From 0cf19940dbe748c85cb658ecd99ba1eeb45ea960 Mon Sep 17 00:00:00 2001 From: David Sinclair Date: Mon, 22 Oct 2018 13:05:28 -0700 Subject: [PATCH 1/4] iOS: #1135 (privacy policy etc) Added text between the purchase policy and products table with links to the privacy policy & terms of use. --- clients/ios/Classes/PremiumViewController.h | 1 + clients/ios/Classes/PremiumViewController.m | 24 ++++++++++++++++ clients/ios/Classes/PremiumViewController.xib | 28 ++++++++++++++----- 3 files changed, 46 insertions(+), 7 deletions(-) diff --git a/clients/ios/Classes/PremiumViewController.h b/clients/ios/Classes/PremiumViewController.h index b97db5dc7..94f3be48f 100644 --- a/clients/ios/Classes/PremiumViewController.h +++ b/clients/ios/Classes/PremiumViewController.h @@ -28,6 +28,7 @@ @property (nonatomic) IBOutlet NSLayoutConstraint *productsHeight; @property (nonatomic) IBOutlet UILabel *labelTitle; @property (nonatomic) IBOutlet UILabel *labelSubtitle; +@property (nonatomic) IBOutlet UITextView *policyTextView; @property (nonatomic) IBOutlet UILabel *labelPremiumTitle; @property (nonatomic) IBOutlet UILabel *labelPremiumExpire; diff --git a/clients/ios/Classes/PremiumViewController.m b/clients/ios/Classes/PremiumViewController.m index 33fe52d6e..b466a160a 100644 --- a/clients/ios/Classes/PremiumViewController.m +++ b/clients/ios/Classes/PremiumViewController.m @@ -57,6 +57,7 @@ self.navigationItem.title = @"NewsBlur Premium"; [self loadProducts]; + [self preparePolicyText]; [self updateTheme]; [confettiView setNeedsLayout]; [confettiView startConfetti]; @@ -77,6 +78,26 @@ [self dismissViewControllerAnimated:YES completion:nil]; } +- (void)preparePolicyText { + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy]; + paragraphStyle.alignment = NSTextAlignmentCenter; + NSDictionary *attributes = @{NSParagraphStyleAttributeName : paragraphStyle}; + NSMutableAttributedString *policyString = [[NSMutableAttributedString alloc] initWithString:@"See NewsBlur's " attributes:attributes]; + NSURL *privacyURL = [NSURL URLWithString:@"https://newsblur.com/privacy/"]; + NSURL *termsURL = [NSURL URLWithString:@"https://newsblur.com/tos/"]; + NSAttributedString *privacyLink = [[NSAttributedString alloc] initWithString:@"privacy policy" + attributes:@{NSLinkAttributeName : privacyURL}]; + NSAttributedString *termsLink = [[NSAttributedString alloc] initWithString:@"terms of use" + attributes:@{NSLinkAttributeName : termsURL}]; + + [policyString appendAttributedString:privacyLink]; + [policyString appendAttributedString:[[NSAttributedString alloc] initWithString:@" and "]]; + [policyString appendAttributedString:termsLink]; + [policyString appendAttributedString:[[NSAttributedString alloc] initWithString:@" for details."]]; + + self.policyTextView.attributedText = policyString; +} + - (void)updateTheme { [super updateTheme]; @@ -85,6 +106,9 @@ self.view.backgroundColor = UIColorFromRGB(0xf4f4f4); self.labelTitle.textColor = UIColorFromRGB(0x0c0c0c); self.labelSubtitle.textColor = UIColorFromRGB(0x0c0c0c); + self.policyTextView.textColor = UIColorFromRGB(0x0c0c0c); + self.policyTextView.linkTextAttributes = @{NSForegroundColorAttributeName : UIColorFromRGB(NEWSBLUR_LINK_COLOR)}; + self.labelPremiumExpire.textColor = UIColorFromRGB(0x0c0c0c); self.labelPremiumTitle.textColor = UIColorFromRGB(0x0c0c0c); self.labelPremiumExpire.shadowColor = UIColorFromRGB(0xf4f4f4); diff --git a/clients/ios/Classes/PremiumViewController.xib b/clients/ios/Classes/PremiumViewController.xib index 19d8ab171..b679495d4 100644 --- a/clients/ios/Classes/PremiumViewController.xib +++ b/clients/ios/Classes/PremiumViewController.xib @@ -1,11 +1,11 @@ - + - + @@ -22,6 +22,7 @@ + @@ -39,10 +40,10 @@ - + - + @@ -50,7 +51,7 @@ - + @@ -73,24 +74,37 @@ + + + + + + + + + + + + - + + @@ -100,7 +114,7 @@ - +