slashcommands-accountswitcher: allow using current token

This commit is contained in:
ave 2019-05-26 23:03:23 +03:00
parent 08baa86ac6
commit f9c80a395e
No known key found for this signature in database
GPG key ID: 09356ABAA42C842B
2 changed files with 23 additions and 9 deletions

View file

@ -1,6 +1,6 @@
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-26 20:27:36.478778820 +0300
--- com.discord-903/smali/com/discord/models/domain/ModelChannel.smali 2019-05-26 22:55:23.815254247 +0300
***************
*** 2082,2087 ****
--- 2082,2097 ----
@ -22,7 +22,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-26 22:26:25.368827559 +0300
--- com.discord-903/smali/com/discord/stores/StoreMessages.smali 2019-05-26 23:02:25.030960153 +0300
***************
*** 432,437 ****
--- 432,441 ----
@ -38,7 +38,7 @@ diff -crB com.discord-903-base/smali/com/discord/stores/StoreMessages.smali com.
***************
*** 948,953 ****
--- 952,3720 ----
--- 952,3733 ----
return-void
.end method
@ -2460,6 +2460,19 @@ diff -crB com.discord-903-base/smali/com/discord/stores/StoreMessages.smali com.
+
+ move-result-object v0
+
+ const-string v2, "current"
+
+ invoke-virtual {p0, v2}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
+
+ move-result v2
+
+ if-eqz v2, :cond_8
+
+ invoke-virtual {v0}, Lcom/discord/stores/StoreUserSettings;->getStoredToken()Ljava/lang/String;
+
+ move-result-object p0
+
+ :cond_8
+ invoke-virtual {v0, p0, v1}, Lcom/discord/stores/StoreUserSettings;->setAccountToken(Ljava/lang/String;Ljava/lang/String;)V
+
+ const-string p0, "CTC: Added account."
@ -2810,7 +2823,7 @@ diff -crB com.discord-903-base/smali/com/discord/stores/StoreMessages.smali com.
.annotation system Ldalvik/annotation/Signature;
***************
*** 977,982 ****
--- 3744,3753 ----
--- 3757,3766 ----
invoke-static {p4, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
@ -2823,7 +2836,7 @@ diff -crB com.discord-903-base/smali/com/discord/stores/StoreMessages.smali com.
if-eqz p6, :cond_0
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-26 22:24:34.401539018 +0300
--- com.discord-903/smali/com/discord/stores/StoreUserSettings.smali 2019-05-26 22:55:23.815254247 +0300
***************
*** 1272,1277 ****
--- 1272,1452 ----
@ -3010,7 +3023,7 @@ diff -crB com.discord-903-base/smali/com/discord/stores/StoreUserSettings.smali
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 20:27:36.482112172 +0300
--- com.discord-903/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali 2019-05-26 22:55:23.818587599 +0300
***************
*** 124,129 ****
--- 124,139 ----
@ -3032,7 +3045,7 @@ diff -crB com.discord-903-base/smali/com/discord/widgets/chat/input/WidgetChatIn
diff -crB com.discord-903-base/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali com.discord-903/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali
*** com.discord-903-base/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali 2019-05-24 23:40:49.907470826 +0300
--- com.discord-903/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali 2019-05-26 20:27:36.482112172 +0300
--- com.discord-903/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali 2019-05-26 22:55:23.818587599 +0300
***************
*** 355,360 ****
--- 355,362 ----
@ -3093,7 +3106,7 @@ diff -crB com.discord-903-base/smali/com/discord/widgets/chat/input/WidgetChatIn
.line 79
diff -crB com.discord-903-base/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali com.discord-903/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali
*** com.discord-903-base/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali 2019-05-24 23:40:49.907470826 +0300
--- com.discord-903/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali 2019-05-26 20:27:36.485445524 +0300
--- com.discord-903/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali 2019-05-26 22:55:23.818587599 +0300
***************
*** 50,55 ****
--- 50,79 ----

View file

@ -27,12 +27,13 @@ CutTheCord has a couple features that can utilized with slash commands as well:
- /ctc notyping true/false -> Disables typing event so that it's not visible when you type (true = typing is shown, false = not shown)
- /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)
- /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`)
- /ctc account $name -> Switches to the account (requires you to restart the app)
Commands like fw can be generated by `textreplacegen.py` or `textreplacegen-array.py` provided in this folder.
## Known bugs
- There's no help.
- Output from /ctc commands doesn't get properly displayed if enter is not pressed using a physical keyboard (usb or bluetooth). This is bizarre and oh god please help me solve this bug.
#### Available and tested on: