Skip to content

Commit

Permalink
#1349 - further fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
budowski committed Aug 18, 2024
1 parent 7f9894d commit 3536b59
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,8 @@ private void refreshFavorites() {
mRemoveFavorite.setVisibility(View.GONE);
}

mFavoritesAdapter = new FavoritesAdapter(getActivity(), mFavorites, new BetterJSONObject(mObsJson));
mFavoritesAdapter = new FavoritesAdapter(getActivity(), mFavorites,
mObsJson != null ? new BetterJSONObject(mObsJson) : new BetterJSONObject(mObservation.toJSONObject()));
mFavoritesList.setAdapter(mFavoritesAdapter);

mRemoveFavorite.setOnClickListener(new OnClickListener() {
Expand Down

0 comments on commit 3536b59

Please sign in to comment.