Fixed going back to default fragment when rotating the device

This commit is contained in:
Sylvain Berfini 2024-02-07 15:15:44 +01:00
parent 91ec675cbe
commit 6faff7f780
2 changed files with 12 additions and 0 deletions

View file

@ -386,6 +386,16 @@ class MainActivity : GenericActivity() {
@MainThread
private fun handleMainIntent(intent: Intent, isNewIntent: Boolean) {
// Prevent navigating to default fragment upon rotation (we only want to do it on first start)
if (intent.action == Intent.ACTION_MAIN && intent.type == null && intent.data == null && !isNewIntent) {
if (viewModel.mainIntentHandled) {
Log.d("$TAG Main intent without type nor data was already handled, do nothing")
return
} else {
viewModel.mainIntentHandled = true
}
}
if (intent.hasExtra("Chat")) {
Log.i("$TAG Intent has [Chat] extra")
try {

View file

@ -86,6 +86,8 @@ class MainViewModel @UiThread constructor() : ViewModel() {
var accountsFound = -1
var mainIntentHandled = false
private var defaultAccountRegistrationFailed = false
private val alertsList = arrayListOf<Pair<Int, String>>()