mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-17 08:13:56 +00:00
Compare commits
11 Commits
v2.141.0
...
v2.143.0-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a767f77b72 | ||
|
|
3dc88e2578 | ||
|
|
2df07cad36 | ||
|
|
943221173e | ||
|
|
6ff3f3c974 | ||
|
|
e4c2bb9d39 | ||
|
|
67e2e00cdc | ||
|
|
170c5daa33 | ||
|
|
ce1099cd9c | ||
|
|
9af1fef0b7 | ||
|
|
a421da53f3 |
24
.github/workflows/pull_request.yml
vendored
Normal file
24
.github/workflows/pull_request.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
name: PR to main
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
MESSAGE: merge branch \`${{ github.head_ref || github.ref_name }}\` to \`main\`
|
||||
|
||||
jobs:
|
||||
pull-request:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Open pull request
|
||||
uses: repo-sync/pull-request@v2
|
||||
with:
|
||||
destination_branch: 'main'
|
||||
pr_title: 'chore: ${{ env.MESSAGE }}'
|
||||
pr_body: 'This pull request will ${{ env.MESSAGE }}.'
|
||||
pr_draft: true
|
||||
21
.github/workflows/release.yml
vendored
21
.github/workflows/release.yml
vendored
@@ -12,7 +12,7 @@ on:
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
@@ -22,18 +22,25 @@ jobs:
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
distribution: 'zulu'
|
||||
cache: gradle
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 'latest'
|
||||
cache: 'npm'
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v2
|
||||
uses: amyu/setup-android@v2
|
||||
with:
|
||||
cache-disabled: false
|
||||
sdk-version: '33'
|
||||
build-tools-version: '33.0.1'
|
||||
- name: Build with Gradle
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: ./gradlew build clean generateMeta
|
||||
- name: Install Android build-tools
|
||||
run: sdkmanager "build-tools;32.0.0"
|
||||
run: ./gradlew build generateMeta --no-daemon
|
||||
- name: Setup semantic-release
|
||||
run: npm install -g semantic-release @semantic-release/git @semantic-release/changelog gradle-semantic-release-plugin -D
|
||||
run: npm install semantic-release @saithodev/semantic-release-backmerge @semantic-release/git @semantic-release/changelog gradle-semantic-release-plugin -D
|
||||
- name: Release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -118,3 +118,6 @@ gradle-app.setting
|
||||
|
||||
# Ignore vscode config
|
||||
.vscode/
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
@@ -38,6 +38,12 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
"@saithodev/semantic-release-backmerge",
|
||||
{
|
||||
"branches": ["dev"]
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
|
||||
15
CHANGELOG.md
15
CHANGELOG.md
@@ -1,3 +1,18 @@
|
||||
# [2.143.0-dev.1](https://github.com/revanced/revanced-patches/compare/v2.142.0...v2.143.0-dev.1) (2022-12-13)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **sleepasandroid:** remove `unlock-premium` patch ([#1253](https://github.com/revanced/revanced-patches/issues/1253)) ([414f503](https://github.com/revanced/revanced-patches/commit/414f503e493f2dc27edf134f5db723da77636d81))
|
||||
|
||||
# [2.142.0](https://github.com/revanced/revanced-patches/compare/v2.141.0...v2.142.0) (2022-12-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* `predictive-back-gesture` patch ([#1236](https://github.com/revanced/revanced-patches/issues/1236)) ([11b59f7](https://github.com/revanced/revanced-patches/commit/11b59f767c94514d49a84593618ff9d2aace2636))
|
||||
* **twitch/block-embedded-ads:** `block-embedded-ads` patch ([#1166](https://github.com/revanced/revanced-patches/issues/1166)) ([018606e](https://github.com/revanced/revanced-patches/commit/018606e9832c43836b6b8f4fbd623adb8876d162))
|
||||
|
||||
# [2.141.0](https://github.com/revanced/revanced-patches/compare/v2.140.0...v2.141.0) (2022-12-09)
|
||||
|
||||
|
||||
|
||||
45
README.md
45
README.md
@@ -113,6 +113,7 @@ The official Patch bundle provided by ReVanced and the community.
|
||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||
|:--------:|:--------------:|:-----------------:|
|
||||
| `block-audio-ads` | Blocks audio ads in streams and VODs. | all |
|
||||
| `block-embedded-ads` | Blocks embedded steam ads using services like TTV.lol or PurpleAdBlocker. | all |
|
||||
| `block-video-ads` | Blocks video ads in streams and VODs. | all |
|
||||
| `debug-mode` | Enables Twitch's internal debugging mode. | all |
|
||||
| `settings` | Adds settings menu to Twitch. | all |
|
||||
@@ -196,15 +197,7 @@ The official Patch bundle provided by ReVanced and the community.
|
||||
| `promo-code-unlock` | Disables the validation of promo code. Any code will work to unlock all features. | all |
|
||||
</details>
|
||||
|
||||
### 📦 `com.urbandroid.sleep`
|
||||
<details>
|
||||
|
||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||
|:--------:|:--------------:|:-----------------:|
|
||||
| `unlock-premium` | Unlocks all premium features. | all |
|
||||
</details>
|
||||
|
||||
### 📦 `ginlemon.iconpackstudio`
|
||||
### 📦 `com.awedea.nyx`
|
||||
<details>
|
||||
|
||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||
@@ -212,22 +205,6 @@ The official Patch bundle provided by ReVanced and the community.
|
||||
| `unlock-pro` | Unlocks all pro features. | all |
|
||||
</details>
|
||||
|
||||
### 📦 `com.ithebk.expensemanager`
|
||||
<details>
|
||||
|
||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||
|:--------:|:--------------:|:-----------------:|
|
||||
| `unlock-pro` | Unlocks pro features. | all |
|
||||
</details>
|
||||
|
||||
### 📦 `org.totschnig.myexpenses`
|
||||
<details>
|
||||
|
||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||
|:--------:|:--------------:|:-----------------:|
|
||||
| `unlock-pro` | Unlocks all professional features. | all |
|
||||
</details>
|
||||
|
||||
### 📦 `co.windyapp.android`
|
||||
<details>
|
||||
|
||||
@@ -236,7 +213,23 @@ The official Patch bundle provided by ReVanced and the community.
|
||||
| `unlock-pro` | Unlocks all pro features. | all |
|
||||
</details>
|
||||
|
||||
### 📦 `com.awedea.nyx`
|
||||
### 📦 `org.totschnig.myexpenses`
|
||||
<details>
|
||||
|
||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||
|:--------:|:--------------:|:-----------------:|
|
||||
| `unlock-pro` | Unlocks all professional features. | all |
|
||||
</details>
|
||||
|
||||
### 📦 `com.ithebk.expensemanager`
|
||||
<details>
|
||||
|
||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||
|:--------:|:--------------:|:-----------------:|
|
||||
| `unlock-pro` | Unlocks pro features. | all |
|
||||
</details>
|
||||
|
||||
### 📦 `ginlemon.iconpackstudio`
|
||||
<details>
|
||||
|
||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||
|
||||
@@ -20,7 +20,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("app.revanced:revanced-patcher:6.3.0")
|
||||
implementation("app.revanced:revanced-patcher:6.3.1")
|
||||
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
||||
// Required for meta
|
||||
implementation("com.google.code.gson:gson:2.10")
|
||||
@@ -33,7 +33,7 @@ tasks {
|
||||
|
||||
doLast {
|
||||
val androidHome = System.getenv("ANDROID_HOME") ?: throw GradleException("ANDROID_HOME not found")
|
||||
val d8 = "${androidHome}/build-tools/32.0.0/d8"
|
||||
val d8 = "${androidHome}/build-tools/33.0.1/d8"
|
||||
val input = configurations.archives.get().allArtifacts.files.files.first().absolutePath
|
||||
val work = File("${buildDir}/libs")
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
kotlin.code.style = official
|
||||
version = 2.141.0
|
||||
version = 2.143.0-dev.1
|
||||
|
||||
6107
package-lock.json
generated
Normal file
6107
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
8
package.json
Normal file
8
package.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"@semantic-release/changelog": "^6.0.2",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"gradle-semantic-release-plugin": "^1.7.4",
|
||||
"semantic-release": "^19.0.5"
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,6 +1,5 @@
|
||||
package app.revanced.extensions
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
@@ -28,19 +27,6 @@ fun MutableClass.findMutableMethodOf(method: Method) = this.methods.first {
|
||||
MethodUtil.methodSignaturesMatch(it, method)
|
||||
}
|
||||
|
||||
/**
|
||||
* traverse the class hierarchy starting from the given root class
|
||||
*
|
||||
* @param targetClass the class to start traversing the class hierarchy from
|
||||
* @param callback function that is called for every class in the hierarchy
|
||||
*/
|
||||
fun BytecodeContext.traverseClassHierarchy(targetClass: MutableClass, callback: MutableClass.() -> Unit) {
|
||||
callback(targetClass)
|
||||
this.findClass(targetClass.superclass ?: return)?.mutableClass?.let {
|
||||
traverseClassHierarchy(it, callback)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* apply a transform to all methods of the class
|
||||
*
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package app.revanced.patches.all.interaction.gestures.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
|
||||
@Patch
|
||||
@Name("predictive-back-gesture")
|
||||
@Description("Enables the predictive back gesture introduced on Android 13.")
|
||||
@Version("0.0.1")
|
||||
class PredictiveBackGesturePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
context.xmlEditor["AndroidManifest.xml"].use { editor ->
|
||||
val document = editor.file
|
||||
|
||||
with(document.getElementsByTagName("application").item(0)) {
|
||||
attributes.getNamedItem(FLAG)?.let {
|
||||
document.createAttribute(FLAG)
|
||||
.apply { value = "true" }
|
||||
.let(attributes::setNamedItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val FLAG = "android:enableOnBackInvokedCallback"
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ internal data class ArrayResource(
|
||||
resourceCallback?.invoke(item)
|
||||
|
||||
this.appendChild(ownerDocument.createElement("item").also { itemNode ->
|
||||
itemNode.textContent = item.value
|
||||
itemNode.textContent = "@string/${item.name}"
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ abstract class AbstractSettingsResourcePatch(
|
||||
* @param arrayResource The array resource to add.
|
||||
*/
|
||||
fun addArray(arrayResource: ArrayResource) =
|
||||
arraysNode!!.addResource(arrayResource)
|
||||
arraysNode!!.addResource(arrayResource) { it.include() }
|
||||
|
||||
/**
|
||||
* Add a preference to the settings.
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.sleepasandroid.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
||||
object IsTrialFingerprint : MethodFingerprint(
|
||||
"Z",
|
||||
customFingerprint = { it.name == "isTrial" }
|
||||
)
|
||||
@@ -1,36 +0,0 @@
|
||||
package app.revanced.patches.sleepasandroid.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.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.Patch
|
||||
import app.revanced.patches.sleepasandroid.annotations.UnlockPremiumCompatibility
|
||||
import app.revanced.patches.sleepasandroid.fingerprints.IsTrialFingerprint
|
||||
|
||||
@Patch
|
||||
@Name("unlock-premium")
|
||||
@Description("Unlocks all premium features.")
|
||||
@UnlockPremiumCompatibility
|
||||
class UnlockPremiumPatch : BytecodePatch(
|
||||
listOf(
|
||||
IsTrialFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
val method = IsTrialFingerprint.result!!.mutableMethod
|
||||
|
||||
method.addInstructions(
|
||||
0,
|
||||
"""
|
||||
const/4 v0, 0x0
|
||||
return v0
|
||||
"""
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
package app.revanced.patches.sleepasandroid.annotations
|
||||
package app.revanced.patches.twitch.ad.embedded.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.urbandroid.sleep")])
|
||||
@Compatibility([Package("tv.twitch.android.app")])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
internal annotation class UnlockPremiumCompatibility
|
||||
internal annotation class EmbeddedAdsCompatibility
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package app.revanced.patches.twitch.ad.embedded.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
||||
object CreateUsherClientFingerprint : MethodFingerprint(
|
||||
customFingerprint = { method ->
|
||||
method.definingClass.endsWith("Ltv/twitch/android/network/OkHttpClientFactory;") && method.name == "buildOkHttpClient"
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,78 @@
|
||||
package app.revanced.patches.twitch.ad.embedded.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
|
||||
import app.revanced.patcher.extensions.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.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.ArrayResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.ListPreference
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.twitch.ad.embedded.annotations.EmbeddedAdsCompatibility
|
||||
import app.revanced.patches.twitch.ad.embedded.fingerprints.CreateUsherClientFingerprint
|
||||
import app.revanced.patches.twitch.ad.video.patch.VideoAdsPatch
|
||||
import app.revanced.patches.twitch.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
|
||||
|
||||
@Patch
|
||||
@DependsOn([VideoAdsPatch::class, IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("block-embedded-ads")
|
||||
@Description("Blocks embedded steam ads using services like TTV.lol or PurpleAdBlocker.")
|
||||
@EmbeddedAdsCompatibility
|
||||
@Version("0.0.1")
|
||||
class EmbeddedAdsPatch : BytecodePatch(
|
||||
listOf(CreateUsherClientFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
val result = CreateUsherClientFingerprint.result ?: return PatchResultError("${CreateUsherClientFingerprint.name} not found")
|
||||
|
||||
// Inject OkHttp3 application interceptor
|
||||
result.mutableMethod.addInstructions(
|
||||
3,
|
||||
"""
|
||||
invoke-static {}, Lapp/revanced/twitch/patches/EmbeddedAdsPatch;->createRequestInterceptor()Lapp/revanced/twitch/api/RequestInterceptor;
|
||||
move-result-object v2
|
||||
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_ttv_lol", "TTV LOL proxy"),
|
||||
StringResource("revanced_proxy_purpleadblock", "PurpleAdBlock proxy"),
|
||||
)
|
||||
),
|
||||
ArrayResource(
|
||||
"revanced_hls_proxies_values",
|
||||
listOf(
|
||||
StringResource("key_revanced_proxy_disabled", "disabled"),
|
||||
StringResource("key_revanced_proxy_ttv_lol", "ttv-lol"),
|
||||
StringResource("key_revanced_proxy_purpleadblock", "purpleadblock")
|
||||
)
|
||||
),
|
||||
"ttv-lol"
|
||||
)
|
||||
)
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package app.revanced.patches.twitch.ad.shared.util
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
|
||||
abstract class AbstractAdPatch(
|
||||
val conditionCall: String,
|
||||
val skipLabelName: String,
|
||||
internal val fingerprints: Iterable<MethodFingerprint>? = null,
|
||||
) : BytecodePatch(fingerprints) {
|
||||
|
||||
protected fun createConditionInstructions(register: String = "v0") = """
|
||||
invoke-static { }, $conditionCall
|
||||
move-result $register
|
||||
if-eqz $register, :$skipLabelName
|
||||
"""
|
||||
|
||||
protected data class ReturnMethod(val returnType: Char = 'V', val value: String = "")
|
||||
|
||||
protected fun BytecodeContext.blockMethods(clazz: String, vararg methodNames: String, returnMethod: ReturnMethod = ReturnMethod()): Boolean {
|
||||
|
||||
return with(findClass(clazz)?.mutableClass) {
|
||||
this ?: return false
|
||||
|
||||
this.methods.filter { methodNames.contains(it.name) }.forEach {
|
||||
val retIntructions = when(returnMethod.returnType) {
|
||||
'V' -> "return-void"
|
||||
'Z' -> """
|
||||
const/4 v0, ${returnMethod.value}
|
||||
return v0
|
||||
"""
|
||||
else -> throw NotImplementedError()
|
||||
}
|
||||
it.addInstructions(
|
||||
0,
|
||||
"""
|
||||
${createConditionInstructions("v0")}
|
||||
$retIntructions
|
||||
""",
|
||||
listOf(ExternalLabel(skipLabelName, it.instruction(0)))
|
||||
)
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
package app.revanced.patches.twitch.ad.video.fingerprints
|
||||
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
||||
object AdsManagerFingerprint : MethodFingerprint(
|
||||
object GetReadyToShowAdFingerprint : MethodFingerprint(
|
||||
customFingerprint = { method ->
|
||||
method.definingClass.endsWith("AdsManagerImpl;") && method.name == "playAds"
|
||||
method.definingClass.endsWith("/StreamDisplayAdsPresenter;") && method.name == "getReadyToShowAdOrAbort"
|
||||
}
|
||||
)
|
||||
@@ -6,7 +6,6 @@ import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
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
|
||||
@@ -14,10 +13,11 @@ import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.twitch.ad.shared.util.AbstractAdPatch
|
||||
import app.revanced.patches.twitch.ad.video.annotations.VideoAdsCompatibility
|
||||
import app.revanced.patches.twitch.ad.video.fingerprints.AdsManagerFingerprint
|
||||
import app.revanced.patches.twitch.ad.video.fingerprints.CheckAdEligibilityLambdaFingerprint
|
||||
import app.revanced.patches.twitch.ad.video.fingerprints.ContentConfigShowAdsFingerprint
|
||||
import app.revanced.patches.twitch.ad.video.fingerprints.GetReadyToShowAdFingerprint
|
||||
import app.revanced.patches.twitch.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
|
||||
|
||||
@@ -27,20 +27,63 @@ import app.revanced.patches.twitch.misc.settings.bytecode.patch.SettingsPatch
|
||||
@Description("Blocks video ads in streams and VODs.")
|
||||
@VideoAdsCompatibility
|
||||
@Version("0.0.1")
|
||||
class VideoAdsPatch : BytecodePatch(
|
||||
class VideoAdsPatch : AbstractAdPatch(
|
||||
"Lapp/revanced/twitch/patches/VideoAdsPatch;->shouldBlockVideoAds()Z",
|
||||
"show_video_ads",
|
||||
listOf(
|
||||
ContentConfigShowAdsFingerprint,
|
||||
AdsManagerFingerprint,
|
||||
CheckAdEligibilityLambdaFingerprint
|
||||
CheckAdEligibilityLambdaFingerprint,
|
||||
GetReadyToShowAdFingerprint
|
||||
)
|
||||
) {
|
||||
private fun createConditionInstructions(register: String = "v0") = """
|
||||
invoke-static { }, Lapp/revanced/twitch/patches/VideoAdsPatch;->shouldBlockVideoAds()Z
|
||||
move-result $register
|
||||
if-eqz $register, :show_video_ads
|
||||
"""
|
||||
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
/* Amazon ads SDK */
|
||||
context.blockMethods(
|
||||
"Lcom/amazon/ads/video/player/AdsManagerImpl;",
|
||||
"playAds"
|
||||
)
|
||||
|
||||
/* Twitch ads manager */
|
||||
context.blockMethods(
|
||||
"Ltv/twitch/android/shared/ads/VideoAdManager;",
|
||||
"checkAdEligibilityAndRequestAd", "requestAd", "requestAds"
|
||||
)
|
||||
|
||||
/* Various ad presenters */
|
||||
context.blockMethods(
|
||||
"Ltv/twitch/android/shared/ads/AdsPlayerPresenter;",
|
||||
"requestAd", "requestFirstAd", "requestFirstAdIfEligible", "requestMidroll", "requestAdFromMultiAdFormatEvent"
|
||||
)
|
||||
|
||||
context.blockMethods(
|
||||
"Ltv/twitch/android/shared/ads/AdsVodPlayerPresenter;",
|
||||
"requestAd", "requestFirstAd",
|
||||
)
|
||||
|
||||
context.blockMethods(
|
||||
"Ltv/twitch/android/feature/theatre/ads/AdEdgeAllocationPresenter;",
|
||||
"parseAdAndCheckEligibility", "requestAdsAfterEligibilityCheck", "showAd", "bindMultiAdFormatAllocation"
|
||||
)
|
||||
|
||||
/* A/B ad testing experiments */
|
||||
context.blockMethods(
|
||||
"Ltv/twitch/android/provider/experiments/helpers/DisplayAdsExperimentHelper;",
|
||||
"areDisplayAdsEnabled",
|
||||
returnMethod = ReturnMethod('Z', "0")
|
||||
)
|
||||
|
||||
context.blockMethods(
|
||||
"Ltv/twitch/android/shared/ads/tracking/MultiFormatAdsTrackingExperiment;",
|
||||
"shouldUseMultiAdFormatTracker", "shouldUseVideoAdTracker",
|
||||
returnMethod = ReturnMethod('Z', "0")
|
||||
)
|
||||
|
||||
context.blockMethods(
|
||||
"Ltv/twitch/android/shared/ads/MultiformatAdsExperiment;",
|
||||
"shouldDisableClientSideLivePreroll", "shouldDisableClientSideVodPreroll",
|
||||
returnMethod = ReturnMethod('Z', "1")
|
||||
)
|
||||
|
||||
// Pretend our player is ineligible for all ads
|
||||
with(CheckAdEligibilityLambdaFingerprint.result!!) {
|
||||
mutableMethod.addInstructions(
|
||||
@@ -52,7 +95,22 @@ class VideoAdsPatch : BytecodePatch(
|
||||
move-result-object p0
|
||||
return-object p0
|
||||
""",
|
||||
listOf(ExternalLabel("show_video_ads", mutableMethod.instruction(0)))
|
||||
listOf(ExternalLabel(skipLabelName, mutableMethod.instruction(0)))
|
||||
)
|
||||
}
|
||||
|
||||
with(GetReadyToShowAdFingerprint.result!!) {
|
||||
val adFormatDeclined = "Ltv/twitch/android/shared/display/ads/theatre/StreamDisplayAdsPresenter\$Action\$AdFormatDeclined;"
|
||||
mutableMethod.addInstructions(
|
||||
0,
|
||||
"""
|
||||
${createConditionInstructions()}
|
||||
sget-object p2, $adFormatDeclined->INSTANCE:$adFormatDeclined
|
||||
invoke-static {p1, p2}, Ltv/twitch/android/core/mvp/presenter/StateMachineKt;->plus(Ltv/twitch/android/core/mvp/presenter/PresenterState;Ltv/twitch/android/core/mvp/presenter/PresenterAction;)Ltv/twitch/android/core/mvp/presenter/StateAndAction;
|
||||
move-result-object p1
|
||||
return-object p1
|
||||
""",
|
||||
listOf(ExternalLabel(skipLabelName, mutableMethod.instruction(0)))
|
||||
)
|
||||
}
|
||||
|
||||
@@ -61,24 +119,12 @@ class VideoAdsPatch : BytecodePatch(
|
||||
mutableMethod.addInstructions(0, """
|
||||
${createConditionInstructions()}
|
||||
const/4 v0, 0
|
||||
:show_video_ads
|
||||
:$skipLabelName
|
||||
return v0
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
||||
// Block playAds call
|
||||
with(AdsManagerFingerprint.result!!) {
|
||||
mutableMethod.addInstructions(
|
||||
0,
|
||||
"""
|
||||
${createConditionInstructions()}
|
||||
return-void
|
||||
""",
|
||||
listOf(ExternalLabel("show_video_ads", mutableMethod.instruction(0)))
|
||||
)
|
||||
}
|
||||
|
||||
SettingsPatch.PreferenceScreen.ADS.CLIENT_SIDE.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_block_video_ads",
|
||||
|
||||
@@ -173,6 +173,7 @@ class SettingsPatch : BytecodePatch(
|
||||
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")
|
||||
|
||||
internal inner class CustomCategory(key: String, title: String) : Screen.Category(key, title) {
|
||||
/* For Twitch, we need to load our CustomPreferenceCategory class instead of the default one. */
|
||||
|
||||
@@ -8,18 +8,14 @@ import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.shared.settings.preference.impl.TextPreference
|
||||
import app.revanced.patches.shared.settings.preference.impl.InputType
|
||||
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
|
||||
import app.revanced.patches.shared.settings.preference.impl.*
|
||||
import app.revanced.patches.youtube.interaction.downloads.annotation.DownloadsCompatibility
|
||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||
import app.revanced.patches.youtube.misc.playercontrols.resource.patch.BottomControlsResourcePatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.Settings.mergeStrings
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||
import app.revanced.util.resources.ResourceUtils.mergeStrings
|
||||
|
||||
@Name("downloads-resource-patch")
|
||||
@DependsOn([BottomControlsResourcePatch::class, FixLocaleConfigErrorPatch::class, SettingsPatch::class])
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package app.revanced.patches.youtube.interaction.swipecontrols.patch.bytecode
|
||||
|
||||
import app.revanced.extensions.transformMethods
|
||||
import app.revanced.extensions.traverseClassHierarchy
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
@@ -11,10 +10,11 @@ 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.TypeUtil.traverseClassHierarchy
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||
import app.revanced.patches.shared.fingerprints.WatchWhileActivityFingerprint
|
||||
import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility
|
||||
import app.revanced.patches.youtube.interaction.swipecontrols.fingerprints.SwipeControlsHostActivityFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.WatchWhileActivityFingerprint
|
||||
import app.revanced.patches.youtube.interaction.swipecontrols.patch.resource.SwipeControlsResourcePatch
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
||||
|
||||
@@ -8,12 +8,12 @@ import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.settings.preference.impl.Preference
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.annotations.ReturnYouTubeDislikeCompatibility
|
||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.shared.settings.preference.impl.Preference
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.util.resources.ResourceUtils.Settings.mergeStrings
|
||||
import app.revanced.util.resources.ResourceUtils.mergeStrings
|
||||
|
||||
@DependsOn([FixLocaleConfigErrorPatch::class, SettingsPatch::class])
|
||||
@Name("return-youtube-dislike-resource-patch")
|
||||
|
||||
@@ -7,16 +7,16 @@ import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.shared.settings.preference.impl.Preference
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.Settings.mergeStrings
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||
import app.revanced.util.resources.ResourceUtils.copyXmlNode
|
||||
import app.revanced.util.resources.ResourceUtils.mergeStrings
|
||||
|
||||
@Name("sponsorblock-resource-patch")
|
||||
@SponsorBlockCompatibility
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package app.revanced.util.microg
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.util.resources.ResourceUtils.Settings.mergeStrings
|
||||
import app.revanced.util.resources.ResourceUtils.mergeStrings
|
||||
|
||||
/**
|
||||
* Helper class for applying resource patches needed for the microg-support patches.
|
||||
|
||||
@@ -2,8 +2,8 @@ package app.revanced.util.resources
|
||||
|
||||
import app.revanced.patcher.data.DomFileEditor
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import org.w3c.dom.Node
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.StandardCopyOption
|
||||
@@ -11,26 +11,21 @@ import java.nio.file.StandardCopyOption
|
||||
internal object ResourceUtils {
|
||||
|
||||
/**
|
||||
* Settings related utilities
|
||||
* Merge strings. This manages [StringResource]s automatically.
|
||||
* @param host The hosting xml resource. Needs to be a valid strings.xml resource.
|
||||
*/
|
||||
internal object Settings {
|
||||
/**
|
||||
* Merge strings. This handles [StringResource]s automatically.
|
||||
* @param host The hosting xml resource. Needs to be a valid strings.xml resource.
|
||||
*/
|
||||
internal fun ResourceContext.mergeStrings(host: String) {
|
||||
this.iterateXmlNodeChildren(host, "resources") {
|
||||
// TODO: figure out why this is needed
|
||||
if (!it.hasAttributes()) return@iterateXmlNodeChildren
|
||||
internal fun ResourceContext.mergeStrings(host: String) {
|
||||
this.iterateXmlNodeChildren(host, "resources") {
|
||||
// TODO: figure out why this is needed
|
||||
if (!it.hasAttributes()) return@iterateXmlNodeChildren
|
||||
|
||||
val attributes = it.attributes
|
||||
val key = attributes.getNamedItem("name")!!.nodeValue!!
|
||||
val value = it.textContent!!
|
||||
val attributes = it.attributes
|
||||
val key = attributes.getNamedItem("name")!!.nodeValue!!
|
||||
val value = it.textContent!!
|
||||
|
||||
val formatted = attributes.getNamedItem("formatted") == null
|
||||
val formatted = attributes.getNamedItem("formatted") == null
|
||||
|
||||
SettingsPatch.addString(key, value, formatted)
|
||||
}
|
||||
SettingsPatch.addString(key, value, formatted)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user