Skip to content

Commit

Permalink
upgraded Android uploader service dependency. NOTE this requires the …
Browse files Browse the repository at this point in the history
…app's android/app/build.gradle to have compileSdkVersion and targetSdkVersion of at least 25. Or else you get a compilation error
  • Loading branch information
StevePotter committed Apr 28, 2017
1 parent d1e01f4 commit a7d2ef9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
12 changes: 6 additions & 6 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.3'
classpath 'com.android.tools.build:gradle:2.3.0'
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
compileSdkVersion 25
buildToolsVersion "25.0.2"

defaultConfig {
minSdkVersion 16
targetSdkVersion 22
targetSdkVersion 25
versionCode 1
versionName "1.0"
ndk {
Expand All @@ -31,6 +31,6 @@ repositories {
mavenCentral()
}
dependencies {
compile 'net.gotev:uploadservice:3.0.3'
compile 'net.gotev:uploadservice:3.2.3'
compile 'com.facebook.react:react-native:+'
}
}
9 changes: 5 additions & 4 deletions android/src/main/java/com/vydia/UploaderModule.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.vydia.RNUploader;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.Log;
import android.webkit.MimeTypeMap;
Expand Down Expand Up @@ -131,23 +132,23 @@ public void startUpload(ReadableMap options, final Promise promise) {
.setMaxRetries(2)
.setDelegate(new UploadStatusDelegate() {
@Override
public void onProgress(UploadInfo uploadInfo) {
public void onProgress(Context context, UploadInfo uploadInfo) {
WritableMap params = Arguments.createMap();
params.putString("id", customUploadId != null ? customUploadId : uploadInfo.getUploadId());
params.putInt("progress", uploadInfo.getProgressPercent()); //0-100
sendEvent("progress", params);
}

@Override
public void onError(UploadInfo uploadInfo, Exception exception) {
public void onError(Context context, UploadInfo uploadInfo, Exception exception) {
WritableMap params = Arguments.createMap();
params.putString("id", customUploadId != null ? customUploadId : uploadInfo.getUploadId());
params.putString("error", exception.getMessage());
sendEvent("error", params);
}

@Override
public void onCompleted(UploadInfo uploadInfo, ServerResponse serverResponse) {
public void onCompleted(Context context, UploadInfo uploadInfo, ServerResponse serverResponse) {
WritableMap params = Arguments.createMap();
params.putString("id", customUploadId != null ? customUploadId : uploadInfo.getUploadId());
params.putInt("responseCode", serverResponse.getHttpCode());
Expand All @@ -156,7 +157,7 @@ public void onCompleted(UploadInfo uploadInfo, ServerResponse serverResponse) {
}

@Override
public void onCancelled(UploadInfo uploadInfo) {
public void onCancelled(Context context, UploadInfo uploadInfo) {
WritableMap params = Arguments.createMap();
params.putString("id", customUploadId != null ? customUploadId : uploadInfo.getUploadId());
sendEvent("cancelled", params);
Expand Down

0 comments on commit a7d2ef9

Please sign in to comment.