diff --git a/Classes/Swift/Util/UIAlertController.swift b/Classes/Swift/Util/UIAlertController.swift
new file mode 100644
index 000000000..f426028eb
--- /dev/null
+++ b/Classes/Swift/Util/UIAlertController.swift
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2010-2020 Belledonne Communications SARL.
+ *
+ * This file is part of linphone-iphone
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+import Foundation
+import UIKit
+
+extension UIAlertController {
+
+ //Set background color of UIAlertController
+ func setBackgroundColor(color: UIColor) {
+ if let bgView = self.view.subviews.first, let groupView = bgView.subviews.first, let contentView = groupView.subviews.first {
+ contentView.backgroundColor = color
+ }
+ }
+
+ func setMaxWidth(alert: UIAlertController) {
+ let widthConstraints = alert.view.constraints.filter({ return $0.firstAttribute == .width })
+ alert.view.removeConstraints(widthConstraints)
+ // Here you can enter any width that you want
+ let newWidth = UIScreen.main.bounds.width * 0.90
+ // Adding constraint for alert base view
+ let widthConstraint = NSLayoutConstraint(item: alert.view,
+ attribute: .width,
+ relatedBy: .equal,
+ toItem: nil,
+ attribute: .notAnAttribute,
+ multiplier: 1,
+ constant: newWidth)
+ alert.view.addConstraint(widthConstraint)
+ let firstContainer = alert.view.subviews[0]
+ // Finding first child width constraint
+ let constraint = firstContainer.constraints.filter({ return $0.firstAttribute == .width && $0.secondItem == nil })
+ firstContainer.removeConstraints(constraint)
+ // And replacing with new constraint equal to alert.view width constraint that we setup earlier
+ alert.view.addConstraint(NSLayoutConstraint(item: firstContainer,
+ attribute: .width,
+ relatedBy: .equal,
+ toItem: alert.view,
+ attribute: .width,
+ multiplier: 1.0,
+ constant: 0))
+ // Same for the second child with width constraint with 998 priority
+ let innerBackground = firstContainer.subviews[0]
+ let innerConstraints = innerBackground.constraints.filter({ return $0.firstAttribute == .width && $0.secondItem == nil })
+ innerBackground.removeConstraints(innerConstraints)
+ firstContainer.addConstraint(NSLayoutConstraint(item: innerBackground,
+ attribute: .width,
+ relatedBy: .equal,
+ toItem: firstContainer,
+ attribute: .width,
+ multiplier: 1.0,
+ constant: 0))
+ }
+
+ //Set title font and title color
+ func setTitle(font: UIFont?, color: UIColor?) {
+ guard let title = self.title else { return }
+ let attributeString = NSMutableAttributedString(string: title)//1
+
+ if let titleFont = font {
+ attributeString.addAttributes([NSAttributedString.Key.font : titleFont],//2
+ range: NSMakeRange(0, title.count))
+ }
+
+ if let titleColor = color {
+ attributeString.addAttributes([NSAttributedString.Key.foregroundColor : titleColor],//3
+ range: NSMakeRange(0, title.count))
+ }
+
+ self.setValue(attributeString, forKey: "attributedTitle")//4
+ }
+
+ //Set message font and message color
+ func setMessage(font: UIFont?, color: UIColor?) {
+ guard let message = self.message else { return }
+ let attributeString = NSMutableAttributedString(string: message)
+ if let messageFont = font {
+ attributeString.addAttributes([NSAttributedString.Key.font : messageFont],
+ range: NSMakeRange(0, message.count))
+ }
+
+ if let messageColorColor = color {
+ attributeString.addAttributes([NSAttributedString.Key.foregroundColor : messageColorColor],
+ range: NSMakeRange(0, message.count))
+ }
+ self.setValue(attributeString, forKey: "attributedMessage")
+ }
+
+ //Set tint color of UIAlertController
+ func setTint(color: UIColor) {
+ self.view.tintColor = color
+ }
+}
diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj
index 8d5792760..5b38b652b 100644
--- a/linphone.xcodeproj/project.pbxproj
+++ b/linphone.xcodeproj/project.pbxproj
@@ -962,6 +962,7 @@
D7421D9E29228A5200290CAB /* DetailChatRoomFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7421D9D29228A5200290CAB /* DetailChatRoomFragment.swift */; };
D74A44912923BAF90017D063 /* BackActionsNavigationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74A44902923BAF90017D063 /* BackActionsNavigationView.swift */; };
D77057F1292E4A340031A970 /* ChatConversationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D77057F0292E4A340031A970 /* ChatConversationViewModel.swift */; };
+ D7C6DE7D2947331A00756E03 /* UIAlertController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C6DE7C2947331A00756E03 /* UIAlertController.swift */; };
EA0007A62356008F003CC6BF /* msgNotificationService.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = EA5F25D9232BD3E200475F2E /* msgNotificationService.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
EA3650DB2330D2E30001148A /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA5F25DB232BD3E200475F2E /* NotificationService.swift */; };
EA88A405242A6216007FEC61 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 63AADBC41B6A0FF200AA16FD /* Localizable.strings */; };
@@ -2212,6 +2213,7 @@
D7421D9D29228A5200290CAB /* DetailChatRoomFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailChatRoomFragment.swift; sourceTree = ""; };
D74A44902923BAF90017D063 /* BackActionsNavigationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackActionsNavigationView.swift; sourceTree = ""; };
D77057F0292E4A340031A970 /* ChatConversationViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatConversationViewModel.swift; sourceTree = ""; };
+ D7C6DE7C2947331A00756E03 /* UIAlertController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIAlertController.swift; sourceTree = ""; };
DF241FDC6C7431777AB3BD58 /* Pods-msgNotificationContent.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-msgNotificationContent.debug.xcconfig"; path = "Target Support Files/Pods-msgNotificationContent/Pods-msgNotificationContent.debug.xcconfig"; sourceTree = ""; };
E19FC645A566E91D4EEB9C8F /* Pods-msgNotificationService.distributionadhoc.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-msgNotificationService.distributionadhoc.xcconfig"; path = "Target Support Files/Pods-msgNotificationService/Pods-msgNotificationService.distributionadhoc.xcconfig"; sourceTree = ""; };
EA5F25D9232BD3E200475F2E /* msgNotificationService.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = msgNotificationService.appex; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -3481,6 +3483,7 @@
D7A7544F29507038005C9D4A /* CustomAlertController.swift */,
D779D39D29AC9E92007B8087 /* AudioPlayer.swift */,
D779D3A129B5E365007B8087 /* UIImageExtension.swift */,
+ D7C6DE7C2947331A00756E03 /* UIAlertController.swift */,
);
path = Util;
sourceTree = "";
@@ -5084,6 +5087,7 @@
D3ED3E871586291E006C0DE4 /* TabBarView.m in Sources */,
617C242A263022690042FB4A /* UIChatContentView.m in Sources */,
C63F7261285A24B10066163B /* CallControlButton.swift in Sources */,
+ D7C6DE7D2947331A00756E03 /* UIAlertController.swift in Sources */,
D3ED3EA71587334E006C0DE4 /* HistoryListTableView.m in Sources */,
D768763529CDA88200570747 /* UploadMessageCell.swift in Sources */,
C63F7220285A24B10066163B /* TimestampUtils.swift in Sources */,