mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-22 03:54:18 -04:00
Merge pull request #1978 from kiwix/macgills/feature/1977-null-descriptions
#1977 Can't Download Item with no description
This commit is contained in:
commit
2439957029
@ -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,
|
||||
|
@ -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
|
||||
)
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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)}"
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user