aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2021-12-20 00:15:05 +0100
committerfiaxh <git@lightrise.org>2021-12-23 00:19:26 +0100
commitf0c7dd0682fec8d72c644d8e54896de7bdc40ddb (patch)
tree0e275aa1fab7004cef7c92e16721d493b18bf8b6 /main/src
parentff4e2540ae3bfab6873beb7e03ef5c6a5b9da1da (diff)
downloaddino-f0c7dd0682fec8d72c644d8e54896de7bdc40ddb.tar.gz
dino-f0c7dd0682fec8d72c644d8e54896de7bdc40ddb.zip
UI + libdino: Improve MUJI calls from MUC
- Move calls from ICE-thead onto main thread - Identify Call.ourpart as MUC nick if in MUC - Keep track of the initiator of a call
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/application.vala18
-rw-r--r--main/src/ui/call_window/call_window.vala2
-rw-r--r--main/src/ui/conversation_content_view/call_widget.vala2
-rw-r--r--main/src/ui/conversation_titlebar/call_entry.vala18
-rw-r--r--main/src/ui/notifier_freedesktop.vala6
5 files changed, 31 insertions, 15 deletions
diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala
index 9f48caec..ecbea85e 100644
--- a/main/src/ui/application.vala
+++ b/main/src/ui/application.vala
@@ -206,9 +206,14 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
});
add_action(open_shortcuts_action);
- SimpleAction accept_call_action = new SimpleAction("accept-call", VariantType.INT32);
+ SimpleAction accept_call_action = new SimpleAction("accept-call", new VariantType.tuple(new VariantType[]{VariantType.INT32, VariantType.INT32}));
accept_call_action.activate.connect((variant) => {
- Call? call = stream_interactor.get_module(CallStore.IDENTITY).get_call_by_id(variant.get_int32());
+ int conversation_id = variant.get_child_value(0).get_int32();
+ Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation_by_id(conversation_id);
+ if (conversation == null) return;
+
+ int call_id = variant.get_child_value(1).get_int32();
+ Call? call = stream_interactor.get_module(CallStore.IDENTITY).get_call_by_id(call_id, conversation);
CallState? call_state = stream_interactor.get_module(Calls.IDENTITY).call_states[call];
if (call_state == null) return;
@@ -220,9 +225,14 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
});
add_action(accept_call_action);
- SimpleAction deny_call_action = new SimpleAction("reject-call", VariantType.INT32);
+ SimpleAction deny_call_action = new SimpleAction("reject-call", new VariantType.tuple(new VariantType[]{VariantType.INT32, VariantType.INT32}));
deny_call_action.activate.connect((variant) => {
- Call? call = stream_interactor.get_module(CallStore.IDENTITY).get_call_by_id(variant.get_int32());
+ int conversation_id = variant.get_child_value(0).get_int32();
+ Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation_by_id(conversation_id);
+ if (conversation == null) return;
+
+ int call_id = variant.get_child_value(1).get_int32();
+ Call? call = stream_interactor.get_module(CallStore.IDENTITY).get_call_by_id(call_id, conversation);
CallState? call_state = stream_interactor.get_module(Calls.IDENTITY).call_states[call];
if (call_state == null) return;
diff --git a/main/src/ui/call_window/call_window.vala b/main/src/ui/call_window/call_window.vala
index fab424bf..c610444f 100644
--- a/main/src/ui/call_window/call_window.vala
+++ b/main/src/ui/call_window/call_window.vala
@@ -20,7 +20,7 @@ namespace Dino.Ui {
public Revealer header_bar_revealer = new Revealer() { halign=Align.END, valign=Align.START, transition_type=RevealerTransitionType.CROSSFADE, transition_duration=200, visible=true };
public Box own_video_box = new Box(Orientation.HORIZONTAL, 0) { halign=Align.END, valign=Align.END, visible=true };
public Revealer invite_button_revealer = new Revealer() { margin_top=50, margin_right=30, halign=Align.END, valign=Align.START, transition_type=RevealerTransitionType.CROSSFADE, transition_duration=200 };
- public Button invite_button = new Button.from_icon_name("dino-account-plus") { relief=ReliefStyle.NONE };
+ public Button invite_button = new Button.from_icon_name("dino-account-plus") { relief=ReliefStyle.NONE, visible=false };
private Widget? own_video = null;
private HashMap<string, ParticipantWidget> participant_widgets = new HashMap<string, ParticipantWidget>();
private ArrayList<string> participants = new ArrayList<string>();
diff --git a/main/src/ui/conversation_content_view/call_widget.vala b/main/src/ui/conversation_content_view/call_widget.vala
index a7d37afd..a2c8c0c2 100644
--- a/main/src/ui/conversation_content_view/call_widget.vala
+++ b/main/src/ui/conversation_content_view/call_widget.vala
@@ -86,7 +86,7 @@ namespace Dino.Ui {
private void update_counterparts() {
if (call.state != Call.State.IN_PROGRESS && call.state != Call.State.ENDED) return;
- if (call.counterparts.size <= 1) return;
+ if (call.counterparts.size <= 1 && conversation.type_ == Conversation.Type.CHAT) return;
multiparty_peer_box.foreach((widget) => { multiparty_peer_box.remove(widget); });
diff --git a/main/src/ui/conversation_titlebar/call_entry.vala b/main/src/ui/conversation_titlebar/call_entry.vala
index 3fa399a6..3b3a5b39 100644
--- a/main/src/ui/conversation_titlebar/call_entry.vala
+++ b/main/src/ui/conversation_titlebar/call_entry.vala
@@ -115,13 +115,17 @@ namespace Dino.Ui {
return;
}
- Conversation conv_bak = conversation;
- bool audio_works = yield stream_interactor.get_module(Calls.IDENTITY).can_do_audio_calls_async(conversation);
- bool video_works = yield stream_interactor.get_module(Calls.IDENTITY).can_do_video_calls_async(conversation);
- if (conv_bak != conversation) return;
-
- visible = audio_works;
- video_button.visible = video_works;
+ if (conversation.type_ == Conversation.Type.CHAT) {
+ Conversation conv_bak = conversation;
+ bool audio_works = yield stream_interactor.get_module(Calls.IDENTITY).can_do_audio_calls_async(conversation);
+ bool video_works = yield stream_interactor.get_module(Calls.IDENTITY).can_do_video_calls_async(conversation);
+ if (conv_bak != conversation) return;
+
+ visible = audio_works;
+ video_button.visible = video_works;
+ } else {
+ visible = false;
+ }
}
public new void unset_conversation() { }
diff --git a/main/src/ui/notifier_freedesktop.vala b/main/src/ui/notifier_freedesktop.vala
index 83e9bf57..e8e2ba1d 100644
--- a/main/src/ui/notifier_freedesktop.vala
+++ b/main/src/ui/notifier_freedesktop.vala
@@ -141,10 +141,12 @@ public class Dino.Ui.FreeDesktopNotifier : NotificationProvider, Object {
GLib.Application.get_default().activate_action("open-conversation", new Variant.int32(conversation.id));
});
add_action_listener(notification_id, "reject", () => {
- GLib.Application.get_default().activate_action("reject-call", new Variant.int32(call.id));
+ var variant = new Variant.tuple(new Variant[] {new Variant.int32(conversation.id), new Variant.int32(call.id)});
+ GLib.Application.get_default().activate_action("reject-call", variant);
});
add_action_listener(notification_id, "accept", () => {
- GLib.Application.get_default().activate_action("accept-call", new Variant.int32(call.id));
+ var variant = new Variant.tuple(new Variant[] {new Variant.int32(conversation.id), new Variant.int32(call.id)});
+ GLib.Application.get_default().activate_action("accept-call", variant);
});
} catch (Error e) {
warning("Failed showing subscription request notification: %s", e.message);