Skip to content

Commit

Permalink
Move usingTouch into the utils store
Browse files Browse the repository at this point in the history
Touch no longer has to be "redetected" on every video
  • Loading branch information
MarmadileManteater committed Mar 3, 2024
1 parent 632957d commit 4bb55fc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/renderer/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ export default defineComponent({
})
})
},

methods: {
checkThemeSettings: function () {
const theme = {
Expand Down Expand Up @@ -551,7 +552,8 @@ export default defineComponent({
},

...mapMutations([
'setInvidiousInstancesList'
'setInvidiousInstancesList',
'setUsingTouch'
]),

...mapActions([
Expand Down
14 changes: 9 additions & 5 deletions src/renderer/components/ft-video-player/ft-video-player.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineComponent } from 'vue'
import { mapActions } from 'vuex'
import { mapActions, mapMutations } from 'vuex'

import videojs from 'video.js'
import qualitySelector from '@silvermine/videojs-quality-selector'
Expand Down Expand Up @@ -146,7 +146,6 @@ export default defineComponent({
statsModal: null,
showStatsModal: false,
statsModalEventName: 'updateStats',
usingTouch: false,
// whether or not sponsor segments should be skipped
skipSponsors: true,
// countdown before actually skipping sponsor segments
Expand Down Expand Up @@ -185,6 +184,9 @@ export default defineComponent({
}
},
computed: {
usingTouch: function () {
return this.$store.getters.getUsingTouch
},
currentLocale: function () {
return this.$i18n.locale.replace('_', '-')
},
Expand Down Expand Up @@ -1984,13 +1986,13 @@ export default defineComponent({
},

handleTouchStart: function () {
this.usingTouch = true
this.setUsingTouch(true)
},

handleMouseOver: function () {
// This addresses a discrepancy that only seems to occur in the mobile version of firefox
if (navigator.userAgent.search('Firefox') !== -1 && (videojs.browser.IS_ANDROID || videojs.browser.IS_IOS)) { return }
this.usingTouch = false
this.setUsingTouch(false)
},

toggleShowStatsModal: function () {
Expand Down Expand Up @@ -2281,7 +2283,9 @@ export default defineComponent({
this.powerSaveBlocker = null
}
},

...mapMutations([
'setUsingTouch'
]),
...mapActions([
'updateDefaultCaptionSettings',
'parseScreenshotCustomFileName',
Expand Down
11 changes: 10 additions & 1 deletion src/renderer/store/modules/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ const state = {
externalPlayerNames: [],
externalPlayerNameTranslationKeys: [],
externalPlayerValues: [],
externalPlayerCmdArguments: {}
externalPlayerCmdArguments: {},
usingTouch: false
}

const getters = {
Expand Down Expand Up @@ -143,6 +144,10 @@ const getters = {

getExternalPlayerCmdArguments () {
return state.externalPlayerCmdArguments
},

getUsingTouch () {
return state.usingTouch
}
}

Expand Down Expand Up @@ -884,6 +889,10 @@ const mutations = {

setExternalPlayerCmdArguments (state, value) {
state.externalPlayerCmdArguments = value
},

setUsingTouch(state, value) {
state.usingTouch = value
}
}

Expand Down

0 comments on commit 4bb55fc

Please sign in to comment.