TF-3334 Use queue to handle multiple refresh changes mailbox from incoming websocket
This commit is contained in:
@@ -143,20 +143,7 @@ abstract class BaseController extends GetxController
|
||||
|
||||
void onData(Either<Failure, Success> newState) {
|
||||
viewState.value = newState;
|
||||
viewState.value.fold(
|
||||
(failure) {
|
||||
if (failure is FeatureFailure) {
|
||||
final isUrgentException = validateUrgentException(failure.exception);
|
||||
if (isUrgentException) {
|
||||
handleUrgentException(failure: failure, exception: failure.exception);
|
||||
} else {
|
||||
handleFailureViewState(failure);
|
||||
}
|
||||
} else {
|
||||
handleFailureViewState(failure);
|
||||
}
|
||||
},
|
||||
handleSuccessViewState);
|
||||
viewState.value.fold(onDataFailureViewState, handleSuccessViewState);
|
||||
}
|
||||
|
||||
void onError(dynamic error, StackTrace stackTrace) {
|
||||
@@ -272,6 +259,19 @@ abstract class BaseController extends GetxController
|
||||
}
|
||||
}
|
||||
|
||||
void onDataFailureViewState(Failure failure) {
|
||||
if (failure is FeatureFailure) {
|
||||
final isUrgentException = validateUrgentException(failure.exception);
|
||||
if (isUrgentException) {
|
||||
handleUrgentException(failure: failure, exception: failure.exception);
|
||||
} else {
|
||||
handleFailureViewState(failure);
|
||||
}
|
||||
} else {
|
||||
handleFailureViewState(failure);
|
||||
}
|
||||
}
|
||||
|
||||
void handleFailureViewState(Failure failure) async {
|
||||
logError('$runtimeType::handleFailureViewState():Failure = $failure');
|
||||
if (failure is LogoutOidcFailure) {
|
||||
|
||||
@@ -104,8 +104,7 @@ abstract class BaseMailboxController extends BaseController {
|
||||
teamMailboxesTree.value = tupleTree.value3;
|
||||
}
|
||||
|
||||
Future<void> syncAllMailboxWithDisplayName(BuildContext context) async {
|
||||
log("BaseMailboxController::syncAllMailboxWithDisplayName");
|
||||
void syncAllMailboxWithDisplayName(BuildContext context) {
|
||||
final syncedMailbox = allMailboxes
|
||||
.map((mailbox) => mailbox.withDisplayName(mailbox.getDisplayName(context)))
|
||||
.toList();
|
||||
|
||||
Reference in New Issue
Block a user