From a52e5dd89bf1f0f99155a123d6a5a9f9b1775b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mieszko=20Wrzeszczy=C5=84ski?= Date: Thu, 29 Nov 2018 22:34:31 +0100 Subject: [PATCH] Increase version --- app/build.gradle | 4 +- .../network/RetrofitClientInstance.java | 55 ------------------- 2 files changed, 2 insertions(+), 57 deletions(-) delete mode 100644 app/src/main/java/com/uam/wmi/findmytutor/network/RetrofitClientInstance.java diff --git a/app/build.gradle b/app/build.gradle index ab29415..e5042a6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.uam.wmi.findmytutor" minSdkVersion 22 targetSdkVersion 27 - versionCode 7 - versionName "0.9.0-alpha" + versionCode 8 + versionName "0.9.1-alpha" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true } diff --git a/app/src/main/java/com/uam/wmi/findmytutor/network/RetrofitClientInstance.java b/app/src/main/java/com/uam/wmi/findmytutor/network/RetrofitClientInstance.java deleted file mode 100644 index c59609b..0000000 --- a/app/src/main/java/com/uam/wmi/findmytutor/network/RetrofitClientInstance.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.uam.wmi.findmytutor.network; - -import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; - -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.logging.HttpLoggingInterceptor; -import retrofit2.Retrofit; -import retrofit2.converter.gson.GsonConverterFactory; - -public class RetrofitClientInstance { - - private static final String BASE_URL = "https://s416084.projektstudencki.pl/develop/"; - - private static Retrofit.Builder builder - = new Retrofit.Builder() - .baseUrl(BASE_URL) - .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) - .addConverterFactory(GsonConverterFactory.create()); - - private static Retrofit retrofit = builder.build(); - - private static OkHttpClient.Builder httpClient - = new OkHttpClient.Builder(); - - private static HttpLoggingInterceptor logging - = new HttpLoggingInterceptor() - .setLevel(HttpLoggingInterceptor.Level.BASIC); - - public static S createService(Class serviceClass) { - if (!httpClient.interceptors().contains(logging)) { - httpClient.addInterceptor(logging); - builder.client(httpClient.build()); - retrofit = builder.build(); - } - return retrofit.create(serviceClass); - } - - public static S createService(Class serviceClass, final String token) { - if (token != null) { - httpClient.interceptors().clear(); - httpClient.addInterceptor(chain -> { - Request original = chain.request(); - Request.Builder builder1 = original.newBuilder() - .header("Authorization", "Bearer " + token); - Request request = builder1.build(); - return chain.proceed(request); - }); - builder.client(httpClient.build()); - retrofit = builder.build(); - } - return retrofit.create(serviceClass); - } -} - -- 2.20.1