diff --git a/FirebaseAnonymousAuthUI.podspec b/FirebaseAnonymousAuthUI.podspec index 29be9894215..d428403c125 100644 --- a/FirebaseAnonymousAuthUI.podspec +++ b/FirebaseAnonymousAuthUI.podspec @@ -9,7 +9,6 @@ Pod::Spec.new do |s| s.platform = :ios s.ios.deployment_target = '10.0' s.ios.framework = 'UIKit' - s.static_framework = true s.requires_arc = true s.cocoapods_version = '>= 1.8.0' s.pod_target_xcconfig = { @@ -21,7 +20,7 @@ Pod::Spec.new do |s| s.dependency 'FirebaseAuthUI' s.dependency 'FirebaseAuth', '~> 8.0' s.dependency 'FirebaseCore' - s.resource_bundle = { + s.resource_bundles = { 'FirebaseAnonymousAuthUI' => [ 'FirebaseAnonymousAuthUI/Sources/{Resources,Strings}/*.{png,lproj}' ] diff --git a/FirebaseAnonymousAuthUI/FirebaseAnonymousAuthUITests/FirebaseAnonymousAuthUITests.m b/FirebaseAnonymousAuthUI/FirebaseAnonymousAuthUITests/FirebaseAnonymousAuthUITests.m index 56ef2f010dc..1f3f911ed2d 100644 --- a/FirebaseAnonymousAuthUI/FirebaseAnonymousAuthUITests/FirebaseAnonymousAuthUITests.m +++ b/FirebaseAnonymousAuthUI/FirebaseAnonymousAuthUITests/FirebaseAnonymousAuthUITests.m @@ -30,10 +30,6 @@ @implementation FirebaseAnonymousAuthUITests - (void)setUp { [super setUp]; - - id mockUtilsClass = OCMClassMock([FUIAuthUtils class]); - OCMStub(ClassMethod([mockUtilsClass bundleNamed:OCMOCK_ANY])). - andReturn([NSBundle bundleForClass:[FUIAnonymousAuth class]]); id authUIClass = OCMClassMock([FUIAuth class]); OCMStub(ClassMethod([authUIClass authUIWithAuth:OCMOCK_ANY])). diff --git a/FirebaseAnonymousAuthUI/Sources/FUIAnonymousAuth.m b/FirebaseAnonymousAuthUI/Sources/FUIAnonymousAuth.m index c4589633cfd..20a0a5e045d 100644 --- a/FirebaseAnonymousAuthUI/Sources/FUIAnonymousAuth.m +++ b/FirebaseAnonymousAuthUI/Sources/FUIAnonymousAuth.m @@ -49,6 +49,11 @@ @implementation FUIAnonymousAuth { UIViewController *_presentingViewController; } ++ (NSBundle *)bundle { + return [FUIAuthUtils bundleNamed:kBundleName + inFrameworkBundle:[NSBundle bundleForClass:[self class]]]; +} + - (instancetype)init { return [self initWithAuthUI:[FUIAuth defaultAuthUI]]; } @@ -85,11 +90,13 @@ - (NSString *)shortName { } - (NSString *)signInLabel { - return FUILocalizedStringFromTableInBundle(kSignInAsGuest, kTableName, kBundleName); + return FUILocalizedStringFromTableInBundle(kSignInAsGuest, + kTableName, + [FUIAnonymousAuth bundle]); } - (UIImage *)icon { - return [FUIAuthUtils imageNamed:@"ic_anonymous" fromBundleNameOrNil:kBundleName]; + return [FUIAuthUtils imageNamed:@"ic_anonymous" fromBundle:[FUIAnonymousAuth bundle]]; } - (UIColor *)buttonBackgroundColor { diff --git a/FirebaseAnonymousAuthUI/Sources/Public/FirebaseAnonymousAuthUI/FUIAnonymousAuth.h b/FirebaseAnonymousAuthUI/Sources/Public/FirebaseAnonymousAuthUI/FUIAnonymousAuth.h index 77b7847cc89..a549b066202 100644 --- a/FirebaseAnonymousAuthUI/Sources/Public/FirebaseAnonymousAuthUI/FUIAnonymousAuth.h +++ b/FirebaseAnonymousAuthUI/Sources/Public/FirebaseAnonymousAuthUI/FUIAnonymousAuth.h @@ -28,6 +28,11 @@ NS_ASSUME_NONNULL_BEGIN */ @property(nonatomic, readwrite) FUIButtonAlignment buttonAlignment; +/** @fn bundle + @brief Returns the FirebaseAnonymousAuthUI resource bundle. + */ ++ (NSBundle *)bundle; + /** @fn init @brief Initialize the instance with the default AuthUI. */ diff --git a/FirebaseAuthUI.podspec b/FirebaseAuthUI.podspec index 6e33ed81346..af18a601eaa 100644 --- a/FirebaseAuthUI.podspec +++ b/FirebaseAuthUI.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.dependency 'FirebaseAuth' s.dependency 'FirebaseCore' s.dependency 'GoogleUtilities/UserDefaults' - s.resource_bundle = { + s.resource_bundles = { 'FirebaseAuthUI' => ['FirebaseAuthUI/Sources/{Resources,Strings}/*.{xib,png,lproj}'] } diff --git a/FirebaseAuthUI/Sources/FUIAuthBaseViewController.m b/FirebaseAuthUI/Sources/FUIAuthBaseViewController.m index bae5d29d5f5..e912dad2a63 100644 --- a/FirebaseAuthUI/Sources/FUIAuthBaseViewController.m +++ b/FirebaseAuthUI/Sources/FUIAuthBaseViewController.m @@ -87,7 +87,7 @@ - (instancetype)initWithNibName:(NSString *)nibNameOrNil - (instancetype)initWithAuthUI:(FUIAuth *)authUI { return [self initWithNibName:NSStringFromClass([self class]) - bundle:[FUIAuthUtils bundleNamed:FUIAuthBundleName] + bundle:[FUIAuthUtils authUIBundle] authUI:authUI]; } diff --git a/FirebaseAuthUI/Sources/FUIAuthPickerViewController.m b/FirebaseAuthUI/Sources/FUIAuthPickerViewController.m index 98f7eff0fa6..d302cddf0e8 100644 --- a/FirebaseAuthUI/Sources/FUIAuthPickerViewController.m +++ b/FirebaseAuthUI/Sources/FUIAuthPickerViewController.m @@ -73,7 +73,7 @@ @implementation FUIAuthPickerViewController { - (instancetype)initWithAuthUI:(FUIAuth *)authUI { return [self initWithNibName:@"FUIAuthPickerViewController" - bundle:[FUIAuthUtils bundleNamed:FUIAuthBundleName] + bundle:[FUIAuthUtils authUIBundle] authUI:authUI]; } diff --git a/FirebaseAuthUI/Sources/FUIAuthStrings.m b/FirebaseAuthUI/Sources/FUIAuthStrings.m index b520a3d96f8..99810b10a00 100644 --- a/FirebaseAuthUI/Sources/FUIAuthStrings.m +++ b/FirebaseAuthUI/Sources/FUIAuthStrings.m @@ -130,12 +130,12 @@ } NSString *FUILocalizedStringFromTable(NSString *key, NSString *table) { - return FUILocalizedStringFromTableInBundle(key, table, FUIAuthBundleName); + return FUILocalizedStringFromTableInBundle(key, table, [FUIAuthUtils authUIBundle]); } NSString *FUILocalizedStringFromTableInBundle(NSString *key, NSString *table, - NSString *_Nullable bundleName) { + NSBundle *_Nullable bundle) { // Don't load defaultAuthUI if the default app isn't configured. We don't recommend // people do this in our docs, but if for whatever reason they want to use a custom // app, this code shouldn't crash. @@ -150,11 +150,10 @@ } } } - NSBundle *frameworkBundle = [FUIAuthUtils bundleNamed:bundleName]; - if (frameworkBundle == nil) { - frameworkBundle = [NSBundle mainBundle]; + if (bundle == nil) { + bundle = [NSBundle mainBundle]; } - return [frameworkBundle localizedStringForKey:key value:nil table:table]; + return [bundle localizedStringForKey:key value:nil table:table]; } NS_ASSUME_NONNULL_END diff --git a/FirebaseAuthUI/Sources/FUIAuthUtils.m b/FirebaseAuthUI/Sources/FUIAuthUtils.m index 6ff4ddfe6bd..7ebb711eba9 100644 --- a/FirebaseAuthUI/Sources/FUIAuthUtils.m +++ b/FirebaseAuthUI/Sources/FUIAuthUtils.m @@ -24,40 +24,53 @@ @implementation FUIAuthUtils -+ (nullable NSBundle *)bundleNamed:(nullable NSString *)bundleName { - NSBundle *frameworkBundle = nil; ++ (NSBundle *)authUIBundle { + return [self bundleNamed:FUIAuthBundleName + inFrameworkBundle:[NSBundle bundleForClass:[self class]]]; +} + ++ (nullable NSBundle *)bundleNamed:(nullable NSString *)bundleName + inFrameworkBundle:(nullable NSBundle *)framework { + NSBundle *returnBundle = nil; if (!bundleName) { bundleName = FUIAuthBundleName; } + // Use the main bundle as a default if the framework wasn't provided. + NSBundle *frameworkBundle = framework; + if (frameworkBundle == nil) { + // If frameworkBundle is unspecified, assume main bundle/static linking. + frameworkBundle = [NSBundle mainBundle]; + } + // If using static frameworks, the bundle will be included directly in the main + // bundle. NSString *path = [[NSBundle mainBundle] pathForResource:bundleName ofType:@"bundle"]; + + // Otherwise, check the appropriate framework bundle. if (!path) { - // Check framework resources if bundle isn't present in main bundle. - path = [[NSBundle mainBundle] pathForResource:bundleName ofType:@"framework"]; + path = [frameworkBundle pathForResource:bundleName ofType:@"bundle"]; } - frameworkBundle = [NSBundle bundleWithPath:path]; - if (!frameworkBundle) { - frameworkBundle = [NSBundle bundleForClass:[self class]]; + if (!path) { + NSLog(@"Warning: Unable to find bundle %@ in framework %@.", bundleName, framework); + // Fall back on the root module. + return frameworkBundle; } - return frameworkBundle; + returnBundle = [NSBundle bundleWithPath:path]; + return returnBundle; } + (nullable UIImage *)imageNamed:(NSString *)name fromBundle:(nullable NSBundle *)bundle { if (!bundle) { - bundle = [self bundleNamed:nil]; + bundle = [self authUIBundle]; } NSString *path = [bundle pathForResource:name ofType:@"png"]; if (!path) { NSLog(@"Warning: Unable to find asset %@ in bundle %@.", name, bundle); } - return [UIImage imageWithContentsOfFile:path]; -} - -+ (nullable UIImage *)imageNamed:(NSString *)name fromBundleNameOrNil:(nullable NSString *)bundleNameOrNil { - NSString *path = [[FUIAuthUtils bundleNamed:bundleNameOrNil] pathForResource:name ofType:@"png"]; - if (!path) { - NSLog(@"Warning: Unable to find asset %@ in bundle named %@.", name, bundleNameOrNil); + if (@available(iOS 13.0, *)) { + return [UIImage imageNamed:name inBundle:bundle withConfiguration:nil]; + } else { + return [UIImage imageWithContentsOfFile:path]; } - return [UIImage imageWithContentsOfFile:path]; } @end diff --git a/FirebaseAuthUI/Sources/FUIStaticContentTableViewController.m b/FirebaseAuthUI/Sources/FUIStaticContentTableViewController.m index 3dee8a5feae..a019d443739 100644 --- a/FirebaseAuthUI/Sources/FUIStaticContentTableViewController.m +++ b/FirebaseAuthUI/Sources/FUIStaticContentTableViewController.m @@ -68,7 +68,7 @@ - (instancetype)initWithContents:(nullable FUIStaticContentTableViewContent *)co footerText:(nullable NSString *)footerText footerAction:(nullable FUIStaticContentTableViewCellAction)footerAction { if (self = [super initWithNibName:NSStringFromClass([self class]) - bundle:[FUIAuthUtils bundleNamed:FUIAuthBundleName] + bundle:[FUIAuthUtils authUIBundle] authUI:[FUIAuth defaultAuthUI]]) { _tableViewManager.contents = contents; _nextAction = [nextAction copy]; diff --git a/FirebaseAuthUI/Sources/FUIStaticContentTableViewManager.m b/FirebaseAuthUI/Sources/FUIStaticContentTableViewManager.m index 039d0062cee..8c67539c1c8 100644 --- a/FirebaseAuthUI/Sources/FUIStaticContentTableViewManager.m +++ b/FirebaseAuthUI/Sources/FUIStaticContentTableViewManager.m @@ -64,11 +64,11 @@ - (void)setTableView:(nullable UITableView *)tableView { [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kCellReuseIdentitfier]; UINib *passwordCellNib = [UINib nibWithNibName:NSStringFromClass([FUIPasswordTableViewCell class]) - bundle:[FUIAuthUtils bundleNamed:FUIAuthBundleName]]; + bundle:[FUIAuthUtils authUIBundle]]; [tableView registerNib:passwordCellNib forCellReuseIdentifier:kPasswordCellReuseIdentitfier]; UINib *inputCellNib = [UINib nibWithNibName:NSStringFromClass([FUIInputTableViewCell class]) - bundle:[FUIAuthUtils bundleNamed:FUIAuthBundleName]]; + bundle:[FUIAuthUtils authUIBundle]]; [tableView registerNib:inputCellNib forCellReuseIdentifier:kInputCellReuseIdentitfier]; } diff --git a/FirebaseAuthUI/Sources/Public/FirebaseAuthUI/FUIAuthStrings.h b/FirebaseAuthUI/Sources/Public/FirebaseAuthUI/FUIAuthStrings.h index 3ddd4790c50..700ab911ce7 100644 --- a/FirebaseAuthUI/Sources/Public/FirebaseAuthUI/FUIAuthStrings.h +++ b/FirebaseAuthUI/Sources/Public/FirebaseAuthUI/FUIAuthStrings.h @@ -133,12 +133,12 @@ NSString *FUILocalizedStringFromTable(NSString *key, NSString *table); @brief Gets a localized string from a name. @param key The key value of the string. @param table The localization table name. - @param bundleName The value of bundlu to look for. If nil is passed looking in apps bundle. + @param bundle The bundle containing the strings. If nil is provided, this function searches the main app bundle. @return The string by the key localized in the current locale. */ NSString *FUILocalizedStringFromTableInBundle(NSString *key, NSString *table, - NSString *_Nullable bundleName); + NSBundle *_Nullable bundle); #ifdef __cplusplus } diff --git a/FirebaseAuthUI/Sources/Public/FirebaseAuthUI/FUIAuthUtils.h b/FirebaseAuthUI/Sources/Public/FirebaseAuthUI/FUIAuthUtils.h index 10bc8b06138..a62908af415 100644 --- a/FirebaseAuthUI/Sources/Public/FirebaseAuthUI/FUIAuthUtils.h +++ b/FirebaseAuthUI/Sources/Public/FirebaseAuthUI/FUIAuthUtils.h @@ -28,26 +28,22 @@ extern NSString *const FUIAuthBundleName; - (instancetype)init NS_UNAVAILABLE; ++ (NSBundle *)authUIBundle; + /** @fn bundleNamed: @brief Gets the framework bundle for specified name @param bundleName Name of the bundle to retreive. If nil, this returns the default bundle for FirebaseUI. + @param framework The name of the framework module the resource bundle should be present in. */ -+ (nullable NSBundle *)bundleNamed:(nullable NSString *)bundleName; - -/** @fn imageNamed:fromBundle: - @brief Gets a UIImage with the given name, assuming it's a png. - @param name Name of the image to retreive. - @param bundleNameOrNil Name of the bundle to retreive. If nil, this method will look into the - default FirebaseUI framework bundle. - */ -+ (nullable UIImage *)imageNamed:(NSString *)name fromBundleNameOrNil:(nullable NSString *)bundleNameOrNil; ++ (nullable NSBundle *)bundleNamed:(nullable NSString *)bundleName + inFrameworkBundle:(nullable NSBundle *)framework; /** @fn imageNamed:fromBundle: @brief Gets a UIImage with the given name, assuming it's a png. @param name Name of the image to retreive. @param bundle The bundle to retrieve the image from. If nil, this method will look into the - default FirebaseUI framework bundle. + default FirebaseAuthUI framework bundle. */ + (nullable UIImage *)imageNamed:(NSString *)name fromBundle:(nullable NSBundle *)bundle; diff --git a/FirebaseEmailAuthUI.podspec b/FirebaseEmailAuthUI.podspec index bd20b36c346..e61a6cd8ef7 100644 --- a/FirebaseEmailAuthUI.podspec +++ b/FirebaseEmailAuthUI.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.dependency 'FirebaseAuth', '~> 8.0' s.dependency 'FirebaseCore' s.dependency 'GoogleUtilities/UserDefaults' - s.resource_bundle = { + s.resource_bundles = { 'FirebaseEmailAuthUI' => ['FirebaseEmailAuthUI/Sources/Resources/*.{xib,png}'] } diff --git a/FirebaseEmailAuthUI/FirebaseEmailAuthUITests/FirebaseEmailAuthUITests.m b/FirebaseEmailAuthUI/FirebaseEmailAuthUITests/FirebaseEmailAuthUITests.m index bd262f0da1b..3cd1eb1ab9a 100644 --- a/FirebaseEmailAuthUI/FirebaseEmailAuthUITests/FirebaseEmailAuthUITests.m +++ b/FirebaseEmailAuthUI/FirebaseEmailAuthUITests/FirebaseEmailAuthUITests.m @@ -31,10 +31,6 @@ @implementation FirebaseEmailAuthUITests - (void)setUp { [super setUp]; - - id mockUtilsClass = OCMClassMock([FUIAuthUtils class]); - OCMStub(ClassMethod([mockUtilsClass bundleNamed:OCMOCK_ANY])). - andReturn([NSBundle bundleForClass:[FUIEmailAuth class]]); id authUIClass = OCMClassMock([FUIAuth class]); OCMStub([authUIClass setEmailAuthProvider:[OCMArg any]]).andDo(^(NSInvocation *invocation){ diff --git a/FirebaseEmailAuthUI/Sources/FUIConfirmEmailViewController.m b/FirebaseEmailAuthUI/Sources/FUIConfirmEmailViewController.m index 6e9c01268b6..b9a17c865f5 100755 --- a/FirebaseEmailAuthUI/Sources/FUIConfirmEmailViewController.m +++ b/FirebaseEmailAuthUI/Sources/FUIConfirmEmailViewController.m @@ -74,7 +74,7 @@ @implementation FUIConfirmEmailViewController - (instancetype)initWithAuthUI:(FUIAuth *)authUI { return [self initWithNibName:NSStringFromClass([self class]) - bundle:[FUIAuthUtils bundleNamed:FUIEmailAuthBundleName] + bundle:[FUIEmailAuth bundle] authUI:authUI]; } @@ -207,7 +207,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView FUIAuthTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellReuseIdentifier]; if (!cell) { UINib *cellNib = [UINib nibWithNibName:NSStringFromClass([FUIAuthTableViewCell class]) - bundle:[FUIAuthUtils bundleNamed:FUIAuthBundleName]]; + bundle:[FUIAuthUtils authUIBundle]]; [tableView registerNib:cellNib forCellReuseIdentifier:kCellReuseIdentifier]; cell = [tableView dequeueReusableCellWithIdentifier:kCellReuseIdentifier]; } diff --git a/FirebaseEmailAuthUI/Sources/FUIEmailAuth.m b/FirebaseEmailAuthUI/Sources/FUIEmailAuth.m index 81873a10a2b..41fee6d8ac8 100644 --- a/FirebaseEmailAuthUI/Sources/FUIEmailAuth.m +++ b/FirebaseEmailAuthUI/Sources/FUIEmailAuth.m @@ -71,6 +71,11 @@ @interface FUIEmailAuth () @implementation FUIEmailAuth ++ (NSBundle *)bundle { + return [FUIAuthUtils bundleNamed:FUIEmailAuthBundleName + inFrameworkBundle:[NSBundle bundleForClass:[self class]]]; +} + - (instancetype)init { return [self initAuthAuthUI:[FUIAuth defaultAuthUI] signInMethod:FIREmailPasswordAuthSignInMethod @@ -143,7 +148,7 @@ - (NSString *)signInLabel { } - (UIImage *)icon { - return [FUIAuthUtils imageNamed:@"ic_email" fromBundleNameOrNil:FUIEmailAuthBundleName]; + return [FUIAuthUtils imageNamed:@"ic_email" fromBundle:[FUIEmailAuth bundle]]; } - (UIColor *)buttonBackgroundColor { diff --git a/FirebaseEmailAuthUI/Sources/FUIEmailAuthStrings.m b/FirebaseEmailAuthUI/Sources/FUIEmailAuthStrings.m index 2bd17dc8e37..ff2fcc9de3f 100644 --- a/FirebaseEmailAuthUI/Sources/FUIEmailAuthStrings.m +++ b/FirebaseEmailAuthUI/Sources/FUIEmailAuthStrings.m @@ -14,6 +14,7 @@ // limitations under the License. // +#import "FirebaseEmailAuthUI/Sources/Public/FirebaseEmailAuthUI/FUIEmailAuth.h" #import "FirebaseEmailAuthUI/Sources/FUIEmailAuthStrings.h" #if SWIFT_PACKAGE @@ -30,5 +31,5 @@ NSString *FUIEmailAuthLocalizedString(NSString *key) { return FUILocalizedStringFromTableInBundle(key, kEmailAuthProviderTableName, - FUIEmailAuthBundleName); + [FUIEmailAuth bundle]); } diff --git a/FirebaseEmailAuthUI/Sources/FUIEmailEntryViewController.m b/FirebaseEmailAuthUI/Sources/FUIEmailEntryViewController.m index dd960b7275a..3a98040c7af 100755 --- a/FirebaseEmailAuthUI/Sources/FUIEmailEntryViewController.m +++ b/FirebaseEmailAuthUI/Sources/FUIEmailEntryViewController.m @@ -74,7 +74,7 @@ @implementation FUIEmailEntryViewController { - (instancetype)initWithAuthUI:(FUIAuth *)authUI { return [self initWithNibName:NSStringFromClass([self class]) - bundle:[FUIAuthUtils bundleNamed:FUIEmailAuthBundleName] + bundle:[FUIEmailAuth bundle] authUI:authUI]; } @@ -280,7 +280,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView FUIAuthTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellReuseIdentifier]; if (!cell) { UINib *cellNib = [UINib nibWithNibName:NSStringFromClass([FUIAuthTableViewCell class]) - bundle:[FUIAuthUtils bundleNamed:FUIAuthBundleName]]; + bundle:[FUIAuthUtils authUIBundle]]; [tableView registerNib:cellNib forCellReuseIdentifier:kCellReuseIdentifier]; cell = [tableView dequeueReusableCellWithIdentifier:kCellReuseIdentifier]; } diff --git a/FirebaseEmailAuthUI/Sources/FUIPasswordRecoveryViewController.m b/FirebaseEmailAuthUI/Sources/FUIPasswordRecoveryViewController.m index 33a0f4ea6f9..43edc1fccc1 100755 --- a/FirebaseEmailAuthUI/Sources/FUIPasswordRecoveryViewController.m +++ b/FirebaseEmailAuthUI/Sources/FUIPasswordRecoveryViewController.m @@ -19,6 +19,7 @@ #import #import +#import "FirebaseEmailAuthUI/Sources/Public/FirebaseEmailAuthUI/FUIEmailAuth.h" #import "FirebaseEmailAuthUI/Sources/FUIEmailAuthStrings.h" /** @var kCellReuseIdentifier @@ -60,7 +61,7 @@ @implementation FUIPasswordRecoveryViewController { - (instancetype)initWithAuthUI:(FUIAuth *)authUI email:(NSString *_Nullable)email { return [self initWithNibName:NSStringFromClass([self class]) - bundle:[FUIAuthUtils bundleNamed:FUIEmailAuthBundleName] + bundle:[FUIEmailAuth bundle] authUI:authUI email:email]; } @@ -168,7 +169,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView FUIAuthTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellReuseIdentifier]; if (!cell) { UINib *cellNib = [UINib nibWithNibName:NSStringFromClass([FUIAuthTableViewCell class]) - bundle:[FUIAuthUtils bundleNamed:FUIAuthBundleName]]; + bundle:[FUIAuthUtils authUIBundle]]; [tableView registerNib:cellNib forCellReuseIdentifier:kCellReuseIdentifier]; cell = [tableView dequeueReusableCellWithIdentifier:kCellReuseIdentifier]; } diff --git a/FirebaseEmailAuthUI/Sources/FUIPasswordSignInViewController.m b/FirebaseEmailAuthUI/Sources/FUIPasswordSignInViewController.m index a5bcff22cd9..eaf9ebce714 100755 --- a/FirebaseEmailAuthUI/Sources/FUIPasswordSignInViewController.m +++ b/FirebaseEmailAuthUI/Sources/FUIPasswordSignInViewController.m @@ -67,7 +67,7 @@ @implementation FUIPasswordSignInViewController { - (instancetype)initWithAuthUI:(FUIAuth *)authUI email:(NSString *_Nullable)email { return [self initWithNibName:NSStringFromClass([self class]) - bundle:[FUIAuthUtils bundleNamed:FUIEmailAuthBundleName] + bundle:[FUIEmailAuth bundle] authUI:authUI email:email]; } @@ -246,7 +246,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView FUIAuthTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellReuseIdentifier]; if (!cell) { UINib *cellNib = [UINib nibWithNibName:NSStringFromClass([FUIAuthTableViewCell class]) - bundle:[FUIAuthUtils bundleNamed:FUIAuthBundleName]]; + bundle:[FUIAuthUtils authUIBundle]]; [tableView registerNib:cellNib forCellReuseIdentifier:kCellReuseIdentifier]; cell = [tableView dequeueReusableCellWithIdentifier:kCellReuseIdentifier]; } diff --git a/FirebaseEmailAuthUI/Sources/FUIPasswordSignUpViewController.m b/FirebaseEmailAuthUI/Sources/FUIPasswordSignUpViewController.m index 1fd2c092200..fda0d26f213 100755 --- a/FirebaseEmailAuthUI/Sources/FUIPasswordSignUpViewController.m +++ b/FirebaseEmailAuthUI/Sources/FUIPasswordSignUpViewController.m @@ -19,6 +19,7 @@ #import #import +#import "FirebaseEmailAuthUI/Sources/Public/FirebaseEmailAuthUI/FUIEmailAuth.h" #import "FirebaseEmailAuthUI/Sources/FUIEmailAuthStrings.h" /** @var kCellReuseIdentifier @@ -90,7 +91,7 @@ - (instancetype)initWithAuthUI:(FUIAuth *)authUI email:(NSString *_Nullable)email requireDisplayName:(BOOL)requireDisplayName { return [self initWithNibName:NSStringFromClass([self class]) - bundle:[FUIAuthUtils bundleNamed:FUIEmailAuthBundleName] + bundle:[FUIEmailAuth bundle] authUI:authUI email:email requireDisplayName:requireDisplayName]; @@ -263,7 +264,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView FUIAuthTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellReuseIdentifier]; if (!cell) { UINib *cellNib = [UINib nibWithNibName:NSStringFromClass([FUIAuthTableViewCell class]) - bundle:[FUIAuthUtils bundleNamed:FUIAuthBundleName]]; + bundle:[FUIAuthUtils authUIBundle]]; [tableView registerNib:cellNib forCellReuseIdentifier:kCellReuseIdentifier]; cell = [tableView dequeueReusableCellWithIdentifier:kCellReuseIdentifier]; } @@ -361,7 +362,7 @@ - (UIButton *)visibilityToggleButtonForPasswordField { - (void)updateIconForRightViewButton:(UIButton *)button { NSString *imageName = _passwordField.secureTextEntry ? @"ic_visibility" : @"ic_visibility_off"; - UIImage *image = [FUIAuthUtils imageNamed:imageName fromBundleNameOrNil:FUIAuthBundleName]; + UIImage *image = [FUIAuthUtils imageNamed:imageName fromBundle:[FUIAuthUtils authUIBundle]]; [button setImage:image forState:UIControlStateNormal]; } diff --git a/FirebaseEmailAuthUI/Sources/FUIPasswordVerificationViewController.m b/FirebaseEmailAuthUI/Sources/FUIPasswordVerificationViewController.m index d66d18e7dfc..c07b1804b9b 100755 --- a/FirebaseEmailAuthUI/Sources/FUIPasswordVerificationViewController.m +++ b/FirebaseEmailAuthUI/Sources/FUIPasswordVerificationViewController.m @@ -68,7 +68,7 @@ - (instancetype)initWithAuthUI:(FUIAuth *)authUI email:(NSString *_Nullable)email newCredential:(FIRAuthCredential *)newCredential { return [self initWithNibName:NSStringFromClass([self class]) - bundle:[FUIAuthUtils bundleNamed:FUIEmailAuthBundleName] + bundle:[FUIEmailAuth bundle] authUI:authUI email:email newCredential:newCredential]; @@ -205,7 +205,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView FUIAuthTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellReuseIdentifier]; if (!cell) { UINib *cellNib = [UINib nibWithNibName:NSStringFromClass([FUIAuthTableViewCell class]) - bundle:[FUIAuthUtils bundleNamed:FUIAuthBundleName]]; + bundle:[FUIAuthUtils authUIBundle]]; [tableView registerNib:cellNib forCellReuseIdentifier:kCellReuseIdentifier]; cell = [tableView dequeueReusableCellWithIdentifier:kCellReuseIdentifier]; } diff --git a/FirebaseEmailAuthUI/Sources/Public/FirebaseEmailAuthUI/FUIEmailAuth.h b/FirebaseEmailAuthUI/Sources/Public/FirebaseEmailAuthUI/FUIEmailAuth.h index 864bfe650c8..22fa242328d 100644 --- a/FirebaseEmailAuthUI/Sources/Public/FirebaseEmailAuthUI/FUIEmailAuth.h +++ b/FirebaseEmailAuthUI/Sources/Public/FirebaseEmailAuthUI/FUIEmailAuth.h @@ -41,6 +41,8 @@ NS_ASSUME_NONNULL_BEGIN */ @property(nonatomic, readwrite) FUIButtonAlignment buttonAlignment; ++ (NSBundle *)bundle; + /** @fn initAuthAuthUI:signInMethod:forceSameDevice:allowNewEmailAccounts:actionCodeSetting: @brief Initializer with several configurations. @param authUI The auth UI object that this auth UI provider associate with. diff --git a/FirebaseFacebookAuthUI.podspec b/FirebaseFacebookAuthUI.podspec index d65f8d349c8..643125d2ece 100644 --- a/FirebaseFacebookAuthUI.podspec +++ b/FirebaseFacebookAuthUI.podspec @@ -25,7 +25,7 @@ Pod::Spec.new do |s| s.dependency 'GoogleUtilities/UserDefaults' s.dependency 'FBSDKLoginKit', '~> 9.0' s.dependency 'FBSDKCoreKit' - s.resource_bundle = { + s.resource_bundles = { 'FirebaseFacebookAuthUI' => ['FirebaseFacebookAuthUI/Sources/{Resources,Strings}/*.{png,lproj}'] } diff --git a/FirebaseFacebookAuthUI/FirebaseFacebookAuthUITests/FirebaseFacebookAuthUITests.m b/FirebaseFacebookAuthUI/FirebaseFacebookAuthUITests/FirebaseFacebookAuthUITests.m index ad563ed2534..45f15428c74 100644 --- a/FirebaseFacebookAuthUI/FirebaseFacebookAuthUITests/FirebaseFacebookAuthUITests.m +++ b/FirebaseFacebookAuthUI/FirebaseFacebookAuthUITests/FirebaseFacebookAuthUITests.m @@ -38,10 +38,6 @@ @implementation FirebaseFacebookAuthUITests - (void)setUp { [super setUp]; - id mockUtilsClass = OCMClassMock([FUIAuthUtils class]); - OCMStub(ClassMethod([mockUtilsClass bundleNamed:OCMOCK_ANY])). - andReturn([NSBundle bundleForClass:[FUIFacebookAuthTest class]]); - id authClass = OCMClassMock([FIRAuth class]); OCMStub(ClassMethod([authClass auth])). andReturn(authClass); @@ -50,6 +46,11 @@ - (void)setUp { OCMStub(ClassMethod([self.mockOAuthProvider providerWithProviderID:OCMOCK_ANY])). andReturn(self.mockOAuthProvider); + id mockUtilsClass = OCMClassMock([FUIAuthUtils class]); + OCMStub(ClassMethod([mockUtilsClass bundleNamed:OCMOCK_ANY + inFrameworkBundle:OCMOCK_ANY])). + andReturn([NSBundle bundleForClass:[FUIFacebookAuthTest class]]); + FIRAuth *auth = [FIRAuth auth]; self.authUI = [FUIAuth authUIWithAuth:auth]; self.provider = [[FUIFacebookAuthTest alloc] initWithAuthUI:self.authUI]; diff --git a/FirebaseFacebookAuthUI/Sources/FUIFacebookAuth.m b/FirebaseFacebookAuthUI/Sources/FUIFacebookAuth.m index 1f4a3d60e3d..8a48243739f 100644 --- a/FirebaseFacebookAuthUI/Sources/FUIFacebookAuth.m +++ b/FirebaseFacebookAuthUI/Sources/FUIFacebookAuth.m @@ -88,6 +88,11 @@ @implementation FUIFacebookAuth { NSString *_email; } ++ (NSBundle *)bundle { + return [FUIAuthUtils bundleNamed:kBundleName + inFrameworkBundle:[NSBundle bundleForClass:[self class]]]; +} + - (instancetype)initWithAuthUI:(FUIAuth *)authUI permissions:(NSArray *)permissions { self = [super init]; @@ -145,11 +150,13 @@ - (NSString *)shortName { } - (NSString *)signInLabel { - return FUILocalizedStringFromTableInBundle(kSignInWithFacebook, kTableName, kBundleName); + return FUILocalizedStringFromTableInBundle(kSignInWithFacebook, + kTableName, + [FUIFacebookAuth bundle]); } - (UIImage *)icon { - return [FUIAuthUtils imageNamed:@"ic_facebook" fromBundleNameOrNil:kBundleName]; + return [FUIAuthUtils imageNamed:@"ic_facebook" fromBundle:[FUIFacebookAuth bundle]]; } - (UIColor *)buttonBackgroundColor { @@ -311,9 +318,11 @@ - (void)configureProvider { NSString *facebookDisplayName = [bundle objectForInfoDictionaryKey:kFacebookDisplayName]; if (facebookAppId == nil || facebookDisplayName == nil) { - bundle = [FUIAuthUtils bundleNamed:nil]; - facebookAppId = [bundle objectForInfoDictionaryKey:kFacebookAppId]; - facebookDisplayName = [bundle objectForInfoDictionaryKey:kFacebookDisplayName]; + // Executes in test targets only. + bundle = [FUIFacebookAuth bundle]; + facebookAppId = facebookAppId ?: [bundle objectForInfoDictionaryKey:kFacebookAppId]; + facebookDisplayName = facebookDisplayName ?: + [bundle objectForInfoDictionaryKey:kFacebookDisplayName]; } if (!(facebookAppId && facebookDisplayName)) { diff --git a/FirebaseGoogleAuthUI.podspec b/FirebaseGoogleAuthUI.podspec index 5c3ba9e07f0..61bd0392101 100644 --- a/FirebaseGoogleAuthUI.podspec +++ b/FirebaseGoogleAuthUI.podspec @@ -23,7 +23,7 @@ Pod::Spec.new do |s| s.dependency 'FirebaseAuth', '~> 8.0' s.dependency 'FirebaseCore' s.dependency 'GoogleUtilities/UserDefaults' - s.resource_bundle = { + s.resource_bundles = { 'FirebaseGoogleAuthUI' => ['FirebaseGoogleAuthUI/Sources/{Resources,Strings}/*.{png,lproj}'] } diff --git a/FirebaseGoogleAuthUI/FirebaseGoogleAuthUITests/FirebaseGoogleAuthUITests.m b/FirebaseGoogleAuthUI/FirebaseGoogleAuthUITests/FirebaseGoogleAuthUITests.m index 823e4144977..f839549f02f 100644 --- a/FirebaseGoogleAuthUI/FirebaseGoogleAuthUITests/FirebaseGoogleAuthUITests.m +++ b/FirebaseGoogleAuthUI/FirebaseGoogleAuthUITests/FirebaseGoogleAuthUITests.m @@ -36,9 +36,6 @@ @implementation FirebaseGoogleAuthUITests - (void)setUp { [super setUp]; - id mockUtilsClass = OCMClassMock([FUIAuthUtils class]); - OCMStub(ClassMethod([mockUtilsClass bundleNamed:OCMOCK_ANY])). - andReturn([NSBundle bundleForClass:[FUIGoogleAuth class]]); id authClass = OCMClassMock([FIRAuth class]); OCMStub(ClassMethod([authClass auth])). diff --git a/FirebaseGoogleAuthUI/Sources/FUIGoogleAuth.m b/FirebaseGoogleAuthUI/Sources/FUIGoogleAuth.m index a1615fb0b9f..7e3cb541499 100644 --- a/FirebaseGoogleAuthUI/Sources/FUIGoogleAuth.m +++ b/FirebaseGoogleAuthUI/Sources/FUIGoogleAuth.m @@ -66,6 +66,11 @@ @implementation FUIGoogleAuth { NSString *_email; } ++ (NSBundle *)bundle { + return [FUIAuthUtils bundleNamed:kBundleName + inFrameworkBundle:[NSBundle bundleForClass:[self class]]]; +} + - (instancetype)initWithAuthUI:(FUIAuth *)authUI { return [self initWithAuthUI:authUI scopes:@[kGoogleUserInfoEmailScope, kGoogleUserInfoProfileScope]]; } @@ -123,11 +128,13 @@ - (NSString *)shortName { } - (NSString *)signInLabel { - return FUILocalizedStringFromTableInBundle(kSignInWithGoogle, kTableName, kBundleName); + return FUILocalizedStringFromTableInBundle(kSignInWithGoogle, + kTableName, + [FUIGoogleAuth bundle]); } - (UIImage *)icon { - return [FUIAuthUtils imageNamed:@"ic_google" fromBundleNameOrNil:kBundleName]; + return [FUIAuthUtils imageNamed:@"ic_google" fromBundle:[FUIGoogleAuth bundle]]; } - (UIColor *)buttonBackgroundColor { diff --git a/FirebaseOAuthUI.podspec b/FirebaseOAuthUI.podspec index 4bca9330297..e53ace53438 100644 --- a/FirebaseOAuthUI.podspec +++ b/FirebaseOAuthUI.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.dependency 'FirebaseAuth', '~> 8.0' s.dependency 'FirebaseCore' s.dependency 'GoogleUtilities/UserDefaults' - s.resource_bundle = { + s.resource_bundles = { 'FirebaseOAuthUI' => ['FirebaseOAuthUI/Sources/{Resources,Strings}/*.{png,lproj}'] } diff --git a/FirebaseOAuthUI/FirebaseOAuthUITests/FirebaseOAuthUITests.m b/FirebaseOAuthUI/FirebaseOAuthUITests/FirebaseOAuthUITests.m index 0d7420ea2ff..1f49fa0b677 100644 --- a/FirebaseOAuthUI/FirebaseOAuthUITests/FirebaseOAuthUITests.m +++ b/FirebaseOAuthUI/FirebaseOAuthUITests/FirebaseOAuthUITests.m @@ -34,10 +34,6 @@ @implementation FirebaseOAuthUITests - (void)setUp { [super setUp]; - id mockUtilsClass = OCMClassMock([FUIAuthUtils class]); - OCMStub(ClassMethod([mockUtilsClass bundleNamed:OCMOCK_ANY])). - andReturn([NSBundle bundleForClass:[FUIOAuth class]]); - id authClass = OCMClassMock([FIRAuth class]); OCMStub(ClassMethod([authClass auth])). andReturn(authClass); diff --git a/FirebaseOAuthUI/Sources/FUIOAuth.m b/FirebaseOAuthUI/Sources/FUIOAuth.m index da7bff96e10..6bb50ca24db 100644 --- a/FirebaseOAuthUI/Sources/FUIOAuth.m +++ b/FirebaseOAuthUI/Sources/FUIOAuth.m @@ -108,6 +108,11 @@ @interface FUIOAuth () 8.0' s.dependency 'FirebaseCore' s.dependency 'GoogleUtilities/UserDefaults' - s.resource_bundle = { + s.resource_bundles = { 'FirebasePhoneAuthUI' => ['FirebasePhoneAuthUI/Sources/{Resources,Strings}/*.{xib,json,lproj,png}'] } diff --git a/FirebasePhoneAuthUI/FirebasePhoneAuthUITests/FirebasePhoneAuthUITests.m b/FirebasePhoneAuthUI/FirebasePhoneAuthUITests/FirebasePhoneAuthUITests.m index 5a8d418a5cc..28bf8f72ca7 100644 --- a/FirebasePhoneAuthUI/FirebasePhoneAuthUITests/FirebasePhoneAuthUITests.m +++ b/FirebasePhoneAuthUI/FirebasePhoneAuthUITests/FirebasePhoneAuthUITests.m @@ -32,10 +32,6 @@ @implementation FirebasePhoneAuthUITests - (void)setUp { [super setUp]; - - id mockUtilsClass = OCMClassMock([FUIAuthUtils class]); - OCMStub(ClassMethod([mockUtilsClass bundleNamed:OCMOCK_ANY])). - andReturn([NSBundle bundleForClass:[FUIPhoneAuth class]]); id authUIClass = OCMClassMock([FUIAuth class]); OCMStub(ClassMethod([authUIClass authUIWithAuth:OCMOCK_ANY])). diff --git a/FirebasePhoneAuthUI/Sources/FUICountryCodes.m b/FirebasePhoneAuthUI/Sources/FUICountryCodes.m index 7f6a8ac97ef..0b401bdadfa 100644 --- a/FirebasePhoneAuthUI/Sources/FUICountryCodes.m +++ b/FirebasePhoneAuthUI/Sources/FUICountryCodes.m @@ -20,6 +20,7 @@ #import #import +#import "FirebasePhoneAuthUI/Sources/Public/FirebasePhoneAuthUI/FUIPhoneAuth.h" #import "FirebasePhoneAuthUI/Sources/FUIPhoneAuthStrings.h" NS_ASSUME_NONNULL_BEGIN @@ -67,9 +68,8 @@ @implementation FUICountryCodes - (instancetype)init { if (self = [super init]) { // Country codes JSON containing country codes and phone number info. - NSString *countryCodeFilePath = - [[FUIAuthUtils bundleNamed:FUIPhoneAuthBundleName] pathForResource:@"country-codes" - ofType:@"json"]; + NSBundle *bundle = [FUIPhoneAuth bundle]; + NSString *countryCodeFilePath = [bundle pathForResource:@"country-codes" ofType:@"json"]; NSAssert([[NSFileManager defaultManager] fileExistsAtPath:countryCodeFilePath], @"Could not find country code file"); diff --git a/FirebasePhoneAuthUI/Sources/FUICountryTableViewController.m b/FirebasePhoneAuthUI/Sources/FUICountryTableViewController.m index cf729dba076..3fef32410dd 100644 --- a/FirebasePhoneAuthUI/Sources/FUICountryTableViewController.m +++ b/FirebasePhoneAuthUI/Sources/FUICountryTableViewController.m @@ -18,6 +18,7 @@ #import +#import "FirebasePhoneAuthUI/Sources/Public/FirebasePhoneAuthUI/FUIPhoneAuth.h" #import "FirebasePhoneAuthUI/Sources/FUICountryCodes.h" #import "FirebasePhoneAuthUI/Sources/FUICountryTableViewController.h" #import "FirebasePhoneAuthUI/Sources/FUIFeatureSwitch.h" @@ -40,7 +41,7 @@ @implementation FUICountryTableViewController - (instancetype)initWithCountryCodes:(FUICountryCodes *)countryCodes { if ((self = [super initWithNibName:NSStringFromClass([self class]) - bundle:[FUIAuthUtils bundleNamed:FUIPhoneAuthBundleName]])) { + bundle:[FUIPhoneAuth bundle]])) { _countryCodes = countryCodes; _collationForCountries = [[FUICollationForCountries alloc] initWithCountryCodes:self.countryCodes]; diff --git a/FirebasePhoneAuthUI/Sources/FUIPhoneAuth.m b/FirebasePhoneAuthUI/Sources/FUIPhoneAuth.m index c3752f17016..17d049d1cee 100644 --- a/FirebasePhoneAuthUI/Sources/FUIPhoneAuth.m +++ b/FirebasePhoneAuthUI/Sources/FUIPhoneAuth.m @@ -35,6 +35,11 @@ @implementation FUIPhoneAuth { FUICountryCodes *_countryCodes; } ++ (NSBundle *)bundle { + return [FUIAuthUtils bundleNamed:FUIPhoneAuthBundleName + inFrameworkBundle:[NSBundle bundleForClass:[self class]]]; +} + - (instancetype)initWithAuthUI:(FUIAuth *)authUI { if (self = [super init]) { _authUI = authUI; @@ -102,7 +107,7 @@ - (NSString *)signInLabel { } - (UIImage *)icon { - return [FUIAuthUtils imageNamed:@"ic_phone" fromBundleNameOrNil:FUIPhoneAuthBundleName]; + return [FUIAuthUtils imageNamed:@"ic_phone" fromBundle:[FUIPhoneAuth bundle]]; } - (UIColor *)buttonBackgroundColor { diff --git a/FirebasePhoneAuthUI/Sources/FUIPhoneAuthStrings.m b/FirebasePhoneAuthUI/Sources/FUIPhoneAuthStrings.m index 30595a655f8..d38bfbdd197 100644 --- a/FirebasePhoneAuthUI/Sources/FUIPhoneAuthStrings.m +++ b/FirebasePhoneAuthUI/Sources/FUIPhoneAuthStrings.m @@ -14,6 +14,7 @@ // limitations under the License. // +#import "FirebasePhoneAuthUI/Sources/Public/FirebasePhoneAuthUI/FUIPhoneAuth.h" #import "FirebasePhoneAuthUI/Sources/FUIPhoneAuthStrings.h" #import "FirebasePhoneAuthUI/Sources/FUIPhoneAuth_Internal.h" @@ -59,7 +60,7 @@ NSString *FUIPhoneAuthLocalizedString(NSString *key) { return FUILocalizedStringFromTableInBundle(key, kPhoneAuthProviderTableName, - FUIPhoneAuthBundleName); + [FUIPhoneAuth bundle]); } NS_ASSUME_NONNULL_END diff --git a/FirebasePhoneAuthUI/Sources/FUIPhoneEntryViewController.m b/FirebasePhoneAuthUI/Sources/FUIPhoneEntryViewController.m index add23343be0..62279843228 100755 --- a/FirebasePhoneAuthUI/Sources/FUIPhoneEntryViewController.m +++ b/FirebasePhoneAuthUI/Sources/FUIPhoneEntryViewController.m @@ -21,6 +21,7 @@ #import #import +#import "FirebasePhoneAuthUI/Sources/Public/FirebasePhoneAuthUI/FUIPhoneAuth.h" #import "FirebasePhoneAuthUI/Sources/FUICountryTableViewController.h" #import "FirebasePhoneAuthUI/Sources/FUIFeatureSwitch.h" #import "FirebasePhoneAuthUI/Sources/FUIPhoneAuthStrings.h" @@ -84,7 +85,7 @@ - (instancetype)initWithNibName:(nullable NSString *)nibNameOrNil - (instancetype)initWithAuthUI:(FUIAuth *)authUI { return [self initWithNibName:NSStringFromClass([self class]) - bundle:[FUIAuthUtils bundleNamed:FUIPhoneAuthBundleName] + bundle:[FUIPhoneAuth bundle] authUI:authUI phoneNumber:nil countryCodes:nil]; @@ -94,7 +95,7 @@ - (instancetype)initWithAuthUI:(FUIAuth *)authUI phoneNumber:(nullable NSString *)phoneNumber countryCodes:(nullable FUICountryCodes *)countryCodes { return [self initWithNibName:NSStringFromClass([self class]) - bundle:[FUIAuthUtils bundleNamed:FUIPhoneAuthBundleName] + bundle:[FUIPhoneAuth bundle] authUI:authUI phoneNumber:phoneNumber countryCodes:countryCodes]; @@ -260,7 +261,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView FUIAuthTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellReuseIdentifier]; if (!cell) { UINib *cellNib = [UINib nibWithNibName:NSStringFromClass([FUIAuthTableViewCell class]) - bundle:[FUIAuthUtils bundleNamed:FUIAuthBundleName]]; + bundle:[FUIAuthUtils authUIBundle]]; [tableView registerNib:cellNib forCellReuseIdentifier:kCellReuseIdentifier]; cell = [tableView dequeueReusableCellWithIdentifier:kCellReuseIdentifier]; } diff --git a/FirebasePhoneAuthUI/Sources/FUIPhoneVerificationViewController.m b/FirebasePhoneAuthUI/Sources/FUIPhoneVerificationViewController.m index 334de6a47ef..dd8d9968294 100644 --- a/FirebasePhoneAuthUI/Sources/FUIPhoneVerificationViewController.m +++ b/FirebasePhoneAuthUI/Sources/FUIPhoneVerificationViewController.m @@ -20,6 +20,7 @@ #import #import +#import "FirebasePhoneAuthUI/Sources/Public/FirebasePhoneAuthUI/FUIPhoneAuth.h" #import "FirebasePhoneAuthUI/Sources/FUICodeField.h" #import "FirebasePhoneAuthUI/Sources/FUIPhoneAuthStrings.h" #import "FirebasePhoneAuthUI/Sources/FUIPhoneAuth_Internal.h" @@ -58,7 +59,7 @@ - (instancetype)initWithAuthUI:(FUIAuth *)authUI verificationID:(NSString *)verificationID phoneNumber:(NSString *)phoneNumber{ return [self initWithNibName:NSStringFromClass([self class]) - bundle:[FUIAuthUtils bundleNamed:FUIPhoneAuthBundleName] + bundle:[FUIPhoneAuth bundle] authUI:authUI verificationID:verificationID phoneNumber:phoneNumber]; diff --git a/FirebasePhoneAuthUI/Sources/Public/FirebasePhoneAuthUI/FUIPhoneAuth.h b/FirebasePhoneAuthUI/Sources/Public/FirebasePhoneAuthUI/FUIPhoneAuth.h index a8a4dd48f1b..bdf56218e0b 100644 --- a/FirebasePhoneAuthUI/Sources/Public/FirebasePhoneAuthUI/FUIPhoneAuth.h +++ b/FirebasePhoneAuthUI/Sources/Public/FirebasePhoneAuthUI/FUIPhoneAuth.h @@ -28,6 +28,11 @@ NS_ASSUME_NONNULL_BEGIN */ @property(nonatomic, readwrite) FUIButtonAlignment buttonAlignment; +/** @fn bundle + @brief Returns the resource bundle required by this class. + */ ++ (NSBundle *)bundle; + /** @fn init @brief Please use @c initWithAuthUI: . */ diff --git a/samples/swift/FirebaseUI-demo-swift.xcodeproj/project.pbxproj b/samples/swift/FirebaseUI-demo-swift.xcodeproj/project.pbxproj index f74c5b7ec8d..7ba515e58e1 100644 --- a/samples/swift/FirebaseUI-demo-swift.xcodeproj/project.pbxproj +++ b/samples/swift/FirebaseUI-demo-swift.xcodeproj/project.pbxproj @@ -201,6 +201,7 @@ 8DABC9871D3D82D600453807 /* FirebaseUI-demo-swift */, 8DABC99C1D3D82D600453807 /* FirebaseUI-demo-swiftTests */, 8DABC9861D3D82D600453807 /* Products */, + 9C43BF8CA810E7C909775084 /* Pods */, ); sourceTree = ""; }; @@ -236,6 +237,13 @@ path = "FirebaseUI-demo-swiftTests"; sourceTree = ""; }; + 9C43BF8CA810E7C909775084 /* Pods */ = { + isa = PBXGroup; + children = ( + ); + path = Pods; + sourceTree = ""; + }; C302C1D31D91CC7B00ADBD41 /* Samples */ = { isa = PBXGroup; children = ( @@ -335,7 +343,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 1010; + LastUpgradeCheck = 1230; ORGANIZATIONNAME = "Firebase, Inc."; TargetAttributes = { 8DABC9841D3D82D600453807 = { @@ -650,6 +658,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -674,7 +683,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -708,6 +717,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -726,7 +736,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; @@ -764,7 +774,7 @@ "\"$(PODS_ROOT)/FirebaseUI/FirebaseDatabaseUI\"", ); INFOPLIST_FILE = "FirebaseUI-demo-swift/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.google.firebase.firebaseui.FirebaseUI-demo-swift"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -803,7 +813,7 @@ "\"$(PODS_ROOT)/FirebaseUI/FirebaseDatabaseUI\"", ); INFOPLIST_FILE = "FirebaseUI-demo-swift/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.google.firebase.firebaseui.FirebaseUI-demo-swift"; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/samples/swift/Podfile.lock b/samples/swift/Podfile.lock index 830c679917c..508358f0cd2 100644 --- a/samples/swift/Podfile.lock +++ b/samples/swift/Podfile.lock @@ -491,7 +491,7 @@ SPEC CHECKSUMS: FBSDKCoreKit: 0d1ae58388a458b8222f72025804cdc84eb5d0c3 FBSDKLoginKit: aea68df6121c5e165ccae2fabfdc83c4644ee40f Firebase: 73c3e3b216ec1ecbc54d2ffdd4670c65c749edb1 - FirebaseAnonymousAuthUI: e8e72803e69b1669b74cc262bef2d73c42344f0e + FirebaseAnonymousAuthUI: 250139e53ca84bb18b9cd67e35be0d4d63e22418 FirebaseAuth: b8cd992fca5b53dc6eec09e873a3f375f000c5a1 FirebaseAuthUI: a44ed5d5da7337fd1dfbd9ac4a32ac3217ea8f2c FirebaseCore: 3f09591d51292843e2a46f18358d60bf4e996255