diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index fb7f4a8a..61a9130c 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index f5782a6e..94fb0d01 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -86,5 +86,15 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 860da66a..d5d35ec4 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,6 @@
-
+
diff --git a/app/build.gradle b/app/build.gradle
index b5c1eb32..ab9e8835 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -65,13 +65,13 @@ android {
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.10"
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.20"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0-RC"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.0"
implementation "androidx.appcompat:appcompat:1.3.0"
- implementation "androidx.activity:activity-ktx:1.3.0-beta01"
- implementation "androidx.fragment:fragment-ktx:1.3.4"
+ implementation "androidx.activity:activity-ktx:1.3.0-rc01"
+ implementation "androidx.fragment:fragment-ktx:1.3.5"
implementation "androidx.preference:preference-ktx:1.1.1"
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation "androidx.constraintlayout:constraintlayout:2.0.4"
@@ -110,7 +110,7 @@ dependencies {
implementation "ru.noties.markwon:core:3.1.0"
- implementation "xyz.quaver:libpupil:2.1.0"
+ implementation "xyz.quaver:libpupil:2.1.2"
implementation "xyz.quaver:documentfilex:0.6.1"
implementation "xyz.quaver:floatingsearchview:1.1.7"
@@ -119,8 +119,8 @@ dependencies {
debugImplementation "com.squareup.leakcanary:leakcanary-android:2.6"
testImplementation "junit:junit:4.13.1"
- androidTestImplementation "androidx.test.ext:junit:1.1.2"
- androidTestImplementation "androidx.test:rules:1.3.0"
- androidTestImplementation "androidx.test:runner:1.3.0"
- androidTestImplementation "androidx.test.espresso:espresso-core:3.3.0"
+ androidTestImplementation "androidx.test.ext:junit:1.1.3"
+ androidTestImplementation "androidx.test:rules:1.4.0"
+ androidTestImplementation "androidx.test:runner:1.4.0"
+ androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
}
\ No newline at end of file
diff --git a/app/src/main/java/xyz/quaver/pupil/ui/viewmodel/ReaderViewModel.kt b/app/src/main/java/xyz/quaver/pupil/ui/viewmodel/ReaderViewModel.kt
index ce4c02fa..731c2703 100644
--- a/app/src/main/java/xyz/quaver/pupil/ui/viewmodel/ReaderViewModel.kt
+++ b/app/src/main/java/xyz/quaver/pupil/ui/viewmodel/ReaderViewModel.kt
@@ -25,15 +25,13 @@ import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
+import com.orhanobut.logger.Logger
import kotlinx.coroutines.*
-import okhttp3.Headers
import okhttp3.Headers.Companion.toHeaders
import okhttp3.Request
import org.kodein.di.DIAware
import org.kodein.di.android.x.closestDI
-import org.kodein.di.android.x.di
import org.kodein.di.instance
-import xyz.quaver.io.FileX
import xyz.quaver.pupil.adapters.ReaderItem
import xyz.quaver.pupil.sources.AnySource
import xyz.quaver.pupil.util.ImageCache
@@ -85,19 +83,32 @@ class ReaderViewModel(app: Application) : AndroidViewModel(app), DIAware {
val channel = cache.channels[image] ?: error("Channel is null")
- channel.invokeOnClose { e ->
- viewModelScope.launch {
- if (e == null) {
- _readerItems.value!![index] = ReaderItem(_readerItems.value!![index].progress, Uri.fromFile(file))
- _readerItems.notify()
+ if (channel.isClosedForReceive) {
+ _readerItems.value!![index] =
+ ReaderItem(_readerItems.value!![index].progress, Uri.fromFile(file))
+ _readerItems.notify()
+ } else {
+ channel.invokeOnClose { e ->
+ viewModelScope.launch {
+ if (e == null) {
+ _readerItems.value!![index] =
+ ReaderItem(_readerItems.value!![index].progress, Uri.fromFile(file))
+ _readerItems.notify()
+ } else {
+ Logger.e(index.toString())
+ Logger.e(e, e.message ?: "")
+ }
}
}
- }
- launch {
- for (progress in channel) {
- _readerItems.value!![index] = ReaderItem(progress, _readerItems.value!![index].image)
- _readerItems.notify()
+ launch {
+ kotlin.runCatching {
+ for (progress in channel) {
+ _readerItems.value!![index] =
+ ReaderItem(progress, _readerItems.value!![index].image)
+ _readerItems.notify()
+ }
+ }
}
}
}
diff --git a/build.gradle b/build.gradle
index add77926..ee5cb5f0 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,14 +6,14 @@ buildscript {
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.2.1'
+ classpath 'com.android.tools.build:gradle:4.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath "com.google.gms:google-services:4.3.8"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
- classpath "com.google.firebase:firebase-crashlytics-gradle:2.7.0"
+ classpath "com.google.firebase:firebase-crashlytics-gradle:2.7.1"
classpath "com.google.firebase:perf-plugin:1.4.0"
classpath "com.google.android.gms:oss-licenses-plugin:0.10.4"
}
diff --git a/gradle.properties b/gradle.properties
index 5c529e8f..7d0a7085 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -21,4 +21,4 @@ android.enableJetifier=true
android.useAndroidX=true
android.enableBuildCache=true
-kotlin_version=1.5.10
\ No newline at end of file
+kotlin_version=1.5.20
\ No newline at end of file