From e8f996306dd559f66467c1f815e59a65ba6e7a92 Mon Sep 17 00:00:00 2001 From: Ryan Zhao Date: Thu, 3 Mar 2022 13:25:53 +1100 Subject: [PATCH] show call permission required modal when calls are nor enabled --- Session.xcodeproj/project.pbxproj | 4 + .../ConversationVC+Interaction.swift | 3 + Session/Conversations/ConversationVC.swift | 2 +- .../CallPermissionRequestModal.swift | 79 +++++++++++++++++++ .../ConversationTitleView.swift | 2 +- .../Translations/de.lproj/Localizable.strings | 2 + .../Translations/en.lproj/Localizable.strings | 2 + .../Translations/es.lproj/Localizable.strings | 2 + .../Translations/fa.lproj/Localizable.strings | 2 + .../Translations/fi.lproj/Localizable.strings | 2 + .../Translations/fr.lproj/Localizable.strings | 2 + .../Translations/hi.lproj/Localizable.strings | 2 + .../Translations/hr.lproj/Localizable.strings | 2 + .../id-ID.lproj/Localizable.strings | 2 + .../Translations/it.lproj/Localizable.strings | 2 + .../Translations/ja.lproj/Localizable.strings | 2 + .../Translations/nl.lproj/Localizable.strings | 2 + .../Translations/pl.lproj/Localizable.strings | 2 + .../pt_BR.lproj/Localizable.strings | 2 + .../Translations/ru.lproj/Localizable.strings | 2 + .../Translations/si.lproj/Localizable.strings | 2 + .../Translations/sk.lproj/Localizable.strings | 2 + .../Translations/sv.lproj/Localizable.strings | 2 + .../Translations/th.lproj/Localizable.strings | 2 + .../vi-VN.lproj/Localizable.strings | 2 + .../zh-Hant.lproj/Localizable.strings | 2 + .../zh_CN.lproj/Localizable.strings | 2 + .../PrivacySettingsTableViewController.h | 2 + .../PrivacySettingsTableViewController.m | 13 +++ 29 files changed, 147 insertions(+), 2 deletions(-) create mode 100644 Session/Conversations/Views & Modals/CallPermissionRequestModal.swift diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index a16136bb0..b3879228f 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -178,6 +178,7 @@ 7BFD1A8A2745C4F000FB91B9 /* Permissions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BFD1A892745C4F000FB91B9 /* Permissions.swift */; }; 7BFD1A8C2747150E00FB91B9 /* TurnServerInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BFD1A8B2747150E00FB91B9 /* TurnServerInfo.swift */; }; 7BFD1A972747689000FB91B9 /* Session-Turn-Server in Resources */ = {isa = PBXBuildFile; fileRef = 7BFD1A962747689000FB91B9 /* Session-Turn-Server */; }; + 7BFFB33C27D02F5800BEA04E /* CallPermissionRequestModal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BFFB33B27D02F5800BEA04E /* CallPermissionRequestModal.swift */; }; 96EB4427CAAFFFC92E52573C /* Pods_GlobalDependencies_FrameworkAndExtensionDependencies_ExtendedDependencies_SessionMessagingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E77FE0A560DE43C5741FB252 /* Pods_GlobalDependencies_FrameworkAndExtensionDependencies_ExtendedDependencies_SessionMessagingKit.framework */; }; A11CD70D17FA230600A2D1B1 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A11CD70C17FA230600A2D1B1 /* QuartzCore.framework */; }; A13FC3642BE5D37A004D0EC8 /* Pods_GlobalDependencies_FrameworkAndExtensionDependencies_ExtendedDependencies_SignalUtilitiesKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 19942D14DEF67D588752ADB2 /* Pods_GlobalDependencies_FrameworkAndExtensionDependencies_ExtendedDependencies_SignalUtilitiesKit.framework */; }; @@ -1191,6 +1192,7 @@ 7BFD1A892745C4F000FB91B9 /* Permissions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Permissions.swift; sourceTree = ""; }; 7BFD1A8B2747150E00FB91B9 /* TurnServerInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TurnServerInfo.swift; sourceTree = ""; }; 7BFD1A962747689000FB91B9 /* Session-Turn-Server */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Session-Turn-Server"; sourceTree = ""; }; + 7BFFB33B27D02F5800BEA04E /* CallPermissionRequestModal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallPermissionRequestModal.swift; sourceTree = ""; }; 7DD180F770F8518B4E8796F2 /* Pods-SessionUtilitiesKit.app store release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SessionUtilitiesKit.app store release.xcconfig"; path = "Pods/Target Support Files/Pods-SessionUtilitiesKit/Pods-SessionUtilitiesKit.app store release.xcconfig"; sourceTree = ""; }; 826CF3AB370207485081AD78 /* Pods-GlobalDependencies-FrameworkAndExtensionDependencies-ExtendedDependencies-SignalUtilitiesKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GlobalDependencies-FrameworkAndExtensionDependencies-ExtendedDependencies-SignalUtilitiesKit.debug.xcconfig"; path = "Pods/Target Support Files/Pods-GlobalDependencies-FrameworkAndExtensionDependencies-ExtendedDependencies-SignalUtilitiesKit/Pods-GlobalDependencies-FrameworkAndExtensionDependencies-ExtendedDependencies-SignalUtilitiesKit.debug.xcconfig"; sourceTree = ""; }; 848B0C04B8211741A916EE49 /* Pods-GlobalDependencies-FrameworkAndExtensionDependencies-ExtendedDependencies-SessionMessagingKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GlobalDependencies-FrameworkAndExtensionDependencies-ExtendedDependencies-SessionMessagingKit.debug.xcconfig"; path = "Pods/Target Support Files/Pods-GlobalDependencies-FrameworkAndExtensionDependencies-ExtendedDependencies-SessionMessagingKit/Pods-GlobalDependencies-FrameworkAndExtensionDependencies-ExtendedDependencies-SessionMessagingKit.debug.xcconfig"; sourceTree = ""; }; @@ -2297,6 +2299,7 @@ C374EEEA25DA3CA70073A857 /* ConversationTitleView.swift */, B848A4C4269EAAA200617031 /* UserDetailsSheet.swift */, 7B1581E3271FC59C00848B49 /* CallModal.swift */, + 7BFFB33B27D02F5800BEA04E /* CallPermissionRequestModal.swift */, ); path = "Views & Modals"; sourceTree = ""; @@ -5053,6 +5056,7 @@ 341341EF2187467A00192D59 /* ConversationViewModel.m in Sources */, 4C21D5D8223AC60F00EF8A77 /* PhotoCapture.swift in Sources */, C331FFF32558FF0300070591 /* PathStatusView.swift in Sources */, + 7BFFB33C27D02F5800BEA04E /* CallPermissionRequestModal.swift in Sources */, B8569AD325CBA13D00DBA3DB /* MediaTextOverlayView.swift in Sources */, 4CC1ECFB211A553000CC13BE /* AppUpdateNag.swift in Sources */, B848A4C5269EAAA200617031 /* UserDetailsSheet.swift in Sources */, diff --git a/Session/Conversations/ConversationVC+Interaction.swift b/Session/Conversations/ConversationVC+Interaction.swift index 8ef38c150..48eda23d8 100644 --- a/Session/Conversations/ConversationVC+Interaction.swift +++ b/Session/Conversations/ConversationVC+Interaction.swift @@ -54,6 +54,9 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc self.inputAccessoryView?.isHidden = true self.inputAccessoryView?.alpha = 0 present(callVC, animated: true, completion: nil) + } else { + let callPermissionRequestModal = CallPermissionRequestModal() + self.navigationController?.present(callPermissionRequestModal, animated: true, completion: nil) } } diff --git a/Session/Conversations/ConversationVC.swift b/Session/Conversations/ConversationVC.swift index 76848efb1..e2b68178b 100644 --- a/Session/Conversations/ConversationVC.swift +++ b/Session/Conversations/ConversationVC.swift @@ -487,7 +487,7 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat settingsButton.accessibilityLabel = "Settings button" settingsButton.isAccessibilityElement = true rightBarButtonItems.append(settingsButton) - let shouldShowCallButton = SessionCall.isEnabled && !thread.isNoteToSelf() && SSKPreferences.areCallsEnabled + let shouldShowCallButton = SessionCall.isEnabled && !thread.isNoteToSelf() && !thread.isMessageRequest() if shouldShowCallButton { let callButton = UIBarButtonItem(image: UIImage(named: "Phone")!, style: .plain, target: self, action: #selector(startCall)) rightBarButtonItems.append(callButton) diff --git a/Session/Conversations/Views & Modals/CallPermissionRequestModal.swift b/Session/Conversations/Views & Modals/CallPermissionRequestModal.swift new file mode 100644 index 000000000..a82a7c435 --- /dev/null +++ b/Session/Conversations/Views & Modals/CallPermissionRequestModal.swift @@ -0,0 +1,79 @@ +// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved. + +@objc +final class CallPermissionRequestModal : Modal { + + // MARK: Lifecycle + @objc + init() { + super.init(nibName: nil, bundle: nil) + self.modalPresentationStyle = .overFullScreen + self.modalTransitionStyle = .crossDissolve + } + + required init?(coder: NSCoder) { + preconditionFailure("Use init(onCallEnabled:) instead.") + } + + override init(nibName: String?, bundle: Bundle?) { + preconditionFailure("Use init(onCallEnabled:) instead.") + } + + override func populateContentView() { + // Title + let titleLabel = UILabel() + titleLabel.textColor = Colors.text + titleLabel.font = .boldSystemFont(ofSize: Values.mediumFontSize) + titleLabel.text = NSLocalizedString("modal_call_permission_request_title", comment: "") + titleLabel.textAlignment = .center + // Message + let messageLabel = UILabel() + messageLabel.textColor = Colors.text + messageLabel.font = .systemFont(ofSize: Values.smallFontSize) + let message = NSLocalizedString("modal_call_permission_request_explanation", comment: "") + messageLabel.text = message + messageLabel.numberOfLines = 0 + messageLabel.lineBreakMode = .byWordWrapping + messageLabel.textAlignment = .center + // Enable button + let goToSettingsButton = UIButton() + goToSettingsButton.set(.height, to: Values.mediumButtonHeight) + goToSettingsButton.layer.cornerRadius = Modal.buttonCornerRadius + goToSettingsButton.backgroundColor = Colors.buttonBackground + goToSettingsButton.titleLabel!.font = .systemFont(ofSize: Values.smallFontSize) + goToSettingsButton.setTitleColor(Colors.text, for: UIControl.State.normal) + goToSettingsButton.setTitle(NSLocalizedString("vc_settings_title", comment: ""), for: UIControl.State.normal) + goToSettingsButton.addTarget(self, action: #selector(goToSettings), for: UIControl.Event.touchUpInside) + // Content stack view + let contentStackView = UIStackView(arrangedSubviews: [ titleLabel, messageLabel ]) + contentStackView.axis = .vertical + contentStackView.spacing = Values.largeSpacing + // Button stack view + let buttonStackView = UIStackView(arrangedSubviews: [ cancelButton, goToSettingsButton ]) + buttonStackView.axis = .horizontal + buttonStackView.distribution = .fillEqually + // Main stack view + let spacing = Values.largeSpacing - (Values.mediumButtonHeight - Values.smallFontSize)/2 + let mainStackView = UIStackView(arrangedSubviews: [ contentStackView, buttonStackView ]) + mainStackView.axis = .vertical + mainStackView.spacing = spacing + contentView.addSubview(mainStackView) + mainStackView.pin(.leading, to: .leading, of: contentView, withInset: Values.largeSpacing) + mainStackView.pin(.top, to: .top, of: contentView, withInset: Values.largeSpacing) + contentView.pin(.trailing, to: .trailing, of: mainStackView, withInset: Values.largeSpacing) + contentView.pin(.bottom, to: .bottom, of: mainStackView, withInset: spacing) + } + + // MARK: Interaction + @objc func goToSettings(_ sender: Any) { + dismiss(animated: true, completion: { + if let vc = CurrentAppContext().frontmostViewController() { + let privacySettingsVC = PrivacySettingsTableViewController() + privacySettingsVC.shouldShowCloseButton = true + let nav = OWSNavigationController(rootViewController: privacySettingsVC) + nav.modalPresentationStyle = .fullScreen + vc.present(nav, animated: true, completion: nil) + } + }) + } +} diff --git a/Session/Conversations/Views & Modals/ConversationTitleView.swift b/Session/Conversations/Views & Modals/ConversationTitleView.swift index 90123c53c..39896a3f3 100644 --- a/Session/Conversations/Views & Modals/ConversationTitleView.swift +++ b/Session/Conversations/Views & Modals/ConversationTitleView.swift @@ -44,7 +44,7 @@ final class ConversationTitleView : UIView { stackView.axis = .vertical stackView.alignment = .center stackView.isLayoutMarginsRelativeArrangement = true - let shouldShowCallButton = SessionCall.isEnabled && !thread.isNoteToSelf() && !thread.isGroupThread() && SSKPreferences.areCallsEnabled + let shouldShowCallButton = SessionCall.isEnabled && !thread.isNoteToSelf() && !thread.isGroupThread() && !thread.isMessageRequest() let leftMargin: CGFloat = shouldShowCallButton ? 54 : 8 // Contact threads also have the call button to compensate for stackView.layoutMargins = UIEdgeInsets(top: 0, left: leftMargin, bottom: 0, right: 0) addSubview(stackView) diff --git a/Session/Meta/Translations/de.lproj/Localizable.strings b/Session/Meta/Translations/de.lproj/Localizable.strings index 20bc65052..adb414ff9 100644 --- a/Session/Meta/Translations/de.lproj/Localizable.strings +++ b/Session/Meta/Translations/de.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/en.lproj/Localizable.strings b/Session/Meta/Translations/en.lproj/Localizable.strings index 2a58905df..e67ae41f7 100644 --- a/Session/Meta/Translations/en.lproj/Localizable.strings +++ b/Session/Meta/Translations/en.lproj/Localizable.strings @@ -647,3 +647,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/es.lproj/Localizable.strings b/Session/Meta/Translations/es.lproj/Localizable.strings index 80d015a28..d663aea99 100644 --- a/Session/Meta/Translations/es.lproj/Localizable.strings +++ b/Session/Meta/Translations/es.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/fa.lproj/Localizable.strings b/Session/Meta/Translations/fa.lproj/Localizable.strings index b915a9572..5823242fc 100644 --- a/Session/Meta/Translations/fa.lproj/Localizable.strings +++ b/Session/Meta/Translations/fa.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/fi.lproj/Localizable.strings b/Session/Meta/Translations/fi.lproj/Localizable.strings index 6620ff13a..269137b81 100644 --- a/Session/Meta/Translations/fi.lproj/Localizable.strings +++ b/Session/Meta/Translations/fi.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/fr.lproj/Localizable.strings b/Session/Meta/Translations/fr.lproj/Localizable.strings index d53045329..584c3b737 100644 --- a/Session/Meta/Translations/fr.lproj/Localizable.strings +++ b/Session/Meta/Translations/fr.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/hi.lproj/Localizable.strings b/Session/Meta/Translations/hi.lproj/Localizable.strings index 932d237f2..393a979e0 100644 --- a/Session/Meta/Translations/hi.lproj/Localizable.strings +++ b/Session/Meta/Translations/hi.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/hr.lproj/Localizable.strings b/Session/Meta/Translations/hr.lproj/Localizable.strings index 75a42e330..162f4aa7b 100644 --- a/Session/Meta/Translations/hr.lproj/Localizable.strings +++ b/Session/Meta/Translations/hr.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/id-ID.lproj/Localizable.strings b/Session/Meta/Translations/id-ID.lproj/Localizable.strings index 5bbe80689..520dbf7e6 100644 --- a/Session/Meta/Translations/id-ID.lproj/Localizable.strings +++ b/Session/Meta/Translations/id-ID.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/it.lproj/Localizable.strings b/Session/Meta/Translations/it.lproj/Localizable.strings index d1baf8f6d..9767ed4f2 100644 --- a/Session/Meta/Translations/it.lproj/Localizable.strings +++ b/Session/Meta/Translations/it.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/ja.lproj/Localizable.strings b/Session/Meta/Translations/ja.lproj/Localizable.strings index da26da686..dcd2509a6 100644 --- a/Session/Meta/Translations/ja.lproj/Localizable.strings +++ b/Session/Meta/Translations/ja.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/nl.lproj/Localizable.strings b/Session/Meta/Translations/nl.lproj/Localizable.strings index bb7fbd69f..2e56c911b 100644 --- a/Session/Meta/Translations/nl.lproj/Localizable.strings +++ b/Session/Meta/Translations/nl.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/pl.lproj/Localizable.strings b/Session/Meta/Translations/pl.lproj/Localizable.strings index e9b93b9fc..cdfe3530e 100644 --- a/Session/Meta/Translations/pl.lproj/Localizable.strings +++ b/Session/Meta/Translations/pl.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/pt_BR.lproj/Localizable.strings b/Session/Meta/Translations/pt_BR.lproj/Localizable.strings index 569e33958..553bc9b55 100644 --- a/Session/Meta/Translations/pt_BR.lproj/Localizable.strings +++ b/Session/Meta/Translations/pt_BR.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/ru.lproj/Localizable.strings b/Session/Meta/Translations/ru.lproj/Localizable.strings index b2ac6b225..1d319dc6b 100644 --- a/Session/Meta/Translations/ru.lproj/Localizable.strings +++ b/Session/Meta/Translations/ru.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/si.lproj/Localizable.strings b/Session/Meta/Translations/si.lproj/Localizable.strings index b5aaee4cc..f186558d9 100644 --- a/Session/Meta/Translations/si.lproj/Localizable.strings +++ b/Session/Meta/Translations/si.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/sk.lproj/Localizable.strings b/Session/Meta/Translations/sk.lproj/Localizable.strings index 8db64a990..06e81338f 100644 --- a/Session/Meta/Translations/sk.lproj/Localizable.strings +++ b/Session/Meta/Translations/sk.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/sv.lproj/Localizable.strings b/Session/Meta/Translations/sv.lproj/Localizable.strings index 21c7fda03..11e2cedcb 100644 --- a/Session/Meta/Translations/sv.lproj/Localizable.strings +++ b/Session/Meta/Translations/sv.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/th.lproj/Localizable.strings b/Session/Meta/Translations/th.lproj/Localizable.strings index 99f4db6a0..cc269e133 100644 --- a/Session/Meta/Translations/th.lproj/Localizable.strings +++ b/Session/Meta/Translations/th.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/vi-VN.lproj/Localizable.strings b/Session/Meta/Translations/vi-VN.lproj/Localizable.strings index 0b7fe89f8..2c403e362 100644 --- a/Session/Meta/Translations/vi-VN.lproj/Localizable.strings +++ b/Session/Meta/Translations/vi-VN.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/zh-Hant.lproj/Localizable.strings b/Session/Meta/Translations/zh-Hant.lproj/Localizable.strings index 58016f4e0..8536c26d5 100644 --- a/Session/Meta/Translations/zh-Hant.lproj/Localizable.strings +++ b/Session/Meta/Translations/zh-Hant.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Meta/Translations/zh_CN.lproj/Localizable.strings b/Session/Meta/Translations/zh_CN.lproj/Localizable.strings index b4d7ad639..a988ba784 100644 --- a/Session/Meta/Translations/zh_CN.lproj/Localizable.strings +++ b/Session/Meta/Translations/zh_CN.lproj/Localizable.strings @@ -621,3 +621,5 @@ "NEW_CONVERSATION_MENU_OPEN_GROUP" = "Open Group"; "NEW_CONVERSATION_MENU_DIRECT_MESSAGE" = "Direct Message"; "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; +"modal_call_permission_request_title" = "Call Permissions Required"; +"modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; diff --git a/Session/Settings/PrivacySettingsTableViewController.h b/Session/Settings/PrivacySettingsTableViewController.h index fb0432186..9fc33e219 100644 --- a/Session/Settings/PrivacySettingsTableViewController.h +++ b/Session/Settings/PrivacySettingsTableViewController.h @@ -8,6 +8,8 @@ NS_ASSUME_NONNULL_BEGIN @interface PrivacySettingsTableViewController : OWSTableViewController +@property (nonatomic) BOOL shouldShowCloseButton; + @end NS_ASSUME_NONNULL_END diff --git a/Session/Settings/PrivacySettingsTableViewController.m b/Session/Settings/PrivacySettingsTableViewController.m index 2dd2cc6b9..ac0d2735a 100644 --- a/Session/Settings/PrivacySettingsTableViewController.m +++ b/Session/Settings/PrivacySettingsTableViewController.m @@ -32,6 +32,14 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s [LKViewControllerUtilities setUpDefaultSessionStyleForVC:self withTitle:NSLocalizedString(@"vc_privacy_settings_title", @"") customBackButton:NO]; self.tableView.backgroundColor = UIColor.clearColor; + + if (self.shouldShowCloseButton) { + UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"X"] + style:UIBarButtonItemStylePlain + target:self + action:@selector(close:)]; + [[self navigationItem] setLeftBarButtonItem:closeButton]; + } } - (void)viewDidAppear:(BOOL)animated @@ -351,6 +359,11 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s return [NSString formatDurationSeconds:(uint32_t)value useShortFormat:useShortFormat]; } +- (void)close: (UIBarButtonItem *)sender +{ + [[self navigationController] dismissViewControllerAnimated:YES completion:nil]; +} + @end NS_ASSUME_NONNULL_END