Auto refresh mails when resume app from background
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
|
||||
class DeleteEmailStateToRefreshLoading extends UIState {}
|
||||
|
||||
class DeleteEmailStateToRefreshSuccess extends UIState {
|
||||
|
||||
DeleteEmailStateToRefreshSuccess();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class DeleteEmailStateToRefreshFailure extends FeatureFailure {
|
||||
|
||||
DeleteEmailStateToRefreshFailure(dynamic exception) : super(exception: exception);
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
|
||||
class DeleteMailboxStateToRefreshLoading extends UIState {}
|
||||
|
||||
class DeleteMailboxStateToRefreshSuccess extends UIState {
|
||||
|
||||
DeleteMailboxStateToRefreshSuccess();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class DeleteMailboxStateToRefreshFailure extends FeatureFailure {
|
||||
|
||||
DeleteMailboxStateToRefreshFailure(dynamic exception) : super(exception: exception);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
|
||||
|
||||
class GetEmailStateToRefreshLoading extends UIState {}
|
||||
|
||||
class GetEmailStateToRefreshSuccess extends UIState {
|
||||
|
||||
final jmap.State storedState;
|
||||
|
||||
GetEmailStateToRefreshSuccess(this.storedState);
|
||||
|
||||
@override
|
||||
List<Object> get props => [storedState];
|
||||
}
|
||||
|
||||
class GetEmailStateToRefreshFailure extends FeatureFailure {
|
||||
|
||||
GetEmailStateToRefreshFailure(dynamic exception) : super(exception: exception);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
|
||||
|
||||
class GetMailboxStateToRefreshLoading extends UIState {}
|
||||
|
||||
class GetMailboxStateToRefreshSuccess extends UIState {
|
||||
|
||||
final jmap.State storedState;
|
||||
|
||||
GetMailboxStateToRefreshSuccess(this.storedState);
|
||||
|
||||
@override
|
||||
List<Object> get props => [storedState];
|
||||
}
|
||||
|
||||
class GetMailboxStateToRefreshFailure extends FeatureFailure {
|
||||
|
||||
GetMailboxStateToRefreshFailure(dynamic exception) : super(exception: exception);
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:fcm/model/type_name.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/user_name.dart';
|
||||
import 'package:tmail_ui_user/features/push_notification/domain/repository/fcm_repository.dart';
|
||||
import 'package:tmail_ui_user/features/push_notification/domain/state/delete_email_state_to_refresh_state.dart';
|
||||
|
||||
class DeleteEmailStateToRefreshInteractor {
|
||||
final FCMRepository _fcmRepository;
|
||||
|
||||
DeleteEmailStateToRefreshInteractor(this._fcmRepository);
|
||||
|
||||
Stream<Either<Failure, Success>> execute(AccountId accountId, UserName userName) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(DeleteEmailStateToRefreshLoading());
|
||||
await _fcmRepository.deleteStateToRefresh(accountId, userName, TypeName.emailType);
|
||||
yield Right<Failure, Success>(DeleteEmailStateToRefreshSuccess());
|
||||
} catch (e) {
|
||||
yield Left<Failure, Success>(DeleteEmailStateToRefreshFailure(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:fcm/model/type_name.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/user_name.dart';
|
||||
import 'package:tmail_ui_user/features/push_notification/domain/repository/fcm_repository.dart';
|
||||
import 'package:tmail_ui_user/features/push_notification/domain/state/delete_mailbox_state_to_refresh_state.dart';
|
||||
|
||||
class DeleteMailboxStateToRefreshInteractor {
|
||||
final FCMRepository _fcmRepository;
|
||||
|
||||
DeleteMailboxStateToRefreshInteractor(this._fcmRepository);
|
||||
|
||||
Stream<Either<Failure, Success>> execute(AccountId accountId, UserName userName) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(DeleteMailboxStateToRefreshLoading());
|
||||
await _fcmRepository.deleteStateToRefresh(accountId, userName, TypeName.mailboxType);
|
||||
yield Right<Failure, Success>(DeleteMailboxStateToRefreshSuccess());
|
||||
} catch (e) {
|
||||
yield Left<Failure, Success>(DeleteMailboxStateToRefreshFailure(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:fcm/model/type_name.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/user_name.dart';
|
||||
import 'package:tmail_ui_user/features/push_notification/domain/repository/fcm_repository.dart';
|
||||
import 'package:tmail_ui_user/features/push_notification/domain/state/get_email_state_to_refresh_state.dart';
|
||||
|
||||
class GetEmailStateToRefreshInteractor {
|
||||
final FCMRepository _fcmRepository;
|
||||
|
||||
GetEmailStateToRefreshInteractor(this._fcmRepository);
|
||||
|
||||
Stream<Either<Failure, Success>> execute(AccountId accountId, UserName userName) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(GetEmailStateToRefreshLoading());
|
||||
final storedState = await _fcmRepository.getStateToRefresh(accountId, userName, TypeName.emailType);
|
||||
yield Right<Failure, Success>(GetEmailStateToRefreshSuccess(storedState));
|
||||
} catch (e) {
|
||||
yield Left<Failure, Success>(GetEmailStateToRefreshFailure(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:fcm/model/type_name.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/user_name.dart';
|
||||
import 'package:tmail_ui_user/features/push_notification/domain/repository/fcm_repository.dart';
|
||||
import 'package:tmail_ui_user/features/push_notification/domain/state/get_mailbox_state_to_refresh_state.dart';
|
||||
|
||||
class GetMailboxStateToRefreshInteractor {
|
||||
final FCMRepository _fcmRepository;
|
||||
|
||||
GetMailboxStateToRefreshInteractor(this._fcmRepository);
|
||||
|
||||
Stream<Either<Failure, Success>> execute(AccountId accountId, UserName userName) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(GetMailboxStateToRefreshLoading());
|
||||
final storedState = await _fcmRepository.getStateToRefresh(accountId, userName, TypeName.mailboxType);
|
||||
yield Right<Failure, Success>(GetMailboxStateToRefreshSuccess(storedState));
|
||||
} catch (e) {
|
||||
yield Left<Failure, Success>(GetMailboxStateToRefreshFailure(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user