KMVerificationInfoViewController.m 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. //
  2. // KMVerificationInfoViewController.m
  3. // PDF Reader Pro Edition
  4. //
  5. // Created by 王帅 on 2018/5/11.
  6. //
  7. #import "KMVerificationInfoViewController.h"
  8. #import <PDF_Reader_Pro-Swift.h>
  9. #import "NSObject+DeviceInfo.h"
  10. #import "VerificationManager.h"
  11. @interface KMVerificationInfoViewController ()
  12. @property (nonatomic, assign) IBOutlet NSTextField *label;
  13. @property (nonatomic, assign) IBOutlet NSTextField *licenseLabel;
  14. @property (nonatomic, assign) IBOutlet NSTextField *license;
  15. @property (nonatomic, assign) IBOutlet NSTextField *deviceLabel;
  16. @property (nonatomic, assign) IBOutlet NSTextField *device;
  17. @property (nonatomic, assign) IBOutlet KMCustomButton *continueButton;
  18. @property (assign) IBOutlet NSButton *unbindButton;
  19. @property (nonatomic, retain) CALayer *continueButtonLayer;
  20. @end
  21. @implementation KMVerificationInfoViewController
  22. #pragma mark Init Methods
  23. - (instancetype)init {
  24. if (self = [super initWithNibName:@"KMVerificationInfoViewController" bundle:nil]) {
  25. }
  26. return self;
  27. }
  28. - (void)dealloc {
  29. }
  30. #pragma mark Setter Methods
  31. - (void)loadView {
  32. [super loadView];
  33. // Do view setup here.
  34. self.continueButton.wantsLayer = YES;
  35. self.continueButton.layer.masksToBounds = YES;
  36. self.continueButton.layer.cornerRadius = 1.0;
  37. self.label.stringValue = NSLocalizedString(@"Successful Activation!", nil);
  38. self.licenseLabel.stringValue = NSLocalizedString(@"License ID:", nil);
  39. self.deviceLabel.stringValue = NSLocalizedString(@"UUID:", nil);
  40. self.continueButton.title = NSLocalizedString(@"Continue", nil);
  41. [self.continueButton setTitleColor:[NSColor whiteColor]];
  42. self.unbindButton.title = NSLocalizedString(@"Unbind License Code", nil);
  43. NSString *cdkey = [VerificationManager manager].detailInfo[@"device"][@"cdkey"];
  44. NSString *unique_sn = [VerificationManager manager].detailInfo[@"device"][@"uniqueSn"];
  45. self.license.stringValue = cdkey ? : @"";
  46. self.device.stringValue = unique_sn ? : [self udid];
  47. self.continueButtonLayer = [CALayer layer];
  48. [self.continueButton.layer addSublayer:self.continueButtonLayer];
  49. self.continueButtonLayer.frame = CGRectMake(0, 0, CGRectGetWidth(_continueButton.bounds), CGRectGetHeight(_continueButton.bounds));
  50. self.continueButtonLayer.backgroundColor = [KMAppearance KMColor_Status_Sel].CGColor;
  51. self.continueButtonLayer.cornerRadius = 0;
  52. self.continueButtonLayer.hidden = YES;
  53. __weak typeof(self) weakSelf = self;
  54. self.continueButton.mouseMoveCallback = ^(BOOL mouseEntered) {
  55. if (mouseEntered)
  56. weakSelf.continueButtonLayer.hidden = NO;
  57. else
  58. weakSelf.continueButtonLayer.hidden = YES;
  59. };
  60. [self.label setTextColor:[KMAppearance KMColor_Layout_H0]];
  61. [self.licenseLabel setTextColor:[KMAppearance KM_242424_Color75]];
  62. [self.deviceLabel setTextColor:[KMAppearance KM_242424_Color75]];
  63. [self.license setTextColor:[KMAppearance KM_242424_Color75]];
  64. [self.device setTextColor:[KMAppearance KM_242424_Color75]];
  65. }
  66. #pragma mark - Getter
  67. - (NSString *)udid {
  68. return GetHardwareUUID()?:@"";
  69. }
  70. #pragma mark - IBAction
  71. - (IBAction)continueButtonAction:(id)sender {
  72. if (self.callback) {
  73. self.callback();
  74. }
  75. }
  76. - (IBAction)unbindAction:(NSButton *)sender {
  77. if (self.unbindAction) {
  78. self.unbindAction();
  79. }
  80. }
  81. @end