Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:matrix/matrix.dart';

import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/routes/home/signup/registration_email_popup.dart';
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
import 'package:fluffychat/widgets/adaptive_dialogs/show_text_input_dialog.dart';
import 'package:fluffychat/widgets/future_loading_dialog.dart';
Expand Down Expand Up @@ -44,31 +45,37 @@ class Settings3PidController extends State<Settings3Pid> {
),
);
if (response.error != null) return;
final ok = await showOkAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).weSentYouAnEmail,
// #Pangea
// message: L10n.of(context).pleaseClickOnLink,
message: L10n.of(context).clickOnEmailLinkDesc,
// Pangea#
okLabel: L10n.of(context).iHaveClickedOnLink,
);
if (ok != OkCancelResult.ok) return;
final success = await showFutureLoadingDialog(
context: context,
delay: false,
future: () => Matrix.of(context).client.uiaRequestBackground(
(auth) => Matrix.of(
context,
).client.add3PID(clientSecret, response.result!.sid, auth: auth),
),
// #Pangea
showError: (e) => !e.toString().contains("Request has been canceled"),
// Pangea#
);
if (success.error != null) return;
setState(() => request = null);
if (OkCancelResult.ok ==
await showDialog<OkCancelResult?>(
useRootNavigator: false,
barrierDismissible: false,
context: context,
builder: (context) => RegistrationEmailPopup(
onResendEmail: () async {
Settings3Pid.sendAttempt++;
await Matrix.of(context).client.requestTokenToRegisterEmail(
clientSecret,
input,
Settings3Pid.sendAttempt,
);
},
Comment on lines +54 to +61

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Add error handling and loading feedback for the resend action.

Currently, the onResendEmail callback fires a network request without any visual loading state or error handling. If the request fails, the exception will be unhandled and the user will not receive any feedback.

Consider wrapping the request with showFutureLoadingDialog (as done for the initial request) to provide a loading indicator and to handle potential errors gracefully.

💻 Proposed fix
-            onResendEmail: () async {
-              Settings3Pid.sendAttempt++;
-              await Matrix.of(context).client.requestTokenToRegisterEmail(
-                clientSecret,
-                input,
-                Settings3Pid.sendAttempt,
-              );
-            },
+            onResendEmail: () async {
+              Settings3Pid.sendAttempt++;
+              await showFutureLoadingDialog(
+                context: context,
+                future: () => Matrix.of(context).client.requestTokenToRegisterEmail(
+                  clientSecret,
+                  input,
+                  Settings3Pid.sendAttempt,
+                ),
+              );
+            },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
onResendEmail: () async {
Settings3Pid.sendAttempt++;
await Matrix.of(context).client.requestTokenToRegisterEmail(
clientSecret,
input,
Settings3Pid.sendAttempt,
);
},
onResendEmail: () async {
Settings3Pid.sendAttempt++;
await showFutureLoadingDialog(
context: context,
future: () => Matrix.of(context).client.requestTokenToRegisterEmail(
clientSecret,
input,
Settings3Pid.sendAttempt,
),
);
},
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/routes/settings/settings_security/settings_3pid/settings_3pid.dart`
around lines 53 - 60, Update the onResendEmail callback to wrap
requestTokenToRegisterEmail with the existing showFutureLoadingDialog pattern
used by the initial request, preserving the send-attempt increment and request
arguments while providing loading feedback and graceful error handling.

),
)) {
final success = await showFutureLoadingDialog(
context: context,
delay: false,
future: () => Matrix.of(context).client.uiaRequestBackground(
(auth) => Matrix.of(
context,
).client.add3PID(clientSecret, response.result!.sid, auth: auth),
),
// #Pangea
showError: (e) => !e.toString().contains("Request has been canceled"),
// Pangea#
);
if (success.error != null) return;
setState(() => request = null);
}
}

Future<List<ThirdPartyIdentifier>?>? request;
Expand Down
Loading