KMProductModel.swift 61 KB

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