@react-native-firebase/storage 20.2.0 → 20.3.0
Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,16 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [20.3.0](https://github.com/invertase/react-native-firebase/compare/v20.2.1...v20.3.0) (2024-07-19)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @react-native-firebase/storage
|
9
|
+
|
10
|
+
## [20.2.1](https://github.com/invertase/react-native-firebase/compare/v20.2.0...v20.2.1) (2024-07-17)
|
11
|
+
|
12
|
+
### Bug Fixes
|
13
|
+
|
14
|
+
- **storage:** ensure emulator is used for different storage buckets ([#7892](https://github.com/invertase/react-native-firebase/issues/7892)) ([3fa3f11](https://github.com/invertase/react-native-firebase/commit/3fa3f110b357ef0dbe2cc0fc12e982edc913b588))
|
15
|
+
|
6
16
|
## [20.2.0](https://github.com/invertase/react-native-firebase/compare/v20.1.0...v20.2.0) (2024-07-15)
|
7
17
|
|
8
18
|
### Features
|
package/android/src/main/java/io/invertase/firebase/storage/ReactNativeFirebaseStorageModule.java
CHANGED
@@ -281,12 +281,15 @@ public class ReactNativeFirebaseStorageModule extends ReactNativeFirebaseModule
|
|
281
281
|
* @link https://firebase.google.com/docs/reference/js/firebase.storage.Storage#useEmulator
|
282
282
|
*/
|
283
283
|
@ReactMethod
|
284
|
-
public void useEmulator(String appName, String host, int port, Promise promise) {
|
284
|
+
public void useEmulator(String appName, String host, int port, String bucketUrl, Promise promise) {
|
285
285
|
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
|
286
|
-
|
287
|
-
|
286
|
+
|
287
|
+
FirebaseStorage firebaseStorage = FirebaseStorage.getInstance(firebaseApp, bucketUrl);
|
288
|
+
String emulatorKey = appName + ":" + bucketUrl;
|
289
|
+
|
290
|
+
if (emulatorConfigs.get(emulatorKey) == null) {
|
288
291
|
firebaseStorage.useEmulator(host, port);
|
289
|
-
emulatorConfigs.put(
|
292
|
+
emulatorConfigs.put(emulatorKey, "true");
|
290
293
|
}
|
291
294
|
promise.resolve(null);
|
292
295
|
}
|
@@ -511,12 +511,15 @@ RCT_EXPORT_METHOD(putString
|
|
511
511
|
RCT_EXPORT_METHOD(useEmulator
|
512
512
|
: (FIRApp *)firebaseApp
|
513
513
|
: (nonnull NSString *)host
|
514
|
-
: (NSInteger)port
|
514
|
+
: (NSInteger)port
|
515
|
+
: (NSString *)bucketUrl) {
|
515
516
|
emulatorHost = host;
|
516
517
|
emulatorPort = port;
|
517
|
-
|
518
|
-
|
519
|
-
|
518
|
+
NSString *key = [self createEmulatorKey:bucketUrl appName:firebaseApp.name];
|
519
|
+
|
520
|
+
if (!emulatorConfigs[key]) {
|
521
|
+
[[FIRStorage storageForApp:firebaseApp URL:bucketUrl] useEmulatorWithHost:host port:port];
|
522
|
+
emulatorConfigs[key] = @YES;
|
520
523
|
}
|
521
524
|
}
|
522
525
|
|
@@ -557,6 +560,10 @@ RCT_EXPORT_METHOD(setTaskStatus
|
|
557
560
|
#pragma mark -
|
558
561
|
#pragma mark Firebase Storage Internals
|
559
562
|
|
563
|
+
- (NSString *)createEmulatorKey:(NSString *)bucketUrl appName:(NSString *)appName {
|
564
|
+
return [NSString stringWithFormat:@"%@-%@", appName, bucketUrl];
|
565
|
+
}
|
566
|
+
|
560
567
|
- (void)addUploadTaskObservers:(FIRStorageUploadTask *)uploadTask
|
561
568
|
appDisplayName:(NSString *)appDisplayName
|
562
569
|
taskId:(NSNumber *)taskId
|
@@ -675,11 +682,11 @@ RCT_EXPORT_METHOD(setTaskStatus
|
|
675
682
|
storage = [FIRStorage storageForApp:firebaseApp URL:bucket];
|
676
683
|
|
677
684
|
NSLog(@"Setting emulator - host %@ port %ld", emulatorHost, (long)emulatorPort);
|
678
|
-
|
679
|
-
|
685
|
+
NSString *key = [self createEmulatorKey:bucket appName:firebaseApp.name];
|
686
|
+
if (![emulatorHost isEqual:[NSNull null]] && emulatorHost != nil && !emulatorConfigs[key]) {
|
680
687
|
@try {
|
681
688
|
[storage useEmulatorWithHost:emulatorHost port:emulatorPort];
|
682
|
-
emulatorConfigs[
|
689
|
+
emulatorConfigs[key] = @YES;
|
683
690
|
} @catch (NSException *e) {
|
684
691
|
NSLog(@"WARNING: Unable to set the Firebase Storage emulator settings. These must be set "
|
685
692
|
@"before any usages of Firebase Storage. If you see this log after a hot "
|
package/lib/index.js
CHANGED
@@ -203,7 +203,7 @@ class FirebaseStorageModule extends FirebaseModule {
|
|
203
203
|
}
|
204
204
|
this.emulatorHost = host;
|
205
205
|
this.emulatorPort = port;
|
206
|
-
this.native.useEmulator(_host, port);
|
206
|
+
this.native.useEmulator(_host, port, this._customUrlOrRegion);
|
207
207
|
return [_host, port]; // undocumented return, just used to unit test android host remapping
|
208
208
|
}
|
209
209
|
}
|
package/lib/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
// Generated by genversion.
|
2
|
-
module.exports = '20.
|
2
|
+
module.exports = '20.3.0';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-native-firebase/storage",
|
3
|
-
"version": "20.
|
3
|
+
"version": "20.3.0",
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
5
5
|
"description": "React Native Firebase - React Native Firebase provides native integration with Cloud Storage, providing support to upload and download files directly from your device and from your Firebase Cloud Storage bucket.",
|
6
6
|
"main": "lib/index.js",
|
@@ -29,10 +29,10 @@
|
|
29
29
|
"download"
|
30
30
|
],
|
31
31
|
"peerDependencies": {
|
32
|
-
"@react-native-firebase/app": "20.
|
32
|
+
"@react-native-firebase/app": "20.3.0"
|
33
33
|
},
|
34
34
|
"publishConfig": {
|
35
35
|
"access": "public"
|
36
36
|
},
|
37
|
-
"gitHead": "
|
37
|
+
"gitHead": "a916b37b022cf40588fa0fd915b7ab901e2458d0"
|
38
38
|
}
|