Skip to content

Commit

Permalink
fix: lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Nov 3, 2024
1 parent 58b23d9 commit c4085e1
Showing 1 changed file with 57 additions and 57 deletions.
114 changes: 57 additions & 57 deletions android/src/main/java/ee/forgr/capacitor/uploader/UploaderPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,66 +49,66 @@ private void createNotificationChannel() {
@Override
public void load() {
createNotificationChannel();

// Create a request observer for all uploads
RequestObserver observer = new RequestObserver(
getContext().getApplicationContext(),
getActivity(),
new RequestObserverDelegate() {
@Override
public void onProgress(Context context, UploadInfo uploadInfo) {
JSObject event = new JSObject();
event.put("name", "uploading");
JSObject payload = new JSObject();
payload.put("percent", uploadInfo.getProgressPercent());
event.put("payload", payload);
event.put("id", uploadInfo.getUploadId());
notifyListeners("events", event);
}

@Override
public void onSuccess(
Context context,
UploadInfo uploadInfo,
ServerResponse serverResponse
) {
JSObject event = new JSObject();
event.put("name", "completed");
JSObject payload = new JSObject();
payload.put("statusCode", serverResponse.getCode());
event.put("payload", payload);
event.put("id", uploadInfo.getUploadId());
notifyListeners("events", event);
}

@Override
public void onError(
Context context,
UploadInfo uploadInfo,
Throwable exception
) {
JSObject event = new JSObject();
event.put("name", "failed");
JSObject payload = new JSObject();
payload.put("error", exception.getMessage());
event.put("payload", payload);
event.put("id", uploadInfo.getUploadId());
notifyListeners("events", event);
}

@Override
public void onCompleted(Context context, UploadInfo uploadInfo) {
JSObject event = new JSObject();
event.put("name", "finished");
event.put("id", uploadInfo.getUploadId());
notifyListeners("events", event);
}

@Override
public void onCompletedWhileNotObserving() {
// Handle completion while not observing if needed
}
getContext().getApplicationContext(),
getActivity(),
new RequestObserverDelegate() {
@Override
public void onProgress(Context context, UploadInfo uploadInfo) {
JSObject event = new JSObject();
event.put("name", "uploading");
JSObject payload = new JSObject();
payload.put("percent", uploadInfo.getProgressPercent());
event.put("payload", payload);
event.put("id", uploadInfo.getUploadId());
notifyListeners("events", event);
}

@Override
public void onSuccess(
Context context,
UploadInfo uploadInfo,
ServerResponse serverResponse
) {
JSObject event = new JSObject();
event.put("name", "completed");
JSObject payload = new JSObject();
payload.put("statusCode", serverResponse.getCode());
event.put("payload", payload);
event.put("id", uploadInfo.getUploadId());
notifyListeners("events", event);
}

@Override
public void onError(
Context context,
UploadInfo uploadInfo,
Throwable exception
) {
JSObject event = new JSObject();
event.put("name", "failed");
JSObject payload = new JSObject();
payload.put("error", exception.getMessage());
event.put("payload", payload);
event.put("id", uploadInfo.getUploadId());
notifyListeners("events", event);
}

@Override
public void onCompleted(Context context, UploadInfo uploadInfo) {
JSObject event = new JSObject();
event.put("name", "finished");
event.put("id", uploadInfo.getUploadId());
notifyListeners("events", event);
}

@Override
public void onCompletedWhileNotObserving() {
// Handle completion while not observing if needed
}
}
);

implementation = new Uploader(getContext().getApplicationContext());
Expand Down

0 comments on commit c4085e1

Please sign in to comment.