mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-11-25 02:14:32 +01:00
WebView User Agent Updated
This commit is contained in:
parent
86062f405c
commit
172c8d1f55
@ -35,8 +35,8 @@ android {
|
|||||||
applicationId 'com.shabinder.spotiflyer'
|
applicationId 'com.shabinder.spotiflyer'
|
||||||
minSdkVersion 22
|
minSdkVersion 22
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 6
|
versionCode 7
|
||||||
versionName "1.5"
|
versionName "1.5.1"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
packagingOptions {
|
packagingOptions {
|
||||||
|
@ -45,12 +45,10 @@ import kotlinx.coroutines.launch
|
|||||||
import okhttp3.Interceptor
|
import okhttp3.Interceptor
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
|
||||||
import retrofit2.Retrofit
|
import retrofit2.Retrofit
|
||||||
import retrofit2.converter.moshi.MoshiConverterFactory
|
import retrofit2.converter.moshi.MoshiConverterFactory
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class MainActivity : AppCompatActivity(){
|
class MainActivity : AppCompatActivity(){
|
||||||
@ -134,17 +132,13 @@ class MainActivity : AppCompatActivity(){
|
|||||||
* */
|
* */
|
||||||
private fun implementSpotifyService(token: String) {
|
private fun implementSpotifyService(token: String) {
|
||||||
val httpClient: OkHttpClient.Builder = OkHttpClient.Builder()
|
val httpClient: OkHttpClient.Builder = OkHttpClient.Builder()
|
||||||
httpClient.addInterceptor(object : Interceptor {
|
httpClient.addInterceptor(Interceptor { chain ->
|
||||||
|
val request: Request =
|
||||||
override fun intercept(chain: Interceptor.Chain): Response {
|
chain.request().newBuilder().addHeader(
|
||||||
val request: Request =
|
"Authorization",
|
||||||
chain.request().newBuilder().addHeader(
|
"Bearer $token"
|
||||||
"Authorization",
|
).build()
|
||||||
"Bearer $token"
|
chain.proceed(request)
|
||||||
).build()
|
|
||||||
return chain.proceed(request)
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
val retrofit = Retrofit.Builder()
|
val retrofit = Retrofit.Builder()
|
||||||
|
@ -258,14 +258,13 @@ object SpotifyDownloadHelper {
|
|||||||
@SuppressLint("SetJavaScriptEnabled")
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
fun applyWebViewSettings(webView: WebView) {
|
fun applyWebViewSettings(webView: WebView) {
|
||||||
val desktopUserAgent =
|
val desktopUserAgent =
|
||||||
"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/20100101 Firefox/4.0"
|
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0"
|
||||||
val mobileUserAgent =
|
val mobileUserAgent =
|
||||||
"Mozilla/5.0 (Linux; U; Android 4.4; en-us; Nexus 4 Build/JOP24G) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30"
|
"Mozilla/5.0 (Linux; U; Android 4.4; en-us; Nexus 4 Build/JOP24G) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30"
|
||||||
|
|
||||||
//Choose Mobile/Desktop client.
|
//Choose Mobile/Desktop client.
|
||||||
webView.settings.userAgentString = desktopUserAgent
|
webView.settings.userAgentString = desktopUserAgent
|
||||||
webView.settings.loadWithOverviewMode = true
|
webView.settings.loadWithOverviewMode = true
|
||||||
webView.settings.loadWithOverviewMode = true
|
|
||||||
webView.settings.builtInZoomControls = true
|
webView.settings.builtInZoomControls = true
|
||||||
webView.settings.setSupportZoom(true)
|
webView.settings.setSupportZoom(true)
|
||||||
webView.isScrollbarFadingEnabled = false
|
webView.isScrollbarFadingEnabled = false
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
<AppUpdater>
|
<AppUpdater>
|
||||||
<update>
|
<update>
|
||||||
<latestVersion>1.5</latestVersion>
|
<latestVersion>1.5.1</latestVersion>
|
||||||
<latestVersionCode>6</latestVersionCode>
|
<latestVersionCode>7</latestVersionCode>
|
||||||
<url>https://github.com/Shabinder/SpotiFlyer/releases/download/1.5/SpotiFlyer-v1.5.apk</url>
|
<url>https://github.com/Shabinder/SpotiFlyer/releases/download/1.5/SpotiFlyer-v1.5.apk</url>
|
||||||
</update>
|
</update>
|
||||||
</AppUpdater>
|
</AppUpdater>
|
Loading…
Reference in New Issue
Block a user