added enc key delete
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user