Chromium Code Reviews| Index: ios/chrome/browser/ui/first_run/welcome_to_chrome_view.mm |
| diff --git a/ios/chrome/browser/ui/first_run/welcome_to_chrome_view.mm b/ios/chrome/browser/ui/first_run/welcome_to_chrome_view.mm |
| index e57276250466c666058b8103361a34fe9bc2966e..d88705ca9b307ddea587fc0555c0a012c876f8ba 100644 |
| --- a/ios/chrome/browser/ui/first_run/welcome_to_chrome_view.mm |
| +++ b/ios/chrome/browser/ui/first_run/welcome_to_chrome_view.mm |
| @@ -14,6 +14,7 @@ |
| #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| #import "ios/chrome/browser/ui/util/CRUILabel+AttributeUtils.h" |
| #import "ios/chrome/browser/ui/util/label_link_controller.h" |
| +#import "ios/chrome/browser/ui/util/label_observer.h" |
| #include "ios/chrome/common/string_util.h" |
| #include "ios/chrome/grit/ios_chromium_strings.h" |
| #include "ios/chrome/grit/ios_strings.h" |
| @@ -92,8 +93,12 @@ NSString* const kCheckBoxCheckedImageName = @"checkbox_checked"; |
| @property(strong, nonatomic, readonly) UIImageView* imageView; |
| // The "Terms of Service" label. |
| @property(strong, nonatomic, readonly) UILabel* TOSLabel; |
| +// Observer for setting the size of the TOSLabel; |
| +@property(strong, nonatomic) LabelObserver* TOSObserver; |
| // The stats reporting opt-in label. |
| @property(strong, nonatomic, readonly) UILabel* optInLabel; |
| +// Observer for setting the size of the optInLabel; |
| +@property(strong, nonatomic) LabelObserver* optInObserver; |
| // The stats reporting opt-in checkbox button. |
| @property(strong, nonatomic, readonly) UIButton* checkBoxButton; |
| // The "Accept & Continue" button. |
| @@ -135,6 +140,8 @@ NSString* const kCheckBoxCheckedImageName = @"checkbox_checked"; |
| @implementation WelcomeToChromeView |
| @synthesize delegate = _delegate; |
| +@synthesize TOSObserver = _TOSObserver; |
| +@synthesize optInObserver = _optInObserver; |
| - (instancetype)initWithFrame:(CGRect)frame { |
| self = [super initWithFrame:frame]; |
| @@ -179,6 +186,11 @@ NSString* const kCheckBoxCheckedImageName = @"checkbox_checked"; |
| completion:nil]; |
| } |
| +- (void)dealloc { |
| + [self.TOSObserver stopObserving]; |
| + [self.optInObserver stopObserving]; |
| +} |
| + |
| #pragma mark - Accessors |
| - (BOOL)isCheckBoxSelected { |
| @@ -223,6 +235,8 @@ NSString* const kCheckBoxCheckedImageName = @"checkbox_checked"; |
| - (UILabel*)TOSLabel { |
| if (!_TOSLabel) { |
| _TOSLabel = [[UILabel alloc] initWithFrame:CGRectZero]; |
| + self.TOSObserver = [LabelObserver observerForLabel:_TOSLabel]; |
| + [self.TOSObserver startObserving]; |
|
marq (ping after 24h)
2017/04/19 15:25:19
What do these observers do? This CL doesn't add an
gambard
2017/04/19 15:48:18
The actions are added in CRUILabel+AttributeUtils.
marq (ping after 24h)
2017/04/20 11:52:00
Yeah, that's non-obvious and kind of clunky.
|
| [_TOSLabel setNumberOfLines:0]; |
| [_TOSLabel setTextAlignment:NSTextAlignmentCenter]; |
| } |
| @@ -232,6 +246,8 @@ NSString* const kCheckBoxCheckedImageName = @"checkbox_checked"; |
| - (UILabel*)optInLabel { |
| if (!_optInLabel) { |
| _optInLabel = [[UILabel alloc] initWithFrame:CGRectZero]; |
| + self.optInObserver = [LabelObserver observerForLabel:_optInLabel]; |
| + [self.optInObserver startObserving]; |
| [_optInLabel setNumberOfLines:0]; |
| [_optInLabel |
| setText:l10n_util::GetNSString(IDS_IOS_FIRSTRUN_NEW_OPT_IN_LABEL)]; |