Merge branch 'master' into perf

This commit is contained in:
Elliot Hesp
2018-07-18 16:15:28 +01:00
committed by GitHub
26 changed files with 280 additions and 105 deletions

View File

@@ -75,9 +75,15 @@ coverage
yarn.lock
tests
bridge/
lib/.watchmanconfig
buddybuild_postclone.sh
bin/test.js
.github
example
codorials
.vscode
.nyc_output
React-Native-Firebase.svg
CONTRIBUTING.md
CODE_OF_CONDUCT.md
android/.settings
README.md

View File

@@ -36,6 +36,9 @@ android {
}
productFlavors {
}
lintOptions {
disable 'GradleCompatible'
}
}
rootProject.gradle.buildFinished { buildResult ->
@@ -68,7 +71,8 @@ rootProject.gradle.buildFinished { buildResult ->
logger.log(LogLevel.ERROR, "| |")
logger.log(LogLevel.ERROR, " ----------------------------------------------------------- ")
}
} catch (Exception exception) {}
} catch (Exception exception) {
}
}
}

View File

@@ -2,4 +2,6 @@
package="io.invertase.firebase">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>

View File

@@ -174,7 +174,11 @@ public class RNFirebaseLinks extends ReactContextBaseJavaModule implements Activ
// Looks at the internals of the link data to detect whether it's an invitation or not
private boolean isInvitation(PendingDynamicLinkData pendingDynamicLinkData) {
return FirebaseAppInvite.getInvitation(pendingDynamicLinkData) != null;
FirebaseAppInvite invite = FirebaseAppInvite.getInvitation(pendingDynamicLinkData);
if (invite != null && invite.getInvitationId() != null && !invite.getInvitationId().isEmpty()) {
return true;
}
return false;
}
private DynamicLink.Builder getDynamicLinkBuilder(final ReadableMap linkData) {

View File

@@ -36,6 +36,7 @@ import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
@@ -357,6 +358,21 @@ public class RNFirebaseNotificationManager {
notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
if (schedule.containsKey("repeatInterval")) {
// If fireDate you specify is in the past, the alarm triggers immediately.
// So we need to adjust the time for correct operation.
if (fireDate < System.currentTimeMillis()) {
Calendar newFireDate = Calendar.getInstance();
Calendar currentFireDate = Calendar.getInstance();
currentFireDate.setTimeInMillis(fireDate);
newFireDate.add(Calendar.DATE, 1);
newFireDate.set(Calendar.HOUR_OF_DAY, currentFireDate.get(Calendar.HOUR_OF_DAY));
newFireDate.set(Calendar.MINUTE, currentFireDate.get(Calendar.MINUTE));
newFireDate.set(Calendar.SECOND, currentFireDate.get(Calendar.SECOND));
fireDate = newFireDate.getTimeInMillis();
}
Long interval = null;
switch (schedule.getString("repeatInterval")) {
case "minute":

View File

@@ -65,18 +65,45 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- App Links -->
<intent-filter android:autoVerify="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="je786.app.goo.gl"
android:scheme="http" />
android:scheme="http"
android:host="je786.app.goo.gl" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="je786.app.goo.gl"
android:scheme="https" />
android:scheme="http"
android:host="je786.app.goo.gl" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="je786.app.goo.gl" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="je786.app.goo.gl" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />

View File

@@ -32,6 +32,10 @@ public class MainActivity extends ReactActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
checkWindowPerms();
// ATTENTION: This was auto-generated to handle app links.
Intent appLinkIntent = getIntent();
String appLinkAction = appLinkIntent.getAction();
Uri appLinkData = appLinkIntent.getData();
}
public void checkWindowPerms() {

View File

@@ -10,13 +10,56 @@ describe('iid()', () => {
it('deletes the current instance id', async () => {
const iidBefore = await firebase.iid().get();
iidBefore.should.be.a.String();
await firebase.iid().delete();
const iidAfter = await firebase.iid().get();
iidAfter.should.be.a.String();
iidBefore.should.not.equal(iidAfter);
});
});
describe('getToken()', () => {
it('should return an FCM token from getToken with arguments', async () => {
const authorizedEntity = firebase.iid().app.options.messagingSenderId;
await firebase.iid().delete();
const token = await firebase.iid().getToken(authorizedEntity, '*');
token.should.be.a.String();
});
it('should return an FCM token from getToken without arguments', async () => {
await firebase.iid().delete();
const token = await firebase.iid().getToken();
token.should.be.a.String();
});
it('should return an FCM token from getToken with 1 argument', async () => {
const authorizedEntity = firebase.iid().app.options.messagingSenderId;
await firebase.iid().delete();
const token = await firebase.iid().getToken(authorizedEntity);
token.should.be.a.String();
});
});
describe('deleteToken()', () => {
it('should return nil from deleteToken with arguments', async () => {
const authorizedEntity = firebase.iid().app.options.messagingSenderId;
const token = await firebase.iid().deleteToken(authorizedEntity, '*');
should.not.exist(token);
});
it('should return nil from deleteToken without arguments', async () => {
const token = await firebase.iid().deleteToken();
should.not.exist(token);
});
it('should return nil from deleteToken with 1 argument', async () => {
const authorizedEntity = firebase.iid().app.options.messagingSenderId;
const token = await firebase.iid().deleteToken(authorizedEntity);
should.not.exist(token);
});
});
});

View File

@@ -49,6 +49,18 @@ describe('storage()', () => {
.downloadFile(
`${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/ok.jpeg`
);
await firebase
.storage()
.ref('/cat.gif')
.downloadFile(
`${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/cat.gif`
);
await firebase
.storage()
.ref('/hei.heic')
.downloadFile(
`${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/hei.heic`
);
});
it('errors if permission denied', async () => {
@@ -75,6 +87,20 @@ describe('storage()', () => {
`${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/ok.jpeg`
);
await firebase
.storage()
.ref('/uploadCat.gif')
.putFile(
`${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/cat.gif`
);
await firebase
.storage()
.ref('/uploadHei.heic')
.putFile(
`${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/hei.heic`
);
uploadTaskSnapshot.state.should.eql(firebase.storage.TaskState.SUCCESS);
uploadTaskSnapshot.bytesTransferred.should.eql(
uploadTaskSnapshot.totalBytes

View File

@@ -18,21 +18,21 @@ target 'testing' do
'RCTWebSocket',
]
pod 'Firebase/AdMob'
pod 'Firebase/Auth'
pod 'Firebase/Core'
pod 'Firebase/Crash'
pod 'Firebase/Database'
pod 'Firebase/Functions'
pod 'Firebase/DynamicLinks'
pod 'Firebase/Firestore'
pod 'Firebase/Invites'
pod 'Firebase/Messaging'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Storage'
pod 'Firebase/Performance'
pod 'Firebase/AdMob', '~> 5.3.0'
pod 'Firebase/Auth', '~> 5.3.0'
pod 'Firebase/Core', '~> 5.3.0'
pod 'Firebase/Crash', '~> 5.3.0'
pod 'Firebase/Database', '~> 5.3.0'
pod 'Firebase/Functions', '~> 5.3.0'
pod 'Firebase/DynamicLinks', '~> 5.3.0'
pod 'Firebase/Firestore', '~> 5.3.0'
pod 'Firebase/Invites', '~> 5.3.0'
pod 'Firebase/Messaging', '~> 5.3.0'
pod 'Firebase/RemoteConfig', '~> 5.3.0'
pod 'Firebase/Storage', '~> 5.3.0'
pod 'Firebase/Performance', '~> 5.3.0'
pod 'Fabric', '~> 1.7.5'
pod 'Crashlytics', '~> 3.10.1'
pod 'Crashlytics', '~> 3.10.4'
pod 'RNFirebase', :path => '../../ios/RNFirebase.podspec'

View File

@@ -5,9 +5,9 @@ PODS:
- BoringSSL/Implementation (10.0.5):
- BoringSSL/Interface (= 10.0.5)
- BoringSSL/Interface (10.0.5)
- Crashlytics (3.10.2):
- Fabric (~> 1.7.7)
- Fabric (1.7.7)
- Crashlytics (3.10.4):
- Fabric (~> 1.7.9)
- Fabric (1.7.9)
- Firebase/AdMob (5.3.0):
- Firebase/Core
- Google-Mobile-Ads-SDK (= 7.31.0)
@@ -162,25 +162,27 @@ PODS:
- GoogleToolboxForMac/Defines (= 2.1.4)
- "GoogleToolboxForMac/NSDictionary+URLArguments (= 2.1.4)"
- "GoogleToolboxForMac/NSString+URLArguments (= 2.1.4)"
- gRPC (1.12.0):
- gRPC-RxLibrary (= 1.12.0)
- gRPC/Main (= 1.12.0)
- gRPC-Core (1.12.0):
- gRPC-Core/Implementation (= 1.12.0)
- gRPC-Core/Interface (= 1.12.0)
- gRPC-Core/Implementation (1.12.0):
- gRPC (1.13.0):
- gRPC-RxLibrary (= 1.13.0)
- gRPC/Main (= 1.13.0)
- gRPC-Core (1.13.0):
- gRPC-Core/Implementation (= 1.13.0)
- gRPC-Core/Interface (= 1.13.0)
- gRPC-Core/Implementation (1.13.0):
- BoringSSL (~> 10.0)
- gRPC-Core/Interface (= 1.12.0)
- gRPC-Core/Interface (= 1.13.0)
- nanopb (~> 0.3)
- gRPC-Core/Interface (1.12.0)
- gRPC-ProtoRPC (1.12.0):
- gRPC (= 1.12.0)
- gRPC-RxLibrary (= 1.12.0)
- gRPC-Core/Interface (1.13.0)
- gRPC-ProtoRPC (1.13.0):
- gRPC-ProtoRPC/Main (= 1.13.0)
- gRPC-ProtoRPC/Main (1.13.0):
- gRPC (= 1.13.0)
- gRPC-RxLibrary (= 1.13.0)
- Protobuf (~> 3.0)
- gRPC-RxLibrary (1.12.0)
- gRPC/Main (1.12.0):
- gRPC-Core (= 1.12.0)
- gRPC-RxLibrary (= 1.12.0)
- gRPC-RxLibrary (1.13.0)
- gRPC/Main (1.13.0):
- gRPC-Core (= 1.13.0)
- gRPC-RxLibrary (= 1.13.0)
- GTMOAuth2 (1.1.6):
- GTMSessionFetcher (~> 1.1)
- GTMSessionFetcher (1.1.15):
@@ -216,21 +218,21 @@ PODS:
- yoga (0.55.3.React)
DEPENDENCIES:
- Crashlytics (~> 3.10.1)
- Crashlytics (~> 3.10.4)
- Fabric (~> 1.7.5)
- Firebase/AdMob
- Firebase/Auth
- Firebase/Core
- Firebase/Crash
- Firebase/Database
- Firebase/DynamicLinks
- Firebase/Firestore
- Firebase/Functions
- Firebase/Invites
- Firebase/Messaging
- Firebase/Performance
- Firebase/RemoteConfig
- Firebase/Storage
- Firebase/AdMob (~> 5.3.0)
- Firebase/Auth (~> 5.3.0)
- Firebase/Core (~> 5.3.0)
- Firebase/Crash (~> 5.3.0)
- Firebase/Database (~> 5.3.0)
- Firebase/DynamicLinks (~> 5.3.0)
- Firebase/Firestore (~> 5.3.0)
- Firebase/Functions (~> 5.3.0)
- Firebase/Invites (~> 5.3.0)
- Firebase/Messaging (~> 5.3.0)
- Firebase/Performance (~> 5.3.0)
- Firebase/RemoteConfig (~> 5.3.0)
- Firebase/Storage (~> 5.3.0)
- React/Core (from `../node_modules/react-native`)
- React/RCTNetwork (from `../node_modules/react-native`)
- React/RCTText (from `../node_modules/react-native`)
@@ -284,8 +286,8 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
BoringSSL: cf3f1793eb6e3c445c4d150456341f149c268a35
Crashlytics: 0360624eea1c978a743feddb2fb1ef8b37fb7a0d
Fabric: bda89e242bce1b7b8ab264248cf3407774ce0095
Crashlytics: 915a7787b84f635fb2a81f92a90e265c2c413f76
Fabric: a2917d3895e4c1569b9c3170de7320ea1b1e6661
Firebase: 68afeeb05461db02d7c9e3215cda28068670f4aa
FirebaseABTesting: 1f50b8d50f5e3469eea54e7463a7b7fe221d1f5e
FirebaseAnalytics: b3628aea54c50464c32c393fb2ea032566e7ecc2
@@ -307,10 +309,10 @@ SPEC CHECKSUMS:
GoogleAPIClientForREST: f7951c455df271bc6259b3ddb4073d0026475ccf
GoogleSignIn: d9ef55b10f0aa401a5de2747f59b725e4b9732ac
GoogleToolboxForMac: 91c824d21e85b31c2aae9bb011c5027c9b4e738f
gRPC: 9362451032695e2dfb7bafcd3740e3a27939e4ff
gRPC-Core: 9696b220565b283e021cf2722d473a4a74b7622a
gRPC-ProtoRPC: a1bd56fb1991a8dae4581250d7259eddabb66779
gRPC-RxLibrary: 1ed5314e8b38cd6e55c9bfa048387136ae925ce9
gRPC: 81b990caa01d7c32605d300c2ffd1b5ba0ef9e49
gRPC-Core: a56b086a8ef5ced6f6ba5be5bc0a63fca185015a
gRPC-ProtoRPC: 842797fbe05dfcf891afb4a5048e5ccf5f06ef86
gRPC-RxLibrary: fa6852f98d6ec0b73c0ec2f6406c26943099d501
GTMOAuth2: c77fe325e4acd453837e72d91e3b5f13116857b2
GTMSessionFetcher: 5fa5b80fd20e439ef5f545fb2cb3ca6c6714caa2
leveldb-library: 08cba283675b7ed2d99629a4bc5fd052cd2bb6a5
@@ -320,6 +322,6 @@ SPEC CHECKSUMS:
RNFirebase: 2b25fd2e60269f26bb0a76c71dcc942b35a77df0
yoga: a23273df0088bf7f2bb7e5d7b00044ea57a2a54a
PODFILE CHECKSUM: 582ceaad051470812ad9203e13b5ea8ad20c78ac
PODFILE CHECKSUM: af3286375d5c28aa5d912b64dee23c8f7c4f9282
COCOAPODS: 1.5.3

View File

@@ -13,7 +13,7 @@
"test-android-reuse": "detox test --configuration android.emu.debug --reuse",
"test-android-cover": "nyc detox test --configuration android.emu.debug",
"test-android-cover-reuse": "nyc detox test --configuration android.emu.debug --reuse",
"test-ios": "detox test --configuration ios.sim.debug",
"test-ios": "detox test --configuration ios.sim.debug --loglevel warn",
"test-ios-reuse": "detox test --configuration ios.sim.debug --reuse --loglevel warn",
"test-ios-cover": "nyc detox test --configuration ios.sim.debug",
"test-ios-cover-reuse": "nyc detox test --configuration ios.sim.debug --reuse --loglevel warn",

View File

@@ -2,7 +2,7 @@
#define RNFirebaseCrashlytics_h
#import <Foundation/Foundation.h>
#if __has_include(<Crashlytics/Crashlytics.h>)
#if __has_include(<Crashlytics/Crashlytics/Crashlytics.h>)
#import <React/RCTBridgeModule.h>
@interface RNFirebaseCrashlytics : NSObject <RCTBridgeModule> {

View File

@@ -1,7 +1,7 @@
#import "RNFirebaseCrashlytics.h"
#if __has_include(<Crashlytics/Crashlytics.h>)
#import <Crashlytics/Crashlytics.h>
#if __has_include(<Crashlytics/Crashlytics/Crashlytics.h>)
#import <Crashlytics/Crashlytics/Crashlytics.h>
@implementation RNFirebaseCrashlytics
RCT_EXPORT_MODULE();

View File

@@ -1,7 +1,7 @@
#import "RNFirebaseInstanceId.h"
#if __has_include(<FirebaseInstanceID/FIRInstanceID.h>)
#import <FirebaseMessaging/FirebaseMessaging.h>
//#import <FirebaseMessaging/FirebaseMessaging.h>
#import <FirebaseInstanceID/FIRInstanceID.h>
@implementation RNFirebaseInstanceId
@@ -32,9 +32,9 @@ RCT_EXPORT_METHOD(getToken:(NSString *)authorizedEntity
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject) {
NSDictionary * options = nil;
if ([FIRMessaging messaging].APNSToken) {
options = @{@"apns_token": [FIRMessaging messaging].APNSToken};
}
// if ([FIRMessaging messaging].APNSToken) {
// options = @{@"apns_token": [FIRMessaging messaging].APNSToken};
// }
[[FIRInstanceID instanceID] tokenWithAuthorizedEntity:authorizedEntity scope:scope options:options handler:^(NSString * _Nullable identity, NSError * _Nullable error) {
if (error) {
reject(@"instance_id_error", @"Failed to getToken", error);

View File

@@ -60,11 +60,11 @@ continueUserActivity:(NSUserActivity *)userActivity
return [[FIRDynamicLinks dynamicLinks]
handleUniversalLink:userActivity.webpageURL
completion:^(FIRDynamicLink * _Nullable dynamicLink, NSError * _Nullable error) {
if (error != nil){
NSLog(@"Failed to handle universal link: %@", [error localizedDescription]);
} else {
NSURL* url = dynamicLink ? dynamicLink.url : userActivity.webpageURL;
if (dynamicLink && dynamicLink.url && error == nil) {
NSURL* url = dynamicLink.url;
[self sendJSEvent:self name:LINKS_LINK_RECEIVED body:url.absoluteString];
} else {
NSLog(@"Failed to handle universal link: %@", userActivity.webpageURL);
}
}];
}

View File

@@ -231,11 +231,15 @@ RCT_EXPORT_METHOD(putFile:(NSString *) appDisplayName
options.networkAccessAllowed = true;
[[PHImageManager defaultManager] requestImageDataForAsset:asset options:options resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
if (info[PHImageErrorKey] == nil) {
if (UTTypeConformsTo((__bridge CFStringRef)dataUTI, kUTTypeJPEG)) {
if (
UTTypeConformsTo((__bridge CFStringRef) dataUTI, kUTTypeJPEG) ||
UTTypeConformsTo((__bridge CFStringRef) dataUTI, kUTTypePNG) ||
UTTypeConformsTo((__bridge CFStringRef) dataUTI, kUTTypeGIF)
) {
firmetadata.contentType = [self utiToMimeType:dataUTI];
[self uploadData:appDisplayName data:imageData firmetadata:firmetadata path:path resolver:resolve rejecter:reject];
} else {
// if the image UTI is not JPEG then convert to JPEG, e.g. HEI
// all other image types are converted to JPEG, e.g. HEI
CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)imageData, NULL);
NSDictionary *imageInfo = (__bridge NSDictionary*)CGImageSourceCopyPropertiesAtIndex(source, 0, NULL);
NSDictionary *imageMetadata = [imageInfo copy];

4
lib/index.d.ts vendored
View File

@@ -1089,8 +1089,8 @@ declare module 'react-native-firebase' {
interface InstanceId {
delete(): Promise<void>;
get(): Promise<string>;
getToken(authorizedEntity: string, scope: string): Promise<string>;
deleteToken(authorizedEntity: string, scope: string): Promise<void>;
getToken(authorizedEntity?: string, scope?: string): Promise<string>;
deleteToken(authorizedEntity?: string, scope?: string): Promise<void>;
}
}

View File

@@ -32,6 +32,7 @@ export default class PhoneAuthListener {
_timeout: number;
_publicEvents: Object;
_internalEvents: Object;
_forceResending: boolean;
_reject: Function | null;
_resolve: Function | null;
_credential: Object | null;

View File

@@ -299,15 +299,15 @@ export default class Reference extends ReferenceBase {
* @param onComplete
* @returns {*}
*/
push(value: any, onComplete?: Function): ThenableReference<void> {
push(value: any, onComplete?: Function): Reference | Promise<void> {
if (value === null || value === undefined) {
return new ThenableReference(
return new Reference(
this._database,
`${this.path}/${generatePushID(this._database._serverTimeOffset)}`
);
}
const newRef = new ThenableReference(
const newRef = new Reference(
this._database,
`${this.path}/${generatePushID(this._database._serverTimeOffset)}`
);
@@ -894,10 +894,10 @@ export default class Reference extends ReferenceBase {
}
// eslint-disable-next-line no-unused-vars
declare class ThenableReference<+R> extends Reference {
then<U>(
onFulfill?: (value: R) => Promise<U> | U,
onReject?: (error: any) => Promise<U> | U
): Promise<U>;
catch<U>(onReject?: (error: any) => Promise<U> | U): Promise<R | U>;
}
// class ThenableReference<+R> extends Reference {
// then<U>(
// onFulfill?: (value: R) => Promise<U> | U,
// onReject?: (error: any) => Promise<U> | U
// ): Promise<U>;
// catch<U>(onReject?: (error: any) => Promise<U> | U): Promise<R | U>;
// }

View File

@@ -13,7 +13,12 @@ import { getNativeModule } from '../../utils/native';
import type Firestore from './';
import type Path from './Path';
import type { MetadataChanges, QueryDirection, QueryOperator } from './types';
import type {
MetadataChanges,
QueryDirection,
QueryOperator,
GetOptions,
} from './types';
const DIRECTIONS: { [QueryDirection]: string } = {
ASC: 'ASCENDING',

View File

@@ -27,7 +27,7 @@ export type NativeDocumentChange = {
document: NativeDocumentSnapshot,
newIndex: number,
oldIndex: number,
type: string,
type: 'added' | 'modified' | 'removed',
};
export type NativeDocumentSnapshot = {

View File

@@ -7,8 +7,8 @@ import { getNativeModule } from '../../utils/native';
import type App from '../core/app';
export const MODULE_NAME = 'RNFirebaseInstanceId';
export const NAMESPACE = 'iid';
export const MODULE_NAME = 'RNFirebaseInstanceId';
export default class InstanceId extends ModuleBase {
constructor(app: App) {
@@ -20,20 +20,51 @@ export default class InstanceId extends ModuleBase {
});
}
delete(): Promise<void> {
return getNativeModule(this).delete();
}
/**
* Get the current Instance ID.
*
* @returns {*}
*/
get(): Promise<string> {
return getNativeModule(this).get();
}
getToken(authorizedEntity: string, scope: string): Promise<string> {
return getNativeModule(this).getToken(authorizedEntity, scope);
/**
* Delete the current Instance ID.
*
* @returns {*}
*/
delete(): Promise<void> {
return getNativeModule(this).delete();
}
deleteToken(authorizedEntity: string, scope: string): Promise<void> {
return getNativeModule(this).deleteToken(authorizedEntity, scope);
/**
* Get a token that authorizes an Entity to perform an action on behalf
* of the application identified by Instance ID.
*
* @param authorizedEntity
* @param scope
* @returns {Promise<string>}
*/
getToken(authorizedEntity?: string, scope?: string): Promise<string> {
return getNativeModule(this).getToken(
authorizedEntity || this.app.options.messagingSenderId,
scope || '*'
);
}
/**
* Revokes access to a scope (action) for an entity previously authorized by getToken().
*
* @param authorizedEntity
* @param scope
* @returns {Promise<void>}
*/
deleteToken(authorizedEntity?: string, scope?: string): Promise<void> {
return getNativeModule(this).deleteToken(
authorizedEntity || this.app.options.messagingSenderId,
scope || '*'
);
}
}

View File

@@ -196,7 +196,7 @@ export function noop(): void {}
* @returns {*}
*/
export function stripTrailingSlash(str: string): string {
if (!str || !isString(str)) return str;
if (!isString(str)) return str;
return str.endsWith('/') ? str.slice(0, -1) : str;
}

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "react-native-firebase",
"version": "4.2.0",
"version": "4.3.7",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "react-native-firebase",
"version": "4.2.0",
"version": "4.3.7",
"author": "Invertase <contact@invertase.io> (http://invertase.io)",
"description": "A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Functions, Messaging (FCM), Remote Config, Storage and more.",
"main": "dist/index.js",
@@ -35,7 +35,7 @@
"setupFiles": [],
"unmockedModulePathPatterns": ["./node_modules/react", "./node_modules/react-native", "./node_modules/react-native-mock", "./node_modules/react-addons-test-utils"]
},
"license": "APACHE-2.0",
"license": "Apache-2.0",
"keywords": ["react", "admob", "auth", "config", "digits", "fabric", "functions", "phone-auth", "sms", "firestore", "cloud-firestore", "datastore", "remote-config", "transactions", "react-native", "react-native-firebase", "firebase", "fcm", "apn", "gcm", "analytics", "messaging", "database", "android", "ios", "crash", "firestack", "performance", "firestore", "dynamic-links", "crashlytics"],
"peerDependencies": {
"react": "*",