Skip to content

Commit

Permalink
fix: hide stories in Shared Media
Browse files Browse the repository at this point in the history
Co-authored-by: arsLan4k1390 <[email protected]>
  • Loading branch information
omg-xtao and arsLan4k1390 committed Mar 19, 2024
1 parent 0864a3f commit 4402fa9
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
import tw.nekomimi.nekogram.ui.BottomBuilder;
import tw.nekomimi.nekogram.utils.AlertUtil;
import tw.nekomimi.nekogram.utils.ProxyUtil;
import xyz.nextalone.nagram.NaConfig;

@SuppressWarnings("unchecked")
public class SharedMediaLayout extends FrameLayout implements NotificationCenter.NotificationCenterDelegate, DialogCell.DialogCellDelegate {
Expand Down Expand Up @@ -1451,7 +1452,7 @@ public SharedMediaLayout(Context context, long did, SharedMediaPreloader preload
this.initialTab = initialTab;
} else if (initialTab == TAB_SAVED_DIALOGS) {
this.initialTab = initialTab;
} else if (userInfo != null && userInfo.stories_pinned_available || chatInfo != null && chatInfo.stories_pinned_available || isStoriesView()) {
} else if (NaConfig.INSTANCE.getDisableStories().Bool() && (userInfo != null && userInfo.stories_pinned_available || chatInfo != null && chatInfo.stories_pinned_available || isStoriesView())) {
this.initialTab = getInitialTab();
} else if (initialTab != -1 && topicId == 0) {
this.initialTab = initialTab;
Expand Down Expand Up @@ -3138,7 +3139,8 @@ protected boolean isArchivedOnlyStoriesView() {
}

protected boolean includeStories() {
return true;
return !NaConfig.INSTANCE.getDisableStories().Bool();
// return true;
}

protected boolean includeSavedDialogs() {
Expand Down Expand Up @@ -5581,7 +5583,7 @@ private void updateTabs(boolean animated) {
boolean hasSavedDialogs = false;
boolean hasSavedMessages = savedMessagesContainer != null && sharedMediaPreloader != null && sharedMediaPreloader.hasSavedMessages;
int changed = 0;
if (((DialogObject.isUserDialog(dialog_id) || DialogObject.isChatDialog(dialog_id)) && !DialogObject.isEncryptedDialog(dialog_id) && (userInfo != null && userInfo.stories_pinned_available || info != null && info.stories_pinned_available || isStoriesView()) && includeStories()) != scrollSlidingTextTabStrip.hasTab(TAB_STORIES)) {
if (!NaConfig.INSTANCE.getDisableStories().Bool() && (((DialogObject.isUserDialog(dialog_id) || DialogObject.isChatDialog(dialog_id)) && !DialogObject.isEncryptedDialog(dialog_id) && (userInfo != null && userInfo.stories_pinned_available || info != null && info.stories_pinned_available || isStoriesView()) && includeStories()) != scrollSlidingTextTabStrip.hasTab(TAB_STORIES))) {
changed++;
}
if (!isStoriesView()) {
Expand Down Expand Up @@ -5666,7 +5668,7 @@ public Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues sta
if (changed > 3) {
idToView = null;
}
if ((DialogObject.isUserDialog(dialog_id) || DialogObject.isChatDialog(dialog_id)) && !DialogObject.isEncryptedDialog(dialog_id) && (userInfo != null && userInfo.stories_pinned_available || info != null && info.stories_pinned_available || isStoriesView()) && includeStories()) {
if (!NaConfig.INSTANCE.getDisableStories().Bool() && ((DialogObject.isUserDialog(dialog_id) || DialogObject.isChatDialog(dialog_id)) && !DialogObject.isEncryptedDialog(dialog_id) && (userInfo != null && userInfo.stories_pinned_available || info != null && info.stories_pinned_available || isStoriesView()) && includeStories())) {
if (isArchivedOnlyStoriesView()) {
if (!scrollSlidingTextTabStrip.hasTab(TAB_ARCHIVED_STORIES)) {
scrollSlidingTextTabStrip.addTextTab(TAB_ARCHIVED_STORIES, getString("ProfileStories", R.string.ProfileStories), idToView);
Expand Down

0 comments on commit 4402fa9

Please sign in to comment.