[iOS] Subscriptions modal presentation for iPad

This commit is contained in:
Alexander Boriskov 2019-11-08 14:15:12 +03:00 committed by Aleksey Belousov
parent dc5ffbe069
commit fa7a0f9455
5 changed files with 13 additions and 3 deletions

View file

@ -8,7 +8,8 @@ class AllPassSubscriptionViewController: BaseSubscriptionViewController {
@IBOutlet private var monthlySubscriptionButton: BookmarksSubscriptionButton!
@IBOutlet private var pageIndicator: PageIndicator!
@IBOutlet private var descriptionPageScrollView: UIScrollView!
@IBOutlet private var contentView: UIView!
//MARK: locals
private var pageWidth: CGFloat {
return self.descriptionPageScrollView.frame.width;
@ -74,6 +75,8 @@ class AllPassSubscriptionViewController: BaseSubscriptionViewController {
discountLabels:[
.year: annualDiscountLabel])
self.preferredContentSize = CGSize(width: 414, height: contentView.frame.height)
Statistics.logEvent(kStatInappShow, withParameters: [kStatVendor: MWMPurchaseManager.allPassProductIds,
kStatPurchase: MWMPurchaseManager.allPassSubscriptionServerId(),
kStatProduct: BOOKMARKS_SUBSCRIPTION_YEARLY_PRODUCT_ID, //FIXME

View file

@ -18,6 +18,7 @@
<outlet property="annualDiscountLabel" destination="HUV-kf-oUo" id="eNl-h8-mGe"/>
<outlet property="annualSubscriptionButton" destination="Lg7-Sn-MNZ" id="Dfz-gM-gDd"/>
<outlet property="backgroundImageView" destination="MVh-rE-VHd" id="aK3-Tk-Q82"/>
<outlet property="contentView" destination="TaY-K1-Hdb" id="eX6-cq-BPU"/>
<outlet property="descriptionPageScrollView" destination="pyJ-8x-bjL" id="763-Gg-LfT"/>
<outlet property="loadingView" destination="je2-0p-PRM" id="q8x-ah-ZDN"/>
<outlet property="monthlySubscriptionButton" destination="UL9-YY-AHH" id="5ms-ia-Lwx"/>

View file

@ -24,7 +24,8 @@ class BaseSubscriptionViewController: MWMViewController {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
subscriptionManager?.addListener(self)
self.modalTransitionStyle = .coverVertical
self.modalPresentationStyle = .formSheet
}
required init?(coder aDecoder: NSCoder) {
@ -37,6 +38,7 @@ class BaseSubscriptionViewController: MWMViewController {
override func viewDidLoad() {
super.viewDidLoad()
subscriptionManager?.addListener(self)
self.presentationController?.delegate = self;
}

View file

@ -5,7 +5,8 @@ import SafariServices
@IBOutlet private var annualSubscriptionButton: BookmarksSubscriptionButton!
@IBOutlet private var annualDiscountLabel: BookmarksSubscriptionDiscountLabel!
@IBOutlet private var monthlySubscriptionButton: BookmarksSubscriptionButton!
@IBOutlet private var contentView: UIView!
override var subscriptionManager: ISubscriptionManager? {
get { return InAppPurchase.bookmarksSubscriptionManager }
}
@ -51,6 +52,8 @@ import SafariServices
discountLabels:[
.year: annualDiscountLabel])
self.preferredContentSize = CGSize(width: 414, height: contentView.frame.height)
Statistics.logEvent(kStatInappShow, withParameters: [kStatVendor: MWMPurchaseManager.bookmarksSubscriptionVendorId(),
kStatPurchase: MWMPurchaseManager.bookmarksSubscriptionServerId(),
kStatProduct: BOOKMARKS_SUBSCRIPTION_YEARLY_PRODUCT_ID,

View file

@ -12,6 +12,7 @@
<connections>
<outlet property="annualDiscountLabel" destination="YH0-h4-ZEb" id="onk-lS-6im"/>
<outlet property="annualSubscriptionButton" destination="neX-0h-hs4" id="I6s-8S-Qks"/>
<outlet property="contentView" destination="Eiz-QQ-h0b" id="Yqj-Hf-utg"/>
<outlet property="loadingView" destination="BHb-cU-Ze3" id="bfe-6a-BJf"/>
<outlet property="monthlySubscriptionButton" destination="sj5-ey-SEv" id="nUs-dU-WOI"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>