fix(tiktok/show-seekbar): fix crash when showing seekbar (#1643)
This commit is contained in:
parent
44b74ae268
commit
160b71644d
|
@ -1,5 +1,6 @@
|
||||||
package app.revanced.patches.tiktok.interaction.seekbar.patch
|
package app.revanced.patches.tiktok.interaction.seekbar.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
|
@ -14,6 +15,7 @@ import app.revanced.patches.tiktok.interaction.seekbar.annotations.ShowSeekbarCo
|
||||||
import app.revanced.patches.tiktok.interaction.seekbar.fingerprints.AwemeGetVideoControlFingerprint
|
import app.revanced.patches.tiktok.interaction.seekbar.fingerprints.AwemeGetVideoControlFingerprint
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction11n
|
import org.jf.dexlib2.builder.instruction.BuilderInstruction11n
|
||||||
|
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction22c
|
import org.jf.dexlib2.builder.instruction.BuilderInstruction22c
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
|
@ -32,15 +34,18 @@ class ShowSeekbarPatch : BytecodePatch(
|
||||||
?: return PatchResultError("Can not find target class")
|
?: return PatchResultError("Can not find target class")
|
||||||
val fieldList = videoControl.immutableClass.fields.associateBy { field -> field.name }
|
val fieldList = videoControl.immutableClass.fields.associateBy { field -> field.name }
|
||||||
|
|
||||||
val method = AwemeGetVideoControlFingerprint.result!!.mutableMethod
|
AwemeGetVideoControlFingerprint.result?.mutableMethod?.implementation?.apply {
|
||||||
val implementation = method.implementation!!
|
val ifNullLabel = newLabelForIndex(1)
|
||||||
implementation.addInstructions(
|
addInstructions(
|
||||||
1, listOf(
|
1,
|
||||||
|
listOf(
|
||||||
BuilderInstruction11n(Opcode.CONST_4, 1, 1),
|
BuilderInstruction11n(Opcode.CONST_4, 1, 1),
|
||||||
|
BuilderInstruction21t(Opcode.IF_EQZ, 0, ifNullLabel),
|
||||||
BuilderInstruction22c(Opcode.IPUT, 1, 0, fieldList["showProgressBar"]!!),
|
BuilderInstruction22c(Opcode.IPUT, 1, 0, fieldList["showProgressBar"]!!),
|
||||||
BuilderInstruction22c(Opcode.IPUT, 1, 0, fieldList["draftProgressBar"]!!)
|
BuilderInstruction22c(Opcode.IPUT, 1, 0, fieldList["draftProgressBar"]!!)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
} ?: return AwemeGetVideoControlFingerprint.toErrorResult()
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue