mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2025-06-28 20:29:53 +00:00
android, desktop: make audio call default type of call on desktop (#4954)
* android, desktop: make audio call default type of call on desktop * change
This commit is contained in:
parent
15ca662805
commit
d9ad755474
4 changed files with 19 additions and 40 deletions
|
@ -17,7 +17,7 @@ data class Call(
|
||||||
val callUUID: String?,
|
val callUUID: String?,
|
||||||
val callState: CallState,
|
val callState: CallState,
|
||||||
val initialCallType: CallMediaType,
|
val initialCallType: CallMediaType,
|
||||||
val localMediaSources: CallMediaSources = CallMediaSources(mic = true, camera = initialCallType == CallMediaType.Video && appPlatform.isAndroid),
|
val localMediaSources: CallMediaSources = CallMediaSources(mic = true, camera = initialCallType == CallMediaType.Video),
|
||||||
val localCapabilities: CallCapabilities? = null,
|
val localCapabilities: CallCapabilities? = null,
|
||||||
val peerMediaSources: CallMediaSources = CallMediaSources(),
|
val peerMediaSources: CallMediaSources = CallMediaSources(),
|
||||||
val sharedKey: String? = null,
|
val sharedKey: String? = null,
|
||||||
|
|
|
@ -779,30 +779,16 @@ fun ChatInfoToolbar(
|
||||||
if (chatInfo is ChatInfo.Direct && chatInfo.contact.mergedPreferences.calls.enabled.forUser) {
|
if (chatInfo is ChatInfo.Direct && chatInfo.contact.mergedPreferences.calls.enabled.forUser) {
|
||||||
if (activeCall == null) {
|
if (activeCall == null) {
|
||||||
barButtons.add {
|
barButtons.add {
|
||||||
if (appPlatform.isAndroid) {
|
IconButton({
|
||||||
IconButton({
|
showMenu.value = false
|
||||||
showMenu.value = false
|
startCall(CallMediaType.Audio)
|
||||||
startCall(CallMediaType.Audio)
|
}, enabled = chatInfo.contact.ready && chatInfo.contact.active
|
||||||
}, enabled = chatInfo.contact.ready && chatInfo.contact.active
|
) {
|
||||||
) {
|
Icon(
|
||||||
Icon(
|
painterResource(MR.images.ic_call_500),
|
||||||
painterResource(MR.images.ic_call_500),
|
stringResource(MR.strings.icon_descr_audio_call).capitalize(Locale.current),
|
||||||
stringResource(MR.strings.icon_descr_audio_call).capitalize(Locale.current),
|
tint = if (chatInfo.contact.ready && chatInfo.contact.active) MaterialTheme.colors.primary else MaterialTheme.colors.secondary
|
||||||
tint = if (chatInfo.contact.ready && chatInfo.contact.active) MaterialTheme.colors.primary else MaterialTheme.colors.secondary
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
IconButton({
|
|
||||||
showMenu.value = false
|
|
||||||
startCall(CallMediaType.Video)
|
|
||||||
}, enabled = chatInfo.contact.ready && chatInfo.contact.active
|
|
||||||
) {
|
|
||||||
Icon(
|
|
||||||
painterResource(MR.images.ic_videocam),
|
|
||||||
stringResource(MR.strings.icon_descr_video_call).capitalize(Locale.current),
|
|
||||||
tint = if (chatInfo.contact.ready && chatInfo.contact.active) MaterialTheme.colors.primary else MaterialTheme.colors.secondary
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (activeCall?.contact?.id == chatInfo.id && appPlatform.isDesktop) {
|
} else if (activeCall?.contact?.id == chatInfo.id && appPlatform.isDesktop) {
|
||||||
|
@ -836,17 +822,10 @@ fun ChatInfoToolbar(
|
||||||
}
|
}
|
||||||
if (chatInfo.contact.ready && chatInfo.contact.active && activeCall == null) {
|
if (chatInfo.contact.ready && chatInfo.contact.active && activeCall == null) {
|
||||||
menuItems.add {
|
menuItems.add {
|
||||||
if (appPlatform.isAndroid) {
|
ItemAction(stringResource(MR.strings.icon_descr_video_call).capitalize(Locale.current), painterResource(MR.images.ic_videocam), onClick = {
|
||||||
ItemAction(stringResource(MR.strings.icon_descr_video_call).capitalize(Locale.current), painterResource(MR.images.ic_videocam), onClick = {
|
showMenu.value = false
|
||||||
showMenu.value = false
|
startCall(CallMediaType.Video)
|
||||||
startCall(CallMediaType.Video)
|
})
|
||||||
})
|
|
||||||
} else {
|
|
||||||
ItemAction(stringResource(MR.strings.icon_descr_audio_call).capitalize(Locale.current), painterResource(MR.images.ic_call_500), onClick = {
|
|
||||||
showMenu.value = false
|
|
||||||
startCall(CallMediaType.Audio)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (chatInfo is ChatInfo.Group && chatInfo.groupInfo.canAddMembers) {
|
} else if (chatInfo is ChatInfo.Group && chatInfo.groupInfo.canAddMembers) {
|
||||||
|
|
|
@ -296,7 +296,7 @@ const processCommand = (function () {
|
||||||
endCall();
|
endCall();
|
||||||
let localStream = null;
|
let localStream = null;
|
||||||
try {
|
try {
|
||||||
localStream = await getLocalMediaStream(true, command.media == CallMediaType.Video && !isDesktop, VideoCamera.User);
|
localStream = await getLocalMediaStream(true, command.media == CallMediaType.Video, VideoCamera.User);
|
||||||
const videos = getVideoElements();
|
const videos = getVideoElements();
|
||||||
if (videos) {
|
if (videos) {
|
||||||
videos.local.srcObject = localStream;
|
videos.local.srcObject = localStream;
|
||||||
|
@ -325,7 +325,7 @@ const processCommand = (function () {
|
||||||
if (activeCall)
|
if (activeCall)
|
||||||
endCall();
|
endCall();
|
||||||
inactiveCallMediaSources.mic = true;
|
inactiveCallMediaSources.mic = true;
|
||||||
inactiveCallMediaSources.camera = command.media == CallMediaType.Video && !isDesktop;
|
inactiveCallMediaSources.camera = command.media == CallMediaType.Video;
|
||||||
inactiveCallMediaSourcesChanged(inactiveCallMediaSources);
|
inactiveCallMediaSourcesChanged(inactiveCallMediaSources);
|
||||||
const { media, iceServers, relay } = command;
|
const { media, iceServers, relay } = command;
|
||||||
const encryption = supportsInsertableStreams(useWorker);
|
const encryption = supportsInsertableStreams(useWorker);
|
||||||
|
|
|
@ -560,7 +560,7 @@ const processCommand = (function () {
|
||||||
|
|
||||||
let localStream: MediaStream | null = null
|
let localStream: MediaStream | null = null
|
||||||
try {
|
try {
|
||||||
localStream = await getLocalMediaStream(true, command.media == CallMediaType.Video && !isDesktop, VideoCamera.User)
|
localStream = await getLocalMediaStream(true, command.media == CallMediaType.Video, VideoCamera.User)
|
||||||
const videos = getVideoElements()
|
const videos = getVideoElements()
|
||||||
if (videos) {
|
if (videos) {
|
||||||
videos.local.srcObject = localStream
|
videos.local.srcObject = localStream
|
||||||
|
@ -588,7 +588,7 @@ const processCommand = (function () {
|
||||||
if (activeCall) endCall()
|
if (activeCall) endCall()
|
||||||
|
|
||||||
inactiveCallMediaSources.mic = true
|
inactiveCallMediaSources.mic = true
|
||||||
inactiveCallMediaSources.camera = command.media == CallMediaType.Video && !isDesktop
|
inactiveCallMediaSources.camera = command.media == CallMediaType.Video
|
||||||
inactiveCallMediaSourcesChanged(inactiveCallMediaSources)
|
inactiveCallMediaSourcesChanged(inactiveCallMediaSources)
|
||||||
|
|
||||||
const {media, iceServers, relay} = command
|
const {media, iceServers, relay} = command
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue