From 2a2897dc9e81799a3318875122fc7b49692e3764 Mon Sep 17 00:00:00 2001 From: johnconner122 <107796137+johnconner122@users.noreply.github.com> Date: Sat, 1 Jul 2023 19:44:45 +0500 Subject: [PATCH] fix(trakt): bump compatibility to newer version (#2554) --- .../patches/trakt/fingerprints/IsVIPEPFingerprint.kt | 2 +- .../patches/trakt/fingerprints/IsVIPFingerprint.kt | 2 +- ...SettingsFingerprint.kt => RemoteUserFingerprint.kt} | 4 ++-- .../app/revanced/patches/trakt/patch/UnlockProPatch.kt | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) rename src/main/kotlin/app/revanced/patches/trakt/fingerprints/{RealmUserSettingsFingerprint.kt => RemoteUserFingerprint.kt} (58%) diff --git a/src/main/kotlin/app/revanced/patches/trakt/fingerprints/IsVIPEPFingerprint.kt b/src/main/kotlin/app/revanced/patches/trakt/fingerprints/IsVIPEPFingerprint.kt index f62cfe5fc..e596a52d2 100644 --- a/src/main/kotlin/app/revanced/patches/trakt/fingerprints/IsVIPEPFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/trakt/fingerprints/IsVIPEPFingerprint.kt @@ -4,7 +4,7 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint object IsVIPEPFingerprint : MethodFingerprint( customFingerprint = custom@{ methodDef, _ -> - if (!methodDef.definingClass.endsWith("RealmUserSettings;")) return@custom false + if (!methodDef.definingClass.endsWith("RemoteUser;")) return@custom false methodDef.name == "isVIPEP" } diff --git a/src/main/kotlin/app/revanced/patches/trakt/fingerprints/IsVIPFingerprint.kt b/src/main/kotlin/app/revanced/patches/trakt/fingerprints/IsVIPFingerprint.kt index eb678d260..bf5c9feb1 100644 --- a/src/main/kotlin/app/revanced/patches/trakt/fingerprints/IsVIPFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/trakt/fingerprints/IsVIPFingerprint.kt @@ -4,7 +4,7 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint object IsVIPFingerprint : MethodFingerprint( customFingerprint = custom@{ methodDef, _ -> - if (!methodDef.definingClass.endsWith("RealmUserSettings;")) return@custom false + if (!methodDef.definingClass.endsWith("RemoteUser;")) return@custom false methodDef.name == "isVIP" } diff --git a/src/main/kotlin/app/revanced/patches/trakt/fingerprints/RealmUserSettingsFingerprint.kt b/src/main/kotlin/app/revanced/patches/trakt/fingerprints/RemoteUserFingerprint.kt similarity index 58% rename from src/main/kotlin/app/revanced/patches/trakt/fingerprints/RealmUserSettingsFingerprint.kt rename to src/main/kotlin/app/revanced/patches/trakt/fingerprints/RemoteUserFingerprint.kt index dd8c8198e..0d072b7e9 100644 --- a/src/main/kotlin/app/revanced/patches/trakt/fingerprints/RealmUserSettingsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/trakt/fingerprints/RemoteUserFingerprint.kt @@ -2,8 +2,8 @@ package app.revanced.patches.trakt.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -object RealmUserSettingsFingerprint : MethodFingerprint( +object RemoteUserFingerprint : MethodFingerprint( customFingerprint = { methodDef, _ -> - methodDef.definingClass.endsWith("RealmUserSettings;") + methodDef.definingClass.endsWith("RemoteUser;") } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/trakt/patch/UnlockProPatch.kt b/src/main/kotlin/app/revanced/patches/trakt/patch/UnlockProPatch.kt index 1e6fdbb34..ea363e276 100644 --- a/src/main/kotlin/app/revanced/patches/trakt/patch/UnlockProPatch.kt +++ b/src/main/kotlin/app/revanced/patches/trakt/patch/UnlockProPatch.kt @@ -14,7 +14,7 @@ import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.trakt.annotations.UnlockProCompatibility import app.revanced.patches.trakt.fingerprints.IsVIPEPFingerprint import app.revanced.patches.trakt.fingerprints.IsVIPFingerprint -import app.revanced.patches.trakt.fingerprints.RealmUserSettingsFingerprint +import app.revanced.patches.trakt.fingerprints.RemoteUserFingerprint @Patch @Name("unlock-pro") @@ -22,20 +22,20 @@ import app.revanced.patches.trakt.fingerprints.RealmUserSettingsFingerprint @UnlockProCompatibility @Version("0.0.1") class UnlockProPatch : BytecodePatch( - listOf(RealmUserSettingsFingerprint) + listOf(RemoteUserFingerprint) ) { override fun execute(context: BytecodeContext): PatchResult { - RealmUserSettingsFingerprint.result?.classDef?.let { realUserSettingsClass -> + RemoteUserFingerprint.result?.classDef?.let { remoteUserClass -> arrayOf(IsVIPFingerprint, IsVIPEPFingerprint).onEach { fingerprint -> // Resolve both fingerprints on the same class. - if (!fingerprint.resolve(context, realUserSettingsClass)) + if (!fingerprint.resolve(context, remoteUserClass)) throw fingerprint.toErrorResult() }.forEach { fingerprint -> // Return true for both VIP check methods. fingerprint.result?.mutableMethod?.addInstructions(0, RETURN_TRUE_INSTRUCTIONS) ?: return fingerprint.toErrorResult() } - } ?: return RealmUserSettingsFingerprint.toErrorResult() + } ?: return RemoteUserFingerprint.toErrorResult() return PatchResultSuccess() }