diff --git a/resources/patches/betterdmheader/87202.patch b/resources/patches/betterdmheader/87202.patch new file mode 100644 index 0000000..a258298 --- /dev/null +++ b/resources/patches/betterdmheader/87202.patch @@ -0,0 +1,37 @@ +diff -crB from/smali_classes2/com/discord/widgets/home/WidgetHomeHeaderManager$getOnConfigureAction$1.smali to/smali_classes2/com/discord/widgets/home/WidgetHomeHeaderManager$getOnConfigureAction$1.smali +*** from/smali_classes2/com/discord/widgets/home/WidgetHomeHeaderManager$getOnConfigureAction$1.smali 2020-11-19 15:23:43.685245089 +0000 +--- to/smali_classes2/com/discord/widgets/home/WidgetHomeHeaderManager$getOnConfigureAction$1.smali 2020-11-19 15:26:07.886953277 +0000 +*************** +*** 181,187 **** + + invoke-static {v3, v9}, Ld0/z/d/m;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V + +! invoke-interface {v3, v1}, Landroid/view/MenuItem;->setVisible(Z)Landroid/view/MenuItem; + + .line 7 + invoke-interface {p1, v8}, Landroid/view/Menu;->findItem(I)Landroid/view/MenuItem; +--- 181,187 ---- + + invoke-static {v3, v9}, Ld0/z/d/m;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V + +! invoke-interface {v3, v2}, Landroid/view/MenuItem;->setVisible(Z)Landroid/view/MenuItem; + + .line 7 + invoke-interface {p1, v8}, Landroid/view/Menu;->findItem(I)Landroid/view/MenuItem; +*************** +*** 360,366 **** + + invoke-static {v3, v9}, Ld0/z/d/m;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V + +! invoke-interface {v3, v1}, Landroid/view/MenuItem;->setVisible(Z)Landroid/view/MenuItem; + + .line 19 + invoke-interface {p1, v6}, Landroid/view/Menu;->findItem(I)Landroid/view/MenuItem; +--- 360,366 ---- + + invoke-static {v3, v9}, Ld0/z/d/m;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V + +! invoke-interface {v3, v2}, Landroid/view/MenuItem;->setVisible(Z)Landroid/view/MenuItem; + + .line 19 + invoke-interface {p1, v6}, Landroid/view/Menu;->findItem(I)Landroid/view/MenuItem; diff --git a/resources/patches/disable-mobileindicator/87202.patch b/resources/patches/disable-mobileindicator/87202.patch index 954dd9f..04bcf67 100644 --- a/resources/patches/disable-mobileindicator/87202.patch +++ b/resources/patches/disable-mobileindicator/87202.patch @@ -1,29 +1,4 @@ diff -crB from/smali/com/discord/utilities/analytics/AnalyticSuperProperties.smali to/smali/com/discord/utilities/analytics/AnalyticSuperProperties.smali -*** from/smali_classes2/com/discord/widgets/home/WidgetHomeHeaderManager$getOnConfigureAction$1.smali 2021-08-04 19:46:28.632872300 +0100 ---- to/smali_classes2/com/discord/widgets/home/WidgetHomeHeaderManager$getOnConfigureAction$1.smali 2021-08-04 21:06:15.420553000 +0100 -*************** -*** 181,187 **** - - invoke-static {v3, v9}, Ld0/z/d/m;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V - -! invoke-interface {v3, v1}, Landroid/view/MenuItem;->setVisible(Z)Landroid/view/MenuItem; - - .line 7 - invoke-interface {p1, v8}, Landroid/view/Menu;->findItem(I)Landroid/view/MenuItem; ---- 181,187 ---- - - invoke-static {v3, v9}, Ld0/z/d/m;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V - -! invoke-interface {v3, v2}, Landroid/view/MenuItem;->setVisible(Z)Landroid/view/MenuItem; - - .line 7 - invoke-interface {p1, v8}, Landroid/view/Menu;->findItem(I)Landroid/view/MenuItem; -clienthax@DESKTOP-KM4G6JD:/mnt/c/Users/clienthax/Documents/Projects/cutthecord/ugh$ -clienthax@DESKTOP-KM4G6JD:/mnt/c/Users/clienthax/Documents/Projects/cutthecord/ugh$ -clienthax@DESKTOP-KM4G6JD:/mnt/c/Users/clienthax/Documents/Projects/cutthecord/ugh$ -clienthax@DESKTOP-KM4G6JD:/mnt/c/Users/clienthax/Documents/Projects/cutthecord/ugh$ -clienthax@DESKTOP-KM4G6JD:/mnt/c/Users/clienthax/Documents/Projects/cutthecord/ugh$ -clienthax@DESKTOP-KM4G6JD:/mnt/c/Users/clienthax/Documents/Projects/cutthecord/ugh$ diff -crB from/smali/com/discord/utilities/analytics/AnalyticSuperProperties.smali to/smali/com/discord/utilities/analytics/AnalyticSuperProperties.smali *** from/smali/com/discord/utilities/analytics/AnalyticSuperProperties.smali 2021-08-04 19:45:49.058376400 +0100 --- to/smali/com/discord/utilities/analytics/AnalyticSuperProperties.smali 2021-08-04 21:13:23.168882700 +0100 *************** diff --git a/resources/patches/slashcommands/code/src/main/java/com/cutthecord/commands/CTCCommands.java b/resources/patches/slashcommands/code/src/main/java/com/cutthecord/commands/CTCCommands.java index 7da7eca..39e07e3 100644 --- a/resources/patches/slashcommands/code/src/main/java/com/cutthecord/commands/CTCCommands.java +++ b/resources/patches/slashcommands/code/src/main/java/com/cutthecord/commands/CTCCommands.java @@ -1,9 +1,13 @@ package com.cutthecord.commands; -import com.cutthecord.commands.commands.*; +import com.cutthecord.commands.commands.CmdCtc; +import com.cutthecord.commands.commands.CmdEmojify; +import com.cutthecord.commands.commands.CmdOwo; +import com.cutthecord.commands.commands.CmdSpoilerImg; import com.discord.api.commands.ApplicationCommandType; import com.discord.api.commands.CommandChoice; -import com.discord.models.commands.*; +import com.discord.models.commands.ApplicationCommand; +import com.discord.models.commands.ApplicationCommandOption; import com.discord.stores.BuiltInCommands; import d0.z.d.m; import d0.z.d.o; @@ -11,7 +15,10 @@ import kotlin.jvm.functions.Function1; import kotlin.jvm.internal.DefaultConstructorMarker; import java.lang.reflect.Field; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; @SuppressWarnings("SameParameterValue") public class CTCCommands { @@ -35,8 +42,6 @@ public class CTCCommands { public static void CreateCTCCommands(BuiltInCommands builtIn) { // Used in command creation in BuiltinCommands, one more than the last reference - // TODO help text? - // Add existing commands ArrayList commands = new ArrayList<>(builtIn.getBuiltInCommands()); @@ -61,25 +66,16 @@ public class CTCCommands { commands.add(createHandleRawMessageCommand("owo", "Myakes tyext reawwy owo-ly, nya :3", "Message", new CmdOwo())); // owo commands.add(createHandleRawMessageCommand("emojify", "Emojify text", "Message", new CmdEmojify())); // emojify + commands.add(createHandleRawMessageCommand("spoilerimg", "Prepends SPOILER_ to names of all images attached to the message that starts with this, causing them to get marked as spoiler", "Message", new CmdSpoilerImg())); + commands.add(createEnableDisableCommand("channelleak", "Shows all hidden channels", new CmdCtc.CmdCtcChannelLeak())); + commands.add(createEnableDisableCommand("showtyping", "Change typing event so that its visible/not when you type", new CmdCtc.CmdCtcShowTyping())); + commands.add(createEnableDisableCommand("nodelete", "Disables handling of message delete events", new CmdCtc.CmdCtcNoDelete())); + commands.add(createHandleRawMessageCommand("gettoken", "Get current token, DO NOT USE IN PUBLIC", null, new CmdCtc.CmdCtcGetToken())); + commands.add(createHandleRawMessageCommand("settoken", "Set current token, DO NOT USE IN PUBLIC", "Token", new CmdCtc.CmdCtcSetToken())); + commands.add(createHandleRawMessageCommand("switchaccount", "Switch to specified account, DO NOT USE IN PUBLIC", "Name", new CmdCtc.CmdCtcSwitchAccount())); + // TODO addaccount - // TODO - /* - - cmds.put("spoilerimg", new CmdSpoilerImg()); - - // TODO can we add an CTC user that responds for these? - Command ctcCommand = new CmdCtc(); - - ctcCommand.registerSubCommand("channelleak", new CmdCtc.CmdCtcChannelLeak()); - ctcCommand.registerSubCommand("showtyping", new CmdCtc.CmdCtcShowTyping()); - ctcCommand.registerSubCommand("token", new CmdCtc.CmdCtcToken()); - ctcCommand.registerSubCommand("account", new CmdCtc.CmdCtcAccount()); - ctcCommand.registerSubCommand("addaccount", new CmdCtc.CmdCtcAddAccount()); - ctcCommand.registerSubCommand("nodelete", new CmdCtc.CmdCtcNoDelete()); - - cmds.put("ctc", ctcCommand); - */ // Builtin list is non modifiable, lets hijack it instead :) try { @@ -270,10 +266,44 @@ public class CTCCommands { } } + final static class EnableDisableCommand extends o implements Function1, String> { + public final EnableDisableHandler handler; + + public EnableDisableCommand(EnableDisableHandler handler) { + super(1); + this.handler = handler; + } + + public final String invoke(Map options) { + m.checkNotNullParameter(options, "commandOptions"); + StringBuilder newMessage = new StringBuilder(); + + boolean enabled = (boolean) options.get("enabled"); + + newMessage.append(handler.processEnableDisable(enabled)); + return newMessage.toString(); + } + } + private static ApplicationCommand createHandleRawMessageCommand(String name, String cmdDesc, String optionDesc, RawMsgHandler handler) { + boolean required = true; + if (optionDesc == null) { + required = false; + } return makeCtcCommand(name, cmdDesc, Collections.singletonList( - makeOption(ApplicationCommandType.STRING, "message", optionDesc, null, false, false, null, null, 192, null) + makeOption(ApplicationCommandType.STRING, "message", optionDesc, null, required, required, null, null, 192, null) ), new RawMessageCommand(handler)); } + private static ApplicationCommand createEnableDisableCommand(String name, String cmdDesc, EnableDisableHandler handler) { + ArrayList truefalse = new ArrayList<>(); + truefalse.add(new CommandChoice("on", "true")); + truefalse.add(new CommandChoice("off", "false")); + + return makeCtcCommand(name, cmdDesc, Collections.singletonList( + makeOption(ApplicationCommandType.BOOLEAN, "enabled", "Enable/Disable", null, true, true, truefalse, null, 192, null) + ), new EnableDisableCommand(handler)); + } + + } diff --git a/resources/patches/slashcommands/code/src/main/java/com/cutthecord/commands/EnableDisableHandler.java b/resources/patches/slashcommands/code/src/main/java/com/cutthecord/commands/EnableDisableHandler.java new file mode 100644 index 0000000..e90a9e3 --- /dev/null +++ b/resources/patches/slashcommands/code/src/main/java/com/cutthecord/commands/EnableDisableHandler.java @@ -0,0 +1,7 @@ +package com.cutthecord.commands; + +public interface EnableDisableHandler { + + String processEnableDisable(boolean enabled); + +} diff --git a/resources/patches/slashcommands/code/src/main/java/com/cutthecord/commands/commands/CmdCtc.java b/resources/patches/slashcommands/code/src/main/java/com/cutthecord/commands/commands/CmdCtc.java index f8c1614..24066b3 100644 --- a/resources/patches/slashcommands/code/src/main/java/com/cutthecord/commands/commands/CmdCtc.java +++ b/resources/patches/slashcommands/code/src/main/java/com/cutthecord/commands/commands/CmdCtc.java @@ -1,131 +1,175 @@ -/*package com.cutthecord.commands.commands; +package com.cutthecord.commands.commands; -import com.cutthecord.commands.CommandHandler; +import com.cutthecord.commands.EnableDisableHandler; +import com.cutthecord.commands.RawMsgHandler; import com.discord.stores.StoreStream; import com.discord.stores.StoreUserSettings; -public class CmdCtc extends CommandHandler.PrivateCommand { +import java.lang.reflect.Method; + +public class CmdCtc { // TODO make token calls write directly to clipboard - // TODO replace patched method calls with reflection - @Override - public String getPopupInfo() { - return "cheese"; - } + // TODO make supplemental inject a interface so we can just cast instead of using reflection - - - public static class CmdCtcChannelLeak extends CommandHandler.PrivateCommand { + public static class CmdCtcChannelLeak implements EnableDisableHandler { @Override - public String handleCommand(String msg) { - StoreStream.getUserSettings().setLeakChannels(msg.startsWith("false")); - return "CTC: Successfully set channelleak state."; - } + public String processEnableDisable(boolean enabled) { + try { + //noinspection JavaReflectionMemberAccess + final Method m = StoreStream.getUserSettings().getClass().getDeclaredMethod("setLeakChannels", boolean.class); + m.invoke(StoreStream.getUserSettings(), enabled); + } catch (Exception e) { + System.out.println("Failed to call StoreStream.getUserSettings().setLeakChannels"); - @Override - public String getPopupInfo() { - return "Shows all channels, even those you don’t have permissions to view"; + System.out.println("Declared"); + for (Method m : StoreStream.getUserSettings().getClass().getDeclaredMethods()) { + System.out.println(m.getName()+" "+ m.toString()); + } + + System.out.println(); + System.out.println("Methods"); + for (Method m : StoreStream.getUserSettings().getClass().getMethods()) { + System.out.println(m.getName()+" "+ m.toString()); + } + + e.printStackTrace(); + return "Failed to call StoreStream.getUserSettings().setLeakChannels"; + } + return "CTC: Successfully set channelleak state."; // TODO use notification } } - public static class CmdCtcShowTyping extends CommandHandler.PrivateCommand { + public static class CmdCtcShowTyping implements EnableDisableHandler { @Override - public String handleCommand(String msg) { - StoreStream.getUserSettings().setShowTyping(msg.startsWith("true")); - return "CTC: Successfully set showtyping state."; - } + public String processEnableDisable(boolean enabled) { - @Override - public String getPopupInfo() { - return "Change typing event so that its visible/not when you type"; - } - - } - - public static class CmdCtcToken extends CommandHandler.PrivateCommand { - - @Override - public String handleCommand(String msg) { - if (msg.isEmpty()) { - // Print token - return StoreStream.getUserSettings().getStoredToken(); + try { + //noinspection JavaReflectionMemberAccess + final Method m = StoreStream.getUserSettings().getClass().getDeclaredMethod("setShowTyping", boolean.class); + m.invoke(StoreStream.getUserSettings(), enabled); + } catch (Exception e) { + System.out.println("Failed to call StoreStream.getUserSettings().setShowTyping"); + e.printStackTrace(); + } + + return "CTC: Successfully set showtyping state."; // TODO use notification + } + + } + + public static class CmdCtcNoDelete implements EnableDisableHandler { + + @Override + public String processEnableDisable(boolean enabled) { + + try { + //noinspection JavaReflectionMemberAccess + final Method m = StoreStream.getUserSettings().getClass().getDeclaredMethod("setNoDelete", boolean.class); + m.invoke(StoreStream.getUserSettings(), enabled); + } catch (Exception e) { + System.out.println("Failed to call StoreStream.getUserSettings().setNoDelete"); + e.printStackTrace(); + } + + return "CTC: Successfully set nodelete state."; // TODO use notification + } + + } + + public static class CmdCtcGetToken implements RawMsgHandler { + + @Override + public String processRawMessage(String orig) { + try { + //noinspection JavaReflectionMemberAccess + final Method m = StoreStream.getUserSettings().getClass().getDeclaredMethod("getStoredToken"); + return (String) m.invoke(StoreStream.getUserSettings()); // TODO notification + } catch (Exception e) { + System.out.println("Failed to call StoreStream.getUserSettings().getStoredToken()"); + e.printStackTrace(); + } + + return ""; + } + + } + + public static class CmdCtcSetToken implements RawMsgHandler { + + @Override + public String processRawMessage(String msg) { + + try { + //noinspection JavaReflectionMemberAccess + final Method m = StoreStream.getUserSettings().getClass().getDeclaredMethod("setStoredToken", String.class); + m.invoke(StoreStream.getUserSettings(), msg); + } catch (Exception e) { + System.out.println("Failed to call StoreStream.getUserSettings().setStoredToken()"); + e.printStackTrace(); } - // Set token - StoreStream.getUserSettings().setStoredToken(msg); return "CTC: Successfully changed token. Please restart application."; } - @Override - public String getPopupInfo() { - return "Gives or sets token"; - } - } - public static class CmdCtcAccount extends CommandHandler.PrivateCommand { + public static class CmdCtcSwitchAccount implements RawMsgHandler { @Override - public String handleCommand(String msg) { + public String processRawMessage(String msg) { String trim = msg.trim(); StoreUserSettings userSettings = StoreStream.getUserSettings(); - String accountToken = userSettings.getAccountToken(trim); - if (accountToken.startsWith("none")) { - return "CTC: No such account found."; + + try { + //noinspection JavaReflectionMemberAccess + final Method m1 = userSettings.getClass().getDeclaredMethod("getAccountToken", String.class); + String accountToken = (String) m1.invoke(userSettings, trim); + if (accountToken.startsWith("none")) { + return "CTC: No such account found."; + } + + //noinspection JavaReflectionMemberAccess + final Method m2 = userSettings.getClass().getDeclaredMethod("setStoredToken", String.class); + m2.invoke(userSettings, accountToken); + return "CTC: Successfully changed accounts. Please restart application."; + } catch (Exception e) { + e.printStackTrace(); } - userSettings.setStoredToken(accountToken); - return "CTC: Successfully changed accounts. Please restart application."; - } - - @Override - public String getPopupInfo() { - return "Switches to the account specified"; + return ""; } } - public static class CmdCtcAddAccount extends CommandHandler.PrivateCommand { + public static class CmdCtcAddAccount implements RawMsgHandler {//TODO @Override - public String handleCommand(String msg) { + public String processRawMessage(String msg) { String substring3 = msg.substring(msg.indexOf(" ")); - String trim2 = msg.replace(substring3, "").trim(); - String trim3 = substring3.trim(); - StoreUserSettings userSettings2 = StoreStream.getUserSettings(); - if (trim2.startsWith("current")) { - trim2 = userSettings2.getStoredToken(); + String accName = msg.replace(substring3, "").trim(); + String accToken = substring3.trim(); + + StoreUserSettings userSettings = StoreStream.getUserSettings(); + if (accName.startsWith("current")) { + accName = StoreStream.getUsers().getMe().getUsername(); + accToken = StoreStream.getUsers().getMe().getToken(); } - userSettings2.setAccountToken(trim2, trim3); + + try { + final Method m = userSettings.getClass().getDeclaredMethod("setAccountToken", String.class, String.class); + m.invoke(userSettings, accName, accToken); + } catch (Exception e) { + e.printStackTrace(); + } + return "CTC: Added account."; } - @Override - public String getPopupInfo() { - return "Adds an account to the account switcher"; - } - } - public static class CmdCtcNoDelete extends CommandHandler.PrivateCommand { - - @Override - public String handleCommand(String msg) { - StoreStream.getUserSettings().setNoDelete(msg.startsWith("true")); - return "CTC: Successfully set nodelete state."; - } - - @Override - public String getPopupInfo() { - return "Disables handling of message delete events"; - } - - } - - } -*/ \ No newline at end of file diff --git a/resources/patches/slashcommands/code/src/main/java/com/cutthecord/commands/commands/CmdSpoilerImg.java b/resources/patches/slashcommands/code/src/main/java/com/cutthecord/commands/commands/CmdSpoilerImg.java index 8c2ea5f..f01e617 100644 --- a/resources/patches/slashcommands/code/src/main/java/com/cutthecord/commands/commands/CmdSpoilerImg.java +++ b/resources/patches/slashcommands/code/src/main/java/com/cutthecord/commands/commands/CmdSpoilerImg.java @@ -1,17 +1,25 @@ package com.cutthecord.commands.commands; +import com.cutthecord.commands.RawMsgHandler; import com.discord.stores.StoreStream; +import java.lang.reflect.Method; -public class CmdSpoilerImg { - public String handleCommand(String msg) { - // TODO StoreStream.getUserSettings().setImageSpoiler(true); - return msg; - } +public class CmdSpoilerImg implements RawMsgHandler { - public String getPopupInfo() { - return "Prepends SPOILER_ to names of all images attached to the message that starts with this, causing them to get marked as spoiler"; + @Override + public String processRawMessage(String orig) { + try { + // Added by Supplemental patch + //noinspection JavaReflectionMemberAccess + final Method m = StoreStream.getUserSettings().getClass().getDeclaredMethod("setImageSpoiler", Boolean.class); + m.invoke(StoreStream.getUserSettings(), true); + } catch (Exception e) { + System.out.println("Failed to call StoreStream.getUserSettings().setImageSpoiler(true)"); + e.printStackTrace(); + } + return orig; } } diff --git a/resources/patches/supplemental/87202.patch b/resources/patches/supplemental/87202.patch index ec54853..9a4e77e 100644 --- a/resources/patches/supplemental/87202.patch +++ b/resources/patches/supplemental/87202.patch @@ -21,77 +21,65 @@ diff -crB from/smali/com/discord/gateway/io/IncomingParser.smali to/smali/com/di new-instance v0, Lcom/discord/models/domain/ModelMessageDelete; invoke-direct {v0}, Lcom/discord/models/domain/ModelMessageDelete;->()V -diff -crB from/smali/com/discord/models/domain/ModelChannel.smali to/smali/com/discord/models/domain/ModelChannel.smali +diff -crB from/smali/com/discord/api/channel/Channel.smali to/smali/com/discord/api/channel/Channel.smali *** from/smali/com/discord/api/channel/Channel.smali 2021-08-10 20:23:56.976468100 +0100 --- to/smali/com/discord/api/channel/Channel.smali 2021-08-11 17:13:48.876902500 +0100 *************** -*** 1774,1779 **** ---- 1774,1789 ---- +*** 1774,1783 **** } .end annotation -+ invoke-static {}, Lcom/discord/stores/StoreStream;->getUserSettings()Lcom/discord/stores/StoreUserSettings; +! .line 1 +! iget-object v0, p0, Lcom/discord/api/channel/Channel;->permissionOverwrites:Ljava/util/List; + + return-object v0 + .end method + + .method public final t()I +--- 1774,1800 ---- + } + .end annotation + +! invoke-static {}, Lcom/discord/stores/StoreStream;->getUserSettings()Lcom/discord/stores/StoreUserSettings; +! +! move-result-object v0 +! +! invoke-virtual {v0}, Lcom/discord/stores/StoreUserSettings;->getLeakChannels()Z +! +! move-result v0 +! +! if-eqz v0, :cond_0 + ++ invoke-static {}, Ljava/util/Collections;->emptyList()Ljava/util/List; + + move-result-object v0 + -+ invoke-virtual {v0}, Lcom/discord/stores/StoreUserSettings;->getLeakChannels()Z ++ :goto_0 + return-object v0 + -+ move-result v0 ++ :cond_0 ++ iget-object v0, p0, Lcom/discord/api/channel/Channel;->permissionOverwrites:Ljava/util/List; + -+ if-eqz v0, :cond_0 -+ - .line 1 - iget-object v0, p0, Lcom/discord/api/channel/Channel;->permissionOverwrites:Ljava/util/List; ++ goto :goto_0 + .end method + .method public final t()I diff -crB from/smali/com/discord/stores/StoreUserSettings.smali to/smali/com/discord/stores/StoreUserSettings.smali *** from/smali/com/discord/stores/StoreUserSettings.smali 2020-11-16 13:22:49.513198310 +0000 --- to/smali/com/discord/stores/StoreUserSettings.smali 2020-11-16 13:57:09.234000134 +0000 *************** *** 2899,2904 **** ---- 2899,3188 ---- +--- 2899,3178 ---- return-void .end method -+ .method public getAutoplayGifs()Z -+ .locals 3 -+ -+ iget-object v0, p0, Lcom/discord/stores/StoreUserSettings;->prefs:Landroid/content/SharedPreferences; -+ -+ const-string v1, "CACHE_KEY_CTC_AUTOPLAY_GIFS" -+ -+ const/4 v2, 0x1 -+ -+ invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z -+ -+ move-result v0 -+ -+ return v0 -+ .end method -+ -+ .method public setAutoplayGifs(Z)V -+ .locals 2 -+ -+ iget-object v0, p0, Lcom/discord/stores/StoreUserSettings;->prefs:Landroid/content/SharedPreferences; -+ -+ invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor; -+ -+ move-result-object v0 -+ -+ const-string v1, "CACHE_KEY_CTC_AUTOPLAY_GIFS" -+ -+ invoke-interface {v0, v1, p1}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor; -+ -+ move-result-object p1 -+ -+ invoke-interface {p1}, Landroid/content/SharedPreferences$Editor;->apply()V -+ -+ return-void -+ .end method -+ + .method public getLeakChannels()Z + .locals 3 + -+ iget-object v0, p0, Lcom/discord/stores/StoreUserSettings;->prefs:Landroid/content/SharedPreferences; ++ .line 1 ++ invoke-virtual {p0}, Lcom/discord/stores/Store;->getPrefs()Landroid/content/SharedPreferences; ++ ++ move-result-object v0 + + const-string v1, "CACHE_KEY_CTC_LEAK_CHANNELS" + @@ -107,7 +95,9 @@ diff -crB from/smali/com/discord/stores/StoreUserSettings.smali to/smali/com/dis + .method public setLeakChannels(Z)V + .locals 2 + -+ iget-object v0, p0, Lcom/discord/stores/StoreUserSettings;->prefs:Landroid/content/SharedPreferences; ++ invoke-virtual {p0}, Lcom/discord/stores/Store;->getPrefs()Landroid/content/SharedPreferences; ++ ++ move-result-object v0 + + invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor; + @@ -127,11 +117,14 @@ diff -crB from/smali/com/discord/stores/StoreUserSettings.smali to/smali/com/dis + .method public getImageSpoiler()Z + .locals 3 + -+ iget-object v0, p0, Lcom/discord/stores/StoreUserSettings;->prefs:Landroid/content/SharedPreferences; ++ .line 1 ++ invoke-virtual {p0}, Lcom/discord/stores/Store;->getPrefs()Landroid/content/SharedPreferences; ++ ++ move-result-object v0 + + const-string v1, "CACHE_KEY_CTC_IMAGE_SPOILER" + -+ const/4 v2, 0x0 ++ const/4 v2, 0x1 + + invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z + @@ -143,7 +136,9 @@ diff -crB from/smali/com/discord/stores/StoreUserSettings.smali to/smali/com/dis + .method public setImageSpoiler(Z)V + .locals 2 + -+ iget-object v0, p0, Lcom/discord/stores/StoreUserSettings;->prefs:Landroid/content/SharedPreferences; ++ invoke-virtual {p0}, Lcom/discord/stores/Store;->getPrefs()Landroid/content/SharedPreferences; ++ ++ move-result-object v0 + + invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor; + @@ -160,15 +155,17 @@ diff -crB from/smali/com/discord/stores/StoreUserSettings.smali to/smali/com/dis + return-void + .end method + -+ + .method public getNoDelete()Z + .locals 3 + -+ iget-object v0, p0, Lcom/discord/stores/StoreUserSettings;->prefs:Landroid/content/SharedPreferences; ++ .line 1 ++ invoke-virtual {p0}, Lcom/discord/stores/Store;->getPrefs()Landroid/content/SharedPreferences; ++ ++ move-result-object v0 + + const-string v1, "CACHE_KEY_CTC_NO_DELETE" + -+ const/4 v2, 0x0 ++ const/4 v2, 0x1 + + invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z + @@ -180,7 +177,9 @@ diff -crB from/smali/com/discord/stores/StoreUserSettings.smali to/smali/com/dis + .method public setNoDelete(Z)V + .locals 2 + -+ iget-object v0, p0, Lcom/discord/stores/StoreUserSettings;->prefs:Landroid/content/SharedPreferences; ++ invoke-virtual {p0}, Lcom/discord/stores/Store;->getPrefs()Landroid/content/SharedPreferences; ++ ++ move-result-object v0 + + invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor; + @@ -200,7 +199,10 @@ diff -crB from/smali/com/discord/stores/StoreUserSettings.smali to/smali/com/dis + .method public getShowTyping()Z + .locals 3 + -+ iget-object v0, p0, Lcom/discord/stores/StoreUserSettings;->prefs:Landroid/content/SharedPreferences; ++ .line 1 ++ invoke-virtual {p0}, Lcom/discord/stores/Store;->getPrefs()Landroid/content/SharedPreferences; ++ ++ move-result-object v0 + + const-string v1, "CACHE_KEY_CTC_SHOW_TYPING" + @@ -216,7 +218,9 @@ diff -crB from/smali/com/discord/stores/StoreUserSettings.smali to/smali/com/dis + .method public setShowTyping(Z)V + .locals 2 + -+ iget-object v0, p0, Lcom/discord/stores/StoreUserSettings;->prefs:Landroid/content/SharedPreferences; ++ invoke-virtual {p0}, Lcom/discord/stores/Store;->getPrefs()Landroid/content/SharedPreferences; ++ ++ move-result-object v0 + + invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor; + @@ -233,11 +237,12 @@ diff -crB from/smali/com/discord/stores/StoreUserSettings.smali to/smali/com/dis + return-void + .end method + -+ + .method public getStoredToken()Ljava/lang/String; + .locals 3 + -+ iget-object v0, p0, Lcom/discord/stores/StoreAuthentication;->prefs:Landroid/content/SharedPreferences; ++ invoke-virtual {p0}, Lcom/discord/stores/Store;->getPrefs()Landroid/content/SharedPreferences; ++ ++ move-result-object v0 + + const-string v1, "none" + @@ -254,7 +259,9 @@ diff -crB from/smali/com/discord/stores/StoreUserSettings.smali to/smali/com/dis + .method public setStoredToken(Ljava/lang/String;)V + .locals 2 + -+ iget-object v0, p0, Lcom/discord/stores/StoreAuthentication;->prefs:Landroid/content/SharedPreferences; ++ invoke-virtual {p0}, Lcom/discord/stores/Store;->getPrefs()Landroid/content/SharedPreferences; ++ ++ move-result-object v0 + + invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor; + @@ -290,7 +297,9 @@ diff -crB from/smali/com/discord/stores/StoreUserSettings.smali to/smali/com/dis + + move-result-object v2 + -+ iget-object v0, p0, Lcom/discord/stores/StoreAuthentication;->prefs:Landroid/content/SharedPreferences; ++ invoke-virtual {p0}, Lcom/discord/stores/Store;->getPrefs()Landroid/content/SharedPreferences; ++ ++ move-result-object v0 + + const-string v1, "none" + @@ -321,7 +330,9 @@ diff -crB from/smali/com/discord/stores/StoreUserSettings.smali to/smali/com/dis + + move-result-object v1 + -+ iget-object v0, p0, Lcom/discord/stores/StoreAuthentication;->prefs:Landroid/content/SharedPreferences; ++ invoke-virtual {p0}, Lcom/discord/stores/Store;->getPrefs()Landroid/content/SharedPreferences; ++ ++ move-result-object v0 + + invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor; + diff --git a/resources/xmlpatches/betterdmheader/87202.xml b/resources/xmlpatches/betterdmheader/87202.xml new file mode 100644 index 0000000..d858450 --- /dev/null +++ b/resources/xmlpatches/betterdmheader/87202.xml @@ -0,0 +1,7 @@ + + + never + never + always + +