mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2024-11-10 01:01:56 +01:00
fix(YouTube - GmsCore support): Check for availability earlier to prevent crashing without any notice
This commit is contained in:
parent
b288e45021
commit
dab8900e22
4 changed files with 17 additions and 5 deletions
|
@ -1423,6 +1423,10 @@ public final class app/revanced/patches/youtube/misc/gms/GmsCoreSupportResourceP
|
|||
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/youtube/misc/gms/fingerprints/HomeActivityFingerprint : app/revanced/patches/shared/integrations/AbstractIntegrationsPatch$IntegrationsFingerprint {
|
||||
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/gms/fingerprints/HomeActivityFingerprint;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/youtube/misc/integrations/IntegrationsPatch : app/revanced/patches/shared/integrations/AbstractIntegrationsPatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/integrations/IntegrationsPatch;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import app.revanced.patches.youtube.misc.gms.Constants.REVANCED_YOUTUBE_PACKAGE_
|
|||
import app.revanced.patches.youtube.misc.gms.Constants.YOUTUBE_PACKAGE_NAME
|
||||
import app.revanced.patches.youtube.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorOption
|
||||
import app.revanced.patches.youtube.misc.gms.fingerprints.*
|
||||
import app.revanced.patches.youtube.shared.fingerprints.WatchWhileActivityFingerprint
|
||||
import app.revanced.util.exception
|
||||
|
||||
|
||||
|
@ -50,17 +49,17 @@ object GmsCoreSupportPatch : AbstractGmsCoreSupportPatch(
|
|||
CastDynamiteModuleV2Fingerprint,
|
||||
CastContextFetchFingerprint,
|
||||
PrimeMethodFingerprint,
|
||||
WatchWhileActivityFingerprint
|
||||
HomeActivityFingerprint,
|
||||
)
|
||||
) {
|
||||
override val gmsCoreVendor by gmsCoreVendorOption
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// Check the availability of GmsCore.
|
||||
WatchWhileActivityFingerprint.result?.mutableMethod?.addInstruction(
|
||||
HomeActivityFingerprint.result?.mutableMethod?.addInstruction(
|
||||
0,
|
||||
"invoke-static {}, Lapp/revanced/integrations/patches/GmsCoreSupport;->checkAvailability()V"
|
||||
) ?: throw WatchWhileActivityFingerprint.exception
|
||||
) ?: throw HomeActivityFingerprint.exception
|
||||
|
||||
super.execute(context)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package app.revanced.patches.youtube.misc.gms.fingerprints
|
||||
|
||||
import app.revanced.patches.shared.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint
|
||||
|
||||
object HomeActivityFingerprint : IntegrationsFingerprint(
|
||||
customFingerprint = { methodDef, classDef ->
|
||||
methodDef.name == "onCreate" && classDef.type.endsWith("Shell_HomeActivity;")
|
||||
},
|
||||
)
|
|
@ -16,4 +16,4 @@ object IntegrationsPatch : AbstractIntegrationsPatch(
|
|||
EmbeddedPlayerFingerprint,
|
||||
APIPlayerServiceFingerprint,
|
||||
),
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue