Fix can not open new tab for email

(cherry picked from commit f5c569ad340d66d27cf676b4de9602a41ed93fb5)
This commit is contained in:
dab246
2023-09-25 11:04:04 +07:00
committed by Dat H. Pham
parent 78eddecc1a
commit ee5f103048
3 changed files with 46 additions and 44 deletions
@@ -3,7 +3,6 @@ import 'dart:convert';
import 'package:core/core.dart'; import 'package:core/core.dart';
import 'package:dartz/dartz.dart'; import 'package:dartz/dartz.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
@@ -256,22 +255,20 @@ class MailboxDashBoardController extends ReloadableController {
_registerPendingEmailAddress(); _registerPendingEmailAddress();
_registerPendingEmailContents(); _registerPendingEmailContents();
_registerPendingFileInfo(); _registerPendingFileInfo();
_getSessionCurrent(); _handleArguments();
_getAppVersion(); _getAppVersion();
super.onReady(); super.onReady();
} }
void _handleComposerCache() async { void _handleComposerCache() async {
if (kIsWeb && userProfile.value != null) { _getEmailCacheOnWebInteractor.execute().fold(
_getEmailCacheOnWebInteractor.execute().fold( (failure) {},
(failure) {}, (success) {
(success) { if(success is GetComposerCacheSuccess){
if(success is GetComposerCacheSuccess){ openComposerOverlay(ComposerArguments.fromSessionStorageBrowser(success.composerCache));
openComposerOverlay(ComposerArguments.fromSessionStorageBrowser(success.composerCache)); }
} },
}, );
);
}
} }
@override @override
@@ -415,11 +412,7 @@ class MailboxDashBoardController extends ReloadableController {
_handleMessageFromNotification(notificationResponse?.payload, onForeground: false); _handleMessageFromNotification(notificationResponse?.payload, onForeground: false);
} }
void _getUserProfile() async { void _handleArguments() {
userProfile.value = sessionCurrent != null ? UserProfile(sessionCurrent!.username.value) : null;
}
void _getSessionCurrent() {
final arguments = Get.arguments; final arguments = Get.arguments;
log('MailboxDashBoardController::_getSessionCurrent(): arguments = $arguments'); log('MailboxDashBoardController::_getSessionCurrent(): arguments = $arguments');
if (arguments is Session) { if (arguments is Session) {
@@ -455,25 +448,15 @@ class MailboxDashBoardController extends ReloadableController {
} }
void _handleSession(Session session) { void _handleSession(Session session) {
sessionCurrent = session; log('MailboxDashBoardController::_handleSession:');
final personalAccount = sessionCurrent!.personalAccount; _setUpComponentsFromSession(session);
accountId.value = personalAccount.accountId;
_getUserProfile();
updateAuthenticationAccount( updateAuthenticationAccount(
sessionCurrent!, sessionCurrent!,
accountId.value!, accountId.value!,
sessionCurrent!.username sessionCurrent!.username
); );
injectAutoCompleteBindings(sessionCurrent, accountId.value);
injectRuleFilterBindings(sessionCurrent, accountId.value);
injectVacationBindings(sessionCurrent, accountId.value);
injectFCMBindings(sessionCurrent, accountId.value);
_getVacationResponse();
spamReportController.getSpamReportStateAction();
if (PlatformInfo.isMobile) {
getAllSendingEmails();
_storeSessionAction(sessionCurrent!);
}
if (PlatformInfo.isMobile && !_notificationManager.isNotificationClickedOnTerminate) { if (PlatformInfo.isMobile && !_notificationManager.isNotificationClickedOnTerminate) {
_handleClickLocalNotificationOnTerminated(); _handleClickLocalNotificationOnTerminated();
} else { } else {
@@ -481,7 +464,27 @@ class MailboxDashBoardController extends ReloadableController {
} }
} }
void _setUpComponentsFromSession(Session session) {
sessionCurrent = session;
accountId.value = sessionCurrent!.personalAccount.accountId;
userProfile.value = UserProfile(sessionCurrent!.username.value);
injectAutoCompleteBindings(sessionCurrent, accountId.value);
injectRuleFilterBindings(sessionCurrent, accountId.value);
injectVacationBindings(sessionCurrent, accountId.value);
injectFCMBindings(sessionCurrent, accountId.value);
_getVacationResponse();
spamReportController.getSpamReportStateAction();
if (PlatformInfo.isMobile) {
getAllSendingEmails();
_storeSessionAction(sessionCurrent!);
}
}
void _handleMailtoURL(MailtoArguments arguments) { void _handleMailtoURL(MailtoArguments arguments) {
log('MailboxDashBoardController::_handleMailtoURL:');
routerParameters.value = arguments.toMapRouter(); routerParameters.value = arguments.toMapRouter();
_handleSession(arguments.session); _handleSession(arguments.session);
} }
@@ -1244,19 +1247,9 @@ class MailboxDashBoardController extends ReloadableController {
void handleReloaded(Session session) { void handleReloaded(Session session) {
log('MailboxDashBoardController::handleReloaded():'); log('MailboxDashBoardController::handleReloaded():');
_getRouteParameters(); _getRouteParameters();
sessionCurrent = session; _setUpComponentsFromSession(session);
accountId.value = sessionCurrent?.accounts.keys.first; if (PlatformInfo.isWeb) {
_getUserProfile(); _handleComposerCache();
_handleComposerCache();
injectAutoCompleteBindings(sessionCurrent, accountId.value);
injectRuleFilterBindings(sessionCurrent, accountId.value);
injectFCMBindings(sessionCurrent, accountId.value);
injectVacationBindings(sessionCurrent, accountId.value);
_getVacationResponse();
spamReportController.getSpamReportStateAction();
if (PlatformInfo.isMobile) {
getAllSendingEmails();
_storeSessionAction(sessionCurrent!);
} }
} }
+8
View File
@@ -55,6 +55,14 @@ class AppPages {
mailbox_dashboard.loadLibrary, mailbox_dashboard.loadLibrary,
() => mailbox_dashboard.MailboxDashBoardView()), () => mailbox_dashboard.MailboxDashBoardView()),
binding: MailboxDashBoardBindings()), binding: MailboxDashBoardBindings()),
GetPage(
name: AppRoutes.dashboardWithParameter,
page: () => DeferredWidget(
mailbox_dashboard.loadLibrary,
() => mailbox_dashboard.MailboxDashBoardView()
),
binding: MailboxDashBoardBindings()
),
GetPage( GetPage(
name: AppRoutes.mailtoURL, name: AppRoutes.mailtoURL,
page: () => DeferredWidget( page: () => DeferredWidget(
+1
View File
@@ -3,6 +3,7 @@ abstract class AppRoutes {
static const login = '/login'; static const login = '/login';
static const session = '/session'; static const session = '/session';
static const dashboard = '/dashboard'; static const dashboard = '/dashboard';
static const dashboardWithParameter = '/dashboard/:id';
static const settings = '/settings'; static const settings = '/settings';
static const composer = '/composer'; static const composer = '/composer';
static const destinationPicker = '/destination_picker'; static const destinationPicker = '/destination_picker';