EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 442 forks source link

firebase.query removeEventlistener onCancelled failed error after firebase.logout #298

Open Florian007 opened 7 years ago

Florian007 commented 7 years ago

Hi, thank you for your super plugin. I'm using it with Angular like in the Giftler app from Jen Looper. Everything works fine, except if I am trying to logout and before did a firebase.query command like:

var results = []; var path = "/companies"; var options = { orderBy: { type: firebase.QueryOrderByType.CHILD, value: 'name' } } let onValueEvent = (snapshot: any) => { this.ngZone.run(() => { results.push(snapshot.value); observer.next([...results]); }); }; var ref = firebase.query(onValueEvent,path,options);

Before logout I remove the EventeListeners successfully with: firebase.removeEventListeners(ref,path).then( () => { console.log("firebase.doRemoveValueEventListenersForCompanies success"); }, (error) => { console.log("firebase.removeEventListeners error."); } );

But after the logout command: firebase.logout();

I get follwing Error (as soon as I don't do that query above, logout works fine again): An uncaught Exception occurred on "main" thread. com.tns.NativeScriptException: Calling js method onCancelled failed

Error: java.lang.AbstractMethodError: abstract method "void com.google.firebase.database.ChildEventListener.onCancelled(com.google.firebase.database.DatabaseError)" com.tns.Runtime.callJSMethodNative(Native Method) com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1197) com.tns.Runtime.callJSMethodImpl(Runtime.java:1061) com.tns.Runtime.callJSMethod(Runtime.java:1047) com.tns.Runtime.callJSMethod(Runtime.java:1028) com.tns.Runtime.callJSMethod(Runtime.java:1018)

Could you please help? Best regards!

adamansky commented 7 years ago

+1