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() {
128128 /* * Generates a new session id and sends it everywhere it's needed */
129129 private fun newSession () {
130130 try {
131+ // TODO(mrober): Consider migrating to Dagger, or update [FirebaseSessionsRegistrar].
131132 SessionGenerator .instance.generateNewSession()
132133 Log .d(TAG , " Generated new session." )
133134 broadcastSession()
@@ -152,17 +153,17 @@ internal class SessionLifecycleService : Service() {
152153 }
153154
154155 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 {
159160 // Send the value from the datastore before the first foregrounding it exists
160161 val storedSession = SessionDatastore .instance.getCurrentSessionId()
161162 Log .d(TAG , " App has not yet foregrounded. Using previously stored session." )
162163 storedSession?.let { sendSessionToClient(client, it) }
163- } catch (ex: IllegalStateException ) {
164- Log .w(TAG , " Failed to send session to client." , ex)
165164 }
165+ } catch (ex: IllegalStateException ) {
166+ Log .w(TAG , " Failed to send session to client." , ex)
166167 }
167168 }
168169
You can’t perform that action at this time.
0 commit comments