Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32b79c4c authored by Moez Bhatti's avatar Moez Bhatti
Browse files

Added preferences for auto-delete feature

parent 5241b377
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -43,6 +43,10 @@ public enum QKPreference {
    DELIVERY_TOAST("pref_key_delivery_toast", true),
    DELIVERY_VIBRATE("pref_key_delivery_vibrate", true),

    DELETE_OLD_MESSAGES("pref_key_delete_old_messages", false),
    DELETE_UNREAD_MESSAGES("pref_key_delete_old_unread_messages", "7"), // This type of preference only accepts strings
    DELETE_READ_MESSAGES("pref_key_delete_old_read_messages", "7"),

    AUTO_EMOJI("pref_key_auto_emoji", false),
    TEXT_FORMATTING("pref_key_markdown_enabled", false),
    STRIP_UNICODE("pref_key_strip_unicode", false),
+18 −0
Original line number Diff line number Diff line
@@ -105,6 +105,8 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O
    public static final String DELIVERY_REPORTS = "pref_key_delivery";
    public static final String DELIVERY_TOAST = "pref_key_delivery_toast";
    public static final String DELIVERY_VIBRATE = "pref_key_delivery_vibrate";
    public static final String DELETE_UNREAD_MESSAGES = "pref_key_delete_old_unread_messages";
    public static final String DELETE_READ_MESSAGES = "pref_key_delete_old_read_messages";
    public static final String YAPPY = "pref_key_endlessjabber";
    public static final String BLOCKED_ENABLED = "pref_key_blocked_enabled";
    public static final String BLOCKED_SENDERS = "pref_key_blocked_senders";
@@ -284,6 +286,16 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O
            font_weight.setSummary(mFontWeights[i == 2 ? 0 : 1]);
        }

        EditTextPreference deleteUnread = (EditTextPreference) findPreference(DELETE_UNREAD_MESSAGES);
        if (deleteUnread != null) {
            deleteUnread.setSummary(mContext.getString(R.string.pref_delete_old_messages_unread_summary, mContext.getString(QKPreference.DELETE_UNREAD_MESSAGES)));
        }

        EditTextPreference deleteRead = (EditTextPreference) findPreference(DELETE_READ_MESSAGES);
        if (deleteRead != null) {
            deleteRead.setSummary(mContext.getString(R.string.pref_delete_old_messages_read_summary, mContext.getString(QKPreference.DELETE_READ_MESSAGES)));
        }

        Preference day_start = findPreference(DAY_START);
        if (day_start != null) {
            day_start.setSummary(DateFormatter.getSummaryTimestamp(mContext, mPrefs.getString(DAY_START, "6:00")));
@@ -440,6 +452,12 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O
            case NIGHT_START:
                updateAlarmManager(mContext, true);
                break;
            case DELETE_UNREAD_MESSAGES:
                preference.setSummary(mContext.getString(R.string.pref_delete_old_messages_unread_summary, newValue));
                break;
            case DELETE_READ_MESSAGES:
                preference.setSummary(mContext.getString(R.string.pref_delete_old_messages_read_summary, newValue));
                break;
            case YAPPY:
                if ((Boolean) newValue) {
                    try {
+6 −0
Original line number Diff line number Diff line
@@ -169,6 +169,12 @@
    <string name="pref_delivery_toast_summary">Show a short toast to indicate a message being delivered</string>
    <string name="pref_delivery_vibrate">Vibrate</string>
    <string name="pref_delivery_vibrate_summary">Vibrate on message delivery</string>
    <string name="pref_delete_old_messages">Delete old messages</string>
    <string name="pref_delete_old_messages_summary">Automatically delete messages once they\'re old enough</string>
    <string name="pref_delete_old_messages_unread">Unread messages</string>
    <string name="pref_delete_old_messages_unread_summary">Automatically delete unread messages after %s days</string>
    <string name="pref_delete_old_messages_read">Read messages</string>
    <string name="pref_delete_old_messages_read_summary">Automatically delete read messages after %s days</string>
    <string name="pref_yappy">Yappy integration</string>
    <string name="pref_endlessjabber_summary">Enable full support for Yappy</string>
    <string name="pref_blocked_conversations">Blocked conversations</string>
+10 −2
Original line number Diff line number Diff line
@@ -3,8 +3,7 @@
    <Preference
        android:defaultValue="-16746133"
        android:key="pref_key_theme" />
    <Preference
        android:key="pref_key_icon" />
    <Preference android:key="pref_key_icon" />
    <Preference
        android:defaultValue="@bool/hasL"
        android:key="pref_key_status_tint" />
@@ -73,6 +72,15 @@
    <Preference
        android:defaultValue="false"
        android:key="pref_key_mobile_only" />
    <Preference
        android:defaultValue="false"
        android:key="pref_key_delete_old_messages" />
    <Preference
        android:defaultValue="7"
        android:key="pref_key_delete_old_unread_messages" />
    <Preference
        android:defaultValue="7"
        android:key="pref_key_delete_old_read_messages" />
    <Preference
        android:defaultValue="false"
        android:key="pref_key_strip_unicode" />
+29 −2
Original line number Diff line number Diff line
@@ -47,6 +47,33 @@
            android:title="@string/pref_delivery_vibrate"
            android:widgetLayout="@layout/view_switch" />
    </PreferenceCategory>
    <PreferenceCategory
        android:layout="@layout/list_item_preference_category"
        android:title="@string/pref_delete_old_messages">
        <CheckBoxPreference
            android:defaultValue="false"
            android:key="pref_key_delete_old_messages"
            android:layout="@layout/list_item_preference"
            android:summary="@string/pref_delete_old_messages_summary"
            android:title="@string/pref_delete_old_messages"
            android:widgetLayout="@layout/view_switch" />
        <EditTextPreference
            android:defaultValue="7"
            android:dependency="pref_key_delete_old_messages"
            android:inputType="number"
            android:key="pref_key_delete_old_unread_messages"
            android:layout="@layout/list_item_preference"
            android:summary="@string/pref_delete_old_messages_unread_summary"
            android:title="@string/pref_delete_old_messages_unread" />
        <EditTextPreference
            android:defaultValue="7"
            android:dependency="pref_key_delete_old_messages"
            android:inputType="number"
            android:key="pref_key_delete_old_read_messages"
            android:layout="@layout/list_item_preference"
            android:summary="@string/pref_delete_old_messages_read_summary"
            android:title="@string/pref_delete_old_messages_read" />
    </PreferenceCategory>
    <PreferenceCategory
        android:layout="@layout/list_item_preference_category"
        android:title="@string/pref_text">
@@ -147,12 +174,12 @@
            android:title="@string/pref_key_timestamp_delay" />
        <CheckBoxPreference
            android:defaultValue="false"
            android:disableDependentsState="true"
            android:key="pref_key_force_timestamps"
            android:layout="@layout/list_item_preference"
            android:summary="@string/pref_force_timestamps_summary"
            android:title="@string/pref_force_timestamps"
            android:widgetLayout="@layout/view_switch"
            android:disableDependentsState="true"/>
            android:widgetLayout="@layout/view_switch" />
        <CheckBoxPreference
            android:defaultValue="true"
            android:key="pref_key_compose_favorites"