diff options
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/utils')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java | 5 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java | 30 |
2 files changed, 28 insertions, 7 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java b/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java index 326139c0..d1ac0eb3 100644 --- a/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java @@ -39,6 +39,7 @@ import java.security.cert.X509Certificate; import java.security.interfaces.RSAPrivateKey; import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; +import java.util.Calendar; import se.leap.bitmaskclient.BuildConfig; import se.leap.bitmaskclient.ProviderAPI; @@ -177,4 +178,8 @@ public class ConfigHelper { public static boolean preferAnonymousUsage() { return BuildConfig.priotize_anonymous_usage; } + + public static int getCurrentTimezone() { + return Calendar.getInstance().get(Calendar.ZONE_OFFSET) / 3600000; + } } diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java b/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java index b1da1284..44831049 100644 --- a/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java @@ -2,7 +2,6 @@ package se.leap.bitmaskclient.utils; import android.content.Context; import android.content.SharedPreferences; -import android.os.Looper; import android.preference.PreferenceManager; import android.support.annotation.NonNull; import android.support.annotation.Nullable; @@ -10,12 +9,6 @@ import android.support.annotation.Nullable; import org.json.JSONException; import org.json.JSONObject; -import java.io.ByteArrayInputStream; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.math.BigInteger; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; @@ -239,6 +232,29 @@ public class PreferenceHelper { return result; } + /*public static void saveLastProfile(Context context, String uuid) { + if (context == null) { + return; + } + putString(context, PROVIDER_PROFILE_UUID, uuid); + } + + public static void clearLastProfile(Context context) { + if (context == null) { + return; + } + SharedPreferences preferences = context.getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE); + preferences.edit().remove(PROVIDER_PROFILE_UUID).apply(); + } + + public static String getLastProfile(Context context){ + return getString(context, PROVIDER_PROFILE_UUID, null); + } + + public static void saveLastGatewayNumber(Context context, int number) { + + } +*/ public static String getString(Context context, String key, String defValue) { SharedPreferences preferences = context.getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE); return preferences.getString(key, defValue); |