mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 02:17:41 +00:00 
			
		
		
		
	fix crash when calling getOkHttpInterceptor
This commit is contained in:
		
							parent
							
								
									019383378d
								
							
						
					
					
						commit
						e78b96348b
					
				| @ -45,13 +45,6 @@ public class HttpClient { | |||||||
|     public static OkHttpClient getOkHttpClient() { |     public static OkHttpClient getOkHttpClient() { | ||||||
|         if (mOkHttpClient == null) { |         if (mOkHttpClient == null) { | ||||||
|              |              | ||||||
|             mOkHttpInterceptor = new HttpInterceptor() |  | ||||||
|                     .addRequestInterceptor(new UserAgentInterceptor( |  | ||||||
|                                     // TODO Try to get rid of this dependency |  | ||||||
|                                     OwnCloudClientManagerFactory.getUserAgent() |  | ||||||
|                             ) |  | ||||||
|                     ); |  | ||||||
| 
 |  | ||||||
|             mOkHttpClient = new OkHttpClient.Builder() |             mOkHttpClient = new OkHttpClient.Builder() | ||||||
|                     .addInterceptor(mOkHttpInterceptor) |                     .addInterceptor(mOkHttpInterceptor) | ||||||
|                     .protocols(Arrays.asList(Protocol.HTTP_1_1)) |                     .protocols(Arrays.asList(Protocol.HTTP_1_1)) | ||||||
| @ -63,6 +56,14 @@ public class HttpClient { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public static HttpInterceptor getOkHttpInterceptor() { |     public static HttpInterceptor getOkHttpInterceptor() { | ||||||
|  |         if(mOkHttpInterceptor == null) { | ||||||
|  |             mOkHttpInterceptor = new HttpInterceptor() | ||||||
|  |                     .addRequestInterceptor(new UserAgentInterceptor( | ||||||
|  |                                     // TODO Try to get rid of this dependency | ||||||
|  |                                     OwnCloudClientManagerFactory.getUserAgent() | ||||||
|  |                             ) | ||||||
|  |                     ); | ||||||
|  |         } | ||||||
|         return mOkHttpInterceptor; |         return mOkHttpInterceptor; | ||||||
|     } |     } | ||||||
| } | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user