diff --git a/Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate b/Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate index 3874b25..94e38a2 100644 Binary files a/Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate and b/Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Clocker/Model/CLTimezoneData.h b/Clocker/Model/CLTimezoneData.h index 1712f15..ba2d786 100644 --- a/Clocker/Model/CLTimezoneData.h +++ b/Clocker/Model/CLTimezoneData.h @@ -16,7 +16,11 @@ @property (strong, nonatomic) NSString *sunriseTime; @property (strong, nonatomic) NSString *sunsetTime; @property (strong, nonatomic) NSString *timezoneID; +@property (strong, nonatomic) NSString *latitude; +@property (strong, nonatomic) NSString *longitude; + +-(instancetype)initWithDictionary:(NSDictionary *)dictionary; - (BOOL)saveObjectToPreferences:(CLTimezoneData *)object; @end diff --git a/Clocker/Model/CLTimezoneData.m b/Clocker/Model/CLTimezoneData.m index 883ae25..f7becf5 100644 --- a/Clocker/Model/CLTimezoneData.m +++ b/Clocker/Model/CLTimezoneData.m @@ -7,12 +7,25 @@ // #import "CLTimezoneData.h" +#import "CommonStrings.h" @implementation CLTimezoneData --(void)initWithDictionary:(NSDictionary *)dictionary +-(instancetype)initWithDictionary:(NSDictionary *)dictionary { + if (self == [super init]) + { + self.customLabel = dictionary[CLCustomLabel]; + self.sunriseTime = CLEmptyString; + self.sunsetTime = CLEmptyString; + self.timezoneID = dictionary[CLTimezoneName]; + self.latitude = dictionary[@"latitude"]; + self.longitude = dictionary[@"longitude"]; + self.place_id = dictionary[CLPlaceIdentifier]; + self.formattedAddress = dictionary[CLTimezoneName]; + } + return self; } - (BOOL)saveObjectToPreferences:(CLTimezoneData *)object @@ -65,4 +78,16 @@ return self; } +-(NSString *)description +{ + return [NSString stringWithFormat:@"TimezoneID:%@\nFormatted Address:%@\nCustom Label:%@\nLatitude:%@\nLongitude:%@\nSunrise:%@\nSunset:%@\nPlaceID:%@", self.timezoneID, + self.formattedAddress, + self.customLabel, + self.latitude, + self.longitude, + self.sunriseTime, + self.sunsetTime, + self.place_id]; +} + @end diff --git a/Clocker/PanelController.m b/Clocker/PanelController.m index c427312..b21ff1d 100755 --- a/Clocker/PanelController.m +++ b/Clocker/PanelController.m @@ -99,7 +99,7 @@ NSString *const CLTimezoneCellViewIdentifier = @"timeZoneCell"; [self updateDefaultPreferences]; self.mainTableview.selectionHighlightStyle = NSTableViewSelectionHighlightStyleNone; - // Make a fully skinned panel + NSPanel *panel = (id)[self window]; [panel setAcceptsMouseMovedEvents:YES]; [panel setLevel:NSPopUpMenuWindowLevel]; @@ -308,7 +308,7 @@ NSString *const CLTimezoneCellViewIdentifier = @"timeZoneCell"; NSString *theme = [[NSUserDefaults standardUserDefaults] objectForKey:CLThemeKey]; if (theme.length > 0 && ![theme isEqualToString:@"Default"]) { - [cell updateTextColorWithColor:[NSColor whiteColor] andCell:cell]; +// [cell updateTextColorWithColor:[NSColor whiteColor] andCell:cell]; [self.mainTableview setBackgroundColor:[NSColor blackColor]]; self.window.alphaValue = 0.90; [cell.customName setDrawsBackground:YES]; @@ -318,7 +318,7 @@ NSString *const CLTimezoneCellViewIdentifier = @"timeZoneCell"; else { - [cell updateTextColorWithColor:[NSColor blackColor] andCell:cell]; +// [cell updateTextColorWithColor:[NSColor blackColor] andCell:cell]; [cell.customName setDrawsBackground:NO]; [self.mainTableview setBackgroundColor:[NSColor whiteColor]]; self.window.alphaValue = 1; @@ -362,6 +362,8 @@ NSString *const CLTimezoneCellViewIdentifier = @"timeZoneCell"; return cell; } + + #pragma mark - #pragma mark Datasource formatting #pragma mark - @@ -801,14 +803,16 @@ NSString *const CLTimezoneCellViewIdentifier = @"timeZoneCell"; return; } - if ([json[@"status"][@"message"] isEqualToString:@"the hourly limit of 2000 credits for abhishaker17 has been exceeded. Please throttle your requests or use the commercial service."]) + if ([json[@"status"][@"message"] + isEqualToString:@"the hourly limit of 2000 credits for abhishaker17 has been exceeded. Please throttle your requests or use the commercial service."]) { return; } - NSMutableDictionary *newDictionary = [[NSMutableDictionary alloc] initWithDictionary:dictionary copyItems:YES]; + NSMutableDictionary *newDictionary = [[NSMutableDictionary alloc] initWithDictionary:dictionary + copyItems:YES]; if (json[@"sunrise"] && json[@"sunset"]) { [newDictionary setObject:json[@"sunrise"] forKey:@"sunriseTime"]; diff --git a/Clocker/Preferences/CLPreferencesViewController.m b/Clocker/Preferences/CLPreferencesViewController.m index ddf8b61..2ce7dc9 100644 --- a/Clocker/Preferences/CLPreferencesViewController.m +++ b/Clocker/Preferences/CLPreferencesViewController.m @@ -12,7 +12,7 @@ #import "ApplicationDelegate.h" #import #import "CommonStrings.h" - +#import "CLTimezoneData.h" #import #import "CLAPI.h" @@ -425,6 +425,11 @@ NSString *const CLTryAgainMessage = @"Try again, maybe?"; CLCustomLabel: CLEmptyString, CLTimezoneID : CLEmptyString, CLPlaceIdentifier : dictionary[CLPlaceIdentifier]}; + + CLTimezoneData *newObject = [[CLTimezoneData alloc] initWithDictionary:totalPackage]; + + NSLog(@"%@", newObject.description); + [self.filteredArray addObject:totalPackage]; }