Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/components/CallView/shared/EmptyCallView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import IconLink from 'vue-material-design-icons/Link.vue'
import IconPhoneOutline from 'vue-material-design-icons/PhoneOutline.vue'
import { useGetToken } from '../../../composables/useGetToken.ts'
import { CONVERSATION, PARTICIPANT } from '../../../constants.ts'
import { isConversationPhoneRoom } from '../../../utils/conversation.ts'
import { copyConversationLinkToClipboard } from '../../../utils/handleUrl.ts'

export default {
Expand Down Expand Up @@ -104,10 +105,7 @@ export default {
},

isPhoneConversation() {
return this.conversation
&& (this.conversation.objectType === CONVERSATION.OBJECT_TYPE.PHONE_LEGACY
|| this.conversation.objectType === CONVERSATION.OBJECT_TYPE.PHONE_PERSISTENT
|| this.conversation.objectType === CONVERSATION.OBJECT_TYPE.PHONE_TEMPORARY)
return this.conversation && isConversationPhoneRoom(this.conversation)
},

canInviteOthers() {
Expand Down
6 changes: 2 additions & 4 deletions src/components/TopBar/CallButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ import { useSoundsStore } from '../../stores/sounds.js'
import { useTalkHashStore } from '../../stores/talkHash.js'
import { useTokenStore } from '../../stores/token.ts'
import { blockCalls, unsupportedWarning } from '../../utils/browserCheck.ts'
import { isConversationPhoneRoom } from '../../utils/conversation.ts'
import { messagePleaseReload } from '../../utils/talkDesktopUtils.ts'

export default {
Expand Down Expand Up @@ -354,10 +355,7 @@ export default {
},

isPhoneRoom() {
return this.conversation.objectId === CONVERSATION.OBJECT_ID.PHONE_OUTGOING
&& (this.conversation.objectType === CONVERSATION.OBJECT_TYPE.PHONE_LEGACY
|| this.conversation.objectType === CONVERSATION.OBJECT_TYPE.PHONE_PERSISTENT
|| this.conversation.objectType === CONVERSATION.OBJECT_TYPE.PHONE_TEMPORARY)
return isConversationPhoneRoom(this.conversation)
},

isInLobby() {
Expand Down
21 changes: 3 additions & 18 deletions src/composables/useJoinCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import type { Conversation, Participant } from '../types/index.ts'
import type { Participant } from '../types/index.ts'

import { showError } from '@nextcloud/dialogs'
import { emit } from '@nextcloud/event-bus'
import { t } from '@nextcloud/l10n'
import { useStore } from 'vuex'
import { ATTENDEE, CALL, CONVERSATION, PARTICIPANT } from '../constants.ts'
import { ATTENDEE, CALL, PARTICIPANT } from '../constants.ts'
import { callSIPDialOut } from '../services/callsService.ts'
import { getTalkConfig } from '../services/CapabilitiesManager.ts'
import { useActorStore } from '../stores/actor.ts'
import { useSettingsStore } from '../stores/settings.ts'
import { isAxiosErrorResponse } from '../types/guards.ts'
import { isConversationPhoneRoom } from '../utils/conversation.ts'

/**
* Handler function to join a call and manage side effects
Expand All @@ -24,22 +25,6 @@ export function useJoinCall() {
const settingsStore = useSettingsStore()
const vuexStore = useStore()

/**
* Returns whether the conversation is a phone room (with a single SIP phone participant)
*
* @param conversation - conversation object
* @param conversation.objectId - conversation objectId
* @param conversation.objectType - conversation objectType
*/
function isConversationPhoneRoom({ objectId, objectType }: Conversation) {
return objectId === CONVERSATION.OBJECT_ID.PHONE_OUTGOING
&& [
CONVERSATION.OBJECT_TYPE.PHONE_LEGACY,
CONVERSATION.OBJECT_TYPE.PHONE_PERSISTENT,
CONVERSATION.OBJECT_TYPE.PHONE_TEMPORARY,
].includes(objectType)
}

/**
* Tries to call the given SIP phone participant
*
Expand Down
15 changes: 5 additions & 10 deletions src/store/participantsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { emit } from '@nextcloud/event-bus'
import { t } from '@nextcloud/l10n'
import Hex from 'crypto-js/enc-hex.js'
import SHA1 from 'crypto-js/sha1.js'
import { ATTENDEE, CONVERSATION, PARTICIPANT } from '../constants.ts'
import { ATTENDEE, PARTICIPANT } from '../constants.ts'
import { banActor } from '../services/banService.ts'
import {
joinCall,
Expand Down Expand Up @@ -40,6 +40,7 @@ import pinia from '../stores/pinia.ts'
import { useSessionStore } from '../stores/session.ts'
import { useTokenStore } from '../stores/token.ts'
import CancelableRequest from '../utils/CancelableRequest.ts'
import { isConversationPhoneRoom } from '../utils/conversation.ts'
import { convertToUnix } from '../utils/formattedTime.ts'
import { messagePleaseTryToReload } from '../utils/talkDesktopUtils.ts'

Expand Down Expand Up @@ -1178,17 +1179,11 @@ const actions = {
}, 5000)
}

// Special handling for dial-out rooms, if a call was rejected
// Special handling for phone rooms, if a call was rejected
if (value.status === 'rejected') {
const conversation = context.rootGetters.conversation(tokenStore.token)
const isConversationPhoneRoom = [
CONVERSATION.OBJECT_TYPE.PHONE_LEGACY,
CONVERSATION.OBJECT_TYPE.PHONE_PERSISTENT,
CONVERSATION.OBJECT_TYPE.PHONE_TEMPORARY,
].includes(conversation.objectType)
&& conversation.objectId === CONVERSATION.OBJECT_ID.PHONE_OUTGOING

if (isConversationPhoneRoom) {

if (isConversationPhoneRoom(conversation)) {
const actorStore = useActorStore()
await context.dispatch('leaveCall', {
token: tokenStore.token,
Expand Down
19 changes: 19 additions & 0 deletions src/utils/conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,25 @@ export function isEvent(conversation: Conversation): boolean {
return conversation.objectType === CONVERSATION.OBJECT_TYPE.EVENT
}

/**
* Returns whether the conversation is a phone room (with a single SIP phone participant).
* Covers both dial-out and direct-dial-in rooms.
*
* @param conversation - conversation object
* @param conversation.objectId - conversation objectId
* @param conversation.objectType - conversation objectType
*/
export function isConversationPhoneRoom({ objectId, objectType }: Conversation) {
return [
CONVERSATION.OBJECT_ID.PHONE_OUTGOING,
CONVERSATION.OBJECT_ID.PHONE_INCOMING,
].includes(objectId) && [
CONVERSATION.OBJECT_TYPE.PHONE_LEGACY,
CONVERSATION.OBJECT_TYPE.PHONE_PERSISTENT,
CONVERSATION.OBJECT_TYPE.PHONE_TEMPORARY,
].includes(objectType)
}

/**
* check if the conversation is archived
*
Expand Down
9 changes: 2 additions & 7 deletions src/views/MainView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { CALL, CONVERSATION } from '../constants.ts'
import { getTalkConfig } from '../services/CapabilitiesManager.ts'
import { useActorStore } from '../stores/actor.ts'
import { useSettingsStore } from '../stores/settings.ts'
import { isConversationPhoneRoom } from '../utils/conversation.ts'

const props = defineProps<{
token: string
Expand Down Expand Up @@ -116,15 +117,9 @@ function handleDirectCall(routeToken: string) {
CALL.RECORDING.AUDIO,
].includes(conversation.callRecording)
|| conversation.recordingConsent === CALL.RECORDING_CONSENT.ENABLED
const isConversationPhoneRoom = [
CONVERSATION.OBJECT_TYPE.PHONE_LEGACY,
CONVERSATION.OBJECT_TYPE.PHONE_PERSISTENT,
CONVERSATION.OBJECT_TYPE.PHONE_TEMPORARY,
].includes(conversation.objectType)
&& conversation.objectId === CONVERSATION.OBJECT_ID.PHONE_OUTGOING

// Verify conditions for showing MediaSettings (required or user opted out)
if (showRecordingWarning || settingsStore.showMediaSettings || isConversationPhoneRoom) {
if (showRecordingWarning || settingsStore.showMediaSettings || isConversationPhoneRoom(conversation)) {
emit('talk:media-settings:show')
return
}
Expand Down
Loading