mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-05 17:14:35 +02:00
chore: lint code
This commit is contained in:
parent
4ad2ad7765
commit
72adaf1a8e
@ -14,9 +14,10 @@ import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfFirstInstruction
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
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.instruction.formats.Instruction35c
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
@ -57,27 +58,24 @@ object HideHandlePatch : BytecodePatch(
|
||||
/**
|
||||
* Hide handle in account menu
|
||||
*/
|
||||
AccountSwitcherAccessibilityLabelFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val textColorIndex = implementation!!.instructions.indexOfFirst { instruction ->
|
||||
((instruction as? ReferenceInstruction)?.reference as? MethodReference)?.name == "setTextColor"
|
||||
AccountSwitcherAccessibilityLabelFingerprint.result?.let { result ->
|
||||
result.mutableMethod.apply {
|
||||
|
||||
val textColorIndex = indexOfFirstInstruction {
|
||||
getReference<MethodReference>()?.name == "setTextColor"
|
||||
}
|
||||
|
||||
for (index in textColorIndex until textColorIndex + 5) {
|
||||
if (getInstruction(index).opcode != Opcode.INVOKE_VIRTUAL) continue
|
||||
|
||||
if ((getInstruction<ReferenceInstruction>(index).reference as MethodReference).name == "setVisibility") {
|
||||
|
||||
val textViewInstruction = getInstruction<Instruction35c>(index)
|
||||
|
||||
replaceInstruction(
|
||||
index,
|
||||
"invoke-static {v${textViewInstruction.registerC}, v${textViewInstruction.registerD}}, $ACCOUNT->hideHandle(Landroid/widget/TextView;I)V"
|
||||
)
|
||||
|
||||
break
|
||||
val setTextIndex = implementation!!.instructions.let {
|
||||
textColorIndex + it.subList(textColorIndex, textColorIndex + 10).indexOfFirst { instruction ->
|
||||
instruction.opcode == Opcode.INVOKE_VIRTUAL
|
||||
&& instruction.getReference<MethodReference>()?.name == "setVisibility"
|
||||
}
|
||||
}
|
||||
val textViewInstruction = getInstruction<Instruction35c>(setTextIndex)
|
||||
|
||||
replaceInstruction(
|
||||
setTextIndex,
|
||||
"invoke-static {v${textViewInstruction.registerC}, v${textViewInstruction.registerD}}, $ACCOUNT->hideHandle(Landroid/widget/TextView;I)V"
|
||||
)
|
||||
}
|
||||
} ?: throw AccountSwitcherAccessibilityLabelFingerprint.exception
|
||||
|
||||
|
@ -9,7 +9,6 @@ import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.patch.litho.ComponentParserPatch
|
||||
import app.revanced.patches.youtube.utils.browseid.fingerprints.BrowseIdClassFingerprint
|
||||
import app.revanced.patches.youtube.utils.browseid.fingerprints.SetToolBarPaddingFingerprint
|
||||
import app.revanced.patches.youtube.utils.integrations.Constants.UTILS_PATH
|
||||
import app.revanced.patches.youtube.utils.litho.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
||||
@ -26,10 +25,7 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||
]
|
||||
)
|
||||
object BrowseIdHookPatch : BytecodePatch(
|
||||
setOf(
|
||||
BrowseIdClassFingerprint,
|
||||
SetToolBarPaddingFingerprint
|
||||
)
|
||||
setOf(BrowseIdClassFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"$UTILS_PATH/BrowseIdPatch;"
|
||||
|
@ -1,16 +0,0 @@
|
||||
package app.revanced.patches.youtube.utils.browseid.fingerprints
|
||||
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ToolBarPaddingHome
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object SetToolBarPaddingFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
parameters = listOf("I", "I"),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_STATIC
|
||||
),
|
||||
literalSupplier = { ToolBarPaddingHome }
|
||||
)
|
@ -78,7 +78,6 @@ object SharedResourceIdPatch : ResourcePatch() {
|
||||
var SubtitleMenuSettingsFooterInfo: Long = -1
|
||||
var SuggestedAction: Long = -1
|
||||
var TabsBarTextTabView: Long = -1
|
||||
var ToolBarPaddingHome: Long = -1
|
||||
var ToolTipContentView: Long = -1
|
||||
var TotalTime: Long = -1
|
||||
var VideoQualityBottomSheet: Long = -1
|
||||
@ -162,7 +161,6 @@ object SharedResourceIdPatch : ResourcePatch() {
|
||||
SubtitleMenuSettingsFooterInfo = find(STRING, "subtitle_menu_settings_footer_info")
|
||||
SuggestedAction = find(LAYOUT, "suggested_action")
|
||||
TabsBarTextTabView = find(ID, "tabs_bar_text_tab_view")
|
||||
ToolBarPaddingHome = find(DIMEN, "toolbar_padding_home_action_up")
|
||||
ToolTipContentView = find(LAYOUT, "tooltip_content_view")
|
||||
TotalTime = find(STRING, "total_time")
|
||||
VideoQualityBottomSheet = find(LAYOUT, "video_quality_bottom_sheet_list_fragment_title")
|
||||
|
Loading…
x
Reference in New Issue
Block a user