diff --git a/Riot/Assets/Riot-Defaults.plist b/Riot/Assets/Riot-Defaults.plist
index 95dea3dd0..7ef98b242 100644
--- a/Riot/Assets/Riot-Defaults.plist
+++ b/Riot/Assets/Riot-Defaults.plist
@@ -32,5 +32,7 @@
15020851
enableBotCreation
+ enableRingingForGroupCalls
+
diff --git a/Riot/Assets/en.lproj/Localizable.strings b/Riot/Assets/en.lproj/Localizable.strings
index 93dfd2426..481ab9c9a 100644
--- a/Riot/Assets/en.lproj/Localizable.strings
+++ b/Riot/Assets/en.lproj/Localizable.strings
@@ -123,6 +123,9 @@
/* Incoming named video conference invite from a specific person */
"VIDEO_CONF_NAMED_FROM_USER" = "Video group call from %@: '%@'";
+/* A user added a Jitsi call to a room */
+"GROUP_CALL_STARTED_IN_ROOM" = "%@ added a group call to %@";
+
/* Group call from user, CallKit caller name */
"GROUP_CALL_FROM_USER" = "%@ (Group call)";
diff --git a/Riot/Assets/en.lproj/Vector.strings b/Riot/Assets/en.lproj/Vector.strings
index d1d97df63..3bb638c4b 100644
--- a/Riot/Assets/en.lproj/Vector.strings
+++ b/Riot/Assets/en.lproj/Vector.strings
@@ -525,6 +525,7 @@ Tap the + to start adding people.";
"settings_labs_e2e_encryption_prompt_message" = "To finish setting up encryption you must log in again.";
"settings_labs_create_conference_with_jitsi" = "Create conference calls with jitsi";
"settings_labs_message_reaction" = "React to messages with emoji";
+"settings_labs_enable_ringing_for_group_calls" = "Ring for group calls";
"settings_version" = "Version %@";
"settings_olm_version" = "Olm Version %@";
diff --git a/Riot/Generated/Strings.swift b/Riot/Generated/Strings.swift
index 13475d1ca..7ce62a5db 100644
--- a/Riot/Generated/Strings.swift
+++ b/Riot/Generated/Strings.swift
@@ -4266,6 +4266,10 @@ internal enum VectorL10n {
internal static var settingsLabsE2eEncryptionPromptMessage: String {
return VectorL10n.tr("Vector", "settings_labs_e2e_encryption_prompt_message")
}
+ /// Ring for group calls
+ internal static var settingsLabsEnableRingingForGroupCalls: String {
+ return VectorL10n.tr("Vector", "settings_labs_enable_ringing_for_group_calls")
+ }
/// React to messages with emoji
internal static var settingsLabsMessageReaction: String {
return VectorL10n.tr("Vector", "settings_labs_message_reaction")
diff --git a/Riot/Managers/Call/CallPresenter.swift b/Riot/Managers/Call/CallPresenter.swift
index dd704ac65..91b618ed2 100644
--- a/Riot/Managers/Call/CallPresenter.swift
+++ b/Riot/Managers/Call/CallPresenter.swift
@@ -297,6 +297,10 @@ class CallPresenter: NSObject {
JMCallKitProxy.reportOutgoingCall(with: newUUID, connectedAt: nil)
} else {
// incoming call
+ guard RiotSettings.shared.enableRingingForGroupCalls else {
+ // do not ring for Jitsi calls
+ return
+ }
let user = session.user(withUserId: event.sender)
let displayName = NSString.localizedUserNotificationString(forKey: "GROUP_CALL_FROM_USER",
arguments: [user?.displayname as Any])
diff --git a/Riot/Managers/Settings/RiotSettings.swift b/Riot/Managers/Settings/RiotSettings.swift
index 8e5487a38..583e5f74e 100644
--- a/Riot/Managers/Settings/RiotSettings.swift
+++ b/Riot/Managers/Settings/RiotSettings.swift
@@ -51,6 +51,7 @@ final class RiotSettings: NSObject {
static let roomCreationScreenAllowRoomTypeConfiguration = "roomCreationScreenAllowRoomTypeConfiguration"
static let roomCreationScreenRoomIsPublic = "roomCreationScreenRoomIsPublic"
static let allowInviteExernalUsers = "allowInviteExernalUsers"
+ static let enableRingingForGroupCalls = "enableRingingForGroupCalls"
}
static let shared = RiotSettings()
@@ -192,6 +193,15 @@ final class RiotSettings: NSObject {
// MARK: Labs
+ /// Indicates if CallKit ringing is enabled for group calls. This setting does not disable the CallKit integration for group calls, only relates to ringing.
+ var enableRingingForGroupCalls: Bool {
+ get {
+ return defaults.bool(forKey: UserDefaultsKeys.enableRingingForGroupCalls)
+ } set {
+ defaults.set(newValue, forKey: UserDefaultsKeys.enableRingingForGroupCalls)
+ }
+ }
+
// MARK: Calls
/// Indicate if `allowStunServerFallback` settings has been set once.
diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m
index f6341d140..2c238e07e 100644
--- a/Riot/Modules/Settings/SettingsViewController.m
+++ b/Riot/Modules/Settings/SettingsViewController.m
@@ -140,6 +140,11 @@ enum
OTHER_REPORT_BUG_INDEX,
};
+enum
+{
+ LABS_ENABLE_RINGING_FOR_GROUP_CALLS_INDEX = 0
+};
+
enum
{
SECURITY_BUTTON_INDEX = 0,
@@ -475,6 +480,7 @@ TableViewSectionsDelegate>
if (BuildSettings.settingsScreenShowLabSettings)
{
Section *sectionLabs = [Section sectionWithTag:SECTION_TAG_LABS];
+ [sectionLabs addRowWithTag:LABS_ENABLE_RINGING_FOR_GROUP_CALLS_INDEX];
sectionLabs.headerTitle = NSLocalizedStringFromTable(@"settings_labs", @"Vector", nil);
if (sectionLabs.hasAnyRows)
{
@@ -2241,7 +2247,18 @@ TableViewSectionsDelegate>
}
else if (section == SECTION_TAG_LABS)
{
-
+ if (row == LABS_ENABLE_RINGING_FOR_GROUP_CALLS_INDEX)
+ {
+ MXKTableViewCellWithLabelAndSwitch *labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
+
+ labelAndSwitchCell.mxkLabel.text = NSLocalizedStringFromTable(@"settings_labs_enable_ringing_for_group_calls", @"Vector", nil);
+ labelAndSwitchCell.mxkSwitch.on = RiotSettings.shared.enableRingingForGroupCalls;
+ labelAndSwitchCell.mxkSwitch.tintColor = ThemeService.shared.theme.tintColor;
+
+ [labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleEnableRingingForGroupCalls:) forControlEvents:UIControlEventValueChanged];
+
+ cell = labelAndSwitchCell;
+ }
}
else if (section == SECTION_TAG_FLAIR)
{
@@ -2930,6 +2947,16 @@ TableViewSectionsDelegate>
}
}
+- (void)toggleEnableRingingForGroupCalls:(UISwitch *)sender
+{
+ if (sender)
+ {
+ RiotSettings.shared.enableRingingForGroupCalls = sender.isOn;
+
+ [self.tableView reloadData];
+ }
+}
+
- (void)togglePinRoomsWithMissedNotif:(id)sender
{
UISwitch *switchButton = (UISwitch*)sender;
diff --git a/RiotNSE/NotificationService.swift b/RiotNSE/NotificationService.swift
index df5f815ab..ef594ff92 100644
--- a/RiotNSE/NotificationService.swift
+++ b/RiotNSE/NotificationService.swift
@@ -377,11 +377,14 @@ class NotificationService: UNNotificationServiceExtension {
if event.type == kWidgetMatrixEventTypeString || event.type == kWidgetModularEventTypeString {
if let content = event.content, let type = content["type"] as? String {
if type == kWidgetTypeJitsiV1 || type == kWidgetTypeJitsiV2 {
- notificationBody = NSString.localizedUserNotificationString(forKey: "VIDEO_CONF_FROM_USER", arguments: [eventSenderName as Any])
+ notificationBody = NSString.localizedUserNotificationString(forKey: "GROUP_CALL_STARTED_IN_ROOM", arguments: [eventSenderName as Any, roomDisplayName as Any])
// call notifications should stand out from normal messages, so we don't stack them
threadIdentifier = nil
- self.sendVoipPush(forEvent: event)
+ // only send VoIP pushes if ringing is enabled for group calls
+ if RiotSettings.shared.enableRingingForGroupCalls {
+ self.sendVoipPush(forEvent: event)
+ }
}
}
}