@@ -150,9 +150,9 @@ internal interface FirebaseSessionsComponent {
150150 },
151151 scope = CoroutineScope (blockingDispatcher),
152152 produceFile = {
153- prepDataStoreFile(
154- appContext.dataStoreFile( " firebaseSessions/sessionConfigsDataStore.data " )
155- )
153+ appContext.dataStoreFile( " firebaseSessions/sessionConfigsDataStore.data " ). also {
154+ prepDataStoreFile(it )
155+ }
156156 },
157157 )
158158
@@ -172,7 +172,9 @@ internal interface FirebaseSessionsComponent {
172172 },
173173 scope = CoroutineScope (blockingDispatcher),
174174 produceFile = {
175- prepDataStoreFile(appContext.dataStoreFile(" firebaseSessions/sessionDataStore.data" ))
175+ appContext.dataStoreFile(" firebaseSessions/sessionDataStore.data" ).also {
176+ prepDataStoreFile(it)
177+ }
176178 },
177179 )
178180
@@ -211,8 +213,8 @@ internal interface FirebaseSessionsComponent {
211213 * Prepares the DataStore file by ensuring its parent directory exists. Throws [IOException]
212214 * if the directory could not be created, or if a conflicting file could not be removed.
213215 */
214- private fun prepDataStoreFile (dataStoreFile : File ): File {
215- val parentDir = dataStoreFile.parentFile ? : return dataStoreFile
216+ private fun prepDataStoreFile (dataStoreFile : File ) {
217+ val parentDir = dataStoreFile.parentFile ? : return
216218
217219 // Check if something exists at the path, but isn't a directory
218220 if (parentDir.exists() && ! parentDir.isDirectory) {
@@ -225,7 +227,7 @@ internal interface FirebaseSessionsComponent {
225227 }
226228
227229 if (parentDir.isDirectory) {
228- return dataStoreFile
230+ return
229231 }
230232
231233 if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
@@ -242,8 +244,6 @@ internal interface FirebaseSessionsComponent {
242244 }
243245 }
244246 }
245-
246- return dataStoreFile
247247 }
248248 }
249249 }
0 commit comments