KMProductModel.swift 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056
  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", Float(model.priceString ?? "0") ?? 0)
  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", Float(model.cnyPriceString ?? "0") ?? 0)
  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", Float(model.displayPriceString ?? "0") ?? 0)
  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", Float(model.displayCnyPriceString ?? "0") ?? 0)
  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. if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
  396. return String(format: "USD $%@", getDMGPrice(productCode: KMStandardAnnualSubscriptionCodeKey_DMG))
  397. } else {
  398. return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMStandardAnnualSubscriptionCodeKey_DMG))
  399. }
  400. } else if type == .pdfReaderProAdvanced_dmg {
  401. if isBlackFive {
  402. if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
  403. return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG))
  404. } else {
  405. return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG))
  406. }
  407. } else {
  408. if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
  409. return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionCodeKey_DMG))
  410. } else {
  411. return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionCodeKey_DMG))
  412. }
  413. }
  414. } else if type == .pdfReaderProPermanent_dmg {
  415. if isBlackFive {
  416. if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
  417. return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedPermanentBlackFiveCodeKey_DMG))
  418. } else {
  419. return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedPermanentBlackFiveCodeKey_DMG))
  420. }
  421. } else {
  422. if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
  423. return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedPermanentCodeKey_DMG))
  424. } else {
  425. return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedPermanentCodeKey_DMG))
  426. }
  427. }
  428. } else if type == .pdfReaderProAIAnnual_dmg {
  429. if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
  430. return String(format: "USD $%@", getDMGPrice(productCode: KMAISubscriptionYearTrailCodeKey_DMG))
  431. } else {
  432. return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAISubscriptionYearTrailCodeKey_DMG))
  433. }
  434. } else if type == .pdfReaderProAIMonthly_dmg {
  435. if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
  436. return String(format: "USD $%@", getDMGPrice(productCode: KMAISubscriptionMonthCodeKey_DMG))
  437. } else {
  438. return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAISubscriptionMonthCodeKey_DMG))
  439. }
  440. } else if type == .pdfToOffice_dmg {
  441. } else if type == .add2Device_dmg {
  442. } else if type == .add3Device_dmg {
  443. }
  444. #else
  445. // AppStore 免费版本
  446. if type == .fourDevicesAllAccessPackNew6months_lite {
  447. if let product = IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite, product.isOffers {
  448. return product.offersPrice()
  449. } else {
  450. return IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite.price()
  451. }
  452. } else if type == .fourDevicesAllAccessPackNew12months_lite {
  453. if let product = IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite, product.isOffers {
  454. return product.offersPrice()
  455. } else {
  456. return IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite.price()
  457. }
  458. } else if type == .aiAllAccessPack1month_lite {
  459. if let product = IAPProductsManager.default().aiAllAccessPack1month_lite, product.isOffers {
  460. return product.offersPrice()
  461. } else {
  462. return IAPProductsManager.default().aiAllAccessPack1month_lite.price()
  463. }
  464. } else if type == .aiAllAccessPack12month_lite {
  465. if let product = IAPProductsManager.default().aiAllAccessPack12month_lite, product.isOffers {
  466. return product.offersPrice()
  467. } else {
  468. return IAPProductsManager.default().aiAllAccessPack12month_lite.price()
  469. }
  470. } else if type == .allAccessPackPermanent_lite {
  471. if let product = IAPProductsManager.default().allAccessPackPermanent_lite, product.isOffers {
  472. return product.offersPrice()
  473. } else {
  474. return IAPProductsManager.default().allAccessPackPermanent_lite.price()
  475. }
  476. } else if type == .advancedAddDevicesAllAccessPack12months_lite {
  477. if let product = IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_lite, product.isOffers {
  478. return product.offersPrice()
  479. } else {
  480. return IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_lite.price()
  481. }
  482. } else if type == .advancedAdd2DevicesAllAccessPack12months_lite {
  483. if let product = IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite, product.isOffers {
  484. return product.offersPrice()
  485. } else {
  486. return IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite.price()
  487. }
  488. }
  489. #endif
  490. #else
  491. // AppStore 付费版
  492. if type == .aiAllAccessPack1month_pro {
  493. if let product = IAPProductsManager.default().aiAllAccessPack1month_pro, product.isOffers {
  494. return product.offersPrice()
  495. } else {
  496. return IAPProductsManager.default().aiAllAccessPack1month_pro.price()
  497. }
  498. } else if type == .aiAllAccessPack12month_pro {
  499. if let product = IAPProductsManager.default().aiAllAccessPack12month_pro, product.isOffers {
  500. return product.offersPrice()
  501. } else {
  502. return IAPProductsManager.default().aiAllAccessPack12month_pro.price()
  503. }
  504. } else if type == .pdfToOfficePackPermanent_pro {
  505. if let product = IAPProductsManager.default().pdfToOfficePackPermanent_pro, product.isOffers {
  506. return product.offersPrice()
  507. } else {
  508. return IAPProductsManager.default().pdfToOfficePackPermanent_pro.price()
  509. }
  510. } else if type == .fourDevicesAllAccessPack12months_pro {
  511. if let product = IAPProductsManager.default().fourDevicesAllAccessPack12months_pro, product.isOffers {
  512. return product.offersPrice()
  513. } else {
  514. return IAPProductsManager.default().fourDevicesAllAccessPack12months_pro.price()
  515. }
  516. } else if type == .standardAddDevicesAllAccessPack12months_pro {
  517. if let product = IAPProductsManager.default().standardAddDevicesAllAccessPack12months_pro, product.isOffers {
  518. return product.offersPrice()
  519. } else {
  520. return IAPProductsManager.default().standardAddDevicesAllAccessPack12months_pro.price()
  521. }
  522. } else if type == .advancedAddDevicesAllAccessPack12months_pro {
  523. if let product = IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_pro, product.isOffers {
  524. return product.offersPrice()
  525. } else {
  526. return IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_pro.price()
  527. }
  528. } else if type == .advancedAdd2DevicesAllAccessPack12months_pro {
  529. if let product = IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro, product.isOffers {
  530. return product.offersPrice()
  531. } else {
  532. return IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro.price()
  533. }
  534. }
  535. #endif
  536. return ""
  537. }
  538. func appstorePurchaseAction(_ tag: Int, _ complete: @escaping AppstorePurchaseComplete) -> Void {
  539. if state == .dmg_Base {
  540. var code = ""
  541. if tag == 1 {
  542. code = KMStandardAnnualSubscriptionCodeKey_DMG
  543. } else if tag == 3 {
  544. if isBlackFive {
  545. code = KMAdvancedPermanentBlackFiveCodeKey_DMG
  546. } else {
  547. code = KMAdvancedPermanentCodeKey_DMG
  548. }
  549. } else {
  550. if isBlackFive {
  551. code = KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG
  552. } else {
  553. code = KMAdvancedAnnualSubscriptionCodeKey_DMG
  554. }
  555. }
  556. #if VERSION_DMG
  557. let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(code)
  558. embeddedWC.showWindow(nil)
  559. embeddedWC.window?.center()
  560. #endif
  561. } else if state == .dmg_Upgrades1 {
  562. #if VERSION_DMG
  563. let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(KMAdvancedAnnualSubscriptionCodeKey_DMG)
  564. embeddedWC.showWindow(nil)
  565. embeddedWC.window?.center()
  566. #endif
  567. } else if state == .dmg_Upgrades2 {
  568. #if VERSION_DMG
  569. let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(KMAdvancedAnnualSubscriptionCodeKey_DMG)
  570. embeddedWC.showWindow(nil)
  571. embeddedWC.window?.center()
  572. #endif
  573. } else if state == .lite_Base {
  574. if tag == 0 {
  575. if isPurchaseSwitch { membershipPurchase(.fourDevicesAllAccessPackNew12months_lite) }
  576. else { membershipPurchase(.fourDevicesAllAccessPackNew6months_lite) }
  577. } else if tag == 3 {
  578. membershipPurchase(.allAccessPackPermanent_lite)
  579. } else {
  580. membershipPurchase(.fourDevicesAllAccessPackNew12months_lite)
  581. }
  582. } else if state == .lite_MacWindows {
  583. if tag == 2 {
  584. let platforms = KMMemberInfo.shared.vip_platforms
  585. let platformsArray = platforms
  586. .components(separatedBy: ",")
  587. .map { $0.trimmingCharacters(in: .whitespaces) }
  588. if KMMemberInfo.shared.userScenarioType == .lite_type5 {
  589. if platformsArray.count == 1 {
  590. membershipPurchase(.advancedAddDevicesAllAccessPack12months_lite)
  591. } else if platformsArray.count == 2 {
  592. membershipPurchase(.advancedAdd2DevicesAllAccessPack12months_lite)
  593. }
  594. } else {
  595. if platformsArray.count == 1 {
  596. membershipPurchase(.advancedAddDevicesAllAccessPack12months_lite)
  597. } else if platformsArray.count == 2 {
  598. membershipPurchase(.advancedAdd2DevicesAllAccessPack12months_lite)
  599. } else {
  600. membershipPurchase(.advancedAdd2DevicesAllAccessPack12months_lite)
  601. }
  602. }
  603. }
  604. } else if state == .pro_Base {
  605. if KMMemberInfo.shared.userScenarioType == .pro_type3 {
  606. if tag == 2 {
  607. membershipPurchase(.standardAddDevicesAllAccessPack12months_pro)
  608. } else if tag == 3 {
  609. membershipPurchase(.pdfToOfficePackPermanent_pro)
  610. }
  611. }
  612. } else if state == .pro_Advanced {
  613. if KMMemberInfo.shared.userScenarioType == .pro_type1 {
  614. membershipPurchase(.advancedAddDevicesAllAccessPack12months_pro)
  615. } else if KMMemberInfo.shared.userScenarioType == .pro_type4 {
  616. let platforms = KMMemberInfo.shared.vip_platforms
  617. let platformsArray = platforms
  618. .components(separatedBy: ",")
  619. .map { $0.trimmingCharacters(in: .whitespaces) }
  620. if platformsArray.count == 1 {
  621. membershipPurchase(.advancedAddDevicesAllAccessPack12months_pro)
  622. } else if platformsArray.count == 2 {
  623. membershipPurchase(.advancedAdd2DevicesAllAccessPack12months_pro)
  624. } else {
  625. membershipPurchase(.advancedAdd2DevicesAllAccessPack12months_pro)
  626. }
  627. }
  628. } else {
  629. #if VERSION_FREE
  630. #if VERSION_DMG
  631. // DMG
  632. let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(KMAdvancedAnnualSubscriptionCodeKey_DMG)
  633. embeddedWC.showWindow(nil)
  634. embeddedWC.window?.center()
  635. #else
  636. // AppStore 免费版本
  637. if tag == 2 {
  638. membershipPurchase(.fourDevicesAllAccessPackNew12months_lite)
  639. }
  640. #endif
  641. #else
  642. // AppStore 付费版
  643. #endif
  644. }
  645. }
  646. func appStoreEquityVerification(_ notification: Notification,_ complete: @escaping KMMemberProductComplete) -> Void {
  647. #if VERSION_FREE
  648. #if VERSION_DMG
  649. // DMG
  650. #else
  651. // AppStore 免费版本
  652. if let userInfo = notification.object as? SKPaymentTransaction,
  653. let transactionId = userInfo.transactionIdentifier as? String,
  654. let productId = userInfo.payment.productIdentifier as? String {
  655. print("Transaction ID: \(transactionId)")
  656. print("product ID: \(productId)")
  657. var productCode = ""
  658. var isSubscribed = false
  659. if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_advanced_6months.001" {
  660. productCode = "advanced-annual-subscription-six-month"
  661. if IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite.isSubscribed {
  662. isSubscribed = true
  663. }
  664. } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_advanced_annual.001" {
  665. productCode = "advanced-annual-subscription"
  666. if IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite.isSubscribed {
  667. isSubscribed = true
  668. }
  669. } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_new_6months.001" {
  670. productCode = "advanced-annual-subscription-six-month"
  671. if IAPProductsManager.default().allAccessPackNew6months_lite.isSubscribed {
  672. isSubscribed = true
  673. }
  674. } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_12months.001" {
  675. productCode = "advanced-annual-subscription"
  676. if IAPProductsManager.default().allAccessPack12months_lite.isSubscribed {
  677. isSubscribed = true
  678. }
  679. } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_6months.001" {
  680. productCode = "advanced-annual-subscription-six-month"
  681. if IAPProductsManager.default().allAccessPack6months_lite.isSubscribed {
  682. isSubscribed = true
  683. }
  684. } else if productId == "com.pdfreaderpro.mac_free.member.ai_pack_1_month" {
  685. productCode = "ai-subscription-month"
  686. if IAPProductsManager.default().aiAllAccessPack1month_lite.isSubscribed {
  687. isSubscribed = true
  688. }
  689. } else if productId == "com.pdfreaderpro.mac_free.member.ai_pack_12_month" {
  690. productCode = "ai-subscription-year-trail"
  691. if IAPProductsManager.default().aiAllAccessPack12month_lite.isSubscribed {
  692. isSubscribed = true
  693. }
  694. } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_advanced_permanent_license.001" {
  695. productCode = "advanced-permanent"
  696. if IAPProductsManager.default().allAccessPackPermanent_lite.isSubscribed {
  697. isSubscribed = true
  698. }
  699. } else if productId == "com.pdfreaderpro.mac_free.member.advanced_add_devices_all_access_pack_advanced_annual.001" {
  700. productCode = "advanced-annual-subscription-single-upgrade"
  701. if IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_lite.isSubscribed {
  702. isSubscribed = true
  703. }
  704. } else if productId == "com.pdfreaderpro.mac_free.member.advanced_add_2_devices_all_access_pack_advanced_annual.001" {
  705. productCode = "advanced-annual-subscription-multi-upgrade"
  706. if IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite.isSubscribed {
  707. isSubscribed = true
  708. }
  709. }
  710. if isSubscribed {
  711. KMMemberCenterManager.manager.appStoreEquityVerification(applePayProductId: productId, transactionId: transactionId, productCode: productCode) { success, result in
  712. DispatchQueue.main.async {
  713. if success {
  714. complete(true, result)
  715. } else {
  716. complete(false, result)
  717. }
  718. }
  719. }
  720. }
  721. } else {
  722. print(NSLocalizedString("Order does not exist.", tableName: "MemberCenterLocalizable", comment: ""))
  723. }
  724. #endif
  725. #else
  726. // AppStore 付费版
  727. if let userInfo = notification.object as? SKPaymentTransaction,
  728. let transactionId = userInfo.transactionIdentifier as? String,
  729. let productId = userInfo.payment.productIdentifier as? String {
  730. print("Transaction ID: \(transactionId)")
  731. print("product ID: \(productId)")
  732. var productCode = ""
  733. var isSubscribed = false
  734. if productId == "com.pdfreaderpro.mac.ai_pack_1_month" {
  735. productCode = "ai-subscription-month"
  736. if IAPProductsManager.default().aiAllAccessPack1month_pro.isSubscribed {
  737. isSubscribed = true
  738. }
  739. } else if productId == "com.pdfreaderpro.mac.ai_pack_12_month" {
  740. productCode = "ai-subscription-year-trail"
  741. if IAPProductsManager.default().aiAllAccessPack12month_pro.isSubscribed {
  742. isSubscribed = true
  743. }
  744. } else if productId == "com.pdfreaderpro.mac.pdf_to_office_pack_permanent_license.001" {
  745. productCode = "advanced-permanent-mac-upgrade"
  746. if IAPProductsManager.default().pdfToOfficePackPermanent_pro.isSubscribed {
  747. isSubscribed = true
  748. }
  749. } else if productId == "com.pdfreaderpro.mac.all_access_pack_advanced_annual.001" {
  750. productCode = "advanced-permanent-mac-upgrade"
  751. if IAPProductsManager.default().fourDevicesAllAccessPack12months_pro.isSubscribed {
  752. isSubscribed = true
  753. }
  754. } else if productId == "com.pdfreaderpro.mac.standard_add_devices_all_access_pack_advanced_annual.001" {
  755. productCode = "advanced-annual-subscription-standard-upgrade"
  756. if IAPProductsManager.default().standardAddDevicesAllAccessPack12months_pro.isSubscribed {
  757. isSubscribed = true
  758. }
  759. } else if productId == "com.pdfreaderpro.mac.advanced_add_devices_all_access_pack_advanced_annual.001" {
  760. productCode = "advanced-annual-subscription-single-upgrade"
  761. if IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_pro.isSubscribed {
  762. isSubscribed = true
  763. }
  764. } else if productId == "com.pdfreaderpro.mac.advanced_add_2_devices_all_access_pack_advanced_annual.001" {
  765. productCode = "advanced-annual-subscription-multi-upgrade"
  766. if IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro.isSubscribed {
  767. isSubscribed = true
  768. }
  769. }
  770. if isSubscribed {
  771. KMMemberCenterManager.manager.appStoreEquityVerification(applePayProductId: productId, transactionId: transactionId, productCode: productCode) { success, result in
  772. if success {
  773. complete(true, result)
  774. } else {
  775. complete(false, result)
  776. }
  777. }
  778. }
  779. } else {
  780. print(NSLocalizedString("Order does not exist.", tableName: "MemberCenterLocalizable", comment: ""))
  781. }
  782. #endif
  783. }
  784. var isCancelAutoRenew: Bool {
  785. return IAPProductsManager.default().isCancelAutoRenew()
  786. }
  787. var isShowSale: Bool {
  788. if #available(macOS 10.14.4, *), isCancelAutoRenew {
  789. let manager = IAPProductsManager.default()
  790. let isSubscribed_newlyMonth = manager?.allAccessPackNew6months_lite.isSubscribed ?? false
  791. let isSubscribed_year = manager?.allAccessPack12months_lite.isSubscribed ?? false
  792. if isSubscribed_newlyMonth || isSubscribed_year {
  793. return false
  794. }
  795. if let info = KMAdvertisementManager.manager.info.StoreUserRecovery?.content?.first, !(info.show! as NSString).boolValue {
  796. return false
  797. }
  798. return true
  799. }
  800. return false
  801. }
  802. // MARK: Private Method
  803. /**
  804. 会员购买
  805. */
  806. private func membershipPurchase(_ type: KMPurchasedProductType) -> Void {
  807. #if !VERSION_DMG
  808. if type == .fourDevicesAllAccessPackNew6months_lite || type == .fourDevicesAllAccessPackNew12months_lite {
  809. if isPurchaseSwitch {
  810. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite, discount: isCancelAutoRenew)
  811. } else {
  812. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite, discount: isCancelAutoRenew)
  813. }
  814. } else if type == .aiAllAccessPack1month_lite {
  815. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().aiAllAccessPack1month_lite, discount: isCancelAutoRenew)
  816. } else if type == .aiAllAccessPack12month_lite {
  817. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().aiAllAccessPack12month_lite, discount: isCancelAutoRenew)
  818. } else if type == .allAccessPackPermanent_lite {
  819. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().allAccessPackPermanent_lite, discount: isCancelAutoRenew)
  820. } else if type == .advancedAddDevicesAllAccessPack12months_lite {
  821. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_lite, discount: isCancelAutoRenew)
  822. } else if type == .advancedAdd2DevicesAllAccessPack12months_lite {
  823. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite, discount: isCancelAutoRenew)
  824. } else if type == .aiAllAccessPack1month_pro {
  825. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().aiAllAccessPack1month_pro, discount: isCancelAutoRenew)
  826. } else if type == .aiAllAccessPack12month_pro {
  827. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().aiAllAccessPack12month_pro, discount: isCancelAutoRenew)
  828. } else if type == .pdfToOfficePackPermanent_pro {
  829. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().pdfToOfficePackPermanent_pro, discount: isCancelAutoRenew)
  830. } else if type == .fourDevicesAllAccessPack12months_pro {
  831. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().fourDevicesAllAccessPack12months_pro, discount: isCancelAutoRenew)
  832. } else if type == .standardAddDevicesAllAccessPack12months_pro {
  833. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().standardAddDevicesAllAccessPack12months_pro, discount: isCancelAutoRenew)
  834. } else if type == .advancedAddDevicesAllAccessPack12months_pro {
  835. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_pro, discount: isCancelAutoRenew)
  836. } else if type == .advancedAdd2DevicesAllAccessPack12months_pro {
  837. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro, discount: isCancelAutoRenew)
  838. }
  839. #endif
  840. }
  841. // MARK: Action Method
  842. /**
  843. 恢复购买
  844. */
  845. func productRestore() -> Void {
  846. IAPProductsManager.default().restoreSubscriptions()
  847. }
  848. func privacyPolicyAction() -> Void {
  849. NSWorkspace.shared.open(URL(string: "https://www.pdfreaderpro.com/privacy-policy")!)
  850. }
  851. func termOfSerAction() -> Void {
  852. NSWorkspace.shared.open(URL(string: "https://www.pdfreaderpro.com/terms_of_service")!)
  853. }
  854. // MARK: Get & Set
  855. /**
  856. 当前比较表产品列表内容
  857. */
  858. var products: [KMCompareProductType] {
  859. if state == .trial {
  860. return [.free, .freeTrial]
  861. } else if state == .dmg_Base {
  862. return [.free, .allPlatformStandard, .allPlatformAdvanced_12, .dualPlatformAdvanced]
  863. } else if state == .dmg_Upgrades1 {
  864. return [.allPlatformAdvanced_12]
  865. } else if state == .dmg_Upgrades1 {
  866. return [.allPlatformAdvanced_12]
  867. } else if state == .lite_Base {
  868. return [.free, .allPlatformAdvanced_6, .allPlatformAdvanced_12, .dualPlatformAdvanced]
  869. } else if state == .lite_MacWindows {
  870. return [.allPlatformAdvanced_12]
  871. } else if state == .pro_Base {
  872. return [.allPlatformAdvanced_12, .macPlatformAdvanced]
  873. } else if state == .pro_Advanced {
  874. return [.allPlatformAdvanced_12]
  875. }
  876. return []
  877. }
  878. /**
  879. 比较表数据源
  880. */
  881. var dataSource: [Any] {
  882. if isPurchaseSwitch {
  883. // 试用 全平台标准版年订阅 全平台高级版6/12个月订阅 Mac&Windows双平台高级版永久 MAC单平台高级版永久
  884. //MAC单平台标准版永久
  885. return [
  886. "Benefit",
  887. ["Supported platforms", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows", "mac"],
  888. ["Maximum number of accessible devices", "4 devices", "4 devices", "4 devices", "1 device", "1 device"],
  889. "PDF to Office",
  890. ["Convert PDFs to Word, HTML, TXT, JPEG or PNG files", "Only first 10 pages", "Standard", "Advanced", "Advanced", "Advanced"],
  891. ["Turn PDF to PPT, Excel, RTF, CSV, and more", "Only first 10 pages", "Only first 10 pages", "✓", "✓", "✓"],
  892. ["Convert PDF to TIFF, BMP, GIF or TGA files", "Only first 10 pages", "Only first 10 pages", "✓", "✓", "✓"],
  893. "Edit PDF",
  894. ["Add and edit text in PDF", "X", "✓", "✓", "✓", "✓"],
  895. ["Edit, crop, replace image in PDF", "X", "✓", "✓", "✓", "✓"],
  896. "OCR",
  897. ["Extract texts from image-based or scanned PDF", "X", "✓", "✓", "✓", "✓"],
  898. "Organize Pages",
  899. ["Extract, rotate, rearrange, replace, add, delete pages", "X", "✓", "✓", "✓", "✓"],
  900. ["Split PDFs into multiple files", "X", "✓", "✓", "✓", "✓"],
  901. "Advanced Editing Tools",
  902. ["Merge multiple documents into a new PDF", "Up to 2 files or 20 MB", "✓", "✓", "✓", "∞", "∞"],
  903. ["Add & edit watermark", "X", "✓", "✓", "✓", "✓"],
  904. ["Add header, footer, page numbers", "X", "✓", "✓", "✓", "✓"],
  905. ["Add Bates Number", "X", "✓", "✓", "✓", "✓"],
  906. ["Insert PDF page background by color or image", "X", "✓", "✓", "✓", "✓"],
  907. ["Create fattened copies", "X", "✓", "✓", "✓", "✓"],
  908. ["Extract Images", "X", "✓", "✓", "✓", "✓"],
  909. ["Extract tables", "Only first 10 pages", "Only first 10 pages", "✓", "✓", "✓"],
  910. ["Measuring Tools", "X", "✓", "✓", "✓", "✓"],
  911. "Fill & Sign",
  912. ["Create digital signature", "X", "✓", "✓", "✓", "✓"],
  913. ["Create & Edit & Fill Adobe Fillable PDF Forms", "X", "✓", "✓", "✓", "✓"],
  914. "Security",
  915. ["Batch encrypting PDF documents", "X", "✓", "✓", "✓", "✓"],
  916. ["PDF Password Remover", "X", "✓", "✓", "✓", "✓"],
  917. ["Redact sensitive information", "X", "✓", "✓", "✓", "✓"],
  918. "Create PDF",
  919. ["Convert JPEG, JPG, PNG, TIFF, BMP or PSD files to PDFs", "1 file", "✓", "✓", "✓", "✓"],
  920. ["Create PDFs from a scanner and iOS devices", "X", "✓", "✓", "✓", "✓"],
  921. "Annotations",
  922. ["Customize PDF stamps", "X", "✓", "✓", "✓", "✓"],
  923. ["Hyperlink", "Page Number", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email"],
  924. ["Signature", "Standard", "Advanced", "Advanced", "Advanced", "Advanced"],
  925. ["Table", "X", "✓", "✓", "✓", "✓"],
  926. "View PDF",
  927. ["Multi-tab viewer", "X", "✓", "✓", "✓", "✓"],
  928. ["Various printing types: poster, booklet, multi-page printing", "X", "✓", "✓", "✓", "✓"],
  929. ["Customize theme colors: Light Mode, Dark Mode, Sepia Mode and more", "X", "✓", "✓", "✓", "✓"],
  930. ["Split View to compare files", "X", "✓", "✓", "✓", "✓"],
  931. "Subscription Based Solution",
  932. ["Access all premium features in app", "X", "12 months", "12 months", "∞", "∞"],
  933. ["Priority customer support", "X", "✓", "✓", "✓", "✓"],
  934. ["Ad-free", "X", "✓", "✓", "✓", "✓"]
  935. ]
  936. } else {
  937. return [
  938. "Benefit",
  939. ["Supported platforms", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows", "mac"],
  940. ["Maximum number of accessible devices", "4 devices", "4 devices", "4 devices", "1 device", "1 device"],
  941. "PDF to Office",
  942. ["Convert PDFs to Word, HTML, TXT, JPEG or PNG files", "Only first 10 pages", "Standard", "Advanced", "Advanced", "Advanced"],
  943. ["Turn PDF to PPT, Excel, RTF, CSV, and more", "Only first 10 pages", "Only first 10 pages", "✓", "✓", "✓"],
  944. ["Convert PDF to TIFF, BMP, GIF or TGA files", "Only first 10 pages", "Only first 10 pages", "✓", "✓", "✓"],
  945. "Edit PDF",
  946. ["Add and edit text in PDF", "X", "✓", "✓", "✓", "✓"],
  947. ["Edit, crop, replace image in PDF", "X", "✓", "✓", "✓", "✓"],
  948. "OCR",
  949. ["Extract texts from image-based or scanned PDF", "X", "✓", "✓", "✓", "✓"],
  950. "Organize Pages",
  951. ["Extract, rotate, rearrange, replace, add, delete pages", "X", "✓", "✓", "✓", "✓"],
  952. ["Split PDFs into multiple files", "X", "✓", "✓", "✓", "✓"],
  953. "Advanced Editing Tools",
  954. ["Merge multiple documents into a new PDF", "Up to 2 files or 20 MB", "✓", "✓", "✓", "∞", "∞"],
  955. ["Add & edit watermark", "X", "✓", "✓", "✓", "✓"],
  956. ["Add header, footer, page numbers", "X", "✓", "✓", "✓", "✓"],
  957. ["Add Bates Number", "X", "✓", "✓", "✓", "✓"],
  958. ["Insert PDF page background by color or image", "X", "✓", "✓", "✓", "✓"],
  959. ["Create fattened copies", "X", "✓", "✓", "✓", "✓"],
  960. ["Extract Images", "X", "✓", "✓", "✓", "✓"],
  961. ["Extract tables", "Only first 10 pages", "Only first 10 pages", "✓", "✓", "✓"],
  962. ["Measuring Tools", "X", "✓", "✓", "✓", "✓"],
  963. "Fill & Sign",
  964. ["Create digital signature", "X", "✓", "✓", "✓", "✓"],
  965. ["Create & Edit & Fill Adobe Fillable PDF Forms", "X", "✓", "✓", "✓", "✓"],
  966. "Security",
  967. ["Batch encrypting PDF documents", "X", "✓", "✓", "✓", "✓"],
  968. ["PDF Password Remover", "X", "✓", "✓", "✓", "✓"],
  969. ["Redact sensitive information", "X", "✓", "✓", "✓", "✓"],
  970. "Create PDF",
  971. ["Convert JPEG, JPG, PNG, TIFF, BMP or PSD files to PDFs", "1 file", "✓", "✓", "✓", "✓"],
  972. ["Create PDFs from a scanner and iOS devices", "X", "✓", "✓", "✓", "✓"],
  973. "Annotations",
  974. ["Customize PDF stamps", "X", "✓", "✓", "✓", "✓"],
  975. ["Hyperlink", "Page Number", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email"],
  976. ["Signature", "Standard", "Advanced", "Advanced", "Advanced", "Advanced"],
  977. ["Table", "X", "✓", "✓", "✓", "✓"],
  978. "View PDF",
  979. ["Multi-tab viewer", "X", "✓", "✓", "✓", "✓"],
  980. ["Various printing types: poster, booklet, multi-page printing", "X", "✓", "✓", "✓", "✓"],
  981. ["Customize theme colors: Light Mode, Dark Mode, Sepia Mode and more", "X", "✓", "✓", "✓", "✓"],
  982. ["Split View to compare files", "X", "✓", "✓", "✓", "✓"],
  983. "Subscription Based Solution",
  984. ["Access all premium features in app", "X", "6 months", "6 months", "∞", "∞"],
  985. ["Priority customer support", "X", "✓", "✓", "✓", "✓"],
  986. ["Ad-free", "X", "✓", "✓", "✓", "✓"]
  987. ]
  988. }
  989. }
  990. /**
  991. 是否黑五活动期
  992. */
  993. var isBlackFive: Bool {
  994. if let loginContent = KMAdvertisementManager.manager.info.topRightInfoContent {
  995. if loginContent.content?.isEmpty == false {
  996. return true
  997. }
  998. }
  999. return false
  1000. }
  1001. }