package com.xebia.xtime;

import android.app.Application;

import com.xebia.xtime.webservice.XTimeCookieJar;
import com.xebia.xtime.webservice.XTimeWebService;

import timber.log.Timber;

public class XTimeApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        initLogging();
        initHttpClient();
    }

    private void initHttpClient() {
        Timber.d("Init HTTP client");
        XTimeWebService.init(new XTimeCookieJar(this));
    }

    private void initLogging() {
        if (BuildConfig.DEBUG) {
            Timber.plant(new Timber.DebugTree());
        }
    }

}

@@ -50,16 +50,103 @@
 ication;
+%0Aimport android.content.SharedPreferences;%0Aimport android.preference.PreferenceManager;
 %0A%0Aimport
@@ -435,24 +435,564 @@
 tpClient();%0A
+        cleanOldPrefs();%0A    %7D%0A%0A    /**%0A     * Cleans up any old login credentials%0A     */%0A    private void cleanOldPrefs() %7B%0A        final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);%0A        if (preferences.contains(%22com.xebia.xtime.extra.PASSWORD%22)) %7B%0A            Timber.d(%22Clean up old preferences%22);%0A            preferences.edit()%0A                    .remove(%22com.xebia.xtime.extra.USERNAME%22)%0A                    .remove(%22com.xebia.xtime.extra.PASSWORD%22)%0A                    .apply();%0A        %7D%0A
     %7D%0A%0A    p

Clean up old preferences on app startup