From 82712e93138416dc78be246c7dc3ca1a33446f9c Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Fri, 13 Sep 2024 13:52:29 +0530 Subject: [PATCH] [mob] Handle subscription err during sendLink --- .../collection/collection_sharing_actions.dart | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/mobile/lib/ui/actions/collection/collection_sharing_actions.dart b/mobile/lib/ui/actions/collection/collection_sharing_actions.dart index c4f23df419..509d676529 100644 --- a/mobile/lib/ui/actions/collection/collection_sharing_actions.dart +++ b/mobile/lib/ui/actions/collection/collection_sharing_actions.dart @@ -51,7 +51,7 @@ class CollectionActions { return true; } catch (e) { if (e is SharingNotPermittedForFreeAccountsError) { - _showUnSupportedAlert(context); + await _showUnSupportedAlert(context); } else { logger.severe("Failed to update shareUrl collection", e); await showGenericErrorDialog(context: context, error: e); @@ -139,8 +139,12 @@ class CollectionActions { await CollectionsService.instance.createShareUrl(collection); return collection; } catch (e, s) { - await showGenericErrorDialog(context: context, error: e); - logger.severe("Failing to create link for selected files", e, s); + if (e is SharingNotPermittedForFreeAccountsError) { + await _showUnSupportedAlert(context); + } else { + logger.severe("Failing to create link for selected files", e, s); + await showGenericErrorDialog(context: context, error: e); + } } return null; } @@ -327,7 +331,7 @@ class CollectionActions { } catch (e) { await dialog?.hide(); if (e is SharingNotPermittedForFreeAccountsError) { - _showUnSupportedAlert(context); + await _showUnSupportedAlert(context); } else { logger.severe("failed to share collection", e); await showGenericErrorDialog(context: context, error: e); @@ -641,7 +645,7 @@ class CollectionActions { return true; } - void _showUnSupportedAlert(BuildContext context) { + Future _showUnSupportedAlert(BuildContext context) async { final AlertDialog alert = AlertDialog( title: Text(S.of(context).sorry), content: Text( @@ -680,7 +684,7 @@ class CollectionActions { ], ); - showDialog( + return showDialog( context: context, builder: (BuildContext context) { return alert;