TF-1599 Handle remove notification when email mask as read or delete permanent

(cherry picked from commit 1abcc61474728cadca024d21eba43aaf4f09a078)
This commit is contained in:
dab246
2023-04-07 16:02:54 +07:00
committed by Dat Vu
parent fbaea1a951
commit 9dac861baa
10 changed files with 159 additions and 24 deletions
@@ -57,8 +57,9 @@ class FcmMessageController extends FcmBaseController {
static FcmMessageController get instance => _instance;
void initializeFromAccountId(AccountId accountId) {
void initializeFromAccountId(AccountId accountId, Session session) {
_currentAccountId = accountId;
_currentSession = session;
FcmTokenController.instance.initialize();
}
@@ -98,7 +99,7 @@ class FcmMessageController extends FcmBaseController {
if (_currentAccountId != null) {
final stateChange = _convertRemoteMessageToStateChange(newRemoteMessage);
final mapTypeState = stateChange.getMapTypeState(_currentAccountId!);
_mappingTypeStateToAction(mapTypeState, _currentAccountId!);
_mappingTypeStateToAction(mapTypeState, _currentAccountId!, session: _currentSession);
}
}
@@ -161,9 +162,9 @@ class FcmMessageController extends FcmBaseController {
final newState = jmap.State(mapTypeState[typeName.value]);
if (typeName == TypeName.emailType) {
if (isForeground) {
return SynchronizeEmailOnForegroundAction(typeName, newState, accountId);
return SynchronizeEmailOnForegroundAction(typeName, newState, accountId, session);
} else {
return StoreEmailStateToRefreshAction(typeName, newState, accountId);
return StoreEmailStateToRefreshAction(typeName, newState, accountId, session);
}
} else if (typeName == TypeName.emailDelivery) {
if (!isForeground) {