Coder Social home page Coder Social logo

nativescript / tns-core-modules-widgets Goto Github PK

View Code? Open in Web Editor NEW
12.0 28.0 19.0 1.97 MB

Repo for widgets used in NativeScript modules

License: Apache License 2.0

Java 96.18% Shell 0.77% Objective-C 3.05%
nativescript android ios mobile widgets core modules

tns-core-modules-widgets's Introduction

This repository is deprecated in favor of NativeScirpt/NativeScript/tns-core-modules-widgets.

NativeScript Core Modules Widgets

Build Status

This repository contains the source code of the tns-core-modules-widgets library. This library represents native code (Java and Objective-C) used by the NativeScript core modules.

NativeScript is a framework which enables developers to write truly native mobile applications for Android and iOS using JavaScript and CSS.

Contribute

We love PRs! Check out the contributing guidelines and development workflow for local setup. If you want to contribute, but you are not sure where to start - look for issues labeled help wanted.

Get Help

Please, use github issues strictly for reporting bugs or requesting features. For general questions and support, check out the NativeScript community forum or ask our experts in NativeScript community Slack channel.

tns-core-modules-widgets's People

Contributors

adjenkov avatar atanasovg avatar ddfreiling avatar dicksmith avatar dtopuzov avatar enchev avatar etabakov avatar hamdiwanis avatar hamorphis avatar hdeshev avatar jasssonpet avatar manoldonev avatar martoyankov avatar nathanaela avatar nathanwalker avatar panayotcankov avatar petekanev avatar plamen5kov avatar reinaldorauch avatar svetoslavtsenov avatar tbozhikov avatar tgpetrov avatar tzraikov avatar vchimev avatar vladimiramiorkov avatar vtrifonov avatar vultix avatar zh-m avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tns-core-modules-widgets's Issues

caused by: UIImage.tns_safeImageNamed is not a function on iOS 10 with simulator

my app was running with android fine, but with iOS 10 with simulator, I got the following error, looks it's may related to UIImage of ios, any suggestion for fixing it?

detail error log as below.

eb 1 15:20:13 L500176 yourapp[23699]: CONSOLE ERROR file:///app/tns_modules/@angular/core/bundles/core.umd.js:2837:32: EXCEPTION: Uncaught (in promise): Error: Error in /Users/youraccountidyouraccountid/Library/Developer/CoreSimulator/Devices/567EE584-1A1D-4AB1-BB79-38D59B350E9A/data/Containers/Bundle/Application/7EB6CCC6-5905-4335-AB88-2602D29E35F7/yourapp.app/app/login/login.html:2:8 caused by: UIImage.tns_safeImageNamed is not a function. (In 'UIImage.tns_safeImageNamed(name)', 'UIImage.tns_safeImageNamed' is undefined)
Feb 1 15:20:13 L500176 yourapp[23699]: CONSOLE ERROR file:///app/tns_modules/@angular/core/bundles/core.umd.js:2842:36: ORIGINAL STACKTRACE:
Feb 1 15:20:13 L500176 yourapp[23699]: CONSOLE ERROR file:///app/tns_modules/@angular/core/bundles/core.umd.js:2843:36: resolvePromise@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:416:40
resolvePromise@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:401:31
file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:449:31
invokeTask@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:223:42
onInvokeTask@file:///app/tns_modules/@angular/core/bundles/core.umd.js:5966:51
invokeTask@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:222:54
runTask@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:123:57
drainMicroTaskQueue@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:355:42
promiseReactionJob@[native code]
UIApplicationMain@[native code]
start@file:///app/tns_modules/application/application.js:251:30
bootstrapApp@file:///app/tns_modules/nativescript-angular/platform-common.js:67:26
bootstrapModule@file:///app/tns_modules/nativescript-angular/platform-common.js:55:26
anonymous@file:///app/main.js:25:57
evaluate@[native code]
moduleEvaluation@[native code]
[native code]
promiseReactionJob@[native code]
Feb 1 15:20:13 L500176 yourapp[23699]: CONSOLE ERROR file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:342:26: Unhandled Promise rejection: Error in /Users/youraccountid/Library/Developer/CoreSimulator/Devices/567EE584-1A1D-4AB1-BB79-38D59B350E9A/data/Containers/Bundle/Application/7EB6CCC6-5905-4335-AB88-2602D29E35F7/yourapp.app/app/login/login.html:2:8 caused by: UIImage.tns_safeImageNamed is not a function. (In 'UIImage.tns_safeImageNamed(name)', 'UIImage.tns_safeImageNamed' is undefined) ; Zone: angular ; Task: Promise.then ; Value: Error: Error in /Users/youraccountid/Library/Developer/CoreSimulator/Devices/567EE584-1A1D-4AB1-BB79-38D59B350E9A/data/Containers/Bundle/Application/7EB6CCC6-5905-4335-AB88-2602D29E35F7/yourapp.app/app/login/login.html:2:8 caused by: UIImage.tns_safeImageNamed is not a function. (In 'UIImage.tns_safeImageNamed(name)', 'UIImage.tns_safeImageNamed' is undefined) loadFromResource@file:///app/tns_modules/image-source/image-source.js:22:46
_createImageSourceFromSrc@file:///app/tns_modules/ui/image/image-common.js:120:48
onSrcPropertyChanged@file:///app/tns_modules/ui/image/image-common.js:21:36
_onPropertyChanged@file:///app/tns_modules/ui/core/dependency-observable.js:213:25
_onPropertyChanged@file:///app/tns_modules/ui/core/bindable.js:73:49
_onPropertyChanged@file:///app/tns_modules/ui/core/proxy.js:45:49
_onPropertyChanged@file:///app/tns_modules/ui/core/view-common.js:772:49
_setValueInternal@file:///app/tns_modules/ui/core/dependency-observable.js:307:36
_setValue@file:///app/tns_modules/ui/core/dependency-observable.js:133:31
set@file:///app/tns_modules/ui/image/image-common.js:43:27
setPropertyInternal@file:///app/tns_modules/nativescript-angular/view-util.js:217:17
setProperty@file:///app/tns_modules/nativescript-angular/view-util.js:198:37
setElementProperty@file:///app/tns_modules/nativescript-angular/renderer.js:154:34
setElementAttribute@file:///app/tns_modules/nativescript-angular/renderer.js:159:39
createRenderElement@file:///app/tns_modules/@angular/core/bundles/core.umd.js:4973:41
createInternal
create@file:///app/tns_modules/@angular/core/bundles/core.umd.js:9396:52
createInternal
createHostView@file:///app/tns_modules/@angular/core/bundles/core.umd.js:9407:60
createComponent@file:///app/tns_modules/@angular/core/bundles/core.umd.js:7129:55
activateOnGoForward@file:///app/tns_modules/nativescript-angular/router/page-router-outlet.js:146:74
activate@file:///app/tns_modules/nativescript-angular/router/page-router-outlet.js:135:37
placeComponentIntoOutlet@file:///app/tns_modules/@angular/router/bundles/router.umd.js:3178:28
activateRoutes@file:///app/tns_modules/@angular/router/bundles/router.umd.js:3152:50
file:///app/tns_modules/@angular/router/bundles/router.umd.js:3107:76
forEach@[native code]
activateChildRoutes@file:///app/tns_modules/@angular/router/bundles/router.umd.js:3107:40
activate@file:///app/tns_modules/@angular/router/bundles/router.umd.js:3093:37
file:///app/tns_modules/@angular/router/bundles/router.umd.js:2818:68
file:///app/tns_modules/rxjs/Observable.js:108:25
__tryOrSetError@file:///app/tns_modules/rxjs/Subscriber.js:232:20
next@file:///app/tns_modules/rxjs/Subscriber.js:174:42
_next@file:///app/tns_modules/rxjs/Subscriber.js:125:30
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:133:34
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
_complete@file:///app/tns_modules/rxjs/operator/reduce.js:105:34
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27
_complete@file:///app/tns_modules/rxjs/operator/mergeMap.js:125:38
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27
_subscribe@file:///app/tns_modules/rxjs/observable/ArrayObservable.js:116:32
subscribe@file:///app/tns_modules/rxjs/Observable.js:56:37
subscribe@file:///app/tns_modules/rxjs/Observable.js:53:26
subscribe@file:///app/tns_modules/rxjs/Observable.js:53:26
subscribe@file:///app/tns_modules/rxjs/Observable.js:53:26
_innerSub@file:///app/tns_modules/rxjs/operator/mergeMap.js:120:55
_tryNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:117:23
_next@file:///app/tns_modules/rxjs/operator/mergeMap.js:100:26
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:133:34
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
notifyComplete@file:///app/tns_modules/rxjs/operator/every.js:47:30
_complete@file:///app/tns_modules/rxjs/operator/every.js:64:28
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27
_complete@file:///app/tns_modules/rxjs/operator/mergeMap.js:125:38
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27
_subscribe@file:///app/tns_modules/rxjs/observable/ArrayObservable.js:116:32
subscribe@file:///app/tns_modules/rxjs/Observable.js:56:37
subscribe@file:///app/tns_modules/rxjs/Observable.js:53:26
subscribe@file:///app/tns_modules/rxjs/Observable.js:53:26
subscribe@file:///app/tns_modules/rxjs/Observable.js:53:26
_innerSub@file:///app/tns_modules/rxjs/operator/mergeMap.js:120:55
_tryNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:117:23
_next@file:///app/tns_modules/rxjs/operator/mergeMap.js:100:26
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:133:34
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
_subscribe@file:///app/tns_modules/rxjs/observable/ScalarObservable.js:49:28
subscribe@file:///app/tns_modules/rxjs/Observable.js:56:37
subscribe@file:///app/tns_modules/rxjs/Observable.js:53:26
_innerSub@file:///app/tns_modules/rxjs/operator/mergeMap.js:120:55
_tryNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:117:23
_next@file:///app/tns_modules/rxjs/operator/mergeMap.js:100:26
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
_next@file:///app/tns_modules/rxjs/Subscriber.js:125:30
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23
_complete@file:///app/tns_modules/rxjs/operator/last.js:109:29
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27
_complete@file:///app/tns_modules/rxjs/operator/mergeAll.js:94:38
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27
_subscribe@file:///app/tns_modules/rxjs/observable/ScalarObservable.js:51:36
subscribe@file:///app/tns_modules/rxjs/Observable.js:56:37
subscribe@file:///app/tns_modules/rxjs/Observable.js:53:26
subscribe@file:///app/tns_modules/rxjs/Observable.js:53:26
subscribe@file:///app/tns_modules/rxjs/Observable.js:53:26
subscribe@file:///app/tns_modules/rxjs/Observable.js:53:26
subscribe@file:///app/tns_modules/rxjs/Observable.js:53:26
subscribe@file:///app/tns_modules/rxjs/Observable.js:53:26
subscribe@file:///app/tns_modules/rxjs/Observable.js:53:26
subscribe@file:///app/tns_modules/rxjs/Observable.js:53:26
subscribe@file:///app/tns_modules/rxjs/Observable.js:53:26
subscribe@file:///app/tns_modules/rxjs/Observable.js:53:26
subscribe@file:///app/tns_modules/rxjs/Observable.js:53:26
file:///app/tns_modules/rxjs/Observable.js:87:47
ZoneAwarePromise@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:465:37
forEach@file:///app/tns_modules/rxjs/Observable.js:86:31
file:///app/tns_modules/@angular/router/bundles/router.umd.js:2800:29
ZoneAwarePromise@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:465:37
runNavigate@file:///app/tns_modules/@angular/router/bundles/router.umd.js:2739:31
invoke@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:190:33
onInvoke@file:///app/tns_modules/@angular/core/bundles/core.umd.js:5975:47
invoke@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:189:42
run@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:83:49
file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:449:60
invokeTask@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:223:42
onInvokeTask@file:///app/tns_modules/@angular/core/bundles/core.umd.js:5966:51
invokeTask@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:222:54
runTask@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:123:57
drainMicroTaskQueue@file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:355:42
promiseReactionJob@[native code]
UIApplicationMain@[native code]
start@file:///app/tns_modules/application/application.js:251:30
bootstrapApp@file:///app/tns_modules/nativescript-angular/platform-common.js:67:26
bootstrapModule@file:///app/tns_modules/nativescript-angular/platform-common.js:55:26
anonymous@file:///app/main.js:25:57
evaluate@[native code]
moduleEvaluation@[native code]
[native code]
promiseReactionJob@[native code]
Feb 1 15:20:13 L500176 yourapp[23699]: CONSOLE ERROR file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:344:22: Error: Uncaught (in promise): Error: Error in /Users/youraccountid/Library/Developer/CoreSimulator/Devices/567EE584-1A1D-4AB1-BB79-38D59B350E9A/data/Containers/Bundle/Application/7EB6CCC6-5905-4335-AB88-2602D29E35F7/yourapp.app/app/login/login.html:2:8 caused by: UIImage.tns_safeImageNamed is not a function. (In 'UIImage.tns_safeImageNamed(name)', 'UIImage.tns_safeImageNamed' is undefined)

ui/image-cache not downloading in android emulator

I am developing Nativescript app. and displaying image from remote with cache.
It displays image if i directly set url to src.

and if i use ui/image-cahe plugin image gets displayed in device. same code does not download image from server.
my test server works fine. i can access image url. simulator can access to server data. because it is getting image url from server first.
in simulator i gave storage and internet permission.

my log ives me this

JS:  INFO -- 2016-10-20T06:06:16.788Z : Image download request : vznm3jd4l6
JS:  ------- 2016-10-20T06:06:16.788Z :  --> 0 : {"_observers":{},"disableNotifications":{},"maxRequests":5,"_enabled":true,"_pendingDownloads":{"http://mytestserver.com/data/uploads/post/images/57fd9a5dc8c59_temp.png":{"key":"http://mytestserver.com/data/uploads/post/images/57fd9a5dc8c59_temp.png","url":"http://mytestserver.com/data/uploads/post/images/57fd9a5dc8c59_temp.png"}},"_queue":[],"_currentDownloads":1,"_cache":{},"_callback":{},"placeholder":null}
JS:  INFO -- 2016-10-20T06:06:17.147Z :  --> 0 : "from native source "
JS:  INFO -- 2016-10-20T06:06:17.147Z :  --> 1 : {}
JS:  INFO -- 2016-10-20T06:06:17.147Z :  --> 2 : "vznm3jd4l6"
JS:  INFO -- 2016-10-20T06:06:17.147Z : from native source android.graphics.Bitmap@56272bf

I console logged and confirmed download function is being called in JS. and _callback.onComplete is not being called.

     function Cache() {
        _super.call(this);
        ensureLruBitmapCacheClass();
        var maxMemory = java.lang.Runtime.getRuntime().maxMemory() / 1024;
        var cacheSize = maxMemory / 8;
        this._cache = new LruBitmapCacheClass(cacheSize);
        var that = new WeakRef(this);
        this._callback = new org.nativescript.widgets.Async.CompleteCallback({
            onComplete: function (result, context) {
                console.log("_____________________________ asdf5 __ 0");
                var instance = that.get();
                if (instance) {
                    instance._onDownloadCompleted(context, result);
                }
            }
        });
    }
    Cache.prototype._downloadCore = function (request) {
        console.log("_____________________________ asdf4 __ 0")
        org.nativescript.widgets.Async.Image.download(request.url, this._callback, request.key);
    };

How can i can i debug this.

Update build.sh to build under XCode 10

Right now it appears that if you have upgraded to XCode 10, the build scripts encounter this error:

/Users/nathan/Documents/github/NativeScript/tns-core-modules-widgets/ios/TNSWidgets/TNSWidgets/UIView+PassThroughParent.m:9:9: warning: non-portable path to file '"UIView+PassthroughParent.h"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#import "UIView+PassThroughParent.h"
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
        "UIView+PassthroughParent.h"
1 warning generated.
/Users/nathan/Documents/github/NativeScript/tns-core-modules-widgets/ios/TNSWidgets/TNSWidgets/UIView+PassThroughParent.m:9:9: warning: non-portable path to file '"UIView+PassthroughParent.h"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#import "UIView+PassThroughParent.h"
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
        "UIView+PassthroughParent.h"
1 warning generated.
note: Using new build systemnote: Planning buildnote: Constructing build description
Build for iphoneos
/Users/nathan/Documents/github/NativeScript/tns-core-modules-widgets/ios/TNSWidgets/TNSWidgets/UIView+PassThroughParent.m:9:9: warning: non-portable path to file '"UIView+PassthroughParent.h"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#import "UIView+PassThroughParent.h"
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
        "UIView+PassthroughParent.h"
1 warning generated.
/Users/nathan/Documents/github/NativeScript/tns-core-modules-widgets/ios/TNSWidgets/TNSWidgets/UIView+PassThroughParent.m:9:9: warning: non-portable path to file '"UIView+PassthroughParent.h"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#import "UIView+PassThroughParent.h"
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
        "UIView+PassthroughParent.h"
1 warning generated.
note: Using new build systemnote: Planning buildnote: Constructing build description
Build fat framework at TNSWidgets/build/TNSWidgets.framework
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: TNSWidgets/build/Release-iphonesimulator/TNSWidgets.framework/TNSWidgets (No such file or directory)

Bug: Can't Set Cookies with Android Http Module

Did you verify this is a real problem by searching Stack Overflow and the other open issues in this repo?

Yes

Tell us about the problem

Due to CookieManager, cookies set in the options.headers for http.request are ignored.

This leads to different behavior on Android and iOS. This can be fixed by checking the headers for a Cookie key, parsing it, and setting the parsed cookies via the native cookie manager.

Or, alternatively, maybe just by not setting the default cookie manager (maybe with some flag)?

Which platform(s) does your issue occur on?

Android

Please provide the following version numbers that your issue occurs with:

  • CLI: 2.3
  • Cross-platform modules: 2.3
  • Runtime(s): tns-android

Possible memory leak in widgets.Async.Http.MakeRequest

Make sure to check the existing issues in this repository

If there is no issue for your problem, tell us about it

I'm downloading small video files of 2-3mb in size, using http.getFile . After each download, i can see a significant increase in memory usage. In time, this results in OOM. I'm able to trace this problem back to widgets.Async.Http.MakeRequest, but lack of java skills stops me there.

Which platform(s) does your issue occur on?

  • iOS/Android/Both
    Android
  • iOS/Android versions
    7.1.1
  • emulator or device. What type of device?
    Device: General Mobile 4G Android One

Please, provide the following version numbers that your issue occurs with:

  • CLI: 4.0.0
  • Cross-platform modules: 4.0.0
  • Runtime(s): tns-android 4.0.1
  • Plugin(s):
    "dependencies": {
    "nativescript": "^4.0.0",
    "nativescript-exoplayer": "^3.4.1",
    "nativescript-facebook": "^2.2.2",
    "nativescript-oauth": "^2.1.2",
    "nativescript-theme-core": "^1.0.4",
    "nativescript-vue": "^1.3.2-rc.4",
    "tns-core-modules": "^4.0.0",
    "vue-router": "^3.0.1",
    "vuex": "^3.0.1"
    },
    "devDependencies": {
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.4",
    "babel-plugin-transform-async-to-generator": "^6.24.1",
    "babel-plugin-transform-object-rest-spread": "^6.26.0",
    "babel-polyfill": "^6.26.0",
    "babel-preset-env": "^1.6.1",
    "babel-traverse": "6.26.0",
    "babel-types": "6.26.0",
    "babylon": "6.18.0",
    "copy-webpack-plugin": "^4.5.1",
    "css-loader": "^0.28.11",
    "extract-text-webpack-plugin": "^3.0.2",
    "fs-extra": "^5.0.0",
    "lazy": "1.0.11",
    "nativescript-vue-externals": "^0.1.2",
    "nativescript-vue-loader": "^0.1.5",
    "nativescript-vue-target": "^0.1.0",
    "nativescript-vue-template-compiler": "^1.3.2-rc.4",
    "node-sass": "^4.7.2",
    "ns-vue-loader": "^0.1.2",
    "optimize-css-assets-webpack-plugin": "^3.2.0",
    "rimraf": "^2.6.2",
    "sass-loader": "^6.0.7",
    "vue-template-compiler": "^2.5.16",
    "webpack": "^3.11.0",
    "webpack-synchronizable-shell-plugin": "0.0.7",
    "winston-color": "^1.0.0"
    },
    "nativescript": {
    "id": "com.sample.app",
    "tns-android": {
    "version": "4.0.1"
    }
    },
    "android": {
    "v8Flags": "--expose_gc --track_gc_object_stats"
    }

Please, tell us how to recreate the issue in as much detail as possible.

I'm simply calling http.getFile.

== app/game_state.js ==
...
gmu("getVideoFile 1");
await $http.getFile(fileurl, filePath);
gmu("getVideoFile 2");
...

== tns-core-modules/http/http.js ==
function getFile(arg, destinationFilePath) {
    return new Promise(function (resolve, reject) {
        gmu("getfile 1")
        httpRequest.request(typeof arg === "string" ? { url: arg, method: "GET" } : arg)
            .then(function (r) {
            try {
        gmu("getfile 2")


== tns-core-modules/http/http-request/http-request.android.js ==
function request(options) {
        ...
        gmu("request 8")
            org.nativescript.widgets.Async.Http.MakeRequest(javaOptions, completeCallback, new java.lang.Integer(requestIdCounter));
        gmu("request 9")
        ...
}

Memory usage logs are as follows. The significant jump happens upon widgets.Async.Http.MakeRequest resolves at "getfile 2"

'getVideoFile 1 - usedSize: 4773, freeSize: 2048, totalSize: 6821, maxHeapSize: 134217'
'getfile 1' '- usedSize:' 4776 'freeSize:' 2045 'totalSize:' 6821 'maxHeapSize:' 134217
'request 8' '- usedSize:' 4801 'freeSize:' 2020 'totalSize:' 6821 'maxHeapSize:' 134217
'request 9' '- usedSize:' 4804 'freeSize:' 2017 'totalSize:' 6821 'maxHeapSize:' 134217
'getfile 2' '- usedSize:' 11331 'freeSize:' 915 'totalSize:' 12246 'maxHeapSize:' 134217
'getVideoFile 2 - usedSize: 10409, freeSize: 1837, totalSize: 12246, maxHeapSize: 134217'

'getVideoFile 1 - usedSize: 10275, freeSize: 6019, totalSize: 16294, maxHeapSize: 134217'
'getfile 1' '- usedSize:' 10277 'freeSize:' 6017 'totalSize:' 16294 'maxHeapSize:' 134217
'request 8' '- usedSize:' 10305 'freeSize:' 5989 'totalSize:' 16294 'maxHeapSize:' 134217
'request 9' '- usedSize:' 10309 'freeSize:' 5985 'totalSize:' 16294 'maxHeapSize:' 134217
'getfile 2' '- usedSize:' 12443 'freeSize:' 3851 'totalSize:' 16294 'maxHeapSize:' 134217
'getVideoFile 2 - usedSize: 13335, freeSize: 2959, totalSize: 16294, maxHeapSize: 134217'

'getVideoFile 1 - usedSize: 15762, freeSize: 532, totalSize: 16294, maxHeapSize: 134217'
'getfile 1' '- usedSize:' 15769 'freeSize:' 525 'totalSize:' 16294 'maxHeapSize:' 134217
'request 8' '- usedSize:' 15803 'freeSize:' 491 'totalSize:' 16294 'maxHeapSize:' 134217
'request 9' '- usedSize:' 15846 'freeSize:' 448 'totalSize:' 16294 'maxHeapSize:' 134217
'getfile 2' '- usedSize:' 17530 'freeSize:' 5428 'totalSize:' 22958 'maxHeapSize:' 134217
'getVideoFile 2 - usedSize: 18199, freeSize: 4759, totalSize: 22958, maxHeapSize: 134217'

'getVideoFile 1 - usedSize: 40310, freeSize: 11389, totalSize: 51699, maxHeapSize: 134217'
'getfile 1' '- usedSize:' 40313 'freeSize:' 11386 'totalSize:' 51699 'maxHeapSize:' 134217
'request 8' '- usedSize:' 40343 'freeSize:' 11356 'totalSize:' 51699 'maxHeapSize:' 134217
'request 9' '- usedSize:' 40384 'freeSize:' 11315 'totalSize:' 51699 'maxHeapSize:' 134217
'getfile 2' '- usedSize:' 47767 'freeSize:' 3932 'totalSize:' 51699 'maxHeapSize:' 134217
'getVideoFile 2 - usedSize: 48840, freeSize: 2859, totalSize: 51699, maxHeapSize: 134217'

Android crash (usually on launch): An error occured while executing doInBackground()

Make sure to check the existing issues in this repository

If there is no issue for your problem, tell us about it

Please, ensure your title is less than 63 characters long and starts with a capital
letter.

Which platform(s) does your issue occur on?

  • Android
  • Android 5.1+ (minimum version supported by app)
  • Various

Please, provide the following version numbers that your issue occurs with:

  • CLI: 4.2.3 (but prior as well)
  • Cross-platform modules: 4.2.0 (but prior as well)
  • Runtime(s): 4.2.0 (but prior as well)
  • Plugin(s): Many, but maybe related to "nativescript-fresco": "~4.0.0"

Please, tell us how to recreate the issue in as much detail as possible.

From Firebase/Crashlytics:

Fatal Exception: java.lang.RuntimeException
An error occured while executing doInBackground()
org.nativescript.widgets.image.AsyncTask$3.done (AsyncTask.java:326)
java.util.concurrent.FutureTask.finishCompletion (FutureTask.java:354)
java.util.concurrent.FutureTask.setException (FutureTask.java:223)
java.util.concurrent.FutureTask.run (FutureTask.java:242)
org.nativescript.widgets.image.AsyncTask$SerialExecutor$1.run (AsyncTask.java:256)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1113)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:588)
java.lang.Thread.run (Thread.java:818)

Caused by java.lang.IllegalArgumentException
not a directory: /storage/emulated/0/Android/data/com.ugroupmedia.pnp14/cache/http
org.nativescript.widgets.image.DiskLruCache.deleteContents (DiskLruCache.java:257)
org.nativescript.widgets.image.DiskLruCache.delete (DiskLruCache.java:713)
org.nativescript.widgets.image.DiskLruCache.open (DiskLruCache.java:328)
org.nativescript.widgets.image.Fetcher.initDiskCacheInternal (Fetcher.java:92)
org.nativescript.widgets.image.Worker$CacheAsyncTask.doInBackground (Worker.java:502)
org.nativescript.widgets.image.Worker$CacheAsyncTask.doInBackground (Worker.java:493)
org.nativescript.widgets.image.AsyncTask$2.call (AsyncTask.java:313)
java.util.concurrent.FutureTask.run (FutureTask.java:237)
org.nativescript.widgets.image.AsyncTask$SerialExecutor$1.run (AsyncTask.java:256)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1113)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:588)
java.lang.Thread.run (Thread.java:818)

Appears to happen usually on app launch, before any analytics events are logged by Firebase/Crashlytics, but can happen after shallow progress in the app.

An uncaught Exception occurred on "main" thread

Make sure to check the existing issues in this repository

Yes

If there is no issue for your problem, tell us about it

An uncaught Exception occurred on "main" thread.

Which platform(s) does your issue occur on?

Android 4.4.2,6.0.1,7.1.1

Please, provide the following version numbers that your issue occurs with:

  • CLI: (4.2.0)
  • Cross-platform modules: (3.4.0)
  • Runtime(s): (3.4.1)
  • Plugin(s): (
    "dependencies": {
    "nativescript-gif": "^3.1.1",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-vue": "^0.1.1",
    "tns-core-modules": "^3.0.0",
    "vue-router": "^2.4.0"
    },
    "devDependencies": {
    "babel-traverse": "6.24.1",
    "babel-types": "6.24.1",
    "babylon": "6.16.1",
    "lazy": "1.0.11",
    "nativescript-dev-android-snapshot": "^0.."
    }
    )

Please, tell us how to recreate the issue in as much detail as possible.

I have tested a simple movie-brief app from github: https://github.com/HolyZheng/nativescript-vue-build-a-movie-brief-app

Whenever my app turn off and run again, it has crashed and report:

An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to resume activity {org.nativescript.myapp/com.tns.NativeScriptActivity}: com.tns.NativeScriptException:
Calling js method onCreateView failed

Error: View already has a parent. View: Page(13) Parent: Frame(14)
File: "file:///data/data/org.nativescript.myapp/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js, line: 343, column: 12

StackTrace:
Frame: function:'ViewBase._addView', file:'file:///data/data/org.nativescript.myapp/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 343, column: 19
Frame: function:'FragmentCallbacksImplementation.onCreateView', file:'file:///data/data/org.nativescript.myapp/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 504, column: 24
Frame: function:'FragmentClass.onCreateView', file:'file:///data/data/org.nativescript.myapp/files/app/tns_modules/tns-core-modules/ui/frame/fragment.js', line: 27, column: 38

at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3230)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3308)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2587)
at android.app.ActivityThread.access$1200(ActivityThread.java:163)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1441)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: com.tns.NativeScriptException:
Calling js method onCreateView failed

Error: View already has a parent. View: Page(13) Parent: Frame(14)
File: "file:///data/data/org.nativescript.myapp/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js, line: 343, column: 12

StackTrace:
Frame: function:'ViewBase._addView', file:'file:///data/data/org.nativescript.myapp/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 343, column: 19
Frame: function:'FragmentCallbacksImplementation.onCreateView', file:'file:///data/data/org.nativescript.myapp/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 504, column: 24
Frame: function:'FragmentClass.onCreateView', file:'file:///data/data/org.nativescript.myapp/files/app/tns_modules/tns-core-modules/ui/frame/fragment.js', line: 27, column: 38

at com.tns.Runtime.callJSMethodNative(Native Method)
at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088)
at com.tns.Runtime.callJSMethodImpl(Runtime.java:970)
at com.tns.Runtime.callJSMethod(Runtime.java:957)
at com.tns.Runtime.callJSMethod(Runtime.java:941)
at com.tns.Runtime.callJSMethod(Runtime.java:933)
at com.tns.FragmentClass.onCreateView(FragmentClass.java:40)
at android.app.Fragment.performCreateView(Fragment.java:2223)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:973)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1148)
at android.app.BackStackRecord.run(BackStackRecord.java:793)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1535)
at android.app.FragmentController.execPendingActions(FragmentController.java:325)
at android.app.Activity.performResume(Activity.java:6394)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3219)
... 10 more

Is there any code involved?

Yes, the all codes can be gitted clone from github: https://github.com/HolyZheng/nativescript-vue-build-a-movie-brief-app

can not initiate instance of new org.nativescript.widgets.Async.CompleteCallback()

files in my app:

.ts
import * as httpModule from 'http';
....
private getActivityViaHttp() : Promise {
return httpModule.getJSON('http://httpbin.org/ip');
}

result
httpModule.getJSON('http://httpbin.org/ip') returns 'undefined'

debug output
following function failed to execute:

completeCallback = new org.nativescript.widgets.Async.CompleteCallback({ onComplete: function (result, context) { onRequestComplete(context, result); } });

onComplete is never called/executed:
onComplete: function (result, context) { onRequestComplete(context, result);

which, I believe, causes the http call never sent to the server as Fiddler indicated.

Any thoughts on why new org.nativesript.widgets.Async.CompleteCalback() / onRequestComplete(context, result); not executed?

System.err: java.net.UnknownHostException: Unable to resolve host "google.com": No address associated with hostname

From @webleaf on April 6, 2018 8:54

If I use fetch or http with no internet connection, error catched, but also produced System.err.

I try this:

fetch("https://google.com").then(response => {
    console.log(response);
}).catch(function (error) {
    console.log(error);
});

or this:

http.request({ url: "https://google.com", method: "GET" }).then(function (response) {
    console.log(response);
}, function (error) {
    console.log(error);
});

result is the same:

System.err: java.net.UnknownHostException: Unable to resolve host "google.com": No address associated with hostname
System.err: 	at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:125)
System.err: 	at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:74)
System.err: 	at java.net.InetAddress.getAllByName(InetAddress.java:752)
System.err: 	at com.android.okhttp.internal.Network$1.resolveInetAddresses(Network.java:29)
System.err: 	at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:209)
System.err: 	at com.android.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:163)
System.err: 	at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:105)
System.err: 	at com.android.okhttp.internal.http.HttpEngine.createNextConnection(HttpEngine.java:489)
System.err: 	at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:465)
System.err: 	at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:371)
System.err: 	at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:503)
System.err: 	at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:130)
System.err: 	at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.connect(DelegatingHttpsURLConnection.java:89)
System.err: 	at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java)
System.err: 	at org.nativescript.widgets.Async$Http$HttpRequestTask.doInBackground(Async.java:543)
System.err: 	at org.nativescript.widgets.Async$Http$1.run(Async.java:482)
System.err: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
System.err: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
System.err: 	at org.nativescript.widgets.Async$PriorityThreadFactory$1.run(Async.java:52)
System.err: 	at java.lang.Thread.run(Thread.java:762)
System.err: Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
System.err: 	at libcore.io.Posix.android_getaddrinfo(Native Method)
System.err: 	at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:55)
System.err: 	at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:106)
System.err: 	... 19 more
JS: TypeError: Network request failed: java.net.UnknownHostException: Unable to resolve host "google.com": No address associated with hostname

tns --version 3.4.3

Same error will be produced if i try connect WITH Internet connection, but to any really unknown host (like http://jhgadfjgafjasgf.com)
Is it ok? Or how to handle this System.err?
Was tried only for android.

Copied from original issue: NativeScript/android#995

AndroidX support

As discussed i created a branch for AndroidX in my fork here
Can you create an androidx branch so that i can create a PR?

Thanks

http timeout

Hello. In my project, when I want to do a http request and set the timeout option to 3000 and after that time past the call didn't return a exception, it's like still waiting the response. This is the code:

http.request({
url: global.serverJavaURL+"/j_spring_security_check",
method: "POST",
timeout : 1000,
headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" },
content: data
}).then(function (response) {

So I search and found the source of http.request and added a line of code:

connection.setReadTimeout(options.timeout);

I clean and build the project with this modification and trying again my project where I do the http request with the timeout and this time it returns an exception like I expected.

So I think it should be added the change to the class org.nativescript.widgets.Async like this

// apply timeout
if (options.timeout > 0)
{
connection.setConnectTimeout(options.timeout);
connection.setReadTimeout(options.timeout);
}

Like a reference the is a issue that it may be related to this one #2849 https://github.com/NativeScript/NativeScript

java.lang.NumberFormatException when applying clip-path with percentage values

When a component is off-screen and its width and height are zero, we get a java.lang.NumberFormatException when trying to calculate the percentage of the total, since the total is zero:

11-02 14:51:14.658 6351-6351/? W/System.err: java.lang.NumberFormatException: Invalid float: "3%"
11-02 14:51:14.658 6351-6351/? W/System.err:     at java.lang.StringToReal.invalidReal(StringToReal.java:63)
11-02 14:51:14.658 6351-6351/? W/System.err:     at java.lang.StringToReal.initialParse(StringToReal.java:164)
11-02 14:51:14.658 6351-6351/? W/System.err:     at java.lang.StringToReal.parseFloat(StringToReal.java:323)
11-02 14:51:14.658 6351-6351/? W/System.err:     at java.lang.Float.parseFloat(Float.java:306)
11-02 14:51:14.658 6351-6351/? W/System.err:     at org.nativescript.widgets.BorderDrawable.cssValueToDevicePixels(BorderDrawable.java:414)
11-02 14:51:14.658 6351-6351/? W/System.err:     at org.nativescript.widgets.BorderDrawable.drawClipPath(BorderDrawable.java:258)
11-02 14:51:14.658 6351-6351/? W/System.err:     at org.nativescript.widgets.BorderDrawable.draw(BorderDrawable.java:123)

main-page.xml:

<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo">
  <StackLayout>
    <Image width="100" height="100" class="elementStyle"  src="~/files/icon.png"/>
    <Button backgroundColor="blue" class="elementStyle"  text="TAP"  />
    <Label backgroundColor="red" class="elementStyle" text="sample label" textWrap="true"/>
    <TextField backgroundColor="green" class="elementStyle" hint="" text="Sample textfield" />-->
    <TextView  class="elementStyle" text="Sample text view" backgroundColor="yellow" editable="true" />
    <AbsoluteLayout class="container">
    </AbsoluteLayout>
  </StackLayout>
</Page>

app.css:

.container {
    width: 200;
    height: 200;
    clip-path: polygon(50% 2%, 3% 100%, 100% 100%);
    background-color: black;
}
.elementStyle{
    width: 200;
    height: 200;
   clip-path: polygon(50% 3%, 3% 100%, 100% 100%);
}

Build Instructions?

Any build instructions, neither Grunt, nor Gradle have rules to build it...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.