Skip to content

armgit / ente

Public Imported from GitHub
0

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

Legacy final

AmanRajSinghMouryadcfaf6f941a8
diff --git a/mobile/packages/legacy/lib/components/invite_bottom_sheet.dart b/mobile/packages/legacy/lib/components/invite_bottom_sheet.dart
deleted file mode 100644
index 6b1cae0b86..0000000000
--- a/mobile/packages/legacy/lib/components/invite_bottom_sheet.dart
+++ /dev/null
@@ -1,118 +0,0 @@
-import "package:ente_legacy/components/gradient_button.dart";
-import "package:ente_strings/ente_strings.dart";
-import "package:ente_ui/theme/colors.dart";
-import "package:ente_ui/theme/ente_theme.dart";
-import "package:ente_ui/theme/text_style.dart";
-import "package:flutter/material.dart";
-
-Future<InviteAction?> showInviteBottomSheet(
- BuildContext context, {
- required String email,
-}) {
- return showModalBottomSheet<InviteAction>(
- context: context,
- isScrollControlled: true,
- isDismissible: true,
- builder: (context) => InviteBottomSheet(email: email),
- );
-}
-
-enum InviteAction { accept, decline }
-
-class InviteBottomSheet extends StatelessWidget {
- final String email;
-
- const InviteBottomSheet({
- required this.email,
- super.key,
- });
-
- @override
- Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
-
- return Container(
- decoration: BoxDecoration(
- color: colorScheme.backgroundElevated2,
- borderRadius: const BorderRadius.only(
- topLeft: Radius.circular(24),
- topRight: Radius.circular(24),
- ),
- ),
- child: SafeArea(
- top: false,
- child: Padding(
- padding: const EdgeInsets.all(16),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- _buildHeader(colorScheme, textTheme),
- const SizedBox(height: 12),
- _buildDescription(colorScheme, textTheme, context),
- const SizedBox(height: 20),
- GradientButton(
- text: context.strings.acceptTrustInvite,
- backgroundColor: colorScheme.primary700,
- onTap: () => Navigator.of(context).pop(InviteAction.accept),
- ),
- const SizedBox(height: 8),
- GradientButton(
- text: context.strings.declineTrustInvite,
- backgroundColor: colorScheme.warning400,
- onTap: () => Navigator.of(context).pop(InviteAction.decline),
- ),
- ],
- ),
- ),
- ),
- );
- }
-
- Widget _buildHeader(
- EnteColorScheme colorScheme,
- EnteTextTheme textTheme,
- ) {
- return Builder(
- builder: (context) => Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Expanded(
- child: Text(
- email,
- style: textTheme.largeBold,
- overflow: TextOverflow.ellipsis,
- ),
- ),
- GestureDetector(
- onTap: () => Navigator.of(context).pop(),
- child: Container(
- padding: const EdgeInsets.all(8),
- decoration: BoxDecoration(
- color: colorScheme.fillFaint,
- shape: BoxShape.circle,
- ),
- child: Icon(
- Icons.close,
- size: 20,
- color: colorScheme.textBase,
- ),
- ),
- ),
- ],
- ),
- );
- }
-
- Widget _buildDescription(
- EnteColorScheme colorScheme,
- EnteTextTheme textTheme,
- BuildContext context,
- ) {
- return Text(
- context.strings.legacyInvite(email),
- style: textTheme.small.copyWith(color: colorScheme.textMuted),
- );
- }
-}
diff --git a/mobile/packages/legacy/lib/components/invite_reject_bottom_sheet.dart b/mobile/packages/legacy/lib/components/invite_reject_bottom_sheet.dart
new file mode 100644
index 0000000000..bcbcc220be
--- /dev/null
+++ b/mobile/packages/legacy/lib/components/invite_reject_bottom_sheet.dart
@@ -0,0 +1,104 @@
+import "package:ente_ui/theme/colors.dart";
+import "package:ente_ui/theme/ente_theme.dart";
+import "package:ente_ui/theme/text_style.dart";
+import "package:flutter/material.dart";
+
+Future<T?> showEmailBottomSheet<T>(
+ BuildContext context, {
+ required String email,
+ required String message,
+ required List<Widget> buttons,
+}) {
+ return showModalBottomSheet<T>(
+ context: context,
+ isScrollControlled: true,
+ isDismissible: true,
+ builder: (context) => _EmailBottomSheet(
+ email: email,
+ message: message,
+ buttons: buttons,
+ ),
+ );
+}
+
+class _EmailBottomSheet extends StatelessWidget {
+ final String email;
+ final String message;
+ final List<Widget> buttons;
+
+ const _EmailBottomSheet({
+ required this.email,
+ required this.message,
+ required this.buttons,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+
+ return Container(
+ decoration: BoxDecoration(
+ color: colorScheme.backgroundElevated2,
+ borderRadius: const BorderRadius.only(
+ topLeft: Radius.circular(24),
+ topRight: Radius.circular(24),
+ ),
+ ),
+ child: SafeArea(
+ top: false,
+ child: Padding(
+ padding: const EdgeInsets.all(16),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ _buildHeader(context, colorScheme, textTheme),
+ const SizedBox(height: 12),
+ Text(
+ message,
+ style: textTheme.small.copyWith(color: colorScheme.textMuted),
+ ),
+ const SizedBox(height: 20),
+ ...buttons,
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+
+ Widget _buildHeader(
+ BuildContext context,
+ EnteColorScheme colorScheme,
+ EnteTextTheme textTheme,
+ ) {
+ return Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Expanded(
+ child: Text(
+ email,
+ style: textTheme.largeBold,
+ overflow: TextOverflow.ellipsis,
+ ),
+ ),
+ GestureDetector(
+ onTap: () => Navigator.of(context).pop(),
+ child: Container(
+ padding: const EdgeInsets.all(8),
+ decoration: BoxDecoration(
+ color: colorScheme.fillFaint,
+ shape: BoxShape.circle,
+ ),
+ child: Icon(
+ Icons.close,
+ size: 20,
+ color: colorScheme.textBase,
+ ),
+ ),
+ ),
+ ],
+ );
+ }
+}
diff --git a/mobile/packages/legacy/lib/pages/emergency_page.dart b/mobile/packages/legacy/lib/pages/emergency_page.dart
index d1a5774807..43cdf34de9 100644
--- a/mobile/packages/legacy/lib/pages/emergency_page.dart
+++ b/mobile/packages/legacy/lib/pages/emergency_page.dart
@@ -3,7 +3,7 @@ import "dart:async";
import "package:ente_configuration/base_configuration.dart";
import "package:ente_legacy/components/alert_bottom_sheet.dart";
import "package:ente_legacy/components/gradient_button.dart";
-import "package:ente_legacy/components/invite_bottom_sheet.dart";
+import "package:ente_legacy/components/invite_reject_bottom_sheet.dart";
import "package:ente_legacy/components/trusted_contact_bottom_sheet.dart";
import "package:ente_legacy/models/emergency_models.dart";
import "package:ente_legacy/pages/other_contact_page.dart";
@@ -17,7 +17,6 @@ import "package:ente_ui/components/divider_widget.dart";
import "package:ente_ui/components/loading_widget.dart";
import "package:ente_ui/components/menu_item_widget_v2.dart";
import "package:ente_ui/components/menu_section_title.dart";
-import "package:ente_ui/components/notification_widget.dart";
import "package:ente_ui/components/title_bar_title_widget.dart";
import "package:ente_ui/theme/ente_theme.dart";
import "package:ente_ui/utils/toast_util.dart";
@@ -130,11 +129,8 @@ class _EmergencyPageState extends State<EmergencyPage> {
if (index == 0) {
return Padding(
padding: const EdgeInsets.only(bottom: 16.0),
- child: NotificationWidget(
- startIcon: Icons.warning_amber_rounded,
+ child: _WarningBanner(
text: context.strings.recoveryWarning,
- actionIcon: null,
- onTap: () {},
),
);
}
@@ -425,11 +421,11 @@ class _EmergencyPageState extends State<EmergencyPage> {
final confirmed = await showAlertBottomSheet<bool>(
context,
title: isPending
- ? context.strings.cancelInviteTitle
- : context.strings.removeContactTitle,
+ ? context.strings.cancelInvite
+ : context.strings.removeContact,
message: isPending
- ? context.strings.cancelInviteMessage
- : context.strings.removeContactMessage,
+ ? context.strings.cancelInviteDesc
+ : context.strings.removeContactDesc,
assetPath: "assets/warning-grey.png",
buttons: [
SizedBox(
@@ -445,7 +441,7 @@ class _EmergencyPageState extends State<EmergencyPage> {
],
);
- if (confirmed!) {
+ if (confirmed == true) {
await EmergencyContactService.instance
.updateContact(contact, ContactState.userRevokedContact);
info?.contacts.remove(contact);
@@ -492,12 +488,37 @@ class _EmergencyPageState extends State<EmergencyPage> {
BuildContext context,
EmergencyContact contact,
) async {
- final result = await showInviteBottomSheet(
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+
+ final result = await showEmailBottomSheet<String>(
context,
email: contact.user.email,
+ message: context.strings.legacyInvite(contact.user.email),
+ buttons: [
+ GradientButton(
+ text: context.strings.acceptTrustInvite,
+ backgroundColor: colorScheme.primary700,
+ onTap: () => Navigator.of(context).pop("accept"),
+ ),
+ const SizedBox(height: 16),
+ Center(
+ child: GestureDetector(
+ onTap: () => Navigator.of(context).pop("decline"),
+ child: Text(
+ context.strings.declineTrustInvite,
+ style: textTheme.bodyBold.copyWith(
+ color: colorScheme.warning400,
+ decoration: TextDecoration.underline,
+ decorationColor: colorScheme.warning400,
+ ),
+ ),
+ ),
+ ),
+ ],
);
- if (result == InviteAction.accept) {
+ if (result == "accept") {
await EmergencyContactService.instance
.updateContact(contact, ContactState.contactAccepted);
final updatedContact =
@@ -507,7 +528,7 @@ class _EmergencyPageState extends State<EmergencyPage> {
if (mounted) {
setState(() {});
}
- } else if (result == InviteAction.decline) {
+ } else if (result == "decline") {
await EmergencyContactService.instance
.updateContact(contact, ContactState.contactDenied);
info?.othersEmergencyContact.remove(contact);
@@ -521,35 +542,31 @@ class _EmergencyPageState extends State<EmergencyPage> {
final String emergencyContactEmail = session.emergencyContact.email;
final colorScheme = getEnteColorScheme(context);
- final confirmed = await showAlertBottomSheet<bool>(
+ final confirmed = await showEmailBottomSheet<bool>(
context,
- title: context.strings.recoveryWarning,
+ email: emergencyContactEmail,
message: context.strings.recoveryWarningBody(emergencyContactEmail),
- assetPath: "assets/warning-grey.png",
buttons: [
- SizedBox(
- width: double.infinity,
- child: GradientButton(
- text: context.strings.rejectRecovery,
- backgroundColor: colorScheme.warning700,
- onTap: () => Navigator.of(context).pop(true),
- ),
+ GradientButton(
+ text: context.strings.rejectRecovery,
+ backgroundColor: colorScheme.warning700,
+ onTap: () => Navigator.of(context).pop(true),
),
- if (kDebugMode)
- SizedBox(
- width: double.infinity,
- child: GradientButton(
- text: "Approve recovery (to be removed)",
- onTap: () async {
- Navigator.of(context).pop();
- await EmergencyContactService.instance.approveRecovery(session);
- if (mounted) {
- setState(() {});
- }
- unawaited(_fetchData());
- },
- ),
+ if (kDebugMode) ...[
+ const SizedBox(height: 8),
+ GradientButton(
+ text: "Approve recovery (to be removed)",
+ backgroundColor: colorScheme.primary700,
+ onTap: () async {
+ Navigator.of(context).pop();
+ await EmergencyContactService.instance.approveRecovery(session);
+ if (mounted) {
+ setState(() {});
+ }
+ unawaited(_fetchData());
+ },
),
+ ],
],
);
@@ -563,3 +580,37 @@ class _EmergencyPageState extends State<EmergencyPage> {
}
}
}
+
+class _WarningBanner extends StatelessWidget {
+ final String text;
+
+ const _WarningBanner({required this.text});
+
+ @override
+ Widget build(BuildContext context) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+
+ return Container(
+ padding: const EdgeInsets.all(18),
+ decoration: BoxDecoration(
+ color: colorScheme.warning400.withOpacity(0.13),
+ borderRadius: BorderRadius.circular(20),
+ ),
+ child: Row(
+ children: [
+ Image.asset("assets/warning-grey.png", width: 20, height: 20),
+ const SizedBox(width: 16),
+ Expanded(
+ child: Text(
+ text,
+ style: textTheme.bodyBold.copyWith(
+ color: colorScheme.warning400,
+ ),
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+}
diff --git a/mobile/packages/legacy/lib/pages/other_contact_page.dart b/mobile/packages/legacy/lib/pages/other_contact_page.dart
index cbe5ba1477..f71633ba75 100644
--- a/mobile/packages/legacy/lib/pages/other_contact_page.dart
+++ b/mobile/packages/legacy/lib/pages/other_contact_page.dart
@@ -3,18 +3,13 @@ import "dart:async";
import "package:collection/collection.dart";
import "package:ente_base/models/key_attributes.dart";
import "package:ente_configuration/base_configuration.dart";
+import "package:ente_legacy/components/alert_bottom_sheet.dart";
+import "package:ente_legacy/components/gradient_button.dart";
import "package:ente_legacy/models/emergency_models.dart";
import "package:ente_legacy/pages/recover_others_account.dart";
import "package:ente_legacy/services/emergency_service.dart";
import "package:ente_strings/ente_strings.dart";
-import "package:ente_ui/components/action_sheet_widget.dart";
-import "package:ente_ui/components/buttons/button_widget.dart";
-import "package:ente_ui/components/buttons/models/button_type.dart";
-import "package:ente_ui/components/captioned_text_widget.dart";
-import "package:ente_ui/components/menu_item_widget.dart";
-import "package:ente_ui/components/menu_section_title.dart";
import "package:ente_ui/components/title_bar_title_widget.dart";
-import "package:ente_ui/theme/colors.dart";
import "package:ente_ui/theme/ente_theme.dart";
import "package:ente_ui/utils/dialog_util.dart";
import "package:ente_utils/navigation_util.dart";
@@ -85,151 +80,176 @@ class _OtherContactPageState extends State<OtherContactPage> {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
return Scaffold(
- appBar: AppBar(),
+ appBar: AppBar(
+ toolbarHeight: 48,
+ leadingWidth: 48,
+ leading: GestureDetector(
+ onTap: () {
+ Navigator.pop(context);
+ },
+ child: const Icon(
+ Icons.arrow_back_outlined,
+ ),
+ ),
+ ),
body: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ padding: const EdgeInsets.all(16.0),
child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- SafeArea(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const SizedBox(height: 12),
- TitleBarTitleWidget(
- title: context.strings.recoverAccount,
- ),
- Text(
- accountEmail,
- textAlign: TextAlign.left,
- style:
- textTheme.small.copyWith(color: colorScheme.textMuted),
- ),
- ],
- ),
+ TitleBarTitleWidget(
+ title: context.strings.recoverAccount,
+ ),
+ Text(
+ accountEmail,
+ style: textTheme.smallMuted,
),
const SizedBox(height: 12),
- recoverySession == null
- ? Text(
- "You can recover $accountEmail's account in ${widget.contact.recoveryNoticeInDays} days"
- " after starting the recovery process.",
- style: textTheme.body,
- )
- : (recoverySession!.status == "READY"
- ? Text(
- "Recovery ready for $accountEmail",
- style: textTheme.body,
- )
- : Text(
- "You can recover $accountEmail's"
- " account after $waitTill.",
- style: textTheme.bodyBold,
- )),
+ // Description text based on recovery state
+ if (recoverySession == null)
+ Text(
+ context.strings.recoverAccountDesc(
+ accountEmail,
+ widget.contact.recoveryNoticeInDays,
+ ),
+ style: textTheme.smallMuted,
+ ),
+ if (recoverySession != null && recoverySession!.status == "READY")
+ Text(
+ context.strings.recoveryReady(accountEmail),
+ style: textTheme.smallMuted,
+ ),
+ if (recoverySession != null && recoverySession!.status == "WAITING")
+ Text(
+ context.strings.recoverAccountAfter(
+ accountEmail,
+ waitTill!,
+ ),
+ style: textTheme.smallMuted,
+ ),
const SizedBox(height: 24),
+ // Start recovery button (no active session)
if (recoverySession == null)
- ButtonWidget(
- // icon: Icons.start_outlined,
- buttonType: ButtonType.trailingIconPrimary,
- icon: Icons.start_outlined,
- labelText: context.strings.startAccountRecoveryTitle,
+ GradientButton(
+ text: context.strings.startRecovery,
+ backgroundColor: colorScheme.primary700,
onTap: widget.contact.isPendingInvite()
- ? null
+ ? () {}
: () async {
- final actionResult = await showChoiceActionSheet(
+ final confirmed = await showAlertBottomSheet<bool>(
context,
- title: context.strings.startAccountRecoveryTitle,
- firstButtonLabel: context.strings.yes,
- body: "Are you sure you want to initiate recovery?",
- isCritical: true,
+ title: context.strings.startRecovery,
+ message:
+ context.strings.startRecoveryDesc(accountEmail),
+ assetPath: "assets/warning-grey.png",
+ buttons: [
+ SizedBox(
+ width: double.infinity,
+ child: GradientButton(
+ text: context.strings.startRecovery,
+ backgroundColor: colorScheme.primary700,
+ onTap: () => Navigator.of(context).pop(true),
+ ),
+ ),
+ ],
);
- if (actionResult?.action != null) {
- if (actionResult!.action == ButtonAction.first) {
- try {
- await EmergencyContactService.instance
- .startRecovery(widget.contact);
- if (mounted) {
- _fetchData().ignore();
- await showErrorDialog(
- context,
- context.strings.recoveryInitiated,
- context.strings.recoveryInitiatedDesc(
- widget.contact.recoveryNoticeInDays,
- widget.config.getEmail()!,
- ),
- );
- }
- } catch (e) {
- showGenericErrorDialog(context: context, error: e)
- .ignore();
+
+ if (confirmed == true) {
+ try {
+ await EmergencyContactService.instance
+ .startRecovery(widget.contact);
+ if (mounted) {
+ _fetchData().ignore();
+ await showAlertBottomSheet(
+ context,
+ title: context.strings.recoveryInitiated,
+ message: context.strings.recoveryInitiatedDesc(
+ widget.contact.recoveryNoticeInDays,
+ widget.config.getEmail()!,
+ ),
+ assetPath: "assets/warning-grey.png",
+ );
}
+ } catch (e) {
+ showGenericErrorDialog(context: context, error: e)
+ .ignore();
}
}
},
),
if (recoverySession != null && recoverySession!.status == "READY")
- Padding(
- padding: const EdgeInsets.only(bottom: 12.0),
- child: ButtonWidget(
- buttonType: ButtonType.primary,
- labelText: context.strings.recoverAccount,
- onTap: () async {
- try {
- final (String key, KeyAttributes attributes) =
- await EmergencyContactService.instance
- .getRecoveryInfo(recoverySession!);
- routeToPage(
- context,
- RecoverOthersAccount(key, attributes, recoverySession!),
- ).ignore();
- } catch (e) {
- showGenericErrorDialog(context: context, error: e)
- .ignore();
- }
- },
- ),
+ GradientButton(
+ text: context.strings.recoverAccount,
+ backgroundColor: colorScheme.primary700,
+ onTap: () async {
+ try {
+ final (String key, KeyAttributes attributes) =
+ await EmergencyContactService.instance
+ .getRecoveryInfo(recoverySession!);
+ routeToPage(
+ context,
+ RecoverOthersAccount(key, attributes, recoverySession!),
+ ).ignore();
+ } catch (e) {
+ showGenericErrorDialog(context: context, error: e).ignore();
+ }
+ },
+ ),
+ if (recoverySession != null && recoverySession!.status == "WAITING")
+ GradientButton(
+ text: context.strings.cancelRecovery,
+ backgroundColor: colorScheme.primary700,
+ onTap: () => _showCancelRecoverySheet(),
),
if (recoverySession != null &&
- (recoverySession!.status == "WAITING" ||
- recoverySession!.status == "READY"))
- ButtonWidget(
- buttonType: ButtonType.neutral,
- labelText: context.strings.cancelAccountRecovery,
- shouldSurfaceExecutionStates: false,
+ recoverySession!.status == "READY") ...[
+ const SizedBox(height: 16),
+ Center(
+ child: GestureDetector(
+ onTap: () => _showCancelRecoverySheet(),
+ child: Text(
+ context.strings.cancelRecovery,
+ style: textTheme.bodyBold.copyWith(
+ color: colorScheme.warning400,
+ decoration: TextDecoration.underline,
+ decorationColor: colorScheme.warning400,
+ ),
+ ),
+ ),
+ ),
+ const SizedBox(height: 24),
+ Text(
+ context.strings.orRemoveYourself(accountEmail),
+ style: textTheme.smallMuted,
+ ),
+ const SizedBox(height: 12),
+ GradientButton(
+ text: context.strings.removeContact,
+ backgroundColor: colorScheme.warning400,
onTap: () async {
- final actionResult = await showChoiceActionSheet(
- context,
- title: context.strings.cancelAccountRecovery,
- firstButtonLabel: context.strings.yes,
- body: context.strings.cancelAccountRecoveryBody,
- isCritical: true,
- firstButtonOnTap: () async {
- await EmergencyContactService.instance
- .stopRecovery(recoverySession!);
- },
- );
- if (actionResult?.action == ButtonAction.first) {
- _fetchData().ignore();
- }
+ await showRemoveSheet();
},
),
- MenuSectionTitle(
- title: context.strings.removeYourselfAsTrustedContact,
- ),
- MenuItemWidget(
- captionedTextWidget: CaptionedTextWidget(
- title: context.strings.remove,
- textColor: warning500,
- makeTextBold: true,
+ ],
+ if (recoverySession == null ||
+ recoverySession!.status != "READY") ...[
+ const SizedBox(height: 16),
+ Center(
+ child: GestureDetector(
+ onTap: () async {
+ await showRemoveSheet();
+ },
+ child: Text(
+ context.strings.removeContact,
+ style: textTheme.bodyBold.copyWith(
+ color: colorScheme.warning400,
+ decoration: TextDecoration.underline,
+ decorationColor: colorScheme.warning400,
+ ),
+ ),
+ ),
),
- leadingIcon: Icons.not_interested_outlined,
- leadingIconColor: warning500,
- menuItemColor: colorScheme.fillFaint,
- surfaceExecutionStates: false,
- onTap: () async {
- await showRemoveSheet();
- },
- ),
+ ],
],
),
),
@@ -245,43 +265,68 @@ class _OtherContactPageState extends State<OtherContactPage> {
);
}
- Future<void> showRemoveSheet() async {
- await showActionSheet(
- context: context,
+ Future<void> _showCancelRecoverySheet() async {
+ final colorScheme = getEnteColorScheme(context);
+ final confirmed = await showAlertBottomSheet<bool>(
+ context,
+ title: context.strings.cancelRecovery,
+ message: context.strings.cancelRecoveryDesc(accountEmail),
+ assetPath: "assets/warning-grey.png",
buttons: [
- ButtonWidget(
- labelText: context.strings.remove,
- buttonSize: ButtonSize.large,
- shouldStickToDarkTheme: true,
- buttonType: ButtonType.critical,
- buttonAction: ButtonAction.first,
- onTap: () async {
- try {
- await EmergencyContactService.instance.updateContact(
- widget.contact,
- ContactState.contactLeft,
- );
- Navigator.of(context).pop();
- } catch (e) {
- showGenericErrorDialog(context: context, error: e).ignore();
- }
- },
- isInAlert: true,
+ SizedBox(
+ width: double.infinity,
+ child: GradientButton(
+ text: context.strings.cancelRecovery,
+ backgroundColor: colorScheme.warning700,
+ onTap: () => Navigator.of(context).pop(true),
+ ),
),
- ButtonWidget(
- labelText: context.strings.cancel,
- buttonType: ButtonType.tertiary,
- buttonSize: ButtonSize.large,
- buttonAction: ButtonAction.third,
- shouldStickToDarkTheme: true,
- isInAlert: true,
+ ],
+ );
+
+ if (confirmed == true) {
+ try {
+ await EmergencyContactService.instance.stopRecovery(recoverySession!);
+ if (mounted) {
+ _fetchData().ignore();
+ }
+ } catch (e) {
+ showGenericErrorDialog(context: context, error: e).ignore();
+ }
+ }
+ }
+
+ Future<void> showRemoveSheet() async {
+ final colorScheme = getEnteColorScheme(context);
+ final confirmed = await showAlertBottomSheet<bool>(
+ context,
+ title: context.strings.removeContact,
+ message: context.strings.removeYourselfDesc(accountEmail),
+ assetPath: "assets/warning-grey.png",
+ buttons: [
+ SizedBox(
+ width: double.infinity,
+ child: GradientButton(
+ text: context.strings.removeContact,
+ backgroundColor: colorScheme.warning700,
+ onTap: () => Navigator.of(context).pop(true),
+ ),
),
],
- body: "Are you sure your want to stop being a trusted "
- "contact for $accountEmail?",
- title: context.strings.remove,
- actionSheetType: ActionSheetType.defaultActionSheet,
);
- return;
+
+ if (confirmed == true) {
+ try {
+ await EmergencyContactService.instance.updateContact(
+ widget.contact,
+ ContactState.contactLeft,
+ );
+ if (mounted) {
+ Navigator.of(context).pop();
+ }
+ } catch (e) {
+ showGenericErrorDialog(context: context, error: e).ignore();
+ }
+ }
}
}
diff --git a/mobile/packages/legacy/lib/pages/select_contact_page.dart b/mobile/packages/legacy/lib/pages/select_contact_page.dart
index 362874048d..a48c346174 100644
--- a/mobile/packages/legacy/lib/pages/select_contact_page.dart
+++ b/mobile/packages/legacy/lib/pages/select_contact_page.dart
@@ -488,7 +488,7 @@ class _AddContactBottomSheetState extends State<AddContactBottomSheet> {
onTap: _onVerifyTap,
child: Text(
context.strings.verifyIDLabel,
- style: textTheme.body.copyWith(
+ style: textTheme.bodyBold.copyWith(
color: canAdd
? getEnteColorScheme(context).primary700
: getEnteColorScheme(context).textMuted,