Skip to content

Commit

Permalink
Merge pull request #2728 from dimagi/dv/rate_limit_bug
Browse files Browse the repository at this point in the history
Fixed bug when trying to show rate limiting error message.
  • Loading branch information
OrangeAndGreen authored Oct 30, 2023
2 parents e6adadf + 669a224 commit 93eb1e7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions app/src/org/commcare/activities/SyncCapableCommCareActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,23 +232,23 @@ public void handleSyncNotAttempted(String message) {
public void handleFormUploadResult(FormUploadResult result, String formLabel, boolean userTriggered) {
switch (result) {
case FULL_SUCCESS:
handleFormSendResult(formLabel, true);
updateUiForFormUploadResult(formLabel, true);
break;
case BAD_CERTIFICATE:
CommCareApplication.notificationManager().reportNotificationMessage(
NotificationMessageFactory.message(NotificationMessageFactory.StockMessages.BadSslCertificate,
NotificationActionButtonInfo.ButtonAction.LAUNCH_DATE_SETTINGS));

handleFormSendResult(Localization.get(result.getLocaleKeyBase()), false);
updateUiForFormUploadResult(Localization.get(result.getLocaleKeyBase()), false);
break;
case ACTIONABLE_FAILURE:
handleFormSendResult(result.getErrorMessage(), false);
updateUiForFormUploadResult(result.getErrorMessage(), false);
break;
case RATE_LIMITED:
showRateLimitError(userTriggered);
break;
case CANCELLED:
handleFormSendResult(Localization.get(result.getLocaleKeyBase())
updateUiForFormUploadResult(Localization.get(result.getLocaleKeyBase())
+ " " + formLabel, false);
break;
case AUTH_FAILURE:
Expand All @@ -258,12 +258,12 @@ public void handleFormUploadResult(FormUploadResult result, String formLabel, bo
case INVALID_CASE_GRAPH:
case FAILURE:
default:
handleFormSendResult(Localization.get(result.getLocaleKeyBase()), false);
updateUiForFormUploadResult(Localization.get(result.getLocaleKeyBase()), false);
break;
}
}

public void handleFormSendResult(String message, boolean success) {
public void updateUiForFormUploadResult(String message, boolean success) {
updateUiAfterDataPullOrSend(message, success);
if (success) {
// Since we know that we just had connectivity, now is a great time to try this
Expand All @@ -273,7 +273,7 @@ public void handleFormSendResult(String message, boolean success) {

public void showRateLimitError(boolean userTriggered) {
if (HiddenPreferences.isRateLimitPopupDisabled() || !userTriggered) {
handleFormUploadResult(FormUploadResult.RATE_LIMITED, null, userTriggered);
updateUiForFormUploadResult(Localization.get(FormUploadResult.RATE_LIMITED.getLocaleKeyBase()), false);
return;
}
String title = Localization.get("form.send.rate.limit.error.title");
Expand Down

0 comments on commit 93eb1e7

Please sign in to comment.