fix: Revert previous release

The previous release depends on a version of ReVanced Patcher which prevents usage of resource patches on lower Android versions. To solve this issue temporarily, until a fix is present, the previous release is reverted.
This commit is contained in:
oSumAtrIX
2023-08-27 04:37:21 +02:00
parent ce2e46a7cb
commit 3938f2f1b3
496 changed files with 2551 additions and 2425 deletions
@@ -6,6 +6,8 @@ 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.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
@@ -24,7 +26,7 @@ import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
class AudioAdsPatch : BytecodePatch(
listOf(AudioAdsPresenterPlayFingerprint)
) {
override fun execute(context: BytecodeContext) {
override fun execute(context: BytecodeContext): PatchResult {
// Block playAds call
with(AudioAdsPresenterPlayFingerprint.result!!) {
mutableMethod.addInstructionsWithLabels(
@@ -57,5 +59,7 @@ class AudioAdsPatch : BytecodePatch(
default = true,
)
)
return PatchResultSuccess()
}
}
@@ -6,7 +6,9 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.settings.preference.impl.ArrayResource
@@ -26,8 +28,8 @@ import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
class EmbeddedAdsPatch : BytecodePatch(
listOf(CreateUsherClientFingerprint)
) {
override fun execute(context: BytecodeContext) {
val result = CreateUsherClientFingerprint.result ?: throw PatchException("${CreateUsherClientFingerprint.name} not found")
override fun execute(context: BytecodeContext): PatchResult {
val result = CreateUsherClientFingerprint.result ?: return PatchResultError("${CreateUsherClientFingerprint.name} not found")
// Inject OkHttp3 application interceptor
result.mutableMethod.addInstructions(
@@ -68,5 +70,7 @@ class EmbeddedAdsPatch : BytecodePatch(
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.")
return PatchResultSuccess()
}
}
@@ -1,12 +1,14 @@
package app.revanced.patches.twitch.ad.video.patch
import app.revanced.extensions.exception
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
@@ -34,7 +36,7 @@ class VideoAdsPatch : AbstractAdPatch(
GetReadyToShowAdFingerprint
)
) {
override fun execute(context: BytecodeContext) {
override fun execute(context: BytecodeContext): PatchResult {
/* Amazon ads SDK */
context.blockMethods(
"Lcom/amazon/ads/video/player/AdsManagerImpl;",
@@ -95,7 +97,7 @@ class VideoAdsPatch : AbstractAdPatch(
""",
ExternalLabel(skipLabelName, mutableMethod.getInstruction(0))
)
} ?: throw CheckAdEligibilityLambdaFingerprint.exception
} ?: return CheckAdEligibilityLambdaFingerprint.toErrorResult()
GetReadyToShowAdFingerprint.result?.apply {
val adFormatDeclined = "Ltv/twitch/android/shared/display/ads/theatre/StreamDisplayAdsPresenter\$Action\$AdFormatDeclined;"
@@ -110,7 +112,7 @@ class VideoAdsPatch : AbstractAdPatch(
""",
ExternalLabel(skipLabelName, mutableMethod.getInstruction(0))
)
} ?: throw GetReadyToShowAdFingerprint.exception
} ?: return GetReadyToShowAdFingerprint.toErrorResult()
// Spoof showAds JSON field
ContentConfigShowAdsFingerprint.result?.apply {
@@ -121,7 +123,7 @@ class VideoAdsPatch : AbstractAdPatch(
return v0
"""
)
} ?: throw ContentConfigShowAdsFingerprint.exception
} ?: return ContentConfigShowAdsFingerprint.toErrorResult()
SettingsPatch.PreferenceScreen.ADS.CLIENT_SIDE.addPreferences(
SwitchPreference(
@@ -141,5 +143,7 @@ class VideoAdsPatch : AbstractAdPatch(
default = true
)
)
return PatchResultSuccess()
}
}
@@ -2,7 +2,7 @@ package app.revanced.patches.twitch.chat.antidelete.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
import org.jf.dexlib2.AccessFlags
object DeletedMessageClickableSpanCtorFingerprint : MethodFingerprint(
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
@@ -1,6 +1,6 @@
package app.revanced.patches.twitch.chat.antidelete.patch
import app.revanced.extensions.exception
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
@@ -8,6 +8,8 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
@@ -39,7 +41,7 @@ class ShowDeletedMessagesPatch : BytecodePatch(
if-eqz $register, :no_spoiler
"""
override fun execute(context: BytecodeContext) {
override fun execute(context: BytecodeContext): PatchResult {
// Spoiler mode: Force set hasModAccess member to true in constructor
DeletedMessageClickableSpanCtorFingerprint.result?.mutableMethod?.apply {
addInstructionsWithLabels(
@@ -51,11 +53,11 @@ class ShowDeletedMessagesPatch : BytecodePatch(
""",
ExternalLabel("no_spoiler", getInstruction(implementation!!.instructions.lastIndex))
)
} ?: throw DeletedMessageClickableSpanCtorFingerprint.exception
} ?: return DeletedMessageClickableSpanCtorFingerprint.toErrorResult()
// Spoiler mode: Disable setHasModAccess setter
SetHasModAccessFingerprint.result?.mutableMethod?.addInstruction(0, "return-void")
?: throw SetHasModAccessFingerprint.exception
?: return SetHasModAccessFingerprint.toErrorResult()
// Cross-out mode: Reformat span of deleted message
ChatUtilCreateDeletedSpanFingerprint.result?.mutableMethod?.apply {
@@ -69,7 +71,7 @@ class ShowDeletedMessagesPatch : BytecodePatch(
""",
ExternalLabel("no_reformat", getInstruction(0))
)
} ?: throw ChatUtilCreateDeletedSpanFingerprint.exception
} ?: return ChatUtilCreateDeletedSpanFingerprint.toErrorResult()
SettingsPatch.PreferenceScreen.CHAT.GENERAL.addPreferences(
ListPreference(
@@ -99,5 +101,7 @@ class ShowDeletedMessagesPatch : BytecodePatch(
)
SettingsPatch.addString("revanced_deleted_msg", "message deleted")
return PatchResultSuccess()
}
}
@@ -1,12 +1,14 @@
package app.revanced.patches.twitch.chat.autoclaim.patch
import app.revanced.extensions.exception
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
@@ -24,7 +26,7 @@ import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
class AutoClaimChannelPointPatch : BytecodePatch(
listOf(CommunityPointsButtonViewDelegateFingerprint)
) {
override fun execute(context: BytecodeContext) {
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.CHAT.GENERAL.addPreferences(
SwitchPreference(
"revanced_auto_claim_channel_points",
@@ -60,6 +62,8 @@ class AutoClaimChannelPointPatch : BytecodePatch(
""",
ExternalLabel("auto_claim", getInstruction(lastIndex))
)
} ?: throw CommunityPointsButtonViewDelegateFingerprint.exception
} ?: return CommunityPointsButtonViewDelegateFingerprint.toErrorResult()
return PatchResultSuccess()
}
}
@@ -1,11 +1,13 @@
package app.revanced.patches.twitch.debug.patch
import app.revanced.extensions.exception
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.settings.preference.impl.StringResource
@@ -29,7 +31,7 @@ class DebugModePatch : BytecodePatch(
ShouldShowDebugOptionsFingerprint
)
) {
override fun execute(context: BytecodeContext) {
override fun execute(context: BytecodeContext): PatchResult {
listOf(
IsDebugConfigEnabledFingerprint,
IsOmVerificationEnabledFingerprint,
@@ -44,7 +46,7 @@ class DebugModePatch : BytecodePatch(
return v0
"""
)
} ?: throw it.exception
} ?: return it.toErrorResult()
}
SettingsPatch.PreferenceScreen.MISC.OTHER.addPreferences(
@@ -65,5 +67,7 @@ class DebugModePatch : BytecodePatch(
default = false,
)
)
return PatchResultSuccess()
}
}
@@ -0,0 +1,8 @@
package app.revanced.patches.twitch.misc.integrations.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("tv.twitch.android.app")])
@Target(AnnotationTarget.CLASS)
internal annotation class IntegrationsCompatibility
@@ -1,9 +1,11 @@
package app.revanced.patches.twitch.misc.integrations.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patches.twitch.misc.integrations.annotations.IntegrationsCompatibility
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
@Name("Init fingerprint")
@IntegrationsCompatibility
object InitFingerprint : IntegrationsFingerprint(
customFingerprint = { methodDef, _ ->
methodDef.definingClass.endsWith("/TwitchApplication;") &&
@@ -3,9 +3,11 @@ package app.revanced.patches.twitch.misc.integrations.patch
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.patch.annotations.RequiresIntegrations
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch
import app.revanced.patches.twitch.misc.integrations.annotations.IntegrationsCompatibility
import app.revanced.patches.twitch.misc.integrations.fingerprints.InitFingerprint
@Name("Integrations")
@IntegrationsCompatibility
@RequiresIntegrations
class IntegrationsPatch : AbstractIntegrationsPatch(
"Lapp/revanced/twitch/utils/ReVancedUtils;",
@@ -1,6 +1,6 @@
package app.revanced.patches.twitch.misc.settings.bytecode.patch
import app.revanced.extensions.exception
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
@@ -10,6 +10,8 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
@@ -24,8 +26,8 @@ import app.revanced.patches.twitch.misc.settings.fingerprints.MenuGroupsUpdatedF
import app.revanced.patches.twitch.misc.settings.fingerprints.SettingsActivityOnCreateFingerprint
import app.revanced.patches.twitch.misc.settings.fingerprints.SettingsMenuItemEnumFingerprint
import app.revanced.patches.twitch.misc.settings.resource.patch.SettingsResourcePatch
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.immutable.ImmutableField
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.immutable.ImmutableField
import java.io.Closeable
@Patch
@@ -41,7 +43,7 @@ class SettingsPatch : BytecodePatch(
MenuGroupsOnClickFingerprint
)
), Closeable {
override fun execute(context: BytecodeContext) {
override fun execute(context: BytecodeContext): PatchResult {
// Hook onCreate to handle fragment creation
SettingsActivityOnCreateFingerprint.result?.apply {
val insertIndex = mutableMethod.implementation!!.instructions.size - 2
@@ -55,7 +57,7 @@ class SettingsPatch : BytecodePatch(
""",
ExternalLabel("no_rv_settings_init", mutableMethod.getInstruction(insertIndex))
)
} ?: throw SettingsActivityOnCreateFingerprint.exception
} ?: return SettingsActivityOnCreateFingerprint.toErrorResult()
// Create new menu item for settings menu
SettingsMenuItemEnumFingerprint.result?.apply {
@@ -65,7 +67,7 @@ class SettingsPatch : BytecodePatch(
REVANCED_SETTINGS_MENU_ITEM_TITLE_RES,
REVANCED_SETTINGS_MENU_ITEM_ICON_RES
)
} ?: throw SettingsMenuItemEnumFingerprint.exception
} ?: return SettingsMenuItemEnumFingerprint.toErrorResult()
// Intercept settings menu creation and add new menu item
MenuGroupsUpdatedFingerprint.result?.apply {
@@ -77,7 +79,7 @@ class SettingsPatch : BytecodePatch(
move-result-object p1
"""
)
} ?: throw MenuGroupsUpdatedFingerprint.exception
} ?: return MenuGroupsUpdatedFingerprint.toErrorResult()
// Intercept onclick events for the settings menu
MenuGroupsOnClickFingerprint.result?.apply {
@@ -94,12 +96,14 @@ class SettingsPatch : BytecodePatch(
""",
ExternalLabel("no_rv_settings_onclick", mutableMethod.getInstruction(insertIndex))
)
} ?: throw MenuGroupsOnClickFingerprint.exception
} ?: return MenuGroupsOnClickFingerprint.toErrorResult()
addString("revanced_settings", "ReVanced Settings", false)
addString("revanced_reboot_message", "Twitch needs to restart to apply your changes. Restart now?", false)
addString("revanced_reboot", "Restart", false)
addString("revanced_cancel", "Cancel", false)
return PatchResultSuccess()
}
internal companion object {
@@ -2,7 +2,7 @@ package app.revanced.patches.twitch.misc.settings.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
import org.jf.dexlib2.AccessFlags
object MenuGroupsOnClickFingerprint : MethodFingerprint(
"V",