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