diff --git a/Mac/Preferences/Accounts/AccountsNewsBlurWindowController.swift b/Mac/Preferences/Accounts/AccountsNewsBlurWindowController.swift index 00f47778e..e7a233041 100644 --- a/Mac/Preferences/Accounts/AccountsNewsBlurWindowController.swift +++ b/Mac/Preferences/Accounts/AccountsNewsBlurWindowController.swift @@ -128,11 +128,10 @@ class AccountsNewsBlurWindowController: NSWindowController { } // MARK: Autofill + func enableAutofill() { - if #available(macOS 11, *) { - usernameTextField.contentType = .username - passwordTextField.contentType = .password - } + + usernameTextField.contentType = .username + passwordTextField.contentType = .password } - } diff --git a/Mac/Preferences/Accounts/AccountsReaderAPIWindowController.swift b/Mac/Preferences/Accounts/AccountsReaderAPIWindowController.swift index b00d4646d..992b8c260 100644 --- a/Mac/Preferences/Accounts/AccountsReaderAPIWindowController.swift +++ b/Mac/Preferences/Accounts/AccountsReaderAPIWindowController.swift @@ -196,11 +196,10 @@ class AccountsReaderAPIWindowController: NSWindowController { } // MARK: Autofill + func enableAutofill() { - if #available(macOS 11, *) { - usernameTextField.contentType = .username - passwordTextField.contentType = .password - } + + usernameTextField.contentType = .username + passwordTextField.contentType = .password } - } diff --git a/Mac/Preferences/Accounts/AddAccountsView.swift b/Mac/Preferences/Accounts/AddAccountsView.swift index c8a496ad2..1a143d5c8 100644 --- a/Mac/Preferences/Accounts/AddAccountsView.swift +++ b/Mac/Preferences/Accounts/AddAccountsView.swift @@ -102,45 +102,24 @@ struct AddAccountsView: View { HStack(spacing: 12) { Spacer() - if #available(OSX 11.0, *) { - Button(action: { - parent?.dismiss(nil) - }, label: { - Text("Cancel") - .frame(width: 76) - }) - .help("Cancel") - .keyboardShortcut(.cancelAction) - - } else { - Button(action: { - parent?.dismiss(nil) - }, label: { - Text("Cancel") - .frame(width: 76) - }) - .accessibility(label: Text("Add Account")) - } - if #available(OSX 11.0, *) { - Button(action: { - addAccountDelegate?.presentSheetForAccount(selectedAccount) - parent?.dismiss(nil) - }, label: { - Text("Continue") - .frame(width: 76) - }) - .help("Add Account") - .keyboardShortcut(.defaultAction) - - } else { - Button(action: { - addAccountDelegate?.presentSheetForAccount(selectedAccount) - parent?.dismiss(nil) - }, label: { - Text("Continue") - .frame(width: 76) - }) - } + Button(action: { + parent?.dismiss(nil) + }, label: { + Text("Cancel") + .frame(width: 76) + }) + .help("Cancel") + .keyboardShortcut(.cancelAction) + + Button(action: { + addAccountDelegate?.presentSheetForAccount(selectedAccount) + parent?.dismiss(nil) + }, label: { + Text("Continue") + .frame(width: 76) + }) + .help("Add Account") + .keyboardShortcut(.defaultAction) } .padding(.top, 12) .padding(.bottom, 4) diff --git a/Shared/Extensions/NSView-Extensions.swift b/Shared/Extensions/NSView-Extensions.swift index e9449208e..d11ad2011 100644 --- a/Shared/Extensions/NSView-Extensions.swift +++ b/Shared/Extensions/NSView-Extensions.swift @@ -11,20 +11,11 @@ import AppKit extension NSView { func constraintsToMakeSubViewFullSize(_ subview: NSView) -> [NSLayoutConstraint] { - - if #available(macOS 11, *) { - let leadingConstraint = NSLayoutConstraint(item: subview, attribute: .leading, relatedBy: .equal, toItem: self.safeAreaLayoutGuide, attribute: .leading, multiplier: 1.0, constant: 0.0) - let trailingConstraint = NSLayoutConstraint(item: subview, attribute: .trailing, relatedBy: .equal, toItem: self.safeAreaLayoutGuide, attribute: .trailing, multiplier: 1.0, constant: 0.0) - let topConstraint = NSLayoutConstraint(item: subview, attribute: .top, relatedBy: .equal, toItem: self.safeAreaLayoutGuide, attribute: .top, multiplier: 1.0, constant: 0.0) - let bottomConstraint = NSLayoutConstraint(item: subview, attribute: .bottom, relatedBy: .equal, toItem: self.safeAreaLayoutGuide, attribute: .bottom, multiplier: 1.0, constant: 0.0) - return [leadingConstraint, trailingConstraint, topConstraint, bottomConstraint] - } else { - let leadingConstraint = NSLayoutConstraint(item: subview, attribute: .leading, relatedBy: .equal, toItem: self, attribute: .leading, multiplier: 1.0, constant: 0.0) - let trailingConstraint = NSLayoutConstraint(item: subview, attribute: .trailing, relatedBy: .equal, toItem: self, attribute: .trailing, multiplier: 1.0, constant: 0.0) - let topConstraint = NSLayoutConstraint(item: subview, attribute: .top, relatedBy: .equal, toItem: self, attribute: .top, multiplier: 1.0, constant: 0.0) - let bottomConstraint = NSLayoutConstraint(item: subview, attribute: .bottom, relatedBy: .equal, toItem: self, attribute: .bottom, multiplier: 1.0, constant: 0.0) - return [leadingConstraint, trailingConstraint, topConstraint, bottomConstraint] - } - + + let leadingConstraint = NSLayoutConstraint(item: subview, attribute: .leading, relatedBy: .equal, toItem: self.safeAreaLayoutGuide, attribute: .leading, multiplier: 1.0, constant: 0.0) + let trailingConstraint = NSLayoutConstraint(item: subview, attribute: .trailing, relatedBy: .equal, toItem: self.safeAreaLayoutGuide, attribute: .trailing, multiplier: 1.0, constant: 0.0) + let topConstraint = NSLayoutConstraint(item: subview, attribute: .top, relatedBy: .equal, toItem: self.safeAreaLayoutGuide, attribute: .top, multiplier: 1.0, constant: 0.0) + let bottomConstraint = NSLayoutConstraint(item: subview, attribute: .bottom, relatedBy: .equal, toItem: self.safeAreaLayoutGuide, attribute: .bottom, multiplier: 1.0, constant: 0.0) + return [leadingConstraint, trailingConstraint, topConstraint, bottomConstraint] } } diff --git a/iOS/AppDelegate.swift b/iOS/AppDelegate.swift index 3969f9577..f76fefaa2 100644 --- a/iOS/AppDelegate.swift +++ b/iOS/AppDelegate.swift @@ -396,16 +396,14 @@ private extension AppDelegate { } AccountManager.shared.refreshAll(errorHandler: ErrorHandler.log) { [unowned self] in if !AccountManager.shared.isSuspended { - if #available(iOS 14, *) { - try? WidgetDataEncoder.shared.encodeWidgetData() - } + try? WidgetDataEncoder.shared.encodeWidgetData() self.suspendApplication() os_log("Account refresh operation completed.", log: self.log, type: .info) task.setTaskCompleted(success: true) } } } - + // set expiration handler task.expirationHandler = { [weak task] in DispatchQueue.main.sync { @@ -443,9 +441,7 @@ private extension AppDelegate { self.prepareAccountsForBackground() account!.syncArticleStatus(completion: { [weak self] _ in if !AccountManager.shared.isSuspended { - if #available(iOS 14, *) { - try? WidgetDataEncoder.shared.encodeWidgetData() - } + try? WidgetDataEncoder.shared.encodeWidgetData() self?.prepareAccountsForBackground() self?.suspendApplication() } @@ -472,9 +468,7 @@ private extension AppDelegate { account!.markArticles(article!, statusKey: .starred, flag: true) { _ in } account!.syncArticleStatus(completion: { [weak self] _ in if !AccountManager.shared.isSuspended { - if #available(iOS 14, *) { - try? WidgetDataEncoder.shared.encodeWidgetData() - } + try? WidgetDataEncoder.shared.encodeWidgetData() self?.prepareAccountsForBackground() self?.suspendApplication() } diff --git a/iOS/SceneDelegate.swift b/iOS/SceneDelegate.swift index 2e36eaefb..434ab9574 100644 --- a/iOS/SceneDelegate.swift +++ b/iOS/SceneDelegate.swift @@ -65,9 +65,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { } func sceneDidEnterBackground(_ scene: UIScene) { - if #available(iOS 14, *) { - try? WidgetDataEncoder.shared.encodeWidgetData() - } + try? WidgetDataEncoder.shared.encodeWidgetData() ArticleStringFormatter.emptyCaches() appDelegate.prepareAccountsForBackground() }