Browse Source

Model Changes.

v1.2.2
Abhishek Banthia 9 years ago
parent
commit
4d45ca4f83
  1. BIN
      Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate
  2. 4
      Clocker/Model/CLTimezoneData.h
  3. 27
      Clocker/Model/CLTimezoneData.m
  4. 14
      Clocker/PanelController.m
  5. 7
      Clocker/Preferences/CLPreferencesViewController.m

BIN
Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate generated

Binary file not shown.

4
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

27
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

14
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"];

7
Clocker/Preferences/CLPreferencesViewController.m

@ -12,7 +12,7 @@
#import "ApplicationDelegate.h"
#import <QuartzCore/QuartzCore.h>
#import "CommonStrings.h"
#import "CLTimezoneData.h"
#import <Parse/Parse.h>
#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];
}

Loading…
Cancel
Save