Added setting to disable hiding the time zone

This commit is contained in:
M66B
2020-04-24 20:59:17 +02:00
parent 477719eb95
commit 075b1edbf9
4 changed files with 33 additions and 10 deletions

View File

@@ -60,6 +60,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
private SwitchCompat swConfirmImages;
private SwitchCompat swConfirmHtml;
private SwitchCompat swDisableTracking;
private SwitchCompat swHideTimeZone;
private Button btnBiometrics;
private Button btnPin;
private Spinner spBiometricsTimeout;
@@ -71,7 +72,8 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
private Group grpSafeBrowsing;
private final static String[] RESET_OPTIONS = new String[]{
"confirm_links", "browse_links", "confirm_images", "confirm_html", "disable_tracking",
"confirm_links", "browse_links", "confirm_images", "confirm_html",
"disable_tracking", "hide_timezone",
"biometrics", "pin", "biometrics_timeout",
"display_hidden", "secure", "safe_browsing"
};
@@ -92,6 +94,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
swConfirmImages = view.findViewById(R.id.swConfirmImages);
swConfirmHtml = view.findViewById(R.id.swConfirmHtml);
swDisableTracking = view.findViewById(R.id.swDisableTracking);
swHideTimeZone = view.findViewById(R.id.swHideTimeZone);
btnBiometrics = view.findViewById(R.id.btnBiometrics);
btnPin = view.findViewById(R.id.btnPin);
spBiometricsTimeout = view.findViewById(R.id.spBiometricsTimeout);
@@ -144,6 +147,13 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
}
});
swHideTimeZone.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("hide_timezone", checked).apply();
}
});
btnBiometrics.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -278,6 +288,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
swConfirmImages.setChecked(prefs.getBoolean("confirm_images", true));
swConfirmHtml.setChecked(prefs.getBoolean("confirm_html", true));
swDisableTracking.setChecked(prefs.getBoolean("disable_tracking", true));
swHideTimeZone.setChecked(prefs.getBoolean("hide_timezone", true));
boolean biometrics = prefs.getBoolean("biometrics", false);
btnBiometrics.setText(biometrics

View File

@@ -140,6 +140,12 @@ public class MessageHelper {
static MimeMessageEx from(Context context, EntityMessage message, EntityIdentity identity, Session isession, boolean send)
throws MessagingException, IOException {
DB db = DB.getInstance(context);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
int receipt_type = prefs.getInt("receipt_type", 2);
boolean hide_timezone = prefs.getBoolean("hide_timezone", true);
boolean autocrypt = prefs.getBoolean("autocrypt", true);
boolean mutual = prefs.getBoolean("autocrypt_mutual", true);
MimeMessageEx imessage = new MimeMessageEx(isession, message.msgid);
// Flags
@@ -217,8 +223,6 @@ public class MessageHelper {
if (message.receipt_request != null && message.receipt_request) {
String to = (identity.replyto == null ? identity.email : identity.replyto);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
int receipt_type = prefs.getInt("receipt_type", 2);
// 0=Read receipt
// 1=Delivery receipt
// 2=Read+delivery receipt
@@ -238,9 +242,8 @@ public class MessageHelper {
imessage.addHeader("List-Unsubscribe", "<" + message.unsubscribe + ">");
MailDateFormat mdf = new MailDateFormat();
mdf.setTimeZone(TimeZone.getTimeZone("UTC"));
mdf.setTimeZone(hide_timezone ? TimeZone.getTimeZone("UTC") : TimeZone.getDefault());
imessage.setHeader("Date", mdf.format(new Date()));
//imessage.setSentDate(new Date());
List<EntityAttachment> attachments = db.attachment().getAttachments(message.id);
@@ -249,10 +252,6 @@ public class MessageHelper {
if (EntityAttachment.PGP_KEY.equals(attachment.encryption)) {
InternetAddress from = (InternetAddress) message.from[0];
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean autocrypt = prefs.getBoolean("autocrypt", true);
boolean mutual = prefs.getBoolean("autocrypt_mutual", true);
if (autocrypt) {
String mode = (mutual ? "mutual" : "nopreference");