|
|
|
@ -6,15 +6,16 @@
|
|
|
|
|
// |
|
|
|
|
// |
|
|
|
|
|
|
|
|
|
#import "CLAPI.h" |
|
|
|
|
#import "CLTimezoneData.h" |
|
|
|
|
#import "CommonStrings.h" |
|
|
|
|
#import "DateTools.h" |
|
|
|
|
#import "CLAPI.h" |
|
|
|
|
#import "PanelController.h" |
|
|
|
|
#import <Parse/Parse.h> |
|
|
|
|
#include <CoreFoundation/CoreFoundation.h> |
|
|
|
|
#include <IOKit/IOKitLib.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@implementation CLTimezoneData |
|
|
|
|
|
|
|
|
|
-(instancetype)initWithDictionary:(NSDictionary *)dictionary |
|
|
|
@ -57,6 +58,10 @@
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
+ (instancetype)getCustomObject:(NSData *)encodedData |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (encodedData) |
|
|
|
|
{ |
|
|
|
|
if ([encodedData isKindOfClass:[NSDictionary class]]) |
|
|
|
|
{ |
|
|
|
@ -68,6 +73,10 @@
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return nil; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
- (void)encodeWithCoder:(NSCoder *)coder |
|
|
|
|
{ |
|
|
|
|
[coder encodeObject:self.place_id forKey:@"place_id"]; |
|
|
|
@ -211,6 +220,9 @@
|
|
|
|
|
|
|
|
|
|
- (NSString *)compareSystemDate:(NSString *)systemDate toTimezoneDate:(NSString *)date |
|
|
|
|
{ |
|
|
|
|
NSParameterAssert(systemDate); |
|
|
|
|
NSParameterAssert(date); |
|
|
|
|
|
|
|
|
|
NSDateFormatter *formatter = [NSDateFormatter new]; |
|
|
|
|
formatter.dateFormat = [NSDateFormatter dateFormatFromTemplate:@"MM/dd/yyyy" |
|
|
|
|
options:0 |
|
|
|
@ -219,9 +231,8 @@
|
|
|
|
|
NSDate *localDate = [formatter dateFromString:systemDate]; |
|
|
|
|
NSDate *timezoneDate = [formatter dateFromString:date]; |
|
|
|
|
|
|
|
|
|
if (localDate == nil || timezoneDate == nil) { |
|
|
|
|
return @"Today"; |
|
|
|
|
} |
|
|
|
|
NSAssert(localDate != nil, @"Local date cannot be nil"); |
|
|
|
|
NSAssert(timezoneDate != nil, @"Local date cannot be nil"); |
|
|
|
|
|
|
|
|
|
// Specify which units we would like to use |
|
|
|
|
NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar]; |
|
|
|
@ -310,6 +321,7 @@
|
|
|
|
|
|
|
|
|
|
- (NSString *)getWeekdayFromInteger:(NSInteger)weekdayInteger |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
if (weekdayInteger > 7) { |
|
|
|
|
weekdayInteger = weekdayInteger - 7; |
|
|
|
|
} |
|
|
|
@ -359,12 +371,17 @@
|
|
|
|
|
|
|
|
|
|
if (shouldCityBeShown.boolValue == 0) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
self.customLabel.length > 0 ? |
|
|
|
|
[menuTitle appendString:self.customLabel] : |
|
|
|
|
[menuTitle appendString:self.formattedAddress]; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (shouldDayBeShown.boolValue == 0) |
|
|
|
|
{ |
|
|
|
|
NSString *substring = [self getDateForTimeZoneWithFutureSliderValue:0 andDisplayType:CLMenuDisplay]; |
|
|
|
|
|
|
|
|
|
substring = [substring substringToIndex:3]; |
|
|
|
|
|
|
|
|
|
if (menuTitle.length > 0) |
|
|
|
@ -406,10 +423,20 @@
|
|
|
|
|
|
|
|
|
|
- (void)sendAnalyticsData |
|
|
|
|
{ |
|
|
|
|
NSAssert(self.formattedAddress != nil, @"Formatted Address cannot be nil before sending analytics"); |
|
|
|
|
NSAssert(self.timezoneID != nil, @"Timezone ID cannot be nil before sending analytics"); |
|
|
|
|
|
|
|
|
|
NSString *uniqueIdentifier = [self getSerialNumber]; |
|
|
|
|
if (uniqueIdentifier == nil) |
|
|
|
|
{ |
|
|
|
|
uniqueIdentifier = @"N/A"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PFObject *feedbackObject = [PFObject objectWithClassName:@"CLTimezoneData"]; |
|
|
|
|
feedbackObject[@"formattedAddress"] = self.formattedAddress; |
|
|
|
|
feedbackObject[@"timezoneID"] = self.timezoneID; |
|
|
|
|
feedbackObject[@"uniqueID"] = [self getSerialNumber]; |
|
|
|
|
feedbackObject[@"uniqueID"] = uniqueIdentifier; |
|
|
|
|
[feedbackObject saveEventually]; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|