Hiyobi file structure changed
This commit is contained in:
@@ -22,6 +22,7 @@ import android.content.Context
|
||||
import android.content.ContextWrapper
|
||||
import android.util.Base64
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.crashlytics.android.Crashlytics
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.async
|
||||
@@ -106,9 +107,11 @@ class Cache(context: Context) : ContextWrapper(context) {
|
||||
var galleryBlock: GalleryBlock? = null
|
||||
|
||||
for (source in sources) {
|
||||
galleryBlock = kotlin.runCatching {
|
||||
galleryBlock = try {
|
||||
source.invoke()
|
||||
}.getOrNull()
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
}
|
||||
|
||||
if (galleryBlock != null)
|
||||
break
|
||||
@@ -158,6 +161,7 @@ class Cache(context: Context) : ContextWrapper(context) {
|
||||
retval = try {
|
||||
source.value.invoke()
|
||||
} catch (e: Exception) {
|
||||
Crashlytics.logException(e)
|
||||
null
|
||||
}
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ class DownloadWorker private constructor(context: Context) : ContextWrapper(cont
|
||||
url(
|
||||
urlFromUrlFromHash(
|
||||
galleryID,
|
||||
reader.galleryInfo[index],
|
||||
reader.galleryInfo.files[index],
|
||||
if (lowQuality) "webp" else null
|
||||
)
|
||||
)
|
||||
@@ -251,18 +251,18 @@ class DownloadWorker private constructor(context: Context) : ContextWrapper(cont
|
||||
|
||||
val cache = Cache(this@DownloadWorker).getImages(galleryID)
|
||||
|
||||
progress.put(galleryID, reader.galleryInfo.indices.map { index ->
|
||||
progress.put(galleryID, reader.galleryInfo.files.indices.map { index ->
|
||||
if (cache?.getOrNull(index) != null)
|
||||
Float.POSITIVE_INFINITY
|
||||
else
|
||||
0F
|
||||
}.toMutableList())
|
||||
exception.put(galleryID, reader.galleryInfo.map { null }.toMutableList())
|
||||
exception.put(galleryID, reader.galleryInfo.files.map { null }.toMutableList())
|
||||
|
||||
if (notification[galleryID] == null)
|
||||
initNotification(galleryID)
|
||||
|
||||
notification[galleryID].setContentTitle(reader.title)
|
||||
notification[galleryID].setContentTitle(reader.galleryInfo.title)
|
||||
notify(galleryID)
|
||||
|
||||
if (isCompleted(galleryID)) {
|
||||
@@ -276,7 +276,7 @@ class DownloadWorker private constructor(context: Context) : ContextWrapper(cont
|
||||
return@launch
|
||||
}
|
||||
|
||||
for (i in reader.galleryInfo.indices) {
|
||||
for (i in reader.galleryInfo.files.indices) {
|
||||
val callback = object : Callback {
|
||||
override fun onFailure(call: Call, e: IOException) {
|
||||
if (Fabric.isInitialized() && e.message != "Canceled")
|
||||
|
||||
Reference in New Issue
Block a user