mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-19 16:19:33 +01:00
Set a better User-Agent on requests.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package org.thoughtcrime.securesms.net;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.BuildConfig;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class UserAgentInterceptor implements Interceptor {
|
||||
|
||||
private static final String USER_AGENT = "Signal-Android " + BuildConfig.VERSION_NAME + " (API " + Build.VERSION.SDK_INT + ")";
|
||||
|
||||
@Override
|
||||
public Response intercept(@NonNull Chain chain) throws IOException {
|
||||
return chain.proceed(chain.request().newBuilder()
|
||||
.header("User-Agent", USER_AGENT)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user