[app] Expose beta release channel in the app details UI

This commit is contained in:
Torsten Grote
2022-04-21 16:47:31 -03:00
committed by Hans-Christoph Steiner
parent acafbbaa65
commit 0a7debeb30
3 changed files with 16 additions and 0 deletions

View File

@@ -250,12 +250,15 @@ public class AppDetailsActivity extends AppCompatActivity
MenuItem itemIgnoreAll = menu.findItem(R.id.action_ignore_all);
itemIgnoreAll.setChecked(prefs.getIgnoreAllUpdates());
MenuItem itemIgnoreThis = menu.findItem(R.id.action_ignore_this);
MenuItem itemBeta = menu.findItem(R.id.action_release_channel_beta);
if (itemIgnoreAll.isChecked()) {
itemIgnoreThis.setEnabled(false);
itemBeta.setEnabled(false);
} else if (app != null && versions != null) {
itemIgnoreThis.setVisible(app.hasUpdates(versions, appPrefs));
itemIgnoreThis.setChecked(prefs.shouldIgnoreUpdate(app.autoInstallVersionCode));
}
itemBeta.setChecked(prefs.getReleaseChannels().contains(Apk.RELEASE_CHANNEL_BETA));
return true;
}
@@ -328,6 +331,13 @@ public class AppDetailsActivity extends AppCompatActivity
db.getAppPrefsDao().update(prefs.toggleIgnoreVersionCodeUpdate(app.autoInstallVersionCode)));
AppUpdateStatusManager.getInstance(this).checkForUpdates();
return true;
} else if (item.getItemId() == R.id.action_release_channel_beta) {
final AppPrefs prefs = Objects.requireNonNull(appPrefs);
Utils.runOffUiThread(() -> {
db.getAppPrefsDao().update(prefs.toggleReleaseChannel(Apk.RELEASE_CHANNEL_BETA));
return true; // we don't really care about the result here
}, result -> AppUpdateStatusManager.getInstance(this).checkForUpdates());
return true;
} else if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;

View File

@@ -19,4 +19,9 @@
android:title="@string/menu_ignore_this"
android:checkable="true"
app:showAsAction="never" />
<item
android:id="@+id/action_release_channel_beta"
android:title="@string/menu_release_channel_beta"
android:checkable="true"
app:showAsAction="never" />
</menu>

View File

@@ -223,6 +223,7 @@ This often occurs with apps installed via Google Play or other sources, if they
<string name="menu_select_for_wipe">Select for wipe</string>
<string name="menu_ignore_all">Ignore All Updates</string>
<string name="menu_ignore_this">Ignore This Update</string>
<string name="menu_release_channel_beta">Allow Beta Updates</string>
<string name="menu_website">Website</string>
<string name="menu_email">E-Mail Author</string>
<!-- The title for the link that points to the issue tracker for this app -->