|
@@ -150,15 +150,15 @@ static KMVerificationWindowController *_currentWindowController = nil;
|
|
_normalViewController = [[KMVerificationViewController alloc] init];
|
|
_normalViewController = [[KMVerificationViewController alloc] init];
|
|
_normalViewController.callback = ^(NSInteger index) {
|
|
_normalViewController.callback = ^(NSInteger index) {
|
|
if (index == 0) {
|
|
if (index == 0) {
|
|
- [blockSelf setContentView:blockSelf.activateViewController.view];
|
|
|
|
|
|
+ [self setContentView:self.activateViewController.view];
|
|
} else if (index == 1) {
|
|
} else if (index == 1) {
|
|
if (KMVerificationTypeActivateExpired == self.type) {
|
|
if (KMVerificationTypeActivateExpired == self.type) {
|
|
- [blockSelf verificationFeedback];
|
|
|
|
|
|
+ [self verificationFeedback];
|
|
} else {
|
|
} else {
|
|
- [blockSelf close];
|
|
|
|
|
|
+ [self close];
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- [blockSelf verificationBuy];
|
|
|
|
|
|
+ [self verificationBuy];
|
|
}
|
|
}
|
|
};
|
|
};
|
|
if (KMVerificationTypeTrialExpired == self.type) {
|
|
if (KMVerificationTypeTrialExpired == self.type) {
|
|
@@ -192,9 +192,16 @@ static KMVerificationWindowController *_currentWindowController = nil;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- [blockSelf verificationActivate:string];
|
|
|
|
|
|
+ if (blockSelf.type == KMVerificationTypeActivateAIInfo) {
|
|
|
|
+ [blockSelf verificationActivateAIInfo:string];
|
|
|
|
+ } else {
|
|
|
|
+ [blockSelf verificationActivate:string];
|
|
|
|
+ }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+ if (self.type == KMVerificationTypeActivateAIInfo) {
|
|
|
|
+ _activateViewController.type = self.type;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return _activateViewController;
|
|
return _activateViewController;
|
|
}
|
|
}
|
|
@@ -382,6 +389,9 @@ static KMVerificationWindowController *_currentWindowController = nil;
|
|
} else if (self.type == KMVerificationTypeTrialSuccess ||
|
|
} else if (self.type == KMVerificationTypeTrialSuccess ||
|
|
self.type == KMVerificationTypeRepeatTrialSuccess) {
|
|
self.type == KMVerificationTypeRepeatTrialSuccess) {
|
|
[self setContentView:self.trialSuccessController.view];
|
|
[self setContentView:self.trialSuccessController.view];
|
|
|
|
+ } else if (KMVerificationTypeActivateAIInfo == self.type) {
|
|
|
|
+ [self setContentView:self.activateViewController.view];
|
|
|
|
+ self.activateViewController.type = self.type;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -473,10 +483,141 @@ static KMVerificationWindowController *_currentWindowController = nil;
|
|
}];
|
|
}];
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+- (void)verificationActivateAIInfo:(NSString *)license {
|
|
|
|
+ if (license.length <= 0) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (![self isConnectionAvailable]) {
|
|
|
|
+ NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Connection Error", nil)
|
|
|
|
+ defaultButton:NSLocalizedString(@"OK", nil)
|
|
|
|
+ alternateButton:nil
|
|
|
|
+ otherButton:nil
|
|
|
|
+ informativeTextWithFormat:@"", nil];
|
|
|
|
+
|
|
|
|
+ NSButton *accessryBtn = [[NSButton alloc] initWithFrame:CGRectMake(0, 0, 180, 44)];
|
|
|
|
+ accessryBtn.autoresizingMask = NSViewMaxXMargin | NSViewMinYMargin | NSViewMaxYMargin;
|
|
|
|
+ accessryBtn.bezelStyle = NSBezelStyleRegularSquare;
|
|
|
|
+ accessryBtn.bordered = NO;
|
|
|
|
+ accessryBtn.target = self;
|
|
|
|
+ accessryBtn.action = @selector(accessryBtnClicked:);
|
|
|
|
+ NSMutableAttributedString *mutAttrString = [[NSMutableAttributedString alloc] initWithString:NSLocalizedString(@"Please make sure your internet connection is available.", nil)];
|
|
|
|
+ [mutAttrString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:NSMakeRange(0, [mutAttrString length])];
|
|
|
|
+ [mutAttrString addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:12] range:NSMakeRange(0, [mutAttrString length])];
|
|
|
|
+ [mutAttrString addAttribute:NSForegroundColorAttributeName value:[KMAppearance KMColor_Interactive_M0] range:NSMakeRange(0, [mutAttrString length])];
|
|
|
|
+
|
|
|
|
+ accessryBtn.attributedTitle = mutAttrString;
|
|
|
|
+
|
|
|
|
+ NSRect rect = [mutAttrString boundingRectWithSize:CGSizeMake(180, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading];
|
|
|
|
+ CGRect frame = accessryBtn.frame;
|
|
|
|
+ frame.size.height = rect.size.height;
|
|
|
|
+ accessryBtn.frame = frame;
|
|
|
|
+ alert.accessoryView = accessryBtn;
|
|
|
|
+
|
|
|
|
+ [alert runModal];
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ __block __typeof(self) blockSelf = self;
|
|
|
|
+ self.progressIndicator.hidden = NO;
|
|
|
|
+ [self.progressIndicator startAnimation:nil];
|
|
|
|
+ [self.activateViewController setEnabled:NO];
|
|
|
|
+ NSDictionary *infoDic = @{@"cdkey":license};
|
|
|
|
+ [[AIInfoManager defaultManager] activateAIWithInfo:infoDic complention:^(NSDictionary *info, NSError *error) {
|
|
|
|
+ blockSelf.progressIndicator.hidden = YES;
|
|
|
|
+ [blockSelf.progressIndicator stopAnimation:nil];
|
|
|
|
+ [blockSelf.activateViewController setEnabled:YES];
|
|
|
|
+ if (error) {
|
|
|
|
+
|
|
|
|
+ NSString *tTitle0 = NSLocalizedString(@"The license you have entered is not correct. Please enter valid license.", nil);
|
|
|
|
+ NSString *tTitle1 = NSLocalizedString(@"Please confirm your PDF Reader Pro AI license code through the email you provided when purchasing.", nil);
|
|
|
|
+
|
|
|
|
+ NSString *message = [NSString stringWithFormat:@"%@\n\n%@", tTitle0, tTitle1];
|
|
|
|
+
|
|
|
|
+ if (ActivityErrorTypeCDKeyEmpty == error.code) {
|
|
|
|
+ message = [NSString stringWithFormat:@"%@\n\n%@", NSLocalizedString(@"License number can not be empty.", nil), @""];
|
|
|
|
+ } else if (ActivityErrorTypeCDKeyNotExist == error.code) {
|
|
|
|
+ message = [NSString stringWithFormat:@"%@\n\n%@", NSLocalizedString(@"License number does not exist.", nil), @""];
|
|
|
|
+ } else if (ActivityErrorTypeOutNumber == error.code) {
|
|
|
|
+ NSString *tMsg0 = NSLocalizedString(@"The devices connected to the license number has outnumbered.", nil);
|
|
|
|
+ NSString *tMsg1 = NSLocalizedString(@"Please deactivate license on one of them, to use PDF Reader Pro on this computer", nil);
|
|
|
|
+ message = [NSString stringWithFormat:@"%@\n\n%@", tMsg0, tMsg1];
|
|
|
|
+ } else if (ActivityErrorTypeNetworkDisable == error.code) {
|
|
|
|
+ message = NSLocalizedString(@"The network is unavailable.", nil);
|
|
|
|
+ } else if (ActivityErrorTypeCDKeyExpire == error.code) {
|
|
|
|
+ message = NSLocalizedString(@"The license number expired.", nil);
|
|
|
|
+ } else if (ActivityErrorTypeInvalidInfo == error.code) {
|
|
|
|
+ message = NSLocalizedString(@"Activation error. Please try to input correct license, or contact us.", nil);
|
|
|
|
+ } else if (ActivityErrorTypeNotMatchProduct == error.code) {
|
|
|
|
+ message = NSLocalizedString(@"The license number is wrong, please input right license which is for this app.", nil);
|
|
|
|
+ } else if (ActivityErrorTypeFormatError == error.code) {
|
|
|
|
+ message = NSLocalizedString(@"Error license. Please enter an AI license.", nil);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ((ActivityErrorTypeUnknow == error.code) || (ActivityErrorTypeOutNumber == error.code) || (ActivityErrorTypeInvalidInfo == error.code)) {
|
|
|
|
+ NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Activation Error", nil)
|
|
|
|
+ defaultButton:NSLocalizedString(@"Contact Us", nil)
|
|
|
|
+ alternateButton:NSLocalizedString(@"Try Again", nil)
|
|
|
|
+ otherButton:nil
|
|
|
|
+ informativeTextWithFormat:message, nil];
|
|
|
|
+ if ([alert runModal]) {
|
|
|
|
+ [blockSelf verificationFeedback];
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (ActivityErrorTypeNetworkDisable == error.code) {
|
|
|
|
+ NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Connection Error", nil)
|
|
|
|
+ defaultButton:NSLocalizedString(@"OK", nil)
|
|
|
|
+ alternateButton:nil
|
|
|
|
+ otherButton:nil
|
|
|
|
+ informativeTextWithFormat:@"", nil];
|
|
|
|
+
|
|
|
|
+ NSButton *accessryBtn = [[NSButton alloc] initWithFrame:CGRectMake(0, 0, 180, 44)];
|
|
|
|
+ accessryBtn.autoresizingMask = NSViewMaxXMargin | NSViewMinYMargin | NSViewMaxYMargin;
|
|
|
|
+ accessryBtn.bezelStyle = NSBezelStyleRegularSquare;
|
|
|
|
+ accessryBtn.bordered = NO;
|
|
|
|
+ accessryBtn.target = self;
|
|
|
|
+ accessryBtn.action = @selector(accessryBtnClicked:);
|
|
|
|
+ NSMutableAttributedString *mutAttrString = [[NSMutableAttributedString alloc] initWithString:NSLocalizedString(@"Please make sure your internet connection is available.", nil)];
|
|
|
|
+ [mutAttrString addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:12] range:NSMakeRange(0, [mutAttrString length])];
|
|
|
|
+ [mutAttrString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:NSMakeRange(0, [mutAttrString length])];
|
|
|
|
+ [mutAttrString addAttribute:NSForegroundColorAttributeName value:[KMAppearance KMColor_Interactive_M0] range:NSMakeRange(0, [mutAttrString length])];
|
|
|
|
+
|
|
|
|
+ accessryBtn.attributedTitle = mutAttrString;
|
|
|
|
+ NSRect rect = [mutAttrString boundingRectWithSize:CGSizeMake(180, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading];
|
|
|
|
+ CGRect frame = accessryBtn.frame;
|
|
|
|
+ frame.size.height = rect.size.height;
|
|
|
|
+ accessryBtn.frame = frame;
|
|
|
|
+ alert.accessoryView = accessryBtn;
|
|
|
|
+
|
|
|
|
+ [alert runModal];
|
|
|
|
+ } else {
|
|
|
|
+ NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Activation Error", nil)
|
|
|
|
+ defaultButton:NSLocalizedString(@"Try Again", nil)
|
|
|
|
+ alternateButton:nil
|
|
|
|
+ otherButton:nil
|
|
|
|
+ informativeTextWithFormat:message, nil];
|
|
|
|
+ [alert runModal];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ blockSelf.activityAlertViewController.alertTitle = NSLocalizedString(@"Successful Activation!", nil);
|
|
|
|
+ blockSelf.activityAlertViewController.alertMessage = NSLocalizedString(@"Congratulations! You can start using PDF Reader Pro AI features.", nil);
|
|
|
|
+ [blockSelf setContentView:blockSelf.activityAlertViewController.view];
|
|
|
|
+ }
|
|
|
|
+ }];
|
|
|
|
+}
|
|
|
|
+
|
|
- (void)verificationActivate:(NSString *)license {
|
|
- (void)verificationActivate:(NSString *)license {
|
|
if (license.length <= 0) {
|
|
if (license.length <= 0) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ if ([license hasPrefix:@"AI-"]) {
|
|
|
|
+ NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Activation Error", nil)
|
|
|
|
+ defaultButton:NSLocalizedString(@"Try Again", nil)
|
|
|
|
+ alternateButton:nil
|
|
|
|
+ otherButton:nil
|
|
|
|
+ informativeTextWithFormat:NSLocalizedString(@"For AI license code, please activate it via 'My AI Credit' - 'Enter AI License' in the upper right corner.", nil), nil];
|
|
|
|
+ [alert runModal];
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
if (![self isConnectionAvailable]) {
|
|
if (![self isConnectionAvailable]) {
|
|
NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Connection Error", nil)
|
|
NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Connection Error", nil)
|
|
defaultButton:NSLocalizedString(@"OK", nil)
|
|
defaultButton:NSLocalizedString(@"OK", nil)
|
|
@@ -589,7 +730,7 @@ static KMVerificationWindowController *_currentWindowController = nil;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
blockSelf.activityAlertViewController.alertTitle = NSLocalizedString(@"Successful Activation!", nil);
|
|
blockSelf.activityAlertViewController.alertTitle = NSLocalizedString(@"Successful Activation!", nil);
|
|
- blockSelf.activityAlertViewController.alertMessage = NSLocalizedString(@"Congrats! You can start enjoying the advanced features of PDF Reader Pro.", nil);
|
|
|
|
|
|
+ blockSelf.activityAlertViewController.alertMessage = NSLocalizedString(@"Congrats! You are eligible to enjoy all advanced features (excluding AI) in PDF Reader Pro.", nil);
|
|
[blockSelf setContentView:blockSelf.activityAlertViewController.view];
|
|
[blockSelf setContentView:blockSelf.activityAlertViewController.view];
|
|
}
|
|
}
|
|
}];
|
|
}];
|