Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Fix AccountUi lag #919

Merged
merged 2 commits into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ internal class ActivityTraktAuthManager @Inject constructor(
private val clientAuth: Lazy<ClientAuthentication>,
private val logger: Logger
) : TraktAuthManager {
private val authService by lazy(LazyThreadSafetyMode.NONE) {
AuthorizationService(context)
}
private val authService = AuthorizationService(context)

override fun buildLoginIntent(): Intent {
return authService.getAuthorizationRequestIntent(requestProvider.get())
Expand Down
6 changes: 3 additions & 3 deletions trakt-auth/src/main/java/app/tivi/trakt/TraktAuthManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ import net.openid.appauth.AuthorizationException
import net.openid.appauth.AuthorizationResponse

interface TraktAuthManager {
fun buildLoginActivityResult(): LoginTrakt = LoginTrakt(buildLoginIntent())
fun buildLoginActivityResult(): LoginTrakt = LoginTrakt { buildLoginIntent() }
fun buildLoginIntent(): Intent
fun onLoginResult(result: LoginTrakt.Result)
}

class LoginTrakt internal constructor(
private val loginIntent: Intent,
private val intentBuilder: () -> Intent,
) : ActivityResultContract<Unit, LoginTrakt.Result?>() {
override fun createIntent(context: Context, input: Unit?): Intent = loginIntent
override fun createIntent(context: Context, input: Unit?): Intent = intentBuilder()

override fun parseResult(
resultCode: Int,
Expand Down