Commit fd1f1105 authored by Niklas Fix's avatar Niklas Fix 🎓

add getter method for baseURL and use it in smartLoad method

parent 2f83b0c3
package de.akamu.tudarmstadt.api;
import android.app.Application;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
......@@ -21,7 +19,6 @@ import de.akamu.tudarmstadt.api.interceptor.TokenInterceptor;
import de.akamu.tudarmstadt.api.interceptor.UnauthorizedInterceptor;
import de.akamu.tudarmstadt.exceptions.AkamuAPIException;
import de.akamu.tudarmstadt.model.JWT;
import de.akamu.tudarmstadt.util.AppUserUtil;
import okhttp3.HttpUrl;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
......@@ -38,9 +35,8 @@ import okhttp3.Response;
public final class V2API {
private static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
private static final String baseURL = "https://dev.akamu.de/api/v2/"; // Dev version of server
// private static final String baseURL = "http://192.168.0.186:8080/"; // Docker version of server
// private static final String baseURL = "http://172.18.95.200:8080/"; // Docker version of server
private static final String baseURL = "https://akamu.de/api/v2/";
// private static final String baseURL = "https://dev.akamu.de/api/v2/"; // Dev version of server
private static String token = "";
private static Date expire;
private static final OkHttpClient client = new OkHttpClient.Builder()
......@@ -220,4 +216,7 @@ public final class V2API {
return code < 300 && code >= 200;
}
public static String getBaseURL() {
return baseURL;
}
}
......@@ -17,7 +17,7 @@ class AkamuResource {
return
}
}
val glideUrl = GlideUrl("https://dev.akamu.de/api/v2/resource/$resId") {
val glideUrl = GlideUrl(V2API.getBaseURL() + "resource/$resId") {
mapOf(Pair("Authorization", "Bearer ${V2API.getToken()}"))
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment