Pass the destination File to the callback
The current argument is unused and it should have been removed
with commit 81229329f1
("Generate download clients using a builder class"). Instead of
removing it completely, use it to pass the File of the download.
This commit is contained in:
@@ -241,7 +241,7 @@ public class UpdatesActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String response) {
|
public void onSuccess(File destination) {
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@@ -78,7 +78,7 @@ public class UpdatesCheckReceiver extends BroadcastReceiver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String response) {
|
public void onSuccess(File destination) {
|
||||||
try {
|
try {
|
||||||
if (json.exists() && Utils.checkForNewUpdates(json, jsonNew)) {
|
if (json.exists() && Utils.checkForNewUpdates(json, jsonNew)) {
|
||||||
showNotification(context);
|
showNotification(context);
|
||||||
|
@@ -176,7 +176,7 @@ public class UpdaterController implements UpdaterControllerInt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String body) {
|
public void onSuccess(File destination) {
|
||||||
Log.d(TAG, "Download complete");
|
Log.d(TAG, "Download complete");
|
||||||
UpdateDownload update = mDownloads.get(downloadId).mUpdate;
|
UpdateDownload update = mDownloads.get(downloadId).mUpdate;
|
||||||
update.setStatus(UpdateStatus.VERIFYING);
|
update.setStatus(UpdateStatus.VERIFYING);
|
||||||
|
@@ -24,7 +24,7 @@ public interface DownloadClient {
|
|||||||
interface DownloadCallback {
|
interface DownloadCallback {
|
||||||
void onResponse(int statusCode, String url, Headers headers);
|
void onResponse(int statusCode, String url, Headers headers);
|
||||||
|
|
||||||
void onSuccess(String body);
|
void onSuccess(File destination);
|
||||||
|
|
||||||
void onFailure(boolean cancelled);
|
void onFailure(boolean cancelled);
|
||||||
}
|
}
|
||||||
|
@@ -196,7 +196,7 @@ class OkHttpDownloadClient implements DownloadClient {
|
|||||||
sink.writeAll(body.source());
|
sink.writeAll(body.source());
|
||||||
Log.d(TAG, "Download complete");
|
Log.d(TAG, "Download complete");
|
||||||
sink.flush();
|
sink.flush();
|
||||||
mCallback.onSuccess(null);
|
mCallback.onSuccess(mDestination);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
onFailure(request, e);
|
onFailure(request, e);
|
||||||
} finally {
|
} finally {
|
||||||
|
Reference in New Issue
Block a user