make url for mqtt-relay apis a preference

This commit is contained in:
Eric House 2020-06-13 17:20:03 -07:00
parent c4dfae13ee
commit af46660d6c
5 changed files with 18 additions and 5 deletions

View file

@ -226,8 +226,7 @@ public class NetUtils {
protected static HttpsURLConnection makeHttpsMQTTConn( Context context,
String proc )
{
// String url = XWPrefs.getDefaultMQTTUrl( context );
String url = "https://liquidsugar.net/xw4/api/v1";
String url = XWPrefs.getDefaultMQTTUrl( context );
return makeHttpsConn( context, url, proc );
}

View file

@ -148,6 +148,15 @@ public class XWPrefs {
return result;
}
public static String getDefaultMQTTUrl( Context context )
{
String result = getPrefsString( context, R.string.key_mqtt_url );
if ( result == null || 0 == result.length() ) {
result = context.getString( R.string.default_mqtt_url );
}
return result;
}
public static boolean getRelayEnabled( Context context )
{
boolean enabled = ! getPrefsBoolean( context, R.string.key_disable_relay,

View file

@ -39,6 +39,7 @@
<string name="key_relay_via_http_first">key_relay_via_http_first</string>
<string name="key_update_url">key_update_url2</string>
<string name="key_relay_url">key_relay_url2</string>
<string name="key_mqtt_url">key_mqtt_url</string>
<string name="key_mqtt_host">key_mqtt_host</string>
<string name="key_mqtt_port">key_mqtt_port</string>
<string name="key_mqtt_qos">key_mqtt_qos</string>
@ -170,9 +171,7 @@
<string name="nbs_ban_url">https://eehouse.org/sms.html</string>
<string name="default_update_url">https://eehouse.org/xw4/info.py</string>
<string name="default_relay_url">https://eehouse.org/xw4/relay.py</string>
<!-- <string name="default_relay_url">http://10.0.3.2/xw4/relay.py</string> -->
<!--string name="dict_url">http://10.0.2.2/~eehouse/and_dicts</string-->
<string name="default_mqtt_url">https://liquidsugar.net/xw4/api/v1</string>
<string-array name="board_sizes">
<item>15x15</item>

View file

@ -2230,6 +2230,7 @@
<string name="game_summary_field_npackets">Pending packet count</string>
<string name="expl_update_url">Update checks URL</string>
<string name="expl_relay_url">URL for relay web API</string>
<string name="expl_mqtt_url">URL for new mqtt-based relay API</string>
<string name="got_langdict_title">Fetch default wordlist for language</string>
<string name="got_langdict_summary">Don\'t try a second time</string>
<string name="pref_group_sms_title">SMS Stuff</string>

View file

@ -456,6 +456,11 @@
android:entryValues="@array/mqtt_qos_values"
android:defaultValue="2"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_mqtt_url"
android:title="@string/expl_mqtt_url"
android:defaultValue="@string/default_mqtt_url"
/>
</PreferenceScreen>