// // KMVerificationInfoViewController.m // PDF Reader Pro Edition // // Created by 王帅 on 2018/5/11. // #import "KMVerificationInfoViewController.h" #import #import "NSObject+DeviceInfo.h" #import "VerificationManager.h" @interface KMVerificationInfoViewController () @property (nonatomic, assign) IBOutlet NSTextField *label; @property (nonatomic, assign) IBOutlet NSTextField *licenseLabel; @property (nonatomic, assign) IBOutlet NSTextField *license; @property (nonatomic, assign) IBOutlet NSTextField *deviceLabel; @property (nonatomic, assign) IBOutlet NSTextField *device; @property (nonatomic, assign) IBOutlet KMCustomButton *continueButton; @property (assign) IBOutlet NSButton *unbindButton; @property (nonatomic, retain) CALayer *continueButtonLayer; @end @implementation KMVerificationInfoViewController #pragma mark Init Methods - (instancetype)init { if (self = [super initWithNibName:@"KMVerificationInfoViewController" bundle:nil]) { } return self; } - (void)dealloc { } #pragma mark Setter Methods - (void)loadView { [super loadView]; // Do view setup here. self.continueButton.wantsLayer = YES; self.continueButton.layer.masksToBounds = YES; self.continueButton.layer.cornerRadius = 1.0; self.label.stringValue = NSLocalizedString(@"Successful Activation!", nil); self.licenseLabel.stringValue = NSLocalizedString(@"License ID:", nil); self.deviceLabel.stringValue = NSLocalizedString(@"UUID:", nil); self.continueButton.title = NSLocalizedString(@"Continue", nil); [self.continueButton setTitleColor:[NSColor whiteColor]]; self.unbindButton.title = NSLocalizedString(@"Unbind License Code", nil); NSString *cdkey = [VerificationManager manager].detailInfo[@"device"][@"cdkey"]; NSString *unique_sn = [VerificationManager manager].detailInfo[@"device"][@"uniqueSn"]; self.license.stringValue = cdkey ? : @""; self.device.stringValue = unique_sn ? : [self udid]; self.continueButtonLayer = [CALayer layer]; [self.continueButton.layer addSublayer:self.continueButtonLayer]; self.continueButtonLayer.frame = CGRectMake(0, 0, CGRectGetWidth(_continueButton.bounds), CGRectGetHeight(_continueButton.bounds)); self.continueButtonLayer.backgroundColor = [KMAppearance KMColor_Status_Sel].CGColor; self.continueButtonLayer.cornerRadius = 0; self.continueButtonLayer.hidden = YES; __weak typeof(self) weakSelf = self; self.continueButton.mouseMoveCallback = ^(BOOL mouseEntered) { if (mouseEntered) weakSelf.continueButtonLayer.hidden = NO; else weakSelf.continueButtonLayer.hidden = YES; }; [self.label setTextColor:[KMAppearance KMColor_Layout_H0]]; [self.licenseLabel setTextColor:[KMAppearance KM_242424_Color75]]; [self.deviceLabel setTextColor:[KMAppearance KM_242424_Color75]]; [self.license setTextColor:[KMAppearance KM_242424_Color75]]; [self.device setTextColor:[KMAppearance KM_242424_Color75]]; } #pragma mark - Getter - (NSString *)udid { return GetHardwareUUID()?:@""; } #pragma mark - IBAction - (IBAction)continueButtonAction:(id)sender { if (self.callback) { self.callback(); } } - (IBAction)unbindAction:(NSButton *)sender { if (self.unbindAction) { self.unbindAction(); } } @end