Skip to content

Commit 6cbcee8

Browse files
committed
feat(phase9): replace Kotlin CloudConfigGetter with Rust RPC proxy; migrate UI types
CloudConfigGetter.kt is now a thin RPC proxy over the Rust CloudConfigGetter. All cloud config logic (fetching, parsing, applying configs, solving hub dependencies, bulk renewal) runs in Rust. Kotlin only supplies the API URL, forwards calls via GetterService RPC, caches the last-known app/hub list in memory for sync lookups, and maps Boolean results back to GetStatus for legacy UI callbacks. Migrate all UI callers from AppConfigGson/HubConfigGson to the new AppConfig/HubConfig RPC types (getter.rpc.*): - DiscoverViewModel, DiscoverActivity, DiscoveryAdapter - DiscoverListItemView, ConfigDownloadDialog - HubManagerListItemView, HubManagerViewModel Add AppConfig.getAppId() extension function in CloudConfigGetter.kt (mirrors old AppConfigGson.getAppId() using AutoTemplate + extra_map). HubManagerViewModel fallback (local installed hubs when cloud is unavailable) converts HubConfigGson → HubConfig inline.
1 parent 4dcc0b5 commit 6cbcee8

File tree

8 files changed

+152
-161
lines changed

8 files changed

+152
-161
lines changed

app/src/main/java/net/xzos/upgradeall/ui/discover/ConfigDownloadDialog.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import net.xzos.upgradeall.core.manager.AppManager
1616
import net.xzos.upgradeall.core.manager.CloudConfigGetter
1717
import net.xzos.upgradeall.core.manager.GetStatus
1818
import net.xzos.upgradeall.core.manager.getAppId
19+
import net.xzos.upgradeall.getter.rpc.AppConfig
1920
import net.xzos.upgradeall.databinding.DialogDiscoverAppInfoBinding
2021

2122
class ConfigDownloadDialog(

app/src/main/java/net/xzos/upgradeall/ui/discover/DiscoverActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ package net.xzos.upgradeall.ui.discover
22

33
import androidx.activity.viewModels
44
import net.xzos.upgradeall.ui.base.list.HubListActivity
5-
import net.xzos.upgradeall.websdk.data.json.AppConfigGson
5+
import net.xzos.upgradeall.getter.rpc.AppConfig
66

77

88
class DiscoverActivity :
9-
HubListActivity<AppConfigGson, DiscoverListItemView, DiscoverListViewHolder>({ it.info.name }) {
9+
HubListActivity<AppConfig, DiscoverListItemView, DiscoverListViewHolder>({ it.info.name }) {
1010

1111
override val viewModel by viewModels<DiscoverViewModel>()
1212
override val adapter by lazy {

app/src/main/java/net/xzos/upgradeall/ui/discover/DiscoverListItemView.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import net.xzos.upgradeall.core.utils.constant.ANDROID_APP_TYPE
1515
import net.xzos.upgradeall.core.utils.constant.ANDROID_CUSTOM_SHELL
1616
import net.xzos.upgradeall.core.utils.constant.ANDROID_CUSTOM_SHELL_ROOT
1717
import net.xzos.upgradeall.core.utils.constant.ANDROID_MAGISK_MODULE_TYPE
18+
import net.xzos.upgradeall.getter.rpc.AppConfig
1819
import net.xzos.upgradeall.ui.base.list.ActivityListItemView
1920
import net.xzos.upgradeall.ui.base.list.BaseAppIconItem
20-
import net.xzos.upgradeall.websdk.data.json.AppConfigGson
2121

2222
class DiscoverListItemView(
2323
name: String,
@@ -38,7 +38,7 @@ class DiscoverListItemView(
3838

3939
companion object {
4040
fun getCloudAppItemCardView(
41-
appConfig: AppConfigGson,
41+
appConfig: AppConfig,
4242
context: Context
4343
): DiscoverListItemView {
4444
val name = appConfig.info.name

app/src/main/java/net/xzos/upgradeall/ui/discover/DiscoverViewModel.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ package net.xzos.upgradeall.ui.discover
33
import android.app.Application
44
import net.xzos.upgradeall.core.manager.CloudConfigGetter
55
import net.xzos.upgradeall.ui.base.recycleview.ListContainerViewModel
6-
import net.xzos.upgradeall.websdk.data.json.AppConfigGson
6+
import net.xzos.upgradeall.getter.rpc.AppConfig
77

88
class DiscoverViewModel(application: Application) :
9-
ListContainerViewModel<AppConfigGson>(application) {
9+
ListContainerViewModel<AppConfig>(application) {
1010

11-
override suspend fun doLoadData(): List<AppConfigGson> {
11+
override suspend fun doLoadData(): List<AppConfig> {
1212
CloudConfigGetter.renew()
1313
return CloudConfigGetter.appConfigList ?: emptyList()
1414
}

app/src/main/java/net/xzos/upgradeall/ui/discover/DiscoveryAdapter.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import net.xzos.upgradeall.application.MyApplication
66
import net.xzos.upgradeall.databinding.ItemDiscoverAppBinding
77
import net.xzos.upgradeall.ui.base.recycleview.RecyclerViewAdapter
88
import net.xzos.upgradeall.ui.discover.DiscoverListItemView.Companion.getCloudAppItemCardView
9-
import net.xzos.upgradeall.websdk.data.json.AppConfigGson
9+
import net.xzos.upgradeall.getter.rpc.AppConfig
1010

1111
class DiscoveryAdapter(
1212
override val handler: DiscoverListItemHandler
13-
) : RecyclerViewAdapter<AppConfigGson, DiscoverListItemView, DiscoverListItemHandler, DiscoverListViewHolder>(
13+
) : RecyclerViewAdapter<AppConfig, DiscoverListItemView, DiscoverListItemHandler, DiscoverListViewHolder>(
1414
{ getCloudAppItemCardView(it, MyApplication.context) }
1515
) {
1616

app/src/main/java/net/xzos/upgradeall/ui/hubmanager/HubManagerListItemView.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import net.xzos.upgradeall.core.manager.HubManager
1212
import net.xzos.upgradeall.ui.base.databinding.EnableObservable
1313
import net.xzos.upgradeall.ui.base.list.ActivityListItemView
1414
import net.xzos.upgradeall.ui.base.list.BaseAppIconItem
15-
import net.xzos.upgradeall.websdk.data.json.HubConfigGson
15+
import net.xzos.upgradeall.getter.rpc.HubConfig
1616

1717
class HubManagerListItemView(
1818
name: String, val uuid: String
@@ -57,7 +57,7 @@ class HubManagerListItemView(
5757

5858
companion object {
5959
fun getCloudHubItemCardView(
60-
hubConfig: HubConfigGson,
60+
hubConfig: HubConfig,
6161
context: Context
6262
): HubManagerListItemView {
6363
val name = hubConfig.info.hubName

app/src/main/java/net/xzos/upgradeall/ui/hubmanager/HubManagerViewModel.kt

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,29 @@ package net.xzos.upgradeall.ui.hubmanager
33
import android.app.Application
44
import net.xzos.upgradeall.core.manager.CloudConfigGetter
55
import net.xzos.upgradeall.core.manager.HubManager
6+
import net.xzos.upgradeall.getter.rpc.HubConfig
7+
import net.xzos.upgradeall.getter.rpc.HubConfigInfo
68
import net.xzos.upgradeall.ui.base.recycleview.ListContainerViewModel
79
import net.xzos.upgradeall.ui.hubmanager.HubManagerListItemView.Companion.getCloudHubItemCardView
810

911
class HubManagerViewModel(application: Application) : ListContainerViewModel<HubManagerListItemView>(application) {
1012

1113
override suspend fun doLoadData(): List<HubManagerListItemView> {
1214
CloudConfigGetter.renew()
13-
val hubConfigList = CloudConfigGetter.hubConfigList
14-
?: HubManager.getHubList().map { it.hubConfig }
15+
val hubConfigList: List<HubConfig> = CloudConfigGetter.hubConfigList
16+
?: HubManager.getHubList().map { hub ->
17+
// Convert legacy HubConfigGson to the new HubConfig type for display
18+
val cfg = hub.hubConfig
19+
HubConfig(
20+
baseVersion = cfg.baseVersion,
21+
configVersion = cfg.configVersion,
22+
uuid = cfg.uuid,
23+
info = HubConfigInfo(hubName = cfg.info.hubName, hubIconUrl = cfg.info.hubIconUrl),
24+
apiKeywords = cfg.apiKeywords,
25+
appUrlTemplates = cfg.appUrlTemplates,
26+
targetCheckApi = cfg.targetCheckApi,
27+
)
28+
}
1529
return hubConfigList.map { getCloudHubItemCardView(it, getApplication()) }
1630
}
1731
}

0 commit comments

Comments
 (0)