Permalink
Browse files

Update library

  • Loading branch information...
soffes committed Nov 16, 2012
1 parent b33b07e commit 6ccf58b1c8254c43b255629acee2d804888f2496
Showing with 3,443 additions and 2,224 deletions.
  1. +21 −0 LICENSE
  2. +76 −57 LocalyticsDatabase.h
  3. +1,313 −743 LocalyticsDatabase.m
  4. +321 −216 LocalyticsSession.h
  5. +1,475 −1,148 LocalyticsSession.m
  6. +39 −7 LocalyticsUploader.h
  7. +164 −40 LocalyticsUploader.m
  8. +34 −13 WebserviceConstants.h
View
21 LICENSE
@@ -0,0 +1,21 @@
+Copyright (c) 2009, Char Software, Inc. d/b/a Localytics
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Neither the name of Char Software, Inc., Localytics nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY CHAR SOFTWARE, INC. D/B/A LOCALYTICS ''AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL CHAR SOFTWARE, INC. D/B/A LOCALYTICS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
@@ -1,57 +1,76 @@
-//
-// LocalyticsDatabase.h
-// LocalyticsDemo
-//
-// Created by jkaufman on 5/26/11.
-// Copyright 2011 Localytics. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import <sqlite3.h>
-
-#define MAX_DATABASE_SIZE 500000 // The maximum allowed disk size of the primary database file at open, in bytes
-#define VACUUM_THRESHOLD 0.8 // The database is vacuumed after its size exceeds this proportion of the maximum.
-
-@interface LocalyticsDatabase : NSObject {
- sqlite3 *_databaseConnection;
-}
-
-+ (LocalyticsDatabase *)sharedLocalyticsDatabase;
-
-- (NSUInteger)databaseSize;
-- (int)eventCount;
-- (NSTimeInterval)createdTimestamp;
-
-- (BOOL)beginTransaction:(NSString *)name;
-- (BOOL)releaseTransaction:(NSString *)name;
-- (BOOL)rollbackTransaction:(NSString *)name;
-
-- (BOOL)incrementLastUploadNumber:(int *)uploadNumber;
-- (BOOL)incrementLastSessionNumber:(int *)sessionNumber;
-
-- (BOOL)addEventWithBlobString:(NSString *)blob;
-- (BOOL)addCloseEventWithBlobString:(NSString *)blob;
-- (BOOL)addFlowEventWithBlobString:(NSString *)blob;
-- (BOOL)removeLastCloseAndFlowEvents;
-
-- (BOOL)addHeaderWithSequenceNumber:(int)number blobString:(NSString *)blob rowId:(sqlite3_int64 *)insertedRowId;
-- (int)unstagedEventCount;
-- (BOOL)stageEventsForUpload:(sqlite3_int64)headerId;
-- (BOOL)updateAppKey:(NSString *)appKey;
-- (NSString *)uploadBlobString;
-- (BOOL)deleteUploadedData;
-- (BOOL)resetAnalyticsData;
-- (BOOL)vacuumIfRequired;
-
-- (NSTimeInterval)lastSessionStartTimestamp;
-- (BOOL)setLastsessionStartTimestamp:(NSTimeInterval)timestamp;
-
-- (BOOL)isOptedOut;
-- (BOOL)setOptedOut:(BOOL)optOut;
-- (NSString *)installId;
-- (NSString *)appKey; // Most recent app key-- may not be that used to open the session.
-
-- (NSString *)customDimension:(int)dimension;
-- (BOOL)setCustomDimension:(int)dimension value:(NSString *)value;
-
-@end
+//
+// LocalyticsDatabase.h
+// Copyright (C) 2012 Char Software Inc., DBA Localytics
+//
+// This code is provided under the Localytics Modified BSD License.
+// A copy of this license has been distributed in a file called LICENSE
+// with this source code.
+//
+// Please visit www.localytics.com for more information.
+
+#import <Foundation/Foundation.h>
+#import <sqlite3.h>
+
+#define MAX_DATABASE_SIZE 500000 // The maximum allowed disk size of the primary database file at open, in bytes
+#define VACUUM_THRESHOLD 0.8 // The database is vacuumed after its size exceeds this proportion of the maximum.
+
+@interface LocalyticsDatabase : NSObject {
+ sqlite3 *_databaseConnection;
+}
+
++ (LocalyticsDatabase *)sharedLocalyticsDatabase;
+
+- (unsigned long long)databaseSize;
+- (int)eventCount;
+- (NSTimeInterval)createdTimestamp;
+
+- (BOOL)beginTransaction:(NSString *)name;
+- (BOOL)releaseTransaction:(NSString *)name;
+- (BOOL)rollbackTransaction:(NSString *)name;
+
+- (BOOL)incrementLastUploadNumber:(int *)uploadNumber;
+- (BOOL)incrementLastSessionNumber:(int *)sessionNumber;
+
+- (BOOL)addEventWithBlobString:(NSString *)blob;
+- (BOOL)addCloseEventWithBlobString:(NSString *)blob;
+- (BOOL)queueCloseEventWithBlobString:(NSString *)blob;
+- (NSString *)dequeueCloseEventBlobString;
+- (BOOL)addFlowEventWithBlobString:(NSString *)blob;
+- (BOOL)removeLastCloseAndFlowEvents;
+
+- (BOOL)addHeaderWithSequenceNumber:(int)number blobString:(NSString *)blob rowId:(sqlite3_int64 *)insertedRowId;
+- (int)unstagedEventCount;
+- (BOOL)stageEventsForUpload:(sqlite3_int64)headerId;
+- (BOOL)updateAppKey:(NSString *)appKey;
+- (NSString *)uploadBlobString;
+- (BOOL)deleteUploadedData;
+- (BOOL)resetAnalyticsData;
+- (BOOL)vacuumIfRequired;
+
+- (NSTimeInterval)lastSessionStartTimestamp;
+- (BOOL)setLastSessionStartTimestamp:(NSTimeInterval)timestamp;
+
+- (BOOL)isOptedOut;
+- (BOOL)setOptedOut:(BOOL)optOut;
+- (NSString *)installId;
+- (NSString *)appKey; // Most recent app key-- may not be that used to open the session.
+
+- (NSString *)customDimension:(int)dimension;
+- (BOOL)setCustomDimension:(int)dimension value:(NSString *)value;
+
+- (BOOL)setValueForIdentifier:(NSString *)identifierName value:(NSString *)value;
+- (NSString *)valueForIdentifier:(NSString *)identifierName;
+- (BOOL)deleteIdentifer:(NSString *)identifierName;
+- (NSDictionary *)identifiers;
+
+- (BOOL)setFacebookAttribution:(NSString *)fbAttribution;
+- (NSString *)facebookAttributionFromDb;
+- (NSString *)facebookAttributionFromPasteboard;
+
+- (NSInteger)safeIntegerValueFromDictionary:(NSDictionary *)dict forKey:(NSString *)key;
+- (NSString *)safeStringValueFromDictionary:(NSDictionary *)dict forKey:(NSString *)key;
+- (NSDictionary *)safeDictionaryFromDictionary:(NSDictionary *)dict forKey:(NSString *)key;
+- (NSArray *)safeListFromDictionary:(NSDictionary *)dict forKey:(NSString *)key;
+
+
+@end
Oops, something went wrong.

0 comments on commit 6ccf58b

Please sign in to comment.