KMVerificationExpiredViewController.m 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. //
  2. // KMVerificationExpiredViewController.m
  3. // PDF Reader Pro Edition
  4. //
  5. // Created by 王帅 on 2018/5/11.
  6. //
  7. #import "KMVerificationExpiredViewController.h"
  8. #import <PDF_Reader_Pro-Swift.h>
  9. #import "NSObject+DeviceInfo.h"
  10. #import "VerificationManager.h"
  11. @interface KMVerificationExpiredViewController ()
  12. @property (nonatomic,assign) IBOutlet NSTextField *label;
  13. @property (nonatomic,assign) IBOutlet NSTextField *sublabel;
  14. @property (nonatomic,assign) IBOutlet NSTextField *licenseLabel;
  15. @property (nonatomic,assign) IBOutlet NSTextField *license;
  16. @property (nonatomic,assign) IBOutlet NSTextField *deviceLabel;
  17. @property (nonatomic,assign) IBOutlet NSTextField *device;
  18. @property (nonatomic,assign) IBOutlet KMCustomButton *licenseButton;
  19. @property (nonatomic,assign) IBOutlet KMCustomButton *contactUsButton;
  20. @property (nonatomic, retain) CALayer *contactUsButtonLayer;
  21. @end
  22. @implementation KMVerificationExpiredViewController
  23. #pragma mark Init Methods
  24. - (instancetype)init {
  25. if (self = [super initWithNibName:@"KMVerificationExpiredViewController" bundle:nil]) {
  26. }
  27. return self;
  28. }
  29. - (void)dealloc {
  30. }
  31. #pragma mark View Methods
  32. - (void)loadView {
  33. [super loadView];
  34. // Do view setup here.
  35. self.licenseButton.wantsLayer = YES;
  36. self.licenseButton.layer.masksToBounds = YES;
  37. self.licenseButton.layer.cornerRadius = 1.0;
  38. // self.licenseButton.layer.backgroundColor = [NSColor colorWithRed:218/255.0 green:219/255.0 blue:222/255.0 alpha:1.0].CGColor;
  39. self.contactUsButton.wantsLayer = YES;
  40. self.contactUsButton.layer.masksToBounds = YES;
  41. self.contactUsButton.layer.cornerRadius = 1.0;
  42. // self.contactUsButton.layer.backgroundColor = [KMAppearance KMColor_Interactive_M0].CGColor;
  43. self.label.stringValue = NSLocalizedString(@"Activation Error", nil);
  44. self.sublabel.stringValue = NSLocalizedString(@"Your license was deactivated. Please contact our support team if you are not sure why this happened.", nil);
  45. self.licenseLabel.stringValue = NSLocalizedString(@"License ID:", nil);
  46. self.deviceLabel.stringValue = NSLocalizedString(@"UUID:", nil);
  47. self.licenseButton.title = NSLocalizedString(@"Enter License Number", nil);
  48. self.contactUsButton.title = NSLocalizedString(@"Contact Us", nil);
  49. [self.licenseButton setTitleColor:[KMAppearance KMColor_Layout_H0]];
  50. [self.contactUsButton setTitleColor:[NSColor whiteColor]];
  51. NSString *cdkey = [VerificationManager manager].detailInfo[@"device"][@"cdkey"];
  52. NSString *unique_sn = [VerificationManager manager].detailInfo[@"device"][@"uniqueSn"];
  53. self.license.stringValue = cdkey ? : @"";
  54. self.device.stringValue = unique_sn ?:GetHardwareUUID()?:@"";
  55. self.contactUsButtonLayer = [CALayer layer];
  56. [self.contactUsButton.layer addSublayer:self.contactUsButtonLayer];
  57. self.contactUsButtonLayer.frame = CGRectMake(0, 0, CGRectGetWidth(_contactUsButton.bounds), CGRectGetHeight(_contactUsButton.bounds));
  58. self.contactUsButtonLayer.backgroundColor = [KMAppearance KMColor_Status_Sel].CGColor;
  59. self.contactUsButtonLayer.cornerRadius = 0;
  60. self.contactUsButtonLayer.hidden = YES;
  61. __block KMVerificationExpiredViewController *blockSelf = self;
  62. self.contactUsButton.mouseMoveCallback = ^(BOOL mouseEntered) {
  63. if (mouseEntered)
  64. blockSelf.contactUsButtonLayer.hidden = NO;
  65. else
  66. blockSelf.contactUsButtonLayer.hidden = YES;
  67. };
  68. self.licenseButton.mouseMoveCallback = nil;
  69. [self.label setTextColor:[KMAppearance KMColor_Layout_H0]];
  70. [self.sublabel setTextColor:[KMAppearance KM_242424_Color75]];
  71. [self.licenseLabel setTextColor:[KMAppearance KM_242424_Color75]];
  72. [self.deviceLabel setTextColor:[KMAppearance KM_242424_Color75]];
  73. [self.license setTextColor:[KMAppearance KM_242424_Color75]];
  74. [self.device setTextColor:[KMAppearance KM_242424_Color75]];
  75. }
  76. #pragma mark Button Actions
  77. - (IBAction)licenseButtonAction:(id)sender {
  78. if (self.callback) {
  79. self.callback(0);
  80. }
  81. }
  82. - (IBAction)contactUsButtonAction:(id)sender {
  83. if (self.callback) {
  84. self.callback(1);
  85. }
  86. }
  87. @end