internal void childRemoved(DataSnapshot dataSnapshot) { string key = dataSnapshot.Key; LocationInfo info = GeoUtils.getMapSafe(key, locationInfos); if (info != null) { ValueChangedListenerSetup vs = new ValueChangedListenerSetup(geoFire.getDatabaseRefForKey(key), true, (s) => { if (s.DatabaseError == null) { lock (Lock) { GeoLocation location = GeoFire.getLocationValue(dataSnapshot); GeoHash hash = (location != null) ? new GeoHash(location) : null; if (hash == null || !geoHashQueriesContainGeoHash(hash)) { LocationInfo _info = GeoUtils.getMapSafe(key, locationInfos); locationInfos.Remove(key); if (_info != null && _info.inGeoQuery) { foreach (GeoQueryEventListener listener in eventListeners) { geoFire.raiseEvent(() => { listener.onKeyExited(key); }); } } } } } }); } }
internal void childChanged(DataSnapshot dataSnapshot) { GeoLocation location = GeoFire.getLocationValue(dataSnapshot); if (location != null) { this.updateLocationInfo(dataSnapshot.Key, location); } else { // throw an error in future? } }
public void onDataChange(DataSnapshot dataSnapshot) { if (dataSnapshot.Value == null) { this.callback.onLocationResult(dataSnapshot.Key, null); } else { GeoLocation location = GeoFire.getLocationValue(dataSnapshot); if (location != null) { this.callback.onLocationResult(dataSnapshot.Key, location); } else { string message = "GeoFire data has invalid format: " + dataSnapshot.Value; this.callback.onCancelled(new ExDatabaseError(new Exception(message))); } } }