Commit f351e1b1 authored by Toni Beier's avatar Toni Beier

Merge branch 'remove_writable_eduroam_check_loop' into 'master'

Remove writable eduroam check loop

See merge request !17
parents 04312185 9cb54d0c
Pipeline #22955 passed with stages
in 3 minutes and 15 seconds
......@@ -50,11 +50,17 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Pattern;
import java.util.stream.Stream;
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;
//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
......@@ -713,12 +719,13 @@ class Helper {
ticked = 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
if (wifi.updateNetwork(currentConfig) != -1) {
tick = new MainActivity.TickLine(true, context.getString(R.string.tickline_message_wifi_writable), context.getString(R.string.tickline_subtext_wifi_writable), false);
} else {
tick = new MainActivity.TickLine(false, context.getString(R.string.tickline_message_wifi_writable), context.getString(R.string.tickline_subtext_wifi_notwritable), false);
// if eduroam is not marked as writable, test it. Remember the result.
if (!IS_EDUROAM_WIFI_WRITABLE.get()) {
IS_EDUROAM_WIFI_WRITABLE.set(wifi.updateNetwork(currentConfig) != -1);
}
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);
list.add(tick);
}
......@@ -866,4 +873,7 @@ class Helper {
return (lastHasInternet = false);
}
public static void resetIsEduroamWifiWriteable() {
IS_EDUROAM_WIFI_WRITABLE.set(false);
}
}
......@@ -142,6 +142,8 @@ public class MainActivity extends AppCompatActivity {
protected void onResume() {
super.onResume();
Helper.resetIsEduroamWifiWriteable();
recomputeLayout();
IntentFilter networkChangeRecieverIntentFilter = new IntentFilter();
......
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