Fix:Back button closing modals and fullscreen player #535

This commit is contained in:
advplyr 2023-01-31 14:50:26 -06:00
parent 152cce2e9e
commit ebd65b4fa7
2 changed files with 7 additions and 6 deletions

View file

@ -849,7 +849,7 @@ export default {
document.documentElement.style.setProperty('--title-author-left-offset-collapsed', 24 + coverImageWidthCollapsed + 'px') document.documentElement.style.setProperty('--title-author-left-offset-collapsed', 24 + coverImageWidthCollapsed + 'px')
}, },
minimizePlayerEvt() { minimizePlayerEvt() {
this.showFullscreen = false this.collapseFullscreen()
}, },
showProgressSyncIsFailing() { showProgressSyncIsFailing() {
this.syncStatus = this.$constants.SyncStatus.FAILED this.syncStatus = this.$constants.SyncStatus.FAILED

View file

@ -215,17 +215,18 @@ Vue.prototype.$setOrientationLock = (orientationLockSetting) => {
} }
export default ({ store, app }, inject) => { export default ({ store, app }, inject) => {
inject('eventBus', new Vue()) const eventBus = new Vue()
inject('eventBus', eventBus)
// iOS Only // iOS Only
// backButton event does not work with iOS swipe navigation so use this workaround // backButton event does not work with iOS swipe navigation so use this workaround
if (app.router && Capacitor.getPlatform() === 'ios') { if (app.router && Capacitor.getPlatform() === 'ios') {
app.router.beforeEach((to, from, next) => { app.router.beforeEach((to, from, next) => {
if (store.state.globals.isModalOpen) { if (store.state.globals.isModalOpen) {
Vue.prototype.$eventBus.$emit('close-modal') eventBus.$emit('close-modal')
} }
if (store.state.playerIsFullscreen) { if (store.state.playerIsFullscreen) {
Vue.prototype.$eventBus.$emit('minimize-player') eventBus.$emit('minimize-player')
} }
next() next()
}) })
@ -234,11 +235,11 @@ export default ({ store, app }, inject) => {
// Android only // Android only
App.addListener('backButton', async ({ canGoBack }) => { App.addListener('backButton', async ({ canGoBack }) => {
if (store.state.globals.isModalOpen) { if (store.state.globals.isModalOpen) {
Vue.prototype.$eventBus.$emit('close-modal') eventBus.$emit('close-modal')
return return
} }
if (store.state.playerIsFullscreen) { if (store.state.playerIsFullscreen) {
Vue.prototype.$eventBus.$emit('minimize-player') eventBus.$emit('minimize-player')
return return
} }
if (!canGoBack) { if (!canGoBack) {