Skip to content

Commit 486cc27

Browse files
committed
Merge remote-tracking branch 'origin/dev' into dev
2 parents 8111777 + 4bb3e9d commit 486cc27

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/androidMain/kotlin/com/adamratzman/spotify/auth/pkce/AbstractSpotifyPkceLoginActivity.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,15 @@ public abstract class AbstractSpotifyPkceLoginActivity : AppCompatActivity() {
8686
super.onCreate(savedInstanceState)
8787
setContentView(R.layout.spotify_pkce_auth_layout)
8888

89-
authorizationIntent = Intent(Intent.ACTION_VIEW, getAuthorizationUrl())
9089
credentialStore = application.getDefaultCredentialStore(clientId, redirectUri)
9190

92-
startActivity(authorizationIntent)
91+
// This activity is recreated on every launch, therefore we need to make sure not to
92+
// launch the activity when a Spotify intent result has been received
93+
if (intent?.isSpotifyPkceAuthIntent(redirectUri) == false) {
94+
authorizationIntent = Intent(Intent.ACTION_VIEW, getAuthorizationUrl())
95+
startActivity(authorizationIntent)
96+
finish()
97+
}
9398
}
9499

95100
/**

0 commit comments

Comments
 (0)