KMProductModel.swift 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028
  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. 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 = KMStandardAnnualSubscriptionCodeKey_DMG
  516. } else if tag == 3 {
  517. if isBlackFive {
  518. code = KMAdvancedPermanentBlackFiveCodeKey_DMG
  519. } else {
  520. code = KMAdvancedPermanentCodeKey_DMG
  521. }
  522. } else {
  523. if isBlackFive {
  524. code = KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG
  525. } else {
  526. code = KMAdvancedAnnualSubscriptionCodeKey_DMG
  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(KMAdvancedAnnualSubscriptionCodeKey_DMG)
  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(KMAdvancedAnnualSubscriptionCodeKey_DMG)
  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 VERSION_FREE
  603. #if VERSION_DMG
  604. // DMG
  605. let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(KMAdvancedAnnualSubscriptionCodeKey_DMG)
  606. embeddedWC.showWindow(nil)
  607. embeddedWC.window?.center()
  608. #else
  609. // AppStore 免费版本
  610. if tag == 2 {
  611. membershipPurchase(.fourDevicesAllAccessPackNew12months_lite)
  612. }
  613. #endif
  614. #else
  615. // AppStore 付费版
  616. #endif
  617. }
  618. }
  619. func appStoreEquityVerification(_ notification: Notification,_ complete: @escaping KMMemberProductComplete) -> Void {
  620. #if VERSION_FREE
  621. #if VERSION_DMG
  622. // DMG
  623. #else
  624. // AppStore 免费版本
  625. if let userInfo = notification.object as? SKPaymentTransaction,
  626. let transactionId = userInfo.transactionIdentifier as? String,
  627. let productId = userInfo.payment.productIdentifier as? String {
  628. print("Transaction ID: \(transactionId)")
  629. print("product ID: \(productId)")
  630. var productCode = ""
  631. var isSubscribed = false
  632. if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_advanced_6months.001" {
  633. productCode = "advanced-annual-subscription-six-month"
  634. if IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite.isSubscribed {
  635. isSubscribed = true
  636. }
  637. } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_advanced_annual.001" {
  638. productCode = "advanced-annual-subscription"
  639. if IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite.isSubscribed {
  640. isSubscribed = true
  641. }
  642. } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_new_6months.001" {
  643. productCode = "advanced-annual-subscription-six-month"
  644. if IAPProductsManager.default().allAccessPackNew6months_lite.isSubscribed {
  645. isSubscribed = true
  646. }
  647. } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_12months.001" {
  648. productCode = "advanced-annual-subscription"
  649. if IAPProductsManager.default().allAccessPack12months_lite.isSubscribed {
  650. isSubscribed = true
  651. }
  652. } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_6months.001" {
  653. productCode = "advanced-annual-subscription-six-month"
  654. if IAPProductsManager.default().allAccessPack6months_lite.isSubscribed {
  655. isSubscribed = true
  656. }
  657. } else if productId == "com.pdfreaderpro.mac_free.member.ai_pack_1_month" {
  658. productCode = "ai-subscription-month"
  659. if IAPProductsManager.default().aiAllAccessPack1month_lite.isSubscribed {
  660. isSubscribed = true
  661. }
  662. } else if productId == "com.pdfreaderpro.mac_free.member.ai_pack_12_month" {
  663. productCode = "ai-subscription-year-trail"
  664. if IAPProductsManager.default().aiAllAccessPack12month_lite.isSubscribed {
  665. isSubscribed = true
  666. }
  667. } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_advanced_permanent_license.001" {
  668. productCode = "advanced-permanent"
  669. if IAPProductsManager.default().allAccessPackPermanent_lite.isSubscribed {
  670. isSubscribed = true
  671. }
  672. } else if productId == "com.pdfreaderpro.mac_free.member.advanced_add_devices_all_access_pack_advanced_annual.001" {
  673. productCode = "advanced-annual-subscription-single-upgrade"
  674. if IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_lite.isSubscribed {
  675. isSubscribed = true
  676. }
  677. } else if productId == "com.pdfreaderpro.mac_free.member.advanced_add_2_devices_all_access_pack_advanced_annual.001" {
  678. productCode = "advanced-annual-subscription-multi-upgrade"
  679. if IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite.isSubscribed {
  680. isSubscribed = true
  681. }
  682. }
  683. if isSubscribed {
  684. KMMemberCenterManager.manager.appStoreEquityVerification(applePayProductId: productId, transactionId: transactionId, productCode: productCode) { success, result in
  685. DispatchQueue.main.async {
  686. if success {
  687. complete(true, result)
  688. } else {
  689. complete(false, result)
  690. }
  691. }
  692. }
  693. }
  694. } else {
  695. print(NSLocalizedString("Order does not exist.", tableName: "MemberCenterLocalizable", comment: ""))
  696. }
  697. #endif
  698. #else
  699. // AppStore 付费版
  700. if let userInfo = notification.object as? SKPaymentTransaction,
  701. let transactionId = userInfo.transactionIdentifier as? String,
  702. let productId = userInfo.payment.productIdentifier as? String {
  703. print("Transaction ID: \(transactionId)")
  704. print("product ID: \(productId)")
  705. var productCode = ""
  706. var isSubscribed = false
  707. if productId == "com.pdfreaderpro.mac.ai_pack_1_month" {
  708. productCode = "ai-subscription-month"
  709. if IAPProductsManager.default().aiAllAccessPack1month_pro.isSubscribed {
  710. isSubscribed = true
  711. }
  712. } else if productId == "com.pdfreaderpro.mac.ai_pack_12_month" {
  713. productCode = "ai-subscription-year-trail"
  714. if IAPProductsManager.default().aiAllAccessPack12month_pro.isSubscribed {
  715. isSubscribed = true
  716. }
  717. } else if productId == "com.pdfreaderpro.mac.pdf_to_office_pack_permanent_license.001" {
  718. productCode = "advanced-permanent-mac-upgrade"
  719. if IAPProductsManager.default().pdfToOfficePackPermanent_pro.isSubscribed {
  720. isSubscribed = true
  721. }
  722. } else if productId == "com.pdfreaderpro.mac.all_access_pack_advanced_annual.001" {
  723. productCode = "advanced-permanent-mac-upgrade"
  724. if IAPProductsManager.default().fourDevicesAllAccessPack12months_pro.isSubscribed {
  725. isSubscribed = true
  726. }
  727. } else if productId == "com.pdfreaderpro.mac.standard_add_devices_all_access_pack_advanced_annual.001" {
  728. productCode = "advanced-annual-subscription-standard-upgrade"
  729. if IAPProductsManager.default().standardAddDevicesAllAccessPack12months_pro.isSubscribed {
  730. isSubscribed = true
  731. }
  732. } else if productId == "com.pdfreaderpro.mac.advanced_add_devices_all_access_pack_advanced_annual.001" {
  733. productCode = "advanced-annual-subscription-single-upgrade"
  734. if IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_pro.isSubscribed {
  735. isSubscribed = true
  736. }
  737. } else if productId == "com.pdfreaderpro.mac.advanced_add_2_devices_all_access_pack_advanced_annual.001" {
  738. productCode = "advanced-annual-subscription-multi-upgrade"
  739. if IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro.isSubscribed {
  740. isSubscribed = true
  741. }
  742. }
  743. if isSubscribed {
  744. KMMemberCenterManager.manager.appStoreEquityVerification(applePayProductId: productId, transactionId: transactionId, productCode: productCode) { success, result in
  745. if success {
  746. complete(true, result)
  747. } else {
  748. complete(false, result)
  749. }
  750. }
  751. }
  752. } else {
  753. print(NSLocalizedString("Order does not exist.", tableName: "MemberCenterLocalizable", comment: ""))
  754. }
  755. #endif
  756. }
  757. var isCancelAutoRenew: Bool {
  758. return IAPProductsManager.default().isCancelAutoRenew()
  759. }
  760. var isShowSale: Bool {
  761. if #available(macOS 10.14.4, *), isCancelAutoRenew {
  762. let manager = IAPProductsManager.default()
  763. let isSubscribed_newlyMonth = manager?.allAccessPackNew6months_lite.isSubscribed ?? false
  764. let isSubscribed_year = manager?.allAccessPack12months_lite.isSubscribed ?? false
  765. if isSubscribed_newlyMonth || isSubscribed_year {
  766. return false
  767. }
  768. if let info = KMAdvertisementManager.manager.info.StoreUserRecovery?.content?.first, !(info.show! as NSString).boolValue {
  769. return false
  770. }
  771. return true
  772. }
  773. return false
  774. }
  775. // MARK: Private Method
  776. /**
  777. 会员购买
  778. */
  779. private func membershipPurchase(_ type: KMPurchasedProductType) -> Void {
  780. #if !VERSION_DMG
  781. if type == .fourDevicesAllAccessPackNew6months_lite || type == .fourDevicesAllAccessPackNew12months_lite {
  782. if isPurchaseSwitch {
  783. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite, discount: isCancelAutoRenew)
  784. } else {
  785. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite, discount: isCancelAutoRenew)
  786. }
  787. } else if type == .aiAllAccessPack1month_lite {
  788. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().aiAllAccessPack1month_lite, discount: isCancelAutoRenew)
  789. } else if type == .aiAllAccessPack12month_lite {
  790. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().aiAllAccessPack12month_lite, discount: isCancelAutoRenew)
  791. } else if type == .allAccessPackPermanent_lite {
  792. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().allAccessPackPermanent_lite, discount: isCancelAutoRenew)
  793. } else if type == .advancedAddDevicesAllAccessPack12months_lite {
  794. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_lite, discount: isCancelAutoRenew)
  795. } else if type == .advancedAdd2DevicesAllAccessPack12months_lite {
  796. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite, discount: isCancelAutoRenew)
  797. } else if type == .aiAllAccessPack1month_pro {
  798. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().aiAllAccessPack1month_pro, discount: isCancelAutoRenew)
  799. } else if type == .aiAllAccessPack12month_pro {
  800. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().aiAllAccessPack12month_pro, discount: isCancelAutoRenew)
  801. } else if type == .pdfToOfficePackPermanent_pro {
  802. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().pdfToOfficePackPermanent_pro, discount: isCancelAutoRenew)
  803. } else if type == .fourDevicesAllAccessPack12months_pro {
  804. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().fourDevicesAllAccessPack12months_pro, discount: isCancelAutoRenew)
  805. } else if type == .standardAddDevicesAllAccessPack12months_pro {
  806. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().standardAddDevicesAllAccessPack12months_pro, discount: isCancelAutoRenew)
  807. } else if type == .advancedAddDevicesAllAccessPack12months_pro {
  808. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_pro, discount: isCancelAutoRenew)
  809. } else if type == .advancedAdd2DevicesAllAccessPack12months_pro {
  810. IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro, discount: isCancelAutoRenew)
  811. }
  812. #endif
  813. }
  814. // MARK: Action Method
  815. /**
  816. 恢复购买
  817. */
  818. func productRestore() -> Void {
  819. IAPProductsManager.default().restoreSubscriptions()
  820. }
  821. func privacyPolicyAction() -> Void {
  822. NSWorkspace.shared.open(URL(string: "https://www.pdfreaderpro.com/privacy-policy")!)
  823. }
  824. func termOfSerAction() -> Void {
  825. NSWorkspace.shared.open(URL(string: "https://www.pdfreaderpro.com/terms_of_service")!)
  826. }
  827. // MARK: Get & Set
  828. /**
  829. 当前比较表产品列表内容
  830. */
  831. var products: [KMCompareProductType] {
  832. if state == .trial {
  833. return [.free, .freeTrial]
  834. } else if state == .dmg_Base {
  835. return [.free, .allPlatformStandard, .allPlatformAdvanced_12, .dualPlatformAdvanced]
  836. } else if state == .dmg_Upgrades1 {
  837. return [.allPlatformAdvanced_12]
  838. } else if state == .dmg_Upgrades1 {
  839. return [.allPlatformAdvanced_12]
  840. } else if state == .lite_Base {
  841. return [.free, .allPlatformAdvanced_6, .allPlatformAdvanced_12, .dualPlatformAdvanced]
  842. } else if state == .lite_MacWindows {
  843. return [.allPlatformAdvanced_12]
  844. } else if state == .pro_Base {
  845. return [.allPlatformAdvanced_12, .macPlatformAdvanced]
  846. } else if state == .pro_Advanced {
  847. return [.allPlatformAdvanced_12]
  848. }
  849. return []
  850. }
  851. /**
  852. 比较表数据源
  853. */
  854. var dataSource: [Any] {
  855. if isPurchaseSwitch {
  856. // 试用 全平台标准版年订阅 全平台高级版6/12个月订阅 Mac&Windows双平台高级版永久 MAC单平台高级版永久
  857. //MAC单平台标准版永久
  858. return [
  859. "Benefit",
  860. ["Supported platforms", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows", "mac"],
  861. ["Maximum number of accessible devices", "4 devices", "4 devices", "4 devices", "2 devices", "1 devices"],
  862. "PDF to Office",
  863. ["Convert PDFs to Word, HTML, TXT, JPEG or PNG files", "Only first 10 pages", "Standard", "Advanced", "Advanced", "Advanced"],
  864. ["Turn PDF to PPT, Excel, RTF, CSV, and more", "Only first 10 pages", "Only first 10 pages", "✓", "✓", "✓"],
  865. ["Convert PDF to TIFF, BMP, GIF or TGA files", "Only first 10 pages", "Only first 10 pages", "✓", "✓", "✓"],
  866. "Edit PDF",
  867. ["Add and edit text in PDF", "X", "✓", "✓", "✓", "✓"],
  868. ["Edit, crop, replace image in PDF", "X", "✓", "✓", "✓", "✓"],
  869. "OCR",
  870. ["Extract texts from image-based or scanned PDF", "X", "✓", "✓", "✓", "✓"],
  871. "Organize Pages",
  872. ["Extract, rotate, rearrange, replace, add, delete pages", "X", "✓", "✓", "✓", "✓"],
  873. ["Split PDFs into multiple files", "X", "✓", "✓", "✓", "✓"],
  874. "Advanced Editing Tools",
  875. ["Merge multiple documents into a new PDF", "Up to 2 files or 20 MB", "✓", "✓", "✓", "∞", "∞"],
  876. ["Add & edit watermark", "X", "✓", "✓", "✓", "✓"],
  877. ["Add header, footer, page numbers", "X", "✓", "✓", "✓", "✓"],
  878. ["Add Bates Number", "X", "✓", "✓", "✓", "✓"],
  879. ["Insert PDF page background by color or image", "X", "✓", "✓", "✓", "✓"],
  880. ["Create fattened copies", "X", "✓", "✓", "✓", "✓"],
  881. ["Extract Images", "X", "✓", "✓", "✓", "✓"],
  882. ["Extract tables", "Only first 10 pages", "Only first 10 pages", "✓", "✓", "✓"],
  883. ["Measuring Tools", "X", "✓", "✓", "✓", "✓"],
  884. "Fill & Sign",
  885. ["Create digital signature", "X", "✓", "✓", "✓", "✓"],
  886. ["Create & Edit & Fill Adobe Fillable PDF Forms", "X", "✓", "✓", "✓", "✓"],
  887. "Security",
  888. ["Batch encrypting PDF documents", "X", "✓", "✓", "✓", "✓"],
  889. ["PDF Password Remover", "X", "✓", "✓", "✓", "✓"],
  890. ["Redact sensitive information", "X", "✓", "✓", "✓", "✓"],
  891. "Create PDF",
  892. ["Convert JPEG, JPG, PNG, TIFF, BMP or PSD files to PDFs", "1 file", "✓", "✓", "✓", "✓"],
  893. ["Create PDFs from a scanner and iOS devices", "X", "✓", "✓", "✓", "✓"],
  894. "Annotations",
  895. ["Customize PDF stamps", "X", "✓", "✓", "✓", "✓"],
  896. ["Hyperlink", "Page Number", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email"],
  897. ["Signature", "Standard", "Advanced", "Advanced", "Advanced", "Advanced"],
  898. ["Table", "X", "✓", "✓", "✓", "✓"],
  899. "View PDF",
  900. ["Multi-tab viewer", "X", "✓", "✓", "✓", "✓"],
  901. ["Various printing types: poster, booklet, multi-page printing", "X", "✓", "✓", "✓", "✓"],
  902. ["Customize theme colors: Light Mode, Dark Mode, Sepia Mode and more", "X", "✓", "✓", "✓", "✓"],
  903. ["Split View to compare files", "X", "✓", "✓", "✓", "✓"],
  904. "Subscription Based Solution",
  905. ["Access all premium features in app", "X", "12 months", "12 months", "∞", "∞"],
  906. ["Priority customer support", "X", "✓", "✓", "✓", "✓"],
  907. ["Ad-free", "X", "✓", "✓", "✓", "✓"]
  908. ]
  909. } else {
  910. return [
  911. "Benefit",
  912. ["Supported platforms", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows, ios, android", "mac, windows", "mac"],
  913. ["Maximum number of accessible devices", "4 devices", "4 devices", "4 devices", "2 devices", "1 devices"],
  914. "PDF to Office",
  915. ["Convert PDFs to Word, HTML, TXT, JPEG or PNG files", "Only first 10 pages", "Standard", "Advanced", "Advanced", "Advanced"],
  916. ["Turn PDF to PPT, Excel, RTF, CSV, and more", "Only first 10 pages", "Only first 10 pages", "✓", "✓", "✓"],
  917. ["Convert PDF to TIFF, BMP, GIF or TGA files", "Only first 10 pages", "Only first 10 pages", "✓", "✓", "✓"],
  918. "Edit PDF",
  919. ["Add and edit text in PDF", "X", "✓", "✓", "✓", "✓"],
  920. ["Edit, crop, replace image in PDF", "X", "✓", "✓", "✓", "✓"],
  921. "OCR",
  922. ["Extract texts from image-based or scanned PDF", "X", "✓", "✓", "✓", "✓"],
  923. "Organize Pages",
  924. ["Extract, rotate, rearrange, replace, add, delete pages", "X", "✓", "✓", "✓", "✓"],
  925. ["Split PDFs into multiple files", "X", "✓", "✓", "✓", "✓"],
  926. "Advanced Editing Tools",
  927. ["Merge multiple documents into a new PDF", "Up to 2 files or 20 MB", "✓", "✓", "✓", "∞", "∞"],
  928. ["Add & edit watermark", "X", "✓", "✓", "✓", "✓"],
  929. ["Add header, footer, page numbers", "X", "✓", "✓", "✓", "✓"],
  930. ["Add Bates Number", "X", "✓", "✓", "✓", "✓"],
  931. ["Insert PDF page background by color or image", "X", "✓", "✓", "✓", "✓"],
  932. ["Create fattened copies", "X", "✓", "✓", "✓", "✓"],
  933. ["Extract Images", "X", "✓", "✓", "✓", "✓"],
  934. ["Extract tables", "Only first 10 pages", "Only first 10 pages", "✓", "✓", "✓"],
  935. ["Measuring Tools", "X", "✓", "✓", "✓", "✓"],
  936. "Fill & Sign",
  937. ["Create digital signature", "X", "✓", "✓", "✓", "✓"],
  938. ["Create & Edit & Fill Adobe Fillable PDF Forms", "X", "✓", "✓", "✓", "✓"],
  939. "Security",
  940. ["Batch encrypting PDF documents", "X", "✓", "✓", "✓", "✓"],
  941. ["PDF Password Remover", "X", "✓", "✓", "✓", "✓"],
  942. ["Redact sensitive information", "X", "✓", "✓", "✓", "✓"],
  943. "Create PDF",
  944. ["Convert JPEG, JPG, PNG, TIFF, BMP or PSD files to PDFs", "1 file", "✓", "✓", "✓", "✓"],
  945. ["Create PDFs from a scanner and iOS devices", "X", "✓", "✓", "✓", "✓"],
  946. "Annotations",
  947. ["Customize PDF stamps", "X", "✓", "✓", "✓", "✓"],
  948. ["Hyperlink", "Page Number", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email", "Page Number, URL, Email"],
  949. ["Signature", "Standard", "Advanced", "Advanced", "Advanced", "Advanced"],
  950. ["Table", "X", "✓", "✓", "✓", "✓"],
  951. "View PDF",
  952. ["Multi-tab viewer", "X", "✓", "✓", "✓", "✓"],
  953. ["Various printing types: poster, booklet, multi-page printing", "X", "✓", "✓", "✓", "✓"],
  954. ["Customize theme colors: Light Mode, Dark Mode, Sepia Mode and more", "X", "✓", "✓", "✓", "✓"],
  955. ["Split View to compare files", "X", "✓", "✓", "✓", "✓"],
  956. "Subscription Based Solution",
  957. ["Access all premium features in app", "X", "6 months", "6 months", "∞", "∞"],
  958. ["Priority customer support", "X", "✓", "✓", "✓", "✓"],
  959. ["Ad-free", "X", "✓", "✓", "✓", "✓"]
  960. ]
  961. }
  962. }
  963. /**
  964. 是否黑五活动期
  965. */
  966. var isBlackFive: Bool {
  967. if let loginContent = KMAdvertisementManager.manager.info.topRightInfoContent {
  968. if loginContent.content?.isEmpty == false {
  969. return true
  970. }
  971. }
  972. return false
  973. }
  974. }