Skip to content

Commit f8d7d4a

Browse files
Merge pull request #1309 from firebase/example-app
2 parents 6ccaccd + 58697f6 commit f8d7d4a

File tree

3 files changed

+41
-55
lines changed

3 files changed

+41
-55
lines changed

samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@
296296
CODE_SIGN_ENTITLEMENTS = FirebaseSwiftUISample/FirebaseSwiftUISample.entitlements;
297297
CODE_SIGN_STYLE = Automatic;
298298
CURRENT_PROJECT_VERSION = 1;
299+
DEVELOPMENT_TEAM = YYX2P3XVJ7;
299300
ENABLE_PREVIEWS = YES;
300301
GENERATE_INFOPLIST_FILE = YES;
301302
INFOPLIST_FILE = FirebaseSwiftUISample/Info.plist;
@@ -331,6 +332,7 @@
331332
CODE_SIGN_ENTITLEMENTS = FirebaseSwiftUISample/FirebaseSwiftUISample.entitlements;
332333
CODE_SIGN_STYLE = Automatic;
333334
CURRENT_PROJECT_VERSION = 1;
335+
DEVELOPMENT_TEAM = YYX2P3XVJ7;
334336
ENABLE_PREVIEWS = YES;
335337
GENERATE_INFOPLIST_FILE = YES;
336338
INFOPLIST_FILE = FirebaseSwiftUISample/Info.plist;

samples/swiftui/FirebaseSwiftUISample/FirebaseSwiftUISample/Application/ContentView.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ import FirebaseOAuthSwiftUI
2525

2626
struct ContentView: View {
2727
init() {
28-
Auth.auth().useEmulator(withHost: "127.0.0.1", port: 9099)
29-
Auth.auth().settings?.isAppVerificationDisabledForTesting = true
30-
//Auth.auth().signInAnonymously()
28+
Auth.auth().useEmulator(withHost: "127.0.0.1", port: 9099)
29+
3130
let actionCodeSettings = ActionCodeSettings()
31+
3232
actionCodeSettings.handleCodeInApp = true
3333
actionCodeSettings.url = URL(string: "https://flutterfire-e2e-tests.firebaseapp.com")
3434
actionCodeSettings.setIOSBundleID(Bundle.main.bundleIdentifier!)
@@ -55,6 +55,7 @@ struct ContentView: View {
5555
.withOAuthSignIn(
5656
OAuthProviderSwift(
5757
providerId: "oidc.line",
58+
scopes: ["openid", "profile", "email"],
5859
displayName: "Sign in with LINE",
5960
buttonIcon: Image(.icLineLogo),
6061
buttonBackgroundColor: .lineButton,

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

Lines changed: 35 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -181,62 +181,45 @@ struct CustomViewExample: View {
181181
}
182182

183183
private var authenticatedView: some View {
184-
AuthPickerView {
185-
VStack(spacing: 24) {
186-
Spacer()
187-
Image(systemName: "checkmark.circle.fill")
188-
.font(.system(size: 80))
189-
.foregroundStyle(.green)
184+
VStack(spacing: 24) {
185+
Spacer()
186+
Image(systemName: "checkmark.circle.fill")
187+
.font(.system(size: 80))
188+
.foregroundStyle(.green)
189+
190+
VStack(spacing: 8) {
191+
Text("Signed In Successfully")
192+
.font(.title)
193+
.fontWeight(.bold)
190194

191-
VStack(spacing: 8) {
192-
Text("Signed In Successfully")
193-
.font(.title)
194-
.fontWeight(.bold)
195-
196-
if let email = authService.currentUser?.email {
197-
Text(email)
198-
.font(.body)
199-
.foregroundColor(.secondary)
200-
} else if let phoneNumber = authService.currentUser?.phoneNumber {
201-
Text(phoneNumber)
202-
.font(.body)
203-
.foregroundColor(.secondary)
204-
}
195+
if let email = authService.currentUser?.email {
196+
Text(email)
197+
.font(.body)
198+
.foregroundColor(.secondary)
199+
} else if let phoneNumber = authService.currentUser?.phoneNumber {
200+
Text(phoneNumber)
201+
.font(.body)
202+
.foregroundColor(.secondary)
205203
}
206-
207-
VStack(spacing: 12) {
208-
Button {
209-
authService.isPresented = true
210-
} label: {
211-
Text("Manage Account")
212-
.font(.body)
213-
.fontWeight(.semibold)
214-
.foregroundColor(.white)
215-
.frame(maxWidth: .infinity)
216-
.padding(.vertical, 14)
217-
.background(Color.blue)
218-
.cornerRadius(8)
219-
}
220-
221-
Button {
222-
Task {
223-
try? await authService.signOut()
224-
}
225-
} label: {
226-
Text("Sign Out")
227-
.font(.body)
228-
.fontWeight(.semibold)
229-
.foregroundColor(.red)
230-
.frame(maxWidth: .infinity)
231-
.padding(.vertical, 14)
232-
.background(Color.red.opacity(0.1))
233-
.cornerRadius(8)
234-
}
204+
}
205+
206+
Button {
207+
Task {
208+
try? await authService.signOut()
235209
}
236-
.padding(.horizontal, 24)
237-
238-
Spacer()
210+
} label: {
211+
Text("Sign Out")
212+
.font(.body)
213+
.fontWeight(.semibold)
214+
.foregroundColor(.red)
215+
.frame(maxWidth: .infinity)
216+
.padding(.vertical, 14)
217+
.background(Color.red.opacity(0.1))
218+
.cornerRadius(8)
239219
}
220+
.padding(.horizontal, 24)
221+
222+
Spacer()
240223
}
241224
}
242225

0 commit comments

Comments
 (0)