mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-04-30 22:14:25 +02:00
use correct version in root installs
This commit is contained in:
parent
a85ad4ea0e
commit
fd013ab5d7
@ -76,7 +76,8 @@ class PatcherViewModel(
|
||||
private val installedAppRepository: InstalledAppRepository by inject()
|
||||
private val rootInstaller: RootInstaller by inject()
|
||||
|
||||
val installerStatusDialogModel : InstallerStatusDialogModel = object : InstallerStatusDialogModel {
|
||||
val installerStatusDialogModel: InstallerStatusDialogModel =
|
||||
object : InstallerStatusDialogModel {
|
||||
override var packageInstallerStatus: Int? by mutableStateOf(null)
|
||||
|
||||
override fun reinstall() {
|
||||
@ -341,7 +342,8 @@ class PatcherViewModel(
|
||||
// Check if the app version is less than the installed version
|
||||
if (pm.getVersionCode(currentPackageInfo) < pm.getVersionCode(existingPackageInfo)) {
|
||||
// Exit if the selected app version is less than the installed version
|
||||
installerStatusDialogModel.packageInstallerStatus = PackageInstaller.STATUS_FAILURE_CONFLICT
|
||||
installerStatusDialogModel.packageInstallerStatus =
|
||||
PackageInstaller.STATUS_FAILURE_CONFLICT
|
||||
return@launch
|
||||
}
|
||||
}
|
||||
@ -377,20 +379,23 @@ class PatcherViewModel(
|
||||
}
|
||||
}
|
||||
|
||||
val inputVersion = input.selectedApp.version
|
||||
?: inputFile?.let(pm::getPackageInfo)?.versionName
|
||||
?: throw Exception("Failed to determine input APK version")
|
||||
|
||||
// Install as root
|
||||
rootInstaller.install(
|
||||
outputFile,
|
||||
inputFile,
|
||||
packageName,
|
||||
// input.selectedApp.version?
|
||||
packageInfo.versionName!!,
|
||||
inputVersion,
|
||||
label
|
||||
)
|
||||
|
||||
installedAppRepository.addOrUpdate(
|
||||
packageInfo.packageName,
|
||||
packageName,
|
||||
packageInfo.versionName!!,
|
||||
inputVersion,
|
||||
InstallType.MOUNT,
|
||||
input.selectedPatches
|
||||
)
|
||||
@ -410,7 +415,7 @@ class PatcherViewModel(
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(e: Exception) {
|
||||
} catch (e: Exception) {
|
||||
Log.e(tag, "Failed to install", e)
|
||||
app.toast(app.getString(R.string.install_app_fail, e.simpleMessage()))
|
||||
} finally {
|
||||
|
Loading…
x
Reference in New Issue
Block a user