Skip to content

Commit b47e124

Browse files
committed
[auth-swift] Fix Sample build warnings
1 parent 1a0d39a commit b47e124

File tree

4 files changed

+11
-17
lines changed

4 files changed

+11
-17
lines changed

FirebaseAuth/Tests/SampleSwift/AuthenticationExample/Utility/DataSourceProvider/DataSourceProvider.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class DataSourceProvider<DataSource: DataSourceProvidable>: NSObject, UITableVie
4343
return sectionItem(at: indexPath)
4444
}
4545

46+
@discardableResult
4647
public func updateItem(at indexPath: IndexPath, item: Item) -> DataSource.Section.Item {
4748
return editSectionItem(at: indexPath, item: item)
4849
}

FirebaseAuth/Tests/SampleSwift/AuthenticationExample/ViewControllers/AuthViewController.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,8 @@ class AuthViewController: UIViewController, DataSourceProviderDelegate {
408408
return // Handle error case, returning early
409409
}
410410

411-
if let tokenResult = tokenResult, let claims = tokenResult.claims as? [String: Any] {
411+
if let tokenResult = tokenResult {
412+
let claims = tokenResult.claims
412413
var message = "Token refresh succeeded\n\n"
413414
for (key, value) in claims {
414415
message += "\(key): \(value)\n"
@@ -612,7 +613,7 @@ class AuthViewController: UIViewController, DataSourceProviderDelegate {
612613
if self.actionCodeRequestType == .email {
613614
AppManager.shared.auth().sendPasswordReset(withEmail: email, completion: completionHandler)
614615
} else {
615-
guard let actionCodeContinueURL = self.actionCodeContinueURL else {
616+
guard self.actionCodeContinueURL != nil else {
616617
print("Error: Action code continue URL is nil.")
617618
return
618619
}
@@ -684,9 +685,8 @@ class AuthViewController: UIViewController, DataSourceProviderDelegate {
684685
print("Check action code succeeded")
685686
let email = info.email
686687
let previousEmail = info.previousEmail
687-
let message = previousEmail != nil ? "\(previousEmail!) -> \(email)" : email
688688
let operation = self.nameForActionCodeOperation(info.operation)
689-
showAlert(for: operation)
689+
showAlert(for: operation, message: previousEmail ?? email)
690690
}
691691
showTextInputPrompt(with: "OOB Code:") {
692692
oobCode in
@@ -724,7 +724,7 @@ class AuthViewController: UIViewController, DataSourceProviderDelegate {
724724
return
725725
}
726726
print("Verify password resest code succeeded.")
727-
showAlert(for: "Code verified for email: \(email)")
727+
showAlert(for: "Code verified for email: \(email ?? "missing email")")
728728
}
729729
showTextInputPrompt(with: "OOB Code: ") {
730730
oobCode in
@@ -1030,7 +1030,7 @@ class AuthViewController: UIViewController, DataSourceProviderDelegate {
10301030
return nil
10311031
}
10321032

1033-
func showAlert(for message: String) {
1033+
func showAlert(for title: String, message: String? = nil) {
10341034
let alertController = UIAlertController(
10351035
title: message,
10361036
message: nil,

FirebaseAuth/Tests/SampleSwift/AuthenticationExample/ViewControllers/SettingsViewController.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class SettingsViewController: UIViewController, DataSourceProviderDelegate {
132132
let tokenType = token.type == .prod ? "Production" : "Sandbox"
133133
let message = "token: \(token.string)\ntype: \(tokenType)"
134134

135-
let prompt = UIAlertController(title: nil, message: "Clear APNs Token?",
135+
let prompt = UIAlertController(title: "Clear APNs Token?", message: message,
136136
preferredStyle: .alert)
137137
let okAction = UIAlertAction(title: "OK", style: .default) { action in
138138
AppManager.shared.auth().tokenManager.token = nil
@@ -144,7 +144,8 @@ class SettingsViewController: UIViewController, DataSourceProviderDelegate {
144144

145145
func clearAppCredential() {
146146
if let credential = AppManager.shared.auth().appCredentialManager.credential {
147-
let prompt = UIAlertController(title: nil, message: "Clear APNs Token?",
147+
let message = "receipt:\(credential.receipt) secret:\(credential.secret ?? "nil")"
148+
let prompt = UIAlertController(title: "Clear App Credential", message: message,
148149
preferredStyle: .alert)
149150
let okAction = UIAlertAction(title: "OK", style: .default) { action in
150151
AppManager.shared.auth().appCredentialManager.clearCredential()

FirebaseAuth/Tests/SampleSwift/README.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,7 @@ Firebase Auth offers multiple ways to authenticate users. In this sample, we dem
1212

1313
Ready? Let's get started! 🏎💨
1414

15-
Run `pod install`. This command will install all of the required cocoapods for this sample and generate a `.xcworkspace` project. Go ahead and open the `AuthenticationExample.xcworkspace` project.
16-
17-
### Terminal commands to clone and open the project!
18-
```bash
19-
$ pod install --repo-update
20-
21-
$ open AuthenticationExample.xcworkspace
22-
23-
```
15+
Open the `AuthenticationExample.xcodeproj` project.
2416

2517
## Connecting to the [Firebase Console](https://console.firebase.google.com)
2618

0 commit comments

Comments
 (0)