#1695 (Premium Archive subscription)

- Removed confetti.
- Fixed iPad layout.
- Moved Manage Subscription to the bottom of the active subscription.
This commit is contained in:
David Sinclair 2022-07-05 20:00:20 -07:00
parent 979394be04
commit c5590204d8
3 changed files with 34 additions and 43 deletions

View file

@ -16,7 +16,6 @@
@property (nonatomic) IBOutlet NewsBlurAppDelegate *appDelegate;
@property (nonatomic) IBOutlet UITableView *premiumTable;
@property (nonatomic) IBOutlet SAConfettiView *confettiView;
- (IBAction)closeDialog:(id)sender;

View file

@ -13,6 +13,8 @@
#define kPremiumSubscriptionSection 0
#define kPremiumArchiveSubscriptionSection 1
#define kManageSubscriptionHeight 100
@interface PremiumViewController ()
@end
@ -43,34 +45,8 @@
self.navigationItem.title = @"NewsBlur Premium";
[self loadProducts];
if (self.appDelegate.isPremium) {
self.premiumTable.tableHeaderView = [self makeManageSubscriptionView];
} else {
self.premiumTable.tableHeaderView = nil;
}
self.premiumTable.tableFooterView = [self makePolicyView];
[self updateTheme];
if (self.appDelegate.isPremium) {
[self.confettiView setNeedsLayout];
[self.confettiView startConfetti];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
[self.confettiView stopConfetti];
});
}
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self.confettiView setNeedsLayout];
}
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
[self.confettiView stopConfetti];
}
- (void)closeDialog:(id)sender {
@ -91,7 +67,7 @@
}
- (UIView *)makeManageSubscriptionView {
CGSize viewSize = CGSizeMake(self.view.frame.size.width, 90);
CGSize viewSize = CGSizeMake(self.view.frame.size.width, kManageSubscriptionHeight);
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, viewSize.width, viewSize.height)];
UIView *button = [self makeButtonWithTitle:@"Manage Subscription" forURL:@"https://apps.apple.com/account/subscriptions"];
@ -116,7 +92,7 @@
label.font = [UIFont systemFontOfSize:[UIFont smallSystemFontSize]];
label.textColor = UIColorFromRGB(0x0c0c0c);
CGSize measuredSize = [label.text sizeWithAttributes:@{NSFontAttributeName: label.font}];
label.frame = CGRectMake((viewSize.width - measuredSize.width) / 2, viewSize.height - measuredSize.height - 10, measuredSize.width, measuredSize.height);
label.frame = CGRectMake((viewSize.width - measuredSize.width) / 2, 15 + CGRectGetHeight(button.frame) + 15, measuredSize.width, measuredSize.height);
[view addSubview:label];
@ -124,18 +100,19 @@
}
- (UIView *)makePolicyView {
CGSize viewSize = CGSizeMake(self.view.frame.size.width, 90);
CGSize viewSize = CGSizeMake(self.view.frame.size.width, 120);
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, viewSize.width, viewSize.height)];
UIView *button = [self makeButtonWithTitle:@"Privacy Policy" forURL:@"https://newsblur.com/privacy/"];
CGFloat buttonHeight = CGRectGetHeight(button.frame) + 5;
button.frame = CGRectMake(((viewSize.width - CGRectGetWidth(button.frame)) / 2) - 20, 15, CGRectGetWidth(button.frame) + 40, CGRectGetHeight(button.frame) + 5);
button.frame = CGRectMake(((viewSize.width - CGRectGetWidth(button.frame)) / 2) - 20, 15, CGRectGetWidth(button.frame) + 40, buttonHeight);
[view addSubview:button];
button = [self makeButtonWithTitle:@"Terms of Use" forURL:@"https://newsblur.com/tos/"];
button.frame = CGRectMake(((viewSize.width - CGRectGetWidth(button.frame)) / 2) - 20, viewSize.height - 30, CGRectGetWidth(button.frame) + 40, CGRectGetHeight(button.frame) + 5);
button.frame = CGRectMake(((viewSize.width - CGRectGetWidth(button.frame)) / 2) - 20, 15 + buttonHeight + 15, CGRectGetWidth(button.frame) + 40, buttonHeight);
[view addSubview:button];
@ -367,8 +344,24 @@
return 60;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
if (section == kPremiumArchiveSubscriptionSection && self.appDelegate.isPremiumArchive) {
return [self makeManageSubscriptionView];
} else if (section == kPremiumSubscriptionSection && self.appDelegate.isPremium) {
return [self makeManageSubscriptionView];
} else {
return nil;
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 0;
if (section == kPremiumArchiveSubscriptionSection && self.appDelegate.isPremiumArchive) {
return kManageSubscriptionHeight;
} else if (section == kPremiumSubscriptionSection && self.appDelegate.isPremium) {
return kManageSubscriptionHeight;
} else {
return 0;
}
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

View file

@ -4,12 +4,12 @@
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="PremiumViewController">
<connections>
<outlet property="confettiView" destination="TFM-k9-HJ2" id="Xqn-VR-200"/>
<outlet property="premiumTable" destination="fn0-sC-cuM" id="AmW-m0-Koz"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
@ -19,29 +19,28 @@
<rect key="frame" x="0.0" y="0.0" width="428" height="926"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="fn0-sC-cuM">
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" style="grouped" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="fn0-sC-cuM">
<rect key="frame" x="0.0" y="0.0" width="428" height="926"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<connections>
<outlet property="dataSource" destination="-1" id="Hc6-OJ-jhm"/>
<outlet property="delegate" destination="-1" id="bI2-jz-jA3"/>
</connections>
</tableView>
<view userInteractionEnabled="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TFM-k9-HJ2" customClass="SAConfettiView" customModule="NewsBlur" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="428" height="926"/>
</view>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="fn0-sC-cuM" secondAttribute="bottom" id="BCw-iy-KQA"/>
<constraint firstItem="TFM-k9-HJ2" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="FTr-As-NDa"/>
<constraint firstItem="TFM-k9-HJ2" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="LUc-I7-7Oh"/>
<constraint firstAttribute="trailing" secondItem="fn0-sC-cuM" secondAttribute="trailing" id="Xx0-Rx-ajt"/>
<constraint firstAttribute="bottom" secondItem="fn0-sC-cuM" secondAttribute="bottom" id="eSa-L8-FDC"/>
<constraint firstItem="fn0-sC-cuM" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="l7J-N0-Stv"/>
<constraint firstAttribute="trailing" secondItem="TFM-k9-HJ2" secondAttribute="trailing" id="rWJ-2y-ikK"/>
<constraint firstItem="fn0-sC-cuM" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="u6N-Ew-57l"/>
<constraint firstAttribute="bottom" secondItem="TFM-k9-HJ2" secondAttribute="bottom" id="z9v-dX-Xko"/>
</constraints>
<nil key="simulatedTopBarMetrics"/>
<point key="canvasLocation" x="24.5" y="51.5"/>
</view>
</objects>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>