Skip to content

Commit 6e52a49

Browse files
authored
Introduce UserInfoInterface.PhoneNumber instead. (#704)
Deprecate `UserInfoInterface.phone_number` and introduce `UserInfoInterface.PhoneNumber` instead.
1 parent 3d5ea59 commit 6e52a49

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

auth/src/swig/auth.i

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,22 @@ static CppInstanceManager<Auth> g_auth_instances;
12521252
public string SmsCode { get { return SmsCodeInternal; } }
12531253
%}
12541254

1255+
%attributestring(firebase::auth::PhoneAuthCredential, std::string, SmsCodeInternal, sms_code);
1256+
%typemap(cscode) firebase::auth::PhoneAuthCredential %{
1257+
/// Gets the auto-retrieved SMS verification code if applicable.
1258+
///
1259+
/// This method is supported on Android devices only. It will return empty strings on
1260+
/// other platforms.
1261+
///
1262+
/// When SMS verification is used, you will be called back first via
1263+
/// @ref PhoneAuthProvider.CodeSent, and later
1264+
/// PhoneAuthProvider.VerificationCompleted with a PhoneAuthCredential containing
1265+
/// a non-null SMS code if auto-retrieval succeeded. If Firebase used another approach
1266+
/// to verify the phone number and triggers a callback via
1267+
/// @ref PhoneAuthProvider.VerificationCompleted, then the SMS code can be null.
1268+
public string SmsCode { get { return SmsCodeInternal; } }
1269+
%}
1270+
12551271
%typemap(csclassmodifiers) firebase::auth::FederatedAuthProvider "public class";
12561272

12571273
%typemap(csclassmodifiers) firebase::auth::FederatedOAuthProvider
@@ -1731,11 +1747,25 @@ static CppInstanceManager<Auth> g_auth_instances;
17311747
%}
17321748

17331749
%typemap(cscode) firebase::auth::UserInfoInterface %{
1750+
/// Gets the photo url associated with the user, if any.
17341751
public System.Uri PhotoUrl {
17351752
get {
17361753
return Firebase.FirebaseApp.UrlStringToUri(PhotoUrlInternal);
17371754
}
17381755
}
1756+
1757+
/// @deprecated Please use @ref PhoneNumber instead.
1758+
///
1759+
/// Gets the phone number for the user, in E.164 format.
1760+
[System.Obsolete("Please use `PhoneNumber` instead", false)]
1761+
public string phone_number {
1762+
get { return PhoneNumberInternal; }
1763+
}
1764+
1765+
/// Gets the phone number for the user, in E.164 format.
1766+
public string PhoneNumber {
1767+
get { return PhoneNumberInternal; }
1768+
}
17391769
%}
17401770

17411771

@@ -1845,6 +1875,7 @@ static CppInstanceManager<Auth> g_auth_instances;
18451875
%attributestring(firebase::auth::UserInfoInterface, std::string, DisplayName, display_name);
18461876
%attributestring(firebase::auth::UserInfoInterface, std::string, PhotoUrlInternal, photo_url);
18471877
%attributestring(firebase::auth::UserInfoInterface, std::string, ProviderId, provider_id);
1878+
%attributestring(firebase::auth::UserInfoInterface, std::string, PhoneNumberInternal, phone_number);
18481879

18491880

18501881
%typemap(csinterfaces) firebase::auth::UserInfoInterface

0 commit comments

Comments
 (0)