fix bug that allowed user to bypass warning slide during onboarding
Auto Tag on Version Change / check-version (push) Successful in 4s

This commit is contained in:
2026-06-03 20:01:55 +05:00
parent 140b0069bd
commit 982596f2a8
2 changed files with 9 additions and 4 deletions
@@ -31,9 +31,14 @@ class OnboardingActivity : AppCompatActivity(), SecuritySetupFragment.Callback {
ThemeHelper.applyAccent(this)
super.onCreate(savedInstanceState)
// If security is already configured, onboarding is complete. Redirect to lock screen
// to prevent overwriting an existing PIN/pattern via direct activity launch.
if (CredentialStore(this).loadSecurityHash() != null) {
prefs = getSharedPreferences("prefs", MODE_PRIVATE)
// Only redirect to the lock screen if onboarding is fully complete. Checking the
// security hash alone is not sufficient — the hash is written during the PIN/pattern
// setup step (page 1) which happens *before* the user clicks "Get Started", so a
// theme change or process restart mid-onboarding would otherwise trigger this guard
// and strand the user in the lock flow without finishing onboarding.
if (prefs.getBoolean("onboarding_done", false) && CredentialStore(this).loadSecurityHash() != null) {
startActivity(Intent(this, LockActivity::class.java))
finish()
return
@@ -50,7 +55,6 @@ class OnboardingActivity : AppCompatActivity(), SecuritySetupFragment.Callback {
val ta = obtainStyledAttributes(intArrayOf(android.R.attr.colorBackground))
window.statusBarColor = ta.getColor(0, if (isLight) android.graphics.Color.WHITE else android.graphics.Color.BLACK)
ta.recycle()
prefs = getSharedPreferences("prefs", MODE_PRIVATE)
val originalBottomPadding = binding.bottomBar.paddingBottom
ViewCompat.setOnApplyWindowInsetsListener(binding.bottomBar) { view, insets ->
val navBar = insets.getInsets(WindowInsetsCompat.Type.systemBars())
@@ -59,6 +59,7 @@ class OnboardingFragment : Fragment() {
private fun notifyScrolledToBottom() {
if (scrolledToBottom) return
if (!isAdded) return
scrolledToBottom = true
parentFragmentManager.setFragmentResult(RESULT_SCROLLED_TO_BOTTOM, Bundle.EMPTY)
}