parent
8cb444088d
commit
9a34c6804c
|
@ -48,6 +48,13 @@
|
|||
[informationSection addItem:[OWSTableItem labelItemWithText:NSLocalizedString(@"SETTINGS_VERSION", @"")
|
||||
accessoryText:[[[NSBundle mainBundle] infoDictionary]
|
||||
objectForKey:@"CFBundleVersion"]]];
|
||||
|
||||
[informationSection addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_LEGAL_TERMS_CELL",
|
||||
@"table cell label")
|
||||
actionBlock:^{
|
||||
[[UIApplication sharedApplication]
|
||||
openURL:[NSURL URLWithString:kLegalTermsUrlString]];
|
||||
}]];
|
||||
[contents addSection:informationSection];
|
||||
|
||||
OWSTableSection *helpSection = [OWSTableSection new];
|
||||
|
|
|
@ -70,42 +70,54 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
|
|||
UIView *headerWrapper = [UIView containerView];
|
||||
[self.view addSubview:headerWrapper];
|
||||
headerWrapper.backgroundColor = UIColor.ows_signalBrandBlueColor;
|
||||
|
||||
UIView *headerContent = [UIView new];
|
||||
[headerWrapper addSubview:headerContent];
|
||||
[headerWrapper autoPinEdgesToSuperviewEdgesWithInsets:UIEdgeInsetsZero excludingEdge:ALEdgeBottom];
|
||||
[headerContent autoPinEdgeToSuperviewEdge:ALEdgeBottom];
|
||||
[headerContent autoPinToTopLayoutGuideOfViewController:self withInset:0];
|
||||
[headerContent autoPinWidthToSuperview];
|
||||
|
||||
UILabel *headerLabel = [UILabel new];
|
||||
headerLabel.text = NSLocalizedString(@"REGISTRATION_TITLE_LABEL", @"");
|
||||
headerLabel.textColor = [UIColor whiteColor];
|
||||
headerLabel.font = [UIFont ows_mediumFontWithSize:ScaleFromIPhone5To7Plus(20.f, 24.f)];
|
||||
[headerContent addSubview:headerLabel];
|
||||
[headerLabel autoHCenterInSuperview];
|
||||
[headerLabel autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:14.f];
|
||||
|
||||
CGFloat screenHeight = MAX([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
|
||||
if (screenHeight < 568) {
|
||||
// iPhone 4s or smaller.
|
||||
[headerContent autoSetDimension:ALDimensionHeight toSize:20];
|
||||
headerLabel.hidden = YES;
|
||||
} else if (screenHeight < 667) {
|
||||
// iPhone 5 or smaller.
|
||||
[headerContent autoSetDimension:ALDimensionHeight toSize:80];
|
||||
} else {
|
||||
[headerContent autoSetDimension:ALDimensionHeight toSize:220];
|
||||
NSString *legalTopMatterFormat = NSLocalizedString(@"REGISTRATION_LEGAL_TOP_MATTER_FORMAT",
|
||||
@"legal disclaimer, embeds a tappable {{link title}} which is styled as a hyperlink");
|
||||
NSString *legalTopMatterLinkWord = NSLocalizedString(
|
||||
@"REGISTRATION_LEGAL_TOP_MATTER_LINK_TITLE", @"embedded in legal topmatter, styled as a link");
|
||||
NSString *legalTopMatter = [NSString stringWithFormat:legalTopMatterFormat, legalTopMatterLinkWord];
|
||||
NSMutableAttributedString *attributedLegalTopMatter =
|
||||
[[NSMutableAttributedString alloc] initWithString:legalTopMatter];
|
||||
NSRange linkRange = [legalTopMatter rangeOfString:legalTopMatterLinkWord];
|
||||
NSDictionary *linkStyleAttributes = @{
|
||||
NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle | NSUnderlinePatternSolid),
|
||||
};
|
||||
[attributedLegalTopMatter setAttributes:linkStyleAttributes range:linkRange];
|
||||
|
||||
UIImage *logo = [UIImage imageNamed:@"logoSignal"];
|
||||
OWSAssert(logo);
|
||||
UIImageView *logoView = [UIImageView new];
|
||||
logoView.image = logo;
|
||||
[headerContent addSubview:logoView];
|
||||
[logoView autoHCenterInSuperview];
|
||||
[logoView autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:headerLabel withOffset:-14.f];
|
||||
UILabel *legalTopMatterLabel = [UILabel new];
|
||||
legalTopMatterLabel.textColor = UIColor.whiteColor;
|
||||
legalTopMatterLabel.font = UIFont.ows_dynamicTypeFootnoteFont;
|
||||
legalTopMatterLabel.numberOfLines = 0;
|
||||
legalTopMatterLabel.textAlignment = NSTextAlignmentCenter;
|
||||
legalTopMatterLabel.attributedText = attributedLegalTopMatter;
|
||||
legalTopMatterLabel.userInteractionEnabled = YES;
|
||||
|
||||
UITapGestureRecognizer *tapGesture =
|
||||
[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapLegalTerms:)];
|
||||
[legalTopMatterLabel addGestureRecognizer:tapGesture];
|
||||
|
||||
UIStackView *headerContent = [[UIStackView alloc] initWithArrangedSubviews:@[ headerLabel, legalTopMatterLabel ]];
|
||||
headerContent.axis = UILayoutConstraintAxisVertical;
|
||||
headerContent.alignment = UIStackViewAlignmentCenter;
|
||||
headerContent.spacing = ScaleFromIPhone5To7Plus(8, 16);
|
||||
headerContent.layoutMarginsRelativeArrangement = YES;
|
||||
|
||||
{
|
||||
CGFloat topMargin = ScaleFromIPhone5To7Plus(4, 16);
|
||||
CGFloat bottomMargin = ScaleFromIPhone5To7Plus(8, 16);
|
||||
headerContent.layoutMargins = UIEdgeInsetsMake(topMargin, 40, bottomMargin, 40);
|
||||
}
|
||||
|
||||
[headerWrapper addSubview:headerContent];
|
||||
[headerContent autoPinToTopLayoutGuideOfViewController:self withInset:0];
|
||||
[headerContent autoPinEdgesToSuperviewMarginsExcludingEdge:ALEdgeTop];
|
||||
|
||||
const CGFloat kRowHeight = 60.f;
|
||||
const CGFloat kRowHMargin = 20.f;
|
||||
const CGFloat kSeparatorHeight = 1.f;
|
||||
|
@ -229,6 +241,25 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
|
|||
[spinnerView autoSetDimension:ALDimensionHeight toSize:20.f];
|
||||
[spinnerView autoPinTrailingToSuperviewMarginWithInset:20.f];
|
||||
[spinnerView stopAnimating];
|
||||
|
||||
NSString *bottomTermsLinkText = NSLocalizedString(@"REGISTRATION_LEGAL_TERMS_LINK",
|
||||
@"one line label below submit button on registration screen, which links to an external webpage.");
|
||||
UIButton *bottomLegalLinkButton = [UIButton new];
|
||||
bottomLegalLinkButton.titleLabel.font = UIFont.ows_dynamicTypeFootnoteFont;
|
||||
[bottomLegalLinkButton setTitleColor:UIColor.ows_materialBlueColor forState:UIControlStateNormal];
|
||||
[bottomLegalLinkButton setTitle:bottomTermsLinkText forState:UIControlStateNormal];
|
||||
[contentView addSubview:bottomLegalLinkButton];
|
||||
[bottomLegalLinkButton addTarget:self
|
||||
action:@selector(didTapLegalTerms:)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
[bottomLegalLinkButton autoPinLeadingAndTrailingToSuperviewMargin];
|
||||
[bottomLegalLinkButton autoPinEdge:ALEdgeTop
|
||||
toEdge:ALEdgeBottom
|
||||
ofView:activateButton
|
||||
withOffset:ScaleFromIPhone5To7Plus(8, 12)];
|
||||
[bottomLegalLinkButton setCompressionResistanceHigh];
|
||||
[bottomLegalLinkButton setContentHuggingHigh];
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated
|
||||
|
@ -350,6 +381,11 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
|
|||
}
|
||||
}
|
||||
|
||||
- (void)didTapLegalTerms:(UIButton *)sender
|
||||
{
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:kLegalTermsUrlString]];
|
||||
}
|
||||
|
||||
- (void)changeCountryCodeTapped
|
||||
{
|
||||
CountryCodeViewController *countryCodeController = [CountryCodeViewController new];
|
||||
|
|
|
@ -1600,6 +1600,15 @@
|
|||
/* alert body during registration */
|
||||
"REGISTRATION_ERROR_BLANK_VERIFICATION_CODE" = "We can't activate your account until you verify the code we sent you.";
|
||||
|
||||
/* one line label below submit button on registration screen, which links to an external webpage. */
|
||||
"REGISTRATION_LEGAL_TERMS_LINK" = "Terms & Privacy Policy";
|
||||
|
||||
/* legal disclaimer, embeds a tappable {{link title}} which is styled as a hyperlink */
|
||||
"REGISTRATION_LEGAL_TOP_MATTER_FORMAT" = "By registering this device, you agree to Signal's %@";
|
||||
|
||||
/* embedded in legal topmatter, styled as a link */
|
||||
"REGISTRATION_LEGAL_TOP_MATTER_LINK_TITLE" = "terms";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"REGISTRATION_NON_VALID_NUMBER" = "This phone number format is not supported, please contact support.";
|
||||
|
||||
|
@ -1888,6 +1897,9 @@
|
|||
/* Label for settings view that allows user to change the notification sound. */
|
||||
"SETTINGS_ITEM_NOTIFICATION_SOUND" = "Message Sound";
|
||||
|
||||
/* table cell label */
|
||||
"SETTINGS_LEGAL_TERMS_CELL" = "Terms & Privacy Policy";
|
||||
|
||||
/* Title for settings activity */
|
||||
"SETTINGS_NAV_BAR_TITLE" = "Settings";
|
||||
|
||||
|
|
|
@ -17,6 +17,9 @@ typedef NS_ENUM(NSInteger, TSWhisperMessageType) {
|
|||
|
||||
#define textSecureHTTPTimeOut 10
|
||||
|
||||
// FIXME this is likely to change
|
||||
#define kLegalTermsUrlString @"https://signal.org/signal/privacy/"
|
||||
|
||||
//#ifndef DEBUG
|
||||
|
||||
// Production
|
||||
|
|
Loading…
Reference in New Issue