react-native-blob-util 0.21.3 → 0.22.1
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/NuGet.config +11 -0
- package/package.json +65 -52
- package/windows/ExperimentalFeatures.props +33 -0
- package/windows/ReactNativeBlobUtil/ReactNativeBlobUtil.cpp +1426 -1290
- package/windows/ReactNativeBlobUtil/ReactNativeBlobUtil.h +200 -206
- package/windows/ReactNativeBlobUtil/ReactNativeBlobUtil.rc +0 -0
- package/windows/ReactNativeBlobUtil/ReactNativeBlobUtil.vcxproj +41 -82
- package/windows/ReactNativeBlobUtil/ReactNativeBlobUtil.vcxproj.filters +32 -20
- package/windows/ReactNativeBlobUtil/ReactPackageProvider.cpp +8 -3
- package/windows/ReactNativeBlobUtil/ReactPackageProvider.h +7 -3
- package/windows/ReactNativeBlobUtil/ReactPackageProvider.idl +7 -7
- package/windows/ReactNativeBlobUtil/codegen/.clang-format +2 -0
- package/windows/ReactNativeBlobUtil/codegen/NativeBlobUtilsDataTypes.g.h +42 -0
- package/windows/ReactNativeBlobUtil/codegen/NativeBlobUtilsSpec.g.h +353 -0
- package/windows/ReactNativeBlobUtil/packages.lock.json +60 -0
- package/windows/ReactNativeBlobUtil/pch.cpp +1 -1
- package/windows/ReactNativeBlobUtil/pch.h +30 -4
- package/windows/ReactNativeBlobUtil/resource.h +5 -0
- package/windows/ReactNativeBlobUtil/targetver.h +8 -0
- package/windows/ReactNativeBlobUtil.sln +43 -0
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "pch.h"
|
|
4
|
+
#include "resource.h"
|
|
5
|
+
|
|
6
|
+
#if __has_include("codegen/NativeBlobUtilsDataTypes.g.h")
|
|
7
|
+
#include "codegen/NativeBlobUtilsDataTypes.g.h"
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
#include "codegen/NativeBlobUtilsSpec.g.h"
|
|
2
11
|
#include "NativeModules.h"
|
|
3
12
|
#include <winrt/Windows.Foundation.h>
|
|
4
13
|
#include <winrt/Windows.Security.Cryptography.h>
|
|
@@ -88,7 +97,7 @@ public:
|
|
|
88
97
|
struct ReactNativeBlobUtilConfig
|
|
89
98
|
{
|
|
90
99
|
public:
|
|
91
|
-
ReactNativeBlobUtilConfig(
|
|
100
|
+
ReactNativeBlobUtilConfig(::React::JSValue& options);
|
|
92
101
|
|
|
93
102
|
bool overwrite;
|
|
94
103
|
std::chrono::seconds timeout;
|
|
@@ -104,276 +113,261 @@ public:
|
|
|
104
113
|
struct ReactNativeBlobUtilProgressConfig {
|
|
105
114
|
public:
|
|
106
115
|
ReactNativeBlobUtilProgressConfig() = default;
|
|
107
|
-
ReactNativeBlobUtilProgressConfig(
|
|
116
|
+
ReactNativeBlobUtilProgressConfig(double count_, double interval_);
|
|
108
117
|
|
|
109
|
-
|
|
110
|
-
|
|
118
|
+
double count{ -1.0 };
|
|
119
|
+
double interval{ -1.0 };
|
|
111
120
|
};
|
|
112
121
|
|
|
122
|
+
namespace winrt::ReactNativeBlobUtil
|
|
123
|
+
{
|
|
113
124
|
|
|
114
|
-
REACT_MODULE(ReactNativeBlobUtil
|
|
115
|
-
struct ReactNativeBlobUtil
|
|
125
|
+
REACT_MODULE(ReactNativeBlobUtil)
|
|
126
|
+
struct ReactNativeBlobUtil
|
|
116
127
|
{
|
|
117
|
-
|
|
118
|
-
|
|
128
|
+
using ModuleSpec = ReactNativeBlobUtilCodegen::BlobUtilsSpec;
|
|
129
|
+
using StreamId = std::string;
|
|
119
130
|
|
|
120
|
-
|
|
121
|
-
|
|
131
|
+
REACT_INIT(Initialize)
|
|
132
|
+
void Initialize(React::ReactContext const& reactContext) noexcept;
|
|
122
133
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
winrt::Microsoft::ReactNative::ReactConstantProvider& constants) noexcept;
|
|
134
|
+
REACT_GET_CONSTANTS(GetConstants)
|
|
135
|
+
ReactNativeBlobUtilCodegen::BlobUtilsSpec_Constants GetConstants() noexcept;
|
|
126
136
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
std::string encoding,
|
|
133
|
-
winrt::Microsoft::ReactNative::ReactPromise<std::string> promise) noexcept;
|
|
137
|
+
REACT_METHOD(fetchBlobForm)
|
|
138
|
+
winrt::fire_and_forget fetchBlobForm(::React::JSValue options, std::string taskId, std::string method, std::string url, ::React::JSValue headers, ::React::JSValueArray form, std::function<void(::React::JSValueArray)> callback) noexcept;
|
|
139
|
+
|
|
140
|
+
REACT_METHOD(fetchBlob)
|
|
141
|
+
winrt::fire_and_forget fetchBlob(::React::JSValue options, std::string taskId, std::string method, std::string url, ::React::JSValue headers, std::string body, std::function<void(::React::JSValueArray)> callback) noexcept;
|
|
134
142
|
|
|
135
|
-
|
|
143
|
+
REACT_METHOD(createFile)
|
|
144
|
+
winrt::fire_and_forget createFile(
|
|
145
|
+
std::string path,
|
|
146
|
+
std::wstring content,
|
|
147
|
+
std::string encoding,
|
|
148
|
+
winrt::Microsoft::ReactNative::ReactPromise<void> promise
|
|
149
|
+
) noexcept;
|
|
150
|
+
|
|
151
|
+
REACT_METHOD(createFileASCII)
|
|
136
152
|
winrt::fire_and_forget createFileASCII(
|
|
137
153
|
std::string path,
|
|
138
154
|
winrt::Microsoft::ReactNative::JSValueArray dataArray,
|
|
139
|
-
winrt::Microsoft::ReactNative::ReactPromise<
|
|
140
|
-
|
|
155
|
+
winrt::Microsoft::ReactNative::ReactPromise<void> promise) noexcept;
|
|
141
156
|
|
|
142
|
-
|
|
143
|
-
REACT_METHOD(writeFile);
|
|
157
|
+
REACT_METHOD(writeFile)
|
|
144
158
|
winrt::fire_and_forget writeFile(
|
|
145
159
|
std::string path,
|
|
146
160
|
std::string encoding,
|
|
147
161
|
std::wstring data,
|
|
162
|
+
bool transformFile,
|
|
148
163
|
bool append,
|
|
149
|
-
winrt::Microsoft::ReactNative::ReactPromise<
|
|
164
|
+
winrt::Microsoft::ReactNative::ReactPromise<double> promise) noexcept;
|
|
150
165
|
|
|
151
|
-
REACT_METHOD(writeFileArray)
|
|
166
|
+
REACT_METHOD(writeFileArray)
|
|
152
167
|
winrt::fire_and_forget writeFileArray(
|
|
153
168
|
std::string path,
|
|
154
169
|
winrt::Microsoft::ReactNative::JSValueArray dataArray,
|
|
155
170
|
bool append,
|
|
156
|
-
winrt::Microsoft::ReactNative::ReactPromise<
|
|
171
|
+
winrt::Microsoft::ReactNative::ReactPromise<double> promise) noexcept;
|
|
157
172
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
winrt::fire_and_forget ReactNativeBlobUtil::writeStream(
|
|
161
|
-
std::string path,
|
|
162
|
-
std::string encoding,
|
|
163
|
-
bool append,
|
|
164
|
-
std::function<void(std::string, std::string, std::string)> callback) noexcept;
|
|
173
|
+
REACT_METHOD(pathForAppGroup)
|
|
174
|
+
void pathForAppGroup(std::string groupName, ::React::ReactPromise<std::string>&& result) noexcept;
|
|
165
175
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
void ReactNativeBlobUtil::writeChunk(
|
|
169
|
-
std::string streamId,
|
|
170
|
-
std::wstring data,
|
|
171
|
-
std::function<void(std::string)> callback) noexcept;
|
|
176
|
+
REACT_SYNC_METHOD(syncPathAppGroup)
|
|
177
|
+
std::string syncPathAppGroup(std::string groupName) noexcept;
|
|
172
178
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
std::string streamId,
|
|
176
|
-
winrt::Microsoft::ReactNative::JSValueArray dataArray,
|
|
177
|
-
std::function<void(std::string)> callback) noexcept;
|
|
179
|
+
REACT_METHOD(exists)
|
|
180
|
+
void exists(std::string path, std::function<void(std::vector<bool> const&)> const& callback) noexcept;
|
|
178
181
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
void ReactNativeBlobUtil::readStream(
|
|
182
|
-
std::string path,
|
|
183
|
-
std::string encoding,
|
|
184
|
-
uint32_t bufferSize,
|
|
185
|
-
uint64_t tick,
|
|
186
|
-
const std::string streamId) noexcept;
|
|
182
|
+
REACT_METHOD(writeStream)
|
|
183
|
+
winrt::fire_and_forget writeStream(std::string path, std::string encoding, bool appendData, std::function<void(::React::JSValueArray)> callback) noexcept;
|
|
187
184
|
|
|
185
|
+
REACT_METHOD(writeArrayChunk)
|
|
186
|
+
void writeArrayChunk(std::string streamId, ::React::JSValueArray&& dataArray, std::function<void(::React::JSValueArray const&)> const& callback) noexcept;
|
|
188
187
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
188
|
+
REACT_METHOD(writeChunk)
|
|
189
|
+
void writeChunk(std::string streamId, std::string data, std::function<void(::React::JSValueArray const&)> const& callback) noexcept;
|
|
190
|
+
|
|
191
|
+
REACT_METHOD(closeStream)
|
|
192
|
+
void closeStream(std::string streamId, std::function<void(::React::JSValueArray const&)> const& callback) noexcept;
|
|
193
|
+
|
|
194
|
+
REACT_METHOD(unlink)
|
|
195
|
+
winrt::fire_and_forget unlink(std::string path, std::function<void(::React::JSValueArray)> callback) noexcept;
|
|
194
196
|
|
|
197
|
+
REACT_METHOD(removeSession)
|
|
198
|
+
winrt::fire_and_forget removeSession(::React::JSValueArray paths, std::function<void(::React::JSValueArray)> callback) noexcept;
|
|
195
199
|
|
|
196
|
-
|
|
197
|
-
REACT_METHOD(readFile)
|
|
200
|
+
// readFile
|
|
201
|
+
REACT_METHOD(readFile)
|
|
198
202
|
winrt::fire_and_forget readFile(
|
|
199
203
|
std::string path,
|
|
200
204
|
std::string encoding,
|
|
201
|
-
|
|
202
|
-
|
|
205
|
+
bool transformFile,
|
|
206
|
+
::React::ReactPromise<::React::JSValueArray> promise) noexcept;
|
|
203
207
|
|
|
204
208
|
// hash
|
|
205
|
-
REACT_METHOD(hash)
|
|
209
|
+
REACT_METHOD(hash)
|
|
206
210
|
winrt::fire_and_forget hash(
|
|
207
211
|
std::string path,
|
|
208
212
|
std::string algorithm,
|
|
209
|
-
|
|
213
|
+
::React::ReactPromise<std::string> promise) noexcept;
|
|
210
214
|
|
|
211
215
|
// ls
|
|
212
|
-
REACT_METHOD(ls)
|
|
216
|
+
REACT_METHOD(ls)
|
|
213
217
|
winrt::fire_and_forget ls(
|
|
214
218
|
std::string path,
|
|
215
|
-
|
|
216
|
-
|
|
219
|
+
::React::ReactPromise<::React::JSValueArray> promise) noexcept;
|
|
217
220
|
|
|
218
221
|
// mv
|
|
219
|
-
REACT_METHOD(mv)
|
|
222
|
+
REACT_METHOD(mv)
|
|
220
223
|
winrt::fire_and_forget mv(
|
|
221
|
-
std::string src,
|
|
222
|
-
std::string dest,
|
|
223
|
-
std::function<void(
|
|
224
|
-
|
|
224
|
+
std::string src,
|
|
225
|
+
std::string dest,
|
|
226
|
+
std::function<void(::React::JSValueArray)> callback) noexcept;
|
|
225
227
|
|
|
226
228
|
// cp
|
|
227
|
-
REACT_METHOD(cp)
|
|
229
|
+
REACT_METHOD(cp)
|
|
228
230
|
winrt::fire_and_forget cp(
|
|
229
231
|
std::string src, // from
|
|
230
232
|
std::string dest, // to
|
|
231
|
-
std::function<void(
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
// exists
|
|
235
|
-
REACT_METHOD(exists);
|
|
236
|
-
void exists(
|
|
237
|
-
std::string path,
|
|
238
|
-
std::function<void(bool, bool)> callback) noexcept;
|
|
239
|
-
|
|
233
|
+
std::function<void(::React::JSValueArray)> callback) noexcept;
|
|
240
234
|
|
|
241
|
-
|
|
242
|
-
REACT_METHOD(
|
|
243
|
-
winrt::fire_and_forget unlink(
|
|
244
|
-
std::string path,
|
|
245
|
-
std::function<void(std::string, bool)> callback) noexcept;
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
// lstat
|
|
249
|
-
REACT_METHOD(lstat);
|
|
235
|
+
// lstat
|
|
236
|
+
REACT_METHOD(lstat)
|
|
250
237
|
winrt::fire_and_forget lstat(
|
|
251
238
|
std::string path,
|
|
252
|
-
std::function<void(
|
|
253
|
-
|
|
239
|
+
std::function<void(::React::JSValueArray)> callback) noexcept;
|
|
254
240
|
|
|
255
241
|
// stat
|
|
256
|
-
REACT_METHOD(stat)
|
|
242
|
+
REACT_METHOD(stat)
|
|
257
243
|
winrt::fire_and_forget stat(
|
|
258
244
|
std::string path,
|
|
259
|
-
std::function<void(
|
|
245
|
+
std::function<void(::React::JSValueArray)> callback) noexcept;
|
|
260
246
|
|
|
261
247
|
// df
|
|
262
|
-
REACT_METHOD(df)
|
|
248
|
+
REACT_METHOD(df)
|
|
263
249
|
winrt::fire_and_forget df(
|
|
264
|
-
std::function<void(
|
|
250
|
+
std::function<void(::React::JSValueArray)> callback) noexcept;
|
|
265
251
|
|
|
266
|
-
REACT_METHOD(slice)
|
|
267
|
-
winrt::fire_and_forget
|
|
252
|
+
REACT_METHOD(slice)
|
|
253
|
+
winrt::fire_and_forget slice(
|
|
268
254
|
std::string src,
|
|
269
255
|
std::string dest,
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
REACT_METHOD(fetchBlob);
|
|
275
|
-
winrt::fire_and_forget fetchBlob(
|
|
276
|
-
winrt::Microsoft::ReactNative::JSValueObject options,
|
|
277
|
-
std::string taskId,
|
|
278
|
-
std::string method,
|
|
279
|
-
std::wstring url,
|
|
280
|
-
winrt::Microsoft::ReactNative::JSValueObject headers,
|
|
281
|
-
std::string body,
|
|
282
|
-
std::function<void(std::string, std::string, std::string)> callback) noexcept;
|
|
283
|
-
|
|
284
|
-
REACT_METHOD(fetchBlobForm);
|
|
285
|
-
winrt::fire_and_forget fetchBlobForm(
|
|
286
|
-
winrt::Microsoft::ReactNative::JSValueObject options,
|
|
287
|
-
std::string taskId,
|
|
288
|
-
std::string method,
|
|
289
|
-
std::wstring url,
|
|
290
|
-
winrt::Microsoft::ReactNative::JSValueObject headers,
|
|
291
|
-
winrt::Microsoft::ReactNative::JSValueArray body,
|
|
292
|
-
std::function<void(std::string, std::string, std::string)> callback) noexcept;
|
|
293
|
-
|
|
294
|
-
REACT_METHOD(enableProgressReport);
|
|
295
|
-
void enableProgressReport(
|
|
296
|
-
std::string taskId,
|
|
297
|
-
int interval,
|
|
298
|
-
int count) noexcept;
|
|
299
|
-
|
|
300
|
-
// enableUploadProgressReport
|
|
301
|
-
REACT_METHOD(enableUploadProgressReport);
|
|
302
|
-
void enableUploadProgressReport(
|
|
303
|
-
std::string taskId,
|
|
304
|
-
int interval,
|
|
305
|
-
int count) noexcept;
|
|
306
|
-
|
|
307
|
-
// cancelRequest
|
|
308
|
-
REACT_METHOD(cancelRequest);
|
|
309
|
-
void cancelRequest(
|
|
310
|
-
std::string taskId,
|
|
311
|
-
std::function<void(std::string, std::string)> callback) noexcept;
|
|
312
|
-
|
|
313
|
-
REACT_METHOD(removeSession);
|
|
314
|
-
winrt::fire_and_forget ReactNativeBlobUtil::removeSession(
|
|
315
|
-
winrt::Microsoft::ReactNative::JSValueArray paths,
|
|
316
|
-
std::function<void(std::string)> callback) noexcept;
|
|
317
|
-
|
|
318
|
-
REACT_METHOD(closeStream);
|
|
319
|
-
void closeStream(
|
|
320
|
-
std::string streamId,
|
|
321
|
-
std::function<void(std::string)> callback) noexcept;
|
|
322
|
-
|
|
323
|
-
// addListener
|
|
324
|
-
REACT_METHOD(addListener);
|
|
325
|
-
void addListener(
|
|
326
|
-
std::string eventName
|
|
327
|
-
) noexcept;
|
|
328
|
-
|
|
329
|
-
// removeListeners
|
|
330
|
-
REACT_METHOD(removeListeners);
|
|
331
|
-
void removeListeners(
|
|
332
|
-
double count
|
|
333
|
-
) noexcept;
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
// Helper methods
|
|
337
|
-
private:
|
|
338
|
-
|
|
256
|
+
double start,
|
|
257
|
+
double end,
|
|
258
|
+
::React::ReactPromise<std::string> promise) noexcept;
|
|
339
259
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
winrt::hstring& fileName) noexcept;
|
|
370
|
-
|
|
371
|
-
const std::string prefix{ "ReactNativeBlobUtil-file://" };
|
|
372
|
-
|
|
373
|
-
std::mutex m_mutex;
|
|
374
|
-
std::map<std::string, ReactNativeBlobUtilProgressConfig> downloadProgressMap;
|
|
375
|
-
std::map<std::string, ReactNativeBlobUtilProgressConfig> uploadProgressMap;
|
|
376
|
-
};
|
|
260
|
+
REACT_METHOD(mkdir)
|
|
261
|
+
void mkdir(std::string path, ::React::ReactPromise<bool>&& result) noexcept;
|
|
262
|
+
|
|
263
|
+
REACT_METHOD(readStream)
|
|
264
|
+
winrt::fire_and_forget readStream(std::string path, std::string encoding, double bufferSize, double tick, std::string streamId) noexcept;
|
|
265
|
+
|
|
266
|
+
REACT_METHOD(getEnvironmentDirs)
|
|
267
|
+
void getEnvironmentDirs(std::function<void(::React::JSValueArray const&)> const& callback) noexcept;
|
|
268
|
+
|
|
269
|
+
REACT_METHOD(cancelRequest)
|
|
270
|
+
void cancelRequest(std::string taskId, std::function<void(::React::JSValueArray const&)> const& callback) noexcept;
|
|
271
|
+
|
|
272
|
+
REACT_METHOD(enableProgressReport)
|
|
273
|
+
void enableProgressReport(std::string taskId, double interval, double count) noexcept;
|
|
274
|
+
|
|
275
|
+
REACT_METHOD(enableUploadProgressReport)
|
|
276
|
+
void enableUploadProgressReport(std::string taskId, double interval, double count) noexcept;
|
|
277
|
+
|
|
278
|
+
REACT_METHOD(presentOptionsMenu)
|
|
279
|
+
void presentOptionsMenu(std::string uri, std::string scheme, ::React::ReactPromise<::React::JSValueArray>&& result) noexcept;
|
|
280
|
+
|
|
281
|
+
REACT_METHOD(presentOpenInMenu)
|
|
282
|
+
void presentOpenInMenu(std::string uri, std::string scheme, ::React::ReactPromise<::React::JSValueArray>&& result) noexcept;
|
|
283
|
+
|
|
284
|
+
REACT_METHOD(presentPreview)
|
|
285
|
+
void presentPreview(std::string uri, std::string scheme, ::React::ReactPromise<::React::JSValueArray>&& result) noexcept;
|
|
286
|
+
|
|
287
|
+
REACT_METHOD(excludeFromBackupKey)
|
|
288
|
+
void excludeFromBackupKey(std::string url, ::React::ReactPromise<::React::JSValueArray>&& result) noexcept;
|
|
377
289
|
|
|
290
|
+
REACT_METHOD(emitExpiredEvent)
|
|
291
|
+
void emitExpiredEvent(std::function<void(std::string)> const& callback) noexcept;
|
|
378
292
|
|
|
293
|
+
REACT_METHOD(actionViewIntent)
|
|
294
|
+
void actionViewIntent(std::string path, std::string mime, std::string chooserTitle, ::React::ReactPromise<void>&& result) noexcept;
|
|
295
|
+
|
|
296
|
+
REACT_METHOD(addCompleteDownload)
|
|
297
|
+
void addCompleteDownload(::React::JSValue&& config, ::React::ReactPromise<void>&& result) noexcept;
|
|
298
|
+
|
|
299
|
+
REACT_METHOD(copyToInternal)
|
|
300
|
+
void copyToInternal(std::string contentUri, std::string destpath, ::React::ReactPromise<std::string>&& result) noexcept;
|
|
301
|
+
|
|
302
|
+
REACT_METHOD(copyToMediaStore)
|
|
303
|
+
void copyToMediaStore(::React::JSValue&& filedata, std::string mt, std::string path, ::React::ReactPromise<std::string>&& result) noexcept;
|
|
304
|
+
|
|
305
|
+
REACT_METHOD(createMediaFile)
|
|
306
|
+
void createMediaFile(::React::JSValue&& filedata, std::string mt, ::React::ReactPromise<std::string>&& result) noexcept;
|
|
307
|
+
|
|
308
|
+
REACT_METHOD(getBlob)
|
|
309
|
+
void getBlob(std::string contentUri, std::string encoding, ::React::ReactPromise<::React::JSValueArray>&& result) noexcept;
|
|
310
|
+
|
|
311
|
+
REACT_METHOD(getContentIntent)
|
|
312
|
+
void getContentIntent(std::string mime, ::React::ReactPromise<std::string>&& result) noexcept;
|
|
313
|
+
|
|
314
|
+
REACT_METHOD(getSDCardDir)
|
|
315
|
+
void getSDCardDir(::React::ReactPromise<std::string>&& result) noexcept;
|
|
316
|
+
|
|
317
|
+
REACT_METHOD(getSDCardApplicationDir)
|
|
318
|
+
void getSDCardApplicationDir(::React::ReactPromise<std::string>&& result) noexcept;
|
|
319
|
+
|
|
320
|
+
REACT_METHOD(scanFile)
|
|
321
|
+
void scanFile(::React::JSValueArray&& pairs, std::function<void(::React::JSValueArray const&)> const& callback) noexcept;
|
|
322
|
+
|
|
323
|
+
REACT_METHOD(writeToMediaFile)
|
|
324
|
+
void writeToMediaFile(std::string fileUri, std::string path, bool transformFile, ::React::ReactPromise<std::string>&& result) noexcept;
|
|
325
|
+
|
|
326
|
+
REACT_METHOD(addListener)
|
|
327
|
+
void addListener(std::string eventName) noexcept;
|
|
328
|
+
|
|
329
|
+
REACT_METHOD(removeListeners)
|
|
330
|
+
void removeListeners(double count) noexcept;
|
|
331
|
+
|
|
332
|
+
private:
|
|
333
|
+
React::ReactContext m_context;
|
|
334
|
+
|
|
335
|
+
constexpr static int64_t UNIX_EPOCH_IN_WINRT_SECONDS = 11644473600;
|
|
336
|
+
|
|
337
|
+
std::map<StreamId, ReactNativeBlobUtilStream> m_streamMap;
|
|
338
|
+
//winrt::Windows::Web::Http::HttpClient m_httpClient;
|
|
339
|
+
winrt::Microsoft::ReactNative::ReactContext m_reactContext;
|
|
340
|
+
TaskCancellationManager m_tasks;
|
|
341
|
+
|
|
342
|
+
winrt::Windows::Foundation::IAsyncAction ProcessRequestAsync(
|
|
343
|
+
const std::string& taskId,
|
|
344
|
+
const winrt::Windows::Web::Http::Filters::HttpBaseProtocolFilter& filter,
|
|
345
|
+
winrt::Windows::Web::Http::HttpRequestMessage& httpRequestMessage,
|
|
346
|
+
ReactNativeBlobUtilConfig& config,
|
|
347
|
+
std::function<void(std::string, std::string, std::string)> callback,
|
|
348
|
+
std::string& error) noexcept;
|
|
349
|
+
|
|
350
|
+
const std::map<std::string, std::function<CryptographyCore::HashAlgorithmProvider()>> availableHashes{
|
|
351
|
+
{"md5", []() { return CryptographyCore::HashAlgorithmProvider::OpenAlgorithm(CryptographyCore::HashAlgorithmNames::Md5()); } },
|
|
352
|
+
{"sha1", []() { return CryptographyCore::HashAlgorithmProvider::OpenAlgorithm(CryptographyCore::HashAlgorithmNames::Sha1()); } },
|
|
353
|
+
{"sha256", []() { return CryptographyCore::HashAlgorithmProvider::OpenAlgorithm(CryptographyCore::HashAlgorithmNames::Sha256()); } },
|
|
354
|
+
{"sha384", []() { return CryptographyCore::HashAlgorithmProvider::OpenAlgorithm(CryptographyCore::HashAlgorithmNames::Sha384()); } },
|
|
355
|
+
{"sha512", []() { return CryptographyCore::HashAlgorithmProvider::OpenAlgorithm(CryptographyCore::HashAlgorithmNames::Sha512()); } }
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
void splitPath(const std::string& fullPath,
|
|
359
|
+
winrt::hstring& directoryPath,
|
|
360
|
+
winrt::hstring& fileName) noexcept;
|
|
361
|
+
|
|
362
|
+
void splitPath(const std::wstring& fullPath,
|
|
363
|
+
winrt::hstring& directoryPath,
|
|
364
|
+
winrt::hstring& fileName) noexcept;
|
|
365
|
+
|
|
366
|
+
const std::string prefix{ "ReactNativeBlobUtil-file://" };
|
|
367
|
+
|
|
368
|
+
std::mutex m_mutex;
|
|
369
|
+
std::map<std::string, ReactNativeBlobUtilProgressConfig> downloadProgressMap;
|
|
370
|
+
std::map<std::string, ReactNativeBlobUtilProgressConfig> uploadProgressMap;
|
|
371
|
+
};
|
|
379
372
|
|
|
373
|
+
} // namespace winrt::ReactNativeBlobUtil
|
|
Binary file
|