build(Needs bump): Bump dependencies (#2946)
Co-authored-by: Ushie <ushiekane@gmail.com> Co-authored-by: aAbed <aabedhkhan@gmail.com> Co-authored-by: CnC-Robert <CnC.Rob3rt@gmail.com>
This commit is contained in:
co-authored by
Ushie
aAbed
CnC-Robert
parent
fe3a6fd4a4
commit
8c8dff9078
+14
-15
@@ -1,28 +1,27 @@
|
||||
package app.revanced.patches.twitch.ad.audio.patch
|
||||
package app.revanced.patches.twitch.ad.audio
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.twitch.ad.audio.annotations.AudioAdsCompatibility
|
||||
import app.revanced.patches.twitch.ad.audio.fingerprints.AudioAdsPresenterPlayFingerprint
|
||||
import app.revanced.patches.twitch.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.twitch.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.twitch.misc.settings.SettingsPatch
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("Block audio ads")
|
||||
@Description("Blocks audio ads in streams and VODs.")
|
||||
@AudioAdsCompatibility
|
||||
class AudioAdsPatch : BytecodePatch(
|
||||
listOf(AudioAdsPresenterPlayFingerprint)
|
||||
@Patch(
|
||||
name = "Block audio ads",
|
||||
description = "Blocks audio ads in streams and VODs.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0"])],
|
||||
)
|
||||
@Suppress("unused")
|
||||
object AudioAdsPatch : BytecodePatch(
|
||||
setOf(AudioAdsPresenterPlayFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// Block playAds call
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package app.revanced.patches.twitch.ad.audio.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("tv.twitch.android.app", arrayOf("15.4.1", "16.1.0"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class AudioAdsCompatibility
|
||||
|
||||
+17
-19
@@ -1,33 +1,31 @@
|
||||
package app.revanced.patches.twitch.ad.embedded.patch
|
||||
package app.revanced.patches.twitch.ad.embedded
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.ArrayResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.ListPreference
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.twitch.ad.embedded.annotations.EmbeddedAdsCompatibility
|
||||
import app.revanced.patches.twitch.ad.embedded.fingerprints.CreateUsherClientFingerprint
|
||||
import app.revanced.patches.twitch.ad.video.patch.VideoAdsPatch
|
||||
import app.revanced.patches.twitch.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.twitch.ad.video.VideoAdsPatch
|
||||
import app.revanced.patches.twitch.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.twitch.misc.settings.SettingsPatch
|
||||
|
||||
@Patch
|
||||
@DependsOn([VideoAdsPatch::class, IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("Block embedded ads")
|
||||
@Description("Blocks embedded stream ads using services like Luminous or PurpleAdBlocker.")
|
||||
@EmbeddedAdsCompatibility
|
||||
class EmbeddedAdsPatch : BytecodePatch(
|
||||
listOf(CreateUsherClientFingerprint)
|
||||
@Patch(
|
||||
name = "Block embedded ads",
|
||||
description = "Blocks embedded stream ads using services like Luminous or PurpleAdBlocker.",
|
||||
dependencies = [VideoAdsPatch::class, IntegrationsPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0"])]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object EmbeddedAdsPatch : BytecodePatch(
|
||||
setOf(CreateUsherClientFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
val result = CreateUsherClientFingerprint.result ?: throw PatchException("${CreateUsherClientFingerprint.name} not found")
|
||||
val result = CreateUsherClientFingerprint.result ?: throw CreateUsherClientFingerprint.exception
|
||||
|
||||
// Inject OkHttp3 application interceptor
|
||||
result.mutableMethod.addInstructions(
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package app.revanced.patches.twitch.ad.embedded.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("tv.twitch.android.app", arrayOf("15.4.1", "16.1.0"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class EmbeddedAdsCompatibility
|
||||
|
||||
@@ -10,7 +10,7 @@ import app.revanced.patcher.util.smali.ExternalLabel
|
||||
abstract class AbstractAdPatch(
|
||||
val conditionCall: String,
|
||||
val skipLabelName: String,
|
||||
internal val fingerprints: Iterable<MethodFingerprint>? = null,
|
||||
internal val fingerprints: Set<MethodFingerprint> = emptySet(),
|
||||
) : BytecodePatch(fingerprints) {
|
||||
|
||||
protected fun createConditionInstructions(register: String = "v0") = """
|
||||
|
||||
+13
-15
@@ -1,34 +1,32 @@
|
||||
package app.revanced.patches.twitch.ad.video.patch
|
||||
package app.revanced.patches.twitch.ad.video
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.twitch.ad.shared.util.AbstractAdPatch
|
||||
import app.revanced.patches.twitch.ad.video.annotations.VideoAdsCompatibility
|
||||
import app.revanced.patches.twitch.ad.video.fingerprints.CheckAdEligibilityLambdaFingerprint
|
||||
import app.revanced.patches.twitch.ad.video.fingerprints.ContentConfigShowAdsFingerprint
|
||||
import app.revanced.patches.twitch.ad.video.fingerprints.GetReadyToShowAdFingerprint
|
||||
import app.revanced.patches.twitch.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.twitch.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.twitch.misc.settings.SettingsPatch
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("Block video ads")
|
||||
@Description("Blocks video ads in streams and VODs.")
|
||||
@VideoAdsCompatibility
|
||||
class VideoAdsPatch : AbstractAdPatch(
|
||||
@Patch(
|
||||
name = "Block video ads",
|
||||
description = "Blocks video ads in streams and VODs.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0"])]
|
||||
)
|
||||
object VideoAdsPatch : AbstractAdPatch(
|
||||
"Lapp/revanced/twitch/patches/VideoAdsPatch;->shouldBlockVideoAds()Z",
|
||||
"show_video_ads",
|
||||
listOf(
|
||||
setOf(
|
||||
ContentConfigShowAdsFingerprint,
|
||||
CheckAdEligibilityLambdaFingerprint,
|
||||
GetReadyToShowAdFingerprint
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package app.revanced.patches.twitch.ad.video.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("tv.twitch.android.app", arrayOf("15.4.1", "16.1.0"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class VideoAdsCompatibility
|
||||
|
||||
+14
-15
@@ -1,33 +1,32 @@
|
||||
package app.revanced.patches.twitch.chat.antidelete.patch
|
||||
package app.revanced.patches.twitch.chat.antidelete
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.settings.preference.impl.ArrayResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.ListPreference
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.twitch.chat.antidelete.annotations.ShowDeletedMessagesCompatibility
|
||||
import app.revanced.patches.twitch.chat.antidelete.fingerprints.ChatUtilCreateDeletedSpanFingerprint
|
||||
import app.revanced.patches.twitch.chat.antidelete.fingerprints.DeletedMessageClickableSpanCtorFingerprint
|
||||
import app.revanced.patches.twitch.chat.antidelete.fingerprints.SetHasModAccessFingerprint
|
||||
import app.revanced.patches.twitch.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.twitch.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.twitch.misc.settings.SettingsPatch
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("Show deleted messages")
|
||||
@Description("Shows deleted chat messages behind a clickable spoiler.")
|
||||
@ShowDeletedMessagesCompatibility
|
||||
class ShowDeletedMessagesPatch : BytecodePatch(
|
||||
listOf(
|
||||
@Patch(
|
||||
name = "Show deleted messages",
|
||||
description = "Shows deleted chat messages behind a clickable spoiler.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0"])]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object ShowDeletedMessagesPatch : BytecodePatch(
|
||||
setOf(
|
||||
SetHasModAccessFingerprint,
|
||||
DeletedMessageClickableSpanCtorFingerprint,
|
||||
ChatUtilCreateDeletedSpanFingerprint
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package app.revanced.patches.twitch.chat.antidelete.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("tv.twitch.android.app", arrayOf("15.4.1", "16.1.0"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class ShowDeletedMessagesCompatibility
|
||||
|
||||
+13
-14
@@ -1,28 +1,27 @@
|
||||
package app.revanced.patches.twitch.chat.autoclaim.patch
|
||||
package app.revanced.patches.twitch.chat.autoclaim
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.twitch.chat.autoclaim.annotations.AutoClaimChannelPointsCompatibility
|
||||
import app.revanced.patches.twitch.chat.autoclaim.fingerprints.CommunityPointsButtonViewDelegateFingerprint
|
||||
import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.twitch.misc.settings.SettingsPatch
|
||||
|
||||
@Patch
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@Name("Auto claim channel points")
|
||||
@Description("Automatically claim Channel Points.")
|
||||
@AutoClaimChannelPointsCompatibility
|
||||
class AutoClaimChannelPointPatch : BytecodePatch(
|
||||
listOf(CommunityPointsButtonViewDelegateFingerprint)
|
||||
@Patch(
|
||||
name = "Auto claim channel points",
|
||||
description = "Automatically claim Channel Points.",
|
||||
dependencies = [SettingsPatch::class],
|
||||
compatiblePackages = [CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0"])]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object AutoClaimChannelPointPatch : BytecodePatch(
|
||||
setOf(CommunityPointsButtonViewDelegateFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.CHAT.GENERAL.addPreferences(
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.twitch.chat.autoclaim.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("tv.twitch.android.app", arrayOf("15.4.1", "16.1.0"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class AutoClaimChannelPointsCompatibility
|
||||
+15
-15
@@ -1,29 +1,29 @@
|
||||
package app.revanced.patches.twitch.debug.patch
|
||||
package app.revanced.patches.twitch.debug
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.twitch.debug.annotations.DebugModeCompatibility
|
||||
import app.revanced.patches.twitch.debug.fingerprints.IsDebugConfigEnabledFingerprint
|
||||
import app.revanced.patches.twitch.debug.fingerprints.IsOmVerificationEnabledFingerprint
|
||||
import app.revanced.patches.twitch.debug.fingerprints.ShouldShowDebugOptionsFingerprint
|
||||
import app.revanced.patches.twitch.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.twitch.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.twitch.misc.settings.SettingsPatch
|
||||
|
||||
@Patch(false)
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("Debug mode")
|
||||
@Description("Enables Twitch's internal debugging mode.")
|
||||
@DebugModeCompatibility
|
||||
class DebugModePatch : BytecodePatch(
|
||||
listOf(
|
||||
@Patch(
|
||||
name = "Debug mode",
|
||||
description = "Enables Twitch's internal debugging mode.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [CompatiblePackage("tv.twitch.android.app")],
|
||||
use = false
|
||||
)
|
||||
@Suppress("unused")
|
||||
object DebugModePatch : BytecodePatch(
|
||||
setOf(
|
||||
IsDebugConfigEnabledFingerprint,
|
||||
IsOmVerificationEnabledFingerprint,
|
||||
ShouldShowDebugOptionsFingerprint
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package app.revanced.patches.twitch.debug.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("tv.twitch.android.app")])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class DebugModeCompatibility
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package app.revanced.patches.twitch.misc.integrations
|
||||
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.integrations.AbstractIntegrationsPatch
|
||||
import app.revanced.patches.twitch.misc.integrations.fingerprints.InitFingerprint
|
||||
|
||||
@Patch(requiresIntegrations = true)
|
||||
object IntegrationsPatch : AbstractIntegrationsPatch(
|
||||
"Lapp/revanced/twitch/utils/ReVancedUtils;",
|
||||
setOf(InitFingerprint)
|
||||
)
|
||||
+1
-3
@@ -1,9 +1,7 @@
|
||||
package app.revanced.patches.twitch.misc.integrations.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
|
||||
import app.revanced.patches.shared.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint
|
||||
|
||||
@Name("Init fingerprint")
|
||||
object InitFingerprint : IntegrationsFingerprint(
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.definingClass.endsWith("/TwitchApplication;") &&
|
||||
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
package app.revanced.patches.twitch.misc.integrations.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.patch.annotations.RequiresIntegrations
|
||||
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch
|
||||
import app.revanced.patches.twitch.misc.integrations.fingerprints.InitFingerprint
|
||||
|
||||
@Name("Integrations")
|
||||
@RequiresIntegrations
|
||||
class IntegrationsPatch : AbstractIntegrationsPatch(
|
||||
"Lapp/revanced/twitch/utils/ReVancedUtils;",
|
||||
listOf(InitFingerprint)
|
||||
)
|
||||
+54
-57
@@ -1,8 +1,6 @@
|
||||
package app.revanced.patches.twitch.misc.settings.bytecode.patch
|
||||
package app.revanced.patches.twitch.misc.settings
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
@@ -10,37 +8,51 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.settings.preference.impl.PreferenceCategory
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.util.AbstractPreferenceScreen
|
||||
import app.revanced.patches.twitch.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.twitch.misc.settings.annotations.SettingsCompatibility
|
||||
import app.revanced.patches.twitch.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.twitch.misc.settings.fingerprints.MenuGroupsOnClickFingerprint
|
||||
import app.revanced.patches.twitch.misc.settings.fingerprints.MenuGroupsUpdatedFingerprint
|
||||
import app.revanced.patches.twitch.misc.settings.fingerprints.SettingsActivityOnCreateFingerprint
|
||||
import app.revanced.patches.twitch.misc.settings.fingerprints.SettingsMenuItemEnumFingerprint
|
||||
import app.revanced.patches.twitch.misc.settings.resource.patch.SettingsResourcePatch
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.immutable.ImmutableField
|
||||
import java.io.Closeable
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, SettingsResourcePatch::class])
|
||||
@Name("Settings")
|
||||
@Description("Adds settings menu to Twitch.")
|
||||
@SettingsCompatibility
|
||||
class SettingsPatch : BytecodePatch(
|
||||
listOf(
|
||||
|
||||
@Patch(
|
||||
name = "Settings",
|
||||
description = "Adds settings menu to Twitch.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsResourcePatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage("tv.twitch.android.app")
|
||||
]
|
||||
)
|
||||
object SettingsPatch : BytecodePatch(
|
||||
setOf(
|
||||
SettingsActivityOnCreateFingerprint,
|
||||
SettingsMenuItemEnumFingerprint,
|
||||
MenuGroupsUpdatedFingerprint,
|
||||
MenuGroupsOnClickFingerprint
|
||||
)
|
||||
), Closeable {
|
||||
private const val REVANCED_SETTINGS_MENU_ITEM_NAME = "RevancedSettings"
|
||||
private const val REVANCED_SETTINGS_MENU_ITEM_ID = 0x7
|
||||
private const val REVANCED_SETTINGS_MENU_ITEM_TITLE_RES = "revanced_settings"
|
||||
private const val REVANCED_SETTINGS_MENU_ITEM_ICON_RES = "ic_settings"
|
||||
|
||||
private const val MENU_ITEM_ENUM_CLASS = "Ltv/twitch/android/feature/settings/menu/SettingsMenuItem;"
|
||||
private const val MENU_DISMISS_EVENT_CLASS = "Ltv/twitch/android/feature/settings/menu/SettingsMenuViewDelegate\$Event\$OnDismissClicked;"
|
||||
|
||||
private const val INTEGRATIONS_PACKAGE = "app/revanced/twitch"
|
||||
private const val SETTINGS_HOOKS_CLASS = "L$INTEGRATIONS_PACKAGE/settingsmenu/SettingsHooks;"
|
||||
private const val REVANCED_UTILS_CLASS = "L$INTEGRATIONS_PACKAGE/utils/ReVancedUtils;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// Hook onCreate to handle fragment creation
|
||||
SettingsActivityOnCreateFingerprint.result?.apply {
|
||||
@@ -102,49 +114,35 @@ class SettingsPatch : BytecodePatch(
|
||||
addString("revanced_cancel", "Cancel", false)
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
fun addString(identifier: String, value: String, formatted: Boolean = true) =
|
||||
SettingsResourcePatch.addString(identifier, value, formatted)
|
||||
fun addString(identifier: String, value: String, formatted: Boolean = true) =
|
||||
SettingsResourcePatch.addString(identifier, value, formatted)
|
||||
|
||||
fun addPreferenceScreen(preferenceScreen: app.revanced.patches.shared.settings.preference.impl.PreferenceScreen) =
|
||||
SettingsResourcePatch.addPreferenceScreen(preferenceScreen)
|
||||
fun addPreferenceScreen(preferenceScreen: app.revanced.patches.shared.settings.preference.impl.PreferenceScreen) =
|
||||
SettingsResourcePatch.addPreferenceScreen(preferenceScreen)
|
||||
|
||||
/* Private members */
|
||||
private const val REVANCED_SETTINGS_MENU_ITEM_NAME = "RevancedSettings"
|
||||
private const val REVANCED_SETTINGS_MENU_ITEM_ID = 0x7
|
||||
private const val REVANCED_SETTINGS_MENU_ITEM_TITLE_RES = "revanced_settings"
|
||||
private const val REVANCED_SETTINGS_MENU_ITEM_ICON_RES = "ic_settings"
|
||||
private fun MethodFingerprintResult.injectMenuItem(
|
||||
name: String,
|
||||
value: Int,
|
||||
titleResourceName: String,
|
||||
iconResourceName: String
|
||||
) {
|
||||
// Add new static enum member field
|
||||
mutableClass.staticFields.add(
|
||||
ImmutableField(
|
||||
mutableMethod.definingClass,
|
||||
name,
|
||||
MENU_ITEM_ENUM_CLASS,
|
||||
AccessFlags.PUBLIC or AccessFlags.FINAL or AccessFlags.ENUM or AccessFlags.STATIC,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
).toMutable()
|
||||
)
|
||||
|
||||
private const val MENU_ITEM_ENUM_CLASS = "Ltv/twitch/android/feature/settings/menu/SettingsMenuItem;"
|
||||
private const val MENU_DISMISS_EVENT_CLASS = "Ltv/twitch/android/feature/settings/menu/SettingsMenuViewDelegate\$Event\$OnDismissClicked;"
|
||||
|
||||
private const val INTEGRATIONS_PACKAGE = "app/revanced/twitch"
|
||||
private const val SETTINGS_HOOKS_CLASS = "L$INTEGRATIONS_PACKAGE/settingsmenu/SettingsHooks;"
|
||||
private const val REVANCED_UTILS_CLASS = "L$INTEGRATIONS_PACKAGE/utils/ReVancedUtils;"
|
||||
|
||||
private fun MethodFingerprintResult.injectMenuItem(
|
||||
name: String,
|
||||
value: Int,
|
||||
titleResourceName: String,
|
||||
iconResourceName: String
|
||||
) {
|
||||
// Add new static enum member field
|
||||
mutableClass.staticFields.add(
|
||||
ImmutableField(
|
||||
mutableMethod.definingClass,
|
||||
name,
|
||||
MENU_ITEM_ENUM_CLASS,
|
||||
AccessFlags.PUBLIC or AccessFlags.FINAL or AccessFlags.ENUM or AccessFlags.STATIC,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
).toMutable()
|
||||
)
|
||||
|
||||
// Add initializer for the new enum member
|
||||
mutableMethod.addInstructions(
|
||||
mutableMethod.implementation!!.instructions.size - 4,
|
||||
"""
|
||||
// Add initializer for the new enum member
|
||||
mutableMethod.addInstructions(
|
||||
mutableMethod.implementation!!.instructions.size - 4,
|
||||
"""
|
||||
new-instance v0, $MENU_ITEM_ENUM_CLASS
|
||||
const-string v1, "$titleResourceName"
|
||||
invoke-static {v1}, $REVANCED_UTILS_CLASS->getStringId(Ljava/lang/String;)I
|
||||
@@ -157,8 +155,7 @@ class SettingsPatch : BytecodePatch(
|
||||
invoke-direct {v0, v4, v5, v1, v3}, $MENU_ITEM_ENUM_CLASS-><init>(Ljava/lang/String;III)V
|
||||
sput-object v0, $MENU_ITEM_ENUM_CLASS->$name:$MENU_ITEM_ENUM_CLASS
|
||||
"""
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -0,0 +1,36 @@
|
||||
package app.revanced.patches.twitch.misc.settings
|
||||
|
||||
import app.revanced.patches.shared.settings.AbstractSettingsResourcePatch
|
||||
import app.revanced.patches.shared.settings.preference.impl.ArrayResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
|
||||
|
||||
object SettingsResourcePatch : AbstractSettingsResourcePatch(
|
||||
"revanced_prefs",
|
||||
"twitch/settings"
|
||||
) {
|
||||
/* Companion delegates */
|
||||
|
||||
/**
|
||||
* Add a new string to the resources.
|
||||
*
|
||||
* @param identifier The key of the string.
|
||||
* @param value The value of the string.
|
||||
* @throws IllegalArgumentException if the string already exists.
|
||||
*/
|
||||
fun addString(identifier: String, value: String, formatted: Boolean) =
|
||||
AbstractSettingsResourcePatch.addString(identifier, value, formatted)
|
||||
|
||||
/**
|
||||
* Add an array to the resources.
|
||||
*
|
||||
* @param arrayResource The array resource to add.
|
||||
*/
|
||||
fun addArray(arrayResource: ArrayResource) = AbstractSettingsResourcePatch.addArray(arrayResource)
|
||||
|
||||
/**
|
||||
* Add a preference to the settings.
|
||||
*
|
||||
* @param preferenceScreen The name of the preference screen.
|
||||
*/
|
||||
fun addPreferenceScreen(preferenceScreen: PreferenceScreen) = AbstractSettingsResourcePatch.addPreference(preferenceScreen)
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.twitch.misc.settings.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("tv.twitch.android.app")])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class SettingsCompatibility
|
||||
-38
@@ -1,38 +0,0 @@
|
||||
package app.revanced.patches.twitch.misc.settings.resource.patch
|
||||
|
||||
import app.revanced.patches.shared.settings.preference.impl.ArrayResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
|
||||
import app.revanced.patches.shared.settings.resource.patch.AbstractSettingsResourcePatch
|
||||
|
||||
class SettingsResourcePatch : AbstractSettingsResourcePatch(
|
||||
"revanced_prefs",
|
||||
"twitch/settings"
|
||||
) {
|
||||
internal companion object {
|
||||
/* Companion delegates */
|
||||
|
||||
/**
|
||||
* Add a new string to the resources.
|
||||
*
|
||||
* @param identifier The key of the string.
|
||||
* @param value The value of the string.
|
||||
* @throws IllegalArgumentException if the string already exists.
|
||||
*/
|
||||
fun addString(identifier: String, value: String, formatted: Boolean) =
|
||||
AbstractSettingsResourcePatch.addString(identifier, value, formatted)
|
||||
|
||||
/**
|
||||
* Add an array to the resources.
|
||||
*
|
||||
* @param arrayResource The array resource to add.
|
||||
*/
|
||||
fun addArray(arrayResource: ArrayResource) = AbstractSettingsResourcePatch.addArray(arrayResource)
|
||||
|
||||
/**
|
||||
* Add a preference to the settings.
|
||||
*
|
||||
* @param preferenceScreen The name of the preference screen.
|
||||
*/
|
||||
fun addPreferenceScreen(preferenceScreen: PreferenceScreen) = AbstractSettingsResourcePatch.addPreference(preferenceScreen)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user