diff --git a/app/res/values/strings.xml b/app/res/values/strings.xml
index a9902b6173..58722a00b6 100644
--- a/app/res/values/strings.xml
+++ b/app/res/values/strings.xml
@@ -393,6 +393,8 @@
Notification containing information around current user session like when the current session is scheduled to expire
Server Communications
Notifications for status of any background server communication happening at the moment like CommCare App updates, log submission etc.
+ Priority notifications from Server
+ Notifications sent from server directly to notify user of priority tasks
Choose Reinstall Method
@@ -451,6 +453,6 @@
Install from Store
No Play Store found on your device
FCM Notification
- notification-channel-server-communications
+ notification-channel-push-notifications
Required CommCare App is not installed on device
diff --git a/app/src/org/commcare/CommCareNoficationManager.java b/app/src/org/commcare/CommCareNoficationManager.java
index 2f6bd62efe..6180f9e0e2 100644
--- a/app/src/org/commcare/CommCareNoficationManager.java
+++ b/app/src/org/commcare/CommCareNoficationManager.java
@@ -38,6 +38,7 @@ public class CommCareNoficationManager {
public static final String NOTIFICATION_CHANNEL_ERRORS_ID = "notification-channel-errors";
public static final String NOTIFICATION_CHANNEL_USER_SESSION_ID = "notification-channel-user-session";
public static final String NOTIFICATION_CHANNEL_SERVER_COMMUNICATIONS_ID = "notification-channel-server-communications";
+ public static final String NOTIFICATION_CHANNEL_PUSH_NOTIFICATIONS_ID = "notification-channel-push-notifications";
/**
* Handler to receive notifications and show them the user using toast.
@@ -188,6 +189,11 @@ public void createNotificationChannels() {
R.string.notification_channel_server_communication_title,
R.string.notification_channel_server_communication_description,
NotificationManager.IMPORTANCE_LOW);
+
+ createNotificationChannel(NOTIFICATION_CHANNEL_PUSH_NOTIFICATIONS_ID,
+ R.string.notification_channel_push_notfications_title,
+ R.string.notification_channel_push_notfications_description,
+ NotificationManager.IMPORTANCE_DEFAULT);
}
@TargetApi(Build.VERSION_CODES.O)
diff --git a/app/src/org/commcare/activities/SyncCapableCommCareActivity.java b/app/src/org/commcare/activities/SyncCapableCommCareActivity.java
index 0202ae5c16..d527bc5904 100644
--- a/app/src/org/commcare/activities/SyncCapableCommCareActivity.java
+++ b/app/src/org/commcare/activities/SyncCapableCommCareActivity.java
@@ -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:
@@ -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
@@ -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");
diff --git a/app/src/org/commcare/services/CommCareFirebaseMessagingService.java b/app/src/org/commcare/services/CommCareFirebaseMessagingService.java
index 7fc2bc6d9d..f189193956 100644
--- a/app/src/org/commcare/services/CommCareFirebaseMessagingService.java
+++ b/app/src/org/commcare/services/CommCareFirebaseMessagingService.java
@@ -99,7 +99,7 @@ private void showNotification(RemoteMessage.Notification notification) {
contentIntent = PendingIntent.getActivity(this, 0, i, 0);
NotificationCompat.Builder fcmNotification = new NotificationCompat.Builder(this,
- CommCareNoficationManager.NOTIFICATION_CHANNEL_SERVER_COMMUNICATIONS_ID)
+ CommCareNoficationManager.NOTIFICATION_CHANNEL_PUSH_NOTIFICATIONS_ID)
.setContentTitle(notificationTitle)
.setContentText(notificationText)
.setContentIntent(contentIntent)
diff --git a/app/unit-tests/src/org/commcare/android/tests/processing/FormStorageTest.java b/app/unit-tests/src/org/commcare/android/tests/processing/FormStorageTest.java
index f14bc6c834..62d344c8ff 100644
--- a/app/unit-tests/src/org/commcare/android/tests/processing/FormStorageTest.java
+++ b/app/unit-tests/src/org/commcare/android/tests/processing/FormStorageTest.java
@@ -353,6 +353,7 @@ public class FormStorageTest {
, "org.commcare.suite.model.DetailGroup"
, "org.commcare.services.FCMMessageData"
, "org.commcare.suite.model.EndpointArgument"
+ , "org.commcare.suite.model.EndpointAction"
);