KMPurchaseCompareDMGWindowController.m 61 KB

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