diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ChatThemeController.java b/TMessagesProj/src/main/java/org/telegram/messenger/ChatThemeController.java index 6c8239e620..a1b7f4a9f4 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ChatThemeController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ChatThemeController.java @@ -23,6 +23,8 @@ import java.util.List; import java.util.Locale; +import xyz.nextalone.nagram.NaConfig; + public class ChatThemeController extends BaseController { private final long reloadTimeoutMs = 2 * 60 * 60 * 1000; @@ -300,11 +302,17 @@ public void saveChatWallpaper(long dialogId, TLRPC.WallPaper wallPaper) { public TLRPC.WallPaper getDialogWallpaper(long dialogId) { if (dialogId >= 0) { + if (NaConfig.INSTANCE.getDisableCustomWallpaperUser().Bool()) { + return null; + } TLRPC.UserFull userFull = getMessagesController().getUserFull(dialogId); if (userFull != null) { return userFull.wallpaper; } } else { + if (NaConfig.INSTANCE.getDisableCustomWallpaperChannel().Bool()) { + return null; + } TLRPC.ChatFull chatFull = getMessagesController().getChatFull(-dialogId); if (chatFull != null) { return chatFull.wallpaper; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/PreviewView.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/PreviewView.java index e90825ba8e..265948373f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/PreviewView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/PreviewView.java @@ -1464,17 +1464,18 @@ public static Drawable getBackgroundDrawable(Drawable prevDrawable, int currentA return null; } TLRPC.WallPaper wallpaper = null; - if (dialogId >= 0) { - TLRPC.UserFull userFull = MessagesController.getInstance(currentAccount).getUserFull(dialogId); - if (userFull != null) { - wallpaper = userFull.wallpaper; - } - } else { - TLRPC.ChatFull chatFull = MessagesController.getInstance(currentAccount).getChatFull(-dialogId); - if (chatFull != null) { - wallpaper = chatFull.wallpaper; - } - } +// if (dialogId >= 0) { +// TLRPC.UserFull userFull = MessagesController.getInstance(currentAccount).getUserFull(dialogId); +// if (userFull != null) { +// wallpaper = userFull.wallpaper; +// } +// } else { +// TLRPC.ChatFull chatFull = MessagesController.getInstance(currentAccount).getChatFull(-dialogId); +// if (chatFull != null) { +// wallpaper = chatFull.wallpaper; +// } +// } + wallpaper = ChatThemeController.getInstance(currentAccount).getDialogWallpaper(dialogId); return getBackgroundDrawable(prevDrawable, currentAccount, wallpaper, isDark); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/StoryThemeSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/StoryThemeSheet.java index 4c2a95c054..a97506d49d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/StoryThemeSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/StoryThemeSheet.java @@ -100,17 +100,18 @@ public void open(StoryEntry entry) { if (entry != null) { TLRPC.WallPaper wallpaper = null; if (entry.backgroundWallpaperPeerId != Long.MIN_VALUE) { - if (entry.backgroundWallpaperPeerId < 0) { - TLRPC.ChatFull chatFull = MessagesController.getInstance(entry.currentAccount).getChatFull(-entry.backgroundWallpaperPeerId); - if (chatFull != null) { - wallpaper = chatFull.wallpaper; - } - } else { - TLRPC.UserFull userFull = MessagesController.getInstance(entry.currentAccount).getUserFull(entry.backgroundWallpaperPeerId); - if (userFull != null) { - wallpaper = userFull.wallpaper; - } - } +// if (entry.backgroundWallpaperPeerId < 0) { +// TLRPC.ChatFull chatFull = MessagesController.getInstance(entry.currentAccount).getChatFull(-entry.backgroundWallpaperPeerId); +// if (chatFull != null) { +// wallpaper = chatFull.wallpaper; +// } +// } else { +// TLRPC.UserFull userFull = MessagesController.getInstance(entry.currentAccount).getUserFull(entry.backgroundWallpaperPeerId); +// if (userFull != null) { +// wallpaper = userFull.wallpaper; +// } +// } + wallpaper = ChatThemeController.getInstance(entry.currentAccount).getDialogWallpaper(entry.backgroundWallpaperPeerId); } themeView.setGalleryWallpaper(wallpaper); if (entry.backgroundWallpaperEmoticon != null) { diff --git a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoChatSettingsActivity.java b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoChatSettingsActivity.java index 6f863b3a92..3f54197c1f 100644 --- a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoChatSettingsActivity.java +++ b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoChatSettingsActivity.java @@ -122,6 +122,8 @@ public class NekoChatSettingsActivity extends BaseNekoXSettingsActivity implemen private final AbstractConfigCell quickToggleAnonymousRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getQuickToggleAnonymous(), LocaleController.getString("QuickToggleAnonymousNotice", R.string.QuickToggleAnonymousNotice))); private final AbstractConfigCell showOnlineStatusRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getShowOnlineStatus(), LocaleController.getString("ShowOnlineStatusNotice", R.string.ShowOnlineStatusNotice))); private final AbstractConfigCell showRecentOnlineStatusRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getShowRecentOnlineStatus())); + private final AbstractConfigCell disableCustomWallpaperUserRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getDisableCustomWallpaperUser())); + private final AbstractConfigCell disableCustomWallpaperChannelRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getDisableCustomWallpaperChannel())); private final AbstractConfigCell dividerChat = cellGroup.appendCell(new ConfigCellDivider()); // Interactions diff --git a/TMessagesProj/src/main/kotlin/xyz/nextalone/nagram/NaConfig.kt b/TMessagesProj/src/main/kotlin/xyz/nextalone/nagram/NaConfig.kt index 21d225cb03..eb1ed83f15 100644 --- a/TMessagesProj/src/main/kotlin/xyz/nextalone/nagram/NaConfig.kt +++ b/TMessagesProj/src/main/kotlin/xyz/nextalone/nagram/NaConfig.kt @@ -466,6 +466,18 @@ object NaConfig { ConfigItem.configTypeBool, false ) + val disableCustomWallpaperUser = + addConfig( + "DisableCustomWallpaperUser", + ConfigItem.configTypeBool, + false + ) + val disableCustomWallpaperChannel = + addConfig( + "DisableCustomWallpaperChannel", + ConfigItem.configTypeBool, + false + ) private fun addConfig( k: String, diff --git a/TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml b/TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml index a8d246aa31..e7392de525 100644 --- a/TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml +++ b/TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml @@ -92,4 +92,6 @@ 隐藏文件夹中的\"全部取消静音\" 本地名称颜色 显示方形头像 + 禁用私聊的自定义背景 + 禁用频道的自定义背景 diff --git a/TMessagesProj/src/main/res/values/strings_na.xml b/TMessagesProj/src/main/res/values/strings_na.xml index 4c24e5acd5..eb5e064eea 100644 --- a/TMessagesProj/src/main/res/values/strings_na.xml +++ b/TMessagesProj/src/main/res/values/strings_na.xml @@ -95,4 +95,6 @@ Hide filter mute all Use local quote color Show square avatar + Disable user custom wallpaper + Disable channel custom wallpaper