Last active
August 29, 2015 13:58
-
-
Save CVertex/9949073 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (ApiErrorCodeChecker.isCommon(code)) { | |
| final boolean shouldLogout = ApiErrorCodeChecker.doesRequireLogout(code); | |
| final boolean shouldShowMessage = ApiErrorCodeChecker.shouldShowMessage(code); | |
| final boolean shouldGoUnderMaintenance = code == ApiErrorCode.UnderMaintenance; | |
| if (shouldShowMessage) { | |
| if (shouldLogout || shouldGoUnderMaintenance) { | |
| // On pressing Ok, user should be shown the "Service unavailable" message or the user should be logged out | |
| AlertDialogHelper.showOk(context, result.getMessage(), new OnClickListener() { | |
| @Override | |
| public void onClick(DialogInterface dialog, int which) { | |
| if (shouldLogout) { | |
| AuthenticationManager.INSTANCE.clearInfo(context); | |
| result.setResultWasHandled(true); | |
| } | |
| if (shouldGoUnderMaintenance) { | |
| MaintenanceModeManager.INSTANCE.notifyServiceIsUnderMaintenance(); | |
| result.setResultWasHandled(true); | |
| } | |
| } | |
| }); | |
| result.setResultWasHandled(true); | |
| } else { | |
| // Just show message and don't handle the result | |
| AlertDialogHelper.showOk(context, result.getMessage()); | |
| } | |
| } else if (shouldLogout) { | |
| AuthenticationManager.INSTANCE.clearInfo(context); | |
| result.setResultWasHandled(true); | |
| } | |
| else if (shouldGoUnderMaintenance) { | |
| MaintenanceModeManager.INSTANCE.notifyServiceIsUnderMaintenance(); | |
| result.setResultWasHandled(true); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We are missing -
ImportantMessageQueue.INSTANCE.add(result.getMessage());