Skip to content

Commit

Permalink
Merge pull request #11119 from nextcloud/fix/10887/session-in-call
Browse files Browse the repository at this point in the history
fix(activeSession): minor fixes
  • Loading branch information
Antreesy committed Dec 5, 2023
2 parents 3258e99 + 7ebd24a commit 990ae05
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/composables/useActiveSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { showInfo } from '@nextcloud/dialogs'

import { SESSION } from '../constants.js'
import { setSessionState } from '../services/participantsService.js'
import { useIsInCall } from './useIsInCall.js'
import { useStore } from './useStore.js'

const supportSessionState = getCapabilities()?.spreed?.features?.includes('session-state')
Expand All @@ -42,6 +43,7 @@ export function useActiveSession() {
}

const store = useStore()
const isInCall = useIsInCall()
const token = computed(() => store.getters.getToken())
const windowIsVisible = computed(() => store.getters.windowIsVisible())

Expand Down Expand Up @@ -94,6 +96,9 @@ export function useActiveSession() {
|| !token.value) {
return
}
if (isInCall.value) {
return
}
clearTimeout(inactiveTimer.value)
inactiveTimer.value = null
currentState.value = SESSION.STATE.INACTIVE
Expand All @@ -111,13 +116,13 @@ export function useActiveSession() {
}

const handleWindowFocus = ({ type }) => {
clearTimeout(inactiveTimer.value)
if (type === 'focus') {
setSessionAsActive()

document.removeEventListener('mouseenter', handleMouseMove)
document.removeEventListener('mouseleave', handleMouseMove)
} else if (type === 'blur') {
clearTimeout(inactiveTimer.value)
inactiveTimer.value = setTimeout(() => {
setSessionAsInactive()
}, INACTIVE_TIME_MS)
Expand Down

0 comments on commit 990ae05

Please sign in to comment.