mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-03 09:49:21 +02:00
Merge pull request #3594 from deltachat/adb/issue-3591
hide some option in Encryption category
This commit is contained in:
commit
ee78397614
9 changed files with 9 additions and 211 deletions
|
@ -7,6 +7,7 @@
|
||||||
* add mute option "8 hours"
|
* add mute option "8 hours"
|
||||||
* add menu option to easily save/unsave selected message
|
* add menu option to easily save/unsave selected message
|
||||||
* improve deletion confirmation for "Device Messages"
|
* improve deletion confirmation for "Device Messages"
|
||||||
|
* remove dangerous encryption options
|
||||||
* always paste as plain text in message draft area
|
* always paste as plain text in message draft area
|
||||||
* some small bug fixes and updated translations
|
* some small bug fixes and updated translations
|
||||||
* update to core 1.157.2
|
* update to core 1.157.2
|
||||||
|
|
|
@ -150,7 +150,6 @@ public class DcMsg {
|
||||||
public native String getWebxdcHref ();
|
public native String getWebxdcHref ();
|
||||||
public native boolean isForwarded ();
|
public native boolean isForwarded ();
|
||||||
public native boolean isInfo ();
|
public native boolean isInfo ();
|
||||||
public native boolean isSetupMessage ();
|
|
||||||
public native boolean hasHtml ();
|
public native boolean hasHtml ();
|
||||||
public native String getSetupCodeBegin ();
|
public native String getSetupCodeBegin ();
|
||||||
public native String getVideochatUrl ();
|
public native String getVideochatUrl ();
|
||||||
|
|
|
@ -294,7 +294,7 @@ public class ConversationAdapter <V extends View & BindableConversationItem>
|
||||||
else if (type==DcMsg.DC_MSG_AUDIO || type==DcMsg.DC_MSG_VOICE) {
|
else if (type==DcMsg.DC_MSG_AUDIO || type==DcMsg.DC_MSG_VOICE) {
|
||||||
return dcMsg.isOutgoing()? MESSAGE_TYPE_AUDIO_OUTGOING : MESSAGE_TYPE_AUDIO_INCOMING;
|
return dcMsg.isOutgoing()? MESSAGE_TYPE_AUDIO_OUTGOING : MESSAGE_TYPE_AUDIO_INCOMING;
|
||||||
}
|
}
|
||||||
else if (type==DcMsg.DC_MSG_FILE && !dcMsg.isSetupMessage()) {
|
else if (type==DcMsg.DC_MSG_FILE) {
|
||||||
return dcMsg.isOutgoing()? MESSAGE_TYPE_DOCUMENT_OUTGOING : MESSAGE_TYPE_DOCUMENT_INCOMING;
|
return dcMsg.isOutgoing()? MESSAGE_TYPE_DOCUMENT_OUTGOING : MESSAGE_TYPE_DOCUMENT_INCOMING;
|
||||||
}
|
}
|
||||||
else if (type==DcMsg.DC_MSG_IMAGE || type==DcMsg.DC_MSG_GIF || type==DcMsg.DC_MSG_VIDEO) {
|
else if (type==DcMsg.DC_MSG_IMAGE || type==DcMsg.DC_MSG_GIF || type==DcMsg.DC_MSG_VIDEO) {
|
||||||
|
|
|
@ -25,8 +25,6 @@ import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
|
||||||
import android.text.TextWatcher;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -37,12 +35,10 @@ import android.view.ViewGroup;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.view.animation.AnimationUtils;
|
import android.view.animation.AnimationUtils;
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.view.ActionMode;
|
import androidx.appcompat.view.ActionMode;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
@ -725,80 +721,6 @@ public class ConversationFragment extends MessageSelectorFragment
|
||||||
Util.runOnAnyBackgroundThread(() -> dcContext.markseenMsgs(ids));
|
Util.runOnAnyBackgroundThread(() -> dcContext.markseenMsgs(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void querySetupCode(final DcMsg dcMsg, String[] preload)
|
|
||||||
{
|
|
||||||
if( !dcMsg.isSetupMessage()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
View gl = View.inflate(getActivity(), R.layout.setup_code_grid, null);
|
|
||||||
final EditText[] editTexts = {
|
|
||||||
gl.findViewById(R.id.setupCode0), gl.findViewById(R.id.setupCode1), gl.findViewById(R.id.setupCode2),
|
|
||||||
gl.findViewById(R.id.setupCode3), gl.findViewById(R.id.setupCode4), gl.findViewById(R.id.setupCode5),
|
|
||||||
gl.findViewById(R.id.setupCode6), gl.findViewById(R.id.setupCode7), gl.findViewById(R.id.setupCode8)
|
|
||||||
};
|
|
||||||
AlertDialog.Builder builder1 = new AlertDialog.Builder(getActivity());
|
|
||||||
builder1.setView(gl);
|
|
||||||
editTexts[0].setText(dcMsg.getSetupCodeBegin());
|
|
||||||
editTexts[0].setSelection(editTexts[0].getText().length());
|
|
||||||
|
|
||||||
for( int i = 0; i < 9; i++ ) {
|
|
||||||
if( preload != null && i < preload.length ) {
|
|
||||||
editTexts[i].setText(preload[i]);
|
|
||||||
editTexts[i].setSelection(editTexts[i].getText().length());
|
|
||||||
}
|
|
||||||
editTexts[i].addTextChangedListener(new TextWatcher() {
|
|
||||||
@Override
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
||||||
if( s.length()==4 ) {
|
|
||||||
for ( int i = 0; i < 8; i++ ) {
|
|
||||||
if( editTexts[i].hasFocus() && editTexts[i+1].getText().length()<4 ) {
|
|
||||||
editTexts[i+1].requestFocus();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
builder1.setTitle(getActivity().getString(R.string.autocrypt_continue_transfer_title));
|
|
||||||
builder1.setMessage(getActivity().getString(R.string.autocrypt_continue_transfer_please_enter_code));
|
|
||||||
builder1.setNegativeButton(android.R.string.cancel, null);
|
|
||||||
builder1.setCancelable(false); // prevent the dialog from being dismissed accidentally (when the dialog is closed, the setup code is gone forever and the user has to create a new setup message)
|
|
||||||
builder1.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
|
||||||
String setup_code = "";
|
|
||||||
final String[] preload1 = new String[9];
|
|
||||||
for ( int i = 0; i < 9; i++ ) {
|
|
||||||
preload1[i] = editTexts[i].getText().toString();
|
|
||||||
setup_code += preload1[i];
|
|
||||||
}
|
|
||||||
boolean success = dcContext.continueKeyTransfer(dcMsg.getId(), setup_code);
|
|
||||||
|
|
||||||
AlertDialog.Builder builder2 = new AlertDialog.Builder(getActivity());
|
|
||||||
builder2.setTitle(getActivity().getString(R.string.autocrypt_continue_transfer_title));
|
|
||||||
builder2.setMessage(getActivity().getString(success? R.string.autocrypt_continue_transfer_succeeded : R.string.autocrypt_bad_setup_code));
|
|
||||||
if( success ) {
|
|
||||||
builder2.setPositiveButton(android.R.string.ok, null);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
builder2.setNegativeButton(android.R.string.cancel, null);
|
|
||||||
builder2.setPositiveButton(R.string.autocrypt_continue_transfer_retry, (dialog1, which1) -> querySetupCode(dcMsg, preload1));
|
|
||||||
}
|
|
||||||
builder2.show();
|
|
||||||
});
|
|
||||||
builder1.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private class ConversationFragmentItemClickListener implements ItemClickListener {
|
private class ConversationFragmentItemClickListener implements ItemClickListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -818,9 +740,6 @@ public class ConversationFragment extends MessageSelectorFragment
|
||||||
actionMode.setTitleOptionalHint(false); // the title represents important information, also indicating implicitly, more items can be selected
|
actionMode.setTitleOptionalHint(false); // the title represents important information, also indicating implicitly, more items can be selected
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(messageRecord.isSetupMessage()) {
|
|
||||||
querySetupCode(messageRecord,null);
|
|
||||||
}
|
|
||||||
else if (messageRecord.getType()==DcMsg.DC_MSG_VIDEOCHAT_INVITATION) {
|
else if (messageRecord.getType()==DcMsg.DC_MSG_VIDEOCHAT_INVITATION) {
|
||||||
new VideochatUtil().join(getActivity(), messageRecord.getId());
|
new VideochatUtil().join(getActivity(), messageRecord.getId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -390,7 +390,7 @@ public class ConversationItem extends BaseConversationItem
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasDocument(DcMsg dcMsg) {
|
private boolean hasDocument(DcMsg dcMsg) {
|
||||||
return dcMsg.getType()==DcMsg.DC_MSG_FILE && !dcMsg.isSetupMessage();
|
return dcMsg.getType()==DcMsg.DC_MSG_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setBodyText(DcMsg messageRecord) {
|
private void setBodyText(DcMsg messageRecord) {
|
||||||
|
@ -399,11 +399,7 @@ public class ConversationItem extends BaseConversationItem
|
||||||
|
|
||||||
String text = messageRecord.getText();
|
String text = messageRecord.getText();
|
||||||
|
|
||||||
if (messageRecord.isSetupMessage()) {
|
if (text.isEmpty()) {
|
||||||
bodyText.setText(context.getString(R.string.autocrypt_asm_click_body));
|
|
||||||
bodyText.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
else if (text.isEmpty()) {
|
|
||||||
bodyText.setVisibility(View.GONE);
|
bodyText.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -61,7 +61,6 @@ public class DcHelper {
|
||||||
public static final String CONFIG_DISPLAY_NAME = "displayname";
|
public static final String CONFIG_DISPLAY_NAME = "displayname";
|
||||||
public static final String CONFIG_SELF_STATUS = "selfstatus";
|
public static final String CONFIG_SELF_STATUS = "selfstatus";
|
||||||
public static final String CONFIG_SELF_AVATAR = "selfavatar";
|
public static final String CONFIG_SELF_AVATAR = "selfavatar";
|
||||||
public static final String CONFIG_E2EE_ENABLED = "e2ee_enabled";
|
|
||||||
public static final String CONFIG_SENTBOX_WATCH = "sentbox_watch";
|
public static final String CONFIG_SENTBOX_WATCH = "sentbox_watch";
|
||||||
public static final String CONFIG_MVBOX_MOVE = "mvbox_move";
|
public static final String CONFIG_MVBOX_MOVE = "mvbox_move";
|
||||||
public static final String CONFIG_ONLY_FETCH_MVBOX = "only_fetch_mvbox";
|
public static final String CONFIG_ONLY_FETCH_MVBOX = "only_fetch_mvbox";
|
||||||
|
|
|
@ -3,7 +3,6 @@ package org.thoughtcrime.securesms.preferences;
|
||||||
import static android.app.Activity.RESULT_OK;
|
import static android.app.Activity.RESULT_OK;
|
||||||
import static android.text.InputType.TYPE_TEXT_VARIATION_URI;
|
import static android.text.InputType.TYPE_TEXT_VARIATION_URI;
|
||||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_BCC_SELF;
|
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_BCC_SELF;
|
||||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_E2EE_ENABLED;
|
|
||||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_MVBOX_MOVE;
|
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_MVBOX_MOVE;
|
||||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_ONLY_FETCH_MVBOX;
|
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_ONLY_FETCH_MVBOX;
|
||||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_SENTBOX_WATCH;
|
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_SENTBOX_WATCH;
|
||||||
|
@ -11,13 +10,11 @@ import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_SHOW_EMAILS;
|
||||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_WEBXDC_REALTIME_ENABLED;
|
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_WEBXDC_REALTIME_ENABLED;
|
||||||
import static org.thoughtcrime.securesms.connect.DcHelper.getRpc;
|
import static org.thoughtcrime.securesms.connect.DcHelper.getRpc;
|
||||||
|
|
||||||
import android.Manifest;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -32,7 +29,6 @@ import androidx.preference.CheckBoxPreference;
|
||||||
import androidx.preference.ListPreference;
|
import androidx.preference.ListPreference;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
import com.b44t.messenger.DcContext;
|
|
||||||
import com.b44t.messenger.rpc.RpcException;
|
import com.b44t.messenger.rpc.RpcException;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
|
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
|
||||||
|
@ -42,12 +38,9 @@ import org.thoughtcrime.securesms.R;
|
||||||
import org.thoughtcrime.securesms.RegistrationActivity;
|
import org.thoughtcrime.securesms.RegistrationActivity;
|
||||||
import org.thoughtcrime.securesms.connect.DcEventCenter;
|
import org.thoughtcrime.securesms.connect.DcEventCenter;
|
||||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||||
import org.thoughtcrime.securesms.mms.AttachmentManager;
|
|
||||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
|
||||||
import org.thoughtcrime.securesms.proxy.ProxySettingsActivity;
|
import org.thoughtcrime.securesms.proxy.ProxySettingsActivity;
|
||||||
import org.thoughtcrime.securesms.util.Prefs;
|
import org.thoughtcrime.securesms.util.Prefs;
|
||||||
import org.thoughtcrime.securesms.util.ScreenLockUtil;
|
import org.thoughtcrime.securesms.util.ScreenLockUtil;
|
||||||
import org.thoughtcrime.securesms.util.StorageUtil;
|
|
||||||
import org.thoughtcrime.securesms.util.StreamUtil;
|
import org.thoughtcrime.securesms.util.StreamUtil;
|
||||||
import org.thoughtcrime.securesms.util.Util;
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
|
|
||||||
|
@ -63,10 +56,8 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||||
implements DcEventCenter.DcEventDelegate
|
implements DcEventCenter.DcEventDelegate
|
||||||
{
|
{
|
||||||
private static final String TAG = AdvancedPreferenceFragment.class.getSimpleName();
|
private static final String TAG = AdvancedPreferenceFragment.class.getSimpleName();
|
||||||
public static final int PICK_SELF_KEYS = 29923;
|
|
||||||
|
|
||||||
private ListPreference showEmails;
|
private ListPreference showEmails;
|
||||||
CheckBoxPreference preferE2eeCheckbox;
|
|
||||||
CheckBoxPreference sentboxWatchCheckbox;
|
CheckBoxPreference sentboxWatchCheckbox;
|
||||||
CheckBoxPreference bccSelfCheckbox;
|
CheckBoxPreference bccSelfCheckbox;
|
||||||
CheckBoxPreference mvboxMoveCheckbox;
|
CheckBoxPreference mvboxMoveCheckbox;
|
||||||
|
@ -92,11 +83,6 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||||
sendAsm.setOnPreferenceClickListener(new SendAsmListener());
|
sendAsm.setOnPreferenceClickListener(new SendAsmListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
preferE2eeCheckbox = (CheckBoxPreference) this.findPreference("pref_prefer_e2ee");
|
|
||||||
if (preferE2eeCheckbox != null) {
|
|
||||||
preferE2eeCheckbox.setOnPreferenceChangeListener(new PreferE2eeListener());
|
|
||||||
}
|
|
||||||
|
|
||||||
sentboxWatchCheckbox = (CheckBoxPreference) this.findPreference("pref_sentbox_watch");
|
sentboxWatchCheckbox = (CheckBoxPreference) this.findPreference("pref_sentbox_watch");
|
||||||
if (sentboxWatchCheckbox != null) {
|
if (sentboxWatchCheckbox != null) {
|
||||||
sentboxWatchCheckbox.setOnPreferenceChangeListener((preference, newValue) -> {
|
sentboxWatchCheckbox.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
|
@ -163,11 +149,6 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Preference manageKeys = this.findPreference("pref_manage_keys");
|
|
||||||
if (manageKeys != null) {
|
|
||||||
manageKeys.setOnPreferenceClickListener(new ManageKeysListener());
|
|
||||||
}
|
|
||||||
|
|
||||||
Preference screenSecurity = this.findPreference(Prefs.SCREEN_SECURITY_PREF);
|
Preference screenSecurity = this.findPreference(Prefs.SCREEN_SECURITY_PREF);
|
||||||
if (screenSecurity != null) {
|
if (screenSecurity != null) {
|
||||||
screenSecurity.setOnPreferenceChangeListener(new ScreenShotSecurityListener());
|
screenSecurity.setOnPreferenceChangeListener(new ScreenShotSecurityListener());
|
||||||
|
@ -269,7 +250,6 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dcContext.isChatmail()) {
|
if (dcContext.isChatmail()) {
|
||||||
preferE2eeCheckbox.setVisible(false);
|
|
||||||
showSystemContacts.setVisible(false);
|
showSystemContacts.setVisible(false);
|
||||||
sentboxWatchCheckbox.setVisible(false);
|
sentboxWatchCheckbox.setVisible(false);
|
||||||
bccSelfCheckbox.setVisible(false);
|
bccSelfCheckbox.setVisible(false);
|
||||||
|
@ -292,7 +272,6 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||||
showEmails.setValue(value);
|
showEmails.setValue(value);
|
||||||
updateListSummary(showEmails, value);
|
updateListSummary(showEmails, value);
|
||||||
|
|
||||||
preferE2eeCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_E2EE_ENABLED));
|
|
||||||
sentboxWatchCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_SENTBOX_WATCH));
|
sentboxWatchCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_SENTBOX_WATCH));
|
||||||
bccSelfCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_BCC_SELF));
|
bccSelfCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_BCC_SELF));
|
||||||
mvboxMoveCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_MVBOX_MOVE));
|
mvboxMoveCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_MVBOX_MOVE));
|
||||||
|
@ -304,24 +283,7 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
if (resultCode != RESULT_OK) return;
|
if (resultCode == RESULT_OK && requestCode == REQUEST_CODE_CONFIRM_CREDENTIALS_ACCOUNT) {
|
||||||
if (requestCode == REQUEST_CODE_CONFIRM_CREDENTIALS_KEYS) {
|
|
||||||
manageKeys();
|
|
||||||
} else if (requestCode == PICK_SELF_KEYS) {
|
|
||||||
Uri uri = (data != null ? data.getData() : null);
|
|
||||||
if (uri == null) {
|
|
||||||
Log.e(TAG, " Can't import null URI");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
String name = AttachmentManager.getFileName(getContext(), uri);
|
|
||||||
if (name == null || name.isEmpty()) name = "FILE";
|
|
||||||
File file = copyToCacheDir(uri);
|
|
||||||
showImportKeysDialog(file.getAbsolutePath(), name);
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e(TAG, "Error calling copyToCacheDir()", e);
|
|
||||||
}
|
|
||||||
} else if (requestCode == REQUEST_CODE_CONFIRM_CREDENTIALS_ACCOUNT) {
|
|
||||||
openRegistrationActivity();
|
openRegistrationActivity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -470,76 +432,4 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PreferE2eeListener implements Preference.OnPreferenceChangeListener {
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceChange(@NonNull final Preference preference, Object newValue) {
|
|
||||||
boolean enabled = (Boolean) newValue;
|
|
||||||
dcContext.setConfigInt(CONFIG_E2EE_ENABLED, enabled? 1 : 0);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************************************
|
|
||||||
* Key Import/Export
|
|
||||||
**********************************************************************************************/
|
|
||||||
protected void showImportKeysDialog(String imexPath, String pathAsDisplayedToUser) {
|
|
||||||
new AlertDialog.Builder(requireActivity())
|
|
||||||
.setTitle(R.string.pref_managekeys_import_secret_keys)
|
|
||||||
.setMessage(requireActivity().getString(R.string.pref_managekeys_import_explain, pathAsDisplayedToUser))
|
|
||||||
.setNegativeButton(android.R.string.cancel, null)
|
|
||||||
.setPositiveButton(android.R.string.ok, (dialogInterface2, i2) -> startImexOne(DcContext.DC_IMEX_IMPORT_SELF_KEYS, imexPath, pathAsDisplayedToUser))
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private class ManageKeysListener implements Preference.OnPreferenceClickListener {
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceClick(@NonNull Preference preference) {
|
|
||||||
boolean result = ScreenLockUtil.applyScreenLock(requireActivity(), getString(R.string.pref_manage_keys), getString(R.string.enter_system_secret_to_continue), REQUEST_CODE_CONFIRM_CREDENTIALS_KEYS);
|
|
||||||
if (!result) {
|
|
||||||
manageKeys();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void manageKeys() {
|
|
||||||
Activity activity = requireActivity();
|
|
||||||
Permissions.with(activity)
|
|
||||||
.request(Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE)
|
|
||||||
.alwaysGrantOnSdk30()
|
|
||||||
.ifNecessary()
|
|
||||||
.withPermanentDenialDialog(getString(R.string.perm_explain_access_to_storage_denied))
|
|
||||||
.onAllGranted(() -> {
|
|
||||||
new AlertDialog.Builder(activity)
|
|
||||||
.setTitle(R.string.pref_managekeys_menu_title)
|
|
||||||
.setItems(new CharSequence[]{
|
|
||||||
activity.getString(R.string.pref_managekeys_export_secret_keys),
|
|
||||||
activity.getString(R.string.pref_managekeys_import_secret_keys)
|
|
||||||
},
|
|
||||||
(dialogInterface, i) -> {
|
|
||||||
if (i==0) {
|
|
||||||
new AlertDialog.Builder(activity)
|
|
||||||
.setTitle(R.string.pref_managekeys_export_secret_keys)
|
|
||||||
.setMessage(activity.getString(R.string.pref_managekeys_export_explain, DcHelper.getImexDir().getAbsolutePath()))
|
|
||||||
.setNegativeButton(android.R.string.cancel, null)
|
|
||||||
.setPositiveButton(android.R.string.ok, (dialogInterface2, i2) -> startImexOne(DcContext.DC_IMEX_EXPORT_SELF_KEYS))
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (Build.VERSION.SDK_INT >= 30) {
|
|
||||||
AttachmentManager.selectMediaType(activity, "*/*", null, PICK_SELF_KEYS, StorageUtil.getDownloadUri());
|
|
||||||
} else {
|
|
||||||
String path = DcHelper.getImexDir().getAbsolutePath();
|
|
||||||
showImportKeysDialog(path, path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.setNegativeButton(R.string.cancel, null)
|
|
||||||
.setNeutralButton(R.string.learn_more, (d, w) -> DcHelper.openHelp(activity, "#importkey"))
|
|
||||||
.show();
|
|
||||||
})
|
|
||||||
.execute();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -879,6 +879,7 @@
|
||||||
<string name="autocrypt_prefer_e2ee">Prefer End-To-End Encryption</string>
|
<string name="autocrypt_prefer_e2ee">Prefer End-To-End Encryption</string>
|
||||||
<string name="autocrypt_asm_subject">Autocrypt Setup Message</string>
|
<string name="autocrypt_asm_subject">Autocrypt Setup Message</string>
|
||||||
<string name="autocrypt_asm_general_body">This is the Autocrypt Setup Message used to transfer your end-to-end setup between clients.\n\nTo decrypt and use your setup, open the message in an Autocrypt-compliant client and enter the setup code presented on the generating device.</string>
|
<string name="autocrypt_asm_general_body">This is the Autocrypt Setup Message used to transfer your end-to-end setup between clients.\n\nTo decrypt and use your setup, open the message in an Autocrypt-compliant client and enter the setup code presented on the generating device.</string>
|
||||||
|
<!-- deprecated -->
|
||||||
<string name="autocrypt_asm_click_body">This is the Autocrypt Setup Message used to transfer your end-to-end setup between clients.\n\nTo decrypt and use your setup, tap or click on this message.</string>
|
<string name="autocrypt_asm_click_body">This is the Autocrypt Setup Message used to transfer your end-to-end setup between clients.\n\nTo decrypt and use your setup, tap or click on this message.</string>
|
||||||
<string name="autocrypt_continue_transfer_title">Autocrypt Setup Message</string>
|
<string name="autocrypt_continue_transfer_title">Autocrypt Setup Message</string>
|
||||||
<string name="autocrypt_continue_transfer_please_enter_code">Please enter the setup code displayed on the other device.</string>
|
<string name="autocrypt_continue_transfer_please_enter_code">Please enter the setup code displayed on the other device.</string>
|
||||||
|
|
|
@ -70,16 +70,9 @@
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/pref_encryption">
|
<PreferenceCategory
|
||||||
|
android:key="pref_category_encryption"
|
||||||
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
android:title="@string/pref_encryption">
|
||||||
android:defaultValue="true"
|
|
||||||
android:key="pref_prefer_e2ee"
|
|
||||||
android:title="@string/autocrypt_prefer_e2ee"/>
|
|
||||||
|
|
||||||
|
|
||||||
<Preference android:key="pref_manage_keys"
|
|
||||||
android:title="@string/pref_manage_keys"/>
|
|
||||||
|
|
||||||
<Preference android:key="pref_send_autocrypt_setup_message"
|
<Preference android:key="pref_send_autocrypt_setup_message"
|
||||||
android:title="@string/autocrypt_send_asm_title"/>
|
android:title="@string/autocrypt_send_asm_title"/>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue