|
@@ -1212,12 +1212,77 @@ class KMProductCompareWC: NSWindowController {
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+ private func _loginAfterAction() {
|
|
|
+ let info = KMMemberInfo.shared
|
|
|
+ var expired = info.vip_status == 2 || info.vip_status == 4
|
|
|
+ let state = info.userScenarioType
|
|
|
+ let platforms = info.userPlatforms()
|
|
|
+ let vip_levels = info.vip_levels
|
|
|
+ let vip_paymentModel = info.vip_paymentModel
|
|
|
+
|
|
|
+ if platforms.count == 1 && platforms.first == "ios" && info.vip_levels == "3" && vip_paymentModel == "2" { // ios单平台高级版永久账户
|
|
|
+ KMMemberInfo.shared.productCompareShow()
|
|
|
+ return
|
|
|
+ } else if platforms.count == 1 && platforms.first == "mac" { // Mac 单平台高级版永久账户
|
|
|
+ // 关闭比较表,可以直接使用高级功能
|
|
|
+ window?.close()
|
|
|
+ return
|
|
|
+ } else if platforms.count == 2 && platforms.contains("windows") && platforms.contains("mac") && vip_paymentModel == "2" { // Mac & Windows 双平台高级永久账户
|
|
|
+ // 关闭比较表,可以直接使用高级功能
|
|
|
+ window?.close()
|
|
|
+ return
|
|
|
+ } else if platforms.count == 1 && platforms.first == "android" && info.vip_levels == "3" && vip_paymentModel == "1" { // Android单平台高级版月订阅账户
|
|
|
+ // 关闭比较表,可以直接使用高级功能
|
|
|
+ let alert = NSAlert()
|
|
|
+ alert.alertStyle = .critical
|
|
|
+ alert.informativeText = NSLocalizedString("Sorry, you do not have the rights to this paid feature and cannot use it. If you have any questions, please contact customer service at support@pdfreaderpro.com", comment: "")
|
|
|
+ alert.addButton(withTitle: NSLocalizedString("Got it", comment: ""))
|
|
|
+ alert.runModal()
|
|
|
+
|
|
|
+ window?.close()
|
|
|
+ return
|
|
|
+
|
|
|
+ } else if platforms.count == 4 && vip_levels == "2" && vip_paymentModel == "1" { // 全平台标准版年订阅账户 不支持升级,关闭比较表,可以直接使用非转档的高级功能
|
|
|
+ let alert = NSAlert()
|
|
|
+ alert.alertStyle = .critical
|
|
|
+ alert.informativeText = NSLocalizedString("Sorry, you do not have the rights to this paid feature and cannot use it. If you have any questions, please contact customer service at support@pdfreaderpro.com", comment: "")
|
|
|
+ alert.addButton(withTitle: NSLocalizedString("Got it", comment: ""))
|
|
|
+ alert.runModal()
|
|
|
+
|
|
|
+ window?.close()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// MARK: Button Actions
|
|
|
|
|
|
@IBAction func buttonItemClicked_Subscribe(_ sender: Any) {
|
|
|
if KMIsAppStoreFreeVersion() && subscribeType != nil && KMMemberInfo.shared.isLogin == false { // AppStore 免费版 + 付费功能进入 + 未登陆,跳转登陆
|
|
|
- KMLoginWindowsController.shared.newOpenWindow(type: subscribeType) { success in
|
|
|
+ var product = IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite
|
|
|
+ if model.isPurchaseSwitch {
|
|
|
+ product = IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite
|
|
|
+ }
|
|
|
+ KMLoginWindowsController.shared.newOpenWindow(type: subscribeType, product: product, needDiscount: model.isCancelAutoRenew) { success in
|
|
|
+ if KMMemberInfo.shared.isLogin == false {
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
+ let info = KMMemberInfo.shared
|
|
|
+ var expired = info.vip_status == 2 || info.vip_status == 4
|
|
|
+ let state = info.userScenarioType
|
|
|
+ let platforms = info.userPlatforms()
|
|
|
+ let vip_levels = info.vip_levels
|
|
|
+ let vip_paymentModel = info.vip_paymentModel
|
|
|
+ if info.vip_levels == "1" || expired {
|
|
|
+ if self.model.isPurchaseSwitch { // 免费账户/订阅过期账户
|
|
|
+ IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite, discount: self.model.isCancelAutoRenew)
|
|
|
+ } else {
|
|
|
+ IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite, discount: self.model.isCancelAutoRenew)
|
|
|
+ }
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ self._loginAfterAction()
|
|
|
+ }
|
|
|
}
|
|
|
return
|
|
|
}
|
|
@@ -1338,14 +1403,73 @@ class KMProductCompareWC: NSWindowController {
|
|
|
KMMemberPromptWC.shared.tipType = .signouting
|
|
|
} else {
|
|
|
#if !VERSION_DMG
|
|
|
- addWaitingView(to: window?.contentView ?? NSView())
|
|
|
+// addWaitingView(to: window?.contentView ?? NSView())
|
|
|
#endif
|
|
|
if KMIsAppStoreFreeVersion() && subscribeType != nil && KMMemberInfo.shared.isLogin == false { // AppStore 免费版 + 付费功能进入 + 未登陆,跳转登陆
|
|
|
- KMLoginWindowsController.shared.newOpenWindow(type: subscribeType) { success in
|
|
|
+ let state = model.state
|
|
|
+ let tag = sender.tag
|
|
|
+ var product: IAPProduct?
|
|
|
+ let isPurchaseSwitch = model.isPurchaseSwitch
|
|
|
+ if state == .lite_Base {
|
|
|
+ if tag == 0 {
|
|
|
+ if isPurchaseSwitch {
|
|
|
+ product = IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite
|
|
|
+ } else {
|
|
|
+ product = IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite
|
|
|
+ }
|
|
|
+ } else if tag == 3 {
|
|
|
+ product = IAPProductsManager.default().allAccessPackPermanent_lite
|
|
|
+ } else {
|
|
|
+ product = IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite
|
|
|
+ }
|
|
|
+ } else if state == .lite_MacWindows {
|
|
|
+ if tag == 2 {
|
|
|
+ let platforms = KMMemberInfo.shared.vip_platforms
|
|
|
+ let platformsArray = platforms
|
|
|
+ .components(separatedBy: ",")
|
|
|
+ .map { $0.trimmingCharacters(in: .whitespaces) }
|
|
|
+ if KMMemberInfo.shared.userScenarioType == .lite_type5 {
|
|
|
+ if platformsArray.count == 1 {
|
|
|
+ product = IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_lite
|
|
|
+ } else if platformsArray.count == 2 {
|
|
|
+ product = IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if platformsArray.count == 1 {
|
|
|
+ product = IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_lite
|
|
|
+ } else if platformsArray.count == 2 {
|
|
|
+ product = IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite
|
|
|
+ } else {
|
|
|
+ product = IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ KMLoginWindowsController.shared.newOpenWindow(type: subscribeType, product: product, needDiscount: model.isCancelAutoRenew) { success in
|
|
|
+ if KMMemberInfo.shared.isLogin == false {
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
+ let info = KMMemberInfo.shared
|
|
|
+ var expired = info.vip_status == 2 || info.vip_status == 4
|
|
|
+ let state = info.userScenarioType
|
|
|
+ let platforms = info.userPlatforms()
|
|
|
+ let vip_levels = info.vip_levels
|
|
|
+ let vip_paymentModel = info.vip_paymentModel
|
|
|
+ if info.vip_levels == "1" || expired {
|
|
|
+ self.model.appstorePurchaseAction(sender.tag) { [weak self] success, msg in
|
|
|
+
|
|
|
+ }
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ self._loginAfterAction()
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+ addWaitingView(to: window?.contentView ?? NSView())
|
|
|
model.appstorePurchaseAction(sender.tag) { [weak self] success, msg in
|
|
|
guard let self = self else { return }
|
|
|
}
|