From ebd65b4fa7507fe1ce9623fc244622ea7122af7b Mon Sep 17 00:00:00 2001 From: advplyr Date: Tue, 31 Jan 2023 14:50:26 -0600 Subject: [PATCH] Fix:Back button closing modals and fullscreen player #535 --- components/app/AudioPlayer.vue | 2 +- plugins/init.client.js | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/components/app/AudioPlayer.vue b/components/app/AudioPlayer.vue index 450e6efa..890b77ae 100644 --- a/components/app/AudioPlayer.vue +++ b/components/app/AudioPlayer.vue @@ -849,7 +849,7 @@ export default { document.documentElement.style.setProperty('--title-author-left-offset-collapsed', 24 + coverImageWidthCollapsed + 'px') }, minimizePlayerEvt() { - this.showFullscreen = false + this.collapseFullscreen() }, showProgressSyncIsFailing() { this.syncStatus = this.$constants.SyncStatus.FAILED diff --git a/plugins/init.client.js b/plugins/init.client.js index 3ccb8582..669db71a 100644 --- a/plugins/init.client.js +++ b/plugins/init.client.js @@ -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) {