Skip to content

Commit 01c5346

Browse files
committed
make country code info nscopying
1 parent bdd1b2e commit 01c5346

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

FirebasePhoneAuthUI/Sources/FUICountryCodes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
NS_ASSUME_NONNULL_BEGIN
2020

21-
@interface FUICountryCodeInfo : NSObject
21+
@interface FUICountryCodeInfo : NSObject <NSCopying>
2222

2323
@property (nonatomic, copy) NSString *countryName;
2424
@property (nonatomic, copy) NSString *localizedCountryName;

FirebasePhoneAuthUI/Sources/FUICountryCodes.m

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,31 @@ - (NSString *)countryFlagEmoji {
5757
length:sizeof(bytes)
5858
encoding:NSUTF32LittleEndianStringEncoding];
5959
}
60+
61+
- (id)copyWithZone:(NSZone *_Nullable)zone {
62+
FUICountryCodeInfo *newInfo = [[FUICountryCodeInfo alloc] init];
63+
newInfo.countryName = self.countryName;
64+
newInfo.localizedCountryName = self.localizedCountryName;
65+
newInfo.countryCode = self.countryCode;
66+
newInfo.dialCode = self.dialCode;
67+
newInfo.level = self.level;
68+
return newInfo;
69+
}
70+
71+
- (BOOL)isEqual:(FUICountryCodeInfo *)object {
72+
if (object == self) {
73+
return YES;
74+
}
75+
if (![object isKindOfClass:[self class]]) {
76+
return NO;
77+
}
78+
return object.countryName == self.countryName &&
79+
object.localizedCountryName == self.localizedCountryName &&
80+
object.countryCode == self.countryCode &&
81+
object.dialCode == self.dialCode &&
82+
object.level == self.level;
83+
}
84+
6085
@end
6186

6287
@interface FUICountryCodes ()

samples/swift/FirebaseUI-demo-swift/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5+
<key>FacebookClientToken</key>
6+
<string>aaaaa</string>
57
<key>CFBundleDevelopmentRegion</key>
68
<string>en</string>
79
<key>CFBundleExecutable</key>

samples/swift/FirebaseUI-demo-swift/Samples/Auth/FUIAuthViewController.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,9 @@ class FUIAuthViewController: UITableViewController {
323323
provider = nil
324324
}
325325
case Providers.Phone.rawValue:
326-
provider = FUIPhoneAuth(authUI: self.authUI!)
326+
let phoneAuth = FUIPhoneAuth(authUI: self.authUI!)
327+
phoneAuth.defaultCountryCode = "JP"
328+
provider = phoneAuth
327329
default: provider = nil
328330
}
329331

0 commit comments

Comments
 (0)