KMProductModel.swift 88 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362
  1. //
  2. // KMProductModel.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by wanjun on 2024/11/6.
  6. //
  7. import Foundation
  8. import Combine
  9. #if !VERSION_DMG
  10. import StoreKit
  11. #endif
  12. @objc enum KMCompareTableType : Int {
  13. case trial = 0 // 试用比较表
  14. case dmg_Base // DMG 购买比较表
  15. case dmg_Upgrades1 // DMG 升级比较表 39.99
  16. case dmg_Upgrades2 // DMG 升级比较表 49.99
  17. case lite_Base // Lite 基础版
  18. case lite_MacWindows // Lite Mac&Windows双平台高级版永久
  19. case pro_Base // Pro 基础版
  20. case pro_Advanced // Pro Mac单平台高级版永久
  21. }
  22. @objc enum KMCompareProductType : Int {
  23. case free = 0 // 免费
  24. case freeTrial // 试用
  25. case allPlatformStandard // 全平台标准版年订阅
  26. case dualPlatformAdvanced // Mac&Windows双平台高级版永久
  27. case allPlatformAdvanced_6 // 全平台高级版6个月订阅
  28. case allPlatformAdvanced_12 // 全平台高级版12个月订阅
  29. case macPlatformAdvanced // MAC单平台高级版永久
  30. }
  31. @objc enum KMPurchasedProductType : Int {
  32. case fourDevicesAllAccessPackNew6months_lite = 0 // 4_devices_all_access_pack_new_6months(订阅)
  33. case fourDevicesAllAccessPackNew12months_lite // 4_devices_all_access_pack_12months(订阅)
  34. // case allAccessPackNew6months_lite // all_access_pack_new_6months(订阅)
  35. // case allAccessPack12months_lite // all_access_pack_12months(订阅)
  36. // case allAccessPack6months_lite // all_access_pack_6months(订阅)
  37. case aiAllAccessPack1month_lite // ai_all_access_pack_1month(订阅)
  38. case aiAllAccessPack12month_lite // ai_all_access_pack_12month(订阅)
  39. case allAccessPackPermanent_lite // all_access_pack_permanent(永久)
  40. case advancedAddDevicesAllAccessPack12months_lite // advanced_add_devices_all_access_pack_12months(订阅)单平台升级到全平台
  41. case advancedAdd2DevicesAllAccessPack12months_lite // advanced_add_2_devices_all_access_pack_12months(订阅)双平台升级到全平台
  42. case aiAllAccessPack1month_pro // ai_all_access_pack_1month(订阅)
  43. case aiAllAccessPack12month_pro // ai_all_access_pack_1month(订阅)
  44. case pdfToOfficePackPermanent_pro // pdf_to_office_pack_permanent(永久)
  45. case fourDevicesAllAccessPack12months_pro // 4_devices_all_access_pack_12months(全平台高级年订阅)
  46. case standardAddDevicesAllAccessPack12months_pro // standard_add_devices_all_access_pack_12months(订阅)
  47. case advancedAddDevicesAllAccessPack12months_pro // advanced_add_devices_all_access_pack_12months(订阅)
  48. case advancedAdd2DevicesAllAccessPack12months_pro // advanced_add_2_devices_all_access_pack_12months(订阅)
  49. case pdfReaderProStandard_dmg // 全平台标准版年订阅
  50. case pdfReaderProAdvanced_dmg // 全平台高级版年订阅
  51. case pdfReaderProPermanent_dmg // Mac&Windows双平台高级版永久
  52. case pdfReaderProAIAnnual_dmg // AI 年订阅
  53. case pdfReaderProAIMonthly_dmg // AI 月订阅
  54. case pdfToOffice_dmg // 转档包 永久
  55. case add2Device_dmg // 多设备全平台
  56. case add3Device_dmg // 单平台升级高级版
  57. }
  58. @objc enum KMPaymentModeType : Int {
  59. case null = 0
  60. case freeTrial
  61. case payAsYouGo
  62. case payUpFront
  63. case discount
  64. }
  65. typealias AppstorePurchaseComplete = (_ success: Bool,_ msg: String) -> Void
  66. @objcMembers
  67. class KMProductModel: ObservableObject {
  68. static let shared = KMProductModel()
  69. /**
  70. 比较表类型
  71. */
  72. @Published var state: KMCompareTableType = .trial
  73. /**
  74. 高级版半年 或 年订阅,true为年订阅,false为半年订阅,默认true为年订阅
  75. */
  76. @Published var isPurchaseSwitch: Bool = true
  77. // MARK: DMG Public Property
  78. /**
  79. DMG 版本所有已经上架产品记录(暂时无教育优惠)
  80. */
  81. var dmgProductDatas: KMMemberProductResult?
  82. /**
  83. DMG 版本 已经登录用户 最后一次价格获取
  84. */
  85. var dmgLastGetProductPriceInfos: KMMemberProductResult?
  86. /**
  87. DMG 版本 已经登录用户 最后一次批量价格获取
  88. */
  89. var dmgLastGetBatchProductPriceInfos: KMMemberProductResult?
  90. /**
  91. DMG 版本 已经登录用户 最后一次验证商品优惠券价格获取
  92. */
  93. var dmgLastCheckCouponProductPriceInfos: KMMemberProductResult?
  94. /**
  95. DMG 版本 已经登录用户 最后一次创建的买断订单返回信息
  96. */
  97. var dmgLastCreatOrderProductInfos: KMMemberProductResult?
  98. /**
  99. DMG 版本 已经登录用户 最后一次创建的买断订单返回信息
  100. */
  101. var dmgLastCreatSubscriberProductInfos: KMMemberProductResult?
  102. // MARK: DMG Public Method
  103. func checkConnectionAvailable() -> Void {
  104. if KMMemberCenterManager.manager.isConnectionAvailable() == false {
  105. let alert = NSAlert()
  106. alert.alertStyle = .critical
  107. alert.messageText = NSLocalizedString("Error Information", comment: "")
  108. alert.informativeText = NSLocalizedString("Please make sure your internet connection is available.", comment: "")
  109. alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
  110. alert.runModal()
  111. return
  112. }
  113. }
  114. /**
  115. @abstract 获取DMG服务器架上所有商品 (得到的价格是原始价格)
  116. @param
  117. */
  118. func getDMGProductDatas( _ complete: @escaping KMMemberProductComplete) -> Void {
  119. checkConnectionAvailable()
  120. KMMemberCenterManager.manager.getListingProducts(isEducation: 0) { [weak self] success, result in
  121. guard let productsArrays : KMMemberProductResult = result else { return }
  122. self?.dmgProductDatas = productsArrays
  123. complete(success, result)
  124. }
  125. if KMMemberInfo.shared.isLogin {
  126. // getDMGProductPriceInfosForMember(productId: "SP2024102300004", isEducation: 0) { [weak self] success, result in
  127. //
  128. //
  129. // }
  130. // getDMGBatchProductPriceInfosForMember(productId: "SP2024102300004", num: 10) { [weak self] success, result in
  131. //
  132. //
  133. // }
  134. // getDMGProductListInfosForMember(orderStatus: 0) { [weak self] success, result in
  135. //
  136. // }
  137. //创建买断订单
  138. // creatOrder(productId: "SP2024102300004", paymentMethod: 0, price: "119.99", discountFlag: 0, couponCode: "", num: 1) { [weak self] success, result in
  139. //
  140. // }
  141. //创建订阅订单(创建买断订单后会报错已经是购买用户,不能重复购买)
  142. // createSubscriber(productId: "SP2024102300003", paymentMethod: 0, price: "99.99", discountFlag: 0, couponCode: "", num: 1) { [weak self] success, result in
  143. //
  144. // }
  145. // getDMGProductOrderIdInfosForMember(orderId: "94b10d5f1ca193948e005503bff0df11") { [weak self] success, result in
  146. //
  147. // }
  148. }
  149. }
  150. /**
  151. @abstract 获取DMG产品价格(美元)
  152. */
  153. func getDMGPrice(productCode: String) -> String {
  154. guard let productModels = dmgProductDatas?.listingProducts else { return "" }
  155. for model in productModels {
  156. if model.code == productCode {
  157. if model.upgradePriceString?.isEmpty == false {
  158. return String(format: "%.2f", Float(model.upgradePriceString ?? "0") ?? 0)
  159. } else if model.displayPriceString?.isEmpty == false {
  160. if model.displayPriceString == "0.00" {
  161. return String(format: "%.2f", Float(model.priceString ?? "0") ?? 0)
  162. } else {
  163. return String(format: "%.2f", Float(model.displayPriceString ?? "0") ?? 0)
  164. }
  165. } else {
  166. return String(format: "%.2f", Float(model.priceString ?? "0") ?? 0)
  167. }
  168. }
  169. }
  170. return ""
  171. }
  172. /**
  173. @abstract 获取DMG产品价格(人民币)
  174. */
  175. func getDMGCNYPrice(productCode: String) -> String {
  176. guard let productModels = dmgProductDatas?.listingProducts else { return "" }
  177. for model in productModels {
  178. if model.code == productCode {
  179. if model.cnyUpgradePriceString?.isEmpty == false {
  180. return String(format: "%.2f", Float(model.cnyUpgradePriceString ?? "0") ?? 0)
  181. } else if model.displayCnyPriceString?.isEmpty == false {
  182. if model.displayCnyPriceString == "0.00" {
  183. return String(format: "%.2f", Float(model.cnyPriceString ?? "0") ?? 0)
  184. } else {
  185. return String(format: "%.2f", Float(model.displayCnyPriceString ?? "0") ?? 0)
  186. }
  187. } else {
  188. return String(format: "%.2f", Float(model.cnyPriceString ?? "0") ?? 0)
  189. }
  190. }
  191. }
  192. return ""
  193. }
  194. /**
  195. @abstract 获取DMG产品折扣价格(美元)
  196. */
  197. func getDMGDisplayPrice(productCode: String) -> String {
  198. guard let productModels = dmgProductDatas?.listingProducts else { return "" }
  199. for model in productModels {
  200. if model.code == productCode {
  201. return String(format: "%.2f", Float(model.displayPriceString ?? "0") ?? 0)
  202. }
  203. }
  204. return ""
  205. }
  206. /**
  207. @abstract 获取DMG产品折扣价格(人民币)
  208. */
  209. func getDMGDisplayCNYPrice(productCode: String) -> String {
  210. guard let productModels = dmgProductDatas?.listingProducts else { return "" }
  211. for model in productModels {
  212. if model.code == productCode {
  213. return String(format: "%.2f", Float(model.displayCnyPriceString ?? "0") ?? 0)
  214. }
  215. }
  216. return ""
  217. }
  218. /**
  219. @abstract 获取登录用户价格(建立订单时需要用到)
  220. @param productId 购买的产品id
  221. @param isEducation 是否教育优惠
  222. @param complete 回调
  223. */
  224. func getDMGProductPriceInfosForMember(productId: String, isEducation: Int, _ complete: @escaping KMMemberProductComplete) {
  225. checkConnectionAvailable()
  226. //暂时无教育优惠,先固定传 0
  227. KMMemberCenterManager.manager.getProductPriceForBuy(productId: productId, isEducation: 0, userId:KMMemberInfo.shared.userID) { [weak self] success, result in
  228. if success {
  229. guard let productsArrays : KMMemberProductResult = result else {
  230. complete(false, result)
  231. return
  232. }
  233. self?.dmgLastGetProductPriceInfos = productsArrays
  234. complete(true, productsArrays)
  235. } else {
  236. complete(false, result)
  237. }
  238. }
  239. }
  240. /**
  241. @abstract 获取批量阶段购买价格(建立订单时需要用到)
  242. @param productId 购买的产品id
  243. @param num 批量个数
  244. @param complete 回调
  245. */
  246. func getDMGBatchProductPriceInfosForMember(productId: String, num: Int, _ complete: @escaping KMMemberProductComplete) {
  247. checkConnectionAvailable()
  248. KMMemberCenterManager.manager.getBatchProductPrice(productId: productId, num: num) { [weak self] success, result in
  249. if success {
  250. guard let productsArrays : KMMemberProductResult = result else {
  251. complete(false, result)
  252. return
  253. }
  254. self?.dmgLastGetBatchProductPriceInfos = productsArrays
  255. complete(true, productsArrays)
  256. } else {
  257. complete(false, result)
  258. }
  259. }
  260. }
  261. /**
  262. @abstract 验证商品优惠券(建立订单时需要用到)
  263. @param productId 购买的产品id
  264. @param code 优惠券
  265. @param complete 回调
  266. */
  267. func getDMGCheckCouponProductPriceInfosForMember(productId: String, code: String, _ complete: @escaping KMMemberProductComplete) {
  268. checkConnectionAvailable()
  269. KMMemberCenterManager.manager.checkCoupon(productId: productId, userId: KMMemberInfo.shared.userID, code: code) { [weak self] success, result in
  270. if success {
  271. guard let productsArrays : KMMemberProductResult = result else {
  272. complete(false, result)
  273. return
  274. }
  275. self?.dmgLastCheckCouponProductPriceInfos = productsArrays
  276. complete(true, productsArrays)
  277. } else {
  278. complete(false, result)
  279. }
  280. }
  281. }
  282. /**
  283. @abstract 获取订单列表
  284. @param orderStatus 0全部1待支付
  285. @param complete 回调
  286. */
  287. func getDMGProductListInfosForMember(orderStatus: Int, _ complete: @escaping KMMemberRequestInfoComplete) {
  288. checkConnectionAvailable()
  289. KMMemberCenterManager.manager.getOrderListByStatus(orderStatus: orderStatus) { [weak self] success, result in
  290. if success {
  291. guard let productsInfos : NSDictionary = result else {
  292. complete(false, result)
  293. return
  294. }
  295. complete(true, productsInfos)
  296. } else {
  297. complete(false, result)
  298. }
  299. }
  300. }
  301. /**
  302. @abstract 创建订单(买断)
  303. @param productId 产品id
  304. @param paymentMethod 支付方式 PAYPAL(0),ALIPAY(1),WXPAY(2),PADDLE(3)
  305. @param price 价格
  306. @param discountFlag 0原价,1优惠券,2升级,3教育优惠,4批量购买,5黑五折扣
  307. @param couponCode 优惠卷
  308. @param num 批量购买数量
  309. @param complete 回调
  310. */
  311. func creatOrder(productId: String, paymentMethod: Int, price: String, discountFlag: Int, couponCode: String, num: Int, _ complete: @escaping KMMemberProductComplete) {
  312. checkConnectionAvailable()
  313. KMMemberCenterManager.manager.createOrder(productId: productId, paymentMethod: paymentMethod, price: price, discountFlag: discountFlag, couponCode: couponCode, num: num) { [weak self] success, result in
  314. if success {
  315. guard let productsArrays : KMMemberProductResult = result else {
  316. complete(false, result)
  317. return
  318. }
  319. self?.dmgLastCreatOrderProductInfos = productsArrays
  320. complete(true, productsArrays)
  321. } else {
  322. complete(false, result)
  323. }
  324. }
  325. }
  326. /**
  327. @abstract 创建订单(订阅)
  328. @param productId 产品id
  329. @param paymentMethod 支付方式 PAYPAL(0),ALIPAY(1),WXPAY(2),PADDLE(3)
  330. @param price 价格
  331. @param discountFlag 0原价,1优惠券,2升级,3教育优惠,4批量购买,5黑五折扣
  332. @param couponCode 优惠卷
  333. @param num 批量购买数量
  334. @param complete 回调
  335. */
  336. func createSubscriber(productId: String, paymentMethod: Int, price: String, discountFlag: Int, couponCode: String, num: Int, _ complete: @escaping KMMemberProductComplete) {
  337. checkConnectionAvailable()
  338. KMMemberCenterManager.manager.createSubscriber(productId: productId, paymentMethod: paymentMethod, price: price, discountFlag: discountFlag, couponCode: couponCode, num: num) { [weak self] success, result in
  339. if success {
  340. guard let productsArrays : KMMemberProductResult = result else {
  341. complete(false, result)
  342. return
  343. }
  344. self?.dmgLastCreatSubscriberProductInfos = productsArrays
  345. complete(true, productsArrays)
  346. } else {
  347. complete(false, result)
  348. }
  349. }
  350. }
  351. /**
  352. @abstract 支付后查询订单状态
  353. @param productId 购买的产品id
  354. @param complete 回调
  355. */
  356. func getDMGProductOrderIdInfosForMember(orderId: String, _ complete: @escaping KMMemberRequestInfoComplete) {
  357. checkConnectionAvailable()
  358. KMMemberCenterManager.manager.getStateByOrderId(orderId: orderId) { [weak self] success, result in
  359. if success {
  360. guard let productsInfos : NSDictionary = result else {
  361. complete(false, result)
  362. return
  363. }
  364. complete(true, productsInfos)
  365. } else {
  366. complete(false, result)
  367. }
  368. }
  369. }
  370. // MARK: Public Method
  371. /**
  372. @abstract 根据当前权益获取比较表类型
  373. @param
  374. */
  375. func getCurrentComparisonTableType() -> Void {
  376. let userScenarioType = KMMemberInfo.shared.userScenarioType
  377. let platforms = KMMemberInfo.shared.vip_platforms
  378. let platformsArray = platforms
  379. .components(separatedBy: ",")
  380. .map { $0.trimmingCharacters(in: .whitespaces) }
  381. if userScenarioType == .lite_type1 ||
  382. userScenarioType == .lite_type3 ||
  383. userScenarioType == .lite_type11 ||
  384. userScenarioType == .lite_type4 ||
  385. userScenarioType == .lite_type5 ||
  386. userScenarioType == .lite_type9 ||
  387. userScenarioType == .lite_type13 ||
  388. userScenarioType == .lite_type7 ||
  389. userScenarioType == .lite_type8 {
  390. if userScenarioType == .lite_type1 {
  391. state = .trial
  392. } else if userScenarioType == .lite_type3 || userScenarioType == .lite_type11 {
  393. state = .lite_Base
  394. } else if userScenarioType == .lite_type4 || userScenarioType == .lite_type5 || userScenarioType == .lite_type9 || userScenarioType == .lite_type13 {
  395. state = .lite_MacWindows
  396. } else if userScenarioType == .lite_type7 || userScenarioType == .lite_type8 {
  397. if KMMemberInfo.shared.vip_paymentModel == "1" && KMMemberInfo.shared.vip_cycle == 4 && platformsArray.count == 4 {
  398. state = .lite_MacWindows
  399. } else {
  400. state = .lite_Base
  401. }
  402. }
  403. } else if userScenarioType == .pro_type1 ||
  404. userScenarioType == .pro_type3 ||
  405. userScenarioType == .pro_type4 {
  406. if userScenarioType == .pro_type1 ||
  407. userScenarioType == .pro_type4 {
  408. state = .pro_Advanced
  409. } else if userScenarioType == .pro_type3 {
  410. state = .pro_Base
  411. }
  412. } else if userScenarioType == .dmg_type4 ||
  413. userScenarioType == .dmg_type5 ||
  414. userScenarioType == .dmg_type6 ||
  415. userScenarioType == .dmg_type7 ||
  416. userScenarioType == .dmg_type8 ||
  417. userScenarioType == .dmg_type9 ||
  418. userScenarioType == .dmg_type10 ||
  419. userScenarioType == .dmg_type11 ||
  420. userScenarioType == .dmg_type12 ||
  421. userScenarioType == .dmg_type13 ||
  422. userScenarioType == .dmg_type14 ||
  423. userScenarioType == .dmg_type15 ||
  424. userScenarioType == .dmg_type16 ||
  425. userScenarioType == .dmg_type17 ||
  426. userScenarioType == .dmg_type18 ||
  427. userScenarioType == .dmg_type19 ||
  428. userScenarioType == .dmg_type20 ||
  429. userScenarioType == .dmg_type21 ||
  430. userScenarioType == .dmg_type22 ||
  431. userScenarioType == .dmg_type23 ||
  432. userScenarioType == .dmg_type24 ||
  433. userScenarioType == .dmg_type25 ||
  434. userScenarioType == .dmg_type26 ||
  435. userScenarioType == .dmg_type27 ||
  436. userScenarioType == .dmg_type28 ||
  437. userScenarioType == .dmg_type29 ||
  438. userScenarioType == .dmg_type30 ||
  439. userScenarioType == .dmg_type31 ||
  440. userScenarioType == .dmg_type32 ||
  441. userScenarioType == .dmg_type33 ||
  442. userScenarioType == .dmg_type34 ||
  443. userScenarioType == .dmg_type35 ||
  444. userScenarioType == .dmg_type36 ||
  445. userScenarioType == .dmg_type37 ||
  446. userScenarioType == .dmg_type38 ||
  447. userScenarioType == .dmg_type39 ||
  448. userScenarioType == .dmg_type40 ||
  449. userScenarioType == .dmg_type41 ||
  450. userScenarioType == .dmg_type42 ||
  451. userScenarioType == .dmg_type43 ||
  452. userScenarioType == .dmg_type44 ||
  453. userScenarioType == .dmg_type45 ||
  454. userScenarioType == .dmg_type46 ||
  455. userScenarioType == .dmg_type47 ||
  456. userScenarioType == .dmg_type48 {
  457. if userScenarioType == .dmg_type4 ||
  458. userScenarioType == .dmg_type19 ||
  459. userScenarioType == .dmg_type34 {
  460. state = .trial
  461. } else if userScenarioType == .dmg_type5 ||
  462. userScenarioType == .dmg_type28 ||
  463. userScenarioType == .dmg_type43 {
  464. state = .dmg_Upgrades1
  465. } else if userScenarioType == .dmg_type6 ||
  466. userScenarioType == .dmg_type7 ||
  467. userScenarioType == .dmg_type29 ||
  468. userScenarioType == .dmg_type30 ||
  469. userScenarioType == .dmg_type44 ||
  470. userScenarioType == .dmg_type45 {
  471. state = .dmg_Upgrades2
  472. } else if userScenarioType == .dmg_type11 ||
  473. userScenarioType == .dmg_type18 ||
  474. userScenarioType == .dmg_type22 ||
  475. userScenarioType == .dmg_type33 ||
  476. userScenarioType == .dmg_type37 ||
  477. userScenarioType == .dmg_type48 {
  478. state = .dmg_Base
  479. }
  480. }
  481. }
  482. /**
  483. 对应商品价格
  484. */
  485. func getProductPrice(_ type: KMPurchasedProductType) -> String {
  486. #if VERSION_FREE
  487. #if VERSION_DMG
  488. // DMG
  489. if type == .pdfReaderProStandard_dmg {
  490. if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
  491. return String(format: "USD $%@", getDMGPrice(productCode: KMStandardAnnualSubscriptionCodeKey_DMG))
  492. } else {
  493. return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMStandardAnnualSubscriptionCodeKey_DMG))
  494. }
  495. } else if type == .pdfReaderProAdvanced_dmg {
  496. if state == .dmg_Base {
  497. if isBlackFive {
  498. if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
  499. return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG))
  500. } else {
  501. return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG))
  502. }
  503. } else {
  504. if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
  505. return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionCodeKey_DMG))
  506. } else {
  507. return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionCodeKey_DMG))
  508. }
  509. }
  510. } else {
  511. if KMMemberInfo.shared.canTrail && state == .trial {
  512. if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
  513. return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionTrailCodeKey_DMG))
  514. } else {
  515. return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionTrailCodeKey_DMG))
  516. }
  517. } else {
  518. if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
  519. return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionCodeKey_DMG))
  520. } else {
  521. return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionCodeKey_DMG))
  522. }
  523. }
  524. }
  525. } else if type == .pdfReaderProPermanent_dmg {
  526. if state == .dmg_Base {
  527. if isBlackFive {
  528. if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
  529. return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedPermanentBlackFiveCodeKey_DMG))
  530. } else {
  531. return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedPermanentBlackFiveCodeKey_DMG))
  532. }
  533. } else {
  534. if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
  535. return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedPermanentCodeKey_DMG))
  536. } else {
  537. return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedPermanentCodeKey_DMG))
  538. }
  539. }
  540. } else {
  541. }
  542. } else if type == .pdfReaderProAIAnnual_dmg {
  543. if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
  544. return String(format: "USD $%@", getDMGPrice(productCode: KMAISubscriptionYearTrailCodeKey_DMG))
  545. } else {
  546. return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAISubscriptionYearTrailCodeKey_DMG))
  547. }
  548. } else if type == .pdfReaderProAIMonthly_dmg {
  549. if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
  550. return String(format: "USD $%@", getDMGPrice(productCode: KMAISubscriptionMonthCodeKey_DMG))
  551. } else {
  552. return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAISubscriptionMonthCodeKey_DMG))
  553. }
  554. } else if type == .pdfToOffice_dmg {
  555. } else if type == .add2Device_dmg {
  556. } else if type == .add3Device_dmg {
  557. }
  558. #else
  559. // AppStore 免费版本
  560. if type == .fourDevicesAllAccessPackNew6months_lite {
  561. if let product = IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite, product.isOffers {
  562. return product.offersPrice()
  563. } else {
  564. return IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite.price()
  565. }
  566. } else if type == .fourDevicesAllAccessPackNew12months_lite {
  567. if let product = IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite, product.isOffers {
  568. return product.offersPrice()
  569. } else {
  570. return IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite.price()
  571. }
  572. } else if type == .aiAllAccessPack1month_lite {
  573. if let product = IAPProductsManager.default().aiAllAccessPack1month_lite, product.isOffers {
  574. return product.offersPrice()
  575. } else {
  576. return IAPProductsManager.default().aiAllAccessPack1month_lite.price()
  577. }
  578. } else if type == .aiAllAccessPack12month_lite {
  579. if let product = IAPProductsManager.default().aiAllAccessPack12month_lite, product.isOffers {
  580. return product.offersPrice()
  581. } else {
  582. return IAPProductsManager.default().aiAllAccessPack12month_lite.price()
  583. }
  584. } else if type == .allAccessPackPermanent_lite {
  585. if let product = IAPProductsManager.default().allAccessPackPermanent_lite, product.isOffers {
  586. return product.offersPrice()
  587. } else {
  588. return IAPProductsManager.default().allAccessPackPermanent_lite.price()
  589. }
  590. } else if type == .advancedAddDevicesAllAccessPack12months_lite {
  591. if let product = IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_lite, product.isOffers {
  592. return product.offersPrice()
  593. } else {
  594. return IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_lite.price()
  595. }
  596. } else if type == .advancedAdd2DevicesAllAccessPack12months_lite {
  597. if let product = IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite, product.isOffers {
  598. return product.offersPrice()
  599. } else {
  600. return IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite.price()
  601. }
  602. }
  603. #endif
  604. #else
  605. // AppStore 付费版
  606. if type == .aiAllAccessPack1month_pro {
  607. if let product = IAPProductsManager.default().aiAllAccessPack1month_pro, product.isOffers {
  608. return product.offersPrice()
  609. } else {
  610. return IAPProductsManager.default().aiAllAccessPack1month_pro.price()
  611. }
  612. } else if type == .aiAllAccessPack12month_pro {
  613. if let product = IAPProductsManager.default().aiAllAccessPack12month_pro, product.isOffers {
  614. return product.offersPrice()
  615. } else {
  616. return IAPProductsManager.default().aiAllAccessPack12month_pro.price()
  617. }
  618. } else if type == .pdfToOfficePackPermanent_pro {
  619. if let product = IAPProductsManager.default().pdfToOfficePackPermanent_pro, product.isOffers {
  620. return product.offersPrice()
  621. } else {
  622. return IAPProductsManager.default().pdfToOfficePackPermanent_pro.price()
  623. }
  624. } else if type == .fourDevicesAllAccessPack12months_pro {
  625. if let product = IAPProductsManager.default().fourDevicesAllAccessPack12months_pro, product.isOffers {
  626. return product.offersPrice()
  627. } else {
  628. return IAPProductsManager.default().fourDevicesAllAccessPack12months_pro.price()
  629. }
  630. } else if type == .standardAddDevicesAllAccessPack12months_pro {
  631. if let product = IAPProductsManager.default().standardAddDevicesAllAccessPack12months_pro, product.isOffers {
  632. return product.offersPrice()
  633. } else {
  634. return IAPProductsManager.default().standardAddDevicesAllAccessPack12months_pro.price()
  635. }
  636. } else if type == .advancedAddDevicesAllAccessPack12months_pro {
  637. if let product = IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_pro, product.isOffers {
  638. return product.offersPrice()
  639. } else {
  640. return IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_pro.price()
  641. }
  642. } else if type == .advancedAdd2DevicesAllAccessPack12months_pro {
  643. if let product = IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro, product.isOffers {
  644. return product.offersPrice()
  645. } else {
  646. return IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro.price()
  647. }
  648. }
  649. #endif
  650. return ""
  651. }
  652. func appstorePurchaseAction(_ tag: Int, _ complete: @escaping AppstorePurchaseComplete) -> Void {
  653. if state == .dmg_Base {
  654. var code = ""
  655. if tag == 1 {
  656. code = KMStandardAnnualSubscriptionCodeKey_DMG
  657. } else if tag == 3 {
  658. if isBlackFive {
  659. code = KMAdvancedPermanentBlackFiveCodeKey_DMG
  660. } else {
  661. code = KMAdvancedPermanentCodeKey_DMG
  662. }
  663. } else {
  664. if isBlackFive {
  665. code = KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG
  666. } else {
  667. code = KMAdvancedAnnualSubscriptionCodeKey_DMG
  668. }
  669. }
  670. #if VERSION_DMG
  671. let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(code)
  672. embeddedWC.showWindow(nil)
  673. embeddedWC.window?.center()
  674. #endif
  675. } else if state == .dmg_Upgrades1 {
  676. #if VERSION_DMG
  677. let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(KMAdvancedAnnualSubscriptionCodeKey_DMG)
  678. embeddedWC.showWindow(nil)
  679. embeddedWC.window?.center()
  680. #endif
  681. } else if state == .dmg_Upgrades2 {
  682. #if VERSION_DMG
  683. let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(KMAdvancedAnnualSubscriptionCodeKey_DMG)
  684. embeddedWC.showWindow(nil)
  685. embeddedWC.window?.center()
  686. #endif
  687. } else if state == .lite_Base {
  688. if tag == 0 {
  689. if isPurchaseSwitch { membershipPurchase(.fourDevicesAllAccessPackNew12months_lite) }
  690. else { membershipPurchase(.fourDevicesAllAccessPackNew6months_lite) }
  691. } else if tag == 3 {
  692. membershipPurchase(.allAccessPackPermanent_lite)
  693. } else {
  694. membershipPurchase(.fourDevicesAllAccessPackNew12months_lite)
  695. }
  696. } else if state == .lite_MacWindows {
  697. if tag == 2 {
  698. let platforms = KMMemberInfo.shared.vip_platforms
  699. let platformsArray = platforms
  700. .components(separatedBy: ",")
  701. .map { $0.trimmingCharacters(in: .whitespaces) }
  702. if KMMemberInfo.shared.userScenarioType == .lite_type5 {
  703. if platformsArray.count == 1 {
  704. membershipPurchase(.advancedAddDevicesAllAccessPack12months_lite)
  705. } else if platformsArray.count == 2 {
  706. membershipPurchase(.advancedAdd2DevicesAllAccessPack12months_lite)
  707. }
  708. } else {
  709. if platformsArray.count == 1 {
  710. membershipPurchase(.advancedAddDevicesAllAccessPack12months_lite)
  711. } else if platformsArray.count == 2 {
  712. membershipPurchase(.advancedAdd2DevicesAllAccessPack12months_lite)
  713. } else {
  714. membershipPurchase(.advancedAdd2DevicesAllAccessPack12months_lite)
  715. }
  716. }
  717. }
  718. } else if state == .pro_Base {
  719. if KMMemberInfo.shared.userScenarioType == .pro_type3 {
  720. if tag == 2 {
  721. membershipPurchase(.standardAddDevicesAllAccessPack12months_pro)
  722. } else if tag == 3 {
  723. membershipPurchase(.pdfToOfficePackPermanent_pro)
  724. }
  725. }
  726. } else if state == .pro_Advanced {
  727. let platforms = KMMemberInfo.shared.vip_platforms
  728. let platformsArray = platforms
  729. .components(separatedBy: ",")
  730. .map { $0.trimmingCharacters(in: .whitespaces) }
  731. if KMMemberInfo.shared.userScenarioType == .pro_type1 {
  732. if platformsArray.count == 1 {
  733. membershipPurchase(.advancedAddDevicesAllAccessPack12months_pro)
  734. } else if platformsArray.count == 2 {
  735. membershipPurchase(.advancedAdd2DevicesAllAccessPack12months_pro)
  736. } else if KMMemberInfo.shared.vip_levels == "1" {
  737. membershipPurchase(.advancedAddDevicesAllAccessPack12months_pro)
  738. } else {
  739. membershipPurchase(.advancedAdd2DevicesAllAccessPack12months_pro)
  740. }
  741. } else if KMMemberInfo.shared.userScenarioType == .pro_type4 {
  742. if platformsArray.count == 1 {
  743. membershipPurchase(.advancedAddDevicesAllAccessPack12months_pro)
  744. } else if platformsArray.count == 2 {
  745. membershipPurchase(.advancedAdd2DevicesAllAccessPack12months_pro)
  746. } else {
  747. membershipPurchase(.advancedAdd2DevicesAllAccessPack12months_pro)
  748. }
  749. }
  750. } else {
  751. #if VERSION_FREE
  752. #if VERSION_DMG
  753. // DMG
  754. var code = ""
  755. if state == .dmg_Base {
  756. if isBlackFive {
  757. code = KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG
  758. } else {
  759. code = KMAdvancedAnnualSubscriptionCodeKey_DMG
  760. }
  761. } else {
  762. if KMMemberInfo.shared.canTrail && state == .trial {
  763. code = KMAdvancedAnnualSubscriptionTrailCodeKey_DMG
  764. } else {
  765. code = KMAdvancedAnnualSubscriptionCodeKey_DMG
  766. }
  767. }
  768. let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(code)
  769. embeddedWC.showWindow(nil)
  770. embeddedWC.window?.center()
  771. #else
  772. // AppStore 免费版本
  773. if tag == 2 {
  774. membershipPurchase(.fourDevicesAllAccessPackNew12months_lite)
  775. }
  776. #endif
  777. #else
  778. // AppStore 付费版
  779. #endif
  780. }
  781. }
  782. func appStoreEquityVerification(_ notification: Notification,_ complete: @escaping KMMemberProductComplete) -> Void {
  783. #if VERSION_FREE
  784. #if VERSION_DMG
  785. // DMG
  786. #else
  787. // AppStore 免费版本
  788. if let userInfo = notification.object as? SKPaymentTransaction,
  789. let transactionId = userInfo.transactionIdentifier as? String,
  790. let productId = userInfo.payment.productIdentifier as? String {
  791. print("Transaction ID: \(transactionId)")
  792. print("product ID: \(productId)")
  793. var productCode = ""
  794. var isSubscribed = false
  795. if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_advanced_6months.001" {
  796. productCode = "advanced-annual-subscription-six-month"
  797. if IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite.isSubscribed {
  798. isSubscribed = true
  799. }
  800. } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_advanced_annual.001" {
  801. productCode = "advanced-annual-subscription"
  802. if IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite.isSubscribed {
  803. isSubscribed = true
  804. }
  805. } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_new_6months.001" {
  806. productCode = "advanced-annual-subscription-six-month"
  807. if IAPProductsManager.default().allAccessPackNew6months_lite.isSubscribed {
  808. isSubscribed = true
  809. }
  810. } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_12months.001" {
  811. productCode = "advanced-annual-subscription"
  812. if IAPProductsManager.default().allAccessPack12months_lite.isSubscribed {
  813. isSubscribed = true
  814. }
  815. } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_6months.001" {
  816. productCode = "advanced-annual-subscription-six-month"
  817. if IAPProductsManager.default().allAccessPack6months_lite.isSubscribed {
  818. isSubscribed = true
  819. }
  820. } else if productId == "com.pdfreaderpro.mac_free.member.ai_pack_1_month" {
  821. productCode = "ai-subscription-month"
  822. if IAPProductsManager.default().aiAllAccessPack1month_lite.isSubscribed {
  823. isSubscribed = true
  824. }
  825. } else if productId == "com.pdfreaderpro.mac_free.member.ai_pack_12_month" {
  826. productCode = "ai-subscription-year-trail"
  827. if IAPProductsManager.default().aiAllAccessPack12month_lite.isSubscribed {
  828. isSubscribed = true
  829. }
  830. } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_advanced_permanent_license.001" {
  831. productCode = "advanced-permanent"
  832. if IAPProductsManager.default().allAccessPackPermanent_lite.isSubscribed {
  833. isSubscribed = true
  834. }
  835. } else if productId == "com.pdfreaderpro.mac_free.member.advanced_add_devices_all_access_pack_advanced_annual.001" {
  836. productCode = "advanced-annual-subscription-single-upgrade"
  837. if IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_lite.isSubscribed {
  838. isSubscribed = true
  839. }
  840. } else if productId == "com.pdfreaderpro.mac_free.member.advanced_add_2_devices_all_access_pack_advanced_annual.001" {
  841. productCode = "advanced-annual-subscription-multi-upgrade"
  842. if IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite.isSubscribed {
  843. isSubscribed = true
  844. }
  845. }
  846. if isSubscribed {
  847. KMMemberCenterManager.manager.appStoreEquityVerification(applePayProductId: productId, transactionId: transactionId, productCode: productCode) { success, result in
  848. DispatchQueue.main.async {
  849. if success {
  850. complete(true, result)
  851. } else {
  852. complete(false, result)
  853. }
  854. }
  855. }
  856. }
  857. } else {
  858. print(NSLocalizedString("Order does not exist.", tableName: "MemberCenterLocalizable", comment: ""))
  859. }
  860. #endif
  861. #else
  862. // AppStore 付费版
  863. if let userInfo = notification.object as? SKPaymentTransaction,
  864. let transactionId = userInfo.transactionIdentifier as? String,
  865. let productId = userInfo.payment.productIdentifier as? String {
  866. print("Transaction ID: \(transactionId)")
  867. print("product ID: \(productId)")
  868. var productCode = ""
  869. var isSubscribed = false
  870. if productId == "com.pdfreaderpro.mac.ai_pack_1_month" {
  871. productCode = "ai-subscription-month"
  872. if IAPProductsManager.default().aiAllAccessPack1month_pro.isSubscribed {
  873. isSubscribed = true
  874. }
  875. } else if productId == "com.pdfreaderpro.mac.ai_pack_12_month" {
  876. productCode = "ai-subscription-year-trail"
  877. if IAPProductsManager.default().aiAllAccessPack12month_pro.isSubscribed {
  878. isSubscribed = true
  879. }
  880. } else if productId == "com.pdfreaderpro.mac.pdf_to_office_pack_permanent_license.001" {
  881. productCode = "advanced-permanent-mac-upgrade"
  882. if IAPProductsManager.default().pdfToOfficePackPermanent_pro.isSubscribed {
  883. isSubscribed = true
  884. }
  885. } else if productId == "com.pdfreaderpro.mac.all_access_pack_advanced_annual.001" {
  886. productCode = "advanced-permanent-mac-upgrade"
  887. if IAPProductsManager.default().fourDevicesAllAccessPack12months_pro.isSubscribed {
  888. isSubscribed = true
  889. }
  890. } else if productId == "com.pdfreaderpro.mac.standard_add_devices_all_access_pack_advanced_annual.001" {
  891. productCode = "advanced-annual-subscription-standard-upgrade"
  892. if IAPProductsManager.default().standardAddDevicesAllAccessPack12months_pro.isSubscribed {
  893. isSubscribed = true
  894. }
  895. } else if productId == "com.pdfreaderpro.mac.advanced_add_devices_all_access_pack_advanced_annual.001" {
  896. productCode = "advanced-annual-subscription-single-upgrade"
  897. if IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_pro.isSubscribed {
  898. isSubscribed = true
  899. }
  900. } else if productId == "com.pdfreaderpro.mac.advanced_add_2_devices_all_access_pack_advanced_annual.001" {
  901. productCode = "advanced-annual-subscription-multi-upgrade"
  902. if IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro.isSubscribed {
  903. isSubscribed = true
  904. }
  905. }
  906. if isSubscribed {
  907. KMMemberCenterManager.manager.appStoreEquityVerification(applePayProductId: productId, transactionId: transactionId, productCode: productCode) { success, result in
  908. if success {
  909. complete(true, result)
  910. } else {
  911. complete(false, result)
  912. }
  913. }
  914. }
  915. } else {
  916. print(NSLocalizedString("Order does not exist.", tableName: "MemberCenterLocalizable", comment: ""))
  917. }
  918. #endif
  919. }
  920. var isCancelAutoRenew: Bool {
  921. return IAPProductsManager.default().isCancelAutoRenew()
  922. }
  923. var isShowSale: Bool {
  924. if #available(macOS 10.14.4, *), isCancelAutoRenew {
  925. #if VERSION_FREE
  926. #if VERSION_DMG
  927. // DMG
  928. if let info = KMAdvertisementManager.manager.info.StoreUserRecovery?.content?.first, !(info.show! as NSString).boolValue {
  929. return false
  930. }
  931. #else
  932. // AppStore 免费版本
  933. let manager = IAPProductsManager.default()
  934. let isSubscribed_newlyMonth = manager?.fourDevicesAllAccessPackNew6Months_lite.isSubscribed ?? false
  935. let isSubscribed_year = manager?.fourDevicesAllAccessPackNew12months_lite.isSubscribed ?? false
  936. if isSubscribed_newlyMonth || isSubscribed_year {
  937. return false
  938. }
  939. if let info = KMAdvertisementManager.manager.info.StoreUserRecovery?.content?.first, !(info.show! as NSString).boolValue {
  940. return false
  941. }
  942. if let discounts = manager?.fourDevicesAllAccessPackNew12months_lite.product?.discounts, discounts.count <= 0 {
  943. return false
  944. }
  945. #endif
  946. #else
  947. // AppStore 付费版
  948. if let info = KMAdvertisementManager.manager.info.StoreUserRecovery?.content?.first, !(info.show! as NSString).boolValue {
  949. return false
  950. }
  951. #endif
  952. return true
  953. }
  954. return false
  955. }
  956. #if !VERSION_DMG
  957. func checkSubscriptionOffer(for product: SKProduct) -> KMPaymentModeType {
  958. if let introductoryPrice = product.introductoryPrice {
  959. switch introductoryPrice.paymentMode {
  960. case .freeTrial:
  961. return .freeTrial
  962. case .payAsYouGo:
  963. return .payAsYouGo
  964. case .payUpFront:
  965. return .payUpFront
  966. @unknown default:
  967. print("Unknown introductory offer type.")
  968. }
  969. }
  970. if #available(iOS 12.2, *), !product.discounts.isEmpty {
  971. return .discount
  972. }
  973. return .null
  974. }
  975. #endif
  976. // MARK: Private Method
  977. /**
  978. 会员购买
  979. */
  980. private func membershipPurchase(_ type: KMPurchasedProductType) -> Void {
  981. #if !VERSION_DMG
  982. if type == .fourDevicesAllAccessPackNew6months_lite || type == .fourDevicesAllAccessPackNew12months_lite {
  983. if isPurchaseSwitch {
  984. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite, discount: isCancelAutoRenew)
  985. } else {
  986. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite, discount: isCancelAutoRenew)
  987. }
  988. } else if type == .aiAllAccessPack1month_lite {
  989. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().aiAllAccessPack1month_lite, discount: isCancelAutoRenew)
  990. } else if type == .aiAllAccessPack12month_lite {
  991. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().aiAllAccessPack12month_lite, discount: isCancelAutoRenew)
  992. } else if type == .allAccessPackPermanent_lite {
  993. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().allAccessPackPermanent_lite, discount: isCancelAutoRenew)
  994. } else if type == .advancedAddDevicesAllAccessPack12months_lite {
  995. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_lite, discount: isCancelAutoRenew)
  996. } else if type == .advancedAdd2DevicesAllAccessPack12months_lite {
  997. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite, discount: isCancelAutoRenew)
  998. } else if type == .aiAllAccessPack1month_pro {
  999. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().aiAllAccessPack1month_pro, discount: isCancelAutoRenew)
  1000. } else if type == .aiAllAccessPack12month_pro {
  1001. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().aiAllAccessPack12month_pro, discount: isCancelAutoRenew)
  1002. } else if type == .pdfToOfficePackPermanent_pro {
  1003. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().pdfToOfficePackPermanent_pro, discount: isCancelAutoRenew)
  1004. } else if type == .fourDevicesAllAccessPack12months_pro {
  1005. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().fourDevicesAllAccessPack12months_pro, discount: isCancelAutoRenew)
  1006. } else if type == .standardAddDevicesAllAccessPack12months_pro {
  1007. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().standardAddDevicesAllAccessPack12months_pro, discount: isCancelAutoRenew)
  1008. } else if type == .advancedAddDevicesAllAccessPack12months_pro {
  1009. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_pro, discount: isCancelAutoRenew)
  1010. } else if type == .advancedAdd2DevicesAllAccessPack12months_pro {
  1011. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro, discount: isCancelAutoRenew)
  1012. }
  1013. #endif
  1014. }
  1015. // MARK: Action Method
  1016. /**
  1017. 恢复购买
  1018. */
  1019. func productRestore() -> Void {
  1020. IAPProductsManager.default().restoreSubscriptions()
  1021. }
  1022. func privacyPolicyAction() -> Void {
  1023. NSWorkspace.shared.open(URL(string: "https://www.pdfreaderpro.com/privacy-policy")!)
  1024. }
  1025. func termOfSerAction() -> Void {
  1026. NSWorkspace.shared.open(URL(string: "https://www.pdfreaderpro.com/terms_of_service")!)
  1027. }
  1028. // MARK: Get & Set
  1029. /**
  1030. 当前比较表产品列表内容
  1031. */
  1032. var products: [KMCompareProductType] {
  1033. if state == .trial {
  1034. return [.free, .freeTrial]
  1035. } else if state == .dmg_Base {
  1036. return [.free, .allPlatformStandard, .allPlatformAdvanced_12, .dualPlatformAdvanced]
  1037. } else if state == .dmg_Upgrades1 {
  1038. return [.allPlatformAdvanced_12]
  1039. } else if state == .dmg_Upgrades1 {
  1040. return [.allPlatformAdvanced_12]
  1041. } else if state == .lite_Base {
  1042. return [.free, .allPlatformAdvanced_6, .allPlatformAdvanced_12, .dualPlatformAdvanced]
  1043. } else if state == .lite_MacWindows {
  1044. return [.allPlatformAdvanced_12]
  1045. } else if state == .pro_Base {
  1046. return [.allPlatformAdvanced_12, .macPlatformAdvanced]
  1047. } else if state == .pro_Advanced {
  1048. return [.allPlatformAdvanced_12]
  1049. }
  1050. return []
  1051. }
  1052. /**
  1053. 比较表数据源
  1054. */
  1055. var dataSource: [Any] {
  1056. if isPurchaseSwitch {
  1057. // 试用 全平台标准版年订阅 全平台高级版6/12个月订阅 Mac&Windows双平台高级版永久 MAC单平台高级版永久
  1058. //MAC单平台标准版永久
  1059. if KMMemberInfo.shared.vip_levels == "1" && KMMemberInfo.shared.vip_status != 2 {
  1060. var aiYear = NSLocalizedString("Free for the 1st year, then auto-renew at $125.99/year", tableName: "MemberCenterLocalizable", comment: "")
  1061. #if VERSION_FREE
  1062. #if VERSION_DMG
  1063. // DMG
  1064. if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
  1065. aiYear = String(format: NSLocalizedString("Free for the 1st year, then auto-renew at USD $%@/year", tableName: "MemberCenterLocalizable", comment: ""), getDMGPrice(productCode: KMAISubscriptionYearTrailCodeKey_DMG))
  1066. } else {
  1067. aiYear = String(format: NSLocalizedString("Free for the 1st year, then auto-renew at CNY ¥%@/year", tableName: "MemberCenterLocalizable", comment: ""), getDMGCNYPrice(productCode: KMAISubscriptionYearTrailCodeKey_DMG))
  1068. }
  1069. #else
  1070. // AppStore 免费版本
  1071. aiYear = String(format: NSLocalizedString("Free for the 1st year, then auto-renew at %@/year", tableName: "MemberCenterLocalizable", comment: ""), IAPProductsManager.default().aiAllAccessPack12month_lite.price())
  1072. #endif
  1073. #else
  1074. // AppStore 付费版
  1075. aiYear = String(format: NSLocalizedString("Free for the 1st year, then auto-renew at %@/year", tableName: "MemberCenterLocalizable", comment: ""), IAPProductsManager.default().aiAllAccessPack12month_pro.price())
  1076. #endif
  1077. return [
  1078. "Membership Benefits",
  1079. ["Supported platforms", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows", "mac"],
  1080. ["Maximum number of accessible devices", "4 devices", "4 devices", "4 devices", "1 device", "1 device"],
  1081. ["1-year AI free use", "X", "X", aiYear, "X", "X"],
  1082. "PDF to Office",
  1083. ["Convert PDFs to Word, HTML, TXT, JPEG or PNG files", "X", "Standard", "Advanced", "Advanced", "Advanced"],
  1084. ["Turn PDF to PPT, Excel, RTF, CSV, and more", "X", "X", "✓", "✓", "✓"],
  1085. ["Convert PDF to TIFF, BMP, GIF or TGA files", "X", "X", "✓", "✓", "✓"],
  1086. "Edit PDF",
  1087. ["Add and edit text in PDF", "X", "✓", "✓", "✓", "✓"],
  1088. ["Edit, crop, replace image in PDF", "X", "✓", "✓", "✓", "✓"],
  1089. "OCR",
  1090. ["Extract texts from image-based or scanned PDF", "X", "✓", "✓", "✓", "✓"],
  1091. "Organize Pages",
  1092. ["Extract, rotate, rearrange, replace, add, delete pages", "X", "✓", "✓", "✓", "✓"],
  1093. ["Split PDFs into multiple files", "X", "✓", "✓", "✓", "✓"],
  1094. "Advanced Editing Tools",
  1095. ["Merge multiple documents into a new PDF", "Up to 2 files or 20 MB", "✓", "✓", "✓", "✓", "✓"],
  1096. ["Add & edit watermark", "X", "✓", "✓", "✓", "✓"],
  1097. ["Add header, footer, page numbers", "X", "✓", "✓", "✓", "✓"],
  1098. ["Add Bates Number", "X", "✓", "✓", "✓", "✓"],
  1099. ["Insert PDF page background by color or image", "X", "✓", "✓", "✓", "✓"],
  1100. ["Create fattened copies", "X", "✓", "✓", "✓", "✓"],
  1101. ["Extract Images", "X", "✓", "✓", "✓", "✓"],
  1102. ["Extract tables", "X", "X", "✓", "✓", "✓"],
  1103. ["Measuring Tools", "X", "✓", "✓", "✓", "✓"],
  1104. "Fill & Sign",
  1105. ["Create digital signature", "X", "✓", "✓", "✓", "✓"],
  1106. ["Create & Edit & Fill Adobe Fillable PDF Forms", "X", "✓", "✓", "✓", "✓"],
  1107. "Security",
  1108. ["Batch encrypting PDF documents", "X", "✓", "✓", "✓", "✓"],
  1109. ["PDF Password Remover", "X", "✓", "✓", "✓", "✓"],
  1110. ["Redact sensitive information", "X", "✓", "✓", "✓", "✓"],
  1111. "Create PDF",
  1112. ["Convert JPEG, JPG, PNG, TIFF, BMP or PSD files to PDFs", "1 file", "✓", "✓", "✓", "✓"],
  1113. ["Create PDFs from a scanner and iOS devices", "X", "✓", "✓", "✓", "✓"],
  1114. "Annotations",
  1115. ["Customize PDF stamps", "X", "✓", "✓", "✓", "✓"],
  1116. ["Hyperlink", "Page Number", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email"],
  1117. ["Signature", "Standard", "Advanced", "Advanced", "Advanced", "Advanced"],
  1118. ["Table", "X", "✓", "✓", "✓", "✓"],
  1119. "View PDF",
  1120. ["Multi-tab viewer", "X", "✓", "✓", "✓", "✓"],
  1121. ["Various printing types: poster, booklet, multi-page printing", "X", "✓", "✓", "✓", "✓"],
  1122. ["Customize theme colors: Light Mode, Dark Mode, Sepia Mode and more", "X", "✓", "✓", "✓", "✓"],
  1123. ["Split View to compare files", "X", "✓", "✓", "✓", "✓"],
  1124. "Subscription Based Solution",
  1125. ["Access all premium features in app", "X", "12 months", "12 months", "∞", "∞"],
  1126. ["Priority customer support", "X", "✓", "✓", "✓", "✓"],
  1127. ["Ad-free", "X", "✓", "✓", "✓", "✓"]
  1128. ]
  1129. } else {
  1130. return [
  1131. "Membership Benefits",
  1132. ["Supported platforms", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows", "mac"],
  1133. ["Maximum number of accessible devices", "4 devices", "4 devices", "4 devices", "1 device", "1 device"],
  1134. ["1-year AI free use", "X", "X", "X", "X", "X"],
  1135. "PDF to Office",
  1136. ["Convert PDFs to Word, HTML, TXT, JPEG or PNG files", "X", "Standard", "Advanced", "Advanced", "Advanced"],
  1137. ["Turn PDF to PPT, Excel, RTF, CSV, and more", "X", "X", "✓", "✓", "✓"],
  1138. ["Convert PDF to TIFF, BMP, GIF or TGA files", "X", "X", "✓", "✓", "✓"],
  1139. "Edit PDF",
  1140. ["Add and edit text in PDF", "X", "✓", "✓", "✓", "✓"],
  1141. ["Edit, crop, replace image in PDF", "X", "✓", "✓", "✓", "✓"],
  1142. "OCR",
  1143. ["Extract texts from image-based or scanned PDF", "X", "✓", "✓", "✓", "✓"],
  1144. "Organize Pages",
  1145. ["Extract, rotate, rearrange, replace, add, delete pages", "X", "✓", "✓", "✓", "✓"],
  1146. ["Split PDFs into multiple files", "X", "✓", "✓", "✓", "✓"],
  1147. "Advanced Editing Tools",
  1148. ["Merge multiple documents into a new PDF", "Up to 2 files or 20 MB", "✓", "✓", "✓", "✓", "✓"],
  1149. ["Add & edit watermark", "X", "✓", "✓", "✓", "✓"],
  1150. ["Add header, footer, page numbers", "X", "✓", "✓", "✓", "✓"],
  1151. ["Add Bates Number", "X", "✓", "✓", "✓", "✓"],
  1152. ["Insert PDF page background by color or image", "X", "✓", "✓", "✓", "✓"],
  1153. ["Create fattened copies", "X", "✓", "✓", "✓", "✓"],
  1154. ["Extract Images", "X", "✓", "✓", "✓", "✓"],
  1155. ["Extract tables", "X", "X", "✓", "✓", "✓"],
  1156. ["Measuring Tools", "X", "✓", "✓", "✓", "✓"],
  1157. "Fill & Sign",
  1158. ["Create digital signature", "X", "✓", "✓", "✓", "✓"],
  1159. ["Create & Edit & Fill Adobe Fillable PDF Forms", "X", "✓", "✓", "✓", "✓"],
  1160. "Security",
  1161. ["Batch encrypting PDF documents", "X", "✓", "✓", "✓", "✓"],
  1162. ["PDF Password Remover", "X", "✓", "✓", "✓", "✓"],
  1163. ["Redact sensitive information", "X", "✓", "✓", "✓", "✓"],
  1164. "Create PDF",
  1165. ["Convert JPEG, JPG, PNG, TIFF, BMP or PSD files to PDFs", "1 file", "✓", "✓", "✓", "✓"],
  1166. ["Create PDFs from a scanner and iOS devices", "X", "✓", "✓", "✓", "✓"],
  1167. "Annotations",
  1168. ["Customize PDF stamps", "X", "✓", "✓", "✓", "✓"],
  1169. ["Hyperlink", "Page Number", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email"],
  1170. ["Signature", "Standard", "Advanced", "Advanced", "Advanced", "Advanced"],
  1171. ["Table", "X", "✓", "✓", "✓", "✓"],
  1172. "View PDF",
  1173. ["Multi-tab viewer", "X", "✓", "✓", "✓", "✓"],
  1174. ["Various printing types: poster, booklet, multi-page printing", "X", "✓", "✓", "✓", "✓"],
  1175. ["Customize theme colors: Light Mode, Dark Mode, Sepia Mode and more", "X", "✓", "✓", "✓", "✓"],
  1176. ["Split View to compare files", "X", "✓", "✓", "✓", "✓"],
  1177. "Subscription Based Solution",
  1178. ["Access all premium features in app", "X", "12 months", "12 months", "∞", "∞"],
  1179. ["Priority customer support", "X", "✓", "✓", "✓", "✓"],
  1180. ["Ad-free", "X", "✓", "✓", "✓", "✓"]
  1181. ]
  1182. }
  1183. } else {
  1184. if KMMemberInfo.shared.vip_levels == "1" && KMMemberInfo.shared.vip_status != 2 {
  1185. return [
  1186. "Membership Benefits",
  1187. ["Supported platforms", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows", "mac"],
  1188. ["Maximum number of accessible devices", "4 devices", "4 devices", "4 devices", "1 device", "1 device"],
  1189. ["1-year AI free use", "X", "X", "X", "X", "X"],
  1190. "PDF to Office",
  1191. ["Convert PDFs to Word, HTML, TXT, JPEG or PNG files", "X", "Standard", "Advanced", "Advanced", "Advanced"],
  1192. ["Turn PDF to PPT, Excel, RTF, CSV, and more", "X", "X", "✓", "✓", "✓"],
  1193. ["Convert PDF to TIFF, BMP, GIF or TGA files", "X", "X", "✓", "✓", "✓"],
  1194. "Edit PDF",
  1195. ["Add and edit text in PDF", "X", "✓", "✓", "✓", "✓"],
  1196. ["Edit, crop, replace image in PDF", "X", "✓", "✓", "✓", "✓"],
  1197. "OCR",
  1198. ["Extract texts from image-based or scanned PDF", "X", "✓", "✓", "✓", "✓"],
  1199. "Organize Pages",
  1200. ["Extract, rotate, rearrange, replace, add, delete pages", "X", "✓", "✓", "✓", "✓"],
  1201. ["Split PDFs into multiple files", "X", "✓", "✓", "✓", "✓"],
  1202. "Advanced Editing Tools",
  1203. ["Merge multiple documents into a new PDF", "Up to 2 files or 20 MB", "✓", "✓", "✓", "✓", "✓"],
  1204. ["Add & edit watermark", "X", "✓", "✓", "✓", "✓"],
  1205. ["Add header, footer, page numbers", "X", "✓", "✓", "✓", "✓"],
  1206. ["Add Bates Number", "X", "✓", "✓", "✓", "✓"],
  1207. ["Insert PDF page background by color or image", "X", "✓", "✓", "✓", "✓"],
  1208. ["Create fattened copies", "X", "✓", "✓", "✓", "✓"],
  1209. ["Extract Images", "X", "✓", "✓", "✓", "✓"],
  1210. ["Extract tables", "X", "X", "✓", "✓", "✓"],
  1211. ["Measuring Tools", "X", "✓", "✓", "✓", "✓"],
  1212. "Fill & Sign",
  1213. ["Create digital signature", "X", "✓", "✓", "✓", "✓"],
  1214. ["Create & Edit & Fill Adobe Fillable PDF Forms", "X", "✓", "✓", "✓", "✓"],
  1215. "Security",
  1216. ["Batch encrypting PDF documents", "X", "✓", "✓", "✓", "✓"],
  1217. ["PDF Password Remover", "X", "✓", "✓", "✓", "✓"],
  1218. ["Redact sensitive information", "X", "✓", "✓", "✓", "✓"],
  1219. "Create PDF",
  1220. ["Convert JPEG, JPG, PNG, TIFF, BMP or PSD files to PDFs", "1 file", "✓", "✓", "✓", "✓"],
  1221. ["Create PDFs from a scanner and iOS devices", "X", "✓", "✓", "✓", "✓"],
  1222. "Annotations",
  1223. ["Customize PDF stamps", "X", "✓", "✓", "✓", "✓"],
  1224. ["Hyperlink", "Page Number", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email"],
  1225. ["Signature", "Standard", "Advanced", "Advanced", "Advanced", "Advanced"],
  1226. ["Table", "X", "✓", "✓", "✓", "✓"],
  1227. "View PDF",
  1228. ["Multi-tab viewer", "X", "✓", "✓", "✓", "✓"],
  1229. ["Various printing types: poster, booklet, multi-page printing", "X", "✓", "✓", "✓", "✓"],
  1230. ["Customize theme colors: Light Mode, Dark Mode, Sepia Mode and more", "X", "✓", "✓", "✓", "✓"],
  1231. ["Split View to compare files", "X", "✓", "✓", "✓", "✓"],
  1232. "Subscription Based Solution",
  1233. ["Access all premium features in app", "X", "6 months", "6 months", "∞", "∞"],
  1234. ["Priority customer support", "X", "✓", "✓", "✓", "✓"],
  1235. ["Ad-free", "X", "✓", "✓", "✓", "✓"]
  1236. ]
  1237. } else {
  1238. return [
  1239. "Membership Benefits",
  1240. ["Supported platforms", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows", "mac"],
  1241. ["Maximum number of accessible devices", "4 devices", "4 devices", "4 devices", "1 device", "1 device"],
  1242. ["1-year AI free use", "X", "X", "X", "X", "X"],
  1243. "PDF to Office",
  1244. ["Convert PDFs to Word, HTML, TXT, JPEG or PNG files", "X", "Standard", "Advanced", "Advanced", "Advanced"],
  1245. ["Turn PDF to PPT, Excel, RTF, CSV, and more", "X", "X", "✓", "✓", "✓"],
  1246. ["Convert PDF to TIFF, BMP, GIF or TGA files", "X", "X", "✓", "✓", "✓"],
  1247. "Edit PDF",
  1248. ["Add and edit text in PDF", "X", "✓", "✓", "✓", "✓"],
  1249. ["Edit, crop, replace image in PDF", "X", "✓", "✓", "✓", "✓"],
  1250. "OCR",
  1251. ["Extract texts from image-based or scanned PDF", "X", "✓", "✓", "✓", "✓"],
  1252. "Organize Pages",
  1253. ["Extract, rotate, rearrange, replace, add, delete pages", "X", "✓", "✓", "✓", "✓"],
  1254. ["Split PDFs into multiple files", "X", "✓", "✓", "✓", "✓"],
  1255. "Advanced Editing Tools",
  1256. ["Merge multiple documents into a new PDF", "Up to 2 files or 20 MB", "✓", "✓", "✓", "✓", "✓"],
  1257. ["Add & edit watermark", "X", "✓", "✓", "✓", "✓"],
  1258. ["Add header, footer, page numbers", "X", "✓", "✓", "✓", "✓"],
  1259. ["Add Bates Number", "X", "✓", "✓", "✓", "✓"],
  1260. ["Insert PDF page background by color or image", "X", "✓", "✓", "✓", "✓"],
  1261. ["Create fattened copies", "X", "✓", "✓", "✓", "✓"],
  1262. ["Extract Images", "X", "✓", "✓", "✓", "✓"],
  1263. ["Extract tables", "X", "X", "✓", "✓", "✓"],
  1264. ["Measuring Tools", "X", "✓", "✓", "✓", "✓"],
  1265. "Fill & Sign",
  1266. ["Create digital signature", "X", "✓", "✓", "✓", "✓"],
  1267. ["Create & Edit & Fill Adobe Fillable PDF Forms", "X", "✓", "✓", "✓", "✓"],
  1268. "Security",
  1269. ["Batch encrypting PDF documents", "X", "✓", "✓", "✓", "✓"],
  1270. ["PDF Password Remover", "X", "✓", "✓", "✓", "✓"],
  1271. ["Redact sensitive information", "X", "✓", "✓", "✓", "✓"],
  1272. "Create PDF",
  1273. ["Convert JPEG, JPG, PNG, TIFF, BMP or PSD files to PDFs", "1 file", "✓", "✓", "✓", "✓"],
  1274. ["Create PDFs from a scanner and iOS devices", "X", "✓", "✓", "✓", "✓"],
  1275. "Annotations",
  1276. ["Customize PDF stamps", "X", "✓", "✓", "✓", "✓"],
  1277. ["Hyperlink", "Page Number", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email"],
  1278. ["Signature", "Standard", "Advanced", "Advanced", "Advanced", "Advanced"],
  1279. ["Table", "X", "✓", "✓", "✓", "✓"],
  1280. "View PDF",
  1281. ["Multi-tab viewer", "X", "✓", "✓", "✓", "✓"],
  1282. ["Various printing types: poster, booklet, multi-page printing", "X", "✓", "✓", "✓", "✓"],
  1283. ["Customize theme colors: Light Mode, Dark Mode, Sepia Mode and more", "X", "✓", "✓", "✓", "✓"],
  1284. ["Split View to compare files", "X", "✓", "✓", "✓", "✓"],
  1285. "Subscription Based Solution",
  1286. ["Access all premium features in app", "X", "6 months", "6 months", "∞", "∞"],
  1287. ["Priority customer support", "X", "✓", "✓", "✓", "✓"],
  1288. ["Ad-free", "X", "✓", "✓", "✓", "✓"]
  1289. ]
  1290. }
  1291. }
  1292. }
  1293. /**
  1294. 是否黑五活动期
  1295. */
  1296. var isBlackFive: Bool {
  1297. if let loginContent = KMAdvertisementManager.manager.info.topRightInfoContent {
  1298. if loginContent.content?.isEmpty == false {
  1299. return true
  1300. }
  1301. }
  1302. return false
  1303. }
  1304. }