Merge pull request #1 from invertase/master

Taking updates
This commit is contained in:
Bilal Syed 2018-07-11 15:17:04 +03:00 committed by GitHub
commit 98ca66294d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 171 additions and 83 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,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

@ -7,7 +7,7 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1'
classpath 'com.google.firebase:firebase-plugins:1.1.1'
classpath 'io.fabric.tools:gradle:1.25.4'

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

@ -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

@ -196,6 +196,7 @@ export function noop(): void {}
* @returns {*}
*/
export function stripTrailingSlash(str: string): string {
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.4",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "react-native-firebase",
"version": "4.2.0",
"version": "4.3.4",
"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",