Add banner for Incognito Mode

(cherry picked from commit cf39ae0000)
This commit is contained in:
arkon
2020-10-03 10:53:26 -04:00
committed by Jobobby04
parent 085722e077
commit 2772e4960e
4 changed files with 24 additions and 2 deletions
@@ -275,7 +275,7 @@ class PreferencesHelper(val context: Context) {
fun sortChapterByAscendingOrDescending() = prefs.getInt(Keys.defaultChapterSortByAscendingOrDescending, Manga.SORT_DESC)
fun incognitoMode() = prefs.getBoolean(Keys.incognitoMode, false)
fun incognitoMode() = flowPrefs.getBoolean(Keys.incognitoMode, false)
fun setChapterSettingsDefault(manga: Manga) {
prefs.edit {
@@ -234,6 +234,10 @@ class MainActivity : BaseActivity<MainActivityBinding>() {
preferences.downloadedOnly()
.asImmediateFlow { binding.downloadedOnly.isVisible = it }
.launchIn(scope)
preferences.incognitoMode()
.asImmediateFlow { binding.incognitoMode.isVisible = it }
.launchIn(scope)
}
override fun onNewIntent(intent: Intent) {
@@ -470,7 +470,7 @@ class ReaderPresenter(
* Saves this [chapter] last read history.
*/
private fun saveChapterHistory(chapter: ReaderChapter) {
if (!preferences.incognitoMode()) {
if (!preferences.incognitoMode().get()) {
val history = History.create(chapter.chapter).apply { last_read = Date().time }
db.updateHistoryLastRead(history).asRxCompletable()
.onErrorComplete()