diff --git a/app/src/main/java/awais/instagrabber/fragments/settings/StoriesPreferencesFragment.java b/app/src/main/java/awais/instagrabber/fragments/settings/StoriesPreferencesFragment.java
index 8337f7c3..99eee7c7 100644
--- a/app/src/main/java/awais/instagrabber/fragments/settings/StoriesPreferencesFragment.java
+++ b/app/src/main/java/awais/instagrabber/fragments/settings/StoriesPreferencesFragment.java
@@ -37,6 +37,14 @@ public class StoriesPreferencesFragment extends BasePreferencesFragment {
return preference;
}
+ private Preference getHideMutedReelsPreference(@NonNull final Context context) {
+ final SwitchPreferenceCompat preference = new SwitchPreferenceCompat(context);
+ preference.setKey(Constants.HIDE_MUTED_REELS);
+ preference.setTitle(R.string.hide_muted_reels_setting);
+ preference.setIconSpaceReserved(false);
+ return preference;
+ }
+
private Preference getMarkStoriesSeenPreference(@NonNull final Context context) {
final SwitchPreferenceCompat preference = new SwitchPreferenceCompat(context);
preference.setKey(Constants.MARK_AS_SEEN);
diff --git a/app/src/main/java/awais/instagrabber/utils/Constants.java b/app/src/main/java/awais/instagrabber/utils/Constants.java
index f6da0362..d305010b 100644
--- a/app/src/main/java/awais/instagrabber/utils/Constants.java
+++ b/app/src/main/java/awais/instagrabber/utils/Constants.java
@@ -28,6 +28,7 @@ public final class Constants {
public static final String CUSTOM_DATE_TIME_FORMAT_ENABLED = "data_time_custom_enabled";
public static final String SWAP_DATE_TIME_FORMAT_ENABLED = "swap_date_time_enabled";
public static final String MARK_AS_SEEN = "mark_as_seen";
+ public static final String HIDE_MUTED_REELS = "hide_muted_reels";
public static final String DM_MARK_AS_SEEN = "dm_mark_as_seen";
// deprecated: public static final String INSTADP = "instadp";
// deprecated: public static final String STORIESIG = "storiesig";
diff --git a/app/src/main/java/awais/instagrabber/utils/SettingsHelper.java b/app/src/main/java/awais/instagrabber/utils/SettingsHelper.java
index 9ae6cfd4..7b89597d 100755
--- a/app/src/main/java/awais/instagrabber/utils/SettingsHelper.java
+++ b/app/src/main/java/awais/instagrabber/utils/SettingsHelper.java
@@ -38,6 +38,7 @@ import static awais.instagrabber.utils.Constants.DOWNLOAD_USER_FOLDER;
import static awais.instagrabber.utils.Constants.FLAG_SECURE;
import static awais.instagrabber.utils.Constants.FOLDER_PATH;
import static awais.instagrabber.utils.Constants.FOLDER_SAVE_TO;
+import static awais.instagrabber.utils.Constants.HIDE_MUTED_REELS;
import static awais.instagrabber.utils.Constants.KEYWORD_FILTERS;
import static awais.instagrabber.utils.Constants.MARK_AS_SEEN;
import static awais.instagrabber.utils.Constants.MUTED_VIDEOS;
@@ -162,7 +163,7 @@ public final class SettingsHelper {
@StringDef({DOWNLOAD_USER_FOLDER, FOLDER_SAVE_TO, AUTOPLAY_VIDEOS, SHOW_QUICK_ACCESS_DIALOG, MUTED_VIDEOS,
SHOW_CAPTIONS, CUSTOM_DATE_TIME_FORMAT_ENABLED, MARK_AS_SEEN, DM_MARK_AS_SEEN, CHECK_ACTIVITY,
CHECK_UPDATES, SWAP_DATE_TIME_FORMAT_ENABLED, PREF_ENABLE_DM_NOTIFICATIONS, PREF_ENABLE_DM_AUTO_REFRESH,
- FLAG_SECURE, TOGGLE_KEYWORD_FILTER, PREF_ENABLE_SENTRY})
+ FLAG_SECURE, TOGGLE_KEYWORD_FILTER, PREF_ENABLE_SENTRY, HIDE_MUTED_REELS})
public @interface BooleanSettings {}
@StringDef({PREV_INSTALL_VERSION, BROWSER_UA_CODE, APP_UA_CODE, PREF_ENABLE_DM_AUTO_REFRESH_FREQ_NUMBER})
diff --git a/app/src/main/java/awais/instagrabber/webservices/StoriesService.java b/app/src/main/java/awais/instagrabber/webservices/StoriesService.java
index 9b47839b..5901ad7b 100644
--- a/app/src/main/java/awais/instagrabber/webservices/StoriesService.java
+++ b/app/src/main/java/awais/instagrabber/webservices/StoriesService.java
@@ -137,7 +137,7 @@ public class StoriesService extends BaseService {
final JSONArray feedStoriesReel = new JSONObject(body).getJSONArray("tray");
for (int i = 0; i < feedStoriesReel.length(); ++i) {
final JSONObject node = feedStoriesReel.getJSONObject(i);
- if (node.optBoolean("hide_from_feed_unit")) continue;
+ if (node.optBoolean("hide_from_feed_unit") && Utils.settingsHelper.getBoolean(Constants.HIDE_MUTED_REELS)) continue;
final JSONObject userJson = node.getJSONObject(node.has("user") ? "user" : "owner");
try {
final User user = new User(userJson.getLong("pk"),
@@ -179,17 +179,22 @@ public class StoriesService extends BaseService {
null,
null
);
- final String id = node.getString("id");
final long timestamp = node.getLong("latest_reel_media");
- final int mediaCount = node.getInt("media_count");
final boolean fullyRead = !node.isNull("seen") && node.getLong("seen") == timestamp;
final JSONObject itemJson = node.has("items") ? node.getJSONArray("items").optJSONObject(0) : null;
- final boolean isBestie = node.optBoolean("has_besties_media", false);
StoryModel firstStoryModel = null;
if (itemJson != null) {
firstStoryModel = ResponseBodyUtils.parseStoryItem(itemJson, false, null);
}
- feedStoryModels.add(new FeedStoryModel(id, user, fullyRead, timestamp, firstStoryModel, mediaCount, false, isBestie));
+ feedStoryModels.add(new FeedStoryModel(
+ node.getString("id"),
+ user,
+ fullyRead,
+ timestamp,
+ firstStoryModel,
+ node.getInt("media_count"),
+ false,
+ node.optBoolean("has_besties_media")));
}
catch (Exception e) {} // to cover promotional reels with non-long user pk's
}
@@ -242,13 +247,16 @@ public class StoriesService extends BaseService {
null,
null
);
- final String id = node.getString("id");
- final long timestamp = node.getLong("published_time");
- // final JSONObject itemJson = node.has("items") ? node.getJSONArray("items").getJSONObject(0) : null;
- final StoryModel firstStoryModel = ResponseBodyUtils.parseBroadcastItem(node);
- // if (itemJson != null) {
- // }
- feedStoryModels.add(new FeedStoryModel(id, user, false, timestamp, firstStoryModel, 1, true, false));
+ feedStoryModels.add(new FeedStoryModel(
+ node.getString("id"),
+ user,
+ false,
+ node.getLong("published_time"),
+ ResponseBodyUtils.parseBroadcastItem(node),
+ 1,
+ true,
+ false
+ ));
}
callback.onSuccess(sort(feedStoryModels));
} catch (JSONException e) {
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index ab8c25f3..ac325b4a 100755
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -28,6 +28,7 @@
Download posts to username folders
Mark stories as seen after viewing
Story author will know you viewed it
+ Hide muted stories from feed
Mark DM as seen after viewing
Other members will know you viewed it
Enable activity notifications