KMProductModel.swift 89 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363
  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. return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAISubscriptionYearTrailCodeKey_DMG))
  1068. aiYear = String(format: NSLocalizedString("Free for the 1st year, then auto-renew at CNY ¥%@/year", tableName: "MemberCenterLocalizable", comment: ""), getDMGCNYPrice(productCode: KMAISubscriptionYearTrailCodeKey_DMG))
  1069. }
  1070. #else
  1071. // AppStore 免费版本
  1072. aiYear = String(format: NSLocalizedString("Free for the 1st year, then auto-renew at %@/year", tableName: "MemberCenterLocalizable", comment: ""), IAPProductsManager.default().aiAllAccessPack12month_lite.price())
  1073. #endif
  1074. #else
  1075. // AppStore 付费版
  1076. aiYear = String(format: NSLocalizedString("Free for the 1st year, then auto-renew at %@/year", tableName: "MemberCenterLocalizable", comment: ""), IAPProductsManager.default().aiAllAccessPack12month_pro.price())
  1077. #endif
  1078. return [
  1079. "Membership Benefits",
  1080. ["Supported platforms", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows", "mac"],
  1081. ["Maximum number of accessible devices", "4 devices", "4 devices", "4 devices", "1 device", "1 device"],
  1082. ["1-year AI free use", "X", "X", "Free for the 1st year, then auto-renew at $125.99/year", "X", "X"],
  1083. "PDF to Office",
  1084. ["Convert PDFs to Word, HTML, TXT, JPEG or PNG files", "X", "Standard", "Advanced", "Advanced", "Advanced"],
  1085. ["Turn PDF to PPT, Excel, RTF, CSV, and more", "X", "X", "✓", "✓", "✓"],
  1086. ["Convert PDF to TIFF, BMP, GIF or TGA files", "X", "X", "✓", "✓", "✓"],
  1087. "Edit PDF",
  1088. ["Add and edit text in PDF", "X", "✓", "✓", "✓", "✓"],
  1089. ["Edit, crop, replace image in PDF", "X", "✓", "✓", "✓", "✓"],
  1090. "OCR",
  1091. ["Extract texts from image-based or scanned PDF", "X", "✓", "✓", "✓", "✓"],
  1092. "Organize Pages",
  1093. ["Extract, rotate, rearrange, replace, add, delete pages", "X", "✓", "✓", "✓", "✓"],
  1094. ["Split PDFs into multiple files", "X", "✓", "✓", "✓", "✓"],
  1095. "Advanced Editing Tools",
  1096. ["Merge multiple documents into a new PDF", "Up to 2 files or 20 MB", "✓", "✓", "✓", "✓", "✓"],
  1097. ["Add & edit watermark", "X", "✓", "✓", "✓", "✓"],
  1098. ["Add header, footer, page numbers", "X", "✓", "✓", "✓", "✓"],
  1099. ["Add Bates Number", "X", "✓", "✓", "✓", "✓"],
  1100. ["Insert PDF page background by color or image", "X", "✓", "✓", "✓", "✓"],
  1101. ["Create fattened copies", "X", "✓", "✓", "✓", "✓"],
  1102. ["Extract Images", "X", "✓", "✓", "✓", "✓"],
  1103. ["Extract tables", "X", "X", "✓", "✓", "✓"],
  1104. ["Measuring Tools", "X", "✓", "✓", "✓", "✓"],
  1105. "Fill & Sign",
  1106. ["Create digital signature", "X", "✓", "✓", "✓", "✓"],
  1107. ["Create & Edit & Fill Adobe Fillable PDF Forms", "X", "✓", "✓", "✓", "✓"],
  1108. "Security",
  1109. ["Batch encrypting PDF documents", "X", "✓", "✓", "✓", "✓"],
  1110. ["PDF Password Remover", "X", "✓", "✓", "✓", "✓"],
  1111. ["Redact sensitive information", "X", "✓", "✓", "✓", "✓"],
  1112. "Create PDF",
  1113. ["Convert JPEG, JPG, PNG, TIFF, BMP or PSD files to PDFs", "1 file", "✓", "✓", "✓", "✓"],
  1114. ["Create PDFs from a scanner and iOS devices", "X", "✓", "✓", "✓", "✓"],
  1115. "Annotations",
  1116. ["Customize PDF stamps", "X", "✓", "✓", "✓", "✓"],
  1117. ["Hyperlink", "Page Number", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email"],
  1118. ["Signature", "Standard", "Advanced", "Advanced", "Advanced", "Advanced"],
  1119. ["Table", "X", "✓", "✓", "✓", "✓"],
  1120. "View PDF",
  1121. ["Multi-tab viewer", "X", "✓", "✓", "✓", "✓"],
  1122. ["Various printing types: poster, booklet, multi-page printing", "X", "✓", "✓", "✓", "✓"],
  1123. ["Customize theme colors: Light Mode, Dark Mode, Sepia Mode and more", "X", "✓", "✓", "✓", "✓"],
  1124. ["Split View to compare files", "X", "✓", "✓", "✓", "✓"],
  1125. "Subscription Based Solution",
  1126. ["Access all premium features in app", "X", "12 months", "12 months", "∞", "∞"],
  1127. ["Priority customer support", "X", "✓", "✓", "✓", "✓"],
  1128. ["Ad-free", "X", "✓", "✓", "✓", "✓"]
  1129. ]
  1130. } else {
  1131. return [
  1132. "Membership Benefits",
  1133. ["Supported platforms", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows", "mac"],
  1134. ["Maximum number of accessible devices", "4 devices", "4 devices", "4 devices", "1 device", "1 device"],
  1135. ["1-year AI free use", "X", "X", "X", "X", "X"],
  1136. "PDF to Office",
  1137. ["Convert PDFs to Word, HTML, TXT, JPEG or PNG files", "X", "Standard", "Advanced", "Advanced", "Advanced"],
  1138. ["Turn PDF to PPT, Excel, RTF, CSV, and more", "X", "X", "✓", "✓", "✓"],
  1139. ["Convert PDF to TIFF, BMP, GIF or TGA files", "X", "X", "✓", "✓", "✓"],
  1140. "Edit PDF",
  1141. ["Add and edit text in PDF", "X", "✓", "✓", "✓", "✓"],
  1142. ["Edit, crop, replace image in PDF", "X", "✓", "✓", "✓", "✓"],
  1143. "OCR",
  1144. ["Extract texts from image-based or scanned PDF", "X", "✓", "✓", "✓", "✓"],
  1145. "Organize Pages",
  1146. ["Extract, rotate, rearrange, replace, add, delete pages", "X", "✓", "✓", "✓", "✓"],
  1147. ["Split PDFs into multiple files", "X", "✓", "✓", "✓", "✓"],
  1148. "Advanced Editing Tools",
  1149. ["Merge multiple documents into a new PDF", "Up to 2 files or 20 MB", "✓", "✓", "✓", "✓", "✓"],
  1150. ["Add & edit watermark", "X", "✓", "✓", "✓", "✓"],
  1151. ["Add header, footer, page numbers", "X", "✓", "✓", "✓", "✓"],
  1152. ["Add Bates Number", "X", "✓", "✓", "✓", "✓"],
  1153. ["Insert PDF page background by color or image", "X", "✓", "✓", "✓", "✓"],
  1154. ["Create fattened copies", "X", "✓", "✓", "✓", "✓"],
  1155. ["Extract Images", "X", "✓", "✓", "✓", "✓"],
  1156. ["Extract tables", "X", "X", "✓", "✓", "✓"],
  1157. ["Measuring Tools", "X", "✓", "✓", "✓", "✓"],
  1158. "Fill & Sign",
  1159. ["Create digital signature", "X", "✓", "✓", "✓", "✓"],
  1160. ["Create & Edit & Fill Adobe Fillable PDF Forms", "X", "✓", "✓", "✓", "✓"],
  1161. "Security",
  1162. ["Batch encrypting PDF documents", "X", "✓", "✓", "✓", "✓"],
  1163. ["PDF Password Remover", "X", "✓", "✓", "✓", "✓"],
  1164. ["Redact sensitive information", "X", "✓", "✓", "✓", "✓"],
  1165. "Create PDF",
  1166. ["Convert JPEG, JPG, PNG, TIFF, BMP or PSD files to PDFs", "1 file", "✓", "✓", "✓", "✓"],
  1167. ["Create PDFs from a scanner and iOS devices", "X", "✓", "✓", "✓", "✓"],
  1168. "Annotations",
  1169. ["Customize PDF stamps", "X", "✓", "✓", "✓", "✓"],
  1170. ["Hyperlink", "Page Number", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email"],
  1171. ["Signature", "Standard", "Advanced", "Advanced", "Advanced", "Advanced"],
  1172. ["Table", "X", "✓", "✓", "✓", "✓"],
  1173. "View PDF",
  1174. ["Multi-tab viewer", "X", "✓", "✓", "✓", "✓"],
  1175. ["Various printing types: poster, booklet, multi-page printing", "X", "✓", "✓", "✓", "✓"],
  1176. ["Customize theme colors: Light Mode, Dark Mode, Sepia Mode and more", "X", "✓", "✓", "✓", "✓"],
  1177. ["Split View to compare files", "X", "✓", "✓", "✓", "✓"],
  1178. "Subscription Based Solution",
  1179. ["Access all premium features in app", "X", "12 months", "12 months", "∞", "∞"],
  1180. ["Priority customer support", "X", "✓", "✓", "✓", "✓"],
  1181. ["Ad-free", "X", "✓", "✓", "✓", "✓"]
  1182. ]
  1183. }
  1184. } else {
  1185. if KMMemberInfo.shared.vip_levels == "1" && KMMemberInfo.shared.vip_status != 2 {
  1186. return [
  1187. "Membership Benefits",
  1188. ["Supported platforms", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows", "mac"],
  1189. ["Maximum number of accessible devices", "4 devices", "4 devices", "4 devices", "1 device", "1 device"],
  1190. ["1-year AI free use", "X", "X", "X", "X", "X"],
  1191. "PDF to Office",
  1192. ["Convert PDFs to Word, HTML, TXT, JPEG or PNG files", "X", "Standard", "Advanced", "Advanced", "Advanced"],
  1193. ["Turn PDF to PPT, Excel, RTF, CSV, and more", "X", "X", "✓", "✓", "✓"],
  1194. ["Convert PDF to TIFF, BMP, GIF or TGA files", "X", "X", "✓", "✓", "✓"],
  1195. "Edit PDF",
  1196. ["Add and edit text in PDF", "X", "✓", "✓", "✓", "✓"],
  1197. ["Edit, crop, replace image in PDF", "X", "✓", "✓", "✓", "✓"],
  1198. "OCR",
  1199. ["Extract texts from image-based or scanned PDF", "X", "✓", "✓", "✓", "✓"],
  1200. "Organize Pages",
  1201. ["Extract, rotate, rearrange, replace, add, delete pages", "X", "✓", "✓", "✓", "✓"],
  1202. ["Split PDFs into multiple files", "X", "✓", "✓", "✓", "✓"],
  1203. "Advanced Editing Tools",
  1204. ["Merge multiple documents into a new PDF", "Up to 2 files or 20 MB", "✓", "✓", "✓", "✓", "✓"],
  1205. ["Add & edit watermark", "X", "✓", "✓", "✓", "✓"],
  1206. ["Add header, footer, page numbers", "X", "✓", "✓", "✓", "✓"],
  1207. ["Add Bates Number", "X", "✓", "✓", "✓", "✓"],
  1208. ["Insert PDF page background by color or image", "X", "✓", "✓", "✓", "✓"],
  1209. ["Create fattened copies", "X", "✓", "✓", "✓", "✓"],
  1210. ["Extract Images", "X", "✓", "✓", "✓", "✓"],
  1211. ["Extract tables", "X", "X", "✓", "✓", "✓"],
  1212. ["Measuring Tools", "X", "✓", "✓", "✓", "✓"],
  1213. "Fill & Sign",
  1214. ["Create digital signature", "X", "✓", "✓", "✓", "✓"],
  1215. ["Create & Edit & Fill Adobe Fillable PDF Forms", "X", "✓", "✓", "✓", "✓"],
  1216. "Security",
  1217. ["Batch encrypting PDF documents", "X", "✓", "✓", "✓", "✓"],
  1218. ["PDF Password Remover", "X", "✓", "✓", "✓", "✓"],
  1219. ["Redact sensitive information", "X", "✓", "✓", "✓", "✓"],
  1220. "Create PDF",
  1221. ["Convert JPEG, JPG, PNG, TIFF, BMP or PSD files to PDFs", "1 file", "✓", "✓", "✓", "✓"],
  1222. ["Create PDFs from a scanner and iOS devices", "X", "✓", "✓", "✓", "✓"],
  1223. "Annotations",
  1224. ["Customize PDF stamps", "X", "✓", "✓", "✓", "✓"],
  1225. ["Hyperlink", "Page Number", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email"],
  1226. ["Signature", "Standard", "Advanced", "Advanced", "Advanced", "Advanced"],
  1227. ["Table", "X", "✓", "✓", "✓", "✓"],
  1228. "View PDF",
  1229. ["Multi-tab viewer", "X", "✓", "✓", "✓", "✓"],
  1230. ["Various printing types: poster, booklet, multi-page printing", "X", "✓", "✓", "✓", "✓"],
  1231. ["Customize theme colors: Light Mode, Dark Mode, Sepia Mode and more", "X", "✓", "✓", "✓", "✓"],
  1232. ["Split View to compare files", "X", "✓", "✓", "✓", "✓"],
  1233. "Subscription Based Solution",
  1234. ["Access all premium features in app", "X", "6 months", "6 months", "∞", "∞"],
  1235. ["Priority customer support", "X", "✓", "✓", "✓", "✓"],
  1236. ["Ad-free", "X", "✓", "✓", "✓", "✓"]
  1237. ]
  1238. } else {
  1239. return [
  1240. "Membership Benefits",
  1241. ["Supported platforms", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows", "mac"],
  1242. ["Maximum number of accessible devices", "4 devices", "4 devices", "4 devices", "1 device", "1 device"],
  1243. ["1-year AI free use", "X", "X", "X", "X", "X"],
  1244. "PDF to Office",
  1245. ["Convert PDFs to Word, HTML, TXT, JPEG or PNG files", "X", "Standard", "Advanced", "Advanced", "Advanced"],
  1246. ["Turn PDF to PPT, Excel, RTF, CSV, and more", "X", "X", "✓", "✓", "✓"],
  1247. ["Convert PDF to TIFF, BMP, GIF or TGA files", "X", "X", "✓", "✓", "✓"],
  1248. "Edit PDF",
  1249. ["Add and edit text in PDF", "X", "✓", "✓", "✓", "✓"],
  1250. ["Edit, crop, replace image in PDF", "X", "✓", "✓", "✓", "✓"],
  1251. "OCR",
  1252. ["Extract texts from image-based or scanned PDF", "X", "✓", "✓", "✓", "✓"],
  1253. "Organize Pages",
  1254. ["Extract, rotate, rearrange, replace, add, delete pages", "X", "✓", "✓", "✓", "✓"],
  1255. ["Split PDFs into multiple files", "X", "✓", "✓", "✓", "✓"],
  1256. "Advanced Editing Tools",
  1257. ["Merge multiple documents into a new PDF", "Up to 2 files or 20 MB", "✓", "✓", "✓", "✓", "✓"],
  1258. ["Add & edit watermark", "X", "✓", "✓", "✓", "✓"],
  1259. ["Add header, footer, page numbers", "X", "✓", "✓", "✓", "✓"],
  1260. ["Add Bates Number", "X", "✓", "✓", "✓", "✓"],
  1261. ["Insert PDF page background by color or image", "X", "✓", "✓", "✓", "✓"],
  1262. ["Create fattened copies", "X", "✓", "✓", "✓", "✓"],
  1263. ["Extract Images", "X", "✓", "✓", "✓", "✓"],
  1264. ["Extract tables", "X", "X", "✓", "✓", "✓"],
  1265. ["Measuring Tools", "X", "✓", "✓", "✓", "✓"],
  1266. "Fill & Sign",
  1267. ["Create digital signature", "X", "✓", "✓", "✓", "✓"],
  1268. ["Create & Edit & Fill Adobe Fillable PDF Forms", "X", "✓", "✓", "✓", "✓"],
  1269. "Security",
  1270. ["Batch encrypting PDF documents", "X", "✓", "✓", "✓", "✓"],
  1271. ["PDF Password Remover", "X", "✓", "✓", "✓", "✓"],
  1272. ["Redact sensitive information", "X", "✓", "✓", "✓", "✓"],
  1273. "Create PDF",
  1274. ["Convert JPEG, JPG, PNG, TIFF, BMP or PSD files to PDFs", "1 file", "✓", "✓", "✓", "✓"],
  1275. ["Create PDFs from a scanner and iOS devices", "X", "✓", "✓", "✓", "✓"],
  1276. "Annotations",
  1277. ["Customize PDF stamps", "X", "✓", "✓", "✓", "✓"],
  1278. ["Hyperlink", "Page Number", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email"],
  1279. ["Signature", "Standard", "Advanced", "Advanced", "Advanced", "Advanced"],
  1280. ["Table", "X", "✓", "✓", "✓", "✓"],
  1281. "View PDF",
  1282. ["Multi-tab viewer", "X", "✓", "✓", "✓", "✓"],
  1283. ["Various printing types: poster, booklet, multi-page printing", "X", "✓", "✓", "✓", "✓"],
  1284. ["Customize theme colors: Light Mode, Dark Mode, Sepia Mode and more", "X", "✓", "✓", "✓", "✓"],
  1285. ["Split View to compare files", "X", "✓", "✓", "✓", "✓"],
  1286. "Subscription Based Solution",
  1287. ["Access all premium features in app", "X", "6 months", "6 months", "∞", "∞"],
  1288. ["Priority customer support", "X", "✓", "✓", "✓", "✓"],
  1289. ["Ad-free", "X", "✓", "✓", "✓", "✓"]
  1290. ]
  1291. }
  1292. }
  1293. }
  1294. /**
  1295. 是否黑五活动期
  1296. */
  1297. var isBlackFive: Bool {
  1298. if let loginContent = KMAdvertisementManager.manager.info.topRightInfoContent {
  1299. if loginContent.content?.isEmpty == false {
  1300. return true
  1301. }
  1302. }
  1303. return false
  1304. }
  1305. }