mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-06-28 16:00:17 +02:00
This commit is contained in:
parent
6a8d901ce1
commit
b4bb6bf81b
7 changed files with 64 additions and 22 deletions
|
@ -14,21 +14,6 @@ if (Capacitor.getPlatform() != 'web') {
|
|||
setStatusBarStyleDark()
|
||||
}
|
||||
|
||||
App.addListener('backButton', async ({ canGoBack }) => {
|
||||
if (!canGoBack) {
|
||||
const { value } = await Dialog.confirm({
|
||||
title: 'Confirm',
|
||||
message: `Did you want to exit the app?`,
|
||||
})
|
||||
if (value) {
|
||||
App.exitApp()
|
||||
}
|
||||
|
||||
} else {
|
||||
window.history.back()
|
||||
}
|
||||
})
|
||||
|
||||
Vue.prototype.$isDev = process.env.NODE_ENV !== 'production'
|
||||
|
||||
Vue.prototype.$dateDistanceFromNow = (unixms) => {
|
||||
|
@ -135,6 +120,30 @@ Vue.prototype.$encode = encode
|
|||
const decode = (text) => Buffer.from(decodeURIComponent(text), 'base64').toString()
|
||||
Vue.prototype.$decode = decode
|
||||
|
||||
export default ({ store }) => {
|
||||
App.addListener('backButton', async ({ canGoBack }) => {
|
||||
if (store.state.globals.isModalOpen) {
|
||||
Vue.prototype.$eventBus.$emit('close-modal')
|
||||
return
|
||||
}
|
||||
if (store.state.playerIsFullscreen) {
|
||||
Vue.prototype.$eventBus.$emit('minimize-player')
|
||||
return
|
||||
}
|
||||
if (!canGoBack) {
|
||||
const { value } = await Dialog.confirm({
|
||||
title: 'Confirm',
|
||||
message: `Did you want to exit the app?`,
|
||||
})
|
||||
if (value) {
|
||||
App.exitApp()
|
||||
}
|
||||
} else {
|
||||
window.history.back()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export {
|
||||
encode,
|
||||
decode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue