From 24c4a55096e1f16d652b7888da30d2f357c4906d Mon Sep 17 00:00:00 2001 From: Juby210 Date: Fri, 21 Aug 2020 00:01:03 +0200 Subject: [PATCH] port new changes in supplemental to 1243 --- patches/supplemental/1243.patch | 330 +++++++++++++++++++++++++++++--- 1 file changed, 307 insertions(+), 23 deletions(-) diff --git a/patches/supplemental/1243.patch b/patches/supplemental/1243.patch index c73836f..a64d1be 100644 --- a/patches/supplemental/1243.patch +++ b/patches/supplemental/1243.patch @@ -1,27 +1,117 @@ -diff -crB from/smali/com/discord/gateway/io/IncomingParser.smali to/smali/com/discord/gateway/io/IncomingParser.smali -*** from/smali/com/discord/gateway/io/IncomingParser.smali 2020-08-20 11:50:17.400000000 +0300 ---- to/smali/com/discord/gateway/io/IncomingParser.smali 2020-08-20 11:53:27.380000000 +0300 +diff -crBN from/smali/com/cutthecord/Utils.smali to/smali/com/cutthecord/Utils.smali +*** from/smali/com/cutthecord/Utils.smali Thu Jan 1 01:00:00 1970 +--- to/smali/com/cutthecord/Utils.smali Thu Aug 13 14:15:11 2020 *************** -*** 762,767 **** ---- 762,778 ---- - - .line 57 - :goto_2 +*** 0 **** +--- 1,36 ---- ++ .class public Lcom/cutthecord/Utils; ++ .super Ljava/lang/Object; + -+ invoke-static {}, Lcom/discord/stores/StoreStream;->getUserSettings()Lcom/discord/stores/StoreUserSettings; + -+ move-result-object v0 ++ # static fields ++ .field public static messageFragment:Landroidx/fragment/app/Fragment; + -+ invoke-virtual {v0}, Lcom/discord/stores/StoreUserSettings;->getNoDelete()Z + -+ move-result v4 ++ # direct methods ++ .method public constructor ()V ++ .locals 0 + -+ if-nez v4, :cond_b ++ invoke-direct {p0}, Ljava/lang/Object;->()V + - 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 ++ return-void ++ .end method ++ ++ .method public static refreshView()V ++ .locals 2 ++ ++ new-instance v0, Landroid/os/Handler; ++ ++ invoke-static {}, Landroid/os/Looper;->getMainLooper()Landroid/os/Looper; ++ ++ move-result-object v1 ++ ++ invoke-direct {v0, v1}, Landroid/os/Handler;->(Landroid/os/Looper;)V ++ ++ new-instance v1, Lcom/cutthecord/refreshView; ++ ++ invoke-direct {v1}, Lcom/cutthecord/refreshView;->()V ++ ++ invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z ++ ++ return-void ++ .end method +diff -crBN from/smali/com/cutthecord/refreshView.smali to/smali/com/cutthecord/refreshView.smali +*** from/smali/com/cutthecord/refreshView.smali Thu Jan 1 01:00:00 1970 +--- to/smali/com/cutthecord/refreshView.smali Thu Aug 13 13:56:59 2020 +*************** +*** 0 **** +--- 1,65 ---- ++ .class final Lcom/cutthecord/refreshView; ++ .super Ljava/lang/Object; ++ ++ # interfaces ++ .implements Ljava/lang/Runnable; ++ ++ ++ # direct methods ++ .method public constructor ()V ++ .locals 0 ++ ++ invoke-direct {p0}, Ljava/lang/Object;->()V ++ ++ return-void ++ .end method ++ ++ ++ # virtual methods ++ .method public run()V ++ .locals 4 ++ ++ sget-object v0, Lcom/cutthecord/Utils;->messageFragment:Landroidx/fragment/app/Fragment; ++ ++ if-eqz v0, :cond_0 ++ ++ invoke-virtual {v0}, Landroidx/fragment/app/Fragment;->isStateSaved()Z ++ ++ move-result v1 ++ ++ if-nez v1, :cond_0 ++ ++ invoke-virtual {v0}, Landroidx/fragment/app/Fragment;->getFragmentManager()Landroidx/fragment/app/FragmentManager; ++ ++ move-result-object v1 ++ ++ if-eqz v1, :cond_0 ++ ++ invoke-virtual {v1}, Landroidx/fragment/app/FragmentManager;->beginTransaction()Landroidx/fragment/app/FragmentTransaction; ++ ++ move-result-object v1 ++ ++ sget v2, Landroid/os/Build$VERSION;->SDK_INT:I ++ ++ const/16 v3, 0x1a # 26 ++ ++ if-lt v2, v3, :cond_1 ++ ++ const/4 v2, 0x0 ++ ++ invoke-virtual {v1, v2}, Landroidx/fragment/app/FragmentTransaction;->setReorderingAllowed(Z)Landroidx/fragment/app/FragmentTransaction; ++ ++ :cond_1 ++ invoke-virtual {v1, v0}, Landroidx/fragment/app/FragmentTransaction;->detach(Landroidx/fragment/app/Fragment;)Landroidx/fragment/app/FragmentTransaction; ++ ++ move-result-object v1 ++ ++ invoke-virtual {v1, v0}, Landroidx/fragment/app/FragmentTransaction;->attach(Landroidx/fragment/app/Fragment;)Landroidx/fragment/app/FragmentTransaction; ++ ++ move-result-object v1 ++ ++ invoke-virtual {v1}, Landroidx/fragment/app/FragmentTransaction;->commit()I ++ ++ :cond_0 ++ return-void ++ .end method +diff -crBN from/smali/com/discord/models/domain/ModelChannel.smali to/smali/com/discord/models/domain/ModelChannel.smali *** from/smali/com/discord/models/domain/ModelChannel.smali 2020-08-20 11:50:17.420000000 +0300 --- to/smali/com/discord/models/domain/ModelChannel.smali 2020-08-20 11:53:27.380000000 +0300 *************** @@ -43,7 +133,34 @@ diff -crB from/smali/com/discord/models/domain/ModelChannel.smali to/smali/com/d .line 1 iget-object v0, p0, Lcom/discord/models/domain/ModelChannel;->permissionOverwrites:Ljava/util/Map; -diff -crB from/smali/com/discord/models/domain/ModelMessageEmbed.smali to/smali/com/discord/models/domain/ModelMessageEmbed.smali +diff -crBN from/smali/com/discord/models/domain/ModelMessage.smali to/smali/com/discord/models/domain/ModelMessage.smali +*** from/smali/com/discord/models/domain/ModelMessage.smali Wed Aug 12 18:07:38 2020 +--- to/smali/com/discord/models/domain/ModelMessage.smali Thu Aug 13 12:03:45 2020 +*************** +*** 151,156 **** +--- 151,158 ---- + + .field public content:Ljava/lang/String; + ++ .field public deleted:Z ++ + .field public editedTimestamp:Ljava/lang/String; + + .field public final editedTimestampMilliseconds:Ljava/util/concurrent/atomic/AtomicReference; +*************** +*** 336,341 **** +--- 338,347 ---- + + iput-object v0, p0, Lcom/discord/models/domain/ModelMessage;->editedTimestampMilliseconds:Ljava/util/concurrent/atomic/AtomicReference; + ++ const/4 v0, 0x0 ++ ++ iput-boolean v0, p0, Lcom/discord/models/domain/ModelMessage;->deleted:Z ++ + return-void + .end method + +diff -crBN from/smali/com/discord/models/domain/ModelMessageEmbed.smali to/smali/com/discord/models/domain/ModelMessageEmbed.smali *** from/smali/com/discord/models/domain/ModelMessageEmbed.smali 2020-08-20 11:50:17.430000000 +0300 --- to/smali/com/discord/models/domain/ModelMessageEmbed.smali 2020-08-20 11:53:27.380000000 +0300 *************** @@ -103,7 +220,89 @@ diff -crB from/smali/com/discord/models/domain/ModelMessageEmbed.smali to/smali/ .end method .method public toString()Ljava/lang/String; -diff -crB from/smali/com/discord/stores/StoreUserSettings.smali to/smali/com/discord/stores/StoreUserSettings.smali +diff -crBN from/smali/com/discord/stores/StoreMessagesHolder.smali to/smali/com/discord/stores/StoreMessagesHolder.smali +*** from/smali/com/discord/stores/StoreMessagesHolder.smali Wed Aug 12 18:07:38 2020 +--- to/smali/com/discord/stores/StoreMessagesHolder.smali Thu Aug 13 15:01:22 2020 +*************** +*** 1395,1401 **** + .end method + + .method public deleteMessages(JLjava/util/List;)V +! .locals 5 + .param p3 # Ljava/util/List; + .annotation build Landroidx/annotation/Nullable; + .end annotation +--- 1395,1401 ---- + .end method + + .method public deleteMessages(JLjava/util/List;)V +! .locals 6 + .param p3 # Ljava/util/List; + .annotation build Landroidx/annotation/Nullable; + .end annotation +*************** +*** 1451,1456 **** +--- 1451,1464 ---- + + move-result-object p3 + ++ invoke-static {}, Lcom/discord/stores/StoreStream;->getUserSettings()Lcom/discord/stores/StoreUserSettings; ++ ++ move-result-object v5 ++ ++ invoke-virtual {v5}, Lcom/discord/stores/StoreUserSettings;->getNoDelete()Z ++ ++ move-result v5 ++ + :cond_1 + :goto_0 + invoke-interface {p3}, Ljava/util/Iterator;->hasNext()Z +*************** +*** 1485,1493 **** +--- 1493,1520 ---- + + move-result-object v2 + ++ if-nez v5, :cond_4 ++ + invoke-interface {v1, v2}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object; + ++ goto :goto_2 ++ ++ :cond_4 ++ invoke-interface {v1, v2}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object; ++ ++ move-result-object v2 ++ ++ check-cast v2, Lcom/discord/models/domain/ModelMessage; ++ ++ if-eqz v2, :cond_5 ++ ++ const/4 v3, 0x1 ++ ++ iput-boolean v3, v2, Lcom/discord/models/domain/ModelMessage;->deleted:Z ++ + .line 7 ++ :goto_2 ++ :cond_5 + iget-object v2, p0, Lcom/discord/stores/StoreMessagesHolder;->updatedChannels:Ljava/util/Set; + + invoke-static {p1, p2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long; +*************** +*** 1500,1505 **** +--- 1527,1537 ---- + + .line 8 + :cond_2 ++ if-eqz v5, :cond_6 ++ ++ invoke-static {}, Lcom/cutthecord/Utils;->refreshView()V ++ ++ :cond_6 + invoke-direct {p0}, Lcom/discord/stores/StoreMessagesHolder;->publishIfUpdated()V + + .line 9 +diff -crBN from/smali/com/discord/stores/StoreUserSettings.smali to/smali/com/discord/stores/StoreUserSettings.smali *** from/smali/com/discord/stores/StoreUserSettings.smali 2020-08-20 11:50:17.730000000 +0300 --- to/smali/com/discord/stores/StoreUserSettings.smali 2020-08-20 11:53:27.390000000 +0300 *************** @@ -399,7 +598,7 @@ diff -crB from/smali/com/discord/stores/StoreUserSettings.smali to/smali/com/dis .method private getAdjustedTheme(Ljava/lang/String;)Ljava/lang/String; .locals 1 -diff -crB from/smali/com/discord/utilities/rest/SendUtils$getPart$1$1.smali to/smali/com/discord/utilities/rest/SendUtils$getPart$1$1.smali +diff -crBN from/smali/com/discord/utilities/rest/SendUtils$getPart$1$1.smali to/smali/com/discord/utilities/rest/SendUtils$getPart$1$1.smali *** from/smali/com/discord/utilities/rest/SendUtils$getPart$1$1.smali 2020-08-20 11:50:17.810000000 +0300 --- to/smali/com/discord/utilities/rest/SendUtils$getPart$1$1.smali 2020-08-20 11:53:27.390000000 +0300 *************** @@ -458,7 +657,7 @@ diff -crB from/smali/com/discord/utilities/rest/SendUtils$getPart$1$1.smali to/s .line 4 iget-object p1, p0, Lcom/discord/utilities/rest/SendUtils$getPart$1$1;->this$0:Lcom/discord/utilities/rest/SendUtils$getPart$1; -diff -crB from/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali to/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali +diff -crBN from/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali to/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali *** from/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali 2020-08-20 11:50:17.980000000 +0300 --- to/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali 2020-08-20 11:53:27.390000000 +0300 *************** @@ -480,7 +679,7 @@ diff -crB from/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.sm .line 4 invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z -diff -crB from/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali to/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali +diff -crBN from/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali to/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali *** from/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali 2020-08-20 11:50:17.990000000 +0300 --- to/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali 2020-08-20 11:53:27.390000000 +0300 *************** @@ -516,7 +715,7 @@ diff -crB from/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali to .method private final clearInput(Lcom/discord/widgets/chat/input/WidgetChatInputEditText;Lcom/lytefast/flexinput/viewmodel/FlexInputViewModel;Ljava/lang/Boolean;)Z .locals 1 -diff -crB from/smali/com/discord/widgets/chat/list/InlineMediaView.smali to/smali/com/discord/widgets/chat/list/InlineMediaView.smali +diff -crBN from/smali/com/discord/widgets/chat/list/InlineMediaView.smali to/smali/com/discord/widgets/chat/list/InlineMediaView.smali *** from/smali/com/discord/widgets/chat/list/InlineMediaView.smali 2020-08-20 11:50:18.050000000 +0300 --- to/smali/com/discord/widgets/chat/list/InlineMediaView.smali 2020-08-20 11:53:27.390000000 +0300 *************** @@ -538,3 +737,88 @@ diff -crB from/smali/com/discord/widgets/chat/list/InlineMediaView.smali to/smal if-eqz v1, :cond_6 const/4 v7, 0x1 +diff -crBN from/smali/com/discord/widgets/chat/list/WidgetChatList.smali to/smali/com/discord/widgets/chat/list/WidgetChatList.smali +*** from/smali/com/discord/widgets/chat/list/WidgetChatList.smali Wed Aug 12 18:07:40 2020 +--- to/smali/com/discord/widgets/chat/list/WidgetChatList.smali Thu Aug 13 13:58:01 2020 +*************** +*** 40,45 **** +--- 40,47 ---- + .line 3 + iput-object v0, p0, Lcom/discord/widgets/chat/list/WidgetChatList;->_flexInputViewModel:Lcom/discord/widgets/chat/input/AppFlexInputViewModel; + ++ sput-object p0, Lcom/cutthecord/Utils;->messageFragment:Landroidx/fragment/app/Fragment; ++ + return-void + .end method + +diff -crBN from/smali/com/discord/widgets/chat/list/WidgetChatListAdapterItemMessage.smali to/smali/com/discord/widgets/chat/list/WidgetChatListAdapterItemMessage.smali +*** from/smali/com/discord/widgets/chat/list/WidgetChatListAdapterItemMessage.smali Wed Aug 12 18:07:40 2020 +--- to/smali/com/discord/widgets/chat/list/WidgetChatListAdapterItemMessage.smali Thu Aug 13 12:19:34 2020 +*************** +*** 1214,1219 **** +--- 1214,1278 ---- + + .line 20 + :cond_3 ++ iget-boolean v2, v14, Lcom/discord/models/domain/ModelMessage;->deleted:Z ++ ++ if-eqz v2, :cond_d ++ ++ new-instance v2, Ljava/util/ArrayList; ++ ++ const/4 v3, 0x2 ++ ++ invoke-direct {v2, v3}, Ljava/util/ArrayList;->(I)V ++ ++ .line 14 ++ new-instance v3, Landroid/text/style/RelativeSizeSpan; ++ ++ const/high16 v4, 0x3f400000 # 0.75f ++ ++ invoke-direct {v3, v4}, Landroid/text/style/RelativeSizeSpan;->(F)V ++ ++ invoke-virtual {v2, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z ++ ++ .line 15 ++ new-instance v3, Landroid/text/style/ForegroundColorSpan; ++ ++ const v4, 0x7f040166 ++ ++ invoke-static {v15, v4}, Lcom/discord/utilities/color/ColorCompat;->getThemedColor(Landroid/content/Context;I)I ++ ++ move-result v4 ++ ++ invoke-direct {v3, v4}, Landroid/text/style/ForegroundColorSpan;->(I)V ++ ++ invoke-virtual {v2, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z ++ ++ .line 16 ++ new-instance v3, Lf/a/j/a/a/a; ++ ++ const-string v4, " " ++ ++ invoke-direct {v3, v4}, Lf/a/j/a/a/a;->(Ljava/lang/String;)V ++ ++ invoke-interface {v13, v3}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z ++ ++ .line 17 ++ new-instance v3, Lcom/discord/simpleast/core/node/StyleNode; ++ ++ invoke-direct {v3, v2}, Lcom/discord/simpleast/core/node/StyleNode;->(Ljava/util/List;)V ++ ++ .line 18 ++ new-instance v2, Lf/a/j/a/a/a; ++ ++ const-string v4, "(deleted)" ++ ++ invoke-direct {v2, v4}, Lf/a/j/a/a/a;->(Ljava/lang/String;)V ++ ++ invoke-virtual {v3, v2}, Lcom/discord/simpleast/core/node/Node;->addChild(Lcom/discord/simpleast/core/node/Node;)V ++ ++ .line 19 ++ invoke-interface {v13, v3}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z ++ ++ :cond_d + invoke-virtual {v12}, Lcom/discord/utilities/textprocessing/MessagePreprocessor;->isLinkifyConflicting()Z + + move-result v2