refactor(Spoof SIM country): Use existing function to register patch option

This commit is contained in:
oSumAtrIX 2023-12-22 03:30:27 +01:00
parent 1dfbda7be4
commit a7c3cf2f5c
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -3,7 +3,7 @@ package app.revanced.patches.all.telephony.sim.spoof
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.patch.options.PatchOption
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.all.misc.transformation.AbstractTransformInstructionsPatch
import com.android.tools.smali.dexlib2.iface.ClassDef
@ -39,16 +39,15 @@ object SpoofSimCountryPatch : AbstractTransformInstructionsPatch<Pair<Int, Strin
private fun isoCountryPatchOption(
key: String,
title: String,
) = PatchOption(
) = stringPatchOption(
key,
null,
countries,
title,
"ISO-3166-1 alpha-2 country code equivalent for the SIM provider's country code.",
false,
valueType = "String",
validator = { it: String? -> it?.uppercase() in countries.keys || it == null }
).also(options::register)
)
override fun filterMap(
classDef: ClassDef,