Skip to content

Commit

Permalink
disabled ssl verification temporarily and added new fr and es urls
Browse files Browse the repository at this point in the history
  • Loading branch information
romainpiel committed Jan 12, 2014
1 parent f5b8631 commit 04f4b12
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Library/android-websockets
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
public class PreferencesHelper {

private static final String KEY_PREFS_LAST_APP_VERSION = "last_app_version";
private static final String KEY_PREFS_CAMERA_ID = "camera_id";
private static final String APP_SHARED_PREFS = PreferencesHelper.class.getSimpleName();

Expand All @@ -38,6 +39,20 @@ public void saveCameraId(int cameraId) {
prefsEditor.apply();
}

public int getLastAppVersion(int defaultValue) {
return sharedPrefs.getInt(KEY_PREFS_LAST_APP_VERSION, defaultValue);
}

public void saveLastAppVersion(int lastAppVersion) {
prefsEditor.putInt(KEY_PREFS_LAST_APP_VERSION, lastAppVersion);
prefsEditor.apply();
}

public static void cleanDefault(Context context, int key) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
prefs.edit().remove(context.getString(key)).apply();
}

public static int getAutoKillTimeoutBg(Context context) {
return Integer.valueOf(getDefaultString(
context,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package com.romainpiel.meatspace;

import android.app.Application;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

import com.google.analytics.tracking.android.GoogleAnalytics;
import com.romainpiel.lib.helper.PreferencesHelper;

/**
* MeatspaceProject
Expand All @@ -12,11 +16,30 @@
*/
public class MeatspaceApplication extends Application {

private PreferencesHelper preferencesHelper;

@Override
public void onCreate() {
super.onCreate();

preferencesHelper = new PreferencesHelper(this);

// disable google analytics if in debug mode
GoogleAnalytics.getInstance(this).setDryRun(BuildConfig.DEBUG);

checkUpdate();
}

private void checkUpdate() {
int lastVersion = preferencesHelper.getLastAppVersion(0);
if (lastVersion < BuildConfig.VERSION_CODE) {

// some base url were changed between 17 and 18
if (lastVersion < 18) {
PreferencesHelper.cleanDefault(this, R.string.settings_url_key);
}

preferencesHelper.saveLastAppVersion(BuildConfig.VERSION_CODE);
}
}
}
4 changes: 4 additions & 0 deletions Meatspace/src/main/res/values-es/urls.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="url_api_release">@string/url_api_release_spanish</string>
</resources>
1 change: 1 addition & 0 deletions Meatspace/src/main/res/values/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<string-array name="settings_url_values_string">
<item>@string/url_api_release_english</item>
<item>@string/url_api_release_french</item>
<item>@string/url_api_release_spanish</item>
</string-array>

<string name="settings_auto_kill_timeout_bg_title">Stop service in background</string>
Expand Down
3 changes: 2 additions & 1 deletion Meatspace/src/main/res/values/urls.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
<string name="url_api_release">@string/url_api_release_english</string>

<string name="url_api_release_english">https://chat.meatspac.es</string>
<string name="url_api_release_french">http://fr.meatspac.es</string>
<string name="url_api_release_french">https://fr.meatspac.es</string>
<string name="url_api_release_spanish">https://es.meatspac.es</string>
</resources>

0 comments on commit 04f4b12

Please sign in to comment.