@ammarahmed/react-native-upload 6.28.0 → 6.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/android/build.gradle
CHANGED
|
@@ -36,7 +36,7 @@ android {
|
|
|
36
36
|
buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
|
|
37
37
|
|
|
38
38
|
defaultConfig {
|
|
39
|
-
minSdkVersion 21
|
|
39
|
+
minSdkVersion safeExtGet('minSdkVersion', 21)
|
|
40
40
|
targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
|
|
41
41
|
versionCode 1
|
|
42
42
|
versionName "1.0"
|
|
@@ -7,6 +7,8 @@ import com.facebook.react.bridge.ReactApplicationContext
|
|
|
7
7
|
import com.facebook.react.bridge.WritableMap
|
|
8
8
|
import com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter
|
|
9
9
|
import net.gotev.uploadservice.data.UploadInfo
|
|
10
|
+
import net.gotev.uploadservice.exceptions.UploadError
|
|
11
|
+
import net.gotev.uploadservice.exceptions.UserCancelledUploadException
|
|
10
12
|
import net.gotev.uploadservice.network.ServerResponse
|
|
11
13
|
import net.gotev.uploadservice.observer.request.RequestObserverDelegate
|
|
12
14
|
|
|
@@ -22,20 +24,29 @@ class GlobalRequestObserverDelegate(reactContext: ReactApplicationContext) : Req
|
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
override fun onError(context: Context, uploadInfo: UploadInfo, exception: Throwable) {
|
|
25
|
-
|
|
26
27
|
val params = Arguments.createMap()
|
|
27
28
|
params.putString("id", uploadInfo.uploadId)
|
|
29
|
+
when (exception) {
|
|
30
|
+
is UserCancelledUploadException -> {
|
|
31
|
+
params.putString("error", "User cancelled upload")
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
is UploadError -> {
|
|
35
|
+
Log.e("RECEIVER", "Error, upload error: ${exception.serverResponse}")
|
|
36
|
+
params.putString("error", exception.message)
|
|
37
|
+
params.putInt("responseCode", exception.serverResponse.code)
|
|
38
|
+
params.putString("responseBody", exception.serverResponse.bodyString)
|
|
39
|
+
}
|
|
28
40
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} else {
|
|
33
|
-
params.putString("error", "Unknown exception")
|
|
41
|
+
else -> {
|
|
42
|
+
params.putString("error", exception.message)
|
|
43
|
+
}
|
|
34
44
|
}
|
|
35
45
|
|
|
36
46
|
sendEvent("error", params, context)
|
|
37
47
|
}
|
|
38
48
|
|
|
49
|
+
|
|
39
50
|
override fun onProgress(context: Context, uploadInfo: UploadInfo) {
|
|
40
51
|
val params = Arguments.createMap()
|
|
41
52
|
params.putString("id", uploadInfo.uploadId)
|
package/package.json
CHANGED