diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 1d19ede6..60e9b55d 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -383,7 +383,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = WQ5H736A22; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -518,7 +518,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = WQ5H736A22; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -548,7 +548,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = WQ5H736A22; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/lib/app.dart b/lib/app.dart index c0f1a3ba..5e183208 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -309,7 +309,7 @@ class _WalletAppState extends State { RemoteNodeListPage(_appStore.settings), SS58PrefixListPage.route: (_) => SS58PrefixListPage(_appStore.settings), - AboutPage.route: (_) => AboutPage(), + AboutPage.route: (_) => AboutPage(_appStore), RecoverySettingPage.route: (_) => RecoverySettingPage(_appStore), RecoveryStatePage.route: (_) => RecoveryStatePage(_appStore), RecoveryProofPage.route: (_) => RecoveryProofPage(_appStore), diff --git a/lib/common/consts/settings.dart b/lib/common/consts/settings.dart index bdb85629..17a51175 100644 --- a/lib/common/consts/settings.dart +++ b/lib/common/consts/settings.dart @@ -141,8 +141,8 @@ const String cross_chain_transfer_address_laminar = '5CLaminarAUSDCrossChainTransferxxxxxxxxxxxxxwisu'; /// app versions -const String app_beta_version = 'v1.0.5-beta.1'; -const int app_beta_version_code = 1051; +const String app_beta_version = 'v1.0.5-beta.2'; +const int app_beta_version_code = 1052; /// js code versions const Map js_code_version_map = { diff --git a/lib/page/profile/aboutPage.dart b/lib/page/profile/aboutPage.dart index 47de6e82..6a2ddc9b 100644 --- a/lib/page/profile/aboutPage.dart +++ b/lib/page/profile/aboutPage.dart @@ -3,11 +3,17 @@ import 'package:flutter/material.dart'; import 'package:polka_wallet/common/components/JumpToBrowserLink.dart'; import 'package:polka_wallet/common/components/roundedButton.dart'; import 'package:polka_wallet/common/consts/settings.dart'; +import 'package:polka_wallet/service/substrateApi/api.dart'; import 'package:polka_wallet/service/walletApi.dart'; +import 'package:polka_wallet/store/app.dart'; import 'package:polka_wallet/utils/UI.dart'; import 'package:polka_wallet/utils/i18n/index.dart'; class AboutPage extends StatefulWidget { + AboutPage(this.store); + + final AppStore store; + static final String route = '/profile/about'; @override @@ -31,6 +37,10 @@ class _AboutPage extends State { @override Widget build(BuildContext context) { final Map dic = I18n.of(context).profile; + final currentJSVersion = WalletApi.getPolkadotJSVersion( + webApi.jsStorage, + widget.store.settings.endpoint.info, + ); return Scaffold( backgroundColor: Theme.of(context).cardColor, appBar: AppBar( @@ -64,6 +74,10 @@ class _AboutPage extends State { padding: EdgeInsets.all(8), child: Text('${dic['about.version']}: $app_beta_version'), ), + Padding( + padding: EdgeInsets.only(bottom: 8), + child: Text('API: $currentJSVersion'), + ), Padding( padding: EdgeInsets.all(16), child: RoundedButton( diff --git a/lib/service/substrateApi/api.dart b/lib/service/substrateApi/api.dart index 085ea343..a163ccc7 100644 --- a/lib/service/substrateApi/api.dart +++ b/lib/service/substrateApi/api.dart @@ -74,6 +74,8 @@ class Api { // check js code update final network = store.settings.endpoint.info; final jsVersions = await WalletApi.fetchPolkadotJSVersion(); + if (jsVersions == null) return; + final version = jsVersions[network]; final versionMin = jsVersions['$network-min']; final bool needUpdate = diff --git a/lib/service/walletApi.dart b/lib/service/walletApi.dart index 23093e79..760a40e1 100644 --- a/lib/service/walletApi.dart +++ b/lib/service/walletApi.dart @@ -70,12 +70,15 @@ class WalletApi { GetStorage jsStorage, String networkName, ) { - String version = jsStorage.read('$_jsCodeStorageVersionKey$networkName'); + final int appJSVersion = js_code_version_map[networkName]; + final String version = + jsStorage.read('$_jsCodeStorageVersionKey$networkName'); if (version != null) { - return int.parse(version); + final updatedVersion = int.parse(version); + return updatedVersion > appJSVersion ? updatedVersion : appJSVersion; } // default version - return js_code_version_map[networkName]; + return appJSVersion; } static String getPolkadotJSCode( diff --git a/pubspec.yaml b/pubspec.yaml index 47ab8429..75a24757 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: PolkaWallet made with Flutter. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.5+1051 +version: 1.0.5+1052 environment: sdk: ">=2.7.0 <3.0.0"