@@ -159,7 +159,7 @@ public void onComplete(DatabaseError error, DatabaseReference ref) {
159159 } else {
160160 Log .d (TAG , "No value passed to push: " + newPath );
161161 WritableMap res = Arguments .createMap ();
162- res .putString ("result " , "success" );
162+ res .putString ("status " , "success" );
163163 res .putString ("ref" , newPath );
164164 callback .invoke (null , res );
165165 }
@@ -180,7 +180,7 @@ public void on(final String path,
180180 }
181181
182182 WritableMap resp = Arguments .createMap ();
183- resp .putString ("result " , "success" );
183+ resp .putString ("status " , "success" );
184184 resp .putString ("handle" , path );
185185 callback .invoke (null , resp );
186186 }
@@ -205,13 +205,31 @@ public void onOnce(final String path,
205205 public void off (
206206 final String path ,
207207 final String modifiersString ,
208- @ Deprecated final String name ,
208+ final String name ,
209209 final Callback callback ) {
210- this .removeDBHandle (path , modifiersString );
210+
211+ String key = this .getDBListenerKey (path , modifiersString );
212+ FirestackDatabaseReference r = mDBListeners .get (key );
213+
214+ if (r != null ) {
215+ if (name == null || "" .equals (name )) {
216+ r .cleanup ();
217+ mDBListeners .remove (key );
218+ } else {
219+ //TODO: Remove individual listeners as per iOS code
220+ //1) Remove event handler
221+ //2) If no more listeners, remove from listeners map
222+ r .cleanup ();
223+ mDBListeners .remove (key );
224+ }
225+ }
226+
211227 Log .d (TAG , "Removed listener " + path + "/" + modifiersString );
212228 WritableMap resp = Arguments .createMap ();
213229 resp .putString ("handle" , path );
214- resp .putString ("result" , "success" );
230+ resp .putString ("status" , "success" );
231+ resp .putString ("modifiersString" , modifiersString );
232+ //TODO: Remaining listeners
215233 callback .invoke (null , resp );
216234 }
217235
@@ -304,14 +322,4 @@ private FirestackDatabaseReference getDBHandle(final String path,
304322 private String getDBListenerKey (String path , String modifiersString ) {
305323 return path + " | " + modifiersString ;
306324 }
307-
308- private void removeDBHandle (final String path , String modifiersString ) {
309- String key = this .getDBListenerKey (path , modifiersString );
310- FirestackDatabaseReference r = mDBListeners .get (key );
311-
312- if (r != null ) {
313- r .cleanup ();
314- mDBListeners .remove (key );
315- }
316- }
317325}
0 commit comments