adamint / spotify-web-api-kotlin

Spotify Web API wrapper for Kotlin, Java, JS, and Native - Targets JVM, Android, JS (browser), Native (Desktop), and Apple tvOS/iOS. Includes a Spotify Web Playback SDK wrapper for Kotlin/JS, and a spotify-auth wrapper for Kotlin/Android.
https://adamint.github.io/spotify-web-api-kotlin-docs/
MIT License
194 stars 21 forks source link

Fixed issue with browser launching for SpotifyPkceLogin #282

Closed Nielssg closed 3 years ago

Nielssg commented 3 years ago

When using the AbstractSpotifyPkceLoginActivity, I stumbled upon issues regarding the launch of the browser. In this activity, specifically in the onCreate, a startActivity is used to open the browser and authenticate the user. When the user finishes in the browser, the app will be opened again. The problem I encountered was the re-opening of the browser, because this happens in the onCreate. I've added a check so it won't open the browser if a Spotify intent has been received, which helped solve the issue.

I have also added finish(), which I mainly did because of one reason: if the user gets the option to choose which browser to open, but the user dismisses the dialog, a black activity will remain. Because the activity is recreated after you've been in the browser, the best way to solve this issue is by finishing the activity after you've called startActivity.

adamint commented 3 years ago

Thanks for the contribution. Please let me know if you find anything else! These changes will be included in the next release sometime this week (7.0.01)