added enc key delete

This commit is contained in:
gdlbo
2023-03-19 12:05:32 +03:00
parent 207a63117e
commit 2cf60aedac
6 changed files with 12 additions and 7 deletions
@@ -5,7 +5,6 @@ import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
public abstract class IMProcessor {
@@ -84,4 +83,8 @@ public abstract class IMProcessor {
public String getEncryptionKeyFor(int id) {
return Preferences.getPreferences().getString("VT_IMEncodeKey_" + getPrefKey() + "_" + id, null);
}
public void removeEncryptionKeyFor(int id) {
Preferences.getPreferences().edit().remove("VT_IMEncodeKey_" + getPrefKey() + "_" + id).apply();
}
}
@@ -100,7 +100,7 @@ public class CryptImHook {
key = enabled.getEncryptionKeyFor(peerId);
}
if (key.equals("VTAesDefault")) {
if (Objects.equals(key, "VTAesDefault")) {
key = null;
}
@@ -128,6 +128,9 @@ public class CryptImHook {
Editable edit = editText.getText();
finalEnabled.setEncryptionKeyFor(peerId, edit == null ? null : edit.toString());
}).setNegativeButton(android.R.string.cancel, null)
.setNeutralButton("Удалить ключ", (dialog, which) -> {
finalEnabled.removeEncryptionKeyFor(peerId);
})
.show();
}
}
+1 -2
View File
@@ -6079,8 +6079,7 @@ QR-код"</string>
<string name="encryption_settings_title">Налады шыфравання</string>
<string name="encryption_public_algorithm_error">Абраны алгарытм публічны і не мае налад!</string>
<string name="encryption_enter_key">Увядзіце ключ шыфравання</string>
<string name="encryption_current_algorithm_title">Алгарытм, які выкарыстоўваецца: %1$s.\nУлічыце, што калі поле будзе пустым, то будзе выкарыстоўвацца ключ па змаўчанні.
</string>
<string name="encryption_current_algorithm_title">Алгарытм, які выкарыстоўваецца: %1$s</string>
<string name="update_error">Памылка абнаўлення</string>
<string name="update_error_text">Адбылася памылка пры спробе спампаваць новую версію дадатку. \nАбнавіць дадатак ўручную?</string>
<string name="photo_get_error">Не ўдалося атрымаць спасылку на фота</string>
+1 -1
View File
@@ -6165,7 +6165,7 @@
<string name="encryption_settings_title">Настройки шифрования</string>
<string name="encryption_public_algorithm_error">Выбранный алгоритм публичный и не имеет настроек!</string>
<string name="encryption_enter_key">Введите ключ шифрования</string>
<string name="encryption_current_algorithm_title">Используемый алгоритм: %1$s.\nУчтите, что если поле будет пустым, то будет использоваться ключ по умолчанию.</string>
<string name="encryption_current_algorithm_title">Используемый алгоритм: %1$s</string>
<string name="update_error">Ошибка обновления</string>
<string name="update_error_text">Произошла ошибка при попытке скачать новую версию приложения.\nОбновить приложение вручную?</string>
+1 -1
View File
@@ -6090,7 +6090,7 @@
<string name="encryption_settings_title">Налаштування шифрування</string>
<string name="encryption_public_algorithm_error">Вибраний алгоритм публічний і не має налаштувань!</string>
<string name="encryption_enter_key">Введіть ключ шифрування</string>
<string name="encryption_current_algorithm_title">Використовуваний алгоритм: %1$s.\nВрахуйте, що якщо поле буде порожнім, то використовуватиметься ключ за замовчуванням.</string>
<string name="encryption_current_algorithm_title">Використовуваний алгоритм: %1$s</string>
<string name="update_error">Помилка оновлення</string>
<string name="update_error_text">Відбулася помилка при спробі завантажити нову версію додатка.\nОновити додаток вручну?</string>
+1 -1
View File
@@ -6303,7 +6303,7 @@ May look like a fake leaving the online"</string>
<string name="encryption_settings_title">Encryption settings</string>
<string name="encryption_public_algorithm_error">The selected algorithm is public and has no settings!</string>
<string name="encryption_enter_key">Enter encryption key</string>
<string name="encryption_current_algorithm_title">Algorithm used: %1$s.\nPlease note that if the field is empty, the default key will be used.</string>
<string name="encryption_current_algorithm_title">Algorithm used: %1$s</string>
<string name="update_error">Update failed</string>
<string name="update_error_text">An error occurred while trying to download the new version of the app.\nDo you want to update the app manually?</string>