feat: Move strings to resources for localization (#2440)

Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: Aunali321 <aunvakil.aa@gmail.com>

BREAKING CHANGE: Various APIs have been changed.
This commit is contained in:
LisoUseInAIKyrios 2024-01-27 05:34:01 +04:00 committed by GitHub
parent cb7ecb6443
commit 060ab8fbfe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
201 changed files with 3411 additions and 3784 deletions

View File

@ -4,7 +4,7 @@ public final class app/revanced/patches/all/activity/exportall/ExportAllActiviti
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
}
public final class app/revanced/patches/all/connectivity/wifi/spoof/SpoofWifiPatch : app/revanced/patches/all/misc/transformation/AbstractTransformInstructionsPatch {
public final class app/revanced/patches/all/connectivity/wifi/spoof/SpoofWifiPatch : app/revanced/patches/all/misc/transformation/BaseTransformInstructionsPatch {
public static final field INSTANCE Lapp/revanced/patches/all/connectivity/wifi/spoof/SpoofWifiPatch;
public synthetic fun filterMap (Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;I)Ljava/lang/Object;
public fun filterMap (Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;I)Lkotlin/Triple;
@ -38,7 +38,44 @@ public final class app/revanced/patches/all/misc/packagename/ChangePackageNamePa
public final fun setOrGetFallbackPackageName (Ljava/lang/String;)Ljava/lang/String;
}
public abstract class app/revanced/patches/all/misc/transformation/AbstractTransformInstructionsPatch : app/revanced/patcher/patch/BytecodePatch {
public final class app/revanced/patches/all/misc/resources/AddResourcesPatch : app/revanced/patcher/patch/ResourcePatch, java/io/Closeable, java/util/Map, kotlin/jvm/internal/markers/KMutableMap {
public static final field INSTANCE Lapp/revanced/patches/all/misc/resources/AddResourcesPatch;
public fun clear ()V
public fun close ()V
public final fun containsKey (Ljava/lang/Object;)Z
public fun containsKey (Ljava/lang/String;)Z
public final fun containsValue (Ljava/lang/Object;)Z
public fun containsValue (Ljava/util/Set;)Z
public final fun entrySet ()Ljava/util/Set;
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
public final synthetic fun get (Ljava/lang/Object;)Ljava/lang/Object;
public final fun get (Ljava/lang/Object;)Ljava/util/Set;
public fun get (Ljava/lang/String;)Ljava/util/Set;
public fun getEntries ()Ljava/util/Set;
public fun getKeys ()Ljava/util/Set;
public fun getSize ()I
public fun getValues ()Ljava/util/Collection;
public final fun invoke (Ljava/lang/String;Lapp/revanced/util/resource/BaseResource;)Z
public final fun invoke (Ljava/lang/String;Ljava/lang/Iterable;)Z
public final fun invoke (Ljava/lang/String;Ljava/lang/String;ZLjava/lang/String;)Z
public final fun invoke (Ljava/lang/String;Ljava/util/List;)Z
public final fun invoke (Lkotlin/reflect/KClass;Lkotlin/jvm/functions/Function1;)Z
public static synthetic fun invoke$default (Lapp/revanced/patches/all/misc/resources/AddResourcesPatch;Ljava/lang/String;Ljava/lang/String;ZLjava/lang/String;ILjava/lang/Object;)Z
public static synthetic fun invoke$default (Lapp/revanced/patches/all/misc/resources/AddResourcesPatch;Lkotlin/reflect/KClass;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Z
public fun isEmpty ()Z
public final fun keySet ()Ljava/util/Set;
public synthetic fun put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public fun put (Ljava/lang/String;Ljava/util/Set;)Ljava/util/Set;
public fun putAll (Ljava/util/Map;)V
public final synthetic fun remove (Ljava/lang/Object;)Ljava/lang/Object;
public final fun remove (Ljava/lang/Object;)Ljava/util/Set;
public fun remove (Ljava/lang/String;)Ljava/util/Set;
public final fun size ()I
public final fun values ()Ljava/util/Collection;
}
public abstract class app/revanced/patches/all/misc/transformation/BaseTransformInstructionsPatch : app/revanced/patcher/patch/BytecodePatch {
public fun <init> ()V
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
@ -59,7 +96,7 @@ public final class app/revanced/patches/all/misc/transformation/IMethodCall$Defa
public static fun replaceInvokeVirtualWithIntegrations (Lapp/revanced/patches/all/misc/transformation/IMethodCall;Ljava/lang/String;Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Lcom/android/tools/smali/dexlib2/iface/instruction/formats/Instruction35c;I)V
}
public final class app/revanced/patches/all/screencapture/removerestriction/RemoveCaptureRestrictionPatch : app/revanced/patches/all/misc/transformation/AbstractTransformInstructionsPatch {
public final class app/revanced/patches/all/screencapture/removerestriction/RemoveCaptureRestrictionPatch : app/revanced/patches/all/misc/transformation/BaseTransformInstructionsPatch {
public static final field INSTANCE Lapp/revanced/patches/all/screencapture/removerestriction/RemoveCaptureRestrictionPatch;
public synthetic fun filterMap (Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;I)Ljava/lang/Object;
public fun filterMap (Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;I)Lkotlin/Triple;
@ -80,7 +117,7 @@ public final class app/revanced/patches/all/screencapture/removerestriction/Remo
public static fun values ()[Lapp/revanced/patches/all/screencapture/removerestriction/RemoveCaptureRestrictionPatch$MethodCall;
}
public final class app/revanced/patches/all/screenshot/removerestriction/RemoveScreenshotRestrictionPatch : app/revanced/patches/all/misc/transformation/AbstractTransformInstructionsPatch {
public final class app/revanced/patches/all/screenshot/removerestriction/RemoveScreenshotRestrictionPatch : app/revanced/patches/all/misc/transformation/BaseTransformInstructionsPatch {
public static final field INSTANCE Lapp/revanced/patches/all/screenshot/removerestriction/RemoveScreenshotRestrictionPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
@ -103,7 +140,7 @@ public final class app/revanced/patches/all/screenshot/removerestriction/RemoveS
public static fun values ()[Lapp/revanced/patches/all/screenshot/removerestriction/RemoveScreenshotRestrictionPatch$MethodCall;
}
public final class app/revanced/patches/all/telephony/sim/spoof/SpoofSimCountryPatch : app/revanced/patches/all/misc/transformation/AbstractTransformInstructionsPatch {
public final class app/revanced/patches/all/telephony/sim/spoof/SpoofSimCountryPatch : app/revanced/patches/all/misc/transformation/BaseTransformInstructionsPatch {
public static final field INSTANCE Lapp/revanced/patches/all/telephony/sim/spoof/SpoofSimCountryPatch;
public synthetic fun filterMap (Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;I)Ljava/lang/Object;
public fun filterMap (Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;I)Lkotlin/Pair;
@ -313,14 +350,18 @@ public final class app/revanced/patches/music/misc/gms/Constants {
public static final field INSTANCE Lapp/revanced/patches/music/misc/gms/Constants;
}
public final class app/revanced/patches/music/misc/gms/GmsCoreSupportPatch : app/revanced/patches/shared/misc/gms/AbstractGmsCoreSupportPatch {
public final class app/revanced/patches/music/misc/gms/GmsCoreSupportPatch : app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportPatch {
public static final field INSTANCE Lapp/revanced/patches/music/misc/gms/GmsCoreSupportPatch;
}
public final class app/revanced/patches/music/misc/gms/GmsCoreSupportResourcePatch : app/revanced/patches/shared/misc/gms/AbstractGmsCoreSupportResourcePatch {
public final class app/revanced/patches/music/misc/gms/GmsCoreSupportResourcePatch : app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportResourcePatch {
public static final field INSTANCE Lapp/revanced/patches/music/misc/gms/GmsCoreSupportResourcePatch;
}
public final class app/revanced/patches/music/misc/integrations/IntegrationsPatch : app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch {
public static final field INSTANCE Lapp/revanced/patches/music/misc/integrations/IntegrationsPatch;
}
public final class app/revanced/patches/music/premium/backgroundplay/BackgroundPlayPatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/music/premium/backgroundplay/BackgroundPlayPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
@ -407,7 +448,7 @@ public final class app/revanced/patches/reddit/ad/general/HideAdsPatch : app/rev
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public abstract class app/revanced/patches/reddit/customclients/AbstractSpoofClientPatch : app/revanced/patcher/patch/BytecodePatch {
public abstract class app/revanced/patches/reddit/customclients/BaseSpoofClientPatch : app/revanced/patcher/patch/BytecodePatch {
public fun <init> (Ljava/lang/String;Ljava/util/Set;Ljava/util/Set;Ljava/util/Set;Ljava/util/Set;Ljava/util/Set;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/util/Set;Ljava/util/Set;Ljava/util/Set;Ljava/util/Set;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
@ -424,17 +465,17 @@ public final class app/revanced/patches/reddit/customclients/Constants {
public static final field OAUTH_USER_AGENT Ljava/lang/String;
}
public final class app/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/AbstractSpoofClientPatch {
public final class app/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/BaseSpoofClientPatch {
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch;
public fun patchClientId (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
}
public final class app/revanced/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/AbstractSpoofClientPatch {
public final class app/revanced/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/BaseSpoofClientPatch {
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch;
public fun patchClientId (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
}
public final class app/revanced/patches/reddit/customclients/infinityforreddit/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/AbstractSpoofClientPatch {
public final class app/revanced/patches/reddit/customclients/infinityforreddit/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/BaseSpoofClientPatch {
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/infinityforreddit/api/SpoofClientPatch;
public fun patchClientId (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
}
@ -451,7 +492,7 @@ public final class app/revanced/patches/reddit/customclients/joeyforreddit/ads/D
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/reddit/customclients/joeyforreddit/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/AbstractSpoofClientPatch {
public final class app/revanced/patches/reddit/customclients/joeyforreddit/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/BaseSpoofClientPatch {
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/joeyforreddit/api/SpoofClientPatch;
public fun patchClientId (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
}
@ -462,19 +503,19 @@ public final class app/revanced/patches/reddit/customclients/joeyforreddit/detec
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/AbstractSpoofClientPatch {
public final class app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/BaseSpoofClientPatch {
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch;
public fun patchClientId (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
public fun patchUserAgent (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
}
public final class app/revanced/patches/reddit/customclients/relayforreddit/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/AbstractSpoofClientPatch {
public final class app/revanced/patches/reddit/customclients/relayforreddit/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/BaseSpoofClientPatch {
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/relayforreddit/api/SpoofClientPatch;
public fun patchClientId (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
public fun patchMiscellaneous (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
}
public final class app/revanced/patches/reddit/customclients/slide/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/AbstractSpoofClientPatch {
public final class app/revanced/patches/reddit/customclients/slide/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/BaseSpoofClientPatch {
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/slide/api/SpoofClientPatch;
public fun patchClientId (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
}
@ -491,7 +532,7 @@ public final class app/revanced/patches/reddit/customclients/syncforreddit/annoy
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/reddit/customclients/syncforreddit/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/AbstractSpoofClientPatch {
public final class app/revanced/patches/reddit/customclients/syncforreddit/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/BaseSpoofClientPatch {
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/syncforreddit/api/SpoofClientPatch;
public fun patchClientId (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
public fun patchMiscellaneous (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
@ -533,45 +574,62 @@ public final class app/revanced/patches/serviceportalbund/detection/root/RootDet
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/shared/fingerprints/HomeActivityFingerprint : app/revanced/patches/shared/integrations/AbstractIntegrationsPatch$IntegrationsFingerprint {
public static final field INSTANCE Lapp/revanced/patches/shared/fingerprints/HomeActivityFingerprint;
public final class app/revanced/patches/shared/misc/fix/verticalscroll/VerticalScrollPatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/shared/misc/fix/verticalscroll/VerticalScrollPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public abstract class app/revanced/patches/shared/integrations/AbstractIntegrationsPatch : app/revanced/patcher/patch/BytecodePatch {
public abstract class app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportPatch : app/revanced/patcher/patch/BytecodePatch {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lapp/revanced/patcher/fingerprint/MethodFingerprint;Ljava/util/Set;Lapp/revanced/patcher/fingerprint/MethodFingerprint;Lkotlin/reflect/KClass;Lapp/revanced/patches/shared/misc/gms/BaseGmsCoreSupportResourcePatch;Ljava/util/Set;Ljava/util/Set;Ljava/util/Set;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Lapp/revanced/patcher/fingerprint/MethodFingerprint;Ljava/util/Set;Lapp/revanced/patcher/fingerprint/MethodFingerprint;Lkotlin/reflect/KClass;Lapp/revanced/patches/shared/misc/gms/BaseGmsCoreSupportResourcePatch;Ljava/util/Set;Ljava/util/Set;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public abstract class app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportResourcePatch : app/revanced/patcher/patch/ResourcePatch {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
protected final fun getGmsCoreVendor ()Ljava/lang/String;
}
public abstract class app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch : app/revanced/patcher/patch/BytecodePatch {
public fun <init> (Ljava/lang/String;Ljava/util/Set;)V
public fun <init> (Ljava/util/Set;)V
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public abstract class app/revanced/patches/shared/integrations/AbstractIntegrationsPatch$IntegrationsFingerprint : app/revanced/patcher/fingerprint/MethodFingerprint {
public abstract class app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch$IntegrationsFingerprint : app/revanced/patcher/fingerprint/MethodFingerprint {
public fun <init> ()V
public fun <init> (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun invoke (Ljava/lang/String;)V
}
public abstract interface class app/revanced/patches/shared/integrations/AbstractIntegrationsPatch$IntegrationsFingerprint$RegisterResolver : kotlin/jvm/functions/Function1 {
public abstract interface class app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch$IntegrationsFingerprint$IRegisterResolver : kotlin/jvm/functions/Function1 {
public abstract fun invoke (Lcom/android/tools/smali/dexlib2/iface/Method;)Ljava/lang/Integer;
}
public final class app/revanced/patches/shared/integrations/AbstractIntegrationsPatch$IntegrationsFingerprint$RegisterResolver$DefaultImpls {
public static fun invoke (Lapp/revanced/patches/shared/integrations/AbstractIntegrationsPatch$IntegrationsFingerprint$RegisterResolver;Lcom/android/tools/smali/dexlib2/iface/Method;)Ljava/lang/Integer;
public final class app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch$IntegrationsFingerprint$IRegisterResolver$DefaultImpls {
public static fun invoke (Lapp/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch$IntegrationsFingerprint$IRegisterResolver;Lcom/android/tools/smali/dexlib2/iface/Method;)Ljava/lang/Integer;
}
public final class app/revanced/patches/shared/mapping/misc/ResourceMappingPatch : app/revanced/patcher/patch/ResourcePatch {
public static final field INSTANCE Lapp/revanced/patches/shared/mapping/misc/ResourceMappingPatch;
public final class app/revanced/patches/shared/misc/mapping/ResourceMappingPatch : app/revanced/patcher/patch/ResourcePatch {
public static final field INSTANCE Lapp/revanced/patches/shared/misc/mapping/ResourceMappingPatch;
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
}
public final class app/revanced/patches/shared/mapping/misc/ResourceMappingPatch$ResourceElement {
public final class app/revanced/patches/shared/misc/mapping/ResourceMappingPatch$ResourceElement {
public fun <init> (Ljava/lang/String;Ljava/lang/String;J)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()J
public final fun copy (Ljava/lang/String;Ljava/lang/String;J)Lapp/revanced/patches/shared/mapping/misc/ResourceMappingPatch$ResourceElement;
public static synthetic fun copy$default (Lapp/revanced/patches/shared/mapping/misc/ResourceMappingPatch$ResourceElement;Ljava/lang/String;Ljava/lang/String;JILjava/lang/Object;)Lapp/revanced/patches/shared/mapping/misc/ResourceMappingPatch$ResourceElement;
public final fun copy (Ljava/lang/String;Ljava/lang/String;J)Lapp/revanced/patches/shared/misc/mapping/ResourceMappingPatch$ResourceElement;
public static synthetic fun copy$default (Lapp/revanced/patches/shared/misc/mapping/ResourceMappingPatch$ResourceElement;Ljava/lang/String;Ljava/lang/String;JILjava/lang/Object;)Lapp/revanced/patches/shared/misc/mapping/ResourceMappingPatch$ResourceElement;
public fun equals (Ljava/lang/Object;)Z
public final fun getId ()J
public final fun getName ()Ljava/lang/String;
@ -580,181 +638,175 @@ public final class app/revanced/patches/shared/mapping/misc/ResourceMappingPatch
public fun toString ()Ljava/lang/String;
}
public final class app/revanced/patches/shared/misc/fix/verticalscroll/VerticalScrollPatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/shared/misc/fix/verticalscroll/VerticalScrollPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public abstract class app/revanced/patches/shared/misc/gms/AbstractGmsCoreSupportPatch : app/revanced/patcher/patch/BytecodePatch {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lapp/revanced/patcher/fingerprint/MethodFingerprint;Ljava/util/Set;Lapp/revanced/patches/shared/misc/gms/AbstractGmsCoreSupportResourcePatch;Ljava/util/Set;Ljava/util/Set;Ljava/util/Set;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Lapp/revanced/patcher/fingerprint/MethodFingerprint;Ljava/util/Set;Lapp/revanced/patches/shared/misc/gms/AbstractGmsCoreSupportResourcePatch;Ljava/util/Set;Ljava/util/Set;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public abstract class app/revanced/patches/shared/misc/gms/AbstractGmsCoreSupportResourcePatch : app/revanced/patcher/patch/ResourcePatch {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
protected final fun getGmsCoreVendor ()Ljava/lang/String;
}
public final class app/revanced/patches/shared/misc/gms/fingerprints/GmsCoreSupportFingerprint : app/revanced/patcher/fingerprint/MethodFingerprint {
public static final field GET_GMS_CORE_VENDOR_METHOD_NAME Ljava/lang/String;
public static final field INSTANCE Lapp/revanced/patches/shared/misc/gms/fingerprints/GmsCoreSupportFingerprint;
}
public abstract class app/revanced/patches/shared/settings/AbstractSettingsResourcePatch : app/revanced/patcher/patch/ResourcePatch, java/io/Closeable {
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
public abstract class app/revanced/patches/shared/misc/settings/BaseSettingsResourcePatch : app/revanced/patcher/patch/ResourcePatch, java/io/Closeable, java/util/Set, kotlin/jvm/internal/markers/KMutableSet {
public fun <init> ()V
public fun <init> (Lkotlin/Pair;Ljava/util/Set;)V
public synthetic fun <init> (Lkotlin/Pair;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun add (Lapp/revanced/patches/shared/misc/settings/preference/BasePreference;)Z
public synthetic fun add (Ljava/lang/Object;)Z
public fun addAll (Ljava/util/Collection;)Z
public fun clear ()V
public fun close ()V
public fun contains (Lapp/revanced/patches/shared/misc/settings/preference/BasePreference;)Z
public final fun contains (Ljava/lang/Object;)Z
public fun containsAll (Ljava/util/Collection;)Z
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
public fun getSize ()I
public fun isEmpty ()Z
public fun iterator ()Ljava/util/Iterator;
public fun remove (Lapp/revanced/patches/shared/misc/settings/preference/BasePreference;)Z
public final fun remove (Ljava/lang/Object;)Z
public fun removeAll (Ljava/util/Collection;)Z
public fun retainAll (Ljava/util/Collection;)Z
public final fun size ()I
public fun toArray ()[Ljava/lang/Object;
public fun toArray ([Ljava/lang/Object;)[Ljava/lang/Object;
}
public abstract class app/revanced/patches/shared/settings/preference/BasePreference {
public fun <init> (Ljava/lang/String;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Ljava/lang/String;)V
public synthetic fun <init> (Ljava/lang/String;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public abstract class app/revanced/patches/shared/misc/settings/preference/BasePreference {
public static final field Companion Lapp/revanced/patches/shared/misc/settings/preference/BasePreference$Companion;
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun equals (Ljava/lang/Object;)Z
public final fun getKey ()Ljava/lang/String;
public final fun getSummary ()Lapp/revanced/patches/shared/settings/preference/impl/StringResource;
public final fun getSummaryKey ()Ljava/lang/String;
public final fun getTag ()Ljava/lang/String;
public final fun getTitle ()Lapp/revanced/patches/shared/settings/preference/impl/StringResource;
public final fun getTitleKey ()Ljava/lang/String;
public fun hashCode ()I
public fun serialize (Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;)Lorg/w3c/dom/Element;
}
public abstract class app/revanced/patches/shared/settings/preference/BaseResource {
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
public final fun getName ()Ljava/lang/String;
public final fun getTag ()Ljava/lang/String;
public fun serialize (Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;)Lorg/w3c/dom/Element;
public static synthetic fun serialize$default (Lapp/revanced/patches/shared/settings/preference/BaseResource;Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/w3c/dom/Element;
public final class app/revanced/patches/shared/misc/settings/preference/BasePreference$Companion {
public final fun addSummary (Lorg/w3c/dom/Element;Ljava/lang/String;Lapp/revanced/patches/shared/misc/settings/preference/SummaryType;)V
public static synthetic fun addSummary$default (Lapp/revanced/patches/shared/misc/settings/preference/BasePreference$Companion;Lorg/w3c/dom/Element;Ljava/lang/String;Lapp/revanced/patches/shared/misc/settings/preference/SummaryType;ILjava/lang/Object;)V
}
public final class app/revanced/patches/shared/settings/preference/SummaryType : java/lang/Enum {
public static final field DEFAULT Lapp/revanced/patches/shared/settings/preference/SummaryType;
public static final field OFF Lapp/revanced/patches/shared/settings/preference/SummaryType;
public static final field ON Lapp/revanced/patches/shared/settings/preference/SummaryType;
public abstract class app/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen : java/io/Closeable {
public fun <init> ()V
public fun <init> (Ljava/util/Set;)V
public synthetic fun <init> (Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun close ()V
public abstract fun commit (Lapp/revanced/patches/shared/misc/settings/preference/PreferenceScreen;)V
}
public abstract class app/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$BasePreferenceCollection {
public fun <init> ()V
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getKey ()Ljava/lang/String;
public final fun getPreferences ()Ljava/util/Set;
public final fun getTitleKey ()Ljava/lang/String;
public abstract fun transform ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreference;
}
public class app/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen : app/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$BasePreferenceCollection {
public fun <init> (Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;Ljava/util/Set;)V
public synthetic fun <init> (Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen;Ljava/lang/String;Ljava/util/Set;Ljava/util/Set;)V
public synthetic fun <init> (Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen;Ljava/lang/String;Ljava/util/Set;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun addPreferences ([Lapp/revanced/patches/shared/misc/settings/preference/BasePreference;)V
public final fun getCategories ()Ljava/util/Set;
public synthetic fun transform ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreference;
public fun transform ()Lapp/revanced/patches/shared/misc/settings/preference/PreferenceScreen;
}
public class app/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen$Category : app/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$BasePreferenceCollection {
public fun <init> (Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;)V
public synthetic fun <init> (Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun addPreferences ([Lapp/revanced/patches/shared/misc/settings/preference/BasePreference;)V
public synthetic fun transform ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreference;
public fun transform ()Lapp/revanced/patches/shared/misc/settings/preference/PreferenceCategory;
}
public final class app/revanced/patches/shared/misc/settings/preference/InputType : java/lang/Enum {
public static final field NUMBER Lapp/revanced/patches/shared/misc/settings/preference/InputType;
public static final field TEXT Lapp/revanced/patches/shared/misc/settings/preference/InputType;
public static final field TEXT_CAP_CHARACTERS Lapp/revanced/patches/shared/misc/settings/preference/InputType;
public static final field TEXT_MULTI_LINE Lapp/revanced/patches/shared/misc/settings/preference/InputType;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public final fun getType ()Ljava/lang/String;
public static fun valueOf (Ljava/lang/String;)Lapp/revanced/patches/shared/settings/preference/SummaryType;
public static fun values ()[Lapp/revanced/patches/shared/settings/preference/SummaryType;
public static fun valueOf (Ljava/lang/String;)Lapp/revanced/patches/shared/misc/settings/preference/InputType;
public static fun values ()[Lapp/revanced/patches/shared/misc/settings/preference/InputType;
}
public final class app/revanced/patches/shared/settings/preference/impl/ArrayResource : app/revanced/patches/shared/settings/preference/BaseResource {
public fun <init> (Ljava/lang/String;Ljava/util/List;)V
public final fun getItems ()Ljava/util/List;
public final class app/revanced/patches/shared/misc/settings/preference/IntentPreference : app/revanced/patches/shared/misc/settings/preference/BasePreference {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lapp/revanced/patches/shared/misc/settings/preference/IntentPreference$Intent;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lapp/revanced/patches/shared/misc/settings/preference/IntentPreference$Intent;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun equals (Ljava/lang/Object;)Z
public final fun getIntent ()Lapp/revanced/patches/shared/misc/settings/preference/IntentPreference$Intent;
public fun hashCode ()I
public fun serialize (Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;)Lorg/w3c/dom/Element;
}
public final class app/revanced/patches/shared/settings/preference/impl/InputType : java/lang/Enum {
public static final field NUMBER Lapp/revanced/patches/shared/settings/preference/impl/InputType;
public static final field TEXT Lapp/revanced/patches/shared/settings/preference/impl/InputType;
public static final field TEXT_CAP_CHARACTERS Lapp/revanced/patches/shared/settings/preference/impl/InputType;
public static final field TEXT_MULTI_LINE Lapp/revanced/patches/shared/settings/preference/impl/InputType;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public final fun getType ()Ljava/lang/String;
public static fun valueOf (Ljava/lang/String;)Lapp/revanced/patches/shared/settings/preference/impl/InputType;
public static fun values ()[Lapp/revanced/patches/shared/settings/preference/impl/InputType;
public final class app/revanced/patches/shared/misc/settings/preference/IntentPreference$Intent {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function0;)V
public final fun copy (Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function0;)Lapp/revanced/patches/shared/misc/settings/preference/IntentPreference$Intent;
public static synthetic fun copy$default (Lapp/revanced/patches/shared/misc/settings/preference/IntentPreference$Intent;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)Lapp/revanced/patches/shared/misc/settings/preference/IntentPreference$Intent;
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class app/revanced/patches/shared/settings/preference/impl/ListPreference : app/revanced/patches/shared/settings/preference/BasePreference {
public fun <init> (Ljava/lang/String;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/ArrayResource;Lapp/revanced/patches/shared/settings/preference/impl/ArrayResource;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;)V
public synthetic fun <init> (Ljava/lang/String;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/ArrayResource;Lapp/revanced/patches/shared/settings/preference/impl/ArrayResource;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final class app/revanced/patches/shared/misc/settings/preference/ListPreference : app/revanced/patches/shared/misc/settings/preference/BasePreference {
public fun <init> ()V
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lapp/revanced/util/resource/ArrayResource;Lapp/revanced/util/resource/ArrayResource;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lapp/revanced/util/resource/ArrayResource;Lapp/revanced/util/resource/ArrayResource;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getEntries ()Lapp/revanced/util/resource/ArrayResource;
public final fun getEntriesKey ()Ljava/lang/String;
public final fun getEntryValues ()Lapp/revanced/util/resource/ArrayResource;
public final fun getEntryValuesKey ()Ljava/lang/String;
public fun serialize (Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;)Lorg/w3c/dom/Element;
}
public final class app/revanced/patches/shared/settings/preference/impl/NonInteractivePreference : app/revanced/patches/shared/settings/preference/BasePreference {
public fun <init> (Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Ljava/lang/String;Z)V
public synthetic fun <init> (Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Ljava/lang/String;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final class app/revanced/patches/shared/misc/settings/preference/NonInteractivePreference : app/revanced/patches/shared/misc/settings/preference/BasePreference {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getSelectable ()Z
public fun serialize (Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;)Lorg/w3c/dom/Element;
}
public final class app/revanced/patches/shared/settings/preference/impl/Preference : app/revanced/patches/shared/settings/preference/BasePreference {
public fun <init> (Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/Preference$Intent;)V
public fun <init> (Ljava/lang/String;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/Preference$Intent;)V
public final fun getIntent ()Lapp/revanced/patches/shared/settings/preference/impl/Preference$Intent;
public class app/revanced/patches/shared/misc/settings/preference/PreferenceCategory : app/revanced/patches/shared/misc/settings/preference/BasePreference {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getPreferences ()Ljava/util/Set;
public fun serialize (Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;)Lorg/w3c/dom/Element;
}
public final class app/revanced/patches/shared/settings/preference/impl/Preference$Intent {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
}
public class app/revanced/patches/shared/settings/preference/impl/PreferenceCategory : app/revanced/patches/shared/settings/preference/BasePreference {
public fun <init> (Ljava/lang/String;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Ljava/util/List;Ljava/lang/String;)V
public synthetic fun <init> (Ljava/lang/String;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Ljava/util/List;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getPreferences ()Ljava/util/List;
public fun serialize (Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;)Lorg/w3c/dom/Element;
public final fun setPreferences (Ljava/util/List;)V
}
public class app/revanced/patches/shared/settings/preference/impl/PreferenceScreen : app/revanced/patches/shared/settings/preference/BasePreference {
public fun <init> (Ljava/lang/String;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Ljava/util/List;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;)V
public synthetic fun <init> (Ljava/lang/String;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Ljava/util/List;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getPreferences ()Ljava/util/List;
public fun serialize (Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;)Lorg/w3c/dom/Element;
public final fun setPreferences (Ljava/util/List;)V
}
public final class app/revanced/patches/shared/settings/preference/impl/StringResource : app/revanced/patches/shared/settings/preference/BaseResource {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Z)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getFormatted ()Z
public final fun getValue ()Ljava/lang/String;
public class app/revanced/patches/shared/misc/settings/preference/PreferenceScreen : app/revanced/patches/shared/misc/settings/preference/BasePreference {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getPreferences ()Ljava/util/Set;
public fun serialize (Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;)Lorg/w3c/dom/Element;
}
public final class app/revanced/patches/shared/settings/preference/impl/SwitchPreference : app/revanced/patches/shared/settings/preference/BasePreference {
public fun <init> (Ljava/lang/String;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;)V
public synthetic fun <init> (Ljava/lang/String;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getSummaryOff ()Lapp/revanced/patches/shared/settings/preference/impl/StringResource;
public final fun getSummaryOn ()Lapp/revanced/patches/shared/settings/preference/impl/StringResource;
public final fun getUserDialogMessage ()Lapp/revanced/patches/shared/settings/preference/impl/StringResource;
public fun serialize (Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;)Lorg/w3c/dom/Element;
public final class app/revanced/patches/shared/misc/settings/preference/SummaryType : java/lang/Enum {
public static final field DEFAULT Lapp/revanced/patches/shared/misc/settings/preference/SummaryType;
public static final field OFF Lapp/revanced/patches/shared/misc/settings/preference/SummaryType;
public static final field ON Lapp/revanced/patches/shared/misc/settings/preference/SummaryType;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public final fun getType ()Ljava/lang/String;
public static fun valueOf (Ljava/lang/String;)Lapp/revanced/patches/shared/misc/settings/preference/SummaryType;
public static fun values ()[Lapp/revanced/patches/shared/misc/settings/preference/SummaryType;
}
public final class app/revanced/patches/shared/settings/preference/impl/TextPreference : app/revanced/patches/shared/settings/preference/BasePreference {
public fun <init> (Ljava/lang/String;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/InputType;Ljava/lang/String;)V
public synthetic fun <init> (Ljava/lang/String;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/InputType;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getInputType ()Lapp/revanced/patches/shared/settings/preference/impl/InputType;
public fun serialize (Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;)Lorg/w3c/dom/Element;
}
public abstract class app/revanced/patches/shared/settings/util/AbstractPreferenceScreen : java/io/Closeable {
public final class app/revanced/patches/shared/misc/settings/preference/SwitchPreference : app/revanced/patches/shared/misc/settings/preference/BasePreference {
public fun <init> ()V
public fun <init> (Ljava/util/List;)V
public synthetic fun <init> (Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun close ()V
public abstract fun commit (Lapp/revanced/patches/shared/settings/preference/impl/PreferenceScreen;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getSummaryOffKey ()Ljava/lang/String;
public final fun getSummaryOnKey ()Ljava/lang/String;
public fun serialize (Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;)Lorg/w3c/dom/Element;
}
public abstract class app/revanced/patches/shared/settings/util/AbstractPreferenceScreen$BasePreferenceCollection {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getKey ()Ljava/lang/String;
public final fun getPreferences ()Ljava/util/List;
public final fun getTitle ()Ljava/lang/String;
public abstract fun transform ()Lapp/revanced/patches/shared/settings/preference/BasePreference;
}
public class app/revanced/patches/shared/settings/util/AbstractPreferenceScreen$Screen : app/revanced/patches/shared/settings/util/AbstractPreferenceScreen$BasePreferenceCollection {
public fun <init> (Lapp/revanced/patches/shared/settings/util/AbstractPreferenceScreen;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/util/List;)V
public synthetic fun <init> (Lapp/revanced/patches/shared/settings/util/AbstractPreferenceScreen;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun addPreferences ([Lapp/revanced/patches/shared/settings/preference/BasePreference;)V
public final fun getCategories ()Ljava/util/List;
public final fun getSummary ()Ljava/lang/String;
public synthetic fun transform ()Lapp/revanced/patches/shared/settings/preference/BasePreference;
public fun transform ()Lapp/revanced/patches/shared/settings/preference/impl/PreferenceScreen;
}
public class app/revanced/patches/shared/settings/util/AbstractPreferenceScreen$Screen$Category : app/revanced/patches/shared/settings/util/AbstractPreferenceScreen$BasePreferenceCollection {
public fun <init> (Lapp/revanced/patches/shared/settings/util/AbstractPreferenceScreen$Screen;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;)V
public synthetic fun <init> (Lapp/revanced/patches/shared/settings/util/AbstractPreferenceScreen$Screen;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun addPreferences ([Lapp/revanced/patches/shared/settings/preference/BasePreference;)V
public synthetic fun transform ()Lapp/revanced/patches/shared/settings/preference/BasePreference;
public fun transform ()Lapp/revanced/patches/shared/settings/preference/impl/PreferenceCategory;
public final class app/revanced/patches/shared/misc/settings/preference/TextPreference : app/revanced/patches/shared/misc/settings/preference/BasePreference {
public fun <init> ()V
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lapp/revanced/patches/shared/misc/settings/preference/InputType;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lapp/revanced/patches/shared/misc/settings/preference/InputType;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getInputType ()Lapp/revanced/patches/shared/misc/settings/preference/InputType;
public fun serialize (Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;)Lorg/w3c/dom/Element;
}
public final class app/revanced/patches/solidexplorer2/functionality/filesize/RemoveFileSizeLimitPatch : app/revanced/patcher/patch/BytecodePatch {
@ -848,7 +900,7 @@ public final class app/revanced/patches/tiktok/interaction/speed/PlaybackSpeedPa
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/tiktok/misc/integrations/IntegrationsPatch : app/revanced/patches/shared/integrations/AbstractIntegrationsPatch {
public final class app/revanced/patches/tiktok/misc/integrations/IntegrationsPatch : app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch {
public static final field INSTANCE Lapp/revanced/patches/tiktok/misc/integrations/IntegrationsPatch;
}
@ -942,25 +994,25 @@ public final class app/revanced/patches/twitch/ad/embedded/EmbeddedAdsPatch : ap
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public abstract class app/revanced/patches/twitch/ad/shared/util/AbstractAdPatch : app/revanced/patcher/patch/BytecodePatch {
public abstract class app/revanced/patches/twitch/ad/shared/util/BaseAdPatch : app/revanced/patcher/patch/BytecodePatch {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
protected final fun blockMethods (Lapp/revanced/patcher/data/BytecodeContext;Ljava/lang/String;[Ljava/lang/String;Lapp/revanced/patches/twitch/ad/shared/util/AbstractAdPatch$ReturnMethod;)Z
public static synthetic fun blockMethods$default (Lapp/revanced/patches/twitch/ad/shared/util/AbstractAdPatch;Lapp/revanced/patcher/data/BytecodeContext;Ljava/lang/String;[Ljava/lang/String;Lapp/revanced/patches/twitch/ad/shared/util/AbstractAdPatch$ReturnMethod;ILjava/lang/Object;)Z
protected final fun blockMethods (Lapp/revanced/patcher/data/BytecodeContext;Ljava/lang/String;[Ljava/lang/String;Lapp/revanced/patches/twitch/ad/shared/util/BaseAdPatch$ReturnMethod;)Z
public static synthetic fun blockMethods$default (Lapp/revanced/patches/twitch/ad/shared/util/BaseAdPatch;Lapp/revanced/patcher/data/BytecodeContext;Ljava/lang/String;[Ljava/lang/String;Lapp/revanced/patches/twitch/ad/shared/util/BaseAdPatch$ReturnMethod;ILjava/lang/Object;)Z
protected final fun createConditionInstructions (Ljava/lang/String;)Ljava/lang/String;
public static synthetic fun createConditionInstructions$default (Lapp/revanced/patches/twitch/ad/shared/util/AbstractAdPatch;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
public static synthetic fun createConditionInstructions$default (Lapp/revanced/patches/twitch/ad/shared/util/BaseAdPatch;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
public final fun getConditionCall ()Ljava/lang/String;
public final fun getSkipLabelName ()Ljava/lang/String;
}
protected final class app/revanced/patches/twitch/ad/shared/util/AbstractAdPatch$ReturnMethod {
protected final class app/revanced/patches/twitch/ad/shared/util/BaseAdPatch$ReturnMethod {
public fun <init> ()V
public fun <init> (CLjava/lang/String;)V
public synthetic fun <init> (CLjava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()C
public final fun component2 ()Ljava/lang/String;
public final fun copy (CLjava/lang/String;)Lapp/revanced/patches/twitch/ad/shared/util/AbstractAdPatch$ReturnMethod;
public static synthetic fun copy$default (Lapp/revanced/patches/twitch/ad/shared/util/AbstractAdPatch$ReturnMethod;CLjava/lang/String;ILjava/lang/Object;)Lapp/revanced/patches/twitch/ad/shared/util/AbstractAdPatch$ReturnMethod;
public final fun copy (CLjava/lang/String;)Lapp/revanced/patches/twitch/ad/shared/util/BaseAdPatch$ReturnMethod;
public static synthetic fun copy$default (Lapp/revanced/patches/twitch/ad/shared/util/BaseAdPatch$ReturnMethod;CLjava/lang/String;ILjava/lang/Object;)Lapp/revanced/patches/twitch/ad/shared/util/BaseAdPatch$ReturnMethod;
public fun equals (Ljava/lang/Object;)Z
public final fun getReturnType ()C
public final fun getValue ()Ljava/lang/String;
@ -968,7 +1020,7 @@ protected final class app/revanced/patches/twitch/ad/shared/util/AbstractAdPatch
public fun toString ()Ljava/lang/String;
}
public final class app/revanced/patches/twitch/ad/video/VideoAdsPatch : app/revanced/patches/twitch/ad/shared/util/AbstractAdPatch {
public final class app/revanced/patches/twitch/ad/video/VideoAdsPatch : app/revanced/patches/twitch/ad/shared/util/BaseAdPatch {
public static final field INSTANCE Lapp/revanced/patches/twitch/ad/video/VideoAdsPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
@ -980,8 +1032,8 @@ public final class app/revanced/patches/twitch/chat/antidelete/ShowDeletedMessag
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/twitch/chat/autoclaim/AutoClaimChannelPointPatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/twitch/chat/autoclaim/AutoClaimChannelPointPatch;
public final class app/revanced/patches/twitch/chat/autoclaim/AutoClaimChannelPointsPatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/twitch/chat/autoclaim/AutoClaimChannelPointsPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
@ -992,25 +1044,19 @@ public final class app/revanced/patches/twitch/debug/DebugModePatch : app/revanc
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/twitch/misc/integrations/IntegrationsPatch : app/revanced/patches/shared/integrations/AbstractIntegrationsPatch {
public final class app/revanced/patches/twitch/misc/integrations/IntegrationsPatch : app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch {
public static final field INSTANCE Lapp/revanced/patches/twitch/misc/integrations/IntegrationsPatch;
}
public final class app/revanced/patches/twitch/misc/settings/SettingsPatch : app/revanced/patcher/patch/BytecodePatch, java/io/Closeable {
public static final field INSTANCE Lapp/revanced/patches/twitch/misc/settings/SettingsPatch;
public final fun addPreferenceScreen (Lapp/revanced/patches/shared/settings/preference/impl/PreferenceScreen;)V
public final fun addString (Ljava/lang/String;Ljava/lang/String;Z)V
public static synthetic fun addString$default (Lapp/revanced/patches/twitch/misc/settings/SettingsPatch;Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)V
public fun close ()V
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/twitch/misc/settings/SettingsResourcePatch : app/revanced/patches/shared/settings/AbstractSettingsResourcePatch {
public final class app/revanced/patches/twitch/misc/settings/SettingsResourcePatch : app/revanced/patches/shared/misc/settings/BaseSettingsResourcePatch {
public static final field INSTANCE Lapp/revanced/patches/twitch/misc/settings/SettingsResourcePatch;
public final fun addArray (Lapp/revanced/patches/shared/settings/preference/impl/ArrayResource;)V
public final fun addPreferenceScreen (Lapp/revanced/patches/shared/settings/preference/impl/PreferenceScreen;)V
public final fun addString (Ljava/lang/String;Ljava/lang/String;Z)V
}
public final class app/revanced/patches/twitter/misc/dynamiccolor/DynamicColorPatch : app/revanced/patcher/patch/ResourcePatch {
@ -1026,17 +1072,17 @@ public final class app/revanced/patches/twitter/misc/hook/json/JsonHookPatch : a
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public abstract class app/revanced/patches/twitter/misc/hook/patch/BaseHookPatchPatch : app/revanced/patcher/patch/BytecodePatch {
public abstract class app/revanced/patches/twitter/misc/hook/patch/BaseHookPatch : app/revanced/patcher/patch/BytecodePatch {
public fun <init> (Ljava/lang/String;)V
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/twitter/misc/hook/patch/ads/HideAdsPatch : app/revanced/patches/twitter/misc/hook/patch/BaseHookPatchPatch {
public static final field INSTANCE Lapp/revanced/patches/twitter/misc/hook/patch/ads/HideAdsPatch;
public final class app/revanced/patches/twitter/misc/hook/patch/ads/HideAdsHookPatch : app/revanced/patches/twitter/misc/hook/patch/BaseHookPatch {
public static final field INSTANCE Lapp/revanced/patches/twitter/misc/hook/patch/ads/HideAdsHookPatch;
}
public final class app/revanced/patches/twitter/misc/hook/patch/recommendation/HideRecommendedUsersPatch : app/revanced/patches/twitter/misc/hook/patch/BaseHookPatchPatch {
public final class app/revanced/patches/twitter/misc/hook/patch/recommendation/HideRecommendedUsersPatch : app/revanced/patches/twitter/misc/hook/patch/BaseHookPatch {
public static final field INSTANCE Lapp/revanced/patches/twitter/misc/hook/patch/recommendation/HideRecommendedUsersPatch;
}
@ -1262,12 +1308,6 @@ public final class app/revanced/patches/youtube/layout/hide/loadmorebutton/HideL
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/youtube/layout/hide/personalinformation/HideEmailAddressPatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/layout/hide/personalinformation/HideEmailAddressPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch : app/revanced/patcher/patch/ResourcePatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch;
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
@ -1441,19 +1481,17 @@ public final class app/revanced/patches/youtube/misc/fix/playback/SpoofSignature
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
}
public final class app/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch : app/revanced/patches/shared/misc/gms/AbstractGmsCoreSupportPatch {
public final class app/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch : app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportPatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/youtube/misc/gms/GmsCoreSupportResourcePatch : app/revanced/patches/shared/misc/gms/AbstractGmsCoreSupportResourcePatch {
public final class app/revanced/patches/youtube/misc/gms/GmsCoreSupportResourcePatch : app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportResourcePatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/gms/GmsCoreSupportResourcePatch;
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
}
public final class app/revanced/patches/youtube/misc/integrations/IntegrationsPatch : app/revanced/patches/shared/integrations/AbstractIntegrationsPatch {
public final class app/revanced/patches/youtube/misc/integrations/IntegrationsPatch : app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/integrations/IntegrationsPatch;
}
@ -1463,7 +1501,7 @@ public final class app/revanced/patches/youtube/misc/links/BypassURLRedirectsPat
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch : app/revanced/patches/all/misc/transformation/AbstractTransformInstructionsPatch {
public final class app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch : app/revanced/patches/all/misc/transformation/BaseTransformInstructionsPatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
@ -1525,30 +1563,24 @@ public final class app/revanced/patches/youtube/misc/privacy/RemoveTrackingQuery
public final class app/revanced/patches/youtube/misc/settings/SettingsPatch : app/revanced/patcher/patch/BytecodePatch, java/io/Closeable {
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/settings/SettingsPatch;
public final fun addPreference (Lapp/revanced/patches/shared/settings/preference/impl/Preference;)V
public final fun addPreferenceScreen (Lapp/revanced/patches/shared/settings/preference/impl/PreferenceScreen;)V
public final fun addString (Ljava/lang/String;Ljava/lang/String;Z)V
public static synthetic fun addString$default (Lapp/revanced/patches/youtube/misc/settings/SettingsPatch;Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)V
public fun close ()V
public final fun createReVancedSettingsIntent (Ljava/lang/String;)Lapp/revanced/patches/shared/settings/preference/impl/Preference$Intent;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
public final fun renameIntentsTargetPackage (Ljava/lang/String;)V
public final fun newIntent (Ljava/lang/String;)Lapp/revanced/patches/shared/misc/settings/preference/IntentPreference$Intent;
}
public final class app/revanced/patches/youtube/misc/settings/SettingsPatch$PreferenceScreen : app/revanced/patches/shared/settings/util/AbstractPreferenceScreen {
public final class app/revanced/patches/youtube/misc/settings/SettingsPatch$PreferenceScreen : app/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen {
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/settings/SettingsPatch$PreferenceScreen;
public fun commit (Lapp/revanced/patches/shared/settings/preference/impl/PreferenceScreen;)V
public final fun getADS ()Lapp/revanced/patches/shared/settings/util/AbstractPreferenceScreen$Screen;
public final fun getINTERACTIONS ()Lapp/revanced/patches/shared/settings/util/AbstractPreferenceScreen$Screen;
public final fun getLAYOUT ()Lapp/revanced/patches/shared/settings/util/AbstractPreferenceScreen$Screen;
public final fun getMISC ()Lapp/revanced/patches/shared/settings/util/AbstractPreferenceScreen$Screen;
public final fun getVIDEO ()Lapp/revanced/patches/shared/settings/util/AbstractPreferenceScreen$Screen;
public fun commit (Lapp/revanced/patches/shared/misc/settings/preference/PreferenceScreen;)V
public final fun getADS ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen;
public final fun getINTERACTIONS ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen;
public final fun getLAYOUT ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen;
public final fun getMISC ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen;
public final fun getVIDEO ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen;
}
public final class app/revanced/patches/youtube/misc/settings/SettingsResourcePatch : app/revanced/patches/shared/settings/AbstractSettingsResourcePatch {
public final class app/revanced/patches/youtube/misc/settings/SettingsResourcePatch : app/revanced/patches/shared/misc/settings/BaseSettingsResourcePatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/settings/SettingsResourcePatch;
public fun close ()V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
}
@ -1673,11 +1705,13 @@ public final class app/revanced/util/ResourceGroup {
}
public final class app/revanced/util/ResourceUtilsKt {
public static final fun asSequence (Lorg/w3c/dom/NodeList;)Lkotlin/sequences/Sequence;
public static final fun childElementsSequence (Lorg/w3c/dom/Node;)Lkotlin/sequences/Sequence;
public static final fun copyResources (Lapp/revanced/patcher/data/ResourceContext;Ljava/lang/String;[Lapp/revanced/util/ResourceGroup;)V
public static final fun copyXmlNode (Ljava/lang/String;Lapp/revanced/patcher/util/DomFileEditor;Lapp/revanced/patcher/util/DomFileEditor;)Ljava/lang/AutoCloseable;
public static final fun doRecursively (Lorg/w3c/dom/Node;Lkotlin/jvm/functions/Function1;)V
public static final fun forEachChildElement (Lorg/w3c/dom/Node;Lkotlin/jvm/functions/Function1;)V
public static final fun iterateXmlNodeChildren (Lapp/revanced/patcher/data/ResourceContext;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V
public static final fun mergeStrings (Lapp/revanced/patcher/data/ResourceContext;Ljava/lang/String;)V
}
public abstract class app/revanced/util/patch/LiteralValueFingerprint : app/revanced/patcher/fingerprint/MethodFingerprint {
@ -1685,3 +1719,37 @@ public abstract class app/revanced/util/patch/LiteralValueFingerprint : app/reva
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Lkotlin/jvm/functions/Function0;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
}
public final class app/revanced/util/resource/ArrayResource : app/revanced/util/resource/BaseResource {
public static final field Companion Lapp/revanced/util/resource/ArrayResource$Companion;
public fun <init> (Ljava/lang/String;Ljava/util/List;)V
public final fun getItems ()Ljava/util/List;
public fun serialize (Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;)Lorg/w3c/dom/Element;
}
public final class app/revanced/util/resource/ArrayResource$Companion {
public final fun fromNode (Lorg/w3c/dom/Node;)Lapp/revanced/util/resource/ArrayResource;
}
public abstract class app/revanced/util/resource/BaseResource {
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
public fun equals (Ljava/lang/Object;)Z
public final fun getName ()Ljava/lang/String;
public final fun getTag ()Ljava/lang/String;
public fun hashCode ()I
public fun serialize (Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;)Lorg/w3c/dom/Element;
public static synthetic fun serialize$default (Lapp/revanced/util/resource/BaseResource;Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/w3c/dom/Element;
}
public final class app/revanced/util/resource/StringResource : app/revanced/util/resource/BaseResource {
public static final field Companion Lapp/revanced/util/resource/StringResource$Companion;
public fun <init> (Ljava/lang/String;Ljava/lang/String;Z)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getFormatted ()Z
public final fun getValue ()Ljava/lang/String;
public fun serialize (Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;)Lorg/w3c/dom/Element;
}
public final class app/revanced/util/resource/StringResource$Companion {
public final fun fromNode (Lorg/w3c/dom/Node;)Lapp/revanced/util/resource/StringResource;
}

View File

@ -78,7 +78,7 @@ tasks {
dependsOn(build)
classpath = sourceSets["main"].runtimeClasspath
mainClass.set("app.revanced.meta.PatchesFileGenerator")
mainClass.set("app.revanced.meta.IPatchesFileGenerator")
}
// Required to run tasks because Gradle semantic-release plugin runs the publish task.

View File

@ -4,7 +4,7 @@ import app.revanced.patcher.PatchBundleLoader
import app.revanced.patcher.PatchSet
import java.io.File
internal interface PatchesFileGenerator {
internal interface IPatchesFileGenerator {
fun generate(patches: PatchSet)
private companion object {
@ -14,7 +14,7 @@ internal interface PatchesFileGenerator {
).also { loader ->
if (loader.isEmpty()) throw IllegalStateException("No patches found")
}.let { bundle ->
arrayOf(JsonGenerator()).forEach { generator -> generator.generate(bundle) }
arrayOf(JsonPatchesFileGenerator()).forEach { generator -> generator.generate(bundle) }
}
}
}
}

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.patch.Patch
import com.google.gson.GsonBuilder
import java.io.File
internal class JsonGenerator : PatchesFileGenerator {
internal class JsonPatchesFileGenerator : IPatchesFileGenerator {
override fun generate(patches: PatchSet) = patches.map {
JsonPatch(
it.name!!,

View File

@ -2,7 +2,7 @@ package app.revanced.patches.all.connectivity.wifi.spoof
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.all.misc.transformation.AbstractTransformInstructionsPatch
import app.revanced.patches.all.misc.transformation.BaseTransformInstructionsPatch
import app.revanced.patches.all.misc.transformation.IMethodCall
import app.revanced.patches.all.misc.transformation.Instruction35cInfo
import app.revanced.patches.all.misc.transformation.filterMapInstruction35c
@ -17,7 +17,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.Instruction
requiresIntegrations = true
)
@Suppress("unused")
object SpoofWifiPatch : AbstractTransformInstructionsPatch<Instruction35cInfo>() {
object SpoofWifiPatch : BaseTransformInstructionsPatch<Instruction35cInfo>() {
private const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX = "Lapp/revanced/integrations/all/connectivity/wifi/spoof/SpoofWifiPatch"
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX;"

View File

@ -41,22 +41,22 @@ object ChangePackageNamePatch : ResourcePatch(), Closeable {
* @throws PatchOptionException.ValueValidationException If the package name is invalid.
*/
fun setOrGetFallbackPackageName(fallbackPackageName: String): String {
val packageName = this.packageNameOption.value!!
val packageName = packageNameOption.value!!
return if (packageName == this.packageNameOption.default)
fallbackPackageName.also { this.packageNameOption.value = it }
return if (packageName == packageNameOption.default)
fallbackPackageName.also { packageNameOption.value = it }
else
packageName
}
override fun close() = context.xmlEditor["AndroidManifest.xml"].use { editor ->
val replacementPackageName = packageNameOption.value
val manifest = editor.file.getElementsByTagName("manifest").item(0) as Element
val originalPackageName = manifest.getAttribute("package")
var replacementPackageName = this.packageNameOption.value
if (replacementPackageName == this.packageNameOption.default)
replacementPackageName = "$originalPackageName.revanced"
manifest.setAttribute("package", replacementPackageName)
manifest.setAttribute(
"package",
if (replacementPackageName != packageNameOption.default) replacementPackageName
else "${manifest.getAttribute("package")}.revanced"
)
}
}

View File

@ -0,0 +1,277 @@
package app.revanced.patches.all.misc.resources
import app.revanced.patcher.PatchClass
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.DomFileEditor
import app.revanced.patches.all.misc.resources.AddResourcesPatch.resources
import app.revanced.util.*
import app.revanced.util.resource.ArrayResource
import app.revanced.util.resource.BaseResource
import app.revanced.util.resource.StringResource
import org.w3c.dom.Node
import java.io.Closeable
import java.util.*
/**
* An identifier of an app. For example, `youtube`.
*/
private typealias AppId = String
/**
* An identifier of a patch. For example, `ad.general.HideAdsPatch`.
*/
private typealias PatchId = String
/**
* A set of resources of a patch.
*/
private typealias PatchResources = MutableSet<BaseResource>
/**
* A map of resources belonging to a patch.
*/
private typealias AppResources = MutableMap<PatchId, PatchResources>
/**
* A map of resources belonging to an app.
*/
private typealias Resources = MutableMap<AppId, AppResources>
/**
* The value of a resource.
* For example, `values` or `values-de`.
*/
private typealias Value = String
@Patch(description = "Add resources such as strings or arrays to the app.")
object AddResourcesPatch : ResourcePatch(), MutableMap<Value, MutableSet<BaseResource>> by mutableMapOf(), Closeable {
private lateinit var context: ResourceContext
/**
* A map of all resources associated by their value staged by [execute].
*/
private lateinit var resources: Map<Value, Resources>
/*
The strategy of this patch is to stage resources present in `/resources/addresources`.
These resources are organized by their respective value and patch.
On AddResourcesPatch#execute, all resources are staged in a temporary map.
After that, other patches that depend on AddResourcesPatch can call
AddResourcesPatch#invoke(PatchClass) to stage resources belonging to that patch
from the temporary map to AddResourcesPatch.
After all patches that depend on AddResourcesPatch have been executed,
AddResourcesPatch#close is finally called to add all staged resources to the app.
*/
override fun execute(context: ResourceContext) {
this.context = context
resources = buildMap {
/**
* Puts resources under `/resources/addresources/<value>/<resourceKind>.xml` into the map.
*
* @param value The value of the resource. For example, `values` or `values-de`.
* @param resourceKind The kind of the resource. For example, `strings` or `arrays`.
* @param transform A function that transforms the [Node]s from the XML files to a [BaseResource].
*/
fun addResources(
value: Value,
resourceKind: String,
transform: (Node) -> BaseResource,
) {
inputStreamFromBundledResource(
"addresources",
"$value/$resourceKind.xml"
)?.let { stream ->
// Add the resources associated with the given value to the map,
// instead of overwriting it.
// This covers the example case such as adding strings and arrays of the same value.
getOrPut(value, ::mutableMapOf).apply {
context.xmlEditor[stream].use {
it.file.getElementsByTagName("app").asSequence().forEach { app ->
val appId = app.attributes.getNamedItem("id").textContent
getOrPut(appId, ::mutableMapOf).apply {
app.forEachChildElement { patch ->
val patchId = patch.attributes.getNamedItem("id").textContent
getOrPut(patchId, ::mutableSetOf).apply {
patch.forEachChildElement { resourceNode ->
val resource = transform(resourceNode)
add(resource)
}
}
}
}
}
}
}
}
}
// Stage all resources to a temporary map.
// Staged resources consumed by AddResourcesPatch#invoke(PatchClass)
// are later used in AddResourcesPatch#close.
try {
val addStringResources = { value: Value ->
addResources(value, "strings", StringResource::fromNode)
}
Locale.getISOLanguages().asSequence().map { "values-$it" }.forEach { addStringResources(it) }
addStringResources("values")
addResources("values", "arrays", ArrayResource::fromNode)
} catch (e: Exception) {
throw PatchException("Failed to read resources", e)
}
}
}
/**
* Adds a [BaseResource] to the map using [MutableMap.getOrPut].
*
* @param value The value of the resource. For example, `values` or `values-de`.
* @param resource The resource to add.
*
* @return True if the resource was added, false if it already existed.
*/
operator fun invoke(value: Value, resource: BaseResource) =
getOrPut(value, ::mutableSetOf).add(resource)
/**
* Adds a list of [BaseResource]s to the map using [MutableMap.getOrPut].
*
* @param value The value of the resource. For example, `values` or `values-de`.
* @param resources The resources to add.
*
* @return True if the resources were added, false if they already existed.
*/
operator fun invoke(value: Value, resources: Iterable<BaseResource>) =
getOrPut(value, ::mutableSetOf).addAll(resources)
/**
* Adds a [StringResource].
*
* @param name The name of the string resource.
* @param value The value of the string resource.
* @param formatted Whether the string resource is formatted. Defaults to `true`.
* @param resourceValue The value of the resource. For example, `values` or `values-de`.
*
* @return True if the resource was added, false if it already existed.
*/
operator fun invoke(
name: String,
value: String,
formatted: Boolean = true,
resourceValue: Value = "values",
) = invoke(resourceValue, StringResource(name, value, formatted))
/**
* Adds an [ArrayResource].
*
* @param name The name of the array resource.
* @param items The items of the array resource.
*
* @return True if the resource was added, false if it already existed.
*/
operator fun invoke(
name: String,
items: List<String>
) = invoke("values", ArrayResource(name, items))
/**
* Puts all resources of any [Value] staged in [resources] for the given [PatchClass] to [AddResourcesPatch].
*
* @param patch The class of the patch to add resources for.
* @param parseIds A function that parses the [AppId] and [PatchId] from the given [PatchClass].
* This is used to access the resources in [resources] to stage them in [AddResourcesPatch].
* The default implementation assumes that the [PatchClass] qualified name has the following format:
* `<any>.<any>.<any>.<app id>.<patch id>`.
*
* @return True if any resources were added, false if none were added.
*
* @see AddResourcesPatch.close
*/
operator fun invoke(
patch: PatchClass,
parseIds: PatchClass.() -> Pair<AppId, PatchId> = {
val qualifiedName = qualifiedName ?: throw PatchException("Patch qualified name is null")
// This requires qualifiedName to have the following format:
// `<any>.<any>.<any>.<app id>.<patch id>`
with(qualifiedName.split(".")) {
if (size < 5) throw PatchException("Patch qualified name has invalid format")
val appId = this[3]
val patchId = subList(4, size).joinToString(".")
appId to patchId
}
}
): Boolean {
val (appId, patchId) = patch.parseIds()
var result = false
// Stage resources for the given patch to AddResourcesPatch associated with their value.
resources.forEach { (value, resources) ->
resources[appId]?.get(patchId)?.let { patchResources ->
if (invoke(value, patchResources)) result = true
}
}
return result
}
/**
* Adds all resources staged in [AddResourcesPatch] to the app.
* This is called after all patches that depend on [AddResourcesPatch] have been executed.
*/
override fun close() {
operator fun MutableMap<String, Pair<DomFileEditor, Node>>.invoke(
value: Value,
resource: BaseResource
) {
// TODO: Fix open-closed principle violation by modifying BaseResource#serialize so that it accepts
// a Value and the map of editors. It will then get or put the editor suitable for its resource type
// to serialize itself to it.
val resourceFileName = when (resource) {
is StringResource -> "strings"
is ArrayResource -> "arrays"
else -> throw NotImplementedError("Unsupported resource type")
}
getOrPut(resourceFileName) {
val targetFile = context["res/$value/$resourceFileName.xml"].also {
it.parentFile?.mkdirs()
it.createNewFile()
}
context.xmlEditor[targetFile.path].let { editor ->
// Save the target node here as well
// in order to avoid having to call editor.getNode("resources")
// every time addUsingEditors is called but also save the editor so that it can be closed later.
editor to editor.getNode("resources")
}
}.let { (_, targetNode) ->
targetNode.addResource(resource) { invoke(value, it) }
}
}
forEach { (value, resources) ->
// A map of editors associated by their kind (e.g. strings, arrays).
// Each editor is accompanied by the target node to which resources are added.
// A map is used because Map#getOrPut allows opening a new editor for the duration of a resource value.
// This is done to prevent having to open the files for every resource that is added.
// Instead, it is cached once and reused for resources of the same value.
// This map is later accessed to close all editors for the current resource value.
val resourceFileEditors = mutableMapOf<String, Pair<DomFileEditor, Node>>()
resources.forEach { resource -> resourceFileEditors(value, resource) }
resourceFileEditors.values.forEach { (editor, _) -> editor.close() }
}
}
}

View File

@ -9,7 +9,7 @@ import com.android.tools.smali.dexlib2.iface.Method
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
@Suppress("MemberVisibilityCanBePrivate")
abstract class AbstractTransformInstructionsPatch<T> : BytecodePatch() {
abstract class BaseTransformInstructionsPatch<T> : BytecodePatch() {
abstract fun filterMap(
classDef: ClassDef,
method: Method,

View File

@ -2,7 +2,7 @@ package app.revanced.patches.all.screencapture.removerestriction
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.all.misc.transformation.AbstractTransformInstructionsPatch
import app.revanced.patches.all.misc.transformation.BaseTransformInstructionsPatch
import app.revanced.patches.all.misc.transformation.IMethodCall
import app.revanced.patches.all.misc.transformation.Instruction35cInfo
import app.revanced.patches.all.misc.transformation.filterMapInstruction35c
@ -18,7 +18,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.Instruction
requiresIntegrations = true
)
@Suppress("unused")
object RemoveCaptureRestrictionPatch : AbstractTransformInstructionsPatch<Instruction35cInfo>() {
object RemoveCaptureRestrictionPatch : BaseTransformInstructionsPatch<Instruction35cInfo>() {
private const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX =
"Lapp/revanced/integrations/all/screencapture/removerestriction/RemoveScreencaptureRestrictionPatch"
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX;"

View File

@ -4,7 +4,7 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.all.misc.transformation.AbstractTransformInstructionsPatch
import app.revanced.patches.all.misc.transformation.BaseTransformInstructionsPatch
import app.revanced.patches.all.misc.transformation.IMethodCall
import app.revanced.patches.all.misc.transformation.Instruction35cInfo
import app.revanced.patches.all.misc.transformation.filterMapInstruction35c
@ -22,7 +22,7 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference
requiresIntegrations = true,
)
@Suppress("unused")
object RemoveScreenshotRestrictionPatch : AbstractTransformInstructionsPatch<Instruction35cInfo>() {
object RemoveScreenshotRestrictionPatch : BaseTransformInstructionsPatch<Instruction35cInfo>() {
private const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX =
"Lapp/revanced/integrations/all/screenshot/removerestriction/RemoveScreenshotRestrictionPatch"
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX;"
@ -71,7 +71,7 @@ object RemoveScreenshotRestrictionPatch : AbstractTransformInstructionsPatch<Ins
}
}
private class ModifyLayoutParamsFlags : AbstractTransformInstructionsPatch<Pair<Instruction22c, Int>>() {
private class ModifyLayoutParamsFlags : BaseTransformInstructionsPatch<Pair<Instruction22c, Int>>() {
override fun filterMap(
classDef: ClassDef,
method: Method,

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.all.misc.transformation.AbstractTransformInstructionsPatch
import app.revanced.patches.all.misc.transformation.BaseTransformInstructionsPatch
import com.android.tools.smali.dexlib2.iface.ClassDef
import com.android.tools.smali.dexlib2.iface.Method
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
@ -23,7 +23,7 @@ import java.util.*
use = false,
)
@Suppress("unused")
object SpoofSimCountryPatch : AbstractTransformInstructionsPatch<Pair<Int, String>>() {
object SpoofSimCountryPatch : BaseTransformInstructionsPatch<Pair<Int, String>>() {
private val countries = Locale.getISOCountries().associateBy { Locale("", it).displayCountry }
private val networkCountryIso by isoCountryPatchOption(

View File

@ -4,11 +4,13 @@ import app.revanced.patches.music.misc.gms.Constants.MUSIC_PACKAGE_NAME
import app.revanced.patches.music.misc.gms.Constants.REVANCED_MUSIC_PACKAGE_NAME
import app.revanced.patches.music.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorOption
import app.revanced.patches.music.misc.gms.fingerprints.*
import app.revanced.patches.shared.misc.gms.AbstractGmsCoreSupportPatch
import app.revanced.patches.youtube.misc.gms.fingerprints.CastContextFetchFingerprint
import app.revanced.patches.music.misc.integrations.fingerprints.ApplicationInitFingerprint
import app.revanced.patches.music.misc.integrations.IntegrationsPatch
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch
import app.revanced.patches.shared.fingerprints.CastContextFetchFingerprint
@Suppress("unused")
object GmsCoreSupportPatch : AbstractGmsCoreSupportPatch(
object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
fromPackageName = MUSIC_PACKAGE_NAME,
toPackageName = REVANCED_MUSIC_PACKAGE_NAME,
primeMethodFingerprint = PrimeMethodFingerprint,
@ -19,7 +21,9 @@ object GmsCoreSupportPatch : AbstractGmsCoreSupportPatch(
CastDynamiteModuleV2Fingerprint,
CastContextFetchFingerprint,
),
abstractGmsCoreSupportResourcePatch = GmsCoreSupportResourcePatch,
mainActivityOnCreateFingerprint = ApplicationInitFingerprint,
integrationsPatchDependency = IntegrationsPatch::class,
gmsCoreSupportResourcePatch = GmsCoreSupportResourcePatch,
compatiblePackages = setOf(CompatiblePackage("com.google.android.apps.youtube.music")),
fingerprints = setOf(
ServiceCheckFingerprint,

View File

@ -2,10 +2,10 @@ package app.revanced.patches.music.misc.gms
import app.revanced.patches.music.misc.gms.Constants.MUSIC_PACKAGE_NAME
import app.revanced.patches.music.misc.gms.Constants.REVANCED_MUSIC_PACKAGE_NAME
import app.revanced.patches.shared.misc.gms.AbstractGmsCoreSupportResourcePatch
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportResourcePatch
object GmsCoreSupportResourcePatch : AbstractGmsCoreSupportResourcePatch(
object GmsCoreSupportResourcePatch : BaseGmsCoreSupportResourcePatch(
fromPackageName = MUSIC_PACKAGE_NAME,
toPackageName = REVANCED_MUSIC_PACKAGE_NAME,
spoofedPackageSignature = "afb0fed5eeaebdd86f56a97742f4b6b33ef59875"
)
)

View File

@ -0,0 +1,13 @@
package app.revanced.patches.music.misc.integrations
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.misc.integrations.fingerprints.ApplicationInitFingerprint
import app.revanced.patches.shared.misc.integrations.BaseIntegrationsPatch
@Patch(requiresIntegrations = true)
object IntegrationsPatch : BaseIntegrationsPatch(
"Lapp/revanced/integrations/utils/ReVancedUtils;",
setOf(
ApplicationInitFingerprint,
),
)

View File

@ -0,0 +1,19 @@
package app.revanced.patches.music.misc.integrations.fingerprints
import app.revanced.patches.shared.misc.integrations.BaseIntegrationsPatch.IntegrationsFingerprint
import com.android.tools.smali.dexlib2.Opcode
internal object ApplicationInitFingerprint : IntegrationsFingerprint(
returnType = "V",
parameters = emptyList(),
opcodes = listOf(
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT,
Opcode.INVOKE_STATIC,
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT,
Opcode.INVOKE_VIRTUAL
),
strings = listOf("activity"),
customFingerprint = { methodDef, _ -> methodDef.name == "onCreate" },
)

View File

@ -1,14 +1,14 @@
package app.revanced.patches.reddit.customclients
import app.revanced.util.exception
import app.revanced.patcher.PatchClass
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.fingerprint.MethodFingerprint
import app.revanced.patcher.fingerprint.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
import app.revanced.util.exception
abstract class AbstractSpoofClientPatch(
abstract class BaseSpoofClientPatch(
redirectUri: String,
private val miscellaneousFingerprints: Set<MethodFingerprint> = emptySet(),
private val clientIdFingerprints: Set<MethodFingerprint> = emptySet(),

View File

@ -4,14 +4,14 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.fingerprint.MethodFingerprintResult
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.BaseSpoofClientPatch
import app.revanced.patches.reddit.customclients.baconreader.api.fingerprints.GetAuthorizationUrlFingerprint
import app.revanced.patches.reddit.customclients.baconreader.api.fingerprints.RequestTokenFingerprint
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Suppress("unused")
object SpoofClientPatch : AbstractSpoofClientPatch(
object SpoofClientPatch : BaseSpoofClientPatch(
redirectUri = "http://baconreader.com/auth",
clientIdFingerprints = setOf(GetAuthorizationUrlFingerprint, RequestTokenFingerprint),
compatiblePackages = setOf(

View File

@ -3,13 +3,13 @@ package app.revanced.patches.reddit.customclients.boostforreddit.api
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.fingerprint.MethodFingerprintResult
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.BaseSpoofClientPatch
import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints.GetClientIdFingerprint
import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints.LoginActivityOnCreateFingerprint
@Suppress("unused")
object SpoofClientPatch : AbstractSpoofClientPatch(
object SpoofClientPatch : BaseSpoofClientPatch(
redirectUri = "http://rubenmayayo.com",
clientIdFingerprints = setOf(GetClientIdFingerprint),
userAgentFingerprints = setOf(LoginActivityOnCreateFingerprint),

View File

@ -5,14 +5,14 @@ import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.MethodFingerprintResult
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.BaseSpoofClientPatch
import app.revanced.patches.reddit.customclients.infinityforreddit.api.fingerprints.APIUtilsFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodImplementation
@Suppress("unused")
object SpoofClientPatch : AbstractSpoofClientPatch(
object SpoofClientPatch : BaseSpoofClientPatch(
redirectUri = "infinity://localhost",
clientIdFingerprints = setOf(APIUtilsFingerprint),
compatiblePackages = setOf(CompatiblePackage("ml.docilealligator.infinityforreddit"))

View File

@ -3,13 +3,13 @@ package app.revanced.patches.reddit.customclients.joeyforreddit.api
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.fingerprint.MethodFingerprintResult
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.BaseSpoofClientPatch
import app.revanced.patches.reddit.customclients.joeyforreddit.api.fingerprints.GetClientIdFingerprint
import app.revanced.patches.reddit.customclients.joeyforreddit.detection.piracy.DisablePiracyDetectionPatch
@Suppress("unused")
object SpoofClientPatch : AbstractSpoofClientPatch(
object SpoofClientPatch : BaseSpoofClientPatch(
redirectUri = "https://127.0.0.1:65023/authorize_callback",
clientIdFingerprints = setOf(GetClientIdFingerprint),
compatiblePackages = setOf(

View File

@ -6,7 +6,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.fingerprint.MethodFingerprintResult
import app.revanced.patcher.fingerprint.MethodFingerprintResult.MethodFingerprintScanResult.StringsScanResult.StringMatch
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.BaseSpoofClientPatch
import app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints.BasicAuthorizationFingerprint
import app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints.BuildAuthorizationStringFingerprint
import app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints.GetUserAgentFingerprint
@ -14,7 +14,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Suppress("unused")
object SpoofClientPatch : AbstractSpoofClientPatch(
object SpoofClientPatch : BaseSpoofClientPatch(
redirectUri = "redditisfun://auth",
clientIdFingerprints = setOf(BuildAuthorizationStringFingerprint, BasicAuthorizationFingerprint),
userAgentFingerprints = setOf(GetUserAgentFingerprint),

View File

@ -2,6 +2,6 @@ package app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint
internal abstract class AbstractClientIdFingerprint(string: String) : MethodFingerprint(
internal abstract class BaseClientIdFingerprint(string: String) : MethodFingerprint(
strings = listOfNotNull("yyOCBp.RHJhDKd", string),
)

View File

@ -1,5 +1,5 @@
package app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints
internal object BasicAuthorizationFingerprint : AbstractClientIdFingerprint(
internal object BasicAuthorizationFingerprint : BaseClientIdFingerprint(
string = "fJOxVwBUyo*=f:<OoejWs:AqmIJ", // Encrypted basic authorization string.
)

View File

@ -1,5 +1,5 @@
package app.revanced.patches.reddit.customclients.redditisfun.api.fingerprints
internal object BuildAuthorizationStringFingerprint : AbstractClientIdFingerprint(
internal object BuildAuthorizationStringFingerprint : BaseClientIdFingerprint(
string = "client_id"
)

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.fingerprint.MethodFingerprintResult
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.BaseSpoofClientPatch
import app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints.*
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction10t
@ -14,7 +14,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Suppress("unused")
object SpoofClientPatch : AbstractSpoofClientPatch(
object SpoofClientPatch : BaseSpoofClientPatch(
redirectUri = "dbrady://relay",
miscellaneousFingerprints = setOf(
SetRemoteConfigFingerprint,

View File

@ -2,6 +2,6 @@ package app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprint
import app.revanced.patcher.fingerprint.MethodFingerprint
internal abstract class AbstractClientIdFingerprint(string: String) : MethodFingerprint(
internal abstract class BaseClientIdFingerprint(string: String) : MethodFingerprint(
strings = listOfNotNull("dj-xCIZQYiLbEg", string),
)

View File

@ -1,3 +1,3 @@
package app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints
internal object GetLoggedInBearerTokenFingerprint : AbstractClientIdFingerprint("authorization_code")
internal object GetLoggedInBearerTokenFingerprint : BaseClientIdFingerprint("authorization_code")

View File

@ -1,3 +1,3 @@
package app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints
internal object GetLoggedOutBearerTokenFingerprint : AbstractClientIdFingerprint("https://oauth.reddit.com/grants/installed_client")
internal object GetLoggedOutBearerTokenFingerprint : BaseClientIdFingerprint("https://oauth.reddit.com/grants/installed_client")

View File

@ -1,3 +1,3 @@
package app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints
internal object GetRefreshTokenFingerprint : AbstractClientIdFingerprint("refresh_token")
internal object GetRefreshTokenFingerprint : BaseClientIdFingerprint("refresh_token")

View File

@ -1,3 +1,3 @@
package app.revanced.patches.reddit.customclients.relayforreddit.api.fingerprints
internal object LoginActivityClientIdFingerprint : AbstractClientIdFingerprint("&duration=permanent")
internal object LoginActivityClientIdFingerprint : BaseClientIdFingerprint("&duration=permanent")

View File

@ -3,12 +3,12 @@ package app.revanced.patches.reddit.customclients.slide.api
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.fingerprint.MethodFingerprintResult
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.BaseSpoofClientPatch
import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints.GetClientIdFingerprint
@Suppress("unused")
object SpoofClientPatch : AbstractSpoofClientPatch(
object SpoofClientPatch : BaseSpoofClientPatch(
redirectUri = "http://www.ccrama.me",
clientIdFingerprints = setOf(GetClientIdFingerprint),
compatiblePackages = setOf(CompatiblePackage("me.ccrama.redditslide"))

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.fingerprint.MethodFingerprintResult
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
import app.revanced.patches.reddit.customclients.BaseSpoofClientPatch
import app.revanced.patches.reddit.customclients.syncforreddit.api.fingerprints.GetAuthorizationStringFingerprint
import app.revanced.patches.reddit.customclients.syncforreddit.api.fingerprints.GetBearerTokenFingerprint
import app.revanced.patches.reddit.customclients.syncforreddit.api.fingerprints.ImgurImageAPIFingerprint
@ -19,7 +19,7 @@ import java.util.*
@Suppress("unused")
object SpoofClientPatch : AbstractSpoofClientPatch(
object SpoofClientPatch : BaseSpoofClientPatch(
redirectUri = "http://redditsync/auth",
miscellaneousFingerprints = setOf(ImgurImageAPIFingerprint),
clientIdFingerprints = setOf(GetAuthorizationStringFingerprint),

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.gms.fingerprints
package app.revanced.patches.shared.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint

View File

@ -1,9 +0,0 @@
package app.revanced.patches.shared.fingerprints
import app.revanced.patches.shared.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint
object HomeActivityFingerprint : IntegrationsFingerprint(
customFingerprint = { methodDef, classDef ->
methodDef.name == "onCreate" && classDef.type.endsWith("Shell_HomeActivity;")
},
)

View File

@ -2,14 +2,15 @@ package app.revanced.patches.shared.misc.gms
import app.revanced.patcher.PatchClass
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.fingerprint.MethodFingerprint
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patches.all.misc.packagename.ChangePackageNamePatch
import app.revanced.patches.shared.misc.gms.AbstractGmsCoreSupportPatch.Constants.ACTIONS
import app.revanced.patches.shared.misc.gms.AbstractGmsCoreSupportPatch.Constants.AUTHORITIES
import app.revanced.patches.shared.misc.gms.AbstractGmsCoreSupportPatch.Constants.PERMISSIONS
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch.Constants.ACTIONS
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch.Constants.AUTHORITIES
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch.Constants.PERMISSIONS
import app.revanced.patches.shared.misc.gms.fingerprints.GmsCoreSupportFingerprint
import app.revanced.patches.shared.misc.gms.fingerprints.GmsCoreSupportFingerprint.GET_GMS_CORE_VENDOR_METHOD_NAME
import app.revanced.util.exception
@ -31,17 +32,21 @@ import com.android.tools.smali.dexlib2.util.MethodUtil
* @param toPackageName The package name to fall back to if no custom package name is specified in patch options.
* @param primeMethodFingerprint The fingerprint of the "prime" method that needs to be patched.
* @param earlyReturnFingerprints The fingerprints of methods that need to be returned early.
* @param abstractGmsCoreSupportResourcePatch The corresponding resource patch that is used to patch the resources.
* @param mainActivityOnCreateFingerprint The fingerprint of the main activity's onCreate method.
* @param integrationsPatchDependency The patch responsible for the integrations.
* @param gmsCoreSupportResourcePatch The corresponding resource patch that is used to patch the resources.
* @param dependencies Additional dependencies of this patch.
* @param compatiblePackages The compatible packages of this patch.
* @param fingerprints The fingerprints of this patch.
*/
abstract class AbstractGmsCoreSupportPatch(
abstract class BaseGmsCoreSupportPatch(
private val fromPackageName: String,
private val toPackageName: String,
private val primeMethodFingerprint: MethodFingerprint,
private val earlyReturnFingerprints: Set<MethodFingerprint>,
abstractGmsCoreSupportResourcePatch: AbstractGmsCoreSupportResourcePatch,
private val mainActivityOnCreateFingerprint: MethodFingerprint,
private val integrationsPatchDependency: PatchClass,
gmsCoreSupportResourcePatch: BaseGmsCoreSupportResourcePatch,
dependencies: Set<PatchClass> = setOf(),
compatiblePackages: Set<CompatiblePackage>? = null,
fingerprints: Set<MethodFingerprint> = emptySet(),
@ -49,14 +54,18 @@ abstract class AbstractGmsCoreSupportPatch(
name = "GmsCore support",
description = "Allows patched Google apps to run without root and under a different package name " +
"by using GmsCore instead of Google Play Services.",
dependencies = setOf(ChangePackageNamePatch::class, abstractGmsCoreSupportResourcePatch::class) + dependencies,
dependencies = setOf(
ChangePackageNamePatch::class,
gmsCoreSupportResourcePatch::class,
integrationsPatchDependency
) + dependencies,
compatiblePackages = compatiblePackages,
fingerprints = setOf(GmsCoreSupportFingerprint) + fingerprints,
fingerprints = setOf(GmsCoreSupportFingerprint, mainActivityOnCreateFingerprint) + fingerprints,
requiresIntegrations = true
) {
init {
// Manually register all options of the resource patch so that they are visible in the patch API.
abstractGmsCoreSupportResourcePatch.options.values.forEach(options::register)
gmsCoreSupportResourcePatch.options.values.forEach(options::register)
}
internal abstract val gmsCoreVendor: String?
@ -84,6 +93,12 @@ abstract class AbstractGmsCoreSupportPatch(
// Return these methods early to prevent the app from crashing.
earlyReturnFingerprints.toList().returnEarly()
// Check the availability of GmsCore.
mainActivityOnCreateFingerprint.result?.mutableMethod?.addInstruction(
1, // Hack to not disturb other patches (such as the integrations patch).
"invoke-static {}, Lapp/revanced/integrations/youtube/patches/GmsCoreSupport;->checkAvailability()V"
) ?: throw mainActivityOnCreateFingerprint.exception
// Change the vendor of GmsCore in ReVanced Integrations.
GmsCoreSupportFingerprint.result?.mutableClass?.methods
?.single { it.name == GET_GMS_CORE_VENDOR_METHOD_NAME }

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
import app.revanced.patches.all.misc.packagename.ChangePackageNamePatch
import app.revanced.util.mergeStrings
import app.revanced.patches.all.misc.resources.AddResourcesPatch
import org.w3c.dom.Element
import org.w3c.dom.Node
@ -18,12 +18,12 @@ import org.w3c.dom.Node
* @param spoofedPackageSignature The signature of the package to spoof to.
* @param dependencies Additional dependencies of this patch.
*/
abstract class AbstractGmsCoreSupportResourcePatch(
abstract class BaseGmsCoreSupportResourcePatch(
private val fromPackageName: String,
private val toPackageName: String,
private val spoofedPackageSignature: String,
dependencies: Set<PatchClass> = setOf()
) : ResourcePatch(dependencies = setOf(ChangePackageNamePatch::class) + dependencies) {
) : ResourcePatch(dependencies = setOf(ChangePackageNamePatch::class, AddResourcesPatch::class) + dependencies) {
internal val gmsCoreVendorOption = stringPatchOption(
key = "gmsCoreVendor",
default = "com.mgoogle",
@ -39,7 +39,8 @@ abstract class AbstractGmsCoreSupportResourcePatch(
protected val gmsCoreVendor by gmsCoreVendorOption
override fun execute(context: ResourceContext) {
context.mergeStrings("gms/host/values/strings.xml")
AddResourcesPatch(BaseGmsCoreSupportResourcePatch::class)
context.patchManifest()
context.addSpoofingMetadata()
}

View File

@ -2,7 +2,7 @@ package app.revanced.patches.shared.misc.gms.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint
object GmsCoreSupportFingerprint : MethodFingerprint(
internal object GmsCoreSupportFingerprint : MethodFingerprint(
customFingerprint = { _, classDef ->
classDef.type.endsWith("GmsCoreSupport;")
}

View File

@ -1,16 +1,16 @@
package app.revanced.patches.shared.integrations
package app.revanced.patches.shared.misc.integrations
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.fingerprint.MethodFingerprint
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException
import app.revanced.patches.shared.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint.RegisterResolver
import app.revanced.patches.shared.misc.integrations.BaseIntegrationsPatch.IntegrationsFingerprint.IRegisterResolver
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.ClassDef
import com.android.tools.smali.dexlib2.iface.Method
abstract class AbstractIntegrationsPatch(
abstract class BaseIntegrationsPatch(
private val hooks: Set<IntegrationsFingerprint>
) : BytecodePatch(hooks) {
@ -29,13 +29,15 @@ abstract class AbstractIntegrationsPatch(
"Integrations have not been merged yet. This patch can not succeed without merging the integrations."
)
for (hook in hooks) hook.invoke(INTEGRATIONS_CLASS_DESCRIPTOR)
hooks.forEach { hook ->
hook.invoke(INTEGRATIONS_CLASS_DESCRIPTOR)
}
}
/**
* [MethodFingerprint] for integrations.
*
* @param contextRegisterResolver A [RegisterResolver] to get the register.
* @param contextRegisterResolver A [IRegisterResolver] to get the register.
* @see MethodFingerprint
*/
abstract class IntegrationsFingerprint(
@ -45,7 +47,7 @@ abstract class AbstractIntegrationsPatch(
opcodes: Iterable<Opcode?>? = null,
strings: Iterable<String>? = null,
customFingerprint: ((methodDef: Method, classDef: ClassDef) -> Boolean)? = null,
private val contextRegisterResolver: (Method) -> Int = object : RegisterResolver {}
private val contextRegisterResolver: (Method) -> Int = object : IRegisterResolver {}
) : MethodFingerprint(
returnType,
accessFlags,
@ -66,7 +68,7 @@ abstract class AbstractIntegrationsPatch(
} ?: throw PatchException("Could not find hook target fingerprint.")
}
interface RegisterResolver : (Method) -> Int {
interface IRegisterResolver : (Method) -> Int {
override operator fun invoke(method: Method) = method.implementation!!.registerCount - 1
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.shared.mapping.misc
package app.revanced.patches.shared.misc.mapping
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch

View File

@ -0,0 +1,63 @@
package app.revanced.patches.shared.misc.settings
import app.revanced.patcher.PatchClass
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patches.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.BasePreference
import app.revanced.patches.shared.misc.settings.preference.IntentPreference
import app.revanced.util.ResourceGroup
import app.revanced.util.copyResources
import app.revanced.util.getNode
import org.w3c.dom.Node
import java.io.Closeable
/**
* A resource patch that adds settings to a settings fragment.
*
* @param rootPreference A pair of an intent preference and the name of the fragment file to add it to.
* If null, no preference will be added.
* @param dependencies Additional dependencies of this patch.
*/
abstract class BaseSettingsResourcePatch(
private val rootPreference: Pair<IntentPreference, String>? = null,
dependencies: Set<PatchClass> = emptySet()
) : ResourcePatch(
dependencies = setOf(AddResourcesPatch::class) + dependencies
), MutableSet<BasePreference> by mutableSetOf(), Closeable {
private lateinit var context: ResourceContext
override fun execute(context: ResourceContext) {
context.copyResources(
"settings",
ResourceGroup("xml", "revanced_prefs.xml")
)
this.context = context
AddResourcesPatch(BaseSettingsResourcePatch::class)
}
override fun close() {
fun Node.addPreference(preference: BasePreference) {
preference.serialize(ownerDocument) { resource ->
// TODO: Currently, resources can only be added to "values", which may not be the correct place.
// It may be necessary to ask for the desired resourceValue in the future.
AddResourcesPatch("values", resource)
}.let(this::appendChild)
}
// Add the root preference to an existing fragment if needed.
rootPreference?.let { (intentPreference, fragment) ->
context.xmlEditor["res/xml/$fragment.xml"].use {
it.getNode("PreferenceScreen").addPreference(intentPreference)
}
}
// Add all preferences to the ReVanced fragment.
context.xmlEditor["res/xml/revanced_prefs.xml"].use { editor ->
val revancedPreferenceScreenNode = editor.getNode("PreferenceScreen")
forEach { revancedPreferenceScreenNode.addPreference(it) }
}
}
}

View File

@ -0,0 +1,62 @@
package app.revanced.patches.shared.misc.settings.preference
import app.revanced.util.resource.BaseResource
import org.w3c.dom.Document
import org.w3c.dom.Element
/**
* Base preference class for all preferences.
*
* @param key The key of the preference. If null, other parameters must be specified.
* @param titleKey The key of the preference title.
* @param summaryKey The key of the preference summary.
* @param tag The tag or full class name of the preference.
*/
@Suppress("MemberVisibilityCanBePrivate")
abstract class BasePreference(
val key: String? = null,
val titleKey: String = "${key}_title",
val summaryKey: String? = "${key}_summary",
val tag: String
) {
/**
* Serialize preference element to XML.
* Overriding methods should invoke super and operate on its return value.
*
* @param resourceCallback A callback for additional resources.
* @param ownerDocument Target document to create elements from.
*
* @return The serialized element.
*/
open fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit): Element =
ownerDocument.createElement(tag).apply {
setAttribute("android:key", key)
setAttribute("android:title", "@string/${titleKey}")
summaryKey?.let { addSummary(it) }
}
override fun hashCode(): Int {
var result = key?.hashCode() ?: 0
result = 31 * result + titleKey.hashCode()
result = 31 * result + tag.hashCode()
return result
}
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as BasePreference
if (key != other.key) return false
if (titleKey != other.titleKey) return false
if (tag != other.tag) return false
return true
}
companion object {
fun Element.addSummary(summaryKey: String, summaryType: SummaryType = SummaryType.DEFAULT) =
setAttribute("android:${summaryType.type}", "@string/$summaryKey")
}
}

View File

@ -0,0 +1,93 @@
package app.revanced.patches.shared.misc.settings.preference
import java.io.Closeable
abstract class BasePreferenceScreen(
private val root: MutableSet<Screen> = mutableSetOf()
) : Closeable {
override fun close() {
if (root.isEmpty()) return
root.forEach { preference ->
commit(preference.transform())
}
}
/**
* Finalize and insert root preference into resource patch
*/
abstract fun commit(screen: PreferenceScreen)
open inner class Screen(
key: String? = null,
titleKey: String = "${key}_title",
private val summaryKey: String? = "${key}_summary",
preferences: MutableSet<BasePreference> = mutableSetOf(),
val categories: MutableSet<Category> = mutableSetOf()
) : BasePreferenceCollection(key, titleKey, preferences) {
/**
* Initialize using title and summary keys with suffix "_title" and "_summary".
*/
constructor(
key: String? = null,
preferences: MutableSet<BasePreference> = mutableSetOf(),
categories: MutableSet<Category> = mutableSetOf()
) : this(key, key + "_title", key + "_summary", preferences, categories)
override fun transform(): PreferenceScreen {
return PreferenceScreen(
key,
titleKey,
summaryKey,
// Screens and preferences are sorted at runtime by integrations code,
// so they appear in alphabetical order for the localized language in use.
preferences = preferences + categories.map { it.transform() }
)
}
private fun ensureScreenInserted() {
// Add to screens if not yet done
if (!root.contains(this))
root.add(this)
}
fun addPreferences(vararg preferences: BasePreference) {
ensureScreenInserted()
this.preferences.addAll(preferences)
}
open inner class Category(
key: String? = null,
titleKey: String = "${key}_title",
preferences: MutableSet<BasePreference> = mutableSetOf()
) : BasePreferenceCollection(key, titleKey, preferences) {
override fun transform(): PreferenceCategory {
return PreferenceCategory(
key,
titleKey,
preferences = preferences
)
}
fun addPreferences(vararg preferences: BasePreference) {
ensureScreenInserted()
// Add to the categories if not done yet.
if (!categories.contains(this))
categories.add(this)
this.preferences.addAll(preferences)
}
}
}
abstract class BasePreferenceCollection(
val key: String? = null,
val titleKey: String = "${key}_title",
val preferences: MutableSet<BasePreference> = mutableSetOf()
) {
abstract fun transform(): BasePreference
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.shared.settings.preference.impl
package app.revanced.patches.shared.misc.settings.preference
enum class InputType(val type: String) {
TEXT("text"),

View File

@ -0,0 +1,56 @@
package app.revanced.patches.shared.misc.settings.preference
import app.revanced.patches.shared.misc.settings.preference.IntentPreference.Intent
import app.revanced.util.resource.BaseResource
import org.w3c.dom.Document
/**
* A preference that opens an intent.
*
* @param key The preference key. If null, other parameters must be specified.
* @param titleKey The preference title key.
* @param summaryKey The preference summary key.
* @param tag The preference tag.
* @param intent The intent to open.
*
* @see Intent
*/
class IntentPreference(
key: String? = null,
titleKey: String = "${key}_title",
summaryKey: String? = "${key}_summary",
tag: String = "Preference",
val intent: Intent,
) : BasePreference(null, titleKey, summaryKey, tag) {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
appendChild(ownerDocument.createElement("intent").also { intentNode ->
intentNode.setAttribute("android:data", intent.data)
intentNode.setAttribute("android:targetClass", intent.targetClass)
intentNode.setAttribute("android:targetPackage", intent.targetPackageSupplier())
})
}
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
if (!super.equals(other)) return false
other as IntentPreference
return intent == other.intent
}
override fun hashCode(): Int {
var result = super.hashCode()
result = 31 * result + intent.hashCode()
return result
}
data class Intent(
internal val data: String,
internal val targetClass: String,
internal val targetPackageSupplier: () -> String,
)
}

View File

@ -0,0 +1,72 @@
package app.revanced.patches.shared.misc.settings.preference
import app.revanced.util.resource.ArrayResource
import app.revanced.util.resource.BaseResource
import org.w3c.dom.Document
/**
* List preference.
*
* @param key The preference key. If null, other parameters must be specified.
* @param titleKey The preference title key.
* @param summaryKey The preference summary key.
* @param tag The preference tag.
* @param entriesKey The entries array key.
* @param entryValuesKey The entry values array key.
*/
@Suppress("MemberVisibilityCanBePrivate")
class ListPreference(
key: String? = null,
titleKey: String = "${key}_title",
summaryKey: String? = "${key}_summary",
tag: String = "ListPreference",
val entriesKey: String? = "${key}_entries",
val entryValuesKey: String? = "${key}_entry_values"
) : BasePreference(key, titleKey, summaryKey, tag) {
var entries: ArrayResource? = null
private set
var entryValues: ArrayResource? = null
private set
/**
* List preference.
*
* @param key The preference key. If null, other parameters must be specified.
* @param titleKey The preference title key.
* @param summaryKey The preference summary key.
* @param tag The preference tag.
* @param entries The entries array.
* @param entryValues The entry values array.
*/
constructor(
key: String? = null,
titleKey: String = "${key}_title",
summaryKey: String? = "${key}_summary",
tag: String = "ListPreference",
entries: ArrayResource,
entryValues: ArrayResource
) : this(key, titleKey, summaryKey, tag, entries.name, entryValues.name) {
this.entries = entries
this.entryValues = entryValues
}
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
val entriesArrayName = entries?.also { resourceCallback.invoke(it) }?.name ?: entriesKey
val entryValuesArrayName = entryValues?.also { resourceCallback.invoke(it) }?.name ?: entryValuesKey
entriesArrayName?.let {
setAttribute(
"android:entries",
"@array/$it"
)
}
entryValuesArrayName?.let {
setAttribute(
"android:entryValues",
"@array/$it"
)
}
}
}

View File

@ -0,0 +1,26 @@
package app.revanced.patches.shared.misc.settings.preference
import app.revanced.util.resource.BaseResource
import org.w3c.dom.Document
/**
* A non-interactive preference.
*
* @param key The preference key.
* @param summaryKey The preference summary key.
* @param tag The preference tag.
* @param selectable Whether the preference is selectable.
*/
@Suppress("MemberVisibilityCanBePrivate")
class NonInteractivePreference(
key: String,
summaryKey: String? = "${key}_summary",
tag: String = "Preference",
val selectable: Boolean = false
) : BasePreference(null, "${key}_title", summaryKey, tag) {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
setAttribute("android:selectable", selectable.toString())
}
}

View File

@ -0,0 +1,28 @@
package app.revanced.patches.shared.misc.settings.preference
import app.revanced.util.resource.BaseResource
import org.w3c.dom.Document
/**
* A preference category.
*
* @param key The key of the preference. If null, other parameters must be specified.
* @param titleKey The key of the preference title.
* @param tag The tag or full class name of the preference.
* @param preferences The preferences in this category.
*/
@Suppress("MemberVisibilityCanBePrivate")
open class PreferenceCategory(
key: String? = null,
titleKey: String = "${key}_title",
tag: String = "PreferenceCategory",
val preferences: Set<BasePreference>
) : BasePreference(key, titleKey, null, tag) {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
preferences.forEach {
appendChild(it.serialize(ownerDocument, resourceCallback))
}
}
}

View File

@ -0,0 +1,30 @@
package app.revanced.patches.shared.misc.settings.preference
import app.revanced.util.resource.BaseResource
import org.w3c.dom.Document
/**
* A preference screen.
*
* @param key The key of the preference. If null, other parameters must be specified.
* @param titleKey The key of the preference title.
* @param summaryKey The key of the preference summary.
* @param tag The tag or full class name of the preference.
* @param preferences The preferences in this screen.
*/
@Suppress("MemberVisibilityCanBePrivate")
open class PreferenceScreen(
key: String? = null,
titleKey: String = "${key}_title",
summaryKey: String? = "${key}_summary",
tag: String = "PreferenceScreen",
val preferences: Set<BasePreference>
) : BasePreference(key, titleKey, summaryKey, tag) {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
preferences.forEach {
appendChild(it.serialize(ownerDocument, resourceCallback))
}
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.shared.settings.preference
package app.revanced.patches.shared.misc.settings.preference
enum class SummaryType(val type: String) {
DEFAULT("summary"), ON("summaryOn"), OFF("summaryOff")

View File

@ -0,0 +1,28 @@
package app.revanced.patches.shared.misc.settings.preference
import app.revanced.util.resource.BaseResource
import org.w3c.dom.Document
/**
* A switch preference.
*
* @param key The preference key. If null, other parameters must be specified.
* @param titleKey The preference title key.
* @param tag The preference tag.
* @param summaryOnKey The preference summary-on key.
* @param summaryOffKey The preference summary-off key.
*/
@Suppress("MemberVisibilityCanBePrivate")
class SwitchPreference(
key: String? = null,
titleKey: String = "${key}_title",
tag: String = "SwitchPreference",
val summaryOnKey: String = "${key}_summary_on",
val summaryOffKey: String = "${key}_summary_off"
) : BasePreference(key, titleKey, null, tag) {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
addSummary(summaryOnKey, SummaryType.ON)
addSummary(summaryOffKey, SummaryType.OFF)
}
}

View File

@ -0,0 +1,28 @@
package app.revanced.patches.shared.misc.settings.preference
import app.revanced.util.resource.BaseResource
import org.w3c.dom.Document
/**
* A text preference.
*
* @param key The preference key. If null, other parameters must be specified.
* @param titleKey The preference title key.
* @param summaryKey The preference summary key.
* @param tag The preference tag.
* @param inputType The preference input type.
*/
@Suppress("MemberVisibilityCanBePrivate")
class TextPreference(
key: String? = null,
titleKey: String = "${key}_title",
summaryKey: String? = "${key}_summary",
tag: String = "app.revanced.integrations.shared.settings.preference.ResettableEditTextPreference",
val inputType: InputType = InputType.TEXT
) : BasePreference(key, titleKey, summaryKey, tag) {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
setAttribute("android:inputType", inputType.type)
}
}

View File

@ -1,124 +0,0 @@
package app.revanced.patches.shared.settings
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.util.DomFileEditor
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.addPreference
import app.revanced.patches.shared.settings.preference.addResource
import app.revanced.patches.shared.settings.preference.impl.ArrayResource
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.util.ResourceGroup
import app.revanced.util.copyResources
import app.revanced.util.mergeStrings
import org.w3c.dom.Node
import java.io.Closeable
/**
* Abstract settings resource patch
*
* @param preferenceFileName Name of the settings preference xml file
* @param sourceDirectory Source directory to copy the preference template from
*/
abstract class AbstractSettingsResourcePatch(
private val preferenceFileName: String,
private val sourceDirectory: String,
) : ResourcePatch(), Closeable {
override fun execute(context: ResourceContext) {
/* copy preference template from source dir */
context.copyResources(
sourceDirectory,
ResourceGroup(
"xml", "$preferenceFileName.xml"
)
)
/* prepare xml editors */
stringsEditor = context.xmlEditor["res/values/strings.xml"]
arraysEditor = context.xmlEditor["res/values/arrays.xml"]
revancedPreferencesEditor = context.xmlEditor["res/xml/$preferenceFileName.xml"]
context.mergeStrings("settings/host/values/strings.xml")
}
internal companion object {
private var revancedPreferenceNode: Node? = null
private var stringsNode: Node? = null
private var arraysNode: Node? = null
private var strings = mutableListOf<StringResource>()
private var revancedPreferencesEditor: DomFileEditor? = null
set(value) {
field = value
revancedPreferenceNode = value.getNode("PreferenceScreen")
}
private var stringsEditor: DomFileEditor? = null
set(value) {
field = value
stringsNode = value.getNode("resources")
}
private var arraysEditor: DomFileEditor? = null
set(value) {
field = value
arraysNode = value.getNode("resources")
}
/**
* 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) =
StringResource(identifier, value, formatted).include()
/**
* Add an array to the resources.
*
* @param arrayResource The array resource to add.
*/
fun addArray(arrayResource: ArrayResource) =
arraysNode!!.addResource(arrayResource) { it.include() }
/**
* Add a preference to the settings.
*
* @param preference The preference to add.
*/
fun addPreference(preference: BasePreference) =
revancedPreferenceNode!!.addPreference(preference) { it.include() }
/**
* Add a new resource to the resources.
*
* @throws IllegalArgumentException if the resource already exists.
*/
internal fun BaseResource.include() {
when (this) {
is StringResource -> {
if (strings.any { it.name == name }) return
strings.add(this)
}
is ArrayResource -> addArray(this)
else -> throw NotImplementedError("Unsupported resource type")
}
}
internal fun DomFileEditor?.getNode(tagName: String) = this!!.file.getElementsByTagName(tagName).item(0)
}
override fun close() {
// merge all strings, skip duplicates
strings.forEach {
stringsNode!!.addResource(it)
}
revancedPreferencesEditor?.close()
stringsEditor?.close()
arraysEditor?.close()
}
}

View File

@ -1,34 +0,0 @@
package app.revanced.patches.shared.settings.preference
import app.revanced.patches.shared.settings.preference.impl.StringResource
import org.w3c.dom.Document
import org.w3c.dom.Element
/**
* Base preference class for all preferences.
*
* @param key The key of the preference.
* @param title The title of the preference.
* @param tag The full class name for the preference.
* @param summary The summary of the preference.
*/
abstract class BasePreference(
val key: String?,
val title: StringResource,
val summary: StringResource? = null,
val tag: String
) {
/**
* Serialize preference element to XML.
* Overriding methods should invoke super and operate on its return value.
* @param ownerDocument Target document to create elements from.
* @param resourceCallback Called when a resource has been processed.
* @return The serialized element.
*/
open fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit): Element =
ownerDocument.createElement(tag).apply {
if (key != null) setAttribute("android:key", key)
setAttribute("android:title", "@string/${title.also { resourceCallback.invoke(it) }.name}")
addSummary(summary?.also { resourceCallback.invoke(it) })
}
}

View File

@ -1,48 +0,0 @@
package app.revanced.patches.shared.settings.preference
import app.revanced.patches.shared.settings.preference.impl.StringResource
import org.w3c.dom.Element
import org.w3c.dom.Node
/**
* Add a resource node child
*
* @param resource The resource to add.
* @param resourceCallback Called when a resource has been processed.
*/
internal fun Node.addResource(resource: BaseResource, resourceCallback: (BaseResource) -> Unit = { }) {
appendChild(resource.serialize(ownerDocument, resourceCallback))
}
/**
* Add a preference node child to the settings.
*
* @param preference The preference to add.
* @param resourceCallback Called when a resource has been processed.
*/
internal fun Node.addPreference(preference: BasePreference, resourceCallback: ((BaseResource) -> Unit) = { }) {
appendChild(preference.serialize(ownerDocument, resourceCallback))
}
internal fun Element.addSummary(summaryResource: StringResource?, summaryType: SummaryType = SummaryType.DEFAULT) =
summaryResource?.let { summary ->
setAttribute("android:${summaryType.type}", "@string/${summary.name}")
}
internal fun <T> Element.addDefault(default: T) {
if (default is Boolean && !(default as Boolean)) return // No need to include the default, as no value already means 'false'
default?.let {
setAttribute(
"android:defaultValue", when (it) {
is Boolean -> it.toString()
is String -> it
else -> throw IllegalArgumentException("Unsupported default value type: ${it::class.java.name}")
}
)
}
}
internal fun CharSequence.removePunctuation(): String {
val punctuation = "\\p{P}+".toRegex()
return this.replace(punctuation, "")
}

View File

@ -1,29 +0,0 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BaseResource
import org.w3c.dom.Document
// TODO: allow specifying an array resource file instead of using a list of StringResources
/**
* An array resource.
*
* @param name The name of the array resource.
* @param items The items of the array resource.
*/
class ArrayResource(
name: String,
val items: List<StringResource>
) : BaseResource(name, "string-array") {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
setAttribute("name", name)
items.forEach { item ->
resourceCallback.invoke(item)
this.appendChild(ownerDocument.createElement("item").also { itemNode ->
itemNode.textContent = "@string/${item.name}"
})
}
}
}

View File

@ -1,30 +0,0 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.addSummary
import org.w3c.dom.Document
/**
* List preference.
*
* @param key The key of the list preference.
* @param title The title of the list preference.
* @param entries The human-readable entries of the list preference.
* @param entryValues The entry values of the list preference.
* @param summary The summary of the list preference.
*/
class ListPreference(
key: String,
title: StringResource,
private val entries: ArrayResource,
private val entryValues: ArrayResource,
summary: StringResource? = null
) : BasePreference(key, title, summary, "ListPreference") {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
setAttribute("android:entries", "@array/${entries.also { resourceCallback.invoke(it) }.name}")
setAttribute("android:entryValues", "@array/${entryValues.also { resourceCallback.invoke(it) }.name}")
addSummary(summary)
}
}

View File

@ -1,35 +0,0 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.addSummary
import org.w3c.dom.Document
import org.w3c.dom.Element
/**
* A non interactive preference.
*
* Not backed by any preference key/value,
* and cannot be changed by or interacted with by the user.
*
* @param title The title of the preference.
* @param summary The summary of the text preference.
* @param selectable If this preference responds to tapping.
* Setting to 'true' restores the horizontal dividers on the top and bottom,
* but tapping will still do nothing since this Preference has no key.
*/
class NonInteractivePreference(
title: StringResource,
summary: StringResource?,
tag: String = "Preference",
// If androidx.preference is later used, this can be changed to the show top/bottom dividers feature.
val selectable: Boolean = false
) : BasePreference(null, title, summary, tag) {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit): Element {
return super.serialize(ownerDocument, resourceCallback).apply {
addSummary(summary?.also { resourceCallback.invoke(it)
setAttribute("android:selectable", selectable.toString())
})
}
}
}

View File

@ -1,41 +0,0 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.BaseResource
import org.w3c.dom.Document
/**
* A preference object.
*
* @param key The key of the preference.
* @param title The title of the preference.
* @param summary The summary of the text preference.
* @param intent The intent of the preference.
*/
class Preference(
key: String,
title: StringResource,
summary: StringResource,
val intent: Intent
) : BasePreference(key, title, summary, "Preference") {
constructor(
title: StringResource,
summary: StringResource,
intent: Intent
) : this("", title, summary, intent)
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
this.appendChild(ownerDocument.createElement("intent").also { intentNode ->
intentNode.setAttribute("android:targetPackage", intent.targetPackage)
intentNode.setAttribute("android:data", intent.data)
intentNode.setAttribute("android:targetClass", intent.targetClass)
})
}
class Intent(
internal val targetPackage: String,
internal val data: String,
internal val targetClass: String
)
}

View File

@ -1,26 +0,0 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.BaseResource
import org.w3c.dom.Document
/**
* A preference category.
*
* @param key The key of the preference.
* @param title The title of the preference.
* @param preferences Child preferences of this category.
*/
open class PreferenceCategory(
key: String,
title: StringResource,
var preferences: List<BasePreference>,
tag: String = "PreferenceCategory"
) : BasePreference(key, title, null, tag) {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
for (childPreference in preferences) {
this.appendChild(childPreference.serialize(ownerDocument, resourceCallback))
}
}
}

View File

@ -1,29 +0,0 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.addSummary
import org.w3c.dom.Document
/**
* A preference screen.
*
* @param key The key of the preference.
* @param title The title of the preference.
* @param preferences Child preferences of this screen.
* @param summary The summary of the text preference.
*/
open class PreferenceScreen(
key: String,
title: StringResource,
var preferences: List<BasePreference>,
summary: StringResource? = null
) : BasePreference(key, title, summary, "PreferenceScreen") {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
addSummary(summary?.also { resourceCallback.invoke(it) })
for (childPreference in preferences)
this.appendChild(childPreference.serialize(ownerDocument, resourceCallback))
}
}

View File

@ -1,27 +0,0 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BaseResource
import org.w3c.dom.Document
/**
* A string value.
* Represets a string in the strings.xml file.
*
* @param name The name of the string.
* @param value The value of the string.
* @param formatted If the string is formatted. If false, the attribute will be set.
*/
class StringResource(
name: String,
val value: String,
val formatted: Boolean = true
) : BaseResource(name, "string") {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
// if the string is un-formatted, explicitly add the formatted attribute
if (!formatted) setAttribute("formatted", "false")
textContent = value
}
}

View File

@ -1,34 +0,0 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.AbstractSettingsResourcePatch.Companion.include
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.SummaryType
import app.revanced.patches.shared.settings.preference.addSummary
import org.w3c.dom.Document
import org.w3c.dom.Element
/**
* A switch preference.
*
* @param key The key of the switch.
* @param title The title of the switch.
* @param summaryOn The summary to show when the preference is enabled.
* @param summaryOff The summary to show when the preference is disabled.
* @param userDialogMessage The message to show in a dialog when the user toggles the preference.
*/
class SwitchPreference(
key: String, title: StringResource,
val summaryOn: StringResource,
val summaryOff: StringResource,
val userDialogMessage: StringResource? = null,
) : BasePreference(key, title, null, "SwitchPreference") {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit): Element {
userDialogMessage?.include()
return super.serialize(ownerDocument, resourceCallback).apply {
addSummary(summaryOn.also { resourceCallback.invoke(it) }, SummaryType.ON)
addSummary(summaryOff.also { resourceCallback.invoke(it) }, SummaryType.OFF)
}
}
}

View File

@ -1,27 +0,0 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.BaseResource
import org.w3c.dom.Document
/**
* A text preference.
*
* @param key The key of the text preference.
* @param title The title of the text preference.
* @param inputType The input type of the text preference.
* @param summary The summary of the text preference.
*/
class TextPreference(
key: String?,
title: StringResource,
summary: StringResource?,
val inputType: InputType = InputType.TEXT,
tag: String = "app.revanced.integrations.shared.settings.preference.ResettableEditTextPreference"
) : BasePreference(key, title, summary, tag) {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
setAttribute("android:inputType", inputType.type)
}
}

View File

@ -1,98 +0,0 @@
package app.revanced.patches.shared.settings.util
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.impl.PreferenceCategory
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.removePunctuation
import java.io.Closeable
abstract class AbstractPreferenceScreen(
private val root: MutableList<Screen> = mutableListOf()
) : Closeable {
override fun close() {
if (root.isEmpty())
return
for (preference in root.sortedBy { it.title }) {
commit(preference.transform())
}
}
/**
* Finalize and insert root preference into resource patch
*/
abstract fun commit(screen: PreferenceScreen)
open inner class Screen(
key: String,
title: String,
val summary: String? = null,
preferences: MutableList<BasePreference> = mutableListOf(),
val categories: MutableList<Category> = mutableListOf()
) : BasePreferenceCollection(key, title, preferences) {
override fun transform() = PreferenceScreen(
key,
StringResource(
"${key}_title", title
),
preferences.sortedWith(
compareBy(
{ it is PreferenceScreen },
{ it.title.value.removePunctuation().lowercase() }
)
) + categories.sortedBy {
it.title.removePunctuation().lowercase()
}.map {
it.transform()
},
summary?.let { summary ->
StringResource("${key}_summary", summary)
}
)
private fun ensureScreenInserted() {
// Add to screens if not yet done
if (!this@AbstractPreferenceScreen.root.contains(this))
this@AbstractPreferenceScreen.root.add(this)
}
fun addPreferences(vararg preferences: BasePreference) {
ensureScreenInserted()
this.preferences.addAll(preferences)
}
open inner class Category(
key: String,
title: String,
preferences: MutableList<BasePreference> = mutableListOf()
) : BasePreferenceCollection(key, title, preferences) {
override fun transform(): PreferenceCategory {
return PreferenceCategory(
key,
StringResource("${key}_title", title),
preferences.sortedBy { it.title.value.removePunctuation().lowercase() }
)
}
fun addPreferences(vararg preferences: BasePreference) {
ensureScreenInserted()
// Add to categories if not yet done
if (!this@Screen.categories.contains(this))
this@Screen.categories.add(this)
this.preferences.addAll(preferences)
}
}
}
abstract class BasePreferenceCollection(
val key: String,
val title: String,
val preferences: MutableList<BasePreference> = mutableListOf()
) {
abstract fun transform(): BasePreference
}
}

View File

@ -3,7 +3,7 @@ package app.revanced.patches.spotify.navbar
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch
@Patch(dependencies = [ResourceMappingPatch::class])
object PremiumNavbarTabResourcePatch : ResourcePatch() {

View File

@ -1,10 +1,10 @@
package app.revanced.patches.tiktok.misc.integrations
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.integrations.AbstractIntegrationsPatch
import app.revanced.patches.shared.misc.integrations.BaseIntegrationsPatch
import app.revanced.patches.tiktok.misc.integrations.fingerprints.InitFingerprint
@Patch(requiresIntegrations = true)
object IntegrationsPatch : AbstractIntegrationsPatch(
object IntegrationsPatch : BaseIntegrationsPatch(
setOf(InitFingerprint)
)

View File

@ -1,6 +1,6 @@
package app.revanced.patches.tiktok.misc.integrations.fingerprints
import app.revanced.patches.shared.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint
import app.revanced.patches.shared.misc.integrations.BaseIntegrationsPatch.IntegrationsFingerprint
internal object InitFingerprint : IntegrationsFingerprint(
customFingerprint = { methodDef, _ ->

View File

@ -7,8 +7,8 @@ import app.revanced.patcher.patch.BytecodePatch
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.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.twitch.ad.audio.fingerprints.AudioAdsPresenterPlayFingerprint
import app.revanced.patches.twitch.misc.integrations.IntegrationsPatch
import app.revanced.patches.twitch.misc.settings.SettingsPatch
@ -16,7 +16,7 @@ import app.revanced.patches.twitch.misc.settings.SettingsPatch
@Patch(
name = "Block audio ads",
description = "Blocks audio ads in streams and VODs.",
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class],
compatiblePackages = [CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0", "16.9.1"])],
)
@Suppress("unused")
@ -24,6 +24,10 @@ object AudioAdsPatch : BytecodePatch(
setOf(AudioAdsPresenterPlayFingerprint)
) {
override fun execute(context: BytecodeContext) {
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.ADS.CLIENT_SIDE.addPreferences(SwitchPreference("revanced_block_audio_ads"))
// Block playAds call
with(AudioAdsPresenterPlayFingerprint.result!!) {
mutableMethod.addInstructionsWithLabels(
@ -37,23 +41,5 @@ object AudioAdsPatch : BytecodePatch(
ExternalLabel("show_audio_ads", mutableMethod.getInstruction(0))
)
}
SettingsPatch.PreferenceScreen.ADS.CLIENT_SIDE.addPreferences(
SwitchPreference(
"revanced_block_audio_ads",
StringResource(
"revanced_block_audio_ads",
"Block audio ads"
),
StringResource(
"revanced_block_audio_ads_on",
"Audio ads are blocked"
),
StringResource(
"revanced_block_audio_ads_off",
"Audio ads are unblocked"
)
)
)
}
}

View File

@ -1,23 +1,27 @@
package app.revanced.patches.twitch.ad.embedded
import app.revanced.util.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
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.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.ListPreference
import app.revanced.patches.twitch.ad.embedded.fingerprints.CreateUsherClientFingerprint
import app.revanced.patches.twitch.ad.video.VideoAdsPatch
import app.revanced.patches.twitch.misc.integrations.IntegrationsPatch
import app.revanced.patches.twitch.misc.settings.SettingsPatch
import app.revanced.util.exception
@Patch(
name = "Block embedded ads",
description = "Blocks embedded stream ads using services like Luminous or PurpleAdBlocker.",
dependencies = [VideoAdsPatch::class, IntegrationsPatch::class, SettingsPatch::class],
dependencies = [
VideoAdsPatch::class,
IntegrationsPatch::class,
SettingsPatch::class,
AddResourcesPatch::class
],
compatiblePackages = [CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0", "16.9.1"])]
)
@Suppress("unused")
@ -25,6 +29,12 @@ object EmbeddedAdsPatch : BytecodePatch(
setOf(CreateUsherClientFingerprint)
) {
override fun execute(context: BytecodeContext) {
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.ADS.SURESTREAM.addPreferences(
ListPreference("revanced_block_embedded_ads")
)
val result = CreateUsherClientFingerprint.result ?: throw CreateUsherClientFingerprint.exception
// Inject OkHttp3 application interceptor
@ -36,34 +46,5 @@ object EmbeddedAdsPatch : BytecodePatch(
invoke-virtual {v0, v2}, Lokhttp3/OkHttpClient${"$"}Builder;->addInterceptor(Lokhttp3/Interceptor;)Lokhttp3/OkHttpClient${"$"}Builder;
"""
)
SettingsPatch.PreferenceScreen.ADS.SURESTREAM.addPreferences(
ListPreference(
"revanced_block_embedded_ads",
StringResource(
"revanced_block_embedded_ads",
"Block embedded video ads"
),
ArrayResource(
"revanced_hls_proxies",
listOf(
StringResource("revanced_proxy_disabled", "Disabled"),
StringResource("revanced_proxy_luminous", "Luminous proxy"),
StringResource("revanced_proxy_purpleadblock", "PurpleAdBlock proxy"),
)
),
ArrayResource(
"revanced_hls_proxies_values",
listOf(
StringResource("key_revanced_proxy_disabled", "disabled"),
StringResource("key_revanced_proxy_luminous", "luminous"),
StringResource("key_revanced_proxy_purpleadblock", "purpleadblock")
)
)
)
)
SettingsPatch.addString("revanced_embedded_ads_service_unavailable", "%s is unavailable. Ads may show. Try switching to another ad block service in settings.")
SettingsPatch.addString("revanced_embedded_ads_service_failed", "%s server returned an error. Ads may show. Try switching to another ad block service in settings.")
}
}

View File

@ -7,7 +7,7 @@ import app.revanced.patcher.fingerprint.MethodFingerprint
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.util.smali.ExternalLabel
abstract class AbstractAdPatch(
abstract class BaseAdPatch(
val conditionCall: String,
val skipLabelName: String,
internal val fingerprints: Set<MethodFingerprint> = emptySet(),

View File

@ -1,6 +1,5 @@
package app.revanced.patches.twitch.ad.video
import app.revanced.util.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
@ -8,22 +7,23 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
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.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.twitch.ad.shared.util.BaseAdPatch
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.IntegrationsPatch
import app.revanced.patches.twitch.misc.settings.SettingsPatch
import app.revanced.util.exception
@Patch(
name = "Block video ads",
description = "Blocks video ads in streams and VODs.",
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class],
compatiblePackages = [CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0", "16.9.1"])]
)
object VideoAdsPatch : AbstractAdPatch(
object VideoAdsPatch : BaseAdPatch(
"Lapp/revanced/integrations/twitch/patches/VideoAdsPatch;->shouldBlockVideoAds()Z",
"show_video_ads",
setOf(
@ -33,6 +33,10 @@ object VideoAdsPatch : AbstractAdPatch(
)
) {
override fun execute(context: BytecodeContext) {
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.ADS.CLIENT_SIDE.addPreferences(SwitchPreference("revanced_block_video_ads"))
/* Amazon ads SDK */
context.blockMethods(
"Lcom/amazon/ads/video/player/AdsManagerImpl;",
@ -120,23 +124,5 @@ object VideoAdsPatch : AbstractAdPatch(
"""
)
} ?: throw ContentConfigShowAdsFingerprint.exception
SettingsPatch.PreferenceScreen.ADS.CLIENT_SIDE.addPreferences(
SwitchPreference(
"revanced_block_video_ads",
StringResource(
"revanced_block_video_ads",
"Block video ads"
),
StringResource(
"revanced_block_video_ads_on",
"Video ads are blocked"
),
StringResource(
"revanced_block_video_ads_off",
"Video ads are unblocked"
)
)
)
}
}

View File

@ -1,6 +1,5 @@
package app.revanced.patches.twitch.chat.antidelete
import app.revanced.util.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
@ -9,19 +8,23 @@ import app.revanced.patcher.patch.BytecodePatch
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.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.ListPreference
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.IntegrationsPatch
import app.revanced.patches.twitch.misc.settings.SettingsPatch
import app.revanced.util.exception
@Patch(
name = "Show deleted messages",
description = "Shows deleted chat messages behind a clickable spoiler.",
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
dependencies = [
IntegrationsPatch::class,
SettingsPatch::class,
AddResourcesPatch::class,
],
compatiblePackages = [CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0", "16.9.1"])]
)
@Suppress("unused")
@ -39,6 +42,15 @@ object ShowDeletedMessagesPatch : BytecodePatch(
"""
override fun execute(context: BytecodeContext) {
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.CHAT.GENERAL.addPreferences(
ListPreference(
key = "revanced_show_deleted_messages",
summaryKey = null,
)
)
// Spoiler mode: Force set hasModAccess member to true in constructor
DeletedMessageClickableSpanCtorFingerprint.result?.mutableMethod?.apply {
addInstructionsWithLabels(
@ -68,34 +80,6 @@ object ShowDeletedMessagesPatch : BytecodePatch(
""",
ExternalLabel("no_reformat", getInstruction(0))
)
} ?: throw ChatUtilCreateDeletedSpanFingerprint.exception
SettingsPatch.PreferenceScreen.CHAT.GENERAL.addPreferences(
ListPreference(
"revanced_show_deleted_messages",
StringResource(
"revanced_show_deleted_messages_title",
"Show deleted messages"
),
ArrayResource(
"revanced_deleted_messages",
listOf(
StringResource("revanced_deleted_messages_hide", "Do not show deleted messages"),
StringResource("revanced_deleted_messages_spoiler", "Hide deleted messages behind a spoiler"),
StringResource("revanced_deleted_messages_cross_out", "Show deleted messages as crossed-out text")
)
),
ArrayResource(
"revanced_deleted_messages_values",
listOf(
StringResource("key_revanced_deleted_messages_hide", "hide"),
StringResource("key_revanced_deleted_messages_spoiler", "spoiler"),
StringResource("key_revanced_deleted_messages_cross_out", "cross-out")
)
)
)
)
SettingsPatch.addString("revanced_deleted_msg", "message deleted")
} ?: throw ChatUtilCreateDeletedSpanFingerprint.exception
}
}

View File

@ -1,6 +1,5 @@
package app.revanced.patches.twitch.chat.autoclaim
import app.revanced.util.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
@ -8,38 +7,27 @@ import app.revanced.patcher.patch.BytecodePatch
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.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.twitch.chat.autoclaim.fingerprints.CommunityPointsButtonViewDelegateFingerprint
import app.revanced.patches.twitch.misc.settings.SettingsPatch
import app.revanced.util.exception
@Patch(
name = "Auto claim channel points",
description = "Automatically claim Channel Points.",
dependencies = [SettingsPatch::class],
dependencies = [SettingsPatch::class, AddResourcesPatch::class],
compatiblePackages = [CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0", "16.9.1"])]
)
@Suppress("unused")
object AutoClaimChannelPointPatch : BytecodePatch(
object AutoClaimChannelPointsPatch : BytecodePatch(
setOf(CommunityPointsButtonViewDelegateFingerprint)
) {
override fun execute(context: BytecodeContext) {
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.CHAT.GENERAL.addPreferences(
SwitchPreference(
"revanced_auto_claim_channel_points",
StringResource(
"revanced_auto_claim_channel_points",
"Automatically claim Channel Points"
),
StringResource(
"revanced_auto_claim_channel_points_on",
"Channel Points are claimed automatically"
),
StringResource(
"revanced_auto_claim_channel_points_off",
"Channel Points are not claimed automatically"
)
)
SwitchPreference("revanced_auto_claim_channel_points")
)
CommunityPointsButtonViewDelegateFingerprint.result?.mutableMethod?.apply {

View File

@ -1,23 +1,23 @@
package app.revanced.patches.twitch.debug
import app.revanced.util.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
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.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
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.IntegrationsPatch
import app.revanced.patches.twitch.misc.settings.SettingsPatch
import app.revanced.util.exception
@Patch(
name = "Debug mode",
description = "Enables Twitch's internal debugging mode.",
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class],
compatiblePackages = [CompatiblePackage("tv.twitch.android.app")],
use = false
)
@ -30,6 +30,10 @@ object DebugModePatch : BytecodePatch(
)
) {
override fun execute(context: BytecodeContext) {
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.MISC.OTHER.addPreferences(SwitchPreference("revanced_twitch_debug_mode"))
listOf(
IsDebugConfigEnabledFingerprint,
IsOmVerificationEnabledFingerprint,
@ -46,23 +50,5 @@ object DebugModePatch : BytecodePatch(
)
} ?: throw it.exception
}
SettingsPatch.PreferenceScreen.MISC.OTHER.addPreferences(
SwitchPreference(
"revanced_twitch_debug_mode",
StringResource(
"revanced_twitch_debug_mode_title",
"Enable Twitch debug mode"
),
StringResource(
"revanced_twitch_debug_mode_summary_on",
"Twitch debug mode is enabled (not recommended)"
),
StringResource(
"revanced_twitch_debug_mode_summary_off",
"Twitch debug mode is disabled"
)
)
)
}
}

View File

@ -1,10 +1,10 @@
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.shared.misc.integrations.BaseIntegrationsPatch
import app.revanced.patches.twitch.misc.integrations.fingerprints.InitFingerprint
@Patch(requiresIntegrations = true)
object IntegrationsPatch : AbstractIntegrationsPatch(
object IntegrationsPatch : BaseIntegrationsPatch(
setOf(InitFingerprint)
)

View File

@ -1,6 +1,6 @@
package app.revanced.patches.twitch.misc.integrations.fingerprints
import app.revanced.patches.shared.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint
import app.revanced.patches.shared.misc.integrations.BaseIntegrationsPatch.IntegrationsFingerprint
internal object InitFingerprint : IntegrationsFingerprint(
customFingerprint = { methodDef, _ ->

View File

@ -11,10 +11,10 @@ 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.preference.impl.SwitchPreference
import app.revanced.patches.shared.settings.util.AbstractPreferenceScreen
import app.revanced.patches.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.PreferenceCategory
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.shared.misc.settings.preference.BasePreferenceScreen
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
@ -29,7 +29,11 @@ import java.io.Closeable
@Patch(
name = "Settings",
description = "Adds settings menu to Twitch.",
dependencies = [IntegrationsPatch::class, SettingsResourcePatch::class],
dependencies = [
IntegrationsPatch::class,
SettingsResourcePatch::class,
AddResourcesPatch::class
],
compatiblePackages = [
CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0", "16.9.1"])
]
@ -48,13 +52,18 @@ object SettingsPatch : BytecodePatch(
private const val REVANCED_SETTINGS_MENU_ITEM_ICON_RES = "ic_settings"
private const val MENU_ITEM_ENUM_CLASS_DESCRIPTOR = "Ltv/twitch/android/feature/settings/menu/SettingsMenuItem;"
private const val MENU_DISMISS_EVENT_CLASS_DESCRIPTOR = "Ltv/twitch/android/feature/settings/menu/SettingsMenuViewDelegate\$Event\$OnDismissClicked;"
private const val MENU_DISMISS_EVENT_CLASS_DESCRIPTOR =
"Ltv/twitch/android/feature/settings/menu/SettingsMenuViewDelegate\$Event\$OnDismissClicked;"
private const val INTEGRATIONS_PACKAGE = "app/revanced/integrations/twitch"
private const val ACTIVITY_HOOKS_CLASS_DESCRIPTOR = "L$INTEGRATIONS_PACKAGE/settings/AppCompatActivityHook;"
private const val UTILS_CLASS_DESCRIPTOR = "L$INTEGRATIONS_PACKAGE/Utils;"
override fun execute(context: BytecodeContext) {
AddResourcesPatch(this::class)
PreferenceScreen.MISC.OTHER.addPreferences(SwitchPreference("revanced_debug"))
// Hook onCreate to handle fragment creation
SettingsActivityOnCreateFingerprint.result?.apply {
val insertIndex = mutableMethod.implementation!!.instructions.size - 2
@ -107,26 +116,9 @@ object SettingsPatch : BytecodePatch(
""",
ExternalLabel("no_rv_settings_onclick", mutableMethod.getInstruction(insertIndex))
)
} ?: throw MenuGroupsOnClickFingerprint.exception
addString("revanced_settings", "ReVanced Settings", false)
PreferenceScreen.MISC.OTHER.addPreferences(
SwitchPreference(
"revanced_debug",
StringResource("revanced_debug_title", "Debug logging"),
StringResource("revanced_debug_summary_on", "Debug logs are enabled"),
StringResource("revanced_debug_summary_off", "Debug logs are disabled")
),
)
} ?: throw MenuGroupsOnClickFingerprint.exception
}
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)
private fun MethodFingerprintResult.injectMenuItem(
name: String,
value: Int,
@ -168,33 +160,32 @@ object SettingsPatch : BytecodePatch(
/**
* Preference screens patches should add their settings to.
*/
internal object PreferenceScreen : AbstractPreferenceScreen() {
val ADS = CustomScreen("ads", "Ads", "Ad blocking settings")
val CHAT = CustomScreen("chat", "Chat", "Chat settings")
val MISC = CustomScreen("misc", "Misc", "Miscellaneous patches")
internal object PreferenceScreen : BasePreferenceScreen() {
val ADS = CustomScreen("revanced_ads_screen")
val CHAT = CustomScreen("revanced_chat_screen")
val MISC = CustomScreen("revanced_misc_screen")
internal class CustomScreen(key: String, title: String, summary: String) : Screen(key, title, summary) {
internal class CustomScreen(key: String) : Screen(key) {
/* Categories */
val GENERAL = CustomCategory("general", "General settings")
val OTHER = CustomCategory("other", "Other settings")
val CLIENT_SIDE = CustomCategory("client_ads", "Client-side ads")
val SURESTREAM = CustomCategory("surestream_ads", "Server-side surestream ads")
val GENERAL = CustomCategory("revanced_general_category")
val OTHER = CustomCategory("revanced_other_category")
val CLIENT_SIDE = CustomCategory("revanced_client_ads_category")
val SURESTREAM = CustomCategory("revanced_surestream_ads_category")
internal inner class CustomCategory(key: String, title: String) : Screen.Category(key, title) {
internal inner class CustomCategory(key: String) : Screen.Category(key) {
/* For Twitch, we need to load our CustomPreferenceCategory class instead of the default one. */
override fun transform(): PreferenceCategory {
return PreferenceCategory(
key,
StringResource("${key}_title", title),
preferences.sortedBy { it.title.value },
"app.revanced.integrations.twitch.settings.preference.CustomPreferenceCategory"
preferences = preferences,
tag = "app.revanced.integrations.twitch.settings.preference.CustomPreferenceCategory"
)
}
}
}
override fun commit(screen: app.revanced.patches.shared.settings.preference.impl.PreferenceScreen) {
addPreferenceScreen(screen)
override fun commit(screen: app.revanced.patches.shared.misc.settings.preference.PreferenceScreen) {
SettingsResourcePatch += screen
}
}

View File

@ -1,36 +1,5 @@
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
import app.revanced.patches.shared.misc.settings.BaseSettingsResourcePatch
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)
}
object SettingsResourcePatch : BaseSettingsResourcePatch()

View File

@ -4,7 +4,7 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patches.twitter.misc.hook.json.JsonHookPatch
abstract class BaseHookPatchPatch(private val hookClassDescriptor: String) : BytecodePatch() {
abstract class BaseHookPatch(private val hookClassDescriptor: String) : BytecodePatch() {
override fun execute(context: BytecodeContext) =
JsonHookPatch.hooks.addHook(JsonHookPatch.Hook(context, hookClassDescriptor))
}

View File

@ -3,7 +3,7 @@ package app.revanced.patches.twitter.misc.hook.patch.ads
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.twitter.misc.hook.json.JsonHookPatch
import app.revanced.patches.twitter.misc.hook.patch.BaseHookPatchPatch
import app.revanced.patches.twitter.misc.hook.patch.BaseHookPatch
@Patch(
name = "Hide ads",
@ -12,4 +12,4 @@ import app.revanced.patches.twitter.misc.hook.patch.BaseHookPatchPatch
compatiblePackages = [CompatiblePackage("com.twitter.android")]
)
@Suppress("unused")
object HideAdsPatch : BaseHookPatchPatch("Lapp/revanced/integrations/twitter/patches/hook/patch/ads/AdsHook;")
object HideAdsHookPatch : BaseHookPatch("Lapp/revanced/integrations/twitter/patches/hook/patch/ads/AdsHook;")

View File

@ -3,7 +3,7 @@ package app.revanced.patches.twitter.misc.hook.patch.recommendation
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.twitter.misc.hook.json.JsonHookPatch
import app.revanced.patches.twitter.misc.hook.patch.BaseHookPatchPatch
import app.revanced.patches.twitter.misc.hook.patch.BaseHookPatch
@Patch(
name = "Hide recommended users",
@ -11,6 +11,6 @@ import app.revanced.patches.twitter.misc.hook.patch.BaseHookPatchPatch
compatiblePackages = [CompatiblePackage("com.twitter.android")]
)
@Suppress("unused")
object HideRecommendedUsersPatch : BaseHookPatchPatch(
object HideRecommendedUsersPatch : BaseHookPatch(
"Lapp/revanced/integrations/twitter/patches/hook/patch/recommendation/RecommendedUsersHook;"
)

View File

@ -3,9 +3,9 @@ package app.revanced.patches.youtube.ad.general
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch.PreferenceScreen
@ -14,7 +14,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch.PreferenceScreen
dependencies = [
LithoFilterPatch::class,
SettingsPatch::class,
ResourceMappingPatch::class
ResourceMappingPatch::class,
AddResourcesPatch::class
]
)
object HideAdsResourcePatch : ResourcePatch() {
@ -24,61 +25,18 @@ object HideAdsResourcePatch : ResourcePatch() {
internal var adAttributionId: Long = -1
override fun execute(context: ResourceContext) {
AddResourcesPatch(this::class)
PreferenceScreen.ADS.addPreferences(
SwitchPreference(
"revanced_hide_general_ads",
StringResource("revanced_hide_general_ads_title", "Hide general ads"),
StringResource("revanced_hide_general_ads_summary_on", "General ads are hidden"),
StringResource("revanced_hide_general_ads_summary_off", "General ads are shown")
),
SwitchPreference(
"revanced_hide_fullscreen_ads",
StringResource("revanced_hide_fullscreen_ads_title", "Hide fullscreen ads"),
StringResource("revanced_hide_fullscreen_ads_summary_on", "Fullscreen ads are hidden"),
StringResource("revanced_hide_fullscreen_ads_summary_off", "Fullscreen ads are shown")
),
SwitchPreference(
"revanced_hide_buttoned_ads",
StringResource("revanced_hide_buttoned_ads_title", "Hide buttoned ad"),
StringResource("revanced_hide_buttoned_ads_summary_on", "Buttoned ads are hidden"),
StringResource("revanced_hide_buttoned_ads_summary_off", "Buttoned ads are shown")
),
SwitchPreference(
"revanced_hide_paid_content_ads",
StringResource("revanced_hide_paid_content_ads_title", "Hide paid content"),
StringResource("revanced_hide_paid_content_ads_summary_on", "Paid content is hidden"),
StringResource("revanced_hide_paid_content_ads_summary_off", "Paid content is shown")
),
SwitchPreference(
"revanced_hide_self_sponsor_ads",
StringResource("revanced_hide_self_sponsor_ads_title", "Hide self sponsored cards"),
StringResource("revanced_hide_self_sponsor_ads_summary_on", "Self sponsored cards are hidden"),
StringResource("revanced_hide_self_sponsor_ads_summary_off", "Self sponsored cards are shown")
),
SwitchPreference(
"revanced_hide_products_banner",
StringResource("revanced_hide_products_banner_title", "Hide banner to view products"),
StringResource("revanced_hide_products_banner_summary_on", "Banner is hidden"),
StringResource("revanced_hide_products_banner_summary_off", "Banner is shown")
),
SwitchPreference(
"revanced_hide_shopping_links",
StringResource("revanced_hide_shopping_links_title", "Hide shopping links in video description"),
StringResource("revanced_hide_shopping_links_summary_on", "Shopping links are hidden"),
StringResource("revanced_hide_shopping_links_summary_off", "Shopping links are shown")
),
SwitchPreference(
"revanced_hide_web_search_results",
StringResource("revanced_hide_web_search_results_title", "Hide web search results"),
StringResource("revanced_hide_web_search_results_summary_on", "Web search results are hidden"),
StringResource("revanced_hide_web_search_results_summary_off", "Web search results are shown")
),
SwitchPreference(
"revanced_hide_merchandise_banners",
StringResource("revanced_hide_merchandise_banners_title", "Hide merchandise banners"),
StringResource("revanced_hide_merchandise_banners_summary_on", "Merchandise banners are hidden"),
StringResource("revanced_hide_merchandise_banners_summary_off", "Merchandise banners are shown")
)
SwitchPreference("revanced_hide_general_ads"),
SwitchPreference("revanced_hide_fullscreen_ads"),
SwitchPreference("revanced_hide_buttoned_ads"),
SwitchPreference("revanced_hide_paid_content_ads"),
SwitchPreference("revanced_hide_self_sponsor_ads"),
SwitchPreference("revanced_hide_products_banner"),
SwitchPreference("revanced_hide_shopping_links"),
SwitchPreference("revanced_hide_web_search_results"),
SwitchPreference("revanced_hide_merchandise_banners")
)
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)

View File

@ -1,22 +1,22 @@
package app.revanced.patches.youtube.ad.getpremium
import app.revanced.util.exception
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.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.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.ad.getpremium.fingerprints.GetPremiumViewFingerprint
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.util.exception
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
@Patch(
description = "Hides YouTube Premium signup promotions under the video player.",
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.youtube", [
@ -40,23 +40,9 @@ object HideGetPremiumPatch : BytecodePatch(setOf(GetPremiumViewFingerprint)) {
"Lapp/revanced/integrations/youtube/patches/HideGetPremiumPatch;"
override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.ADS.addPreferences(
SwitchPreference(
"revanced_hide_get_premium",
StringResource(
"revanced_hide_get_premium_title",
"Hide YouTube Premium promotions"
),
StringResource(
"revanced_hide_get_premium_summary_on",
"YouTube Premium promotions under video player are hidden"
),
StringResource(
"revanced_hide_get_premium_summary_off",
"YouTube Premium promotions under video player are shown"
)
)
)
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.ADS.addPreferences(SwitchPreference("revanced_hide_get_premium"))
GetPremiumViewFingerprint.result?.let {
it.mutableMethod.apply {

View File

@ -7,8 +7,8 @@ import app.revanced.patcher.patch.BytecodePatch
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.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.ad.video.fingerprints.LoadVideoAdsFingerprint
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
@ -18,7 +18,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
description = "Adds an option to remove ads in the video player.",
dependencies = [
IntegrationsPatch::class,
SettingsPatch::class
SettingsPatch::class,
AddResourcesPatch::class
],
compatiblePackages = [
CompatiblePackage(
@ -44,14 +45,9 @@ object VideoAdsPatch : BytecodePatch(
setOf(LoadVideoAdsFingerprint)
) {
override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.ADS.addPreferences(
SwitchPreference(
"revanced_hide_video_ads",
StringResource("revanced_hide_video_ads_title", "Hide video ads"),
StringResource("revanced_hide_video_ads_summary_on", "Video ads are hidden"),
StringResource("revanced_hide_video_ads_summary_off", "Video ads are shown")
)
)
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.ADS.addPreferences(SwitchPreference("revanced_hide_video_ads"))
val loadVideoAdsFingerprintMethod = LoadVideoAdsFingerprint.result!!.mutableMethod

View File

@ -3,50 +3,31 @@ package app.revanced.patches.youtube.interaction.copyvideourl
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.misc.playercontrols.BottomControlsResourcePatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.util.ResourceGroup
import app.revanced.util.copyResources
import app.revanced.util.mergeStrings
@Patch(
dependencies = [
SettingsPatch::class,
BottomControlsResourcePatch::class
BottomControlsResourcePatch::class,
AddResourcesPatch::class
]
)
internal object CopyVideoUrlResourcePatch : ResourcePatch() {
override fun execute(context: ResourceContext) {
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
PreferenceScreen(
"revanced_copy_video_url_preference_screen",
StringResource("revanced_copy_video_url_preference_screen_title", "Copy video URL settings"),
listOf(
SwitchPreference(
"revanced_copy_video_url",
StringResource("revanced_copy_video_url_title", "Show copy video URL button"),
StringResource(
"revanced_copy_video_url_summary_on",
"Button is shown. Tap to copy video URL. Tap and hold to copy video URL with timestamp"
),
StringResource("revanced_copy_video_url_summary_off", "Button is not shown")
),
SwitchPreference(
"revanced_copy_video_url_timestamp",
StringResource("revanced_copy_video_url_timestamp_title", "Show copy timestamp URL button"),
StringResource(
"revanced_copy_video_url_timestamp_summary_on",
"Button is shown. Tap to copy video URL with timestamp. Tap and hold to copy video without timestamp"
),
StringResource("revanced_copy_video_url_timestamp_summary_off", "Button is not shown")
)
),
StringResource(
"revanced_copy_video_url_preference_screen_summary",
"Settings related to copy URL buttons in video player"
preferences = setOf(
SwitchPreference("revanced_copy_video_url"),
SwitchPreference("revanced_copy_video_url_timestamp")
)
)
)
@ -59,7 +40,7 @@ internal object CopyVideoUrlResourcePatch : ResourcePatch() {
)
)
context.mergeStrings("copyvideourl/host/values/strings.xml")
AddResourcesPatch(this::class)
BottomControlsResourcePatch.addControls("copyvideourl")
}

View File

@ -6,8 +6,8 @@ import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
import app.revanced.patcher.patch.BytecodePatch
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.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.interaction.dialog.fingerprints.CreateDialogFingerprint
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
@ -18,7 +18,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
name = "Remove viewer discretion dialog",
description = "Adds an option to remove the dialog that appears when opening a video that has been age-restricted " +
"by accepting it automatically. This does not bypass the age restriction.",
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.youtube", [
@ -46,27 +46,9 @@ object RemoveViewerDiscretionDialogPatch : BytecodePatch(
"confirmDialog(Landroid/app/AlertDialog;)V"
override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
SwitchPreference(
"revanced_remove_viewer_discretion_dialog",
StringResource(
"revanced_remove_viewer_discretion_dialog_title",
"Remove viewer discretion dialog"
),
StringResource(
"revanced_remove_viewer_discretion_dialog_summary_on",
"Dialog will be removed"
),
StringResource(
"revanced_remove_viewer_discretion_dialog_summary_off",
"Dialog will be shown"
),
StringResource(
"revanced_remove_viewer_discretion_dialog_user_dialog_message",
"This does not bypass the age restriction. It just accepts it automatically."
)
)
)
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(SwitchPreference("revanced_remove_viewer_discretion_dialog"))
CreateDialogFingerprint.result?.mutableMethod?.apply {
val showDialogIndex = implementation!!.instructions.lastIndex - 2

View File

@ -3,55 +3,37 @@ package app.revanced.patches.youtube.interaction.downloads
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.settings.preference.impl.*
import app.revanced.patches.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.InputType
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.shared.misc.settings.preference.TextPreference
import app.revanced.patches.youtube.misc.playercontrols.BottomControlsResourcePatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.util.ResourceGroup
import app.revanced.util.copyResources
import app.revanced.util.mergeStrings
@Patch(
dependencies = [
BottomControlsResourcePatch::class,
SettingsPatch::class
SettingsPatch::class,
AddResourcesPatch::class,
]
)
internal object ExternalDownloadsResourcePatch : ResourcePatch() {
override fun execute(context: ResourceContext) {
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
PreferenceScreen(
"revanced_external_downloader_preference_screen",
StringResource("revanced_external_downloader_preference_screen_title", "External download settings"),
listOf(
SwitchPreference(
"revanced_external_downloader",
StringResource("revanced_external_downloader_title", "Show external download button"),
StringResource("revanced_external_downloader_summary_on", "Download button shown in player"),
StringResource(
"revanced_external_downloader_summary_off",
"Download button not shown in player"
)
),
TextPreference(
"revanced_external_downloader_name",
StringResource("revanced_external_downloader_name_title", "Downloader package name"),
StringResource(
"revanced_external_downloader_name_summary",
"Package name of your installed external downloader app, such as NewPipe or Seal"
),
InputType.TEXT
)
preferences = setOf(
SwitchPreference("revanced_external_downloader"),
TextPreference("revanced_external_downloader_name", inputType = InputType.TEXT)
),
StringResource(
"revanced_external_downloader_preference_screen_summary",
"Settings for using an external downloader"
)
)
)
context.mergeStrings("downloads/host/values/strings.xml")
context.copyResources(
"downloads",
ResourceGroup("drawable", "revanced_yt_download_button.xml")

View File

@ -1,23 +1,23 @@
package app.revanced.patches.youtube.interaction.seekbar
import app.revanced.util.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch
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.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.interaction.seekbar.fingerprints.IsSwipingUpFingerprint
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.util.exception
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
@Patch(
name = "Disable precise seeking gesture",
description = "Adds an option to disable precise seeking when swiping up on the seekbar.",
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.youtube",
@ -46,13 +46,10 @@ object DisablePreciseSeekingGesturePatch : BytecodePatch(
"disableGesture(Landroid/view/VelocityTracker;Landroid/view/MotionEvent;)V"
override fun execute(context: BytecodeContext) {
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
SwitchPreference(
"revanced_disable_precise_seeking_gesture",
StringResource("revanced_disable_precise_seeking_gesture_title", "Disable precise seeking gesture"),
StringResource("revanced_disable_precise_seeking_gesture_summary_on", "Gesture is disabled"),
StringResource("revanced_disable_precise_seeking_gesture_summary_off", "Gesture is enabled"),
)
SwitchPreference("revanced_disable_precise_seeking_gesture")
)
IsSwipingUpFingerprint.result?.let {

View File

@ -1,6 +1,5 @@
package app.revanced.patches.youtube.interaction.seekbar
import app.revanced.util.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
@ -8,12 +7,13 @@ import app.revanced.patcher.patch.BytecodePatch
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.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.interaction.seekbar.fingerprints.OnTouchEventHandlerFingerprint
import app.revanced.patches.youtube.interaction.seekbar.fingerprints.SeekbarTappingFingerprint
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.util.exception
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
@ -22,7 +22,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
name = "Seekbar tapping",
description = "Adds an option to enable tap-to-seek on the seekbar of the video player.",
dependencies = [
IntegrationsPatch::class, SettingsPatch::class],
IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.youtube",
@ -47,14 +47,9 @@ object EnableSeekbarTappingPatch : BytecodePatch(
)
) {
override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
SwitchPreference(
"revanced_seekbar_tapping",
StringResource("revanced_seekbar_tapping_title", "Enable seekbar tapping"),
StringResource("revanced_seekbar_tapping_summary_on", "Seekbar tapping is enabled"),
StringResource("revanced_seekbar_tapping_summary_off", "Seekbar tapping is disabled")
)
)
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(SwitchPreference("revanced_seekbar_tapping"))
// Find the required methods to tap the seekbar.
val seekbarTappingMethods = OnTouchEventHandlerFingerprint.result?.let {

View File

@ -1,24 +1,24 @@
package app.revanced.patches.youtube.interaction.seekbar
import app.revanced.util.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
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.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.interaction.seekbar.fingerprints.DoubleSpeedSeekNoticeFingerprint
import app.revanced.patches.youtube.interaction.seekbar.fingerprints.SlideToSeekFingerprint
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.util.exception
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch(
name = "Enable slide to seek",
description = "Adds an option to enable slide to seek instead of playing at 2x speed when pressing and holding in the video player. Including this patch may cause issues with tapping or double tapping the video player overlay.",
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.youtube",
@ -46,23 +46,9 @@ object EnableSlideToSeekPatch : BytecodePatch(
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/SlideToSeekPatch;"
override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
SwitchPreference(
"revanced_slide_to_seek",
StringResource(
"revanced_slide_to_seek_title",
"Enable slide to seek"
),
StringResource(
"revanced_slide_to_seek_summary_on",
"Slide to seek is enabled"
),
StringResource(
"revanced_slide_to_seek_summary_off",
"Slide to seek is not enabled"
),
)
)
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(SwitchPreference("revanced_slide_to_seek"))
arrayOf(
// Restore the behaviour to slide to seek.

View File

@ -3,92 +3,36 @@ package app.revanced.patches.youtube.interaction.swipecontrols
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.settings.preference.impl.*
import app.revanced.patches.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.InputType
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.shared.misc.settings.preference.TextPreference
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.util.ResourceGroup
import app.revanced.util.copyResources
@Patch(
dependencies = [SettingsPatch::class]
dependencies = [SettingsPatch::class, AddResourcesPatch::class]
)
internal object SwipeControlsResourcePatch : ResourcePatch() {
override fun execute(context: ResourceContext) {
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
PreferenceScreen(
"revanced_swipe_controls_preference_screen",
StringResource("revanced_swipe_controls_preference_screen_title", "Swipe controls"),
listOf(
SwitchPreference(
"revanced_swipe_brightness",
StringResource("revanced_swipe_brightness_title", "Enable brightness gesture"),
StringResource("revanced_swipe_brightness_summary_on", "Brightness swipe is enabled"),
StringResource("revanced_swipe_brightness_summary_off", "Brightness swipe is disabled")
),
SwitchPreference(
"revanced_swipe_volume",
StringResource("revanced_swipe_volume_title", "Enable volume gesture"),
StringResource("revanced_swipe_volume_summary_on", "Volume swipe is enabled"),
StringResource("revanced_swipe_volume_summary_off", "Volume swipe is disabled")
),
SwitchPreference(
"revanced_swipe_press_to_engage",
StringResource("revanced_swipe_press_to_engage_title", "Enable press-to-swipe gesture"),
StringResource("revanced_swipe_press_to_engage_summary_on", "Press-to-swipe is enabled"),
StringResource("revanced_swipe_press_to_engage_summary_off", "Press-to-swipe is disabled")
),
SwitchPreference(
"revanced_swipe_haptic_feedback",
StringResource("revanced_swipe_haptic_feedback_title", "Enable haptic feedback"),
StringResource("revanced_swipe_haptic_feedback_summary_on", "Haptic feedback is enabled"),
StringResource("revanced_swipe_haptic_feedback_summary_off", "Haptic feedback is disabled")
),
SwitchPreference(
"revanced_swipe_save_and_restore_brightness",
StringResource("revanced_swipe_save_and_restore_brightness_title", "Save and restore brightness"),
StringResource(
"revanced_swipe_save_and_restore_brightness_summary_on",
"Save and restore brightness when exiting or entering fullscreen"
),
StringResource(
"revanced_swipe_save_and_restore_brightness_summary_off",
"Do not save and restore brightness when exiting or entering fullscreen"
)
),
TextPreference(
"revanced_swipe_overlay_timeout",
StringResource("revanced_swipe_overlay_timeout_title", "Swipe overlay timeout"),
StringResource(
"revanced_swipe_overlay_timeout_summary",
"The amount of milliseconds the overlay is visible"
),
InputType.NUMBER
),
TextPreference(
"revanced_swipe_text_overlay_size",
StringResource("revanced_swipe_text_overlay_size_title", "Swipe overlay text size"),
StringResource("revanced_swipe_text_overlay_size_summary", "The text size for swipe overlay"),
InputType.NUMBER
),
TextPreference(
"revanced_swipe_overlay_background_alpha",
StringResource("revanced_swipe_overlay_background_alpha_title", "Swipe background visibility"),
StringResource(
"revanced_swipe_overlay_background_alpha_summary",
"The visibility of swipe overlay background"
),
InputType.NUMBER
),
TextPreference(
"revanced_swipe_threshold",
StringResource("revanced_swipe_threshold_title", "Swipe magnitude threshold"),
StringResource(
"revanced_swipe_threshold_summary",
"The amount of threshold for swipe to occur"
),
InputType.NUMBER
)
key = "revanced_swipe_controls_preference_screen",
preferences = setOf(
SwitchPreference("revanced_swipe_brightness"),
SwitchPreference("revanced_swipe_volume"),
SwitchPreference("revanced_swipe_press_to_engage"),
SwitchPreference("revanced_swipe_haptic_feedback"),
SwitchPreference("revanced_swipe_save_and_restore_brightness"),
TextPreference("revanced_swipe_overlay_timeout", inputType = InputType.NUMBER),
TextPreference("revanced_swipe_text_overlay_size", inputType = InputType.NUMBER),
TextPreference("revanced_swipe_overlay_background_alpha", inputType = InputType.NUMBER),
TextPreference("revanced_swipe_threshold", inputType = InputType.NUMBER)
),
StringResource("revanced_swipe_controls_preference_screen_summary","Control volume and brightness")
)
)
@ -96,10 +40,10 @@ internal object SwipeControlsResourcePatch : ResourcePatch() {
"swipecontrols",
ResourceGroup(
"drawable",
"ic_sc_brightness_auto.xml",
"ic_sc_brightness_manual.xml",
"ic_sc_volume_mute.xml",
"ic_sc_volume_normal.xml"
"revanced_ic_sc_brightness_auto.xml",
"revanced_ic_sc_brightness_manual.xml",
"revanced_ic_sc_volume_mute.xml",
"revanced_ic_sc_volume_normal.xml"
)
)
}

View File

@ -1,25 +1,25 @@
package app.revanced.patches.youtube.layout.autocaptions
import app.revanced.util.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.patch.BytecodePatch
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.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.layout.autocaptions.fingerprints.StartVideoInformerFingerprint
import app.revanced.patches.youtube.layout.autocaptions.fingerprints.SubtitleButtonControllerFingerprint
import app.revanced.patches.youtube.layout.autocaptions.fingerprints.SubtitleTrackFingerprint
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.util.exception
@Patch(
name = "Disable auto captions",
description = "Adds an option to disable captions from being automatically enabled.",
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.youtube",
@ -44,14 +44,9 @@ object AutoCaptionsPatch : BytecodePatch(
setOf(StartVideoInformerFingerprint, SubtitleButtonControllerFingerprint, SubtitleTrackFingerprint)
) {
override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_auto_captions",
StringResource("revanced_auto_captions_title", "Disable auto captions"),
StringResource("revanced_auto_captions_summary_on", "Auto captions are disabled"),
StringResource("revanced_auto_captions_summary_off", "Auto captions are enabled")
)
)
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(SwitchPreference("revanced_auto_captions"))
mapOf(
StartVideoInformerFingerprint to 0,

View File

@ -4,10 +4,10 @@ import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
@ -16,7 +16,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
description = "Adds options to hide action buttons (such as the Download button) under videos.",
dependencies = [
ResourceMappingPatch::class,
LithoFilterPatch::class
LithoFilterPatch::class,
AddResourcesPatch::class
],
compatiblePackages = [
CompatiblePackage(
@ -43,73 +44,23 @@ object HideButtonsPatch : ResourcePatch() {
"Lapp/revanced/integrations/youtube/patches/components/ButtonsFilter;"
override fun execute(context: ResourceContext) {
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
PreferenceScreen(
"revanced_hide_buttons_preference_screen",
StringResource("revanced_hide_buttons_preference_screen_title", "Hide action buttons"),
listOf(
SwitchPreference(
"revanced_hide_like_dislike_button",
StringResource("revanced_hide_like_dislike_button_title", "Hide like and dislike buttons"),
StringResource("revanced_hide_like_dislike_button_summary_on", "Like and dislike buttons are hidden"),
StringResource("revanced_hide_like_dislike_button_summary_off", "Like and dislike buttons are shown")
),
SwitchPreference(
"revanced_hide_live_chat_button",
StringResource("revanced_hide_live_chat_button_title", "Hide live chat button"),
StringResource("revanced_hide_live_chat_button_summary_on", "Live chat button is hidden"),
StringResource("revanced_hide_live_chat_button_summary_off", "Live chat button is shown")
),
SwitchPreference(
"revanced_hide_share_button",
StringResource("revanced_hide_share_button_title", "Hide share button"),
StringResource("revanced_hide_share_button_summary_on", "Share button is hidden"),
StringResource("revanced_hide_share_button_summary_off", "Share button is shown")
),
SwitchPreference(
"revanced_hide_report_button",
StringResource("revanced_hide_report_button_title", "Hide report button"),
StringResource("revanced_hide_report_button_summary_on", "Report button is hidden"),
StringResource("revanced_hide_report_button_summary_off", "Report button is shown")
),
SwitchPreference(
"revanced_hide_remix_button",
StringResource("revanced_hide_remix_button_title", "Hide remix button"),
StringResource("revanced_hide_remix_button_summary_on", "Remix button is hidden"),
StringResource("revanced_hide_remix_button_summary_off", "Remix button is shown")
),
SwitchPreference(
"revanced_hide_download_button",
StringResource("revanced_hide_download_button_title", "Hide download button"),
StringResource("revanced_hide_download_button_summary_on", "Download button is hidden"),
StringResource("revanced_hide_download_button_summary_off", "Download button is shown")
),
SwitchPreference(
"revanced_hide_thanks_button",
StringResource("revanced_hide_thanks_button_title", "Hide thanks button"),
StringResource("revanced_hide_thanks_button_summary_on", "Thanks button is hidden"),
StringResource("revanced_hide_thanks_button_summary_off", "Thanks button is shown")
),
SwitchPreference(
"revanced_hide_clip_button",
StringResource("revanced_hide_clip_button_title", "Hide clip button"),
StringResource("revanced_hide_clip_button_summary_on", "Clip button is hidden"),
StringResource("revanced_hide_clip_button_summary_off", "Clip button is shown"),
),
SwitchPreference(
"revanced_hide_playlist_button",
StringResource("revanced_hide_playlist_button_title", "Hide save to playlist button"),
StringResource("revanced_hide_playlist_button_summary_on", "Save button is hidden"),
StringResource("revanced_hide_playlist_button_summary_off", "Save button is shown")
),
SwitchPreference(
"revanced_hide_shop_button",
StringResource("revanced_hide_shop_button_title", "Hide shop button"),
StringResource("revanced_hide_shop_button_summary_on", "Shop button is hidden"),
StringResource("revanced_hide_shop_button_summary_off", "Shop button is shown")
)
preferences = setOf(
SwitchPreference("revanced_hide_like_dislike_button"),
SwitchPreference("revanced_hide_live_chat_button"),
SwitchPreference("revanced_hide_share_button"),
SwitchPreference("revanced_hide_report_button"),
SwitchPreference("revanced_hide_remix_button"),
SwitchPreference("revanced_hide_download_button"),
SwitchPreference("revanced_hide_thanks_button"),
SwitchPreference("revanced_hide_clip_button"),
SwitchPreference("revanced_hide_playlist_button"),
SwitchPreference("revanced_hide_shop_button")
),
StringResource("revanced_hide_buttons_preference_screen_summary", "Hide or show buttons under videos")
)
)

View File

@ -1,7 +1,5 @@
package app.revanced.patches.youtube.layout.buttons.autoplay
import app.revanced.util.exception
import app.revanced.util.findIndexForIdResource
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
@ -9,12 +7,14 @@ import app.revanced.patcher.patch.BytecodePatch
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.mapping.misc.ResourceMappingPatch
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.patches.youtube.shared.fingerprints.LayoutConstructorFingerprint
import app.revanced.util.exception
import app.revanced.util.findIndexForIdResource
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
@ -26,7 +26,8 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
dependencies = [
IntegrationsPatch::class,
SettingsPatch::class,
ResourceMappingPatch::class
ResourceMappingPatch::class,
AddResourcesPatch::class
],
compatiblePackages = [
CompatiblePackage(
@ -52,14 +53,9 @@ object HideAutoplayButtonPatch : BytecodePatch(
setOf(LayoutConstructorFingerprint)
) {
override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_hide_autoplay_button",
StringResource("revanced_hide_autoplay_button_title", "Hide autoplay button"),
StringResource("revanced_hide_autoplay_button_summary_on", "Autoplay button is hidden"),
StringResource("revanced_hide_autoplay_button_summary_off", "Autoplay button is shown")
),
)
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(SwitchPreference("revanced_hide_autoplay_button"))
LayoutConstructorFingerprint.result?.mutableMethod?.apply {
val layoutGenMethodInstructions = implementation!!.instructions

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
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.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.layout.autocaptions.fingerprints.SubtitleButtonControllerFingerprint
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
@ -17,7 +17,8 @@ import com.android.tools.smali.dexlib2.Opcode
description = "Adds an option to hide the captions button in the video player.",
dependencies = [
IntegrationsPatch::class,
SettingsPatch::class
SettingsPatch::class,
AddResourcesPatch::class
],
compatiblePackages = [
CompatiblePackage(
@ -43,14 +44,9 @@ object HideCaptionsButtonPatch : BytecodePatch(
setOf(SubtitleButtonControllerFingerprint)
) {
override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_hide_captions_button",
StringResource("revanced_hide_captions_button_title", "Hide captions button"),
StringResource("revanced_hide_captions_button_summary_on", "Captions button is hidden"),
StringResource("revanced_hide_captions_button_summary_off", "Captions button is shown")
)
)
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(SwitchPreference("revanced_hide_captions_button"))
val subtitleButtonControllerMethod = SubtitleButtonControllerFingerprint.result!!.mutableMethod

View File

@ -6,8 +6,8 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException
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.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
@ -16,7 +16,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
description = "Adds an option to hide the cast button in the video player.",
dependencies = [
IntegrationsPatch::class,
SettingsPatch::class
SettingsPatch::class,
AddResourcesPatch::class
],
compatiblePackages = [
CompatiblePackage("com.google.android.youtube")
@ -24,14 +25,9 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
)
object HideCastButtonPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_hide_cast_button",
StringResource("revanced_hide_cast_button_title", "Hide cast button"),
StringResource("revanced_hide_cast_button_summary_on", "Cast button is hidden"),
StringResource("revanced_hide_cast_button_summary_off", "Cast button is shown")
)
)
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(SwitchPreference("revanced_hide_cast_button"))
val buttonClass = context.findClass("MediaRouteButton")
?: throw PatchException("MediaRouteButton class not found.")

View File

@ -1,20 +1,20 @@
package app.revanced.patches.youtube.layout.buttons.navigation
import app.revanced.util.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.layout.buttons.navigation.fingerprints.*
import app.revanced.patches.youtube.layout.buttons.navigation.utils.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT
import app.revanced.patches.youtube.layout.buttons.navigation.utils.InjectionUtils.injectHook
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.util.exception
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch(
@ -23,7 +23,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
dependencies = [
IntegrationsPatch::class,
SettingsPatch::class,
ResolvePivotBarFingerprintsPatch::class
ResolvePivotBarFingerprintsPatch::class,
AddResourcesPatch::class
],
compatiblePackages = [
CompatiblePackage(
@ -52,58 +53,18 @@ object NavigationButtonsPatch : BytecodePatch(
"Lapp/revanced/integrations/youtube/patches/NavigationButtonsPatch;"
override fun execute(context: BytecodeContext) {
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
PreferenceScreen(
"revanced_navigation_buttons_preference_screen",
StringResource("revanced_navigation_buttons_preference_screen_title", "Navigation buttons"),
listOf(
SwitchPreference(
"revanced_hide_home_button",
StringResource("revanced_hide_home_button_title", "Hide home button"),
StringResource("revanced_hide_home_button_summary_on", "Home button is hidden"),
StringResource("revanced_hide_home_button_summary_off", "Home button is shown")
),
SwitchPreference(
"revanced_hide_shorts_button",
StringResource("revanced_hide_shorts_button_title", "Hide Shorts button"),
StringResource("revanced_hide_shorts_button_summary_on", "Shorts button is hidden"),
StringResource("revanced_hide_shorts_button_summary_off", "Shorts button is shown")
),
SwitchPreference(
"revanced_hide_subscriptions_button",
StringResource("revanced_hide_subscriptions_button_title", "Hide subscriptions button"),
StringResource(
"revanced_hide_subscriptions_button_summary_on",
"Home subscriptions is hidden"
),
StringResource("revanced_hide_subscriptions_button_summary_off", "Home subscriptions is shown")
),
SwitchPreference(
"revanced_hide_create_button",
StringResource("revanced_hide_create_button_title", "Hide create button"),
StringResource("revanced_hide_create_button_summary_on", "Create button is hidden"),
StringResource("revanced_hide_create_button_summary_off", "Create button is shown")
),
SwitchPreference(
"revanced_switch_create_with_notifications_button",
StringResource(
"revanced_switch_create_with_notifications_button_title",
"Switch create with notifications button"
),
StringResource(
"revanced_switch_create_with_notifications_button_summary_on",
"Create button is switched with notifications"
),
StringResource(
"revanced_switch_create_with_notifications_button_summary_off",
"Create button is not switched with notifications"
),
),
key = "revanced_navigation_buttons_preference_screen",
preferences = setOf(
SwitchPreference("revanced_hide_home_button"),
SwitchPreference("revanced_hide_shorts_button"),
SwitchPreference("revanced_hide_subscriptions_button"),
SwitchPreference("revanced_hide_create_button"),
SwitchPreference("revanced_switch_create_with_notifications_button"),
),
StringResource(
"revanced_navigation_buttons_preference_screen_summary",
"Hide or change buttons in the navigation bar"
)
)
)
@ -156,8 +117,8 @@ object NavigationButtonsPatch : BytecodePatch(
AddCreateButtonViewFingerprint.result?.let {
it.mutableMethod.apply {
val stringIndex = it.scanResult.stringsScanResult!!.matches.find {
match -> match.string == ANDROID_AUTOMOTIVE_STRING
val stringIndex = it.scanResult.stringsScanResult!!.matches.find { match ->
match.string == ANDROID_AUTOMOTIVE_STRING
}!!.index
val conditionalCheckIndex = stringIndex - 1

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch
import app.revanced.patches.youtube.layout.buttons.navigation.fingerprints.InitializeButtonsFingerprint
import app.revanced.patches.youtube.layout.buttons.navigation.fingerprints.PivotBarConstructorFingerprint

View File

@ -1,19 +1,19 @@
package app.revanced.patches.youtube.layout.buttons.player.hide
import app.revanced.util.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
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.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.layout.buttons.player.hide.HidePlayerButtonsPatch.ParameterOffsets.HAS_NEXT
import app.revanced.patches.youtube.layout.buttons.player.hide.HidePlayerButtonsPatch.ParameterOffsets.HAS_PREVIOUS
import app.revanced.patches.youtube.layout.buttons.player.hide.fingerprints.PlayerControlsVisibilityModelFingerprint
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.util.exception
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction3rc
@Patch(
@ -21,7 +21,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction3rc
description = "Adds an option to hide the previous and next buttons in the video player.",
dependencies = [
IntegrationsPatch::class,
SettingsPatch::class
SettingsPatch::class,
AddResourcesPatch::class
],
compatiblePackages = [
CompatiblePackage(
@ -47,23 +48,9 @@ object HidePlayerButtonsPatch : BytecodePatch(
setOf(PlayerControlsVisibilityModelFingerprint)
) {
override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_hide_player_buttons",
StringResource(
"revanced_hide_player_buttons_title",
"Hide previous & next video buttons"
),
StringResource(
"revanced_hide_player_buttons_summary_on",
"Buttons are hidden"
),
StringResource(
"revanced_hide_player_buttons_summary_off",
"Buttons are shown"
)
)
)
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(SwitchPreference("revanced_hide_player_buttons"))
PlayerControlsVisibilityModelFingerprint.result?.apply {
val callIndex = scanResult.patternScanResult!!.endIndex

View File

@ -3,29 +3,25 @@ package app.revanced.patches.youtube.layout.hide.albumcards
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.misc.settings.SettingsPatch
@Patch(
dependencies = [
SettingsPatch::class,
ResourceMappingPatch::class
ResourceMappingPatch::class,
AddResourcesPatch::class
],
)
internal object AlbumCardsResourcePatch : ResourcePatch() {
internal var albumCardId: Long = -1
override fun execute(context: ResourceContext) {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_hide_album_cards",
StringResource("revanced_hide_album_cards_title", "Hide album cards"),
StringResource("revanced_hide_album_cards_summary_on", "Album cards are hidden"),
StringResource("revanced_hide_album_cards_summary_off", "Album cards are shown")
)
)
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(SwitchPreference("revanced_hide_album_cards"))
albumCardId = ResourceMappingPatch.resourceMappings.single {
it.type == "layout" && it.name == "album_card"

Some files were not shown because too many files have changed in this diff Show More