mirzemehdi / KMPAuth

Kotlin Multiplatform Authentication Library targetting android and iOS
https://mirzemehdi.com/KMPAuth/
Apache License 2.0
231 stars 19 forks source link

Added StrictMode in Android target #43

Closed siarhei-luskanau closed 1 month ago

mirzemehdi commented 3 months ago

@siarhei-luskanau Why this is necessary?

siarhei-luskanau commented 3 months ago

Current implementation crashes with IO operations in the main thread if StrictMode.detectDiskReads(). Looks like Firebase libraries reads preferences in main thread, and LaunchedEffect with 'Dispatchers.IO' solves the issue. Probably there are better ways fix this issue. The second place is 'Image' component. Image read vector resources in the main thread in "1.6.10" version, but "1.7.0-alpha03" version have no issue with StrictMode. Probably it is better to wait "1.7.0" release version of compose multiplatform.

mirzemehdi commented 1 month ago

@siarhei-luskanau Thank you very much for bringing this up. Turns out StrictMode violation occurs because of initialization of Firebase. So basically if you just add Firebase.auth code into your application start method, then there will be no issue :)

mirzemehdi commented 1 month ago

@siarhei-luskanau Closing this PR, as these changes would be irrelevant. But thank you for temporary solution!