mirror of
https://github.com/revanced/revanced-patches
synced 2025-01-11 22:56:01 +01:00
refactor(Spoof SIM country): Use existing function to register patch option
This commit is contained in:
parent
1dfbda7be4
commit
a7c3cf2f5c
@ -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.getInstruction
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
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.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patches.all.misc.transformation.AbstractTransformInstructionsPatch
|
import app.revanced.patches.all.misc.transformation.AbstractTransformInstructionsPatch
|
||||||
import com.android.tools.smali.dexlib2.iface.ClassDef
|
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||||
@ -39,16 +39,15 @@ object SpoofSimCountryPatch : AbstractTransformInstructionsPatch<Pair<Int, Strin
|
|||||||
private fun isoCountryPatchOption(
|
private fun isoCountryPatchOption(
|
||||||
key: String,
|
key: String,
|
||||||
title: String,
|
title: String,
|
||||||
) = PatchOption(
|
) = stringPatchOption(
|
||||||
key,
|
key,
|
||||||
null,
|
null,
|
||||||
countries,
|
countries,
|
||||||
title,
|
title,
|
||||||
"ISO-3166-1 alpha-2 country code equivalent for the SIM provider's country code.",
|
"ISO-3166-1 alpha-2 country code equivalent for the SIM provider's country code.",
|
||||||
false,
|
false,
|
||||||
valueType = "String",
|
|
||||||
validator = { it: String? -> it?.uppercase() in countries.keys || it == null }
|
validator = { it: String? -> it?.uppercase() in countries.keys || it == null }
|
||||||
).also(options::register)
|
)
|
||||||
|
|
||||||
override fun filterMap(
|
override fun filterMap(
|
||||||
classDef: ClassDef,
|
classDef: ClassDef,
|
||||||
|
Loading…
Reference in New Issue
Block a user