KMProductModel.swift 58 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015
  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. typealias AppstorePurchaseComplete = (_ success: Bool,_ msg: String) -> Void
  59. @objcMembers
  60. class KMProductModel: ObservableObject {
  61. static let shared = KMProductModel()
  62. /**
  63. 比较表类型
  64. */
  65. @Published var state: KMCompareTableType = .trial
  66. /**
  67. 高级版半年 或 年订阅,true为年订阅,false为半年订阅,默认true为年订阅
  68. */
  69. @Published var isPurchaseSwitch: Bool = true
  70. // MARK: DMG Public Property
  71. /**
  72. DMG 版本所有已经上架产品记录(暂时无教育优惠)
  73. */
  74. var dmgProductDatas: KMMemberProductResult?
  75. /**
  76. DMG 版本 已经登录用户 最后一次价格获取
  77. */
  78. var dmgLastGetProductPriceInfos: KMMemberProductResult?
  79. /**
  80. DMG 版本 已经登录用户 最后一次批量价格获取
  81. */
  82. var dmgLastGetBatchProductPriceInfos: KMMemberProductResult?
  83. /**
  84. DMG 版本 已经登录用户 最后一次验证商品优惠券价格获取
  85. */
  86. var dmgLastCheckCouponProductPriceInfos: KMMemberProductResult?
  87. /**
  88. DMG 版本 已经登录用户 最后一次创建的买断订单返回信息
  89. */
  90. var dmgLastCreatOrderProductInfos: KMMemberProductResult?
  91. /**
  92. DMG 版本 已经登录用户 最后一次创建的买断订单返回信息
  93. */
  94. var dmgLastCreatSubscriberProductInfos: KMMemberProductResult?
  95. // MARK: DMG Public Method
  96. func checkConnectionAvailable() -> Void {
  97. if KMMemberCenterManager.manager.isConnectionAvailable() == false {
  98. let alert = NSAlert()
  99. alert.alertStyle = .critical
  100. alert.messageText = NSLocalizedString("Error Information", comment: "")
  101. alert.informativeText = NSLocalizedString("Please make sure your internet connection is available.", comment: "")
  102. alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
  103. alert.runModal()
  104. return
  105. }
  106. }
  107. /**
  108. @abstract 获取DMG服务器架上所有商品 (得到的价格是原始价格)
  109. @param
  110. */
  111. func getDMGProductDatas( _ complete: @escaping KMMemberProductComplete) -> Void {
  112. checkConnectionAvailable()
  113. KMMemberCenterManager.manager.getListingProducts(isEducation: 0) { [weak self] success, result in
  114. guard let productsArrays : KMMemberProductResult = result else { return }
  115. self?.dmgProductDatas = productsArrays
  116. complete(success, result)
  117. }
  118. if KMMemberInfo.shared.isLogin {
  119. // getDMGProductPriceInfosForMember(productId: "SP2024102300004", isEducation: 0) { [weak self] success, result in
  120. //
  121. //
  122. // }
  123. // getDMGBatchProductPriceInfosForMember(productId: "SP2024102300004", num: 10) { [weak self] success, result in
  124. //
  125. //
  126. // }
  127. // getDMGProductListInfosForMember(orderStatus: 0) { [weak self] success, result in
  128. //
  129. // }
  130. //创建买断订单
  131. // creatOrder(productId: "SP2024102300004", paymentMethod: 0, price: "119.99", discountFlag: 0, couponCode: "", num: 1) { [weak self] success, result in
  132. //
  133. // }
  134. //创建订阅订单(创建买断订单后会报错已经是购买用户,不能重复购买)
  135. // createSubscriber(productId: "SP2024102300003", paymentMethod: 0, price: "99.99", discountFlag: 0, couponCode: "", num: 1) { [weak self] success, result in
  136. //
  137. // }
  138. // getDMGProductOrderIdInfosForMember(orderId: "94b10d5f1ca193948e005503bff0df11") { [weak self] success, result in
  139. //
  140. // }
  141. }
  142. }
  143. /**
  144. @abstract 获取DMG产品价格(美元)
  145. */
  146. func getDMGPrice(productCode: String) -> String {
  147. guard let productModels = dmgProductDatas?.listingProducts else { return "" }
  148. for model in productModels {
  149. if model.code == productCode {
  150. return String(format: "%.2f", model.price.doubleValue)
  151. }
  152. }
  153. return ""
  154. }
  155. /**
  156. @abstract 获取DMG产品价格(人民币)
  157. */
  158. func getDMGCNYPrice(productCode: String) -> String {
  159. guard let productModels = dmgProductDatas?.listingProducts else { return "" }
  160. for model in productModels {
  161. if model.code == productCode {
  162. return String(format: "%.2f", model.cnyPrice.doubleValue)
  163. }
  164. }
  165. return ""
  166. }
  167. /**
  168. @abstract 获取DMG产品折扣价格(美元)
  169. */
  170. func getDMGDisplayPrice(productCode: String) -> String {
  171. guard let productModels = dmgProductDatas?.listingProducts else { return "" }
  172. for model in productModels {
  173. if model.code == productCode {
  174. return String(format: "%.2f", model.displayPrice.doubleValue)
  175. }
  176. }
  177. return ""
  178. }
  179. /**
  180. @abstract 获取DMG产品折扣价格(人民币)
  181. */
  182. func getDMGDisplayCNYPrice(productCode: String) -> String {
  183. guard let productModels = dmgProductDatas?.listingProducts else { return "" }
  184. for model in productModels {
  185. if model.code == productCode {
  186. return String(format: "%.2f", model.displayCnyPrice.doubleValue)
  187. }
  188. }
  189. return ""
  190. }
  191. /**
  192. @abstract 获取登录用户价格(建立订单时需要用到)
  193. @param productId 购买的产品id
  194. @param isEducation 是否教育优惠
  195. @param complete 回调
  196. */
  197. func getDMGProductPriceInfosForMember(productId: String, isEducation: Int, _ complete: @escaping KMMemberProductComplete) {
  198. checkConnectionAvailable()
  199. //暂时无教育优惠,先固定传 0
  200. KMMemberCenterManager.manager.getProductPriceForBuy(productId: productId, isEducation: 0, userId:KMMemberInfo.shared.userID) { [weak self] success, result in
  201. if success {
  202. guard let productsArrays : KMMemberProductResult = result else {
  203. complete(false, result)
  204. return
  205. }
  206. self?.dmgLastGetProductPriceInfos = productsArrays
  207. complete(true, productsArrays)
  208. } else {
  209. complete(false, result)
  210. }
  211. }
  212. }
  213. /**
  214. @abstract 获取批量阶段购买价格(建立订单时需要用到)
  215. @param productId 购买的产品id
  216. @param num 批量个数
  217. @param complete 回调
  218. */
  219. func getDMGBatchProductPriceInfosForMember(productId: String, num: Int, _ complete: @escaping KMMemberProductComplete) {
  220. checkConnectionAvailable()
  221. KMMemberCenterManager.manager.getBatchProductPrice(productId: productId, num: num) { [weak self] success, result in
  222. if success {
  223. guard let productsArrays : KMMemberProductResult = result else {
  224. complete(false, result)
  225. return
  226. }
  227. self?.dmgLastGetBatchProductPriceInfos = productsArrays
  228. complete(true, productsArrays)
  229. } else {
  230. complete(false, result)
  231. }
  232. }
  233. }
  234. /**
  235. @abstract 验证商品优惠券(建立订单时需要用到)
  236. @param productId 购买的产品id
  237. @param code 优惠券
  238. @param complete 回调
  239. */
  240. func getDMGCheckCouponProductPriceInfosForMember(productId: String, code: String, _ complete: @escaping KMMemberProductComplete) {
  241. checkConnectionAvailable()
  242. KMMemberCenterManager.manager.checkCoupon(productId: productId, userId: KMMemberInfo.shared.userID, code: code) { [weak self] success, result in
  243. if success {
  244. guard let productsArrays : KMMemberProductResult = result else {
  245. complete(false, result)
  246. return
  247. }
  248. self?.dmgLastCheckCouponProductPriceInfos = productsArrays
  249. complete(true, productsArrays)
  250. } else {
  251. complete(false, result)
  252. }
  253. }
  254. }
  255. /**
  256. @abstract 获取订单列表
  257. @param orderStatus 0全部1待支付
  258. @param complete 回调
  259. */
  260. func getDMGProductListInfosForMember(orderStatus: Int, _ complete: @escaping KMMemberRequestInfoComplete) {
  261. checkConnectionAvailable()
  262. KMMemberCenterManager.manager.getOrderListByStatus(orderStatus: orderStatus) { [weak self] success, result in
  263. if success {
  264. guard let productsInfos : NSDictionary = result else {
  265. complete(false, result)
  266. return
  267. }
  268. complete(true, productsInfos)
  269. } else {
  270. complete(false, result)
  271. }
  272. }
  273. }
  274. /**
  275. @abstract 创建订单(买断)
  276. @param productId 产品id
  277. @param paymentMethod 支付方式 PAYPAL(0),ALIPAY(1),WXPAY(2),PADDLE(3)
  278. @param price 价格
  279. @param discountFlag 0原价,1优惠券,2升级,3教育优惠,4批量购买,5黑五折扣
  280. @param couponCode 优惠卷
  281. @param num 批量购买数量
  282. @param complete 回调
  283. */
  284. func creatOrder(productId: String, paymentMethod: Int, price: String, discountFlag: Int, couponCode: String, num: Int, _ complete: @escaping KMMemberProductComplete) {
  285. checkConnectionAvailable()
  286. KMMemberCenterManager.manager.createOrder(productId: productId, paymentMethod: paymentMethod, price: price, discountFlag: discountFlag, couponCode: couponCode, num: num) { [weak self] success, result in
  287. if success {
  288. guard let productsArrays : KMMemberProductResult = result else {
  289. complete(false, result)
  290. return
  291. }
  292. self?.dmgLastCreatOrderProductInfos = productsArrays
  293. complete(true, productsArrays)
  294. } else {
  295. complete(false, result)
  296. }
  297. }
  298. }
  299. /**
  300. @abstract 创建订单(订阅)
  301. @param productId 产品id
  302. @param paymentMethod 支付方式 PAYPAL(0),ALIPAY(1),WXPAY(2),PADDLE(3)
  303. @param price 价格
  304. @param discountFlag 0原价,1优惠券,2升级,3教育优惠,4批量购买,5黑五折扣
  305. @param couponCode 优惠卷
  306. @param num 批量购买数量
  307. @param complete 回调
  308. */
  309. func createSubscriber(productId: String, paymentMethod: Int, price: String, discountFlag: Int, couponCode: String, num: Int, _ complete: @escaping KMMemberProductComplete) {
  310. checkConnectionAvailable()
  311. KMMemberCenterManager.manager.createSubscriber(productId: productId, paymentMethod: paymentMethod, price: price, discountFlag: discountFlag, couponCode: couponCode, num: num) { [weak self] success, result in
  312. if success {
  313. guard let productsArrays : KMMemberProductResult = result else {
  314. complete(false, result)
  315. return
  316. }
  317. self?.dmgLastCreatSubscriberProductInfos = productsArrays
  318. complete(true, productsArrays)
  319. } else {
  320. complete(false, result)
  321. }
  322. }
  323. }
  324. /**
  325. @abstract 支付后查询订单状态
  326. @param productId 购买的产品id
  327. @param complete 回调
  328. */
  329. func getDMGProductOrderIdInfosForMember(orderId: String, _ complete: @escaping KMMemberRequestInfoComplete) {
  330. checkConnectionAvailable()
  331. KMMemberCenterManager.manager.getStateByOrderId(orderId: orderId) { [weak self] success, result in
  332. if success {
  333. guard let productsInfos : NSDictionary = result else {
  334. complete(false, result)
  335. return
  336. }
  337. complete(true, productsInfos)
  338. } else {
  339. complete(false, result)
  340. }
  341. }
  342. }
  343. // MARK: Public Method
  344. /**
  345. @abstract 根据当前权益获取比较表类型
  346. @param
  347. */
  348. func getCurrentComparisonTableType() -> Void {
  349. let userScenarioType = KMMemberInfo.shared.userScenarioType
  350. let platforms = KMMemberInfo.shared.vip_platforms
  351. let platformsArray = platforms
  352. .components(separatedBy: ",")
  353. .map { $0.trimmingCharacters(in: .whitespaces) }
  354. if userScenarioType == .lite_type1 ||
  355. userScenarioType == .lite_type3 ||
  356. userScenarioType == .lite_type11 ||
  357. userScenarioType == .lite_type4 ||
  358. userScenarioType == .lite_type5 ||
  359. userScenarioType == .lite_type9 ||
  360. userScenarioType == .lite_type13 ||
  361. userScenarioType == .lite_type7 ||
  362. userScenarioType == .lite_type8 {
  363. if userScenarioType == .lite_type1 {
  364. state = .trial
  365. } else if userScenarioType == .lite_type3 || userScenarioType == .lite_type11 {
  366. state = .lite_Base
  367. } else if userScenarioType == .lite_type4 || userScenarioType == .lite_type5 || userScenarioType == .lite_type9 || userScenarioType == .lite_type13 {
  368. state = .lite_MacWindows
  369. } else if userScenarioType == .lite_type7 || userScenarioType == .lite_type8 {
  370. if KMMemberInfo.shared.vip_paymentModel == "1" && KMMemberInfo.shared.vip_cycle == 4 && platformsArray.count == 4 {
  371. state = .lite_MacWindows
  372. } else {
  373. state = .lite_Base
  374. }
  375. }
  376. } else if userScenarioType == .pro_type1 ||
  377. userScenarioType == .pro_type3 ||
  378. userScenarioType == .pro_type4 {
  379. if userScenarioType == .pro_type1 ||
  380. userScenarioType == .pro_type4 {
  381. state = .pro_Advanced
  382. } else if userScenarioType == .pro_type3 {
  383. state = .pro_Base
  384. }
  385. }
  386. }
  387. /**
  388. 对应商品价格
  389. */
  390. func getProductPrice(_ type: KMPurchasedProductType) -> String {
  391. #if VERSION_FREE
  392. #if VERSION_DMG
  393. // DMG
  394. if type == .pdfReaderProStandard_dmg {
  395. return getDMGPrice(productCode: "standard-annual-subscription")
  396. } else if type == .pdfReaderProAdvanced_dmg {
  397. if isBlackFive {
  398. return getDMGPrice(productCode: "advanced-annual-subscription-blackFive")
  399. } else {
  400. return getDMGPrice(productCode: "advanced-annual-subscription")
  401. }
  402. } else if type == .pdfReaderProPermanent_dmg {
  403. if isBlackFive {
  404. return getDMGPrice(productCode: "advanced-permanent-blackFive")
  405. } else {
  406. return getDMGPrice(productCode: "advanced-permanent")
  407. }
  408. } else if type == .pdfReaderProAIAnnual_dmg {
  409. return getDMGPrice(productCode: "ai-subscription-year-trail")
  410. } else if type == .pdfReaderProAIMonthly_dmg {
  411. return getDMGPrice(productCode: "ai-subscription-month")
  412. } else if type == .pdfToOffice_dmg {
  413. return getDMGPrice(productCode: "PDF to Office")
  414. } else if type == .add2Device_dmg {
  415. } else if type == .add3Device_dmg {
  416. }
  417. #else
  418. // AppStore 免费版本
  419. if type == .fourDevicesAllAccessPackNew6months_lite {
  420. if let product = IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite, product.isOffers {
  421. return product.offersPrice()
  422. } else {
  423. return IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite.price()
  424. }
  425. } else if type == .fourDevicesAllAccessPackNew12months_lite {
  426. if let product = IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite, product.isOffers {
  427. return product.offersPrice()
  428. } else {
  429. return IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite.price()
  430. }
  431. } else if type == .aiAllAccessPack1month_lite {
  432. if let product = IAPProductsManager.default().aiAllAccessPack1month_lite, product.isOffers {
  433. return product.offersPrice()
  434. } else {
  435. return IAPProductsManager.default().aiAllAccessPack1month_lite.price()
  436. }
  437. } else if type == .aiAllAccessPack12month_lite {
  438. if let product = IAPProductsManager.default().aiAllAccessPack12month_lite, product.isOffers {
  439. return product.offersPrice()
  440. } else {
  441. return IAPProductsManager.default().aiAllAccessPack12month_lite.price()
  442. }
  443. } else if type == .allAccessPackPermanent_lite {
  444. if let product = IAPProductsManager.default().allAccessPackPermanent_lite, product.isOffers {
  445. return product.offersPrice()
  446. } else {
  447. return IAPProductsManager.default().allAccessPackPermanent_lite.price()
  448. }
  449. } else if type == .advancedAddDevicesAllAccessPack12months_lite {
  450. if let product = IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_lite, product.isOffers {
  451. return product.offersPrice()
  452. } else {
  453. return IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_lite.price()
  454. }
  455. } else if type == .advancedAdd2DevicesAllAccessPack12months_lite {
  456. if let product = IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite, product.isOffers {
  457. return product.offersPrice()
  458. } else {
  459. return IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite.price()
  460. }
  461. }
  462. #endif
  463. #else
  464. // AppStore 付费版
  465. if type == .aiAllAccessPack1month_pro {
  466. if let product = IAPProductsManager.default().aiAllAccessPack1month_pro, product.isOffers {
  467. return product.offersPrice()
  468. } else {
  469. return IAPProductsManager.default().aiAllAccessPack1month_pro.price()
  470. }
  471. } else if type == .aiAllAccessPack12month_pro {
  472. if let product = IAPProductsManager.default().aiAllAccessPack12month_pro, product.isOffers {
  473. return product.offersPrice()
  474. } else {
  475. return IAPProductsManager.default().aiAllAccessPack12month_pro.price()
  476. }
  477. } else if type == .pdfToOfficePackPermanent_pro {
  478. if let product = IAPProductsManager.default().pdfToOfficePackPermanent_pro, product.isOffers {
  479. return product.offersPrice()
  480. } else {
  481. return IAPProductsManager.default().pdfToOfficePackPermanent_pro.price()
  482. }
  483. } else if type == .fourDevicesAllAccessPack12months_pro {
  484. if let product = IAPProductsManager.default().fourDevicesAllAccessPack12months_pro, product.isOffers {
  485. return product.offersPrice()
  486. } else {
  487. return IAPProductsManager.default().fourDevicesAllAccessPack12months_pro.price()
  488. }
  489. } else if type == .standardAddDevicesAllAccessPack12months_pro {
  490. if let product = IAPProductsManager.default().standardAddDevicesAllAccessPack12months_pro, product.isOffers {
  491. return product.offersPrice()
  492. } else {
  493. return IAPProductsManager.default().standardAddDevicesAllAccessPack12months_pro.price()
  494. }
  495. } else if type == .advancedAddDevicesAllAccessPack12months_pro {
  496. if let product = IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_pro, product.isOffers {
  497. return product.offersPrice()
  498. } else {
  499. return IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_pro.price()
  500. }
  501. } else if type == .advancedAdd2DevicesAllAccessPack12months_pro {
  502. if let product = IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro, product.isOffers {
  503. return product.offersPrice()
  504. } else {
  505. return IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro.price()
  506. }
  507. }
  508. #endif
  509. return ""
  510. }
  511. func appstorePurchaseAction(_ tag: Int, _ complete: @escaping AppstorePurchaseComplete) -> Void {
  512. if state == .dmg_Base {
  513. var code = ""
  514. if tag == 1 {
  515. code = "standard-annual-subscription"
  516. } else if tag == 3 {
  517. if isBlackFive {
  518. code = "advanced-permanent-blackFive"
  519. } else {
  520. code = "advanced-permanent"
  521. }
  522. } else {
  523. if isBlackFive {
  524. code = "advanced-annual-subscription-blackFive"
  525. } else {
  526. code = "advanced-annual-subscription"
  527. }
  528. }
  529. #if VERSION_DMG
  530. let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(code)
  531. embeddedWC.showWindow(nil)
  532. embeddedWC.window?.center()
  533. #endif
  534. } else if state == .dmg_Upgrades1 {
  535. #if VERSION_DMG
  536. let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode("advanced-annual-subscription")
  537. embeddedWC.showWindow(nil)
  538. embeddedWC.window?.center()
  539. #endif
  540. } else if state == .dmg_Upgrades2 {
  541. #if VERSION_DMG
  542. let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode("advanced-annual-subscription")
  543. embeddedWC.showWindow(nil)
  544. embeddedWC.window?.center()
  545. #endif
  546. } else if state == .lite_Base {
  547. if tag == 0 {
  548. if isPurchaseSwitch { membershipPurchase(.fourDevicesAllAccessPackNew12months_lite) }
  549. else { membershipPurchase(.fourDevicesAllAccessPackNew6months_lite) }
  550. } else if tag == 3 {
  551. membershipPurchase(.allAccessPackPermanent_lite)
  552. } else {
  553. membershipPurchase(.fourDevicesAllAccessPackNew12months_lite)
  554. }
  555. } else if state == .lite_MacWindows {
  556. if tag == 2 {
  557. let platforms = KMMemberInfo.shared.vip_platforms
  558. let platformsArray = platforms
  559. .components(separatedBy: ",")
  560. .map { $0.trimmingCharacters(in: .whitespaces) }
  561. if KMMemberInfo.shared.userScenarioType == .lite_type5 {
  562. if platformsArray.count == 1 {
  563. membershipPurchase(.advancedAddDevicesAllAccessPack12months_lite)
  564. } else if platformsArray.count == 2 {
  565. membershipPurchase(.advancedAdd2DevicesAllAccessPack12months_lite)
  566. }
  567. } else {
  568. if platformsArray.count == 1 {
  569. membershipPurchase(.advancedAddDevicesAllAccessPack12months_lite)
  570. } else if platformsArray.count == 2 {
  571. membershipPurchase(.advancedAdd2DevicesAllAccessPack12months_lite)
  572. } else {
  573. membershipPurchase(.advancedAdd2DevicesAllAccessPack12months_lite)
  574. }
  575. }
  576. }
  577. } else if state == .pro_Base {
  578. if KMMemberInfo.shared.userScenarioType == .pro_type3 {
  579. if tag == 2 {
  580. membershipPurchase(.standardAddDevicesAllAccessPack12months_pro)
  581. } else if tag == 3 {
  582. membershipPurchase(.pdfToOfficePackPermanent_pro)
  583. }
  584. }
  585. } else if state == .pro_Advanced {
  586. if KMMemberInfo.shared.userScenarioType == .pro_type1 {
  587. membershipPurchase(.advancedAddDevicesAllAccessPack12months_pro)
  588. } else if KMMemberInfo.shared.userScenarioType == .pro_type4 {
  589. let platforms = KMMemberInfo.shared.vip_platforms
  590. let platformsArray = platforms
  591. .components(separatedBy: ",")
  592. .map { $0.trimmingCharacters(in: .whitespaces) }
  593. if platformsArray.count == 1 {
  594. membershipPurchase(.advancedAddDevicesAllAccessPack12months_pro)
  595. } else if platformsArray.count == 2 {
  596. membershipPurchase(.advancedAdd2DevicesAllAccessPack12months_pro)
  597. } else {
  598. membershipPurchase(.advancedAdd2DevicesAllAccessPack12months_pro)
  599. }
  600. }
  601. } else {
  602. if tag == 2 {
  603. membershipPurchase(.fourDevicesAllAccessPackNew12months_lite)
  604. }
  605. }
  606. }
  607. func appStoreEquityVerification(_ notification: Notification,_ complete: @escaping KMMemberProductComplete) -> Void {
  608. #if VERSION_FREE
  609. #if VERSION_DMG
  610. // DMG
  611. #else
  612. // AppStore 免费版本
  613. if let userInfo = notification.object as? SKPaymentTransaction,
  614. let transactionId = userInfo.transactionIdentifier as? String,
  615. let productId = userInfo.payment.productIdentifier as? String {
  616. print("Transaction ID: \(transactionId)")
  617. print("product ID: \(productId)")
  618. var productCode = ""
  619. var isSubscribed = false
  620. if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_advanced_6months.001" {
  621. productCode = "advanced-annual-subscription-six-month"
  622. if IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite.isSubscribed {
  623. isSubscribed = true
  624. }
  625. } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_advanced_annual.001" {
  626. productCode = "advanced-annual-subscription"
  627. if IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite.isSubscribed {
  628. isSubscribed = true
  629. }
  630. } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_new_6months.001" {
  631. productCode = "advanced-annual-subscription-six-month"
  632. if IAPProductsManager.default().allAccessPackNew6months_lite.isSubscribed {
  633. isSubscribed = true
  634. }
  635. } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_12months.001" {
  636. productCode = "advanced-annual-subscription"
  637. if IAPProductsManager.default().allAccessPack12months_lite.isSubscribed {
  638. isSubscribed = true
  639. }
  640. } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_6months.001" {
  641. productCode = "advanced-annual-subscription-six-month"
  642. if IAPProductsManager.default().allAccessPack6months_lite.isSubscribed {
  643. isSubscribed = true
  644. }
  645. } else if productId == "com.pdfreaderpro.mac_free.member.ai_pack_1_month" {
  646. productCode = "ai-subscription-month"
  647. if IAPProductsManager.default().aiAllAccessPack1month_lite.isSubscribed {
  648. isSubscribed = true
  649. }
  650. } else if productId == "com.pdfreaderpro.mac_free.member.ai_pack_12_month" {
  651. productCode = "ai-subscription-year-trail"
  652. if IAPProductsManager.default().aiAllAccessPack12month_lite.isSubscribed {
  653. isSubscribed = true
  654. }
  655. } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_advanced_permanent_license.001" {
  656. productCode = "advanced-permanent"
  657. if IAPProductsManager.default().allAccessPackPermanent_lite.isSubscribed {
  658. isSubscribed = true
  659. }
  660. } else if productId == "com.pdfreaderpro.mac_free.member.advanced_add_devices_all_access_pack_advanced_annual.001" {
  661. productCode = "advanced-annual-subscription-single-upgrade"
  662. if IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_lite.isSubscribed {
  663. isSubscribed = true
  664. }
  665. } else if productId == "com.pdfreaderpro.mac_free.member.advanced_add_2_devices_all_access_pack_advanced_annual.001" {
  666. productCode = "advanced-annual-subscription-multi-upgrade"
  667. if IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite.isSubscribed {
  668. isSubscribed = true
  669. }
  670. }
  671. if isSubscribed {
  672. KMMemberCenterManager.manager.appStoreEquityVerification(applePayProductId: productId, transactionId: transactionId, productCode: productCode) { success, result in
  673. if success {
  674. complete(true, result)
  675. } else {
  676. complete(false, result)
  677. }
  678. }
  679. }
  680. } else {
  681. print("Transaction ID not found in notification.")
  682. }
  683. #endif
  684. #else
  685. // AppStore 付费版
  686. if let userInfo = notification.object as? SKPaymentTransaction,
  687. let transactionId = userInfo.transactionIdentifier as? String,
  688. let productId = userInfo.payment.productIdentifier as? String {
  689. print("Transaction ID: \(transactionId)")
  690. print("product ID: \(productId)")
  691. var productCode = ""
  692. var isSubscribed = false
  693. if productId == "com.pdfreaderpro.mac.ai_pack_1_month" {
  694. productCode = "ai-subscription-month"
  695. if IAPProductsManager.default().aiAllAccessPack1month_pro.isSubscribed {
  696. isSubscribed = true
  697. }
  698. } else if productId == "com.pdfreaderpro.mac.ai_pack_12_month" {
  699. productCode = "ai-subscription-year-trail"
  700. if IAPProductsManager.default().aiAllAccessPack12month_pro.isSubscribed {
  701. isSubscribed = true
  702. }
  703. } else if productId == "com.pdfreaderpro.mac.pdf_to_office_pack_permanent_license.001" {
  704. productCode = "advanced-permanent-mac-upgrade"
  705. if IAPProductsManager.default().pdfToOfficePackPermanent_pro.isSubscribed {
  706. isSubscribed = true
  707. }
  708. } else if productId == "com.pdfreaderpro.mac.all_access_pack_advanced_annual.001" {
  709. productCode = "advanced-permanent-mac-upgrade"
  710. if IAPProductsManager.default().fourDevicesAllAccessPack12months_pro.isSubscribed {
  711. isSubscribed = true
  712. }
  713. } else if productId == "com.pdfreaderpro.mac.advanced_add_devices_all_access_pack_advanced_annual.001" {
  714. productCode = "advanced-annual-subscription-standard-upgrade"
  715. if IAPProductsManager.default().standardAddDevicesAllAccessPack12months_pro.isSubscribed {
  716. isSubscribed = true
  717. }
  718. } else if productId == "com.pdfreaderpro.mac.advanced_add_devices_all_access_pack_advanced_annual.001" {
  719. productCode = "advanced-annual-subscription-single-upgrade"
  720. if IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_pro.isSubscribed {
  721. isSubscribed = true
  722. }
  723. } else if productId == "com.pdfreaderpro.mac.advanced_add_2_devices_all_access_pack_advanced_annual.001" {
  724. productCode = "advanced-annual-subscription-multi-upgrade"
  725. if IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro.isSubscribed {
  726. isSubscribed = true
  727. }
  728. }
  729. if isSubscribed {
  730. KMMemberCenterManager.manager.appStoreEquityVerification(applePayProductId: productId, transactionId: transactionId, productCode: productCode) { success, result in
  731. if success {
  732. complete(true, result)
  733. } else {
  734. complete(false, result)
  735. }
  736. }
  737. }
  738. } else {
  739. print("Transaction ID not found in notification.")
  740. }
  741. #endif
  742. }
  743. var isCancelAutoRenew: Bool {
  744. return IAPProductsManager.default().isCancelAutoRenew()
  745. }
  746. var isShowSale: Bool {
  747. if #available(macOS 10.14.4, *), isCancelAutoRenew {
  748. let manager = IAPProductsManager.default()
  749. let isSubscribed_newlyMonth = manager?.allAccessPackNew6months_lite.isSubscribed ?? false
  750. let isSubscribed_year = manager?.allAccessPack12months_lite.isSubscribed ?? false
  751. if isSubscribed_newlyMonth || isSubscribed_year {
  752. return false
  753. }
  754. if let info = KMAdvertisementManager.manager.info.StoreUserRecovery?.content?.first, !(info.show! as NSString).boolValue {
  755. return false
  756. }
  757. return true
  758. }
  759. return false
  760. }
  761. // MARK: Private Method
  762. /**
  763. 会员购买
  764. */
  765. private func membershipPurchase(_ type: KMPurchasedProductType) -> Void {
  766. #if !VERSION_DMG
  767. if type == .fourDevicesAllAccessPackNew6months_lite || type == .fourDevicesAllAccessPackNew12months_lite {
  768. if isPurchaseSwitch {
  769. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite, discount: isCancelAutoRenew)
  770. } else {
  771. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite, discount: isCancelAutoRenew)
  772. }
  773. } else if type == .aiAllAccessPack1month_lite {
  774. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().aiAllAccessPack1month_lite, discount: isCancelAutoRenew)
  775. } else if type == .aiAllAccessPack12month_lite {
  776. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().aiAllAccessPack12month_lite, discount: isCancelAutoRenew)
  777. } else if type == .allAccessPackPermanent_lite {
  778. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().allAccessPackPermanent_lite, discount: isCancelAutoRenew)
  779. } else if type == .advancedAddDevicesAllAccessPack12months_lite {
  780. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_lite, discount: isCancelAutoRenew)
  781. } else if type == .advancedAdd2DevicesAllAccessPack12months_lite {
  782. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite, discount: isCancelAutoRenew)
  783. } else if type == .aiAllAccessPack1month_pro {
  784. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().aiAllAccessPack1month_pro, discount: isCancelAutoRenew)
  785. } else if type == .aiAllAccessPack12month_pro {
  786. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().aiAllAccessPack12month_pro, discount: isCancelAutoRenew)
  787. } else if type == .pdfToOfficePackPermanent_pro {
  788. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().pdfToOfficePackPermanent_pro, discount: isCancelAutoRenew)
  789. } else if type == .fourDevicesAllAccessPack12months_pro {
  790. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().fourDevicesAllAccessPack12months_pro, discount: isCancelAutoRenew)
  791. } else if type == .standardAddDevicesAllAccessPack12months_pro {
  792. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().standardAddDevicesAllAccessPack12months_pro, discount: isCancelAutoRenew)
  793. } else if type == .advancedAddDevicesAllAccessPack12months_pro {
  794. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_pro, discount: isCancelAutoRenew)
  795. } else if type == .advancedAdd2DevicesAllAccessPack12months_pro {
  796. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro, discount: isCancelAutoRenew)
  797. }
  798. #endif
  799. }
  800. // MARK: Action Method
  801. /**
  802. 恢复购买
  803. */
  804. func productRestore() -> Void {
  805. IAPProductsManager.default().restoreSubscriptions()
  806. }
  807. func privacyPolicyAction() -> Void {
  808. NSWorkspace.shared.open(URL(string: "https://www.pdfreaderpro.com/privacy-policy")!)
  809. }
  810. func termOfSerAction() -> Void {
  811. NSWorkspace.shared.open(URL(string: "https://www.pdfreaderpro.com/terms_of_service")!)
  812. }
  813. // MARK: Get & Set
  814. /**
  815. 当前比较表产品列表内容
  816. */
  817. var products: [KMCompareProductType] {
  818. if state == .trial {
  819. return [.free, .freeTrial]
  820. } else if state == .dmg_Base {
  821. return [.free, .allPlatformStandard, .allPlatformAdvanced_12, .dualPlatformAdvanced]
  822. } else if state == .dmg_Upgrades1 {
  823. return [.allPlatformAdvanced_12]
  824. } else if state == .dmg_Upgrades1 {
  825. return [.allPlatformAdvanced_12]
  826. } else if state == .lite_Base {
  827. return [.free, .allPlatformAdvanced_6, .allPlatformAdvanced_12, .dualPlatformAdvanced]
  828. } else if state == .lite_MacWindows {
  829. return [.allPlatformAdvanced_12]
  830. } else if state == .pro_Base {
  831. return [.allPlatformAdvanced_12, .macPlatformAdvanced]
  832. } else if state == .pro_Advanced {
  833. return [.allPlatformAdvanced_12]
  834. }
  835. return []
  836. }
  837. /**
  838. 比较表数据源
  839. */
  840. var dataSource: [Any] {
  841. if isPurchaseSwitch {
  842. // 试用 全平台标准版年订阅 全平台高级版6/12个月订阅 Mac&Windows双平台高级版永久 MAC单平台高级版永久
  843. //MAC单平台标准版永久
  844. return [
  845. "Benefit",
  846. ["Supported platforms", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows", "mac"],
  847. ["Maximum number of accessible devices", "4 devices", "4 devices", "4 devices", "2 devices", "1 devices"],
  848. "PDF to Office",
  849. ["Convert PDFs to Word, HTML, TXT, JPEG or PNG files", "Only first 10 pages", "Standard", "Advanced", "Advanced", "Advanced"],
  850. ["Turn PDF to PPT, Excel, RTF, CSV, and more", "Only first 10 pages", "Only first 10 pages", "✓", "✓", "✓"],
  851. ["Convert PDF to TIFF, BMP, GIF or TGA files", "Only first 10 pages", "Only first 10 pages", "✓", "✓", "✓"],
  852. "Edit PDF",
  853. ["Add and edit text in PDF", "X", "✓", "✓", "✓", "✓"],
  854. ["Edit, crop, replace image in PDF", "X", "✓", "✓", "✓", "✓"],
  855. "OCR",
  856. ["Extract texts from image-based or scanned PDF", "X", "✓", "✓", "✓", "✓"],
  857. "Organize Pages",
  858. ["Extract, rotate, rearrange, replace, add, delete pages", "X", "✓", "✓", "✓", "✓"],
  859. ["Split PDFs into multiple files", "X", "✓", "✓", "✓", "✓"],
  860. "Advanced Editing Tools",
  861. ["Merge multiple documents into a new PDF", "Up to 2 files or 20 MB", "✓", "✓", "✓", "∞", "∞"],
  862. ["Add & edit watermark", "X", "✓", "✓", "✓", "✓"],
  863. ["Add header, footer, page numbers", "X", "✓", "✓", "✓", "✓"],
  864. ["Add Bates Number", "X", "✓", "✓", "✓", "✓"],
  865. ["Insert PDF page background by color or image", "X", "✓", "✓", "✓", "✓"],
  866. ["Create fattened copies", "X", "✓", "✓", "✓", "✓"],
  867. ["Extract Images", "X", "✓", "✓", "✓", "✓"],
  868. ["Extract tables", "Only first 10 pages", "Only first 10 pages", "✓", "✓", "✓"],
  869. ["Measuring Tools", "X", "✓", "✓", "✓", "✓"],
  870. "Fill & Sign",
  871. ["Create digital signature", "X", "✓", "✓", "✓", "✓"],
  872. ["Create & Edit & Fill Adobe Fillable PDF Forms", "X", "✓", "✓", "✓", "✓"],
  873. "Security",
  874. ["Batch encrypting PDF documents", "X", "✓", "✓", "✓", "✓"],
  875. ["PDF Password Remover", "X", "✓", "✓", "✓", "✓"],
  876. ["Redact sensitive information", "X", "✓", "✓", "✓", "✓"],
  877. "Create PDF",
  878. ["Convert JPEG, JPG, PNG, TIFF, BMP or PSD files to PDFs", "1 file", "✓", "✓", "✓", "✓"],
  879. ["Create PDFs from a scanner and iOS devices", "X", "✓", "✓", "✓", "✓"],
  880. "Annotations",
  881. ["Customize PDF stamps", "X", "✓", "✓", "✓", "✓"],
  882. ["Hyperlink", "Page Number", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email"],
  883. ["Signature", "Standard", "Advanced", "Advanced", "Advanced", "Advanced"],
  884. ["Table", "X", "✓", "✓", "✓", "✓"],
  885. "View PDF",
  886. ["Multi-tab viewer", "X", "✓", "✓", "✓", "✓"],
  887. ["Various printing types: poster, booklet, multi-page printing", "X", "✓", "✓", "✓", "✓"],
  888. ["Customize theme colors: Light Mode, Dark Mode, Sepia Mode and more", "X", "✓", "✓", "✓", "✓"],
  889. ["Split View to compare files", "X", "✓", "✓", "✓", "✓"],
  890. "Subscription Based Solution",
  891. ["Access all premium features in app", "X", "12 months", "12 months", "∞", "∞"],
  892. ["Priority customer support", "X", "✓", "✓", "✓", "✓"],
  893. ["Ad-free", "X", "✓", "✓", "✓", "✓"]
  894. ]
  895. } else {
  896. return [
  897. "Benefit",
  898. ["Supported platforms", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows", "mac"],
  899. ["Maximum number of accessible devices", "4 devices", "4 devices", "4 devices", "2 devices", "1 devices"],
  900. "PDF to Office",
  901. ["Convert PDFs to Word, HTML, TXT, JPEG or PNG files", "Only first 10 pages", "Standard", "Advanced", "Advanced", "Advanced"],
  902. ["Turn PDF to PPT, Excel, RTF, CSV, and more", "Only first 10 pages", "Only first 10 pages", "✓", "✓", "✓"],
  903. ["Convert PDF to TIFF, BMP, GIF or TGA files", "Only first 10 pages", "Only first 10 pages", "✓", "✓", "✓"],
  904. "Edit PDF",
  905. ["Add and edit text in PDF", "X", "✓", "✓", "✓", "✓"],
  906. ["Edit, crop, replace image in PDF", "X", "✓", "✓", "✓", "✓"],
  907. "OCR",
  908. ["Extract texts from image-based or scanned PDF", "X", "✓", "✓", "✓", "✓"],
  909. "Organize Pages",
  910. ["Extract, rotate, rearrange, replace, add, delete pages", "X", "✓", "✓", "✓", "✓"],
  911. ["Split PDFs into multiple files", "X", "✓", "✓", "✓", "✓"],
  912. "Advanced Editing Tools",
  913. ["Merge multiple documents into a new PDF", "Up to 2 files or 20 MB", "✓", "✓", "✓", "∞", "∞"],
  914. ["Add & edit watermark", "X", "✓", "✓", "✓", "✓"],
  915. ["Add header, footer, page numbers", "X", "✓", "✓", "✓", "✓"],
  916. ["Add Bates Number", "X", "✓", "✓", "✓", "✓"],
  917. ["Insert PDF page background by color or image", "X", "✓", "✓", "✓", "✓"],
  918. ["Create fattened copies", "X", "✓", "✓", "✓", "✓"],
  919. ["Extract Images", "X", "✓", "✓", "✓", "✓"],
  920. ["Extract tables", "Only first 10 pages", "Only first 10 pages", "✓", "✓", "✓"],
  921. ["Measuring Tools", "X", "✓", "✓", "✓", "✓"],
  922. "Fill & Sign",
  923. ["Create digital signature", "X", "✓", "✓", "✓", "✓"],
  924. ["Create & Edit & Fill Adobe Fillable PDF Forms", "X", "✓", "✓", "✓", "✓"],
  925. "Security",
  926. ["Batch encrypting PDF documents", "X", "✓", "✓", "✓", "✓"],
  927. ["PDF Password Remover", "X", "✓", "✓", "✓", "✓"],
  928. ["Redact sensitive information", "X", "✓", "✓", "✓", "✓"],
  929. "Create PDF",
  930. ["Convert JPEG, JPG, PNG, TIFF, BMP or PSD files to PDFs", "1 file", "✓", "✓", "✓", "✓"],
  931. ["Create PDFs from a scanner and iOS devices", "X", "✓", "✓", "✓", "✓"],
  932. "Annotations",
  933. ["Customize PDF stamps", "X", "✓", "✓", "✓", "✓"],
  934. ["Hyperlink", "Page Number", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email"],
  935. ["Signature", "Standard", "Advanced", "Advanced", "Advanced", "Advanced"],
  936. ["Table", "X", "✓", "✓", "✓", "✓"],
  937. "View PDF",
  938. ["Multi-tab viewer", "X", "✓", "✓", "✓", "✓"],
  939. ["Various printing types: poster, booklet, multi-page printing", "X", "✓", "✓", "✓", "✓"],
  940. ["Customize theme colors: Light Mode, Dark Mode, Sepia Mode and more", "X", "✓", "✓", "✓", "✓"],
  941. ["Split View to compare files", "X", "✓", "✓", "✓", "✓"],
  942. "Subscription Based Solution",
  943. ["Access all premium features in app", "X", "6 months", "6 months", "∞", "∞"],
  944. ["Priority customer support", "X", "✓", "✓", "✓", "✓"],
  945. ["Ad-free", "X", "✓", "✓", "✓", "✓"]
  946. ]
  947. }
  948. }
  949. /**
  950. 是否黑五活动期
  951. */
  952. var isBlackFive: Bool {
  953. if let loginContent = KMAdvertisementManager.manager.info.topRightInfoContent {
  954. if loginContent.content?.isEmpty == false {
  955. return true
  956. }
  957. }
  958. return false
  959. }
  960. }