Skip to content

Commit 5e79e5e

Browse files
chore: format
1 parent 38c652a commit 5e79e5e

File tree

5 files changed

+55
-62
lines changed

5 files changed

+55
-62
lines changed

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/AuthServiceError.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,3 @@ public enum AuthServiceError: LocalizedError {
188188
}
189189
}
190190
}
191-

samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Application/AppDelegate.swift

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,45 +18,39 @@ import FirebaseCore
1818
import GoogleSignIn
1919

2020
class AppDelegate: NSObject, UIApplicationDelegate {
21-
func application(
22-
_ application: UIApplication,
23-
didFinishLaunchingWithOptions launchOptions: [
24-
UIApplication.LaunchOptionsKey: Any
25-
]?
26-
) -> Bool {
21+
func application(_ application: UIApplication,
22+
didFinishLaunchingWithOptions launchOptions: [
23+
UIApplication.LaunchOptionsKey: Any
24+
]?) -> Bool {
2725
FirebaseApp.configure()
28-
26+
2927
ApplicationDelegate.shared.application(
3028
application,
3129
didFinishLaunchingWithOptions: launchOptions
3230
)
3331
return true
3432
}
35-
33+
3634
func application(_: UIApplication,
3735
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
3836
Auth.auth().setAPNSToken(deviceToken, type: .prod)
3937
}
40-
41-
func application(
42-
_: UIApplication,
43-
didReceiveRemoteNotification notification: [AnyHashable: Any],
44-
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult)
45-
-> Void
46-
) {
38+
39+
func application(_: UIApplication,
40+
didReceiveRemoteNotification notification: [AnyHashable: Any],
41+
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult)
42+
-> Void) {
4743
if Auth.auth().canHandleNotification(notification) {
4844
completionHandler(.noData)
4945
return
5046
}
5147
}
52-
53-
func application(
54-
_ app: UIApplication,
55-
open url: URL,
56-
options: [UIApplication.OpenURLOptionsKey: Any] = [:]
57-
) -> Bool {
48+
49+
func application(_ app: UIApplication,
50+
open url: URL,
51+
options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
5852
if Auth.auth().canHandle(url) { return true }
59-
53+
6054
if ApplicationDelegate.shared.application(
6155
app,
6256
open: url,
@@ -66,7 +60,7 @@ class AppDelegate: NSObject, UIApplicationDelegate {
6660
) {
6761
return true
6862
}
69-
63+
7064
return GIDSignIn.sharedInstance.handle(url)
7165
}
7266
}

samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Application/FirebaseSwiftUISampleApp.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import SwiftUI
1717
@main
1818
struct FirebaseSwiftUISampleApp: App {
1919
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
20-
20+
2121
var body: some Scene {
2222
WindowGroup {
2323
ContentView()

samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/AuthPickerViewExample.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
import SwiftUI
16-
import FirebaseAuthSwiftUI
1715
import FirebaseAuth
16+
import FirebaseAuthSwiftUI
17+
import SwiftUI
1818

1919
struct AuthPickerViewExample: View {
2020
@Environment(AuthService.self) private var authService
21-
21+
2222
var body: some View {
2323
AuthPickerView {
2424
authenticatedApp
2525
}
2626
}
27-
27+
2828
var authenticatedApp: some View {
2929
NavigationStack {
3030
VStack {

samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Examples/CustomViewExample.swift

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
import SwiftUI
16-
import FirebaseAuthSwiftUI
1715
import FirebaseAuth
16+
import FirebaseAuthSwiftUI
17+
import SwiftUI
1818

1919
struct CustomViewExample: View {
2020
@Environment(AuthService.self) private var authService
@@ -23,49 +23,49 @@ struct CustomViewExample: View {
2323
@State private var isSignUp: Bool = false
2424
@State private var errorMessage: String?
2525
@State private var isLoading: Bool = false
26-
26+
2727
var body: some View {
2828
if authService.authenticationState == .authenticated {
2929
authenticatedView
3030
} else {
3131
landingView
3232
}
3333
}
34-
34+
3535
private var landingView: some View {
3636
ScrollView {
3737
VStack(spacing: 32) {
3838
Spacer()
3939
.frame(height: 40)
40-
40+
4141
// Hero section
4242
VStack(spacing: 16) {
4343
Image(systemName: "flame.fill")
4444
.font(.system(size: 80))
4545
.foregroundStyle(.orange)
46-
46+
4747
Text("Welcome to FirebaseUI")
4848
.font(.largeTitle)
4949
.fontWeight(.bold)
5050
.multilineTextAlignment(.center)
51-
51+
5252
Text("Sign in to continue and explore all the features")
5353
.font(.body)
5454
.foregroundColor(.secondary)
5555
.multilineTextAlignment(.center)
5656
.padding(.horizontal)
5757
}
58-
58+
5959
Spacer()
6060
.frame(height: 20)
61-
61+
6262
// Email/Password form
6363
VStack(spacing: 16) {
6464
VStack(alignment: .leading, spacing: 8) {
6565
Text("Email")
6666
.font(.subheadline)
6767
.fontWeight(.medium)
68-
68+
6969
TextField("Enter your email", text: $email)
7070
.textInputAutocapitalization(.never)
7171
.keyboardType(.emailAddress)
@@ -74,26 +74,26 @@ struct CustomViewExample: View {
7474
.background(Color(UIColor.secondarySystemBackground))
7575
.cornerRadius(8)
7676
}
77-
77+
7878
VStack(alignment: .leading, spacing: 8) {
7979
Text("Password")
8080
.font(.subheadline)
8181
.fontWeight(.medium)
82-
82+
8383
SecureField("Enter your password", text: $password)
8484
.textContentType(isSignUp ? .newPassword : .password)
8585
.padding()
8686
.background(Color(UIColor.secondarySystemBackground))
8787
.cornerRadius(8)
8888
}
89-
89+
9090
if let errorMessage = errorMessage {
9191
Text(errorMessage)
9292
.font(.caption)
9393
.foregroundColor(.red)
9494
.frame(maxWidth: .infinity, alignment: .leading)
9595
}
96-
96+
9797
Button {
9898
Task {
9999
await handleAuthentication()
@@ -114,7 +114,7 @@ struct CustomViewExample: View {
114114
.cornerRadius(8)
115115
}
116116
.disabled(!isFormValid || isLoading)
117-
117+
118118
Button {
119119
isSignUp.toggle()
120120
errorMessage = nil
@@ -125,49 +125,49 @@ struct CustomViewExample: View {
125125
}
126126
}
127127
.padding(.horizontal, 24)
128-
128+
129129
// Divider with text
130130
HStack {
131131
Rectangle()
132132
.fill(Color.secondary.opacity(0.3))
133133
.frame(height: 1)
134-
134+
135135
Text("or continue with")
136136
.font(.caption)
137137
.foregroundColor(.secondary)
138138
.padding(.horizontal, 8)
139-
139+
140140
Rectangle()
141141
.fill(Color.secondary.opacity(0.3))
142142
.frame(height: 1)
143143
}
144144
.padding(.horizontal, 24)
145-
145+
146146
// Auth providers section - using AuthService's renderButtons
147147
VStack(spacing: 12) {
148148
authService.renderButtons(spacing: 12)
149149
}
150150
.padding(.horizontal, 24)
151-
151+
152152
Spacer()
153153
.frame(minHeight: 20)
154-
154+
155155
// Footer
156156
VStack(spacing: 8) {
157157
HStack(spacing: 4) {
158158
Text("By continuing, you agree to our")
159159
.font(.caption)
160160
.foregroundColor(.secondary)
161-
161+
162162
if let tosUrl = authService.configuration.tosUrl {
163163
Link("Terms", destination: tosUrl)
164164
.font(.caption)
165165
}
166-
166+
167167
Text("and")
168168
.font(.caption)
169169
.foregroundColor(.secondary)
170-
170+
171171
if let privacyUrl = authService.configuration.privacyPolicyUrl {
172172
Link("Privacy Policy", destination: privacyUrl)
173173
.font(.caption)
@@ -179,19 +179,19 @@ struct CustomViewExample: View {
179179
}
180180
}
181181
}
182-
182+
183183
private var authenticatedView: some View {
184184
VStack(spacing: 24) {
185185
Spacer()
186186
Image(systemName: "checkmark.circle.fill")
187187
.font(.system(size: 80))
188188
.foregroundStyle(.green)
189-
189+
190190
VStack(spacing: 8) {
191191
Text("Signed In Successfully")
192192
.font(.title)
193193
.fontWeight(.bold)
194-
194+
195195
if let email = authService.currentUser?.email {
196196
Text(email)
197197
.font(.body)
@@ -202,7 +202,7 @@ struct CustomViewExample: View {
202202
.foregroundColor(.secondary)
203203
}
204204
}
205-
205+
206206
Button {
207207
Task {
208208
try? await authService.signOut()
@@ -218,19 +218,19 @@ struct CustomViewExample: View {
218218
.cornerRadius(8)
219219
}
220220
.padding(.horizontal, 24)
221-
221+
222222
Spacer()
223223
}
224224
}
225-
225+
226226
private var isFormValid: Bool {
227227
!email.isEmpty && !password.isEmpty && password.count >= 6
228228
}
229-
229+
230230
private func handleAuthentication() async {
231231
errorMessage = nil
232232
isLoading = true
233-
233+
234234
do {
235235
if isSignUp {
236236
_ = try await authService.createUser(email: email, password: password)
@@ -240,7 +240,7 @@ struct CustomViewExample: View {
240240
} catch {
241241
errorMessage = error.localizedDescription
242242
}
243-
243+
244244
isLoading = false
245245
}
246246
}

0 commit comments

Comments
 (0)