Exemplo n.º 1
0
        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);
                                        });
                                    }
                                }
                            }
                        }
                    }
                });
            }
        }
Exemplo n.º 2
0
        internal void childChanged(DataSnapshot dataSnapshot)
        {
            GeoLocation location = GeoFire.getLocationValue(dataSnapshot);

            if (location != null)
            {
                this.updateLocationInfo(dataSnapshot.Key, location);
            }
            else
            {
                // throw an error in future?
            }
        }
Exemplo n.º 3
0
 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)));
         }
     }
 }