Please, tell us how to recreate the issue in as much detail as possible.
Describe the steps to reproduce it.
When trying to set cookies in app.module.ts, runtime error thrown. See stack trace below:
SocketIOModule.forRoot(<url_value>, { debug: true, cookie: ["<name>=<value>; Domain=<domain_value>; Path=/; Expires=<expiration_time>"], forceNew: true, forceWebsockets: true, secure: true })
System.err: An uncaught Exception occurred on "main" thread.
System.err: Calling js method call failed
System.err: Error: Cannot convert array to Ljava/lang/Object; at index 0
System.err: StackTrace:
System.err: Frame: function:'call', file:'file:///node_modules/nativescript-socketio/socketio.js:75:0
System.err: at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: at com.tns.Runtime.access$2300(Runtime.java:34)
System.err: at com.tns.Runtime$3.run(Runtime.java:1263)
System.err: at android.os.Handler.handleCallback(Handler.java:739)
System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
System.err: at android.os.Looper.loop(Looper.java:145)
System.err: at android.app.ActivityThread.main(ActivityThread.java:6134)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at java.lang.reflect.Method.invoke(Method.java:372)
System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Is there any code involved?
See above.
The issue is that const list = new java.util.ArrayList(); list.add(cookies); is unable to convert the JS array to the Java ArrayList.
Needs to change to something like: const list = new java.util.ArrayList(java.util.Arrays.asList(cookies));
Make sure to check the demo app(s) for sample usage
Done.
Make sure to check the existing issues in this repository
This relates to issue #91. Once that issue is fixed, I get a runtime error "System.err: Error: Cannot convert array to Ljava/lang/Object;"
If the demo apps cannot help and 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?
Please, provide the following version numbers that your issue occurs with:
"dependencies": { "@angular/animations": "~8.2.6", "@angular/common": "~8.2.6", "@angular/compiler": "~8.2.6", "@angular/core": "~8.2.6", "@angular/forms": "~8.2.6", "@angular/http": "8.0.0-beta.10", "@angular/platform-browser": "~8.2.6", "@angular/platform-browser-dynamic": "~8.2.6", "@angular/router": "~8.2.6", "@owen-it/nativescript-uuid": "0.0.4", "ajv": "^6.10.2", "base-64": "^0.1.0", "lodash": "^4.17.15", "nativescript-angular": "^8.2.1", "nativescript-appversion": "^1.4.2", "nativescript-facebook": "^4.2.1", "nativescript-purchase": "^2.0.13", "nativescript-ratings": "^1.0.1", "nativescript-socketio": "^3.3.1", "nativescript-store-update": "^1.0.2", "nativescript-theme-core": "^2.0.20", "nativescript-webview-interface": "^1.4.3", "reflect-metadata": "~0.1.13", "rxjs": "^6.5.3", "tns-core-modules": "^6.1.1", "utf8": "^3.0.0", "zone.js": "^0.10.2" }, "devDependencies": { "@angular/cli": "^8.3.4", "@angular/compiler-cli": "~8.2.6", "@nativescript/schematics": "~0.7.1", "@ngtools/webpack": "~8.3.4", "@types/lodash": "^4.14.138", "@types/node": "^12.7.5", "jasmine": "^3.4.0", "nativescript-dev-webpack": "^1.2.0", "tns-platform-declarations": "6.1.1", "node-sass": "4.13.0", "typescript": "~3.5.3" }
Please, tell us how to recreate the issue in as much detail as possible.
Describe the steps to reproduce it. When trying to set cookies in app.module.ts, runtime error thrown. See stack trace below:
SocketIOModule.forRoot(<url_value>, { debug: true, cookie: ["<name>=<value>; Domain=<domain_value>; Path=/; Expires=<expiration_time>"], forceNew: true, forceWebsockets: true, secure: true })
Is there any code involved?
See above.
The issue is that
const list = new java.util.ArrayList(); list.add(cookies);
is unable to convert the JS array to the Java ArrayList.Needs to change to something like:
const list = new java.util.ArrayList(java.util.Arrays.asList(cookies));
Easy fix. Sending a PR.