summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/base/fragments/ObfuscationProxyDialog.java
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2023-08-02 22:45:26 +0200
committercyBerta <cyberta@riseup.net>2023-08-02 22:45:26 +0200
commit64449816223cb9abb6e75310c03dcc9353a42ee4 (patch)
tree66cb86d382cc67267441a10320f7e13cd125e66b /app/src/main/java/se/leap/bitmaskclient/base/fragments/ObfuscationProxyDialog.java
parent1ac4ec903f0d10b65810b720f76f08df969c3bec (diff)
use single instance of shared prefernces across the app, this reduces the laggyness of the UI noticably
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/base/fragments/ObfuscationProxyDialog.java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/ObfuscationProxyDialog.java23
1 files changed, 11 insertions, 12 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/ObfuscationProxyDialog.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/ObfuscationProxyDialog.java
index 2c0fdd69..948d764f 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/ObfuscationProxyDialog.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/ObfuscationProxyDialog.java
@@ -48,23 +48,23 @@ public class ObfuscationProxyDialog extends AppCompatDialogFragment {
cancelButton = binding.buttonCancel;
kcpSwitch = binding.kcpSwitch;
- ipField.setText(PreferenceHelper.getObfuscationPinningIP(getContext()));
- portField.setText(PreferenceHelper.getObfuscationPinningPort(getContext()));
- certificateField.setText(PreferenceHelper.getObfuscationPinningCert(getContext()));
- kcpSwitch.setChecked(PreferenceHelper.getObfuscationPinningKCP(getContext()));
+ ipField.setText(PreferenceHelper.getObfuscationPinningIP());
+ portField.setText(PreferenceHelper.getObfuscationPinningPort());
+ certificateField.setText(PreferenceHelper.getObfuscationPinningCert());
+ kcpSwitch.setChecked(PreferenceHelper.getObfuscationPinningKCP());
GatewaysManager gatewaysManager = new GatewaysManager(getContext());
saveButton.setOnClickListener(v -> {
String ip = TextUtils.isEmpty(ipField.getText()) ? null : ipField.getText().toString();
- PreferenceHelper.setObfuscationPinningIP(v.getContext(), ip);
+ PreferenceHelper.setObfuscationPinningIP(ip);
String port = TextUtils.isEmpty(portField.getText()) ? null : portField.getText().toString();
- PreferenceHelper.setObfuscationPinningPort(v.getContext(), port);
+ PreferenceHelper.setObfuscationPinningPort(port);
String cert = TextUtils.isEmpty(certificateField.getText()) ? null : certificateField.getText().toString();
- PreferenceHelper.setObfuscationPinningCert(v.getContext(), cert);
- PreferenceHelper.setObfuscationPinningKCP(v.getContext(), kcpSwitch.isChecked());
- PreferenceHelper.setUseObfuscationPinning(v.getContext(), ip != null && port != null && cert != null);
- PreferenceHelper.setObfuscationPinningGatewayLocation(v.getContext(), gatewaysManager.getLocationNameForIP(ip, v.getContext()));
+ PreferenceHelper.setObfuscationPinningCert(cert);
+ PreferenceHelper.setObfuscationPinningKCP(kcpSwitch.isChecked());
+ PreferenceHelper.setUseObfuscationPinning(ip != null && port != null && cert != null);
+ PreferenceHelper.setObfuscationPinningGatewayLocation(gatewaysManager.getLocationNameForIP(ip, v.getContext()));
dismiss();
});
@@ -78,8 +78,7 @@ public class ObfuscationProxyDialog extends AppCompatDialogFragment {
cancelButton.setOnClickListener(v -> {
boolean allowPinning = !TextUtils.isEmpty(ipField.getText()) && !TextUtils.isEmpty(portField.getText()) && !TextUtils.isEmpty(certificateField.getText());
- PreferenceHelper.setUseObfuscationPinning(
- v.getContext(), allowPinning);
+ PreferenceHelper.setUseObfuscationPinning(allowPinning);
dismiss();
});