Skip to content

Commit fdb93b9

Browse files
committed
Add disable-update-screen patch (closes #6)
1 parent b3ae2bd commit fdb93b9

File tree

6 files changed

+81
-3
lines changed

6 files changed

+81
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Around half of the patches currently work.
1616

1717
- Patch with the following command (file names changed for brevity):
1818
```
19-
java -jar revanced-cli.jar patch YouTube_16.40.36.apk -p -o YouTube_ReVanced_16.40.36.apk -b revanced-patches-2.160.8.jar -m revanced-integrations-0.96.6.apk -i microg-support -i spoof-player-parameters -i client-spoof -i hide-video-ads -i enable-minimized-playback --exclusive
19+
java -jar revanced-cli.jar patch YouTube_16.40.36.apk -p -o YouTube_ReVanced_16.40.36.apk -b revanced-patches-2.160.8.jar -m revanced-integrations-0.96.6.apk -i microg-support -i spoof-player-parameters -i client-spoof -i hide-video-ads -i enable-minimized-playback -i disable-update-screen --exclusive
2020
```
2121

2222
- Or patch with all the supported patches (ignore the errors):

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
kotlin.code.style = official
2-
version = 2.160.8
2+
version = 2.160.9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package app.revanced.patches.youtube.misc.updatescreen.bytecode.fingerprints
2+
3+
import app.revanced.patcher.extensions.or
4+
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
5+
import com.android.tools.smali.dexlib2.AccessFlags
6+
import com.android.tools.smali.dexlib2.Opcode
7+
8+
object UpdateScreenFingerprint : MethodFingerprint(
9+
returnType = "Landroid/content/Intent",
10+
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
11+
parameters = listOf("Landroid/content/Intent"),
12+
opcodes = listOf(
13+
Opcode.IGET_OBJECT,
14+
Opcode.IGET_OBJECT,
15+
Opcode.SGET_OBJECT,
16+
Opcode.INVOKE_VIRTUAL,
17+
Opcode.MOVE_RESULT_OBJECT,
18+
Opcode.IGET_OBJECT,
19+
Opcode.IF_NEZ,
20+
Opcode.SGET_OBJECT,
21+
Opcode.IGET_OBJECT
22+
),
23+
strings = listOf("show_force_upgrade", "forward_intent")
24+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package app.revanced.patches.youtube.misc.updatescreen.bytecode.patch
2+
3+
import app.revanced.patcher.annotation.Name
4+
import app.revanced.patcher.data.BytecodeContext
5+
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
6+
import app.revanced.patcher.patch.BytecodePatch
7+
import app.revanced.patches.youtube.misc.updatescreen.bytecode.fingerprints.UpdateScreenFingerprint
8+
import app.revanced.shared.annotation.YouTubeCompatibility
9+
import app.revanced.shared.extensions.exception
10+
11+
@Name("disable-update-screen-bytecode-patch")
12+
@YouTubeCompatibility
13+
class UpdateScreenBytecodePatch : BytecodePatch(
14+
listOf(
15+
UpdateScreenFingerprint
16+
)
17+
) {
18+
override fun execute(context: BytecodeContext) {
19+
20+
UpdateScreenFingerprint.result?.mutableMethod?.replaceInstructions(
21+
0,
22+
"""
23+
const/4 v0, 0x0
24+
return-object v0
25+
"""
26+
) ?: throw UpdateScreenFingerprint.exception
27+
}
28+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package app.revanced.patches.youtube.misc.updatescreen.resource.patch
2+
3+
import app.revanced.patcher.annotation.Description
4+
import app.revanced.patcher.annotation.Name
5+
import app.revanced.patcher.data.ResourceContext
6+
import app.revanced.patcher.patch.ResourcePatch
7+
import app.revanced.patcher.patch.annotations.DependsOn
8+
import app.revanced.patcher.patch.annotations.Patch
9+
import app.revanced.patches.youtube.misc.updatescreen.bytecode.patch.UpdateScreenBytecodePatch
10+
import app.revanced.shared.annotation.YouTubeCompatibility
11+
import app.revanced.shared.util.resources.ResourceHelper
12+
13+
@Patch
14+
@Name("disable-update-screen")
15+
@Description("Disables the app update screen.")
16+
@DependsOn([UpdateScreenBytecodePatch::class])
17+
@YouTubeCompatibility
18+
class UpdateScreenPatch : ResourcePatch {
19+
override fun execute(context: ResourceContext) {
20+
21+
ResourceHelper.patchSuccess(
22+
context,
23+
"disable-new-version"
24+
)
25+
}
26+
}

src/main/resources/youtube/settings/xml/revanced_prefs.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@
352352
<Preference android:title=" " android:selectable="false" android:summary="@string/pref_about_category" />
353353
<PreferenceScreen android:title="@string/revanced_patches_information" android:summary="@string/revanced_patches_information_summary" >
354354
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_tool_used" />
355-
<Preference android:title="revanced-patches" android:selectable="false" android:summary="2.160.8" />
355+
<Preference android:title="revanced-patches" android:selectable="false" android:summary="2.160.9" />
356356
<Preference android:title="revanced-integrations" android:key="revanced-integrations" android:selectable="false"/>
357357
358358
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_video_ads_removal_title" />

0 commit comments

Comments
 (0)