Skip to content

Commit 7f11a9e

Browse files
authored
[v6] Implement Cloud Storage (#2043)
See the changelog for detailed changes.
1 parent 9b1337c commit 7f11a9e

File tree

137 files changed

+16837
-3468
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+16837
-3468
lines changed

.flowconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
# Ignore tests project
66
.*/tests/.*
7+
.*/packages/template/.*
78

89
[include]
910
packages/**/lib/*.js.flow
@@ -42,4 +43,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
4243
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
4344

4445
[version]
45-
^0.93.0
46+
^0.96.0

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,26 @@ await analytics().setUserId('12345678');
179179
- [BREAKING] `enableDeveloperMode` has been removed, you can now use `setConfigSettings({ isDeveloperModeEnabled: boolean })` instead
180180
- [BREAKING] `setDefaults` now returns a Promise that resolves when completed
181181

182+
## Storage
183+
184+
<!-- TODO(salakar) change link -->
185+
> **Blog post announcement (NOT LIVE YET)**: [[Firebase Cloud Storage for React Native](https://invertase.io/blog?utm_source=github&utm_medium=changelog)]
186+
187+
- [NEW] Added support for `put` (`Blob` | `ArrayBuffer` | `Uint8Array`)
188+
- `contentType` mime type is automatically inferred from `Blob`
189+
- [NEW] Added support for `putString` and all StringFormat's (raw, base64, base64url & data_url)
190+
- `contentType` mime type is automatically inferred from `data_url` strings
191+
- [NEW] Added support multiple buckets, e.g. `firebase.app().storage('gs://my-other-bucket')`
192+
- [NEW] Added support `pause()`, `resume()` & `cancel()` for Upload & Download Storage tasks
193+
- [NEW] Added an `error` property to TaskSnapshot's for `error` state events - this is an instance of `NativeFirebaseError` (with `code` & `message`)
194+
- [BREAKING] Removed formerly deprecated `UploadTaskSnapshot.downloadUrl` property, use `StorageReference.getDownloadURL(): Promise<string>` instead
195+
- [BREAKING] `StorageReference.downloadFile()` is now deprecated and will be removed in a later release, please rename usages of this to `getFile()` - renamed to match Native SDKs
196+
- [BREAKING] `firebase.storage.Native` is now deprecated and will be removed in a later release, please rename usages of this to `firebase.storage.Path`
197+
- [BREAKING] `firebase.storage.Native.*` properties have been renamed and deprecated and will be removed in a later release, follow the in-app console warnings on how to migrate
198+
- [BUGFIX][ANDROID] Update/set metadata now correctly supports removing metadata values by passing a null property value in `customMetadata`
199+
- [BUGFIX][ANDROID] `contentType` mime type is now correctly determined in all scenarios, there was an edge case where it would just use the default value
200+
- [INTERNAL][ANDROID] `downloadFile` no longer uses a `StreamDownloadTask`, replaced with the newer `FileDownloadTask`
201+
182202
## Messaging
183203

184204
- [NEW] Support `setAutoInitEnabled(enabled: boolean)` - this is useful for opt-in first flows

docs/analytics/android.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,41 @@ description: Manually integrate Analytics into your Android application.
55

66
# Android Setup
77

8+
## Manual Android Integration
9+
810
> The following steps are only required if your environment does not have access to React Native
9-
auto-linking.
11+
auto-linking.
12+
13+
#### Add Analytics to Gradle Settings
14+
15+
**`android/settings.gradle`**:
16+
```groovy
17+
include ':@react-native-firebase_analytics'
18+
project(':@react-native-firebase_analytics').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/analytics/android')
19+
```
20+
21+
#### Add Analytics to App Gradle Dependencies
22+
23+
**`android/app/build.gradle`**:
24+
```groovy{4}
25+
// ..
26+
dependencies {
27+
// ..
28+
implementation project(path: ":@react-native-firebase_analytics")
29+
}
30+
```
31+
32+
#### Add Analytics to Main Android Application:
33+
34+
**`android/app/src/main/java/**/MainApplication.java`**:
35+
```java{2,8}
36+
// ..
37+
import io.invertase.firebase.analytics.ReactNativeFirebaseAnalyticsPackage;
1038
11-
## TODO
39+
// ..
40+
protected List<ReactPackage> getPackages() {
41+
return Arrays.asList(
42+
new MainReactPackage(),
43+
new ReactNativeFirebaseAnalyticsPackage(),
44+
// ..
45+
```

docs/analytics/ios.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,38 @@ description: Manually integrate Analytics into your iOS application.
55

66
# iOS Setup
77

8+
## Manual iOS Integration via CocoaPods
9+
10+
> The following steps are only required if your environment does not have access to React Native
11+
auto-linking.
12+
13+
#### Add Analytics Pod
14+
15+
**`ios/Podfile`**:
16+
```ruby{4}
17+
// ..
18+
target 'app' do
19+
// ..
20+
pod 'RNFBAnalytics', :path => '../node_modules/@react-native-firebase/analytics/ios'
21+
end
22+
```
23+
24+
## Manual iOS Integration via Frameworks
25+
26+
*TODO*
27+
828
## Device Identification
929

1030
If you would like to enable Firebase Analytics to generate automatic audience metrics for iOS (as it does by default in Android), you must link additional iOS libraries, [as documented by the Google Firebase team](https://support.google.com/firebase/answer/6318039). Specifically you need `libAdIdAccess.a` and `AdSupport.framework`.
1131

1232
The way to do this using Cocoapods is to add this to your Podfile (though please use [the most current Pod version](https://cocoapods.org/pods/GoogleIDFASupport) supported by react-native-firebase):
1333

14-
```ruby
34+
**`ios/Podfile`**:
35+
```ruby{5}
36+
// ..
37+
target 'app' do
38+
// ..
39+
pod 'RNFBAnalytics', :path => '../node_modules/@react-native-firebase/analytics/ios'
1540
pod 'GoogleIDFASupport', '~> 3.14.0'
41+
end
1642
```
17-
18-
> The following steps are only required if your environment does not have access to React Native
19-
auto-linking.
20-
21-
## TODO

docs/crashlytics/android.md

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,76 @@ description: Manually integrate Crashlytics into your Android application.
55

66
# Android Setup
77

8+
> If you're migrating from Fabric ensure you remove the `fabric.properties` file from your android project - if you do not do this you will not receive crash reports on the Firebase console.
9+
10+
## Additional Installation Steps
11+
12+
### Add Fabric Gradle Tools
13+
14+
These steps are required, if you do not add these your app will most likely crash at startup with the following Error: *"The Crashlytics build ID is missing. This occurs when Crashlytics tooling is absent from your app's build configuration. Please review Crashlytics onboarding instructions and ensure you have a valid Crashlytics account."*
15+
16+
#### Add the Fabric Maven repository
17+
18+
**`android/build.gradle`**:
19+
```groovy{6-8}
20+
// ..
21+
buildscript {
22+
// ..
23+
repositories {
24+
// ..
25+
maven {
26+
url 'https://maven.fabric.io/public'
27+
}
28+
}
29+
// ..
30+
}
31+
```
32+
33+
#### Add the Fabric Tools Plugin dependency
34+
35+
**`android/build.gradle`**:
36+
```groovy{6}
37+
// ..
38+
buildscript {
39+
// ..
40+
dependencies {
41+
// ..
42+
classpath 'io.fabric.tools:gradle:1.28.1'
43+
}
44+
// ..
45+
}
46+
```
47+
48+
#### Apply the Fabric Tools Plugin to your app
49+
50+
51+
**`android/app/build.gradle`**:
52+
```groovy{2}
53+
apply plugin: 'com.android.application' // apply after this line
54+
apply plugin: 'io.fabric'
55+
// ..
56+
```
57+
58+
#### Enable Crashlytics NDK reporting
59+
60+
> OPTIONAL
61+
62+
Crashlytics NDK reporting allows you to capture Native Development Kit crashes, e.g. in React Native this will capture crashes originating from the Yoga layout engine.
63+
64+
**`android/app/build.gradle`**:
65+
```groovy{4-6}
66+
// ..
67+
apply plugin: 'io.fabric'
68+
// ..
69+
crashlytics {
70+
enableNdk true
71+
}
72+
```
73+
74+
## Manual Linking
75+
876
> The following steps are only required if your environment does not have access to React Native
977
auto-linking.
1078

1179

12-
> If you're migrating from Fabric ensure you remove the `fabric.properties` file from your android project - if you do not do this you will not receive crash reports on the Firebase console.
13-
14-
## TODO
80+
TODO

docs/database/quick-start.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ data changing, being added, being removed or moved to another location.
8282

8383
```jsx
8484
import React, { useState, useEffect } from 'react';
85-
import { Text, FlatList } from 'react-native';
85+
import { Text } from 'react-native';
8686
import database from '@react-native-firebase/database';
8787

8888
function Role({ uid }) {
@@ -128,7 +128,7 @@ a performant, scrollable list simple:
128128

129129
```jsx
130130
import React, { useState, useEffect } from 'react';
131-
import { Text } from 'react-native';
131+
import { Text, FlatList } from 'react-native';
132132
import database from '@react-native-firebase/database';
133133

134134
function Games() {

docs/sidebar.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@
185185
to: "/android"
186186
- text: iOS Setup
187187
to: "/ios"
188-
- text: Migrating to Dynamic Links
189-
to: "/migrating-to-dynamic-links"
188+
- text: Migrate to Dynamic Links
189+
to: "/migrate-to-dynamic-links"
190190

191191
- module: ml-kit
192192
group: ML Kit

docs/storage/android.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dependencies {
3131

3232
#### Add Cloud Storage to Main Android Application:
3333

34-
**`android/app/src/main/java/**/MainApplication.java`**:
34+
**android/app/src/main/java/\*\*/MainApplication.java**:
3535
```java{2,8}
3636
// ..
3737
import io.invertase.firebase.storage.ReactNativeFirebaseStoragePackage;

0 commit comments

Comments
 (0)