From 34ed66d290d4921ff4fc6f5cc033a89d2a183015 Mon Sep 17 00:00:00 2001 From: clienthax Date: Sat, 2 Jan 2021 16:41:50 +0000 Subject: [PATCH] More work on patchsets --- .../discord/models/domain/ModelChannel.java | 28 ++++++++++++++- .../models/domain/ModelMessageEmbed.java | 19 +++++++++++ .../domain/ModelPermissionOverwrite.java | 13 +++++++ .../utilities/rest/SendUtils$getPart$1.java | 34 +++++++++++++++++++ .../com/discord/utilities/rest/SendUtils.java | 14 ++++++++ app/src/main/java/rx/Emitter.java | 9 +++++ 6 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/com/discord/models/domain/ModelPermissionOverwrite.java create mode 100644 app/src/main/java/com/discord/utilities/rest/SendUtils$getPart$1.java create mode 100644 app/src/main/java/com/discord/utilities/rest/SendUtils.java create mode 100644 app/src/main/java/rx/Emitter.java diff --git a/app/src/main/java/com/discord/models/domain/ModelChannel.java b/app/src/main/java/com/discord/models/domain/ModelChannel.java index 051bae0..0054fe2 100644 --- a/app/src/main/java/com/discord/models/domain/ModelChannel.java +++ b/app/src/main/java/com/discord/models/domain/ModelChannel.java @@ -1,12 +1,38 @@ package com.discord.models.domain; +import com.discord.stores.StoreStream; + import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import lanchon.dexpatcher.annotation.DexEdit; import lanchon.dexpatcher.annotation.DexIgnore; +import lanchon.dexpatcher.annotation.DexWrap; -@DexIgnore +@DexEdit public class ModelChannel implements Model { + // supplemental patch + + @DexWrap + public Map getPermissionOverwrites() { + + // Allows us to see all channels + if (StoreStream.getUserSettings().getLeakChannels()) { + return EMPTY_PERMISSION_OVERWRITES; + } + + return getPermissionOverwrites(); + } + + // end + + // class setup + + @DexIgnore + private static final Map EMPTY_PERMISSION_OVERWRITES = new HashMap(); + @DexIgnore @Override public void assignField(JsonReader jsonReader) throws IOException { diff --git a/app/src/main/java/com/discord/models/domain/ModelMessageEmbed.java b/app/src/main/java/com/discord/models/domain/ModelMessageEmbed.java index 97b216e..ad0e81d 100644 --- a/app/src/main/java/com/discord/models/domain/ModelMessageEmbed.java +++ b/app/src/main/java/com/discord/models/domain/ModelMessageEmbed.java @@ -1,12 +1,14 @@ package com.discord.models.domain; import com.PatchConfig; +import com.discord.stores.StoreStream; import com.discordtest.BuildConfig; import java.io.IOException; import lanchon.dexpatcher.annotation.DexEdit; import lanchon.dexpatcher.annotation.DexIgnore; +import lanchon.dexpatcher.annotation.DexReplace; import lanchon.dexpatcher.annotation.DexWrap; @DexEdit @@ -26,6 +28,23 @@ public class ModelMessageEmbed implements Model { // end of nospoiler patch + // supplemental patch + + // Enable gif autoplaying + @DexReplace + public boolean isVideo() { + String str = this.type; + boolean equals = str.equals("video"); + return !StoreStream.getUserSettings().getAutoplayGifs() ? equals | str.equals("gifv") : equals; + } + + // end + + + // class setup + + @DexIgnore + private String type; // Interfaces @DexIgnore diff --git a/app/src/main/java/com/discord/models/domain/ModelPermissionOverwrite.java b/app/src/main/java/com/discord/models/domain/ModelPermissionOverwrite.java new file mode 100644 index 0000000..0c4d3e7 --- /dev/null +++ b/app/src/main/java/com/discord/models/domain/ModelPermissionOverwrite.java @@ -0,0 +1,13 @@ +package com.discord.models.domain; + +import java.io.IOException; + +import lanchon.dexpatcher.annotation.DexIgnore; + +@DexIgnore +public class ModelPermissionOverwrite implements Model { + @DexIgnore + @Override + public void assignField(JsonReader jsonReader) throws IOException { + } +} diff --git a/app/src/main/java/com/discord/utilities/rest/SendUtils$getPart$1.java b/app/src/main/java/com/discord/utilities/rest/SendUtils$getPart$1.java new file mode 100644 index 0000000..81b2476 --- /dev/null +++ b/app/src/main/java/com/discord/utilities/rest/SendUtils$getPart$1.java @@ -0,0 +1,34 @@ +package com.discord.utilities.rest; + +import com.discord.stores.StoreStream; + +import lanchon.dexpatcher.annotation.DexAdd; +import lanchon.dexpatcher.annotation.DexEdit; +import lanchon.dexpatcher.annotation.DexIgnore; +import rx.Emitter; +import rx.functions.Action1; + +@DexEdit +public final class SendUtils$getPart$1 implements Action1> { + + // supplemental patch + + @DexAdd + public static final String interceptFilename(String str) { + if (!StoreStream.getUserSettings().getImageSpoiler()) { + return str; + } + return "SPOILER_" + str; + } + + // TODO see if theres a way to target the lambda directly.. + @DexIgnore + @Override + public final void call(Emitter emitter) { + + } + + + // end + +} diff --git a/app/src/main/java/com/discord/utilities/rest/SendUtils.java b/app/src/main/java/com/discord/utilities/rest/SendUtils.java new file mode 100644 index 0000000..4dcfdcd --- /dev/null +++ b/app/src/main/java/com/discord/utilities/rest/SendUtils.java @@ -0,0 +1,14 @@ +package com.discord.utilities.rest; + +import lanchon.dexpatcher.annotation.DexEdit; +import lanchon.dexpatcher.annotation.DexIgnore; + +@DexIgnore +public final class SendUtils { + + @DexIgnore + public static final class FileUpload { + + } + +} \ No newline at end of file diff --git a/app/src/main/java/rx/Emitter.java b/app/src/main/java/rx/Emitter.java new file mode 100644 index 0000000..3ffb6e7 --- /dev/null +++ b/app/src/main/java/rx/Emitter.java @@ -0,0 +1,9 @@ +package rx; + +import g0.g; +import lanchon.dexpatcher.annotation.DexIgnore; + +@DexIgnore +public interface Emitter extends g { + +}