Skip to content

Commit

Permalink
[Feature Request] Option to turn off History - #3772 (#3855)
Browse files Browse the repository at this point in the history
* Implementing do not save chapter history preference

* Refactor of labels

* Changing incognito mode from Readers section to More

* Fixing imports and removing unused strings
  • Loading branch information
Platiplus authored Oct 3, 2020
1 parent 2df6a4d commit 79ccfcd
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ object PreferenceKeys {

const val defaultChapterDisplayByNameOrNumber = "default_chapter_display_by_name_or_number"

const val incognitoMode = "incognito_mode"

fun trackUsername(syncId: Int) = "pref_mangasync_username_$syncId"

fun trackPassword(syncId: Int) = "pref_mangasync_password_$syncId"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ class PreferencesHelper(val context: Context) {

fun sortChapterByAscendingOrDescending() = prefs.getInt(Keys.defaultChapterSortByAscendingOrDescending, Manga.SORT_DESC)

fun incognitoMode() = prefs.getBoolean(Keys.incognitoMode, false)

fun setChapterSettingsDefault(manga: Manga) {
prefs.edit {
putInt(Keys.defaultChapterFilterByRead, manga.readFilter)
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import eu.kanade.tachiyomi.util.preference.preferenceCategory
import eu.kanade.tachiyomi.util.preference.summaryRes
import eu.kanade.tachiyomi.util.preference.switchPreference
import eu.kanade.tachiyomi.util.preference.titleRes
import eu.kanade.tachiyomi.util.preference.defaultValue
import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.system.openInBrowser
import rx.android.schedulers.AndroidSchedulers
Expand Down Expand Up @@ -53,6 +54,15 @@ class MoreController :
iconTint = tintColor
}

switchPreference {
key = Keys.incognitoMode
summaryRes = R.string.pref_incognito_mode_summary
titleRes = R.string.pref_incognito_mode
iconRes = R.drawable.ic_glasses_black_24dp
iconTint = tintColor
defaultValue = false
}

preferenceCategory {
preference {
titleRes = R.string.label_download_queue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,11 +409,13 @@ class ReaderPresenter(
* Saves this [chapter] last read history.
*/
private fun saveChapterHistory(chapter: ReaderChapter) {
val history = History.create(chapter.chapter).apply { last_read = Date().time }
db.updateHistoryLastRead(history).asRxCompletable()
.onErrorComplete()
.subscribeOn(Schedulers.io())
.subscribe()
if (!preferences.incognitoMode()) {
val history = History.create(chapter.chapter).apply { last_read = Date().time }
db.updateHistoryLastRead(history).asRxCompletable()
.onErrorComplete()
.subscribeOn(Schedulers.io())
.subscribe()
}
}

/**
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@
<string name="webtoon_side_padding_15">15%</string>
<string name="webtoon_side_padding_20">20%</string>
<string name="webtoon_side_padding_25">25%</string>
<string name="pref_incognito_mode">Incognito mode</string>
<string name="pref_incognito_mode_summary">Disables recording history in History tab</string>

<!-- Downloads section -->
<string name="pref_download_directory">Download location</string>
Expand Down

0 comments on commit 79ccfcd

Please sign in to comment.