Skip to content

Commit

Permalink
fix: hand raised not updating variable when listCleared
Browse files Browse the repository at this point in the history
  • Loading branch information
digitaldrummerj committed Jan 6, 2025
1 parent 63402e0 commit 00c7822
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 98 deletions.
12 changes: 4 additions & 8 deletions src/actions/action-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,20 +161,18 @@ export function GetActionsGroups(instance: InstanceBaseExt<ZoomConfig>): {
instance.ZoomGroupData[group].users.length = 0
}

instance.ZoomClientDataObj.selectedCallers.forEach((zoomID: string | number) => {
instance.ZoomClientDataObj.selectedCallers.forEach((zoomID: number) => {
if (userExist(Number(zoomID), instance.ZoomUserData)) {
if (!instance.ZoomGroupData[group].users.find((o: { zoomID: string | number }) => o.zoomID === zoomID)) {
if (!instance.ZoomGroupData[group].users.some((o: { zoomID: number }) => o.zoomID === zoomID)) {
instance.ZoomGroupData[group].users.push({
zoomID: zoomID as number,
userName: instance.ZoomUserData[zoomID as number].userName,
zoomID: zoomID,
userName: instance.ZoomUserData[zoomID].userName,
})
}
}
})

PreviousSelectedCallersSave(instance)
// instance.ZoomClientDataObj.selectedCallers.length = 0
// instance.UpdateVariablesValues()
const variables: CompanionVariableValues = {}
updateGroupVariables(instance, variables, group)
instance.setVariableValues(variables)
Expand Down Expand Up @@ -245,8 +243,6 @@ export function GetActionsGroups(instance: InstanceBaseExt<ZoomConfig>): {
}

PreviousSelectedCallersSave(instance)
// instance.ZoomClientDataObj.selectedCallers.length = 0
// instance.UpdateVariablesValues()
const variables: CompanionVariableValues = {}
updateGroupVariables(instance, variables, group)
instance.setVariableValues(variables)
Expand Down
54 changes: 0 additions & 54 deletions src/actions/action-zoomiso-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,7 @@ export function GetActionsZoomISOActions(instance: InstanceBaseExt<ZoomConfig>):
},
}
sendActionCommand(instance, sendToCommand)
// reset arrays
PreviousSelectedCallersSave(instance)
// instance.ZoomClientDataObj.selectedCallers.length = 0
// instance.ZoomClientDataObj.selectedOutputs.length = 0

// nothing changed until after the OSC command for outputRouting is received
// so no need to update variable values and feedback here
// instance.UpdateVariablesValues()
// instance.checkFeedbacks(
// FeedbackId.userNameBased,
// FeedbackId.userNameBasedAdvanced,
// FeedbackId.indexBased,
// FeedbackId.indexBasedAdvanced,
// FeedbackId.galleryBased,
// FeedbackId.galleryBasedAdvanced,
// FeedbackId.groupBased,
// FeedbackId.groupBasedAdvanced,
// FeedbackId.output
// )
}
},
},
Expand All @@ -134,25 +116,7 @@ export function GetActionsZoomISOActions(instance: InstanceBaseExt<ZoomConfig>):
},
}
sendActionCommand(instance, sendToCommand)
// reset arrays
PreviousSelectedCallersSave(instance)
// instance.ZoomClientDataObj.selectedCallers.length = 0
// instance.ZoomClientDataObj.selectedOutputs.length = 0

// nothing changed until after the OSC command for audioRouting is received
// so no need to update variable values and feedback here
// instance.UpdateVariablesValues()
// instance.checkFeedbacks(
// FeedbackId.userNameBased,
// FeedbackId.userNameBasedAdvanced,
// FeedbackId.indexBased,
// FeedbackId.indexBasedAdvanced,
// FeedbackId.galleryBased,
// FeedbackId.galleryBasedAdvanced,
// FeedbackId.groupBased,
// FeedbackId.groupBasedAdvanced,
// FeedbackId.output
// )
}
},
},
Expand All @@ -179,25 +143,7 @@ export function GetActionsZoomISOActions(instance: InstanceBaseExt<ZoomConfig>):
args = []
}

// reset arrays
PreviousSelectedCallersSave(instance)
// instance.ZoomClientDataObj.selectedCallers.length = 0
// instance.ZoomClientDataObj.selectedOutputs.length = 0

// nothing changed until after the OSC command for outputRouting is received
// so no need to update variable values and feedback here
// instance.UpdateVariablesValues()
// instance.checkFeedbacks(
// FeedbackId.userNameBased,
// FeedbackId.userNameBasedAdvanced,
// FeedbackId.indexBased,
// FeedbackId.indexBasedAdvanced,
// FeedbackId.galleryBased,
// FeedbackId.galleryBasedAdvanced,
// FeedbackId.groupBased,
// FeedbackId.groupBasedAdvanced,
// FeedbackId.output
// )
},
},
}
Expand Down
62 changes: 32 additions & 30 deletions src/osc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -711,25 +711,17 @@ export class OSC {
return
}

this.instance.ZoomClientDataObj.galleryOrder.length = 0
data.args.forEach((order: { type: string; value: number }) => {
this.instance.ZoomClientDataObj.galleryOrder.push(order.value)
})
this.instance.ZoomClientDataObj.galleryOrder = data.args.map(
(order: { type: string; value: number }) => order.value,
)

this.instance.InitVariables()

const variables: CompanionVariableValues = {}
updateGalleryVariables(this.instance, variables)
this.instance.setVariableValues(variables)

// this.instance.UpdateVariablesValues()
this.instance.checkFeedbacks(
// FeedbackId.indexBased,
// FeedbackId.indexBasedAdvanced,
FeedbackId.galleryBased,
FeedbackId.galleryBasedAdvanced,
// FeedbackId.groupBased,
// FeedbackId.groupBasedAdvanced
)
this.instance.checkFeedbacks(FeedbackId.galleryBased, FeedbackId.galleryBasedAdvanced)
break
}
case 'galleryCount': {
Expand Down Expand Up @@ -873,21 +865,34 @@ export class OSC {
// 7 = Meeting Status Ended
if (data.args[0].value === 0 || data.args[0].value === 7) {
this.destroyTimers()
for (const key of Object.keys(this.instance.ZoomUserData)) {
if (parseInt(key) > this.instance.ZoomClientDataObj.numberOfGroups) {
delete this.instance.ZoomUserData[parseInt(key)]
}
this.instance.ZoomUserData = {}
this.instance.ZoomClientDataObj = {
last_response: this.instance.ZoomClientDataObj.last_response,
selectedCallers: [],
PreviousSelectedCallers: [],
selectedOutputs: [],
selectedAudioOutputs: [],
subscribeMode: this.instance.ZoomClientDataObj.subscribeMode,
activeSpeaker: 'None',
activeSpeakerZoomId: -1,
isSpeaking: 'None',
zoomOSCVersion: this.instance.ZoomClientDataObj.zoomOSCVersion,
callStatus: this.instance.ZoomClientDataObj.callStatus,
galleryCount: 0,
galleryOrder: [],
numberOfGroups: this.instance.ZoomClientDataObj.numberOfGroups,
engineState: this.instance.ZoomClientDataObj.engineState,
capturePermissionGranted: this.instance.ZoomClientDataObj.capturePermissionGranted,
}

this.instance.ZoomClientDataObj.selectedCallers.length = 0
this.instance.ZoomVariableLink.length = 0
this.instance.ZoomGroupData = []
for (let index = 0; index < this.instance.ZoomClientDataObj.numberOfGroups + 2; index++) {
this.instance.ZoomGroupData[index] = {

this.instance.ZoomGroupData = Array.from(
{ length: this.instance.ZoomClientDataObj.numberOfGroups + 2 },
(_, index) => ({
groupName: index === 0 ? 'Hosts' : index === 1 ? 'Spotlights' : `Group ${index}`,
users: [],
}
}
}),
)

this.instance.ZoomUserData = {}
this.instance.InitVariables()
Expand All @@ -910,15 +915,12 @@ export class OSC {
break
}
case 'listCleared': {
this.instance.log('debug', 'listCleared')
PreviousSelectedCallersSave(this.instance)
this.instance.ZoomClientDataObj.selectedCallers.length = 0
this.instance.ZoomVariableLink.length = 0
for (const key of Object.keys(this.instance.ZoomUserData)) {
if (parseInt(key) > this.instance.ZoomClientDataObj.numberOfGroups) {
delete this.instance.ZoomUserData[parseInt(key)]
}
}
this.instance.log('debug', 'listCleared')
this.instance.ZoomUserData = {}

this.instance.InitVariables()
const variables: CompanionVariableValues = {}
updateAllUserBasedVariables(this.instance, variables)
Expand Down
13 changes: 7 additions & 6 deletions src/variables/variable-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,14 @@ export function initVariableDefinitions(instance: InstanceBaseExt<ZoomConfig>):
}

if (instance.config.enableVariablesForEachUser) {
for (const key in instance.ZoomUserData) {
if (userExist(Number(key), instance.ZoomUserData)) {
const user = instance.ZoomUserData[key]
if (user.zoomId > instance.ZoomClientDataObj.numberOfGroups)
userVariables.push({ name: `name`, variableId: user.zoomId.toString() })
Object.entries(instance.ZoomUserData).forEach(([key, user]) => {
const zoomId = Number(key)

if (userExist(zoomId, instance.ZoomUserData)) {
//&& user.zoomId > instance.ZoomClientDataObj.numberOfGroups) {
userVariables.push({ name: `name`, variableId: user.zoomId.toString() })
}
}
})
}

for (const key in instance.ZoomOutputData) {
Expand Down
1 change: 1 addition & 0 deletions src/variables/variable-values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ export function updateAllUserBasedVariables(
updateZoomUserVariables(instance, variables)
updateNumberOfUsers(instance, variables)
updateVideoOnCountVariable(instance, variables)
updateHandRaisedCountVariable(instance, variables)
}

export function updateCallStatusVariables(
Expand Down

0 comments on commit 00c7822

Please sign in to comment.