From 9ca9cca33d2b7961cd00f43608ee6c2d8b97d7f2 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Tue, 22 Dec 2020 13:42:26 -0500 Subject: [PATCH] restore dm indicator, release prep, partially address #431 --- app/build.gradle | 4 +- .../fragments/FollowViewerFragment.java | 3 +- .../instagrabber/utils/ResponseBodyUtils.java | 7 ++- .../layout/dialog_post_layout_preferences.xml | 44 +++++++++++++++---- 4 files changed, 45 insertions(+), 13 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3e81b904..e0d766c3 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { minSdkVersion 21 targetSdkVersion 29 - versionCode 54 - versionName '19.0.2' + versionCode 55 + versionName '19.0.3' multiDexEnabled true diff --git a/app/src/main/java/awais/instagrabber/fragments/FollowViewerFragment.java b/app/src/main/java/awais/instagrabber/fragments/FollowViewerFragment.java index 4da57ca4..260b5da5 100644 --- a/app/src/main/java/awais/instagrabber/fragments/FollowViewerFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/FollowViewerFragment.java @@ -249,8 +249,8 @@ public final class FollowViewerFragment extends Fragment implements SwipeRefresh loading = true; setSubtitle(R.string.followers_compare); allFollowing.clear(); - binding.swipeRefreshLayout.setRefreshing(true); if (moreAvailable) { + binding.swipeRefreshLayout.setRefreshing(true); Toast.makeText(getContext(), R.string.follower_start_compare, Toast.LENGTH_LONG).show(); friendshipService.getList(isFollowersList, profileId, @@ -258,6 +258,7 @@ public final class FollowViewerFragment extends Fragment implements SwipeRefresh isFollowersList ? followersFetchCb : followingFetchCb); } else if (followersModels.size() == 0 || followingModels.size() == 0) { + binding.swipeRefreshLayout.setRefreshing(true); Toast.makeText(getContext(), R.string.follower_start_compare, Toast.LENGTH_LONG).show(); friendshipService.getList(!isFollowersList, profileId, diff --git a/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java b/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java index 8739f0c9..ad38dbb2 100644 --- a/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java +++ b/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java @@ -27,6 +27,8 @@ import awais.instagrabber.models.enums.RavenExpiringMediaType; import awais.instagrabber.models.enums.RavenMediaViewType; import awaisomereport.LogCollector; +import static awais.instagrabber.utils.Utils.settingsHelper; + public final class ResponseBodyUtils { private static final String TAG = "ResponseBodyUtils"; @@ -261,7 +263,10 @@ public final class ResponseBodyUtils { final String threadPrevCursor = data.has("prev_cursor") ? data.getString("prev_cursor") : null; final boolean threadHasOlder = data.getBoolean("has_older"); - final long unreadCount = data.optLong("read_state", 0); + + final String cookie = settingsHelper.getString(Constants.COOKIE); + final String userIdFromCookie = CookieUtils.getUserIdFromCookie(cookie); + final long unreadCount = data.getJSONObject("last_seen_at").getJSONObject(userIdFromCookie).getString("item_id").equals(threadNewestCursor) ? 0 : 1; final long lastActivityAt = data.optLong("last_activity_at"); final boolean named = data.optBoolean("named"); diff --git a/app/src/main/res/layout/dialog_post_layout_preferences.xml b/app/src/main/res/layout/dialog_post_layout_preferences.xml index 7bf0eefc..43f49b1d 100644 --- a/app/src/main/res/layout/dialog_post_layout_preferences.xml +++ b/app/src/main/res/layout/dialog_post_layout_preferences.xml @@ -21,11 +21,14 @@