refactor: use .single for resourceMappings

This commit is contained in:
oSumAtrIX 2022-07-17 11:57:44 +02:00
parent 5824c2cdfb
commit f090ff1229
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
3 changed files with 4 additions and 4 deletions

View File

@ -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(

View File

@ -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 }

View File

@ -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 }