Skip to content

Commit

Permalink
remove duplicate functions
Browse files Browse the repository at this point in the history
  • Loading branch information
awkimball committed Sep 16, 2019
1 parent 003d616 commit 191fc51
Showing 1 changed file with 0 additions and 48 deletions.
48 changes: 0 additions & 48 deletions Source/GPGMailBundle.m
Original file line number Diff line number Diff line change
Expand Up @@ -849,10 +849,6 @@ - (BOOL)hasActiveContractOrActiveTrial {
return [self hasActiveContract] || [[self remainingTrialDays] integerValue] > 0;
}

- (BOOL)hasActiveContractOrActiveTrial {
return [self hasActiveContract] || [[self remainingTrialDays] integerValue] > 0;
}

- (NSNumber *)remainingTrialDays {
NSDictionary *contractInformation = [self contractInformation];
if(!contractInformation[@"ActivationRemainingTrialDays"]) {
Expand Down Expand Up @@ -924,50 +920,6 @@ - (void)saveDateActivationDialogWasLastShown {
[[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:@"__gme3_spd_last_shown_date"];
}

- (BOOL)shouldShowSupportPlanActivationDialog {
if(![self hasActiveContractOrActiveTrial]) {
[self saveDateActivationDialogWasLastShown];
return YES;
}
NSDictionary *contractInfo = [self contractInformation];
// Trial has never been started?
if(![contractInfo valueForKey:@"ActivationRemainingTrialDays"]) {
[self saveDateActivationDialogWasLastShown];
return YES;
}
NSDate *date = [[NSUserDefaults standardUserDefaults] objectForKey:@"__gme3_spd_last_shown_date"];
if(!date) {
[self saveDateActivationDialogWasLastShown];
return YES;
}
// Check if between date now and date last are 3 days.

NSDate *fromDateTime = date;
NSDate *toDateTime = [NSDate date];

NSDate *fromDate;
NSDate *toDate;

NSCalendar *calendar = [NSCalendar currentCalendar];

[calendar rangeOfUnit:NSCalendarUnitDay startDate:&fromDate
interval:NULL forDate:fromDateTime];
[calendar rangeOfUnit:NSCalendarUnitDay startDate:&toDate
interval:NULL forDate:toDateTime];

NSDateComponents *difference = [calendar components:NSCalendarUnitDay
fromDate:fromDate toDate:toDate options:0];
if([difference day] >= 3) {
[self saveDateActivationDialogWasLastShown];
return YES;
}
return NO;
}

- (void)saveDateActivationDialogWasLastShown {
[[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:@"__gme3_spd_last_shown_date"];
}

- (void)checkSupportContractAndStartWizardIfNecessary {
if(![self hasActiveContract]) {
if([self hasActivationCodeForAutomaticActivation] || [self shouldShowSupportPlanActivationDialog]) {
Expand Down

0 comments on commit 191fc51

Please sign in to comment.