mirror of
https://github.com/MinimalBible/MinimalBible-Legacy
synced 2025-07-07 00:34:46 -04:00
Get the unit tests passing again
Note: I need to write more. Lots more.
This commit is contained in:
@ -118,11 +118,7 @@ public class BookListFragment extends BaseFragment {
|
||||
}
|
||||
|
||||
// Listen for the books!
|
||||
refreshManager.getAvailableModules()
|
||||
// First flatten the Map to its lists
|
||||
.flatMap((books) -> Observable.from(books.values()))
|
||||
// Then flatten the lists
|
||||
.flatMap(Observable::from)
|
||||
refreshManager.getAvailableModulesFlattened()
|
||||
.filter((book) -> book.getBookCategory() ==
|
||||
BookCategory.fromString(getArguments().getString(ARG_BOOK_CATEGORY)))
|
||||
// Repack all the books
|
||||
|
@ -56,6 +56,7 @@ public class BookDownloadManager implements WorkListener, BooksListener {
|
||||
BookDownloadThread dlThread = dlThreadProvider.get();
|
||||
dlThread.downloadBook(b);
|
||||
addJob(BookDownloadThread.getJobId(b), b);
|
||||
downloadEvents.onNext(new DLProgressEvent(DLProgressEvent.PROGRESS_BEGINNING, b));
|
||||
}
|
||||
|
||||
public void addJob(String jobId, Book b) {
|
||||
|
@ -63,6 +63,9 @@ public class InstalledManager implements BooksListener {
|
||||
}
|
||||
|
||||
public void removeBook(Book b) {
|
||||
if (installedBooks == null) {
|
||||
initialize();
|
||||
}
|
||||
try {
|
||||
// This worked in the past, but isn't now...
|
||||
// installedBooks.remove(b);
|
||||
|
@ -61,6 +61,14 @@ public class RefreshManager {
|
||||
return availableModules;
|
||||
}
|
||||
|
||||
public Observable<Book> getAvailableModulesFlattened() {
|
||||
return availableModules
|
||||
// First flatten the Map to its lists
|
||||
.flatMap((books) -> Observable.from(books.values()))
|
||||
// Then flatten the lists
|
||||
.flatMap(Observable::from);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cached book list
|
||||
* @return The cached book list, or null
|
||||
@ -90,7 +98,7 @@ public class RefreshManager {
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.take(1)
|
||||
.first()
|
||||
.map(element -> element.entrySet().iterator().next().getKey());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user