Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Refactor

ashilkna3db3e496a12
diff --git a/mobile/lib/ui/viewer/people/link_email_screen.dart b/mobile/lib/ui/viewer/people/link_email_screen.dart
index 730a7a6a81..18a93d704f 100644
--- a/mobile/lib/ui/viewer/people/link_email_screen.dart
+++ b/mobile/lib/ui/viewer/people/link_email_screen.dart
@@ -201,37 +201,7 @@ class _LinkEmailScreen extends State<LinkEmailScreen> {
labelText: S.of(context).link,
isDisabled:
!_emailIsValid && (_selectedEmail?.isEmpty ?? true),
- onTap: () async {
- final newEmail =
- _emailIsValid ? _newEmail : _selectedEmail!;
- if (widget.isFromSaveOrEditPerson) {
- await _emailHoldsEnteAccount(newEmail).then((value) {
- if (value) {
- Navigator.of(context).pop(newEmail);
- }
- });
- } else {
- try {
- final result = await linkEmailToPerson(
- newEmail,
- widget.personID!,
- context,
- );
- if (!result) {
- _textController.clear();
- return;
- }
-
- Navigator.of(context).pop(newEmail);
- } catch (e) {
- await showGenericErrorDialog(
- context: context,
- error: e,
- );
- _logger.severe("Failed to link email to person", e);
- }
- }
- },
+ onTap: _onLinkButtonTap,
),
const SizedBox(height: 12),
],
@@ -243,6 +213,37 @@ class _LinkEmailScreen extends State<LinkEmailScreen> {
);
}
+ Future<void> _onLinkButtonTap() async {
+ final newEmail = _emailIsValid ? _newEmail : _selectedEmail!;
+ if (widget.isFromSaveOrEditPerson) {
+ await _emailHoldsEnteAccount(newEmail).then((value) {
+ if (value) {
+ Navigator.of(context).pop(newEmail);
+ }
+ });
+ } else {
+ try {
+ final result = await linkEmailToPerson(
+ newEmail,
+ widget.personID!,
+ context,
+ );
+ if (!result) {
+ _textController.clear();
+ return;
+ }
+
+ Navigator.of(context).pop(newEmail);
+ } catch (e) {
+ await showGenericErrorDialog(
+ context: context,
+ error: e,
+ );
+ _logger.severe("Failed to link email to person", e);
+ }
+ }
+ }
+
List<User> _getContacts() {
final List<User> suggestedUsers = [];
final int ownerID = Configuration.instance.getUserID()!;