feat(youtube/microg-support): handle availability of Vanced MicroG

This commit is contained in:
oSumAtrIX
2022-10-29 03:03:57 +02:00
parent 01e226d0c9
commit 07d39f2b81
7 changed files with 46 additions and 6 deletions
@@ -4,10 +4,13 @@ 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.addInstruction
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.shared.fingerprints.WatchWhileActivityFingerprint
import app.revanced.patches.youtube.layout.castbutton.patch.HideCastButtonPatch
import app.revanced.patches.youtube.misc.clientspoof.patch.ClientSpoofPatch
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
@@ -38,9 +41,10 @@ class MicroGBytecodePatch : BytecodePatch(
CastDynamiteModuleV2Fingerprint,
CastContextFetchFingerprint,
PrimeFingerprint,
WatchWhileActivityFingerprint
)
) {
override fun execute(context: BytecodeContext) =
override fun execute(context: BytecodeContext): PatchResult {
// apply common microG patch
MicroGBytecodeHelper.patchBytecode(
context, arrayOf(
@@ -62,5 +66,11 @@ class MicroGBytecodePatch : BytecodePatch(
CastDynamiteModuleV2Fingerprint,
CastContextFetchFingerprint
)
).let { PatchResultSuccess() }
)
// inject the notice for MicroG
MicroGBytecodeHelper.injectNotice(WatchWhileActivityFingerprint)
return PatchResultSuccess()
}
}
@@ -53,6 +53,10 @@ class MicroGResourcePatch : ResourcePatch {
SPOOFED_PACKAGE_NAME,
SPOOFED_PACKAGE_SIGNATURE
)
// add strings
MicroGResourceHelper.addStrings(context)
return PatchResultSuccess()
}
}