Commit f0556bf3 authored by Toni Beier's avatar Toni Beier

App perform one check that euroam is writable and remember result

parent 04312185
...@@ -50,11 +50,17 @@ import java.util.ArrayList; ...@@ -50,11 +50,17 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Stream; import java.util.stream.Stream;
class Helper { class Helper {
/**
* Used to remember if edurom wifi is writeable.
*/
private static AtomicBoolean IS_EDUROAM_WIFI_WRITABLE = new AtomicBoolean(false);
//private static int VERSION = 1; //private static int VERSION = 1;
//static String API_URL = "https://tom.hrz.tu-chemnitz.de/mouse/user/service/account/devicepasswords/api/"; // DEBUG //static String API_URL = "https://tom.hrz.tu-chemnitz.de/mouse/user/service/account/devicepasswords/api/"; // DEBUG
static String API_URL = "https://idm.hrz.tu-chemnitz.de/user/service/account/devicepasswords/api/"; // PRODUCTION static String API_URL = "https://idm.hrz.tu-chemnitz.de/user/service/account/devicepasswords/api/"; // PRODUCTION
...@@ -713,12 +719,13 @@ class Helper { ...@@ -713,12 +719,13 @@ class Helper {
ticked = false; ticked = false;
} }
list.add(3, new MainActivity.TickLine(ticked, message, "", false)); list.add(3, new MainActivity.TickLine(ticked, message, "", false));
// try to update network config without config change to check if config is managed by app // try to update network config without config change to check if config is managed by app
if (wifi.updateNetwork(currentConfig) != -1) { // if eduroam is not marked as writable, test it. Remember the result.
tick = new MainActivity.TickLine(true, context.getString(R.string.tickline_message_wifi_writable), context.getString(R.string.tickline_subtext_wifi_writable), false); if (!IS_EDUROAM_WIFI_WRITABLE.get()) {
} else { IS_EDUROAM_WIFI_WRITABLE.set(wifi.updateNetwork(currentConfig) != -1);
tick = new MainActivity.TickLine(false, context.getString(R.string.tickline_message_wifi_writable), context.getString(R.string.tickline_subtext_wifi_notwritable), false);
} }
tick = new MainActivity.TickLine(IS_EDUROAM_WIFI_WRITABLE.get(), context.getString(R.string.tickline_message_wifi_writable), IS_EDUROAM_WIFI_WRITABLE.get() ? context.getString(R.string.tickline_subtext_wifi_writable) : context.getString(R.string.tickline_subtext_wifi_notwritable), false);
tick._tag = context.getString(R.string.tick_tag_wifi_writable); tick._tag = context.getString(R.string.tick_tag_wifi_writable);
list.add(tick); list.add(tick);
} }
......
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