From d2e0bfc5f641b73051d448bd2e0a9d1d35403059 Mon Sep 17 00:00:00 2001 From: Kaustubh Patange Date: Mon, 8 Jun 2020 11:08:18 +0530 Subject: [PATCH] [Updated] Spotify OAuth library --- app/spotifyapi/build.gradle | 4 ++-- .../main/java/com/kpstv/spotifyapi/SpotifyClient.kt | 12 ++++++------ publish.gradle | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/spotifyapi/build.gradle b/app/spotifyapi/build.gradle index 833c117..5432839 100644 --- a/app/spotifyapi/build.gradle +++ b/app/spotifyapi/build.gradle @@ -19,7 +19,7 @@ android { minSdkVersion 16 targetSdkVersion 29 versionCode 1 - versionName "0.13" + versionName "0.15" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles 'consumer-rules.pro' @@ -46,7 +46,7 @@ dependencies { implementation 'androidx.activity:activity-ktx:1.2.0-alpha05' - implementation 'com.spotify.android:auth:1.1.0' + implementation 'com.spotify.android:auth:1.2.3' // OkHttp implementation 'com.squareup.okhttp3:okhttp:3.1.2' diff --git a/app/spotifyapi/src/main/java/com/kpstv/spotifyapi/SpotifyClient.kt b/app/spotifyapi/src/main/java/com/kpstv/spotifyapi/SpotifyClient.kt index 075d9e6..5f92e2f 100644 --- a/app/spotifyapi/src/main/java/com/kpstv/spotifyapi/SpotifyClient.kt +++ b/app/spotifyapi/src/main/java/com/kpstv/spotifyapi/SpotifyClient.kt @@ -11,7 +11,7 @@ import androidx.activity.result.contract.ActivityResultContracts import com.google.gson.Gson import com.google.gson.GsonBuilder import com.kpstv.spotifyapi.enumerations.Scopes -import com.spotify.sdk.android.authentication.LoginActivity +import com.spotify.sdk.android.auth.LoginActivity import okhttp3.* import java.io.IOException import java.util.* @@ -54,8 +54,8 @@ class SpotifyClient( * This flow will generate access_token and refresh_token. */ fun invokeAuthorizationFlow(): Unit = with(activity) { - val builder = com.spotify.sdk.android.authentication.AuthenticationRequest.Builder( - CLIENT_ID, com.spotify.sdk.android.authentication.AuthenticationResponse.Type.CODE, + val builder = com.spotify.sdk.android.auth.AuthorizationRequest.Builder( + CLIENT_ID, com.spotify.sdk.android.auth.AuthorizationResponse.Type.CODE, REDIRECT_URI ) @@ -85,19 +85,19 @@ class SpotifyClient( responseAction: ResponseAction? ) { if (requestCode == AUTHORIZATION_REQUEST_CODE) { - val response = com.spotify.sdk.android.authentication.AuthenticationClient.getResponse( + val response = com.spotify.sdk.android.auth.AuthorizationClient.getResponse( resultCode, data ) when (response.type) { - com.spotify.sdk.android.authentication.AuthenticationResponse.Type.CODE -> { + com.spotify.sdk.android.auth.AuthorizationResponse.Type.CODE -> { val authToken = response.code makeAResponse( "grant_type=authorization_code&code=$authToken&redirect_uri=$REDIRECT_URI" , responseAction ) } - com.spotify.sdk.android.authentication.AuthenticationResponse.Type.ERROR -> { + com.spotify.sdk.android.auth.AuthorizationResponse.Type.ERROR -> { responseAction?.onError(Exception("Authentication is denied")) } else -> diff --git a/publish.gradle b/publish.gradle index c6afa60..2c42492 100644 --- a/publish.gradle +++ b/publish.gradle @@ -75,8 +75,8 @@ afterEvaluate { url = 'https://github.com/KaustubhPatange/Unofficial-Spotify-SDK' licenses { license { - name = 'GNU General Public License, Version 3.0' - url = 'https://www.gnu.org/licenses/gpl-3.0.txt' + name = 'The Apache License, Version 2.0' + url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' } } developers {