/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
*
* @author Joas Schilling <coding@schilljs.com>
*
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
import Vue from 'vue'
import { showError } from '@nextcloud/dialogs'
import { generateUrl } from '@nextcloud/router'
import { PARTICIPANT } from '../constants.js'
import {
joinCall,
leaveCall,
} from '../services/callsService.js'
import { EventBus } from '../services/EventBus.js'
import {
promoteToModerator,
demoteFromModerator,
removeAttendeeFromConversation,
resendInvitations,
sendCallNotification,
joinConversation,
leaveConversation,
removeCurrentUserFromConversation,
grantAllPermissionsToParticipant,
removeAllPermissionsFromParticipant,
setPermissions,
setTyping,
} from '../services/participantsService.js'
import SessionStorage from '../services/SessionStorage.js'
const state = {
attendees: {
},
peers: {
},
inCall: {
},
connecting: {
},
typing: {
},
speaking: {
},
}
const getters = {
isInCall: (state) => (token) => {
return !!(state.inCall[token] && Object.keys(state.inCall[token]).length > 0)
},
isConnecting: (state) => (token) => {
return !!(state.connecting[token] && Object.keys(state.connecting[token]).length > 0)
},
/**
* Gets the participants array.
*
* @param {object} state - the state object.
* @return {Array} the participants array (if there are participants in the
* store).
*/
participantsList: (state) => (token) => {
if (state.attendees[token]) {