Fixup commands/supplemental changes.

This commit is contained in:
clienthax 2021-08-21 17:02:18 +01:00
parent 4de5282bf3
commit c17cb44eaa
2 changed files with 90 additions and 66 deletions

View file

@ -19,11 +19,24 @@ public class CmdCtc {
public String processEnableDisable(boolean enabled) {
try {
//noinspection JavaReflectionMemberAccess
final Method m = StoreStream.getUserSettings().getClass().getDeclaredMethod("setLeakChannels", Boolean.class);
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");
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
}
@ -37,7 +50,7 @@ public class CmdCtc {
try {
//noinspection JavaReflectionMemberAccess
final Method m = StoreStream.getUserSettings().getClass().getDeclaredMethod("setShowTyping", Boolean.class);
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");
@ -56,7 +69,7 @@ public class CmdCtc {
try {
//noinspection JavaReflectionMemberAccess
final Method m = StoreStream.getUserSettings().getClass().getDeclaredMethod("setNoDelete", Boolean.class);
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");

View file

@ -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;-><init>()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;
+