diff --git a/external/shared b/external/shared index 8f980a6618..e50fc03b48 160000 --- a/external/shared +++ b/external/shared @@ -1 +1 @@ -Subproject commit 8f980a6618cd5d0c2d67807ebf697fc00c80c4b3 +Subproject commit e50fc03b48e8df6902e9786b998167f18b79c341 diff --git a/libs/SalesforceSDK/res/values/strings.xml b/libs/SalesforceSDK/res/values/strings.xml index 09b57b4650..3ee4b24014 100644 --- a/libs/SalesforceSDK/res/values/strings.xml +++ b/libs/SalesforceSDK/res/values/strings.xml @@ -13,5 +13,5 @@ touch - v63.0 + v66.0 diff --git a/libs/SalesforceSDK/src/com/salesforce/androidsdk/rest/ApiVersionStrings.java b/libs/SalesforceSDK/src/com/salesforce/androidsdk/rest/ApiVersionStrings.java index 54f8055b24..774880bd9e 100644 --- a/libs/SalesforceSDK/src/com/salesforce/androidsdk/rest/ApiVersionStrings.java +++ b/libs/SalesforceSDK/src/com/salesforce/androidsdk/rest/ApiVersionStrings.java @@ -39,7 +39,7 @@ */ public class ApiVersionStrings { - public static final String VERSION_NUMBER = "v63.0"; + public static final String VERSION_NUMBER = "v66.0"; /** A version number override exclusively to support unit tests */ @VisibleForTesting diff --git a/libs/SalesforceSDK/src/com/salesforce/androidsdk/rest/NotificationsApiClient.kt b/libs/SalesforceSDK/src/com/salesforce/androidsdk/rest/NotificationsApiClient.kt index b525dc9b5e..004605623a 100644 --- a/libs/SalesforceSDK/src/com/salesforce/androidsdk/rest/NotificationsApiClient.kt +++ b/libs/SalesforceSDK/src/com/salesforce/androidsdk/rest/NotificationsApiClient.kt @@ -59,7 +59,7 @@ class NotificationsApiClient( val apiVersion = ApiVersionStrings.getVersionNumber(context) // Submit the request. - if (apiVersion < "v64.0") { // TODO: Remove once MSDK default API version is 64 or greater. + if (apiVersion < "v64.0") { SalesforceSDKLogger.w(TAG, "Cannot request Salesforce push notifications types with API less than v64.0") return null } @@ -98,7 +98,7 @@ class NotificationsApiClient( val apiVersion = ApiVersionStrings.getVersionNumber(context) // Submit the request. - if (apiVersion < "v64.0") { // TODO: Remove once MSDK default API version is 64 or greater. + if (apiVersion < "v64.0") { SalesforceSDKLogger.w(TAG, "Cannot submit Salesforce Notifications API action with API less than v64.0") return null } diff --git a/libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PushMessagingTest.kt b/libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PushMessagingTest.kt index c6449d5524..77a65b7188 100644 --- a/libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PushMessagingTest.kt +++ b/libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PushMessagingTest.kt @@ -208,8 +208,6 @@ class PushMessagingTest { notificationsTypes = fromJson(NOTIFICATIONS_TYPES_JSON) ) - ApiVersionStrings.VERSION_NUMBER_TEST = "v64.0" - // Test once for coverage only with the default REST client. assertThrows(SSLPeerUnverifiedException::class.java) { salesforceSdkManager.invokeServerNotificationAction( @@ -231,24 +229,12 @@ class PushMessagingTest { fun testInvokeServerNotificationActionViaSdkManager_WithoutAccount() { val salesforceSdkManager = SalesforceSDKManager.getInstance() - val restResponse = mockk() - every { restResponse.asString() } returns encodeToString( - NotificationsActionsResponseBody.serializer(), - NotificationsActionsResponseBody( - message = "test_message" + assertThrows(NullPointerException::class.java) { + salesforceSdkManager.invokeServerNotificationAction( + notificationId = "test_notification_id", + actionKey = "test_action_key", ) - ) - every { restResponse.isSuccess } returns true - val restClient = mockk() - every { restClient.sendSync(any()) } returns restResponse - - val notificationsActionsResponseBody = salesforceSdkManager.invokeServerNotificationAction( - notificationId = "test_notification_id", - actionKey = "test_action_key", - restClient = restClient - ) - - assertNull(notificationsActionsResponseBody) + } } @Test @@ -273,6 +259,8 @@ class PushMessagingTest { notificationsTypes = fromJson(NOTIFICATIONS_TYPES_JSON) ) + ApiVersionStrings.VERSION_NUMBER_TEST = "v63.0" + val notificationsActionsResponseBody = salesforceSdkManager.invokeServerNotificationAction( notificationId = "test_notification_id", actionKey = "test_action_key", @@ -299,8 +287,6 @@ class PushMessagingTest { notificationsTypes = fromJson(NOTIFICATIONS_TYPES_JSON) ) - ApiVersionStrings.VERSION_NUMBER_TEST = "v64.0" - assertThrows(NotificationsApiException::class.java) { salesforceSdkManager.invokeServerNotificationAction( notificationId = "test_notification_id", @@ -330,8 +316,6 @@ class PushMessagingTest { notificationsTypes = fromJson(NOTIFICATIONS_TYPES_JSON) ) - ApiVersionStrings.VERSION_NUMBER_TEST = "v64.0" - assertThrows(NotificationsApiException::class.java) { salesforceSdkManager.invokeServerNotificationAction( notificationId = "test_notification_id", @@ -368,9 +352,6 @@ class PushMessagingTest { every { restClient.clientInfo } returns clientInfo every { restClient.sendSync(any()) } returns restResponse - // Setup. - ApiVersionStrings.VERSION_NUMBER_TEST = "v64.0" - assertThrows(NotificationsApiException::class.java) { salesforceSdkManager.invokeServerNotificationAction( notificationId = "test_notification_id", @@ -396,9 +377,6 @@ class PushMessagingTest { every { restClient.clientInfo } returns clientInfo every { restClient.sendSync(any()) } returns restResponse - // Setup. - ApiVersionStrings.VERSION_NUMBER_TEST = "v64.0" - assertThrows(NotificationsApiException::class.java) { salesforceSdkManager.invokeServerNotificationAction( notificationId = "test_notification_id", @@ -431,9 +409,6 @@ class PushMessagingTest { every { restClient.clientInfo } returns clientInfo every { restClient.sendSync(any()) } returns restResponse - // Setup. - ApiVersionStrings.VERSION_NUMBER_TEST = "v64.0" - assertThrows(NotificationsApiException::class.java) { salesforceSdkManager.invokeServerNotificationAction( notificationId = "test_notification_id", diff --git a/libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PushServiceTest.kt b/libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PushServiceTest.kt index 801cefef57..eb243c54ef 100644 --- a/libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PushServiceTest.kt +++ b/libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PushServiceTest.kt @@ -129,6 +129,9 @@ class PushServiceTest { val restClient = mockk() every { restClient.sendSync(any()) } returns restResponse + // Setup. + VERSION_NUMBER_TEST = "v63.0" + val notificationsTypesResponseBody = PushService().fetchNotificationsTypes( restClient = restClient, userAccount = createTestAccount() @@ -285,6 +288,7 @@ class PushServiceTest { every { restResponse.asString() } returns NOTIFICATIONS_TYPES_JSON every { restResponse.isSuccess } returns true val restClient = mockk() + every { restClient.clientInfo } returns clientInfo every { restClient.sendSync(any()) } returns restResponse var result = false @@ -746,6 +750,7 @@ class PushServiceTest { every { restResponse.statusCode } returns HTTP_CREATED every { restResponse.asJSONObject() } returns JSONObject("{\"id\": \"test_id\"}") val restClient = mockk() + every { restClient.clientInfo } returns clientInfo every { restClient.sendSync(any()) } returns restResponse val account = createTestAccount() @@ -765,9 +770,14 @@ class PushServiceTest { restClient = restClient ) - verify(exactly = 1) { + verify(atLeast = 1) { restClient.sendSync(withArg { - assertEquals("test_community_id", it.requestBodyAsJson.get("NetworkId")) + assertEquals( + "test_community_id", + runCatching { + it.requestBodyAsJson.get("NetworkId") + }.getOrDefault("Default Value") + ) }) }