mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 13:17:46 +02:00
fix: error toast is shown when not connected to the network or playing a device file
This commit is contained in:
@ -2,11 +2,9 @@ package app.revanced.patches.music.video.videoid
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.music.video.videoid.fingerprints.PlayerResponseModelStoryboardRendererFingerprint
|
||||
import app.revanced.patches.music.video.videoid.fingerprints.VideoIdParentFingerprint
|
||||
import app.revanced.util.exception
|
||||
@ -15,14 +13,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
import java.io.Closeable
|
||||
|
||||
object VideoIdPatch : BytecodePatch(
|
||||
setOf(
|
||||
PlayerResponseModelStoryboardRendererFingerprint,
|
||||
VideoIdParentFingerprint
|
||||
)
|
||||
), Closeable {
|
||||
) {
|
||||
private var videoIdRegister = 0
|
||||
private var videoIdInsertIndex = 0
|
||||
private lateinit var videoIdMethod: MutableMethod
|
||||
@ -64,22 +61,6 @@ object VideoIdPatch : BytecodePatch(
|
||||
} ?: throw PlayerResponseModelStoryboardRendererFingerprint.exception
|
||||
}
|
||||
|
||||
override fun close() {
|
||||
backgroundPlaybackMethod.apply {
|
||||
val insertIndex = implementation!!.instructions.indexOfLast { instruction ->
|
||||
instruction.opcode == Opcode.IGET_OBJECT
|
||||
} + 1
|
||||
|
||||
if (insertIndex != backgroundPlaybackInsertIndex) {
|
||||
addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
if-eqz v$backgroundPlaybackVideoIdRegister, :ignore
|
||||
""", ExternalLabel("ignore", getInstruction(backgroundPlaybackInsertIndex))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun hookVideoId(
|
||||
methodDescriptor: String
|
||||
) = videoIdMethod.addInstruction(
|
||||
|
Reference in New Issue
Block a user