diff --git a/app/src/main/java/io/netbird/client/ui/advanced/AdvancedFragment.java b/app/src/main/java/io/netbird/client/ui/advanced/AdvancedFragment.java index 3e5bedb..5afcc47 100644 --- a/app/src/main/java/io/netbird/client/ui/advanced/AdvancedFragment.java +++ b/app/src/main/java/io/netbird/client/ui/advanced/AdvancedFragment.java @@ -275,7 +275,14 @@ private boolean isValidPresharedKey(String key) { private void setPreSharedKey(String key, Context context) { String configFilePath = Preferences.configFile(context); io.netbird.gomobile.android.Preferences preferences = new io.netbird.gomobile.android.Preferences(configFilePath); - preferences.setPreSharedKey(key); + try { + preferences.setPreSharedKey(key); + preferences.commit(); + Toast.makeText(context, R.string.advanced_presharedkey_saved_success, Toast.LENGTH_SHORT).show(); + } catch (Exception e) { + Log.e(LOGTAG, "Failed to save pre-shared key", e); + Toast.makeText(context, R.string.advanced_presharedkey_save_error + ": " + e.getMessage(), Toast.LENGTH_LONG).show(); + } } private boolean hasPreSharedKey(Context context) { @@ -301,4 +308,4 @@ private void shareLog() { Log.e(LOGTAG, "failed to dump log", e); } } -} \ No newline at end of file +} diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c6687ff..65ae49f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -71,6 +71,8 @@ You will only communicate with peers that use the same key. Add a pre-shared key Save + Pre-shared key saved successfully + Failed to save pre-shared key Enable trace log level. Share logs Enable Rosenpass