mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-05 06:44:25 +02:00
refactor: use also
instead of let
where possible
This commit is contained in:
parent
31815ca9ea
commit
26fca60b53
@ -64,10 +64,8 @@ class Patcher(
|
|||||||
androlib.decodeResourcesFull(extInputFile, outDir, resourceTable)
|
androlib.decodeResourcesFull(extInputFile, outDir, resourceTable)
|
||||||
|
|
||||||
// read additional metadata from the resource table
|
// read additional metadata from the resource table
|
||||||
packageMetadata.metaInfo.usesFramework = UsesFramework().let { usesFramework ->
|
packageMetadata.metaInfo.usesFramework = UsesFramework().also { usesFramework ->
|
||||||
usesFramework.ids = resourceTable.listFramePackages().map { it.id }.sorted()
|
usesFramework.ids = resourceTable.listFramePackages().map { it.id }.sorted()
|
||||||
|
|
||||||
usesFramework
|
|
||||||
}
|
}
|
||||||
packageMetadata.metaInfo.doNotCompress = buildList {
|
packageMetadata.metaInfo.doNotCompress = buildList {
|
||||||
androlib.recordUncompressedFiles(extInputFile, this)
|
androlib.recordUncompressedFiles(extInputFile, this)
|
||||||
@ -97,11 +95,9 @@ class Patcher(
|
|||||||
packageMetadata.metaInfo.sdkInfo = resourceTable.sdkInfo
|
packageMetadata.metaInfo.sdkInfo = resourceTable.sdkInfo
|
||||||
|
|
||||||
// read dex files
|
// read dex files
|
||||||
val dexFile = MultiDexIO.readDexFile(true, options.inputFile, NAMER, null, null).let { dexFile ->
|
val dexFile = MultiDexIO.readDexFile(true, options.inputFile, NAMER, null, null).also { dexFile ->
|
||||||
// get the opcodes
|
// get the opcodes
|
||||||
opcodes = dexFile.opcodes
|
opcodes = dexFile.opcodes
|
||||||
|
|
||||||
dexFile
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// finally create patcher data
|
// finally create patcher data
|
||||||
@ -150,23 +146,19 @@ class Patcher(
|
|||||||
if (options.patchResources) {
|
if (options.patchResources) {
|
||||||
val cacheDirectory = ExtFile(options.resourceCacheDirectory)
|
val cacheDirectory = ExtFile(options.resourceCacheDirectory)
|
||||||
|
|
||||||
val androlibResources = AndrolibResources().let { resources ->
|
val androlibResources = AndrolibResources().also { resources ->
|
||||||
resources.buildOptions = BuildOptions().let { options ->
|
resources.buildOptions = BuildOptions().also { options ->
|
||||||
// TODO: options.useAapt2 = true
|
// TODO: options.useAapt2 = true
|
||||||
// TODO: options.aaptPath = ""
|
// TODO: options.aaptPath = ""
|
||||||
options.isFramework = metaInfo.isFrameworkApk
|
options.isFramework = metaInfo.isFrameworkApk
|
||||||
options.resourcesAreCompressed = metaInfo.compressionType
|
options.resourcesAreCompressed = metaInfo.compressionType
|
||||||
options.doNotCompress = metaInfo.doNotCompress
|
options.doNotCompress = metaInfo.doNotCompress
|
||||||
|
|
||||||
options
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resources.setSdkInfo(metaInfo.sdkInfo)
|
resources.setSdkInfo(metaInfo.sdkInfo)
|
||||||
resources.setVersionInfo(metaInfo.versionInfo)
|
resources.setVersionInfo(metaInfo.versionInfo)
|
||||||
resources.setSharedLibrary(metaInfo.sharedLibrary)
|
resources.setSharedLibrary(metaInfo.sharedLibrary)
|
||||||
resources.setSparseResources(metaInfo.sparseResources)
|
resources.setSparseResources(metaInfo.sparseResources)
|
||||||
|
|
||||||
resources
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val manifestFile = cacheDirectory.resolve("AndroidManifest.xml")
|
val manifestFile = cacheDirectory.resolve("AndroidManifest.xml")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user