Skip to content

Commit

Permalink
show similar dialog for new users
Browse files Browse the repository at this point in the history
fix debug log option not showing
new release
  • Loading branch information
nonproto committed Jul 2, 2020
1 parent 566d3d0 commit e64492e
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SimilarUpdateJob(private val context: Context, workerParams: WorkerParamet
fun setupTask(skipInitial: Boolean = false) {

val preferences = Injekt.get<PreferencesHelper>()
val enabled = preferences.similarEnabled()
val enabled = preferences.similarEnabled().get()
val interval = preferences.similarUpdateInterval().getOrDefault()
if (enabled) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}

Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/raw/changelog_release.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<changelog bulletedList="true">
<changelogversion
changeDate=""
versionName="v2.0.15.4">
<changelogtext>Fix: missing debug log</changelogtext>
<changelogtext>New: Dialog for similar manga for new users</changelogtext>
</changelogversion>
<changelogversion
changeDate=""
versionName="v2.0.15.3">
Expand Down
12 changes: 10 additions & 2 deletions app/src/main/res/values/strings_neko.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<string name="similar_manually_toast">Starting manual update</string>
<string name="similar_manually_update_message">
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.
</string>
<string name="similar_update_fequency">Similar update frequency</string>
<string name="similar_loading_percent">Updating similar manga (%1$d / %2$d updated)</string>
Expand All @@ -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.
</string>
<string name="similar_credit_message">
For more information and to view the source code:\n%s
</string>
<string name="similar_ask_to_enable_title">Enable Similar Manga?</string>
<string name="similar_ask_to_enable">
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.
</string>
<string name="similar_ask_to_enable_yes">Enable</string>
<string name="similar_ask_to_enable_no">Skip</string>

<!-- Reader Settings -->
<string name="skip_hidden_chapters">Skip chapters hidden by filters</string>
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e64492e

Please sign in to comment.