fix(YouTube - GmsCore support): Check for availability earlier to prevent crashing without any notice

This commit is contained in:
oSumAtrIX 2023-12-11 23:04:37 +01:00
parent b288e45021
commit dab8900e22
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
4 changed files with 17 additions and 5 deletions

View File

@ -1423,6 +1423,10 @@ public final class app/revanced/patches/youtube/misc/gms/GmsCoreSupportResourceP
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V 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 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; public static final field INSTANCE Lapp/revanced/patches/youtube/misc/integrations/IntegrationsPatch;
} }

View File

@ -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.Constants.YOUTUBE_PACKAGE_NAME
import app.revanced.patches.youtube.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorOption import app.revanced.patches.youtube.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorOption
import app.revanced.patches.youtube.misc.gms.fingerprints.* import app.revanced.patches.youtube.misc.gms.fingerprints.*
import app.revanced.patches.youtube.shared.fingerprints.WatchWhileActivityFingerprint
import app.revanced.util.exception import app.revanced.util.exception
@ -50,17 +49,17 @@ object GmsCoreSupportPatch : AbstractGmsCoreSupportPatch(
CastDynamiteModuleV2Fingerprint, CastDynamiteModuleV2Fingerprint,
CastContextFetchFingerprint, CastContextFetchFingerprint,
PrimeMethodFingerprint, PrimeMethodFingerprint,
WatchWhileActivityFingerprint HomeActivityFingerprint,
) )
) { ) {
override val gmsCoreVendor by gmsCoreVendorOption override val gmsCoreVendor by gmsCoreVendorOption
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
// Check the availability of GmsCore. // Check the availability of GmsCore.
WatchWhileActivityFingerprint.result?.mutableMethod?.addInstruction( HomeActivityFingerprint.result?.mutableMethod?.addInstruction(
0, 0,
"invoke-static {}, Lapp/revanced/integrations/patches/GmsCoreSupport;->checkAvailability()V" "invoke-static {}, Lapp/revanced/integrations/patches/GmsCoreSupport;->checkAvailability()V"
) ?: throw WatchWhileActivityFingerprint.exception ) ?: throw HomeActivityFingerprint.exception
super.execute(context) super.execute(context)
} }

View File

@ -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;")
},
)