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

Commit 8b4e2ecf authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊 Committed by Nishith Khanna
Browse files

Updater: add option to show all updates

parent e484c2c3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -584,6 +584,7 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport
        View view = LayoutInflater.from(this).inflate(R.layout.preferences_dialog, null);
        Spinner autoCheckInterval = view.findViewById(R.id.preferences_auto_updates_check_interval);
        SwitchCompat autoDelete = view.findViewById(R.id.preferences_auto_delete_updates);
        SwitchCompat allUpdates = view.findViewById(R.id.preferences_all_updates);
        SwitchCompat meteredNetworkWarning = view.findViewById(
                R.id.preferences_metered_network_warning);
        SwitchCompat abPerfMode = view.findViewById(R.id.preferences_ab_perf_mode);
@@ -614,6 +615,7 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport
        autoCheckInterval.setSelection(Utils.getUpdateCheckSetting(this));

        autoDelete.setChecked(prefs.getBoolean(Constants.PREF_AUTO_DELETE_UPDATES, true));
        allUpdates.setChecked(prefs.getBoolean(Constants.PREF_ALL_UPDATES, false));
        meteredNetworkWarning.setChecked(prefs.getBoolean(Constants.PREF_METERED_NETWORK_WARNING,
                prefs.getBoolean(Constants.PREF_MOBILE_DATA_WARNING, true)));
        abPerfMode.setChecked(prefs.getBoolean(Constants.PREF_AB_PERF_MODE, getResources().getBoolean(R.bool.config_prioritizeUpdateProcess)));
@@ -654,6 +656,7 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport
                            .putInt(Constants.PREF_AUTO_UPDATES_CHECK_INTERVAL,
                                    autoCheckInterval.getSelectedItemPosition())
                            .putBoolean(Constants.PREF_AUTO_DELETE_UPDATES, autoDelete.isChecked())
                            .putBoolean(Constants.PREF_ALL_UPDATES, allUpdates.isChecked())
                            .putBoolean(Constants.PREF_METERED_NETWORK_WARNING,
                                    meteredNetworkWarning.isChecked())
                            .putBoolean(Constants.PREF_AB_PERF_MODE, abPerfMode.isChecked())
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ public final class Constants {
    public static final String PREF_LAST_UPDATE_CHECK = "last_update_check";
    public static final String PREF_AUTO_UPDATES_CHECK_INTERVAL = "auto_updates_check_interval";
    public static final String PREF_AUTO_DELETE_UPDATES = "auto_delete_updates";
    public static final String PREF_ALL_UPDATES = "all_updates";
    public static final String PREF_AB_PERF_MODE = "ab_perf_mode";
    public static final String PREF_METERED_NETWORK_WARNING = "pref_metered_network_warning";
    public static final String PREF_MOBILE_DATA_WARNING = "pref_mobile_data_warning";
+9 −1
Original line number Diff line number Diff line
@@ -268,8 +268,16 @@ public class Utils {
            serverUrl = context.getString(R.string.updater_server_url);
        }

        SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
        boolean allUpdates = preferences.getBoolean(Constants.PREF_ALL_UPDATES, false);
        if (Utils.isDevModeOn(context)) {
            allUpdates = true;
        }

        if (anonHash != null && !anonHash.isEmpty()) {
            serverUrl += "?ota_anon_hash=" + anonHash;
            serverUrl += "?ota_anon_hash=" + anonHash + "&strict=" + !allUpdates;
        } else {
            serverUrl += "?strict=" + !allUpdates;
        }

        return serverUrl.replace("{device}", device)
+8 −0
Original line number Diff line number Diff line
@@ -28,6 +28,14 @@
            android:layout_weight="1" />
    </LinearLayout>

    <androidx.appcompat.widget.SwitchCompat
        android:id="@+id/preferences_all_updates"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="16dp"
        android:text="@string/pref_all_updates"
        android:textSize="16sp" />

    <androidx.appcompat.widget.SwitchCompat
        android:id="@+id/preferences_auto_delete_updates"
        android:layout_width="match_parent"
+19 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright Murena SAS 2023
  ~ This program is free software: you can redistribute it and/or modify
  ~ it under the terms of the GNU General Public License as published by
  ~ the Free Software Foundation, either version 3 of the License, or
  ~ (at your option) any later version.
  ~
  ~ This program is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ~ GNU General Public License for more details.
  ~
  ~ You should have received a copy of the GNU General Public License
  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.
  -->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
  <string name="pref_all_updates">See all available updates</string>
</resources>
 No newline at end of file