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