mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-10 10:19:27 +01:00
refactor: use .single
for resourceMappings
This commit is contained in:
parent
5824c2cdfb
commit
f090ff1229
@ -58,7 +58,7 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
|
||||
"promoted_video_item_land",
|
||||
"promoted_video_item_full_bleed",
|
||||
).map { name ->
|
||||
ResourceIdMappingProviderResourcePatch.resourceMappings.first { it.name == name }.id
|
||||
ResourceIdMappingProviderResourcePatch.resourceMappings.single { it.name == name }.id
|
||||
}
|
||||
|
||||
private val stringReferences = arrayOf(
|
||||
|
@ -32,9 +32,9 @@ class HideAutoplayButton : BytecodePatch(
|
||||
val layoutGenMethod = LayoutConstructorFingerprint.result!!.mutableMethod
|
||||
|
||||
val autonavToggle =
|
||||
ResourceIdMappingProviderResourcePatch.resourceMappings.first { it.type == "id" && it.name == "autonav_toggle" }
|
||||
ResourceIdMappingProviderResourcePatch.resourceMappings.single { it.type == "id" && it.name == "autonav_toggle" }
|
||||
val autonavPreviewStub =
|
||||
ResourceIdMappingProviderResourcePatch.resourceMappings.first { it.type == "id" && it.name == "autonav_preview_stub" }
|
||||
ResourceIdMappingProviderResourcePatch.resourceMappings.single { it.type == "id" && it.name == "autonav_preview_stub" }
|
||||
|
||||
val autonavToggleConstIndex =
|
||||
layoutGenMethod.implementation!!.instructions.indexOfFirst { (it as? WideLiteralInstruction)?.wideLiteral == autonavToggle.id }
|
||||
|
@ -39,7 +39,7 @@ class CreateButtonRemoverPatch : BytecodePatch(
|
||||
val implementation = result.mutableMethod.implementation!!
|
||||
|
||||
val imageOnlyLayout =
|
||||
ResourceIdMappingProviderResourcePatch.resourceMappings.first { it.type == "layout" && it.name == "image_only_tab" }
|
||||
ResourceIdMappingProviderResourcePatch.resourceMappings.single { it.type == "layout" && it.name == "image_only_tab" }
|
||||
|
||||
val imageOnlyLayoutConstIndex =
|
||||
implementation.instructions.indexOfFirst { (it as? WideLiteralInstruction)?.wideLiteral == imageOnlyLayout.id }
|
||||
|
Loading…
Reference in New Issue
Block a user