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

Commit 2623730b authored by Michael W's avatar Michael W
Browse files

Updater: No need to install every update

* Apparently users are not aware that they don't have to install every
  update we ever released (weeklies) after they have skipped some due
  to various reasons
* Since we are providing full installation packages, remind the user that
  it's ok to only ever choose the newest one

Change-Id: I70f9acd70344f36aaae7e45b848f6bcb7a8b3c0f
parent f2ac903e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -152,4 +152,8 @@
    <string name="new_updates_channel_title">New updates</string>
    <string name="ongoing_channel_title">Ongoing downloads</string>
    <string name="update_failed_channel_title">Update failed</string>

    <string name="info_dialog_title">Did you know?</string>
    <string name="info_dialog_message">LineageOS updates are full installation packages. That means you can always install only the latest update, even if you skipped some in between!</string>
    <string name="info_dialog_ok">Thanks for the info!</string>
</resources>
+19 −1
Original line number Diff line number Diff line
@@ -477,7 +477,10 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
                .setMessage(mActivity.getString(resId, buildInfoText,
                        mActivity.getString(android.R.string.ok)))
                .setPositiveButton(android.R.string.ok,
                        (dialog, which) -> Utils.triggerUpdate(mActivity, downloadId))
                        (dialog, which) -> {
                            Utils.triggerUpdate(mActivity, downloadId);
                            maybeShowInfoDialog();
                        })
                .setNegativeButton(android.R.string.cancel, null);
    }

@@ -493,6 +496,21 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
                .setNegativeButton(android.R.string.cancel, null);
    }

    private void maybeShowInfoDialog() {
        SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mActivity);
        boolean alreadySeen = preferences.getBoolean(Constants.HAS_SEEN_INFO_DIALOG, false);
        if (alreadySeen) {
            return;
        }
        new AlertDialog.Builder(mActivity)
                .setTitle(R.string.info_dialog_title)
                .setMessage(R.string.info_dialog_message)
                .setPositiveButton(R.string.info_dialog_ok, (dialog, which) -> preferences.edit()
                        .putBoolean(Constants.HAS_SEEN_INFO_DIALOG, true)
                        .apply())
                .show();
    }

    private void startActionMode(final UpdateInfo update, final boolean canDelete, View anchor) {
        mSelectedDownload = update.getDownloadId();
        notifyItemChanged(update.getDownloadId());
+2 −0
Original line number Diff line number Diff line
@@ -55,4 +55,6 @@ public final class Constants {

    public static final String UPDATE_RECOVERY_EXEC = "/vendor/bin/install-recovery.sh";
    public static final String UPDATE_RECOVERY_PROPERTY = "persist.vendor.recovery_update";

    public static final String HAS_SEEN_INFO_DIALOG = "has_seen_info_dialog";
}