Skip to content

Commit

Permalink
#122 Add Trakt get access token by code in repository
Browse files Browse the repository at this point in the history
  • Loading branch information
hadi-norouzi committed Sep 13, 2024
1 parent 06c15b0 commit e734017
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ interface TraktAuthRepository {
suspend fun logout()

suspend fun getLoginCode(): Result<TraktCodeLogin, GeneralError>

suspend fun getAccessTokenByDeviceCode(deviceCode: String): Result<TraktTokens, GeneralError>
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,12 @@ class TraktAuthRepositoryImpl @Inject constructor(

override suspend fun getLoginCode(): Result<TraktCodeLogin, GeneralError> =
traktAuthRemoteSource.getLoginCode()

override suspend fun getAccessTokenByDeviceCode(deviceCode: String): Result<TraktTokens, GeneralError> {
val result = traktAuthRemoteSource.getAccessTokenByDeviceCode(code = deviceCode)
if (result is Result.Success) {
traktAuthLocalSource.storeAuthTokens(result.data)
}
return result
}
}

0 comments on commit e734017

Please sign in to comment.