TF-1613 Implement handleSuccessViewState and handleFailureViewState for all controller

(cherry picked from commit 35e727e795bb3c44cc9c47e02542b5bdc3955fdd)
This commit is contained in:
dab246
2023-04-04 19:55:18 +07:00
committed by Dat Vu
parent bee9ac37aa
commit 133b04b11c
42 changed files with 662 additions and 810 deletions
@@ -340,12 +340,8 @@ class UploadController extends BaseController {
}
@override
void onDone() {
viewState.value.fold(_handleFailureViewState, _handleSuccessViewState);
}
void _handleFailureViewState(Failure failure) async {
logError('UploadController::_handleFailureViewState():failure: $failure');
void handleFailureViewState(Failure failure) async {
super.handleFailureViewState(failure);
if (failure is UploadAttachmentFailure) {
if (failure.isInline) {
if (currentContext != null && currentOverlayContext != null) {
@@ -367,8 +363,9 @@ class UploadController extends BaseController {
}
}
void _handleSuccessViewState(Success success) async {
log('UploadController::_handleSuccessViewState():success: $success');
@override
void handleSuccessViewState(Success success) async {
super.handleSuccessViewState(success);
if (success is UploadAttachmentSuccess) {
if (success.isInline) {
_uploadingStateInlineFiles.add(success.uploadAttachment.toUploadFileState());