Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Commit

Permalink
added version check for 16.0
Browse files Browse the repository at this point in the history
Avoiding download of stable 15.0 which cannot be installed anyway.
  • Loading branch information
hugbug committed Jul 28, 2015
1 parent 102c96f commit 35a480b
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions app/src/main/java/net/nzbget/nzbget/InstallActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ private void enableButtons(boolean enabled) {
findViewById(R.id.customButton).setEnabled(enabled);
}

private void finished() {
setStatusText(null);
enableButtons(true);
downloading = false;
}

public void installDaemon(View view) {
setStatusText("Downloading installer package...");

Expand Down Expand Up @@ -98,9 +104,9 @@ public void installCustom(View view) {
if (downloadName != null) {
installFile(downloadName);
} else {
MessageActivity.showErrorMessage(this, "NZBGet daemon installer", "Could not find NZBGet daemon installer in Download-directory.", null);
enableButtons(true);
setStatusText(null);
MessageActivity.showErrorMessage(this, "NZBGet daemon installer",
"Could not find NZBGet daemon installer in Download-directory.", null);
finished();
}
}

Expand Down Expand Up @@ -177,12 +183,23 @@ private void infoCompleted(long aLong) {
file.delete();
}
catch (IOException e) {
MessageActivity.showErrorMessage(this, "NZBGet daemon installer", "Could not read version info:" + e.getMessage(), null);
MessageActivity.showErrorMessage(this, "NZBGet daemon installer",
"Could not read version info:" + e.getMessage(), null);
finished();
return;
}

if (downloadUrl.indexOf("nzbget-15.") > -1) {
MessageActivity.showErrorMessage(this, "NZBGet daemon installer",
"This installer requires version 16.0, which seems to be not released yet. Please install the testing version instead.", null);
finished();
return;
}

if (downloadUrl == null) {
MessageActivity.showErrorMessage(this, "NZBGet daemon installer", "Could not read version info: file format error.", null);
MessageActivity.showErrorMessage(this, "NZBGet daemon installer",
"Could not read version info: file format error.", null);
finished();
return;
}

Expand Down Expand Up @@ -246,9 +263,7 @@ private void cancelDownload() {
//Patch for bug: http://code.google.com/p/android/issues/detail?id=6191
}

setStatusText(null);
enableButtons(true);
downloading = false;
finished();
}

protected void downloadCompleted(long downloadId) {
Expand All @@ -264,8 +279,7 @@ protected void downloadCompleted(long downloadId) {

if (!validDownload(downloadId)) {
MessageActivity.showErrorMessage(this, "NZBGet daemon installer", "Download failed.", null);
setStatusText(null);
enableButtons(true);
finished();
return;
}

Expand Down Expand Up @@ -325,8 +339,7 @@ public void onClick() {
MessageActivity.showLogMessage(activity, "NZBGet daemon installation failed.");
}

enableButtons(true);
setStatusText(null);
finished();
}
});
}
Expand Down

0 comments on commit 35a480b

Please sign in to comment.