feat: Restore previous release

This reverts commit 3938f2f1b3.
This commit is contained in:
oSumAtrIX
2023-08-27 21:41:04 +02:00
parent 392021124c
commit 2adfc37a66
496 changed files with 2425 additions and 2551 deletions
@@ -6,8 +6,6 @@ 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
@@ -26,7 +24,7 @@ import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
class AudioAdsPatch : BytecodePatch(
listOf(AudioAdsPresenterPlayFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {
// Block playAds call
with(AudioAdsPresenterPlayFingerprint.result!!) {
mutableMethod.addInstructionsWithLabels(
@@ -59,7 +57,5 @@ class AudioAdsPatch : BytecodePatch(
default = true,
)
)
return PatchResultSuccess()
}
}
@@ -6,9 +6,7 @@ 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.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.settings.preference.impl.ArrayResource
@@ -28,8 +26,8 @@ import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
class EmbeddedAdsPatch : BytecodePatch(
listOf(CreateUsherClientFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
val result = CreateUsherClientFingerprint.result ?: return PatchResultError("${CreateUsherClientFingerprint.name} not found")
override fun execute(context: BytecodeContext) {
val result = CreateUsherClientFingerprint.result ?: throw PatchException("${CreateUsherClientFingerprint.name} not found")
// Inject OkHttp3 application interceptor
result.mutableMethod.addInstructions(
@@ -70,7 +68,5 @@ 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,14 +1,12 @@
package app.revanced.patches.twitch.ad.video.patch
import app.revanced.extensions.toErrorResult
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.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
@@ -36,7 +34,7 @@ class VideoAdsPatch : AbstractAdPatch(
GetReadyToShowAdFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {
/* Amazon ads SDK */
context.blockMethods(
"Lcom/amazon/ads/video/player/AdsManagerImpl;",
@@ -97,7 +95,7 @@ class VideoAdsPatch : AbstractAdPatch(
""",
ExternalLabel(skipLabelName, mutableMethod.getInstruction(0))
)
} ?: return CheckAdEligibilityLambdaFingerprint.toErrorResult()
} ?: throw CheckAdEligibilityLambdaFingerprint.exception
GetReadyToShowAdFingerprint.result?.apply {
val adFormatDeclined = "Ltv/twitch/android/shared/display/ads/theatre/StreamDisplayAdsPresenter\$Action\$AdFormatDeclined;"
@@ -112,7 +110,7 @@ class VideoAdsPatch : AbstractAdPatch(
""",
ExternalLabel(skipLabelName, mutableMethod.getInstruction(0))
)
} ?: return GetReadyToShowAdFingerprint.toErrorResult()
} ?: throw GetReadyToShowAdFingerprint.exception
// Spoof showAds JSON field
ContentConfigShowAdsFingerprint.result?.apply {
@@ -123,7 +121,7 @@ class VideoAdsPatch : AbstractAdPatch(
return v0
"""
)
} ?: return ContentConfigShowAdsFingerprint.toErrorResult()
} ?: throw ContentConfigShowAdsFingerprint.exception
SettingsPatch.PreferenceScreen.ADS.CLIENT_SIDE.addPreferences(
SwitchPreference(
@@ -143,7 +141,5 @@ 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 org.jf.dexlib2.AccessFlags
import com.android.tools.smali.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.toErrorResult
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
@@ -8,8 +8,6 @@ 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
@@ -41,7 +39,7 @@ class ShowDeletedMessagesPatch : BytecodePatch(
if-eqz $register, :no_spoiler
"""
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {
// Spoiler mode: Force set hasModAccess member to true in constructor
DeletedMessageClickableSpanCtorFingerprint.result?.mutableMethod?.apply {
addInstructionsWithLabels(
@@ -53,11 +51,11 @@ class ShowDeletedMessagesPatch : BytecodePatch(
""",
ExternalLabel("no_spoiler", getInstruction(implementation!!.instructions.lastIndex))
)
} ?: return DeletedMessageClickableSpanCtorFingerprint.toErrorResult()
} ?: throw DeletedMessageClickableSpanCtorFingerprint.exception
// Spoiler mode: Disable setHasModAccess setter
SetHasModAccessFingerprint.result?.mutableMethod?.addInstruction(0, "return-void")
?: return SetHasModAccessFingerprint.toErrorResult()
?: throw SetHasModAccessFingerprint.exception
// Cross-out mode: Reformat span of deleted message
ChatUtilCreateDeletedSpanFingerprint.result?.mutableMethod?.apply {
@@ -71,7 +69,7 @@ class ShowDeletedMessagesPatch : BytecodePatch(
""",
ExternalLabel("no_reformat", getInstruction(0))
)
} ?: return ChatUtilCreateDeletedSpanFingerprint.toErrorResult()
} ?: throw ChatUtilCreateDeletedSpanFingerprint.exception
SettingsPatch.PreferenceScreen.CHAT.GENERAL.addPreferences(
ListPreference(
@@ -101,7 +99,5 @@ class ShowDeletedMessagesPatch : BytecodePatch(
)
SettingsPatch.addString("revanced_deleted_msg", "message deleted")
return PatchResultSuccess()
}
}
@@ -1,14 +1,12 @@
package app.revanced.patches.twitch.chat.autoclaim.patch
import app.revanced.extensions.toErrorResult
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.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
@@ -26,7 +24,7 @@ import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
class AutoClaimChannelPointPatch : BytecodePatch(
listOf(CommunityPointsButtonViewDelegateFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.CHAT.GENERAL.addPreferences(
SwitchPreference(
"revanced_auto_claim_channel_points",
@@ -62,8 +60,6 @@ class AutoClaimChannelPointPatch : BytecodePatch(
""",
ExternalLabel("auto_claim", getInstruction(lastIndex))
)
} ?: return CommunityPointsButtonViewDelegateFingerprint.toErrorResult()
return PatchResultSuccess()
} ?: throw CommunityPointsButtonViewDelegateFingerprint.exception
}
}
@@ -1,13 +1,11 @@
package app.revanced.patches.twitch.debug.patch
import app.revanced.extensions.toErrorResult
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.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
@@ -31,7 +29,7 @@ class DebugModePatch : BytecodePatch(
ShouldShowDebugOptionsFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {
listOf(
IsDebugConfigEnabledFingerprint,
IsOmVerificationEnabledFingerprint,
@@ -46,7 +44,7 @@ class DebugModePatch : BytecodePatch(
return v0
"""
)
} ?: return it.toErrorResult()
} ?: throw it.exception
}
SettingsPatch.PreferenceScreen.MISC.OTHER.addPreferences(
@@ -67,7 +65,5 @@ class DebugModePatch : BytecodePatch(
default = false,
)
)
return PatchResultSuccess()
}
}
@@ -1,8 +0,0 @@
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,11 +1,9 @@
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,11 +3,9 @@ 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.toErrorResult
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
@@ -10,8 +10,6 @@ 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
@@ -26,8 +24,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 org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.immutable.ImmutableField
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.immutable.ImmutableField
import java.io.Closeable
@Patch
@@ -43,7 +41,7 @@ class SettingsPatch : BytecodePatch(
MenuGroupsOnClickFingerprint
)
), Closeable {
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {
// Hook onCreate to handle fragment creation
SettingsActivityOnCreateFingerprint.result?.apply {
val insertIndex = mutableMethod.implementation!!.instructions.size - 2
@@ -57,7 +55,7 @@ class SettingsPatch : BytecodePatch(
""",
ExternalLabel("no_rv_settings_init", mutableMethod.getInstruction(insertIndex))
)
} ?: return SettingsActivityOnCreateFingerprint.toErrorResult()
} ?: throw SettingsActivityOnCreateFingerprint.exception
// Create new menu item for settings menu
SettingsMenuItemEnumFingerprint.result?.apply {
@@ -67,7 +65,7 @@ class SettingsPatch : BytecodePatch(
REVANCED_SETTINGS_MENU_ITEM_TITLE_RES,
REVANCED_SETTINGS_MENU_ITEM_ICON_RES
)
} ?: return SettingsMenuItemEnumFingerprint.toErrorResult()
} ?: throw SettingsMenuItemEnumFingerprint.exception
// Intercept settings menu creation and add new menu item
MenuGroupsUpdatedFingerprint.result?.apply {
@@ -79,7 +77,7 @@ class SettingsPatch : BytecodePatch(
move-result-object p1
"""
)
} ?: return MenuGroupsUpdatedFingerprint.toErrorResult()
} ?: throw MenuGroupsUpdatedFingerprint.exception
// Intercept onclick events for the settings menu
MenuGroupsOnClickFingerprint.result?.apply {
@@ -96,14 +94,12 @@ class SettingsPatch : BytecodePatch(
""",
ExternalLabel("no_rv_settings_onclick", mutableMethod.getInstruction(insertIndex))
)
} ?: return MenuGroupsOnClickFingerprint.toErrorResult()
} ?: throw MenuGroupsOnClickFingerprint.exception
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 org.jf.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.AccessFlags
object MenuGroupsOnClickFingerprint : MethodFingerprint(
"V",