mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-04 22:56:45 +08:00
[v6] Misc doc fixes (#2515)
* Typo
* Admob doc link fixes
* Removed Brittish slang 🙄
* Wording, typos
* Extra admob examples
* Analytics doc changes
* User properties details
* Auth stuff
* More auth changes
This commit is contained in:
committed by
Mike Diarmid
parent
f34979d5c2
commit
b39aa3e680
@@ -1,13 +1,13 @@
|
||||
---
|
||||
title: European User Consent
|
||||
description: Understand how the EU User Consent Policy can be managed within AdMob and how it effects your application.
|
||||
description: Understand how the EU User Consent Policy can be managed within AdMob and how it affects your application.
|
||||
---
|
||||
|
||||
# European User Consent
|
||||
|
||||
Under the Google [EU User Consent Policy](https://www.google.com/about/company/consentstaging.html), you must make
|
||||
certain disclosures to your users in the European Economic Area (EEA) and obtain their consent to use cookies or
|
||||
other local storage, where legally required, and to use personal data (such as AdID) to serve ads. This policy
|
||||
certain disclosures to your users in the European Economic Area (EEA) and obtain their consent to use cookies or
|
||||
other local storage, where legally required, and to use personal data (such as AdID) to serve ads. This policy
|
||||
reflects the requirements of the EU ePrivacy Directive and the General Data Protection Regulation (GDPR).
|
||||
|
||||
The React Native Firebase AdMob module provides out of the box support for helping to manage your users consent
|
||||
@@ -22,7 +22,7 @@ The `AdsConsent` helper & AdMob module provides out of the box support for:
|
||||
|
||||
## Understanding AdMob Ads
|
||||
|
||||
Ads served by Google can be categorized as personalized or non-personalized, both requiring consent from users in the EEA. By default,
|
||||
Ads served by Google can be categorized as personalized or non-personalized, both requiring consent from users in the EEA. By default,
|
||||
ad requests to Google serve personalized ads, with ad selection based on the user's previously collected data. Users outside of the EEA do not require consent.
|
||||
|
||||
> The `AdsConsent` helper only provides you with the tools for requesting consent, it is up to the developer to ensure the consent status is reflected throughout the app.
|
||||
@@ -93,22 +93,22 @@ Now we understand the consent status of the user, we can gather their consent (i
|
||||
|
||||
If you are aware that users are under the age of consent in Europe, it is possible to set this using the `setTagForUnderAgeOfConsent`
|
||||
method (TFUA). Once the setting is enabled, the Google-rendered consent form will fail to load. All ad requests that include
|
||||
TFUA will be made ineligible for personalized advertising and remarketing. TFUA disables requests to third-party ad technology
|
||||
TFUA will be made ineligible for personalized advertising and remarketing. TFUA disables requests to third-party ad technology
|
||||
providers, such as ad measurement pixels and third-party ad servers.
|
||||
|
||||
|
||||
To remove this setting, pass `false` to the method.
|
||||
|
||||
#### 1. Google-rendered consent form
|
||||
|
||||
The Google-rendered consent form is a full-screen configurable form that displays over your app content.
|
||||
The Google-rendered consent form is a full-screen configurable form that displays over your app content.
|
||||
You can configure the form to present the user with combinations of the following options:
|
||||
|
||||
- Consent to view personalized ads
|
||||
- Consent to view non-personalized ads
|
||||
- Use a paid version of the app instead of viewing ads
|
||||
|
||||
You should review the consent text carefully: what appears by default is a message that might be appropriate if you use
|
||||
Google to monetize your app; but Google cannot provide legal advice on the consent text that is appropriate for you.
|
||||
You should review the consent text carefully: what appears by default is a message that might be appropriate if you use
|
||||
Google to monetize your app; but Google cannot provide legal advice on the consent text that is appropriate for you.
|
||||
To update consent text of the Google-rendered consent form, modify the `consentform.htm`l file included in the Consent SDK as required.
|
||||
|
||||
> An [example of a Google-rendered](https://developers.google.com/admob/images/android_eu_consent_form.png) consent form.
|
||||
@@ -122,7 +122,7 @@ import { AdsConsent, AdsConsentStatus } from '@react-native-firebase/admob';
|
||||
const consentInfo = await AdsConsent.requestInfoUpdate(['pub-6189033257628123']);
|
||||
|
||||
if (
|
||||
consentInfo.isRequestLocationInEeaOrUnknown &&
|
||||
consentInfo.isRequestLocationInEeaOrUnknown &&
|
||||
consentInfo.status === AdsConsentStatus.UNKNOWN
|
||||
) {
|
||||
const formResult = await AdsConsent.showForm({
|
||||
@@ -134,7 +134,7 @@ if (
|
||||
}
|
||||
```
|
||||
|
||||
Once the user has selected their preference, the `formResult` contains their status and whether or not they prefer an
|
||||
Once the user has selected their preference, the `formResult` contains their status and whether or not they prefer an
|
||||
ad-free option of your application (if enabled):
|
||||
|
||||
```js
|
||||
@@ -183,16 +183,16 @@ import { AdsConsent, AdsConsentStatus } from '@react-native-firebase/admob';
|
||||
await AdsConsent.setStatus(AdsConsentStatus.PERSONALIZED);
|
||||
```
|
||||
|
||||
To invalidate the users consent status (e.g. if the providers list changes since their last consent), set the status back to
|
||||
To invalidate the users consent status (e.g. if the providers list changes since their last consent), set the status back to
|
||||
`UNKNOWN`. When your application next boots, you can get the users previous consent status using the `getStatus` method.
|
||||
|
||||
### Testing
|
||||
### Testing
|
||||
|
||||
When developing the consent flow, the behaviour of the `AdsConsent` responses may not be reliable due to the environment
|
||||
(e.g. using an emulator vs real device). It is possible to set a debug location to test the various responses from the
|
||||
When developing the consent flow, the behaviour of the `AdsConsent` responses may not be reliable due to the environment
|
||||
(e.g. using an emulator vs real device). It is possible to set a debug location to test the various responses from the
|
||||
Consent SDK.
|
||||
|
||||
If using a real device, ensure you whitelist it using the device ID, which can be obtained from native logs or using a library
|
||||
If using a real device, ensure you whitelist it using the device ID, which can be obtained from native logs or using a library
|
||||
such as [react-native-device-info](https://github.com/react-native-community/react-native-device-info). Once found,
|
||||
call the `addTestDevice(deviceId)` method.
|
||||
|
||||
@@ -215,7 +215,7 @@ await AdsConsent.setDebugGeography(AdsConsentDebugGeography.EEA);
|
||||
|
||||
### Forwarding the consent status to ads
|
||||
|
||||
Assuming the user is within the EEA and has provided consent, their status needs to be forwarded to every ad request we
|
||||
Assuming the user is within the EEA and has provided consent, their status needs to be forwarded to every ad request we
|
||||
make in our application.
|
||||
|
||||
> If the user is within the EEA and has not given consent, do not display AdMob ads (even non-personalized).
|
||||
@@ -232,7 +232,7 @@ const rewardedAd = RewardedAd.createForAdRequest('AD_UNIT_ID', {
|
||||
});
|
||||
```
|
||||
|
||||
The requested ad URL via the SDK will send a request with an additional parameter `&npa=1`, which will return a
|
||||
The requested ad URL via the SDK will send a request with an additional parameter `&npa=1`, which will return a
|
||||
non-personalized ad.
|
||||
|
||||
> The requestNonPersonalizedAdsOnly option can be applied to every supported ad format.
|
||||
@@ -241,14 +241,14 @@ non-personalized ad.
|
||||
|
||||
#### "Could not parse Event FE preflight response."
|
||||
|
||||
This is a common error which occurrs on both Android & iOS when making a request to display a Google-rendered consent form. Unfortunatly the reasoning for this error is generic, making it hard to debug. There are a number of steps to check which are usually the cause for this error:
|
||||
This is a common error which occurs on both Android & iOS when making a request to display a Google-rendered consent form. Unfortunately the reasoning for this error is generic, making it hard to debug. There are a number of steps to check which are usually the cause for this error:
|
||||
|
||||
- The AdMob App ID is incorrect: Ensure you have entered the correct ID into the `firebase.json` file under the React Native config, called `occurs`.
|
||||
- The AdMob App ID is incorrect: Ensure you have entered the correct ID into the `firebase.json` file under the `admob_app_id` key in the `react-native` config.
|
||||
- A publisher ID is incorrect: Ensure your entered publisher IDs are correct.
|
||||
- The publisher ID needs to be available on the same account as your AdMob App ID.
|
||||
- The user is outside of the EEA: If a user does not need to provide consent, the form request will error. Ensure you have checked the users status via `requestInfoUpdate`. If using an emulator, ensure you set a debug location via `setDebugGeography`.
|
||||
- Your AdMob account is not valid:
|
||||
- Your account is not disabled: This can occur if Google notices you have duplicate accounts. They will email you about this, and block you from entering the dashboard.
|
||||
- You have setup valid payment information: If your account has no payment information setup, this seems to cause this error to trigger.
|
||||
- Your account is disabled: This can occur if Google notices you have duplicate accounts. They will email you about this, and block you from entering the dashboard.
|
||||
- You have provided invalid payment information: If your account has no payment information set up, this seems to cause this error to trigger.
|
||||
|
||||
If you are still struggling to present the consent form, reach out to AdMob support to investigate your account status.
|
||||
|
||||
@@ -22,15 +22,15 @@ _We are currently investigating how to integrate with [Native Ads](https://devel
|
||||
icon="attach_money"
|
||||
color="#2196f3"
|
||||
title="Quick Start"
|
||||
to="quick-start"
|
||||
to="admob/quick-start"
|
||||
>
|
||||
Install & start monetizing your React Native application with AdMob.
|
||||
</Block>
|
||||
<Block
|
||||
<Block
|
||||
icon="pan_tool"
|
||||
color="#f44336"
|
||||
title="European User Consent"
|
||||
to="european-user-consent"
|
||||
to="admob/european-user-consent"
|
||||
>
|
||||
Learn how to request consent from users within the EEA. The AdMob library comes with built in support to help you handle GDPR regulations in your application.
|
||||
</Block>
|
||||
|
||||
@@ -18,7 +18,7 @@ yarn add @react-native-firebase/admob
|
||||
## Module usage
|
||||
|
||||
The AdMob package provides a JavaScript API for integrating event based adverts such as Interstitial Ads and
|
||||
React component view adverts such as Banner Ads. It also provides functionality for requesting consent from those users within the EEA, specified by EU ePrivacy Directive & GDPR.
|
||||
React component view adverts such as Banner Ads. It also provides functionality for requesting consent from those users within the EEA, specified by EU ePrivacy Directive & GDPR.
|
||||
|
||||
Import the Cloud Functions package into your project:
|
||||
|
||||
@@ -34,7 +34,7 @@ import { firebase } from '@react-native-firebase/admob';
|
||||
|
||||
### Important: Adding your AdMob App ID
|
||||
|
||||
The AdMob module needs hooking up to your own Google AdMob account. On [the dashboard](https://apps.admob.com/v2/home), you can add an application via the "Apps" menu item. Once created, under the "App settings" section you will find a custom "App ID". This ID is needed in order for the module to be used.
|
||||
The AdMob module needs to be hooked up to your own Google AdMob account. On [the dashboard](https://apps.admob.com/v2/home), you can add an application via the "Apps" menu item. Once created, under the "App settings" section you will find a custom "App ID". This ID is needed in order for the module to be used.
|
||||
|
||||

|
||||
|
||||
@@ -56,12 +56,11 @@ Ensure you **rebuild** your application for the changes to take effect.
|
||||
|
||||
Out of the box, AdMob does not handle any related regulations which you may need to enforce on your application. It is up to the developer to implement and handle this on a user-by-user basis. For example, you must consent to EEA users being served both personalized and non-personalized adverts before showing them. For more information, see [Requesting Consent from European Users](https://developers.google.com/admob/android/eu-consent).
|
||||
|
||||
The AdMob module provides a `AdConsent` helper to help developers quickly implement consent flows within their application. See the
|
||||
<Anchor version group href="/european-user-consent">European User Consent</Anchor> page.
|
||||
The AdMob module provides a `AdConsent` helper to help developers quickly implement consent flows within their application. See the <Anchor version group href="/european-user-consent">European User Consent</Anchor> page.
|
||||
|
||||
### Example: Displaying an Interstitial
|
||||
|
||||
An interstitial is a full screen advert which is overlaid on-top of your currently application. They are perfect for showing periodically between game levels or after the user completes an action.
|
||||
An interstitial is a full screen advert which is overlaid on-top of your currently application. They are perfect to show periodically between game levels or after the user completes an action.
|
||||
|
||||
#### Testing
|
||||
|
||||
@@ -111,11 +110,11 @@ Once created, you will be provided with a new Ad Unit ID which can be passed ove
|
||||
|
||||
### Configuring Ad Requests
|
||||
|
||||
The AdMob module provides two ways of filtering and handling ad content within your app.
|
||||
The AdMob module provides two ways of filtering and handling ad content within your app.
|
||||
|
||||
### Global Configuration
|
||||
|
||||
To comply with various online acts, such as [Children's Online Privacy Protection Act (COPPA)](http://business.ftc.gov/privacy-and-security/children%27s-privacy) and [General Data Protection Regulation (GDPR)](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679), it is possible to set targetting preferences across every ad request in your aplication.
|
||||
To comply with various online acts, such as [Children's Online Privacy Protection Act (COPPA)](http://business.ftc.gov/privacy-and-security/children%27s-privacy) and [General Data Protection Regulation (GDPR)](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679), it is possible to set targetting preferences across every ad request in your application.
|
||||
|
||||
Using the `setRequestConfiguration` method, all future ad requests will comply with the `RequestConfiguration` set:
|
||||
|
||||
@@ -129,7 +128,7 @@ await admob().setRequestConfiguration({
|
||||
});
|
||||
```
|
||||
|
||||
For more information on the options available, see the `RequestConfiguration` documentation.
|
||||
For more information on the options available, see the [`RequestConfiguration` documentation](https://firebase.google.com/docs/reference/android/com/google/android/gms/ads/RequestConfiguration).
|
||||
|
||||
### Ad Specific Configuration
|
||||
|
||||
@@ -144,3 +143,4 @@ const interstitialAd = InterstitialAd.createForAdRequest('AD_UNIT_ID', {
|
||||
keywords: ['fashion', 'clothing']
|
||||
});
|
||||
```
|
||||
``
|
||||
|
||||
@@ -18,7 +18,7 @@ yarn add @react-native-firebase/analytics
|
||||
## Module usage
|
||||
|
||||
The Analytics package will automatically start tracking events such as when users clear app data, dismiss notifications and more.
|
||||
To view the full list of automatic events, see <Anchor version group href="/reserved-events">Reserved Events</Anchor>.
|
||||
To view the full list of automatic events, see [this page](https://support.google.com/firebase/answer/6317485) of the official Firebase documentation.
|
||||
|
||||
The package also provides a JavaScript API to allow for logging custom events and metrics throughout your application.
|
||||
|
||||
@@ -52,7 +52,7 @@ async function onProductView() {
|
||||
|
||||
### Attaching user data
|
||||
|
||||
User data can be attached to analytical events via the `setUser*` methods:
|
||||
User data can be attached to analytical events via the [***`setUserId`](reference/module#setUserId), [***`setUserProperties`](reference/module#setUserProperties) and [***`setUserProperty`](reference/module#setUserProperty) methods. Each Firebase project can have up to 25 uniquely named (case-sensitive) user properties.
|
||||
|
||||
```js
|
||||
import analytics from '@react-native-firebase/analytics';
|
||||
@@ -65,9 +65,11 @@ async function onSignIn(user) {
|
||||
}
|
||||
```
|
||||
|
||||
> When you set user properties, be sure to never include personally identifiable information such as names, social security numbers, or email addresses, even in hashed form.
|
||||
|
||||
### Tracking screen names
|
||||
|
||||
Similar to Analytics on the web, it's important to understand the user journey within your application, for example
|
||||
Similar to Analytics on the web, it's important to understand the user's journey within your application, for example
|
||||
tracking drop off points during a e-commerce transaction flow. The Analytics package provides a method called
|
||||
`setCurrentScreen` to help track this.
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ Phone authentication allows users to sign in to Firebase using their phone as th
|
||||
to the user via their phone number containing a unique code. Once the code has been authorized, the user is able to
|
||||
sign in to Firebase.
|
||||
|
||||
Phone numbers that end users provide for authentication will be sent and stored by Google to improve our spam and abuse prevention across Google services, including but not limited to Firebase. **Developers should ensure they have appropriate end-user consent prior to using the Firebase Authentication phone number sign-in service.**
|
||||
|
||||
> Firebase Phone Auth is not supported in all countries. Please see their [FAQs](https://firebase.google.com/support/faq/#develop) for more information.
|
||||
|
||||
React Native Firebase provides two separate integration flows:
|
||||
@@ -23,10 +25,10 @@ The `signInWithPhoneNumber` method handles the entire authentication flow, howev
|
||||
error handling. Some Android devices may also automatically handle the incoming SMS code and authenticate the user
|
||||
automatically.
|
||||
|
||||
**Step 1**: Trigger phone auth
|
||||
|
||||
> Whilst testing, make sure you have [whitelisted your device](https://firebase.google.com/docs/auth/ios/phone-auth#test-with-whitelisted-phone-numbers).
|
||||
|
||||
**Step 1**: Trigger phone auth
|
||||
|
||||
```js
|
||||
import auth from '@react-native-firebase/auth';
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import { firebase } from '@react-native-firebase/auth';
|
||||
### Subscribe to auth state changes
|
||||
|
||||
Whenever a user performs an actions with your application, such as sign-in or signs-out, it is possible to subscribe
|
||||
to the events in realtime using the `onAuthStateChanged` method.
|
||||
to the events in real time using the `onAuthStateChanged` method.
|
||||
|
||||
```jsx
|
||||
import React, { useState, useEffect } from 'react';
|
||||
@@ -88,14 +88,14 @@ The user is able to clear their state by deleting the apps data/cache from the d
|
||||
React Native Firebase provides access to the majority of authentication providers available, including social providers
|
||||
including Facebook, Google, Twitter and Github, along with phone/SMS authentication.
|
||||
|
||||
_Our [guides](/guides?tags=auth) provide more in-depth explanations on provides and how to integrate them into your application._
|
||||
_Our [guides](../guides?tags=auth) provide more in-depth explanations on provides and how to integrate them into your application._
|
||||
|
||||
#### Anonymous Sign In
|
||||
|
||||
Some applications don't require authentication, which make it tricky to identify what users are doing throughout your app.
|
||||
If connecting with external APIs, it is also useful to add an extra layer of security by ensuring the users request is
|
||||
from the app. This can be achieved with the `signInAnonymously` method, which creates a new anonymous user which is
|
||||
persisted, allowing you to integrate with other services such as Analytics by providing a user id.
|
||||
persisted, allowing you to integrate with other services such as Analytics by providing a user ID.
|
||||
|
||||
```js
|
||||
import auth from '@react-native-firebase/auth';
|
||||
@@ -118,8 +118,8 @@ async function bootstrap() {
|
||||
|
||||
#### Email/Password Sign In
|
||||
|
||||
Email/Password sign in is a common method for user sign in on applications. This requires the user to provide
|
||||
an email address and secure password. Users can both register and sign in in one method called
|
||||
Email/password sign in is a common method for user sign in on applications. This requires the user to provide
|
||||
an email address and secure password. Users can both register and sign in using a method called
|
||||
`createUserWithEmailAndPassword`, or sign in to an existing account with `signInWithEmailAndPassword`.
|
||||
|
||||
Users must first register using the `createUserWithEmailAndPassword` method
|
||||
|
||||
@@ -17,7 +17,7 @@ React Native Firebase requires the following platform versions:
|
||||
|
||||
## Firebase Modules
|
||||
|
||||
Each Firebase module is published as it's own package on [NPM](https://www.npmjs.com/) can be
|
||||
Each Firebase module is published as its own package on [NPM](https://www.npmjs.com/) can be
|
||||
individually installed using [`Yarn`](https://yarnpkg.com/lang/en/). Please refer to the quick start guide
|
||||
for installation instructions on each individual module page.
|
||||
|
||||
|
||||
67
packages/admob/lib/index.d.ts
vendored
67
packages/admob/lib/index.d.ts
vendored
@@ -20,19 +20,15 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
/**
|
||||
* Firebase Admob package for React Native.
|
||||
*
|
||||
* #### Example 1
|
||||
* #### Example: access the Firebase export from the `admob` package:
|
||||
*
|
||||
* Access the firebase export from the `admob` package:
|
||||
*
|
||||
* ```js
|
||||
* ```jS
|
||||
* import { firebase } from '@react-native-firebase/admob';
|
||||
*
|
||||
* // firebase.admob().X
|
||||
* ```
|
||||
*
|
||||
* #### Example 2
|
||||
*
|
||||
* Using the default export from the `admob` package:
|
||||
* #### Example: Using the default export from the `admob` package:
|
||||
*
|
||||
* ```js
|
||||
* import admob from '@react-native-firebase/admob';
|
||||
@@ -40,9 +36,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
* // admob().X
|
||||
* ```
|
||||
*
|
||||
* #### Example 3
|
||||
*
|
||||
* Using the default export from the `app` package:
|
||||
* #### Example: Using the default export from the `app` package:
|
||||
*
|
||||
* ```js
|
||||
* import firebase from '@react-native-firebase/app';
|
||||
@@ -96,12 +90,24 @@ export namespace Admob {
|
||||
*/
|
||||
export enum AdEventType {
|
||||
/**
|
||||
* When a ad has loaded. At this point, the ad is ready to be shown to the user.
|
||||
* When an ad has loaded. At this point, the ad is ready to be shown to the user.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* import { AdEventType } from '@react-native-firebase/admob';
|
||||
*
|
||||
* advert.onAdEvent((type,error,data) => {
|
||||
* if (type === AdEventType.LOADED) {
|
||||
* advert.show();
|
||||
* }
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
LOADED = 'loaded',
|
||||
|
||||
/**
|
||||
* The ad errored. See the error parameter the listener callback for more information.
|
||||
* The ad has thrown an error. See the error parameter the listener callback for more information.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
@@ -118,7 +124,7 @@ export namespace Admob {
|
||||
ERROR = 'error',
|
||||
|
||||
/**
|
||||
* The ad opened and is currently visible to the user. This event is received after the `show()`
|
||||
* The ad opened and is currently visible to the user. This event is fired after the `show()`
|
||||
* method has been called.
|
||||
*/
|
||||
OPENED = 'opened',
|
||||
@@ -146,7 +152,7 @@ export namespace Admob {
|
||||
*/
|
||||
export enum RewardedAdEventType {
|
||||
/**
|
||||
* When a rewarded ad has loaded.
|
||||
* An event fired when a rewarded ad has loaded.
|
||||
*
|
||||
* This type differs from `AdEventType.LOADED` as when a rewarded ad is loaded,
|
||||
* an additional data payload is provided to the event handler containing the ad reward
|
||||
@@ -161,7 +167,9 @@ export namespace Admob {
|
||||
*
|
||||
* rewardedAd.onAdEvent((type, error, data) => {
|
||||
* if (type === RewardedAdEventType.LOADED) {
|
||||
* console.log('Rewarded Ad loaded with reward:', data);
|
||||
* console.log(`Rewarded Ad loaded with ${data.amount} ${data.type} as reward`);
|
||||
* // E.g. "Rewarded Ad loaded with 50 coins as reward"
|
||||
* rewardedAd.show();
|
||||
* }
|
||||
* });
|
||||
* ```
|
||||
@@ -170,7 +178,7 @@ export namespace Admob {
|
||||
|
||||
/**
|
||||
* An event fired when the user earned the reward for the video. If the user does not earn a reward,
|
||||
* the AdEventType.CLOSED` event will be fired with no rewarded event.
|
||||
* the `AdEventType.CLOSED` event will be fired with no rewarded event.
|
||||
*
|
||||
* The reward contains a `type` and `amount`.
|
||||
*
|
||||
@@ -181,7 +189,8 @@ export namespace Admob {
|
||||
*
|
||||
* rewardedAd.onAdEvent((type, error, data) => {
|
||||
* if (type === RewardedAdEventType.EARNED_REWARD) {
|
||||
* console.log('User earned the reward:', data);
|
||||
* console.log(`User earned ${data.amount} ${data.type}`);
|
||||
* // E.g. "User earned 50 coins"
|
||||
* }
|
||||
* });
|
||||
* ```
|
||||
@@ -204,7 +213,7 @@ export namespace Admob {
|
||||
* (such as AdID) to serve ads. This policy reflects the requirements of the EU ePrivacy Directive and the
|
||||
* General Data Protection Regulation (GDPR).
|
||||
*
|
||||
* It is recommended that you determine the status of a user's consent ay every app launch. The user consent status is held
|
||||
* It is recommended that you determine the status of a user's consent at every app launch. The user consent status is held
|
||||
* on the device until a condition changes which requires the user to consent again, such as a change in publishers.
|
||||
*
|
||||
* For more information, see [here](https://developers.google.com/admob/android/eu-consent#delay_app_measurement_optional).
|
||||
@@ -349,7 +358,7 @@ export namespace Admob {
|
||||
* This method is used when providing your own means of user consent. If using the Google-rendered form via `showForm()`,
|
||||
* the consent status is automatically set and calling this method is not required.
|
||||
*
|
||||
* This method can also be used to reset the consent status (via UNKNOWN) which may be useful in certain circumstances.
|
||||
* This method can also be used to reset the consent status, by setting it to `AdsConsentStatus.UNKNOWN`, which may be useful in certain circumstances.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
@@ -372,7 +381,7 @@ export namespace Admob {
|
||||
/**
|
||||
* Returns the current consent status of the user.
|
||||
*
|
||||
* > Do not persist the user consent status locally.
|
||||
* > The user consent status may change at any time, therefore don't reuse old values locally and always request the current value at any time consent is required.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
@@ -388,7 +397,7 @@ export namespace Admob {
|
||||
|
||||
/**
|
||||
* If a publisher is aware that the user is under the age of consent, all ad requests must set TFUA (Tag For Users
|
||||
* under the Age of Consent in Europe). This setting takes effect for all future ad requests.
|
||||
* Under the Age of consent in Europe). This setting takes effect for all future ad requests.
|
||||
*
|
||||
* Once the TFUA setting is enabled, the Google-rendered consent form will fail to load. All ad requests that include
|
||||
* TFUA will be made ineligible for personalized advertising and remarketing. TFUA disables requests to third-party
|
||||
@@ -423,28 +432,28 @@ export namespace Admob {
|
||||
}
|
||||
|
||||
/**
|
||||
* The options used to show on the Google-rendered consent form.
|
||||
* The options used to show on the Google-rendered consent form. At least one of `withAdFree`, `withPersonalizedAds` and `WithNonPersonalizedAds` needs to be set to `true`.
|
||||
*/
|
||||
export interface AdsConsentFormOptions {
|
||||
/**
|
||||
* A fully formed HTTP or HTTPS privacy policy URL for your application.
|
||||
*
|
||||
* Users will have the option to visit this webpage before consenting to ads.
|
||||
* Users will have the option to visit this web page before consenting to ads.
|
||||
*/
|
||||
privacyPolicy: string;
|
||||
|
||||
/**
|
||||
* Set to `true` to provide the option for the user to accept being shown personalized ads.
|
||||
* Set to `true` to provide the option for the user to accept being shown personalized ads, defaults to `false`.
|
||||
*/
|
||||
withPersonalizedAds?: boolean;
|
||||
|
||||
/**
|
||||
* Set to `true` to provide the option for the user to accept being shown non-personalized ads.
|
||||
* Set to `true` to provide the option for the user to accept being shown non-personalized ads, defaults to `false`.
|
||||
*/
|
||||
withNonPersonalizedAds?: boolean;
|
||||
|
||||
/**
|
||||
* Set to `true` to provide the option for the user to choose an ad-free version of your app.
|
||||
* Set to `true` to provide the option for the user to choose an ad-free version of your app, defaults to `false`.
|
||||
*
|
||||
* If the user chooses this option, you must handle it as required (e.g. navigating to a paid version of the app,
|
||||
* or a subscribe view).
|
||||
@@ -744,7 +753,7 @@ export namespace Admob {
|
||||
*/
|
||||
export interface RewardedAdReward {
|
||||
/**
|
||||
* The reward type, e.g. 'coins', 'diamonds'.
|
||||
* The reward name, e.g. 'coins', 'diamonds'.
|
||||
*/
|
||||
type: string;
|
||||
|
||||
@@ -761,13 +770,13 @@ export namespace Admob {
|
||||
/**
|
||||
* @param type The event type, e.g. `AdEventType.LOADED`.
|
||||
* @param error An optional JavaScript Error containing the error code and message.
|
||||
* @param data Optional data for the event, e.g. rewarded
|
||||
* @param data Optional data for the event, e.g. reward type and amount
|
||||
*/
|
||||
(type: AdEventType | RewardedAdEventType, error?: Error, data?: any | RewardedAdReward): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Base call for InterstitialAd, RewardedAd and NativeAd.
|
||||
* Base class for InterstitialAd, RewardedAd, NativeAd and BannerAd.
|
||||
*/
|
||||
export class MobileAd {
|
||||
/**
|
||||
|
||||
22
packages/analytics/lib/index.d.ts
vendored
22
packages/analytics/lib/index.d.ts
vendored
@@ -20,9 +20,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
/**
|
||||
* Firebase Analytics package for React Native.
|
||||
*
|
||||
* #### Example 1
|
||||
*
|
||||
* Access the firebase export from the `analytics` package:
|
||||
* #### Example: Access the firebase export from the `analytics` package:
|
||||
*
|
||||
* ```js
|
||||
* import { firebase } from '@react-native-firebase/analytics';
|
||||
@@ -30,9 +28,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
* // firebase.analytics().X
|
||||
* ```
|
||||
*
|
||||
* #### Example 2
|
||||
*
|
||||
* Using the default export from the `analytics` package:
|
||||
* #### Example: Using the default export from the `analytics` package:
|
||||
*
|
||||
* ```js
|
||||
* import analytics from '@react-native-firebase/analytics';
|
||||
@@ -40,9 +36,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
* // analytics().X
|
||||
* ```
|
||||
*
|
||||
* #### Example 3
|
||||
*
|
||||
* Using the default export from the `app` package:
|
||||
* #### Example: Using the default export from the `app` package:
|
||||
*
|
||||
* ```js
|
||||
* import firebase from '@react-native-firebase/app';
|
||||
@@ -164,13 +158,13 @@ export namespace Analytics {
|
||||
* await firebase.analytics().setUserId(null);
|
||||
* ```
|
||||
*
|
||||
* @param id Set to null to remove a previously assigned id from analytics
|
||||
* @param id Set to null to remove a previously assigned ID from analytics
|
||||
* events
|
||||
*/
|
||||
setUserId(id: string | null): Promise<void>;
|
||||
|
||||
/**
|
||||
* Sets a key/value pair of data on the current user.
|
||||
* Sets a key/value pair of data on the current user. Each Firebase project can have up to 25 uniquely named (case-sensitive) user properties.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
@@ -179,12 +173,12 @@ export namespace Analytics {
|
||||
* ```
|
||||
*
|
||||
* @param name A user property identifier.
|
||||
* @param value Set to null to remove a previously assigned id from analytics events.
|
||||
* @param value Set to null to remove a previously assigned ID from analytics events.
|
||||
*/
|
||||
setUserProperty(name: string, value: string | null): Promise<void>;
|
||||
|
||||
/**
|
||||
* Sets multiple key/value pair of data on the current user.
|
||||
* Sets multiple key/value pairs of data on the current user. Each Firebase project can have up to 25 uniquely named (case-sensitive) user properties.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
@@ -195,6 +189,8 @@ export namespace Analytics {
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* > When you set user properties, be sure to never include personally identifiable information such as names, social security numbers, or email addresses, even in hashed form.
|
||||
*
|
||||
* @react-native-firebase
|
||||
* @param properties Set a property value to null to remove it.
|
||||
*/
|
||||
|
||||
69
packages/auth/lib/index.d.ts
vendored
69
packages/auth/lib/index.d.ts
vendored
@@ -20,9 +20,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
/**
|
||||
* Firebase Authentication package for React Native.
|
||||
*
|
||||
* #### Example 1
|
||||
*
|
||||
* Access the firebase export from the `auth` package:
|
||||
* #### Example: Access the firebase export from the `auth` package:
|
||||
*
|
||||
* ```js
|
||||
* import { firebase } from '@react-native-firebase/auth';
|
||||
@@ -30,9 +28,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
* // firebase.auth().X
|
||||
* ```
|
||||
*
|
||||
* #### Example 2
|
||||
*
|
||||
* Using the default export from the `auth` package:
|
||||
* #### Example: Using the default export from the `auth` package:
|
||||
*
|
||||
* ```js
|
||||
* import auth from '@react-native-firebase/auth';
|
||||
@@ -40,9 +36,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
* // auth().X
|
||||
* ```
|
||||
*
|
||||
* #### Example 3
|
||||
*
|
||||
* Using the default export from the `app` package:
|
||||
* #### Example: Using the default export from the `app` package:
|
||||
*
|
||||
* ```js
|
||||
* import firebase from '@react-native-firebase/app';
|
||||
@@ -167,9 +161,21 @@ export namespace Auth {
|
||||
*
|
||||
*/
|
||||
export interface PhoneAuthState {
|
||||
/**
|
||||
* The timeout specified in {@link auth#verifyPhoneNumber} has expired.
|
||||
*/
|
||||
CODE_SENT: 'sent';
|
||||
/**
|
||||
* SMS message with verification code sent to phone number.
|
||||
*/
|
||||
AUTO_VERIFY_TIMEOUT: 'timeout';
|
||||
/**
|
||||
* Phone number auto-verification succeeded.
|
||||
*/
|
||||
AUTO_VERIFIED: 'verified';
|
||||
/**
|
||||
* Phone number verification failed with an error.
|
||||
*/
|
||||
ERROR: 'error';
|
||||
}
|
||||
|
||||
@@ -277,7 +283,7 @@ export namespace Auth {
|
||||
*/
|
||||
isNewUser: boolean;
|
||||
/**
|
||||
* Returns a Object containing IDP-specific user data if the provider is one of Facebook,
|
||||
* Returns an Object containing IDP-specific user data if the provider is one of Facebook,
|
||||
* GitHub, Google, Twitter, Microsoft, or Yahoo.
|
||||
*/
|
||||
profile?: Object;
|
||||
@@ -488,33 +494,41 @@ export namespace Auth {
|
||||
*/
|
||||
export interface ActionCodeSettingsAndroid {
|
||||
/**
|
||||
* The Android Package Name.
|
||||
* Sets the Android package name. This will try to open the link in an android app if it is installed.
|
||||
*/
|
||||
packageName: string;
|
||||
/**
|
||||
* The preference for whether to attempt to install the app if it is not present.
|
||||
* If installApp is passed, it specifies whether to install the Android app if the device supports it and the app is not already installed. If this field is provided without a packageName, an error is thrown explaining that the packageName must be provided in conjunction with this field.
|
||||
*/
|
||||
installApp?: boolean;
|
||||
/**
|
||||
* The minimum Android app version.
|
||||
* If minimumVersion is specified, and an older version of the app is installed, the user is taken to the Play Store to upgrade the app. The Android app needs to be registered in the Console.
|
||||
*/
|
||||
minimumVersion?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional data returned from a {@link auth#checkActionCode} call.
|
||||
* For the PASSWORD_RESET, VERIFY_EMAIL, and RECOVER_EMAIL actions, this object contains an email field with the address the email was sent to.
|
||||
* For the RECOVER_EMAIL action, which allows a user to undo an email address change, this object also contains a fromEmail field with the user account's new email address. After the action completes, the user's email address will revert to the value in the email field from the value in fromEmail field.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const actionCodeInfo = await firebase.auth().checkActionCode('ABCD');
|
||||
*
|
||||
*Data
|
||||
* console.log('Action code email: ', actionCodeInfo.data.email);
|
||||
* console.log('Action code from email: ', actionCodeInfo.data.fromEmail);
|
||||
* ```
|
||||
*/
|
||||
export interface ActionCodeInfoData {
|
||||
/**
|
||||
* This signifies the email before the call was made.
|
||||
*/
|
||||
email?: string;
|
||||
/**
|
||||
* This signifies the current email associated with the account, which may have changed as a result of the {@link auth#checkActionCode} call performed.
|
||||
*/
|
||||
fromEmail?: string;
|
||||
}
|
||||
|
||||
@@ -530,8 +544,8 @@ export namespace Auth {
|
||||
*/
|
||||
export interface ActionCodeInfo {
|
||||
/**
|
||||
* Additional action code data.
|
||||
*/
|
||||
* The data associated with the action code.
|
||||
*/
|
||||
data: ActionCodeInfoData;
|
||||
/**
|
||||
* The operation from where the action originated.
|
||||
@@ -555,7 +569,7 @@ export namespace Auth {
|
||||
*/
|
||||
export interface ActionCodeSettingsIos {
|
||||
/**
|
||||
* An iOS build ID.
|
||||
* Sets the iOS bundle ID. This will try to open the link in an iOS app if it is installed. The iOS app needs to be registered in the Console.
|
||||
*/
|
||||
bundleId?: string;
|
||||
}
|
||||
@@ -579,7 +593,7 @@ export namespace Auth {
|
||||
android?: ActionCodeSettingsAndroid;
|
||||
|
||||
/**
|
||||
* Whether the code should be handled by the app.
|
||||
* Whether the email action link will be opened in a mobile app or a web link first. The default is false. When set to true, the action code link will be be sent as a Universal Link or Android App Link and will be opened by the app if installed. In the false case, the code will be sent to the web widget first and then on continue will redirect to the app if installed.
|
||||
*/
|
||||
handleCodeInApp?: boolean;
|
||||
|
||||
@@ -589,12 +603,12 @@ export namespace Auth {
|
||||
iOS?: ActionCodeSettingsIos;
|
||||
|
||||
/**
|
||||
* Sets the Dynamic Links domain
|
||||
* Sets the dynamic link domain (or subdomain) to use for the current link if it is to be opened using Firebase Dynamic Links. As multiple dynamic link domains can be configured per project, this field provides the ability to explicitly choose one. If none is provided, the first domain is used by default.
|
||||
*/
|
||||
dynamicLinkDomain?: string;
|
||||
|
||||
/**
|
||||
* Sets the URL for the action.
|
||||
* This URL represents the state/Continue URL in the form of a universal link. This URL can should be constructed as a universal link that would either directly open the app where the action code would be handled or continue to the app after the action code is handled by Firebase.
|
||||
*/
|
||||
url: string;
|
||||
}
|
||||
@@ -767,7 +781,7 @@ export namespace Auth {
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* > Used when no `onRejected` handler is passed to the `then`.
|
||||
* > Used when no `onRejected` handler is passed to {@link auth.PhoneAuthListener#then}.
|
||||
*
|
||||
* @param onRejected Rejected promise handler.
|
||||
*/
|
||||
@@ -786,7 +800,9 @@ export namespace Auth {
|
||||
*/
|
||||
export interface AuthSettings {
|
||||
/**
|
||||
* iOS only flag to determine whether app verification should be disabled for testing or not.
|
||||
* iOS only flag to disable app verification for the purpose of testing phone authentication. For this property to take effect, it needs to be set before rendering a reCAPTCHA app verifier. When this is disabled, a mock reCAPTCHA is rendered instead. This is useful for manual testing during development or for automated integration tests.
|
||||
*
|
||||
* > In order to use this feature, you will need to [whitelist your phone number](https://firebase.google.com/docs/auth/web/phone-auth#test-with-whitelisted-phone-numbers) via the Firebase Console.
|
||||
*
|
||||
* @platform iOS
|
||||
* @param disabled Boolean value representing whether app verification should be disabled for testing.
|
||||
@@ -794,12 +810,11 @@ export namespace Auth {
|
||||
appVerificationDisabledForTesting: boolean;
|
||||
|
||||
/**
|
||||
* The phone number and SMS code here must have been configured in the
|
||||
* Firebase Console (Authentication > Sign In Method > Phone).
|
||||
*
|
||||
* Calling this method a second time will overwrite the previously passed parameters.
|
||||
* Only one number can be configured at a given time.
|
||||
*
|
||||
* > The phone number and SMS code here must have been configured in the Firebase Console (Authentication > Sign In Method > Phone).
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
@@ -1206,7 +1221,7 @@ export namespace Auth {
|
||||
onAuthStateChanged(listener: AuthListenerCallback): () => void;
|
||||
|
||||
/**
|
||||
* Listen for changes in id token.
|
||||
* Listen for changes in ID token.
|
||||
* This method returns a unsubscribe function to stop listening to events.
|
||||
* Always ensure you unsubscribe from the listener when no longer needed to prevent updates to components no longer in use.
|
||||
*
|
||||
@@ -1314,7 +1329,7 @@ export namespace Auth {
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @param phoneNumber The user's phone number in E.164 format (e.g. +16505550101).
|
||||
* @param phoneNumber The phone number identifier supplied by the user. Its format is normalized on the server, so it can be in any format here. (e.g. +16505550101).
|
||||
* @param autoVerifyTimeoutOrForceResend If a number, sets in seconds how to to wait until auto verification times out. If boolean, sets the `forceResend` parameter.
|
||||
* @param forceResend If true, resend the verification message even if it was recently sent.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user