Add app settings with update track and auto-check options

- Add AppSettingsScreen with update track selection and auto-check toggle
- Remove checkUpdateAvailable() as all vendors now support update checking
- Add missing Chinese translations for update-related strings
This commit is contained in:
世界
2025-12-16 18:25:10 +08:00
parent be175ccd73
commit e2e2c2ca7b
21 changed files with 862 additions and 21 deletions

View File

@@ -12,14 +12,12 @@ import com.google.android.play.core.install.model.InstallStatus
import com.google.android.play.core.install.model.UpdateAvailability
import com.google.mlkit.common.MlKitException
import io.nekohasekai.sfa.R
import io.nekohasekai.sfa.update.UpdateInfo
import io.nekohasekai.sfa.update.UpdateState
object Vendor : VendorInterface {
private const val TAG = "Vendor"
override fun checkUpdateAvailable(): Boolean {
return true
}
override fun checkUpdate(
activity: Activity,
byUser: Boolean,
@@ -30,6 +28,7 @@ object Vendor : VendorInterface {
when (appUpdateInfo.updateAvailability()) {
UpdateAvailability.UPDATE_NOT_AVAILABLE -> {
Log.d(TAG, "checkUpdate: not available")
UpdateState.clear()
if (byUser) activity.showNoUpdatesDialog()
}
@@ -44,6 +43,7 @@ object Vendor : VendorInterface {
UpdateAvailability.UPDATE_AVAILABLE -> {
Log.d(TAG, "checkUpdate: available")
UpdateState.hasUpdate.value = true
if (appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) {
appUpdateManager.startUpdateFlow(
appUpdateInfo,
@@ -97,4 +97,15 @@ object Vendor : VendorInterface {
// Per-app Proxy is disabled for Play Store builds due to QUERY_ALL_PACKAGES permission restriction
return false
}
override fun supportsTrackSelection(): Boolean {
// Play Store doesn't support track selection
return false
}
override fun checkUpdateAsync(): UpdateInfo? {
// Play Store updates are handled by the Play Core library
// We can't get version info in the same way as GitHub
return null
}
}