File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
firebase-sessions/src/main/kotlin/com/google/firebase/sessions Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,7 @@ internal class SessionLifecycleService : Service() {
128
128
/* * Generates a new session id and sends it everywhere it's needed */
129
129
private fun newSession () {
130
130
try {
131
+ // TODO(mrober): Consider migrating to Dagger, or update [FirebaseSessionsRegistrar].
131
132
SessionGenerator .instance.generateNewSession()
132
133
Log .d(TAG , " Generated new session." )
133
134
broadcastSession()
@@ -152,17 +153,17 @@ internal class SessionLifecycleService : Service() {
152
153
}
153
154
154
155
private fun maybeSendSessionToClient (client : Messenger ) {
155
- if (hasForegrounded) {
156
- sendSessionToClient(client, SessionGenerator .instance.currentSession.sessionId)
157
- } else {
158
- try {
156
+ try {
157
+ if (hasForegrounded) {
158
+ sendSessionToClient(client, SessionGenerator .instance.currentSession.sessionId)
159
+ } else {
159
160
// Send the value from the datastore before the first foregrounding it exists
160
161
val storedSession = SessionDatastore .instance.getCurrentSessionId()
161
162
Log .d(TAG , " App has not yet foregrounded. Using previously stored session." )
162
163
storedSession?.let { sendSessionToClient(client, it) }
163
- } catch (ex: IllegalStateException ) {
164
- Log .w(TAG , " Failed to send session to client." , ex)
165
164
}
165
+ } catch (ex: IllegalStateException ) {
166
+ Log .w(TAG , " Failed to send session to client." , ex)
166
167
}
167
168
}
168
169
You can’t perform that action at this time.
0 commit comments