-
Notifications
You must be signed in to change notification settings - Fork 178
Improve booking server and Firebase integration #189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
aa90065
7fb200f
4420e2b
7476ee0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -680,7 +680,13 @@ class BookingAssistantViewModel @Inject constructor( | |
|
|
||
| private suspend fun getFirebaseAuthToken(): String { | ||
| log("getFirebaseAuthToken: getting FirebaseAuth instance") | ||
| val auth = FirebaseAuth.getInstance() | ||
| val auth = try { | ||
| FirebaseAuth.getInstance() | ||
| } catch (e: Exception) { | ||
| log("FirebaseAuth.getInstance failed: ${e.message}") | ||
| Log.e("BookingAssistant", "FirebaseAuth.getInstance failed", e) | ||
| return "" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we return an empty token here? should it return the exception?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Basically we choose to catch the exception here instead of at the caller site so that we can run the app even when firebase is not initialized and at least test the other features. Not the best user experience as the firebase features would not work, but that's not our demo scenario anyway. |
||
| } | ||
| var user = auth.currentUser | ||
| log("getFirebaseAuthToken: current user is ${user?.uid ?: "null"}") | ||
| if (user == null) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If initialization fails how the app should work? Do we need to exit here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah the rest of the features will still work so no need to fully cancel. We should just make sure not to crash