3
3
#include " pch.h"
4
4
#include " resource.h"
5
5
6
- #if __has_include("codegen/NativeReactNativeBlobUtilDataTypes .g.h")
7
- #include " codegen/NativeReactNativeBlobUtilDataTypes .g.h"
6
+ #if __has_include("codegen/NativeBlobUtilsDataTypes .g.h")
7
+ #include " codegen/NativeBlobUtilsDataTypes .g.h"
8
8
#endif
9
- #include " codegen/NativeReactNativeBlobUtilSpec.g.h"
10
9
10
+ #include " codegen/NativeBlobUtilsSpec.g.h"
11
11
#include " NativeModules.h"
12
12
13
13
namespace winrt ::ReactNativeBlobUtil
@@ -16,13 +16,157 @@ namespace winrt::ReactNativeBlobUtil
16
16
REACT_MODULE (ReactNativeBlobUtil)
17
17
struct ReactNativeBlobUtil
18
18
{
19
- using ModuleSpec = ReactNativeBlobUtilCodegen::ReactNativeBlobUtilSpec ;
19
+ using ModuleSpec = ReactNativeBlobUtilCodegen::BlobUtilsSpec ;
20
20
21
21
REACT_INIT (Initialize)
22
- void Initialize (React::ReactContext const & reactContext) noexcept ;
22
+ void Initialize (React::ReactContext const & reactContext) noexcept ;
23
23
24
- REACT_SYNC_METHOD (multiply)
25
- double multiply (double a, double b) noexcept ;
24
+ REACT_METHOD (getConstants)
25
+ ReactNativeBlobUtilCodegen::BlobUtilsSpec_Constants* getConstants ();
26
+
27
+ REACT_METHOD (fetchBlobForm)
28
+ void fetchBlobForm (JSValue options, std::string const & taskId, std::string const & method, std::string const & url, JSValue headers, JSValue form, std::function<void (JSValue)> const & callback);
29
+
30
+ REACT_METHOD (fetchBlob)
31
+ void fetchBlob (JSValue options, std::string const & taskId, std::string const & method, std::string const & url, JSValue headers, std::string const & body, std::function<void (JSValue)> const & callback);
32
+
33
+ REACT_METHOD (createFile)
34
+ winrt::Windows::Foundation::IAsyncAction createFile (std::string const & path, std::string const & data, std::string const & encoding);
35
+
36
+ REACT_METHOD (createFileASCII)
37
+ winrt::Windows::Foundation::IAsyncAction createFileASCII (std::string const & path, JSValue data);
38
+
39
+ REACT_METHOD (pathForAppGroup)
40
+ winrt::Windows::Foundation::IAsyncOperation<std::string> pathForAppGroup (std::string const & groupName);
41
+
42
+ REACT_METHOD (syncPathAppGroup)
43
+ std::string syncPathAppGroup (std::string const & groupName);
44
+
45
+ REACT_METHOD (exists)
46
+ void exists (std::string const & path, std::function<void (JSValue)> const & callback);
47
+
48
+ REACT_METHOD (writeFile)
49
+ winrt::Windows::Foundation::IAsyncOperation<int > writeFile (std::string const & path, std::string const & encoding, std::string const & data, bool transformFile, bool append);
50
+
51
+ REACT_METHOD (writeFileArray)
52
+ winrt::Windows::Foundation::IAsyncOperation<int > writeFileArray (std::string const & path, JSValue data, bool append);
53
+
54
+ REACT_METHOD (writeStream)
55
+ void writeStream (std::string const & path, std::string const & withEncoding, bool appendData, std::function<void (JSValue)> const & callback);
56
+
57
+ REACT_METHOD (writeArrayChunk)
58
+ void writeArrayChunk (std::string const & streamId, JSValue withArray, std::function<void (JSValue)> const & callback);
59
+
60
+ REACT_METHOD (writeChunk)
61
+ void writeChunk (std::string const & streamId, std::string const & withData, std::function<void (JSValue)> const & callback);
62
+
63
+ REACT_METHOD (closeStream)
64
+ void closeStream (std::string const & streamId, std::function<void (JSValue)> const & callback);
65
+
66
+ REACT_METHOD (unlink)
67
+ void unlink (std::string const & path, std::function<void (JSValue)> const & callback);
68
+
69
+ REACT_METHOD (removeSession)
70
+ void removeSession (JSValue paths, std::function<void (JSValue)> const & callback);
71
+
72
+ REACT_METHOD (ls)
73
+ winrt::Windows::Foundation::IAsyncOperation<JSValue> ls (std::string const & path);
74
+
75
+ REACT_METHOD (stat)
76
+ void stat (std::string const & target, std::function<void (JSValue)> const & callback);
77
+
78
+ REACT_METHOD (lstat)
79
+ void lstat (std::string const & path, std::function<void (JSValue)> const & callback);
80
+
81
+ REACT_METHOD (cp)
82
+ void cp (std::string const & src, std::string const & dest, std::function<void (JSValue)> const & callback);
83
+
84
+ REACT_METHOD (mv)
85
+ void mv (std::string const & path, std::string const & dest, std::function<void (JSValue)> const & callback);
86
+
87
+ REACT_METHOD (mkdir)
88
+ winrt::Windows::Foundation::IAsyncOperation<bool > mkdir (std::string const & path);
89
+
90
+ REACT_METHOD (readFile)
91
+ winrt::Windows::Foundation::IAsyncOperation<JSValue> readFile (std::string const & path, std::string const & encoding, bool transformFile);
92
+
93
+ REACT_METHOD (hash)
94
+ winrt::Windows::Foundation::IAsyncOperation<std::string> hash (std::string const & path, std::string const & algorithm);
95
+
96
+ REACT_METHOD (readStream)
97
+ void readStream (std::string const & path, std::string const & encoding, int bufferSize, int tick, std::string const & streamId);
98
+
99
+ REACT_METHOD (getEnvironmentDirs)
100
+ void getEnvironmentDirs (std::function<void (JSValue)> const & callback);
101
+
102
+ REACT_METHOD (cancelRequest)
103
+ void cancelRequest (std::string const & taskId, std::function<void (JSValue)> const & callback);
104
+
105
+ REACT_METHOD (enableProgressReport)
106
+ void enableProgressReport (std::string const & taskId, int interval, int count);
107
+
108
+ REACT_METHOD (enableUploadProgressReport)
109
+ void enableUploadProgressReport (std::string const & taskId, int interval, int count);
110
+
111
+ REACT_METHOD (slice)
112
+ winrt::Windows::Foundation::IAsyncOperation<std::string> slice (std::string const & src, std::string const & dest, int64_t start, int64_t end);
113
+
114
+ REACT_METHOD (presentOptionsMenu)
115
+ winrt::Windows::Foundation::IAsyncOperation<JSValue> presentOptionsMenu (std::string const & uri, std::string const & scheme);
116
+
117
+ REACT_METHOD (presentOpenInMenu)
118
+ winrt::Windows::Foundation::IAsyncOperation<JSValue> presentOpenInMenu (std::string const & uri, std::string const & scheme);
119
+
120
+ REACT_METHOD (presentPreview)
121
+ winrt::Windows::Foundation::IAsyncOperation<JSValue> presentPreview (std::string const & uri, std::string const & scheme);
122
+
123
+ REACT_METHOD (excludeFromBackupKey)
124
+ winrt::Windows::Foundation::IAsyncOperation<JSValue> excludeFromBackupKey (std::string const & url);
125
+
126
+ REACT_METHOD (df)
127
+ void df (std::function<void (JSValue)> const & callback);
128
+
129
+ REACT_METHOD (emitExpiredEvent)
130
+ void emitExpiredEvent (std::function<void (std::string)> const & callback);
131
+
132
+ REACT_METHOD (actionViewIntent)
133
+ winrt::Windows::Foundation::IAsyncAction actionViewIntent (std::string const & path, std::string const & mime, std::string const & chooserTitle);
134
+
135
+ REACT_METHOD (addCompleteDownload)
136
+ winrt::Windows::Foundation::IAsyncAction addCompleteDownload (JSValue config);
137
+
138
+ REACT_METHOD (copyToInternal)
139
+ winrt::Windows::Foundation::IAsyncOperation<std::string> copyToInternal (std::string const & contentUri, std::string const & destPath);
140
+
141
+ REACT_METHOD (copyToMediaStore)
142
+ winrt::Windows::Foundation::IAsyncOperation<std::string> copyToMediaStore (JSValue filedata, std::string const & mt, std::string const & path);
143
+
144
+ REACT_METHOD (createMediaFile)
145
+ winrt::Windows::Foundation::IAsyncOperation<std::string> createMediaFile (JSValue filedata, std::string const & mt);
146
+
147
+ REACT_METHOD (getBlob)
148
+ winrt::Windows::Foundation::IAsyncOperation<JSValue> getBlob (std::string const & contentUri, std::string const & encoding);
149
+
150
+ REACT_METHOD (getContentIntent)
151
+ winrt::Windows::Foundation::IAsyncOperation<std::string> getContentIntent (std::string const & mime);
152
+
153
+ REACT_METHOD (getSDCardDir)
154
+ winrt::Windows::Foundation::IAsyncOperation<std::string> getSDCardDir ();
155
+
156
+ REACT_METHOD (getSDCardApplicationDir)
157
+ winrt::Windows::Foundation::IAsyncOperation<std::string> getSDCardApplicationDir ();
158
+
159
+ REACT_METHOD (scanFile)
160
+ void scanFile (JSValue pairs, std::function<void (JSValue)> const & callback);
161
+
162
+ REACT_METHOD (writeToMediaFile)
163
+ winrt::Windows::Foundation::IAsyncOperation<std::string> writeToMediaFile (std::string const & fileUri, std::string const & path, bool transformFile);
164
+
165
+ REACT_METHOD (addListener)
166
+ void addListener (std::string const & eventName);
167
+
168
+ REACT_METHOD (removeListeners)
169
+ void removeListeners (int count);
26
170
27
171
private:
28
172
React::ReactContext m_context;
0 commit comments