[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

@@ -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)
}
}