Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/Bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ Describe your issue here
<!-- Thanks for reading this far down ❤️ -->
<!-- High quality, detailed issues are much easier to triage for maintainers -->

<!-- For bonus points, if you put a 🔥 (:fire:) emojii at the start of the issue title we'll know -->
<!-- For bonus points, if you put a 🔥 (:fire:) emoji at the start of the issue title we'll know -->
<!-- that you took the time to fill this out correctly, or, at least read this far -->

---
Expand Down
26 changes: 13 additions & 13 deletions docs/app/utils.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ When working with modules such as [Cloud Storage](/storage), you may need to kno
current directory paths. Rather than installing a separate module, the library provides useful statics
which can be used.

Access the `FilePath` static via utils:
Import `FilePath` directly from the app package:

```js
import { utils } from '@react-native-firebase/app';
import { FilePath } from '@react-native-firebase/app';

console.log(utils.FilePath.PICTURES_DIRECTORY);
console.log(FilePath.PICTURES_DIRECTORY);
```

# Test Lab
Expand All @@ -35,11 +35,11 @@ data collection. Such functionality can be carried out by taking advantage of th
> Be aware, `isRunningInTestLab` is Android only property!

```js
import { utils } from '@react-native-firebase/app';
import { getUtils } from '@react-native-firebase/app';
import { getAnalytics, setAnalyticsCollectionEnabled } from '@react-native-firebase/analytics';

async function bootstrap() {
if (utils().isRunningInTestLab) {
if (getUtils().isRunningInTestLab) {
await setAnalyticsCollectionEnabled(getAnalytics(), false);
}
}
Expand All @@ -55,9 +55,9 @@ separate package.
> it is `undefined` (including when the native value is empty).

```js
import { utils } from '@react-native-firebase/app';
import { getUtils } from '@react-native-firebase/app';

const version = utils().appVersion;
const version = getUtils().appVersion;
if (version) {
console.log('App version:', version);
}
Expand All @@ -68,11 +68,11 @@ if (version) {
It is useful to know if the Android device has play services available, and what to do in response to certain use cases:

```js
import { utils } from '@react-native-firebase/app';
import { getUtils } from '@react-native-firebase/app';

async function checkPlayServicesExample() {
const { status, isAvailable, hasResolution, isUserResolvableError } =
utils().playServicesAvailability;
getUtils().playServicesAvailability;
// all good and valid \o/
if (isAvailable) return Promise.resolve();
// if the user can resolve the issue i.e by updating play services
Expand All @@ -83,19 +83,19 @@ async function checkPlayServicesExample() {
// SERVICE_MISSING - Google Play services is missing on this device.
// show something to user
// and then attempt to install if necessary
return utils().makePlayServicesAvailable();
return getUtils().makePlayServicesAvailable();
case 2:
// SERVICE_VERSION_UPDATE_REQUIRED - The installed version of Google Play services is out of date.
// show something to user
// and then attempt to update if necessary
return utils().resolutionForPlayServices();
return getUtils().resolutionForPlayServices();

default:
// some default dialog / component?
// use the link below to tailor response to status codes to suit your use case
// https://developers.google.com/android/reference/com/google/android/gms/common/ConnectionResult#SERVICE_VERSION_UPDATE_REQUIRED
if (isUserResolvableError) return utils().promptForPlayServices();
if (hasResolution) return utils().resolutionForPlayServices();
if (isUserResolvableError) return getUtils().promptForPlayServices();
if (hasResolution) return getUtils().resolutionForPlayServices();
}
}
// There's no way to resolve play services on this device
Expand Down
2 changes: 1 addition & 1 deletion docs/messaging/usage/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ import { getMessaging, unsubscribeFromTopic } from '@react-native-firebase/messa

const messaging = getMessaging();

unsubscribeFromTopic(messaging, 'weather').then(() => console.log('Unsubscribed fom the topic!'));
unsubscribeFromTopic(messaging, 'weather').then(() => console.log('Unsubscribed from the topic!'));
```

# firebase.json
Expand Down
6 changes: 3 additions & 3 deletions docs/storage/usage/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ const reference = ref(getStorage(), '/images/t-shirts/black-t-shirt-sm.png');

To upload a file directly from the users device, the `putFile` method on a reference accepts a string path to the file
on the users device. For example, you may be creating an app which uploads users photos. The React Native Firebase
library provides [Utils](/app/utils) to help identify device directories:
library provides [utilities](/app/utils) such as `FilePath` to help identify device directories:

```jsx
import React, { useEffect } from 'react';
import { View, Button } from 'react-native';

import { utils } from '@react-native-firebase/app';
import { FilePath } from '@react-native-firebase/app';
import { getStorage, ref, putFile } from '@react-native-firebase/storage';

function App() {
Expand All @@ -91,7 +91,7 @@ function App() {
<View>
<Button
onPress={async () => {
const pathToFile = `${utils.FilePath.PICTURES_DIRECTORY}/black-t-shirt-sm.png`;
const pathToFile = `${FilePath.PICTURES_DIRECTORY}/black-t-shirt-sm.png`;
await putFile(reference, pathToFile);
}}
/>
Expand Down