Drop #available condition on iOS 15 (#274)

This commit is contained in:
Davide De Rosa 2023-03-25 17:05:53 +01:00 committed by GitHub
parent 6af4bb7e0f
commit 1e0d522010
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 33 deletions

View File

@ -45,10 +45,7 @@ extension View {
#if targetEnvironment(macCatalyst)
false
#else
guard #available(iOS 15, *) else {
return false
}
return UIDevice.current.userInterfaceIdiom == .pad
UIDevice.current.userInterfaceIdiom == .pad
#endif
}
}
@ -106,11 +103,7 @@ extension View {
@ViewBuilder
private func themeTint() -> some View {
if #available(iOS 15, *) {
tint(.accentColor)
} else {
self
}
}
private func themeListStyleValue() -> some ListStyle {
@ -118,11 +111,7 @@ extension View {
}
private func themeToggleStyleValue() -> some ToggleStyle {
if #available(iOS 15, *) {
return .switch
} else {
return SwitchToggleStyle(tint: .accentColor)
}
.switch
}
}

View File

@ -31,10 +31,6 @@ struct DestructiveButton<Label: View>: View {
let label: () -> Label
var body: some View {
if #available(iOS 15, *) {
Button(role: .destructive, action: action, label: label)
} else {
Button(action: action, label: label)
}
}
}

View File

@ -148,6 +148,8 @@ extension OrganizerView {
}
var body: some View {
// XXX: iOS bug, before 16, context menu is not redrawn on VPN state change
if #available(iOS 16, *), isActiveProfileNotDisconnected {
reconnectButton
}

View File

@ -99,7 +99,6 @@ struct ProviderLocationView: View, ProviderProfileAvailability {
EmptyView()
}
}.toolbar {
if #available(iOS 15, *) {
Button {
withAnimation {
isShowingFavorites.toggle()
@ -107,7 +106,6 @@ struct ProviderLocationView: View, ProviderProfileAvailability {
} label: {
themeFavoritesImage(isShowingFavorites).asSystemImage
}
}
}.navigationTitle(L10n.Provider.Location.title)
}
@ -133,7 +131,7 @@ struct ProviderLocationView: View, ProviderProfileAvailability {
private func categorySection(_ category: ProviderCategory) -> some View {
Section {
ForEach(filteredLocations(for: category)) { location in
if isEditable, #available(iOS 15, *) {
if isEditable {
locationRow(location)
.swipeActions(edge: .trailing, allowsFullSwipe: false) {
favoriteActions(location)

View File

@ -106,9 +106,7 @@ extension View {
extension View {
func debugChanges() {
if #available(iOS 15, *),
SwiftyBeaver.destinations.first?.minLevel == .verbose {
if SwiftyBeaver.destinations.first?.minLevel == .verbose {
Self._printChanges()
}
}

View File

@ -230,9 +230,7 @@ extension ProfileManager {
if setAsCurrent {
// iOS 14 goes crazy when changing binding of a presented NavigationLink
if #available(iOS 15, *) {
internalCurrentProfileId = copy.id
}
// autosaves copy if non-existing in persistent store
setCurrentProfile(copy)