Skip to content

Commit

Permalink
Merge pull request #38 from Automattic/develop
Browse files Browse the repository at this point in the history
Merge develop into master for 0.0.9 release
  • Loading branch information
astralbodies committed Oct 7, 2015
2 parents 590c9a5 + 044d8c4 commit b9df46f
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 12 deletions.
17 changes: 17 additions & 0 deletions Automattic-Tracks-OSX.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Pod::Spec.new do |spec|
spec.name = 'Automattic-Tracks-OSX'
spec.version = File.read("Automattic-Tracks-iOS/TracksConstants.m").split("const TracksLibraryVersion = @\"").last.split("\"").first
spec.platform = :osx, "10.8"
spec.license = { :type => 'GPLv2' }
spec.homepage = 'https://github.com/automattic/automattic-tracks-ios'
spec.authors = { 'Aaron Douglas' => '[email protected]' }
spec.summary = 'Simple way to track events in an iOS app with Automattic Tracks internal service'
spec.source = { :git => 'https://github.com/Automattic/Automattic-Tracks-iOS.git', :tag => spec.version.to_s }
spec.source_files = 'Automattic-Tracks-iOS/**/*.{h,m}'
spec.resource_bundle = { 'DataModel' => ['Automattic-Tracks-iOS/**/*.xcdatamodeld'] }
spec.framework = 'CoreData'
spec.framework = 'CoreTelephony'

spec.dependency 'CocoaLumberjack', '2.0.0'
spec.dependency 'Reachability', '~>3.1'
end
2 changes: 1 addition & 1 deletion Automattic-Tracks-iOS/TracksConstants.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import "TracksConstants.h"

NSString *const TracksErrorDomain = @"TracksErrorDomain";
NSString *const TracksLibraryVersion = @"0.0.8";
NSString *const TracksLibraryVersion = @"0.0.9";
2 changes: 1 addition & 1 deletion Automattic-Tracks-iOS/TracksDeviceInformation.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

@interface TracksDeviceInformation : NSObject

Expand Down
57 changes: 51 additions & 6 deletions Automattic-Tracks-iOS/TracksDeviceInformation.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#import "TracksDeviceInformation.h"

#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#import <UIDeviceIdentifier/UIDeviceHardware.h>
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import <CoreTelephony/CTCarrier.h>
#import <UIDeviceHardware.h>
#else
#import <AppKit/AppKit.h>
#endif

@interface TracksDeviceInformation ()

Expand All @@ -27,6 +33,13 @@ - (NSString *)brand
return @"Apple";
}

- (NSString *)manufacturer
{
return @"Apple";
}


#if TARGET_OS_IPHONE

- (NSString *)currentNetworkOperator
{
Expand Down Expand Up @@ -59,30 +72,62 @@ - (NSString *)deviceLanguage
return [[NSLocale currentLocale] localeIdentifier];
}

- (NSString *)model
{
return [UIDeviceHardware platformString];
}

- (NSString *)manufacturer

- (NSString *)os
{
return @"Apple";
return [[UIDevice currentDevice] systemName];
}


- (NSString *)version
{
return [[UIDevice currentDevice] systemVersion];
}

#else

- (NSString *)currentNetworkOperator
{
return @"";
}


- (NSString *)currentNetworkRadioType
{
return @"";
}


- (NSString *)deviceLanguage
{
return [[NSLocale currentLocale] localeIdentifier];
}

- (NSString *)model
{
return [UIDeviceHardware platformString];
return @"";
}


- (NSString *)os
{
return [[UIDevice currentDevice] systemName];
return @"OS X";
}


- (NSString *)version
{
return [[UIDevice currentDevice] systemVersion];
return [[NSProcessInfo processInfo] operatingSystemVersionString];
}

#endif



#pragma mark - App Specific Information

Expand Down
2 changes: 1 addition & 1 deletion Automattic-Tracks-iOS/TracksService.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "TracksEvent.h"
#import "TracksEventService.h"
#import "TracksServiceRemote.h"
Expand Down
18 changes: 16 additions & 2 deletions Automattic-Tracks-iOS/TracksService.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
#import <CocoaLumberjack/CocoaLumberjack.h>
#import <Reachability/Reachability.h>

#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#else
#import <AppKit/AppKit.h>
#endif


@interface TracksService ()

@property (nonatomic, strong) NSTimer *timer;
Expand Down Expand Up @@ -74,10 +81,12 @@ - (instancetype)initWithContextManager:(TracksContextManager *)contextManager
[self resetTimer];

NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
[defaultCenter addObserver:self selector:@selector(reachabilityChanged:) name:kReachabilityChangedNotification object:nil];

#if TARGET_OS_IPHONE
[defaultCenter addObserver:self selector:@selector(didEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil];
[defaultCenter addObserver:self selector:@selector(didBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil];

[defaultCenter addObserver:self selector:@selector(reachabilityChanged:) name:kReachabilityChangedNotification object:nil];
#endif
}
return self;
}
Expand Down Expand Up @@ -267,7 +276,12 @@ - (void)setQueueSendInterval:(NSTimeInterval)queueSendInterval

- (NSDictionary *)immutableDeviceProperties
{
#if TARGET_OS_IPHONE
CGSize screenSize = [[UIScreen mainScreen] bounds].size;
#else
CGSize screenSize = [[NSScreen mainScreen] frame].size;
#endif

long long since1970millis = [NSDate date].timeIntervalSince1970 * 1000;

return @{ RequestTimestampKey : @(since1970millis),
Expand Down
2 changes: 1 addition & 1 deletion Automattic-Tracks-iOSTests/TracksEventServiceTests.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#import <OCMock/OCMock.h>
#import "TracksEventService.h"
Expand Down

0 comments on commit b9df46f

Please sign in to comment.