Skip to content

Commit

Permalink
Add direct call to showUpdateAvailable
Browse files Browse the repository at this point in the history
  • Loading branch information
agusguerra10 committed Sep 26, 2018
1 parent a901ebb commit 1ef75de
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,27 @@ public AppUpdater init() {
return this;
}

@Override
public void showUpdateAvailable(Update update) {
switch (display) {
case DIALOG:
final DialogInterface.OnClickListener updateClickListener = btnUpdateClickListener == null ? new UpdateClickListener(context, updateFrom, update.getUrlToDownload()) : btnUpdateClickListener;
final DialogInterface.OnClickListener disableClickListener = btnDisableClickListener == null ? new DisableClickListener(context) : btnDisableClickListener;

alertDialog = UtilsDisplay.showUpdateAvailableDialog(context, titleUpdate, getDescriptionUpdate(context, update, Display.DIALOG), btnDismiss, btnUpdate, btnDisable, updateClickListener, btnDismissClickListener, disableClickListener);
alertDialog.setCancelable(isDialogCancelable);
alertDialog.show();
break;
case SNACKBAR:
snackbar = UtilsDisplay.showUpdateAvailableSnackbar(context, getDescriptionUpdate(context, update, Display.SNACKBAR), UtilsLibrary.getDurationEnumToBoolean(duration), updateFrom, update.getUrlToDownload());
snackbar.show();
break;
case NOTIFICATION:
UtilsDisplay.showUpdateAvailableNotification(context, titleUpdate, getDescriptionUpdate(context, update, Display.NOTIFICATION), updateFrom, update.getUrlToDownload(), iconResId);
break;
}
}

@Override
public void start() {
latestAppVersion = new UtilsAsync.LatestAppVersion(context, false, updateFrom, gitHub, xmlOrJsonUrl, new LibraryListener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ public interface IAppUpdater {
*/
void start();

void showUpdateAvailable(Update update);

/**
* Stops the execution of AppUpdater.
*/
Expand Down

0 comments on commit 1ef75de

Please sign in to comment.