Skip to content

Commit 080b27a

Browse files
Merge pull request #1294 from firebase/clean-up-bugs
2 parents a1e2944 + a48098a commit 080b27a

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Services/AuthService.swift

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ public protocol AuthProviderUI {
2929

3030
public protocol PhoneAuthProviderSwift: AuthProviderSwift {
3131
@MainActor func verifyPhoneNumber(phoneNumber: String) async throws -> String
32-
@MainActor func createAuthCredential(verificationId: String, verificationCode: String) async throws -> AuthCredential
32+
@MainActor func createAuthCredential(verificationId: String,
33+
verificationCode: String) async throws -> AuthCredential
3334
}
3435

3536
public enum AuthenticationState {
@@ -109,7 +110,10 @@ public final class AuthService {
109110
public init(configuration: AuthConfiguration = AuthConfiguration(), auth: Auth = Auth.auth()) {
110111
self.auth = auth
111112
self.configuration = configuration
112-
string = StringUtils(bundle: configuration.customStringsBundle ?? Bundle.module, languageCode: configuration.languageCode)
113+
string = StringUtils(
114+
bundle: configuration.customStringsBundle ?? Bundle.module,
115+
languageCode: configuration.languageCode
116+
)
113117
listenerManager = AuthListenerManager(auth: auth, authEnvironment: self)
114118
FirebaseApp.registerLibrary("firebase-ui-ios", withVersion: FirebaseAuthSwiftUIVersion.version)
115119
}
@@ -427,7 +431,19 @@ public extension AuthService {
427431
throw AuthServiceError
428432
.invalidEmailLink("email address is missing from app storage. Is this the same device?")
429433
}
430-
let link = url.absoluteString
434+
let urlString = url.absoluteString
435+
436+
guard let originalLink = CommonUtils.getQueryParamValue(from: urlString, paramName: "link")
437+
else {
438+
throw AuthServiceError
439+
.invalidEmailLink("'link' parameter is missing from the email link URL")
440+
}
441+
442+
guard let link = originalLink.removingPercentEncoding else {
443+
throw AuthServiceError
444+
.invalidEmailLink("Failed to decode Link URL")
445+
}
446+
431447
guard let continueUrl = CommonUtils.getQueryParamValue(from: link, paramName: "continueUrl")
432448
else {
433449
throw AuthServiceError

samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExample.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@
495495
CODE_SIGN_STYLE = Automatic;
496496
CURRENT_PROJECT_VERSION = 1;
497497
DEVELOPMENT_ASSET_PATHS = "\"FirebaseSwiftUIExample/Preview Content\"";
498-
DEVELOPMENT_TEAM = 3G33A99C47;
498+
DEVELOPMENT_TEAM = YYX2P3XVJ7;
499499
ENABLE_PREVIEWS = YES;
500500
GENERATE_INFOPLIST_FILE = YES;
501501
INFOPLIST_FILE = FirebaseSwiftUIExample/Info.plist;

samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExample/App/ContentView.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@ struct ContentView: View {
3535
Auth.auth().signInAnonymously()
3636
let actionCodeSettings = ActionCodeSettings()
3737
actionCodeSettings.handleCodeInApp = true
38-
actionCodeSettings
39-
.url = URL(string: "https://flutterfire-e2e-tests.firebaseapp.com")
40-
actionCodeSettings.linkDomain = "flutterfire-e2e-tests.firebaseapp.com"
38+
actionCodeSettings.url = URL(string: "https://flutterfire-e2e-tests.firebaseapp.com")
4139
actionCodeSettings.setIOSBundleID(Bundle.main.bundleIdentifier!)
40+
actionCodeSettings.linkDomain = "flutterfire-e2e-tests.firebaseapp.com"
4241
let configuration = AuthConfiguration(
4342
shouldAutoUpgradeAnonymousUsers: true,
4443
tosUrl: URL(string: "https://example.com/tos"),
@@ -110,9 +109,6 @@ struct ContentView: View {
110109
}
111110
.navigationTitle("Firebase UI Demo")
112111
}
113-
.onAppear {
114-
authService.isPresented = authService.authenticationState == .unauthenticated
115-
}
116112
.onChange(of: authService.authenticationState) { _, newValue in
117113
debugPrint("authService.authenticationState - \(newValue)")
118114
if newValue != .authenticating {

samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExample/FirebaseSwiftUIExample.entitlements

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<key>com.apple.developer.associated-domains</key>
1212
<array>
1313
<string>applinks:flutterfire-e2e-tests.firebaseapp.com</string>
14+
<string>applinks:flutterfiretests.page.link</string>
1415
</array>
1516
</dict>
1617
</plist>

0 commit comments

Comments
 (0)