chore: lint code

This commit is contained in:
inotia00
2024-06-13 00:20:35 +09:00
parent 4adce1465c
commit a4c50493f7
14 changed files with 103 additions and 44 deletions

View File

@ -85,7 +85,8 @@ abstract class BaseAdsPatch(
internal fun MethodFingerprintResult.hookLithoFullscreenAds(context: BytecodeContext) {
mutableMethod.apply {
val dialogCodeIndex = scanResult.patternScanResult!!.endIndex
val dialogCodeField = getInstruction<ReferenceInstruction>(dialogCodeIndex).reference as FieldReference
val dialogCodeField =
getInstruction<ReferenceInstruction>(dialogCodeIndex).reference as FieldReference
if (dialogCodeField.type != "I")
throw PatchException("Invalid dialogCodeField: $dialogCodeField")
@ -119,7 +120,8 @@ abstract class BaseAdsPatch(
method.parameters == listOf("I")
&& method.returnType == "Landroid/widget/Button;"
}
val getButtonCall = dialogDefiningClass + "->" + getButtonMethod.name + "(I)Landroid/widget/Button;"
val getButtonCall =
dialogDefiningClass + "->" + getButtonMethod.name + "(I)Landroid/widget/Button;"
val dialogRegister = getInstruction<FiveRegisterInstruction>(dialogIndex).registerC
val freeIndex = getTargetIndex(dialogIndex, Opcode.IF_EQZ)
val freeRegister = getInstruction<OneRegisterInstruction>(freeIndex).registerA

View File

@ -38,12 +38,13 @@ object TranslationsUtils {
// Exception is thrown if an invalid path is used in the patch option.
throw PatchException("Invalid custom translations path: $customLang")
}
}?: run {
} ?: run {
// Process selected translations if no custom translation is set.
val selectedTranslationsArray =
selectedTranslations?.split(",")?.map { it.trim() }?.toTypedArray()
?: throw PatchException("Invalid selected languages.")
val filteredLanguages = translationsArray.filter { it in selectedTranslationsArray }.toTypedArray()
val filteredLanguages =
translationsArray.filter { it in selectedTranslationsArray }.toTypedArray()
copyXml(sourceDirectory, filteredLanguages)
}