123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- //
- // KMUnlockAlertViewController.m
- // PDF Reader Pro Edition
- //
- // Created by Niehaoyu on 2023/4/3.
- //
- #import "KMUnlockAlertViewController.h"
- #import <PDF_Reader_Pro-Swift.h>
- #import "VerificationManager.h"
- @interface KMUnlockAlertViewController ()
- @property (assign) IBOutlet NSTextField *titleLbl;
- @property (assign) IBOutlet NSTextField *subTitleLbl;
- @property (assign) IBOutlet NSView *desView1;
- @property (assign) IBOutlet NSImageView *desImg1;
- @property (assign) IBOutlet NSTextField *deslbl1;
- @property (assign) IBOutlet NSImageView *desImg2;
- @property (assign) IBOutlet NSTextField *desLbl2;
- @property (assign) IBOutlet NSImageView *desImg3;
- @property (assign) IBOutlet NSTextField *desLbl3;
- @property (assign) IBOutlet NSImageView *desImg4;
- @property (assign) IBOutlet NSTextField *desLbl4;
- @property (assign) IBOutlet NSImageView *desImg5;
- @property (assign) IBOutlet NSTextField *desLbl5;
- @property (assign) IBOutlet HyperLinkButton *continueButton;
- @property (assign) IBOutlet NSBox *buyNowBox;
- @property (assign) IBOutlet KMCustomButton *buyNowButton;
- @property (nonatomic, retain) NSTrackingArea *trackingArea;
- @end
- @implementation KMUnlockAlertViewController
- - (void)dealloc {
- if (self.trackingArea) {
- [self.view removeTrackingArea:self.trackingArea];
- }
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do view setup here.
-
- self.titleLbl.font = [NSFont boldSystemFontOfSize:18.];
- self.subTitleLbl.font = [NSFont systemFontOfSize:11.];
- self.deslbl1.font = self.desLbl2.font = self.desLbl3.font = self.desLbl4.font = self.desLbl5.font = [NSFont systemFontOfSize:13.];
-
- self.titleLbl.stringValue = NSLocalizedString(@"Unlock All Advanced Features", nil);
-
- self.deslbl1.stringValue = NSLocalizedString(@"Convert PDF from/to Word/Excel/PPT/HTML/Image, etc.", nil);
- self.desLbl2.stringValue = NSLocalizedString(@"Edit and Modify Texts in PDFs", nil);
- self.desLbl3.stringValue = NSLocalizedString(@"Organize pages", nil);
- self.desLbl4.stringValue = NSLocalizedString(@"Optical Character Recognition (OCR)", nil);
- self.desLbl5.stringValue = NSLocalizedString(@"Create&Fill Forms, digital sign PDFs", nil);
-
- __block typeof(self) blockSelf = self;
-
- self.buyNowBox.wantsLayer = YES;
- self.buyNowBox.layer.cornerRadius = CGRectGetHeight(self.buyNowBox.frame)/2.0;
- self.buyNowBox.layer.masksToBounds = YES;
-
- self.buyNowButton.wantsLayer = YES;
- self.buyNowButton.title = NSLocalizedString(@"Buy Now", nil);
- [self.buyNowButton setTitleColor:[NSColor whiteColor]];
- self.buyNowButton.mouseMoveCallback = ^(BOOL mouseEntered) {
- if (mouseEntered) {
- blockSelf.buyNowButton.layer.backgroundColor = [NSColor colorWithRed:0 green:0 blue:0 alpha:0.15].CGColor;
- } else {
- blockSelf.buyNowButton.layer.backgroundColor = [NSColor clearColor].CGColor;
- }
- };
-
- self.continueButton.wantsLayer = YES;
- self.continueButton.layer.masksToBounds = YES;
- self.continueButton.layer.cornerRadius = 1.0;
- self.continueButton.title = NSLocalizedString(@"Enter License", nil);
- [self.continueButton setTitleColor:[NSColor colorWithRed:39/255. green:60/255. blue:98/255. alpha:1]];
- if ([KMAppearance isDarkMode]) {
- [self.continueButton setTitleColor:[NSColor whiteColor]];
- }
- self.continueButton.mouseMoveCallback = ^(BOOL mouseEntered) {
- if ([KMAppearance isDarkMode]) {
- if (mouseEntered) {
- [blockSelf.continueButton setTitleColor:[NSColor whiteColor]];
- } else {
- [blockSelf.continueButton setTitleColor:[NSColor whiteColor]];
- }
- } else {
- if (mouseEntered) {
- [blockSelf.continueButton setTitleColor:[NSColor colorWithRed:8/255. green:124/255. blue:255/255. alpha:1.]];
- } else {
- [blockSelf.continueButton setTitleColor:[NSColor colorWithRed:39/255. green:60/255. blue:98/255. alpha:1.]];
- }
- }
- };
-
- self.subTitleLbl.stringValue = NSLocalizedString(@"Upgrade PDF Reader Pro to enjoy the full functions.", nil);
- if ([KMAppearance isDarkMode]) {
- self.subTitleLbl.textColor = [KMAppearance KMColor_Layout_W70];
- } else {
- self.subTitleLbl.textColor = [KMAppearance KMColor_Layout_H2];
- }
- if (ActivityStatusTrialExpire == [VerificationManager manager].status &&
- [VerificationManager manager].secondTrialEnabled == false) {
- self.subTitleLbl.stringValue = NSLocalizedString(@"Free trial expired. Upgrade PDF Reader Pro to enjoy the full functions.", nil);
- self.subTitleLbl.textColor = [KMAppearance KMColor_Status_Err];
- }
-
- self.titleLbl.textColor = [KMAppearance KMColor_Layout_H0];
- self.deslbl1.textColor = self.desLbl2.textColor = self.desLbl3.textColor = self.desLbl4.textColor = self.desLbl5.textColor = [KMAppearance KMColor_Layout_H0];
- }
- - (void)addtrackingAreaInfo {
- if (!self.trackingArea) {
- self.trackingArea = [[NSTrackingArea alloc] initWithRect:self.view.bounds options:NSTrackingMouseEnteredAndExited | NSTrackingInVisibleRect | NSTrackingActiveAlways owner:self userInfo:nil];
- }
- [self.view addTrackingArea:self.trackingArea];
- }
- - (void)removeTrackingAreaInfo {
- if (self.trackingArea) {
- [self.view removeTrackingArea:self.trackingArea];
- }
- }
- #pragma mark - IBAction
- - (IBAction)continueAction:(id)sender {
- if (self.callback) {
- self.callback(1);
- }
- }
- - (IBAction)buynowAction:(id)sender {
- if (self.callback) {
- self.callback(2);
- }
- }
- - (void)mouseEntered:(NSEvent *)event {
- [super mouseEntered:event];
-
- if (self.mouseEventCall) {
- self.mouseEventCall(YES);
- }
- }
- - (void)mouseExited:(NSEvent *)event {
- [super mouseExited:event];
-
- if (self.mouseEventCall) {
- self.mouseEventCall(NO);
- }
- }
- @end
|