mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-22 04:18:27 +00:00
Add proxy port option to local APN settings.
This commit is contained in:
parent
5f16da8fca
commit
ead97953e8
@ -374,7 +374,8 @@
|
|||||||
<string name="preferences__enable_local_apns">Enable local APNs</string>
|
<string name="preferences__enable_local_apns">Enable local APNs</string>
|
||||||
<string name="preferences__use_apn_information_configured_here_when_system_apn_information_is_unavailable">Use APN information configured here when system APN information is unavailable.</string>
|
<string name="preferences__use_apn_information_configured_here_when_system_apn_information_is_unavailable">Use APN information configured here when system APN information is unavailable.</string>
|
||||||
<string name="preferences__mmsc_url_required">MMSC URL (Required)</string>
|
<string name="preferences__mmsc_url_required">MMSC URL (Required)</string>
|
||||||
<string name="preferences__mms_proxy_optional">MMS Proxy (Optional)</string>
|
<string name="preferences__mms_proxy_host_optional">MMS Proxy Host (Optional)</string>
|
||||||
|
<string name="preferences__mms_proxy_port_optional">MMS Proxy Port (Optional)</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- **************************************** -->
|
<!-- **************************************** -->
|
||||||
|
@ -152,8 +152,13 @@
|
|||||||
android:dependency="pref_use_local_apns" />
|
android:dependency="pref_use_local_apns" />
|
||||||
|
|
||||||
<EditTextPreference android:key="pref_apn_mms_proxy"
|
<EditTextPreference android:key="pref_apn_mms_proxy"
|
||||||
android:title="@string/preferences__mms_proxy_optional"
|
android:title="@string/preferences__mms_proxy_host_optional"
|
||||||
android:dependency="pref_use_local_apns" />
|
android:dependency="pref_use_local_apns" />
|
||||||
|
|
||||||
|
<EditTextPreference android:key="pref_apn_mms_proxy_port"
|
||||||
|
android:title="@string/preferences__mms_proxy_port_optional"
|
||||||
|
android:dependency="pref_use_local_apns"
|
||||||
|
android:inputType="number" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@ -77,7 +77,8 @@ public class ApplicationPreferencesActivity extends SherlockPreferenceActivity {
|
|||||||
|
|
||||||
public static final String USE_LOCAL_MMS_APNS_PREF = "pref_use_local_apns";
|
public static final String USE_LOCAL_MMS_APNS_PREF = "pref_use_local_apns";
|
||||||
public static final String MMSC_HOST_PREF = "pref_apn_mmsc_host";
|
public static final String MMSC_HOST_PREF = "pref_apn_mmsc_host";
|
||||||
public static final String MMSC_PROXY_PREF = "pref_apn_mms_proxy";
|
public static final String MMSC_PROXY_HOST_PREF = "pref_apn_mms_proxy";
|
||||||
|
public static final String MMSC_PROXY_PORT_PREF = "pref_apn_mms_proxy_port";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle icicle) {
|
protected void onCreate(Bundle icicle) {
|
||||||
@ -145,37 +146,30 @@ public class ApplicationPreferencesActivity extends SherlockPreferenceActivity {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initializeEditTextSummary(final EditTextPreference preference) {
|
||||||
|
if (preference.getText() == null) {
|
||||||
|
preference.setSummary("Not set");
|
||||||
|
} else {
|
||||||
|
preference.setSummary(preference.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
preference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceChange(Preference pref, Object newValue) {
|
||||||
|
preference.setSummary(newValue == null ? "Not set" : (String)newValue);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void initializeEditTextSummaries() {
|
private void initializeEditTextSummaries() {
|
||||||
final EditTextPreference mmscUrlPreference = (EditTextPreference)this.findPreference(MMSC_HOST_PREF);
|
final EditTextPreference mmscUrlPreference = (EditTextPreference)this.findPreference(MMSC_HOST_PREF);
|
||||||
final EditTextPreference mmsProxyPreference = (EditTextPreference)this.findPreference(MMSC_PROXY_PREF);
|
final EditTextPreference mmsProxyHostPreference = (EditTextPreference)this.findPreference(MMSC_PROXY_HOST_PREF);
|
||||||
|
final EditTextPreference mmsProxyPortPreference = (EditTextPreference)this.findPreference(MMSC_PROXY_PORT_PREF);
|
||||||
|
|
||||||
if (mmscUrlPreference.getText() == null) {
|
initializeEditTextSummary(mmscUrlPreference);
|
||||||
mmscUrlPreference.setSummary("Not set");
|
initializeEditTextSummary(mmsProxyHostPreference);
|
||||||
} else {
|
initializeEditTextSummary(mmsProxyPortPreference);
|
||||||
mmscUrlPreference.setSummary(mmscUrlPreference.getText());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mmsProxyPreference.getText() == null) {
|
|
||||||
mmsProxyPreference.setSummary("Not set");
|
|
||||||
} else {
|
|
||||||
mmsProxyPreference.setSummary(mmsProxyPreference.getText());
|
|
||||||
}
|
|
||||||
|
|
||||||
mmscUrlPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
|
||||||
mmscUrlPreference.setSummary(newValue == null ? "Not set" : (String)newValue);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mmsProxyPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
|
||||||
mmsProxyPreference.setSummary(newValue == null ? "Not set" : (String)newValue);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeIdentitySelection() {
|
private void initializeIdentitySelection() {
|
||||||
|
@ -63,9 +63,10 @@ public class MmsCommunication {
|
|||||||
if (mmsc == null || !mmsc.startsWith("http"))
|
if (mmsc == null || !mmsc.startsWith("http"))
|
||||||
throw new ApnUnavailableException("Malformed locally configured MMSC: " + mmsc);
|
throw new ApnUnavailableException("Malformed locally configured MMSC: " + mmsc);
|
||||||
|
|
||||||
String proxy = preferences.getString(ApplicationPreferencesActivity.MMSC_PROXY_PREF, null);
|
String proxy = preferences.getString(ApplicationPreferencesActivity.MMSC_PROXY_HOST_PREF, null);
|
||||||
|
String port = preferences.getString(ApplicationPreferencesActivity.MMSC_PROXY_PORT_PREF, null);
|
||||||
|
|
||||||
return new MmsConnectionParameters(mmsc, proxy, null);
|
return new MmsConnectionParameters(mmsc, proxy, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new ApnUnavailableException("No locally configured parameters available");
|
throw new ApnUnavailableException("No locally configured parameters available");
|
||||||
@ -180,6 +181,9 @@ public class MmsCommunication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getProxy() {
|
public String getProxy() {
|
||||||
|
if (!hasProxy())
|
||||||
|
return null;
|
||||||
|
|
||||||
return proxy;
|
return proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user