@@ -87,7 +87,7 @@ firebase.addAppDelegateMethods = appDelegate => {
8787
8888 // Firebase Facebook authentication
8989 if ( typeof ( FBSDKApplicationDelegate ) !== "undefined" ) {
90- FBSDKApplicationDelegate . sharedInstance ( ) . applicationDidFinishLaunchingWithOptions ( application , launchOptions ) ;
90+ FBSDKApplicationDelegate . sharedInstance . applicationDidFinishLaunchingWithOptions ( application , launchOptions ) ;
9191 }
9292
9393 return true ;
@@ -99,7 +99,7 @@ firebase.addAppDelegateMethods = appDelegate => {
9999 appDelegate . prototype . applicationOpenURLSourceApplicationAnnotation = ( application , url , sourceApplication , annotation ) => {
100100 let result = false ;
101101 if ( typeof ( FBSDKApplicationDelegate ) !== "undefined" ) {
102- result = FBSDKApplicationDelegate . sharedInstance ( ) . applicationOpenURLSourceApplicationAnnotation ( application , url , sourceApplication , annotation ) ;
102+ result = FBSDKApplicationDelegate . sharedInstance . applicationOpenURLSourceApplicationAnnotation ( application , url , sourceApplication , annotation ) ;
103103 }
104104
105105 if ( typeof ( GIDSignIn ) !== "undefined" ) {
@@ -140,7 +140,7 @@ firebase.addAppDelegateMethods = appDelegate => {
140140
141141 let result = false ;
142142 if ( typeof ( FBSDKApplicationDelegate ) !== "undefined" ) {
143- result = FBSDKApplicationDelegate . sharedInstance ( ) . applicationOpenURLSourceApplicationAnnotation (
143+ result = FBSDKApplicationDelegate . sharedInstance . applicationOpenURLSourceApplicationAnnotation (
144144 application ,
145145 url ,
146146 options . valueForKey ( UIApplicationOpenURLOptionsSourceApplicationKey ) ,
@@ -382,7 +382,7 @@ firebase.init = arg => {
382382 FIROptions . defaultOptions ( ) . deepLinkURLScheme = NSBundle . mainBundle . bundleIdentifier ;
383383 }
384384
385- FIRAnalyticsConfiguration . sharedInstance ( ) . setAnalyticsCollectionEnabled ( arg . analyticsCollectionEnabled !== false ) ;
385+ FIRAnalytics . setAnalyticsCollectionEnabled ( arg . analyticsCollectionEnabled !== false ) ;
386386
387387 if ( ! firebase . _configured ) {
388388 firebase . _configured = true ;
@@ -679,8 +679,7 @@ function toLoginResult(user, additionalUserInfo?: FIRAdditionalUserInfo): User {
679679 const pid = firUserInfo . valueForKey ( "providerID" ) ;
680680 // the app may have dropped Facebook support, so check if the native class is still there
681681 if ( pid === 'facebook.com' && typeof ( FBSDKAccessToken ) !== "undefined" ) { // FIRFacebookAuthProviderID
682- const fbCurrentAccessToken = FBSDKAccessToken . currentAccessToken ( ) ;
683- providers . push ( { id : pid , token : fbCurrentAccessToken ? fbCurrentAccessToken . tokenString : null } ) ;
682+ providers . push ( { id : pid , token : FBSDKAccessToken . currentAccessToken ? FBSDKAccessToken . currentAccessToken . tokenString : null } ) ;
684683 } else if ( pid === 'google.com' && typeof ( GIDSignIn ) !== "undefined" && GIDSignIn . sharedInstance ( ) && GIDSignIn . sharedInstance ( ) . currentUser ) {
685684 // include web compatible oauth2 token
686685 const gidCurrentAccessToken = GIDSignIn . sharedInstance ( ) . currentUser . authentication . accessToken ;
@@ -900,12 +899,12 @@ firebase.login = arg => {
900899 }
901900
902901 if ( arg . customOptions . token ) {
903- fAuth . signInAndRetrieveDataWithCustomTokenCompletion ( arg . customOptions . token , onCompletionWithAuthResult ) ;
902+ fAuth . signInWithCustomTokenCompletion ( arg . customOptions . token , onCompletionWithAuthResult ) ;
904903 } else if ( arg . customOptions . tokenProviderFn ) {
905904 arg . customOptions . tokenProviderFn ( )
906905 . then (
907906 token => {
908- fAuth . signInAndRetrieveDataWithCustomTokenCompletion ( token , onCompletionWithAuthResult ) ;
907+ fAuth . signInWithCustomTokenCompletion ( token , onCompletionWithAuthResult ) ;
909908 } ,
910909 error => {
911910 reject ( error ) ;
@@ -928,7 +927,7 @@ firebase.login = arg => {
928927 } else {
929928 // headless facebook auth
930929 // var fIRAuthCredential = FIRFacebookAuthProvider.credentialWithAccessToken(fbSDKLoginManagerLoginResult.token.tokenString);
931- const fIRAuthCredential = FIRFacebookAuthProvider . credentialWithAccessToken ( FBSDKAccessToken . currentAccessToken ( ) . tokenString ) ;
930+ const fIRAuthCredential = FIRFacebookAuthProvider . credentialWithAccessToken ( FBSDKAccessToken . currentAccessToken . tokenString ) ;
932931 if ( fAuth . currentUser ) {
933932 // link credential, note that you only want to do this if this user doesn't already use fb as an auth provider
934933 const onCompletionLink = ( authData : FIRAuthDataResult , error : NSError ) => {
@@ -957,7 +956,7 @@ firebase.login = arg => {
957956 scopes = arg . facebookOptions . scopes ;
958957 }
959958
960- fbSDKLoginManager . logInWithReadPermissionsFromViewControllerHandler (
959+ fbSDKLoginManager . logInWithPermissionsFromViewControllerHandler (
961960 scopes ,
962961 null , // the viewcontroller param can be null since by default topmost is taken
963962 onFacebookCompletion ) ;
@@ -1057,12 +1056,11 @@ firebase.reauthenticate = arg => {
10571056 authCredential = FIRGoogleAuthProvider . credentialWithIDTokenAccessToken ( firebase . _gIDAuthentication . idToken , firebase . _gIDAuthentication . accessToken ) ;
10581057
10591058 } else if ( arg . type === firebase . LoginType . FACEBOOK ) {
1060- const currentAccessToken = FBSDKAccessToken . currentAccessToken ( ) ;
1061- if ( ! currentAccessToken ) {
1059+ if ( ! FBSDKAccessToken . currentAccessToken ) {
10621060 reject ( "Not currently logged in with Facebook" ) ;
10631061 return ;
10641062 }
1065- authCredential = FIRFacebookAuthProvider . credentialWithAccessToken ( currentAccessToken . tokenString ) ;
1063+ authCredential = FIRFacebookAuthProvider . credentialWithAccessToken ( FBSDKAccessToken . currentAccessToken . tokenString ) ;
10661064 }
10671065
10681066 if ( authCredential === null ) {
@@ -1290,7 +1288,7 @@ firebase._addObservers = (to, updateCallback) => {
12901288firebase . keepInSync = ( path , switchOn ) => {
12911289 return new Promise ( ( resolve , reject ) => {
12921290 try {
1293- const where = FIRDatabase . database ( ) . reference ( ) . childByAppendingPath ( path ) ;
1291+ const where = FIRDatabase . database ( ) . reference ( ) . child ( path ) ;
12941292 where . keepSynced ( switchOn ) ;
12951293 resolve ( ) ;
12961294 } catch ( ex ) {
@@ -1303,7 +1301,7 @@ firebase.keepInSync = (path, switchOn) => {
13031301firebase . addChildEventListener = ( updateCallback , path ) => {
13041302 return new Promise ( ( resolve , reject ) => {
13051303 try {
1306- const where = path === undefined ? FIRDatabase . database ( ) . reference ( ) : FIRDatabase . database ( ) . reference ( ) . childByAppendingPath ( path ) ;
1304+ const where = path === undefined ? FIRDatabase . database ( ) . reference ( ) : FIRDatabase . database ( ) . reference ( ) . child ( path ) ;
13071305 resolve ( {
13081306 path : path ,
13091307 listeners : firebase . _addObservers ( where , updateCallback )
@@ -1318,7 +1316,7 @@ firebase.addChildEventListener = (updateCallback, path) => {
13181316firebase . addValueEventListener = ( updateCallback , path ) => {
13191317 return new Promise ( ( resolve , reject ) => {
13201318 try {
1321- const where = path === undefined ? FIRDatabase . database ( ) . reference ( ) : FIRDatabase . database ( ) . reference ( ) . childByAppendingPath ( path ) ;
1319+ const where = path === undefined ? FIRDatabase . database ( ) . reference ( ) : FIRDatabase . database ( ) . reference ( ) . child ( path ) ;
13221320 const listener = where . observeEventTypeWithBlockWithCancelBlock (
13231321 FIRDataEventType . Value ,
13241322 snapshot => {
@@ -1343,7 +1341,7 @@ firebase.addValueEventListener = (updateCallback, path) => {
13431341firebase . getValue = path => {
13441342 return new Promise ( ( resolve , reject ) => {
13451343 try {
1346- const where = path === undefined ? FIRDatabase . database ( ) . reference ( ) : FIRDatabase . database ( ) . reference ( ) . childByAppendingPath ( path ) ;
1344+ const where = path === undefined ? FIRDatabase . database ( ) . reference ( ) : FIRDatabase . database ( ) . reference ( ) . child ( path ) ;
13471345 where . observeSingleEventOfTypeWithBlockWithCancelBlock (
13481346 FIRDataEventType . Value ,
13491347 snapshot => {
@@ -1362,7 +1360,7 @@ firebase.getValue = path => {
13621360firebase . removeEventListeners = ( listeners , path ) => {
13631361 return new Promise ( ( resolve , reject ) => {
13641362 try {
1365- const where = path === undefined ? FIRDatabase . database ( ) . reference ( ) : FIRDatabase . database ( ) . reference ( ) . childByAppendingPath ( path ) ;
1363+ const where = path === undefined ? FIRDatabase . database ( ) . reference ( ) : FIRDatabase . database ( ) . reference ( ) . child ( path ) ;
13661364 for ( let i = 0 ; i < listeners . length ; i ++ ) {
13671365 const listener = listeners [ i ] ;
13681366 where . removeObserverWithHandle ( listener ) ;
@@ -1378,7 +1376,7 @@ firebase.removeEventListeners = (listeners, path) => {
13781376firebase . push = ( path , val ) => {
13791377 return new Promise ( ( resolve , reject ) => {
13801378 try {
1381- const ref = FIRDatabase . database ( ) . reference ( ) . childByAppendingPath ( path ) . childByAutoId ( ) ;
1379+ const ref = FIRDatabase . database ( ) . reference ( ) . child ( path ) . childByAutoId ( ) ;
13821380 ref . setValueWithCompletionBlock ( val , ( error : NSError , dbRef : FIRDatabaseReference ) => {
13831381 error ? reject ( error . localizedDescription ) : resolve ( { key : ref . key } ) ;
13841382 } ) ;
@@ -1392,7 +1390,7 @@ firebase.push = (path, val) => {
13921390firebase . setValue = ( path , val ) => {
13931391 return new Promise ( ( resolve , reject ) => {
13941392 try {
1395- FIRDatabase . database ( ) . reference ( ) . childByAppendingPath ( path ) . setValueWithCompletionBlock ( val , ( error : NSError , dbRef : FIRDatabaseReference ) => {
1393+ FIRDatabase . database ( ) . reference ( ) . child ( path ) . setValueWithCompletionBlock ( val , ( error : NSError , dbRef : FIRDatabaseReference ) => {
13961394 error ? reject ( error . localizedDescription ) : resolve ( ) ;
13971395 } ) ;
13981396 } catch ( ex ) {
@@ -1406,15 +1404,15 @@ firebase.update = (path, val) => {
14061404 return new Promise ( ( resolve , reject ) => {
14071405 try {
14081406 if ( typeof val === "object" ) {
1409- FIRDatabase . database ( ) . reference ( ) . childByAppendingPath ( path ) . updateChildValuesWithCompletionBlock ( val , ( error : NSError , dbRef : FIRDatabaseReference ) => {
1407+ FIRDatabase . database ( ) . reference ( ) . child ( path ) . updateChildValuesWithCompletionBlock ( val , ( error : NSError , dbRef : FIRDatabaseReference ) => {
14101408 error ? reject ( error . localizedDescription ) : resolve ( ) ;
14111409 } ) ;
14121410 } else {
14131411 const lastPartOfPath = path . lastIndexOf ( "/" ) ;
14141412 const pathPrefix = path . substring ( 0 , lastPartOfPath ) ;
14151413 const pathSuffix = path . substring ( lastPartOfPath + 1 ) ;
14161414 const updateObject = '{"' + pathSuffix + '" : "' + val + '"}' ;
1417- FIRDatabase . database ( ) . reference ( ) . childByAppendingPath ( pathPrefix ) . updateChildValuesWithCompletionBlock ( JSON . parse ( updateObject ) , ( error : NSError , dbRef : FIRDatabaseReference ) => {
1415+ FIRDatabase . database ( ) . reference ( ) . child ( pathPrefix ) . updateChildValuesWithCompletionBlock ( JSON . parse ( updateObject ) , ( error : NSError , dbRef : FIRDatabaseReference ) => {
14181416 error ? reject ( error . localizedDescription ) : resolve ( ) ;
14191417 } ) ;
14201418 }
@@ -1428,7 +1426,7 @@ firebase.update = (path, val) => {
14281426firebase . query = ( updateCallback : ( data : FBDataSingleEvent ) => void , path : string , options : QueryOptions ) : Promise < any > => {
14291427 return new Promise < any > ( ( resolve , reject ) => {
14301428 try {
1431- const where = path === undefined ? FIRDatabase . database ( ) . reference ( ) : FIRDatabase . database ( ) . reference ( ) . childByAppendingPath ( path ) ;
1429+ const where = path === undefined ? FIRDatabase . database ( ) . reference ( ) : FIRDatabase . database ( ) . reference ( ) . child ( path ) ;
14321430 let query : FIRDatabaseQuery ;
14331431
14341432 // orderBy
@@ -1540,7 +1538,7 @@ firebase.query = (updateCallback: (data: FBDataSingleEvent) => void, path: strin
15401538firebase . remove = path => {
15411539 return new Promise ( ( resolve , reject ) => {
15421540 try {
1543- FIRDatabase . database ( ) . reference ( ) . childByAppendingPath ( path ) . setValueWithCompletionBlock ( null , ( error : NSError , dbRef : FIRDatabaseReference ) => {
1541+ FIRDatabase . database ( ) . reference ( ) . child ( path ) . setValueWithCompletionBlock ( null , ( error : NSError , dbRef : FIRDatabaseReference ) => {
15441542 error ? reject ( error . localizedDescription ) : resolve ( ) ;
15451543 } ) ;
15461544 } catch ( ex ) {
@@ -1618,7 +1616,7 @@ class OnDisconnect implements OnDisconnectBase {
16181616 const pathPrefix = this . path . substring ( 0 , lastPartOfPath ) ;
16191617 const pathSuffix = this . path . substring ( lastPartOfPath + 1 ) ;
16201618 const updateObject = '{"' + pathSuffix + '" : "' + values + '"}' ;
1621- FIRDatabase . database ( ) . reference ( ) . childByAppendingPath ( pathPrefix ) . updateChildValuesWithCompletionBlock ( JSON . parse ( updateObject ) , ( error : NSError , dbRef : FIRDatabaseReference ) => {
1619+ FIRDatabase . database ( ) . reference ( ) . child ( pathPrefix ) . updateChildValuesWithCompletionBlock ( JSON . parse ( updateObject ) , ( error : NSError , dbRef : FIRDatabaseReference ) => {
16221620 error ? reject ( error . localizedDescription ) : resolve ( ) ;
16231621 } ) ;
16241622 }
0 commit comments