mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-07-02 18:14:47 +02:00
Fix:Back button closing modals and fullscreen player #535
This commit is contained in:
parent
152cce2e9e
commit
ebd65b4fa7
2 changed files with 7 additions and 6 deletions
|
@ -215,17 +215,18 @@ Vue.prototype.$setOrientationLock = (orientationLockSetting) => {
|
|||
}
|
||||
|
||||
export default ({ store, app }, inject) => {
|
||||
inject('eventBus', new Vue())
|
||||
const eventBus = new Vue()
|
||||
inject('eventBus', eventBus)
|
||||
|
||||
// iOS Only
|
||||
// backButton event does not work with iOS swipe navigation so use this workaround
|
||||
if (app.router && Capacitor.getPlatform() === 'ios') {
|
||||
app.router.beforeEach((to, from, next) => {
|
||||
if (store.state.globals.isModalOpen) {
|
||||
Vue.prototype.$eventBus.$emit('close-modal')
|
||||
eventBus.$emit('close-modal')
|
||||
}
|
||||
if (store.state.playerIsFullscreen) {
|
||||
Vue.prototype.$eventBus.$emit('minimize-player')
|
||||
eventBus.$emit('minimize-player')
|
||||
}
|
||||
next()
|
||||
})
|
||||
|
@ -234,11 +235,11 @@ export default ({ store, app }, inject) => {
|
|||
// Android only
|
||||
App.addListener('backButton', async ({ canGoBack }) => {
|
||||
if (store.state.globals.isModalOpen) {
|
||||
Vue.prototype.$eventBus.$emit('close-modal')
|
||||
eventBus.$emit('close-modal')
|
||||
return
|
||||
}
|
||||
if (store.state.playerIsFullscreen) {
|
||||
Vue.prototype.$eventBus.$emit('minimize-player')
|
||||
eventBus.$emit('minimize-player')
|
||||
return
|
||||
}
|
||||
if (!canGoBack) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue