Configured and applied SwiftFormat

This commit is contained in:
Stefan Ceriu
2022-09-27 10:17:22 +03:00
committed by Stefan Ceriu
parent ff2e6ddfa7
commit 43c28d23b7
663 changed files with 2329 additions and 2840 deletions
@@ -1,4 +1,4 @@
//
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,10 +16,8 @@
import SwiftUI
/// A single rounded rect chip to be rendered within `Chips` collection
struct Chip: View {
@Environment(\.isEnabled) var isEnabled
@Environment(\.theme) var theme: ThemeSwiftUI
@@ -57,7 +55,6 @@ struct Chip: View {
.background(backgroundColor)
.foregroundColor(foregroundColor)
.cornerRadius(20)
}
}
@@ -1,4 +1,4 @@
//
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,8 +18,7 @@ import SwiftUI
/// Renders multiple chips in a flow layout.
struct Chips: View {
@State private var frame: CGRect = CGRect.zero
@State private var frame = CGRect.zero
let titles: [String]
let didDeleteChip: (String) -> Void
@@ -56,7 +55,7 @@ struct Chips: View {
}
return result
}
.alignmentGuide(.top) { dimension in
.alignmentGuide(.top) { _ in
// Use next y value and reset if its the last.
let result = y
if chip == titles.last {
@@ -82,6 +81,5 @@ struct Chips_Previews: PreviewProvider {
Chips(titles: chips, didDeleteChip: { _ in })
.theme(.dark)
}
}
}
@@ -1,4 +1,4 @@
//
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,17 +18,15 @@ import SwiftUI
/// Renders an input field and a collection of chips.
struct ChipsInput: View {
@Environment(\.theme) var theme: ThemeSwiftUI
@Environment(\.isEnabled) var isEnabled
@State private var chipText: String = ""
@State private var chipText = ""
let titles: [String]
let didAddChip: (String) -> Void
let didDeleteChip: (String) -> Void
var placeholder: String = ""
var placeholder = ""
var body: some View {
VStack(spacing: 16) {
@@ -55,6 +53,5 @@ struct ChipsInput_Previews: PreviewProvider {
chips.remove(chip)
}
.disabled(true)
}
}
@@ -1,4 +1,4 @@
//
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,6 @@
import SwiftUI
struct DefaultNotificationSettings: View {
@ObservedObject var viewModel: NotificationSettingsViewModel
var body: some View {
@@ -38,6 +37,5 @@ struct DefaultNotifications_Previews: PreviewProvider {
)
.navigationBarTitleDisplayMode(.inline)
}
}
}
@@ -19,7 +19,6 @@ import SwiftUI
/// An input field style for forms.
struct FormInputFieldStyle: TextFieldStyle {
@Environment(\.theme) var theme: ThemeSwiftUI
@Environment(\.isEnabled) var isEnabled
@@ -31,7 +30,7 @@ struct FormInputFieldStyle: TextFieldStyle {
}
private var backgroundColor: Color {
if !isEnabled && theme.identifier == .dark {
if !isEnabled, theme.identifier == .dark {
return theme.colors.quinaryContent
}
return theme.colors.background
@@ -47,7 +46,6 @@ struct FormInputFieldStyle: TextFieldStyle {
}
}
struct FormInputFieldStyle_Previews: PreviewProvider {
static var previews: some View {
Group {
@@ -59,7 +57,6 @@ struct FormInputFieldStyle_Previews: PreviewProvider {
TextField("Placeholder", text: .constant("Web"))
.textFieldStyle(FormInputFieldStyle())
.disabled(true)
}
.padding()
VectorForm {
@@ -70,11 +67,9 @@ struct FormInputFieldStyle_Previews: PreviewProvider {
TextField("Placeholder", text: .constant("Web"))
.textFieldStyle(FormInputFieldStyle())
.disabled(true)
}
.padding()
.theme(ThemeIdentifier.dark)
}
}
}
@@ -1,4 +1,4 @@
//
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,6 @@
import SwiftUI
struct MentionsAndKeywordNotificationSettings: View {
@ObservedObject var viewModel: NotificationSettingsViewModel
var keywordSection: some View {
@@ -28,6 +27,7 @@ struct MentionsAndKeywordNotificationSettings: View {
NotificationSettingsKeywords(viewModel: viewModel)
}
}
var body: some View {
NotificationSettings(
viewModel: viewModel,
@@ -1,4 +1,4 @@
//
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,7 +21,6 @@ import SwiftUI
/// Also renders an optional bottom section.
/// Used in the case of keywords, for the keyword chips and input.
struct NotificationSettings<BottomSection: View>: View {
@ObservedObject var viewModel: NotificationSettingsViewModel
var bottomSection: BottomSection?
@@ -1,4 +1,4 @@
//
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,7 +27,6 @@ struct NotificationSettingsKeywords: View {
placeholder: VectorL10n.settingsNewKeyword
)
.disabled(!(viewModel.viewState.selectionState[.keywords] ?? false))
}
}
@@ -1,4 +1,4 @@
//
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");