Implement gif autoplay option

Closes #63
This commit is contained in:
ave 2020-07-31 19:12:01 +03:00
parent bcbb19690b
commit cb48362e57
Signed by untrusted user: a
GPG key ID: 398DD7BD03276F6D
3 changed files with 191 additions and 36 deletions

View file

@ -1,8 +1,8 @@
Only in to: build
Only in to: dist
diff -crB from/smali/com/discord/stores/StoreMessages.smali to/smali/com/discord/stores/StoreMessages.smali
*** from/smali/com/discord/stores/StoreMessages.smali 2020-07-10 17:08:48.010000000 +0300
--- to/smali/com/discord/stores/StoreMessages.smali 2020-07-10 17:11:59.000000000 +0300
Binary files com.discord-base/build/apk/classes.dex and com.discord/build/apk/classes.dex differ
Binary files com.discord-base/dist/com.discord-1213.apk and com.discord/dist/com.discord-1213.apk differ
diff --color -crB com.discord-base/smali/com/discord/stores/StoreMessages.smali com.discord/smali/com/discord/stores/StoreMessages.smali
*** com.discord-base/smali/com/discord/stores/StoreMessages.smali 2020-07-30 01:52:31.926342249 +0300
--- com.discord/smali/com/discord/stores/StoreMessages.smali 2020-07-31 19:06:14.644725600 +0300
***************
*** 640,645 ****
--- 640,649 ----
@ -35,7 +35,7 @@ diff -crB from/smali/com/discord/stores/StoreMessages.smali to/smali/com/discord
move-object/from16 v8, p4
***************
*** 1411,1413 ****
--- 1423,4687 ----
--- 1423,4722 ----
throw v0
.end method
@ -2941,7 +2941,7 @@ diff -crB from/smali/com/discord/stores/StoreMessages.smali to/smali/com/discord
+
+ move-result v0
+
+ if-eqz v0, :cond_1
+ if-eqz v0, :cond_a
+
+ # Move to config value interpretation
+
@ -2969,8 +2969,43 @@ diff -crB from/smali/com/discord/stores/StoreMessages.smali to/smali/com/discord
+
+ return-object p0
+
+ :cond_a
+ const-string v0, "gifautoplay "
+
+ invoke-virtual {p0, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
+
+ move-result v0
+
+ if-eqz v0, :cond_1
+
+ # Move to config value interpretation
+
+ const/16 v0, 0xc
+
+ invoke-virtual {p0, v0}, Ljava/lang/String;->substring(I)Ljava/lang/String;
+
+ move-result-object p0
+
+ const-string v0, "true"
+
+ invoke-virtual {p0, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
+
+ move-result v1
+
+ # Set value
+
+ invoke-static {}, Lcom/discord/stores/StoreStream;->getUserSettings()Lcom/discord/stores/StoreUserSettings;
+
+ move-result-object v0
+
+ invoke-virtual {v0, v1}, Lcom/discord/stores/StoreUserSettings;->setAutoplayGifs(Z)V
+
+ const-string p0, "CTC: Successfully set gifautoplay state."
+
+ return-object p0
+
+ :cond_1
+ const-string p0, "CTC: No known command supplied. (available: token, showtyping, channelleak, addaccount, account, nodelete. Everything except specified token needs to be lowercase)"
+ const-string p0, "CTC: No known command supplied. (available: token, showtyping, channelleak, addaccount, account, nodelete, gifautoplay. Everything except specified token needs to be lowercase)"
+
+ return-object p0
+ .end method
@ -3301,14 +3336,14 @@ diff -crB from/smali/com/discord/stores/StoreMessages.smali to/smali/com/discord
+ :cond_0
+ return-object p0
+ .end method
diff -crB from/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali to/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali
*** from/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali 2020-07-10 17:08:48.450000000 +0300
--- to/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali 2020-07-10 17:16:37.740000000 +0300
diff --color -crB com.discord-base/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali com.discord/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali
*** com.discord-base/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali 2020-07-30 01:52:32.293011301 +0300
--- com.discord/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali 2020-07-31 19:05:30.521097636 +0300
***************
*** 576,581 ****
--- 576,611 ----
invoke-static {v8, v10}, Li0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
invoke-static {v8, v10}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
+ # intercept edit here
+
@ -3347,7 +3382,7 @@ diff -crB from/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configur
*** 624,629 ****
--- 654,689 ----
invoke-static {v15, v10}, Li0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
invoke-static {v15, v10}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
+ # intercept send here
+
@ -3382,5 +3417,5 @@ diff -crB from/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configur
.line 55
invoke-virtual {v2}, Lcom/discord/models/domain/ModelMessage$Content;->getMentions()Ljava/util/List;
Only in to/smali/com/discord/widgets/chat/input: WidgetChatInputSend$configureSendListeners$1.smali.orig
Only in to/smali/com/discord/widgets/chat/input: WidgetChatInputSend$configureSendListeners$1.smali.rej
Only in com.discord/smali/com/discord/widgets/chat/input: WidgetChatInputSend$configureSendListeners$1.smali.orig

View file

@ -27,6 +27,7 @@ CutTheCord has a couple features that can utilized with slash commands as well:
- /ctc channelleak true/false -> Shows all channels, even those you don't have permissions to view (might mess with channel editing or editing while it's enabled)
- /ctc notyping true/false -> Disables typing event so that it's not visible when you type (true = typing is shown, false = not shown)
- /ctc nodelete true/false -> Disables handling of message delete events. Currently deletes messages don't have anything changed about them, but I plan to append "(deleted)" to them eventually. (true = Deleted messages stay, false = they get deleted)
- /ctc gifautoplay true/false -> Disables auto play of GIFs (true (default) = GIFs autoplay, false = GIFs don't autoplay)
- /ctc token -> Gives your token
- /ctc token $token -> Sets your token to the one specified, allowing switching between accounts
- /ctc addaccount $name $token -> Adds an account to the account switcher (name can be anything, token will be set to the current one if it's `current`)