KMPurchaseCompareDMGWindowController.m 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277
  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)refreshParmanentVerInfo {
  461. if ([self.buySwitch state] == NSControlStateValueOn) {
  462. self.parmanentVerInfoLbl1.stringValue = NSLocalizedString(@"View PDFs", nil);
  463. self.parmanentVerInfoLbl2.stringValue = NSLocalizedString(@"Annotate PDFs (advanced)", nil);
  464. self.parmanentVerInfoLbl3.stringValue = NSLocalizedString(@"Unlimited file conversion", nil);
  465. self.parmanentVerInfoLbl4.stringValue = NSLocalizedString(@"Edit PDF text and images", nil);
  466. self.parmanentVerInfoLbl5.stringValue = NSLocalizedString(@"Digital signature", nil);
  467. self.parmanentVerInfoLbl6.stringValue = NSLocalizedString(@"Organize pages", nil);
  468. self.parmanentVerInfoLbl7.stringValue = NSLocalizedString(@"Batch process", nil);
  469. self.parmanentVerInfoLbl8.stringValue = NSLocalizedString(@"OCR PDFs", nil);
  470. self.parmanentVerInfoLbl9.stringValue = NSLocalizedString(@"Measuring Tools", nil);
  471. self.parmanentVerInfoLbl10.stringValue = NSLocalizedString(@"Ad-free", nil);
  472. self.parmanentVerInfoImage1.image = [NSImage imageNamed:@"function_vip"];
  473. } else {
  474. self.parmanentVerInfoLbl1.stringValue = NSLocalizedString(@"Unlimited file conversion", nil);
  475. self.parmanentVerInfoLbl2.stringValue = NSLocalizedString(@"Annotate PDFs (advanced)", nil);
  476. self.parmanentVerInfoLbl3.stringValue = NSLocalizedString(@"View PDFs", nil);
  477. self.parmanentVerInfoLbl4.stringValue = NSLocalizedString(@"Edit PDF text and images", nil);
  478. self.parmanentVerInfoLbl5.stringValue = NSLocalizedString(@"Digital signature", nil);
  479. self.parmanentVerInfoLbl6.stringValue = NSLocalizedString(@"Organize pages", nil);
  480. self.parmanentVerInfoLbl7.stringValue = NSLocalizedString(@"Batch process", nil);
  481. self.parmanentVerInfoLbl8.stringValue = NSLocalizedString(@"OCR PDFs", nil);
  482. self.parmanentVerInfoLbl9.stringValue = NSLocalizedString(@"Measuring Tools", nil);
  483. self.parmanentVerInfoLbl10.stringValue = NSLocalizedString(@"Ad-free", nil);
  484. self.parmanentVerInfoImage1.image = [NSImage imageNamed:@"compare_nosupport"];
  485. }
  486. }
  487. #pragma mark - Window Method
  488. - (void)showWindow:(id)sender {
  489. [super showWindow:nil];
  490. [self.window center];
  491. [self.window orderFront:nil];
  492. [self.buySwitch setState:NSControlStateValueOn];
  493. [self updatePriceLabel];
  494. [self updatePurchaseInformation];
  495. }
  496. - (BOOL)windowShouldClose:(id)sender {
  497. [self endModal:sender];
  498. return YES;
  499. }
  500. - (void)close {
  501. [super close];
  502. // 清空埋点的数据
  503. self.kEventName = nil;
  504. self.kEventTag = 0;
  505. [self endModal:nil];
  506. }
  507. - (void)updateTitle:(NSString *)title andColor:(NSColor *)titleColor {
  508. self.titleLabel.stringValue = title ?:@"";
  509. self.titleLabel.textColor = titleColor ?:[NSColor labelColor];
  510. }
  511. #pragma mark - IBAction
  512. - (IBAction)startModal:(id)sender {
  513. [NSApp stopModal];
  514. NSInteger modalCode;
  515. self.modalSession = [NSApp beginModalSessionForWindow:self.window];
  516. do {
  517. modalCode = [NSApp runModalSession:self.modalSession];
  518. } while (modalCode == NSRunContinuesResponse);
  519. }
  520. - (IBAction)endModal:(id)sender {
  521. if (self.modalSession) {
  522. [NSApp stopModal];
  523. [NSApp endModalSession:self.modalSession];
  524. [self.window orderOut:self];
  525. self.modalSession = nil;
  526. }
  527. }
  528. - (void)showWindowRestore:(id)sender {
  529. [self showWindow:sender];
  530. }
  531. - (IBAction)enterLicenseAction:(id)sender {
  532. // if (ActivityStatusNone == [VerificationManager manager].status) {
  533. // [self close];
  534. // KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeActivate];
  535. // vc.callback = ^{
  536. // [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
  537. // };
  538. // [vc showWindow:nil];
  539. // } else if (ActivityStatusTrialExpire == [VerificationManager manager].status) {
  540. // if ([VerificationManager manager].secondTrialEnabled) {
  541. // [[FMTrackEventManager manager] trackEvent:@"Tbr" withProperties:@{@"Tbr_Btn":@"Btn_Tbr_SecondTrial"}];
  542. // [[VerificationManager manager] trialForDays:7
  543. // email:[VerificationManager manager].email
  544. // name:[VerificationManager manager].accountName
  545. // complention:^(ActivityStatus status, NSDictionary *info, NSError *error) {
  546. // if (error ||
  547. // status != ActivityStatusTrial) {
  548. // NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Activation Error", nil)
  549. // defaultButton:NSLocalizedString(@"Try Again", nil)
  550. // alternateButton:nil
  551. // otherButton:nil
  552. // informativeTextWithFormat:NSLocalizedString(@"Failed to sign up for the free trial. Please make sure your internet connection is available and try again later.", nil), nil];
  553. // [alert runModal];
  554. // } else {
  555. // KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeRepeatTrialSuccess];
  556. // [vc showWindow:nil];
  557. // }
  558. // }];
  559. // [self close];
  560. // } else {
  561. // [self close];
  562. // KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeActivate];
  563. // vc.callback = ^{
  564. // [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
  565. // };
  566. // [vc showWindow:nil];
  567. // }
  568. // } else {
  569. [self close];
  570. KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeActivate];
  571. vc.callback = ^{
  572. [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
  573. };
  574. [vc showWindow:nil];
  575. // }
  576. }
  577. - (IBAction)buttonItemClicked_Buy:(id)sender {
  578. //#if VERSION_DMG
  579. // NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@?utm_source=app_dmg&utm_medium=dmg_puw_comparison", Swift_oc_Tool.Store_Link_OC]];
  580. // [[NSWorkspace sharedWorkspace] openURL:url];
  581. // [[FMTrackEventManager defaultManager] trackEventWithEvent:@"PUW" withProperties:@{@"PUW_Btn":@"PUW_Btn_UpgradeBuyNow"}];
  582. //#endif
  583. #if VERSION_DMG
  584. [self trackEvent_buyNow];
  585. NSString *paidEventName = [self _buyNowEventToPaidEventName];
  586. NSDictionary *paidEventParams = [self _getPaidEventParamsWith:paidEventName];
  587. NSString *thePaidEventName = paidEventParams.allKeys.firstObject;
  588. NSDictionary *thePaidEventParams = nil;
  589. if (paidEventName != nil && paidEventParams.allValues.firstObject != nil) {
  590. thePaidEventParams = @{paidEventParams.allValues.firstObject : paidEventName};
  591. }
  592. [self close];
  593. NSString *productID = @"";
  594. if ([self.buySwitch state]) {
  595. productID = @"com.brother.pdfreaderpro.mac.product_3";
  596. } else {
  597. productID = @"com.brother.pdfreaderpro.mac.product_1";
  598. }
  599. // KMPurchaseEmbeddedWindowController *embeddedWC = [[KMPurchaseEmbeddedWindowController alloc] initWithWindowNibName:@"KMPurchaseEmbeddedWindowController"];
  600. KMPurchaseEmbeddedWindowController *embeddedWC = [KMPurchaseEmbeddedWindowController currentFirstTrialWC:productID];
  601. // [embeddedWC beginSheetModalFor:NSApp.mainWindow completionHandler:^(NSInteger result) {
  602. //
  603. // }];
  604. embeddedWC.kEventName = thePaidEventName;
  605. embeddedWC.kEventParams = thePaidEventParams;
  606. [embeddedWC showWindow:nil];
  607. [[embeddedWC window] center];
  608. #endif
  609. }
  610. - (IBAction)buttonItemClicked_CloseWindow:(id)sender {
  611. [self close];
  612. }
  613. - (void)buttonItemClicked_License:(id)sender {
  614. // if (ActivityStatusNone == [VerificationManager manager].status) {
  615. // [self close];
  616. //
  617. // KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeTrial];
  618. // [vc showWindow:nil];
  619. // } else if (ActivityStatusTrialExpire == [VerificationManager manager].status) {
  620. if ([VerificationManager manager].secondTrialEnabled) {
  621. [[FMTrackEventManager defaultManager] trackEventWithEvent:@"Tbr" withProperties:@{@"Tbr_Btn":@"Btn_Tbr_SecondTrial"}];
  622. [[VerificationManager manager] trialForDays:7
  623. email:[VerificationManager manager].email
  624. name:[VerificationManager manager].accountName
  625. complention:^(ActivityStatus status, NSDictionary *info, NSError *error) {
  626. if (error ||
  627. status != ActivityStatusTrial) {
  628. NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Activation Error", nil)
  629. defaultButton:NSLocalizedString(@"Try Again", nil)
  630. alternateButton:nil
  631. otherButton:nil
  632. informativeTextWithFormat:NSLocalizedString(@"Failed to sign up for the free trial. Please make sure your internet connection is available and try again later.", nil), nil];
  633. [alert runModal];
  634. } else {
  635. KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeRepeatTrialSuccess];
  636. [vc showWindow:nil];
  637. }
  638. }];
  639. [self close];
  640. } else {
  641. [self close];
  642. KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeTrial];
  643. vc.callback = ^{
  644. [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
  645. };
  646. [vc showWindow:nil];
  647. }
  648. // } else {
  649. // [self close];
  650. // KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeActivate];
  651. // vc.callback = ^{
  652. // [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
  653. // };
  654. // [vc showWindow:nil];
  655. // }
  656. }
  657. - (IBAction)aiPurchaseButtonClick:(NSButton *)sender {
  658. // NSURL *url = [NSURL URLWithString:Swift_oc_Tool.AIProduct_Link_OC];
  659. // [[NSWorkspace sharedWorkspace] openURL:url];
  660. //
  661. // [[FMTrackEventManager defaultManager] trackEventWithEvent:@"PUW" withProperties:@{@"PUW_Btn":@"PUW_Btn_BuyAITools"}];
  662. [self trackEvent_buyNow];
  663. NSString *paidEventName = [self _buyNowEventToPaidEventName];
  664. NSDictionary *paidEventParams = [self _getPaidEventParamsWith:paidEventName];
  665. NSString *thePaidEventName = paidEventParams.allKeys.firstObject;
  666. NSDictionary *thePaidEventParams = nil;
  667. if (paidEventName != nil && paidEventParams.allValues.firstObject != nil) {
  668. thePaidEventParams = @{paidEventParams.allValues.firstObject : paidEventName};
  669. }
  670. [self close];
  671. #if VERSION_DMG
  672. KMPurchaseEmbeddedWindowController *embeddedWC = [KMPurchaseEmbeddedWindowController currentFirstTrialWC:@"com.brother.pdfreaderpro.ai.product_1"];
  673. embeddedWC.kEventName = thePaidEventName;
  674. embeddedWC.kEventParams = thePaidEventParams;
  675. [embeddedWC showWindow:nil];
  676. [[embeddedWC window] center];
  677. #endif
  678. }
  679. - (IBAction)buySwitchAction:(NSSwitch *)sender {
  680. [self refreshParmanentVerInfo];
  681. [self updatePriceLabel];
  682. }
  683. #pragma mark - Noti
  684. - (void)themeChanged:(NSNotification *)notification {
  685. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  686. [self updateViewColor];
  687. });
  688. }
  689. - (void)recommondInfoUpdateNoti:(NSNotification *)noti {
  690. dispatch_async(dispatch_get_main_queue(), ^{
  691. [self updatePriceLabel];
  692. });
  693. }
  694. @end
  695. @implementation KMPurchaseCompareDMGWindowController (KMAnalytic)
  696. - (void)trackEvent_buyNow {
  697. NSDictionary *params = [self _getBuyNowEventParams];
  698. NSString *theEventName = params.allKeys.firstObject;
  699. NSDictionary *theParams = nil;
  700. if (self.kEventName != nil && params.allValues.firstObject != nil) {
  701. theParams = @{params.allValues.firstObject : self.kEventName};
  702. }
  703. [self trackEvent_dmgWithEventName:theEventName params:theParams platform:KMAnalyticsPlatformAppCenter];
  704. }
  705. - (NSDictionary *)_getBuyNowEventParams {
  706. NSString *eveN = self.kEventName;
  707. if (eveN == nil || eveN.length == 0) {
  708. return nil;
  709. }
  710. if ([eveN isEqual:@"Reading_WebsiteLink_BuyNow"] ||
  711. [eveN isEqual:@"Reading_EmailLink_BuyNow"] ||
  712. [eveN isEqual:@"Reading_DynamicStamp_BuyNow"] ||
  713. [eveN isEqual:@"Reading_CustomStamp_BuyNow"] ||
  714. [eveN isEqual:@"Reading_Signature_BuyNow"] ||
  715. [eveN isEqual:@"Reading_Table_BuyNow"]) {
  716. return @{@"Purchase_Tools" : @"SubTbr_Tools"};
  717. } else if ([eveN isEqual:@"Reading_InsertBlankPage_BuyNow"] ||
  718. [eveN isEqual:@"Reading_InsertPDF_BuyNow"] ||
  719. [eveN isEqual:@"Reading_InsertSacnner_BuyNow"] ||
  720. [eveN isEqual:@"Reading_InsertImage_BuyNow"] ||
  721. [eveN isEqual:@"Reading_InsertClipboard_BuyNow"] ||
  722. [eveN isEqual:@"Reading_Replace_BuyNow"] ||
  723. [eveN isEqual:@"Reading_Extract_BuyNow"] ||
  724. [eveN isEqual:@"Reading_Split_BuyNow"] ||
  725. ([eveN isEqual:@"Reading_Rotate_BuyNow"] && self.kEventTag == 0) ||
  726. [eveN isEqual:@"Reading_Reverse_BuyNow"] ||
  727. [eveN isEqual:@"Reading_Copy_BuyNow"] ||
  728. [eveN isEqual:@"Reading_Delete_BuyNow"] ||
  729. [eveN isEqual:@"Reading_Merge_BuyNow"]) {
  730. return @{@"Purchase_PageEdit" : @"SubTbr_PageEdit"};
  731. } else if ([eveN isEqual:@"Onbrd_EditPage_BuyNow"] ||
  732. [eveN isEqual:@"Onbrd_Merge_BuyNow"]) {
  733. return @{@"Purchase_PageEdit" : @"Home_PageEdit"};
  734. } else if ([eveN isEqual:@"Reading_RemoveSecurity_BuyNow"] ||
  735. [eveN isEqual:@"Reading_Compare_BuyNow"] ||
  736. [eveN isEqual:@"Reading_AddWatermark_BuyNow"] ||
  737. [eveN isEqual:@"Reading_RemoveWatermark_BuyNow"] ||
  738. [eveN isEqual:@"Reading_AddBackground_BuyNow"] ||
  739. [eveN isEqual:@"Reading_RemoveBackground_BuyNow"] ||
  740. [eveN isEqual:@"Reading_AddHeaderFooter_BuyNow"] ||
  741. [eveN isEqual:@"Reading_RemoveHeaderFooter_BuyNow"] ||
  742. [eveN isEqual:@"Reading_AddBates_BuyNow"] ||
  743. [eveN isEqual:@"Reading_RemoveBates_BuyNow"] ||
  744. [eveN isEqual:@"Reading_Measure_BuyNow"]) {
  745. return @{@"Purchase_Editor" : @"SubTbr_Editor"};
  746. } else if ([eveN isEqual:@"Onbrd_Compare_BuyNow"] ||
  747. [eveN isEqual:@"Onbrd_Background_BuyNow"] ||
  748. [eveN isEqual:@"Onbrd_Watermard_BuyNow"] ||
  749. [eveN isEqual:@"Onbrd_HeaderFooter_BuyNow"] ||
  750. [eveN isEqual:@"Onbrd_Bates_BuyNow"] ||
  751. [eveN isEqual:@"Onbrd_Security_BuyNow"]) {
  752. return @{@"Purchase_Editor" : @"Home_Editor"};
  753. } else if ([eveN isEqual:@"Reading_PDFtoWord_BuyNow"] ||
  754. [eveN isEqual:@"Reading_PDFtoExcel_BuyNow"] ||
  755. [eveN isEqual:@"Reading_PDFtoPPT_BuyNow"] ||
  756. [eveN isEqual:@"Reading_PDFtoRTF_BuyNow"] ||
  757. [eveN isEqual:@"Reading_PDFtoCSV_BuyNow"] ||
  758. [eveN isEqual:@"Reading_PDFtoText_BuyNow"] ||
  759. [eveN isEqual:@"Reading_PDFtoImage_BuyNow"] ||
  760. [eveN isEqual:@"Reading_ExtractImage_BuyNow"]) {
  761. return @{@"Purchase_Converter" : @"SubTbr_Converter"};
  762. } else if ([eveN isEqual:@"Onbrd_ConvertPDF_BuyNow"] ||
  763. [eveN isEqual:@"Onbrd_PDFtoWord_BuyNow"] ||
  764. [eveN isEqual:@"Onbrd_PDFtoExcel_BuyNow"] ||
  765. [eveN isEqual:@"Onbrd_PDFtoPPT_BuyNow"] ||
  766. [eveN isEqual:@"Onbrd_ImagetoPDF_BuyNow"]) {
  767. return @{@"Purchase_Converter" : @"Home_Converter"};
  768. } else if ([eveN isEqual:@"Reading_TextField_BuyNow"] ||
  769. [eveN isEqual:@"Reading_CheckBox_BuyNow"] ||
  770. [eveN isEqual:@"Reading_RadioButton_BuyNow"] ||
  771. [eveN isEqual:@"Reading_ListBox_BuyNow"] ||
  772. [eveN isEqual:@"Reading_ComboBox_BuyNow"] ||
  773. [eveN isEqual:@"Reading_Button_BuyNow"]) {
  774. return @{@"Purchase_Form" : @"SubTbr_Forms"};
  775. } else if ([eveN isEqual:@"Reading_FillSign_Signature_BuyNow"] ||
  776. [eveN isEqual:@"Reading_DigitalSign_BuyNow"] ||
  777. [eveN isEqual:@"Reading_ElectronicSign_BuyNow"]) {
  778. return @{@"Purchase_Sign" : @"SunTbr_Signature"};
  779. } else if ([eveN isEqual:@"Reading_EditPDF_BuyNow"] ||
  780. [eveN isEqual:@"Reading_ReplaceText_BuyNow"]) {
  781. return @{@"Purchase_EditPDF" : @"Tbr_Edit PDF"};
  782. } else if ([eveN isEqual:@"Reading_Redact_BuyNow"]) {
  783. return @{@"Purchase_Redact" : @"Tbr_Redact"};
  784. } else if ([eveN isEqual:@"Reading_OCR_BuyNow"] ||
  785. [eveN isEqual:@"Reading_Convert_OCR_BuyNow"] ||
  786. [eveN isEqual:@"Onbrd_OCR_BuyNow"]) {
  787. return @{@"Purchase_OCR" : @"SubTbr_OCR"};
  788. } else if ([eveN isEqual:@"Reading_SplitView_BuyNow"] ||
  789. [eveN isEqual:@"Reading_Rotate_BuyNow"] ||
  790. [eveN isEqual:@"Reading_Theme_BuyNow"] ||
  791. [eveN isEqual:@"Reading_MultiTab_BuyNow"]) {
  792. return @{@"Purchase_PageDisplay" : @"SubTbr_PageDisplay"};
  793. } else if ([eveN isEqual:@"Onbrd_PrintPoster_BuyNow"] ||
  794. [eveN isEqual:@"Onbrd_PrintMultiple_BuyNow"] ||
  795. [eveN isEqual:@"Onbrd_PrintBooklet_BuyNow"]) {
  796. return @{@"Purchase_Others" : @"Home_Others"};
  797. } else if ([eveN isEqual:@"Reading_Flatten_BuyNow"]) {
  798. return @{@"Purchase_Others" : @"SubTbr_Others"};
  799. } else if ([eveN isEqual:@"MenuBar_PrintPoster_BuyNow"] ||
  800. [eveN isEqual:@"MenuBar_PrintMultiple_BuyNow"] ||
  801. [eveN isEqual:@"MenuBar_PrintBooklet_BuyNow"]) {
  802. return @{@"Purchase_Others" : @"MenuBar_Others"};
  803. }
  804. return nil;
  805. }
  806. - (NSString *)_buyNowEventToPaidEventName {
  807. NSString *eveN = self.kEventName;
  808. if (eveN == nil || eveN.length == 0) {
  809. return nil;
  810. }
  811. // Paid_Tools
  812. if ([eveN isEqual:@"Reading_WebsiteLink_BuyNow"]) {
  813. return @"Reading_WebsiteLink_Paid";
  814. } else if ([eveN isEqual:@"Reading_EmailLink_BuyNow"]) {
  815. return @"Reading_EmailLink_Paid";
  816. } else if ([eveN isEqual:@"Reading_DynamicStamp_BuyNow"]) {
  817. return @"Reading_DynamicStamp_Paid";
  818. } else if ([eveN isEqual:@"Reading_CustomStamp_BuyNow"]) {
  819. return @"Reading_CustomStamp_Paid";
  820. } else if ([eveN isEqual:@"Reading_Signature_BuyNow"]) {
  821. return @"Reading_Signature_Paid";
  822. } else if ([eveN isEqual:@"Reading_Table_BuyNow"]) {
  823. return @"Reading_Table_Paid";
  824. }
  825. // Paid_PageEdit SubTbr_PageEdit
  826. else if ([eveN isEqual:@"Reading_InsertBlankPage_BuyNow"]) {
  827. return @"Reading_InsertBlankPage_Paid";
  828. } else if ([eveN isEqual:@"Reading_InsertPDF_BuyNow"]) {
  829. return @"Reading_InsertPDF_Paid";
  830. } else if ([eveN isEqual:@"Reading_InsertSacnner_BuyNow"]) {
  831. return @"Reading_InsertSacnner_Paid";
  832. } else if ([eveN isEqual:@"Reading_InsertImage_BuyNow"]) {
  833. return @"Reading_InsertImage_Paid";
  834. } else if ([eveN isEqual:@"Reading_InsertClipboard_BuyNow"]) {
  835. return @"Reading_InsertClipboard_Paid";
  836. } else if ([eveN isEqual:@"Reading_Replace_BuyNow"]) {
  837. return @"Reading_Replace_Paid";
  838. } else if ([eveN isEqual:@"Reading_Extract_BuyNow"]) {
  839. return @"Reading_Extract_Paid";
  840. } else if ([eveN isEqual:@"Reading_Split_BuyNow"]) {
  841. return @"Reading_Split_Paid";
  842. } else if ([eveN isEqual:@"Reading_Rotate_BuyNow"]) {
  843. return @"Reading_Rotate_Paid";
  844. } else if ([eveN isEqual:@"Reading_Reverse_BuyNow"]) {
  845. return @"Reading_Reverse_Paid";
  846. } else if ([eveN isEqual:@"Reading_Copy_BuyNow"]) {
  847. return @"Reading_Copy_Paid";
  848. } else if ([eveN isEqual:@"Reading_Delete_BuyNow"]) {
  849. return @"Reading_Delete_Paid";
  850. } else if ([eveN isEqual:@"Reading_Merge_BuyNow"]) {
  851. return @"Reading_Merge_Paid";
  852. }
  853. // Paid_PageEdit Home_PageEdit
  854. else if ([eveN isEqual:@"Onbrd_EditPage_BuyNow"]) {
  855. return @"Onbrd_EditPage_Paid";
  856. } else if ([eveN isEqual:@"Onbrd_Merge_BuyNow"]) {
  857. return @"Onbrd_Merge_Paid";
  858. }
  859. // Paid_Editor SubTbr_Editor
  860. else if ([eveN isEqual:@"Reading_RemoveSecurity_BuyNow"]) {
  861. return @"Reading_RemoveSecurity_Paid";
  862. } else if ([eveN isEqual:@"Reading_Compare_BuyNow"]) {
  863. return @"Reading_Compare_Paid";
  864. } else if ([eveN isEqual:@"Reading_AddWatermark_BuyNow"]) {
  865. return @"Reading_AddWatermark_Paid";
  866. } else if ([eveN isEqual:@"Reading_RemoveWatermark_BuyNow"]) {
  867. return @"Reading_RemoveWatermark_Paid";
  868. } else if ([eveN isEqual:@"Reading_AddBackground_BuyNow"]) {
  869. return @"Reading_AddBackground_Paid";
  870. } else if ([eveN isEqual:@"Reading_RemoveBackground_BuyNow"]) {
  871. return @"Reading_RemoveBackground_Paid";
  872. } else if ([eveN isEqual:@"Reading_AddHeaderFooter_BuyNow"]) {
  873. return @"Reading_AddHeaderFooter_Paid";
  874. } else if ([eveN isEqual:@"Reading_RemoveHeaderFooter_BuyNow"]) {
  875. return @"Reading_RemoveHeaderFooter_Paid";
  876. } else if ([eveN isEqual:@"Reading_AddBates_BuyNow"]) {
  877. return @"Reading_AddBates_Paid";
  878. } else if ([eveN isEqual:@"Reading_RemoveBates_BuyNow"]) {
  879. return @"Reading_RemoveBates_Paid";
  880. } else if ([eveN isEqual:@"Reading_Measure_BuyNow"]) {
  881. return @"Reading_Measure_Paid";
  882. }
  883. // Paid_Editor Home_Editor
  884. else if ([eveN isEqual:@"Onbrd_Compare_BuyNow"]) {
  885. return @"Onbrd_Compare_Paid";
  886. } else if ([eveN isEqual:@"Onbrd_Background_BuyNow"]) {
  887. return @"Onbrd_Background_Paid";
  888. } else if ([eveN isEqual:@"Onbrd_Watermard_BuyNow"]) {
  889. return @"Onbrd_Watermard_Paid";
  890. } else if ([eveN isEqual:@"Onbrd_HeaderFooter_BuyNow"]) {
  891. return @"Onbrd_HeaderFooter_Paid";
  892. } else if ([eveN isEqual:@"Onbrd_Bates_BuyNow"]) {
  893. return @"Onbrd_Bates_Paid";
  894. } else if ([eveN isEqual:@"Onbrd_Security_BuyNow"]) {
  895. return @"Onbrd_Security_Paid";
  896. }
  897. // Paid_Converter SubTbr_Converte
  898. else if ([eveN isEqual:@"Reading_PDFtoWord_BuyNow"]) {
  899. return @"Reading_PDFtoWord_Paid";
  900. } else if ([eveN isEqual:@"Reading_PDFtoExcel_BuyNow"]) {
  901. return @"Reading_PDFtoExcel_Paid";
  902. } else if ([eveN isEqual:@"Reading_PDFtoPPT_BuyNow"]) {
  903. return @"Reading_PDFtoPPT_Paid";
  904. } else if ([eveN isEqual:@"Reading_PDFtoRTF_BuyNow"]) {
  905. return @"Reading_PDFtoRTF_Paid";
  906. } else if ([eveN isEqual:@"Reading_PDFtoCSV_BuyNow"]) {
  907. return @"Reading_PDFtoCSV_Paid";
  908. } else if ([eveN isEqual:@"Reading_PDFtoText_BuyNow"]) {
  909. return @"Reading_PDFtoText_Paid";
  910. } else if ([eveN isEqual:@"Reading_PDFtoImage_BuyNow"]) {
  911. return @"Reading_PDFtoImage_Paid";
  912. } else if ([eveN isEqual:@"Reading_ExtractImage_BuyNow"]) {
  913. return @"Reading_ExtractImage_Paid";
  914. }
  915. // Paid_Converter Home_Converter
  916. else if ([eveN isEqual:@"Onbrd_ConvertPDF_BuyNow"]) {
  917. return @"Onbrd_ConvertPDF_Paid";
  918. } else if ([eveN isEqual:@"Onbrd_PDFtoWord_BuyNow"]) {
  919. return @"Onbrd_PDFtoWord_Paid";
  920. } else if ([eveN isEqual:@"Onbrd_PDFtoExcel_BuyNow"]) {
  921. return @"Onbrd_PDFtoExcel_Paid";
  922. } else if ([eveN isEqual:@"Onbrd_PDFtoPPT_BuyNow"]) {
  923. return @"Onbrd_PDFtoPPT_Paid";
  924. } else if ([eveN isEqual:@"Onbrd_ImagetoPDF_BuyNow"]) {
  925. return @"Onbrd_ImagetoPDF_Paid";
  926. }
  927. // Paid_Form SubTbr_Forms
  928. else if ([eveN isEqual:@"Reading_TextField_BuyNow"]) {
  929. return @"Reading_TextField_Paid";
  930. } else if ([eveN isEqual:@"Reading_CheckBox_BuyNow"]) {
  931. return @"Reading_CheckBox_Paid";
  932. } else if ([eveN isEqual:@"Reading_RadioButton_BuyNow"]) {
  933. return @"Reading_RadioButton_Paid";
  934. } else if ([eveN isEqual:@"Reading_ListBox_BuyNow"]) {
  935. return @"Reading_ListBox_Paid";
  936. } else if ([eveN isEqual:@"Reading_ComboBox_BuyNow"]) {
  937. return @"Reading_ComboBox_Paid";
  938. } else if ([eveN isEqual:@"Reading_Button_BuyNow"]) {
  939. return @"Reading_Button_Paid";
  940. }
  941. // Paid_Sign SunTbr_Signature
  942. else if ([eveN isEqual:@"Reading_FillSign_Signature_BuyNow"]) {
  943. return @"Reading_FillSign_Signature_Paid";
  944. } else if ([eveN isEqual:@"Reading_DigitalSign_BuyNow"]) {
  945. return @"Reading_DigitalSign_Paid";
  946. } else if ([eveN isEqual:@"Reading_ElectronicSign_BuyNow"]) {
  947. return @"Reading_ElectronicSign_Paid";
  948. }
  949. // Paid_EditPDF Tbr_Edit PDF
  950. else if ([eveN isEqual:@"Reading_EditPDF_BuyNow"]) {
  951. return @"Reading_EditPDF_Paid";
  952. } else if ([eveN isEqual:@"Reading_ReplaceText_BuyNow"]) {
  953. return @"Reading_ReplaceText_Paid";
  954. }
  955. // Paid_Redact Tbr_Redact
  956. else if ([eveN isEqual:@"Reading_Redact_BuyNow"]) {
  957. return @"Reading_Redact_Paid";
  958. }
  959. // Paid_OCR SubTbr_OCR
  960. else if ([eveN isEqual:@"Reading_OCR_BuyNow"]) {
  961. return @"Reading_OCR_Paid";
  962. } else if ([eveN isEqual:@"Reading_Convert_OCR_BuyNow"]) {
  963. return @"Reading_Convert_OCR_Paid";
  964. } else if ([eveN isEqual:@"Onbrd_OCR_BuyNow"]) {
  965. return @"Onbrd_OCR_Paid";
  966. }
  967. // Paid_PageDisplay SubTbr_Page Display
  968. else if ([eveN isEqual:@"Reading_SplitView_BuyNow"]) {
  969. return @"Reading_SplitView_Paid";
  970. } else if ([eveN isEqual:@"Reading_Rotate_BuyNow"]) {
  971. return @"Reading_Rotate_Paid";
  972. } else if ([eveN isEqual:@"Reading_Theme_BuyNow"]) {
  973. return @"Reading_Theme_Paid";
  974. } else if ([eveN isEqual:@"Reading_MultiTab_BuyNow"]) {
  975. return @"Reading_MultiTab_Paid";
  976. }
  977. // Home_Others
  978. else if ([eveN isEqual:@"Onbrd_PrintPoster_BuyNow"]) {
  979. return @"Onbrd_PrintPoster_Paid";
  980. } else if ([eveN isEqual:@"Onbrd_PrintMultiple_BuyNow"]) {
  981. return @"Onbrd_PrintMultiple_Paid";
  982. } else if ([eveN isEqual:@"Onbrd_PrintBooklet_BuyNow"]) {
  983. return @"Onbrd_PrintBooklet_Paid";
  984. }
  985. // Paid_Others SubTbr_Others
  986. else if ([eveN isEqual:@"Reading_Flatten_BuyNow"]) {
  987. return @"Reading_Flatten_Paid";
  988. }
  989. // Paid_Others MenuBar_Others
  990. else if ([eveN isEqual:@"MenuBar_PrintPoster_BuyNow"]) {
  991. return @"MenuBar_PrintPoster_Paid";
  992. } else if ([eveN isEqual:@"MenuBar_PrintMultiple_BuyNow"]) {
  993. return @"MenuBar_PrintMultiple_Paid";
  994. } else if ([eveN isEqual:@"MenuBar_PrintBooklet_BuyNow"]) {
  995. return @"MenuBar_PrintBooklet_Paid";
  996. }
  997. return nil;
  998. }
  999. - (NSDictionary *)_getPaidEventParamsWith:(NSString *)eventN {
  1000. NSString *eveN = eventN;
  1001. if (eveN == nil || eveN.length == 0) {
  1002. return nil;
  1003. }
  1004. // Paid_Tools SubTbr_Tools
  1005. if ([eveN isEqual:@"Reading_WebsiteLink_Paid"] ||
  1006. [eveN isEqual:@"Reading_EmailLink_Paid"] ||
  1007. [eveN isEqual:@"Reading_DynamicStamp_Paid"] ||
  1008. [eveN isEqual:@"Reading_CustomStamp_Paid"] ||
  1009. [eveN isEqual:@"Reading_Signature_Paid"] ||
  1010. [eveN isEqual:@"Reading_Table_Paid"]) {
  1011. return @{@"Paid_Tools" : @"SubTbr_Tools"};
  1012. }
  1013. // Paid_PageEdit SubTbr_PageEdit
  1014. else if ([eveN isEqual:@"Reading_InsertBlankPage_Paid"] ||
  1015. [eveN isEqual:@"Reading_InsertPDF_Paid"] ||
  1016. [eveN isEqual:@"Reading_InsertSacnner_Paid"] ||
  1017. [eveN isEqual:@"Reading_InsertImage_Paid"] ||
  1018. [eveN isEqual:@"Reading_InsertClipboard_Paid"] ||
  1019. [eveN isEqual:@"Reading_Replace_Paid"] ||
  1020. [eveN isEqual:@"Reading_Extract_Paid"] ||
  1021. [eveN isEqual:@"Reading_Split_Paid"] ||
  1022. [eveN isEqual:@"Reading_Rotate_Paid"] ||
  1023. [eveN isEqual:@"Reading_Reverse_Paid"] ||
  1024. [eveN isEqual:@"Reading_Copy_Paid"] ||
  1025. [eveN isEqual:@"Reading_Delete_Paid"] ||
  1026. [eveN isEqual:@"Reading_Merge_Paid"]) {
  1027. return @{@"Paid_PageEdit" : @"SubTbr_PageEdit"};
  1028. }
  1029. // Paid_PageEdit Home_PageEdit
  1030. else if ([eveN isEqual:@"Onbrd_EditPage_Paid"] ||
  1031. [eveN isEqual:@"Onbrd_Merge_Paid"]) {
  1032. return @{@"Paid_PageEdit" : @"Home_PageEdit"};
  1033. }
  1034. // Paid_Editor SubTbr_Editor
  1035. else if ([eveN isEqual:@"Reading_RemoveSecurity_Paid"] ||
  1036. [eveN isEqual:@"Reading_Compare_Paid"] ||
  1037. [eveN isEqual:@"Reading_AddWatermark_Paid"] ||
  1038. [eveN isEqual:@"Reading_RemoveWatermark_Paid"] ||
  1039. [eveN isEqual:@"Reading_AddBackground_Paid"] ||
  1040. [eveN isEqual:@"Reading_RemoveBackground_Paid"] ||
  1041. [eveN isEqual:@"Reading_AddHeaderFooter_Paid"] ||
  1042. [eveN isEqual:@"Reading_RemoveHeaderFooter_Paid"] ||
  1043. [eveN isEqual:@"Reading_AddBates_Paid"] ||
  1044. [eveN isEqual:@"Reading_RemoveBates_Paid"] ||
  1045. [eveN isEqual:@"Reading_Measure_Paid"]) {
  1046. return @{@"" : @""};
  1047. }
  1048. // Paid_Editor Home_Editor
  1049. else if ([eveN isEqual:@"Onbrd_Compare_Paid"] ||
  1050. [eveN isEqual:@"Onbrd_Background_Paid"] ||
  1051. [eveN isEqual:@"Onbrd_Watermard_Paid"] ||
  1052. [eveN isEqual:@"Onbrd_HeaderFooter_Paid"] ||
  1053. [eveN isEqual:@"Onbrd_Bates_Paid"] ||
  1054. [eveN isEqual:@"Onbrd_Security_Paid"]) {
  1055. return @{@"Paid_Editor" : @"Home_Editor"};
  1056. }
  1057. // Paid_Converter SubTbr_Converter
  1058. else if ([eveN isEqual:@"Reading_PDFtoWord_Paid"] ||
  1059. [eveN isEqual:@"Reading_PDFtoExcel_Paid"] ||
  1060. [eveN isEqual:@"Reading_PDFtoPPT_Paid"] ||
  1061. [eveN isEqual:@"Reading_PDFtoRTF_Paid"] ||
  1062. [eveN isEqual:@"Reading_PDFtoCSV_Paid"] ||
  1063. [eveN isEqual:@"Reading_PDFtoText_Paid"] ||
  1064. [eveN isEqual:@"Reading_PDFtoImage_Paid"] ||
  1065. [eveN isEqual:@"Reading_ExtractImage_Paid"]) {
  1066. return @{@"Paid_Converter" : @"SubTbr_Converter"};
  1067. }
  1068. // Paid_Converter Home_Converter
  1069. else if ([eveN isEqual:@"Onbrd_ConvertPDF_Paid"] ||
  1070. [eveN isEqual:@"Onbrd_PDFtoWord_Paid"] ||
  1071. [eveN isEqual:@"Onbrd_PDFtoExcel_Paid"] ||
  1072. [eveN isEqual:@"Onbrd_PDFtoPPT_Paid"] ||
  1073. [eveN isEqual:@"Onbrd_ImagetoPDF_Paid"]) {
  1074. return @{@"Paid_Converter" : @"Home_Converter"};
  1075. }
  1076. // Paid_Form SubTbr_Forms
  1077. else if ([eveN isEqual:@"Reading_TextField_Paid"] ||
  1078. [eveN isEqual:@"Reading_CheckBox_Paid"] ||
  1079. [eveN isEqual:@"Reading_RadioButton_Paid"] ||
  1080. [eveN isEqual:@"Reading_ListBox_Paid"] ||
  1081. [eveN isEqual:@"Reading_ComboBox_Paid"] ||
  1082. [eveN isEqual:@"Reading_Button_Paid"]) {
  1083. return @{@"Paid_Form" : @"SubTbr_Forms"};
  1084. }
  1085. // Paid_Sign SunTbr_Signature
  1086. else if ([eveN isEqual:@"Reading_FillSign_Signature_Paid"] ||
  1087. [eveN isEqual:@"Reading_DigitalSign_Paid"] ||
  1088. [eveN isEqual:@"Reading_ElectronicSign_Paid"]) {
  1089. return @{@"Paid_Sign" : @"SunTbr_Signature"};
  1090. }
  1091. // Paid_EditPDF Tbr_Edit PDF
  1092. else if ([eveN isEqual:@"Reading_EditPDF_Paid"] ||
  1093. [eveN isEqual:@"Reading_ReplaceText_Paid"]) {
  1094. return @{@"Paid_EditPDF" : @"Tbr_Edit PDF"};
  1095. }
  1096. // Paid_Redact Tbr_Redact
  1097. else if ([eveN isEqual:@"Reading_Redact_Paid"]) {
  1098. return @{@"Paid_Redact" : @"Tbr_Redact"};
  1099. }
  1100. // Paid_OCR SubTbr_OCR
  1101. else if ([eveN isEqual:@"Reading_OCR_Paid"] ||
  1102. [eveN isEqual:@"Reading_Convert_OCR_Paid"] ||
  1103. [eveN isEqual:@"Onbrd_OCR_Paid"]) {
  1104. return @{@"Paid_OCR" : @"SubTbr_OCR"};
  1105. }
  1106. // Paid_PageDisplay SubTbr_Page Display
  1107. else if ([eveN isEqual:@"Reading_SplitView_Paid"] ||
  1108. [eveN isEqual:@"Reading_Rotate_Paid"] ||
  1109. [eveN isEqual:@"Reading_Theme_Paid"] ||
  1110. [eveN isEqual:@"Reading_MultiTab_Paid"]) {
  1111. return @{@"Paid_PageDisplay" : @"SubTbr_Page Display"};
  1112. }
  1113. // Home_Others
  1114. else if ([eveN isEqual:@"Onbrd_PrintPoster_Paid"] ||
  1115. [eveN isEqual:@"Onbrd_PrintMultiple_Paid"] ||
  1116. [eveN isEqual:@"Onbrd_PrintBooklet_Paid"]) {
  1117. return @{@"Paid_Others" : @"Home_Others"};
  1118. }
  1119. // Paid_Others SubTbr_Others
  1120. else if ([eveN isEqual:@"Reading_Flatten_Paid"]) {
  1121. return @{@"Paid_Others" : @"SubTbr_Others"};
  1122. }
  1123. // Paid_Others MenuBar_Others
  1124. else if ([eveN isEqual:@"MenuBar_PrintPoster_Paid"] ||
  1125. [eveN isEqual:@"MenuBar_PrintMultiple_Paid"] ||
  1126. [eveN isEqual:@"MenuBar_PrintBooklet_Paid"]) {
  1127. return @{@"Paid_Others" : @"MenuBar_Others"};
  1128. }
  1129. return nil;
  1130. }
  1131. @end