Skip to content

Commit

Permalink
MM-1388 - Geo reinitalization handled. Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
tjuric committed Mar 13, 2017
1 parent 40ed906 commit 4ded153
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
import java.util.concurrent.TimeUnit;
import java.util.regex.PatternSyntaxException;

import static com.google.android.gms.location.GeofenceStatusCodes.GEOFENCE_NOT_AVAILABLE;

/**
* @author pandric
* @since 24.06.2016.
Expand All @@ -62,7 +60,7 @@ class GeoAreasHandler {
}};

private static SparseArray<String> geofencingErrors = new SparseArray<String>() {{
put(GEOFENCE_NOT_AVAILABLE, "Geofence not available");
put(GeofenceStatusCodes.GEOFENCE_NOT_AVAILABLE, "Geofence not available");
put(GeofenceStatusCodes.GEOFENCE_TOO_MANY_GEOFENCES, "Too many geofences");
put(GeofenceStatusCodes.GEOFENCE_TOO_MANY_PENDING_INTENTS, "Too many pending intents");
}};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ public void removeExpiredAreasFromStorage() {
}
}

messageStoreForGeo.deleteByIds(context, messageIdsToDelete.toArray(new String[]{}));
if (!messageIdsToDelete.isEmpty()) {
messageStoreForGeo.deleteByIds(context, messageIdsToDelete.toArray(new String[]{}));
}
}

@SuppressWarnings("WeakerAccess")
Expand Down Expand Up @@ -217,10 +219,9 @@ private static Date calculateNextCheckDateForGeoExpiry(Geo geo, Date oldCheckDat

if (expiryDate.before(now)) {
return now;

} else {
return expiryDate;
}

return expiryDate;
}

@SuppressWarnings("MissingPermission")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class GeofencingConsistencyReceiver extends WakefulBroadcastReceiver {

public static final String NETWORK_PROVIDER_ENABLED_ACTION = "org.infobip.mobile.messaging.geo.intent.NETWORK_PROVIDER_ENABLED";
public static final String SCHEDULED_GEO_REFRESH_ACTION = "org.infobip.mobile.messaging.geo.intent.SCHEDULED_GEO_REFRESH";
public static final String SCHEDULED_GEO_EXPIRE_ACTION = "org.infobip.mobile.messaging.geo.intent.SCHEDULED_GEO_EXPIRE_ACTION";
public static final String SCHEDULED_GEO_EXPIRE_ACTION = "org.infobip.mobile.messaging.geo.intent.SCHEDULED_GEO_EXPIRE";

@Override
public void onReceive(final Context context, final Intent intent) {
Expand Down

0 comments on commit 4ded153

Please sign in to comment.