π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Show subscription required dialog for free users in file sharing
AmanRajSinghMouryad8573ad33045
diff --git a/mobile/apps/locker/lib/utils/collection_actions.dart b/mobile/apps/locker/lib/utils/collection_actions.dartindex a4609ddf6e..9f4f4cc26b 100644--- a/mobile/apps/locker/lib/utils/collection_actions.dart+++ b/mobile/apps/locker/lib/utils/collection_actions.dart@@ -23,6 +23,7 @@ import "package:locker/services/configuration.dart";import "package:locker/services/trash/trash_service.dart";import "package:locker/ui/components/delete_confirmation_dialog.dart";import "package:locker/ui/components/input_dialog_sheet.dart";+import "package:locker/ui/components/subscription_required_dialog.dart";import 'package:logging/logging.dart';/// Utility class for common collection actions like edit and delete@@ -434,7 +435,7 @@ class CollectionActions {return true;} catch (e) {if (e is SharingNotPermittedForFreeAccountsError) {- await _showUnSupportedAlert(context);+ await showSubscriptionRequiredDialog(context);} else {_logger.severe("Failed to update shareUrl collection", e);await showGenericErrorDialog(context: context, error: e);@@ -486,55 +487,6 @@ class CollectionActions {}}- static Future<void> _showUnSupportedAlert(BuildContext context) async {- final AlertDialog alert = AlertDialog(- title: const Text("Sorry"),- content: const Text(- "You need an active paid subscription to enable sharing.",- ),- actions: [- ButtonWidget(- buttonType: ButtonType.primary,- isInAlert: true,- shouldStickToDarkTheme: false,- buttonAction: ButtonAction.first,- shouldSurfaceExecutionStates: true,- labelText: "Subscribe",- onTap: () async {- // TODO: If we are having subscriptions for locker- // Navigator.of(context).push(- // MaterialPageRoute(- // builder: (BuildContext context) {- // return getSubscriptionPage();- // },- // ),- // ).ignore();- Navigator.of(context).pop();- },- ),- Padding(- padding: const EdgeInsets.only(top: 8.0),- child: ButtonWidget(- buttonType: ButtonType.secondary,- buttonAction: ButtonAction.cancel,- isInAlert: true,- shouldStickToDarkTheme: false,- labelText: context.l10n.ok,- ),- ),- ],- );-- return showDialog(- useRootNavigator: false,- context: context,- builder: (BuildContext context) {- return alert;- },- barrierDismissible: true,- );- }-Future<bool> doesEmailHaveAccount(BuildContext context,String email, {@@ -651,7 +603,7 @@ class CollectionActions {} catch (e) {await dialog?.hide();if (e is SharingNotPermittedForFreeAccountsError) {- await _showUnSupportedAlert(context);+ await showSubscriptionRequiredDialog(context);} else {_logger.severe("failed to share collection", e);await showGenericErrorDialog(context: context, error: e);diff --git a/mobile/apps/locker/lib/utils/file_actions.dart b/mobile/apps/locker/lib/utils/file_actions.dartindex 3fb015aa8d..4a92ee3e4d 100644--- a/mobile/apps/locker/lib/utils/file_actions.dart+++ b/mobile/apps/locker/lib/utils/file_actions.dart@@ -2,6 +2,7 @@ import "package:ente_ui/components/buttons/button_widget.dart";import "package:ente_ui/utils/dialog_util.dart";import "package:ente_ui/utils/toast_util.dart";import "package:flutter/material.dart";+import "package:locker/core/errors.dart";import "package:locker/l10n/l10n.dart";import "package:locker/models/info/info_item.dart";import "package:locker/services/collections/collections_service.dart";@@ -15,6 +16,7 @@ import "package:locker/services/trash/trash_service.dart";import "package:locker/ui/components/delete_confirmation_dialog.dart";import "package:locker/ui/components/file_edit_dialog.dart";import "package:locker/ui/components/share_link_dialog.dart";+import "package:locker/ui/components/subscription_required_dialog.dart";import "package:locker/ui/pages/account_credentials_page.dart";import "package:locker/ui/pages/base_info_page.dart";import "package:locker/ui/pages/emergency_contact_page.dart";@@ -263,10 +265,14 @@ class FileActions {await dialog.hide();if (context.mounted) {- showToast(- context,- '${context.l10n.failedToCreateShareLink}: ${e.toString()}',- );+ if (e is SharingNotPermittedForFreeAccountsError) {+ await showSubscriptionRequiredDialog(context);+ } else {+ showToast(+ context,+ context.l10n.failedToCreateShareLink,+ );+ }}}}