Files
speckle-server/packages/frontend-2/lib/presentations/composables/viewerPostSetup.ts
T
Kristaps Fabians Geikins d394e1cd9b fix: various presentations mode fixes related to resetting (#5635)
* better workspace feature flag ops

* user activity is correctly tracked

* more fixes
2025-10-03 12:39:59 +03:00

45 lines
1.1 KiB
TypeScript

import { useInjectedPresentationState } from '~/lib/presentations/composables/setup'
import { useViewerUserActivityTracking } from '~/lib/viewer/composables/activity'
import { useInjectedViewerState } from '~/lib/viewer/composables/setup'
const useActivityTrackingIntegration = () => {
useViewerUserActivityTracking({
trackInternallyOnly: true
})
}
const useResetTrackingIntegration = () => {
const { on } = useEventBus()
const {
ui: { slideIdx },
viewer: { hasViewChanged }
} = useInjectedPresentationState()
const {
ui: {
savedViews: { savedViewStateId }
}
} = useInjectedViewerState()
on(ViewerEventBusKeys.UserChangedOpenedView, () => {
hasViewChanged.value = true
})
watch(
slideIdx,
() => {
savedViewStateId.value = undefined
hasViewChanged.value = false
},
{ flush: 'sync' }
)
}
/**
* Post setup work to run after the viewer (and presentation) states have been set up
*/
export const usePresentationViewerPostSetup = () => {
if (import.meta.server) return
useActivityTrackingIntegration()
useResetTrackingIntegration()
}