KMPurchaseCompareDMGWindowController.m 61 KB

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