diff --git a/Classes/ChatConversationCreateTableView.m b/Classes/ChatConversationCreateTableView.m index afc9e2ba8..79c3cf4b0 100644 --- a/Classes/ChatConversationCreateTableView.m +++ b/Classes/ChatConversationCreateTableView.m @@ -229,6 +229,8 @@ cell.selectedImage.hidden = ![_contactsGroup containsObject:cell.addressLabel.text]; [cell.avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:NO withRoundedRadius:YES]; cell.contentView.userInteractionEnabled = false; + cell.contentView.backgroundColor = UIColor.clearColor; + cell.backgroundColor = UIColor.clearColor; return cell; } diff --git a/Classes/ChatConversationCreateView.m b/Classes/ChatConversationCreateView.m index 2f9bb36d7..0398feaeb 100644 --- a/Classes/ChatConversationCreateView.m +++ b/Classes/ChatConversationCreateView.m @@ -90,6 +90,10 @@ static UICompositeViewDescription *compositeDescription = nil; selector:@selector(viewUpdateEvent:) name:kLinphoneChatCreateViewChange object:nil]; + [NSNotificationCenter.defaultCenter addObserver:self + selector:@selector(displayModeChanged) + name:kDisplayModeChanged + object:nil]; LinphoneAccount *defaultAccount = linphone_core_get_default_account(LC); _chiffreOptionView.hidden = !(defaultAccount && linphone_account_params_get_conference_factory_uri(linphone_account_get_params(defaultAccount))); if ([LinphoneManager.instance lpConfigBoolForKey:@"hide_linphone_contacts" inSection:@"app"]) { @@ -98,6 +102,7 @@ static UICompositeViewDescription *compositeDescription = nil; CGRect frame = _allButton.frame; frame.origin.x = _linphoneButton.frame.origin.x; _allButton.frame = frame; + } if ([LinphoneManager.instance lpConfigBoolForKey:@"force_lime_chat_rooms"]) { @@ -116,13 +121,28 @@ static UICompositeViewDescription *compositeDescription = nil; } else { [_nextButton setImage:[UIImage imageNamed:@"next_default"] forState:UIControlStateNormal]; } - _topBar.backgroundColor = VoipTheme.toolbar_color; } else { _voipTitle.hidden = true; [_nextButton setImage:[UIImage imageNamed:@"next_default"] forState:UIControlStateNormal]; - _topBar.backgroundColor = UIColor.secondarySystemBackgroundColor; } - + [self displayModeChanged]; +} + +- (void)displayModeChanged{ + [self.tableController.tableView reloadData]; + if (_isForVoipConference) { + _topBar.backgroundColor = [VoipTheme.voipToolbarBackgroundColor get]; + self.view.backgroundColor = [VoipTheme.voipBackgroundBWColor get]; + _tableController.tableView.backgroundColor = [VoipTheme.voipBackgroundBWColor get]; + _tableController.searchBar.backgroundColor = [VoipTheme.voipBackgroundBWColor get]; + _tableController.collectionView.backgroundColor = [VoipTheme.voipBackgroundBWColor get]; + } else { + _topBar.backgroundColor = UIColor.secondarySystemBackgroundColor; + self.view.backgroundColor = [VoipTheme.backgroundWhiteBlack get]; + _tableController.tableView.backgroundColor = [VoipTheme.backgroundWhiteBlack get]; + _tableController.searchBar.backgroundColor = [VoipTheme.backgroundWhiteBlack get]; + _tableController.collectionView.backgroundColor = [VoipTheme.backgroundWhiteBlack get]; + } } - (void)viewUpdateEvent:(NSNotification *)notif { @@ -170,9 +190,8 @@ static UICompositeViewDescription *compositeDescription = nil; } - (void)viewWillDisappear:(BOOL)animated { - [super viewWillDisappear:animated]; - if (IPAD) - [NSNotificationCenter.defaultCenter removeObserver:self]; + [super viewWillDisappear:animated]; + [NSNotificationCenter.defaultCenter removeObserver:self]; } #pragma mark - Chat room functions diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 62406a221..44e5e5ce6 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -157,7 +157,9 @@ [self handleShortcut:_shortcutItem]; _shortcutItem = nil; } - + +#if TARGET_IPHONE_SIMULATOR +#else [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:(UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError *_Nullable error) { if (error) @@ -183,10 +185,15 @@ } }]; +#endif + if ([UIDeviceBridge switchedDisplayMode]) { [AvatarBridge prepareIt]; [NSNotificationCenter.defaultCenter postNotificationName:kDisplayModeChanged object:nil]; + [PhoneMainView.instance.mainViewController removeEntryFromCache:ChatConversationCreateView.compositeViewDescription.name]; + [PhoneMainView.instance.mainViewController changeView:PhoneMainView.instance.currentView]; + [UIDeviceBridge notifyDisplayModeSwitch]; } } diff --git a/Classes/LinphoneUI/Base.lproj/UIChatCreateCell.xib b/Classes/LinphoneUI/Base.lproj/UIChatCreateCell.xib index a837d752f..021df4d7f 100644 --- a/Classes/LinphoneUI/Base.lproj/UIChatCreateCell.xib +++ b/Classes/LinphoneUI/Base.lproj/UIChatCreateCell.xib @@ -1,9 +1,9 @@ - + - + @@ -61,7 +61,7 @@ - + diff --git a/Classes/LinphoneUI/UICompositeView.h b/Classes/LinphoneUI/UICompositeView.h index b7c4739cb..9a686347b 100644 --- a/Classes/LinphoneUI/UICompositeView.h +++ b/Classes/LinphoneUI/UICompositeView.h @@ -84,6 +84,7 @@ - (UIViewController *)getCurrentViewController; - (UIInterfaceOrientation)currentOrientation; - (void)clearCache:(NSArray *)exclude; +- (void)removeEntryFromCache:(NSString *)key; - (IBAction)onRightSwipe:(id)sender; diff --git a/Classes/LinphoneUI/UICompositeView.m b/Classes/LinphoneUI/UICompositeView.m index f7ed463b5..0ea80b390 100644 --- a/Classes/LinphoneUI/UICompositeView.m +++ b/Classes/LinphoneUI/UICompositeView.m @@ -305,6 +305,9 @@ return nil; } +- (void)removeEntryFromCache:(NSString *)key { + [viewControllerCache removeObjectForKey:key]; +} - (void)clearCache:(NSArray *)exclude { diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index a64295b7f..e146e01b0 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -960,4 +960,8 @@ void main_view_chat_room_state_changed(LinphoneChatRoom *cr, LinphoneChatRoomSta } } +-(void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection { + [UIDeviceBridge notifyDisplayModeSwitch]; +} + @end diff --git a/Classes/Swift/Conference/Views/ConferenceHistoryDetailsView.swift b/Classes/Swift/Conference/Views/ConferenceHistoryDetailsView.swift index 715237c8f..7e127f789 100644 --- a/Classes/Swift/Conference/Views/ConferenceHistoryDetailsView.swift +++ b/Classes/Swift/Conference/Views/ConferenceHistoryDetailsView.swift @@ -107,7 +107,6 @@ import linphonesw // Organiser - organiserLabel.backgroundColor = VoipTheme.voipFormBackgroundColor.get() contentView.addSubview(organiserLabel) organiserLabel.matchParentSideBorders().height(form_input_height).alignUnder(view: schedulingStack,withMargin: form_margin*2).done() organiserLabel.textAlignment = .left @@ -121,12 +120,10 @@ import linphonesw organizerTableView.allowsFocus = false } organizerTableView.separatorStyle = .singleLine - organizerTableView.separatorColor = VoipTheme.light_grey_color organizerTableView.tag = 1; organizerTableView.matchParentSideBorders().height(VoipParticipantCell.cell_height).alignUnder(view: organiserLabel,withMargin: form_margin).done() // Participants - participantsLabel.backgroundColor = VoipTheme.voipFormBackgroundColor.get() contentView.addSubview(participantsLabel) participantsLabel.matchParentSideBorders().height(form_input_height).alignUnder(view: organizerTableView,withMargin: form_margin).done() participantsLabel.textAlignment = .left @@ -140,7 +137,6 @@ import linphonesw participantsListTableView.allowsFocus = false } participantsListTableView.separatorStyle = .singleLine - participantsListTableView.separatorColor = VoipTheme.light_grey_color // Goto chat - v2 /* @@ -153,6 +149,14 @@ import linphonesw chatButton.centerX().alignParentBottom(withMargin: 3*self.form_margin).alignUnder(view: participantsListTableView,withMargin: 3*self.form_margin).done() */ + + UIDeviceBridge.displayModeSwitched.readCurrentAndObserve { _ in + self.organiserLabel.backgroundColor = VoipTheme.voipFormBackgroundColor.get() + self.organizerTableView.separatorColor = VoipTheme.separatorColor.get() + self.participantsLabel.backgroundColor = VoipTheme.voipFormBackgroundColor.get() + self.participantsListTableView.separatorColor = VoipTheme.separatorColor.get() + self.view.backgroundColor = VoipTheme.voipBackgroundBWColor.get() + } } diff --git a/Classes/Swift/Conference/Views/ConferenceSchedulingSummaryView.swift b/Classes/Swift/Conference/Views/ConferenceSchedulingSummaryView.swift index 2c9a5e6b3..27c6a14f6 100644 --- a/Classes/Swift/Conference/Views/ConferenceSchedulingSummaryView.swift +++ b/Classes/Swift/Conference/Views/ConferenceSchedulingSummaryView.swift @@ -141,7 +141,6 @@ import SVProgressHUD // Participants let participantsLabel = StyledLabel(VoipTheme.conference_scheduling_font, " "+VoipTexts.conference_schedule_participants_list) - participantsLabel.backgroundColor = VoipTheme.voipFormBackgroundColor.get() contentView.addSubview(participantsLabel) participantsLabel.matchParentSideBorders().height(form_input_height).alignUnder(view: viaChatLabel,withMargin: form_margin).done() participantsLabel.textAlignment = .left @@ -156,7 +155,7 @@ import SVProgressHUD participantsListTableView.allowsFocus = false } participantsListTableView.separatorStyle = .singleLine - participantsListTableView.separatorColor = VoipTheme.light_grey_color + participantsListTableView.backgroundColor = .clear ConferenceSchedulingViewModel.shared.selectedAddresses.readCurrentAndObserve { (addresses) in self.participantsListTableView.reloadData() @@ -167,6 +166,7 @@ import SVProgressHUD // Create / Schedule contentView.addSubview(createButton) + createButton.centerX().alignParentBottom(withMargin: 3*self.form_margin).alignUnder(view: participantsListTableView,withMargin: 3*self.form_margin).width(0).done() ConferenceSchedulingViewModel.shared.scheduleForLater.readCurrentAndObserve { _ in self.createButton.title = ConferenceSchedulingViewModel.shared.scheduleForLater.value == true ? ConferenceSchedulingViewModel.shared.existingConfInfo.value != nil ? VoipTexts.conference_schedule_edit.uppercased() : VoipTexts.conference_schedule_start.uppercased() : VoipTexts.conference_group_call_create.uppercased() self.createButton.addSidePadding() @@ -219,8 +219,12 @@ import SVProgressHUD self.createButton.addSidePadding() } - createButton.centerX().alignParentBottom(withMargin: 3*self.form_margin).alignUnder(view: participantsListTableView,withMargin: 3*self.form_margin).done() - + UIDeviceBridge.displayModeSwitched.readCurrentAndObserve { _ in + self.view.backgroundColor = VoipTheme.voipBackgroundBWColor.get() + participantsLabel.backgroundColor = VoipTheme.voipFormBackgroundColor.get() + self.participantsListTableView.separatorColor = VoipTheme.separatorColor.get() + } + } override func viewWillAppear(_ animated: Bool) { diff --git a/Classes/Swift/Conference/Views/ConferenceSchedulingView.swift b/Classes/Swift/Conference/Views/ConferenceSchedulingView.swift index cf693f47c..d2612d514 100644 --- a/Classes/Swift/Conference/Views/ConferenceSchedulingView.swift +++ b/Classes/Swift/Conference/Views/ConferenceSchedulingView.swift @@ -60,7 +60,6 @@ import IQKeyboardManager let schedulingStack = UIStackView() schedulingStack.axis = .vertical - schedulingStack.backgroundColor = VoipTheme.voipFormBackgroundColor.get() contentView.addSubview(schedulingStack) schedulingStack.alignUnder(view: subjectInput,withMargin: form_margin).matchParentSideBorders(insetedByDx: form_margin).done() @@ -206,6 +205,11 @@ import IQKeyboardManager ConferenceSchedulingViewModel.shared.existingConfInfo.readCurrentAndObserve { (confInfo) in super.titleLabel.text = ConferenceSchedulingViewModel.shared.scheduleForLater.value == true ? ConferenceSchedulingViewModel.shared.existingConfInfo.value != nil ? VoipTexts.conference_schedule_edit : VoipTexts.conference_schedule_title : VoipTexts.conference_group_call_title } + + UIDeviceBridge.displayModeSwitched.readCurrentAndObserve { _ in + self.view.backgroundColor = VoipTheme.voipBackgroundBWColor.get() + schedulingStack.backgroundColor = VoipTheme.voipFormBackgroundColor.get() + } } diff --git a/Classes/Swift/Conference/Views/ConferenceWaitingRoomFragment.swift b/Classes/Swift/Conference/Views/ConferenceWaitingRoomFragment.swift index a0220faa0..dfb537d00 100644 --- a/Classes/Swift/Conference/Views/ConferenceWaitingRoomFragment.swift +++ b/Classes/Swift/Conference/Views/ConferenceWaitingRoomFragment.swift @@ -61,7 +61,6 @@ import linphonesw override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = VoipTheme.voipBackgroundColor.get() view.addSubview(subject) subject.centerX().alignParentTop(withMargin: common_margin).done() @@ -192,6 +191,10 @@ import linphonesw layoutRotatableElements() + UIDeviceBridge.displayModeSwitched.readCurrentAndObserve { _ in + self.view.backgroundColor = VoipTheme.voipBackgroundColor.get() + } + } func layoutRotatableElements() { diff --git a/Classes/Swift/Conference/Views/ICSBubbleView.swift b/Classes/Swift/Conference/Views/ICSBubbleView.swift index 2fa1e4663..27637e979 100644 --- a/Classes/Swift/Conference/Views/ICSBubbleView.swift +++ b/Classes/Swift/Conference/Views/ICSBubbleView.swift @@ -75,7 +75,9 @@ import EventKitUI layer.cornerRadius = corner_radius clipsToBounds = true - backgroundColor = VoipTheme.voip_light_gray + UIDeviceBridge.displayModeSwitched.readCurrentAndObserve { _ in + self.backgroundColor = VoipTheme.chatBubbleBGColor.get() + } let rows = UIStackView() rows.axis = .vertical diff --git a/Classes/Swift/Conference/Views/ScheduledConferencesCell.swift b/Classes/Swift/Conference/Views/ScheduledConferencesCell.swift index 26cb67b8a..09914b5c5 100644 --- a/Classes/Swift/Conference/Views/ScheduledConferencesCell.swift +++ b/Classes/Swift/Conference/Views/ScheduledConferencesCell.swift @@ -29,12 +29,12 @@ class ScheduledConferencesCell: UITableViewCell { static let button_size = 40 let delete_checkbox_margin = 5 - let clockIcon = UIImageView(image: UIImage(named: "conference_schedule_time_default")) + let clockIcon = UIImageView() let timeDuration = StyledLabel(VoipTheme.conference_invite_desc_font) let organiser = StyledLabel(VoipTheme.conference_invite_desc_font) let subject = StyledLabel(VoipTheme.conference_list_subject_font) let cancelledLabel = StyledLabel(VoipTheme.conference_cancelled_title_font) - let participantsIcon = UIImageView(image: UIImage(named: "conference_schedule_participants_default")) + let participantsIcon = UIImageView() let participants = StyledLabel(VoipTheme.conference_invite_desc_font) let infoConf = UIButton() @@ -101,7 +101,8 @@ class ScheduledConferencesCell: UITableViewCell { super.init(style: style, reuseIdentifier: reuseIdentifier) contentView.addSubview(myContentView) - + contentView.backgroundColor = .clear + backgroundColor = .clear myContentView.layer.cornerRadius = corner_radius myContentView.clipsToBounds = true myContentView.backgroundColor = VoipTheme.header_background_color @@ -218,6 +219,10 @@ class ScheduledConferencesCell: UITableViewCell { onLongClick { ScheduledConferencesViewModel.shared.editionEnabled.value = true } + UIDeviceBridge.displayModeSwitched.readCurrentAndObserve { _ in + self.clockIcon.image = UIImage(named: "conference_schedule_time_default")?.tinted(with: VoipTheme.voipDrawableColor.get()) + self.participantsIcon.image = UIImage(named: "conference_schedule_participants_default")?.tinted(with: VoipTheme.voipDrawableColor.get()) + } } func askConfirmationTodeleteEntry() { diff --git a/Classes/Swift/Conference/Views/ScheduledConferencesView.swift b/Classes/Swift/Conference/Views/ScheduledConferencesView.swift index 50a1a16cb..74e8aa20f 100644 --- a/Classes/Swift/Conference/Views/ScheduledConferencesView.swift +++ b/Classes/Swift/Conference/Views/ScheduledConferencesView.swift @@ -89,7 +89,6 @@ import linphonesw filters.alignParentLeft(withMargin: 10).alignUnder(view: super.topBar,withMargin: self.form_margin).done() self.view.addSubview(separator) - separator.backgroundColor = VoipTheme.voip_light_gray separator.matchParentSideBorders().height(1).alignUnder(view: filters,withMargin: self.form_margin).done() // Conference list @@ -106,7 +105,7 @@ import linphonesw conferenceListView.allowsFocus = false } conferenceListView.separatorStyle = .singleLine - conferenceListView.separatorColor = .white + conferenceListView.backgroundColor = .clear view.addSubview(noConference) noConference.center().done() @@ -115,16 +114,14 @@ import linphonesw if (editing == true) { self.selectAllButton.isSelected = false self.selectAllButton.isHidden = false - super.nextButton.setImage(UIImage(named: "delete_default"), for: .normal) - super.nextButton.setImage(UIImage(named: "delete_disabled"), for: .disabled) - super.nextButton.setImage(UIImage(named: "delete_default"), for: .highlighted) - super.backButton.setImage(UIImage(named: "cancel_edit_default"), for: .normal) + super.nextButton.applyTintedIcons(tintedIcons: VoipTheme.generic_delete_button) + super.backButton.applyTintedIcons(tintedIcons: VoipTheme.generic_cancel) self.nextButton.isEnabled = ScheduledConferencesViewModel.shared.conferences.value?.filter{$0.selectedForDeletion.value == true}.count ?? 0 > 0 } else { self.selectAllButton.isHidden = true ScheduledConferencesViewModel.shared.conferences.value?.forEach {$0.selectedForDeletion.value = false} super.nextButton.applyTintedIcons(tintedIcons: VoipTheme.conference_create_button) - super.backButton.setImage(UIImage(named: "back_default"), for: .normal) + super.backButton.applyTintedIcons(tintedIcons: VoipTheme.generic_back) self.nextButton.isEnabled = true } } @@ -134,6 +131,12 @@ import linphonesw ScheduledConferencesViewModel.shared.conferences.value?.forEach {$0.selectedForDeletion.value = selectIt} } + UIDeviceBridge.displayModeSwitched.readCurrentAndObserve { _ in + self.view.backgroundColor = VoipTheme.voipBackgroundBWColor.get() + self.separator.backgroundColor = VoipTheme.separatorColor.get() + self.conferenceListView.separatorColor = .clear + self.conferenceListView.reloadData() + } } func getFilterButton(title:String) -> UIButton { @@ -146,6 +149,7 @@ import linphonesw button.layer.cornerRadius = filter_button_height / 2 button.clipsToBounds = true button.applyTitleStyle(VoipTheme.conf_list_filter_button_font) + button.width(0).done() button.addSidePadding() return button } diff --git a/Classes/Swift/Extensions/IOS/UIButtonExtensions.swift b/Classes/Swift/Extensions/IOS/UIButtonExtensions.swift index 54d9ad997..abcb0da99 100644 --- a/Classes/Swift/Extensions/IOS/UIButtonExtensions.swift +++ b/Classes/Swift/Extensions/IOS/UIButtonExtensions.swift @@ -22,9 +22,9 @@ import SnapKit import UIKit extension UIButton { - func addSidePadding(p:CGFloat = 10) { + func addSidePadding(p:CGFloat = 10) { // Requires a width to be set prior to this ! SnapKit does not support updateOrCreate. if let w = titleLabel?.textWidth { - width(w+2*p).done() + updateWidth(w+2*p).done() } } diff --git a/Classes/Swift/Extensions/IOS/UIDeviceExtensions.swift b/Classes/Swift/Extensions/IOS/UIDeviceExtensions.swift index 212a7793e..32b415dbe 100644 --- a/Classes/Swift/Extensions/IOS/UIDeviceExtensions.swift +++ b/Classes/Swift/Extensions/IOS/UIDeviceExtensions.swift @@ -69,9 +69,11 @@ extension UIDevice { } @objc class UIDeviceBridge : NSObject { - @available(iOS 12.0, *) - static let displayMode = MutableLiveData() + static let displayModeSwitched = MutableLiveData() @objc static func switchedDisplayMode() -> Bool { return UIDevice.switchedDisplayMode() } + @objc static func notifyDisplayModeSwitch() { + displayModeSwitched.notifyValue() + } } diff --git a/Classes/Swift/Extensions/IOS/UIVIewExtensions.swift b/Classes/Swift/Extensions/IOS/UIVIewExtensions.swift index 4fb2b6c1f..fe158f836 100644 --- a/Classes/Swift/Extensions/IOS/UIVIewExtensions.swift +++ b/Classes/Swift/Extensions/IOS/UIVIewExtensions.swift @@ -88,6 +88,13 @@ extension UIView { return self } + func updateWidth(_ h:CGFloat) -> UIView { + snp.updateConstraints { (make) in + make.width.equalTo(h) + } + return self + } + func width(_ h:Int) -> UIView { return width(CGFloat(h)) } diff --git a/Classes/Swift/Util/BackNextNavigationView.swift b/Classes/Swift/Util/BackNextNavigationView.swift index 6bb4af676..22582c4cb 100644 --- a/Classes/Swift/Util/BackNextNavigationView.swift +++ b/Classes/Swift/Util/BackNextNavigationView.swift @@ -79,14 +79,9 @@ import linphonesw scrollView.alignUnder(view: topBar, withMargin: content_margin_top).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 - - } - - - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - topBar.backgroundColor = VoipTheme.voipToolbarBackgroundColor.get() - + UIDeviceBridge.displayModeSwitched.readCurrentAndObserve { _ in + self.topBar.backgroundColor = VoipTheme.voipToolbarBackgroundColor.get() + } } } diff --git a/Classes/Swift/Voip/Theme/LightDarkColor.swift b/Classes/Swift/Voip/Theme/LightDarkColor.swift index a01e375b2..f87cf42f5 100644 --- a/Classes/Swift/Voip/Theme/LightDarkColor.swift +++ b/Classes/Swift/Voip/Theme/LightDarkColor.swift @@ -19,7 +19,7 @@ import Foundation -class LightDarkColor { +@objc class LightDarkColor : NSObject { var light: UIColor var dark : UIColor init(_ l:UIColor,_ d:UIColor){ @@ -27,7 +27,7 @@ class LightDarkColor { dark = d } - func get() -> UIColor { + @objc func get() -> UIColor { if #available(iOS 13.0, *) { if UITraitCollection.current.userInterfaceStyle == .light { return light diff --git a/Classes/Swift/Voip/Theme/TextStyle.swift b/Classes/Swift/Voip/Theme/TextStyle.swift index 51fed4484..508a91bf9 100644 --- a/Classes/Swift/Voip/Theme/TextStyle.swift +++ b/Classes/Swift/Voip/Theme/TextStyle.swift @@ -35,9 +35,14 @@ struct TextStyle { extension UILabel { - func applyStyle(_ style:TextStyle) { + + func applyStyleColors(_ style:TextStyle) { textColor = style.fgColor.get() backgroundColor = style.bgColor.get() + } + + func applyStyle(_ style:TextStyle) { + applyStyleColors(style) if (style.allCaps) { text = self.text?.uppercased() tag = 1 @@ -49,7 +54,7 @@ extension UILabel { func addIndicatorIcon(iconName:String, padding:CGFloat = 5.0, y:CGFloat = 4.0, trailing: Bool = true) { let imageAttachment = NSTextAttachment() - imageAttachment.image = UIImage(named:iconName) + imageAttachment.image = UIImage(named:iconName)?.tinted(with: VoipTheme.voipDrawableColor.get()) imageAttachment.bounds = CGRect(x: 0.0, y: y , width: font.lineHeight - 2*padding, height: font.lineHeight - 2*padding) let iconString = NSMutableAttributedString(attachment: imageAttachment) let textXtring = NSMutableAttributedString(string: text != nil ? (!trailing ? " " : "") + text! + (trailing ? " " : "") : "") @@ -78,9 +83,14 @@ extension UIButton { } extension UITextView { - func applyStyle(_ style:TextStyle) { + + func applyStyleColors(_ style:TextStyle) { textColor = style.fgColor.get() backgroundColor = style.bgColor.get() + } + + func applyStyle(_ style:TextStyle) { + applyStyleColors(style) if (style.allCaps) { text = self.text?.uppercased() tag = 1 diff --git a/Classes/Swift/Voip/Theme/VoipTheme.swift b/Classes/Swift/Voip/Theme/VoipTheme.swift index 4c36f4d66..a79ca79b0 100644 --- a/Classes/Swift/Voip/Theme/VoipTheme.swift +++ b/Classes/Swift/Voip/Theme/VoipTheme.swift @@ -64,14 +64,15 @@ import UIKit // Light / Dark variations static let voipBackgroundColor = LightDarkColor(voip_gray_blue_color,voip_dark_color) - static let voipBackgroundBWColor = LightDarkColor(UIColor.white,voip_dark_color) + @objc static let voipBackgroundBWColor = LightDarkColor(.white,voip_dark_color) + @objc static let backgroundWhiteBlack = LightDarkColor(.white,.black) static let voipParticipantBackgroundColor = LightDarkColor(voip_gray_background,voip_dark_color2) static let voipParticipantMeBackgroundColor = LightDarkColor(voip_dark_color3,voip_dark_color3) static let voipExtraButtonsBackgroundColor = LightDarkColor(voip_gray,voip_dark_color3) - static let voipToolbarBackgroundColor = LightDarkColor(toolbar_color,voip_dark_color4) + @objc static let voipToolbarBackgroundColor = LightDarkColor(toolbar_color,voip_dark_color4) static let voipDrawableColor = LightDarkColor(voip_dark_gray,.white) static let voipDrawableColorHighlighted = LightDarkColor(voip_gray,voip_gray) - static let voipTextColor = LightDarkColor(voip_dark_gray,UIColor.white) + static let voipTextColor = LightDarkColor(voip_dark_gray,.white) static let voipFormBackgroundColor = LightDarkColor(form_field_gray_background,voip_dark_color4) static let voipFormFieldBackgroundColor = LightDarkColor(light_grey_color,voip_dark_color4) static let voipFormDisabledFieldBackgroundColor = LightDarkColor(header_background_color,voip_dark_color4) @@ -79,9 +80,10 @@ import UIKit static let primaryTextColor = LightDarkColor(dark_grey_color,.white) static let backgroundColor3 = LightDarkColor(voip_light_gray,voip_dark_color5) static let backgroundColor4 = LightDarkColor(header_background_color,voip_dark_color5) + static let separatorColor = LightDarkColor(light_grey_color,.white) + static let chatBubbleBGColor = LightDarkColor(voip_light_gray, voip_dark_color5) - // Text styles static let fontName = "Roboto" static let call_header_title = TextStyle(fgColor: LightDarkColor(.white,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .center, font: fontName+"-Bold", size: 18.0) @@ -118,19 +120,19 @@ import UIKit static let conference_participant_admin_label = TextStyle(fgColor: primarySubtextLightColor, bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Bold", size: 13.0) - static let conference_participant_name_font = TextStyle(fgColor: LightDarkColor(dark_grey_color,dark_grey_color), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Regular", size: 18.0) + static let conference_participant_name_font = TextStyle(fgColor: LightDarkColor(dark_grey_color,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Regular", size: 18.0) static let conference_participant_sip_uri_font = TextStyle(fgColor: LightDarkColor(primary_color,primary_color), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Regular", size: 12.0) static let conference_participant_name_font_grid = TextStyle(fgColor: LightDarkColor(.white,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Bold", size: 15.0) static let conference_participant_name_font_as = TextStyle(fgColor: LightDarkColor(.white,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Bold", size: 12.0) static let conference_participant_name_font_audio_only = TextStyle(fgColor: LightDarkColor(.white,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName, size: 14.0) - static let conference_mode_title = TextStyle(fgColor: LightDarkColor(dark_grey_color,dark_grey_color), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Regular", size: 17.0) + static let conference_mode_title = TextStyle(fgColor: LightDarkColor(dark_grey_color,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Regular", size: 17.0) static let conference_mode_title_selected = conference_mode_title.boldEd() static let conference_scheduling_font = TextStyle(fgColor: voipTextColor, bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Regular", size: 17.0) - static let conference_invite_desc_font = TextStyle(fgColor: LightDarkColor(dark_grey_color,dark_grey_color), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Regular", size: 14.0) - static let conference_invite_desc_title_font = TextStyle(fgColor: LightDarkColor(voip_dark_gray,voip_dark_gray), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Bold", size: 14.0) - static let conference_invite_subject_font = TextStyle(fgColor: LightDarkColor(voip_dark_gray,voip_dark_gray), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Bold", size: 14.0) - static let conference_invite_title_font = TextStyle(fgColor: LightDarkColor(dark_grey_color,dark_grey_color), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Bold", size: 16.0) + static let conference_invite_desc_font = TextStyle(fgColor: LightDarkColor(dark_grey_color,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Regular", size: 14.0) + static let conference_invite_desc_title_font = TextStyle(fgColor: LightDarkColor(voip_dark_gray,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Bold", size: 14.0) + static let conference_invite_subject_font = TextStyle(fgColor: LightDarkColor(voip_dark_gray,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Bold", size: 14.0) + static let conference_invite_title_font = TextStyle(fgColor: LightDarkColor(dark_grey_color,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Bold", size: 16.0) static let conference_cancelled_title_font = TextStyle(fgColor: LightDarkColor(.red,.red), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Bold", size: 16.0) static let conference_updated_title_font = TextStyle(fgColor: LightDarkColor(voip_conference_updated,voip_conference_updated), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Bold", size: 16.0) @@ -138,9 +140,9 @@ import UIKit static let conference_waiting_room_no_video_font = TextStyle(fgColor: LightDarkColor(.white,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .center, font: fontName+"-Regular", size: 16.0) static let empty_list_font = TextStyle(fgColor: primaryTextColor, bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .center, font: fontName+"-Regular", size: 18.0) - static let conf_list_filter_button_font = TextStyle(fgColor: LightDarkColor(.black,.black), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .center, font: fontName+"-Regular", size: 14.0) - static let conference_list_subject_font = TextStyle(fgColor: LightDarkColor(voip_dark_gray,voip_dark_gray), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Bold", size: 18.0) - static let conference_list_address_desc_font = TextStyle(fgColor: LightDarkColor(voip_dark_gray,voip_dark_gray), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Regular", size: 18.0) + static let conf_list_filter_button_font = TextStyle(fgColor: LightDarkColor(.black,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .center, font: fontName+"-Regular", size: 14.0) + static let conference_list_subject_font = TextStyle(fgColor: LightDarkColor(voip_dark_gray,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Bold", size: 18.0) + static let conference_list_address_desc_font = TextStyle(fgColor: LightDarkColor(voip_dark_gray,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Regular", size: 18.0) // Buttons Background (State colors) @@ -211,7 +213,7 @@ import UIKit ] static let button_conference_list_filter = [ - UIButton.State.normal.rawValue : LightDarkColor(light_grey_color,light_grey_color), + UIButton.State.normal.rawValue : LightDarkColor(light_grey_color,dark_grey_color), UIButton.State.selected.rawValue : LightDarkColor(primary_color.withAlphaComponent(0.24),primary_color.withAlphaComponent(0.24)), ] @@ -331,14 +333,14 @@ import UIKit static let voip_edit = ButtonTheme( tintableStateIcons:[ - UIButton.State.normal.rawValue : TintableIcon(name: "voip_edit",tintColor: LightDarkColor(dark_grey_color,dark_grey_color)), + UIButton.State.normal.rawValue : TintableIcon(name: "voip_edit",tintColor: LightDarkColor(dark_grey_color,.white)), UIButton.State.highlighted.rawValue : TintableIcon(name: "voip_edit",tintColor: voipDrawableColorHighlighted) ], backgroundStateColors: [UIButton.State.normal.rawValue : LightDarkColor(.clear,.clear)]) static let radio_button = ButtonTheme( tintableStateIcons:[ - UIButton.State.normal.rawValue : TintableIcon(name: "voip_radio_off",tintColor: LightDarkColor(dark_grey_color,dark_grey_color)), + UIButton.State.normal.rawValue : TintableIcon(name: "voip_radio_off",tintColor: LightDarkColor(dark_grey_color,.white)), UIButton.State.selected.rawValue : TintableIcon(name: "voip_radio_on",tintColor: LightDarkColor(primary_color,primary_color)) ], backgroundStateColors: [UIButton.State.normal.rawValue : LightDarkColor(.clear,.clear)]) @@ -381,9 +383,9 @@ import UIKit static func nav_button(_ iconName:String) -> ButtonTheme { return ButtonTheme( tintableStateIcons:[ - UIButton.State.normal.rawValue : TintableIcon(name: iconName,tintColor: LightDarkColor(.darkGray,.white)), + UIButton.State.normal.rawValue : TintableIcon(name: iconName,tintColor: LightDarkColor(voip_dark_gray,.white)), UIButton.State.highlighted.rawValue : TintableIcon(name: iconName,tintColor: LightDarkColor(primary_color,primary_color)), - UIButton.State.disabled.rawValue : TintableIcon(name: iconName,tintColor: LightDarkColor(light_grey_color,light_grey_color)), + UIButton.State.disabled.rawValue : TintableIcon(name: iconName,tintColor: LightDarkColor(light_grey_color,.white)), ], backgroundStateColors: [:]) } @@ -401,17 +403,27 @@ import UIKit ] static let conference_create_button = [ - UIButton.State.normal.rawValue : TintableIcon(name: "voip_conference_new",tintColor: LightDarkColor(voip_dark_gray,voip_dark_gray)), + UIButton.State.normal.rawValue : TintableIcon(name: "voip_conference_new",tintColor: LightDarkColor(.darkGray,.white)), UIButton.State.highlighted.rawValue : TintableIcon(name: "voip_conference_new",tintColor: LightDarkColor(primary_color,primary_color)), UIButton.State.disabled.rawValue : TintableIcon(name: "voip_conference_new",tintColor: LightDarkColor(voip_light_gray,voip_light_gray)), ] static let generic_delete_button = [ - UIButton.State.normal.rawValue : TintableIcon(name: "voip_conference_new",tintColor: LightDarkColor(voip_dark_gray,voip_dark_gray)), - UIButton.State.highlighted.rawValue : TintableIcon(name: "voip_conference_new",tintColor: LightDarkColor(primary_color,primary_color)), - UIButton.State.disabled.rawValue : TintableIcon(name: "voip_conference_new",tintColor: LightDarkColor(voip_light_gray,voip_light_gray)), + UIButton.State.normal.rawValue : TintableIcon(name: "delete_default",tintColor: LightDarkColor(.darkGray,.white)), + UIButton.State.highlighted.rawValue : TintableIcon(name: "delete_default",tintColor: LightDarkColor(primary_color,primary_color)), + UIButton.State.disabled.rawValue : TintableIcon(name: "delete_disabled",tintColor: LightDarkColor(voip_light_gray,.white)), ] + static let generic_back = [ + UIButton.State.normal.rawValue : TintableIcon(name: "back_default",tintColor: LightDarkColor(.darkGray,.white)), + UIButton.State.highlighted.rawValue : TintableIcon(name: "back_default",tintColor: LightDarkColor(primary_color,primary_color)), + UIButton.State.disabled.rawValue : TintableIcon(name: "back_default",tintColor: LightDarkColor(voip_light_gray,voip_light_gray)), + ] + + static let generic_cancel = [ + UIButton.State.normal.rawValue : TintableIcon(name: "cancel_edit_default",tintColor: LightDarkColor(.darkGray,.white)), + ] + } diff --git a/Classes/Swift/Voip/Views/CompositeViewControllers/ActiveCallOrConferenceView.swift b/Classes/Swift/Voip/Views/CompositeViewControllers/ActiveCallOrConferenceView.swift index af14974cb..49294477c 100644 --- a/Classes/Swift/Voip/Views/CompositeViewControllers/ActiveCallOrConferenceView.swift +++ b/Classes/Swift/Voip/Views/CompositeViewControllers/ActiveCallOrConferenceView.swift @@ -59,7 +59,9 @@ import linphonesw override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = VoipTheme.voipBackgroundColor.get() + UIDeviceBridge.displayModeSwitched.readCurrentAndObserve { _ in + self.view.backgroundColor = VoipTheme.voipBackgroundColor.get() + } // Hangup let hangup = CallControlButton(width: 65, imageInset:IncomingOutgoingCommonView.answer_decline_inset, buttonTheme: VoipTheme.call_terminate, onClickAction: { @@ -212,9 +214,6 @@ import linphonesw self.dismissableView = VoipConferenceDisplayModeSelectionView() self.view.addSubview(self.dismissableView!) self.dismissableView?.matchParentDimmensions().done() - let activeDisplayMode = ConferenceViewModel.shared.conferenceDisplayMode.value! - let indexPath = IndexPath(row: activeDisplayMode == .Grid ? 0 : activeDisplayMode == .ActiveSpeaker ? 1 : 2, section: 0) - (self.dismissableView as! VoipConferenceDisplayModeSelectionView).optionsListView.selectRow(at:indexPath, animated: true, scrollPosition: .bottom) } // Shading mask, everything before will be shaded upon displaying of the mask diff --git a/Classes/Swift/Voip/Views/Fragments/CallsList/CallsListView.swift b/Classes/Swift/Voip/Views/Fragments/CallsList/CallsListView.swift index 57324d918..ba6fe96cf 100644 --- a/Classes/Swift/Voip/Views/Fragments/CallsList/CallsListView.swift +++ b/Classes/Swift/Voip/Views/Fragments/CallsList/CallsListView.swift @@ -80,7 +80,6 @@ import linphonesw callsListTableView.allowsFocus = false } callsListTableView.separatorStyle = .singleLine - callsListTableView.separatorColor = .white callsListTableView.onClick { self.hideMenu() } @@ -90,6 +89,13 @@ import linphonesw menuView.isHidden = true + UIDeviceBridge.displayModeSwitched.readCurrentAndObserve { _ in + super.contentView.backgroundColor = VoipTheme.voipBackgroundBWColor.get() + self.callsListTableView.backgroundColor = VoipTheme.voipBackgroundBWColor.get() + self.callsListTableView.separatorColor = VoipTheme.separatorColor.get() + self.callsListTableView.reloadData() + } + } diff --git a/Classes/Swift/Voip/Views/Fragments/Conference/VoipConferenceActiveSpeakerView.swift b/Classes/Swift/Voip/Views/Fragments/Conference/VoipConferenceActiveSpeakerView.swift index e2592e61f..21119b6bf 100644 --- a/Classes/Swift/Voip/Views/Fragments/Conference/VoipConferenceActiveSpeakerView.swift +++ b/Classes/Swift/Voip/Views/Fragments/Conference/VoipConferenceActiveSpeakerView.swift @@ -368,6 +368,15 @@ class VoipConferenceActiveSpeakerView: UIView, UICollectionViewDataSource, UICol //Rotation layoutRotatableElements() + + //Appearance + UIDeviceBridge.displayModeSwitched.observe { _ in + fullScreenMutableView.backgroundColor = ControlsViewModel.shared.fullScreenMode.value == true ? .black : VoipTheme.voipBackgroundColor.get() + self.fullScreenOpaqueMasqForNotchedDevices.backgroundColor = fullScreenMutableView.backgroundColor + self.activeSpeakerView.backgroundColor = VoipTheme.voipParticipantBackgroundColor.get() + self.pause.backgroundColor = self.activeSpeakerAvatar.backgroundColor + self.reloadData() + } } diff --git a/Classes/Swift/Voip/Views/Fragments/Conference/VoipConferenceAudioOnlyView.swift b/Classes/Swift/Voip/Views/Fragments/Conference/VoipConferenceAudioOnlyView.swift index 664fb7aa6..6996191d8 100644 --- a/Classes/Swift/Voip/Views/Fragments/Conference/VoipConferenceAudioOnlyView.swift +++ b/Classes/Swift/Voip/Views/Fragments/Conference/VoipConferenceAudioOnlyView.swift @@ -148,7 +148,13 @@ class VoipConferenceAudioOnlyView: UIView, UICollectionViewDataSource, UICollect grid.matchParentDimmensions().done() headerView.matchParentSideBorders().alignParentTop().done() - + + //Appearance + UIDeviceBridge.displayModeSwitched.observe { _ in + self.gridContainer.backgroundColor = VoipTheme.voipBackgroundColor.get() + self.reloadData() + } + } diff --git a/Classes/Swift/Voip/Views/Fragments/Conference/VoipConferenceDisplayModeSelectionView.swift b/Classes/Swift/Voip/Views/Fragments/Conference/VoipConferenceDisplayModeSelectionView.swift index fac51445a..90defb198 100644 --- a/Classes/Swift/Voip/Views/Fragments/Conference/VoipConferenceDisplayModeSelectionView.swift +++ b/Classes/Swift/Voip/Views/Fragments/Conference/VoipConferenceDisplayModeSelectionView.swift @@ -39,9 +39,16 @@ import linphonesw optionsListView.delegate = self optionsListView.register(ConferenceDisplayModeSelectionCell.self, forCellReuseIdentifier: "ConferenceDisplayModeSelectionCell") optionsListView.separatorStyle = .singleLine - optionsListView.separatorColor = VoipTheme.light_grey_color + optionsListView.separatorColor = VoipTheme.separatorColor.get() optionsListView.isScrollEnabled = false - super.contentView.backgroundColor = .white + + UIDeviceBridge.displayModeSwitched.readCurrentAndObserve { _ in + super.contentView.backgroundColor = VoipTheme.voipBackgroundBWColor.get() + self.optionsListView.backgroundColor = VoipTheme.voipBackgroundBWColor.get() + self.optionsListView.separatorColor = VoipTheme.separatorColor.get() + self.optionsListView.reloadData() + } + } // TableView datasource delegate @@ -63,6 +70,7 @@ import linphonesw ConferenceViewModel.shared.conferenceDisplayMode.value = .Grid }, image:(UIImage(named: "voip_conference_mosaic")?.tinted(with: VoipTheme.voipDrawableColor.get())!)!) cell.isUserInteractionEnabled = ConferenceViewModel.shared.conferenceParticipantDevices.value!.count <= ConferenceViewModel.shared.maxParticipantsForMosaicLayout + cell.isSelected = ConferenceViewModel.shared.conferenceDisplayMode.value == .Grid } if (indexPath.row == 1) { cell.setOption(title: VoipTexts.conference_display_mode_active_speaker, onSelectAction: { @@ -70,6 +78,7 @@ import linphonesw ConferenceViewModel.shared.conferenceDisplayMode.value = .ActiveSpeaker }, image:(UIImage(named: "voip_conference_active_speaker")?.tinted(with: VoipTheme.voipDrawableColor.get())!)!) cell.isUserInteractionEnabled = true + cell.isSelected = ConferenceViewModel.shared.conferenceDisplayMode.value == .ActiveSpeaker } if (indexPath.row == 2) { @@ -78,6 +87,7 @@ import linphonesw ConferenceViewModel.shared.conferenceDisplayMode.value = .AudioOnly }, image:(UIImage(named: "voip_conference_audio_only")?.tinted(with: VoipTheme.voipDrawableColor.get())!)!) cell.isUserInteractionEnabled = true + cell.isSelected = ConferenceViewModel.shared.conferenceDisplayMode.value == .AudioOnly } cell.separatorInset = .zero @@ -146,6 +156,8 @@ class ConferenceDisplayModeSelectionCell : UITableViewCell { contentView.addSubview(icon) icon.size(w: icon_size, h: icon_size).alignParentRight(withMargin: side_margins).centerY().done() radio.isUserInteractionEnabled = false + contentView.backgroundColor = .clear + backgroundColor = .clear } required init?(coder: NSCoder) { diff --git a/Classes/Swift/Voip/Views/Fragments/Conference/VoipConferenceGridView.swift b/Classes/Swift/Voip/Views/Fragments/Conference/VoipConferenceGridView.swift index 7043d5478..c5c34e5bc 100644 --- a/Classes/Swift/Voip/Views/Fragments/Conference/VoipConferenceGridView.swift +++ b/Classes/Swift/Voip/Views/Fragments/Conference/VoipConferenceGridView.swift @@ -182,6 +182,13 @@ class VoipConferenceGridView: UIView, UICollectionViewDataSource, UICollectionVi self.reloadData() } } + + //Appearance + UIDeviceBridge.displayModeSwitched.observe { _ in + self.gridContainer.backgroundColor = ControlsViewModel.shared.fullScreenMode.value == true ? .black : VoipTheme.voipBackgroundColor.get() + self.reloadData() + } + } diff --git a/Classes/Swift/Voip/Views/Fragments/DismissableView.swift b/Classes/Swift/Voip/Views/Fragments/DismissableView.swift index 9bb1f7d9b..68434dcb9 100644 --- a/Classes/Swift/Voip/Views/Fragments/DismissableView.swift +++ b/Classes/Swift/Voip/Views/Fragments/DismissableView.swift @@ -51,6 +51,10 @@ class DismissableView: UIView { self.addSubview(contentView) contentView.alignUnder(view: headerView).matchParentSideBorders().alignParentBottom().done() + + UIDeviceBridge.displayModeSwitched.readCurrentAndObserve { _ in + self.headerView.backgroundColor = VoipTheme.voipToolbarBackgroundColor.get() + } } diff --git a/Classes/Swift/Voip/Views/Fragments/ParticipantsList/ParticipantsListView.swift b/Classes/Swift/Voip/Views/Fragments/ParticipantsList/ParticipantsListView.swift index 59f60e183..e58a6109f 100644 --- a/Classes/Swift/Voip/Views/Fragments/ParticipantsList/ParticipantsListView.swift +++ b/Classes/Swift/Voip/Views/Fragments/ParticipantsList/ParticipantsListView.swift @@ -71,7 +71,12 @@ import linphonesw noParticipantsLabel.center().matchParentSideBorders(insetedByDx: side_margin).done() noParticipantsLabel.isHidden = ConferenceViewModel.shared.conferenceParticipants.value?.count ?? 0 > 0 noParticipantsLabel.numberOfLines = 2 - + self.participantsListTableView.backgroundColor = VoipTheme.voipBackgroundBWColor.get() + + UIDeviceBridge.displayModeSwitched.observe { _ in + self.participantsListTableView.backgroundColor = VoipTheme.voipBackgroundBWColor.get() + self.participantsListTableView.reloadData() + } } diff --git a/Classes/Swift/Voip/Views/Fragments/ParticipantsList/VoipParticipantCell.swift b/Classes/Swift/Voip/Views/Fragments/ParticipantsList/VoipParticipantCell.swift index adb75de17..bf0db4695 100644 --- a/Classes/Swift/Voip/Views/Fragments/ParticipantsList/VoipParticipantCell.swift +++ b/Classes/Swift/Voip/Views/Fragments/ParticipantsList/VoipParticipantCell.swift @@ -133,7 +133,8 @@ class VoipParticipantCell: UITableViewCell { isAdminView.leadingAnchor.constraint(greaterThanOrEqualTo: leadingAnchor).isActive = true isAdminView.trailingAnchor.constraint(equalTo: trailingAnchor).isActive = true isAdminView.matchParentHeight().toRightOf(nameAddress).alignParentRight(withMargin: dismiss_right_margin).done() - + contentView.backgroundColor = .clear + backgroundColor = .clear } required init?(coder: NSCoder) { diff --git a/Classes/Swift/Voip/Widgets/Avatar.swift b/Classes/Swift/Voip/Widgets/Avatar.swift index 6e63fd2a9..919dfc414 100644 --- a/Classes/Swift/Voip/Widgets/Avatar.swift +++ b/Classes/Swift/Voip/Widgets/Avatar.swift @@ -46,6 +46,10 @@ class Avatar : UIView { iconImageView.backgroundColor = .white initialsLabel.matchParentSideBorders().matchParentHeight().done() iconImageView.matchParentDimmensions().done() + UIDeviceBridge.displayModeSwitched.observe { _ in + self.initialsLabel.applyStyle(textStyle) + self.backgroundColor = color.get() + } } diff --git a/Classes/Swift/Voip/Widgets/CallControlButton.swift b/Classes/Swift/Voip/Widgets/CallControlButton.swift index 474926248..595a4a548 100644 --- a/Classes/Swift/Voip/Widgets/CallControlButton.swift +++ b/Classes/Swift/Voip/Widgets/CallControlButton.swift @@ -76,6 +76,9 @@ class CallControlButton : ButtonWithStateBackgrounds { onClick { self.onClickAction?() } + UIDeviceBridge.displayModeSwitched.observe { _ in + self.applyTintedIcons(tintedIcons: buttonTheme.tintableStateIcons) + } } diff --git a/Classes/Swift/Voip/Widgets/FormButton.swift b/Classes/Swift/Voip/Widgets/FormButton.swift index 618491852..65a63f7b8 100644 --- a/Classes/Swift/Voip/Widgets/FormButton.swift +++ b/Classes/Swift/Voip/Widgets/FormButton.swift @@ -42,9 +42,11 @@ class FormButton : ButtonWithStateBackgrounds { super.init(backgroundStateColors: backgroundStateColors) layer.cornerRadius = button_radius clipsToBounds = true - applyTitleStyle(bold ? VoipTheme.form_button_bold : VoipTheme.form_button_light) height(button_height).done() addSidePadding() + UIDeviceBridge.displayModeSwitched.readCurrentAndObserve { _ in + self.applyTitleStyle(bold ? VoipTheme.form_button_bold : VoipTheme.form_button_light) + } } convenience init (title:String, backgroundStateColors: [UInt: LightDarkColor], bold:Bool = true, fixedSize:Bool = true) { diff --git a/Classes/Swift/Voip/Widgets/StyledDatePicker.swift b/Classes/Swift/Voip/Widgets/StyledDatePicker.swift index 2bcb22615..ca4cd6d20 100644 --- a/Classes/Swift/Voip/Widgets/StyledDatePicker.swift +++ b/Classes/Swift/Voip/Widgets/StyledDatePicker.swift @@ -58,23 +58,29 @@ class StyledDatePicker: UIView { datePicker.matchParentDimmensions().done() formattedLabel.isUserInteractionEnabled = false - formattedLabel.backgroundColor = VoipTheme.voipFormBackgroundColor.get() addSubview(formattedLabel) formattedLabel.matchParentDimmensions().done() - let chevron = UIImageView(image: UIImage(named: "chevron_list_close")) + let chevron = UIImageView() + + addSubview(chevron) chevron.alignParentRight(withMargin: chevron_margin).centerY().done() chevron.isHidden = readOnly - setFormInputBackground(readOnly:readOnly) height(form_input_height).done() - - if (readOnly) { - formattedLabel.textColor = formattedLabel.textColor.withAlphaComponent(0.5) - } + isUserInteractionEnabled = !readOnly self.liveValue = liveValue + + UIDeviceBridge.displayModeSwitched.readCurrentAndObserve { _ in + self.setFormInputBackground(readOnly:readOnly) + self.formattedLabel.backgroundColor = VoipTheme.voipFormBackgroundColor.get() + chevron.image = UIImage(named: "chevron_list_close")?.tinted(with: VoipTheme.voipDrawableColor.get()) + if (readOnly) { + self.formattedLabel.textColor = self.formattedLabel.textColor.withAlphaComponent(0.5) + } + } } diff --git a/Classes/Swift/Voip/Widgets/StyledLabel.swift b/Classes/Swift/Voip/Widgets/StyledLabel.swift index 29c15da3e..634af1e42 100644 --- a/Classes/Swift/Voip/Widgets/StyledLabel.swift +++ b/Classes/Swift/Voip/Widgets/StyledLabel.swift @@ -29,6 +29,9 @@ class StyledLabel: UILabel { super.init(frame: .zero) self.text = text applyStyle(style) + UIDeviceBridge.displayModeSwitched.observe { _ in + self.applyStyleColors(style) + } } } diff --git a/Classes/Swift/Voip/Widgets/StyledTextView.swift b/Classes/Swift/Voip/Widgets/StyledTextView.swift index 2230dc40d..f404c9bdf 100644 --- a/Classes/Swift/Voip/Widgets/StyledTextView.swift +++ b/Classes/Swift/Voip/Widgets/StyledTextView.swift @@ -50,7 +50,6 @@ class StyledTextView: UITextView, UITextViewDelegate { super.init(frame:.zero, textContainer: nil) textContainer.maximumNumberOfLines = maxLines applyStyle(style) - setFormInputBackground(readOnly:readOnly) placeHolder.map { self.placeholder = $0 } @@ -66,6 +65,10 @@ class StyledTextView: UITextView, UITextViewDelegate { textColor = textColor?.withAlphaComponent(0.5) } isUserInteractionEnabled = !readOnly + UIDeviceBridge.displayModeSwitched.readCurrentAndObserve { _ in + self.applyStyleColors(style) + self.setFormInputBackground(readOnly:readOnly) + } } func textViewDidBeginEditing(_ textView: UITextView) { diff --git a/Classes/Swift/Voip/Widgets/StyledValuePicker.swift b/Classes/Swift/Voip/Widgets/StyledValuePicker.swift index 979e61c30..d19e0a422 100644 --- a/Classes/Swift/Voip/Widgets/StyledValuePicker.swift +++ b/Classes/Swift/Voip/Widgets/StyledValuePicker.swift @@ -45,7 +45,6 @@ class StyledValuePicker: UIView { super.init(frame: .zero) formattedLabel.isUserInteractionEnabled = false - formattedLabel.backgroundColor = VoipTheme.voipFormBackgroundColor.get() liveIndex.value.map { formattedLabel.text = " "+options[$0] } if (readOnly) { @@ -55,25 +54,20 @@ class StyledValuePicker: UIView { addSubview(formattedLabel) formattedLabel.alignParentLeft().alignParentRight(withMargin: (readOnly ? chevron_margin : form_input_height)).matchParentHeight().done() - let chevron = UIImageView(image: UIImage(named: "chevron_list_close")) + let chevron = UIImageView() + addSubview(chevron) chevron.alignParentRight(withMargin: chevron_margin).centerY().done() chevron.isHidden = readOnly - setFormInputBackground(readOnly:readOnly) - - DropDown.appearance().textColor = VoipTheme.conference_scheduling_font.fgColor.get() - DropDown.appearance().selectedTextColor = VoipTheme.conference_scheduling_font.fgColor.get() + DropDown.appearance().textFont = formattedLabel.font - DropDown.appearance().backgroundColor = .white - DropDown.appearance().selectionBackgroundColor = VoipTheme.light_grey_color DropDown.appearance().cellHeight = form_input_height dropDown.anchorView = self dropDown.bottomOffset = CGPoint(x: 0, y:(dropDown.anchorView?.plainView.bounds.height)!) dropDown.dataSource = options - dropDown.backgroundColor = .white dropDown.width = dropdown_width dropDown.selectionAction = { [unowned self] (index: Int, item: String) in @@ -96,6 +90,17 @@ class StyledValuePicker: UIView { } isUserInteractionEnabled = !readOnly + UIDeviceBridge.displayModeSwitched.readCurrentAndObserve { _ in + chevron.image = UIImage(named: "chevron_list_close")?.tinted(with: VoipTheme.voipDrawableColor.get()) + self.formattedLabel.backgroundColor = VoipTheme.voipFormBackgroundColor.get() + DropDown.appearance().textColor = VoipTheme.conference_scheduling_font.fgColor.get() + DropDown.appearance().selectedTextColor = VoipTheme.conference_scheduling_font.fgColor.get() + DropDown.appearance().backgroundColor = VoipTheme.voipFormBackgroundColor.get() + DropDown.appearance().selectionBackgroundColor = VoipTheme.backgroundWhiteBlack.get() + self.dropDown.backgroundColor = VoipTheme.backgroundWhiteBlack.get() + self.setFormInputBackground(readOnly:readOnly) + } + } func setIndex(index: Int) {