123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667 |
- //
- // KMPurchaseCompareDMGWindowController.m
- // PDF Reader Pro Edition
- //
- // Created by 王帅 on 2018/5/8.
- //
- #import "KMPurchaseCompareDMGWindowController.h"
- #import <PDF_Reader_Pro-Swift.h>
- //#import "HyperLinkButton.h"
- #import "KMVerificationWindowController.h"
- //#import "KMPurchaseCompareWindowController.h"
- #import "VerificationManager.h"
- //#import "GAIManager.h"
- //#import "NSImage_SKExtensions.h"
- //#import "KMButton.h"
- //#import "KMBox.h"
- //#import "SKInspectPublicTool.h"
- //#import "FMTrackEventManager.h"
- //#import "NSFont+Custom.h"
- //#import "KMToolbarItemPopViewController.h"
- //#import "KMRecommondManager.h"
- static NSString *const KMPurchaseCompareDMGHeaderCellIdentifier = @"KMPurchaseCompareDMGHeaderCell";
- static NSString *const KMPurchaseCompareDMGCellIdentifier = @"KMPurchaseCompareDMGCell";
- #pragma mark - KMPurchaseCompareDMGHeaderCell
- @interface KMPurchaseCompareDMGHeaderCell : NSTableCellView
- @property (nonatomic,assign) IBOutlet NSView *contentView;
- @end
- @implementation KMPurchaseCompareDMGHeaderCell
- - (void)dealloc {
- [NSDistributedNotificationCenter.defaultCenter removeObserver:self];
- }
- - (void)awakeFromNib {
- [super awakeFromNib];
-
- self.contentView.wantsLayer = YES;
- [self updateViewColor];
- [NSDistributedNotificationCenter.defaultCenter addObserver:self selector:@selector(themeChanged:) name:@"AppleInterfaceThemeChangedNotification" object: nil];
- }
- - (void)themeChanged:(NSNotification *)notification {
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [self updateViewColor];
- });
- }
- - (void)updateViewColor {
- NSColor *textColor = [NSColor colorWithDeviceRed:51.0/255.0 green:51.0/255.0 blue:51.0/255.0 alpha:1.0];
- NSColor *viewColor = [NSColor colorWithDeviceRed:55.0/255.0 green:57.0/255.0 blue:59.0/255.0 alpha:0.06];
-
- if (@available(macOS 10.14, *)) {
- NSAppearanceName appearanceName = [[NSApp effectiveAppearance] bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
- if ([appearanceName isEqualToString:NSAppearanceNameDarkAqua]) {
- textColor = [NSColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:0.87];
- viewColor = [NSColor colorWithRed:52.0/255.0 green:53.0/255.0 blue:56.0/255.0 alpha:1.0];
- }
- }
-
- self.contentView.layer.backgroundColor = viewColor.CGColor;
- self.textField.textColor = textColor;
- self.textField.font = [NSFont boldSystemFontOfSize:14.0];
- }
- @end
- #pragma mark - KMPurchaseCompareDMGCell
- @interface KMPurchaseCompareDMGCell : NSTableCellView
- @property (nonatomic,assign) IBOutlet NSTextField *value1Label;
- @property (nonatomic,assign) IBOutlet NSTextField *value2Label;
- @property (nonatomic,assign) IBOutlet NSImageView *value1ImageView;
- @property (nonatomic,assign) IBOutlet NSImageView *value2ImageView;
- @property (nonatomic,assign) IBOutlet NSBox *lineBox;
- @end
- @implementation KMPurchaseCompareDMGCell
- - (void)dealloc {
- [NSDistributedNotificationCenter.defaultCenter removeObserver:self];
- }
- - (void)awakeFromNib {
- [super awakeFromNib];
- [self updateViewColor];
- [NSDistributedNotificationCenter.defaultCenter addObserver:self selector:@selector(themeChanged:) name:@"AppleInterfaceThemeChangedNotification" object: nil];
- }
- - (void)themeChanged:(NSNotification *)notification {
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [self updateViewColor];
- });
- }
- - (void)updateViewColor {
- NSColor *textColor = [NSColor colorWithRed:102.0/255.0 green:102.0/255.0 blue:102.0/255.0 alpha:0.85];
- NSColor *lineColor = [NSColor colorWithRed:204.0/255.0 green:204.0/255.0 blue:204.0/255.0 alpha:0.4];
-
- if (@available(macOS 10.14, *)) {
- NSAppearanceName appearanceName = [[NSApp effectiveAppearance] bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
- if ([appearanceName isEqualToString:NSAppearanceNameDarkAqua]) {
- textColor = [NSColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:0.6];
- lineColor = [NSColor colorWithRed:0.0/255.0 green:0.0/255.0 blue:0.0/255.0 alpha:0.4];
- }
- }
- self.value1Label.textColor = self.value2Label.textColor = textColor;
- self.lineBox.fillColor = lineColor;
- self.textField.textColor = textColor;
- }
- @end
- #pragma mark - KMPurchaseCompareDMGWindowController
- @interface KMPurchaseCompareDMGWindowController ()
- @property (nonatomic, assign) IBOutlet NSTextField *titleLabel;
- @property (assign) IBOutlet HyperLinkButton *enterLicenseButton;
- @property (assign) IBOutlet NSView *freeContendView;
- @property (assign) IBOutlet NSView *freeVersionBGView;
- @property (assign) IBOutlet NSTextField *freeVersionLbl;
- @property (assign) IBOutlet NSView *freeVersionLineView;
- @property (assign) IBOutlet NSTextField *freeVersionInfoLbl1;
- @property (assign) IBOutlet NSTextField *freeVersionInfoLbl2;
- @property (assign) IBOutlet NSTextField *freeVersionInfoLbl3;
- @property (assign) IBOutlet NSTextField *freeVersionInfoLbl4;
- @property (assign) IBOutlet NSTextField *freeVersionInfoLbl5;
- @property (assign) IBOutlet NSTextField *freeVersionInfoLbl6;
- @property (assign) IBOutlet NSTextField *freeVersionInfoLbl7;
- @property (assign) IBOutlet NSTextField *freeVersionInfoLbl8;
- @property (assign) IBOutlet NSTextField *freeVersionInfoLbl9;
- @property (assign) IBOutlet NSView *parmanentVerBGView;
- @property (assign) IBOutlet NSTextField *parmanentVerLbl;
- @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl1;
- @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl2;
- @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl3;
- @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl4;
- @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl5;
- @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl6;
- @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl7;
- @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl8;
- @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl9;
- @property (assign) IBOutlet KMButton *parmanentVerInfoBtn2;
- @property (assign) IBOutlet NSImageView *parmanentVerinfoimg2;
- @property (assign) IBOutlet NSView *parmanentInfoView;
- @property (assign) IBOutlet NSImageView *discountTipImage;
- @property (assign) IBOutlet NSTextField *oneTimeTipLbl;
- @property (assign) IBOutlet NSBox *freeTrialBox;
- @property (assign) IBOutlet KMButton *freeTrialButton;
- @property (assign) IBOutlet NSBox *buyNowBox;
- @property (assign) IBOutlet KMButton *buyNowButton;
- @property (assign) IBOutlet NSView *aiContendView;
- @property (assign) IBOutlet NSView *aiSepLineView;
- @property (assign) IBOutlet NSTextField *aiTitleLabel;
- @property (assign) IBOutlet NSTextField *aiInfoLbl1;
- @property (assign) IBOutlet NSTextField *aiInfoLbl2;
- @property (assign) IBOutlet NSTextField *aiInfoLbl3;
- @property (assign) IBOutlet NSTextField *aiInfoLbl4;
- @property (assign) IBOutlet NSTextField *aiPurchaseLabel;
- @property (assign) IBOutlet KMButton *aiPurchaseButton;
- @property (nonatomic, assign) NSModalSession modalSession;
- @property (nonatomic, retain) NSArray *dataSource;
- @property (nonatomic, retain) NSPopover *popOver;
- @end
- @implementation KMPurchaseCompareDMGWindowController
- #pragma mark Init Methods
- - (id)init {
- if (self = [super initWithWindowNibName:@"KMPurchaseCompareDMGWindowController"]) {
- }
- return self;
- }
- - (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- [NSDistributedNotificationCenter.defaultCenter removeObserver:self];
-
- }
- - (void)windowDidLoad {
- [super windowDidLoad];
-
- self.window.movableByWindowBackground = YES;
- self.window.backgroundColor = [NSColor whiteColor];
-
- __block typeof(self) blockSelf = self;
-
- [self.freeVersionInfoLbl2 setEnabled:YES];
-
- self.freeVersionLineView.wantsLayer = YES;
-
- self.freeVersionLbl.stringValue = NSLocalizedString(@"Free Version", nil);
- self.parmanentVerLbl.stringValue = NSLocalizedString(@"Permanent License", nil);
-
- self.freeVersionInfoLbl1.stringValue = self.parmanentVerInfoLbl1.stringValue = NSLocalizedString(@"View PDFs", nil);
- self.freeVersionInfoLbl2.stringValue = NSLocalizedString(@"Annotate PDFs (basic)", nil);
- self.parmanentVerInfoLbl2.stringValue = NSLocalizedString(@"Annotate PDFs (advanced)", nil);
- self.freeVersionInfoLbl3.stringValue = self.parmanentVerInfoLbl3.stringValue = NSLocalizedString(@"Unlimited file conversion", nil);
- self.freeVersionInfoLbl4.stringValue = self.parmanentVerInfoLbl4.stringValue = NSLocalizedString(@"Edit PDF text and images", nil);
- self.freeVersionInfoLbl5.stringValue = self.parmanentVerInfoLbl5.stringValue = NSLocalizedString(@"Digital signature", nil);
- self.freeVersionInfoLbl6.stringValue = self.parmanentVerInfoLbl6.stringValue = NSLocalizedString(@"Organize pages", nil);
- self.freeVersionInfoLbl7.stringValue = self.parmanentVerInfoLbl7.stringValue = NSLocalizedString(@"Batch process", nil);
- self.freeVersionInfoLbl8.stringValue = self.parmanentVerInfoLbl8.stringValue = NSLocalizedString(@"OCR PDFs", nil);
- self.freeVersionInfoLbl9.stringValue = self.parmanentVerInfoLbl9.stringValue = NSLocalizedString(@"Ad-free", nil);
- // self.parmanentVerinfoimg2.toolTip = NSLocalizedString(@"Support insert links and custom stamps", nil);
- self.parmanentVerInfoBtn2.mouseMoveCallback = ^(BOOL mouseEntered) {
- if (mouseEntered) {
- KMToolbarItemPopViewController *popViewController = [[KMToolbarItemPopViewController alloc] init];
- self.popOver = [[NSPopover alloc] init];
- self.popOver.contentViewController = popViewController;
- self.popOver.animates = NO;
- self.popOver.behavior = NSPopoverBehaviorSemitransient;
-
- self.popOver.contentSize = popViewController.view.frame.size;
- [popViewController updateWithHelpTipWithHelpTip:NSLocalizedString(@"Support insert links and custom stamps", nil)];
- [self.popOver showRelativeToRect:self.parmanentVerInfoBtn2.frame ofView:self.parmanentInfoView preferredEdge:NSRectEdgeMaxY];
- // self.parmanentVerinfoimg2.image = [NSImage imageNamed:@"ic_Tooltip_hover"];
- } else {
- [self.popOver close];
- // self.parmanentVerinfoimg2.image = [NSImage imageNamed:@"ic_Tooltip"];
- }
- };
-
-
-
- self.oneTimeTipLbl.stringValue = NSLocalizedString(@"one-time purchase", nil);
- self.enterLicenseButton.title = NSLocalizedString(@"Enter License", nil);
- [self.enterLicenseButton setTitleColor:[KMAppearance KMColor_Layout_W0]];
- self.enterLicenseButton.mouseMoveCallback = ^(BOOL mouseEntered) {
- if (mouseEntered) {
- [blockSelf.enterLicenseButton setTitleColor:[KMAppearance KMColor_Layout_W70]];
- } else {
- [blockSelf.enterLicenseButton setTitleColor:[KMAppearance KMColor_Layout_W0]];
- }
- };
-
- self.titleLabel.font = [NSFont SFMediumFontWithSize:20];
- self.freeVersionLbl.font = [NSFont UbuntuBoldFontWithSize:24];
- self.parmanentVerLbl.font = [NSFont UbuntuBoldFontWithSize:24];
- self.freeVersionInfoLbl1.font = self.parmanentVerInfoLbl1.font = [NSFont SFProTextRegularFont:14.];
- self.freeVersionInfoLbl2.font = [NSFont SFProTextRegularFont:14.];
- self.parmanentVerInfoLbl2.font = [NSFont SFProTextRegularFont:14.];
- self.freeVersionInfoLbl3.font = self.parmanentVerInfoLbl3.font = [NSFont SFProTextRegularFont:14.];
- self.freeVersionInfoLbl4.font = self.parmanentVerInfoLbl4.font = [NSFont SFProTextRegularFont:14.];
- self.freeVersionInfoLbl5.font = self.parmanentVerInfoLbl5.font = [NSFont SFProTextRegularFont:14.];
- self.freeVersionInfoLbl6.font = self.parmanentVerInfoLbl6.font = [NSFont SFProTextRegularFont:14.];
- self.freeVersionInfoLbl7.font = self.parmanentVerInfoLbl7.font = [NSFont SFProTextRegularFont:14.];
- self.freeVersionInfoLbl8.font = self.parmanentVerInfoLbl8.font = [NSFont SFProTextRegularFont:14.];
- self.freeVersionInfoLbl9.font = self.parmanentVerInfoLbl9.font = [NSFont SFProTextRegularFont:14.];
- self.buyNowButton.font = [NSFont UbuntuMediumFontWithSize:16];
- self.freeTrialButton.font = [NSFont UbuntuMediumFontWithSize:16];
-
-
- self.freeContendView.wantsLayer = YES;
- self.freeContendView.layer.cornerRadius = 12;
- self.freeContendView.layer.masksToBounds = YES;
-
- self.parmanentVerBGView.wantsLayer = YES;
- self.parmanentVerBGView.layer.cornerRadius = 12;
- self.parmanentVerBGView.layer.masksToBounds = YES;
-
- self.buyNowBox.wantsLayer = YES;
- self.buyNowBox.fillColor = [NSColor colorWithRed:255/255. green:94/255. blue:44/255. alpha:1.];
- self.buyNowBox.cornerRadius = CGRectGetHeight(self.buyNowBox.frame)/2.;
- self.buyNowBox.layer.masksToBounds = YES;
-
- self.buyNowButton.wantsLayer = YES;
- self.buyNowButton.layer.cornerRadius = 1.0;
- self.buyNowButton.title = NSLocalizedString(@"Buy Now", nil);
- self.buyNowButton.mouseMoveCallback = ^(BOOL mouseEntered) {
- if (mouseEntered) {
- blockSelf.buyNowButton.layer.backgroundColor = [[NSColor blackColor] colorWithAlphaComponent:0.15].CGColor;
- } else {
- blockSelf.buyNowButton.layer.backgroundColor = [NSColor clearColor].CGColor;
- }
- };
-
- self.freeTrialBox.cornerRadius = CGRectGetHeight(self.freeTrialBox.frame)/2.;
- self.freeTrialBox.borderWidth = 1.;
-
- self.freeTrialButton.target = self;
- self.freeTrialButton.action = @selector(buttonItemClicked_License:);
- self.freeTrialButton.mouseMoveCallback = ^(BOOL mouseEntered) {
- if ([KMAppearance isDarkMode]) {
- if (mouseEntered) {
- blockSelf.freeTrialBox.fillColor = [NSColor colorWithRed:179/255. green:159/255. blue:1 alpha:0.2];
- } else {
- blockSelf.freeTrialBox.fillColor = [NSColor colorWithRed:179/255. green:159/255. blue:1 alpha:0.07];
- }
- } else {
- if (mouseEntered) {
- blockSelf.freeTrialBox.fillColor = [NSColor colorWithRed:85/255. green:40/255. blue:1 alpha:0.15];
- } else {
- blockSelf.freeTrialBox.fillColor = [NSColor colorWithRed:85/255. green:40/255. blue:1 alpha:0.07];
- }
- }
- };
- self.discountTipImage.hidden = YES;
-
- self.aiSepLineView.wantsLayer = YES;
- self.aiInfoLbl1.font = self.aiInfoLbl2.font = self.aiInfoLbl3.font = self.aiInfoLbl4.font = [NSFont SFProTextRegularFont:14];
- self.aiPurchaseLabel.font = [NSFont UbuntuMediumFontWithSize:16];
-
- self.aiTitleLabel.stringValue = NSLocalizedString(@"AI Tools", nil);
- self.aiInfoLbl1.stringValue = NSLocalizedString(@"AI Summarize", nil);
- self.aiInfoLbl2.stringValue = NSLocalizedString(@"AI Rewrite", nil);
- self.aiInfoLbl3.stringValue = NSLocalizedString(@"AI Proofread", nil);
- self.aiInfoLbl4.stringValue = NSLocalizedString(@"AI Translate", nil);
- self.aiPurchaseLabel.stringValue = NSLocalizedString(@"Buy Now", nil);
- self.aiPurchaseButton.wantsLayer = YES;
- self.aiPurchaseButton.layer.cornerRadius = CGRectGetHeight(self.aiPurchaseButton.frame)/2.;
- self.aiPurchaseButton.layer.masksToBounds = YES;
- self.aiPurchaseButton.mouseMoveCallback = ^(BOOL mouseEntered) {
- if (mouseEntered) {
- self.aiPurchaseButton.layer.backgroundColor = [[NSColor whiteColor] colorWithAlphaComponent:0.2].CGColor;
- } else {
- self.aiPurchaseButton.layer.backgroundColor = [NSColor clearColor].CGColor;
- }
- };
-
- [self updateViewColor];
-
- [self updatePurchaseInformation];
-
- [NSDistributedNotificationCenter.defaultCenter addObserver:self selector:@selector(themeChanged:) name:@"AppleInterfaceThemeChangedNotification" object: nil];
-
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(recommondInfoUpdateNoti:) name:@"KMRecommondInfoUpdateNoti" object:nil];
- }
- #pragma mark - Private Methods
- - (void)updateViewColor {
-
- if ([KMAppearance isDarkMode]) {
- self.freeContendView.layer.backgroundColor = [[NSColor blackColor] colorWithAlphaComponent:0.3].CGColor;
- self.freeVersionLineView.layer.backgroundColor = [[NSColor whiteColor] colorWithAlphaComponent:0.1].CGColor;
- self.aiSepLineView.layer.backgroundColor = [[NSColor whiteColor] colorWithAlphaComponent:0.1].CGColor;
- self.freeVersionLbl.textColor = [[NSColor whiteColor] colorWithAlphaComponent:0.5];
- self.freeTrialBox.fillColor = [NSColor colorWithRed:179/255. green:159/255. blue:1 alpha:0.07];
- self.freeTrialBox.borderColor = [NSColor colorWithRed:207/255. green:146/255. blue:1 alpha:1];
-
- self.freeVersionInfoLbl1.textColor =
- self.freeVersionInfoLbl2.textColor =
- self.freeVersionInfoLbl3.textColor =
- self.freeVersionInfoLbl4.textColor =
- self.freeVersionInfoLbl5.textColor =
- self.freeVersionInfoLbl6.textColor =
- self.freeVersionInfoLbl7.textColor =
- self.freeVersionInfoLbl8.textColor =
- self.freeVersionInfoLbl9.textColor = [NSColor whiteColor];
-
- self.parmanentVerInfoLbl1.textColor =
- self.parmanentVerInfoLbl2.textColor =
- self.parmanentVerInfoLbl3.textColor =
- self.parmanentVerInfoLbl4.textColor =
- self.parmanentVerInfoLbl5.textColor =
- self.parmanentVerInfoLbl6.textColor =
- self.parmanentVerInfoLbl7.textColor =
- self.parmanentVerInfoLbl8.textColor =
- self.parmanentVerInfoLbl9.textColor = [NSColor whiteColor];
-
- self.aiInfoLbl1.textColor = self.aiInfoLbl2.textColor = self.aiInfoLbl3.textColor = self.aiInfoLbl4.textColor = [NSColor whiteColor];
- self.aiPurchaseLabel.textColor = [NSColor whiteColor];
-
- self.aiTitleLabel.textColor = [NSColor colorWithRed:239/255. green:235/255. blue:255/255. alpha:1];
- } else {
- self.freeContendView.layer.backgroundColor = [[NSColor whiteColor] colorWithAlphaComponent:0.7].CGColor;
- self.freeVersionLineView.layer.backgroundColor = [NSColor colorWithRed:0 green:33/255. blue:67/255. alpha:0.1].CGColor;
- self.aiSepLineView.layer.backgroundColor = [NSColor colorWithRed:0 green:33/255. blue:67/255. alpha:0.1].CGColor;
- self.freeVersionLbl.textColor = [NSColor colorWithRed:129/255. green:125/255. blue:178/255. alpha:1.];
- self.freeTrialBox.fillColor = [NSColor colorWithRed:85/255. green:40/255. blue:1 alpha:0.07];
- self.freeTrialBox.borderColor = [NSColor colorWithRed:160/255. green:40/255. blue:1 alpha:1];
-
- self.freeVersionInfoLbl1.textColor =
- self.freeVersionInfoLbl2.textColor =
- self.freeVersionInfoLbl3.textColor =
- self.freeVersionInfoLbl4.textColor =
- self.freeVersionInfoLbl5.textColor =
- self.freeVersionInfoLbl6.textColor =
- self.freeVersionInfoLbl7.textColor =
- self.freeVersionInfoLbl8.textColor =
- self.freeVersionInfoLbl9.textColor = [NSColor colorWithRed:20/255.0 green:0/255.0 blue:102/255.0 alpha:1];
-
- self.parmanentVerInfoLbl1.textColor =
- self.parmanentVerInfoLbl2.textColor =
- self.parmanentVerInfoLbl3.textColor =
- self.parmanentVerInfoLbl4.textColor =
- self.parmanentVerInfoLbl5.textColor =
- self.parmanentVerInfoLbl6.textColor =
- self.parmanentVerInfoLbl7.textColor =
- self.parmanentVerInfoLbl8.textColor =
- self.parmanentVerInfoLbl9.textColor = [NSColor whiteColor];
-
- self.aiInfoLbl1.textColor = self.aiInfoLbl2.textColor = self.aiInfoLbl3.textColor = self.aiInfoLbl4.textColor = [NSColor colorWithRed:20/255. green:0 blue:102/255. alpha:1];
- self.aiPurchaseLabel.textColor = [NSColor whiteColor];
- self.aiTitleLabel.textColor = [NSColor colorWithRed:20/255. green:0 blue:102/255. alpha:1];
- }
-
- self.parmanentVerLbl.textColor = [NSColor colorWithRed:255/255. green:94/255. blue:44/255. alpha:1.];
- self.oneTimeTipLbl.textColor = [NSColor colorWithRed:255/255. green:231/255. blue:106/255. alpha:1.];
-
- if ([KMAppearance isDarkMode]) {
- [self.freeTrialButton setTitleColor:[NSColor colorWithRed:178/255. green:165/255. blue:1 alpha:1]];
- } else {
- [self.freeTrialButton setTitleColor:[NSColor colorWithRed:160/255. green:40/255. blue:1 alpha:1]];
- }
- }
- - (void)updatePurchaseInformation {
- self.freeTrialBox.hidden = NO;
- self.titleLabel.stringValue = NSLocalizedString(@"Upgrade to Pro Version", nil);
- self.titleLabel.textColor = [NSColor whiteColor];
-
- [self.freeTrialButton setTitle:NSLocalizedString(@"7-day Free Trial", nil)];
- if (ActivityStatusVerification == [VerificationManager manager].status) {
- self.freeTrialBox.hidden = YES;
- } else if (ActivityStatusNone == [VerificationManager manager].status) {
-
- } else if (ActivityStatusTrialExpire == [VerificationManager manager].status) {
- self.freeTrialBox.hidden = YES;
- if ([VerificationManager manager].secondTrialEnabled) {
- self.freeTrialBox.hidden = NO;
- }
- } else {
- self.freeTrialBox.hidden = YES;
- }
- if ([KMAppearance isDarkMode]) {
- [self.freeTrialButton setTitleColor:[NSColor colorWithRed:178/255. green:165/255. blue:1 alpha:1]];
- } else {
- [self.freeTrialButton setTitleColor:[NSColor colorWithRed:160/255. green:40/255. blue:1 alpha:1]];
- }
- [self.buyNowButton setTitleColor:[NSColor whiteColor]];
-
- if (KMAdvertisementManager.manager.info.discountContent.content.count > 0) {
- KMAdvertisementItemInfo *info = KMAdvertisementManager.manager.info.discountContent.content.firstObject;
- if ([KMAdvertisementManager checkAdvertisementValid:info]) {
- self.discountTipImage.hidden = NO;
-
- NSURL *url = [NSURL URLWithString:[KMAdvertisementModelTransition transitionImagePathWithImage:info.image highlight:NO]];
- self.discountTipImage.image = [KMAdvertisementImage imageWithURLWithUrl:url completion:^(NSImage * _Nonnull image) {
- self.discountTipImage.image = image;
- }];
- } else {
- self.discountTipImage.hidden = YES;
- }
- }
- }
- #pragma mark - Window Method
- - (void)showWindow:(id)sender {
- [super showWindow:nil];
-
- [self.window center];
- [self.window orderFront:nil];
-
- [self updatePurchaseInformation];
- }
- - (BOOL)windowShouldClose:(id)sender {
- [self endModal:sender];
- return YES;
- }
- - (void)close {
- [super close];
- [self endModal:nil];
- }
- - (void)updateTitle:(NSString *)title andColor:(NSColor *)titleColor {
- self.titleLabel.stringValue = title ?:@"";
- self.titleLabel.textColor = titleColor ?:[NSColor labelColor];
-
- }
- #pragma mark - IBAction
- - (IBAction)startModal:(id)sender {
-
- [NSApp stopModal];
-
- NSInteger modalCode;
- self.modalSession = [NSApp beginModalSessionForWindow:self.window];
- do {
- modalCode = [NSApp runModalSession:self.modalSession];
- } while (modalCode == NSRunContinuesResponse);
- }
- - (IBAction)endModal:(id)sender {
- if (self.modalSession) {
- [NSApp stopModal];
- [NSApp endModalSession:self.modalSession];
- [self.window orderOut:self];
-
- self.modalSession = nil;
- }
- }
- - (void)showWindowRestore:(id)sender {
- [self showWindow:sender];
- }
- - (IBAction)enterLicenseAction:(id)sender {
- // if (ActivityStatusNone == [VerificationManager manager].status) {
- // [self close];
- // KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeActivate];
- // vc.callback = ^{
- // [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
- // };
- // [vc showWindow:nil];
- // } else if (ActivityStatusTrialExpire == [VerificationManager manager].status) {
- // if ([VerificationManager manager].secondTrialEnabled) {
- // [[FMTrackEventManager manager] trackEvent:@"Tbr" withProperties:@{@"Tbr_Btn":@"Btn_Tbr_SecondTrial"}];
- // [[VerificationManager manager] trialForDays:7
- // email:[VerificationManager manager].email
- // name:[VerificationManager manager].accountName
- // complention:^(ActivityStatus status, NSDictionary *info, NSError *error) {
- // if (error ||
- // status != ActivityStatusTrial) {
- // NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Activation Error", nil)
- // defaultButton:NSLocalizedString(@"Try Again", nil)
- // alternateButton:nil
- // otherButton:nil
- // informativeTextWithFormat:NSLocalizedString(@"Failed to sign up for the free trial. Please make sure your internet connection is available and try again later.", nil), nil];
- // [alert runModal];
- // } else {
- // KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeRepeatTrialSuccess];
- // [vc showWindow:nil];
- // }
- // }];
- // [self close];
- // } else {
- // [self close];
- // KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeActivate];
- // vc.callback = ^{
- // [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
- // };
- // [vc showWindow:nil];
- // }
- // } else {
- [self close];
- KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeActivate];
- vc.callback = ^{
- [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
- };
- [vc showWindow:nil];
- // }
- }
- - (IBAction)buttonItemClicked_Buy:(id)sender {
- #if VERSION_DMG
- NSURL *url = [NSURL URLWithString:@"https://www.pdfreaderpro.com/store?utm_source=app_dmg&utm_medium=dmg_puw_comparison"];
- if([SKInspectPublicTool currentisLanguageHans]) {
- url = [NSURL URLWithString:@"https://www.pdfreaderpro.com/zh-cn/store?utm_source=app_dmg&utm_medium=dmg_puw_comparison"];
- }
- [[NSWorkspace sharedWorkspace] openURL:url];
- [[FMTrackEventManager defaultManager] trackEventWithEvent:@"PUW" withProperties:@{@"PUW_Btn":@"PUW_Btn_UpgradeBuyNow"}];
- #endif
-
- }
- - (IBAction)buttonItemClicked_CloseWindow:(id)sender {
- [self close];
- }
- - (void)buttonItemClicked_License:(id)sender {
- // if (ActivityStatusNone == [VerificationManager manager].status) {
- // [self close];
- //
- // KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeTrial];
- // [vc showWindow:nil];
- // } else if (ActivityStatusTrialExpire == [VerificationManager manager].status) {
- if ([VerificationManager manager].secondTrialEnabled) {
- [[FMTrackEventManager defaultManager] trackEventWithEvent:@"Tbr" withProperties:@{@"Tbr_Btn":@"Btn_Tbr_SecondTrial"}];
- [[VerificationManager manager] trialForDays:7
- email:[VerificationManager manager].email
- name:[VerificationManager manager].accountName
- complention:^(ActivityStatus status, NSDictionary *info, NSError *error) {
- if (error ||
- status != ActivityStatusTrial) {
- NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Activation Error", nil)
- defaultButton:NSLocalizedString(@"Try Again", nil)
- alternateButton:nil
- otherButton:nil
- informativeTextWithFormat:NSLocalizedString(@"Failed to sign up for the free trial. Please make sure your internet connection is available and try again later.", nil), nil];
- [alert runModal];
- } else {
- KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeRepeatTrialSuccess];
- [vc showWindow:nil];
- }
- }];
- [self close];
- } else {
- [self close];
- KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeTrial];
- vc.callback = ^{
- [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
- };
- [vc showWindow:nil];
- }
- // } else {
- // [self close];
- // KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeActivate];
- // vc.callback = ^{
- // [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
- // };
- // [vc showWindow:nil];
- // }
- }
- - (IBAction)aiPurchaseButtonClick:(NSButton *)sender {
- NSURL *url = [NSURL URLWithString:kAIStoreServerLink];
- [[NSWorkspace sharedWorkspace] openURL:url];
-
- [[FMTrackEventManager defaultManager] trackEventWithEvent:@"PUW" withProperties:@{@"PUW_Btn":@"PUW_Btn_BuyAITools"}];
- }
- #pragma mark - Noti
- - (void)themeChanged:(NSNotification *)notification {
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [self updateViewColor];
- });
- }
- - (void)recommondInfoUpdateNoti:(NSNotification *)noti {
- dispatch_async(dispatch_get_main_queue(), ^{
- if (KMAdvertisementManager.manager.info.discountContent.content.count > 0) {
- KMAdvertisementItemInfo *info = KMAdvertisementManager.manager.info.discountContent.content.firstObject;
- if ([KMAdvertisementManager checkAdvertisementValid:info]) {
- self.discountTipImage.hidden = NO;
- self.discountTipImage.image = info.image;
- } else {
- self.discountTipImage.hidden = YES;
- }
- }
- });
- }
- @end
|