1
0
Fork 0

Issue #4513: added isLoading to bookmark state

This was added to the state object as a top level param because it could reasonably coexist with any value of `tree` or `mode`. Even if we don't now, we may someday want to display a loading indicator while also showing cached bookmarks.

For now, we set isLoading to false whenever we receive any bookmarks
master
Severin Rudie 2019-09-24 18:21:58 -07:00 committed by Emily Kager
parent 5e8798e89c
commit ca6c324f29
2 changed files with 8 additions and 3 deletions

View File

@ -73,7 +73,7 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), BackHandler, Accou
val view = inflater.inflate(R.layout.fragment_bookmark, container, false)
bookmarkStore = StoreProvider.get(this) {
BookmarkFragmentStore(BookmarkFragmentState(null))
BookmarkFragmentStore(BookmarkFragmentState(null, isLoading = true))
}
bookmarkInteractor = BookmarkFragmentInteractor(
bookmarkStore = bookmarkStore,

View File

@ -20,7 +20,11 @@ class BookmarkFragmentStore(
* @property tree The current tree of bookmarks, if one is loaded
* @property mode The current bookmark multi-selection mode
*/
data class BookmarkFragmentState(val tree: BookmarkNode?, val mode: Mode = Mode.Normal) : State {
data class BookmarkFragmentState(
val tree: BookmarkNode?,
val mode: Mode = Mode.Normal,
val isLoading: Boolean
) : State {
sealed class Mode {
open val selectedItems = emptySet<BookmarkNode>()
@ -58,7 +62,8 @@ private fun bookmarkFragmentStateReducer(
BookmarkFragmentState.Mode.Normal
} else {
BookmarkFragmentState.Mode.Selecting(items.toSet())
}
},
isLoading = false
)
}
is BookmarkFragmentAction.Select ->