Skip to content

Commit

Permalink
Show image modal toast 1 time only
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcoding810 committed Feb 22, 2025
1 parent eec2a00 commit dc8afd9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions app/src/main/java/com/paulcoding/hviewer/preference/MMKV.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const val REMOTE_URL = "remote_url"
const val SECURE_SCREEN = "secure_screen"
const val PIN = "pin"
const val PIN_COUNT = "pin_count"
const val SHOWED_TUT_HIDE_IMAGE_MODAL = "showed_tut_hide_image_modal"

object Preferences {
private val kv: MMKV = MMKV.defaultMMKV()
Expand Down Expand Up @@ -34,4 +35,10 @@ object Preferences {
set(value) {
kv.putString(PIN, value)
}

var showedTutHideImageModal: Boolean
get() = kv.getBoolean(SHOWED_TUT_HIDE_IMAGE_MODAL, false)
set(value) {
kv.putBoolean(SHOWED_TUT_HIDE_IMAGE_MODAL, value)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import com.paulcoding.hviewer.extensions.isScrolledToEnd
import com.paulcoding.hviewer.extensions.openInBrowser
import com.paulcoding.hviewer.helper.makeToast
import com.paulcoding.hviewer.model.SiteConfig
import com.paulcoding.hviewer.preference.Preferences
import com.paulcoding.hviewer.ui.component.HBackIcon
import com.paulcoding.hviewer.ui.component.HIcon
import com.paulcoding.hviewer.ui.component.HImage
Expand Down Expand Up @@ -206,7 +207,12 @@ fun ImageModal(url: String, dismiss: () -> Unit) {
modifier = Modifier
.zoomable(
state = zoomableState,
onClick = { makeToast(R.string.double_click_to_dismiss) },
onClick = {
if (!Preferences.showedTutHideImageModal) {
makeToast(R.string.double_click_to_dismiss)
Preferences.showedTutHideImageModal = true
}
},
onDoubleClick = doubleClickToZoomListener
)
) {
Expand Down

0 comments on commit dc8afd9

Please sign in to comment.