diff --git a/l10n_arb/intl_zh_CN.arb b/l10n_arb/intl_zh_CN.arb index ceebde7..af04bcd 100644 --- a/l10n_arb/intl_zh_CN.arb +++ b/l10n_arb/intl_zh_CN.arb @@ -81,10 +81,6 @@ "APP_TYPE": "类型", "APP_TYPE_UNSPECIFIED": "未知", "APP_TYPE_GAME": "游戏", - "APP_PACKAGE_SOURCE": "来源", - "APP_PACKAGE_SOURCE_UNSPECIFIED": "未知", - "APP_PACKAGE_SOURCE_MANUAL": "手动", - "APP_PACKAGE_SOURCE_SENTINEL": "扫描", "FEED_CONFIG_STATUS": "状态", "FEED_CONFIG_STATUS_UNSPECIFIED": "未知", "FEED_CONFIG_STATUS_ACTIVE": "启用", diff --git a/lib/bloc/gebura/gebura_bloc.dart b/lib/bloc/gebura/gebura_bloc.dart index c986ee0..66a66c3 100644 --- a/lib/bloc/gebura/gebura_bloc.dart +++ b/lib/bloc/gebura/gebura_bloc.dart @@ -27,16 +27,16 @@ class GeburaBloc extends Bloc { GeburaBloc(this._api, this._repo) : super(GeburaState()) { on((event, emit) async { if (state.purchasedApps == null) { - add(GeburaPurchasedAppsLoadEvent()); + add(GeburaPurchasedAppInfosLoadEvent()); add(GeburaScanLocalLibraryEvent()); } }); - on((event, emit) async { + on((event, emit) async { emit(GeburaPurchasedAppsLoadState(state, EventStatus.processing)); final resp = await _api.doRequest( - (client) => client.getPurchasedApps, - GetPurchasedAppsRequest(), + (client) => client.getPurchasedAppInfos, + GetPurchasedAppInfosRequest(), ); if (resp.status != ApiStatus.success) { emit(GeburaPurchasedAppsLoadState(state, EventStatus.failed, @@ -44,27 +44,27 @@ class GeburaBloc extends Bloc { return; } emit(GeburaPurchasedAppsLoadState( - state.copyWith(purchasedApps: resp.getData().apps), + state.copyWith(purchasedApps: resp.getData().appInfos), EventStatus.success, msg: resp.error)); }, transformer: droppable()); - on((event, emit) async { + on((event, emit) async { final newState = state.copyWith(); newState.selectedPurchasedAppIndex = event.index; emit(newState); }); - on((event, emit) async { + on((event, emit) async { emit(GeburaSearchAppsState(state, EventStatus.processing)); final resp = await _api.doRequest( - (client) => client.searchApps, - SearchAppsRequest( + (client) => client.searchAppInfos, + SearchAppInfosRequest( paging: PagingRequest( pageSize: Int64(10), pageNum: Int64(1), ), - keywords: event.query, + query: event.query, ), ); if (resp.status != ApiStatus.success) { @@ -75,16 +75,16 @@ class GeburaBloc extends Bloc { state, EventStatus.success, msg: resp.error, - apps: resp.getData().apps, + apps: resp.getData().appInfos, )); }, transformer: droppable()); on((event, emit) async { emit(GeburaPurchaseState(state, EventStatus.processing)); final resp = await _api.doRequest( - (client) => client.purchaseApp, - PurchaseAppRequest( - appId: AppID( + (client) => client.purchaseAppInfo, + PurchaseAppInfoRequest( + appInfoId: AppInfoID( internal: true, sourceAppId: event.id.id.toString(), ), @@ -95,7 +95,7 @@ class GeburaBloc extends Bloc { return; } emit(GeburaPurchaseState(state, EventStatus.success, msg: resp.error)); - add(GeburaPurchasedAppsLoadEvent()); + add(GeburaPurchasedAppInfosLoadEvent()); }, transformer: droppable()); on((event, emit) async { @@ -104,12 +104,12 @@ class GeburaBloc extends Bloc { emit(GeburaSetAppLauncherSettingState(state, EventStatus.success)); }); - on((event, emit) async { + on((event, emit) async { emit(GeburaAddAppState(state, EventStatus.processing)); final resp = await _api.doRequest( - (client) => client.createApp, - CreateAppRequest( - app: event.app, + (client) => client.createAppInfo, + CreateAppInfoRequest( + appInfo: event.appInfo, ), ); if (resp.status != ApiStatus.success) { @@ -119,12 +119,12 @@ class GeburaBloc extends Bloc { emit(GeburaAddAppState(state, EventStatus.success, msg: resp.error)); }, transformer: droppable()); - on((event, emit) async { + on((event, emit) async { emit(GeburaEditAppState(state, EventStatus.processing)); final resp = await _api.doRequest( - (client) => client.updateApp, - UpdateAppRequest( - app: event.app, + (client) => client.updateAppInfo, + UpdateAppInfoRequest( + appInfo: event.appInfo, ), ); if (resp.status != ApiStatus.success) { @@ -134,12 +134,12 @@ class GeburaBloc extends Bloc { emit(GeburaEditAppState(state, EventStatus.success, msg: resp.error)); }, transformer: droppable()); - on((event, emit) async { + on((event, emit) async { emit(GeburaAddAppPackageState(state, EventStatus.processing)); final resp = await _api.doRequest( - (client) => client.createAppPackage, - CreateAppPackageRequest( - appPackage: event.appPackage, + (client) => client.createApp, + CreateAppRequest( + app: event.app, ), ); if (resp.status != ApiStatus.success) { @@ -151,12 +151,12 @@ class GeburaBloc extends Bloc { msg: resp.error)); }, transformer: droppable()); - on((event, emit) async { + on((event, emit) async { emit(GeburaEditAppPackageState(state, EventStatus.processing)); final resp = await _api.doRequest( - (client) => client.updateAppPackage, - UpdateAppPackageRequest( - appPackage: event.appPackage, + (client) => client.updateApp, + UpdateAppRequest( + app: event.app, ), ); if (resp.status != ApiStatus.success) { @@ -168,13 +168,13 @@ class GeburaBloc extends Bloc { msg: resp.error)); }, transformer: droppable()); - on((event, emit) async { + on((event, emit) async { emit(GeburaAssignAppPackageState(state, EventStatus.processing)); final resp = await _api.doRequest( - (client) => client.assignAppPackage, - AssignAppPackageRequest( + (client) => client.assignApp, + AssignAppRequest( + appInfoId: event.appInfoID, appId: event.appID, - appPackageId: event.appPackageID, ), ); if (resp.status != ApiStatus.success) { @@ -284,16 +284,19 @@ class GeburaBloc extends Bloc { continue; } await _api.doRequest( - (client) => client.syncApps, - SyncAppsRequest( - appIds: [AppID(internal: false, source: 'steam', sourceAppId: app)], + (client) => client.syncAppInfos, + SyncAppInfosRequest( + appInfoIds: [ + AppInfoID(internal: false, source: 'steam', sourceAppId: app) + ], waitData: true, ), ); final purchaseResp = await _api.doRequest( - (client) => client.purchaseApp, - PurchaseAppRequest( - appId: AppID(internal: false, source: 'steam', sourceAppId: app), + (client) => client.purchaseAppInfo, + PurchaseAppInfoRequest( + appInfoId: + AppInfoID(internal: false, source: 'steam', sourceAppId: app), ), ); if (purchaseResp.status != ApiStatus.success) { @@ -301,10 +304,9 @@ class GeburaBloc extends Bloc { continue; } final createResp = await _api.doRequest( - (client) => client.createAppPackage, - CreateAppPackageRequest( - appPackage: AppPackage( - source: AppPackageSource.APP_PACKAGE_SOURCE_MANUAL, + (client) => client.createApp, + CreateAppRequest( + app: App( name: (state.localSteamApps ?? []) .firstWhere((element) => element.appId == app) .name, @@ -316,10 +318,10 @@ class GeburaBloc extends Bloc { continue; } final assignResp = await _api.doRequest( - (client) => client.assignAppPackage, - AssignAppPackageRequest( - appId: purchaseResp.getData().id, - appPackageId: createResp.getData().id, + (client) => client.assignApp, + AssignAppRequest( + appInfoId: purchaseResp.getData().id, + appId: createResp.getData().id, ), ); if (assignResp.status != ApiStatus.success) { @@ -332,7 +334,7 @@ class GeburaBloc extends Bloc { )); } await _repo.setImportedSteamApps(importedSteamApps); - add(GeburaPurchasedAppsLoadEvent()); + add(GeburaPurchasedAppInfosLoadEvent()); emit(GeburaImportSteamAppsState( state.copyWith( localLibraryState: S.current.importSteamApplicationFinished( @@ -342,12 +344,12 @@ class GeburaBloc extends Bloc { EventStatus.success)); }, transformer: droppable()); - on((event, emit) async { + on((event, emit) async { emit(GeburaFetchBoundAppsState(state, EventStatus.processing)); final resp = await _api.doRequest( - (client) => client.getBoundApps, - GetBoundAppsRequest( - appId: event.appID, + (client) => client.getBoundAppInfos, + GetBoundAppInfosRequest( + appInfoId: event.appID, ), ); if (resp.status != ApiStatus.success) { @@ -356,7 +358,7 @@ class GeburaBloc extends Bloc { return; } final storeApps = state.storeApps ?? {}; - storeApps[event.appID] = resp.getData().apps; + storeApps[event.appID] = resp.getData().appInfos; emit(GeburaFetchBoundAppsState( state.copyWith(storeApps: storeApps), EventStatus.success, @@ -369,11 +371,11 @@ class GeburaBloc extends Bloc { return _repo.getAppLauncherSetting(id.id.toInt()); } - Future listApps( + Future listAppInfos( int pageSize, int pageNum, List sourceFilter) async { final resp = await _api.doRequest( - (client) => client.listApps, - ListAppsRequest( + (client) => client.listAppInfos, + ListAppInfosRequest( paging: PagingRequest(pageSize: Int64(pageSize), pageNum: Int64(pageNum)), sourceFilter: sourceFilter, @@ -382,28 +384,26 @@ class GeburaBloc extends Bloc { return resp.getData(); } - Future listAppPackages( - int pageSize, int pageNum, List sourceFilter) async { + Future listApps(int pageSize, int pageNum) async { final resp = await _api.doRequest( - (client) => client.listAppPackages, - ListAppPackagesRequest( + (client) => client.listApps, + ListAppsRequest( paging: PagingRequest(pageSize: Int64(pageSize), pageNum: Int64(pageNum)), - sourceFilter: sourceFilter, ), ); return resp.getData(); } } -App mixApp(List apps) { - var mixedApp = App(); +AppInfo mixAppInfo(List apps) { + var mixedApp = AppInfo(); if (apps.isEmpty) { return mixedApp; } mixedApp = apps.where((element) => element.internal).isNotEmpty ? apps.firstWhere((element) => element.internal) - : App(); + : AppInfo(); for (final app in apps.where((element) => !element.internal)) { mixedApp.name = app.name.isNotEmpty ? app.name : mixedApp.name; mixedApp.shortDescription = app.shortDescription.isNotEmpty diff --git a/lib/bloc/gebura/gebura_event.dart b/lib/bloc/gebura/gebura_event.dart index 67550ea..0d09deb 100644 --- a/lib/bloc/gebura/gebura_event.dart +++ b/lib/bloc/gebura/gebura_event.dart @@ -5,18 +5,18 @@ sealed class GeburaEvent {} final class GeburaInitEvent extends GeburaEvent {} -final class GeburaPurchasedAppsLoadEvent extends GeburaEvent {} +final class GeburaPurchasedAppInfosLoadEvent extends GeburaEvent {} -final class GeburaSetPurchasedAppIndexEvent extends GeburaEvent { +final class GeburaSetPurchasedAppInfoIndexEvent extends GeburaEvent { final int? index; - GeburaSetPurchasedAppIndexEvent(this.index); + GeburaSetPurchasedAppInfoIndexEvent(this.index); } -final class GeburaSearchAppsEvent extends GeburaEvent { +final class GeburaSearchAppInfosEvent extends GeburaEvent { final String query; - GeburaSearchAppsEvent(this.query); + GeburaSearchAppInfosEvent(this.query); } final class GeburaPurchaseEvent extends GeburaEvent { @@ -31,35 +31,35 @@ final class GeburaSetAppLauncherSettingEvent extends GeburaEvent { GeburaSetAppLauncherSettingEvent(this.setting); } -final class GeburaAddAppEvent extends GeburaEvent { - final App app; +final class GeburaAddAppInfoEvent extends GeburaEvent { + final AppInfo appInfo; - GeburaAddAppEvent(this.app); + GeburaAddAppInfoEvent(this.appInfo); } -final class GeburaEditAppEvent extends GeburaEvent { - final App app; +final class GeburaEditAppInfoEvent extends GeburaEvent { + final AppInfo appInfo; - GeburaEditAppEvent(this.app); + GeburaEditAppInfoEvent(this.appInfo); } -final class GeburaAddAppPackageEvent extends GeburaEvent { - final AppPackage appPackage; +final class GeburaAddAppEvent extends GeburaEvent { + final App app; - GeburaAddAppPackageEvent(this.appPackage); + GeburaAddAppEvent(this.app); } -final class GeburaEditAppPackageEvent extends GeburaEvent { - final AppPackage appPackage; +final class GeburaEditAppEvent extends GeburaEvent { + final App app; - GeburaEditAppPackageEvent(this.appPackage); + GeburaEditAppEvent(this.app); } -final class GeburaAssignAppPackageEvent extends GeburaEvent { - final InternalID appPackageID; +final class GeburaAssignAppEvent extends GeburaEvent { final InternalID appID; + final InternalID appInfoID; - GeburaAssignAppPackageEvent(this.appPackageID, this.appID); + GeburaAssignAppEvent(this.appID, this.appInfoID); } final class GeburaRunAppEvent extends GeburaEvent { @@ -76,8 +76,8 @@ final class GeburaImportSteamAppsEvent extends GeburaEvent { GeburaImportSteamAppsEvent(this.appIDs); } -final class GeburaFetchBoundAppsEvent extends GeburaEvent { +final class GeburaFetchBoundAppInfosEvent extends GeburaEvent { final InternalID appID; - GeburaFetchBoundAppsEvent(this.appID); + GeburaFetchBoundAppInfosEvent(this.appID); } diff --git a/lib/bloc/gebura/gebura_state.dart b/lib/bloc/gebura/gebura_state.dart index 01d4eb8..fab0a95 100644 --- a/lib/bloc/gebura/gebura_state.dart +++ b/lib/bloc/gebura/gebura_state.dart @@ -1,10 +1,10 @@ part of 'gebura_bloc.dart'; class GeburaState { - late List? purchasedApps; + late List? purchasedApps; late int? selectedPurchasedAppIndex; - late Map>? storeApps; + late Map>? storeApps; late Map? runState; late String? localLibraryState; @@ -26,9 +26,9 @@ class GeburaState { }); GeburaState copyWith({ - List? purchasedApps, + List? purchasedApps, int? selectedPurchasedAppIndex, - Map>? storeApps, + Map>? storeApps, Map? runState, String? localLibraryState, SteamScanResult? localSteamScanResult, @@ -83,7 +83,7 @@ class GeburaSearchAppsState extends GeburaState with EventStatusMixin { _from(state); } - final List? apps; + final List? apps; @override final EventStatus? statusCode; diff --git a/lib/l10n/intl/messages_en-US.dart b/lib/l10n/intl/messages_en-US.dart index fba1d82..fef103f 100644 --- a/lib/l10n/intl/messages_en-US.dart +++ b/lib/l10n/intl/messages_en-US.dart @@ -49,13 +49,6 @@ class MessageLookup extends MessageLookupByLibrary { "ACCOUNT_PLATFORM_STEAM": MessageLookupByLibrary.simpleMessage("Steam"), "ACCOUNT_PLATFORM_UNSPECIFIED": MessageLookupByLibrary.simpleMessage("Unspecified"), - "APP_PACKAGE_SOURCE": MessageLookupByLibrary.simpleMessage("Source"), - "APP_PACKAGE_SOURCE_MANUAL": - MessageLookupByLibrary.simpleMessage("Manual"), - "APP_PACKAGE_SOURCE_SENTINEL": - MessageLookupByLibrary.simpleMessage("Sentinel"), - "APP_PACKAGE_SOURCE_UNSPECIFIED": - MessageLookupByLibrary.simpleMessage("Unspecified"), "APP_SOURCE": MessageLookupByLibrary.simpleMessage("Source"), "APP_SOURCE_INTERNAL": MessageLookupByLibrary.simpleMessage("Internal"), "APP_SOURCE_STEAM": MessageLookupByLibrary.simpleMessage("Steam"), diff --git a/lib/l10n/intl/messages_zh-CN.dart b/lib/l10n/intl/messages_zh-CN.dart index edbf991..d464c87 100644 --- a/lib/l10n/intl/messages_zh-CN.dart +++ b/lib/l10n/intl/messages_zh-CN.dart @@ -49,12 +49,6 @@ class MessageLookup extends MessageLookupByLibrary { "ACCOUNT_PLATFORM_STEAM": MessageLookupByLibrary.simpleMessage("Steam"), "ACCOUNT_PLATFORM_UNSPECIFIED": MessageLookupByLibrary.simpleMessage("未知"), - "APP_PACKAGE_SOURCE": MessageLookupByLibrary.simpleMessage("来源"), - "APP_PACKAGE_SOURCE_MANUAL": MessageLookupByLibrary.simpleMessage("手动"), - "APP_PACKAGE_SOURCE_SENTINEL": - MessageLookupByLibrary.simpleMessage("扫描"), - "APP_PACKAGE_SOURCE_UNSPECIFIED": - MessageLookupByLibrary.simpleMessage("未知"), "APP_SOURCE": MessageLookupByLibrary.simpleMessage("来源"), "APP_SOURCE_INTERNAL": MessageLookupByLibrary.simpleMessage("内置"), "APP_SOURCE_STEAM": MessageLookupByLibrary.simpleMessage("Steam"), diff --git a/lib/l10n/l10n.dart b/lib/l10n/l10n.dart index 51af892..e6c5a26 100644 --- a/lib/l10n/l10n.dart +++ b/lib/l10n/l10n.dart @@ -810,46 +810,6 @@ class S { ); } - /// `来源` - String get APP_PACKAGE_SOURCE { - return Intl.message( - '来源', - name: 'APP_PACKAGE_SOURCE', - desc: '', - args: [], - ); - } - - /// `未知` - String get APP_PACKAGE_SOURCE_UNSPECIFIED { - return Intl.message( - '未知', - name: 'APP_PACKAGE_SOURCE_UNSPECIFIED', - desc: '', - args: [], - ); - } - - /// `手动` - String get APP_PACKAGE_SOURCE_MANUAL { - return Intl.message( - '手动', - name: 'APP_PACKAGE_SOURCE_MANUAL', - desc: '', - args: [], - ); - } - - /// `扫描` - String get APP_PACKAGE_SOURCE_SENTINEL { - return Intl.message( - '扫描', - name: 'APP_PACKAGE_SOURCE_SENTINEL', - desc: '', - args: [], - ); - } - /// `状态` String get FEED_CONFIG_STATUS { return Intl.message( diff --git a/lib/repo/grpc/l10n.dart b/lib/repo/grpc/l10n.dart index 335a95b..a75bfda 100644 --- a/lib/repo/grpc/l10n.dart +++ b/lib/repo/grpc/l10n.dart @@ -61,18 +61,6 @@ String appTypeString(AppType type) { return ''; } -String appPackageSourceString(AppPackageSource source) { - switch (source) { - case AppPackageSource.APP_PACKAGE_SOURCE_UNSPECIFIED: - return S.current.APP_PACKAGE_SOURCE_UNSPECIFIED; - case AppPackageSource.APP_PACKAGE_SOURCE_MANUAL: - return S.current.APP_PACKAGE_SOURCE_MANUAL; - case AppPackageSource.APP_PACKAGE_SOURCE_SENTINEL: - return S.current.APP_PACKAGE_SOURCE_SENTINEL; - } - return ''; -} - String feedConfigStatusString(FeedConfigStatus status) { switch (status) { case FeedConfigStatus.FEED_CONFIG_STATUS_UNSPECIFIED: diff --git a/lib/route.dart b/lib/route.dart index 92e8a5a..50e5b66 100644 --- a/lib/route.dart +++ b/lib/route.dart @@ -4,6 +4,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:go_router/go_router.dart'; +import 'package:tuihub_protos/librarian/sephirah/v1/gebura.pb.dart'; import 'package:tuihub_protos/librarian/sephirah/v1/tiphereth.pb.dart'; import 'package:tuihub_protos/librarian/v1/common.pb.dart'; @@ -512,14 +513,15 @@ GoRouter getRouter(MainBloc mainBloc, ApiHelper apiHelper) { _SettingsActions.appAdd: const AppAddPage(), _SettingsActions.appEdit: AppEditPage( key: ValueKey(state.extra), - app: state.extra is App ? state.extra! as App : App(), + app: state.extra is AppInfo + ? state.extra! as AppInfo + : AppInfo(), ), _SettingsActions.appPackageAdd: const AppPackageAddPage(), _SettingsActions.appPackageEdit: AppPackageEditPage( key: ValueKey(state.extra), - appPackage: state.extra is AppPackage - ? state.extra! as AppPackage - : AppPackage(), + appPackage: + state.extra is App ? state.extra! as App : App(), ), }; return NoTransitionPage( diff --git a/lib/view/pages/gebura/gebura_library_detail.dart b/lib/view/pages/gebura/gebura_library_detail.dart index 02f1186..5759e02 100644 --- a/lib/view/pages/gebura/gebura_library_detail.dart +++ b/lib/view/pages/gebura/gebura_library_detail.dart @@ -37,7 +37,7 @@ class GeburaLibraryDetailPage extends StatelessWidget { if (firstBuild && (state.storeApps == null || state.storeApps![app.id] == null)) { firstBuild = false; - context.read().add(GeburaFetchBoundAppsEvent(app.id)); + context.read().add(GeburaFetchBoundAppInfosEvent(app.id)); } return Scaffold( backgroundColor: Colors.transparent, diff --git a/lib/view/pages/gebura/gebura_library_overview.dart b/lib/view/pages/gebura/gebura_library_overview.dart index 8e51bdd..119e4d4 100644 --- a/lib/view/pages/gebura/gebura_library_overview.dart +++ b/lib/view/pages/gebura/gebura_library_overview.dart @@ -88,7 +88,7 @@ class _GeburaLibraryOverviewItem extends StatefulWidget { const _GeburaLibraryOverviewItem({required this.index, required this.item}); final int index; - final AppMixed item; + final AppInfoMixed item; @override State<_GeburaLibraryOverviewItem> createState() => @@ -106,7 +106,7 @@ class _GeburaLibraryOverviewItemState onTap: () { context .read() - .add(GeburaSetPurchasedAppIndexEvent(widget.index)); + .add(GeburaSetPurchasedAppInfoIndexEvent(widget.index)); AppRoutes.geburaLibraryDetail(widget.index).push(context); }, child: Stack( diff --git a/lib/view/pages/gebura/gebura_nav.dart b/lib/view/pages/gebura/gebura_nav.dart index afa48b6..11011c0 100644 --- a/lib/view/pages/gebura/gebura_nav.dart +++ b/lib/view/pages/gebura/gebura_nav.dart @@ -39,7 +39,7 @@ class GeburaNav extends StatelessWidget { onTap: () { context .read() - .add(GeburaSetPurchasedAppIndexEvent(null)); + .add(GeburaSetPurchasedAppInfoIndexEvent(null)); AppRoutes.geburaStore.go(context); OverlappingPanels.of(context)?.reveal(RevealSide.main); }, @@ -53,7 +53,7 @@ class GeburaNav extends StatelessWidget { onTap: () { context .read() - .add(GeburaSetPurchasedAppIndexEvent(null)); + .add(GeburaSetPurchasedAppInfoIndexEvent(null)); AppRoutes.geburaLibrary.push(context); OverlappingPanels.of(context)?.reveal(RevealSide.main); }, @@ -76,13 +76,12 @@ class GeburaNav extends StatelessWidget { i < state.purchasedApps!.length; i++, app = state.purchasedApps!.elementAtOrNull(i) ?? - AppMixed()) + AppInfoMixed()) RailTile( selected: i == state.selectedPurchasedAppIndex, onTap: () { - context - .read() - .add(GeburaSetPurchasedAppIndexEvent(i)); + context.read().add( + GeburaSetPurchasedAppInfoIndexEvent(i)); AppRoutes.geburaLibraryDetail(i) .push(context); OverlappingPanels.of(context) diff --git a/lib/view/pages/gebura/gebura_store.dart b/lib/view/pages/gebura/gebura_store.dart index a01bb84..f3ac375 100644 --- a/lib/view/pages/gebura/gebura_store.dart +++ b/lib/view/pages/gebura/gebura_store.dart @@ -16,7 +16,7 @@ class GeburaStorePage extends StatelessWidget { @override Widget build(BuildContext context) { final controller = TextEditingController(); - List? apps; + List? apps; String msg = ''; return BlocBuilder(builder: (context, state) { if (state is GeburaSearchAppsState) { @@ -89,7 +89,7 @@ class GeburaStorePage extends StatelessWidget { )), onEditingComplete: () { context.read().add( - GeburaSearchAppsEvent(controller.text), + GeburaSearchAppInfosEvent(controller.text), ); }, ), @@ -109,7 +109,7 @@ class StoreList extends StatelessWidget { super.key, required this.apps, }); - final List apps; + final List apps; @override Widget build(BuildContext context) { diff --git a/lib/view/pages/gebura/gebura_store_detail.dart b/lib/view/pages/gebura/gebura_store_detail.dart index cbf5686..7ddfd46 100644 --- a/lib/view/pages/gebura/gebura_store_detail.dart +++ b/lib/view/pages/gebura/gebura_store_detail.dart @@ -27,10 +27,10 @@ class GeburaStoreDetail extends StatelessWidget { } }, builder: (context, state) { final apps = state.storeApps != null ? state.storeApps![appID] : null; - final app = apps != null ? mixApp(apps) : null; + final app = apps != null ? mixAppInfo(apps) : null; if (firstBuild && apps == null) { firstBuild = false; - context.read().add(GeburaFetchBoundAppsEvent(appID)); + context.read().add(GeburaFetchBoundAppInfosEvent(appID)); } debugPrint(app.toString()); return Scaffold( @@ -187,7 +187,7 @@ class GeburaStoreDetail extends StatelessWidget { class PurchaseAppDialog extends StatelessWidget { const PurchaseAppDialog({super.key, required this.app}); - final App app; + final AppInfo app; @override Widget build(BuildContext context) { diff --git a/lib/view/pages/settings/app/app_add_page.dart b/lib/view/pages/settings/app/app_add_page.dart index c9ab65c..dd1b1f9 100644 --- a/lib/view/pages/settings/app/app_add_page.dart +++ b/lib/view/pages/settings/app/app_add_page.dart @@ -123,8 +123,8 @@ class AppAddPage extends StatelessWidget { onPressed: () { if (formKey.currentState!.validate()) { formKey.currentState!.save(); - context.read().add(GeburaAddAppEvent( - App( + context.read().add(GeburaAddAppInfoEvent( + AppInfo( name: name, type: appType, shortDescription: shortDescription, diff --git a/lib/view/pages/settings/app/app_edit_page.dart b/lib/view/pages/settings/app/app_edit_page.dart index 5d3e956..7df90f4 100644 --- a/lib/view/pages/settings/app/app_edit_page.dart +++ b/lib/view/pages/settings/app/app_edit_page.dart @@ -9,7 +9,7 @@ import '../../../components/toast.dart'; import '../../../specialized/right_panel_form.dart'; class AppEditPage extends StatefulWidget { - final App app; + final AppInfo app; const AppEditPage({super.key, required this.app}); @override @@ -172,8 +172,8 @@ class _AppEditPageState extends State { onPressed: () { if (_formKey.currentState!.validate()) { _formKey.currentState!.save(); - context.read().add(GeburaEditAppEvent( - App( + context.read().add(GeburaEditAppInfoEvent( + AppInfo( id: widget.app.id, source: widget.app.source, sourceAppId: widget.app.sourceAppId, diff --git a/lib/view/pages/settings/app/app_manage_page.dart b/lib/view/pages/settings/app/app_manage_page.dart index 73ca6fd..98a6833 100644 --- a/lib/view/pages/settings/app/app_manage_page.dart +++ b/lib/view/pages/settings/app/app_manage_page.dart @@ -35,7 +35,7 @@ class _AppManagePageState extends State { .read() .state .serverFeatureSummary - ?.supportedAppSources ?? + ?.supportedAppInfoSources ?? []; return Padding( padding: const EdgeInsets.all(8), @@ -125,10 +125,10 @@ class AppTableSource extends AsyncDataTableSource { Future getRows(int startIndex, int count) async { final data = await context .read() - .listApps(pageSize, startIndex ~/ pageSize + 1, sourceFilter); + .listAppInfos(pageSize, startIndex ~/ pageSize + 1, sourceFilter); return AsyncRowsResponse( data.paging.totalSize.toInt(), - data.apps.map( + data.appInfos.map( (app) { return DataRow2( cells: [ diff --git a/lib/view/pages/settings/app_package/app_package_add_page.dart b/lib/view/pages/settings/app_package/app_package_add_page.dart index 5545ac9..85e7940 100644 --- a/lib/view/pages/settings/app_package/app_package_add_page.dart +++ b/lib/view/pages/settings/app_package/app_package_add_page.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:tuihub_protos/librarian/v1/common.pb.dart'; +import 'package:tuihub_protos/librarian/sephirah/v1/gebura.pb.dart'; import '../../../../bloc/gebura/gebura_bloc.dart'; import '../../../../route.dart'; @@ -89,8 +89,8 @@ class AppPackageAddPage extends StatelessWidget { onPressed: () { if (formKey.currentState!.validate()) { formKey.currentState!.save(); - context.read().add(GeburaAddAppPackageEvent( - AppPackage( + context.read().add(GeburaAddAppEvent( + App( name: name, description: description, ), diff --git a/lib/view/pages/settings/app_package/app_package_assign_dialog.dart b/lib/view/pages/settings/app_package/app_package_assign_dialog.dart index 71e0526..a500e78 100644 --- a/lib/view/pages/settings/app_package/app_package_assign_dialog.dart +++ b/lib/view/pages/settings/app_package/app_package_assign_dialog.dart @@ -2,10 +2,10 @@ import 'package:fixnum/fixnum.dart' as $fixnum; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:tuihub_protos/librarian/sephirah/v1/gebura.pb.dart'; import 'package:tuihub_protos/librarian/v1/common.pb.dart'; import '../../../../bloc/gebura/gebura_bloc.dart'; -import '../../../../repo/grpc/l10n.dart'; import '../../../components/toast.dart'; class AppPackageAssignDialog extends StatelessWidget { @@ -13,7 +13,7 @@ class AppPackageAssignDialog extends StatelessWidget { {super.key, required this.appPackage, required this.callback}); final void Function() callback; - final AppPackage appPackage; + final App appPackage; @override Widget build(BuildContext context) { @@ -38,7 +38,6 @@ class AppPackageAssignDialog extends StatelessWidget { children: [ Text('Name: ${appPackage.name}'), Text('ID: ${appPackage.id.id.toHexString()}'), - Text('Source: ${appPackageSourceString(appPackage.source)}'), const SizedBox( height: 16, ), @@ -87,7 +86,7 @@ class AppPackageAssignDialog extends StatelessWidget { actions: [ TextButton( onPressed: () { - context.read().add(GeburaAssignAppPackageEvent( + context.read().add(GeburaAssignAppEvent( appPackage.id, InternalID(id: $fixnum.Int64(appID)), )); diff --git a/lib/view/pages/settings/app_package/app_package_edit_page.dart b/lib/view/pages/settings/app_package/app_package_edit_page.dart index 5eba045..f173cd9 100644 --- a/lib/view/pages/settings/app_package/app_package_edit_page.dart +++ b/lib/view/pages/settings/app_package/app_package_edit_page.dart @@ -2,10 +2,9 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:tuihub_protos/librarian/v1/common.pb.dart'; +import 'package:tuihub_protos/librarian/sephirah/v1/gebura.pb.dart'; import '../../../../bloc/gebura/gebura_bloc.dart'; -import '../../../../repo/grpc/l10n.dart'; import '../../../../route.dart'; import '../../../components/toast.dart'; import '../../../specialized/right_panel_form.dart'; @@ -14,7 +13,7 @@ import 'app_package_assign_dialog.dart'; class AppPackageEditPage extends StatefulWidget { const AppPackageEditPage({super.key, required this.appPackage}); - final AppPackage appPackage; + final App appPackage; @override State createState() => _AppPackageEditPageState(); @@ -53,8 +52,6 @@ class _AppPackageEditPageState extends State { mainAxisSize: MainAxisSize.min, children: [ Text('ID: ${widget.appPackage.id.id.toHexString()}'), - Text( - 'Source: ${appPackageSourceString(widget.appPackage.source)}'), const SizedBox( height: 16, ), @@ -129,10 +126,9 @@ class _AppPackageEditPageState extends State { onPressed: () { if (_formKey.currentState!.validate()) { _formKey.currentState!.save(); - context.read().add(GeburaEditAppPackageEvent( - AppPackage( + context.read().add(GeburaEditAppEvent( + App( id: widget.appPackage.id, - source: widget.appPackage.source, name: name, description: description, ), diff --git a/lib/view/pages/settings/app_package/app_package_manage_page.dart b/lib/view/pages/settings/app_package/app_package_manage_page.dart index a5cabc2..fa3fa0d 100644 --- a/lib/view/pages/settings/app_package/app_package_manage_page.dart +++ b/lib/view/pages/settings/app_package/app_package_manage_page.dart @@ -3,11 +3,8 @@ import 'dart:async'; import 'package:data_table_2/data_table_2.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:multi_select_flutter/multi_select_flutter.dart'; -import 'package:tuihub_protos/librarian/v1/common.pb.dart'; import '../../../../bloc/gebura/gebura_bloc.dart'; -import '../../../../repo/grpc/l10n.dart'; import '../../../../route.dart'; import '../../../helper/spacing.dart'; @@ -42,29 +39,6 @@ class _AppPackageManagePageState extends State { border: Border.all(color: Theme.of(context).primaryColor), borderRadius: SpacingHelper.defaultBorderRadius, ), - child: MultiSelectDialogField( - title: const Text('按数据来源筛选'), - buttonText: const Text('数据来源'), - buttonIcon: const Icon(Icons.filter_alt_outlined), - items: [ - MultiSelectItem( - AppPackageSource.APP_PACKAGE_SOURCE_MANUAL, - appPackageSourceString( - AppPackageSource.APP_PACKAGE_SOURCE_MANUAL)), - MultiSelectItem( - AppPackageSource.APP_PACKAGE_SOURCE_SENTINEL, - appPackageSourceString( - AppPackageSource.APP_PACKAGE_SOURCE_SENTINEL)), - ], - onConfirm: (values) { - dataSource.sourceFilter = values; - dataSource.refreshDatasource(); - paginatorController.goToFirstPage(); - }, - decoration: BoxDecoration( - borderRadius: SpacingHelper.defaultBorderRadius, - ), - ), ), const Expanded(child: SizedBox()), FilledButton.tonalIcon( @@ -97,10 +71,6 @@ class _AppPackageManagePageState extends State { label: Text('名称'), size: ColumnSize.L, ), - DataColumn2( - label: Text('数据来源'), - size: ColumnSize.S, - ), DataColumn2( label: Text('简介'), size: ColumnSize.S, @@ -119,13 +89,12 @@ class AppPackageTableSource extends AsyncDataTableSource { AppPackageTableSource(this.pageSize); late BuildContext context; final int pageSize; - late List sourceFilter = []; @override Future getRows(int startIndex, int count) async { final data = await context .read() - .listAppPackages(pageSize, startIndex ~/ pageSize + 1, sourceFilter); + .listApps(pageSize, startIndex ~/ pageSize + 1); return AsyncRowsResponse( data.paging.totalSize.toInt(), data.appPackages.map( @@ -134,7 +103,6 @@ class AppPackageTableSource extends AsyncDataTableSource { cells: [ DataCell(Text(appPackage.id.id.toHexString())), DataCell(Text(appPackage.name)), - DataCell(Text(appPackageSourceString(appPackage.source))), DataCell(Text(appPackage.description)), ], onTap: () { diff --git a/pubspec.yaml b/pubspec.yaml index 2189e73..08e0977 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -54,7 +54,7 @@ dependencies: tuihub_protos: git: url: https://github.com/tuihub/protos.git - ref: v0.3.9 + ref: v0.4.1 fixnum: ^1.1.0 # theme