diff --git a/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/extension/ExtensionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/extension/ExtensionPatch.kt index 66efc7f51..5101f3d52 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/extension/ExtensionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/extension/ExtensionPatch.kt @@ -2,4 +2,4 @@ package app.revanced.patches.tiktok.misc.extension import app.revanced.patches.shared.misc.extension.sharedExtensionPatch -val sharedExtensionPatch = sharedExtensionPatch("tiktok", initHook) +val sharedExtensionPatch = sharedExtensionPatch("tiktok", initHook, jatoInitHook) diff --git a/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/extension/Hooks.kt b/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/extension/Hooks.kt index 24a49dd35..8ef26fc3f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/extension/Hooks.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/extension/Hooks.kt @@ -12,3 +12,19 @@ internal val initHook = extensionHook( method.name == "" } } + +/** + * In some cases the extension code can be called before + * the app main activity onCreate is called. + * + * This class is called from startup code titled "BPEA RunnableGuardLancet" + */ +internal val jatoInitHook = extensionHook( + insertIndexResolver = { 0 }, + contextRegisterResolver = { "p1" } +) { + custom { method, classDef -> + classDef.type == "Lcom/ss/android/ugc/aweme/legoImp/task/JatoInitTask;" && + method.name == "run" + } +}