restructure source + fix linting issues from new eslint version

This commit is contained in:
Salakar 2018-08-05 02:32:50 +01:00
parent 94738ef4a6
commit 85321b5246
106 changed files with 332 additions and 79 deletions

1
.eslintignore Normal file
View File

@ -0,0 +1 @@
src/version.js

View File

@ -30,7 +30,8 @@
"no-plusplus": 0,
"no-undef": 0,
"no-underscore-dangle": "off",
"no-use-before-define": 0
"no-use-before-define": 0,
"import/no-cycle": 0
},
"globals": {
"__DEV__": true,

View File

View File

@ -60,12 +60,13 @@ class AdMobComponent extends React.Component {
* @param nativeEvent
*/
onBannerEvent = ({ nativeEvent }) => {
if (this.props[nativeEvent.type]) {
const { props } = this;
if (props[nativeEvent.type]) {
if (nativeEvent.type === 'onAdFailedToLoad') {
const { code, message } = nativeEvent.payload;
this.props[nativeEvent.type](nativeToJSError(code, message));
props[nativeEvent.type](nativeToJSError(code, message));
} else {
this.props[nativeEvent.type](nativeEvent.payload || {});
props[nativeEvent.type](nativeEvent.payload || {});
}
}
@ -87,10 +88,11 @@ class AdMobComponent extends React.Component {
* @returns {XML}
*/
render() {
const { style } = this.props;
return (
<this.nativeView
{...this.props}
style={[this.props.style, { ...this.state }]}
style={[style, { ...this.state }]}
onBannerEvent={this.onBannerEvent}
/>
);

View File

@ -1,10 +1,10 @@
import { Platform } from 'react-native';
import { statics } from './';
import { statics } from '.';
import AdRequest from './AdRequest';
import { SharedEventEmitter } from '../../utils/events';
import { getNativeModule } from '../../utils/native';
import { nativeToJSError } from '../../utils';
import type AdMob from './';
import type AdMob from '.';
let subscriptions = [];

View File

@ -1,9 +1,9 @@
import { statics } from './';
import { statics } from '.';
import AdRequest from './AdRequest';
import { SharedEventEmitter } from '../../utils/events';
import { getNativeModule } from '../../utils/native';
import { nativeToJSError } from '../../utils';
import type AdMob from './';
import type AdMob from '.';
let subscriptions = [];

View File

@ -34,6 +34,7 @@ export const NAMESPACE = 'admob';
export default class AdMob extends ModuleBase {
_appId: ?string;
_initialized: boolean;
constructor(app: App) {

View File

@ -5,7 +5,7 @@
import INTERNALS from '../../utils/internals';
import { getNativeModule } from '../../utils/native';
import type Auth from './';
import type Auth from '.';
import type {
ActionCodeSettings,
AuthCredential,
@ -22,6 +22,7 @@ type UpdateProfile = {
export default class User {
_auth: Auth;
_user: NativeUser;
/**

View File

@ -46,7 +46,9 @@ export const NAMESPACE = 'auth';
export default class Auth extends ModuleBase {
_authResult: boolean;
_languageCode: string;
_user: User | null;
constructor(app: App) {

View File

@ -3,11 +3,12 @@
* ConfirmationResult representation wrapper
*/
import { getNativeModule } from '../../../utils/native';
import type Auth from '../';
import type Auth from '..';
import type User from '../User';
export default class ConfirmationResult {
_auth: Auth;
_verificationId: string;
/**

View File

@ -11,7 +11,7 @@ import {
} from '../../../utils';
import { getNativeModule } from '../../../utils/native';
import type Auth from '../';
import type Auth from '..';
type PhoneAuthSnapshot = {
state: 'sent' | 'timeout' | 'verified' | 'error',
@ -29,14 +29,23 @@ type PhoneAuthError = {
export default class PhoneAuthListener {
_auth: Auth;
_timeout: number;
_publicEvents: Object;
_internalEvents: Object;
_forceResending: boolean;
_reject: Function | null;
_resolve: Function | null;
_credential: Object | null;
_promise: Promise<*> | null;
_phoneAuthRequestKey: string;
/**

View File

@ -33,25 +33,45 @@ const FirebaseCoreModule = NativeModules.RNFirebase;
export default class App {
_extendedProps: { [string]: boolean };
_initialized: boolean = false;
_name: string;
_nativeInitialized: boolean = false;
_options: FirebaseOptions;
admob: () => AdMob;
analytics: () => Analytics;
auth: () => Auth;
config: () => Config;
crashlytics: () => Crashlytics;
database: () => Database;
firestore: () => Firestore;
functions: () => Functions;
iid: () => InstanceId;
invites: () => Invites;
links: () => Links;
messaging: () => Messaging;
notifications: () => Notifications;
perf: () => Performance;
storage: () => Storage;
utils: () => Utils;
constructor(

View File

@ -95,20 +95,35 @@ const FirebaseCoreModule = NativeModules.RNFirebase;
class Firebase {
admob: AdMobModule;
analytics: AnalyticsModule;
auth: AuthModule;
config: ConfigModule;
crashlytics: CrashlyticsModule;
database: DatabaseModule;
firestore: FirestoreModule;
functions: FunctionsModule;
iid: InstanceIdModule;
invites: InvitesModule;
links: LinksModule;
messaging: MessagingModule;
notifications: NotificationsModule;
perf: PerformanceModule;
storage: StorageModule;
utils: UtilsModule;
constructor() {

View File

@ -2,7 +2,7 @@
* @flow
* DataSnapshot representation wrapper
*/
import { isObject, deepGet, deepExists } from './../../utils';
import { isObject, deepGet, deepExists } from '../../utils';
import type Reference from './Reference';
/**
@ -11,10 +11,13 @@ import type Reference from './Reference';
*/
export default class DataSnapshot {
ref: Reference;
key: string;
_value: any;
_priority: any;
_childKeys: Array<string>;
constructor(ref: Reference, snapshot: Object) {

View File

@ -4,7 +4,7 @@
*/
import { typeOf } from '../../utils';
import { getNativeModule } from '../../utils/native';
import type Database from './';
import type Database from '.';
import type Reference from './Reference';
/**
@ -13,7 +13,9 @@ import type Reference from './Reference';
*/
export default class OnDisconnect {
_database: Database;
ref: Reference;
path: string;
/**

View File

@ -14,6 +14,7 @@ import type Reference from './Reference';
*/
export default class Query {
_reference: Reference;
modifiers: Array<DatabaseModifier>;
constructor(ref: Reference, existingModifiers?: Array<DatabaseModifier>) {

View File

@ -21,7 +21,7 @@ import {
import SyncTree from '../../utils/SyncTree';
import type Database from './';
import type Database from '.';
import type { DatabaseModifier, FirebaseError } from '../../types';
// track all event registrations by path
@ -76,8 +76,11 @@ type DatabaseListener = {
*/
export default class Reference extends ReferenceBase {
_database: Database;
_promise: ?Promise<*>;
_query: Query;
_refListeners: { [listenerId: number]: DatabaseListener };
constructor(

View File

@ -25,8 +25,11 @@ export const NAMESPACE = 'database';
*/
export default class Database extends ModuleBase {
_offsetRef: Reference;
_serverTimeOffset: number;
_transactionHandler: TransactionHandler;
_serviceUrl: string;
constructor(appOrUrl: App | string, options: Object = {}) {

View File

@ -5,7 +5,7 @@
import { getAppEventName, SharedEventEmitter } from '../../utils/events';
import { getLogger } from '../../utils/log';
import { getNativeModule } from '../../utils/native';
import type Database from './';
import type Database from '.';
let transactionId = 0;
@ -21,6 +21,7 @@ const generateTransactionId = (): number => transactionId++;
*/
export default class TransactionHandler {
_database: Database;
_transactions: { [number]: Object };
constructor(database: Database) {

View File

@ -1,4 +1,4 @@
import Base64 from './../../utils/Base64';
import Base64 from '../../utils/Base64';
export default class Blob {
_binaryString: string;

View File

@ -6,7 +6,7 @@ import DocumentReference from './DocumentReference';
import Query from './Query';
import { firestoreAutoId } from '../../utils';
import type Firestore from './';
import type Firestore from '.';
import type {
GetOptions,
MetadataChanges,
@ -23,7 +23,9 @@ import type QuerySnapshot from './QuerySnapshot';
*/
export default class CollectionReference {
_collectionPath: Path;
_firestore: Firestore;
_query: Query;
constructor(firestore: Firestore, collectionPath: Path) {

View File

@ -4,7 +4,7 @@
*/
import DocumentSnapshot from './DocumentSnapshot';
import type Firestore from './';
import type Firestore from '.';
import type { NativeDocumentChange } from './types';
/**
@ -12,8 +12,11 @@ import type { NativeDocumentChange } from './types';
*/
export default class DocumentChange {
_document: DocumentSnapshot;
_newIndex: number;
_oldIndex: number;
_type: 'added' | 'modified' | 'removed';
constructor(firestore: Firestore, nativeData: NativeDocumentChange) {

View File

@ -11,7 +11,7 @@ import { getLogger } from '../../utils/log';
import { firestoreAutoId, isFunction, isObject } from '../../utils';
import { getNativeModule } from '../../utils/native';
import type Firestore from './';
import type Firestore from '.';
import type {
GetOptions,
MetadataChanges,
@ -33,6 +33,7 @@ type Observer = {
*/
export default class DocumentReference {
_documentPath: Path;
_firestore: Firestore;
constructor(firestore: Firestore, documentPath: Path) {
@ -79,7 +80,8 @@ export default class DocumentReference {
'DocumentReference.get failed: First argument must be an object.'
)
);
} else if (
}
if (
options.source &&
(options.source !== 'default' &&
options.source !== 'server' &&

View File

@ -8,7 +8,7 @@ import Path from './Path';
import { isObject, deepGet } from '../../utils';
import { parseNativeMap } from './utils/serialize';
import type Firestore from './';
import type Firestore from '.';
import type { NativeDocumentSnapshot, SnapshotMetadata } from './types';
const extractFieldPathData = (data: Object | void, segments: string[]): any => {
@ -27,7 +27,9 @@ const extractFieldPathData = (data: Object | void, segments: string[]): any => {
*/
export default class DocumentSnapshot {
_data: Object | void;
_metadata: SnapshotMetadata;
_ref: DocumentReference;
constructor(firestore: Firestore, nativeData: NativeDocumentSnapshot) {

View File

@ -8,6 +8,7 @@
*/
export default class GeoPoint {
_latitude: number;
_longitude: number;
constructor(latitude: number, longitude: number) {

View File

@ -11,7 +11,7 @@ import { getLogger } from '../../utils/log';
import { firestoreAutoId, isFunction, isObject } from '../../utils';
import { getNativeModule } from '../../utils/native';
import type Firestore from './';
import type Firestore from '.';
import type Path from './Path';
import type {
MetadataChanges,
@ -88,10 +88,15 @@ const buildNativeFieldPath = (
*/
export default class Query {
_fieldFilters: FieldFilter[];
_fieldOrders: FieldOrder[];
_firestore: Firestore;
_iid: number;
_queryOptions: QueryOptions;
_referencePath: Path;
constructor(
@ -148,7 +153,8 @@ export default class Query {
return Promise.reject(
new Error('Query.get failed: First argument must be an object.')
);
} else if (
}
if (
options.source &&
(options.source !== 'default' &&
options.source !== 'server' &&
@ -438,8 +444,8 @@ export default class Query {
fieldOrder.fieldPath.string
) {
values.push(docSnapshot.get(fieldOrder.fieldPath.string));
} else if (fieldOrder.fieldPath.fieldpath) {
const fieldPath = new FieldPath(...fieldOrder.fieldPath.fieldpath);
} else if (fieldOrder.fieldPath.elements) {
const fieldPath = new FieldPath(...fieldOrder.fieldPath.elements);
values.push(docSnapshot.get(fieldPath));
}
}

View File

@ -5,7 +5,7 @@
import DocumentChange from './DocumentChange';
import DocumentSnapshot from './DocumentSnapshot';
import type Firestore from './';
import type Firestore from '.';
import type {
NativeDocumentChange,
NativeDocumentSnapshot,
@ -24,8 +24,11 @@ type NativeQuerySnapshot = {
*/
export default class QuerySnapshot {
_changes: DocumentChange[];
_docs: DocumentSnapshot[];
_metadata: SnapshotMetadata;
_query: Query;
constructor(

View File

@ -5,7 +5,7 @@
import { parseUpdateArgs } from './utils';
import { buildNativeMap } from './utils/serialize';
import type Firestore from './';
import type Firestore from '.';
import type { TransactionMeta } from './TransactionHandler';
import type DocumentReference from './DocumentReference';
import DocumentSnapshot from './DocumentSnapshot';
@ -30,8 +30,11 @@ type SetOptions = {
*/
export default class Transaction {
_pendingResult: ?any;
_firestore: Firestore;
_meta: TransactionMeta;
_commandBuffer: Array<Command>;
constructor(firestore: Firestore, meta: TransactionMeta) {

View File

@ -5,7 +5,7 @@
import { getAppEventName, SharedEventEmitter } from '../../utils/events';
import { getNativeModule } from '../../utils/native';
import Transaction from './Transaction';
import type Firestore from './';
import type Firestore from '.';
let transactionId = 0;
@ -36,6 +36,7 @@ type TransactionEvent = {
*/
export default class TransactionHandler {
_firestore: Firestore;
_pending: {
[number]: {
meta: TransactionMeta,

View File

@ -7,7 +7,7 @@ import { buildNativeMap } from './utils/serialize';
import { getNativeModule } from '../../utils/native';
import type DocumentReference from './DocumentReference';
import type Firestore from './';
import type Firestore from '.';
import type { SetOptions } from './types';
type DocumentWrite = {
@ -22,6 +22,7 @@ type DocumentWrite = {
*/
export default class WriteBatch {
_firestore: Firestore;
_writes: DocumentWrite[];
constructor(firestore: Firestore) {

View File

@ -62,6 +62,7 @@ export const NAMESPACE = 'firestore';
*/
export default class Firestore extends ModuleBase {
_referencePath: Path;
_transactionHandler: TransactionHandler;
constructor(app: App) {
@ -165,24 +166,25 @@ export default class Firestore extends ModuleBase {
return Promise.reject(
new Error('Firestore.settings failed: settings must be an object.')
);
} else if (hop(settings, 'host') && !isString(settings.host)) {
}
if (hop(settings, 'host') && !isString(settings.host)) {
return Promise.reject(
new Error('Firestore.settings failed: settings.host must be a string.')
);
} else if (
hop(settings, 'persistence') &&
!isBoolean(settings.persistence)
) {
}
if (hop(settings, 'persistence') && !isBoolean(settings.persistence)) {
return Promise.reject(
new Error(
'Firestore.settings failed: settings.persistence must be boolean.'
)
);
} else if (hop(settings, 'ssl') && !isBoolean(settings.ssl)) {
}
if (hop(settings, 'ssl') && !isBoolean(settings.ssl)) {
return Promise.reject(
new Error('Firestore.settings failed: settings.ssl must be boolean.')
);
} else if (
}
if (
hop(settings, 'timestampsInSnapshots') &&
!isBoolean(settings.timestampsInSnapshots)
) {

View File

@ -26,7 +26,8 @@ export const mergeFieldPathData = (
...data,
[segments[0]]: value,
};
} else if (data[segments[0]]) {
}
if (data[segments[0]]) {
return {
...data,
[segments[0]]: mergeFieldPathData(

View File

@ -13,7 +13,7 @@ import GeoPoint from '../GeoPoint';
import Path from '../Path';
import { typeOf } from '../../../utils';
import type Firestore from '../';
import type Firestore from '..';
import type { NativeTypeMap } from '../types';
/*
@ -55,38 +55,45 @@ export const buildTypeMap = (value: any): NativeTypeMap | null => {
type: 'null',
value: null,
};
} else if (value === DELETE_FIELD_VALUE) {
}
if (value === DELETE_FIELD_VALUE) {
return {
type: 'fieldvalue',
value: 'delete',
};
} else if (value === SERVER_TIMESTAMP_FIELD_VALUE) {
}
if (value === SERVER_TIMESTAMP_FIELD_VALUE) {
return {
type: 'fieldvalue',
value: 'timestamp',
};
} else if (value === DOCUMENT_ID) {
}
if (value === DOCUMENT_ID) {
return {
type: 'documentid',
value: null,
};
} else if (type === 'boolean' || type === 'number' || type === 'string') {
}
if (type === 'boolean' || type === 'number' || type === 'string') {
return {
type,
value,
};
} else if (type === 'array') {
}
if (type === 'array') {
return {
type,
value: buildNativeArray(value),
};
} else if (type === 'object') {
}
if (type === 'object') {
if (value instanceof DocumentReference) {
return {
type: 'reference',
value: value.path,
};
} else if (value instanceof GeoPoint) {
}
if (value instanceof GeoPoint) {
return {
type: 'geopoint',
value: {
@ -94,12 +101,14 @@ export const buildTypeMap = (value: any): NativeTypeMap | null => {
longitude: value.longitude,
},
};
} else if (value instanceof Date) {
}
if (value instanceof Date) {
return {
type: 'date',
value: value.getTime(),
};
} else if (value instanceof Blob) {
}
if (value instanceof Blob) {
return {
type: 'blob',
value: value.toBase64(),
@ -150,19 +159,26 @@ const parseTypeMap = (firestore: Firestore, typeMap: NativeTypeMap): any => {
const { type, value } = typeMap;
if (type === 'null') {
return null;
} else if (type === 'boolean' || type === 'number' || type === 'string') {
}
if (type === 'boolean' || type === 'number' || type === 'string') {
return value;
} else if (type === 'array') {
}
if (type === 'array') {
return parseNativeArray(firestore, value);
} else if (type === 'object') {
}
if (type === 'object') {
return parseNativeMap(firestore, value);
} else if (type === 'reference') {
}
if (type === 'reference') {
return new DocumentReference(firestore, Path.fromName(value));
} else if (type === 'geopoint') {
}
if (type === 'geopoint') {
return new GeoPoint(value.latitude, value.longitude);
} else if (type === 'date') {
}
if (type === 'date') {
return new Date(value);
} else if (type === 'blob') {
}
if (type === 'blob') {
return Blob.fromBase64String(value);
}
console.warn(`Unknown data type received ${type}`);

View File

@ -2,7 +2,9 @@ import type { FunctionsErrorCode } from './types.flow';
export default class HttpsError extends Error {
+details: ?any;
+code: FunctionsErrorCode;
constructor(code: FunctionsErrorCode, message?: string, details?: any) {
super(message);
this.details = details;

View File

@ -7,9 +7,13 @@ import type { NativeAndroidInvitation } from './types';
export default class AndroidInvitation {
_additionalReferralParameters: { [string]: string } | void;
_emailHtmlContent: string | void;
_emailSubject: string | void;
_googleAnalyticsTrackingId: string | void;
_invitation: Invitation;
constructor(invitation: Invitation) {

View File

@ -9,13 +9,21 @@ import type { NativeInvitation } from './types';
export default class Invitation {
_android: AndroidInvitation;
_androidClientId: string | void;
_androidMinimumVersionCode: number | void;
_callToActionText: string | void;
_customImage: string | void;
_deepLink: string | void;
_iosClientId: string | void;
_message: string;
_title: string;
constructor(title: string, message: string) {

View File

@ -7,10 +7,15 @@ import type { NativeAnalyticsParameters } from './types';
export default class AnalyticsParameters {
_campaign: string | void;
_content: string | void;
_link: DynamicLink;
_medium: string | void;
_source: string | void;
_term: string | void;
constructor(link: DynamicLink) {

View File

@ -7,8 +7,11 @@ import type { NativeAndroidParameters } from './types';
export default class AndroidParameters {
_fallbackUrl: string | void;
_link: DynamicLink;
_minimumVersion: number | void;
_packageName: string | void;
constructor(link: DynamicLink) {

View File

@ -13,12 +13,19 @@ import type { NativeDynamicLink } from './types';
export default class DynamicLink {
_analytics: AnalyticsParameters;
_android: AndroidParameters;
_dynamicLinkDomain: string;
_ios: IOSParameters;
_itunes: ITunesParameters;
_link: string;
_navigation: NavigationParameters;
_social: SocialParameters;
constructor(link: string, dynamicLinkDomain: string) {

View File

@ -7,12 +7,19 @@ import type { NativeIOSParameters } from './types';
export default class IOSParameters {
_appStoreId: string | void;
_bundleId: string | void;
_customScheme: string | void;
_fallbackUrl: string | void;
_iPadBundleId: string | void;
_iPadFallbackUrl: string | void;
_link: DynamicLink;
_minimumVersion: string | void;
constructor(link: DynamicLink) {

View File

@ -7,8 +7,11 @@ import type { NativeITunesParameters } from './types';
export default class ITunesParameters {
_affiliateToken: string | void;
_campaignToken: string | void;
_link: DynamicLink;
_providerToken: string | void;
constructor(link: DynamicLink) {

View File

@ -7,6 +7,7 @@ import type { NativeNavigationParameters } from './types';
export default class NavigationParameters {
_forcedRedirectEnabled: boolean | void;
_link: DynamicLink;
constructor(link: DynamicLink) {

View File

@ -7,8 +7,11 @@ import type { NativeSocialParameters } from './types';
export default class SocialParameters {
_descriptionText: string | void;
_imageUrl: string | void;
_link: DynamicLink;
_title: string | void;
constructor(link: DynamicLink) {

View File

@ -2,7 +2,7 @@
* @flow
* RemoteMessage representation wrapper
*/
import { isObject, generatePushID } from './../../utils';
import { isObject, generatePushID } from '../../utils';
import type {
NativeInboundRemoteMessage,
@ -11,12 +11,19 @@ import type {
export default class RemoteMessage {
_collapseKey: string | void;
_data: { [string]: string };
_from: string | void;
_messageId: string;
_messageType: string | void;
_sentTime: number | void;
_to: string;
_ttl: number;
constructor(inboundMessage?: NativeInboundRemoteMessage) {

View File

@ -10,11 +10,17 @@ import type { NativeAndroidAction, SemanticActionType } from './types';
export default class AndroidAction {
_action: string;
_allowGeneratedReplies: boolean | void;
_icon: string;
_remoteInputs: RemoteInput[];
_semanticAction: SemanticActionType | void;
_showUserInterface: boolean | void;
_title: string;
constructor(action: string, icon: string, title: string) {

View File

@ -23,17 +23,29 @@ type NativeAndroidChannel = {|
export default class AndroidChannel {
_bypassDnd: boolean | void;
_channelId: string;
_description: string | void;
_group: string | void;
_importance: ImportanceType;
_lightColor: string | void;
_lightsEnabled: boolean | void;
_lockScreenVisibility: VisibilityType;
_name: string;
_showBadge: boolean | void;
_sound: string | void;
_vibrationEnabled: boolean | void;
_vibrationPattern: number[] | void;
constructor(channelId: string, name: string, importance: ImportanceType) {

View File

@ -10,6 +10,7 @@ type NativeAndroidChannelGroup = {|
export default class AndroidChannelGroup {
_groupId: string;
_name: string;
constructor(groupId: string, name: string) {

View File

@ -22,43 +22,79 @@ import type {
export default class AndroidNotification {
_actions: AndroidAction[];
_autoCancel: boolean | void;
_badgeIconType: BadgeIconTypeType | void;
_bigPicture: BigPicture | void;
_bigText: BigText | void;
_category: CategoryType | void;
_channelId: string;
_clickAction: string | void;
_color: string | void;
_colorized: boolean | void;
_contentInfo: string | void;
_defaults: DefaultsType[] | void;
_group: string | void;
_groupAlertBehaviour: GroupAlertType | void;
_groupSummary: boolean | void;
_largeIcon: string | void;
_lights: Lights | void;
_localOnly: boolean | void;
_notification: Notification;
_number: number | void;
_ongoing: boolean | void;
_onlyAlertOnce: boolean | void;
_people: string[];
_priority: PriorityType | void;
_progress: Progress | void;
// _publicVersion: Notification;
_remoteInputHistory: string[] | void;
_shortcutId: string | void;
_showWhen: boolean | void;
_smallIcon: SmallIcon;
_sortKey: string | void;
// TODO: style: Style; // Need to figure out if this can work
_tag: string | void;
_ticker: string | void;
_timeoutAfter: number | void;
_usesChronometer: boolean | void;
_vibrate: number[] | void;
_visibility: VisibilityType | void;
_when: number | void;
// android unsupported

View File

@ -7,7 +7,7 @@ import AndroidChannel from './AndroidChannel';
import AndroidChannelGroup from './AndroidChannelGroup';
import { getNativeModule } from '../../utils/native';
import type Notifications from './';
import type Notifications from '.';
export default class AndroidNotifications {
_notifications: Notifications;

View File

@ -7,9 +7,13 @@ import type { AndroidAllowDataType, NativeAndroidRemoteInput } from './types';
export default class AndroidRemoteInput {
_allowedDataTypes: AndroidAllowDataType[];
_allowFreeFormInput: boolean | void;
_choices: string[];
_label: string | void;
_resultKey: string;
constructor(resultKey: string) {

View File

@ -10,13 +10,25 @@ import type {
} from './types';
export default class IOSNotification {
_alertAction: string | void; // alertAction | N/A
_attachments: IOSAttachment[]; // N/A | attachments
_badge: number | void; // applicationIconBadgeNumber | badge
_alertAction: string | void;
// alertAction | N/A
_attachments: IOSAttachment[];
// N/A | attachments
_badge: number | void;
// applicationIconBadgeNumber | badge
_category: string | void;
_hasAction: boolean | void; // hasAction | N/A
_launchImage: string | void; // alertLaunchImage | launchImageName
_hasAction: boolean | void;
// hasAction | N/A
_launchImage: string | void;
// alertLaunchImage | launchImageName
_notification: Notification;
_threadIdentifier: string | void; // N/A | threadIdentifier
constructor(notification: Notification, data?: NativeIOSNotification) {

View File

@ -18,12 +18,23 @@ export type NotificationOpen = {|
export default class Notification {
// iOS 8/9 | 10+ | Android
_android: AndroidNotification;
_body: string; // alertBody | body | contentText
_data: { [string]: string }; // userInfo | userInfo | extras
_body: string;
// alertBody | body | contentText
_data: { [string]: string };
// userInfo | userInfo | extras
_ios: IOSNotification;
_notificationId: string;
_sound: string | void; // soundName | sound | sound
_subtitle: string | void; // N/A | subtitle | subText
_sound: string | void;
// soundName | sound | sound
_subtitle: string | void;
// N/A | subtitle | subText
_title: string; // alertTitle | title | contentTitle
constructor(data?: NativeNotification) {

View File

@ -3,11 +3,13 @@
* Trace representation wrapper
*/
import { getNativeModule } from '../../utils/native';
import type PerformanceMonitoring from './';
import type PerformanceMonitoring from '.';
export default class HttpMetric {
url: string;
httpMethod: string;
_perf: PerformanceMonitoring;
constructor(perf: PerformanceMonitoring, url: string, httpMethod: string) {

View File

@ -3,10 +3,11 @@
* Trace representation wrapper
*/
import { getNativeModule } from '../../utils/native';
import type PerformanceMonitoring from './';
import type PerformanceMonitoring from '.';
export default class Trace {
identifier: string;
_perf: PerformanceMonitoring;
constructor(perf: PerformanceMonitoring, identifier: string) {

View File

@ -5,7 +5,7 @@
import ReferenceBase from '../../utils/ReferenceBase';
import StorageTask, { UPLOAD_TASK, DOWNLOAD_TASK } from './task';
import { getNativeModule } from '../../utils/native';
import type Storage from './';
import type Storage from '.';
/**
* @url https://firebase.google.com/docs/reference/js/firebase.storage.Reference
@ -73,7 +73,7 @@ export default class StorageReference extends ReferenceBase {
* @param {String} filePath Where to store the file
* @return {Promise}
*/
downloadFile(filePath: string): Promise<Object> {
downloadFile(filePath: string): StorageTask {
return new StorageTask(
DOWNLOAD_TASK,
getNativeModule(this._storage).downloadFile(this.path, filePath),
@ -85,7 +85,7 @@ export default class StorageReference extends ReferenceBase {
* Alias to putFile
* @returns {StorageReference.putFile}
*/
get put(): (Object, Object) => Promise<Object> {
get put(): (Object, Object) => StorageTask {
return this.putFile;
}
@ -95,7 +95,7 @@ export default class StorageReference extends ReferenceBase {
* @param {object} metadata An object containing metadata
* @return {Promise}
*/
putFile(filePath: Object, metadata: Object = {}): Promise<Object> {
putFile(filePath: Object, metadata: Object = {}): StorageTask {
let _filePath = filePath.replace('file://', '');
if (_filePath.includes('%')) _filePath = decodeURI(_filePath);
return new StorageTask(

View File

@ -2,9 +2,9 @@
* @flow
* UploadTask representation wrapper
*/
import { statics as StorageStatics } from './';
import { isFunction } from './../../utils';
import type Storage from './';
import { statics as StorageStatics } from '.';
import { isFunction } from '../../utils';
import type Storage from '.';
import type StorageReference from './reference';
export const UPLOAD_TASK = 'upload';
@ -45,10 +45,15 @@ declare type NextOrObserverType =
*/
export default class StorageTask {
type: typeof UPLOAD_TASK | typeof DOWNLOAD_TASK;
ref: StorageReference;
storage: Storage;
path: string;
then: () => Promise<*>;
catch: () => Promise<*>;
constructor(

View File

@ -45,8 +45,8 @@ export default class RNFirebaseUtils extends ModuleBase {
} else {
const error = INTERNALS.STRINGS.ERROR_PLAY_SERVICES(status);
if (INTERNALS.OPTIONS.errorOnMissingPlayServices) {
if (status === 2)
console.warn(error); // only warn if it exists but may need an update
if (status === 2) console.warn(error);
// only warn if it exists but may need an update
else throw new Error(error);
} else {
console.warn(error);

View File

@ -9,7 +9,9 @@ import type { FirebaseModuleConfig, FirebaseNamespace } from '../types';
export default class ModuleBase {
_app: App;
_serviceUrl: ?string;
namespace: FirebaseNamespace;
/**

View File

@ -6,7 +6,7 @@ import { NativeEventEmitter, NativeModules } from 'react-native';
import { SharedEventEmitter } from './events';
import DataSnapshot from '../modules/database/DataSnapshot';
import DatabaseReference from '../modules/database/Reference';
import { isString, nativeToJSError } from '../utils';
import { isString, nativeToJSError } from '.';
type Listener = DataSnapshot => any;
@ -27,7 +27,9 @@ type Registration = {
*/
class SyncTree {
_nativeEmitter: NativeEventEmitter;
_reverseLookup: { [string]: Registration };
_tree: { [string]: { [string]: { [string]: Listener } } };
constructor() {

View File

@ -4,7 +4,7 @@
import { NativeModules } from 'react-native';
import App from '../modules/core/app';
import INTERNALS from './internals';
import { isAndroid, isObject, isString } from './';
import { isAndroid, isObject, isString } from '.';
import type {
FirebaseModule,

Some files were not shown because too many files have changed in this diff Show More