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 swConfirmImages;
private SwitchCompat swConfirmHtml; private SwitchCompat swConfirmHtml;
private SwitchCompat swDisableTracking; private SwitchCompat swDisableTracking;
private SwitchCompat swHideTimeZone;
private Button btnBiometrics; private Button btnBiometrics;
private Button btnPin; private Button btnPin;
private Spinner spBiometricsTimeout; private Spinner spBiometricsTimeout;
@ -71,7 +72,8 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
private Group grpSafeBrowsing; private Group grpSafeBrowsing;
private final static String[] RESET_OPTIONS = new String[]{ 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", "biometrics", "pin", "biometrics_timeout",
"display_hidden", "secure", "safe_browsing" "display_hidden", "secure", "safe_browsing"
}; };
@ -92,6 +94,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
swConfirmImages = view.findViewById(R.id.swConfirmImages); swConfirmImages = view.findViewById(R.id.swConfirmImages);
swConfirmHtml = view.findViewById(R.id.swConfirmHtml); swConfirmHtml = view.findViewById(R.id.swConfirmHtml);
swDisableTracking = view.findViewById(R.id.swDisableTracking); swDisableTracking = view.findViewById(R.id.swDisableTracking);
swHideTimeZone = view.findViewById(R.id.swHideTimeZone);
btnBiometrics = view.findViewById(R.id.btnBiometrics); btnBiometrics = view.findViewById(R.id.btnBiometrics);
btnPin = view.findViewById(R.id.btnPin); btnPin = view.findViewById(R.id.btnPin);
spBiometricsTimeout = view.findViewById(R.id.spBiometricsTimeout); 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() { btnBiometrics.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -278,6 +288,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
swConfirmImages.setChecked(prefs.getBoolean("confirm_images", true)); swConfirmImages.setChecked(prefs.getBoolean("confirm_images", true));
swConfirmHtml.setChecked(prefs.getBoolean("confirm_html", true)); swConfirmHtml.setChecked(prefs.getBoolean("confirm_html", true));
swDisableTracking.setChecked(prefs.getBoolean("disable_tracking", true)); swDisableTracking.setChecked(prefs.getBoolean("disable_tracking", true));
swHideTimeZone.setChecked(prefs.getBoolean("hide_timezone", true));
boolean biometrics = prefs.getBoolean("biometrics", false); boolean biometrics = prefs.getBoolean("biometrics", false);
btnBiometrics.setText(biometrics 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) static MimeMessageEx from(Context context, EntityMessage message, EntityIdentity identity, Session isession, boolean send)
throws MessagingException, IOException { throws MessagingException, IOException {
DB db = DB.getInstance(context); 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); MimeMessageEx imessage = new MimeMessageEx(isession, message.msgid);
// Flags // Flags
@ -217,8 +223,6 @@ public class MessageHelper {
if (message.receipt_request != null && message.receipt_request) { if (message.receipt_request != null && message.receipt_request) {
String to = (identity.replyto == null ? identity.email : identity.replyto); 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 // 0=Read receipt
// 1=Delivery receipt // 1=Delivery receipt
// 2=Read+delivery receipt // 2=Read+delivery receipt
@ -238,9 +242,8 @@ public class MessageHelper {
imessage.addHeader("List-Unsubscribe", "<" + message.unsubscribe + ">"); imessage.addHeader("List-Unsubscribe", "<" + message.unsubscribe + ">");
MailDateFormat mdf = new MailDateFormat(); 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.setHeader("Date", mdf.format(new Date()));
//imessage.setSentDate(new Date());
List<EntityAttachment> attachments = db.attachment().getAttachments(message.id); List<EntityAttachment> attachments = db.attachment().getAttachments(message.id);
@ -249,10 +252,6 @@ public class MessageHelper {
if (EntityAttachment.PGP_KEY.equals(attachment.encryption)) { if (EntityAttachment.PGP_KEY.equals(attachment.encryption)) {
InternetAddress from = (InternetAddress) message.from[0]; 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) { if (autocrypt) {
String mode = (mutual ? "mutual" : "nopreference"); String mode = (mutual ? "mutual" : "nopreference");

View File

@ -126,6 +126,18 @@
app:layout_constraintTop_toBottomOf="@+id/tvConfirmHtmlHint" app:layout_constraintTop_toBottomOf="@+id/tvConfirmHtmlHint"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swHideTimeZone"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_hide_timezone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/swDisableTracking"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView <eu.faircode.email.FixedTextView
android:id="@+id/tvBiometrics" android:id="@+id/tvBiometrics"
android:layout_width="0dp" android:layout_width="0dp"
@ -137,7 +149,7 @@
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swDisableTracking" /> app:layout_constraintTop_toBottomOf="@id/swHideTimeZone" />
<Button <Button
android:id="@+id/btnBiometrics" android:id="@+id/btnBiometrics"

View File

@ -414,6 +414,7 @@
<string name="title_advanced_confirm_images">Confirm showing images</string> <string name="title_advanced_confirm_images">Confirm showing images</string>
<string name="title_advanced_confirm_html">Show reformatted messages by default</string> <string name="title_advanced_confirm_html">Show reformatted messages by default</string>
<string name="title_advanced_tracking">Automatically recognize and disable tracking images</string> <string name="title_advanced_tracking">Automatically recognize and disable tracking images</string>
<string name="title_advanced_hide_timezone">Send messages without timezone data</string>
<string name="title_advanced_display_hidden">Display hidden message texts</string> <string name="title_advanced_display_hidden">Display hidden message texts</string>
<string name="title_advanced_secure">Hide from recent apps screen and prevent taking screenshots</string> <string name="title_advanced_secure">Hide from recent apps screen and prevent taking screenshots</string>
<string name="title_advanced_pin">PIN</string> <string name="title_advanced_pin">PIN</string>