mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
Introduce enableRingingForGroupCalls and add a labs setting for it
This commit is contained in:
parent
2742315a64
commit
3162a5d720
8 changed files with 57 additions and 3 deletions
|
@ -32,5 +32,7 @@
|
|||
<integer>15020851</integer>
|
||||
<key>enableBotCreation</key>
|
||||
<false/>
|
||||
<key>enableRingingForGroupCalls</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -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)";
|
||||
|
||||
|
|
|
@ -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 %@";
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue