Drop #available condition on iOS 15 (#274)
This commit is contained in:
parent
6af4bb7e0f
commit
1e0d522010
|
@ -45,10 +45,7 @@ extension View {
|
||||||
#if targetEnvironment(macCatalyst)
|
#if targetEnvironment(macCatalyst)
|
||||||
false
|
false
|
||||||
#else
|
#else
|
||||||
guard #available(iOS 15, *) else {
|
UIDevice.current.userInterfaceIdiom == .pad
|
||||||
return false
|
|
||||||
}
|
|
||||||
return UIDevice.current.userInterfaceIdiom == .pad
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,11 +103,7 @@ extension View {
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private func themeTint() -> some View {
|
private func themeTint() -> some View {
|
||||||
if #available(iOS 15, *) {
|
tint(.accentColor)
|
||||||
tint(.accentColor)
|
|
||||||
} else {
|
|
||||||
self
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func themeListStyleValue() -> some ListStyle {
|
private func themeListStyleValue() -> some ListStyle {
|
||||||
|
@ -118,11 +111,7 @@ extension View {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func themeToggleStyleValue() -> some ToggleStyle {
|
private func themeToggleStyleValue() -> some ToggleStyle {
|
||||||
if #available(iOS 15, *) {
|
.switch
|
||||||
return .switch
|
|
||||||
} else {
|
|
||||||
return SwitchToggleStyle(tint: .accentColor)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,6 @@ struct DestructiveButton<Label: View>: View {
|
||||||
let label: () -> Label
|
let label: () -> Label
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
if #available(iOS 15, *) {
|
Button(role: .destructive, action: action, label: label)
|
||||||
Button(role: .destructive, action: action, label: label)
|
|
||||||
} else {
|
|
||||||
Button(action: action, label: label)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,6 +148,8 @@ extension OrganizerView {
|
||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
|
||||||
|
// XXX: iOS bug, before 16, context menu is not redrawn on VPN state change
|
||||||
if #available(iOS 16, *), isActiveProfileNotDisconnected {
|
if #available(iOS 16, *), isActiveProfileNotDisconnected {
|
||||||
reconnectButton
|
reconnectButton
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,14 +99,12 @@ struct ProviderLocationView: View, ProviderProfileAvailability {
|
||||||
EmptyView()
|
EmptyView()
|
||||||
}
|
}
|
||||||
}.toolbar {
|
}.toolbar {
|
||||||
if #available(iOS 15, *) {
|
Button {
|
||||||
Button {
|
withAnimation {
|
||||||
withAnimation {
|
isShowingFavorites.toggle()
|
||||||
isShowingFavorites.toggle()
|
|
||||||
}
|
|
||||||
} label: {
|
|
||||||
themeFavoritesImage(isShowingFavorites).asSystemImage
|
|
||||||
}
|
}
|
||||||
|
} label: {
|
||||||
|
themeFavoritesImage(isShowingFavorites).asSystemImage
|
||||||
}
|
}
|
||||||
}.navigationTitle(L10n.Provider.Location.title)
|
}.navigationTitle(L10n.Provider.Location.title)
|
||||||
}
|
}
|
||||||
|
@ -133,7 +131,7 @@ struct ProviderLocationView: View, ProviderProfileAvailability {
|
||||||
private func categorySection(_ category: ProviderCategory) -> some View {
|
private func categorySection(_ category: ProviderCategory) -> some View {
|
||||||
Section {
|
Section {
|
||||||
ForEach(filteredLocations(for: category)) { location in
|
ForEach(filteredLocations(for: category)) { location in
|
||||||
if isEditable, #available(iOS 15, *) {
|
if isEditable {
|
||||||
locationRow(location)
|
locationRow(location)
|
||||||
.swipeActions(edge: .trailing, allowsFullSwipe: false) {
|
.swipeActions(edge: .trailing, allowsFullSwipe: false) {
|
||||||
favoriteActions(location)
|
favoriteActions(location)
|
||||||
|
|
|
@ -106,9 +106,7 @@ extension View {
|
||||||
|
|
||||||
extension View {
|
extension View {
|
||||||
func debugChanges() {
|
func debugChanges() {
|
||||||
if #available(iOS 15, *),
|
if SwiftyBeaver.destinations.first?.minLevel == .verbose {
|
||||||
SwiftyBeaver.destinations.first?.minLevel == .verbose {
|
|
||||||
|
|
||||||
Self._printChanges()
|
Self._printChanges()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,9 +230,7 @@ extension ProfileManager {
|
||||||
if setAsCurrent {
|
if setAsCurrent {
|
||||||
|
|
||||||
// iOS 14 goes crazy when changing binding of a presented NavigationLink
|
// iOS 14 goes crazy when changing binding of a presented NavigationLink
|
||||||
if #available(iOS 15, *) {
|
internalCurrentProfileId = copy.id
|
||||||
internalCurrentProfileId = copy.id
|
|
||||||
}
|
|
||||||
|
|
||||||
// autosaves copy if non-existing in persistent store
|
// autosaves copy if non-existing in persistent store
|
||||||
setCurrentProfile(copy)
|
setCurrentProfile(copy)
|
||||||
|
|
Loading…
Reference in New Issue