diff --git a/assets/config/v5/communities.json b/assets/config/v5/communities.json index 08d80601..9bbb166c 100644 --- a/assets/config/v5/communities.json +++ b/assets/config/v5/communities.json @@ -458,6 +458,14 @@ "desc": "SFLUV has migrated from Polygon to BeraChain, so this community (SFLUV Polygon) has been closed. Click the link below to create an account in the new SFLUV community. Your SFLUV Polygon balance will be transferred over once you have a new account.", "button": "Migrate" } + }, + { + "url": "https://app.sfluv.org/map", + "icon": "https://assets.citizenwallet.xyz/wallet-config/_images/sfluv.svg", + "name": "Map", + "featured": true, + "signature": true, + "launch_mode": "webview" } ], "version": 5, @@ -483,6 +491,8 @@ "logo": "https://assets.citizenwallet.xyz/wallet-config/_images/sfluv.svg", "name": "SFLUV Community (Polygon)", "alias": "wallet.sfluv.org", + "hidden": true, + "closed": true, "theme": { "primary": "#eb6c6c" }, diff --git a/assets/config/v5/communities.test.json b/assets/config/v5/communities.test.json index 08d80601..9bbb166c 100644 --- a/assets/config/v5/communities.test.json +++ b/assets/config/v5/communities.test.json @@ -458,6 +458,14 @@ "desc": "SFLUV has migrated from Polygon to BeraChain, so this community (SFLUV Polygon) has been closed. Click the link below to create an account in the new SFLUV community. Your SFLUV Polygon balance will be transferred over once you have a new account.", "button": "Migrate" } + }, + { + "url": "https://app.sfluv.org/map", + "icon": "https://assets.citizenwallet.xyz/wallet-config/_images/sfluv.svg", + "name": "Map", + "featured": true, + "signature": true, + "launch_mode": "webview" } ], "version": 5, @@ -483,6 +491,8 @@ "logo": "https://assets.citizenwallet.xyz/wallet-config/_images/sfluv.svg", "name": "SFLUV Community (Polygon)", "alias": "wallet.sfluv.org", + "hidden": true, + "closed": true, "theme": { "primary": "#eb6c6c" }, diff --git a/lib/screens/wallet/screen.dart b/lib/screens/wallet/screen.dart index 86278c61..6fb4bbef 100644 --- a/lib/screens/wallet/screen.dart +++ b/lib/screens/wallet/screen.dart @@ -87,6 +87,7 @@ class WalletScreenState extends State String? _sendToURL; Config? _config; bool _isClosedBannerDismissed = false; + int _bannerResetKey = 0; @override void initState() { @@ -152,6 +153,20 @@ class WalletScreenState extends State } } + @override + Future didChangeAppLifecycleState(AppLifecycleState state) async { + switch (state) { + case AppLifecycleState.resumed: + _logic.updateWalletConfigFromRemote(); + setState(() { + _isClosedBannerDismissed = false; + _bannerResetKey++; + }); + break; + default: + } + } + void onScrollUpdate() { if (_scrollController.position.pixels >= _scrollController.position.maxScrollExtent - 300) { @@ -374,6 +389,11 @@ class WalletScreenState extends State _profileLogic.resume(); _profilesLogic.resume(); _voucherLogic.resume(); + _logic.updateWalletConfigFromRemote(); + setState(() { + _isClosedBannerDismissed = false; + _bannerResetKey++; + }); navigator.go('/wallet/$_address'); } @@ -595,6 +615,11 @@ class WalletScreenState extends State _profileLogic.resume(); _profilesLogic.resume(); _voucherLogic.resume(); + _logic.updateWalletConfigFromRemote(); + setState(() { + _isClosedBannerDismissed = false; + _bannerResetKey++; + }); } void handleReceive() async { @@ -602,10 +627,16 @@ class WalletScreenState extends State final navigator = GoRouter.of(context); - navigator.push('/wallet/$_address/receive', extra: { + await navigator.push('/wallet/$_address/receive', extra: { 'logic': _logic, 'profilesLogic': _profilesLogic, }); + + _logic.updateWalletConfigFromRemote(); + setState(() { + _isClosedBannerDismissed = false; + _bannerResetKey++; + }); } Future handlePlugin(PluginConfig pluginConfig) async { @@ -700,6 +731,11 @@ class WalletScreenState extends State _profileLogic.resume(); _profilesLogic.resume(); _voucherLogic.resume(); + _logic.updateWalletConfigFromRemote(); + setState(() { + _isClosedBannerDismissed = false; + _bannerResetKey++; + }); } Future handleMint({String? receiveParams}) async { @@ -721,6 +757,11 @@ class WalletScreenState extends State _profileLogic.resume(); _profilesLogic.resume(); _voucherLogic.resume(); + _logic.updateWalletConfigFromRemote(); + setState(() { + _isClosedBannerDismissed = false; + _bannerResetKey++; + }); } void handleVouchers() async { @@ -742,6 +783,11 @@ class WalletScreenState extends State _profileLogic.resume(); _profilesLogic.resume(); _voucherLogic.resume(); + _logic.updateWalletConfigFromRemote(); + setState(() { + _isClosedBannerDismissed = false; + _bannerResetKey++; + }); } void handleCopy(String value) { @@ -768,6 +814,11 @@ class WalletScreenState extends State _profileLogic.resume(); _profilesLogic.resume(); _voucherLogic.resume(); + _logic.updateWalletConfigFromRemote(); + setState(() { + _isClosedBannerDismissed = false; + _bannerResetKey++; + }); } void handleLoad(String address) async { @@ -785,6 +836,11 @@ class WalletScreenState extends State if (args == null) { _logic.resumeFetching(); + _logic.updateWalletConfigFromRemote(); + setState(() { + _isClosedBannerDismissed = false; + _bannerResetKey++; + }); return; } @@ -792,6 +848,11 @@ class WalletScreenState extends State if (address == _address && alias == _alias) { _logic.resumeFetching(); + _logic.updateWalletConfigFromRemote(); + setState(() { + _isClosedBannerDismissed = false; + _bannerResetKey++; + }); return; } @@ -1201,13 +1262,14 @@ class WalletScreenState extends State final isOffline = eventServiceState == EventServiceState.error || eventServiceState == EventServiceState.connecting; - final isCommunityClosed = eventServiceState == EventServiceState.closed; + final config = context.select((WalletState state) => state.config); + final isCommunityClosed = eventServiceState == EventServiceState.closed || + (config?.community.closed ?? false); final offboardPlugin = context.select( (WalletState state) => state.config!.getOffboardPlugin(), ); final cleaningUp = context.select((WalletState state) => state.cleaningUp); - final config = context.select((WalletState state) => state.config); final hasActiveSessions = context.select((WalletConnectState state) => state.hasActiveSessions); @@ -1401,19 +1463,19 @@ class WalletScreenState extends State ), ), ), - if (isCommunityClosed) - CommunityClosedBanner( - handleOffboardPlugin: offboardPlugin != null - ? () => handlePlugin(offboardPlugin) - : null, - onDismiss: () { - setState(() { - _isClosedBannerDismissed = true; - }); - }, - display: isCommunityClosed, - offboardPlugin: offboardPlugin, - ), + CommunityClosedBanner( + key: ValueKey('community_closed_banner_$_bannerResetKey'), + handleOffboardPlugin: offboardPlugin != null + ? () => handlePlugin(offboardPlugin) + : null, + onDismiss: () { + setState(() { + _isClosedBannerDismissed = true; + }); + }, + display: isCommunityClosed && !_isClosedBannerDismissed, + offboardPlugin: offboardPlugin, + ), OfflineBanner( communityUrl: config?.community.url ?? '', display: isOffline, diff --git a/lib/services/config/config.dart b/lib/services/config/config.dart index 62c87085..f4a3c5df 100644 --- a/lib/services/config/config.dart +++ b/lib/services/config/config.dart @@ -62,6 +62,7 @@ class CommunityConfig { final String logo; final String? customDomain; final bool hidden; + final bool closed; final ColorTheme theme; final ContractLocation profile; final ContractLocation primaryToken; @@ -76,6 +77,7 @@ class CommunityConfig { required this.logo, this.customDomain, this.hidden = false, + this.closed = false, required this.theme, required this.profile, required this.primaryToken, @@ -96,6 +98,7 @@ class CommunityConfig { logo: json['logo'] ?? '', customDomain: json['custom_domain'], hidden: json['hidden'] ?? false, + closed: json['closed'] ?? false, theme: theme, profile: ContractLocation.fromJson(json['profile']), primaryToken: ContractLocation.fromJson(json['primary_token']), @@ -117,6 +120,7 @@ class CommunityConfig { 'logo': logo, 'custom_domain': customDomain, 'hidden': hidden, + 'closed': closed, 'theme': theme, 'profile': profile.toJson(), 'primary_token': primaryToken.toJson(),