mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-05-03 16:14:28 +02:00
fix(TikTok - Settings): Prevent crash by fixing invalid patch
This commit is contained in:
parent
82d53cbc3b
commit
8074032fad
@ -25,8 +25,8 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|||||||
dependencies = [IntegrationsPatch::class],
|
dependencies = [IntegrationsPatch::class],
|
||||||
compatiblePackages = [
|
compatiblePackages = [
|
||||||
CompatiblePackage("com.ss.android.ugc.trill", ["32.5.3"]),
|
CompatiblePackage("com.ss.android.ugc.trill", ["32.5.3"]),
|
||||||
CompatiblePackage("com.zhiliaoapp.musically", ["32.5.3"])
|
CompatiblePackage("com.zhiliaoapp.musically", ["32.5.3"]),
|
||||||
]
|
],
|
||||||
)
|
)
|
||||||
object SettingsPatch : BytecodePatch(
|
object SettingsPatch : BytecodePatch(
|
||||||
setOf(
|
setOf(
|
||||||
@ -34,21 +34,21 @@ object SettingsPatch : BytecodePatch(
|
|||||||
AddSettingsEntryFingerprint,
|
AddSettingsEntryFingerprint,
|
||||||
SettingsEntryFingerprint,
|
SettingsEntryFingerprint,
|
||||||
SettingsEntryInfoFingerprint,
|
SettingsEntryInfoFingerprint,
|
||||||
)
|
),
|
||||||
) {
|
) {
|
||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||||
"Lapp/revanced/integrations/tiktok/settings/AdPersonalizationActivityHook;"
|
"Lapp/revanced/integrations/tiktok/settings/AdPersonalizationActivityHook;"
|
||||||
|
|
||||||
private const val INITIALIZE_SETTINGS_METHOD_DESCRIPTOR =
|
private const val INITIALIZE_SETTINGS_METHOD_DESCRIPTOR =
|
||||||
"$INTEGRATIONS_CLASS_DESCRIPTOR->initialize(" +
|
"$INTEGRATIONS_CLASS_DESCRIPTOR->initialize(" +
|
||||||
"Lcom/bytedance/ies/ugc/aweme/commercialize/compliance/personalization/AdPersonalizationActivity;" +
|
"Lcom/bytedance/ies/ugc/aweme/commercialize/compliance/personalization/AdPersonalizationActivity;" +
|
||||||
")Z"
|
")Z"
|
||||||
|
|
||||||
private const val CREATE_SETTINGS_ENTRY_METHOD_DESCRIPTOR =
|
private const val CREATE_SETTINGS_ENTRY_METHOD_DESCRIPTOR =
|
||||||
"$INTEGRATIONS_CLASS_DESCRIPTOR->createSettingsEntry(" +
|
"$INTEGRATIONS_CLASS_DESCRIPTOR->createSettingsEntry(" +
|
||||||
"Ljava/lang/String;" +
|
"Ljava/lang/String;" +
|
||||||
"Ljava/lang/String;" +
|
"Ljava/lang/String;" +
|
||||||
")Ljava/lang/Object;"
|
")Ljava/lang/Object;"
|
||||||
|
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
// Find the class name of classes which construct a settings entry
|
// Find the class name of classes which construct a settings entry
|
||||||
@ -70,8 +70,8 @@ object SettingsPatch : BytecodePatch(
|
|||||||
markIndex + 2,
|
markIndex + 2,
|
||||||
listOf(
|
listOf(
|
||||||
getUnitManager,
|
getUnitManager,
|
||||||
addEntry
|
addEntry,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
@ -81,7 +81,8 @@ object SettingsPatch : BytecodePatch(
|
|||||||
const-string v1, "$settingsButtonInfoClass"
|
const-string v1, "$settingsButtonInfoClass"
|
||||||
invoke-static {v0, v1}, $CREATE_SETTINGS_ENTRY_METHOD_DESCRIPTOR
|
invoke-static {v0, v1}, $CREATE_SETTINGS_ENTRY_METHOD_DESCRIPTOR
|
||||||
move-result-object v0
|
move-result-object v0
|
||||||
"""
|
check-cast v0, ${SettingsEntryFingerprint.result!!.classDef}
|
||||||
|
""",
|
||||||
)
|
)
|
||||||
} ?: throw AddSettingsEntryFingerprint.exception
|
} ?: throw AddSettingsEntryFingerprint.exception
|
||||||
|
|
||||||
@ -102,12 +103,10 @@ object SettingsPatch : BytecodePatch(
|
|||||||
if-eqz v$usableRegister, :do_not_open
|
if-eqz v$usableRegister, :do_not_open
|
||||||
return-void
|
return-void
|
||||||
""",
|
""",
|
||||||
ExternalLabel("do_not_open", getInstruction(initializeSettingsIndex))
|
ExternalLabel("do_not_open", getInstruction(initializeSettingsIndex)),
|
||||||
)
|
)
|
||||||
} ?: throw AdPersonalizationActivityOnCreateFingerprint.exception
|
} ?: throw AdPersonalizationActivityOnCreateFingerprint.exception
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun String.toClassName(): String {
|
private fun String.toClassName(): String = substring(1, this.length - 1).replace("/", ".")
|
||||||
return substring(1, this.length - 1).replace("/", ".")
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user