From e64492e3a8d3def7281c5bc2f4aab1372cd6f5ac Mon Sep 17 00:00:00 2001 From: Carlos <2092019+CarlosEsco@users.noreply.github.com> Date: Thu, 2 Jul 2020 14:37:41 -0400 Subject: [PATCH] show similar dialog for new users fix debug log option not showing new release --- .../data/preference/PreferencesHelper.kt | 4 ++- .../data/similar/SimilarUpdateJob.kt | 2 +- .../kanade/tachiyomi/ui/main/MainActivity.kt | 7 ++++- .../ui/manga/MangaDetailsPresenter.kt | 2 +- .../ui/setting/SettingsAdvancedController.kt | 31 +++++++++---------- app/src/main/res/raw/changelog_release.xml | 6 ++++ app/src/main/res/values/strings_neko.xml | 12 +++++-- buildSrc/src/main/kotlin/Dependencies.kt | 4 +-- 8 files changed, 43 insertions(+), 25 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt index c4bb94e2d8..9cbcc88351 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt @@ -298,7 +298,9 @@ class PreferencesHelper(val context: Context) { fun shownSimilarTutorial() = flowPrefs.getBoolean("shown_similar_tutorial", false) - fun similarEnabled() = prefs.getBoolean(Keys.similarEnabled, false) + fun similarEnabled() = flowPrefs.getBoolean(Keys.similarEnabled, false) + + fun shownSimilarAskDialog() = flowPrefs.getBoolean("shown_similar_ask_dialog", false) fun similarOnlyOverWifi() = prefs.getBoolean(Keys.similarOnlyOverWifi, true) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/similar/SimilarUpdateJob.kt b/app/src/main/java/eu/kanade/tachiyomi/data/similar/SimilarUpdateJob.kt index ab48c64bf9..475154f61b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/similar/SimilarUpdateJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/similar/SimilarUpdateJob.kt @@ -29,7 +29,7 @@ class SimilarUpdateJob(private val context: Context, workerParams: WorkerParamet fun setupTask(skipInitial: Boolean = false) { val preferences = Injekt.get() - val enabled = preferences.similarEnabled() + val enabled = preferences.similarEnabled().get() val interval = preferences.similarUpdateInterval().getOrDefault() if (enabled) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index c0eb6b4f19..fc4d080168 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -285,8 +285,13 @@ open class MainActivity : BaseActivity(), DownloadServiceListener, MangadexLogin (router.backstack.lastOrNull()?.controller() as? SettingsController)?.setTitle() if (savedInstanceState == null) { - // Show changelog if needed + // Show changelog or similar manga enabling on install prompt + // NOTE: we show the similar manga dialog first so it is behind the changelog if (Migrations.upgrade(preferences)) { + if (!preferences.similarEnabled().get() && !preferences.shownSimilarAskDialog().get()) { + EnableSimilarDialogController().showDialog(router) + preferences.shownSimilarAskDialog().set(true) + } if (!BuildConfig.DEBUG) ChangelogDialogController().showDialog(router) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt index 5c6f50eaed..c2aec8f71a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt @@ -755,7 +755,7 @@ class MangaDetailsPresenter( fun isTracked(): Boolean = loggedServices.any { service -> tracks.any { it.sync_id == service.id } } - fun similarEnabled(): Boolean = preferences.similarEnabled() + fun similarEnabled(): Boolean = preferences.similarEnabled().get() // Tracking private fun setTrackItems() { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt index 12c5e3562d..b8318446ed 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt @@ -12,7 +12,6 @@ import android.widget.Toast import androidx.preference.PreferenceScreen import com.afollestad.materialdialogs.MaterialDialog import com.google.firebase.crashlytics.FirebaseCrashlytics -import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.DebugTree import eu.kanade.tachiyomi.FileDebugTree import eu.kanade.tachiyomi.R @@ -113,23 +112,21 @@ class SettingsAdvancedController : SettingsController() { onClick { cleanupDownloads() } }*/ - if (BuildConfig.DEBUG) { - switchPreference { - key = PreferenceKeys.debugLogger - titleRes = R.string.enable_debug_logs - summaryRes = R.string.enable_debug_logs_summary - defaultValue = false - setOnPreferenceClickListener { it -> - if (it.isEnabled) { - Timber.plant(FileDebugTree()) - } else { - val fileDebugTree = FileDebugTree(); - Timber.uproot(fileDebugTree) - Timber.uproot(DebugTree()) - fileDebugTree.cleanup() - } - true + switchPreference { + key = PreferenceKeys.debugLogger + titleRes = R.string.enable_debug_logs + summaryRes = R.string.enable_debug_logs_summary + defaultValue = false + setOnPreferenceClickListener { it -> + if (it.isEnabled) { + Timber.plant(FileDebugTree()) + } else { + val fileDebugTree = FileDebugTree(); + Timber.uproot(fileDebugTree) + Timber.uproot(DebugTree()) + fileDebugTree.cleanup() } + true } } diff --git a/app/src/main/res/raw/changelog_release.xml b/app/src/main/res/raw/changelog_release.xml index f35c29d366..431567ddba 100644 --- a/app/src/main/res/raw/changelog_release.xml +++ b/app/src/main/res/raw/changelog_release.xml @@ -1,5 +1,11 @@ + + Fix: missing debug log + New: Dialog for similar manga for new users + diff --git a/app/src/main/res/values/strings_neko.xml b/app/src/main/res/values/strings_neko.xml index 5433cc03ff..116887cb40 100644 --- a/app/src/main/res/values/strings_neko.xml +++ b/app/src/main/res/values/strings_neko.xml @@ -63,7 +63,7 @@ Starting manual update Download the latest similar manga database. - This is around 20mb in size and is updated daily. + This is around 15mb in size and is updated daily. Similar update frequency Updating similar manga (%1$d / %2$d updated) @@ -75,11 +75,19 @@ This is a recommendation system outside of MangaDex, and works by matching by genres, demographics, content type, themes, and then using term frequency–inverse document frequency (Tfidf) to get the similarity of two manga\'s descriptions. When enabled this file will download immediately!! - Then auto download a refreshed file every 3 day. The file is about 20mb in size. + Then auto download a refreshed file every 3 day. The file is about 15mb in size. For more information and to view the source code:\n%s + Enable Similar Manga? + + Would you like to enable similar manga recommendations? + This will download approximately 15mb of data if enabled right now. + You can always enable it in the Settings / Similar manga menu. + + Enable + Skip Skip chapters hidden by filters diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 3b0d237329..271871ab15 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -19,8 +19,8 @@ object AndroidVersions { const val COMPILE_SDK = 29 const val MIN_SDK = 24 const val TARGET_SDK = 29 - const val VERSION_CODE = 71 - const val VERSION_NAME = "2.0.15.3" + const val VERSION_CODE = 72 + const val VERSION_NAME = "2.0.15.4" } object BuildPluginsVersion {