diff --git a/NextcloudTalk.xcodeproj/project.pbxproj b/NextcloudTalk.xcodeproj/project.pbxproj index af09f41a3..4eaca14c4 100644 --- a/NextcloudTalk.xcodeproj/project.pbxproj +++ b/NextcloudTalk.xcodeproj/project.pbxproj @@ -38,7 +38,6 @@ 1F98DF9C28E7484700E05174 /* ReferenceDeckView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F98DF9B28E7484700E05174 /* ReferenceDeckView.swift */; }; 1F98DF9E28E7485000E05174 /* ReferenceDeckView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1F98DF9D28E7485000E05174 /* ReferenceDeckView.xib */; }; 1FA20C8A284001D80062B4F3 /* DebounceWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FA20C89284001D80062B4F3 /* DebounceWebView.swift */; }; - 1FADF2E528EAE28F0074A532 /* iOS13Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1FADF2E428EAE28F0074A532 /* iOS13Main.storyboard */; }; 1FB52E762842C75E00AC741B /* QRCodeLoginController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FB52E752842C75E00AC741B /* QRCodeLoginController.swift */; }; 1FB6678F28CE381300D29F8D /* SubtitleTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FB6678E28CE381300D29F8D /* SubtitleTableViewCell.swift */; }; 1FD9182928C55A73009092AB /* BGTaskHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD9182828C55A73009092AB /* BGTaskHelper.swift */; }; @@ -393,7 +392,6 @@ 1F98DF9B28E7484700E05174 /* ReferenceDeckView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReferenceDeckView.swift; sourceTree = ""; }; 1F98DF9D28E7485000E05174 /* ReferenceDeckView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ReferenceDeckView.xib; sourceTree = ""; }; 1FA20C89284001D80062B4F3 /* DebounceWebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebounceWebView.swift; sourceTree = ""; }; - 1FADF2E428EAE28F0074A532 /* iOS13Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = iOS13Main.storyboard; sourceTree = ""; }; 1FB52E752842C75E00AC741B /* QRCodeLoginController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRCodeLoginController.swift; sourceTree = ""; }; 1FB6678E28CE381300D29F8D /* SubtitleTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubtitleTableViewCell.swift; sourceTree = ""; }; 1FD9182828C55A73009092AB /* BGTaskHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BGTaskHelper.swift; sourceTree = ""; }; @@ -920,7 +918,6 @@ 2C6085C11FB1063700B36A6E /* NextcloudTalk.entitlements */, 2CA1CCAB1F067F35002FE6A2 /* Images.xcassets */, 2C0574941EDD9E8E00D9E7F2 /* Info.plist */, - 1FADF2E428EAE28F0074A532 /* iOS13Main.storyboard */, 2C05748C1EDD9E8E00D9E7F2 /* Main.storyboard */, 2C1D13A1253760EE00EC0533 /* LaunchScreen.xib */, 2C7F47AC20289B9600081CC7 /* Localizable.strings */, @@ -1645,7 +1642,6 @@ 2CC007BE20D8F24B0096D91F /* RoomCreation2TableViewController.xib in Resources */, 2CC32E9327F45AE000BB8C39 /* ReactionsViewCell.xib in Resources */, 2C330372255E6EBC00BDB4E4 /* InfoPlist.strings in Resources */, - 1FADF2E528EAE28F0074A532 /* iOS13Main.storyboard in Resources */, 2C78EFA11F828C41008AFA74 /* CallViewController.xib in Resources */, 2C3780C5210F4A26003F9AE8 /* HeaderWithButton.xib in Resources */, 2CC007B920D8139D0096D91F /* RoomCreationTableViewController.xib in Resources */, diff --git a/NextcloudTalk/AppDelegate.m b/NextcloudTalk/AppDelegate.m index f1dd92b4a..b9081c419 100644 --- a/NextcloudTalk/AppDelegate.m +++ b/NextcloudTalk/AppDelegate.m @@ -84,22 +84,12 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( [self registerBackgroundFetchTask]; - if (@available(iOS 14.0, *)) { - [NCUserInterfaceController sharedInstance].mainSplitViewController = (NCSplitViewController *) self.window.rootViewController; - [NCUserInterfaceController sharedInstance].mainViewController = (NCSplitViewController *) self.window.rootViewController; - [NCUserInterfaceController sharedInstance].roomsTableViewController = [NCUserInterfaceController sharedInstance].mainSplitViewController.viewControllers.firstObject.childViewControllers.firstObject; - - if (@available(iOS 14.5, *)) { - [NCUserInterfaceController sharedInstance].mainSplitViewController.displayModeButtonVisibility = UISplitViewControllerDisplayModeButtonVisibilityNever; - } - } else { - // We're using iOS 14 specific APIs for splitView, so fall back in case they're not supported - UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iOS13Main" bundle:[NSBundle mainBundle]]; - UIViewController *vc = [storyboard instantiateInitialViewController]; - - self.window.rootViewController = vc; + [NCUserInterfaceController sharedInstance].mainSplitViewController = (NCSplitViewController *) self.window.rootViewController; + [NCUserInterfaceController sharedInstance].mainViewController = (NCSplitViewController *) self.window.rootViewController; + [NCUserInterfaceController sharedInstance].roomsTableViewController = [NCUserInterfaceController sharedInstance].mainSplitViewController.viewControllers.firstObject.childViewControllers.firstObject; - [NCUserInterfaceController sharedInstance].mainViewController = (NCNavigationController *) self.window.rootViewController; + if (@available(iOS 14.5, *)) { + [NCUserInterfaceController sharedInstance].mainSplitViewController.displayModeButtonVisibility = UISplitViewControllerDisplayModeButtonVisibilityNever; } return YES; diff --git a/NextcloudTalk/CallKitManager.m b/NextcloudTalk/CallKitManager.m index d221f38f2..43e7bb5c7 100644 --- a/NextcloudTalk/CallKitManager.m +++ b/NextcloudTalk/CallKitManager.m @@ -99,7 +99,7 @@ + (BOOL)isCallKitAvailable - (CXProvider *)provider { if (!_provider) { - CXProviderConfiguration *configuration = [[CXProviderConfiguration alloc] initWithLocalizedName:talkAppName]; + CXProviderConfiguration *configuration = [[CXProviderConfiguration alloc] init]; configuration.supportsVideo = YES; configuration.maximumCallGroups = 1; configuration.maximumCallsPerCallGroup = 1; diff --git a/NextcloudTalk/ChatMessageTableViewCell.m b/NextcloudTalk/ChatMessageTableViewCell.m index 75eeec346..b7e665443 100644 --- a/NextcloudTalk/ChatMessageTableViewCell.m +++ b/NextcloudTalk/ChatMessageTableViewCell.m @@ -450,12 +450,10 @@ - (void)setUserStatus:(NSString *)userStatus _userStatusImageView.contentMode = UIViewContentModeCenter; _userStatusImageView.layer.cornerRadius = 6; _userStatusImageView.clipsToBounds = YES; - _userStatusImageView.backgroundColor = self.backgroundColor; - if (@available(iOS 14.0, *)) { - // When a background color is set directly to the cell it seems that there is no background configuration. - // In this class, even when no background color is set, the background configuration is nil. - _userStatusImageView.backgroundColor = (self.backgroundColor) ? self.backgroundColor : [[self backgroundConfiguration] backgroundColor]; - } + + // When a background color is set directly to the cell it seems that there is no background configuration. + // In this class, even when no background color is set, the background configuration is nil. + _userStatusImageView.backgroundColor = (self.backgroundColor) ? self.backgroundColor : [[self backgroundConfiguration] backgroundColor]; } } diff --git a/NextcloudTalk/ContactsTableViewCell.m b/NextcloudTalk/ContactsTableViewCell.m index 1f212b83a..4b471049a 100644 --- a/NextcloudTalk/ContactsTableViewCell.m +++ b/NextcloudTalk/ContactsTableViewCell.m @@ -86,11 +86,9 @@ - (void)setUserStatus:(NSString *)userStatus _userStatusImageView.contentMode = UIViewContentModeCenter; _userStatusImageView.layer.cornerRadius = 10; _userStatusImageView.clipsToBounds = YES; - _userStatusImageView.backgroundColor = self.backgroundColor; - if (@available(iOS 14.0, *)) { - // When a background color is set directly to the cell it seems that there is no background configuration. - _userStatusImageView.backgroundColor = (self.backgroundColor) ? self.backgroundColor : [[self backgroundConfiguration] backgroundColor]; - } + + // When a background color is set directly to the cell it seems that there is no background configuration. + _userStatusImageView.backgroundColor = (self.backgroundColor) ? self.backgroundColor : [[self backgroundConfiguration] backgroundColor]; } } diff --git a/NextcloudTalk/DebounceWebView.swift b/NextcloudTalk/DebounceWebView.swift index cbdac1703..8b0774d61 100644 --- a/NextcloudTalk/DebounceWebView.swift +++ b/NextcloudTalk/DebounceWebView.swift @@ -35,7 +35,7 @@ class DebounceWebView: WKWebView { previousPasteTimestamp = currentPasteTimestamp } - + super.paste(sender) } } diff --git a/NextcloudTalk/DiagnosticsTableViewController.swift b/NextcloudTalk/DiagnosticsTableViewController.swift index 85280ece0..ac2008567 100644 --- a/NextcloudTalk/DiagnosticsTableViewController.swift +++ b/NextcloudTalk/DiagnosticsTableViewController.swift @@ -396,7 +396,7 @@ class DiagnosticsTableViewController: UITableViewController { cell.textLabel?.text = NSLocalizedString("Location access", comment: "") if CLLocationManager.locationServicesEnabled() { - switch CLLocationManager.authorizationStatus() { + switch CLLocationManager().authorizationStatus { case .authorizedAlways, .authorizedWhenInUse: cell.detailTextLabel?.text = allowedString diff --git a/NextcloudTalk/NCNotificationController.m b/NextcloudTalk/NCNotificationController.m index e9d7cfb03..aec521b26 100644 --- a/NextcloudTalk/NCNotificationController.m +++ b/NextcloudTalk/NCNotificationController.m @@ -378,7 +378,7 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNot { // Called when a notification is delivered to a foreground app. [[NSNotificationCenter defaultCenter] postNotificationName:NCNotificationControllerWillPresentNotification object:self userInfo:nil]; - completionHandler(UNNotificationPresentationOptionAlert); + completionHandler(UNNotificationPresentationOptionList | UNNotificationPresentationOptionBanner); // Remove the notification from Notification Center if it is from the active account NSString *notificationAccountId = [notification.request.content.userInfo objectForKey:@"accountId"]; diff --git a/NextcloudTalk/NCSplitViewController.swift b/NextcloudTalk/NCSplitViewController.swift index 56c879199..cf2fa5767 100644 --- a/NextcloudTalk/NCSplitViewController.swift +++ b/NextcloudTalk/NCSplitViewController.swift @@ -27,7 +27,7 @@ override func viewDidLoad() { super.viewDidLoad() self.delegate = self - self.preferredDisplayMode = .allVisible + self.preferredDisplayMode = .oneBesideSecondary // As we always show the columns on iPads, we don't need gesture support self.presentsWithGesture = false @@ -46,48 +46,44 @@ return } - if #available(iOS 14.0, *) { - if let navController = self.viewController(for: .secondary) as? UINavigationController, - viewController is RoomsTableViewController { - - // MovingFromParentViewController is always false in case of a rootViewController, - // because of this, the chat will never be left in NCChatViewController - // (see viewDidDisappear). So we have to leave the chat here, if collapsed - if let chatViewController = getActiveChatViewController() { - chatViewController.leaveChat() - } + if let navController = self.viewController(for: .secondary) as? UINavigationController, + viewController is RoomsTableViewController { - // Make sure the chatViewController gets properly deallocated - setViewController(placeholderViewController, for: .secondary) - navController.setViewControllers([placeholderViewController], animated: false) + // MovingFromParentViewController is always false in case of a rootViewController, + // because of this, the chat will never be left in NCChatViewController + // (see viewDidDisappear). So we have to leave the chat here, if collapsed + if let chatViewController = getActiveChatViewController() { + chatViewController.leaveChat() } + + // Make sure the chatViewController gets properly deallocated + setViewController(placeholderViewController, for: .secondary) + navController.setViewControllers([placeholderViewController], animated: false) } } override func showDetailViewController(_ vc: UIViewController, sender: Any?) { - if #available(iOS 14.0, *) { - if !isCollapsed { - // When another room is selected while there's still an active chatViewController - // we need to make sure the active one is removed (applies to expanded mode only) - if let navController = self.viewController(for: .secondary) as? UINavigationController { - navController.popToRootViewController(animated: false) - } + if !isCollapsed { + // When another room is selected while there's still an active chatViewController + // we need to make sure the active one is removed (applies to expanded mode only) + if let navController = self.viewController(for: .secondary) as? UINavigationController { + navController.popToRootViewController(animated: false) } + } - super.showDetailViewController(vc, sender: sender) + super.showDetailViewController(vc, sender: sender) - if isCollapsed { - // Make sure we don't have accidentally a placeholderView in our navigation - // while in collapsed mode - if let navController = self.viewController(for: .secondary) as? UINavigationController, - vc is NCChatViewController { + if isCollapsed { + // Make sure we don't have accidentally a placeholderView in our navigation + // while in collapsed mode + if let navController = self.viewController(for: .secondary) as? UINavigationController, + vc is NCChatViewController { - // Only set the viewController if there's actually an active one shown by showDetailViewController - // Otherwise UI might break or crash (view not loaded correctly) - // This might happen if a chatViewController is shown by a push notification - if self.hasActiveChatViewController() { - navController.setViewControllers([vc], animated: false) - } + // Only set the viewController if there's actually an active one shown by showDetailViewController + // Otherwise UI might break or crash (view not loaded correctly) + // This might happen if a chatViewController is shown by a push notification + if self.hasActiveChatViewController() { + navController.setViewControllers([vc], animated: false) } } } @@ -102,21 +98,19 @@ } func getActiveViewController() -> T? { - if #available(iOS 14.0, *) { - // In case we have a collapsed view, we need to retrieve the viewController this way - if let navController = self.viewController(for: .secondary) as? UINavigationController { - for secondaryViewController in navController.viewControllers { - if let activeViewController = secondaryViewController as? T { - return activeViewController - } + // In case we have a collapsed view, we need to retrieve the viewController this way + if let navController = self.viewController(for: .secondary) as? UINavigationController { + for secondaryViewController in navController.viewControllers { + if let activeViewController = secondaryViewController as? T { + return activeViewController } } + } - if let navController = self.viewController(for: .primary) as? UINavigationController { - for primaryViewController in navController.viewControllers { - if let activeViewController = primaryViewController as? T { - return activeViewController - } + if let navController = self.viewController(for: .primary) as? UINavigationController { + for primaryViewController in navController.viewControllers { + if let activeViewController = primaryViewController as? T { + return activeViewController } } } @@ -124,7 +118,6 @@ return nil } - @available(iOS 14.0, *) func splitViewController(_ svc: UISplitViewController, topColumnForCollapsingToProposedTopColumn proposedTopColumn: UISplitViewController.Column) -> UISplitViewController.Column { // When we rotate the device and the splitViewController gets collapsed // we need to determine if we're still in a chat or not. @@ -136,7 +129,6 @@ return .primary } - @available(iOS 14.0, *) func splitViewControllerDidExpand(_ svc: UISplitViewController) { if let navController = self.viewController(for: .secondary) as? UINavigationController { if hasActiveChatViewController() { @@ -151,7 +143,6 @@ } } - @available(iOS 14.0, *) func splitViewControllerDidCollapse(_ svc: UISplitViewController) { if hasActiveChatViewController() { // If we collapse (only show one column) and there's a active chatViewController @@ -162,7 +153,6 @@ } } - @available(iOS 14.0, *) func popSecondaryColumnToRootViewController() { if let navController = self.viewController(for: .secondary) as? UINavigationController { if let chatViewController = getActiveChatViewController() { diff --git a/NextcloudTalk/NCUserInterfaceController.m b/NextcloudTalk/NCUserInterfaceController.m index 91beec052..185433f13 100644 --- a/NextcloudTalk/NCUserInterfaceController.m +++ b/NextcloudTalk/NCUserInterfaceController.m @@ -325,10 +325,8 @@ - (void)presentConversationsList { [_mainViewController dismissViewControllerAnimated:YES completion:nil]; - if (@available(iOS 14.0, *)) { - [_mainSplitViewController popSecondaryColumnToRootViewController]; - [_mainSplitViewController showColumn:UISplitViewControllerColumnPrimary]; - } + [_mainSplitViewController popSecondaryColumnToRootViewController]; + [_mainSplitViewController showColumn:UISplitViewControllerColumnPrimary]; } @@ -336,25 +334,21 @@ - (void)presentChatViewController:(NCChatViewController *)chatViewController { [self presentConversationsList]; - if (@available(iOS 14.0, *)) { - if (_mainSplitViewController.transitionCoordinator == nil) { - // No ongoing animations -> show chatViewController directly - [_mainSplitViewController showDetailViewController:chatViewController sender:self]; - } else { - // Wait until the splitViewController finished all it's animations. - // Otherwise the chatViewController might end up in the wrong column. - // This mainly happens when being in a conversation and tapping a push notification - // of another conversation. - [_mainSplitViewController.transitionCoordinator animateAlongsideTransition:^(id _Nonnull context) { - // Nothing to do here, we are only interested in the completion block - } completion:^(id _Nonnull context) { - dispatch_async(dispatch_get_main_queue(), ^{ - [self->_mainSplitViewController showDetailViewController:chatViewController sender:self]; - }); - }]; - } + if (_mainSplitViewController.transitionCoordinator == nil) { + // No ongoing animations -> show chatViewController directly + [_mainSplitViewController showDetailViewController:chatViewController sender:self]; } else { - [(UINavigationController *)_mainViewController pushViewController:chatViewController animated:YES]; + // Wait until the splitViewController finished all it's animations. + // Otherwise the chatViewController might end up in the wrong column. + // This mainly happens when being in a conversation and tapping a push notification + // of another conversation. + [_mainSplitViewController.transitionCoordinator animateAlongsideTransition:^(id _Nonnull context) { + // Nothing to do here, we are only interested in the completion block + } completion:^(id _Nonnull context) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self->_mainSplitViewController showDetailViewController:chatViewController sender:self]; + }); + }]; } [_roomsTableViewController setSelectedRoomToken:chatViewController.room.token]; diff --git a/NextcloudTalk/NCUtils.m b/NextcloudTalk/NCUtils.m index 91e1066c6..213ac6456 100644 --- a/NextcloudTalk/NCUtils.m +++ b/NextcloudTalk/NCUtils.m @@ -406,11 +406,7 @@ + (void)log:(NSString *)message + (BOOL)isiOSAppOnMac { - if (@available(iOS 14.0, *)) { - return [NSProcessInfo processInfo].isiOSAppOnMac; - } - - return false; + return [NSProcessInfo processInfo].isiOSAppOnMac; } + (NSString *)removeHTMLFromString:(NSString *)string diff --git a/NextcloudTalk/QRCodeLoginController.swift b/NextcloudTalk/QRCodeLoginController.swift index c869b317a..7fdf1bc49 100644 --- a/NextcloudTalk/QRCodeLoginController.swift +++ b/NextcloudTalk/QRCodeLoginController.swift @@ -21,15 +21,15 @@ import Foundation import QRCodeReader -@objc public protocol QRCodeLoginControllerDelegate { +@objc public protocol QRCodeLoginControllerDelegate { @objc func readLoginDetails(serverUrl: String?, user: String?, password: String?) } @objc public class QRCodeLoginController: NSObject, QRCodeReaderViewControllerDelegate { - + lazy var reader: QRCodeReader = QRCodeReader() weak var delegate: UIViewController? - + lazy var readerVC: QRCodeReaderViewController = { let builder = QRCodeReaderViewControllerBuilder { $0.reader = QRCodeReader(metadataObjectTypes: [.qr], captureDevicePosition: .back) @@ -37,40 +37,40 @@ import QRCodeReader $0.preferredStatusBarStyle = .lightContent $0.showOverlayView = true $0.rectOfInterest = CGRect(x: 0.2, y: 0.2, width: 0.6, height: 0.6) - + $0.reader.stopScanningWhenCodeIsFound = false } - + return QRCodeReaderViewController(builder: builder) }() - + override init() { - + } - + @objc public init(delegate: UIViewController) { self.delegate = delegate } - + @objc func scan() { guard checkScanPermissions() else { return } - + readerVC.modalPresentationStyle = .formSheet readerVC.delegate = self - + readerVC.completionBlock = { (_: QRCodeReaderResult?) in self.readerVC.dismiss(animated: true, completion: nil) } - + delegate?.present(readerVC, animated: true, completion: nil) } - + private func checkScanPermissions() -> Bool { do { return try QRCodeReader.supportsMetadataObjectTypes() } catch let error as NSError { let alert: UIAlertController - + switch error.code { case -11852: alert = UIAlertController( @@ -78,7 +78,7 @@ import QRCodeReader message: NSLocalizedString("Camera access is not allowed. Check your settings.", comment: ""), preferredStyle: .alert ) - + alert.addAction(UIAlertAction(title: NSLocalizedString("Settings", comment: ""), style: .default, handler: { _ in DispatchQueue.main.async { if let settingsURL = URL(string: UIApplication.openSettingsURLString) { @@ -86,7 +86,7 @@ import QRCodeReader } } })) - + alert.addAction(UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .cancel, handler: nil)) default: alert = UIAlertController( @@ -94,24 +94,24 @@ import QRCodeReader message: NSLocalizedString("Scanning QR Codes is not supported on this device.", comment: ""), preferredStyle: .alert ) - + alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .cancel, handler: nil)) } - + delegate?.present(alert, animated: true, completion: nil) - + return false } } - + public func reader(_ reader: QRCodeReaderViewController, didScanResult result: QRCodeReaderResult) { reader.stopScanning() - + if let urlComponents = NSURLComponents(string: result.value), var path = urlComponents.path, urlComponents.scheme == "nc", urlComponents.host == "login" { if path.starts(with: "/") { path.removeFirst() } - + if path.contains("user:") && path.contains("password:") && path.contains("server:") { let pathArray = path.components(separatedBy: "&") if pathArray.count == 3 { @@ -119,14 +119,14 @@ import QRCodeReader let user = pathArray[0].replacingOccurrences(of: "user:", with: "") let password = pathArray[1].replacingOccurrences(of: "password:", with: "") let serverUrl = pathArray[2].replacingOccurrences(of: "server:", with: "") - + (self.delegate as? QRCodeLoginControllerDelegate)?.readLoginDetails(serverUrl: serverUrl, user: user, password: password) return } } } } - + public func readerDidCancel(_ reader: QRCodeReaderViewController) { reader.stopScanning() } diff --git a/NextcloudTalk/ReferenceDefaultView.swift b/NextcloudTalk/ReferenceDefaultView.swift index 552aea7ef..76d53afdb 100644 --- a/NextcloudTalk/ReferenceDefaultView.swift +++ b/NextcloudTalk/ReferenceDefaultView.swift @@ -89,8 +89,6 @@ import Foundation referenceDescription.isHidden = true } - let activeAccount = NCDatabaseManager.sharedInstance().activeAccount() - if let thumbUrlString = reference["thumb"] as? String, let request = NCAPIController.sharedInstance().createReferenceThumbnailRequest(forUrl: thumbUrlString) { diff --git a/NextcloudTalk/RoomInfoTableViewController.m b/NextcloudTalk/RoomInfoTableViewController.m index 9ac67b9af..dbc9c765a 100644 --- a/NextcloudTalk/RoomInfoTableViewController.m +++ b/NextcloudTalk/RoomInfoTableViewController.m @@ -221,9 +221,8 @@ - (void)viewDidLoad _lobbyDatePicker = [[UIDatePicker alloc] init]; _lobbyDatePicker.datePickerMode = UIDatePickerModeDateAndTime; - if (@available(iOS 13.4, *)) { - _lobbyDatePicker.preferredDatePickerStyle = UIDatePickerStyleWheels; - } + _lobbyDatePicker.preferredDatePickerStyle = UIDatePickerStyleWheels; + _lobbyDateTextField = [[UITextField alloc] initWithFrame:CGRectMake(0, 00, 150, 30)]; _lobbyDateTextField.textAlignment = NSTextAlignmentRight; _lobbyDateTextField.placeholder = NSLocalizedString(@"Manual", @"TRANSLATORS this is used when no meeting start time is set and the meeting will be started manually"); diff --git a/NextcloudTalk/RoomTableViewCell.m b/NextcloudTalk/RoomTableViewCell.m index 633bb51ef..934863251 100644 --- a/NextcloudTalk/RoomTableViewCell.m +++ b/NextcloudTalk/RoomTableViewCell.m @@ -173,11 +173,9 @@ - (void)setUserStatus:(NSString *)userStatus _userStatusImageView.contentMode = UIViewContentModeCenter; _userStatusImageView.layer.cornerRadius = 10; _userStatusImageView.clipsToBounds = YES; - _userStatusImageView.backgroundColor = self.backgroundColor; - if (@available(iOS 14.0, *)) { - // When a background color is set directly to the cell it seems that there is no background configuration. - _userStatusImageView.backgroundColor = (self.backgroundColor) ? self.backgroundColor : [[self backgroundConfiguration] backgroundColor]; - } + + // When a background color is set directly to the cell it seems that there is no background configuration. + _userStatusImageView.backgroundColor = (self.backgroundColor) ? self.backgroundColor : [[self backgroundConfiguration] backgroundColor]; } } diff --git a/NextcloudTalk/RoomsTableViewController.m b/NextcloudTalk/RoomsTableViewController.m index 6bb9b7b8b..753be9d2c 100644 --- a/NextcloudTalk/RoomsTableViewController.m +++ b/NextcloudTalk/RoomsTableViewController.m @@ -243,11 +243,7 @@ - (void)viewWillAppear:(BOOL)animated self.clearsSelectionOnViewWillAppear = self.splitViewController.isCollapsed; - if (@available(iOS 14.0, *)) { - if (self.splitViewController.isCollapsed) { - [self setSelectedRoomToken:nil]; - } - } else { + if (self.splitViewController.isCollapsed) { [self setSelectedRoomToken:nil]; } } diff --git a/NextcloudTalk/SettingsTableViewController.swift b/NextcloudTalk/SettingsTableViewController.swift index 5db3a6734..65ece1c22 100644 --- a/NextcloudTalk/SettingsTableViewController.swift +++ b/NextcloudTalk/SettingsTableViewController.swift @@ -369,7 +369,7 @@ class SettingsTableViewController: UITableViewController, UITextFieldDelegate { } if isStoredResolution { - action.setValue(UIImage(named: "checkmark")?.withRenderingMode(_:.alwaysOriginal), forKey: "image") + action.setValue(UIImage(named: "checkmark")?.withRenderingMode(_: .alwaysOriginal), forKey: "image") } optionsActionSheet.addAction(action) } @@ -395,7 +395,7 @@ class SettingsTableViewController: UITableViewController, UITextFieldDelegate { self.tableView.reloadData() } if browser == defaultBrowser { - action.setValue(UIImage(named: "checkmark")?.withRenderingMode(_:.alwaysOriginal), forKey: "image") + action.setValue(UIImage(named: "checkmark")?.withRenderingMode(_: .alwaysOriginal), forKey: "image") } optionsActionSheet.addAction(action) } diff --git a/NextcloudTalk/ShareLocationViewController.m b/NextcloudTalk/ShareLocationViewController.m index e603c42f0..350f92612 100644 --- a/NextcloudTalk/ShareLocationViewController.m +++ b/NextcloudTalk/ShareLocationViewController.m @@ -136,8 +136,10 @@ - (void)viewDidLoad #pragma mark - CLLocationManagerDelegate -- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status +- (void)locationManagerDidChangeAuthorization:(CLLocationManager *)manager { + CLAuthorizationStatus status = manager.authorizationStatus; + _myLocationButton.hidden = YES; if (status == kCLAuthorizationStatusAuthorizedWhenInUse || status == kCLAuthorizationStatusAuthorizedAlways) { _myLocationButton.hidden = NO; @@ -274,18 +276,16 @@ - (void)hideDropPinGuideView - (void)searchForNearbyPlaces { - if (@available(iOS 14.0, *)) { - MKLocalPointsOfInterestRequest *request = [[MKLocalPointsOfInterestRequest alloc] initWithCoordinateRegion:self.mapView.region]; - MKLocalSearch *search = [[MKLocalSearch alloc] initWithPointsOfInterestRequest:request]; - [search startWithCompletionHandler:^(MKLocalSearchResponse * _Nullable response, NSError * _Nullable error) { - if (response) { - dispatch_async(dispatch_get_main_queue(), ^{ - self->_nearbyPlaces = response.mapItems; - [self.tableView reloadSections:[[NSIndexSet alloc] initWithIndex:kShareLocationSectionNearby] withRowAnimation:UITableViewRowAnimationNone]; - }); - } - }]; - } + MKLocalPointsOfInterestRequest *request = [[MKLocalPointsOfInterestRequest alloc] initWithCoordinateRegion:self.mapView.region]; + MKLocalSearch *search = [[MKLocalSearch alloc] initWithPointsOfInterestRequest:request]; + [search startWithCompletionHandler:^(MKLocalSearchResponse * _Nullable response, NSError * _Nullable error) { + if (response) { + dispatch_async(dispatch_get_main_queue(), ^{ + self->_nearbyPlaces = response.mapItems; + [self.tableView reloadSections:[[NSIndexSet alloc] initWithIndex:kShareLocationSectionNearby] withRowAnimation:UITableViewRowAnimationNone]; + }); + } + }]; } - (void)searchForPlacesWithString:(NSString *)searchString diff --git a/NextcloudTalk/UserStatusMessageViewController.swift b/NextcloudTalk/UserStatusMessageViewController.swift index aff6a0351..fa5399769 100644 --- a/NextcloudTalk/UserStatusMessageViewController.swift +++ b/NextcloudTalk/UserStatusMessageViewController.swift @@ -183,16 +183,14 @@ class UserStatusMessageViewController: UIViewController, UITextFieldDelegate { func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { if textField is EmojiTextField { - if #available(iOS 10.2, *) { - if string.isSingleEmoji == false { - self.setStatusIconInView(icon: nil) - } else { - self.setStatusIconInView(icon: string) - } - } else { + if string.isSingleEmoji == false { self.setStatusIconInView(icon: nil) + } else { + self.setStatusIconInView(icon: string) } + textField.endEditing(true) + return false } diff --git a/NextcloudTalk/VoiceMessageTranscribeViewController.m b/NextcloudTalk/VoiceMessageTranscribeViewController.m index 736135257..7fdd90638 100644 --- a/NextcloudTalk/VoiceMessageTranscribeViewController.m +++ b/NextcloudTalk/VoiceMessageTranscribeViewController.m @@ -53,33 +53,31 @@ - (void)viewDidLoad { self.navigationController.navigationBar.tintColor = [NCAppBranding themeTextColor]; self.navigationController.navigationBar.translucent = NO; self.navigationController.navigationBar.barTintColor = [NCAppBranding themeColor]; + + UIColor *themeColor = [NCAppBranding themeColor]; + UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init]; + [appearance configureWithOpaqueBackground]; + appearance.backgroundColor = themeColor; + appearance.titleTextAttributes = @{NSForegroundColorAttributeName:[NCAppBranding themeTextColor]}; + self.navigationItem.standardAppearance = appearance; + self.navigationItem.compactAppearance = appearance; + self.navigationItem.scrollEdgeAppearance = appearance; + + UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel + target:self action:@selector(closeViewController)]; - if (@available(iOS 13.0, *)) { - UIColor *themeColor = [NCAppBranding themeColor]; - UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init]; - [appearance configureWithOpaqueBackground]; - appearance.backgroundColor = themeColor; - appearance.titleTextAttributes = @{NSForegroundColorAttributeName:[NCAppBranding themeTextColor]}; - self.navigationItem.standardAppearance = appearance; - self.navigationItem.compactAppearance = appearance; - self.navigationItem.scrollEdgeAppearance = appearance; - - UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel - target:self action:@selector(closeViewController)]; - - self.navigationController.navigationBar.topItem.leftBarButtonItem = cancelButton; - - _activityIndicator = [[UIActivityIndicatorView alloc] init]; - _activityIndicator.color = [NCAppBranding themeTextColor]; - - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self->_activityIndicator]; - - [_activityIndicator startAnimating]; - - _supportedLocales = @[@"de", @"it", @"en", @"fr", @"es"]; - - [self checkPermissionAndStartTranscription]; - } + self.navigationController.navigationBar.topItem.leftBarButtonItem = cancelButton; + + _activityIndicator = [[UIActivityIndicatorView alloc] init]; + _activityIndicator.color = [NCAppBranding themeTextColor]; + + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self->_activityIndicator]; + + [_activityIndicator startAnimating]; + + _supportedLocales = @[@"de", @"it", @"en", @"fr", @"es"]; + + [self checkPermissionAndStartTranscription]; } - (void)closeViewController @@ -87,7 +85,7 @@ - (void)closeViewController [self dismissViewControllerAnimated:YES completion:nil]; } -- (void)checkPermissionAndStartTranscription API_AVAILABLE(ios(13.0)) +- (void)checkPermissionAndStartTranscription { [SFSpeechRecognizer requestAuthorization:^(SFSpeechRecognizerAuthorizationStatus status){ dispatch_async(dispatch_get_main_queue(), ^{ @@ -101,7 +99,7 @@ - (void)checkPermissionAndStartTranscription API_AVAILABLE(ios(13.0)) }]; } -- (void)showLocaleSelection API_AVAILABLE(ios(13.0)) +- (void)showLocaleSelection { UIAlertController *optionsActionSheet = [UIAlertController alertControllerWithTitle:nil message:nil @@ -137,7 +135,7 @@ - (void)showLocaleSelection API_AVAILABLE(ios(13.0)) [self presentViewController:optionsActionSheet animated:YES completion:nil]; } -- (void)transcribeWithLocale:(NSLocale *)locale API_AVAILABLE(ios(13.0)) +- (void)transcribeWithLocale:(NSLocale *)locale { SFSpeechRecognizer *speechRecognizer = [[SFSpeechRecognizer alloc] initWithLocale:locale]; SFSpeechURLRecognitionRequest *speechRecognitionRequest = [[SFSpeechURLRecognitionRequest alloc] initWithURL:_audioFileUrl]; diff --git a/NextcloudTalk/iOS13Main.storyboard b/NextcloudTalk/iOS13Main.storyboard deleted file mode 100644 index ec21ac0ea..000000000 --- a/NextcloudTalk/iOS13Main.storyboard +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -