forked from mirrors/linphone-iphone
Minor changes + add no ask again switch in Devices List alertController
This commit is contained in:
parent
f3532e7124
commit
4e96033d04
4 changed files with 49 additions and 56 deletions
|
|
@ -42,6 +42,8 @@ import DropDown
|
|||
var address: String? = nil
|
||||
var notifications_on: Bool = true
|
||||
|
||||
var activeAlertController = CustomAlertController()
|
||||
|
||||
let menu: DropDown = {
|
||||
let menu = DropDown()
|
||||
menu.dataSource = [""]
|
||||
|
|
@ -101,11 +103,11 @@ import DropDown
|
|||
action2: {
|
||||
self.tapChooseMenuItem(self.action2Button)
|
||||
},
|
||||
action3: {
|
||||
self.alertActionGoToDevicesList()
|
||||
},
|
||||
title: address ?? "Error"
|
||||
//title:"benoit.martins.test1"
|
||||
//title:"Coin à champis de François"
|
||||
)
|
||||
//view.backgroundColor = VoipTheme.backgroundColor3.get()
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
|
|
@ -197,7 +199,6 @@ import DropDown
|
|||
let isOneToOneChat = chatRoom!.hasCapability(mask: Int(LinphoneChatRoomCapabilitiesOneToOne.rawValue))
|
||||
|
||||
if (!isOneToOneChat) {
|
||||
//ConferenceViewModelBridge.startGroupCall(cChatRoom: cChatRoom!)
|
||||
alertActionConferenceCall(cChatRoom: cChatRoom)
|
||||
} else {
|
||||
LinphoneManager.instance().call(addr)
|
||||
|
|
@ -214,6 +215,8 @@ import DropDown
|
|||
alertController.setMaxWidth(alert: alertController)
|
||||
|
||||
alertController.addButtonsAlertController(alertController: alertController, buttonsViewHeightV: 60, buttonsAlertHeightV: 40)
|
||||
|
||||
activeAlertController = alertController
|
||||
|
||||
self.present(alertController, animated: true, completion:{
|
||||
alertController.view.superview?.isUserInteractionEnabled = true
|
||||
|
|
@ -225,15 +228,51 @@ import DropDown
|
|||
|
||||
}
|
||||
|
||||
func alertActionGoToDevicesList() {
|
||||
|
||||
let notAskAgain = ConfigManager.instance().lpConfigBoolForKey(key: "confirmation_dialog_before_sas_call_not_ask_again");
|
||||
if(!notAskAgain){
|
||||
let alertController = CustomAlertController(title: VoipTexts.alert_dialog_secure_badge_button_chat_conversation_title, message: nil, preferredStyle: .alert)
|
||||
|
||||
alertController.setBackgroundColor(color: .darkGray)
|
||||
alertController.setTitle(font: nil, color: .white)
|
||||
alertController.setTint(color: .white)
|
||||
alertController.setMaxWidth(alert: alertController)
|
||||
|
||||
alertController.addButtonsAlertController(alertController: alertController, buttonsViewHeightV: 60, checkboxViewHeightV: 50, buttonsAlertHeightV: 40)
|
||||
|
||||
activeAlertController = alertController
|
||||
|
||||
self.present(alertController, animated: true, completion:{
|
||||
alertController.view.superview?.isUserInteractionEnabled = true
|
||||
alertController.view.superview?.subviews[0].addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.dismissOnTapOutsideOrCancel)))
|
||||
})
|
||||
|
||||
alertController.ok_button_alert.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.onTapOkGoToDevicesList)))
|
||||
}else{
|
||||
let view: DevicesListView = self.VIEW(DevicesListView.compositeViewDescription())
|
||||
view.room = chatRoom?.getCobject
|
||||
PhoneMainView.instance().changeCurrentView(view.compositeViewDescription())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@objc func onTapOkStartGroupCall(){
|
||||
self.dismiss(animated: true, completion: nil)
|
||||
ConferenceViewModelBridge.startGroupCall(cChatRoom: (chatRoom?.getCobject)!)
|
||||
}
|
||||
|
||||
@objc override func onTapOk() {
|
||||
@objc func onTapOkGoToDevicesList() {
|
||||
self.dismiss(animated: true, completion: nil)
|
||||
if(activeAlertController.isChecked){
|
||||
ConfigManager.instance().lpConfigSetBool(value: activeAlertController.isChecked, key: "confirmation_dialog_before_sas_call_not_ask_again")
|
||||
}
|
||||
let view: DevicesListView = self.VIEW(DevicesListView.compositeViewDescription())
|
||||
view.room = chatRoom?.getCobject
|
||||
PhoneMainView.instance().changeCurrentView(view.compositeViewDescription())
|
||||
}
|
||||
|
||||
@objc func dismissOnTapOutsideOrCancel(){
|
||||
self.dismiss(animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import UniformTypeIdentifiers
|
|||
|
||||
class MessageView: UIView, PHPickerViewControllerDelegate, UIDocumentPickerDelegate {
|
||||
|
||||
let top_bar_height = 66.0
|
||||
let side_buttons_margin = 10
|
||||
|
||||
var action1 : (() -> Void)? = nil
|
||||
|
|
|
|||
|
|
@ -25,16 +25,8 @@ import linphonesw
|
|||
@objc class BackActionsNavigationView: UIViewController {
|
||||
|
||||
|
||||
// layout constants
|
||||
let top_bar_height = 66.0
|
||||
let navigation_buttons_padding = 18.0
|
||||
let side_buttons_margin = 5
|
||||
|
||||
// User by subviews
|
||||
let form_margin = 10.0
|
||||
let form_input_height = 40.0
|
||||
let schdule_for_later_height = 80.0
|
||||
let description_height = 150.0
|
||||
|
||||
let titleLabel = StyledLabel(VoipTheme.calls_list_header_font)
|
||||
|
||||
|
|
@ -51,21 +43,15 @@ import linphonesw
|
|||
let action1BisButton = CallControlButton(buttonTheme:VoipTheme.nav_button("voip_conference_new"))
|
||||
let action2Button = CallControlButton(buttonTheme:VoipTheme.nav_button("more_menu_default"))
|
||||
|
||||
let cancel_button_alert = UIButton()
|
||||
let ok_button_alert = UIButton()
|
||||
let checkBoxButton = CallControlButton(buttonTheme:VoipTheme.nav_button("checkbox_unchecked"))
|
||||
var isChecked = false
|
||||
let checkBoxText = UILabel()
|
||||
|
||||
var isSecure : Bool = false
|
||||
let isGroupChat : Bool = false
|
||||
let levelMaxSecure : Bool = false
|
||||
let floatingButton = CallControlButton(buttonTheme:VoipTheme.nav_button(""))
|
||||
|
||||
func viewDidLoad(backAction : @escaping () -> Void,
|
||||
action1 : @escaping () -> Void,
|
||||
action1Bis : @escaping () -> Void,
|
||||
action2 : @escaping () -> Void,
|
||||
action3 : @escaping () -> Void,
|
||||
title:String) {
|
||||
self.backAction = backAction
|
||||
self.action1 = action1
|
||||
|
|
@ -102,7 +88,7 @@ import linphonesw
|
|||
view.addSubview(scrollView)
|
||||
scrollView.alignUnder(view: topBar).alignParentBottom().matchParentSideBorders().done()
|
||||
scrollView.addSubview(contentView)
|
||||
contentView.matchBordersOf(view: view).alignParentBottom().alignParentTop().done() // don't forget a bottom constraint b/w last element of contentview and contentview
|
||||
contentView.matchBordersOf(view: view).alignParentBottom().alignParentTop().done()
|
||||
|
||||
view.addSubview(messageView)
|
||||
messageView.alignParentBottom().height(top_bar_height).matchParentSideBorders().done()
|
||||
|
|
@ -112,7 +98,7 @@ import linphonesw
|
|||
floatingButton.topAnchor.constraint(equalTo: self.view.layoutMarginsGuide.topAnchor, constant: top_bar_height + 5).isActive = true
|
||||
floatingButton.setImage(UIImage(named:"security_alert_indicator.png"), for: .normal)
|
||||
floatingButton.imageEdgeInsets = UIEdgeInsets(top: 45, left: 45, bottom: 45, right: 45)
|
||||
floatingButton.onClickAction = alertAction
|
||||
floatingButton.onClickAction = action3
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -123,25 +109,6 @@ import linphonesw
|
|||
|
||||
}
|
||||
|
||||
func alertAction() {
|
||||
|
||||
let alertController = CustomAlertController(title: VoipTexts.alert_dialog_secure_badge_button_chat_conversation_title, message: nil, preferredStyle: .alert)
|
||||
|
||||
alertController.setBackgroundColor(color: .darkGray)
|
||||
alertController.setTitle(font: nil, color: .white)
|
||||
alertController.setTint(color: .white)
|
||||
alertController.setMaxWidth(alert: alertController)
|
||||
|
||||
alertController.addButtonsAlertController(alertController: alertController, buttonsViewHeightV: 60, checkboxViewHeightV: 50, buttonsAlertHeightV: 40)
|
||||
|
||||
self.present(alertController, animated: true, completion:{
|
||||
alertController.view.superview?.isUserInteractionEnabled = true
|
||||
alertController.view.superview?.subviews[0].addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.dismissOnTapOutsideOrCancel)))
|
||||
})
|
||||
|
||||
alertController.ok_button_alert.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.onTapOk)))
|
||||
}
|
||||
|
||||
func changeTitle(titleString: String){
|
||||
titleLabel.text = titleString
|
||||
}
|
||||
|
|
@ -165,12 +132,4 @@ import linphonesw
|
|||
action1BisButton.isHidden = true
|
||||
}
|
||||
}
|
||||
|
||||
@objc func dismissOnTapOutsideOrCancel(){
|
||||
self.dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
||||
@objc func onTapOk(){
|
||||
self.dismiss(animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,10 +27,6 @@ class CustomAlertController: UIAlertController {
|
|||
var isChecked = false
|
||||
let checkBoxText = UILabel()
|
||||
|
||||
var isSecure : Bool = false
|
||||
let isGroupChat : Bool = false
|
||||
let levelMaxSecure : Bool = false
|
||||
|
||||
@objc func dismissOnTapOutsideOrCancel(){
|
||||
self.dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
|
@ -39,7 +35,7 @@ class CustomAlertController: UIAlertController {
|
|||
self.dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
||||
@objc func switchCheckedValue(){
|
||||
@objc func changeCheckValue(){
|
||||
isChecked = !isChecked
|
||||
checkBoxButton.isSelected = isChecked
|
||||
}
|
||||
|
|
@ -87,7 +83,7 @@ class CustomAlertController: UIAlertController {
|
|||
|
||||
checkBoxButton.setImage(UIImage(named:"checkbox_unchecked.png"), for: .normal)
|
||||
checkBoxButton.setImage(UIImage(named:"checkbox_checked.png"), for: .selected)
|
||||
checkBoxButton.addTarget(self, action: #selector(switchCheckedValue), for: .touchUpInside)
|
||||
checkBoxButton.addTarget(self, action: #selector(changeCheckValue), for: .touchUpInside)
|
||||
checkboxView.addSubview(checkBoxButton)
|
||||
|
||||
checkBoxText.text = VoipTexts.alert_dialog_secure_badge_button_chat_conversation_checkboxtext
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue