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_Master-Bridging-Header.h"
  9. #if VERSION_DMG
  10. #import <PDF_Master-Swift.h>
  11. #else
  12. #import <PDF_Master-Swift.h>
  13. #endif
  14. //#import "VerificationManager.h"
  15. @interface KMVerificationInfoViewController ()
  16. @property (nonatomic, assign) IBOutlet NSTextField *label;
  17. @property (nonatomic, assign) IBOutlet NSTextField *licenseLabel;
  18. @property (nonatomic, assign) IBOutlet NSTextField *license;
  19. @property (nonatomic, assign) IBOutlet NSTextField *deviceLabel;
  20. @property (nonatomic, assign) IBOutlet NSTextField *device;
  21. @property (nonatomic, assign) IBOutlet KMCustomButton *continueButton;
  22. @property (assign) IBOutlet NSButton *unbindButton;
  23. @property (nonatomic, retain) CALayer *continueButtonLayer;
  24. @end
  25. @implementation KMVerificationInfoViewController
  26. #pragma mark Init Methods
  27. - (instancetype)init {
  28. if (self = [super initWithNibName:@"KMVerificationInfoViewController" bundle:nil]) {
  29. }
  30. return self;
  31. }
  32. - (void)dealloc {
  33. }
  34. #pragma mark Setter Methods
  35. - (void)loadView {
  36. [super loadView];
  37. // Do view setup here.
  38. self.continueButton.wantsLayer = YES;
  39. self.continueButton.layer.masksToBounds = YES;
  40. self.continueButton.layer.cornerRadius = 1.0;
  41. self.label.stringValue = NSLocalizedString(@"Successful activation!", nil);
  42. self.licenseLabel.stringValue = NSLocalizedString(@"License ID:", nil);
  43. self.deviceLabel.stringValue = NSLocalizedString(@"UUID:", nil);
  44. self.continueButton.title = NSLocalizedString(@"Continue", nil);
  45. [self.continueButton setTitleColor:[NSColor whiteColor]];
  46. self.unbindButton.title = NSLocalizedString(@"Unbind License Code", nil);
  47. // NSString *cdkey = [VerificationManager manager].detailInfo[@"device"][@"cdkey"];
  48. // NSString *unique_sn = [VerificationManager manager].detailInfo[@"device"][@"unique_sn"];
  49. // self.license.stringValue = cdkey ? : @"";
  50. // self.device.stringValue = unique_sn ? : @"";
  51. self.continueButtonLayer = [CALayer layer];
  52. [self.continueButton.layer addSublayer:self.continueButtonLayer];
  53. self.continueButtonLayer.frame = CGRectMake(0, 0, CGRectGetWidth(_continueButton.bounds), CGRectGetHeight(_continueButton.bounds));
  54. self.continueButtonLayer.backgroundColor = [KMAppearance KMColor_Status_Sel].CGColor;
  55. self.continueButtonLayer.cornerRadius = 0;
  56. self.continueButtonLayer.hidden = YES;
  57. __block KMVerificationInfoViewController *blockSelf = self;
  58. self.continueButton.mouseMoveCallback = ^(BOOL mouseEntered) {
  59. if (mouseEntered)
  60. blockSelf.continueButtonLayer.hidden = NO;
  61. else
  62. blockSelf.continueButtonLayer.hidden = YES;
  63. };
  64. [self.label setTextColor:[KMAppearance KMColor_Layout_H0]];
  65. [self.licenseLabel setTextColor:[KMAppearance KM_242424_Color75]];
  66. [self.deviceLabel setTextColor:[KMAppearance KM_242424_Color75]];
  67. [self.license setTextColor:[KMAppearance KM_242424_Color75]];
  68. [self.device setTextColor:[KMAppearance KM_242424_Color75]];
  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