Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit b721b16

Browse files
Upgrade native SDKs to iOS 6.2.0 and Android 16.0.9 #1283 (removed stuff that referred to removed Firebase SDK features)
1 parent 93f4477 commit b721b16

File tree

7 files changed

+15
-163
lines changed

7 files changed

+15
-163
lines changed

demo/app/main-page.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
<Button row="2" col="0" text="anonymous login" tap="{{ doWebLoginAnonymously }}" class="button"/>
2929
<Button row="2" col="1" text="passwd login" tap="{{ doWebLoginByPassword }}" class="button"/>
3030

31-
<Button row="3" col="0" text="providers for email" tap="{{ doWebFetchProvidersForEmail }}" class="button"/>
32-
<Button row="3" col="1" text="email sign-in methods" tap="{{ doWebFetchSignInMethodsForEmail }}" class="button"/>
31+
<Button row="3" col="0" colSpan="2" text="email sign-in methods" tap="{{ doWebFetchSignInMethodsForEmail }}" class="button"/>
3332

3433
<Button row="4" col="0" text="create pwd user" tap="{{ doWebCreateUser }}" class="button"/>
3534
<Button row="4" col="1" text="get current user" tap="{{ doWebGetCurrentUser }}" class="button"/>
@@ -116,8 +115,7 @@
116115
<Button row="8" col="0" text="phone login" tap="{{ doLoginByPhone }}" class="button"/>
117116
<Button row="8" col="1" text="update profile" tap="{{ doUpdateProfile }}" class="button"/>
118117

119-
<Button row="9" col="0" text="providers for email" tap="{{ doFetchProvidersForEmail }}" class="button"/>
120-
<Button row="9" col="1" text="email sign-in methods" tap="{{ doFetchSignInMethodsForEmail }}" class="button"/>
118+
<Button row="9" col="0" colSpan="2" text="email sign-in methods" tap="{{ doFetchSignInMethodsForEmail }}" class="button"/>
121119

122120
<Button row="10" col="0" text="re-auth passwd" tap="{{ doReauthenticatePwdUser }}" class="button"/>
123121
<Button row="10" col="1" text="re-auth Facebook" tap="{{ doReauthenticateFacebookUser }}" class="button"/>

demo/app/main-view-model.ts

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -97,35 +97,6 @@ export class HelloWorldModel extends Observable {
9797
);
9898
}
9999

100-
public doWebFetchProvidersForEmail(): void {
101-
const user = firebaseWebApi.auth().currentUser;
102-
if (!user || !user.email) {
103-
alert({
104-
title: "Can't fetch providers",
105-
message: "No user with an emailaddress logged in.",
106-
okButtonText: "OK, makes sense.."
107-
});
108-
return;
109-
}
110-
111-
firebaseWebApi.auth().fetchProvidersForEmail(user.email).then(
112-
result => {
113-
alert({
114-
title: `Providers for ${user.email}`,
115-
message: JSON.stringify(result), // likely to be ["password"]
116-
okButtonText: "Thanks!"
117-
});
118-
},
119-
errorMessage => {
120-
alert({
121-
title: "Fetch Providers for Email error",
122-
message: errorMessage,
123-
okButtonText: "OK, pity.."
124-
});
125-
}
126-
);
127-
}
128-
129100
public doWebFetchSignInMethodsForEmail(): void {
130101
const user = firebaseWebApi.auth().currentUser;
131102
if (!user || !user.email) {
@@ -899,37 +870,6 @@ export class HelloWorldModel extends Observable {
899870
);
900871
}
901872

902-
public doFetchProvidersForEmail(): void {
903-
firebase.getCurrentUser().then(
904-
user => {
905-
if (!user || !user.email) {
906-
alert({
907-
title: "Can't fetch providers",
908-
message: "No user with emailaddress logged in.",
909-
okButtonText: "OK, makes sense.."
910-
});
911-
return;
912-
}
913-
914-
firebase.fetchProvidersForEmail(user.email).then(
915-
result => {
916-
alert({
917-
title: `Providers for ${user.email}`,
918-
message: JSON.stringify(result), // likely to be ["password"]
919-
okButtonText: "Thanks!"
920-
});
921-
},
922-
errorMessage => {
923-
alert({
924-
title: "Fetch Providers for Email error",
925-
message: errorMessage,
926-
okButtonText: "OK, pity.."
927-
});
928-
}
929-
);
930-
});
931-
}
932-
933873
public doFetchSignInMethodsForEmail(): void {
934874
firebase.getCurrentUser().then(
935875
user => {

docs/AUTHENTICATION.md

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -150,39 +150,8 @@ Once the user is logged in you can retrieve the currently logged in user:
150150
```
151151
</details>
152152

153-
### Fetch providers for email
154-
Want to know which auth providers are associated with an emailaddress?
155-
156-
<details>
157-
<summary>Native API</summary>
158-
159-
```typescript
160-
const emailAddress = "[email protected]";
161-
firebase.fetchProvidersForEmail(emailAddress).then((providers: Array<string>) => {
162-
console.log(`Providers for ${emailAddress}: ${JSON.stringify(providers)}`);
163-
});
164-
```
165-
</details>
166-
167-
<details>
168-
<summary>Web API</summary>
169-
170-
```js
171-
const user = firebaseWebApi.auth().currentUser;
172-
if (!user || !user.email) {
173-
console.log("Can't fetch providers; no user with an emailaddress logged in.");
174-
return;
175-
}
176-
177-
firebaseWebApi.auth().fetchProvidersForEmail(user.email)
178-
.then(result => console.log(`Providers for ${user.email}: ${JSON.stringify(result)}`))
179-
.catch(error => console.log("Fetch Providers for Email error: " + error));
180-
```
181-
</details>
182-
183153
### Fetch sign-in methods for email
184-
Both email-password login and email-link login are `password` providers, so by just using `fetchProvidersForEmail`
185-
you won't be able to differentiate between those login methods. That's where `fetchSignInMethodsForEmail` comes in.
154+
Use this if you want to know which auth providers are associated with an emailaddress.
186155

187156
<details>
188157
<summary>Native API</summary>

src/app/auth/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,6 @@ export namespace auth {
176176
});
177177
}
178178

179-
public fetchProvidersForEmail(email: string): Promise<any> {
180-
return firebase.fetchProvidersForEmail(email);
181-
}
182-
183179
public fetchSignInMethodsForEmail(email: string): Promise<any> {
184180
return firebase.fetchSignInMethodsForEmail(email);
185181
}

src/firebase.android.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -405,33 +405,6 @@ firebase.init = arg => {
405405
});
406406
};
407407

408-
firebase.fetchProvidersForEmail = email => {
409-
return new Promise((resolve, reject) => {
410-
try {
411-
if (typeof (email) !== "string") {
412-
reject("A parameter representing an email address is required.");
413-
return;
414-
}
415-
416-
const onCompleteListener = new gmsTasks.OnCompleteListener({
417-
onComplete: task /* <ProviderQueryResult> */ => {
418-
if (!task.isSuccessful()) {
419-
reject((task.getException() && task.getException().getReason ? task.getException().getReason() : task.getException()));
420-
} else {
421-
const providerList = task.getResult().getProviders();
422-
resolve(firebase.toJsObject(providerList));
423-
}
424-
}
425-
});
426-
427-
com.google.firebase.auth.FirebaseAuth.getInstance().fetchProvidersForEmail(email).addOnCompleteListener(onCompleteListener);
428-
} catch (ex) {
429-
console.log("Error in firebase.fetchProvidersForEmail: " + ex);
430-
reject(ex);
431-
}
432-
});
433-
};
434-
435408
firebase.fetchSignInMethodsForEmail = email => {
436409
return new Promise((resolve, reject) => {
437410
try {

src/firebase.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,8 +1007,6 @@ export function logout(): Promise<any>;
10071007

10081008
export function unlink(providerId: string): Promise<User>;
10091009

1010-
export function fetchProvidersForEmail(email: string): Promise<Array<string>>;
1011-
10121010
export function fetchSignInMethodsForEmail(email: string): Promise<Array<string>>;
10131011

10141012
export function sendEmailVerification(actionCodeSettings?: ActionCodeSettings): Promise<any>;

src/firebase.ios.ts

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ firebase.addAppDelegateMethods = appDelegate => {
182182
}
183183
};
184184
const fIRAuthCredential = FIREmailAuthProvider.credentialWithEmailLink(rememberedEmail, userActivity.webpageURL.absoluteString);
185-
fAuth.currentUser.linkAndRetrieveDataWithCredentialCompletion(fIRAuthCredential, onCompletionLink);
185+
fAuth.currentUser.linkWithCredentialCompletion(fIRAuthCredential, onCompletionLink);
186186

187187
} else {
188188
fAuth.signInWithEmailLinkCompletion(rememberedEmail, userActivity.webpageURL.absoluteString, (authData: FIRAuthDataResult, error: NSError) => {
@@ -229,28 +229,6 @@ firebase.addAppDelegateMethods = appDelegate => {
229229
}
230230
};
231231

232-
firebase.fetchProvidersForEmail = email => {
233-
return new Promise((resolve, reject) => {
234-
try {
235-
if (typeof (email) !== "string") {
236-
reject("A parameter representing an email address is required.");
237-
return;
238-
}
239-
240-
FIRAuth.auth().fetchProvidersForEmailCompletion(email, (providerNSArray, error) => {
241-
if (error) {
242-
reject(error.localizedDescription);
243-
} else {
244-
resolve(firebaseUtils.toJsObject(providerNSArray));
245-
}
246-
});
247-
} catch (ex) {
248-
console.log("Error in firebase.fetchProvidersForEmail: " + ex);
249-
reject(ex);
250-
}
251-
});
252-
};
253-
254232
firebase.fetchSignInMethodsForEmail = email => {
255233
return new Promise((resolve, reject) => {
256234
try {
@@ -781,12 +759,12 @@ firebase.login = arg => {
781759
if (error) {
782760
// ignore, as this one was probably already linked, so just return the user
783761
log("--- linking error: " + error.localizedDescription);
784-
fAuth.signInAndRetrieveDataWithCredentialCompletion(fIRAuthCredential, onCompletionWithAuthResult);
762+
fAuth.signInWithCredentialCompletion(fIRAuthCredential, onCompletionWithAuthResult);
785763
} else {
786764
onCompletionWithAuthResult(authData, error);
787765
}
788766
};
789-
fAuth.currentUser.linkAndRetrieveDataWithCredentialCompletion(fIRAuthCredential, onCompletionLink);
767+
fAuth.currentUser.linkWithCredentialCompletion(fIRAuthCredential, onCompletionLink);
790768

791769
} else {
792770
fAuth.signInWithEmailPasswordCompletion(arg.passwordOptions.email, arg.passwordOptions.password, onCompletionWithAuthResult);
@@ -851,14 +829,14 @@ firebase.login = arg => {
851829
const onCompletionLink = (authData: FIRAuthDataResult, error: NSError) => {
852830
if (error) {
853831
// ignore, as this one was probably already linked, so just return the user
854-
fAuth.signInAndRetrieveDataWithCredentialCompletion(fIRAuthCredential, onCompletionWithAuthResult);
832+
fAuth.signInWithCredentialCompletion(fIRAuthCredential, onCompletionWithAuthResult);
855833
} else {
856834
onCompletionWithAuthResult(authData, error);
857835
}
858836
};
859-
fAuth.currentUser.linkAndRetrieveDataWithCredentialCompletion(fIRAuthCredential, onCompletionLink);
837+
fAuth.currentUser.linkWithCredentialCompletion(fIRAuthCredential, onCompletionLink);
860838
} else {
861-
fAuth.signInAndRetrieveDataWithCredentialCompletion(fIRAuthCredential, onCompletionWithAuthResult);
839+
fAuth.signInWithCredentialCompletion(fIRAuthCredential, onCompletionWithAuthResult);
862840
}
863841
}, arg.phoneOptions.verificationPrompt);
864842
});
@@ -905,15 +883,15 @@ firebase.login = arg => {
905883
if (error) {
906884
// ignore, as this one was probably already linked, so just return the user
907885
log("--- linking error: " + error.localizedDescription);
908-
fAuth.signInAndRetrieveDataWithCredentialCompletion(fIRAuthCredential, onCompletionWithAuthResult);
886+
fAuth.signInWithCredentialCompletion(fIRAuthCredential, onCompletionWithAuthResult);
909887
} else {
910888
onCompletionWithAuthResult(authData);
911889
}
912890
};
913-
fAuth.currentUser.linkAndRetrieveDataWithCredentialCompletion(fIRAuthCredential, onCompletionLink);
891+
fAuth.currentUser.linkWithCredentialCompletion(fIRAuthCredential, onCompletionLink);
914892

915893
} else {
916-
fAuth.signInAndRetrieveDataWithCredentialCompletion(fIRAuthCredential, onCompletionWithAuthResult);
894+
fAuth.signInWithCredentialCompletion(fIRAuthCredential, onCompletionWithAuthResult);
917895
}
918896
}
919897
};
@@ -963,15 +941,15 @@ firebase.login = arg => {
963941
const onCompletionLink = (user, error) => {
964942
if (error) {
965943
// ignore, as this one was probably already linked, so just return the user
966-
fAuth.signInAndRetrieveDataWithCredentialCompletion(fIRAuthCredential, onCompletionWithAuthResult);
944+
fAuth.signInWithCredentialCompletion(fIRAuthCredential, onCompletionWithAuthResult);
967945
} else {
968946
onCompletionWithAuthResult(user);
969947
}
970948
};
971-
fAuth.currentUser.linkAndRetrieveDataWithCredentialCompletion(fIRAuthCredential, onCompletionLink);
949+
fAuth.currentUser.linkWithCredentialCompletion(fIRAuthCredential, onCompletionLink);
972950

973951
} else {
974-
fAuth.signInAndRetrieveDataWithCredentialCompletion(fIRAuthCredential, onCompletionWithAuthResult);
952+
fAuth.signInWithCredentialCompletion(fIRAuthCredential, onCompletionWithAuthResult);
975953
}
976954

977955
} else {

0 commit comments

Comments
 (0)