Skip to content

Commit

Permalink
Merge pull request #647 from firebase/tos
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuan Ren authored Mar 18, 2019
2 parents cd5ad5e + 67b74cd commit 7cef0f1
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 30 deletions.
27 changes: 20 additions & 7 deletions Auth/FirebaseAuthUI/FUIAuthPickerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,30 @@
/** @var kButtonContainerBottomMargin
@brief The magin between sign in buttons and the bottom of the content view.
*/
static const CGFloat kButtonContainerBottomMargin = 56.0f;
static const CGFloat kButtonContainerBottomMargin = 48.0f;

/** @var kButtonContainerTopMargin
@brief The margin between sign in buttons and the top of the content view.
*/
static const CGFloat kButtonContainerTopMargin = 16.0f;

/** @var kTOSViewBottomMargin
@brief The margin between privacy policy and TOS view and the bottom of the content view.
*/
static const CGFloat kTOSViewBottomMargin = 24.0f;

/** @var kTOSViewHorizontalMargin
@brief The margin between privacy policy and TOS view and the left or right of the content view.
*/
static const CGFloat kTOSViewHorizontalMargin = 16.0f;

@implementation FUIAuthPickerViewController {
UIView *_buttonContainerView;

IBOutlet FUIPrivacyAndTermsOfServiceView *_privacyPolicyAndTOSView;

IBOutlet UIView *_contentView;

IBOutlet UIScrollView *_scrollView;
}

Expand Down Expand Up @@ -134,18 +144,18 @@ - (void)viewDidLayoutSubviews {
// old layout behavior.
if (!_scrollView) {
CGFloat distanceFromCenterToBottom =
CGRectGetHeight(_buttonContainerView.frame) / 2.0f + kButtonContainerBottomMargin;
CGRectGetHeight(_buttonContainerView.frame) / 2.0f + kButtonContainerBottomMargin + kTOSViewBottomMargin;
CGFloat centerY = CGRectGetHeight(self.view.bounds) - distanceFromCenterToBottom;
// Compensate for bounds adjustment if any.
centerY += self.view.bounds.origin.y;
_buttonContainerView.center = CGPointMake(self.view.center.x, centerY);
return;
}

CGFloat buttonContainerHeight = CGRectGetHeight(_buttonContainerView.frame);
CGFloat buttonContainerWidth = CGRectGetWidth(_buttonContainerView.frame);
CGFloat contentViewHeight = kButtonContainerTopMargin +
buttonContainerHeight + kButtonContainerBottomMargin;
CGFloat contentViewHeight = kButtonContainerTopMargin + buttonContainerHeight
+ kButtonContainerBottomMargin + kTOSViewBottomMargin;
CGFloat contentViewWidth = CGRectGetWidth(self.view.bounds);
_scrollView.frame = self.view.frame;
CGFloat scrollViewHeight;
Expand All @@ -168,7 +178,10 @@ - (void)viewDidLayoutSubviews {
buttonContainerWidth,
buttonContainerHeight);
CGFloat privacyViewHeight = CGRectGetHeight(_privacyPolicyAndTOSView.frame);
_privacyPolicyAndTOSView.frame = CGRectMake(0, contentViewHeight - privacyViewHeight, contentViewWidth, privacyViewHeight);
_privacyPolicyAndTOSView.frame = CGRectMake(kTOSViewHorizontalMargin, contentViewHeight
- privacyViewHeight - kTOSViewBottomMargin,
contentViewWidth - kTOSViewHorizontalMargin*2,
privacyViewHeight);
}

#pragma mark - Actions
Expand Down
46 changes: 23 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,69 +2,69 @@ GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.0)
activesupport (4.2.10)
activesupport (4.2.11.1)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
atomos (0.1.2)
atomos (0.1.3)
claide (1.0.2)
cocoapods (1.5.3)
cocoapods (1.6.1)
activesupport (>= 4.0.2, < 5)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.5.3)
cocoapods-core (= 1.6.1)
cocoapods-deintegrate (>= 1.0.2, < 2.0)
cocoapods-downloader (>= 1.2.0, < 2.0)
cocoapods-downloader (>= 1.2.2, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.3.0, < 2.0)
cocoapods-trunk (>= 1.3.1, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (~> 2.0.1)
fourflusher (>= 2.2.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.6.5)
molinillo (~> 0.6.6)
nap (~> 1.0)
ruby-macho (~> 1.1)
xcodeproj (>= 1.5.7, < 2.0)
cocoapods-core (1.5.3)
ruby-macho (~> 1.4)
xcodeproj (>= 1.8.1, < 2.0)
cocoapods-core (1.6.1)
activesupport (>= 4.0.2, < 6)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
cocoapods-deintegrate (1.0.2)
cocoapods-downloader (1.2.1)
cocoapods-deintegrate (1.0.3)
cocoapods-downloader (1.2.2)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-trunk (1.3.0)
cocoapods-stats (1.1.0)
cocoapods-trunk (1.3.1)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.1.0)
colored2 (3.1.2)
concurrent-ruby (1.0.5)
concurrent-ruby (1.1.5)
escape (0.0.4)
fourflusher (2.0.1)
fourflusher (2.2.0)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
minitest (5.11.3)
molinillo (0.6.5)
molinillo (0.6.6)
nanaimo (0.2.6)
nap (1.1.0)
netrc (0.11.0)
ruby-macho (1.2.0)
ruby-macho (1.4.0)
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
xcodeproj (1.5.9)
xcodeproj (1.8.1)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.2)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.2.5)
nanaimo (~> 0.2.6)

PLATFORMS
ruby
Expand All @@ -75,4 +75,4 @@ DEPENDENCIES
xcodeproj

BUNDLED WITH
1.16.1
1.17.2

0 comments on commit 7cef0f1

Please sign in to comment.