@@ -1167,8 +1167,8 @@ - (void)unlinkFromProvider:(NSString *)provider
1167
1167
FIRSetAccountInfoRequest *setAccountInfoRequest =
1168
1168
[[FIRSetAccountInfoRequest alloc ] initWithRequestConfiguration: requestConfiguration];
1169
1169
setAccountInfoRequest.accessToken = accessToken;
1170
- BOOL isEmailPasswordProvider = [provider isEqualToString: FIREmailAuthProviderID];
1171
- if (isEmailPasswordProvider ) {
1170
+
1171
+ if ([provider isEqualToString: FIREmailAuthProviderID] ) {
1172
1172
if (!self->_hasEmailPasswordCredential ) {
1173
1173
completeAndCallbackWithError ([FIRAuthErrorUtils noSuchProviderError ]);
1174
1174
return ;
@@ -1181,6 +1181,7 @@ - (void)unlinkFromProvider:(NSString *)provider
1181
1181
}
1182
1182
setAccountInfoRequest.deleteProviders = @[ provider ];
1183
1183
}
1184
+
1184
1185
[FIRAuthBackend setAccountInfo: setAccountInfoRequest
1185
1186
callback: ^(FIRSetAccountInfoResponse *_Nullable response,
1186
1187
NSError *_Nullable error) {
@@ -1189,23 +1190,24 @@ - (void)unlinkFromProvider:(NSString *)provider
1189
1190
completeAndCallbackWithError (error);
1190
1191
return ;
1191
1192
}
1192
- if (isEmailPasswordProvider) {
1193
+
1194
+ // We can't just use the provider info objects in FIRSetAcccountInfoResponse because they
1195
+ // don't have localID and email fields. Remove the specific provider manually.
1196
+ NSMutableDictionary *mutableProviderData = [self ->_providerData mutableCopy ];
1197
+ [mutableProviderData removeObjectForKey: provider];
1198
+ self->_providerData = [mutableProviderData copy ];
1199
+
1200
+ if ([provider isEqualToString: FIREmailAuthProviderID]) {
1193
1201
self->_hasEmailPasswordCredential = NO ;
1194
- } else {
1195
- // We can't just use the provider info objects in FIRSetAcccountInfoResponse because they
1196
- // don't have localID and email fields. Remove the specific provider manually.
1197
- NSMutableDictionary *mutableProviderData = [self ->_providerData mutableCopy ];
1198
- [mutableProviderData removeObjectForKey: provider];
1199
- self->_providerData = [mutableProviderData copy ];
1200
-
1201
- #if TARGET_OS_IOS
1202
- // After successfully unlinking a phone auth provider, remove the phone number from the
1203
- // cached user info.
1204
- if ([provider isEqualToString: FIRPhoneAuthProviderID]) {
1205
- self->_phoneNumber = nil ;
1206
- }
1207
- #endif
1208
1202
}
1203
+ #if TARGET_OS_IOS
1204
+ // After successfully unlinking a phone auth provider, remove the phone number from the
1205
+ // cached user info.
1206
+ if ([provider isEqualToString: FIRPhoneAuthProviderID]) {
1207
+ self->_phoneNumber = nil ;
1208
+ }
1209
+ #endif
1210
+
1209
1211
if (response.IDToken && response.refreshToken ) {
1210
1212
FIRSecureTokenService *tokenService = [[FIRSecureTokenService alloc ]
1211
1213
initWithRequestConfiguration: requestConfiguration
0 commit comments