mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 04:58:45 +00:00
Fix invalid navigation to remote restore activity post registration.
This commit is contained in:
committed by
Greyson Parrelli
parent
5f8eaa4f1c
commit
90201a464d
@@ -25,10 +25,10 @@ import org.signal.core.util.ThreadUtil
|
||||
import org.signal.core.util.getParcelableExtraCompat
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.thoughtcrime.securesms.BaseActivity
|
||||
import org.thoughtcrime.securesms.MainActivity
|
||||
import org.thoughtcrime.securesms.PassphraseRequiredActivity
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.RestoreDirections
|
||||
import org.thoughtcrime.securesms.registration.ui.restore.RemoteRestoreActivity
|
||||
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
||||
import org.thoughtcrime.securesms.util.navigation.safeNavigate
|
||||
@@ -73,9 +73,20 @@ class RestoreActivity : BaseActivity() {
|
||||
|
||||
when (navTarget) {
|
||||
NavTarget.NEW_LANDING -> {
|
||||
if (!sharedViewModel.hasMultipleRestoreMethods()) {
|
||||
startActivity(RemoteRestoreActivity.getIntent(this, isOnlyOption = true))
|
||||
finish()
|
||||
if (sharedViewModel.hasNoRestoreMethods()) {
|
||||
Log.i(TAG, "No restore methods available, skipping")
|
||||
sharedViewModel.skipRestore()
|
||||
|
||||
val nextIntent = sharedViewModel.getNextIntent()
|
||||
|
||||
if (nextIntent != null) {
|
||||
Log.d(TAG, "Launching ${nextIntent.component}")
|
||||
startActivity(nextIntent)
|
||||
} else {
|
||||
startActivity(MainActivity.clearTop(this))
|
||||
}
|
||||
|
||||
supportFinishAfterTransition()
|
||||
}
|
||||
}
|
||||
NavTarget.LOCAL_RESTORE -> navController.safeNavigate(RestoreDirections.goDirectlyToChooseLocalBackup())
|
||||
@@ -120,7 +131,7 @@ class RestoreActivity : BaseActivity() {
|
||||
|
||||
fun onBackupCompletedSuccessfully() {
|
||||
sharedViewModel.getNextIntent()?.let {
|
||||
Log.d(TAG, "Launching ${it.component}", Throwable())
|
||||
Log.d(TAG, "Launching ${it.component}")
|
||||
startActivity(it)
|
||||
}
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@ class RestoreViewModel : ViewModel() {
|
||||
|
||||
fun getNextIntent(): Intent? = store.value.nextIntent
|
||||
|
||||
fun hasMultipleRestoreMethods(): Boolean {
|
||||
return getAvailableRestoreMethods().size > 1
|
||||
fun hasNoRestoreMethods(): Boolean {
|
||||
return getAvailableRestoreMethods().isEmpty()
|
||||
}
|
||||
|
||||
fun getAvailableRestoreMethods(): List<RestoreMethod> {
|
||||
|
||||
Reference in New Issue
Block a user