fix: specify multithreadingDexFileWriter in PatcherOptions (#1402)

Co-authored-by: Ax333l <main@axelen.xyz>
This commit is contained in:
Benjamin 2023-11-29 13:33:00 -08:00 committed by GitHub
parent 9cab91959e
commit 12b00e5c8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 9 deletions

View File

@ -12,6 +12,7 @@ class PreferencesManager(
val api = stringPreference("api_url", "https://api.revanced.app")
val multithreadingDexFileWriter = booleanPreference("multithreading_dex_file_writer", true)
val allowExperimental = booleanPreference("allow_experimental", false)
val keystoreCommonName = stringPreference("keystore_cn", KeystoreManager.DEFAULT)

View File

@ -20,6 +20,7 @@ class Session(
cacheDir: String,
frameworkDir: String,
aaptPath: String,
multithreadingDexFileWriter: Boolean,
private val logger: ManagerLogger,
private val input: File,
private val onStepSucceeded: suspend () -> Unit
@ -30,7 +31,8 @@ class Session(
inputFile = input,
resourceCachePath = tempDir.resolve("aapt-resources"),
frameworkFileDirectory = frameworkDir,
aaptBinaryPath = aaptPath
aaptBinaryPath = aaptPath,
multithreadingDexFileWriter = multithreadingDexFileWriter,
)
)

View File

@ -219,6 +219,7 @@ class PatcherWorker(
fs.tempDir.absolutePath,
frameworkPath,
aaptPath,
prefs.multithreadingDexFileWriter.get(),
args.logger,
inputFile,
onStepSucceeded = ::updateProgress

View File

@ -70,7 +70,7 @@ fun AdvancedSettingsScreen(
.padding(paddingValues)
.verticalScroll(rememberScrollState())
) {
val apiUrl by vm.apiUrl.getAsState()
val apiUrl by vm.prefs.api.getAsState()
var showApiUrlDialog by rememberSaveable { mutableStateOf(false) }
if (showApiUrlDialog) {
@ -89,11 +89,17 @@ fun AdvancedSettingsScreen(
GroupHeader(stringResource(R.string.patcher))
BooleanItem(
preference = vm.allowExperimental,
preference = vm.prefs.allowExperimental,
coroutineScope = vm.viewModelScope,
headline = R.string.experimental_patches,
description = R.string.experimental_patches_description
)
BooleanItem(
preference = vm.prefs.multithreadingDexFileWriter,
coroutineScope = vm.viewModelScope,
headline = R.string.multithreaded_dex_file_writer,
description = R.string.multithreaded_dex_file_writer_description,
)
GroupHeader(stringResource(R.string.patch_bundles_section))
SettingsListItem(

View File

@ -12,17 +12,14 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
class AdvancedSettingsViewModel(
prefs: PreferencesManager,
val prefs: PreferencesManager,
private val app: Application,
private val patchBundleRepository: PatchBundleRepository
) : ViewModel() {
val apiUrl = prefs.api
val allowExperimental = prefs.allowExperimental
fun setApiUrl(value: String) = viewModelScope.launch(Dispatchers.Default) {
if (value == apiUrl.get()) return@launch
if (value == prefs.api.get()) return@launch
apiUrl.update(value)
prefs.api.update(value)
patchBundleRepository.reloadApiBundles()
}

View File

@ -65,6 +65,8 @@
<string name="dynamic_color_description">Adapt colors to the wallpaper</string>
<string name="theme">Theme</string>
<string name="theme_description">Choose between light or dark theme</string>
<string name="multithreaded_dex_file_writer">Multi-threaded DEX file writer</string>
<string name="multithreaded_dex_file_writer_description">Use multiple cores to write DEX files. This is faster, but uses more memory</string>
<string name="experimental_patches">Allow experimental patches</string>
<string name="experimental_patches_description">Allow patching incompatible patches with experimental versions, something may break</string>
<string name="import_keystore">Import keystore</string>