12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052 |
- //
- // KMVerificationWindowController.m
- // PDF Reader Pro Edition
- //
- // Created by 王帅 on 2018/5/8.
- //
- #import "KMVerificationWindowController.h"
- #import "KMVerificationViewController.h"
- #import "KMVerificationActivateViewController.h"
- #import "KMVerificationExpiredViewController.h"
- #import "KMVerificationTrialViewController.h"
- #import "KMVerificationAlertViewController.h"
- #import "KMActivityALertViewController.h"
- #import "KMVerificationInfoViewController.h"
- #import "VerificationManager.h"
- //#import "KMMailHelper.h"
- #import "GBDeviceInfo.h"
- #import "Reachability.h"
- //#import "SKInspectPublicTool.h"
- //#import "FMTrackEventManager.h"
- #import "KMRepeatTrialAlertController.h"
- #import "KMRepeatVerifyExpireController.h"
- #import <PDF_Reader_Pro-Swift.h>
- #import "NSObject+DeviceInfo.h"
- @interface KMVerificationWindowController ()
- @property (nonatomic, assign) KMVerificationType type;
- @property (nonatomic, assign) IBOutlet NSBox *box;
- @property (nonatomic, assign) IBOutlet NSProgressIndicator *progressIndicator;
- @property (nonatomic, retain) KMVerificationViewController *normalViewController;
- @property (nonatomic, retain) KMVerificationActivateViewController *activateViewController;
- @property (nonatomic, retain) KMVerificationExpiredViewController *expiredViewController;
- @property (nonatomic, retain) KMVerificationTrialViewController *trialViewController;
- @property (nonatomic, retain) KMVerificationAlertViewController *alertViewController;
- @property (nonatomic, retain) KMActivityALertViewController *activityAlertViewController;
- @property (nonatomic, retain) KMVerificationInfoViewController *infoViewController;
- @property (nonatomic, retain) KMRepeatTrialAlertController *repeatTrialAlertController;//二次试用提示弹窗
- @property (nonatomic, retain) KMRepeatVerifyExpireController *repeatTrialExpireController;//二次试用过期弹窗
- @property (nonatomic, retain) KMTrialSuccessController *trialSuccessController;
- @end
- @implementation KMVerificationWindowController
- + (void)launching {
- [VerificationManager manager];
- }
- + (BOOL)allowsShowExpired {
- #if VERSION_DMG
- if ([VerificationManager manager].status == ActivityStatusTrialExpire &&
- [VerificationManager manager].secondTrialEnabled == NO) {
- if (![[NSUserDefaults standardUserDefaults] objectForKey:@"allowTrialExpireShowKeyDMG"]) {
- [[NSUserDefaults standardUserDefaults] setObject:@"YES" forKey:@"allowTrialExpireShowKeyDMG"];
- return YES;
- }
- }
- return NO;
- #else
- NSDate *lastTimeDate = [[NSUserDefaults standardUserDefaults] objectForKey:@"kVerificationExpiredShowLastTimeDateKay"];
- if (lastTimeDate) {
- NSDate *date = [NSDate date];
- NSTimeInterval time = [date timeIntervalSinceDate:lastTimeDate];
- int days = ((int)time)/(3600*24);
- if (days < 15) {
- return NO;
- }
- }
- #endif
- return YES;
- }
- + (void)showExpiredInfo {
- if (ActivityStatusTrialExpire == [VerificationManager manager].status) {
- if ([KMVerificationWindowController allowsShowExpired]) {
- KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeTrialExpired];
- [vc showWindow:nil];
-
- [[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:@"kVerificationExpiredShowLastTimeDateKay"];
- [[NSUserDefaults standardUserDefaults] synchronize];
- }
- } else if (ActivityStatusVerifExpire == [VerificationManager manager].status) {
- if ([KMVerificationWindowController allowsShowExpired]) {
- KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeActivateExpired];
- [vc showWindow:nil];
-
- [[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:@"kVerificationExpiredShowLastTimeDateKay"];
- [[NSUserDefaults standardUserDefaults] synchronize];
- }
- }
- }
- + (BOOL)allowRepeatTrialAlertShow {
- //是否在开启APP时弹出二次试用弹窗提示框
- if ([VerificationManager manager].secondTrialEnabled) {
- if (![[NSUserDefaults standardUserDefaults] objectForKey:@"allowRepeatTrialAlertShowKey"]) {
- return YES;
- }
- }
- return NO;
- }
- + (BOOL)allowRepeatTrialExpireShow {
- if ([VerificationManager manager].status == ActivityStatusTrialExpire &&
- [VerificationManager manager].trialTimes == 2) {
- if (![[NSUserDefaults standardUserDefaults] objectForKey:@"allowRepeatTrialExpireShowKey"]) {
- return YES;
- }
- }
- return NO;
- }
- static KMVerificationWindowController *_currentWindowController = nil;
- + (KMVerificationWindowController *)verificationWithType:(KMVerificationType)type {
- if (_currentWindowController) {
- if (type != _currentWindowController.type) {
- [_currentWindowController close];
- } else {
- return _currentWindowController;
- }
- }
- KMVerificationWindowController *vc = [[KMVerificationWindowController alloc] initWithType:type];
- return vc;
- }
- #pragma mark Init Methods
- - (instancetype)initWithType:(KMVerificationType)type {
- if (self = [super initWithWindowNibName:@"KMVerificationWindowController"]) {
- _type = type;
- }
- return self;
- }
- - (void)dealloc {
- [NSDistributedNotificationCenter.defaultCenter removeObserver:self];
-
- }
- #pragma mark - Getter Methods
- - (KMVerificationViewController *)normalViewController {
- if (!_normalViewController) {
- __block __typeof(self) blockSelf = self;
- _normalViewController = [[KMVerificationViewController alloc] init];
- _normalViewController.callback = ^(NSInteger index) {
- if (index == 0) {
- [blockSelf setContentView:blockSelf.activateViewController.view];
- } else if (index == 1) {
- if (KMVerificationTypeActivateExpired == self.type) {
- [blockSelf verificationFeedback];
- } else {
- [blockSelf close];
- }
- } else {
- [blockSelf verificationBuy];
- }
- };
- if (KMVerificationTypeTrialExpired == self.type) {
- _normalViewController.titleText = NSLocalizedString(@"Thank you for trying PDFull", nil);
- _normalViewController.messageText = NSLocalizedString(@"Your trial has expired. Buy Full version to annotate and edit PDF files.", nil);
- } else {
- _normalViewController.titleText = NSLocalizedString(@"PDFull Activation", nil);
- _normalViewController.messageText = NSLocalizedString(@"Buy Full Version to annotate and edit your PDF documents.", nil);
- }
- }
- return _normalViewController;
- }
- - (KMVerificationActivateViewController *)activateViewController {
- if (!_activateViewController) {
- __block __typeof(self) blockSelf = self;
- _activateViewController = [[KMVerificationActivateViewController alloc] init];
- _activateViewController.callback = ^(NSInteger index, NSString *string) {
- if (index == 0) {
- if (blockSelf.callback) {
- blockSelf.callback();
- blockSelf.callback = nil;
- [blockSelf close];
- } else {
- if (KMVerificationTypeTrial == blockSelf.type) {
- [blockSelf setContentView:blockSelf.trialViewController.view];
- } else if (KMVerificationTypeActivateExpired == blockSelf.type) {
- [blockSelf setContentView:blockSelf.expiredViewController.view];
- } else {
- [blockSelf setContentView:blockSelf.normalViewController.view];
- }
- }
- } else {
- if (blockSelf.type == KMVerificationTypeActivateAIInfo) {
- [blockSelf verificationActivateAIInfo:string];
- } else {
- [blockSelf verificationActivate:string];
- }
- }
- };
- if (self.type == KMVerificationTypeActivateAIInfo) {
- _activateViewController.type = self.type;
- }
- }
- return _activateViewController;
- }
- - (KMVerificationExpiredViewController *)expiredViewController {
- if (!_expiredViewController) {
- __block __typeof(self) blockSelf = self;
- _expiredViewController = [[KMVerificationExpiredViewController alloc] init];
- _expiredViewController.callback = ^(NSInteger index) {
- if (index == 0) {
- [blockSelf setContentView:blockSelf.activateViewController.view];
- } else {
- [blockSelf verificationFeedback];
- }
- };
- }
- return _expiredViewController;
- }
- - (KMVerificationTrialViewController *)trialViewController {
- if (!_trialViewController) {
- __block __typeof(self) blockSelf = self;
- _trialViewController = [[KMVerificationTrialViewController alloc] init];
- _trialViewController.callback = ^(NSInteger index, NSString *email, NSString *name) {
- if (index == 0) {
- [blockSelf setContentView:blockSelf.activateViewController.view];
- } else {
- [blockSelf verificationTrialForEmail:email name:name];
- }
- };
- }
- return _trialViewController;
- }
- - (KMVerificationAlertViewController *)alertViewController {
- if (!_alertViewController) {
- __block __typeof(self) blockSelf = self;
- _alertViewController = [[KMVerificationAlertViewController alloc] init];
- _alertViewController.callback = ^{
- [blockSelf close];
- };
- _alertViewController.buyActionHandle = ^{
- #if VERSION_DMG
- NSURL *url = [NSURL URLWithString:@"https://www.anyrecover.com/buy-pdf-editor-reader-converter"];
- [[NSWorkspace sharedWorkspace] openURL:url];
- #endif
- [[FMTrackEventManager defaultManager] trackEventWithEvent:@"PUW" withProperties:@{@"PUW_Btn":@"Btn_PUW_BuyNow-Trial"}];
- [blockSelf close];
- };
- }
- return _alertViewController;
- }
- - (KMActivityALertViewController *)activityAlertViewController {
- if (!_activityAlertViewController) {
- __block __typeof(self) blockSelf = self;
- _activityAlertViewController = [[KMActivityALertViewController alloc] init];
- _activityAlertViewController.callback = ^{
- [blockSelf close];
- };
- }
- return _activityAlertViewController;
- }
- - (KMVerificationInfoViewController *)infoViewController {
- if (!_infoViewController) {
- __block __typeof(self) blockSelf = self;
- _infoViewController = [[KMVerificationInfoViewController alloc] init];
- _infoViewController.callback = ^{
- [blockSelf close];
- };
- _infoViewController.unbindAction = ^{
- dispatch_async(dispatch_get_main_queue(), ^{
- [blockSelf unbindAction];
- });
- };
- }
- return _infoViewController;
- }
- - (KMRepeatTrialAlertController *)repeatTrialAlertController {
- if (!_repeatTrialAlertController) {
- __block __typeof(self) blockSelf = self;
- _repeatTrialAlertController = [[KMRepeatTrialAlertController alloc] init];
- _repeatTrialAlertController.callback = ^(NSInteger clickIndex, KMRepeatTrialAlertController * _Nonnull tRController) {
- if (clickIndex == 0) {
- //免费试用
- [blockSelf verificationTrialForEmail:[VerificationManager manager].email
- name:[VerificationManager manager].accountName] ;
- } else if (clickIndex == 1) {
- //了解更多
- NSURL *url = [NSURL URLWithString:@"https://www.anyrecover.com/buy-pdf-editor-reader-converter"];
- [[NSWorkspace sharedWorkspace] openURL:url];
- [blockSelf close];
- } else if (clickIndex == 2) {
- //输入序列码
- KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeActivate];
- vc.callback = ^{
- };
- [vc showWindow:nil];
- }
- };
- }
- return _repeatTrialAlertController;
- }
- - (KMRepeatVerifyExpireController *)repeatTrialExpireController {
- if (!_repeatTrialExpireController) {
- __block __typeof(self) blockSelf = self;
- _repeatTrialExpireController = [[KMRepeatVerifyExpireController alloc] init];
- _repeatTrialExpireController.callback = ^(NSInteger clickIndex, KMRepeatVerifyExpireController * _Nonnull tRController) {
- if (clickIndex == 0) {
- [blockSelf setContentView:blockSelf.activateViewController.view];
- } else if (clickIndex == 1) {
- [[FMTrackEventManager defaultManager] trackEventWithEvent:@"PUW" withProperties:@{@"PUW_Btn":@"Btn_PUW_SecondTrialExpire_Later"}];
- [blockSelf close];
- } else if (clickIndex == 2) {
- [[FMTrackEventManager defaultManager] trackEventWithEvent:@"PUW" withProperties:@{@"PUW_Btn":@"Btn_PUW_SecondTrialExpire_Buy"}];
- [blockSelf verificationBuy];
- }
- };
- }
- return _repeatTrialExpireController;
- }
- - (KMTrialSuccessController *)trialSuccessController {
- if (!_trialSuccessController) {
- __block __typeof(self) blockSelf = self;
- _trialSuccessController = [[KMTrialSuccessController alloc] init];
- _trialSuccessController.clickHandle = ^(KMTrialSuccessController * _Nonnull controller) {
- [blockSelf close];
- };
- }
- return _trialSuccessController;
- }
- #pragma mark Window Methods
- - (void)windowDidLoad {
- [super windowDidLoad];
-
- // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
- self.window.title = @"";
-
- [[self.window standardWindowButton:NSWindowZoomButton] setHidden:YES];
- [[self.window standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES];
-
- [self updateViewInfo];
-
- [self updateViewColor];
- [NSDistributedNotificationCenter.defaultCenter addObserver:self selector:@selector(themeChanged:) name:@"AppleInterfaceThemeChangedNotification" object: nil];
- }
- - (void)updateViewInfo {
- if (KMVerificationTypeNormal == self.type) {
- [self setContentView:self.normalViewController.view];
- } else if (KMVerificationTypeActivate == self.type) {
- [self setContentView:self.activateViewController.view];
- } else if (KMVerificationTypeTrial == self.type) {
- [self setContentView:self.trialViewController.view];
- } else if (KMVerificationTypeActivateExpired == self.type) {
- [self setContentView:self.expiredViewController.view];
- } else if (KMVerificationTypeTrialExpired == self.type) {
- [self setContentView:self.normalViewController.view];
- } else if (KMVerificationTypeInfo == self.type) {
- [self setContentView:self.infoViewController.view];
- } else if (KMVerificationTypeRepeatTrialGuide == self.type) {
- self.window.title = @"";
- [self setContentView:self.repeatTrialAlertController.view];
- [[NSUserDefaults standardUserDefaults] setObject:@"YES" forKey:@"allowRepeatTrialAlertShowKey"];
- [[NSUserDefaults standardUserDefaults] synchronize];
- } else if (KMVerificationTypeRepeatTrialExpire == self.type) {
- [self setContentView:self.repeatTrialExpireController.view];
- [[NSUserDefaults standardUserDefaults] setObject:@"YES" forKey:@"allowRepeatTrialExpireShowKey"];
- [[NSUserDefaults standardUserDefaults] synchronize];
- } else if (self.type == KMVerificationTypeTrialSuccess ||
- self.type == KMVerificationTypeRepeatTrialSuccess) {
- [self setContentView:self.trialSuccessController.view];
- } else if (KMVerificationTypeActivateAIInfo == self.type) {
- [self setContentView:self.activateViewController.view];
- self.activateViewController.type = self.type;
- }
- }
- - (void)updateViewColor {
- if (KMVerificationTypeNormal == self.type) {
-
- } else if (KMVerificationTypeActivate == self.type) {
-
- } else if (KMVerificationTypeTrial == self.type) {
-
- } else if (KMVerificationTypeActivateExpired == self.type) {
-
- } else if (KMVerificationTypeTrialExpired == self.type) {
-
- } else if (KMVerificationTypeInfo == self.type) {
-
- } else if (KMVerificationTypeRepeatTrialGuide == self.type) {
- [self.repeatTrialAlertController updateViewColor];
- } else if (KMVerificationTypeRepeatTrialExpire == self.type) {
- [self.repeatTrialExpireController updateViewColor];
- } else if (KMVerificationTypeTrialSuccess == self.type ||
- KMVerificationTypeRepeatTrialSuccess == self.type) {
- [self.trialSuccessController updateViewColor];
- }
- }
- - (void)showWindow:(id)sender {
- if (!_currentWindowController) {
- _currentWindowController = self;
- }
-
- [super showWindow:sender];
- }
- - (void)windowWillClose:(NSNotification *)notification {
- if (_currentWindowController) {
- _currentWindowController = nil;
- }
-
- }
- #pragma mark - Setter
- - (void)setContentView:(NSView *)view {
- NSRect frame = self.window.frame;
- frame.origin.y -= view.frame.size.height-frame.size.height;
- frame.origin.x -= (view.frame.size.width-frame.size.width)/2.0;
- frame.size.width = view.frame.size.width;
- frame.size.height = view.frame.size.height;
- [self.box setContentView:view];
- [self.window setFrame:frame display:YES animate:YES];
- }
- #pragma mark - Private Methods
- - (void)verificationTrialForEmail:(NSString *)email name:(NSString *)name {
- if (email.length <= 0) {
- return;
- }
- if (![self isConnectionAvailable]) {
- NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Connection Error", nil)
- defaultButton:NSLocalizedString(@"OK", nil)
- alternateButton:nil
- otherButton:nil
- informativeTextWithFormat:NSLocalizedString(@"Please make sure your internet connection is available.", nil), nil];
- [alert runModal];
- return;
- }
- __block __typeof(self) blockSelf = self;
- self.progressIndicator.hidden = NO;
- [self.progressIndicator startAnimation:nil];
- [self.trialViewController setEnabled:NO];
- [[VerificationManager manager] trialForDays:7 email:email name:name complention:^(ActivityStatus status, NSDictionary *info, NSError *error) {
- blockSelf.progressIndicator.hidden = YES;
- [blockSelf.progressIndicator stopAnimation:nil];
- [blockSelf.trialViewController setEnabled:YES];
- if (error ||
- status != ActivityStatusTrial) {
- NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Activation Error", nil)
- defaultButton:NSLocalizedString(@"Try Again", nil)
- alternateButton:nil
- otherButton:nil
- informativeTextWithFormat:NSLocalizedString(@"Failed to sign up for the free trial. Please make sure your internet connection is available and try again later.", nil), nil];
- [alert runModal];
- } else {
- blockSelf.type = KMVerificationTypeTrialSuccess;
- [blockSelf updateViewInfo];
- }
- }];
- }
- - (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 PDFull 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 PDFull 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 PDFull AI features.", nil);
- [blockSelf setContentView:blockSelf.activityAlertViewController.view];
- }
- }];
- }
- - (void)verificationActivate:(NSString *)license {
- if (license.length <= 0) {
- return;
- }
- // if ([license hasPrefix:@"AI-"]) {
- // NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Activation Error", nil)
- // defaultButton:NSLocalizedString(@"Try Again", nil)
- // alternateButton:nil
- // otherButton:nil
- // informativeTextWithFormat:NSLocalizedString(@"To activate the AI license code, click “AI Tools” on the toolbar, then tap “My AI Credit” from the right panel.", nil), nil];
- // [alert runModal];
- // 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};
- [[VerificationManager manager] activateDeviceWithInfo:infoDic complention:^(ActivityStatus status, 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(@"If you have already purchased PDFull for Mac, you should find your license in an email confirmation.", 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 PDFull 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(@"The license format is wrong. Please input correct 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(@"Congrats! You are eligible to enjoy all advanced features in PDFull.", nil);
- [blockSelf setContentView:blockSelf.activityAlertViewController.view];
- }
- }];
-
- }
- - (void)verificationBuy {
- #if VERSION_DMG
- NSURL *url = [NSURL URLWithString:@"https://www.anyrecover.com/buy-pdf-editor-reader-converter"];
- if([SKInspectPublicTool currentisLanguageHans]) {
- url = [NSURL URLWithString:@"https://www.anyrecover.com/buy-pdf-editor-reader-converter"];
- }
- [[NSWorkspace sharedWorkspace] openURL:url];
- #endif
-
- }
- #pragma - 验证错误时反馈信息
- - (void)verificationFeedback {
- unsigned major, minor, bugFix;
- [self getSystemVersionMajor:&major minor:&minor bugFix:&bugFix];
- NSString *versionString = [NSString stringWithFormat:@"%@ - %u.%u.%u", [GBDeviceInfo deviceInfo].rawSystemInfoString, major, minor, bugFix];
-
- //application version (use short version preferentially)
- NSString *tAppVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
- if ([tAppVersion length] < 1) {
- tAppVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];
- }
-
- NSString* subjects = [[self getAppNameForSupportEmail] stringByAppendingFormat:NSLocalizedString(@" - %@;Verification Feedback;%@", nil) ,tAppVersion,versionString];
- [KMMailHelper newEmailWithContacts:@"support@anyrecover.com" andSubjects:subjects];
- }
- - (void)unbindAction {
- unsigned major, minor, bugFix;
- [self getSystemVersionMajor:&major minor:&minor bugFix:&bugFix];
- NSString *versionString = [NSString stringWithFormat:@"%@ - %u.%u.%u", [GBDeviceInfo deviceInfo].rawSystemInfoString, major, minor, bugFix];
-
- //application version (use short version preferentially)
- NSString *tAppVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
- if ([tAppVersion length] < 1) {
- tAppVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];
- }
-
- NSString *subjects = [[self getAppNameForEmail] stringByAppendingString:[NSString stringWithFormat:@" %@",@"Verification:"]];
- subjects = [subjects stringByAppendingString:[NSString stringWithFormat:@"%@;",tAppVersion]];
- subjects = [subjects stringByAppendingString:[NSString stringWithFormat:@" %@;",versionString]];
- subjects = [subjects stringByAppendingString:[NSString stringWithFormat:@" %@",NSLocalizedString(@"Unbind License Code:", nil)]];
- subjects = [subjects stringByAppendingString:[NSString stringWithFormat:@"%@",[VerificationManager manager].detailInfo[@"device"][@"uniqueSn"]?:GetHardwareUUID()?:@""]];
-
- NSString *mailtoAddress = [NSString stringWithFormat:@"mailto:%@?Subject=%@&body=%@",@"support@anyrecover.com",[self URLEncodedString:subjects],[self URLEncodedString:NSLocalizedString(@"Hi PDFull Team, I need to unbind my license code, thanks!\nNotice: Please do not modify the subtitle content", nil)]];
- [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:mailtoAddress]];
- }
- - (void)accessryBtnClicked:(NSButton *)btn {
-
- [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://www.pdfreaderpro.com/mac/help/activate-license-code-mac"]];
- }
- - (NSString *)URLEncodedString:(NSString *)string {
- CFStringRef stringRef = CFBridgingRetain(string);
- #pragma clang diagnostic push
- #pragma clang diagnostic ignored "-Wdeprecated-declarations"
- CFStringRef encoded = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
- stringRef,
- NULL,
- CFSTR("!*'\"();:@&=+$,/?%#[]% "),
- kCFStringEncodingUTF8);
- #pragma clang diagnostic pop
- CFRelease(stringRef);
- return CFBridgingRelease(encoded);
- }
- - (void)getSystemVersionMajor:(unsigned *)major
- minor:(unsigned *)minor
- bugFix:(unsigned *)bugFix {
- OSErr err;
- SInt32 systemVersion, versionMajor, versionMinor, versionBugFix;
-
- if ([[NSProcessInfo processInfo] respondsToSelector:@selector(operatingSystemVersion)]) {
- NSOperatingSystemVersion osSystemVersion = [[NSProcessInfo processInfo] operatingSystemVersion];
-
- *major = (unsigned)osSystemVersion.majorVersion;
- *minor = (unsigned)osSystemVersion.minorVersion;
- *bugFix = (unsigned)osSystemVersion.patchVersion;
-
- return;
- } else {
- #pragma clang diagnostic push
- #pragma clang diagnostic ignored "-Wdeprecated-declarations"
- if ((err = Gestalt(gestaltSystemVersion, &systemVersion)) != noErr) goto fail;
- if (systemVersion < 0x1040)
- {
- if (major) *major = ((systemVersion & 0xF000) >> 12) * 10 +
- ((systemVersion & 0x0F00) >> 8);
- if (minor) *minor = (systemVersion & 0x00F0) >> 4;
- if (bugFix) *bugFix = (systemVersion & 0x000F);
- }
- else
- {
- if ((err = Gestalt(gestaltSystemVersionMajor, &versionMajor)) != noErr) goto fail;
- if ((err = Gestalt(gestaltSystemVersionMinor, &versionMinor)) != noErr) goto fail;
- if ((err = Gestalt(gestaltSystemVersionBugFix, &versionBugFix)) != noErr) goto fail;
- if (major) *major = versionMajor;
- if (minor) *minor = versionMinor;
- if (bugFix) *bugFix = versionBugFix;
- }
-
- return;
- #pragma clang diagnostic pop
- }
-
- fail:
- NSLog(@"Unable to obtain system version: %ld", (long)err);
- if (major) *major = 10;
- if (minor) *minor = 0;
- if (bugFix) *bugFix = 0;
- }
- - (NSString *)getAppNameForEmail {
- NSString *tAppName = @"PDFull Mac";
-
- #if VERSION_FREE
-
- #if VERSION_DMG
-
- #else
-
- // AppStore 免费版本
- tAppName = @"PDF Reader Pro Lite";
- #endif
-
- #else
-
- // AppStore 付费版
- tAppName = @"PDF Reader Pro Edition";
- #endif
-
- return tAppName;
- }
- - (NSString *)getAppNameForSupportEmail {
- NSString *tAppName = @"PDFull";
-
- #if VERSION_FREE
-
- #if VERSION_DMG
- // 桌机版
- VerificationManager *tManager = [VerificationManager manager];
- switch ([tManager status]) {
- case ActivityStatusTrial:
- tAppName = @"PDFull Trial";
- break;
-
- case ActivityStatusVerification:
- tAppName = @"PDFull Verification";
- break;
-
- case ActivityStatusTrialExpire:
- tAppName = @"PDFull TrialExpire";
- break;
-
- case ActivityStatusVerifExpire:
- tAppName = @"PDFull VerifExpire";
- break;
-
- default:
- break;
- }
-
- #else
-
- // AppStore 免费版本
- tAppName = @"PDF Reader Pro Lite";
- #endif
-
- #else
-
- // AppStore 付费版
- tAppName = @"PDF Reader Pro Edition";
- #endif
-
- return tAppName;
- }
- - (BOOL)isConnectionAvailable {
- BOOL isExistenceNetwork = YES;
- Reachability *reach = [Reachability reachabilityWithHostname:@"www.apple.com"];
- switch ([reach currentReachabilityStatus]) {
- case NotReachable:
- isExistenceNetwork = NO;
- //NSLog(@"notReachable");
- break;
- case ReachableViaWiFi:
- isExistenceNetwork = YES;
- //NSLog(@"WIFI");
- break;
- case ReachableViaWWAN:
- isExistenceNetwork = YES;
- //NSLog(@"3G");
- break;
- }
- if (NotReachable == [[Reachability reachabilityForInternetConnection] currentReachabilityStatus]) {
- return NO;
- }
- return YES;
- }
- #pragma mark - NSNotification
- - (void)themeChanged:(NSNotification *)notification {
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [self updateViewColor];
- });
- }
- + (void)verificationFeedback {
- unsigned major, minor, bugFix;
- [self getSystemVersionMajor:&major minor:&minor bugFix:&bugFix];
- NSString *versionString = [NSString stringWithFormat:@"%@ - %u.%u.%u", [GBDeviceInfo deviceInfo].rawSystemInfoString, major, minor, bugFix];
-
- NSString *tAppVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
- if ([tAppVersion length] < 1)
- {
- tAppVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];
- }
-
- NSString* subjects = [[self getAppNameForSupportEmail] stringByAppendingFormat:NSLocalizedString(@" - %@;Verification Feedback;%@", nil) ,tAppVersion,versionString];
- [KMMailHelper newEmailWithContacts:@"support@anyrecover.com" andSubjects:subjects];
- }
- + (void)getSystemVersionMajor:(unsigned *)major
- minor:(unsigned *)minor
- bugFix:(unsigned *)bugFix;
- {
- OSErr err;
- SInt32 systemVersion, versionMajor, versionMinor, versionBugFix;
-
- if ([[NSProcessInfo processInfo] respondsToSelector:@selector(operatingSystemVersion)]) {
- NSOperatingSystemVersion osSystemVersion = [[NSProcessInfo processInfo] operatingSystemVersion];
-
- *major = (unsigned)osSystemVersion.majorVersion;
- *minor = (unsigned)osSystemVersion.minorVersion;
- *bugFix = (unsigned)osSystemVersion.patchVersion;
-
- return;
- } else {
- #pragma clang diagnostic push
- #pragma clang diagnostic ignored "-Wdeprecated-declarations"
- if ((err = Gestalt(gestaltSystemVersion, &systemVersion)) != noErr) goto fail;
- if (systemVersion < 0x1040)
- {
- if (major) *major = ((systemVersion & 0xF000) >> 12) * 10 +
- ((systemVersion & 0x0F00) >> 8);
- if (minor) *minor = (systemVersion & 0x00F0) >> 4;
- if (bugFix) *bugFix = (systemVersion & 0x000F);
- }
- else
- {
- if ((err = Gestalt(gestaltSystemVersionMajor, &versionMajor)) != noErr) goto fail;
- if ((err = Gestalt(gestaltSystemVersionMinor, &versionMinor)) != noErr) goto fail;
- if ((err = Gestalt(gestaltSystemVersionBugFix, &versionBugFix)) != noErr) goto fail;
- if (major) *major = versionMajor;
- if (minor) *minor = versionMinor;
- if (bugFix) *bugFix = versionBugFix;
- }
-
- return;
- #pragma clang diagnostic pop
- }
-
- fail:
- NSLog(@"Unable to obtain system version: %ld", (long)err);
- if (major) *major = 10;
- if (minor) *minor = 0;
- if (bugFix) *bugFix = 0;
- }
- + (NSString *)getAppNameForSupportEmail
- {
- NSString *tAppName = @"PDFull";
-
- #if VERSION_FREE
-
- #if VERSION_DMG
- // 桌机版
- VerificationManager *tManager = [VerificationManager manager];
- switch ([tManager status]) {
- case ActivityStatusTrial:
- tAppName = @"PDFull Trial";
- break;
-
- case ActivityStatusVerification:
- tAppName = @"PDFull Verification";
- break;
-
- case ActivityStatusTrialExpire:
- tAppName = @"PDFull TrialExpire";
- break;
-
- case ActivityStatusVerifExpire:
- tAppName = @"PDFull VerifExpire";
- break;
-
- default:
- break;
- }
-
- #else
-
- // AppStore 免费版本
- tAppName = @"PDF Reader Pro Lite";
- #endif
-
- #else
-
- // AppStore 付费版
- tAppName = @"PDF Reader Pro Edition";
- #endif
-
- return tAppName;
- }
- @end
|