Skip to content
This repository has been archived by the owner on Dec 21, 2017. It is now read-only.

Commit

Permalink
exposed data collected by countly
Browse files Browse the repository at this point in the history
  • Loading branch information
euforic committed Jun 7, 2012
1 parent c42a77a commit cf9bb0d
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 15 deletions.
47 changes: 42 additions & 5 deletions Classes/CountLyModule.m
Expand Up @@ -94,15 +94,52 @@ -(void)start:(id)args
TiThreadPerformOnMainThread(^{[[Countly sharedInstance] start:apikey withHost:apiHost];}, NO);
}

-(id)exampleProp
-(id)udid
{
// example property getter
return @"hello world";
NSString *udid = [DeviceInfo udid];
return udid;
}

-(void)setExampleProp:(id)value
-(id)device
{
// example property setter
NSString *device = [DeviceInfo device];
return device;
}

-(id)osVersion
{
NSString *osVersion = [DeviceInfo osVersion];
return osVersion;
}

-(id)carrier
{
NSString *carrier = [DeviceInfo carrier];
return carrier;
}

-(id)resolution
{
NSString *resolution = [DeviceInfo resolution];
return resolution;
}

-(id)locale
{
NSString *locale = [DeviceInfo locale];
return locale;
}

-(id)platform
{
NSString *platform = [DeviceInfo platform];
return platform;
}

-(id)metrics
{
NSString *metrics = [DeviceInfo platform];
return metrics;
}

@end
11 changes: 11 additions & 0 deletions README.md
Expand Up @@ -15,6 +15,17 @@ Other Countly SDK repositories;
```
var countly = require('count.ly');
countly.start('APP_KEY','http://API_HOST.com');
//Exposed Info from countly
Ti.API.info(JSON.parse(countly.metrics));
Ti.API.info(countly.udid);
Ti.API.info(countly.device);
Ti.API.info(countly.osVersion);
Ti.API.info(countly.carrier);
Ti.API.info(countly.resolution);
Ti.API.info(countly.locale);
Ti.API.info(countly.platform);
Ti.API.info(countly.metrics);
```

## TODO
Expand Down
14 changes: 11 additions & 3 deletions count.ly.xcodeproj/project.pbxproj
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objectVersion = 46;
objects = {

/* Begin PBXAggregateTarget section */
Expand Down Expand Up @@ -184,8 +184,11 @@
/* Begin PBXProject section */
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0430;
};
buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "count.ly" */;
compatibilityVersion = "Xcode 3.1";
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
Expand Down Expand Up @@ -265,6 +268,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = CountLy_Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = "TI_VERSION=$(TI_VERSION)";
GCC_THUMB_SUPPORT = NO;
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
GCC_VERSION = "";
GCC_WARN_ABOUT_RETURN_TYPE = NO;
Expand Down Expand Up @@ -314,6 +318,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = CountLy_Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = "TI_VERSION=$(TI_VERSION)";
GCC_THUMB_SUPPORT = NO;
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
GCC_VERSION = "";
GCC_WARN_ABOUT_RETURN_TYPE = NO;
Expand Down Expand Up @@ -360,6 +365,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = CountLy_Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = "TI_VERSION=$(TI_VERSION)";
GCC_THUMB_SUPPORT = NO;
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
GCC_VERSION = "";
GCC_WARN_ABOUT_RETURN_TYPE = NO;
Expand Down Expand Up @@ -405,6 +411,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = CountLy_Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = "TI_VERSION=$(TI_VERSION)";
GCC_THUMB_SUPPORT = NO;
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
GCC_VERSION = "";
GCC_WARN_ABOUT_RETURN_TYPE = NO;
Expand Down Expand Up @@ -433,6 +440,7 @@
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_THUMB_SUPPORT = NO;
PRODUCT_NAME = "Build & test";
};
name = Debug;
Expand All @@ -443,7 +451,7 @@
buildSettings = {
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_THUMB_SUPPORT = NO;
PRODUCT_NAME = "Build & test";
ZERO_LINK = NO;
};
Expand Down
Binary file not shown.
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges</key>
<true/>
<key>SnapshotAutomaticallyBeforeSignificantChanges</key>
<true/>
</dict>
</plist>
12 changes: 10 additions & 2 deletions example/app.js
Expand Up @@ -14,7 +14,15 @@ win.open();

// TODO: write your module tests here
var countly = require('count.ly');
Ti.API.info("module is => " + countly);

countly.start('APP_KEY','APP_HOST');
countly.start('APP_KEY','http://API_HOST.com');
label.text = JSON.parse(countly.metrics);

Ti.API.info(countly.udid);
Ti.API.info(countly.device);
Ti.API.info(countly.osVersion);
Ti.API.info(countly.carrier);
Ti.API.info(countly.resolution);
Ti.API.info(countly.locale);
Ti.API.info(countly.platform);
Ti.API.info(countly.metrics);
14 changes: 14 additions & 0 deletions sdk/Countly.h
Expand Up @@ -8,6 +8,20 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface DeviceInfo : NSObject {

}

+ (NSString *)udid;
+ (NSString *)device;
+ (NSString *)osVersion;
+ (NSString *)carrier;
+ (NSString *)resolution;
+ (NSString *)locale;
+ (NSString *)platform;

@end

@interface Countly : NSObject {
double unsentSessionLength;
NSTimer *timer;
Expand Down
28 changes: 23 additions & 5 deletions sdk/Countly.m
Expand Up @@ -23,11 +23,6 @@
#include <sys/types.h>
#include <sys/sysctl.h>

@interface DeviceInfo : NSObject
{
}
@end

@implementation DeviceInfo

+ (NSString *)udid
Expand Down Expand Up @@ -103,6 +98,29 @@ + (NSString *)metrics
return result;
}

+ (NSString *)platform
{
NSString *result = @"{";

result = [result stringByAppendingFormat:@"\"%@\":\"%@\"", @"device", [DeviceInfo device]];

result = [result stringByAppendingFormat:@",\"%@\":\"%@\"", @"os", @"iOS"];

result = [result stringByAppendingFormat:@",\"%@\":\"%@\"", @"os_version", [DeviceInfo osVersion]];

NSString *carrier = [DeviceInfo carrier];
if (carrier != nil)
result = [result stringByAppendingFormat:@",\"%@\":\"%@\"", @"carrier", carrier];

result = [result stringByAppendingFormat:@",\"%@\":\"%@\"", @"resolution", [DeviceInfo resolution]];

result = [result stringByAppendingFormat:@",\"%@\":\"%@\"", @"locale", [DeviceInfo locale]];

result = [result stringByAppendingString:@"}"];

return result;
}

@end

@interface ConnectionQueue : NSObject
Expand Down

0 comments on commit cf9bb0d

Please sign in to comment.