From ff108406dc304cf2c52f4bf46579152ab91e50d3 Mon Sep 17 00:00:00 2001 From: Ahmed Tarek Date: Wed, 15 Oct 2025 01:43:13 +0300 Subject: [PATCH 1/5] feat: initial implementation of upgrader --- android/app/src/main/AndroidManifest.xml | 7 +++ lib/main.dart | 1 - lib/pages/auth/sign_in.dart | 1 + lib/pages/main/main_screen.dart | 73 ++++++++++++++++-------- pubspec.yaml | 2 + 5 files changed, 60 insertions(+), 24 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 0de28475..3eb8f773 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -58,4 +58,11 @@ android:name="flutterEmbedding" android:value="2" /> + + + + + + + diff --git a/lib/main.dart b/lib/main.dart index 7221eac3..c6d7f392 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -39,7 +39,6 @@ Future main() async { PackageInfo packageInfo = await PackageInfo.fromPlatform(); getIt.get().setVersion(packageInfo.version); getIt.get().setBuildNumber(packageInfo.buildNumber); - getIt.get().checkWalletIsInitialized(); } catch (e) { appLogger.e(e.toString()); diff --git a/lib/pages/auth/sign_in.dart b/lib/pages/auth/sign_in.dart index c813146f..59db1f37 100644 --- a/lib/pages/auth/sign_in.dart +++ b/lib/pages/auth/sign_in.dart @@ -26,6 +26,7 @@ import 'package:qubic_wallet/timed_controller.dart'; import 'package:universal_platform/universal_platform.dart'; import 'package:qubic_wallet/l10n/l10n.dart'; import 'package:qubic_wallet/services/biometric_service.dart'; +import 'package:upgrader/upgrader.dart'; class SignIn extends StatefulWidget { final bool disableLocalAuth; diff --git a/lib/pages/main/main_screen.dart b/lib/pages/main/main_screen.dart index 908d486c..8dd506e4 100644 --- a/lib/pages/main/main_screen.dart +++ b/lib/pages/main/main_screen.dart @@ -16,9 +16,9 @@ import 'package:qubic_wallet/l10n/l10n.dart'; import 'package:qubic_wallet/models/app_link/app_link_controller.dart'; import 'package:qubic_wallet/models/wallet_connect/wallet_connect_modals_controller.dart'; import 'package:qubic_wallet/pages/main/download_cmd_utils.dart'; +import 'package:qubic_wallet/pages/main/tab_dapps/tab_dapps.dart'; import 'package:qubic_wallet/pages/main/tab_settings/tab_settings.dart'; import 'package:qubic_wallet/pages/main/tab_wallet_contents.dart'; -import 'package:qubic_wallet/pages/main/tab_dapps/tab_dapps.dart'; import 'package:qubic_wallet/pages/main/wallet_contents/add_account_modal_bottom_sheet.dart'; import 'package:qubic_wallet/resources/qubic_cmd.dart'; import 'package:qubic_wallet/services/wallet_connect_service.dart'; @@ -28,6 +28,8 @@ import 'package:qubic_wallet/stores/settings_store.dart'; import 'package:qubic_wallet/styles/text_styles.dart'; import 'package:qubic_wallet/timed_controller.dart'; import 'package:universal_platform/universal_platform.dart'; +import 'package:upgrader/upgrader.dart'; +import 'package:version/version.dart'; class MainScreen extends StatefulWidget { final int initialTabIndex; @@ -292,34 +294,59 @@ class _MainScreenState extends State with WidgetsBindingObserver { ]; } + UpgraderStore _buildAppCastStore() { + const url = + 'https://raw.githubusercontent.com/ahmed-tarek-salem/qubic-appcast-test/refs/heads/main/appcast.xml?v=2'; + final version = getIt.get().versionInfo ?? '1.0.0'; + return UpgraderAppcastStore( + appcastURL: url, + osVersion: Version.parse(version), + ); + } + Widget getMain() { + final upgrader = Upgrader( + //TODO remove debugDisplayAlways and debugLogging when done + debugDisplayAlways: true, + debugLogging: true, + storeController: UpgraderStoreController( + onAndroid: _buildAppCastStore, + oniOS: _buildAppCastStore, + ), + ); if (applicationStore.hasStoredWalletSettings) { _controller.jumpToTab(applicationStore.currentTabIndex); } else { _controller.jumpToTab(0); } - // _controller.jumpToPreviousTab(); - return PersistentTabView( - controller: _controller, - navBarHeight: 60, - navBarBuilder: (navBarConfig) => Style1BottomNavBar( - navBarConfig: navBarConfig, - navBarDecoration: const NavBarDecoration( - border: Border( - top: BorderSide(width: 1, color: LightThemeColors.navBorder), - ), - color: LightThemeColors.navBg)), - - tabs: _tabs(), - - backgroundColor: LightThemeColors.navBg, - - // Default is Colors.white. - handleAndroidBackButtonPress: true, // Default is true. - navBarOverlap: const NavBarOverlap.none(), - resizeToAvoidBottomInset: - true, // This needs to be true if you want to move up the screen when keyboard appears. Default is true. - stateManagement: true, // Default is true. + return UpgradeAlert( + upgrader: upgrader, + showIgnore: false, + dialogStyle: UniversalPlatform.isIOS + ? UpgradeDialogStyle.cupertino + : UpgradeDialogStyle.material, + child: PersistentTabView( + controller: _controller, + navBarHeight: 60, + navBarBuilder: (navBarConfig) => Style1BottomNavBar( + navBarConfig: navBarConfig, + navBarDecoration: const NavBarDecoration( + border: Border( + top: BorderSide(width: 1, color: LightThemeColors.navBorder), + ), + color: LightThemeColors.navBg)), + + tabs: _tabs(), + + backgroundColor: LightThemeColors.navBg, + + // Default is Colors.white. + handleAndroidBackButtonPress: true, // Default is true. + navBarOverlap: const NavBarOverlap.none(), + resizeToAvoidBottomInset: + true, // This needs to be true if you want to move up the screen when keyboard appears. Default is true. + stateManagement: true, // Default is true. + ), ); } diff --git a/pubspec.yaml b/pubspec.yaml index 01b791c0..97c71019 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -76,6 +76,8 @@ dependencies: safe_device: ^1.2.1 cryptography: ^2.7.0 no_screenshot: ^0.3.1 + upgrader: ^12.1.0 + version: ^3.0.0 dev_dependencies: flutter_test: From f4f839071e8d0481fc77c34719068f3763dd5fe7 Mon Sep 17 00:00:00 2001 From: Ahmed Tarek Date: Thu, 23 Oct 2025 00:57:19 +0300 Subject: [PATCH 2/5] fix: make the upgrade alert only material style for consistency --- lib/pages/main/main_screen.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/pages/main/main_screen.dart b/lib/pages/main/main_screen.dart index 8dd506e4..ee3bae05 100644 --- a/lib/pages/main/main_screen.dart +++ b/lib/pages/main/main_screen.dart @@ -322,9 +322,7 @@ class _MainScreenState extends State with WidgetsBindingObserver { return UpgradeAlert( upgrader: upgrader, showIgnore: false, - dialogStyle: UniversalPlatform.isIOS - ? UpgradeDialogStyle.cupertino - : UpgradeDialogStyle.material, + dialogStyle: UpgradeDialogStyle.material, child: PersistentTabView( controller: _controller, navBarHeight: 60, From e455bb2bbde8dbb07145e766d37423f4b7879e4c Mon Sep 17 00:00:00 2001 From: Ahmed Tarek Date: Thu, 23 Oct 2025 02:18:09 +0300 Subject: [PATCH 3/5] docs: add App Upgrade System to README file --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 6d025032..63a5939a 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,14 @@ You can add accounts to a wallet by: --- +### 5. App Upgrade System +- Automatic update detection – Prompts users to install the latest version directly from within the app. +- Cross-platform support – Works on Android, iOS. +- Custom appcast feed – Fetches release information from a hosted `appcast.xml`. +- Powered by: [Upgrader](https://pub.dev/packages/upgrader) + +--- + ## RPC Communication Qubic Wallet interacts with the network using the following RPC endpoints: From a7233236c9a1563afe57d340f31586cd618437fa Mon Sep 17 00:00:00 2001 From: Ahmed Tarek Date: Thu, 23 Oct 2025 02:18:28 +0300 Subject: [PATCH 4/5] refactor: remove unused import --- lib/pages/auth/sign_in.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/pages/auth/sign_in.dart b/lib/pages/auth/sign_in.dart index 59db1f37..c813146f 100644 --- a/lib/pages/auth/sign_in.dart +++ b/lib/pages/auth/sign_in.dart @@ -26,7 +26,6 @@ import 'package:qubic_wallet/timed_controller.dart'; import 'package:universal_platform/universal_platform.dart'; import 'package:qubic_wallet/l10n/l10n.dart'; import 'package:qubic_wallet/services/biometric_service.dart'; -import 'package:upgrader/upgrader.dart'; class SignIn extends StatefulWidget { final bool disableLocalAuth; From 7ce009baf2eb5596ce0f5e548101054ca3298d89 Mon Sep 17 00:00:00 2001 From: Ahmed Tarek Date: Tue, 28 Oct 2025 19:04:44 +0300 Subject: [PATCH 5/5] fix: Fix identation in AndroidManifest --- android/app/src/main/AndroidManifest.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 3eb8f773..a200d3d4 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -58,11 +58,11 @@ android:name="flutterEmbedding" android:value="2" /> - - - - - - + + + + + +