Move notyping inside of slashcommands

This commit is contained in:
ave 2019-05-26 16:46:38 +03:00
parent 3effa6c2a8
commit ddcb459df4
No known key found for this signature in database
GPG key ID: 09356ABAA42C842B
28 changed files with 105 additions and 8 deletions

View file

@ -2,7 +2,7 @@ Only in com.discord-903: build
Only in com.discord-903: dist
diff -crB com.discord-903-base/smali/com/discord/models/domain/ModelChannel.smali com.discord-903/smali/com/discord/models/domain/ModelChannel.smali
*** com.discord-903-base/smali/com/discord/models/domain/ModelChannel.smali 2019-05-24 23:40:49.520802264 +0300
--- com.discord-903/smali/com/discord/models/domain/ModelChannel.smali 2019-05-25 05:00:46.074702303 +0300
--- com.discord-903/smali/com/discord/models/domain/ModelChannel.smali 2019-05-26 16:28:14.734931852 +0300
***************
*** 2082,2087 ****
--- 2082,2097 ----
@ -24,7 +24,7 @@ diff -crB com.discord-903-base/smali/com/discord/models/domain/ModelChannel.smal
diff -crB com.discord-903-base/smali/com/discord/stores/StoreMessages.smali com.discord-903/smali/com/discord/stores/StoreMessages.smali
*** com.discord-903-base/smali/com/discord/stores/StoreMessages.smali 2019-05-24 23:40:49.670802999 +0300
--- com.discord-903/smali/com/discord/stores/StoreMessages.smali 2019-05-25 05:39:51.367962305 +0300
--- com.discord-903/smali/com/discord/stores/StoreMessages.smali 2019-05-26 16:39:58.879207449 +0300
***************
*** 432,437 ****
--- 432,441 ----
@ -40,7 +40,7 @@ diff -crB com.discord-903-base/smali/com/discord/stores/StoreMessages.smali com.
***************
*** 948,953 ****
--- 952,3537 ----
--- 952,3574 ----
return-void
.end method
@ -2241,7 +2241,7 @@ diff -crB com.discord-903-base/smali/com/discord/stores/StoreMessages.smali com.
+
+ move-result v0
+
+ if-eqz v0, :cond_1
+ if-eqz v0, :cond_2
+
+ # Move to config value interpretation
+
@ -2269,6 +2269,43 @@ diff -crB com.discord-903-base/smali/com/discord/stores/StoreMessages.smali com.
+
+ return-object p0
+
+ # Move to second secondary command's interpretation
+
+ :cond_2
+ const-string v0, "showtyping "
+
+ 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, 0xb
+
+ 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;->setShowTyping(Z)V
+
+ const-string p0, "CTC: Set showtyping state. (Under ideal conditions this should only be visible to you, but the world isn't always that fair, is it now?)"
+
+ return-object p0
+
+ :cond_1
+ const-string p0, "CTC: No known command supplied. (Under ideal conditions this should only be visible to you, but the world isn't always that fair, is it now?)"
+
@ -2629,7 +2666,7 @@ diff -crB com.discord-903-base/smali/com/discord/stores/StoreMessages.smali com.
.annotation system Ldalvik/annotation/Signature;
***************
*** 977,982 ****
--- 3561,3570 ----
--- 3598,3607 ----
invoke-static {p4, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
@ -2640,13 +2677,12 @@ diff -crB com.discord-903-base/smali/com/discord/stores/StoreMessages.smali com.
const/4 v0, 0x1
if-eqz p6, :cond_0
Only in com.discord-903/smali/com/discord/stores: StoreMessages.smali.orig
diff -crB com.discord-903-base/smali/com/discord/stores/StoreUserSettings.smali com.discord-903/smali/com/discord/stores/StoreUserSettings.smali
*** com.discord-903-base/smali/com/discord/stores/StoreUserSettings.smali 2019-05-24 23:40:49.700803146 +0300
--- com.discord-903/smali/com/discord/stores/StoreUserSettings.smali 2019-05-25 04:41:00.951108339 +0300
--- com.discord-903/smali/com/discord/stores/StoreUserSettings.smali 2019-05-26 16:28:45.931787947 +0300
***************
*** 1272,1277 ****
--- 1272,1315 ----
--- 1272,1353 ----
return v0
.end method
@ -2687,7 +2723,67 @@ diff -crB com.discord-903-base/smali/com/discord/stores/StoreUserSettings.smali
+
+ return-void
+ .end method
+
+ .method public getShowTyping()Z
+ .locals 3
+
+ .line 179
+ iget-object v0, p0, Lcom/discord/stores/StoreUserSettings;->prefs:Landroid/content/SharedPreferences;
+
+ const-string v1, "CACHE_KEY_CTC_SHOW_TYPING"
+
+ 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 setShowTyping(Z)V
+ .locals 2
+
+ .line 331
+ 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_SHOW_TYPING"
+
+ 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 handleConnectionOpen(Lcom/discord/models/domain/ModelPayload;)V
.locals 0
diff -crB com.discord-903-base/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali com.discord-903/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali
*** com.discord-903-base/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali 2019-05-24 23:40:49.907470826 +0300
--- com.discord-903/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali 2019-05-26 16:32:19.513084840 +0300
***************
*** 124,129 ****
--- 124,139 ----
invoke-static {p1, v0, v1}, Lcom/discord/widgets/chat/input/WidgetChatInputEditText;->access$202(Lcom/discord/widgets/chat/input/WidgetChatInputEditText;J)J
+ invoke-static {}, Lcom/discord/stores/StoreStream;->getUserSettings()Lcom/discord/stores/StoreUserSettings;
+
+ move-result-object p1
+
+ invoke-virtual {p1}, Lcom/discord/stores/StoreUserSettings;->getShowTyping()Z
+
+ move-result p1
+
+ if-eqz p1, :cond_1
+
.line 222
invoke-static {}, Lcom/discord/stores/StoreStream;->getUsersTyping()Lcom/discord/stores/StoreUserTyping;

View file

@ -24,6 +24,7 @@ Following commands are supported, but create less accessible text (so you should
CutTheCord has a couple features that can be enabled or disabled 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
Commands like fw can be generated by `textreplacegen.py` or `textreplacegen-array.py` provided in this folder.