diff --git a/app/src/main/java/com/nextcloud/client/onboarding/FirstRunActivity.kt b/app/src/main/java/com/nextcloud/client/onboarding/FirstRunActivity.kt index e9080426a974..781151d758ce 100644 --- a/app/src/main/java/com/nextcloud/client/onboarding/FirstRunActivity.kt +++ b/app/src/main/java/com/nextcloud/client/onboarding/FirstRunActivity.kt @@ -198,17 +198,21 @@ class FirstRunActivity : BaseActivity(), ViewPager.OnPageChangeListener, Injecta this, object : OnBackPressedCallback(true) { override fun handleOnBackPressed() { - onFinish() + val isFromAddAccount = intent.getBooleanExtra(EXTRA_ALLOW_CLOSE, false) - if (intent.getBooleanExtra(EXTRA_ALLOW_CLOSE, false)) { - onBackPressedDispatcher.onBackPressed() + val destination: Intent = if (isFromAddAccount) { + Intent(applicationContext, FileDisplayActivity::class.java) } else { - val intent = Intent(applicationContext, AuthenticatorActivity::class.java) - intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP - intent.putExtra(EXTRA_EXIT, true) - startActivity(intent) - finish() + Intent(applicationContext, AuthenticatorActivity::class.java) } + + if (!isFromAddAccount) { + destination.putExtra(EXTRA_EXIT, true) + } + + destination.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP + startActivity(destination) + finish() } } )