diff --git a/app/build.gradle b/app/build.gradle index d96301c6..9313ded0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,7 +21,7 @@ android { minSdkVersion 16 targetSdkVersion 30 versionCode 58 - versionName "5.0" + versionName "5.0-hotfix1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true } diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index 09e2b91c..f18261ab 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -12,7 +12,7 @@ "filters": [], "properties": [], "versionCode": 58, - "versionName": "5.0", + "versionName": "5.0-hotfix1", "enabled": true, "outputFile": "app-release.apk" } diff --git a/app/src/main/java/xyz/quaver/pupil/Pupil.kt b/app/src/main/java/xyz/quaver/pupil/Pupil.kt index ee0e4335..c953fede 100644 --- a/app/src/main/java/xyz/quaver/pupil/Pupil.kt +++ b/app/src/main/java/xyz/quaver/pupil/Pupil.kt @@ -18,10 +18,7 @@ package xyz.quaver.pupil -import android.app.Application -import android.app.Notification -import android.app.NotificationChannel -import android.app.NotificationManager +import android.app.* import android.content.Context import android.content.Intent import android.net.Uri @@ -43,6 +40,7 @@ import okhttp3.Response import xyz.quaver.io.FileX import xyz.quaver.pupil.types.Tag import xyz.quaver.pupil.util.* +import xyz.quaver.pupil.util.downloader.DownloadManager import xyz.quaver.setClient import java.io.File import java.util.* @@ -115,6 +113,8 @@ class Pupil : Application() { Preferences.remove("download_folder") } + DownloadManager.getInstance(this).migrate() + histories = SavedSet(File(ContextCompat.getDataDir(this), "histories.json"), 0) favorites = SavedSet(File(ContextCompat.getDataDir(this), "favorites.json"), 0) favoriteTags = SavedSet(File(ContextCompat.getDataDir(this), "favorites_tags.json"), Tag.parse("")) diff --git a/app/src/main/java/xyz/quaver/pupil/adapters/ReaderAdapter.kt b/app/src/main/java/xyz/quaver/pupil/adapters/ReaderAdapter.kt index 096c128e..61c39f77 100644 --- a/app/src/main/java/xyz/quaver/pupil/adapters/ReaderAdapter.kt +++ b/app/src/main/java/xyz/quaver/pupil/adapters/ReaderAdapter.kt @@ -42,6 +42,7 @@ import xyz.quaver.hitomi.getReferer import xyz.quaver.hitomi.imageUrlFromImage import xyz.quaver.hiyobi.createImgList import xyz.quaver.io.util.readBytes +import xyz.quaver.pupil.BuildConfig import xyz.quaver.pupil.R import xyz.quaver.pupil.services.DownloadService import xyz.quaver.pupil.ui.ReaderActivity @@ -123,6 +124,10 @@ class ReaderAdapter(private val activity: ReaderActivity, .diskCacheStrategy(DiskCacheStrategy.NONE) .skipMemoryCache(false) .fitCenter() + .apply { + if (BuildConfig.CENSOR) + override(5, 8) + } .error(R.drawable.image_broken_variant) .into(holder.view.image) } @@ -139,6 +144,10 @@ class ReaderAdapter(private val activity: ReaderActivity, .diskCacheStrategy(DiskCacheStrategy.NONE) .skipMemoryCache(true) .fitCenter() + .apply { + if (BuildConfig.CENSOR) + override(5, 8) + } .error(R.drawable.image_broken_variant) .listener(object: RequestListener { override fun onLoadFailed( diff --git a/app/src/main/java/xyz/quaver/pupil/util/update.kt b/app/src/main/java/xyz/quaver/pupil/util/update.kt index e13eefd4..3d3978ba 100644 --- a/app/src/main/java/xyz/quaver/pupil/util/update.kt +++ b/app/src/main/java/xyz/quaver/pupil/util/update.kt @@ -258,7 +258,12 @@ fun xyz.quaver.pupil.util.downloader.DownloadManager.migrate() { job?.cancel() job = CoroutineScope(Dispatchers.IO).launch { val downloadFolders = downloadFolder.listFiles { folder -> - (folder as? FileX)?.isDirectory == true && !downloadFolderMap.values.contains(folder.name) + folder.isDirectory && !downloadFolderMap.values.contains(folder.name) + }?.map { + if (it !is FileX) + FileX(this@migrate, it) + else + it } if (downloadFolders.isNullOrEmpty()) return@launch @@ -270,8 +275,6 @@ fun xyz.quaver.pupil.util.downloader.DownloadManager.migrate() { notificationManager.notify(R.id.notification_id_import, notification.build()) kotlin.runCatching { - if (folder !is FileX) return@runCatching - val metadata = kotlin.runCatching { folder.getChild(".metadata").readText()?.let { Json.parseToJsonElement(it).jsonObject } }.getOrNull()