Skip to content

Commit 3f5a140

Browse files
committed
Cleanup
Signed-off-by: Peter Friese <[email protected]>
1 parent 487de6b commit 3f5a140

File tree

4 files changed

+11
-21
lines changed

4 files changed

+11
-21
lines changed

Examples/FriendlyFlix/app/FriendlyFlix/FriendlyFlix/App/FriendlyFlixApp.swift

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,13 @@ import SwiftUI
2020

2121
@main
2222
struct FriendlyFlixApp: App {
23-
private func loadRocketSimConnect() {
24-
#if DEBUG
25-
guard Bundle(
26-
path: "/Applications/RocketSim.app/Contents/Frameworks/RocketSimConnectLinker.nocache.framework"
27-
)?
28-
.load() == true else {
29-
print("Failed to load linker framework")
30-
return
31-
}
32-
print("RocketSim Connect successfully linked")
33-
#endif
34-
}
35-
3623
var authenticationService: AuthenticationService?
3724

3825
init() {
39-
loadRocketSimConnect()
4026
FirebaseApp.configure()
4127

4228
authenticationService = AuthenticationService()
4329
authenticationService?.onSignUp { user in
44-
print(
45-
"User signed in \(user.displayName ?? "(no fullname)") with email \(user.email ?? "(no email)")"
46-
)
4730
let userName = String(user.email?.split(separator: "@").first ?? "(unknown)")
4831
Task {
4932
try await DataConnect.friendlyFlixConnector.upsertUserMutation.execute(username: userName)

Examples/FriendlyFlix/app/FriendlyFlix/FriendlyFlix/Features/Authentication/AuthenticationScreen.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import AuthenticationServices
1616
import SwiftUI
17+
import os
1718

1819
private enum FocusableField: Hashable {
1920
case email
@@ -27,6 +28,7 @@ private enum AuthenticationFlow {
2728
}
2829

2930
struct AuthenticationScreen: View {
31+
private let logger = Logger(subsystem: "FriendlyFlix", category: "auth")
3032
@Environment(AuthenticationService.self) var authenticationService
3133
@Environment(\.colorScheme) private var colorScheme
3234
@Environment(\.dismiss) private var dismiss
@@ -61,7 +63,7 @@ struct AuthenticationScreen: View {
6163
try await authenticationService.signInWithEmailPassword(email: email, password: password)
6264
dismiss()
6365
} catch {
64-
print(error.localizedDescription)
66+
logger.error("Error when signing in with email / password: \(error.localizedDescription)")
6567
errorMessage = error.localizedDescription
6668
}
6769
}
@@ -74,7 +76,7 @@ struct AuthenticationScreen: View {
7476
errorMessage = ""
7577
dismiss()
7678
} catch {
77-
print(error.localizedDescription)
79+
logger.error("Error when signing up with email / password: \(error.localizedDescription)")
7880
errorMessage = error.localizedDescription
7981
}
8082
}

Examples/FriendlyFlix/app/FriendlyFlix/FriendlyFlix/Features/Authentication/AuthenticationService.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import FirebaseAuth
1616
import Foundation
1717
import Observation
18+
import os
1819

1920
enum AuthenticationState {
2021
case unauthenticated
@@ -24,6 +25,8 @@ enum AuthenticationState {
2425

2526
@Observable
2627
class AuthenticationService {
28+
private let logger = Logger(subsystem: "FriendlyFlix", category: "auth")
29+
2730
var presentingAuthenticationDialog = false
2831
var presentingAccountDialog = false
2932

@@ -57,6 +60,7 @@ class AuthenticationService {
5760
try await Auth.auth().createUser(withEmail: email, password: password)
5861

5962
if let onSignUp, let user = Auth.auth().currentUser {
63+
logger.debug("User signed in \(user.displayName ?? "(no fullname)") with email \(user.email ?? "(no email)")")
6064
onSignUp(user)
6165
}
6266

Examples/FriendlyFlix/app/FriendlyFlix/FriendlyFlix/Features/Details/MovieCardView.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ import FirebaseDataConnect
1616
import FriendlyFlixSDK
1717
import NukeUI
1818
import SwiftUI
19+
import os
1920

2021
struct MovieCardView: View {
22+
private let logger = Logger(subsystem: "FriendlyFlix", category: "moviecard")
2123
@Environment(\.dismiss) private var dismiss
2224
private var connector = DataConnect.friendlyFlixConnector
2325

@@ -32,7 +34,6 @@ struct MovieCardView: View {
3234
}
3335

3436
// MARK: - Favourite handling
35-
3637
private let isFavouriteRef: QueryRefObservation<
3738
GetIfFavoritedMovieQuery.Data,
3839
GetIfFavoritedMovieQuery.Variables
@@ -132,7 +133,7 @@ extension MovieCardView {
132133
do {
133134
let _ = try await isFavouriteRef.execute()
134135
} catch {
135-
print(error)
136+
logger.error("Error when trying to fetch favourite status: \(error.localizedDescription)")
136137
}
137138
}
138139
}

0 commit comments

Comments
 (0)