Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

refactor: Replace showSubscriptionRequiredDialog with showSubscriptionRequiredSheet for consistency

AmanRajSinghMouryae73337c04544
diff --git a/mobile/apps/locker/lib/ui/components/subscription_required_dialog.dart b/mobile/apps/locker/lib/ui/components/subscription_required_dialog.dart
index 387a2d6a77..6de1cd695e 100644
--- a/mobile/apps/locker/lib/ui/components/subscription_required_dialog.dart
+++ b/mobile/apps/locker/lib/ui/components/subscription_required_dialog.dart
@@ -1,81 +1,14 @@
-import "package:ente_ui/components/close_icon_button.dart";
-import "package:ente_ui/components/title_bar_title_widget.dart";
-import "package:ente_ui/theme/ente_theme.dart";
+import "package:ente_ui/components/alert_bottom_sheet.dart";
import "package:flutter/material.dart";
import "package:locker/l10n/l10n.dart";
-import "package:locker/ui/components/gradient_button.dart";
-/// Shows a dialog indicating that a paid subscription is required
-/// for the requested feature (e.g., sharing).
-Future<void> showSubscriptionRequiredDialog(BuildContext context) async {
- await showDialog<void>(
- context: context,
- barrierDismissible: true,
- builder: (BuildContext dialogContext) {
- return const SubscriptionRequiredDialog();
- },
- );
-}
-
-class SubscriptionRequiredDialog extends StatelessWidget {
- const SubscriptionRequiredDialog({super.key});
+Future<void> showSubscriptionRequiredSheet(BuildContext context) async {
+ final l10n = context.l10n;
- @override
- Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
- final l10n = context.l10n;
-
- return Dialog(
- backgroundColor: colorScheme.backgroundElevated2,
- insetPadding: const EdgeInsets.symmetric(horizontal: 24, vertical: 24),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(24),
- ),
- child: Container(
- constraints: const BoxConstraints(maxWidth: 400),
- padding: const EdgeInsets.all(24),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- TitleBarTitleWidget(
- title: l10n.sorry,
- ),
- const CloseIconButton(),
- ],
- ),
- const SizedBox(height: 16),
- Text(
- l10n.subscriptionRequiredForSharing,
- style: textTheme.body.copyWith(
- color: colorScheme.textMuted,
- ),
- ),
- const SizedBox(height: 24),
- SizedBox(
- width: double.infinity,
- child: GradientButton(
- onTap: () {
- // TODO: If we are having subscriptions for locker
- // Navigator.of(context).push(
- // MaterialPageRoute(
- // builder: (BuildContext context) {
- // return getSubscriptionPage();
- // },
- // ),
- // );
- Navigator.of(context).pop();
- },
- text: l10n.ok,
- ),
- ),
- ],
- ),
- ),
- );
- }
+ await showAlertBottomSheet(
+ context,
+ title: l10n.sorry,
+ message: l10n.subscriptionRequiredForSharing,
+ assetPath: 'assets/warning-blue.png',
+ );
}
diff --git a/mobile/apps/locker/lib/utils/collection_actions.dart b/mobile/apps/locker/lib/utils/collection_actions.dart
index 4a579500e9..1415b6b9ce 100644
--- a/mobile/apps/locker/lib/utils/collection_actions.dart
+++ b/mobile/apps/locker/lib/utils/collection_actions.dart
@@ -428,7 +428,7 @@ class CollectionActions {
return true;
} catch (e) {
if (e is SharingNotPermittedForFreeAccountsError) {
- await showSubscriptionRequiredDialog(context);
+ await showSubscriptionRequiredSheet(context);
} else {
_logger.severe("Failed to update shareUrl collection", e);
await showGenericErrorDialog(context: context, error: e);
@@ -576,7 +576,7 @@ class CollectionActions {
} catch (e) {
await dialog?.hide();
if (e is SharingNotPermittedForFreeAccountsError) {
- await showSubscriptionRequiredDialog(context);
+ await showSubscriptionRequiredSheet(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.dart
index fdb2e70b96..9294ee320b 100644
--- a/mobile/apps/locker/lib/utils/file_actions.dart
+++ b/mobile/apps/locker/lib/utils/file_actions.dart
@@ -270,7 +270,7 @@ class FileActions {
if (context.mounted) {
if (e is SharingNotPermittedForFreeAccountsError) {
- await showSubscriptionRequiredDialog(context);
+ await showSubscriptionRequiredSheet(context);
} else {
showToast(
context,