Added option to enable/disable changelog

This commit is contained in:
M66B 2021-09-19 11:12:59 +02:00
parent 924db97c90
commit 040b0acb29
5 changed files with 34 additions and 5 deletions

View File

@ -4,6 +4,10 @@
### [Yaverlandia](https://en.wikipedia.org/wiki/Yaverlandia)
### 1.1729
* Added miscellaneous option to disable showing the changelog
### 1.1728
* Prevent suggesting spam contacts

View File

@ -1106,11 +1106,14 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
String version = BuildConfig.VERSION_NAME + BuildConfig.REVISION;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (prefs.getBoolean("first", true))
boolean first = prefs.getBoolean("first", true);
boolean show_changelog = prefs.getBoolean("show_changelog", !BuildConfig.PLAY_STORE_RELEASE);
if (first)
new FragmentDialogFirst().show(getSupportFragmentManager(), "first");
else if (!BuildConfig.PLAY_STORE_RELEASE) {
else if (show_changelog) {
String last = prefs.getString("changelog", null);
if (!Objects.equals(version, last)) {
if (!Objects.equals(version, last) || BuildConfig.DEBUG) {
Bundle args = new Bundle();
args.putString("name", "CHANGELOG.md");
FragmentDialogMarkdown fragment = new FragmentDialogMarkdown();

View File

@ -108,6 +108,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SwitchCompat swWatchdog;
private SwitchCompat swUpdates;
private SwitchCompat swCheckWeekly;
private SwitchCompat swChangelog;
private SwitchCompat swExperiments;
private TextView tvExperimentsHint;
private SwitchCompat swCrashReports;
@ -159,7 +160,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private final static String[] RESET_OPTIONS = new String[]{
"shortcuts", "fts",
"classification", "class_min_probability", "class_min_difference",
"language", "deepl_enabled", "watchdog", "updates", "weekly",
"language", "deepl_enabled", "watchdog", "updates", "weekly", "show_changelog",
"experiments", "wal", "checkpoints", "query_threads", "sqlite_cache", "crash_reports", "cleanup_attachments",
"protocol", "debug", "log_level",
"use_modseq", "perform_expunge",
@ -226,6 +227,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swWatchdog = view.findViewById(R.id.swWatchdog);
swUpdates = view.findViewById(R.id.swUpdates);
swCheckWeekly = view.findViewById(R.id.swWeekly);
swChangelog = view.findViewById(R.id.swChangelog);
swExperiments = view.findViewById(R.id.swExperiments);
tvExperimentsHint = view.findViewById(R.id.tvExperimentsHint);
swCrashReports = view.findViewById(R.id.swCrashReports);
@ -512,6 +514,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swChangelog.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("show_changelog", checked).apply();
}
});
tvExperimentsHint.setPaintFlags(tvExperimentsHint.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
tvExperimentsHint.setOnClickListener(new View.OnClickListener() {
@Override
@ -1114,6 +1123,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swUpdates.setChecked(prefs.getBoolean("updates", true));
swCheckWeekly.setChecked(prefs.getBoolean("weekly", Helper.hasPlayStore(getContext())));
swCheckWeekly.setEnabled(swUpdates.isChecked());
swChangelog.setChecked(prefs.getBoolean("show_changelog", !BuildConfig.PLAY_STORE_RELEASE));
swExperiments.setChecked(prefs.getBoolean("experiments", false));
swCrashReports.setChecked(prefs.getBoolean("crash_reports", false));
tvUuid.setText(prefs.getString("uuid", null));

View File

@ -354,6 +354,17 @@
app:layout_constraintTop_toBottomOf="@id/swUpdates"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swChangelog"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_changelog"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swWeekly"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swExperiments"
android:layout_width="0dp"
@ -362,7 +373,7 @@
android:text="@string/title_advanced_experiments"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swWeekly"
app:layout_constraintTop_toBottomOf="@id/swChangelog"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView

View File

@ -629,6 +629,7 @@
<string name="title_advanced_watchdog">Periodically check if FairEmail is still active</string>
<string name="title_advanced_updates">Check for GitHub updates</string>
<string name="title_advanced_check_weekly">Check weekly instead of daily</string>
<string name="title_advanced_changelog">Show changelog after update</string>
<string name="title_advanced_experiments">Try experimental features</string>
<string name="title_advanced_crash_reports">Send error reports</string>
<string name="title_advanced_cleanup_attachments">Delete attachments of old messages</string>