[iOS] Reduced Project Warnings

- Unused code has been removed (`InteractiveLabel`)
- `NavigationLink` code updated
- `Async` alternative used for UNUserNotificationCenter
- iOS target update to 16 to remove Storyboard related warnings
This commit is contained in:
Stuart Breckenridge
2023-05-31 16:09:38 +08:00
parent bd47c699a7
commit a80fa38a5f
8 changed files with 43 additions and 86 deletions

View File

@@ -119,7 +119,6 @@
5127B238222B4849006D641D /* DetailKeyboardDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5127B236222B4849006D641D /* DetailKeyboardDelegate.swift */; };
5127B23A222B4849006D641D /* DetailKeyboardShortcuts.plist in Resources */ = {isa = PBXBuildFile; fileRef = 5127B237222B4849006D641D /* DetailKeyboardShortcuts.plist */; };
512AF9C2236ED52C0066F8BE /* ImageHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 512AF9C1236ED52C0066F8BE /* ImageHeaderView.swift */; };
512AF9DD236F05230066F8BE /* InteractiveLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 512AF9DC236F05230066F8BE /* InteractiveLabel.swift */; };
512D554423C804DE0023FFFA /* OpenInSafariActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 512D554323C804DE0023FFFA /* OpenInSafariActivity.swift */; };
512E08E62268800D00BDCFDD /* FolderTreeControllerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97A11ED9F180007D329B /* FolderTreeControllerDelegate.swift */; };
512E08E72268801200BDCFDD /* WebFeedTreeControllerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97611ED9EB96007D329B /* WebFeedTreeControllerDelegate.swift */; };
@@ -805,6 +804,8 @@
DF3630EF293618A900326FB8 /* SettingsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF3630EE293618A900326FB8 /* SettingsViewModel.swift */; };
DF394F0029357A180081EB6E /* NewArticleNotificationsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF394EFF29357A180081EB6E /* NewArticleNotificationsView.swift */; };
DF47CDB2294803AB00FCD57E /* AddExtensionListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF47CDB1294803AB00FCD57E /* AddExtensionListView.swift */; };
DF5124CA2A22D5FA00BBAB1F /* Html in Frameworks */ = {isa = PBXBuildFile; productRef = DF5124C92A22D5FA00BBAB1F /* Html */; };
DF5124CC2A22D62600BBAB1F /* AboutHTML.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF5124CB2A22D62600BBAB1F /* AboutHTML.swift */; };
DF5124CD2A230FC100BBAB1F /* Inspector.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DF5124D02A230FC100BBAB1F /* Inspector.storyboard */; };
DF5124CE2A230FC100BBAB1F /* Inspector.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DF5124D02A230FC100BBAB1F /* Inspector.storyboard */; };
DF5124D32A230FE400BBAB1F /* AccountsAddCloudKit.xib in Resources */ = {isa = PBXBuildFile; fileRef = DF5124D62A230FE400BBAB1F /* AccountsAddCloudKit.xib */; };
@@ -826,8 +827,6 @@
DF5125032A23116B00BBAB1F /* MasterTimelineTitleView.xib in Resources */ = {isa = PBXBuildFile; fileRef = DF5125052A23116B00BBAB1F /* MasterTimelineTitleView.xib */; };
DF5125082A23118300BBAB1F /* Add.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DF51250A2A23118300BBAB1F /* Add.storyboard */; };
DF51250D2A23119800BBAB1F /* AddFeedSelectFolderTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = DF51250F2A23119800BBAB1F /* AddFeedSelectFolderTableViewCell.xib */; };
DF5124CA2A22D5FA00BBAB1F /* Html in Frameworks */ = {isa = PBXBuildFile; productRef = DF5124C92A22D5FA00BBAB1F /* Html */; };
DF5124CC2A22D62600BBAB1F /* AboutHTML.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF5124CB2A22D62600BBAB1F /* AboutHTML.swift */; };
DF59F072292085B800ACD33D /* ColorPaletteSelectorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF59F071292085B800ACD33D /* ColorPaletteSelectorView.swift */; };
DF59F0742920DB5100ACD33D /* AccountsManagementView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF59F0732920DB5100ACD33D /* AccountsManagementView.swift */; };
DF5AD10128D6922200CA3BF7 /* SmartFeedSummaryWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1768144D2564BCE000D98635 /* SmartFeedSummaryWidget.swift */; };
@@ -1210,7 +1209,6 @@
5127B236222B4849006D641D /* DetailKeyboardDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DetailKeyboardDelegate.swift; sourceTree = "<group>"; };
5127B237222B4849006D641D /* DetailKeyboardShortcuts.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = DetailKeyboardShortcuts.plist; sourceTree = "<group>"; };
512AF9C1236ED52C0066F8BE /* ImageHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageHeaderView.swift; sourceTree = "<group>"; };
512AF9DC236F05230066F8BE /* InteractiveLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InteractiveLabel.swift; sourceTree = "<group>"; };
512D554323C804DE0023FFFA /* OpenInSafariActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenInSafariActivity.swift; sourceTree = "<group>"; };
512E08F722688F7C00BDCFDD /* MasterFeedTableViewSectionHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterFeedTableViewSectionHeader.swift; sourceTree = "<group>"; };
51314617235A797400387FDC /* NetNewsWire_iOSintentextension_target.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = NetNewsWire_iOSintentextension_target.xcconfig; sourceTree = "<group>"; };
@@ -1548,7 +1546,6 @@
B2B8075D239C49D300F191E0 /* RSImage-AppIcons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RSImage-AppIcons.swift"; sourceTree = "<group>"; };
B2C12C6528F4C46800373730 /* URLPasteboardWriter+NetNewsWire.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URLPasteboardWriter+NetNewsWire.swift"; sourceTree = "<group>"; };
B528F81D23333C7E00E735DD /* page.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = page.html; sourceTree = "<group>"; };
BDCB514D24282C8A00102A80 /* AccountsNewsBlur.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AccountsNewsBlur.xib; sourceTree = "<group>"; };
C47370262A232A0100E77890 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = "<group>"; };
C47370272A232A0100E77890 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "../zh-Hans.lproj/MainWindow.strings"; sourceTree = "<group>"; };
C47370282A232A0100E77890 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "../../../zh-Hans.lproj/RenameSheet.strings"; sourceTree = "<group>"; };
@@ -1614,6 +1611,7 @@
DF3630EE293618A900326FB8 /* SettingsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewModel.swift; sourceTree = "<group>"; };
DF394EFF29357A180081EB6E /* NewArticleNotificationsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewArticleNotificationsView.swift; sourceTree = "<group>"; };
DF47CDB1294803AB00FCD57E /* AddExtensionListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddExtensionListView.swift; sourceTree = "<group>"; };
DF5124CB2A22D62600BBAB1F /* AboutHTML.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutHTML.swift; sourceTree = "<group>"; };
DF5124CF2A230FC100BBAB1F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Inspector.storyboard; sourceTree = "<group>"; };
DF5124D22A230FC700BBAB1F /* en-GB */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "en-GB"; path = "en-GB.lproj/Inspector.strings"; sourceTree = "<group>"; };
DF5124D52A230FE400BBAB1F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/AccountsAddCloudKit.xib; sourceTree = "<group>"; };
@@ -1638,7 +1636,6 @@
DF51250C2A23118700BBAB1F /* en-GB */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "en-GB"; path = "en-GB.lproj/Add.strings"; sourceTree = "<group>"; };
DF51250E2A23119800BBAB1F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/AddFeedSelectFolderTableViewCell.xib; sourceTree = "<group>"; };
DF5125112A23119B00BBAB1F /* en-GB */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "en-GB"; path = "en-GB.lproj/AddFeedSelectFolderTableViewCell.strings"; sourceTree = "<group>"; };
DF5124CB2A22D62600BBAB1F /* AboutHTML.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutHTML.swift; sourceTree = "<group>"; };
DF59F071292085B800ACD33D /* ColorPaletteSelectorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorPaletteSelectorView.swift; sourceTree = "<group>"; };
DF59F0732920DB5100ACD33D /* AccountsManagementView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountsManagementView.swift; sourceTree = "<group>"; };
DF6DE5092965907A002EC085 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
@@ -2134,7 +2131,6 @@
51F85BFA2275D85000C787DC /* Array-Extensions.swift */,
51627A92238A3836007B3B4B /* CroppingPreviewParameters.swift */,
512AF9C1236ED52C0066F8BE /* ImageHeaderView.swift */,
512AF9DC236F05230066F8BE /* InteractiveLabel.swift */,
51A9A5F42380F6A60033AADF /* ModalNavigationController.swift */,
51EAED95231363EF00A9EEE3 /* NonIntrinsicButton.swift */,
5183CCD9226E31A50010922C /* NonIntrinsicImageView.swift */,
@@ -3730,6 +3726,7 @@
/* Begin PBXShellScriptBuildPhase section */
515D50802326D02600EE1167 /* Run Script: Verify No Build Settings */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 12;
files = (
);
@@ -3817,6 +3814,7 @@
};
65ED407D235DEF6C0081F399 /* Run Script: Verify No Build Settings */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@@ -3885,6 +3883,7 @@
};
D519E77022EE5B4100923F27 /* Run Script: Verify No Build Settings */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@@ -4283,7 +4282,6 @@
51C452A222650A1900C03939 /* RSHTMLMetadata+Extension.swift in Sources */,
51B5C87B23F2317700032075 /* ExtensionFeedAddRequest.swift in Sources */,
51627A93238A3836007B3B4B /* CroppingPreviewParameters.swift in Sources */,
512AF9DD236F05230066F8BE /* InteractiveLabel.swift in Sources */,
DFB3498A294B45AC00BC81AD /* ExtensionInspectorView.swift in Sources */,
51E3EB3D229AB08300645299 /* ErrorHandler.swift in Sources */,
5183CCE5226F4DFA0010922C /* RefreshInterval.swift in Sources */,

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="AJQ-jq-uMa">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="AJQ-jq-uMa">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21678"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
@@ -18,7 +18,7 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view hidden="YES" contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="h1Q-FS-jlg" customClass="ArticleSearchBar" customModule="NetNewsWire" customModuleProvider="target">
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="h1Q-FS-jlg" customClass="ArticleSearchBar" customModule="NetNewsWire" customModuleProvider="target">
<rect key="frame" x="0.0" y="777" width="414" height="36"/>
<color key="backgroundColor" name="barBackgroundColor"/>
</view>

View File

@@ -127,11 +127,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner, Ma
}
var node: Node? = nil
if let coordinator = unreadCountProvider as? SceneCoordinator, let feed = coordinator.timelineFeed {
node = coordinator.rootNode.descendantNodeRepresentingObject(feed as AnyObject)
} else {
node = coordinator.rootNode.descendantNodeRepresentingObject(unreadCountProvider as AnyObject)
}
node = coordinator.rootNode.descendantNodeRepresentingObject(unreadCountProvider as AnyObject)
guard let unreadCountNode = node, let indexPath = coordinator.indexPathFor(unreadCountNode) else { return }
if let cell = tableView.cellForRow(at: indexPath) as? MasterFeedTableViewCell {

View File

@@ -49,15 +49,24 @@ struct SettingsRow {
/// This row, when tapped, will push the the Add Account screen
/// in to view.
static var addAccount: some View {
NavigationLink(destination: AccountsManagementView()) {
Label {
Text("button.title.manage-accounts", comment: "Manage Accounts")
} icon: {
Image("app.account")
.resizable()
.frame(width: 25.0, height: 25.0)
.clipShape(RoundedRectangle(cornerRadius: 6))
}
// NavigationLink(destination: AccountsManagementView()) {
// Label {
// Text("button.title.manage-accounts", comment: "Manage Accounts")
// } icon: {
// Image("app.account")
// .resizable()
// .frame(width: 25.0, height: 25.0)
// .clipShape(RoundedRectangle(cornerRadius: 6))
// }
// }
Label {
Text("button.title.manage-accounts", comment: "Manage Accounts")
} icon: {
Image("app.account")
.resizable()
.frame(width: 25.0, height: 25.0)
.clipShape(RoundedRectangle(cornerRadius: 6))
}
}
@@ -198,7 +207,9 @@ struct SettingsRow {
/// This row, when tapped, will push the New Article Notifications
/// screen in to view.
static func configureAppearance(_ isShown: Binding<Bool>) -> some View {
NavigationLink(destination: DisplayAndBehaviorsView(), isActive: isShown) {
NavigationLink {
DisplayAndBehaviorsView()
} label: {
Label {
Text("button.title.display-and-behaviors", comment: "Display & Behaviors")
} icon: {
@@ -208,6 +219,7 @@ struct SettingsRow {
.clipShape(RoundedRectangle(cornerRadius: 6))
}
}
}
/// Sets the help sheet the user wishes to see.

View File

@@ -21,7 +21,7 @@ struct SettingsView: View {
@Binding var isConfigureAppearanceShown: Bool
var body: some View {
NavigationView {
NavigationStack {
List {
// Device Permissions
Section(header: Text("label.text.device-permissions", comment: "Device Permissions"),
@@ -101,9 +101,8 @@ struct SettingsView: View {
AboutView()
}
.task {
UNUserNotificationCenter.current().getNotificationSettings { settings in
Task { await MainActor.run { self.viewModel.notificationPermissions = settings.authorizationStatus }}
}
let settings = await UNUserNotificationCenter.current().notificationSettings()
Task { await MainActor.run { self.viewModel.notificationPermissions = settings.authorizationStatus }}
}
.onChange(of: scenePhase, perform: { phase in
if phase == .active {
@@ -155,6 +154,7 @@ struct SettingsView: View {
isPresented: $viewModel.showImportExportError,
actions: {},
message: { Text(verbatim: viewModel.importExportError?.localizedDescription ?? "") } )
}.navigationViewStyle(.stack)
}
.navigationViewStyle(.stack)
}
}

View File

@@ -1,54 +0,0 @@
//
// InteractiveLabel.swift
// NetNewsWire-iOS
//
// Created by Maurice Parker on 11/3/19.
// Copyright © 2019 Ranchero Software. All rights reserved.
//
import UIKit
@IBDesignable
class InteractiveLabel: UILabel {
override init(frame: CGRect) {
super.init(frame: frame)
commonInit()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
commonInit()
}
func commonInit() {
let gestureRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(handleLongPressGesture(_:)))
self.addGestureRecognizer(gestureRecognizer)
self.isUserInteractionEnabled = true
}
@objc func handleLongPressGesture(_ recognizer: UIGestureRecognizer) {
guard recognizer.state == .began,
let recognizerView = recognizer.view,
let recognizerSuperView = recognizerView.superview,
recognizerView.becomeFirstResponder() else {
return
}
UIMenuController.shared.showMenu(from: recognizerSuperView, rect: recognizerView.frame)
}
override var canBecomeFirstResponder: Bool {
return true
}
override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
return (action == #selector(UIResponderStandardEditActions.copy(_:)))
}
override func copy(_ sender: Any?) {
UIPasteboard.general.string = text
}
}

View File

@@ -10,5 +10,5 @@ COMBINE_HIDPI_IMAGES = YES
GCC_C_LANGUAGE_STANDARD = gnu11;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = 1,2
IPHONEOS_DEPLOYMENT_TARGET = 15.0
IPHONEOS_DEPLOYMENT_TARGET = 16.0
OTHER_LDFLAGS = $(inherited) -Xlinker -no_application_extension