Zerobyw: update URL on all HTTP errors (#16171)
This commit is contained in:
		
							parent
							
								
									6d6c4aa04f
								
							
						
					
					
						commit
						4c13f3836b
					
				@ -5,7 +5,7 @@ ext {
 | 
				
			|||||||
    extName = 'Zerobyw'
 | 
					    extName = 'Zerobyw'
 | 
				
			||||||
    pkgNameSuffix = 'zh.zerobyw'
 | 
					    pkgNameSuffix = 'zh.zerobyw'
 | 
				
			||||||
    extClass = '.Zerobyw'
 | 
					    extClass = '.Zerobyw'
 | 
				
			||||||
    extVersionCode = 15
 | 
					    extVersionCode = 16
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
apply from: "$rootDir/common.gradle"
 | 
					apply from: "$rootDir/common.gradle"
 | 
				
			||||||
 | 
				
			|||||||
@ -11,7 +11,7 @@ import okhttp3.OkHttpClient
 | 
				
			|||||||
import okhttp3.Response
 | 
					import okhttp3.Response
 | 
				
			||||||
import java.io.IOException
 | 
					import java.io.IOException
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private const val DEFAULT_BASE_URL = "http://www.zerobyw4090.com"
 | 
					private const val DEFAULT_BASE_URL = "http://www.zerobyw3.com"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private const val BASE_URL_PREF = "ZEROBYW_BASEURL"
 | 
					private const val BASE_URL_PREF = "ZEROBYW_BASEURL"
 | 
				
			||||||
private const val DEFAULT_BASE_URL_PREF = "defaultBaseUrl"
 | 
					private const val DEFAULT_BASE_URL_PREF = "defaultBaseUrl"
 | 
				
			||||||
@ -78,7 +78,7 @@ class UpdateUrlInterceptor(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        val failedResult = try {
 | 
					        val failedResult = try {
 | 
				
			||||||
            val response = chain.proceed(request)
 | 
					            val response = chain.proceed(request)
 | 
				
			||||||
            if (response.code < 500) return response
 | 
					            if (response.isSuccessful) return response
 | 
				
			||||||
            Result.success(response)
 | 
					            Result.success(response)
 | 
				
			||||||
        } catch (e: IOException) {
 | 
					        } catch (e: IOException) {
 | 
				
			||||||
            if (chain.call().isCanceled()) throw e
 | 
					            if (chain.call().isCanceled()) throw e
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user