KMPurchaseCompareDMGWindowController.m 63 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362
  1. //
  2. // KMPurchaseCompareDMGWindowController.m
  3. // PDF Reader Pro Edition
  4. //
  5. // Created by 王帅 on 2018/5/8.
  6. //
  7. #import "KMPurchaseCompareDMGWindowController.h"
  8. #import <PDF_Reader_Pro-Swift.h>
  9. //#import "HyperLinkButton.h"
  10. #import "KMVerificationWindowController.h"
  11. //#import "KMPurchaseCompareWindowController.h"
  12. #import "VerificationManager.h"
  13. //#import "GAIManager.h"
  14. //#import "NSImage_SKExtensions.h"
  15. //#import "KMButton.h"
  16. //#import "KMBox.h"
  17. //#import "SKInspectPublicTool.h"
  18. //#import "FMTrackEventManager.h"
  19. //#import "NSFont+Custom.h"
  20. //#import "KMToolbarItemPopViewController.h"
  21. //#import "KMRecommondManager.h"
  22. static NSString *const KMPurchaseCompareDMGHeaderCellIdentifier = @"KMPurchaseCompareDMGHeaderCell";
  23. static NSString *const KMPurchaseCompareDMGCellIdentifier = @"KMPurchaseCompareDMGCell";
  24. #pragma mark - KMPurchaseCompareDMGHeaderCell
  25. @interface KMPurchaseCompareDMGHeaderCell : NSTableCellView
  26. @property (nonatomic,assign) IBOutlet NSView *contentView;
  27. @end
  28. @implementation KMPurchaseCompareDMGHeaderCell
  29. - (void)dealloc {
  30. [NSDistributedNotificationCenter.defaultCenter removeObserver:self];
  31. }
  32. - (void)awakeFromNib {
  33. [super awakeFromNib];
  34. self.contentView.wantsLayer = YES;
  35. [self updateViewColor];
  36. [NSDistributedNotificationCenter.defaultCenter addObserver:self selector:@selector(themeChanged:) name:@"AppleInterfaceThemeChangedNotification" object: nil];
  37. }
  38. - (void)themeChanged:(NSNotification *)notification {
  39. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  40. [self updateViewColor];
  41. });
  42. }
  43. - (void)updateViewColor {
  44. NSColor *textColor = [NSColor colorWithDeviceRed:51.0/255.0 green:51.0/255.0 blue:51.0/255.0 alpha:1.0];
  45. NSColor *viewColor = [NSColor colorWithDeviceRed:55.0/255.0 green:57.0/255.0 blue:59.0/255.0 alpha:0.06];
  46. if (@available(macOS 10.14, *)) {
  47. NSAppearanceName appearanceName = [[NSApp effectiveAppearance] bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
  48. if ([appearanceName isEqualToString:NSAppearanceNameDarkAqua]) {
  49. textColor = [NSColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:0.87];
  50. viewColor = [NSColor colorWithRed:52.0/255.0 green:53.0/255.0 blue:56.0/255.0 alpha:1.0];
  51. }
  52. }
  53. self.contentView.layer.backgroundColor = viewColor.CGColor;
  54. self.textField.textColor = textColor;
  55. self.textField.font = [NSFont boldSystemFontOfSize:14.0];
  56. }
  57. @end
  58. #pragma mark - KMPurchaseCompareDMGCell
  59. @interface KMPurchaseCompareDMGCell : NSTableCellView
  60. @property (nonatomic,assign) IBOutlet NSTextField *value1Label;
  61. @property (nonatomic,assign) IBOutlet NSTextField *value2Label;
  62. @property (nonatomic,assign) IBOutlet NSImageView *value1ImageView;
  63. @property (nonatomic,assign) IBOutlet NSImageView *value2ImageView;
  64. @property (nonatomic,assign) IBOutlet NSBox *lineBox;
  65. @end
  66. @implementation KMPurchaseCompareDMGCell
  67. - (void)dealloc {
  68. [NSDistributedNotificationCenter.defaultCenter removeObserver:self];
  69. }
  70. - (void)awakeFromNib {
  71. [super awakeFromNib];
  72. [self updateViewColor];
  73. [NSDistributedNotificationCenter.defaultCenter addObserver:self selector:@selector(themeChanged:) name:@"AppleInterfaceThemeChangedNotification" object: nil];
  74. }
  75. - (void)themeChanged:(NSNotification *)notification {
  76. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  77. [self updateViewColor];
  78. });
  79. }
  80. - (void)updateViewColor {
  81. NSColor *textColor = [NSColor colorWithRed:102.0/255.0 green:102.0/255.0 blue:102.0/255.0 alpha:0.85];
  82. NSColor *lineColor = [NSColor colorWithRed:204.0/255.0 green:204.0/255.0 blue:204.0/255.0 alpha:0.4];
  83. if (@available(macOS 10.14, *)) {
  84. NSAppearanceName appearanceName = [[NSApp effectiveAppearance] bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
  85. if ([appearanceName isEqualToString:NSAppearanceNameDarkAqua]) {
  86. textColor = [NSColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:0.6];
  87. lineColor = [NSColor colorWithRed:0.0/255.0 green:0.0/255.0 blue:0.0/255.0 alpha:0.4];
  88. }
  89. }
  90. self.value1Label.textColor = self.value2Label.textColor = textColor;
  91. self.lineBox.fillColor = lineColor;
  92. self.textField.textColor = textColor;
  93. }
  94. @end
  95. #pragma mark - KMPurchaseCompareDMGWindowController
  96. @interface KMPurchaseCompareDMGWindowController ()
  97. @property (nonatomic, assign) IBOutlet NSTextField *titleLabel;
  98. @property (assign) IBOutlet HyperLinkButton *enterLicenseButton;
  99. @property (assign) IBOutlet NSView *freeContendView;
  100. @property (assign) IBOutlet NSView *freeVersionBGView;
  101. @property (assign) IBOutlet NSTextField *freeVersionLbl;
  102. @property (assign) IBOutlet NSView *freeVersionLineView;
  103. @property (assign) IBOutlet NSTextField *freeVersionInfoLbl1;
  104. @property (assign) IBOutlet NSTextField *freeVersionInfoLbl2;
  105. @property (assign) IBOutlet NSTextField *freeVersionInfoLbl3;
  106. @property (assign) IBOutlet NSTextField *freeVersionInfoLbl4;
  107. @property (assign) IBOutlet NSTextField *freeVersionInfoLbl5;
  108. @property (assign) IBOutlet NSTextField *freeVersionInfoLbl6;
  109. @property (assign) IBOutlet NSTextField *freeVersionInfoLbl7;
  110. @property (assign) IBOutlet NSTextField *freeVersionInfoLbl8;
  111. @property (weak) IBOutlet NSTextField *freeVersionInfoLbl10;
  112. @property (assign) IBOutlet NSView *parmanentVerBGView;
  113. @property (assign) IBOutlet NSTextField *parmanentVerLbl;
  114. @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl1;
  115. @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl2;
  116. @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl3;
  117. @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl4;
  118. @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl5;
  119. @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl6;
  120. @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl7;
  121. @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl8;
  122. @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl9;
  123. @property (weak) IBOutlet NSImageView *parmanentVerInfoImage1;
  124. @property (weak) IBOutlet NSTextField *parmanentVerInfoLbl10;
  125. @property (assign) IBOutlet KMButton *parmanentVerInfoBtn2;
  126. @property (assign) IBOutlet NSImageView *parmanentVerinfoimg2;
  127. @property (assign) IBOutlet NSView *parmanentInfoView;
  128. @property (assign) IBOutlet NSImageView *discountTipImage;
  129. @property (assign) IBOutlet NSTextField *oneTimeTipLbl;
  130. @property (assign) IBOutlet NSBox *freeTrialBox;
  131. @property (assign) IBOutlet KMButton *freeTrialButton;
  132. @property (assign) IBOutlet NSBox *buyNowBox;
  133. @property (assign) IBOutlet KMButton *buyNowButton;
  134. @property (assign) IBOutlet NSView *aiContendView;
  135. @property (assign) IBOutlet NSView *aiSepLineView;
  136. @property (assign) IBOutlet NSTextField *aiTitleLabel;
  137. @property (assign) IBOutlet NSTextField *aiInfoLbl1;
  138. @property (assign) IBOutlet NSTextField *aiInfoLbl2;
  139. @property (assign) IBOutlet NSTextField *aiInfoLbl3;
  140. @property (assign) IBOutlet NSTextField *aiInfoLbl4;
  141. @property (assign) IBOutlet NSTextField *aiPurchaseLabel;
  142. @property (assign) IBOutlet KMButton *aiPurchaseButton;
  143. @property (weak) IBOutlet NSTextField *premiumLabel;
  144. @property (weak) IBOutlet NSTextField *permanentLabel;
  145. @property (weak) IBOutlet NSSwitch *buySwitch;
  146. @property (weak) IBOutlet NSTextField *discountPriceLabel;
  147. @property (weak) IBOutlet NSTextField *originalPriceLabel;
  148. @property (weak) IBOutlet NSTextField *discountPriceLabel2;
  149. @property (nonatomic, assign) NSModalSession modalSession;
  150. @property (nonatomic, retain) NSArray *dataSource;
  151. @property (nonatomic, retain) NSPopover *popOver;
  152. - (NSString *)_buyNowEventToPaidEventName;
  153. - (NSDictionary *)_getPaidEventParamsWith:(NSString *)eventN;
  154. @property (nonatomic, retain) AccountCenterWindowController *winC;
  155. @end
  156. @implementation KMPurchaseCompareDMGWindowController
  157. #pragma mark Init Methods
  158. - (id)init {
  159. if (self = [super initWithWindowNibName:@"KMPurchaseCompareDMGWindowController"]) {
  160. }
  161. return self;
  162. }
  163. - (void)dealloc {
  164. [[NSNotificationCenter defaultCenter] removeObserver:self];
  165. [NSDistributedNotificationCenter.defaultCenter removeObserver:self];
  166. }
  167. - (void)windowDidLoad {
  168. [super windowDidLoad];
  169. self.window.movableByWindowBackground = YES;
  170. self.window.backgroundColor = [NSColor whiteColor];
  171. __block typeof(self) blockSelf = self;
  172. [self.freeVersionInfoLbl2 setEnabled:YES];
  173. self.freeVersionLineView.wantsLayer = YES;
  174. self.premiumLabel.stringValue = NSLocalizedString(@"Premium", nil);
  175. self.premiumLabel.textColor = [NSColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:0.7];
  176. self.premiumLabel.font = [NSFont SFProTextRegularFont:14.0];
  177. self.permanentLabel.stringValue = NSLocalizedString(@"Permanent", nil);
  178. self.permanentLabel.textColor = [NSColor colorWithRed:255.0/255.0 green:94.0/255.0 blue:44.0/255.0 alpha:1.0];
  179. self.permanentLabel.font = [NSFont SFProTextRegularFont:14.0];
  180. self.discountPriceLabel.textColor = [NSColor colorWithRed:255.0/255.0 green:231.0/255.0 blue:106.0/255.0 alpha:1.0];
  181. self.discountPriceLabel.font = [NSFont fontWithName:@"Ubuntu" size:36.0];
  182. self.originalPriceLabel.textColor = [NSColor whiteColor];
  183. self.originalPriceLabel.font = [NSFont fontWithName:@"Ubuntu" size:14.0];
  184. self.discountPriceLabel2.textColor = [NSColor colorWithRed:255.0/255.0 green:231.0/255.0 blue:106.0/255.0 alpha:1.0];
  185. self.discountPriceLabel2.font = [NSFont fontWithName:@"Ubuntu" size:36.0];
  186. [self.discountPriceLabel2 setHidden:YES];
  187. self.freeVersionLbl.stringValue = NSLocalizedString(@"Free Version", nil);
  188. // self.parmanentVerLbl.stringValue = NSLocalizedString(@"Permanent License", nil);
  189. self.parmanentVerLbl.stringValue = NSLocalizedString(@"VIP", nil);
  190. self.freeVersionInfoLbl1.stringValue = self.parmanentVerInfoLbl1.stringValue = NSLocalizedString(@"View PDFs", nil);
  191. self.freeVersionInfoLbl2.stringValue = NSLocalizedString(@"Annotate PDFs (basic)", nil);
  192. self.parmanentVerInfoLbl2.stringValue = NSLocalizedString(@"Annotate PDFs (advanced)", nil);
  193. self.freeVersionInfoLbl3.stringValue = self.parmanentVerInfoLbl3.stringValue = NSLocalizedString(@"Unlimited file conversion", nil);
  194. self.freeVersionInfoLbl4.stringValue = self.parmanentVerInfoLbl4.stringValue = NSLocalizedString(@"Edit PDF text and images", nil);
  195. self.freeVersionInfoLbl5.stringValue = self.parmanentVerInfoLbl5.stringValue = NSLocalizedString(@"Digital signature", nil);
  196. self.freeVersionInfoLbl6.stringValue = self.parmanentVerInfoLbl6.stringValue = NSLocalizedString(@"Organize pages", nil);
  197. self.freeVersionInfoLbl7.stringValue = self.parmanentVerInfoLbl7.stringValue = NSLocalizedString(@"Batch process", nil);
  198. self.freeVersionInfoLbl8.stringValue = self.parmanentVerInfoLbl8.stringValue = NSLocalizedString(@"OCR PDFs", nil);
  199. // self.freeVersionInfoLbl9.stringValue = self.parmanentVerInfoLbl9.stringValue = NSLocalizedString(@"Measuring Tools", nil);
  200. self.freeVersionInfoLbl10.stringValue = self.parmanentVerInfoLbl10.stringValue = NSLocalizedString(@"Ad-free", nil);
  201. [self refreshParmanentVerInfo];
  202. // self.parmanentVerinfoimg2.toolTip = NSLocalizedString(@"Support insert links and custom stamps", nil);
  203. self.parmanentVerInfoBtn2.mouseMoveCallback = ^(BOOL mouseEntered) {
  204. if (mouseEntered) {
  205. KMToolbarItemPopViewController *popViewController = [[KMToolbarItemPopViewController alloc] init];
  206. self.popOver = [[NSPopover alloc] init];
  207. self.popOver.contentViewController = popViewController;
  208. self.popOver.animates = NO;
  209. self.popOver.behavior = NSPopoverBehaviorSemitransient;
  210. self.popOver.contentSize = popViewController.view.frame.size;
  211. [popViewController updateWithHelpTipWithHelpTip:NSLocalizedString(@"Support insert links and custom stamps", nil)];
  212. [self.popOver showRelativeToRect:self.parmanentVerInfoBtn2.frame ofView:self.parmanentInfoView preferredEdge:NSRectEdgeMaxY];
  213. // self.parmanentVerinfoimg2.image = [NSImage imageNamed:@"ic_Tooltip_hover"];
  214. } else {
  215. [self.popOver close];
  216. // self.parmanentVerinfoimg2.image = [NSImage imageNamed:@"ic_Tooltip"];
  217. }
  218. };
  219. self.oneTimeTipLbl.hidden = true;
  220. self.oneTimeTipLbl.stringValue = NSLocalizedString(@"one-time purchase", nil);
  221. self.enterLicenseButton.hidden = true;
  222. self.enterLicenseButton.title = NSLocalizedString(@"Enter License", nil);
  223. [self.enterLicenseButton setTitleColor:[KMAppearance KMColor_Layout_W0]];
  224. self.enterLicenseButton.mouseMoveCallback = ^(BOOL mouseEntered) {
  225. if (mouseEntered) {
  226. [blockSelf.enterLicenseButton setTitleColor:[KMAppearance KMColor_Layout_W70]];
  227. } else {
  228. [blockSelf.enterLicenseButton setTitleColor:[KMAppearance KMColor_Layout_W0]];
  229. }
  230. };
  231. self.titleLabel.font = [NSFont SFMediumFontWithSize:20];
  232. self.freeVersionLbl.font = [NSFont UbuntuBoldFontWithSize:24];
  233. self.parmanentVerLbl.font = [NSFont UbuntuBoldFontWithSize:24];
  234. self.freeVersionInfoLbl1.font = self.parmanentVerInfoLbl1.font = [NSFont SFProTextRegularFont:14.];
  235. self.freeVersionInfoLbl2.font = [NSFont SFProTextRegularFont:14.];
  236. self.parmanentVerInfoLbl2.font = [NSFont SFProTextRegularFont:14.];
  237. self.freeVersionInfoLbl3.font = self.parmanentVerInfoLbl3.font = [NSFont SFProTextRegularFont:14.];
  238. self.freeVersionInfoLbl4.font = self.parmanentVerInfoLbl4.font = [NSFont SFProTextRegularFont:14.];
  239. self.freeVersionInfoLbl5.font = self.parmanentVerInfoLbl5.font = [NSFont SFProTextRegularFont:14.];
  240. self.freeVersionInfoLbl6.font = self.parmanentVerInfoLbl6.font = [NSFont SFProTextRegularFont:14.];
  241. self.freeVersionInfoLbl7.font = self.parmanentVerInfoLbl7.font = [NSFont SFProTextRegularFont:14.];
  242. self.freeVersionInfoLbl8.font = self.parmanentVerInfoLbl8.font = [NSFont SFProTextRegularFont:14.];
  243. // self.freeVersionInfoLbl9.font = self.parmanentVerInfoLbl9.font = [NSFont SFProTextRegularFont:14.];
  244. self.freeVersionInfoLbl10.font = self.parmanentVerInfoLbl10.font = [NSFont SFProTextRegularFont:14.];
  245. self.buyNowButton.font = [NSFont UbuntuMediumFontWithSize:16];
  246. self.freeTrialButton.font = [NSFont UbuntuMediumFontWithSize:16];
  247. self.freeContendView.wantsLayer = YES;
  248. self.freeContendView.layer.cornerRadius = 12;
  249. self.freeContendView.layer.masksToBounds = YES;
  250. self.parmanentVerBGView.wantsLayer = YES;
  251. self.parmanentVerBGView.layer.cornerRadius = 12;
  252. self.parmanentVerBGView.layer.masksToBounds = YES;
  253. self.buyNowBox.wantsLayer = YES;
  254. self.buyNowBox.fillColor = [NSColor colorWithRed:255/255. green:94/255. blue:44/255. alpha:1.];
  255. self.buyNowBox.cornerRadius = CGRectGetHeight(self.buyNowBox.frame)/2.;
  256. self.buyNowBox.layer.masksToBounds = YES;
  257. self.buyNowButton.wantsLayer = YES;
  258. self.buyNowButton.layer.cornerRadius = 1.0;
  259. self.buyNowButton.title = NSLocalizedString(@"Buy Now", nil);
  260. self.buyNowButton.mouseMoveCallback = ^(BOOL mouseEntered) {
  261. if (mouseEntered) {
  262. blockSelf.buyNowButton.layer.backgroundColor = [[NSColor blackColor] colorWithAlphaComponent:0.15].CGColor;
  263. } else {
  264. blockSelf.buyNowButton.layer.backgroundColor = [NSColor clearColor].CGColor;
  265. }
  266. };
  267. self.freeTrialBox.cornerRadius = CGRectGetHeight(self.freeTrialBox.frame)/2.;
  268. self.freeTrialBox.borderWidth = 1.;
  269. self.freeTrialButton.target = self;
  270. self.freeTrialButton.action = @selector(buttonItemClicked_License:);
  271. self.freeTrialButton.mouseMoveCallback = ^(BOOL mouseEntered) {
  272. if ([KMAppearance isDarkMode]) {
  273. if (mouseEntered) {
  274. blockSelf.freeTrialBox.fillColor = [NSColor colorWithRed:179/255. green:159/255. blue:1 alpha:0.2];
  275. } else {
  276. blockSelf.freeTrialBox.fillColor = [NSColor colorWithRed:179/255. green:159/255. blue:1 alpha:0.07];
  277. }
  278. } else {
  279. if (mouseEntered) {
  280. blockSelf.freeTrialBox.fillColor = [NSColor colorWithRed:85/255. green:40/255. blue:1 alpha:0.15];
  281. } else {
  282. blockSelf.freeTrialBox.fillColor = [NSColor colorWithRed:85/255. green:40/255. blue:1 alpha:0.07];
  283. }
  284. }
  285. };
  286. self.discountTipImage.hidden = YES;
  287. [self updatePriceLabel];
  288. self.aiSepLineView.wantsLayer = YES;
  289. self.aiInfoLbl1.font = self.aiInfoLbl2.font = self.aiInfoLbl3.font = self.aiInfoLbl4.font = [NSFont SFProTextRegularFont:14];
  290. self.aiPurchaseLabel.font = [NSFont UbuntuMediumFontWithSize:16];
  291. self.aiTitleLabel.stringValue = NSLocalizedString(@"AI Tools Title", nil);
  292. self.aiInfoLbl1.stringValue = NSLocalizedString(@"AI Summarize", nil);
  293. self.aiInfoLbl2.stringValue = NSLocalizedString(@"AI Rewrite", nil);
  294. self.aiInfoLbl3.stringValue = NSLocalizedString(@"AI Proofread", nil);
  295. self.aiInfoLbl4.stringValue = NSLocalizedString(@"AI Translate", nil);
  296. self.aiPurchaseLabel.stringValue = NSLocalizedString(@"Buy Now", nil);
  297. self.aiPurchaseButton.wantsLayer = YES;
  298. self.aiPurchaseButton.layer.cornerRadius = CGRectGetHeight(self.aiPurchaseButton.frame)/2.;
  299. self.aiPurchaseButton.layer.masksToBounds = YES;
  300. self.aiPurchaseButton.mouseMoveCallback = ^(BOOL mouseEntered) {
  301. if (mouseEntered) {
  302. self.aiPurchaseButton.layer.backgroundColor = [[NSColor whiteColor] colorWithAlphaComponent:0.2].CGColor;
  303. } else {
  304. self.aiPurchaseButton.layer.backgroundColor = [NSColor clearColor].CGColor;
  305. }
  306. };
  307. self.aiContendView.hidden = YES;
  308. [self updateViewColor];
  309. [self updatePurchaseInformation];
  310. [NSDistributedNotificationCenter.defaultCenter addObserver:self selector:@selector(themeChanged:) name:@"AppleInterfaceThemeChangedNotification" object: nil];
  311. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(recommondInfoUpdateNoti:) name:@"KMRecommondInfoUpdateNoti" object:nil];
  312. }
  313. #pragma mark - Private Methods
  314. - (void)updateViewColor {
  315. if ([KMAppearance isDarkMode]) {
  316. self.freeContendView.layer.backgroundColor = [[NSColor blackColor] colorWithAlphaComponent:0.3].CGColor;
  317. self.freeVersionLineView.layer.backgroundColor = [[NSColor whiteColor] colorWithAlphaComponent:0.1].CGColor;
  318. self.aiSepLineView.layer.backgroundColor = [[NSColor whiteColor] colorWithAlphaComponent:0.1].CGColor;
  319. self.freeVersionLbl.textColor = [[NSColor whiteColor] colorWithAlphaComponent:0.5];
  320. self.freeTrialBox.fillColor = [NSColor colorWithRed:179/255. green:159/255. blue:1 alpha:0.07];
  321. self.freeTrialBox.borderColor = [NSColor colorWithRed:207/255. green:146/255. blue:1 alpha:1];
  322. self.freeVersionInfoLbl1.textColor =
  323. self.freeVersionInfoLbl2.textColor =
  324. self.freeVersionInfoLbl3.textColor =
  325. self.freeVersionInfoLbl4.textColor =
  326. self.freeVersionInfoLbl5.textColor =
  327. self.freeVersionInfoLbl6.textColor =
  328. self.freeVersionInfoLbl7.textColor =
  329. // self.freeVersionInfoLbl8.textColor =
  330. self.freeVersionInfoLbl8.textColor =
  331. // self.freeVersionInfoLbl9.textColor =
  332. self.freeVersionInfoLbl10.textColor = [NSColor whiteColor];
  333. self.parmanentVerInfoLbl1.textColor =
  334. self.parmanentVerInfoLbl2.textColor =
  335. self.parmanentVerInfoLbl3.textColor =
  336. self.parmanentVerInfoLbl4.textColor =
  337. self.parmanentVerInfoLbl5.textColor =
  338. self.parmanentVerInfoLbl6.textColor =
  339. self.parmanentVerInfoLbl7.textColor =
  340. self.parmanentVerInfoLbl8.textColor =
  341. self.parmanentVerInfoLbl9.textColor =
  342. self.parmanentVerInfoLbl10.textColor = [NSColor whiteColor];
  343. self.aiInfoLbl1.textColor = self.aiInfoLbl2.textColor = self.aiInfoLbl3.textColor = self.aiInfoLbl4.textColor = [NSColor whiteColor];
  344. self.aiPurchaseLabel.textColor = [NSColor whiteColor];
  345. self.aiTitleLabel.textColor = [NSColor colorWithRed:239/255. green:235/255. blue:255/255. alpha:1];
  346. } else {
  347. self.freeContendView.layer.backgroundColor = [[NSColor whiteColor] colorWithAlphaComponent:0.7].CGColor;
  348. self.freeVersionLineView.layer.backgroundColor = [NSColor colorWithRed:0 green:33/255. blue:67/255. alpha:0.1].CGColor;
  349. self.aiSepLineView.layer.backgroundColor = [NSColor colorWithRed:0 green:33/255. blue:67/255. alpha:0.1].CGColor;
  350. self.freeVersionLbl.textColor = [NSColor colorWithRed:129/255. green:125/255. blue:178/255. alpha:1.];
  351. self.freeTrialBox.fillColor = [NSColor colorWithRed:85/255. green:40/255. blue:1 alpha:0.07];
  352. self.freeTrialBox.borderColor = [NSColor colorWithRed:160/255. green:40/255. blue:1 alpha:1];
  353. self.freeVersionInfoLbl1.textColor =
  354. self.freeVersionInfoLbl2.textColor =
  355. self.freeVersionInfoLbl3.textColor =
  356. self.freeVersionInfoLbl4.textColor =
  357. self.freeVersionInfoLbl5.textColor =
  358. self.freeVersionInfoLbl6.textColor =
  359. self.freeVersionInfoLbl7.textColor =
  360. self.freeVersionInfoLbl8.textColor =
  361. self.aiInfoLbl1.textColor = self.aiInfoLbl2.textColor = self.aiInfoLbl3.textColor = self.aiInfoLbl4.textColor = [NSColor colorWithRed:20/255. green:0 blue:102/255. alpha:1];
  362. // self.freeVersionInfoLbl9.textColor =
  363. self.freeVersionInfoLbl10.textColor = [NSColor colorWithRed:20/255.0 green:0/255.0 blue:102/255.0 alpha:1];
  364. self.parmanentVerInfoLbl1.textColor =
  365. self.parmanentVerInfoLbl2.textColor =
  366. self.parmanentVerInfoLbl3.textColor =
  367. self.parmanentVerInfoLbl4.textColor =
  368. self.parmanentVerInfoLbl5.textColor =
  369. self.parmanentVerInfoLbl6.textColor =
  370. self.parmanentVerInfoLbl7.textColor =
  371. self.parmanentVerInfoLbl8.textColor = [NSColor whiteColor];
  372. self.parmanentVerInfoLbl8.textColor =
  373. self.parmanentVerInfoLbl9.textColor =
  374. self.parmanentVerInfoLbl10.textColor = [NSColor whiteColor];
  375. self.aiPurchaseLabel.textColor = [NSColor whiteColor];
  376. self.aiTitleLabel.textColor = [NSColor colorWithRed:20/255. green:0 blue:102/255. alpha:1];
  377. }
  378. self.parmanentVerLbl.textColor = [NSColor colorWithRed:252/255. green:253/255. blue:255/255. alpha:1.];
  379. self.oneTimeTipLbl.textColor = [NSColor colorWithRed:255/255. green:231/255. blue:106/255. alpha:1.];
  380. if ([KMAppearance isDarkMode]) {
  381. [self.freeTrialButton setTitleColor:[NSColor colorWithRed:178/255. green:165/255. blue:1 alpha:1]];
  382. } else {
  383. [self.freeTrialButton setTitleColor:[NSColor colorWithRed:160/255. green:40/255. blue:1 alpha:1]];
  384. }
  385. }
  386. - (void)updatePurchaseInformation {
  387. self.freeTrialBox.hidden = NO;
  388. self.titleLabel.stringValue = NSLocalizedString(@"Upgrade to authorized Pro version", nil);
  389. self.titleLabel.textColor = [NSColor whiteColor];
  390. [self.freeTrialButton setTitle:NSLocalizedString(@"7-day Free Trial", nil)];
  391. if (ActivityStatusVerification == [VerificationManager manager].status) {
  392. self.freeTrialBox.hidden = YES;
  393. } else if (ActivityStatusNone == [VerificationManager manager].status) {
  394. } else if (ActivityStatusTrialExpire == [VerificationManager manager].status) {
  395. self.freeTrialBox.hidden = YES;
  396. if ([VerificationManager manager].secondTrialEnabled) {
  397. self.freeTrialBox.hidden = NO;
  398. }
  399. } else {
  400. self.freeTrialBox.hidden = YES;
  401. }
  402. if ([KMAppearance isDarkMode]) {
  403. [self.freeTrialButton setTitleColor:[NSColor colorWithRed:178/255. green:165/255. blue:1 alpha:1]];
  404. } else {
  405. [self.freeTrialButton setTitleColor:[NSColor colorWithRed:160/255. green:40/255. blue:1 alpha:1]];
  406. }
  407. [self.buyNowButton setTitleColor:[NSColor whiteColor]];
  408. [self updatePriceLabel];
  409. }
  410. - (void)updatePriceLabel {
  411. NSString *originalText = @"";
  412. NSString *discountText = @"";
  413. #if VERSION_DMG
  414. NSString *abbreviation = @"$";
  415. if ([@"CNY" isEqualToString:NSLocalizedString(@"USD", nil)]) {
  416. abbreviation = @"¥";
  417. }
  418. if ([self.buySwitch state]) {
  419. originalText = [NSString stringWithFormat:@"%@%@", abbreviation, [[KMDMGProductsManager shareInstance] getPrice:@"com.brother.pdfreaderpro.mac.product_3"]];
  420. discountText = [NSString stringWithFormat:@"%@%@", abbreviation, [[KMDMGProductsManager shareInstance] getActivityPrice:@"com.brother.pdfreaderpro.mac.product_3"]];
  421. } else {
  422. originalText = [NSString stringWithFormat:@"%@%@", abbreviation, [[KMDMGProductsManager shareInstance] getPrice:@"com.brother.pdfreaderpro.mac.product_1"]];
  423. discountText = [NSString stringWithFormat:@"%@%@", abbreviation, [[KMDMGProductsManager shareInstance] getActivityPrice:@"com.brother.pdfreaderpro.mac.product_1"]];
  424. }
  425. #endif
  426. NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:originalText];
  427. [attributedText addAttribute:NSStrikethroughStyleAttributeName
  428. value:@(NSUnderlineStyleSingle)
  429. range:NSMakeRange(0, originalText.length)];
  430. self.originalPriceLabel.attributedStringValue = attributedText;
  431. self.discountPriceLabel.stringValue = discountText;
  432. self.discountPriceLabel2.stringValue = discountText;
  433. if (KMAdvertisementManager.manager.info.discountContent.content.count > 0) {
  434. KMAdvertisementItemInfo *info = KMAdvertisementManager.manager.info.discountContent.content.firstObject;
  435. if ([KMAdvertisementManager checkAdvertisementValid:info]) {
  436. self.discountTipImage.hidden = NO;
  437. NSURL *url = [NSURL URLWithString:[KMAdvertisementModelTransition transitionImagePathWithImage:info.image highlight:NO]];
  438. self.discountTipImage.image = [KMAdvertisementImage imageWithURLWithUrl:url completion:^(NSImage * _Nonnull image) {
  439. self.discountTipImage.image = image;
  440. }];
  441. if ([originalText isEqualToString:discountText]) {
  442. [self.originalPriceLabel setHidden:YES];
  443. [self.discountPriceLabel setHidden:YES];
  444. [self.discountPriceLabel2 setHidden:NO];
  445. [self.discountTipImage setHidden:YES];
  446. } else {
  447. [self.originalPriceLabel setHidden:NO];
  448. [self.discountPriceLabel setHidden:NO];
  449. [self.discountPriceLabel2 setHidden:YES];
  450. [self.discountTipImage setHidden:NO];
  451. }
  452. } else {
  453. self.discountTipImage.hidden = YES;
  454. if ([originalText isEqualToString:discountText]) {
  455. [self.originalPriceLabel setHidden:YES];
  456. [self.discountPriceLabel setHidden:YES];
  457. [self.discountPriceLabel2 setHidden:NO];
  458. } else {
  459. [self.originalPriceLabel setHidden:NO];
  460. [self.discountPriceLabel setHidden:NO];
  461. [self.discountPriceLabel2 setHidden:YES];
  462. }
  463. }
  464. }
  465. }
  466. //- (void)updatePriceLabel {
  467. // NSString *originalText = @"";
  468. // NSString *discountText = @"";
  469. // if ([@"USD" isEqualToString:NSLocalizedString(@"USD", nil)]) {
  470. //#if VERSION_DMG
  471. // if ([self.buySwitch state]) {
  472. // originalText = [NSString stringWithFormat:@"$%@", [[KMDMGProductsManager shareInstance] getPrice:@"com.brother.pdfreaderpro.mac.product_3"]];
  473. // discountText = [NSString stringWithFormat:@"$%@", [[KMDMGProductsManager shareInstance] getActivityPrice:@"com.brother.pdfreaderpro.mac.product_3"]];
  474. // } else {
  475. // originalText = [NSString stringWithFormat:@"$%@", [[KMDMGProductsManager shareInstance] getPrice:@"com.brother.pdfreaderpro.mac.product_1"]];
  476. // discountText = [NSString stringWithFormat:@"$%@", [[KMDMGProductsManager shareInstance] getActivityPrice:@"com.brother.pdfreaderpro.mac.product_1"]];
  477. // }
  478. //#endif
  479. // } else {
  480. //#if VERSION_DMG
  481. // if ([self.buySwitch state]) {
  482. // originalText = [NSString stringWithFormat:@"¥%@", [[KMDMGProductsManager shareInstance] getPriceCNY:@"com.brother.pdfreaderpro.mac.product_3"]];
  483. // discountText = [NSString stringWithFormat:@"¥%@", [[KMDMGProductsManager shareInstance] getActivityPriceCNY:@"com.brother.pdfreaderpro.mac.product_3"]];
  484. // } else {
  485. // originalText = [NSString stringWithFormat:@"¥%@", [[KMDMGProductsManager shareInstance] getPriceCNY:@"com.brother.pdfreaderpro.mac.product_1"]];
  486. // discountText = [NSString stringWithFormat:@"¥%@", [[KMDMGProductsManager shareInstance] getActivityPriceCNY:@"com.brother.pdfreaderpro.mac.product_1"]];
  487. // }
  488. //#endif
  489. // }
  490. // NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:originalText];
  491. // [attributedText addAttribute:NSStrikethroughStyleAttributeName
  492. // value:@(NSUnderlineStyleSingle)
  493. // range:NSMakeRange(0, originalText.length)];
  494. // self.originalPriceLabel.attributedStringValue = attributedText;
  495. // self.discountPriceLabel.stringValue = discountText;
  496. //
  497. // if ([originalText isEqualToString:discountText]) {
  498. // [self.originalPriceLabel setHidden:YES];
  499. // } else {
  500. // [self.originalPriceLabel setHidden:NO];
  501. // }
  502. //}
  503. - (void)refreshParmanentVerInfo {
  504. if ([self.buySwitch state] == NSControlStateValueOn) {
  505. self.parmanentVerInfoLbl1.stringValue = NSLocalizedString(@"View PDFs", nil);
  506. self.parmanentVerInfoLbl2.stringValue = NSLocalizedString(@"Annotate PDFs (advanced)", nil);
  507. self.parmanentVerInfoLbl3.stringValue = NSLocalizedString(@"Unlimited file conversion", nil);
  508. self.parmanentVerInfoLbl4.stringValue = NSLocalizedString(@"Edit PDF text and images", nil);
  509. self.parmanentVerInfoLbl5.stringValue = NSLocalizedString(@"Digital signature", nil);
  510. self.parmanentVerInfoLbl6.stringValue = NSLocalizedString(@"Organize pages", nil);
  511. self.parmanentVerInfoLbl7.stringValue = NSLocalizedString(@"Batch process", nil);
  512. self.parmanentVerInfoLbl8.stringValue = NSLocalizedString(@"OCR PDFs", nil);
  513. self.parmanentVerInfoLbl9.stringValue = NSLocalizedString(@"Measuring Tools", nil);
  514. self.parmanentVerInfoLbl10.stringValue = NSLocalizedString(@"Ad-free", nil);
  515. self.parmanentVerInfoImage1.image = [NSImage imageNamed:@"function_vip"];
  516. } else {
  517. self.parmanentVerInfoLbl1.stringValue = NSLocalizedString(@"Unlimited file conversion", nil);
  518. self.parmanentVerInfoLbl2.stringValue = NSLocalizedString(@"Annotate PDFs (advanced)", nil);
  519. self.parmanentVerInfoLbl3.stringValue = NSLocalizedString(@"View PDFs", nil);
  520. self.parmanentVerInfoLbl4.stringValue = NSLocalizedString(@"Edit PDF text and images", nil);
  521. self.parmanentVerInfoLbl5.stringValue = NSLocalizedString(@"Digital signature", nil);
  522. self.parmanentVerInfoLbl6.stringValue = NSLocalizedString(@"Organize pages", nil);
  523. self.parmanentVerInfoLbl7.stringValue = NSLocalizedString(@"Batch process", nil);
  524. self.parmanentVerInfoLbl8.stringValue = NSLocalizedString(@"OCR PDFs", nil);
  525. self.parmanentVerInfoLbl9.stringValue = NSLocalizedString(@"Measuring Tools", nil);
  526. self.parmanentVerInfoLbl10.stringValue = NSLocalizedString(@"Ad-free", nil);
  527. self.parmanentVerInfoImage1.image = [NSImage imageNamed:@"compare_nosupport"];
  528. }
  529. }
  530. #pragma mark - Window Method
  531. - (void)showWindow:(id)sender {
  532. __block NSWindow *mainWin = NSApp.mainWindow;
  533. if ([AccountManager.manager isLogin] == false && mainWin != nil && mainWin.isVisible) {
  534. dispatch_async(dispatch_get_main_queue(), ^{
  535. NSWindow *sheetWin = mainWin.attachedSheet;
  536. if (sheetWin != nil && sheetWin.isVisible) {
  537. mainWin = sheetWin;
  538. }
  539. if (self.winC.window.isVisible) {
  540. return;
  541. }
  542. AccountCenterWindowController *winC = [[AccountCenterWindowController alloc] init];
  543. self.winC = winC;
  544. [mainWin beginSheet:winC.window completionHandler:^(NSModalResponse returnCode) {
  545. }];
  546. });
  547. return;
  548. }
  549. [super showWindow:nil];
  550. [self.window center];
  551. [self.window orderFront:nil];
  552. [self.buySwitch setState:NSControlStateValueOn];
  553. [self updatePriceLabel];
  554. [self updatePurchaseInformation];
  555. }
  556. - (BOOL)windowShouldClose:(id)sender {
  557. [self endModal:sender];
  558. return YES;
  559. }
  560. - (void)close {
  561. [super close];
  562. // 清空埋点的数据
  563. self.kEventName = nil;
  564. self.kEventTag = 0;
  565. [self endModal:nil];
  566. }
  567. - (void)updateTitle:(NSString *)title andColor:(NSColor *)titleColor {
  568. self.titleLabel.stringValue = title ?:@"";
  569. self.titleLabel.textColor = titleColor ?:[NSColor labelColor];
  570. }
  571. #pragma mark - IBAction
  572. - (IBAction)startModal:(id)sender {
  573. [NSApp stopModal];
  574. NSInteger modalCode;
  575. self.modalSession = [NSApp beginModalSessionForWindow:self.window];
  576. do {
  577. modalCode = [NSApp runModalSession:self.modalSession];
  578. } while (modalCode == NSRunContinuesResponse);
  579. }
  580. - (IBAction)endModal:(id)sender {
  581. if (self.modalSession) {
  582. [NSApp stopModal];
  583. [NSApp endModalSession:self.modalSession];
  584. [self.window orderOut:self];
  585. self.modalSession = nil;
  586. }
  587. }
  588. - (void)showWindowRestore:(id)sender {
  589. [self showWindow:sender];
  590. }
  591. - (IBAction)enterLicenseAction:(id)sender {
  592. // if (ActivityStatusNone == [VerificationManager manager].status) {
  593. // [self close];
  594. // KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeActivate];
  595. // vc.callback = ^{
  596. // [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
  597. // };
  598. // [vc showWindow:nil];
  599. // } else if (ActivityStatusTrialExpire == [VerificationManager manager].status) {
  600. // if ([VerificationManager manager].secondTrialEnabled) {
  601. // [[FMTrackEventManager manager] trackEvent:@"Tbr" withProperties:@{@"Tbr_Btn":@"Btn_Tbr_SecondTrial"}];
  602. // [[VerificationManager manager] trialForDays:7
  603. // email:[VerificationManager manager].email
  604. // name:[VerificationManager manager].accountName
  605. // complention:^(ActivityStatus status, NSDictionary *info, NSError *error) {
  606. // if (error ||
  607. // status != ActivityStatusTrial) {
  608. // NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Activation Error", nil)
  609. // defaultButton:NSLocalizedString(@"Try Again", nil)
  610. // alternateButton:nil
  611. // otherButton:nil
  612. // informativeTextWithFormat:NSLocalizedString(@"Failed to sign up for the free trial. Please make sure your internet connection is available and try again later.", nil), nil];
  613. // [alert runModal];
  614. // } else {
  615. // KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeRepeatTrialSuccess];
  616. // [vc showWindow:nil];
  617. // }
  618. // }];
  619. // [self close];
  620. // } else {
  621. // [self close];
  622. // KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeActivate];
  623. // vc.callback = ^{
  624. // [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
  625. // };
  626. // [vc showWindow:nil];
  627. // }
  628. // } else {
  629. [self close];
  630. KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeActivate];
  631. vc.callback = ^{
  632. [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
  633. };
  634. [vc showWindow:nil];
  635. // }
  636. }
  637. - (IBAction)buttonItemClicked_Buy:(id)sender {
  638. #if VERSION_DMG
  639. NSURL *url = [NSURL URLWithString:@"https://www.anyrecover.com/buy-pdf-editor-reader-converter"];
  640. [[NSWorkspace sharedWorkspace] openURL:url];
  641. // [[FMTrackEventManager defaultManager] trackEventWithEvent:@"PUW" withProperties:@{@"PUW_Btn":@"PUW_Btn_UpgradeBuyNow"}];
  642. #endif
  643. //#if VERSION_DMG
  644. // NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@?utm_source=app_dmg&utm_medium=dmg_puw_comparison", Swift_oc_Tool.Store_Link_OC]];
  645. // [[NSWorkspace sharedWorkspace] openURL:url];
  646. // [[FMTrackEventManager defaultManager] trackEventWithEvent:@"PUW" withProperties:@{@"PUW_Btn":@"PUW_Btn_UpgradeBuyNow"}];
  647. //#endif
  648. #if VERSION_DMG
  649. // [self trackEvent_buyNow];
  650. // NSString *paidEventName = [self _buyNowEventToPaidEventName];
  651. // NSDictionary *paidEventParams = [self _getPaidEventParamsWith:paidEventName];
  652. //
  653. // NSString *thePaidEventName = paidEventParams.allKeys.firstObject;
  654. // NSDictionary *thePaidEventParams = nil;
  655. // if (paidEventName != nil && paidEventParams.allValues.firstObject != nil) {
  656. // thePaidEventParams = @{paidEventParams.allValues.firstObject : paidEventName};
  657. // }
  658. //
  659. // [self close];
  660. //
  661. // NSString *productID = @"";
  662. // if ([self.buySwitch state]) {
  663. // productID = @"com.brother.pdfreaderpro.mac.product_3";
  664. // } else {
  665. // productID = @"com.brother.pdfreaderpro.mac.product_1";
  666. // }
  667. // KMPurchaseEmbeddedWindowController *embeddedWC = [[KMPurchaseEmbeddedWindowController alloc] initWithWindowNibName:@"KMPurchaseEmbeddedWindowController"];
  668. // KMPurchaseEmbeddedWindowController *embeddedWC = [KMPurchaseEmbeddedWindowController currentFirstTrialWC:productID];
  669. // [embeddedWC beginSheetModalFor:NSApp.mainWindow completionHandler:^(NSInteger result) {
  670. //
  671. // }];
  672. // embeddedWC.kEventName = thePaidEventName;
  673. // embeddedWC.kEventParams = thePaidEventParams;
  674. // [embeddedWC showWindow:nil];
  675. // [[embeddedWC window] center];
  676. #endif
  677. }
  678. - (IBAction)buttonItemClicked_CloseWindow:(id)sender {
  679. [self close];
  680. }
  681. - (void)buttonItemClicked_License:(id)sender {
  682. // if (ActivityStatusNone == [VerificationManager manager].status) {
  683. // [self close];
  684. //
  685. // KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeTrial];
  686. // [vc showWindow:nil];
  687. // } else if (ActivityStatusTrialExpire == [VerificationManager manager].status) {
  688. if ([VerificationManager manager].secondTrialEnabled) {
  689. [[FMTrackEventManager defaultManager] trackEventWithEvent:@"Tbr" withProperties:@{@"Tbr_Btn":@"Btn_Tbr_SecondTrial"}];
  690. [[VerificationManager manager] trialForDays:7
  691. email:[VerificationManager manager].email
  692. name:[VerificationManager manager].accountName
  693. complention:^(ActivityStatus status, NSDictionary *info, NSError *error) {
  694. if (error ||
  695. status != ActivityStatusTrial) {
  696. NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Activation Error", nil)
  697. defaultButton:NSLocalizedString(@"Try Again", nil)
  698. alternateButton:nil
  699. otherButton:nil
  700. informativeTextWithFormat:NSLocalizedString(@"Failed to sign up for the free trial. Please make sure your internet connection is available and try again later.", nil), nil];
  701. [alert runModal];
  702. } else {
  703. KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeRepeatTrialSuccess];
  704. [vc showWindow:nil];
  705. }
  706. }];
  707. [self close];
  708. } else {
  709. [self close];
  710. KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeTrial];
  711. vc.callback = ^{
  712. [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
  713. };
  714. [vc showWindow:nil];
  715. }
  716. // } else {
  717. // [self close];
  718. // KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeActivate];
  719. // vc.callback = ^{
  720. // [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
  721. // };
  722. // [vc showWindow:nil];
  723. // }
  724. }
  725. - (IBAction)aiPurchaseButtonClick:(NSButton *)sender {
  726. // NSURL *url = [NSURL URLWithString:Swift_oc_Tool.AIProduct_Link_OC];
  727. // [[NSWorkspace sharedWorkspace] openURL:url];
  728. //
  729. // [[FMTrackEventManager defaultManager] trackEventWithEvent:@"PUW" withProperties:@{@"PUW_Btn":@"PUW_Btn_BuyAITools"}];
  730. [self trackEvent_buyNow];
  731. NSString *paidEventName = [self _buyNowEventToPaidEventName];
  732. NSDictionary *paidEventParams = [self _getPaidEventParamsWith:paidEventName];
  733. NSString *thePaidEventName = paidEventParams.allKeys.firstObject;
  734. NSDictionary *thePaidEventParams = nil;
  735. if (paidEventName != nil && paidEventParams.allValues.firstObject != nil) {
  736. thePaidEventParams = @{paidEventParams.allValues.firstObject : paidEventName};
  737. }
  738. [self close];
  739. #if VERSION_DMG
  740. // KMPurchaseEmbeddedWindowController *embeddedWC = [KMPurchaseEmbeddedWindowController currentFirstTrialWC:@"com.brother.pdfreaderpro.ai.product_1"];
  741. // embeddedWC.kEventName = thePaidEventName;
  742. // embeddedWC.kEventParams = thePaidEventParams;
  743. // [embeddedWC showWindow:nil];
  744. // [[embeddedWC window] center];
  745. #endif
  746. }
  747. - (IBAction)buySwitchAction:(NSSwitch *)sender {
  748. [self refreshParmanentVerInfo];
  749. [self updatePriceLabel];
  750. }
  751. #pragma mark - Noti
  752. - (void)themeChanged:(NSNotification *)notification {
  753. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  754. [self updateViewColor];
  755. });
  756. }
  757. - (void)recommondInfoUpdateNoti:(NSNotification *)noti {
  758. dispatch_async(dispatch_get_main_queue(), ^{
  759. [self updatePriceLabel];
  760. });
  761. }
  762. @end
  763. @implementation KMPurchaseCompareDMGWindowController (KMAnalytic)
  764. - (void)trackEvent_buyNow {
  765. NSDictionary *params = [self _getBuyNowEventParams];
  766. NSString *theEventName = params.allKeys.firstObject;
  767. NSDictionary *theParams = nil;
  768. if (self.kEventName != nil && params.allValues.firstObject != nil) {
  769. theParams = @{params.allValues.firstObject : self.kEventName};
  770. }
  771. [self trackEvent_dmgWithEventName:theEventName params:theParams platform:KMAnalyticsPlatformAppCenter];
  772. }
  773. - (NSDictionary *)_getBuyNowEventParams {
  774. NSString *eveN = self.kEventName;
  775. if (eveN == nil || eveN.length == 0) {
  776. return nil;
  777. }
  778. if ([eveN isEqual:@"Reading_WebsiteLink_BuyNow"] ||
  779. [eveN isEqual:@"Reading_EmailLink_BuyNow"] ||
  780. [eveN isEqual:@"Reading_DynamicStamp_BuyNow"] ||
  781. [eveN isEqual:@"Reading_CustomStamp_BuyNow"] ||
  782. [eveN isEqual:@"Reading_Signature_BuyNow"] ||
  783. [eveN isEqual:@"Reading_Table_BuyNow"]) {
  784. return @{@"Purchase_Tools" : @"SubTbr_Tools"};
  785. } else if ([eveN isEqual:@"Reading_InsertBlankPage_BuyNow"] ||
  786. [eveN isEqual:@"Reading_InsertPDF_BuyNow"] ||
  787. [eveN isEqual:@"Reading_InsertSacnner_BuyNow"] ||
  788. [eveN isEqual:@"Reading_InsertImage_BuyNow"] ||
  789. [eveN isEqual:@"Reading_InsertClipboard_BuyNow"] ||
  790. [eveN isEqual:@"Reading_Replace_BuyNow"] ||
  791. [eveN isEqual:@"Reading_Extract_BuyNow"] ||
  792. [eveN isEqual:@"Reading_Split_BuyNow"] ||
  793. ([eveN isEqual:@"Reading_Rotate_BuyNow"] && self.kEventTag == 0) ||
  794. [eveN isEqual:@"Reading_Reverse_BuyNow"] ||
  795. [eveN isEqual:@"Reading_Copy_BuyNow"] ||
  796. [eveN isEqual:@"Reading_Delete_BuyNow"] ||
  797. [eveN isEqual:@"Reading_Merge_BuyNow"]) {
  798. return @{@"Purchase_PageEdit" : @"SubTbr_PageEdit"};
  799. } else if ([eveN isEqual:@"Onbrd_EditPage_BuyNow"] ||
  800. [eveN isEqual:@"Onbrd_Merge_BuyNow"]) {
  801. return @{@"Purchase_PageEdit" : @"Home_PageEdit"};
  802. } else if ([eveN isEqual:@"Reading_RemoveSecurity_BuyNow"] ||
  803. [eveN isEqual:@"Reading_Compare_BuyNow"] ||
  804. [eveN isEqual:@"Reading_AddWatermark_BuyNow"] ||
  805. [eveN isEqual:@"Reading_RemoveWatermark_BuyNow"] ||
  806. [eveN isEqual:@"Reading_AddBackground_BuyNow"] ||
  807. [eveN isEqual:@"Reading_RemoveBackground_BuyNow"] ||
  808. [eveN isEqual:@"Reading_AddHeaderFooter_BuyNow"] ||
  809. [eveN isEqual:@"Reading_RemoveHeaderFooter_BuyNow"] ||
  810. [eveN isEqual:@"Reading_AddBates_BuyNow"] ||
  811. [eveN isEqual:@"Reading_RemoveBates_BuyNow"] ||
  812. [eveN isEqual:@"Reading_Measure_BuyNow"]) {
  813. return @{@"Purchase_Editor" : @"SubTbr_Editor"};
  814. } else if ([eveN isEqual:@"Onbrd_Compare_BuyNow"] ||
  815. [eveN isEqual:@"Onbrd_Background_BuyNow"] ||
  816. [eveN isEqual:@"Onbrd_Watermard_BuyNow"] ||
  817. [eveN isEqual:@"Onbrd_HeaderFooter_BuyNow"] ||
  818. [eveN isEqual:@"Onbrd_Bates_BuyNow"] ||
  819. [eveN isEqual:@"Onbrd_Security_BuyNow"]) {
  820. return @{@"Purchase_Editor" : @"Home_Editor"};
  821. } else if ([eveN isEqual:@"Reading_PDFtoWord_BuyNow"] ||
  822. [eveN isEqual:@"Reading_PDFtoExcel_BuyNow"] ||
  823. [eveN isEqual:@"Reading_PDFtoPPT_BuyNow"] ||
  824. [eveN isEqual:@"Reading_PDFtoRTF_BuyNow"] ||
  825. [eveN isEqual:@"Reading_PDFtoCSV_BuyNow"] ||
  826. [eveN isEqual:@"Reading_PDFtoText_BuyNow"] ||
  827. [eveN isEqual:@"Reading_PDFtoImage_BuyNow"] ||
  828. [eveN isEqual:@"Reading_ExtractImage_BuyNow"]) {
  829. return @{@"Purchase_Converter" : @"SubTbr_Converter"};
  830. } else if ([eveN isEqual:@"Onbrd_ConvertPDF_BuyNow"] ||
  831. [eveN isEqual:@"Onbrd_PDFtoWord_BuyNow"] ||
  832. [eveN isEqual:@"Onbrd_PDFtoExcel_BuyNow"] ||
  833. [eveN isEqual:@"Onbrd_PDFtoPPT_BuyNow"] ||
  834. [eveN isEqual:@"Onbrd_ImagetoPDF_BuyNow"]) {
  835. return @{@"Purchase_Converter" : @"Home_Converter"};
  836. } else if ([eveN isEqual:@"Reading_TextField_BuyNow"] ||
  837. [eveN isEqual:@"Reading_CheckBox_BuyNow"] ||
  838. [eveN isEqual:@"Reading_RadioButton_BuyNow"] ||
  839. [eveN isEqual:@"Reading_ListBox_BuyNow"] ||
  840. [eveN isEqual:@"Reading_ComboBox_BuyNow"] ||
  841. [eveN isEqual:@"Reading_Button_BuyNow"]) {
  842. return @{@"Purchase_Form" : @"SubTbr_Forms"};
  843. } else if ([eveN isEqual:@"Reading_FillSign_Signature_BuyNow"] ||
  844. [eveN isEqual:@"Reading_DigitalSign_BuyNow"] ||
  845. [eveN isEqual:@"Reading_ElectronicSign_BuyNow"]) {
  846. return @{@"Purchase_Sign" : @"SunTbr_Signature"};
  847. } else if ([eveN isEqual:@"Reading_EditPDF_BuyNow"] ||
  848. [eveN isEqual:@"Reading_ReplaceText_BuyNow"]) {
  849. return @{@"Purchase_EditPDF" : @"Tbr_Edit PDF"};
  850. } else if ([eveN isEqual:@"Reading_Redact_BuyNow"]) {
  851. return @{@"Purchase_Redact" : @"Tbr_Redact"};
  852. } else if ([eveN isEqual:@"Reading_OCR_BuyNow"] ||
  853. [eveN isEqual:@"Reading_Convert_OCR_BuyNow"] ||
  854. [eveN isEqual:@"Onbrd_OCR_BuyNow"]) {
  855. return @{@"Purchase_OCR" : @"SubTbr_OCR"};
  856. } else if ([eveN isEqual:@"Reading_SplitView_BuyNow"] ||
  857. [eveN isEqual:@"Reading_Rotate_BuyNow"] ||
  858. [eveN isEqual:@"Reading_Theme_BuyNow"] ||
  859. [eveN isEqual:@"Reading_MultiTab_BuyNow"]) {
  860. return @{@"Purchase_PageDisplay" : @"SubTbr_PageDisplay"};
  861. } else if ([eveN isEqual:@"Onbrd_PrintPoster_BuyNow"] ||
  862. [eveN isEqual:@"Onbrd_PrintMultiple_BuyNow"] ||
  863. [eveN isEqual:@"Onbrd_PrintBooklet_BuyNow"]) {
  864. return @{@"Purchase_Others" : @"Home_Others"};
  865. } else if ([eveN isEqual:@"Reading_Flatten_BuyNow"]) {
  866. return @{@"Purchase_Others" : @"SubTbr_Others"};
  867. } else if ([eveN isEqual:@"MenuBar_PrintPoster_BuyNow"] ||
  868. [eveN isEqual:@"MenuBar_PrintMultiple_BuyNow"] ||
  869. [eveN isEqual:@"MenuBar_PrintBooklet_BuyNow"]) {
  870. return @{@"Purchase_Others" : @"MenuBar_Others"};
  871. }
  872. return nil;
  873. }
  874. - (NSString *)_buyNowEventToPaidEventName {
  875. NSString *eveN = self.kEventName;
  876. if (eveN == nil || eveN.length == 0) {
  877. return nil;
  878. }
  879. // Paid_Tools
  880. if ([eveN isEqual:@"Reading_WebsiteLink_BuyNow"]) {
  881. return @"Reading_WebsiteLink_Paid";
  882. } else if ([eveN isEqual:@"Reading_EmailLink_BuyNow"]) {
  883. return @"Reading_EmailLink_Paid";
  884. } else if ([eveN isEqual:@"Reading_DynamicStamp_BuyNow"]) {
  885. return @"Reading_DynamicStamp_Paid";
  886. } else if ([eveN isEqual:@"Reading_CustomStamp_BuyNow"]) {
  887. return @"Reading_CustomStamp_Paid";
  888. } else if ([eveN isEqual:@"Reading_Signature_BuyNow"]) {
  889. return @"Reading_Signature_Paid";
  890. } else if ([eveN isEqual:@"Reading_Table_BuyNow"]) {
  891. return @"Reading_Table_Paid";
  892. }
  893. // Paid_PageEdit SubTbr_PageEdit
  894. else if ([eveN isEqual:@"Reading_InsertBlankPage_BuyNow"]) {
  895. return @"Reading_InsertBlankPage_Paid";
  896. } else if ([eveN isEqual:@"Reading_InsertPDF_BuyNow"]) {
  897. return @"Reading_InsertPDF_Paid";
  898. } else if ([eveN isEqual:@"Reading_InsertSacnner_BuyNow"]) {
  899. return @"Reading_InsertSacnner_Paid";
  900. } else if ([eveN isEqual:@"Reading_InsertImage_BuyNow"]) {
  901. return @"Reading_InsertImage_Paid";
  902. } else if ([eveN isEqual:@"Reading_InsertClipboard_BuyNow"]) {
  903. return @"Reading_InsertClipboard_Paid";
  904. } else if ([eveN isEqual:@"Reading_Replace_BuyNow"]) {
  905. return @"Reading_Replace_Paid";
  906. } else if ([eveN isEqual:@"Reading_Extract_BuyNow"]) {
  907. return @"Reading_Extract_Paid";
  908. } else if ([eveN isEqual:@"Reading_Split_BuyNow"]) {
  909. return @"Reading_Split_Paid";
  910. } else if ([eveN isEqual:@"Reading_Rotate_BuyNow"]) {
  911. return @"Reading_Rotate_Paid";
  912. } else if ([eveN isEqual:@"Reading_Reverse_BuyNow"]) {
  913. return @"Reading_Reverse_Paid";
  914. } else if ([eveN isEqual:@"Reading_Copy_BuyNow"]) {
  915. return @"Reading_Copy_Paid";
  916. } else if ([eveN isEqual:@"Reading_Delete_BuyNow"]) {
  917. return @"Reading_Delete_Paid";
  918. } else if ([eveN isEqual:@"Reading_Merge_BuyNow"]) {
  919. return @"Reading_Merge_Paid";
  920. }
  921. // Paid_PageEdit Home_PageEdit
  922. else if ([eveN isEqual:@"Onbrd_EditPage_BuyNow"]) {
  923. return @"Onbrd_EditPage_Paid";
  924. } else if ([eveN isEqual:@"Onbrd_Merge_BuyNow"]) {
  925. return @"Onbrd_Merge_Paid";
  926. }
  927. // Paid_Editor SubTbr_Editor
  928. else if ([eveN isEqual:@"Reading_RemoveSecurity_BuyNow"]) {
  929. return @"Reading_RemoveSecurity_Paid";
  930. } else if ([eveN isEqual:@"Reading_Compare_BuyNow"]) {
  931. return @"Reading_Compare_Paid";
  932. } else if ([eveN isEqual:@"Reading_AddWatermark_BuyNow"]) {
  933. return @"Reading_AddWatermark_Paid";
  934. } else if ([eveN isEqual:@"Reading_RemoveWatermark_BuyNow"]) {
  935. return @"Reading_RemoveWatermark_Paid";
  936. } else if ([eveN isEqual:@"Reading_AddBackground_BuyNow"]) {
  937. return @"Reading_AddBackground_Paid";
  938. } else if ([eveN isEqual:@"Reading_RemoveBackground_BuyNow"]) {
  939. return @"Reading_RemoveBackground_Paid";
  940. } else if ([eveN isEqual:@"Reading_AddHeaderFooter_BuyNow"]) {
  941. return @"Reading_AddHeaderFooter_Paid";
  942. } else if ([eveN isEqual:@"Reading_RemoveHeaderFooter_BuyNow"]) {
  943. return @"Reading_RemoveHeaderFooter_Paid";
  944. } else if ([eveN isEqual:@"Reading_AddBates_BuyNow"]) {
  945. return @"Reading_AddBates_Paid";
  946. } else if ([eveN isEqual:@"Reading_RemoveBates_BuyNow"]) {
  947. return @"Reading_RemoveBates_Paid";
  948. } else if ([eveN isEqual:@"Reading_Measure_BuyNow"]) {
  949. return @"Reading_Measure_Paid";
  950. }
  951. // Paid_Editor Home_Editor
  952. else if ([eveN isEqual:@"Onbrd_Compare_BuyNow"]) {
  953. return @"Onbrd_Compare_Paid";
  954. } else if ([eveN isEqual:@"Onbrd_Background_BuyNow"]) {
  955. return @"Onbrd_Background_Paid";
  956. } else if ([eveN isEqual:@"Onbrd_Watermard_BuyNow"]) {
  957. return @"Onbrd_Watermard_Paid";
  958. } else if ([eveN isEqual:@"Onbrd_HeaderFooter_BuyNow"]) {
  959. return @"Onbrd_HeaderFooter_Paid";
  960. } else if ([eveN isEqual:@"Onbrd_Bates_BuyNow"]) {
  961. return @"Onbrd_Bates_Paid";
  962. } else if ([eveN isEqual:@"Onbrd_Security_BuyNow"]) {
  963. return @"Onbrd_Security_Paid";
  964. }
  965. // Paid_Converter SubTbr_Converte
  966. else if ([eveN isEqual:@"Reading_PDFtoWord_BuyNow"]) {
  967. return @"Reading_PDFtoWord_Paid";
  968. } else if ([eveN isEqual:@"Reading_PDFtoExcel_BuyNow"]) {
  969. return @"Reading_PDFtoExcel_Paid";
  970. } else if ([eveN isEqual:@"Reading_PDFtoPPT_BuyNow"]) {
  971. return @"Reading_PDFtoPPT_Paid";
  972. } else if ([eveN isEqual:@"Reading_PDFtoRTF_BuyNow"]) {
  973. return @"Reading_PDFtoRTF_Paid";
  974. } else if ([eveN isEqual:@"Reading_PDFtoCSV_BuyNow"]) {
  975. return @"Reading_PDFtoCSV_Paid";
  976. } else if ([eveN isEqual:@"Reading_PDFtoText_BuyNow"]) {
  977. return @"Reading_PDFtoText_Paid";
  978. } else if ([eveN isEqual:@"Reading_PDFtoImage_BuyNow"]) {
  979. return @"Reading_PDFtoImage_Paid";
  980. } else if ([eveN isEqual:@"Reading_ExtractImage_BuyNow"]) {
  981. return @"Reading_ExtractImage_Paid";
  982. }
  983. // Paid_Converter Home_Converter
  984. else if ([eveN isEqual:@"Onbrd_ConvertPDF_BuyNow"]) {
  985. return @"Onbrd_ConvertPDF_Paid";
  986. } else if ([eveN isEqual:@"Onbrd_PDFtoWord_BuyNow"]) {
  987. return @"Onbrd_PDFtoWord_Paid";
  988. } else if ([eveN isEqual:@"Onbrd_PDFtoExcel_BuyNow"]) {
  989. return @"Onbrd_PDFtoExcel_Paid";
  990. } else if ([eveN isEqual:@"Onbrd_PDFtoPPT_BuyNow"]) {
  991. return @"Onbrd_PDFtoPPT_Paid";
  992. } else if ([eveN isEqual:@"Onbrd_ImagetoPDF_BuyNow"]) {
  993. return @"Onbrd_ImagetoPDF_Paid";
  994. }
  995. // Paid_Form SubTbr_Forms
  996. else if ([eveN isEqual:@"Reading_TextField_BuyNow"]) {
  997. return @"Reading_TextField_Paid";
  998. } else if ([eveN isEqual:@"Reading_CheckBox_BuyNow"]) {
  999. return @"Reading_CheckBox_Paid";
  1000. } else if ([eveN isEqual:@"Reading_RadioButton_BuyNow"]) {
  1001. return @"Reading_RadioButton_Paid";
  1002. } else if ([eveN isEqual:@"Reading_ListBox_BuyNow"]) {
  1003. return @"Reading_ListBox_Paid";
  1004. } else if ([eveN isEqual:@"Reading_ComboBox_BuyNow"]) {
  1005. return @"Reading_ComboBox_Paid";
  1006. } else if ([eveN isEqual:@"Reading_Button_BuyNow"]) {
  1007. return @"Reading_Button_Paid";
  1008. }
  1009. // Paid_Sign SunTbr_Signature
  1010. else if ([eveN isEqual:@"Reading_FillSign_Signature_BuyNow"]) {
  1011. return @"Reading_FillSign_Signature_Paid";
  1012. } else if ([eveN isEqual:@"Reading_DigitalSign_BuyNow"]) {
  1013. return @"Reading_DigitalSign_Paid";
  1014. } else if ([eveN isEqual:@"Reading_ElectronicSign_BuyNow"]) {
  1015. return @"Reading_ElectronicSign_Paid";
  1016. }
  1017. // Paid_EditPDF Tbr_Edit PDF
  1018. else if ([eveN isEqual:@"Reading_EditPDF_BuyNow"]) {
  1019. return @"Reading_EditPDF_Paid";
  1020. } else if ([eveN isEqual:@"Reading_ReplaceText_BuyNow"]) {
  1021. return @"Reading_ReplaceText_Paid";
  1022. }
  1023. // Paid_Redact Tbr_Redact
  1024. else if ([eveN isEqual:@"Reading_Redact_BuyNow"]) {
  1025. return @"Reading_Redact_Paid";
  1026. }
  1027. // Paid_OCR SubTbr_OCR
  1028. else if ([eveN isEqual:@"Reading_OCR_BuyNow"]) {
  1029. return @"Reading_OCR_Paid";
  1030. } else if ([eveN isEqual:@"Reading_Convert_OCR_BuyNow"]) {
  1031. return @"Reading_Convert_OCR_Paid";
  1032. } else if ([eveN isEqual:@"Onbrd_OCR_BuyNow"]) {
  1033. return @"Onbrd_OCR_Paid";
  1034. }
  1035. // Paid_PageDisplay SubTbr_Page Display
  1036. else if ([eveN isEqual:@"Reading_SplitView_BuyNow"]) {
  1037. return @"Reading_SplitView_Paid";
  1038. } else if ([eveN isEqual:@"Reading_Rotate_BuyNow"]) {
  1039. return @"Reading_Rotate_Paid";
  1040. } else if ([eveN isEqual:@"Reading_Theme_BuyNow"]) {
  1041. return @"Reading_Theme_Paid";
  1042. } else if ([eveN isEqual:@"Reading_MultiTab_BuyNow"]) {
  1043. return @"Reading_MultiTab_Paid";
  1044. }
  1045. // Home_Others
  1046. else if ([eveN isEqual:@"Onbrd_PrintPoster_BuyNow"]) {
  1047. return @"Onbrd_PrintPoster_Paid";
  1048. } else if ([eveN isEqual:@"Onbrd_PrintMultiple_BuyNow"]) {
  1049. return @"Onbrd_PrintMultiple_Paid";
  1050. } else if ([eveN isEqual:@"Onbrd_PrintBooklet_BuyNow"]) {
  1051. return @"Onbrd_PrintBooklet_Paid";
  1052. }
  1053. // Paid_Others SubTbr_Others
  1054. else if ([eveN isEqual:@"Reading_Flatten_BuyNow"]) {
  1055. return @"Reading_Flatten_Paid";
  1056. }
  1057. // Paid_Others MenuBar_Others
  1058. else if ([eveN isEqual:@"MenuBar_PrintPoster_BuyNow"]) {
  1059. return @"MenuBar_PrintPoster_Paid";
  1060. } else if ([eveN isEqual:@"MenuBar_PrintMultiple_BuyNow"]) {
  1061. return @"MenuBar_PrintMultiple_Paid";
  1062. } else if ([eveN isEqual:@"MenuBar_PrintBooklet_BuyNow"]) {
  1063. return @"MenuBar_PrintBooklet_Paid";
  1064. }
  1065. return nil;
  1066. }
  1067. - (NSDictionary *)_getPaidEventParamsWith:(NSString *)eventN {
  1068. NSString *eveN = eventN;
  1069. if (eveN == nil || eveN.length == 0) {
  1070. return nil;
  1071. }
  1072. // Paid_Tools SubTbr_Tools
  1073. if ([eveN isEqual:@"Reading_WebsiteLink_Paid"] ||
  1074. [eveN isEqual:@"Reading_EmailLink_Paid"] ||
  1075. [eveN isEqual:@"Reading_DynamicStamp_Paid"] ||
  1076. [eveN isEqual:@"Reading_CustomStamp_Paid"] ||
  1077. [eveN isEqual:@"Reading_Signature_Paid"] ||
  1078. [eveN isEqual:@"Reading_Table_Paid"]) {
  1079. return @{@"Paid_Tools" : @"SubTbr_Tools"};
  1080. }
  1081. // Paid_PageEdit SubTbr_PageEdit
  1082. else if ([eveN isEqual:@"Reading_InsertBlankPage_Paid"] ||
  1083. [eveN isEqual:@"Reading_InsertPDF_Paid"] ||
  1084. [eveN isEqual:@"Reading_InsertSacnner_Paid"] ||
  1085. [eveN isEqual:@"Reading_InsertImage_Paid"] ||
  1086. [eveN isEqual:@"Reading_InsertClipboard_Paid"] ||
  1087. [eveN isEqual:@"Reading_Replace_Paid"] ||
  1088. [eveN isEqual:@"Reading_Extract_Paid"] ||
  1089. [eveN isEqual:@"Reading_Split_Paid"] ||
  1090. [eveN isEqual:@"Reading_Rotate_Paid"] ||
  1091. [eveN isEqual:@"Reading_Reverse_Paid"] ||
  1092. [eveN isEqual:@"Reading_Copy_Paid"] ||
  1093. [eveN isEqual:@"Reading_Delete_Paid"] ||
  1094. [eveN isEqual:@"Reading_Merge_Paid"]) {
  1095. return @{@"Paid_PageEdit" : @"SubTbr_PageEdit"};
  1096. }
  1097. // Paid_PageEdit Home_PageEdit
  1098. else if ([eveN isEqual:@"Onbrd_EditPage_Paid"] ||
  1099. [eveN isEqual:@"Onbrd_Merge_Paid"]) {
  1100. return @{@"Paid_PageEdit" : @"Home_PageEdit"};
  1101. }
  1102. // Paid_Editor SubTbr_Editor
  1103. else if ([eveN isEqual:@"Reading_RemoveSecurity_Paid"] ||
  1104. [eveN isEqual:@"Reading_Compare_Paid"] ||
  1105. [eveN isEqual:@"Reading_AddWatermark_Paid"] ||
  1106. [eveN isEqual:@"Reading_RemoveWatermark_Paid"] ||
  1107. [eveN isEqual:@"Reading_AddBackground_Paid"] ||
  1108. [eveN isEqual:@"Reading_RemoveBackground_Paid"] ||
  1109. [eveN isEqual:@"Reading_AddHeaderFooter_Paid"] ||
  1110. [eveN isEqual:@"Reading_RemoveHeaderFooter_Paid"] ||
  1111. [eveN isEqual:@"Reading_AddBates_Paid"] ||
  1112. [eveN isEqual:@"Reading_RemoveBates_Paid"] ||
  1113. [eveN isEqual:@"Reading_Measure_Paid"]) {
  1114. return @{@"" : @""};
  1115. }
  1116. // Paid_Editor Home_Editor
  1117. else if ([eveN isEqual:@"Onbrd_Compare_Paid"] ||
  1118. [eveN isEqual:@"Onbrd_Background_Paid"] ||
  1119. [eveN isEqual:@"Onbrd_Watermard_Paid"] ||
  1120. [eveN isEqual:@"Onbrd_HeaderFooter_Paid"] ||
  1121. [eveN isEqual:@"Onbrd_Bates_Paid"] ||
  1122. [eveN isEqual:@"Onbrd_Security_Paid"]) {
  1123. return @{@"Paid_Editor" : @"Home_Editor"};
  1124. }
  1125. // Paid_Converter SubTbr_Converter
  1126. else if ([eveN isEqual:@"Reading_PDFtoWord_Paid"] ||
  1127. [eveN isEqual:@"Reading_PDFtoExcel_Paid"] ||
  1128. [eveN isEqual:@"Reading_PDFtoPPT_Paid"] ||
  1129. [eveN isEqual:@"Reading_PDFtoRTF_Paid"] ||
  1130. [eveN isEqual:@"Reading_PDFtoCSV_Paid"] ||
  1131. [eveN isEqual:@"Reading_PDFtoText_Paid"] ||
  1132. [eveN isEqual:@"Reading_PDFtoImage_Paid"] ||
  1133. [eveN isEqual:@"Reading_ExtractImage_Paid"]) {
  1134. return @{@"Paid_Converter" : @"SubTbr_Converter"};
  1135. }
  1136. // Paid_Converter Home_Converter
  1137. else if ([eveN isEqual:@"Onbrd_ConvertPDF_Paid"] ||
  1138. [eveN isEqual:@"Onbrd_PDFtoWord_Paid"] ||
  1139. [eveN isEqual:@"Onbrd_PDFtoExcel_Paid"] ||
  1140. [eveN isEqual:@"Onbrd_PDFtoPPT_Paid"] ||
  1141. [eveN isEqual:@"Onbrd_ImagetoPDF_Paid"]) {
  1142. return @{@"Paid_Converter" : @"Home_Converter"};
  1143. }
  1144. // Paid_Form SubTbr_Forms
  1145. else if ([eveN isEqual:@"Reading_TextField_Paid"] ||
  1146. [eveN isEqual:@"Reading_CheckBox_Paid"] ||
  1147. [eveN isEqual:@"Reading_RadioButton_Paid"] ||
  1148. [eveN isEqual:@"Reading_ListBox_Paid"] ||
  1149. [eveN isEqual:@"Reading_ComboBox_Paid"] ||
  1150. [eveN isEqual:@"Reading_Button_Paid"]) {
  1151. return @{@"Paid_Form" : @"SubTbr_Forms"};
  1152. }
  1153. // Paid_Sign SunTbr_Signature
  1154. else if ([eveN isEqual:@"Reading_FillSign_Signature_Paid"] ||
  1155. [eveN isEqual:@"Reading_DigitalSign_Paid"] ||
  1156. [eveN isEqual:@"Reading_ElectronicSign_Paid"]) {
  1157. return @{@"Paid_Sign" : @"SunTbr_Signature"};
  1158. }
  1159. // Paid_EditPDF Tbr_Edit PDF
  1160. else if ([eveN isEqual:@"Reading_EditPDF_Paid"] ||
  1161. [eveN isEqual:@"Reading_ReplaceText_Paid"]) {
  1162. return @{@"Paid_EditPDF" : @"Tbr_Edit PDF"};
  1163. }
  1164. // Paid_Redact Tbr_Redact
  1165. else if ([eveN isEqual:@"Reading_Redact_Paid"]) {
  1166. return @{@"Paid_Redact" : @"Tbr_Redact"};
  1167. }
  1168. // Paid_OCR SubTbr_OCR
  1169. else if ([eveN isEqual:@"Reading_OCR_Paid"] ||
  1170. [eveN isEqual:@"Reading_Convert_OCR_Paid"] ||
  1171. [eveN isEqual:@"Onbrd_OCR_Paid"]) {
  1172. return @{@"Paid_OCR" : @"SubTbr_OCR"};
  1173. }
  1174. // Paid_PageDisplay SubTbr_Page Display
  1175. else if ([eveN isEqual:@"Reading_SplitView_Paid"] ||
  1176. [eveN isEqual:@"Reading_Rotate_Paid"] ||
  1177. [eveN isEqual:@"Reading_Theme_Paid"] ||
  1178. [eveN isEqual:@"Reading_MultiTab_Paid"]) {
  1179. return @{@"Paid_PageDisplay" : @"SubTbr_Page Display"};
  1180. }
  1181. // Home_Others
  1182. else if ([eveN isEqual:@"Onbrd_PrintPoster_Paid"] ||
  1183. [eveN isEqual:@"Onbrd_PrintMultiple_Paid"] ||
  1184. [eveN isEqual:@"Onbrd_PrintBooklet_Paid"]) {
  1185. return @{@"Paid_Others" : @"Home_Others"};
  1186. }
  1187. // Paid_Others SubTbr_Others
  1188. else if ([eveN isEqual:@"Reading_Flatten_Paid"]) {
  1189. return @{@"Paid_Others" : @"SubTbr_Others"};
  1190. }
  1191. // Paid_Others MenuBar_Others
  1192. else if ([eveN isEqual:@"MenuBar_PrintPoster_Paid"] ||
  1193. [eveN isEqual:@"MenuBar_PrintMultiple_Paid"] ||
  1194. [eveN isEqual:@"MenuBar_PrintBooklet_Paid"]) {
  1195. return @{@"Paid_Others" : @"MenuBar_Others"};
  1196. }
  1197. return nil;
  1198. }
  1199. @end