Resolve #842
This commit is contained in:
1 parent
b716a98548
commit
16e7d266fe
2 files changed
+7
-8
No files matched your search
@@ -36,7 +36,7 @@
|
||||
<activity
|
||||
android:name=".ui.login.LoginActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/AppTheme"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="adjustResize"/>
|
||||
<activity
|
||||
android:name=".ui.MainActivity"
|
||||
|
||||
@@ -233,13 +233,7 @@ class MainActivity : EhActivity() {
|
||||
val navHostFragment =
|
||||
supportFragmentManager.findFragmentById(R.id.fragment_container) as NavHostFragment
|
||||
navController = navHostFragment.navController
|
||||
if (EhUtils.needSignedIn()) {
|
||||
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
|
||||
setNavGraph()
|
||||
}.launch(Intent(this, LoginActivity::class.java))
|
||||
} else {
|
||||
setNavGraph()
|
||||
}
|
||||
if (!EhUtils.needSignedIn()) setNavGraph()
|
||||
binding.drawView.addDrawerListener(mDrawerOnBackPressedCallback)
|
||||
binding.navView.setupWithNavController(navController)
|
||||
|
||||
@@ -371,7 +365,12 @@ class MainActivity : EhActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private val loginLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { setNavGraph() }
|
||||
|
||||
override fun onResume() {
|
||||
if (EhUtils.needSignedIn()) {
|
||||
loginLauncher.launch(Intent(this, LoginActivity::class.java))
|
||||
}
|
||||
super.onResume()
|
||||
lifecycleScope.launch {
|
||||
delay(100)
|
||||
|
||||
Reference in new issue
Block a user