Skip to content

Commit

Permalink
fix(imports): add firebase imports to all places that reference fireb…
Browse files Browse the repository at this point in the history
…ase namespace

Fixes #525
  • Loading branch information
jeffbcross committed Sep 21, 2016
1 parent e93d45d commit c3a954c
Show file tree
Hide file tree
Showing 16 changed files with 22 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/angularfire2.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as firebase from 'firebase';
import {
TestBed,
inject
Expand Down
4 changes: 2 additions & 2 deletions src/angularfire2.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { initializeApp } from 'firebase';
import * as firebase from 'firebase';
import * as utils from './utils';
import { FirebaseAppConfig } from './interfaces';
import { AuthConfiguration } from './auth';
Expand Down Expand Up @@ -49,7 +49,7 @@ export class AngularFire {
}

export function _getFirebase(config: FirebaseAppConfig): firebase.app.App {
return initializeApp(config);
return firebase.initializeApp(config);
}

export function _getWindowLocation(){
Expand Down
1 change: 1 addition & 0 deletions src/auth/auth.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as firebase from 'firebase';
import { auth, initializeApp } from 'firebase';
import { ReflectiveInjector, Provider } from '@angular/core';
import { Observable } from 'rxjs/Observable'
Expand Down
1 change: 1 addition & 0 deletions src/auth/auth.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as firebase from 'firebase';
import { Provider, Inject, Injectable, Optional } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer';
Expand Down
1 change: 1 addition & 0 deletions src/auth/auth_backend.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as firebase from 'firebase';
import {
authDataToAuthState,
AuthProviders,
Expand Down
1 change: 1 addition & 0 deletions src/auth/auth_backend.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as firebase from 'firebase';
import { Observable } from 'rxjs/Observable';

export abstract class AuthBackend {
Expand Down
4 changes: 2 additions & 2 deletions src/auth/firebase_sdk_auth_backend.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as firebase from 'firebase';
import { Injectable, Inject } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer';
import { FirebaseApp } from '../tokens';
import { isPresent, ZoneScheduler } from '../utils';
import { auth } from 'firebase';
import {
authDataToAuthState,
AuthBackend,
Expand All @@ -18,7 +18,7 @@ const {
GithubAuthProvider,
GoogleAuthProvider,
TwitterAuthProvider
} = auth;
} = firebase.auth;

import { map } from 'rxjs/operator/map';
import { fromPromise } from 'rxjs/observable/fromPromise';
Expand Down
1 change: 1 addition & 0 deletions src/database/database.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as firebase from 'firebase';
import { Inject, Injectable } from '@angular/core';
import { FirebaseApp, FirebaseConfig } from '../tokens';
import { FirebaseAppConfig } from '../angularfire2';
Expand Down
2 changes: 1 addition & 1 deletion src/database/firebase_list_factory.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare var require: any;
import * as firebase from 'firebase';
import {
FirebaseListFactory,
FirebaseListObservable,
Expand Down
4 changes: 2 additions & 2 deletions src/database/firebase_list_factory.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as firebase from 'firebase';
import { AFUnwrappedDataSnapshot } from '../interfaces';
import { FirebaseListObservable } from './firebase_list_observable';
import { Observer } from 'rxjs/Observer';
import { database } from 'firebase';
import { observeQuery } from './query_observable';
import { Query, FirebaseListFactoryOpts } from '../interfaces';
import * as utils from '../utils';
Expand All @@ -17,7 +17,7 @@ export function FirebaseListFactory (
let ref: firebase.database.Reference | firebase.database.Query;

utils.checkForUrlOrFirebaseRef(absoluteUrlOrDbRef, {
isUrl: () => ref = database().refFromURL(<string>absoluteUrlOrDbRef),
isUrl: () => ref = firebase.database().refFromURL(<string>absoluteUrlOrDbRef),
isRef: () => ref = <firebase.database.Reference>absoluteUrlOrDbRef,
isQuery: () => ref = <firebase.database.Query>absoluteUrlOrDbRef,
});
Expand Down
4 changes: 2 additions & 2 deletions src/database/firebase_list_observable.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FirebaseListObservable } from './index';
import { Observer } from 'rxjs/Observer';
import { map } from 'rxjs/operator/map';
import { database } from 'firebase';
import * as firebase from 'firebase';
import { unwrapMapFn } from '../utils';
import {
FIREBASE_PROVIDERS,
Expand Down Expand Up @@ -30,7 +30,7 @@ describe('FirebaseObservable', () => {
});
inject([FirebaseApp, AngularFire], (firebaseApp: firebase.app.App, _af: AngularFire) => {
app = firebaseApp;
ref = database().ref();
ref = firebase.database().ref();
O = new FirebaseListObservable(ref, (observer:Observer<any>) => {
});
})();
Expand Down
1 change: 1 addition & 0 deletions src/database/firebase_object_factory.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as firebase from 'firebase';
import { Subscription } from 'rxjs';
import { FirebaseObjectFactory, FirebaseObjectObservable } from './index';
import {
Expand Down
4 changes: 2 additions & 2 deletions src/database/firebase_object_factory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FirebaseObjectObservable } from './index';
import { Observer } from 'rxjs/Observer';
import { database } from 'firebase';
import * as firebase from 'firebase';
import * as utils from '../utils';
import { Query } from '../interfaces';
import { observeQuery } from './query_observable';
Expand All @@ -13,7 +13,7 @@ export function FirebaseObjectFactory (
let ref: firebase.database.Reference;

utils.checkForUrlOrFirebaseRef(absoluteUrlOrDbRef, {
isUrl: () => ref = database().refFromURL(<string>absoluteUrlOrDbRef),
isUrl: () => ref = firebase.database().refFromURL(<string>absoluteUrlOrDbRef),
isRef: () => ref = <firebase.database.Reference>absoluteUrlOrDbRef
});

Expand Down
4 changes: 2 additions & 2 deletions src/database/firebase_object_observable.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { COMMON_CONFIG, ANON_AUTH_CONFIG } from '../test-config';
import { FirebaseObjectObservable } from './index';
import { Observer } from 'rxjs/Observer';
import { map } from 'rxjs/operator/map';
import { database } from 'firebase';
import * as firebase from 'firebase';

const rootDatabaseUrl = COMMON_CONFIG.databaseURL;

Expand All @@ -30,7 +30,7 @@ describe('FirebaseObjectObservable', () => {
});
inject([FirebaseApp, AngularFire], (firebaseApp: firebase.app.App, _af: AngularFire) => {
app = firebaseApp;
ref = database().ref()
ref = firebase.database().ref()
O = new FirebaseObjectObservable((observer:Observer<any>) => {
}, ref);
})();
Expand Down
1 change: 1 addition & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as firebase from 'firebase';
import { Observable } from 'rxjs/Observable';

export interface FirebaseAppConfig {
Expand Down
1 change: 1 addition & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as firebase from 'firebase';
import { Subscription } from 'rxjs/Subscription';
import { Scheduler } from 'rxjs/Scheduler';
import { queue } from 'rxjs/scheduler/queue';
Expand Down

0 comments on commit c3a954c

Please sign in to comment.