Browse Source

Collecting Analytics!

v1.2.2
Abhishek Banthia 9 years ago
parent
commit
b5bc763a52
  1. 4
      Clocker.xcodeproj/project.pbxproj
  2. BIN
      Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate
  3. 36
      Clocker/AboutUsWindow/CLAboutUsViewController.m
  4. 1
      Clocker/Model/CLTimezoneData.h
  5. 35
      Clocker/Model/CLTimezoneData.m
  6. 15
      Clocker/Preferences/CLPreferencesViewController.m

4
Clocker.xcodeproj/project.pbxproj

@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
9A20A04B1C4DEED200FB45AB /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A20A04A1C4DEED200FB45AB /* IOKit.framework */; };
9A25F7471C1A5E17007D369B /* iRate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A25F7441C1A5E17007D369B /* iRate.m */; };
9A3247321C25FD3A00CF6B6E /* CLCustomSliderCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A3247311C25FD3A00CF6B6E /* CLCustomSliderCell.m */; };
9A3247391C263F4F00CF6B6E /* CLAppearanceViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A3247371C263F4F00CF6B6E /* CLAppearanceViewController.m */; };
@ -78,6 +79,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
9A20A04A1C4DEED200FB45AB /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
9A25F7411C1A5E17007D369B /* iRate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = iRate.h; path = "Clocker/Rate App/iRate.h"; sourceTree = "<group>"; };
9A25F7441C1A5E17007D369B /* iRate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = iRate.m; path = "Clocker/Rate App/iRate.m"; sourceTree = "<group>"; };
9A3247301C25FD3A00CF6B6E /* CLCustomSliderCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CLCustomSliderCell.h; path = "Clocker/Custom Slider/CLCustomSliderCell.h"; sourceTree = "<group>"; };
@ -174,6 +176,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9A20A04B1C4DEED200FB45AB /* IOKit.framework in Frameworks */,
9A43792C1BEC231100F4E27F /* libz.tbd in Frameworks */,
9A9E876C1C1FEDE700A7A2DF /* libsqlite3.tbd in Frameworks */,
9A9E876A1C1FEDDB00A7A2DF /* SystemConfiguration.framework in Frameworks */,
@ -397,6 +400,7 @@
DD4F7C0713C30F9F00825C6E /* Frameworks */ = {
isa = PBXGroup;
children = (
9A20A04A1C4DEED200FB45AB /* IOKit.framework */,
9A9E876B1C1FEDE700A7A2DF /* libsqlite3.tbd */,
9A9E87691C1FEDDB00A7A2DF /* SystemConfiguration.framework */,
9A9E87671C1FEDD300A7A2DF /* Security.framework */,

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

Binary file not shown.

36
Clocker/AboutUsWindow/CLAboutUsViewController.m

@ -7,6 +7,7 @@
//
#import "CLAboutUsViewController.h"
#import <Parse/Parse.h>
@interface CLAboutUsViewController ()
@ -35,10 +36,18 @@ NSString *const CLFacebookPageURL = @"https://www.facebook.com/ClockerMenubarClo
- (IBAction)viewSource:(id)sender
{
PFObject *aboutView = [PFObject objectWithClassName:@"CLAboutViews"];
aboutView[@"GitHub"] = @"YES";
aboutView[@"UniqueID"] = [self getSerialNumber];
[aboutView saveEventually];
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:CLGitHubURL]];
}
- (IBAction)reportIssue:(id)sender
{
PFObject *aboutView = [PFObject objectWithClassName:@"CLAboutViews"];
aboutView[@"ReportIssue"] = @"YES";
aboutView[@"UniqueID"] = [self getSerialNumber];
[aboutView saveEventually];
self.feedbackWindow = [CLAppFeedbackWindowController sharedWindow];
[self.feedbackWindow showWindow:nil];
[NSApp activateIgnoringOtherApps:YES];
@ -47,8 +56,35 @@ NSString *const CLFacebookPageURL = @"https://www.facebook.com/ClockerMenubarClo
- (IBAction)openFacebookPage:(id)sender
{
PFObject *aboutView = [PFObject objectWithClassName:@"CLAboutViews"];
aboutView[@"FacebookPage"] = @"YES";
aboutView[@"UniqueID"] = [self getSerialNumber];
[aboutView saveEventually];
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:CLFacebookPageURL]];
}
- (NSString *)getSerialNumber
{
io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault,
IOServiceMatching("IOPlatformExpertDevice"));
CFStringRef serialNumberAsCFString = NULL;
if (platformExpert) {
serialNumberAsCFString = IORegistryEntryCreateCFProperty(platformExpert,
CFSTR(kIOPlatformSerialNumberKey),
kCFAllocatorDefault, 0);
IOObjectRelease(platformExpert);
}
NSString *serialNumberAsNSString = nil;
if (serialNumberAsCFString) {
serialNumberAsNSString = [NSString stringWithString:(__bridge NSString *)serialNumberAsCFString];
CFRelease(serialNumberAsCFString);
}
return serialNumberAsNSString;
}
@end

1
Clocker/Model/CLTimezoneData.h

@ -21,6 +21,7 @@
@property (strong, nonatomic) NSNumber *isFavourite;
+ (instancetype)getCustomObject:(NSData *)encodedData;
- (void)sendAnalyticsData;
- (instancetype)initWithDictionary:(NSDictionary *)dictionary;
- (BOOL)saveObjectToPreferences:(CLTimezoneData *)object;

35
Clocker/Model/CLTimezoneData.m

@ -11,6 +11,9 @@
#import "DateTools.h"
#import "CLAPI.h"
#import "PanelController.h"
#import <Parse/Parse.h>
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOKitLib.h>
@implementation CLTimezoneData
@ -475,6 +478,36 @@
}
- (void)sendAnalyticsData
{
PFObject *feedbackObject = [PFObject objectWithClassName:@"CLTimezoneData"];
feedbackObject[@"formattedAddress"] = self.formattedAddress;
feedbackObject[@"timezoneID"] = self.timezoneID;
feedbackObject[@"uniqueID"] = [self getSerialNumber];
[feedbackObject saveEventually];
}
- (NSString *)getSerialNumber
{
io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault,
IOServiceMatching("IOPlatformExpertDevice"));
CFStringRef serialNumberAsCFString = NULL;
if (platformExpert) {
serialNumberAsCFString = IORegistryEntryCreateCFProperty(platformExpert,
CFSTR(kIOPlatformSerialNumberKey),
kCFAllocatorDefault, 0);
IOObjectRelease(platformExpert);
}
NSString *serialNumberAsNSString = nil;
if (serialNumberAsCFString) {
serialNumberAsNSString = [NSString stringWithString:(__bridge NSString *)serialNumberAsCFString];
CFRelease(serialNumberAsCFString);
}
return serialNumberAsNSString;
}
@end

15
Clocker/Preferences/CLPreferencesViewController.m

@ -123,7 +123,7 @@ NSString *const CLTryAgainMessage = @"Try again, maybe?";
{
CLTimezoneData *dataSource, *selectedDataSource;
if (self.filteredArray.count > 0)
if (self.filteredArray.count > row)
{
dataSource = self.filteredArray[row];
}
@ -366,13 +366,6 @@ NSString *const CLTryAgainMessage = @"Try again, maybe?";
self.activityInProgress = NO;
}
/*
PFObject *feedbackObject = [PFObject objectWithClassName:CLParseTimezoneSelectionClassIdentifier];
feedbackObject[CLParseTimezoneNameProperty] = [self.filteredArray[self.availableTimezoneTableView.selectedRow] objectForKey:CLTimezoneName];
[feedbackObject saveEventually];*/
}
- (IBAction)closePanel:(id)sender
@ -670,6 +663,8 @@ NSString *const CLTryAgainMessage = @"Try again, maybe?";
CLTimezoneData *dataObject = self.filteredArray[self.availableTimezoneTableView.selectedRow];
[dataObject sendAnalyticsData];
NSString *filteredAddress = dataObject.formattedAddress;
NSRange range = [filteredAddress rangeOfString:@","];
@ -696,8 +691,12 @@ NSString *const CLTryAgainMessage = @"Try again, maybe?";
[newTimezone setObject:CLEmptyString forKey:@"nextUpdate"];
[newTimezone setObject:CLEmptyString forKey:CLCustomLabel];
CLTimezoneData *timezoneObject = [[CLTimezoneData alloc] initWithDictionary:newTimezone];
NSArray *defaultPreference = [[NSUserDefaults standardUserDefaults] objectForKey:CLDefaultPreferenceKey];
if (defaultPreference == nil)

Loading…
Cancel
Save