123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- //
- // KMVerificationInfoViewController.m
- // PDF Reader Pro Edition
- //
- // Created by 王帅 on 2018/5/11.
- //
- #import "KMVerificationInfoViewController.h"
- #import <PDF_Reader_Pro-Swift.h>
- #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
|