Skip to content
Snippets Groups Projects
Commit dccc6c7e authored by François-Simon Fauteux-Chapleau's avatar François-Simon Fauteux-Chapleau
Browse files

NotificationArea: don't rely on signal that's not always received

The current implementation of NotificationArea assumes that the
onActiveCallsChanged function in ChatView.qml will be called at least
once before the notification area becomes visible, but this isn't
necessarily the case.

GitLab: #1823
Change-Id: Ic85392dd9b6748b43f6c8d9cc002df973fc8be0e
parent 53a3d321
No related branches found
No related tags found
No related merge requests found
......@@ -167,15 +167,6 @@ Rectangle {
target: CurrentConversation
enabled: true
function onActiveCallsChanged() {
if (CurrentConversation.activeCalls.length > 0) {
notificationArea.id = CurrentConversation.activeCalls[0]["id"];
notificationArea.uri = CurrentConversation.activeCalls[0]["uri"];
notificationArea.device = CurrentConversation.activeCalls[0]["device"];
}
notificationArea.visible = CurrentConversation.activeCalls.length > 0 && !root.inCallView;
}
function onErrorsChanged() {
if (CurrentConversation.errors.length > 0) {
errorRect.errorLabel.text = CurrentConversation.errors[0];
......
......@@ -29,9 +29,7 @@ Rectangle {
opacity: visible
color: CurrentConversation.color
property string id: ""
property string uri: ""
property string device: ""
property var activeCall: CurrentConversation.activeCalls.length > 0 ? CurrentConversation.activeCalls[0] : null
property string textColor: UtilsAdapter.luma(root.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark
RowLayout {
......@@ -64,7 +62,10 @@ Rectangle {
border.width: 1
border.color: root.textColor
onClicked: MessagesAdapter.joinCall(uri, device, id, true)
onClicked: {
if (activeCall !== null)
MessagesAdapter.joinCall(activeCall["uri"], activeCall["device"], activeCall["id"], true)
}
}
PushButton {
......@@ -82,7 +83,10 @@ Rectangle {
border.color: root.textColor
visible: CurrentAccount.videoEnabled_Video
onClicked: MessagesAdapter.joinCall(uri, device, id)
onClicked: {
if (activeCall !== null)
MessagesAdapter.joinCall(activeCall["uri"], activeCall["device"], activeCall["id"])
}
}
PushButton {
......@@ -94,7 +98,10 @@ Rectangle {
source: JamiResources.round_close_24dp_svg
onClicked: ConversationsAdapter.ignoreActiveCall(CurrentConversation.id, id, uri, device)
onClicked: {
if (activeCall !== null)
ConversationsAdapter.ignoreActiveCall(CurrentConversation.id, activeCall["id"], activeCall["uri"], activeCall["device"])
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment