Merge pull request #1978 from kiwix/macgills/feature/1977-null-descriptions

#1977 Can't Download Item with no description
This commit is contained in:
Seán Mac Gillicuddy 2020-03-30 13:40:04 +01:00 committed by GitHub
commit 2439957029
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 17 deletions

View File

@ -62,7 +62,7 @@ sealed class LibraryListItem {
val downloadId: Long,
val favIcon: Base64String,
val title: String,
val description: String,
val description: String?,
val bytesDownloaded: Long,
val totalSizeBytes: Long,
val progress: Int,

View File

@ -85,7 +85,7 @@ class FetchDownloadDao @Inject constructor(
box.store.callInTx {
if (doesNotAlreadyExist(book)) {
insert(
downloadRequester.enqueue(DownloadRequest(url, book)),
downloadRequester.enqueue(DownloadRequest(url)),
book = book
)
}

View File

@ -33,7 +33,7 @@ data class BookOnDiskEntity(
val file: File = File(""),
val bookId: String,
val title: String,
val description: String,
val description: String?,
val language: String,
val creator: String,
val publisher: String,

View File

@ -41,7 +41,7 @@ data class FetchDownloadEntity(
val progress: Int = -1,
val bookId: String,
val title: String,
val description: String,
val description: String?,
val language: String,
val creator: String,
val publisher: String,

View File

@ -36,7 +36,7 @@ data class DownloadItem(
val downloadId: Long,
val favIcon: Base64String,
val title: String,
val description: String,
val description: String?,
val bytesDownloaded: Long,
val totalSizeBytes: Long,
val progress: Int,

View File

@ -18,22 +18,13 @@
package org.kiwix.kiwixmobile.core.downloader.model
import android.net.Uri
import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
import org.kiwix.kiwixmobile.core.utils.StorageUtils
data class DownloadRequest(
val urlString: String,
val title: String,
val description: String
) {
data class DownloadRequest(val urlString: String) {
val uri: Uri get() = Uri.parse(urlString)
constructor(url: String, book: Book) : this(url, book.title, book.description)
fun getDestination(sharedPreferenceUtil: SharedPreferenceUtil): String =
"${sharedPreferenceUtil.prefStorage}/Kiwix/${
StorageUtils.getFileNameFromUrl(urlString)
}"
"${sharedPreferenceUtil.prefStorage}/Kiwix/${StorageUtils.getFileNameFromUrl(urlString)}"
}

View File

@ -17,6 +17,7 @@
*/
package org.kiwix.kiwixmobile.core.entity;
import androidx.annotation.Nullable;
import java.io.File;
import java.io.Serializable;
import java.util.LinkedList;
@ -51,7 +52,7 @@ public class LibraryNetworkEntity {
public String title;
@Attribute(name = "description", required = false)
public String description;
@Nullable public String description;
@Attribute(name = "language", required = false)
public String language;
@ -103,6 +104,7 @@ public class LibraryNetworkEntity {
return this.title;
}
@Nullable
public String getDescription() {
return this.description;
}