diff --git a/assets b/assets index e9f19605d..7e28ed66c 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit e9f19605d28418c8915aa5c9930f5770338c801d +Subproject commit 7e28ed66ce4188696d3ec6f3281b2366a51f0629 diff --git a/lib/screen/home/home_navigation_page.dart b/lib/screen/home/home_navigation_page.dart index 730b8523d..ce6dc701b 100644 --- a/lib/screen/home/home_navigation_page.dart +++ b/lib/screen/home/home_navigation_page.dart @@ -222,7 +222,7 @@ class HomeNavigationPageState extends State }, ), OptionItem( - title: 'addresses'.tr(), + title: 'wallet'.tr(), icon: const Icon( AuIcon.wallet, ), diff --git a/lib/screen/moma_postcard_page/moma_postcard_page.dart b/lib/screen/moma_postcard_page/moma_postcard_page.dart index 6f5d4c726..d9f32ea8d 100644 --- a/lib/screen/moma_postcard_page/moma_postcard_page.dart +++ b/lib/screen/moma_postcard_page/moma_postcard_page.dart @@ -7,6 +7,7 @@ import 'dart:async'; +import 'package:autonomy_flutter/common/environment.dart'; import 'package:autonomy_flutter/common/injector.dart'; import 'package:autonomy_flutter/screen/app_router.dart'; import 'package:autonomy_flutter/screen/detail/artwork_detail_page.dart'; @@ -50,6 +51,7 @@ class _MoMAPostcardPageState extends State { nftBloc.add( GetTokensByOwnerEvent( pageKey: nextKey, + contractAddress: Environment.postcardContractAddress, ), ); } diff --git a/lib/screen/new_onboarding_page.dart b/lib/screen/new_onboarding_page.dart index f73b3c9b2..ea411a9db 100644 --- a/lib/screen/new_onboarding_page.dart +++ b/lib/screen/new_onboarding_page.dart @@ -207,8 +207,9 @@ class _NewOnboardingPageState extends State { price: _getEssentialPrice(subscriptionDetails), isProcessing: _selectedMembershipCardType == MembershipCardType.essential && - subscriptionDetails?.status == - IAPProductStatus.pending, + (subscriptionDetails?.status == + IAPProductStatus.pending || + subscriptionState.isProcessing), isEnable: true, onTap: (type) { _selectMembershipType(type); @@ -221,8 +222,9 @@ class _NewOnboardingPageState extends State { price: _getPremiumPrice(subscriptionDetails), isProcessing: _selectedMembershipCardType == MembershipCardType.premium && - subscriptionDetails?.status == - IAPProductStatus.pending, + (subscriptionDetails?.status == + IAPProductStatus.pending || + subscriptionState.isProcessing), isEnable: true, onTap: (type) async { _selectMembershipType(type); diff --git a/lib/screen/settings/forget_exist/forget_exist_bloc.dart b/lib/screen/settings/forget_exist/forget_exist_bloc.dart index d3d200716..742c2b9b4 100644 --- a/lib/screen/settings/forget_exist/forget_exist_bloc.dart +++ b/lib/screen/settings/forget_exist/forget_exist_bloc.dart @@ -65,12 +65,9 @@ class ForgetExistBloc extends AuBloc { PackageInfo packageInfo = await PackageInfo.fromPlatform(); String? deviceId = await MigrationUtil.getBackupDeviceID(); final requester = '${deviceId}_${packageInfo.packageName}'; - try { - await _iapApi.deleteAllProfiles(requester); - await _iapApi.deleteUserData(); - } catch (e) { - log.info('Error when delete all profiles: $e'); - } + + unawaited(_iapApi.deleteAllProfiles(requester)); + unawaited(_iapApi.deleteUserData()); final List personas = await _cloudDatabase.personaDao.getPersonas(); diff --git a/lib/screen/settings/settings_page.dart b/lib/screen/settings/settings_page.dart index 56b5346fe..0103f2426 100644 --- a/lib/screen/settings/settings_page.dart +++ b/lib/screen/settings/settings_page.dart @@ -181,8 +181,8 @@ class _SettingsPageState extends State ), addOnlyDivider(), _settingItem( - title: 'go_premium'.tr(), - icon: const Icon(AuIcon.add), + title: 'membership'.tr(), + icon: SvgPicture.asset('assets/images/icon_membership.svg'), onTap: () async { await Navigator.of(context) .pushNamed(AppRouter.subscriptionPage); diff --git a/lib/screen/settings/subscription/subscription_page.dart b/lib/screen/settings/subscription/subscription_page.dart index 4c2d08179..9d28e9884 100644 --- a/lib/screen/settings/subscription/subscription_page.dart +++ b/lib/screen/settings/subscription/subscription_page.dart @@ -40,13 +40,6 @@ class _SubscriptionPageState extends State with AfterLayoutMixin { final int initialIndex = 0; final _upgradesBloc = injector.get(); - late bool _isUpgrading; - - @override - void initState() { - super.initState(); - _isUpgrading = false; - } @override Widget build(BuildContext context) { @@ -57,7 +50,7 @@ class _SubscriptionPageState extends State child: Scaffold( appBar: getBackAppBar( context, - title: 'go_premium'.tr(), + title: 'membership'.tr(), onBack: () { if (widget.payload?.onBack != null) { widget.payload?.onBack?.call(); @@ -66,40 +59,44 @@ class _SubscriptionPageState extends State } }, ), - body: SafeArea( - child: BlocBuilder( - bloc: _upgradesBloc, - builder: (context, state) { - final subscriptionDetails = state.activeSubscriptionDetails; - final subscriptionStatus = injector() - .getIAPJWT() - ?.getSubscriptionStatus(); - return Swiper( - itemCount: subscriptionDetails.length, - onIndexChanged: (index) {}, - index: initialIndex, - loop: false, - itemBuilder: (context, index) => _subcribeView( - context, subscriptionDetails[index], subscriptionStatus), - pagination: subscriptionDetails.length > 1 - ? const SwiperPagination( - builder: DotSwiperPaginationBuilder( - color: AppColor.auLightGrey, - activeColor: MomaPallet.lightYellow), - ) - : null, - controller: SwiperController(), - ); - }), - ), + body: BlocBuilder( + bloc: _upgradesBloc, + builder: (context, state) { + final subscriptionDetails = state.activeSubscriptionDetails; + final subscriptionStatus = injector() + .getIAPJWT() + ?.getSubscriptionStatus(); + return Swiper( + itemCount: subscriptionDetails.length, + onIndexChanged: (index) {}, + index: initialIndex, + loop: false, + itemBuilder: (context, index) => _subscribeView( + context, + subscriptionDetails[index], + subscriptionStatus, + state.isProcessing, + ), + pagination: subscriptionDetails.length > 1 + ? const SwiperPagination( + builder: DotSwiperPaginationBuilder( + color: AppColor.auLightGrey, + activeColor: MomaPallet.lightYellow), + ) + : null, + controller: SwiperController(), + ); + }), ), ); } - Widget _subcribeView( - BuildContext context, - SubscriptionDetails subscriptionDetails, - SubscriptionStatus? subscriptionStatus) => + Widget _subscribeView( + BuildContext context, + SubscriptionDetails subscriptionDetails, + SubscriptionStatus? subscriptionStatus, + bool? isProcessing, + ) => Container( color: AppColor.auGreyBackground, padding: const EdgeInsets.all(3), @@ -120,7 +117,11 @@ class _SubscriptionPageState extends State padding: ResponsiveLayout.pageHorizontalEdgeInsetsWithSubmitButton, child: _actionSection( - context, subscriptionDetails, subscriptionStatus), + context, + subscriptionDetails, + subscriptionStatus, + isProcessing, + ), ), ], ), @@ -171,15 +172,18 @@ class _SubscriptionPageState extends State case IAPProductStatus.trial: // we dont support trial now case IAPProductStatus.loading: - case IAPProductStatus.pending: return Container( - height: 80, + height: 500, alignment: Alignment.topCenter, - child: const LoadingWidget(), + child: const LoadingWidget( + backgroundColor: Colors.transparent, + ), ); case IAPProductStatus.expired: // expired membership: user has membership but it's expired // in this case, the UI is the same as free user + case IAPProductStatus.pending: + // pending membership: user is purchasing membership case IAPProductStatus.notPurchased: return Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -208,6 +212,7 @@ class _SubscriptionPageState extends State BuildContext context, SubscriptionDetails subscriptionDetails, SubscriptionStatus? subscriptionStatus, + bool? isProcessing, ) { final theme = Theme.of(context); final dateFormater = DateFormat('dd/MM/yyyy'); @@ -311,20 +316,18 @@ class _SubscriptionPageState extends State case IAPProductStatus.trial: case IAPProductStatus.loading: - case IAPProductStatus.pending: return const SizedBox(); case IAPProductStatus.expired: + case IAPProductStatus.pending: case IAPProductStatus.notPurchased: // when user is essentially a free user return MembershipCard( type: MembershipCardType.premium, price: subscriptionDetails.price, - isProcessing: _isUpgrading, + isProcessing: isProcessing == true || + subscriptionDetails.status == IAPProductStatus.pending, isEnable: true, onTap: (_) { - setState(() { - _isUpgrading = true; - }); _onPressSubscribe(context, subscriptionDetails: subscriptionDetails); }, diff --git a/lib/screen/wallet/wallet_page.dart b/lib/screen/wallet/wallet_page.dart index 26a2295bc..8fa0ba3c4 100644 --- a/lib/screen/wallet/wallet_page.dart +++ b/lib/screen/wallet/wallet_page.dart @@ -128,7 +128,7 @@ class _WalletPageState extends State @override Widget build(BuildContext context) => Scaffold( - appBar: getBackAppBar(context, title: 'addresses'.tr(), onBack: () { + appBar: getBackAppBar(context, title: 'wallet'.tr(), onBack: () { Navigator.of(context).pop(); }, icon: Semantics( diff --git a/lib/view/cast_button.dart b/lib/view/cast_button.dart index 79e7c517b..482479054 100644 --- a/lib/view/cast_button.dart +++ b/lib/view/cast_button.dart @@ -175,7 +175,8 @@ class _FFCastButtonState extends State { return MembershipCard( type: MembershipCardType.premium, price: price, - isProcessing: upgradeState.isProcessing, + isProcessing: upgradeState.isProcessing || + subscriptionDetail?.status == IAPProductStatus.pending, isEnable: subscriptionDetail != null, onTap: (_) { _onPressSubscribe(subscriptionDetails: subscriptionDetail!); diff --git a/lib/view/loading.dart b/lib/view/loading.dart index 99da59c3e..a5a64cff6 100644 --- a/lib/view/loading.dart +++ b/lib/view/loading.dart @@ -6,7 +6,9 @@ import 'package:gif_view/gif_view.dart'; class LoadingWidget extends StatelessWidget { final bool invertColors; - const LoadingWidget({super.key, this.invertColors = false}); + final Color? backgroundColor; + const LoadingWidget( + {super.key, this.invertColors = false, this.backgroundColor}); @override Widget build(BuildContext context) { @@ -15,7 +17,7 @@ class LoadingWidget extends StatelessWidget { return Container( width: double.infinity, height: double.infinity, - color: AppColor.primaryBlack, + color: backgroundColor ?? AppColor.primaryBlack, child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, diff --git a/lib/view/membership_card.dart b/lib/view/membership_card.dart index f42fbcff7..5d927bf5b 100644 --- a/lib/view/membership_card.dart +++ b/lib/view/membership_card.dart @@ -138,6 +138,7 @@ class MembershipCard extends StatelessWidget { Text( 'auto_renews_unless_cancelled'.tr(), style: activeTextStyle, + textAlign: TextAlign.center, ), ], ], diff --git a/pubspec.lock b/pubspec.lock index e1bd51883..5d71eca37 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1512,10 +1512,10 @@ packages: dependency: "direct main" description: name: in_app_purchase_android - sha256: "25eb8694819caca282a527c26d5a1775164965c554ee99b9c10f3a0e44675c75" + sha256: b5ec117e3483fbca0fc5c546e9ed420c126e97fc5952aa891d01f9cf87661d44 url: "https://pub.dev" source: hosted - version: "0.3.6+8" + version: "0.3.6+7" in_app_purchase_platform_interface: dependency: transitive description: @@ -1661,18 +1661,18 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" url: "https://pub.dev" source: hosted - version: "10.0.5" + version: "10.0.4" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "3.0.3" leak_tracker_testing: dependency: transitive description: @@ -1790,10 +1790,10 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.8.0" measured_size: dependency: "direct main" description: @@ -1814,10 +1814,10 @@ packages: dependency: transitive description: name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.12.0" mime: dependency: "direct main" description: @@ -1895,8 +1895,8 @@ packages: dependency: "direct main" description: path: "." - ref: dde11ef9b3eae914ae8cc5bb950b2a4f798f90bd - resolved-ref: dde11ef9b3eae914ae8cc5bb950b2a4f798f90bd + ref: "72f3eee694c66161f31ac63d0a5fc4c475130d34" + resolved-ref: "72f3eee694c66161f31ac63d0a5fc4c475130d34" url: "https://github.com/autonomy-system/nft-rendering.git" source: git version: "1.0.9" @@ -2120,10 +2120,10 @@ packages: dependency: transitive description: name: platform - sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" url: "https://pub.dev" source: hosted - version: "3.1.5" + version: "3.1.4" plugin_platform_interface: dependency: transitive description: @@ -2669,26 +2669,26 @@ packages: dependency: "direct dev" description: name: test - sha256: "7ee44229615f8f642b68120165ae4c2a75fe77ae2065b1e55ae4711f6cf0899e" + sha256: "7ee446762c2c50b3bd4ea96fe13ffac69919352bd3b4b17bac3f3465edc58073" url: "https://pub.dev" source: hosted - version: "1.25.7" + version: "1.25.2" test_api: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.7.0" test_core: dependency: transitive description: name: test_core - sha256: "55ea5a652e38a1dfb32943a7973f3681a60f872f8c3a05a14664ad54ef9c6696" + sha256: "2bc4b4ecddd75309300d8096f781c0e3280ca1ef85beda558d33fcbedc2eead4" url: "https://pub.dev" source: hosted - version: "0.6.4" + version: "0.6.0" tezart: dependency: "direct main" description: @@ -2942,10 +2942,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" url: "https://pub.dev" source: hosted - version: "14.2.5" + version: "14.2.1" wakelock_plus: dependency: "direct main" description: @@ -3115,5 +3115,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.5.0 <4.0.0" - flutter: ">=3.24.0" + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" diff --git a/pubspec.yaml b/pubspec.yaml index bf94365a8..67373b86d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -78,7 +78,7 @@ dependencies: nft_rendering: git: url: https://github.com/autonomy-system/nft-rendering.git - ref: dde11ef9b3eae914ae8cc5bb950b2a4f798f90bd + ref: 72f3eee694c66161f31ac63d0a5fc4c475130d34 onesignal_flutter: ^3.3.0 open_settings: ^2.0.2 overlay_support: ^2.0.0