diff --git a/iNaturalist/src/main/java/org/inaturalist/android/CommentsIdsAdapter.java b/iNaturalist/src/main/java/org/inaturalist/android/CommentsIdsAdapter.java index 4c9fb99c..75a835ad 100644 --- a/iNaturalist/src/main/java/org/inaturalist/android/CommentsIdsAdapter.java +++ b/iNaturalist/src/main/java/org/inaturalist/android/CommentsIdsAdapter.java @@ -542,10 +542,20 @@ public static String formatIdDate(Context context, Timestamp postDate, BetterJSO // Only show month/year for observations that you don't own + obscured/private INaturalistApp app = (INaturalistApp) context.getApplicationContext(); String currentUser = app.currentUserLogin(); + String obsUser = null; + + if (observation != null) { + if (observation.getJSONObject("user") != null && + observation.getJSONObject("user").has("login")) { + obsUser = observation.getJSONObject("user").optString("login"); + } else { + obsUser = observation.getString("user_login"); + } + } boolean obsByUser = observation != null && currentUser != null && - observation.getJSONObject("user") != null && - observation.getJSONObject("user").optString("login", "").equals(currentUser); + obsUser != null && + obsUser.equals(currentUser); boolean isPrivateOrObscured = false; if (observation != null) { diff --git a/iNaturalist/src/main/java/org/inaturalist/android/INaturalistApp.java b/iNaturalist/src/main/java/org/inaturalist/android/INaturalistApp.java index 494a19ef..1cd5433d 100644 --- a/iNaturalist/src/main/java/org/inaturalist/android/INaturalistApp.java +++ b/iNaturalist/src/main/java/org/inaturalist/android/INaturalistApp.java @@ -127,6 +127,7 @@ public class INaturalistApp extends MultiDexApplication implements OnMapsSdkInit private long mAppStartTime; private boolean mCalledStartForeground = false; + private String mInstallationID = null; public boolean hasCalledStartForeground() { return mCalledStartForeground; @@ -157,6 +158,10 @@ public void setShownOnboarding(boolean value) { mOnboardingShownBefore = true; } + public String getInstallationID() { + return mInstallationID; + } + @Override public void onMapsSdkInitialized(@NonNull MapsInitializer.Renderer renderer) { switch (renderer) { @@ -328,6 +333,14 @@ public void run() { setShownOnboarding(true); } + String installationID = pref.getString("installation_id", null); + if (installationID == null) { + installationID = UUID.randomUUID().toString(); + pref.edit().putString("installation_id", installationID).apply(); + } + + mInstallationID = installationID; + // Clear out any old cached photos Intent serviceIntent = new Intent(INaturalistService.ACTION_CLEAR_OLD_PHOTOS_CACHE, null, this, INaturalistService.class); INaturalistService.callService(this, serviceIntent); diff --git a/iNaturalist/src/main/java/org/inaturalist/android/INaturalistServiceImplementation.java b/iNaturalist/src/main/java/org/inaturalist/android/INaturalistServiceImplementation.java index 74a92bbe..2fa8cd6d 100644 --- a/iNaturalist/src/main/java/org/inaturalist/android/INaturalistServiceImplementation.java +++ b/iNaturalist/src/main/java/org/inaturalist/android/INaturalistServiceImplementation.java @@ -5864,6 +5864,7 @@ private JSONArray request(String url, String method, ArrayList