fix(android): default UA (#3429)
* Update DataSourceUtil.java * fix(android): default UA
This commit is contained in:
parent
c8983f4094
commit
dd7bb54720
@ -87,11 +87,16 @@ public class DataSourceUtil {
|
||||
ForwardingCookieHandler handler = new ForwardingCookieHandler(context);
|
||||
container.setCookieJar(new JavaNetCookieJar(handler));
|
||||
OkHttpDataSource.Factory okHttpDataSourceFactory = new OkHttpDataSource.Factory((Call.Factory) client)
|
||||
.setUserAgent(getUserAgent(context))
|
||||
.setTransferListener(bandwidthMeter);
|
||||
|
||||
if (requestHeaders != null)
|
||||
if (requestHeaders != null) {
|
||||
okHttpDataSourceFactory.setDefaultRequestProperties(requestHeaders);
|
||||
if (!requestHeaders.containsKey("User-Agent")) {
|
||||
okHttpDataSourceFactory.setUserAgent(getUserAgent(context));
|
||||
}
|
||||
} else {
|
||||
okHttpDataSourceFactory.setUserAgent(getUserAgent(context));
|
||||
}
|
||||
|
||||
return okHttpDataSourceFactory;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user