diff --git a/app/src/main/kotlin/com/aliucord/manager/manager/InstallLogManager.kt b/app/src/main/kotlin/com/aliucord/manager/manager/InstallLogManager.kt index 1855564..cff32b8 100644 --- a/app/src/main/kotlin/com/aliucord/manager/manager/InstallLogManager.kt +++ b/app/src/main/kotlin/com/aliucord/manager/manager/InstallLogManager.kt @@ -17,6 +17,7 @@ import kotlinx.serialization.json.decodeFromStream import java.text.SimpleDateFormat import java.util.Date import java.util.Locale +import kotlin.time.Duration /** * Central manager for storing all attempted installations and @@ -51,6 +52,7 @@ class InstallLogManager( suspend fun storeInstallData( id: String, installDate: Instant, + installDuration: Duration, options: PatchOptions, log: String, error: Throwable?, @@ -60,6 +62,7 @@ class InstallLogManager( val data = InstallLogData( id = id, installDate = installDate, + installDuration = installDuration, installOptions = options, environmentInfo = getEnvironmentInfo(), installationLog = log, @@ -103,6 +106,7 @@ class InstallLogManager( data class InstallLogData( val id: String, val installDate: Instant, + val installDuration: Duration, val installOptions: PatchOptions, val environmentInfo: String, val installationLog: String, diff --git a/app/src/main/kotlin/com/aliucord/manager/ui/screens/patching/PatchingScreenModel.kt b/app/src/main/kotlin/com/aliucord/manager/ui/screens/patching/PatchingScreenModel.kt index 8b1b7cd..966fe9b 100644 --- a/app/src/main/kotlin/com/aliucord/manager/ui/screens/patching/PatchingScreenModel.kt +++ b/app/src/main/kotlin/com/aliucord/manager/ui/screens/patching/PatchingScreenModel.kt @@ -27,6 +27,8 @@ import kotlinx.coroutines.* import kotlinx.datetime.Clock import kotlinx.datetime.Instant import java.util.UUID +import kotlin.time.Duration +import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds class PatchingScreenModel( @@ -110,6 +112,7 @@ class PatchingScreenModel( installLogs.storeInstallData( id = installId!!, installDate = startTime!!, + installDuration = Duration.ZERO, options = options, log = "- Failed to initialize patch runner", error = error, @@ -149,6 +152,7 @@ class PatchingScreenModel( installLogs.storeInstallData( id = installId!!, installDate = startTime!!, + installDuration = runner.steps.sumOf { it.getDuration() }.milliseconds, options = options, log = runner.getLog(), error = null, @@ -162,6 +166,7 @@ class PatchingScreenModel( installLogs.storeInstallData( id = installId!!, installDate = startTime!!, + installDuration = runner.steps.sumOf { it.getDuration() }.milliseconds, options = options, log = runner.getLog(), error = error,