Skip to content

Commit 862f73c

Browse files
criticalAYlukstbit
authored andcommitted
fix(widget): show correct empty-collection toast in deck picker widget config
When the user's collection has no decks, the deck-picker widget config was showing "AnkiDroid is not initialized yet. Please open AnkiDroid and try again" before closing. The collection is fully initialized in that case the user just has no decks to pick from and re-opening the app won't change anything. Use empty_collection_state_in_widget ("Collection is empty, use app to add decks then reconfigure") instead, which is already the message the widget itself shows in the same situation, keeping the config and the widget consistent.
1 parent 4af7b37 commit 862f73c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

AnkiDroid/src/main/java/com/ichi2/widget/deckpicker/DeckPickerWidgetConfig.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,15 @@ class DeckPickerWidgetConfig :
104104

105105
registerDeckSelectedHandler(action = ::onDeckSelected)
106106

107-
// Check if the collection is empty before proceeding and if the collection is empty, show a toast instead of the configuration view.
107+
// The widget can only be configured against an existing deck. If the collection has
108+
// none, show the same message the widget itself displays and close the config screen.
108109
this.initTask =
109110
lifecycleScope.launch {
110111
if (isCollectionEmpty()) {
111112
Timber.w("Closing: Collection is empty")
112113
showThemedToast(
113114
this@DeckPickerWidgetConfig,
114-
R.string.app_not_initialized_new,
115+
R.string.empty_collection_state_in_widget,
115116
false,
116117
)
117118
finish()

0 commit comments

Comments
 (0)