use of me.devsaki.hentoid.events.UpdateEvent in project Hentoid by avluis.
the class UpdateCheckService method onCheckSuccess.
private void onCheckSuccess(UpdateInfo updateInfoJson) {
boolean newVersion = false;
if (BuildConfig.VERSION_CODE < updateInfoJson.getVersionCode(BuildConfig.DEBUG)) {
stopForeground(true);
String updateUrl = updateInfoJson.getUpdateUrl(BuildConfig.DEBUG);
notificationManager.notify(new UpdateAvailableNotification(updateUrl));
newVersion = true;
} else if (shouldShowToast) {
Toast.makeText(this, R.string.pref_check_updates_manual_no_new, LENGTH_SHORT).show();
}
// Get the alerts relevant to current version code
List<UpdateInfo.SourceAlert> sourceAlerts = Stream.of(updateInfoJson.getSourceAlerts(BuildConfig.DEBUG)).filter(a -> a.getFixedByBuild() > BuildConfig.VERSION_CODE).toList();
// Send update info through the bus to whom it may concern
EventBus.getDefault().postSticky(new UpdateEvent(newVersion, sourceAlerts));
}
Aggregations