ankidroid / Anki-Android

AnkiDroid: Anki flashcards on Android. Your secret trick to achieve superhuman information retention.
GNU General Public License v3.0
7.93k stars 2.16k forks source link

Restoring a backup hides the Menu #16257

Closed neeldoshii closed 1 week ago

neeldoshii commented 2 weeks ago

Steps to Reproduce :

  1. Open the app.
  2. Click on Restore from backup
  3. Continue
  4. Select the backup
  5. Notice the right side menu, search gets hidden

Actual Behaviour

Menu, search, backup menu inflated are hidden.

Expected Behaviour:

Menu, search, backup menu inflated should be shown after switching the backups.

Video of reproduce

https://github.com/ankidroid/Anki-Android/assets/60827173/85a19938-9417-409b-9324-abe17cd9f8ca

SanjaySargam commented 2 weeks ago

Not only hides menu but also does not updateDeckList upon selecting backup.

fun updateDeckList() {
        if (!CollectionManager.isOpenUnsafe()) {
            return
        }
        if (Build.FINGERPRINT != "robolectric") {
            // uses user's desktop settings to determine whether a backup
            // actually happens
            performBackupInBackground()
        }
        Timber.d("updateDeckList")
        loadDeckCounts?.cancel()
        loadDeckCounts = launchCatchingTask {
            withProgress {
                Timber.d("Refreshing deck list")
                val deckData = withCol {
                    Pair(sched.deckDueTree(), this.isEmpty)
                }
                onDecksLoaded(deckData.first, deckData.second)
            }
        }
    }

!CollectionManager.isOpenUnsafe() this return true which is expected to be false