diff options
author | fiaxh <git@lightrise.org> | 2021-12-23 00:44:51 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2021-12-23 00:46:58 +0100 |
commit | d02c5bc55d4325de308a592e8980139aa0634215 (patch) | |
tree | 9cb91f86056dd29f863bd8e54580cccc625af60e /main/src/ui/application.vala | |
parent | 1378224444b1862ac95783ac2bae7d25a0a8862d (diff) | |
parent | f0c7dd0682fec8d72c644d8e54896de7bdc40ddb (diff) | |
download | dino-d02c5bc55d4325de308a592e8980139aa0634215.tar.gz dino-d02c5bc55d4325de308a592e8980139aa0634215.zip |
Merge branch groupcalls
Diffstat (limited to 'main/src/ui/application.vala')
-rw-r--r-- | main/src/ui/application.vala | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala index bed6d01b..ecbea85e 100644 --- a/main/src/ui/application.vala +++ b/main/src/ui/application.vala @@ -206,21 +206,37 @@ 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()); - stream_interactor.get_module(Calls.IDENTITY).accept_call(call); + 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; + + call_state.accept(); var call_window = new CallWindow(); - call_window.controller = new CallWindowController(call_window, call, stream_interactor); + call_window.controller = new CallWindowController(call_window, call_state, stream_interactor); call_window.present(); }); add_action(accept_call_action); - SimpleAction deny_call_action = new SimpleAction("deny-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()); - stream_interactor.get_module(Calls.IDENTITY).reject_call(call); + 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; + + call_state.reject(); }); add_action(deny_call_action); } |