Open undefiened opened 1 year ago
Hi @undefiened sorry I have been busy, but anyway I think the correct way to do it, will be something akin to what SettingsTrackingScreen.kt does it. When the user have logged in successfully it will have a check mark next to it, so I suggest checking that out and see how it's being done.
I did check out SettingsTrackingScreen.kt in the past but not entirely sure how they done it, other than that I suggest going into tachiyomi discord server and head to the #programming channel and ask there.
In addition to that, also hide the "purge google drive" button until the user signs in.
Unfortunately, I am not as advanced with Kotlin and Jetpack Compose, so it took me quite a while and I couldn't figure out how to implement it without introducing a
mutableStateOf
in theGoogleDriveService
. The problem is that theGoogleDriveService
gets updated only after the user is redirected from the browser into theGoogleDriveLoginActivity
which then further runs the remaining part of the authorization process inGoogleDriveService
, so it is pretty hard to subscribe to it. So I did the easiest possible solution instead, which unfortunately introduces a useless variable in theGoogleDriveService
.If it doesn't look good (and I do realize that it probably doesn't), could you please kindly point me in the direction of some mechanism that would allow me to do it in a cleaner way? Or should I do something like an Observable pattern (or something similar)? It is just that what I did feels exactly like that, but takes only 2 lines of code, so I am a bit split as to what would be the best practice.