From ef057b1775eb46096afcd01cc8c71f39f7a8c6a2 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Mon, 17 Oct 2022 10:43:09 +0200 Subject: [PATCH] fix: UIA request handler --- lib/utils/uia_request_manager.dart | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/utils/uia_request_manager.dart b/lib/utils/uia_request_manager.dart index 4382a047..3ad6a22a 100644 --- a/lib/utils/uia_request_manager.dart +++ b/lib/utils/uia_request_manager.dart @@ -9,6 +9,7 @@ import 'package:fluffychat/widgets/matrix.dart'; extension UiaRequestManager on MatrixState { Future uiaRequestHandler(UiaRequest uiaRequest) async { + final l10n = L10n.of(navigatorContext)!; try { if (uiaRequest.state != UiaRequestState.waitForUser || uiaRequest.nextStages.isEmpty) { @@ -22,9 +23,9 @@ extension UiaRequestManager on MatrixState { final input = cachedPassword ?? (await showTextInputDialog( context: navigatorContext, - title: L10n.of(context)!.pleaseEnterYourPassword, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, + title: l10n.pleaseEnterYourPassword, + okLabel: l10n.ok, + cancelLabel: l10n.cancel, textFields: [ const DialogTextField( minLines: 1, @@ -64,10 +65,10 @@ extension UiaRequestManager on MatrixState { await showOkCancelAlertDialog( useRootNavigator: false, context: navigatorContext, - title: L10n.of(context)!.weSentYouAnEmail, - message: L10n.of(context)!.pleaseClickOnLink, - okLabel: L10n.of(context)!.iHaveClickedOnLink, - cancelLabel: L10n.of(context)!.cancel, + title: l10n.weSentYouAnEmail, + message: l10n.pleaseClickOnLink, + okLabel: l10n.iHaveClickedOnLink, + cancelLabel: l10n.cancel, )) { return uiaRequest.completeStage(auth); } @@ -90,10 +91,10 @@ extension UiaRequestManager on MatrixState { if (OkCancelResult.ok == await showOkCancelAlertDialog( useRootNavigator: false, - message: L10n.of(context)!.pleaseFollowInstructionsOnWeb, + message: l10n.pleaseFollowInstructionsOnWeb, context: navigatorContext, - okLabel: L10n.of(context)!.next, - cancelLabel: L10n.of(context)!.cancel, + okLabel: l10n.next, + cancelLabel: l10n.cancel, )) { return uiaRequest.completeStage( AuthenticationData(session: uiaRequest.session),