forked from shadowfacts/Tusker
Use inset list style for preferences on iOS 14
This commit is contained in:
parent
be5a4c03a6
commit
02135aa0de
|
@ -16,8 +16,9 @@ struct AdvancedPrefsView : View {
|
|||
formattingSection
|
||||
automationSection
|
||||
cachingSection
|
||||
}.listStyle(GroupedListStyle())
|
||||
.navigationBarTitle(Text("Advanced"))
|
||||
}
|
||||
.insetOrGroupedListStyle()
|
||||
.navigationBarTitle(Text("Advanced"))
|
||||
}
|
||||
|
||||
var formattingFooter: some View {
|
||||
|
@ -44,7 +45,7 @@ struct AdvancedPrefsView : View {
|
|||
}
|
||||
|
||||
var cachingSection: some View {
|
||||
Section(header: Text("Caching")) {
|
||||
Section(header: Text("Caching"), footer: Text("Clearing caches will restart the app.")) {
|
||||
Button(action: clearCache) {
|
||||
Text("Clear Mastodon Cache")
|
||||
}.foregroundColor(.red)
|
||||
|
|
|
@ -33,8 +33,8 @@ struct AppearancePrefsView : View {
|
|||
accountsSection
|
||||
postsSection
|
||||
}
|
||||
.listStyle(GroupedListStyle())
|
||||
.navigationBarTitle(Text("Appearance"))
|
||||
.insetOrGroupedListStyle()
|
||||
.navigationBarTitle(Text("Appearance"))
|
||||
}
|
||||
|
||||
private var accountsSection: some View {
|
||||
|
|
|
@ -14,7 +14,9 @@ struct BehaviorPrefsView: View {
|
|||
var body: some View {
|
||||
List {
|
||||
linksSection
|
||||
}.listStyle(GroupedListStyle()).navigationBarTitle(Text("Behavior"))
|
||||
}
|
||||
.insetOrGroupedListStyle()
|
||||
.navigationBarTitle(Text("Behavior"))
|
||||
}
|
||||
|
||||
var linksSection: some View {
|
||||
|
|
|
@ -16,7 +16,9 @@ struct ComposingPrefsView: View {
|
|||
List {
|
||||
composingSection
|
||||
replyingSection
|
||||
}.listStyle(GroupedListStyle()).navigationBarTitle("Composing")
|
||||
}
|
||||
.insetOrGroupedListStyle()
|
||||
.navigationBarTitle("Composing")
|
||||
}
|
||||
|
||||
var composingSection: some View {
|
||||
|
|
|
@ -14,7 +14,9 @@ struct MediaPrefsView: View {
|
|||
var body: some View {
|
||||
List {
|
||||
viewingSection
|
||||
}.listStyle(GroupedListStyle()).navigationBarTitle("Media")
|
||||
}
|
||||
.insetOrGroupedListStyle()
|
||||
.navigationBarTitle("Media")
|
||||
}
|
||||
|
||||
var viewingSection: some View {
|
||||
|
|
|
@ -15,7 +15,7 @@ struct PreferencesView: View {
|
|||
// workaround: the navigation view is provided by MyProfileTableViewController so that it can inject the Done button
|
||||
// NavigationView {
|
||||
List {
|
||||
Section {
|
||||
Section(header: Text("Accounts")) {
|
||||
ForEach(localData.accounts, id: \.accessToken) { (account) in
|
||||
Button(action: {
|
||||
NotificationCenter.default.post(name: .activateAccount, object: nil, userInfo: ["account": account])
|
||||
|
@ -75,8 +75,8 @@ struct PreferencesView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.listStyle(GroupedListStyle())
|
||||
.navigationBarTitle(Text("Preferences"), displayMode: .inline)
|
||||
.insetOrGroupedListStyle()
|
||||
.navigationBarTitle(Text("Preferences"), displayMode: .inline)
|
||||
// }
|
||||
}
|
||||
|
||||
|
@ -85,6 +85,17 @@ struct PreferencesView: View {
|
|||
}
|
||||
}
|
||||
|
||||
extension View {
|
||||
@ViewBuilder
|
||||
func insetOrGroupedListStyle() -> some View {
|
||||
if #available(iOS 14.0, *) {
|
||||
self.listStyle(InsetGroupedListStyle())
|
||||
} else {
|
||||
self.listStyle(GroupedListStyle())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
struct PreferencesView_Previews : PreviewProvider {
|
||||
static var previews: some View {
|
||||
|
|
|
@ -14,7 +14,7 @@ struct SilentActionPrefs : View {
|
|||
List(Array(preferences.silentActions.keys), id: \.self) { source in
|
||||
SilentActionPermissionCell(source: source)
|
||||
}
|
||||
.listStyle(GroupedListStyle())
|
||||
.insetOrGroupedListStyle()
|
||||
// .navigationBarTitle("Silent Action Permissions")
|
||||
// see FB6838291
|
||||
}
|
||||
|
|
|
@ -15,8 +15,9 @@ struct WellnessPrefsView: View {
|
|||
List {
|
||||
showFavAndReblogCountSection
|
||||
notificationsModeSection
|
||||
}.listStyle(GroupedListStyle())
|
||||
.navigationBarTitle(Text("Digital Wellness"))
|
||||
}
|
||||
.insetOrGroupedListStyle()
|
||||
.navigationBarTitle(Text("Digital Wellness"))
|
||||
}
|
||||
|
||||
var showFavAndReblogCountSection: some View {
|
||||
|
|
Loading…
Reference in New Issue