Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ else if (installedVersion.isGreaterThanOrEqualTo(new SdkVersion(9, 2, 0, false))
if (installedVersion.isLessThan(new SdkVersion(12, 0, 0, false))) {
updateFromBefore12_0_0();
}
if (installedVersion.isLessThan(new SdkVersion(13, 0, 2, false))) {
updateFromBefore13_0_2();
}
if (installedVersion.isLessThan(new SdkVersion(15, 0, 0, false))) {
migrateAccountType();
}
Expand Down Expand Up @@ -306,6 +309,10 @@ private void updateFromBefore12_0_0() {
PushMessaging.setReRegistrationRequested(true);
}

private void updateFromBefore13_0_2() {
// Re-register all users for push notifications with new keys once push is setup
PushMessaging.setReRegistrationRequested(true);
}

/*
* Migrate any accounts with account_type "com.salesforce.androidsdk" to a unique value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,24 @@ class SalesforceSDKUpgradeManagerTest {
}

@Test
fun testUpgradeAfter12() {
fun testUpgradeFromBefore1302() {
// Set version to a version before 13.0.2
setVersion("12.2.0")

// Create public key for push notifications
KeyStoreWrapper.getInstance().getRSAPublicString(PushService.pushNotificationKeyName)

// Upgrade to latest
upgradeMgr.upgrade()

// Make sure re-registration is requested
Assert.assertTrue(PushMessaging.reRegistrationRequested)
}

@Test
fun testUpgradeAfter1302() {
// Set version to 12.0.0
setVersion("12.0.0")
setVersion("13.0.2")

// Create public key for push notifications
KeyStoreWrapper.getInstance().getRSAPublicString(PushService.pushNotificationKeyName)
Expand Down