mirror of
https://github.com/ente-io/ente.git
synced 2025-08-08 07:28:26 +00:00
[mob] Legacy UX fixes
This commit is contained in:
parent
ebf92dba94
commit
7b85d216dd
@ -1,9 +1,7 @@
|
||||
import "dart:async";
|
||||
|
||||
import "package:flutter/foundation.dart";
|
||||
import 'package:flutter/material.dart';
|
||||
import "package:flutter_svg/flutter_svg.dart";
|
||||
import "package:logging/logging.dart";
|
||||
import 'package:photos/core/configuration.dart';
|
||||
import "package:photos/emergency/emergency_service.dart";
|
||||
import "package:photos/emergency/model.dart";
|
||||
@ -316,13 +314,24 @@ class _EmergencyPageState extends State<EmergencyPage> {
|
||||
currentUser,
|
||||
);
|
||||
} else {
|
||||
await routeToPage(
|
||||
context,
|
||||
OtherContactPage(
|
||||
contact: currentUser,
|
||||
emergencyInfo: info!,
|
||||
await Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return OtherContactPage(
|
||||
contact: currentUser,
|
||||
emergencyInfo: info!,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
// await routeToPage(
|
||||
// context,
|
||||
// OtherContactPage(
|
||||
// contact: currentUser,
|
||||
// emergencyInfo: info!,
|
||||
// ),
|
||||
// );
|
||||
if (mounted) {
|
||||
unawaited(_fetchData());
|
||||
}
|
||||
@ -538,7 +547,7 @@ class _EmergencyPageState extends State<EmergencyPage> {
|
||||
isInAlert: true,
|
||||
),
|
||||
],
|
||||
body: "$emergencyContactEmail is trying to recover your account.",
|
||||
body: "$emergencyContactEmail is trying to recover your accountx.",
|
||||
actionSheetType: ActionSheetType.defaultActionSheet,
|
||||
);
|
||||
return;
|
||||
|
@ -5,9 +5,11 @@ import "package:photos/emergency/emergency_service.dart";
|
||||
import "package:photos/emergency/model.dart";
|
||||
import "package:photos/emergency/recover_others_account.dart";
|
||||
import "package:photos/generated/l10n.dart";
|
||||
import "package:photos/l10n/l10n.dart";
|
||||
import "package:photos/models/key_attributes.dart";
|
||||
import "package:photos/theme/colors.dart";
|
||||
import "package:photos/theme/ente_theme.dart";
|
||||
import "package:photos/ui/components/action_sheet_widget.dart";
|
||||
import "package:photos/ui/components/buttons/button_widget.dart";
|
||||
import "package:photos/ui/components/captioned_text_widget.dart";
|
||||
import "package:photos/ui/components/menu_item_widget/menu_item_widget.dart";
|
||||
@ -36,7 +38,6 @@ class OtherContactPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _OtherContactPageState extends State<OtherContactPage> {
|
||||
late String recoverDelayTime;
|
||||
late String accountEmail = widget.contact.user.email;
|
||||
RecoverySessions? recoverySession;
|
||||
String? waitTill;
|
||||
@ -46,7 +47,6 @@ class _OtherContactPageState extends State<OtherContactPage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
recoverDelayTime = "${(widget.contact.recoveryNoticeInDays ~/ 24)} days";
|
||||
recoverySession = widget.emergencyInfo.othersRecoverySession
|
||||
.firstWhereOrNull((session) => session.user.email == accountEmail);
|
||||
_fetchData();
|
||||
@ -62,7 +62,9 @@ class _OtherContactPageState extends State<OtherContactPage> {
|
||||
);
|
||||
});
|
||||
}
|
||||
} catch (ignored) {}
|
||||
} catch (e) {
|
||||
_logger.severe("Error fetching data", e);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@ -93,8 +95,8 @@ class _OtherContactPageState extends State<OtherContactPage> {
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
const TitleBarTitleWidget(
|
||||
title: "Recover account",
|
||||
TitleBarTitleWidget(
|
||||
title: context.l10n.recoverAccount,
|
||||
),
|
||||
Text(
|
||||
accountEmail,
|
||||
@ -108,16 +110,16 @@ class _OtherContactPageState extends State<OtherContactPage> {
|
||||
const SizedBox(height: 12),
|
||||
recoverySession == null
|
||||
? Text(
|
||||
"You can recover $accountEmail account $recoverDelayTime"
|
||||
" after starting recovery process.",
|
||||
"You can recover $accountEmail's account in ${widget.contact.recoveryNoticeInDays} days"
|
||||
" after starting the recovery process.",
|
||||
style: textTheme.body,
|
||||
)
|
||||
: Text(
|
||||
"You can recover $accountEmail's"
|
||||
" account after $waitTill ",
|
||||
" account after $waitTill.",
|
||||
style: textTheme.bodyBold,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 24),
|
||||
if (recoverySession == null)
|
||||
ButtonWidget(
|
||||
// icon: Icons.start_outlined,
|
||||
@ -143,9 +145,10 @@ class _OtherContactPageState extends State<OtherContactPage> {
|
||||
_fetchData().ignore();
|
||||
await showErrorDialog(
|
||||
context,
|
||||
"Done",
|
||||
"Please visit page after $recoverDelayTime to"
|
||||
" recover $accountEmail's account.",
|
||||
context.l10n.recoveryInitiated,
|
||||
context.l10n.recoveryInitiatedDesc(
|
||||
widget.contact.recoveryNoticeInDays,
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
@ -161,7 +164,7 @@ class _OtherContactPageState extends State<OtherContactPage> {
|
||||
ButtonWidget(
|
||||
// icon: Icons.start_outlined,
|
||||
buttonType: ButtonType.primary,
|
||||
labelText: "Recover account",
|
||||
labelText: context.l10n.recoverAccount,
|
||||
onTap: () async {
|
||||
final (String key, KeyAttributes attributes) =
|
||||
await EmergencyContactService.instance
|
||||
@ -210,26 +213,7 @@ class _OtherContactPageState extends State<OtherContactPage> {
|
||||
menuItemColor: getEnteColorScheme(context).fillFaint,
|
||||
surfaceExecutionStates: false,
|
||||
onTap: () async {
|
||||
await showChoiceActionSheet(
|
||||
context,
|
||||
title: "Remove",
|
||||
firstButtonLabel: S.of(context).yes,
|
||||
body: "Are you sure your want to stop being a trusted "
|
||||
"contact for $accountEmail?",
|
||||
isCritical: true,
|
||||
firstButtonOnTap: () async {
|
||||
try {
|
||||
await EmergencyContactService.instance.updateContact(
|
||||
widget.contact,
|
||||
ContactState.contactLeft,
|
||||
);
|
||||
Navigator.of(context).pop(true);
|
||||
} catch (e) {
|
||||
showGenericErrorDialog(context: context, error: e)
|
||||
.ignore();
|
||||
}
|
||||
},
|
||||
);
|
||||
await showRemoveSheet();
|
||||
},
|
||||
),
|
||||
],
|
||||
@ -237,4 +221,44 @@ class _OtherContactPageState extends State<OtherContactPage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> showRemoveSheet() async {
|
||||
await showActionSheet(
|
||||
context: context,
|
||||
buttons: [
|
||||
ButtonWidget(
|
||||
labelText: context.l10n.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(true);
|
||||
} catch (e) {
|
||||
showGenericErrorDialog(context: context, error: e).ignore();
|
||||
}
|
||||
},
|
||||
isInAlert: true,
|
||||
),
|
||||
ButtonWidget(
|
||||
labelText: S.of(context).cancel,
|
||||
buttonType: ButtonType.tertiary,
|
||||
buttonSize: ButtonSize.large,
|
||||
buttonAction: ButtonAction.third,
|
||||
shouldStickToDarkTheme: true,
|
||||
isInAlert: true,
|
||||
),
|
||||
],
|
||||
body: "Are you sure your want to stop being a trusted "
|
||||
"contact for $accountEmail?",
|
||||
title: context.l10n.remove,
|
||||
actionSheetType: ActionSheetType.defaultActionSheet,
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
8
mobile/lib/generated/intl/messages_en.dart
generated
8
mobile/lib/generated/intl/messages_en.dart
generated
@ -157,6 +157,9 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
|
||||
static String m52(storeName) => "Rate us on ${storeName}";
|
||||
|
||||
static String m83(days) =>
|
||||
"You can access the account after ${days} days. You will get a notification on your registered email.";
|
||||
|
||||
static String m53(storageInGB) =>
|
||||
"3. Both of you get ${storageInGB} GB* free";
|
||||
|
||||
@ -1351,6 +1354,11 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"recoverAccount":
|
||||
MessageLookupByLibrary.simpleMessage("Recover account"),
|
||||
"recoverButton": MessageLookupByLibrary.simpleMessage("Recover"),
|
||||
"recoveryAccount":
|
||||
MessageLookupByLibrary.simpleMessage("Recover account"),
|
||||
"recoveryInitiated":
|
||||
MessageLookupByLibrary.simpleMessage("Recovery initiated"),
|
||||
"recoveryInitiatedDesc": m83,
|
||||
"recoveryKey": MessageLookupByLibrary.simpleMessage("Recovery key"),
|
||||
"recoveryKeyCopiedToClipboard": MessageLookupByLibrary.simpleMessage(
|
||||
"Recovery key copied to clipboard"),
|
||||
|
30
mobile/lib/generated/l10n.dart
generated
30
mobile/lib/generated/l10n.dart
generated
@ -10629,6 +10629,26 @@ class S {
|
||||
);
|
||||
}
|
||||
|
||||
/// `Recovery initiated`
|
||||
String get recoveryInitiated {
|
||||
return Intl.message(
|
||||
'Recovery initiated',
|
||||
name: 'recoveryInitiated',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `You can access the account after {days} days. You will get a notification on your registered email.`
|
||||
String recoveryInitiatedDesc(int days) {
|
||||
return Intl.message(
|
||||
'You can access the account after $days days. You will get a notification on your registered email.',
|
||||
name: 'recoveryInitiatedDesc',
|
||||
desc: '',
|
||||
args: [days],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Cancel recovery`
|
||||
String get cancelAccountRecovery {
|
||||
return Intl.message(
|
||||
@ -10639,6 +10659,16 @@ class S {
|
||||
);
|
||||
}
|
||||
|
||||
/// `Recover account`
|
||||
String get recoveryAccount {
|
||||
return Intl.message(
|
||||
'Recover account',
|
||||
name: 'recoveryAccount',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Are you sure you want to cancel recovery?`
|
||||
String get cancelAccountRecoveryBody {
|
||||
return Intl.message(
|
||||
|
@ -1529,7 +1529,18 @@
|
||||
"removeInvite": "Remove invite",
|
||||
"recoveryWarning": "A trusted contact is trying to access your account",
|
||||
"rejectRecovery": "Reject recovery",
|
||||
"recoveryInitiated": "Recovery initiated",
|
||||
"recoveryInitiatedDesc": "You can access the account after {days} days. You will get a notification on your registered email.",
|
||||
"@recoveryInitiatedDesc": {
|
||||
"placeholders": {
|
||||
"days": {
|
||||
"type": "int",
|
||||
"example": "30"
|
||||
}
|
||||
}
|
||||
},
|
||||
"cancelAccountRecovery": "Cancel recovery",
|
||||
"recoveryAccount":"Recover account",
|
||||
"cancelAccountRecoveryBody": "Are you sure you want to cancel recovery?",
|
||||
"startAccountRecoveryTitle": "Start recovery",
|
||||
"whyAddTrustContact": "Trusted contact can help in recovering your data."
|
||||
|
@ -621,7 +621,7 @@ func main() {
|
||||
privateAPI.POST("/emergency-contacts/start-recovery", emergencyHandler.StartRecovery)
|
||||
privateAPI.POST("/emergency-contacts/stop-recovery", emergencyHandler.StopRecovery)
|
||||
privateAPI.POST("/emergency-contacts/reject-recovery", emergencyHandler.RejectRecovery)
|
||||
privateAPI.POST("/emergency-contacts/approve-recovery", emergencyHandler.RejectRecovery)
|
||||
privateAPI.POST("/emergency-contacts/approve-recovery", emergencyHandler.ApproveRecovery)
|
||||
privateAPI.GET("/emergency-contacts/recovery-info/:id", emergencyHandler.GetRecoveryInfo)
|
||||
privateAPI.POST("/emergency-contacts/init-change-password", emergencyHandler.InitChangePassword)
|
||||
privateAPI.POST("/emergency-contacts/change-password", emergencyHandler.ChangePassword)
|
||||
|
@ -73,7 +73,7 @@ func (c *Controller) GetInfo(ctx *gin.Context, userID int64) (*ente.EmergencyDat
|
||||
Email: emergencyContactUser.Email,
|
||||
},
|
||||
State: contact.State,
|
||||
RecoveryNoticeInDays: contact.NoticePeriodInHrs,
|
||||
RecoveryNoticeInDays: contact.NoticePeriodInHrs / 24,
|
||||
}
|
||||
if contact.UserID == userID {
|
||||
userEmergencyContacts = append(userEmergencyContacts, entity)
|
||||
|
Loading…
x
Reference in New Issue
Block a user