mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-26 08:37:29 +00:00
muted reels behaviour setting
This commit is contained in:
parent
d0e01b3b9b
commit
eb21854ee7
@ -37,6 +37,14 @@ public class StoriesPreferencesFragment extends BasePreferencesFragment {
|
|||||||
return preference;
|
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) {
|
private Preference getMarkStoriesSeenPreference(@NonNull final Context context) {
|
||||||
final SwitchPreferenceCompat preference = new SwitchPreferenceCompat(context);
|
final SwitchPreferenceCompat preference = new SwitchPreferenceCompat(context);
|
||||||
preference.setKey(Constants.MARK_AS_SEEN);
|
preference.setKey(Constants.MARK_AS_SEEN);
|
||||||
|
@ -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 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 SWAP_DATE_TIME_FORMAT_ENABLED = "swap_date_time_enabled";
|
||||||
public static final String MARK_AS_SEEN = "mark_as_seen";
|
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";
|
public static final String DM_MARK_AS_SEEN = "dm_mark_as_seen";
|
||||||
// deprecated: public static final String INSTADP = "instadp";
|
// deprecated: public static final String INSTADP = "instadp";
|
||||||
// deprecated: public static final String STORIESIG = "storiesig";
|
// deprecated: public static final String STORIESIG = "storiesig";
|
||||||
|
@ -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.FLAG_SECURE;
|
||||||
import static awais.instagrabber.utils.Constants.FOLDER_PATH;
|
import static awais.instagrabber.utils.Constants.FOLDER_PATH;
|
||||||
import static awais.instagrabber.utils.Constants.FOLDER_SAVE_TO;
|
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.KEYWORD_FILTERS;
|
||||||
import static awais.instagrabber.utils.Constants.MARK_AS_SEEN;
|
import static awais.instagrabber.utils.Constants.MARK_AS_SEEN;
|
||||||
import static awais.instagrabber.utils.Constants.MUTED_VIDEOS;
|
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,
|
@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,
|
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,
|
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 {}
|
public @interface BooleanSettings {}
|
||||||
|
|
||||||
@StringDef({PREV_INSTALL_VERSION, BROWSER_UA_CODE, APP_UA_CODE, PREF_ENABLE_DM_AUTO_REFRESH_FREQ_NUMBER})
|
@StringDef({PREV_INSTALL_VERSION, BROWSER_UA_CODE, APP_UA_CODE, PREF_ENABLE_DM_AUTO_REFRESH_FREQ_NUMBER})
|
||||||
|
@ -137,7 +137,7 @@ public class StoriesService extends BaseService {
|
|||||||
final JSONArray feedStoriesReel = new JSONObject(body).getJSONArray("tray");
|
final JSONArray feedStoriesReel = new JSONObject(body).getJSONArray("tray");
|
||||||
for (int i = 0; i < feedStoriesReel.length(); ++i) {
|
for (int i = 0; i < feedStoriesReel.length(); ++i) {
|
||||||
final JSONObject node = feedStoriesReel.getJSONObject(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");
|
final JSONObject userJson = node.getJSONObject(node.has("user") ? "user" : "owner");
|
||||||
try {
|
try {
|
||||||
final User user = new User(userJson.getLong("pk"),
|
final User user = new User(userJson.getLong("pk"),
|
||||||
@ -179,17 +179,22 @@ public class StoriesService extends BaseService {
|
|||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
final String id = node.getString("id");
|
|
||||||
final long timestamp = node.getLong("latest_reel_media");
|
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 boolean fullyRead = !node.isNull("seen") && node.getLong("seen") == timestamp;
|
||||||
final JSONObject itemJson = node.has("items") ? node.getJSONArray("items").optJSONObject(0) : null;
|
final JSONObject itemJson = node.has("items") ? node.getJSONArray("items").optJSONObject(0) : null;
|
||||||
final boolean isBestie = node.optBoolean("has_besties_media", false);
|
|
||||||
StoryModel firstStoryModel = null;
|
StoryModel firstStoryModel = null;
|
||||||
if (itemJson != null) {
|
if (itemJson != null) {
|
||||||
firstStoryModel = ResponseBodyUtils.parseStoryItem(itemJson, false, 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
|
catch (Exception e) {} // to cover promotional reels with non-long user pk's
|
||||||
}
|
}
|
||||||
@ -242,13 +247,16 @@ public class StoriesService extends BaseService {
|
|||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
final String id = node.getString("id");
|
feedStoryModels.add(new FeedStoryModel(
|
||||||
final long timestamp = node.getLong("published_time");
|
node.getString("id"),
|
||||||
// final JSONObject itemJson = node.has("items") ? node.getJSONArray("items").getJSONObject(0) : null;
|
user,
|
||||||
final StoryModel firstStoryModel = ResponseBodyUtils.parseBroadcastItem(node);
|
false,
|
||||||
// if (itemJson != null) {
|
node.getLong("published_time"),
|
||||||
// }
|
ResponseBodyUtils.parseBroadcastItem(node),
|
||||||
feedStoryModels.add(new FeedStoryModel(id, user, false, timestamp, firstStoryModel, 1, true, false));
|
1,
|
||||||
|
true,
|
||||||
|
false
|
||||||
|
));
|
||||||
}
|
}
|
||||||
callback.onSuccess(sort(feedStoryModels));
|
callback.onSuccess(sort(feedStoryModels));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
<string name="download_user_folder">Download posts to username folders</string>
|
<string name="download_user_folder">Download posts to username folders</string>
|
||||||
<string name="mark_as_seen_setting">Mark stories as seen after viewing</string>
|
<string name="mark_as_seen_setting">Mark stories as seen after viewing</string>
|
||||||
<string name="mark_as_seen_setting_summary">Story author will know you viewed it</string>
|
<string name="mark_as_seen_setting_summary">Story author will know you viewed it</string>
|
||||||
|
<string name="hide_muted_reels_setting">Hide muted stories from feed</string>
|
||||||
<string name="dm_mark_as_seen_setting">Mark DM as seen after viewing</string>
|
<string name="dm_mark_as_seen_setting">Mark DM as seen after viewing</string>
|
||||||
<string name="dm_mark_as_seen_setting_summary">Other members will know you viewed it</string>
|
<string name="dm_mark_as_seen_setting_summary">Other members will know you viewed it</string>
|
||||||
<string name="activity_setting">Enable activity notifications</string>
|
<string name="activity_setting">Enable activity notifications</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user