@woshapp/react-native-background-upload 6.16.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/.gitattributes +1 -0
- package/LICENSE +21 -0
- package/README.md +53 -0
- package/android/build.gradle +82 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/android/gradle.properties +6 -0
- package/android/gradlew +185 -0
- package/android/gradlew.bat +89 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/com/appfolio/extensions/ContextExtensions.kt +63 -0
- package/android/src/main/java/com/appfolio/extensions/UploadExtensions.kt +57 -0
- package/android/src/main/java/com/appfolio/uploader/GlobalRequestObserverDelegate.kt +62 -0
- package/android/src/main/java/com/appfolio/uploader/ModifiedBinaryUploadRequest.kt +29 -0
- package/android/src/main/java/com/appfolio/uploader/ModifiedHttpUploadRequest.kt +57 -0
- package/android/src/main/java/com/appfolio/uploader/ModifiedMultipartUploadRequest.kt +60 -0
- package/android/src/main/java/com/appfolio/uploader/UploaderModule.kt +384 -0
- package/android/src/main/java/com/appfolio/uploader/UploaderReactPackage.java +32 -0
- package/android/src/main/java/com/appfolio/work/TaskCompletionNotifier.kt +47 -0
- package/android/src/main/java/com/appfolio/work/UploadManager.kt +109 -0
- package/android/src/main/java/com/appfolio/work/UploadWorker.kt +20 -0
- package/bitbucket-pipelines.yml +14 -0
- package/example/RNBackgroundExample/.buckconfig +6 -0
- package/example/RNBackgroundExample/.eslintrc.js +4 -0
- package/example/RNBackgroundExample/.flowconfig +74 -0
- package/example/RNBackgroundExample/.gitattributes +1 -0
- package/example/RNBackgroundExample/.prettierrc.js +6 -0
- package/example/RNBackgroundExample/.watchmanconfig +1 -0
- package/example/RNBackgroundExample/App.js +325 -0
- package/example/RNBackgroundExample/README.md +50 -0
- package/example/RNBackgroundExample/__tests__/App-test.js +14 -0
- package/example/RNBackgroundExample/android/app/BUCK +55 -0
- package/example/RNBackgroundExample/android/app/build.gradle +225 -0
- package/example/RNBackgroundExample/android/app/build_defs.bzl +19 -0
- package/example/RNBackgroundExample/android/app/debug.keystore +0 -0
- package/example/RNBackgroundExample/android/app/proguard-rules.pro +10 -0
- package/example/RNBackgroundExample/android/app/src/androidTest/java/com/rnbackgroundexample/DetoxTest.java +24 -0
- package/example/RNBackgroundExample/android/app/src/debug/AndroidManifest.xml +8 -0
- package/example/RNBackgroundExample/android/app/src/debug/java/com/rnbackgroundexample/ReactNativeFlipper.java +72 -0
- package/example/RNBackgroundExample/android/app/src/main/AndroidManifest.xml +33 -0
- package/example/RNBackgroundExample/android/app/src/main/java/com/rnbackgroundexample/MainActivity.java +15 -0
- package/example/RNBackgroundExample/android/app/src/main/java/com/rnbackgroundexample/MainApplication.java +76 -0
- package/example/RNBackgroundExample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/example/RNBackgroundExample/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/example/RNBackgroundExample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/example/RNBackgroundExample/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/example/RNBackgroundExample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/example/RNBackgroundExample/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/example/RNBackgroundExample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/example/RNBackgroundExample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/example/RNBackgroundExample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/example/RNBackgroundExample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/example/RNBackgroundExample/android/app/src/main/res/values/strings.xml +3 -0
- package/example/RNBackgroundExample/android/app/src/main/res/values/styles.xml +9 -0
- package/example/RNBackgroundExample/android/build.gradle +42 -0
- package/example/RNBackgroundExample/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/example/RNBackgroundExample/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/example/RNBackgroundExample/android/gradle.properties +23 -0
- package/example/RNBackgroundExample/android/gradlew +183 -0
- package/example/RNBackgroundExample/android/gradlew.bat +103 -0
- package/example/RNBackgroundExample/android/settings.gradle +3 -0
- package/example/RNBackgroundExample/app.json +4 -0
- package/example/RNBackgroundExample/babel.config.js +3 -0
- package/example/RNBackgroundExample/e2e/config.json +8 -0
- package/example/RNBackgroundExample/e2e/detox.pathbuilder.android.js +4 -0
- package/example/RNBackgroundExample/e2e/detox.pathbuilder.ios.js +4 -0
- package/example/RNBackgroundExample/e2e/detox.pathbuilder.js +21 -0
- package/example/RNBackgroundExample/e2e/environment.js +23 -0
- package/example/RNBackgroundExample/e2e/firstTest.spec.js +56 -0
- package/example/RNBackgroundExample/e2e/server.js +69 -0
- package/example/RNBackgroundExample/e2e/start-server.js +2 -0
- package/example/RNBackgroundExample/index.js +9 -0
- package/example/RNBackgroundExample/ios/App.swift +9 -0
- package/example/RNBackgroundExample/ios/Podfile +24 -0
- package/example/RNBackgroundExample/ios/Podfile.lock +387 -0
- package/example/RNBackgroundExample/ios/RNBackgroundExample/AppDelegate.h +15 -0
- package/example/RNBackgroundExample/ios/RNBackgroundExample/AppDelegate.m +42 -0
- package/example/RNBackgroundExample/ios/RNBackgroundExample/Images.xcassets/AppIcon.appiconset/Contents.json +38 -0
- package/example/RNBackgroundExample/ios/RNBackgroundExample/Images.xcassets/Contents.json +6 -0
- package/example/RNBackgroundExample/ios/RNBackgroundExample/Info.plist +65 -0
- package/example/RNBackgroundExample/ios/RNBackgroundExample/LaunchScreen.storyboard +58 -0
- package/example/RNBackgroundExample/ios/RNBackgroundExample/main.m +16 -0
- package/example/RNBackgroundExample/ios/RNBackgroundExample-Bridging-Header.h +4 -0
- package/example/RNBackgroundExample/ios/RNBackgroundExample-tvOS/Info.plist +53 -0
- package/example/RNBackgroundExample/ios/RNBackgroundExample-tvOSTests/Info.plist +24 -0
- package/example/RNBackgroundExample/ios/RNBackgroundExample.xcodeproj/project.pbxproj +991 -0
- package/example/RNBackgroundExample/ios/RNBackgroundExample.xcodeproj/xcshareddata/xcschemes/RNBackgroundExample-tvOS.xcscheme +88 -0
- package/example/RNBackgroundExample/ios/RNBackgroundExample.xcodeproj/xcshareddata/xcschemes/RNBackgroundExample.xcscheme +88 -0
- package/example/RNBackgroundExample/ios/RNBackgroundExample.xcworkspace/contents.xcworkspacedata +10 -0
- package/example/RNBackgroundExample/ios/RNBackgroundExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/example/RNBackgroundExample/ios/RNBackgroundExampleTests/Info.plist +24 -0
- package/example/RNBackgroundExample/ios/RNBackgroundExampleTests/RNBackgroundExampleTests.m +72 -0
- package/example/RNBackgroundExample/metro.config.js +22 -0
- package/example/RNBackgroundExample/package.json +71 -0
- package/example/RNBackgroundExample/scripts/deploy-android.sh +14 -0
- package/example/RNBackgroundExample/scripts/deploy-ios.sh +11 -0
- package/example/RNBackgroundExample/scripts/postinstall.sh +13 -0
- package/example/RNBackgroundExample/wait-for-emulator.sh +39 -0
- package/example/RNBackgroundExample/yarn.lock +8165 -0
- package/index.d.ts +154 -0
- package/ios/VydiaRNFileUploader.h +10 -0
- package/ios/VydiaRNFileUploader.m +457 -0
- package/ios/VydiaRNFileUploader.xcodeproj/project.pbxproj +254 -0
- package/package.json +37 -0
- package/react-native-upload.podspec +23 -0
- package/src/index.js +151 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
// !$*UTF8*$!
|
|
2
|
+
{
|
|
3
|
+
archiveVersion = 1;
|
|
4
|
+
classes = {
|
|
5
|
+
};
|
|
6
|
+
objectVersion = 46;
|
|
7
|
+
objects = {
|
|
8
|
+
|
|
9
|
+
/* Begin PBXBuildFile section */
|
|
10
|
+
DCC748851E044F8700EA453E /* VydiaRNFileUploader.m in Sources */ = {isa = PBXBuildFile; fileRef = DCC748841E044F8700EA453E /* VydiaRNFileUploader.m */; };
|
|
11
|
+
/* End PBXBuildFile section */
|
|
12
|
+
|
|
13
|
+
/* Begin PBXCopyFilesBuildPhase section */
|
|
14
|
+
014A3B5A1C6CF33500B6D375 /* CopyFiles */ = {
|
|
15
|
+
isa = PBXCopyFilesBuildPhase;
|
|
16
|
+
buildActionMask = 2147483647;
|
|
17
|
+
dstPath = "include/$(PRODUCT_NAME)";
|
|
18
|
+
dstSubfolderSpec = 16;
|
|
19
|
+
files = (
|
|
20
|
+
);
|
|
21
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
22
|
+
};
|
|
23
|
+
/* End PBXCopyFilesBuildPhase section */
|
|
24
|
+
|
|
25
|
+
/* Begin PBXFileReference section */
|
|
26
|
+
014A3B5C1C6CF33500B6D375 /* libVydiaRNFileUploader.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libVydiaRNFileUploader.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
27
|
+
DCC748841E044F8700EA453E /* VydiaRNFileUploader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VydiaRNFileUploader.m; sourceTree = "<group>"; };
|
|
28
|
+
/* End PBXFileReference section */
|
|
29
|
+
|
|
30
|
+
/* Begin PBXFrameworksBuildPhase section */
|
|
31
|
+
014A3B591C6CF33500B6D375 /* Frameworks */ = {
|
|
32
|
+
isa = PBXFrameworksBuildPhase;
|
|
33
|
+
buildActionMask = 2147483647;
|
|
34
|
+
files = (
|
|
35
|
+
);
|
|
36
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
37
|
+
};
|
|
38
|
+
/* End PBXFrameworksBuildPhase section */
|
|
39
|
+
|
|
40
|
+
/* Begin PBXGroup section */
|
|
41
|
+
014A3B531C6CF33500B6D375 = {
|
|
42
|
+
isa = PBXGroup;
|
|
43
|
+
children = (
|
|
44
|
+
DCC748841E044F8700EA453E /* VydiaRNFileUploader.m */,
|
|
45
|
+
014A3B5D1C6CF33500B6D375 /* Products */,
|
|
46
|
+
);
|
|
47
|
+
sourceTree = "<group>";
|
|
48
|
+
};
|
|
49
|
+
014A3B5D1C6CF33500B6D375 /* Products */ = {
|
|
50
|
+
isa = PBXGroup;
|
|
51
|
+
children = (
|
|
52
|
+
014A3B5C1C6CF33500B6D375 /* libVydiaRNFileUploader.a */,
|
|
53
|
+
);
|
|
54
|
+
name = Products;
|
|
55
|
+
sourceTree = "<group>";
|
|
56
|
+
};
|
|
57
|
+
/* End PBXGroup section */
|
|
58
|
+
|
|
59
|
+
/* Begin PBXNativeTarget section */
|
|
60
|
+
014A3B5B1C6CF33500B6D375 /* VydiaRNFileUploader */ = {
|
|
61
|
+
isa = PBXNativeTarget;
|
|
62
|
+
buildConfigurationList = 014A3B651C6CF33500B6D375 /* Build configuration list for PBXNativeTarget "VydiaRNFileUploader" */;
|
|
63
|
+
buildPhases = (
|
|
64
|
+
014A3B581C6CF33500B6D375 /* Sources */,
|
|
65
|
+
014A3B591C6CF33500B6D375 /* Frameworks */,
|
|
66
|
+
014A3B5A1C6CF33500B6D375 /* CopyFiles */,
|
|
67
|
+
);
|
|
68
|
+
buildRules = (
|
|
69
|
+
);
|
|
70
|
+
dependencies = (
|
|
71
|
+
);
|
|
72
|
+
name = VydiaRNFileUploader;
|
|
73
|
+
productName = VydiaRNFileUploader;
|
|
74
|
+
productReference = 014A3B5C1C6CF33500B6D375 /* libVydiaRNFileUploader.a */;
|
|
75
|
+
productType = "com.apple.product-type.library.static";
|
|
76
|
+
};
|
|
77
|
+
/* End PBXNativeTarget section */
|
|
78
|
+
|
|
79
|
+
/* Begin PBXProject section */
|
|
80
|
+
014A3B541C6CF33500B6D375 /* Project object */ = {
|
|
81
|
+
isa = PBXProject;
|
|
82
|
+
attributes = {
|
|
83
|
+
LastUpgradeCheck = 0720;
|
|
84
|
+
ORGANIZATIONNAME = "Marc Shilling";
|
|
85
|
+
TargetAttributes = {
|
|
86
|
+
014A3B5B1C6CF33500B6D375 = {
|
|
87
|
+
CreatedOnToolsVersion = 7.2.1;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
buildConfigurationList = 014A3B571C6CF33500B6D375 /* Build configuration list for PBXProject "VydiaRNFileUploader" */;
|
|
92
|
+
compatibilityVersion = "Xcode 3.2";
|
|
93
|
+
developmentRegion = English;
|
|
94
|
+
hasScannedForEncodings = 0;
|
|
95
|
+
knownRegions = (
|
|
96
|
+
en,
|
|
97
|
+
);
|
|
98
|
+
mainGroup = 014A3B531C6CF33500B6D375;
|
|
99
|
+
productRefGroup = 014A3B5D1C6CF33500B6D375 /* Products */;
|
|
100
|
+
projectDirPath = "";
|
|
101
|
+
projectRoot = "";
|
|
102
|
+
targets = (
|
|
103
|
+
014A3B5B1C6CF33500B6D375 /* VydiaRNFileUploader */,
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
/* End PBXProject section */
|
|
107
|
+
|
|
108
|
+
/* Begin PBXSourcesBuildPhase section */
|
|
109
|
+
014A3B581C6CF33500B6D375 /* Sources */ = {
|
|
110
|
+
isa = PBXSourcesBuildPhase;
|
|
111
|
+
buildActionMask = 2147483647;
|
|
112
|
+
files = (
|
|
113
|
+
DCC748851E044F8700EA453E /* VydiaRNFileUploader.m in Sources */,
|
|
114
|
+
);
|
|
115
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
116
|
+
};
|
|
117
|
+
/* End PBXSourcesBuildPhase section */
|
|
118
|
+
|
|
119
|
+
/* Begin XCBuildConfiguration section */
|
|
120
|
+
014A3B631C6CF33500B6D375 /* Debug */ = {
|
|
121
|
+
isa = XCBuildConfiguration;
|
|
122
|
+
buildSettings = {
|
|
123
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
124
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
125
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
126
|
+
CLANG_ENABLE_MODULES = YES;
|
|
127
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
128
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
129
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
130
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
131
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
132
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
133
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
134
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
135
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
136
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
137
|
+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
|
138
|
+
COPY_PHASE_STRIP = NO;
|
|
139
|
+
DEBUG_INFORMATION_FORMAT = dwarf;
|
|
140
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
141
|
+
ENABLE_TESTABILITY = YES;
|
|
142
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
143
|
+
GCC_DYNAMIC_NO_PIC = NO;
|
|
144
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
145
|
+
GCC_OPTIMIZATION_LEVEL = 0;
|
|
146
|
+
GCC_PREPROCESSOR_DEFINITIONS = (
|
|
147
|
+
"DEBUG=1",
|
|
148
|
+
"$(inherited)",
|
|
149
|
+
);
|
|
150
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
151
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
152
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
153
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
154
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
155
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
156
|
+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
157
|
+
MTL_ENABLE_DEBUG_INFO = YES;
|
|
158
|
+
ONLY_ACTIVE_ARCH = YES;
|
|
159
|
+
SDKROOT = iphoneos;
|
|
160
|
+
};
|
|
161
|
+
name = Debug;
|
|
162
|
+
};
|
|
163
|
+
014A3B641C6CF33500B6D375 /* Release */ = {
|
|
164
|
+
isa = XCBuildConfiguration;
|
|
165
|
+
buildSettings = {
|
|
166
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
167
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
168
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
169
|
+
CLANG_ENABLE_MODULES = YES;
|
|
170
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
171
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
172
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
173
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
174
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
175
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
176
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
177
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
178
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
179
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
180
|
+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
|
181
|
+
COPY_PHASE_STRIP = NO;
|
|
182
|
+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
|
183
|
+
ENABLE_NS_ASSERTIONS = NO;
|
|
184
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
185
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
186
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
187
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
188
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
189
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
190
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
191
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
192
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
193
|
+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
194
|
+
MTL_ENABLE_DEBUG_INFO = NO;
|
|
195
|
+
SDKROOT = iphoneos;
|
|
196
|
+
VALIDATE_PRODUCT = YES;
|
|
197
|
+
};
|
|
198
|
+
name = Release;
|
|
199
|
+
};
|
|
200
|
+
014A3B661C6CF33500B6D375 /* Debug */ = {
|
|
201
|
+
isa = XCBuildConfiguration;
|
|
202
|
+
buildSettings = {
|
|
203
|
+
HEADER_SEARCH_PATHS = (
|
|
204
|
+
"$(SRCROOT)/../node_modules/react-native/React/**",
|
|
205
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
206
|
+
"$(SRCROOT)/../Example/node_modules/react-native/React/**",
|
|
207
|
+
"$(SRCROOT)/../../../ios/Pods/Headers/Public/**",
|
|
208
|
+
);
|
|
209
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
210
|
+
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
211
|
+
SKIP_INSTALL = YES;
|
|
212
|
+
};
|
|
213
|
+
name = Debug;
|
|
214
|
+
};
|
|
215
|
+
014A3B671C6CF33500B6D375 /* Release */ = {
|
|
216
|
+
isa = XCBuildConfiguration;
|
|
217
|
+
buildSettings = {
|
|
218
|
+
HEADER_SEARCH_PATHS = (
|
|
219
|
+
"$(SRCROOT)/../node_modules/react-native/React/**",
|
|
220
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
221
|
+
"$(SRCROOT)/../Example/node_modules/react-native/React/**",
|
|
222
|
+
"$(SRCROOT)/../../../ios/Pods/Headers/Public/**",
|
|
223
|
+
);
|
|
224
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
225
|
+
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
226
|
+
SKIP_INSTALL = YES;
|
|
227
|
+
};
|
|
228
|
+
name = Release;
|
|
229
|
+
};
|
|
230
|
+
/* End XCBuildConfiguration section */
|
|
231
|
+
|
|
232
|
+
/* Begin XCConfigurationList section */
|
|
233
|
+
014A3B571C6CF33500B6D375 /* Build configuration list for PBXProject "VydiaRNFileUploader" */ = {
|
|
234
|
+
isa = XCConfigurationList;
|
|
235
|
+
buildConfigurations = (
|
|
236
|
+
014A3B631C6CF33500B6D375 /* Debug */,
|
|
237
|
+
014A3B641C6CF33500B6D375 /* Release */,
|
|
238
|
+
);
|
|
239
|
+
defaultConfigurationIsVisible = 0;
|
|
240
|
+
defaultConfigurationName = Release;
|
|
241
|
+
};
|
|
242
|
+
014A3B651C6CF33500B6D375 /* Build configuration list for PBXNativeTarget "VydiaRNFileUploader" */ = {
|
|
243
|
+
isa = XCConfigurationList;
|
|
244
|
+
buildConfigurations = (
|
|
245
|
+
014A3B661C6CF33500B6D375 /* Debug */,
|
|
246
|
+
014A3B671C6CF33500B6D375 /* Release */,
|
|
247
|
+
);
|
|
248
|
+
defaultConfigurationIsVisible = 0;
|
|
249
|
+
defaultConfigurationName = Release;
|
|
250
|
+
};
|
|
251
|
+
/* End XCConfigurationList section */
|
|
252
|
+
};
|
|
253
|
+
rootObject = 014A3B541C6CF33500B6D375 /* Project object */;
|
|
254
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@woshapp/react-native-background-upload",
|
|
3
|
+
"version": "6.16.0",
|
|
4
|
+
"description": "Cross platform http post file uploader with Android and iOS background support.",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"NSURLSession",
|
|
11
|
+
"UploadService",
|
|
12
|
+
"background",
|
|
13
|
+
"upload",
|
|
14
|
+
"react-native",
|
|
15
|
+
"react"
|
|
16
|
+
],
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"react": "*",
|
|
19
|
+
"react-native": ">=0.47.0"
|
|
20
|
+
},
|
|
21
|
+
"author": "Zivi",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://bitbucket.org/woshapp-tech/react-native-background-upload/issues"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://bitbucket.org/woshapp-tech/react-native-background-upload",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://bitbucket.org/woshapp-tech/react-native-background-upload.git"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/react-native": "^0.64.0"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package_json = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "RNBackgroundUpload"
|
|
7
|
+
s.version = package_json["version"]
|
|
8
|
+
s.summary = package_json["description"]
|
|
9
|
+
s.homepage = "https://bitbucket.org/woshapp-tech/react-native-background-upload"
|
|
10
|
+
s.license = { :type => "MIT", :file => "LICENSE" }
|
|
11
|
+
|
|
12
|
+
s.authors = package_json["author"] || "Zivi"
|
|
13
|
+
|
|
14
|
+
s.source = {
|
|
15
|
+
:git => "https://bitbucket.org/woshapp-tech/react-native-background-upload.git",
|
|
16
|
+
:tag => s.version.to_s
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
s.platform = :ios, "9.0"
|
|
20
|
+
s.source_files = "ios/*.{h,m,mm}"
|
|
21
|
+
|
|
22
|
+
s.dependency "React-Core"
|
|
23
|
+
end
|
package/src/index.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
/**
|
|
3
|
+
* Handles HTTP background file uploads from an iOS or Android device.
|
|
4
|
+
*/
|
|
5
|
+
import { NativeModules, DeviceEventEmitter, Platform } from 'react-native';
|
|
6
|
+
|
|
7
|
+
export type UploadEvent = 'progress' | 'error' | 'completed' | 'cancelled';
|
|
8
|
+
|
|
9
|
+
export type NotificationArgs = {
|
|
10
|
+
enabled: boolean,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type StartUploadArgs = {
|
|
14
|
+
url: string,
|
|
15
|
+
path: string,
|
|
16
|
+
method?: 'PUT' | 'POST',
|
|
17
|
+
// Optional, because raw is default
|
|
18
|
+
type?: 'raw' | 'multipart',
|
|
19
|
+
// This option is needed for multipart type
|
|
20
|
+
field?: string,
|
|
21
|
+
customUploadId?: string,
|
|
22
|
+
// parameters are supported only in multipart type
|
|
23
|
+
parameters?: { [string]: string },
|
|
24
|
+
headers?: Object,
|
|
25
|
+
notification?: NotificationArgs,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const NativeModule =
|
|
29
|
+
NativeModules.VydiaRNFileUploader || NativeModules.RNFileUploader; // iOS is VydiaRNFileUploader and Android is NativeModules
|
|
30
|
+
const eventPrefix = 'RNFileUploader-';
|
|
31
|
+
|
|
32
|
+
// for IOS, register event listeners or else they don't fire on DeviceEventEmitter
|
|
33
|
+
if (NativeModules.VydiaRNFileUploader) {
|
|
34
|
+
NativeModule.addListener(eventPrefix + 'progress');
|
|
35
|
+
NativeModule.addListener(eventPrefix + 'error');
|
|
36
|
+
NativeModule.addListener(eventPrefix + 'cancelled');
|
|
37
|
+
NativeModule.addListener(eventPrefix + 'completed');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/*
|
|
41
|
+
Gets file information for the path specified.
|
|
42
|
+
Example valid path is:
|
|
43
|
+
Android: '/storage/extSdCard/DCIM/Camera/20161116_074726.mp4'
|
|
44
|
+
iOS: 'file:///var/mobile/Containers/Data/Application/3C8A0EFB-A316-45C0-A30A-761BF8CCF2F8/tmp/trim.A5F76017-14E9-4890-907E-36A045AF9436.MOV;
|
|
45
|
+
|
|
46
|
+
Returns an object:
|
|
47
|
+
If the file exists: {extension: "mp4", size: "3804316", exists: true, mimeType: "video/mp4", name: "20161116_074726.mp4"}
|
|
48
|
+
If the file doesn't exist: {exists: false} and might possibly include name or extension
|
|
49
|
+
|
|
50
|
+
The promise should never be rejected.
|
|
51
|
+
*/
|
|
52
|
+
export const getFileInfo = (path: string): Promise<Object> => {
|
|
53
|
+
return NativeModule.getFileInfo(path).then(data => {
|
|
54
|
+
if (data.size) {
|
|
55
|
+
// size comes back as a string on android so we convert it here. if it's already a number this won't hurt anything
|
|
56
|
+
data.size = +data.size;
|
|
57
|
+
}
|
|
58
|
+
return data;
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
Starts uploading a file to an HTTP endpoint.
|
|
64
|
+
Options object:
|
|
65
|
+
{
|
|
66
|
+
url: string. url to post to.
|
|
67
|
+
path: string. path to the file on the device
|
|
68
|
+
headers: hash of name/value header pairs
|
|
69
|
+
method: HTTP method to use. Default is "POST"
|
|
70
|
+
notification: hash for customizing tray notifiaction
|
|
71
|
+
enabled: boolean to enable/disabled notifications, true by default.
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
Returns a promise with the string ID of the upload. Will reject if there is a connection problem, the file doesn't exist, or there is some other problem.
|
|
75
|
+
|
|
76
|
+
It is recommended to add listeners in the .then of this promise.
|
|
77
|
+
|
|
78
|
+
*/
|
|
79
|
+
export const startUpload = (options: StartUploadArgs): Promise<string> =>
|
|
80
|
+
NativeModule.startUpload(options);
|
|
81
|
+
|
|
82
|
+
/*
|
|
83
|
+
Cancels active upload by string ID of the upload.
|
|
84
|
+
|
|
85
|
+
Upload ID is returned in a promise after a call to startUpload method,
|
|
86
|
+
use it to cancel started upload.
|
|
87
|
+
|
|
88
|
+
Event "cancelled" will be fired when upload is cancelled.
|
|
89
|
+
|
|
90
|
+
Returns a promise with boolean true if operation was successfully completed.
|
|
91
|
+
Will reject if there was an internal error or ID format is invalid.
|
|
92
|
+
|
|
93
|
+
*/
|
|
94
|
+
export const cancelUpload = (cancelUploadId: string): Promise<boolean> => {
|
|
95
|
+
if (typeof cancelUploadId !== 'string') {
|
|
96
|
+
return Promise.reject(new Error('Upload ID must be a string'));
|
|
97
|
+
}
|
|
98
|
+
return NativeModule.cancelUpload(cancelUploadId);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/*
|
|
102
|
+
Listens for the given event on the given upload ID (resolved from startUpload).
|
|
103
|
+
If you don't supply a value for uploadId, the event will fire for all uploads.
|
|
104
|
+
Events (id is always the upload ID):
|
|
105
|
+
progress - { id: string, progress: int (0-100) }
|
|
106
|
+
error - { id: string, error: string }
|
|
107
|
+
cancelled - { id: string, error: string }
|
|
108
|
+
completed - { id: string }
|
|
109
|
+
*/
|
|
110
|
+
export const addListener = (
|
|
111
|
+
eventType: UploadEvent,
|
|
112
|
+
uploadId: string,
|
|
113
|
+
listener: Function,
|
|
114
|
+
) => {
|
|
115
|
+
return DeviceEventEmitter.addListener(eventPrefix + eventType, data => {
|
|
116
|
+
if (!uploadId || !data || !data.id || data.id === uploadId) {
|
|
117
|
+
listener(data);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const canSuspendIfBackground = () => {
|
|
123
|
+
if (Platform.OS === 'ios') {
|
|
124
|
+
NativeModule.canSuspendIfBackground();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export const shouldLimitNetwork = (limit: boolean) => {
|
|
129
|
+
NativeModule.shouldLimitNetwork(limit);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export const UploadState = {
|
|
133
|
+
Cancelled: 'cancelled',
|
|
134
|
+
Completed: 'completed',
|
|
135
|
+
Pending: 'pending',
|
|
136
|
+
Running: 'running',
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export const getAllUploads = () => {
|
|
140
|
+
return NativeModule.getAllUploads();
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export default {
|
|
144
|
+
startUpload,
|
|
145
|
+
cancelUpload,
|
|
146
|
+
addListener,
|
|
147
|
+
getFileInfo,
|
|
148
|
+
canSuspendIfBackground,
|
|
149
|
+
shouldLimitNetwork,
|
|
150
|
+
getAllUploads,
|
|
151
|
+
};
|