diff --git a/WaniKani/src/tr/xip/wanikani/app/activity/FirstTimeActivity.java b/WaniKani/src/tr/xip/wanikani/app/activity/FirstTimeActivity.java index 62848a0..3a460f1 100644 --- a/WaniKani/src/tr/xip/wanikani/app/activity/FirstTimeActivity.java +++ b/WaniKani/src/tr/xip/wanikani/app/activity/FirstTimeActivity.java @@ -70,6 +70,7 @@ public void onResponse(Call> call, Response> respons if (response.isSuccessful() && response.body().user_information != null) { PrefManager.setApiKey(mApiKey.getText().toString()); PrefManager.setFirstLaunch(false); + WaniKaniApi.init(); startActivity(new Intent(context, MainActivity.class)); // Set an alarm for notifications for the first time diff --git a/WaniKani/src/tr/xip/wanikani/client/WaniKaniApi.java b/WaniKani/src/tr/xip/wanikani/client/WaniKaniApi.java index b7bc9ef..9f75f06 100644 --- a/WaniKani/src/tr/xip/wanikani/client/WaniKaniApi.java +++ b/WaniKani/src/tr/xip/wanikani/client/WaniKaniApi.java @@ -1,8 +1,5 @@ package tr.xip.wanikani.client; -import java.io.IOException; -import java.util.List; - import okhttp3.OkHttpClient; import okhttp3.logging.HttpLoggingInterceptor; import retrofit2.Call; @@ -11,7 +8,6 @@ import tr.xip.wanikani.BuildConfig; import tr.xip.wanikani.managers.PrefManager; import tr.xip.wanikani.models.CriticalItemsList; -import tr.xip.wanikani.models.ItemsList; import tr.xip.wanikani.models.KanjiList; import tr.xip.wanikani.models.LevelProgression; import tr.xip.wanikani.models.RadicalsList; @@ -29,12 +25,12 @@ public abstract class WaniKaniApi { private static String API_KEY; static { - if (API_KEY == null) { - API_KEY = PrefManager.getApiKey(); - } - if (service == null) { - setupService(); - } + init(); + } + + public static void init() { + API_KEY = PrefManager.getApiKey(); + setupService(); } private static void setupService() {