Rocket.Chat.ReactNative/patches/rn-fetch-blob+0.10.16.patch

56 lines
1.7 KiB
Diff

diff --git a/node_modules/rn-fetch-blob/fs.js b/node_modules/rn-fetch-blob/fs.js
index e61f443..77bbe7a 100644
--- a/node_modules/rn-fetch-blob/fs.js
+++ b/node_modules/rn-fetch-blob/fs.js
@@ -135,6 +135,19 @@ function pathForAppGroup(groupName: string): Promise {
return RNFetchBlob.pathForAppGroup(groupName)
}
+/**
+ * Returns the path for the app group synchronous.
+ * @param {string} groupName Name of app group
+ * @return {string} Path of App Group dir
+ */
+function syncPathAppGroup(groupName: string): string {
+ if (Platform.OS === 'ios') {
+ return RNFetchBlob.syncPathAppGroup(groupName);
+ } else {
+ return '';
+ }
+}
+
/**
* Wrapper method of readStream.
* @param {string} path Path of the file.
@@ -402,6 +415,7 @@ export default {
writeFile,
appendFile,
pathForAppGroup,
+ syncPathAppGroup,
readFile,
hash,
exists,
diff --git a/node_modules/rn-fetch-blob/ios/RNFetchBlob/RNFetchBlob.m b/node_modules/rn-fetch-blob/ios/RNFetchBlob/RNFetchBlob.m
index b4642d4..034605d 100644
--- a/node_modules/rn-fetch-blob/ios/RNFetchBlob/RNFetchBlob.m
+++ b/node_modules/rn-fetch-blob/ios/RNFetchBlob/RNFetchBlob.m
@@ -228,6 +228,18 @@ - (NSDictionary *)constantsToExport
}
}
+#pragma mark - fs.syncPathAppGroup
+RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(syncPathAppGroup:(NSString *)groupName) {
+ NSURL *pathUrl = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:groupName];
+ NSString *path = [pathUrl path];
+
+ if(path) {
+ return path;
+ } else {
+ return @"";
+ }
+}
+
#pragma mark - fs.exists
RCT_EXPORT_METHOD(exists:(NSString *)path callback:(RCTResponseSenderBlock)callback) {
[RNFetchBlobFS exists:path callback:callback];