wont show progress window if incognito is on

This commit is contained in:
aayush262 2024-01-25 00:30:28 +05:30
parent 67bb28d027
commit 97eacb58a6
2 changed files with 9 additions and 16 deletions

View file

@ -1210,13 +1210,10 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
val showProgressDialog = val showProgressDialog =
if (settings.askIndividual) loadData<Boolean>("${media.id}_progressDialog") if (settings.askIndividual) loadData<Boolean>("${media.id}_progressDialog")
?: true else false ?: true else false
if (showProgressDialog && Anilist.userid != null && if (media.isAdult) settings.updateForH else true) if (!incognito && showProgressDialog && Anilist.userid != null && if (media.isAdult) settings.updateForH else true)
AlertDialog.Builder(this, R.style.MyPopup) AlertDialog.Builder(this, R.style.MyPopup)
.setTitle(getString(R.string.auto_update, media.userPreferredName)) .setTitle(getString(R.string.auto_update, media.userPreferredName))
.apply { .apply {
if (incognito) {
setMessage(getString(R.string.incognito_will_not_update))
}
setOnCancelListener { hideSystemBars() } setOnCancelListener { hideSystemBars() }
setCancelable(false) setCancelable(false)
setPositiveButton(getString(R.string.yes)) { dialog, _ -> setPositiveButton(getString(R.string.yes)) { dialog, _ ->
@ -1771,7 +1768,9 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
} }
private fun updateAniProgress() { private fun updateAniProgress() {
if (exoPlayer.currentPosition / episodeLength > settings.watchPercentage && Anilist.userid != null) val incognito = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
?.getBoolean("incognito", false) ?: false
if (!incognito && exoPlayer.currentPosition / episodeLength > settings.watchPercentage && Anilist.userid != null)
if (loadData<Boolean>("${media.id}_save_progress") != false && if (media.isAdult) settings.updateForH else true) { if (loadData<Boolean>("${media.id}_save_progress") != false && if (media.isAdult) settings.updateForH else true) {
media.anime!!.selectedEpisode?.apply { media.anime!!.selectedEpisode?.apply {
updateProgress(media, this) updateProgress(media, this)

View file

@ -142,7 +142,6 @@ class MangaReaderActivity : AppCompatActivity() {
ThemeManager(this).applyTheme() ThemeManager(this).applyTheme()
binding = ActivityMangaReaderBinding.inflate(layoutInflater) binding = ActivityMangaReaderBinding.inflate(layoutInflater)
setContentView(binding.root) setContentView(binding.root)
binding.mangaReaderBack.setOnClickListener { binding.mangaReaderBack.setOnClickListener {
onBackPressedDispatcher.onBackPressed() onBackPressedDispatcher.onBackPressed()
} }
@ -853,7 +852,10 @@ class MangaReaderActivity : AppCompatActivity() {
showProgressDialog = showProgressDialog =
if (settings.askIndividual) loadData<Boolean>("${media.id}_progressDialog") if (settings.askIndividual) loadData<Boolean>("${media.id}_progressDialog")
?: true else false ?: true else false
if (showProgressDialog) { val incognito =
currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
?.getBoolean("incognito", false) ?: false
if (showProgressDialog && !incognito) {
val dialogView = layoutInflater.inflate(R.layout.item_custom_dialog, null) val dialogView = layoutInflater.inflate(R.layout.item_custom_dialog, null)
val checkbox = dialogView.findViewById<CheckBox>(R.id.dialog_checkbox) val checkbox = dialogView.findViewById<CheckBox>(R.id.dialog_checkbox)
@ -862,16 +864,8 @@ class MangaReaderActivity : AppCompatActivity() {
saveData("${media.id}_progressDialog", !isChecked) saveData("${media.id}_progressDialog", !isChecked)
showProgressDialog = !isChecked showProgressDialog = !isChecked
} }
val incognito =
currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
?.getBoolean("incognito", false) ?: false
AlertDialog.Builder(this, R.style.MyPopup) AlertDialog.Builder(this, R.style.MyPopup)
.setTitle(getString(R.string.title_update_progress)) .setTitle(getString(R.string.title_update_progress))
.apply {
if (incognito) {
setMessage(getString(R.string.incognito_will_not_update))
}
}
.setView(dialogView) .setView(dialogView)
.setCancelable(false) .setCancelable(false)
.setPositiveButton(getString(R.string.yes)) { dialog, _ -> .setPositiveButton(getString(R.string.yes)) { dialog, _ ->
@ -893,7 +887,7 @@ class MangaReaderActivity : AppCompatActivity() {
.create() .create()
.show() .show()
} else { } else {
if (loadData<Boolean>("${media.id}_save_progress") != false && if (media.isAdult) settings.updateForH else true) if (!incognito && loadData<Boolean>("${media.id}_save_progress") != false && if (media.isAdult) settings.updateForH else true)
updateProgress( updateProgress(
media, media,
MangaNameAdapter.findChapterNumber(media.manga!!.selectedChapter!!) MangaNameAdapter.findChapterNumber(media.manga!!.selectedChapter!!)