TF-1933 Combine cache and server when get session
(cherry picked from commit 05e8ba3d5110c311eae5db0120ea3a9128b7b5d5)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/session/session.dart';
|
||||
|
||||
class GetSessionLoading extends UIState {}
|
||||
|
||||
class GetSessionSuccess extends UIState {
|
||||
final Session session;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ class GetSessionInteractor {
|
||||
|
||||
Stream<Either<Failure, Success>> execute() async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(GetSessionLoading());
|
||||
final session = await sessionRepository.getSession();
|
||||
yield Right<Failure, Success>(GetSessionSuccess(session));
|
||||
} catch (e) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:core/data/network/config/dynamic_url_interceptors.dart';
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:core/presentation/utils/app_toast.dart';
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:core/utils/platform_info.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/session/session.dart';
|
||||
import 'package:tmail_ui_user/features/base/reloadable/reloadable_controller.dart';
|
||||
@@ -88,6 +88,11 @@ class SessionController extends ReloadableController {
|
||||
arguments: session);
|
||||
}
|
||||
|
||||
void _handleGetStoredSession() {
|
||||
log('SessionController::_handleGetStoredSession():');
|
||||
consumeState(_getStoredSessionInteractor.execute());
|
||||
}
|
||||
|
||||
void _getSession() async {
|
||||
consumeState(_getSessionInteractor.execute());
|
||||
}
|
||||
@@ -137,9 +142,4 @@ class SessionController extends ReloadableController {
|
||||
performInvokeLogoutAction();
|
||||
}
|
||||
}
|
||||
|
||||
void _handleGetStoredSession() {
|
||||
log('SessionController::_handleGetStoredSession():');
|
||||
consumeState(_getStoredSessionInteractor.execute());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user