Add force refresh to get module list after installing a module
This commit is contained in:
@@ -47,6 +47,8 @@ import com.sukisu.ultra.ui.component.KeyEventBlocker
|
||||
import com.sukisu.ultra.ui.util.*
|
||||
import com.sukisu.ultra.R
|
||||
import com.sukisu.ultra.ui.theme.CardConfig
|
||||
import com.sukisu.ultra.ui.viewmodel.ModuleViewModel
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import java.io.File
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
@@ -109,6 +111,7 @@ fun FlashScreen(navigator: DestinationsNavigator, flashIt: FlashIt) {
|
||||
val scope = rememberCoroutineScope()
|
||||
val scrollState = rememberScrollState()
|
||||
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(rememberTopAppBarState())
|
||||
val viewModel: ModuleViewModel = viewModel()
|
||||
|
||||
val errorCodeString = stringResource(R.string.error_code)
|
||||
val checkLogString = stringResource(R.string.check_log)
|
||||
@@ -162,6 +165,7 @@ fun FlashScreen(navigator: DestinationsNavigator, flashIt: FlashIt) {
|
||||
}
|
||||
} else {
|
||||
setFlashingStatus(FlashingStatus.SUCCESS)
|
||||
viewModel.markNeedRefresh()
|
||||
}
|
||||
if (showReboot) {
|
||||
text += "\n\n\n"
|
||||
@@ -196,6 +200,8 @@ fun FlashScreen(navigator: DestinationsNavigator, flashIt: FlashIt) {
|
||||
if (flashIt is FlashIt.FlashBoot) {
|
||||
navigator.popBackStack()
|
||||
} else {
|
||||
viewModel.markNeedRefresh()
|
||||
viewModel.fetchModuleList()
|
||||
navigator.navigate(ModuleScreenDestination) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
package com.sukisu.ultra.ui.screen
|
||||
|
||||
import androidx.compose.animation.*
|
||||
import androidx.compose.animation.core.*
|
||||
import androidx.compose.foundation.background
|
||||
@@ -514,9 +516,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
|
||||
val profile = Natives.getAppProfile(app.packageName, app.uid)
|
||||
val updatedProfile = profile.copy(allowSu = allowSu)
|
||||
if (Natives.setAppProfile(updatedProfile)) {
|
||||
// 不重新获取应用列表,避免滚动位置重置
|
||||
// viewModel.fetchAppList()
|
||||
// 仅更新当前应用的配置
|
||||
viewModel.updateAppProfileLocally(app.packageName, updatedProfile)
|
||||
}
|
||||
}
|
||||
@@ -556,9 +555,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
|
||||
val profile = Natives.getAppProfile(app.packageName, app.uid)
|
||||
val updatedProfile = profile.copy(allowSu = allowSu)
|
||||
if (Natives.setAppProfile(updatedProfile)) {
|
||||
// 不重新获取应用列表,避免滚动位置重置
|
||||
// viewModel.fetchAppList()
|
||||
// 仅更新当前应用的配置
|
||||
viewModel.updateAppProfileLocally(app.packageName, updatedProfile)
|
||||
}
|
||||
}
|
||||
@@ -598,9 +594,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
|
||||
val profile = Natives.getAppProfile(app.packageName, app.uid)
|
||||
val updatedProfile = profile.copy(allowSu = allowSu)
|
||||
if (Natives.setAppProfile(updatedProfile)) {
|
||||
// 不重新获取应用列表,避免滚动位置重置
|
||||
// viewModel.fetchAppList()
|
||||
// 仅更新当前应用的配置
|
||||
viewModel.updateAppProfileLocally(app.packageName, updatedProfile)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.sukisu.ultra.ui.screen
|
||||
|
||||
import LabelText
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.widget.Toast
|
||||
|
||||
@@ -360,9 +360,9 @@
|
||||
<string name="select">seçenek</string>
|
||||
<string name="profile_umount_modules_disable">Özel kaldırma modülünü devre dışı bırak</string>
|
||||
<!-- Flash related -->
|
||||
<string name="error_code">error code</string>
|
||||
<string name="check_log">Please check the log</string>
|
||||
<string name="installing_module">Module being installed %1$d/%2$d</string>
|
||||
<string name="module_failed_count">%d Failed to install a new module</string>
|
||||
<string name="module_download_error">Module download failed</string>
|
||||
<string name="error_code">hata kodu</string>
|
||||
<string name="check_log">Lütfen günlüğü kontrol edin</string>
|
||||
<string name="installing_module">Modül yükleniyor %1$d/%2$d</string>
|
||||
<string name="module_failed_count">Yeni bir modül yüklenemedi: %d başarısız</string>
|
||||
<string name="module_download_error">Modül indirilemedi</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user