diff --git a/Clocker.xcodeproj/project.pbxproj b/Clocker.xcodeproj/project.pbxproj index 6d70588..f0316d3 100755 --- a/Clocker.xcodeproj/project.pbxproj +++ b/Clocker.xcodeproj/project.pbxproj @@ -14,7 +14,6 @@ 9A392EED1C1CE9950072C10A /* CLPreferencesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A392EEB1C1CE9950072C10A /* CLPreferencesViewController.m */; }; 9A392EEE1C1CE9950072C10A /* CLPreferencesView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9A392EEC1C1CE9950072C10A /* CLPreferencesView.xib */; }; 9A4379251BEC223900F4E27F /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A4379211BEC223900F4E27F /* Security.framework */; }; - 9A4379261BEC223900F4E27F /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A4379221BEC223900F4E27F /* SystemConfiguration.framework */; }; 9A4379271BEC223900F4E27F /* Fabric.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A4379231BEC223900F4E27F /* Fabric.framework */; }; 9A43792A1BEC230A00F4E27F /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A4379291BEC230A00F4E27F /* libc++.tbd */; }; 9A43792C1BEC231100F4E27F /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A43792B1BEC231100F4E27F /* libz.tbd */; }; @@ -25,7 +24,6 @@ 9A5951BD1C1D0A8D009C17AA /* CommonStrings.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A5951BB1C1D0A8D009C17AA /* CommonStrings.m */; }; 9A5951C01C1D0AA0009C17AA /* CLOneWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A5951BE1C1D0AA0009C17AA /* CLOneWindowController.m */; }; 9A5951C21C1D0AAD009C17AA /* CLOneWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9A5951C11C1D0AAD009C17AA /* CLOneWindow.xib */; }; - 9A5951EB1C1D1EAB009C17AA /* ApptentiveConnect.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A5951E81C1D1E92009C17AA /* ApptentiveConnect.framework */; }; 9A5951EC1C1D1EB4009C17AA /* ApptentiveConnect.framework in Resources */ = {isa = PBXBuildFile; fileRef = 9A5951D11C1D1D94009C17AA /* ApptentiveConnect.framework */; }; 9A5951F51C1D3D81009C17AA /* CLTimezoneCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A5951F41C1D3D81009C17AA /* CLTimezoneCellView.m */; }; 9A5951FA1C1D5214009C17AA /* iVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A5951F91C1D5214009C17AA /* iVersion.m */; }; @@ -58,41 +56,6 @@ remoteGlobalIDString = 49626B6D13942A2B0093534C; remoteInfo = ApptentiveUnitTests; }; - 9A5951DC1C1D1E35009C17AA /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9A5951D61C1D1E35009C17AA /* ApptentiveConnect.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 496DC37F1333D35600743F65; - remoteInfo = ApptentiveConnect; - }; - 9A5951DE1C1D1E35009C17AA /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9A5951D61C1D1E35009C17AA /* ApptentiveConnect.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 496DC38C1333D35600743F65; - remoteInfo = ApptentiveConnectTests; - }; - 9A5951E01C1D1E35009C17AA /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9A5951D61C1D1E35009C17AA /* ApptentiveConnect.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 49D1118C13341A7C00603373; - remoteInfo = ApptentiveResources; - }; - 9A5951E71C1D1E92009C17AA /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9A5951E21C1D1E91009C17AA /* ApptentiveConnect.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 8DC2EF5B0486A6940098B216; - remoteInfo = ApptentiveConnect; - }; - 9A5951E91C1D1E92009C17AA /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9A5951E21C1D1E91009C17AA /* ApptentiveConnect.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 49626B6D13942A2B0093534C; - remoteInfo = ApptentiveUnitTests; - }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ @@ -106,7 +69,6 @@ 9A392EEB1C1CE9950072C10A /* CLPreferencesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CLPreferencesViewController.m; path = Clocker/Preferences/CLPreferencesViewController.m; sourceTree = ""; }; 9A392EEC1C1CE9950072C10A /* CLPreferencesView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = CLPreferencesView.xib; path = Clocker/Preferences/CLPreferencesView.xib; sourceTree = ""; }; 9A4379211BEC223900F4E27F /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Security.framework; sourceTree = ""; }; - 9A4379221BEC223900F4E27F /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = SystemConfiguration.framework; sourceTree = ""; }; 9A4379231BEC223900F4E27F /* Fabric.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Fabric.framework; sourceTree = ""; }; 9A4379291BEC230A00F4E27F /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; }; 9A43792B1BEC231100F4E27F /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; @@ -121,9 +83,6 @@ 9A5951C11C1D0AAD009C17AA /* CLOneWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = CLOneWindow.xib; path = Clocker/CLOneWindow/CLOneWindow.xib; sourceTree = ""; }; 9A5951C71C1D1B6F009C17AA /* ApptentiveConnect.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ApptentiveConnect.xcodeproj; path = Clocker/ApptentiveConnect/ApptentiveConnect.xcodeproj; sourceTree = ""; }; 9A5951D11C1D1D94009C17AA /* ApptentiveConnect.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApptentiveConnect.framework; path = Clocker/ApptentiveConnect/ApptentiveConnect.framework; sourceTree = ""; }; - 9A5951D41C1D1E1D009C17AA /* apptentive-ios */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "apptentive-ios"; path = "Clocker/ApptentiveConnect/apptentive-ios"; sourceTree = ""; }; - 9A5951D61C1D1E35009C17AA /* ApptentiveConnect.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ApptentiveConnect.xcodeproj; path = "Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ApptentiveConnect.xcodeproj"; sourceTree = ""; }; - 9A5951E21C1D1E91009C17AA /* ApptentiveConnect.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ApptentiveConnect.xcodeproj; path = Clocker/ApptentiveConnect/ApptentiveConnect/ApptentiveConnect.xcodeproj; sourceTree = ""; }; 9A5951F31C1D3D81009C17AA /* CLTimezoneCellView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CLTimezoneCellView.h; path = "Clocker/Custom Table Cell Views/CLTimezoneCellView.h"; sourceTree = ""; }; 9A5951F41C1D3D81009C17AA /* CLTimezoneCellView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CLTimezoneCellView.m; path = "Clocker/Custom Table Cell Views/CLTimezoneCellView.m"; sourceTree = ""; }; 9A5951F81C1D5214009C17AA /* iVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = iVersion.h; path = "Clocker/Updated Version/iVersion.h"; sourceTree = ""; }; @@ -153,8 +112,6 @@ DD4F7C0413C30F9F00825C6E /* Clocker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Clocker.app; sourceTree = BUILT_PRODUCTS_DIR; }; DD4F7C0813C30F9F00825C6E /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; DD4F7C0B13C30F9F00825C6E /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; - DD4F7C0C13C30F9F00825C6E /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; - DD4F7C0D13C30F9F00825C6E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -162,13 +119,11 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9A5951EB1C1D1EAB009C17AA /* ApptentiveConnect.framework in Frameworks */, 9AC678E41C1ABAB9003B4F6B /* QuartzCore.framework in Frameworks */, 9A43792C1BEC231100F4E27F /* libz.tbd in Frameworks */, 9A5951BA1C1D0A22009C17AA /* Crashlytics.framework in Frameworks */, 9A43792A1BEC230A00F4E27F /* libc++.tbd in Frameworks */, 9A4379251BEC223900F4E27F /* Security.framework in Frameworks */, - 9A4379261BEC223900F4E27F /* SystemConfiguration.framework in Frameworks */, DD4F7C0913C30F9F00825C6E /* Cocoa.framework in Frameworks */, 9A4379271BEC223900F4E27F /* Fabric.framework in Frameworks */, ); @@ -216,25 +171,6 @@ name = Products; sourceTree = ""; }; - 9A5951D71C1D1E35009C17AA /* Products */ = { - isa = PBXGroup; - children = ( - 9A5951DD1C1D1E35009C17AA /* libApptentiveConnect.a */, - 9A5951DF1C1D1E35009C17AA /* ApptentiveConnectTests.octest */, - 9A5951E11C1D1E35009C17AA /* ApptentiveResources.bundle */, - ); - name = Products; - sourceTree = ""; - }; - 9A5951E31C1D1E91009C17AA /* Products */ = { - isa = PBXGroup; - children = ( - 9A5951E81C1D1E92009C17AA /* ApptentiveConnect.framework */, - 9A5951EA1C1D1E92009C17AA /* ApptentiveUnitTests.octest */, - ); - name = Products; - sourceTree = ""; - }; 9A5951F01C1D3D35009C17AA /* Table Cell Views */ = { isa = PBXGroup; children = ( @@ -331,7 +267,6 @@ DD4F7C0713C30F9F00825C6E /* Frameworks */, 9A5951FB1C1D5222009C17AA /* Check for Updated Version */, DD4F7C0513C30F9F00825C6E /* Products */, - 9A5951E21C1D1E91009C17AA /* ApptentiveConnect.xcodeproj */, 9A25F7481C1A5E21007D369B /* Rate */, ); sourceTree = ""; @@ -347,20 +282,15 @@ DD4F7C0713C30F9F00825C6E /* Frameworks */ = { isa = PBXGroup; children = ( - 9A5951D61C1D1E35009C17AA /* ApptentiveConnect.xcodeproj */, - 9A5951D41C1D1E1D009C17AA /* apptentive-ios */, 9A5951D11C1D1D94009C17AA /* ApptentiveConnect.framework */, 9A5951C71C1D1B6F009C17AA /* ApptentiveConnect.xcodeproj */, 9A5951B91C1D0A22009C17AA /* Crashlytics.framework */, 9AC678E31C1ABAB9003B4F6B /* QuartzCore.framework */, 9A4379211BEC223900F4E27F /* Security.framework */, - 9A4379221BEC223900F4E27F /* SystemConfiguration.framework */, 9A4379231BEC223900F4E27F /* Fabric.framework */, 9A43792B1BEC231100F4E27F /* libz.tbd */, 9A4379291BEC230A00F4E27F /* libc++.tbd */, DD4F7C0B13C30F9F00825C6E /* AppKit.framework */, - DD4F7C0C13C30F9F00825C6E /* CoreData.framework */, - DD4F7C0D13C30F9F00825C6E /* Foundation.framework */, DD4F7C0813C30F9F00825C6E /* Cocoa.framework */, ); name = Frameworks; @@ -421,14 +351,6 @@ ProductGroup = 9A5951C81C1D1B6F009C17AA /* Products */; ProjectRef = 9A5951C71C1D1B6F009C17AA /* ApptentiveConnect.xcodeproj */; }, - { - ProductGroup = 9A5951D71C1D1E35009C17AA /* Products */; - ProjectRef = 9A5951D61C1D1E35009C17AA /* ApptentiveConnect.xcodeproj */; - }, - { - ProductGroup = 9A5951E31C1D1E91009C17AA /* Products */; - ProjectRef = 9A5951E21C1D1E91009C17AA /* ApptentiveConnect.xcodeproj */; - }, ); projectRoot = ""; targets = ( @@ -452,41 +374,6 @@ remoteRef = 9A5951CE1C1D1B6F009C17AA /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 9A5951DD1C1D1E35009C17AA /* libApptentiveConnect.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libApptentiveConnect.a; - remoteRef = 9A5951DC1C1D1E35009C17AA /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 9A5951DF1C1D1E35009C17AA /* ApptentiveConnectTests.octest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = ApptentiveConnectTests.octest; - remoteRef = 9A5951DE1C1D1E35009C17AA /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 9A5951E11C1D1E35009C17AA /* ApptentiveResources.bundle */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = ApptentiveResources.bundle; - remoteRef = 9A5951E01C1D1E35009C17AA /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 9A5951E81C1D1E92009C17AA /* ApptentiveConnect.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = ApptentiveConnect.framework; - remoteRef = 9A5951E71C1D1E92009C17AA /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 9A5951EA1C1D1E92009C17AA /* ApptentiveUnitTests.octest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = ApptentiveUnitTests.octest; - remoteRef = 9A5951E91C1D1E92009C17AA /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ @@ -705,6 +592,7 @@ GCC_PREFIX_HEADER = "Clocker/Clocker-Prefix.pch"; INFOPLIST_FILE = "Clocker/Clocker-Info.plist"; MACOSX_DEPLOYMENT_TARGET = 10.10; + ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( "-ObjC", "-all_load", diff --git a/Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate b/Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate index a558318..16a1074 100644 Binary files a/Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate and b/Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Clocker.xcodeproj/xcuserdata/abhishekbanthia.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Clocker.xcodeproj/xcuserdata/abhishekbanthia.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 6fea210..fe2b454 100644 --- a/Clocker.xcodeproj/xcuserdata/abhishekbanthia.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/Clocker.xcodeproj/xcuserdata/abhishekbanthia.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -2,32 +2,4 @@ - - - - - - - - - - diff --git a/Clocker/AboutUsWindow/CLAboutUsViewController.m b/Clocker/AboutUsWindow/CLAboutUsViewController.m index 1d28621..9ed5913 100644 --- a/Clocker/AboutUsWindow/CLAboutUsViewController.m +++ b/Clocker/AboutUsWindow/CLAboutUsViewController.m @@ -7,7 +7,6 @@ // #import "CLAboutUsViewController.h" -#import @interface CLAboutUsViewController () @@ -39,8 +38,7 @@ NSString *const CLFacebookPageURL = @"https://www.facebook.com/ClockerMenubarClo - (IBAction)reportIssue:(id)sender { // - ATConnect *connection = [ATConnect sharedConnection]; - [connection showFeedbackWindow:sender]; + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:CLIssueURL]]; } - (IBAction)openFacebookPage:(id)sender diff --git a/Clocker/ApplicationDelegate.m b/Clocker/ApplicationDelegate.m index 2d12865..ac6be09 100755 --- a/Clocker/ApplicationDelegate.m +++ b/Clocker/ApplicationDelegate.m @@ -31,7 +31,6 @@ #import "iRate.h" #import "CommonStrings.h" #import "iVersion.h" -#import @implementation ApplicationDelegate @@ -71,10 +70,7 @@ void *kContextActivePanel = &kContextActivePanel; #pragma mark - NSApplicationDelegate - (void)applicationDidFinishLaunching:(NSNotification *)notification -{ - ATConnect *connection = [ATConnect sharedConnection]; - connection.apiKey = @"b9bff3e37b738748b671a751f09fea3a419661bac3e6e11fa5e854b463db3ba0"; - +{ NSArray *defaultPreference = [[NSUserDefaults standardUserDefaults] objectForKey:CLDefaultPreferenceKey]; NSMutableArray *newDefaults = [[NSMutableArray alloc] init]; diff --git a/Clocker/ApptentiveConnect/ApptentiveConnect/ApptentiveConnect.xcodeproj/project.pbxproj b/Clocker/ApptentiveConnect/ApptentiveConnect/ApptentiveConnect.xcodeproj/project.pbxproj deleted file mode 100755 index 4739558..0000000 --- a/Clocker/ApptentiveConnect/ApptentiveConnect/ApptentiveConnect.xcodeproj/project.pbxproj +++ /dev/null @@ -1,939 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 491CA39015F019E20003BC38 /* PJSONKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 491CA38E15F019E20003BC38 /* PJSONKit.h */; }; - 491CA39115F019E20003BC38 /* PJSONKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 491CA38F15F019E20003BC38 /* PJSONKit.m */; }; - 491CA39215F019E20003BC38 /* PJSONKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 491CA38F15F019E20003BC38 /* PJSONKit.m */; }; - 491CA3B515F029630003BC38 /* ATPlaceholderTextView.h in Headers */ = {isa = PBXBuildFile; fileRef = 491CA3B315F029630003BC38 /* ATPlaceholderTextView.h */; }; - 491CA3B615F029630003BC38 /* ATPlaceholderTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 491CA3B415F029630003BC38 /* ATPlaceholderTextView.m */; }; - 491CA3B715F029630003BC38 /* ATPlaceholderTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 491CA3B415F029630003BC38 /* ATPlaceholderTextView.m */; }; - 491CA3BB15F0663C0003BC38 /* at_logo_info@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 491CA3BA15F0663C0003BC38 /* at_logo_info@2x.png */; }; - 49598DBC15C62F1B00DF4ABD /* ATAppConfigurationUpdateTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 49598DBA15C62F1B00DF4ABD /* ATAppConfigurationUpdateTask.h */; }; - 49598DBD15C62F1B00DF4ABD /* ATAppConfigurationUpdateTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 49598DBB15C62F1B00DF4ABD /* ATAppConfigurationUpdateTask.m */; }; - 49598DBE15C62F1B00DF4ABD /* ATAppConfigurationUpdateTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 49598DBB15C62F1B00DF4ABD /* ATAppConfigurationUpdateTask.m */; }; - 49626B7913942A7E0093534C /* ApptentiveConnect.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* ApptentiveConnect.framework */; }; - 49626B7E13942A9A0093534C /* ATSampleTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 49626B7D13942A9A0093534C /* ATSampleTest.m */; }; - 49626C36139437070093534C /* ATAPIRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 49626C2B139437070093534C /* ATAPIRequest.h */; }; - 49626C37139437070093534C /* ATAPIRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 49626C2C139437070093534C /* ATAPIRequest.m */; }; - 49626C38139437070093534C /* ATConnectionChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 49626C2D139437070093534C /* ATConnectionChannel.h */; }; - 49626C39139437070093534C /* ATConnectionChannel.m in Sources */ = {isa = PBXBuildFile; fileRef = 49626C2E139437070093534C /* ATConnectionChannel.m */; }; - 49626C3A139437070093534C /* ATConnectionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 49626C2F139437070093534C /* ATConnectionManager.h */; }; - 49626C3B139437070093534C /* ATConnectionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 49626C30139437070093534C /* ATConnectionManager.m */; }; - 49626C3C139437070093534C /* ATURLConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 49626C31139437070093534C /* ATURLConnection.h */; }; - 49626C3D139437070093534C /* ATURLConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 49626C32139437070093534C /* ATURLConnection.m */; }; - 49626C3E139437070093534C /* ATURLConnection_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 49626C33139437070093534C /* ATURLConnection_Private.h */; }; - 49626C3F139437070093534C /* ATWebClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 49626C34139437070093534C /* ATWebClient.h */; }; - 49626C40139437070093534C /* ATWebClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 49626C35139437070093534C /* ATWebClient.m */; }; - 49626C46139437580093534C /* NSData+ATBase64.h in Headers */ = {isa = PBXBuildFile; fileRef = 49626C44139437580093534C /* NSData+ATBase64.h */; }; - 49626C47139437580093534C /* NSData+ATBase64.m in Sources */ = {isa = PBXBuildFile; fileRef = 49626C45139437580093534C /* NSData+ATBase64.m */; }; - 49626C58139437690093534C /* ATUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 49626C56139437690093534C /* ATUtilities.h */; }; - 49626C59139437690093534C /* ATUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 49626C57139437690093534C /* ATUtilities.m */; }; - 49626C67139437DD0093534C /* ATConnect.h in Headers */ = {isa = PBXBuildFile; fileRef = 49626C65139437DD0093534C /* ATConnect.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 49626C68139437DD0093534C /* ATConnect.m in Sources */ = {isa = PBXBuildFile; fileRef = 49626C66139437DD0093534C /* ATConnect.m */; }; - 49626C7A139439050093534C /* ATBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = 49626C72139439050093534C /* ATBackend.h */; }; - 49626C7B139439050093534C /* ATBackend.m in Sources */ = {isa = PBXBuildFile; fileRef = 49626C73139439050093534C /* ATBackend.m */; }; - 49626C7C139439050093534C /* ATContactStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 49626C74139439050093534C /* ATContactStorage.h */; }; - 49626C7D139439050093534C /* ATContactStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 49626C75139439050093534C /* ATContactStorage.m */; }; - 49626C80139439050093534C /* ATFeedback.h in Headers */ = {isa = PBXBuildFile; fileRef = 49626C78139439050093534C /* ATFeedback.h */; }; - 49626C81139439050093534C /* ATFeedback.m in Sources */ = {isa = PBXBuildFile; fileRef = 49626C79139439050093534C /* ATFeedback.m */; }; - 49626C9113943C310093534C /* ATReachability.h in Headers */ = {isa = PBXBuildFile; fileRef = 49626C8F13943C310093534C /* ATReachability.h */; }; - 49626C9213943C310093534C /* ATReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 49626C9013943C310093534C /* ATReachability.m */; }; - 49626C9613943C520093534C /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49626C9513943C520093534C /* SystemConfiguration.framework */; }; - 49626D19139444C20093534C /* ATFeedbackTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 49626D13139444C20093534C /* ATFeedbackTask.h */; }; - 49626D1A139444C20093534C /* ATFeedbackTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 49626D14139444C20093534C /* ATFeedbackTask.m */; }; - 49626D1B139444C20093534C /* ATTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 49626D15139444C20093534C /* ATTask.h */; }; - 49626D1C139444C20093534C /* ATTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 49626D16139444C20093534C /* ATTask.m */; }; - 49626D1D139444C20093534C /* ATTaskQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 49626D17139444C20093534C /* ATTaskQueue.h */; }; - 49626D1E139444C20093534C /* ATTaskQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 49626D18139444C20093534C /* ATTaskQueue.m */; }; - 49626D4F1397047A0093534C /* ATFeedbackWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 49626D4E1397047A0093534C /* ATFeedbackWindow.xib */; }; - 49626D53139704D00093534C /* ATFeedbackWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = 49626D51139704D00093534C /* ATFeedbackWindowController.h */; }; - 49626D54139704D00093534C /* ATFeedbackWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 49626D52139704D00093534C /* ATFeedbackWindowController.m */; }; - 4964BF2E17C5D12B000DC2E8 /* ATStaticLibraryBootstrap.h in Headers */ = {isa = PBXBuildFile; fileRef = 4964BF2C17C5D12B000DC2E8 /* ATStaticLibraryBootstrap.h */; }; - 4964BF2F17C5D12B000DC2E8 /* ATStaticLibraryBootstrap.m in Sources */ = {isa = PBXBuildFile; fileRef = 4964BF2D17C5D12B000DC2E8 /* ATStaticLibraryBootstrap.m */; }; - 4964BF3017C5D12B000DC2E8 /* ATStaticLibraryBootstrap.m in Sources */ = {isa = PBXBuildFile; fileRef = 4964BF2D17C5D12B000DC2E8 /* ATStaticLibraryBootstrap.m */; }; - 4964BF3417C5D13F000DC2E8 /* ATLog.h in Headers */ = {isa = PBXBuildFile; fileRef = 4964BF3117C5D13E000DC2E8 /* ATLog.h */; }; - 4964BF3517C5D13F000DC2E8 /* ATLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = 4964BF3217C5D13F000DC2E8 /* ATLogger.h */; }; - 4964BF3617C5D13F000DC2E8 /* ATLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 4964BF3317C5D13F000DC2E8 /* ATLogger.m */; }; - 4964BF3717C5D13F000DC2E8 /* ATLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 4964BF3317C5D13F000DC2E8 /* ATLogger.m */; }; - 4964BF3917C5D2A8000DC2E8 /* ATURLConnection_Private.m in Sources */ = {isa = PBXBuildFile; fileRef = 4964BF3817C5D2A8000DC2E8 /* ATURLConnection_Private.m */; }; - 4964BF3A17C5D2A8000DC2E8 /* ATURLConnection_Private.m in Sources */ = {isa = PBXBuildFile; fileRef = 4964BF3817C5D2A8000DC2E8 /* ATURLConnection_Private.m */; }; - 4964BF3D17C5D2B5000DC2E8 /* ATWebClient_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4964BF3B17C5D2B5000DC2E8 /* ATWebClient_Private.h */; }; - 4964BF3E17C5D2B5000DC2E8 /* ATWebClient_Private.m in Sources */ = {isa = PBXBuildFile; fileRef = 4964BF3C17C5D2B5000DC2E8 /* ATWebClient_Private.m */; }; - 4964BF3F17C5D2B5000DC2E8 /* ATWebClient_Private.m in Sources */ = {isa = PBXBuildFile; fileRef = 4964BF3C17C5D2B5000DC2E8 /* ATWebClient_Private.m */; }; - 4971AFF513BA871600774B70 /* ATImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4971AFF313BA871600774B70 /* ATImageView.h */; }; - 4971AFF613BA871600774B70 /* ATImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4971AFF413BA871600774B70 /* ATImageView.m */; }; - 4971B07913BAB12F00774B70 /* ATConnect_FeedbackWindowPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 4971B07713BAB12F00774B70 /* ATConnect_FeedbackWindowPrivate.h */; }; - 4971B07A13BAB12F00774B70 /* ATConnect_FeedbackWindowPrivate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4971B07813BAB12F00774B70 /* ATConnect_FeedbackWindowPrivate.m */; }; - 4971B47413BFBB7C00774B70 /* at_logo_info.png in Resources */ = {isa = PBXBuildFile; fileRef = 4971B47313BFBB7C00774B70 /* at_logo_info.png */; }; - 4971B4CB13BFBEFF00774B70 /* ATImageButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 4971B4C913BFBEFF00774B70 /* ATImageButton.h */; }; - 4971B4CC13BFBEFF00774B70 /* ATImageButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 4971B4CA13BFBEFF00774B70 /* ATImageButton.m */; }; - 4972847713CA625D002AD591 /* ATAppRatingFlow.h in Headers */ = {isa = PBXBuildFile; fileRef = 4972847513CA625D002AD591 /* ATAppRatingFlow.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4972847813CA625D002AD591 /* ATAppRatingFlow.m in Sources */ = {isa = PBXBuildFile; fileRef = 4972847613CA625D002AD591 /* ATAppRatingFlow.m */; }; - 4982FE74157C0BEF00A1ED63 /* ApptentiveMetrics.h in Headers */ = {isa = PBXBuildFile; fileRef = 4982FE69157C0BEF00A1ED63 /* ApptentiveMetrics.h */; }; - 4982FE75157C0BEF00A1ED63 /* ApptentiveMetrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 4982FE6A157C0BEF00A1ED63 /* ApptentiveMetrics.m */; }; - 4982FE76157C0BEF00A1ED63 /* ApptentiveMetrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 4982FE6A157C0BEF00A1ED63 /* ApptentiveMetrics.m */; }; - 4982FE77157C0BEF00A1ED63 /* ATFeedbackMetrics.h in Headers */ = {isa = PBXBuildFile; fileRef = 4982FE6B157C0BEF00A1ED63 /* ATFeedbackMetrics.h */; }; - 4982FE78157C0BEF00A1ED63 /* ATFeedbackMetrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 4982FE6C157C0BEF00A1ED63 /* ATFeedbackMetrics.m */; }; - 4982FE79157C0BEF00A1ED63 /* ATFeedbackMetrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 4982FE6C157C0BEF00A1ED63 /* ATFeedbackMetrics.m */; }; - 4982FE7A157C0BEF00A1ED63 /* ATMetric.h in Headers */ = {isa = PBXBuildFile; fileRef = 4982FE6D157C0BEF00A1ED63 /* ATMetric.h */; }; - 4982FE7B157C0BEF00A1ED63 /* ATMetric.m in Sources */ = {isa = PBXBuildFile; fileRef = 4982FE6E157C0BEF00A1ED63 /* ATMetric.m */; }; - 4982FE7C157C0BEF00A1ED63 /* ATMetric.m in Sources */ = {isa = PBXBuildFile; fileRef = 4982FE6E157C0BEF00A1ED63 /* ATMetric.m */; }; - 4982FE7D157C0BEF00A1ED63 /* ATSurveyMetrics.h in Headers */ = {isa = PBXBuildFile; fileRef = 4982FE6F157C0BEF00A1ED63 /* ATSurveyMetrics.h */; }; - 4982FE7E157C0BEF00A1ED63 /* ATSurveyMetrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 4982FE70157C0BEF00A1ED63 /* ATSurveyMetrics.m */; }; - 4982FE7F157C0BEF00A1ED63 /* ATSurveyMetrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 4982FE70157C0BEF00A1ED63 /* ATSurveyMetrics.m */; }; - 4982FE80157C0BEF00A1ED63 /* ATWebClient+Metrics.h in Headers */ = {isa = PBXBuildFile; fileRef = 4982FE72157C0BEF00A1ED63 /* ATWebClient+Metrics.h */; }; - 4982FE81157C0BEF00A1ED63 /* ATWebClient+Metrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 4982FE73157C0BEF00A1ED63 /* ATWebClient+Metrics.m */; }; - 4982FE82157C0BEF00A1ED63 /* ATWebClient+Metrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 4982FE73157C0BEF00A1ED63 /* ATWebClient+Metrics.m */; }; - 4982FE86157C0C2700A1ED63 /* ATAppConfigurationUpdater.h in Headers */ = {isa = PBXBuildFile; fileRef = 4982FE84157C0C2700A1ED63 /* ATAppConfigurationUpdater.h */; }; - 4982FE87157C0C2700A1ED63 /* ATAppConfigurationUpdater.m in Sources */ = {isa = PBXBuildFile; fileRef = 4982FE85157C0C2700A1ED63 /* ATAppConfigurationUpdater.m */; }; - 4982FE88157C0C2700A1ED63 /* ATAppConfigurationUpdater.m in Sources */ = {isa = PBXBuildFile; fileRef = 4982FE85157C0C2700A1ED63 /* ATAppConfigurationUpdater.m */; }; - 4982FE8D157C0C3D00A1ED63 /* ATAppRatingFlow_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4982FE89157C0C3D00A1ED63 /* ATAppRatingFlow_Private.h */; }; - 4982FE8E157C0C3D00A1ED63 /* ATAppRatingFlow_Private.m in Sources */ = {isa = PBXBuildFile; fileRef = 4982FE8A157C0C3D00A1ED63 /* ATAppRatingFlow_Private.m */; }; - 4982FE8F157C0C3D00A1ED63 /* ATAppRatingFlow_Private.m in Sources */ = {isa = PBXBuildFile; fileRef = 4982FE8A157C0C3D00A1ED63 /* ATAppRatingFlow_Private.m */; }; - 4982FE90157C0C3D00A1ED63 /* ATAppRatingMetrics.h in Headers */ = {isa = PBXBuildFile; fileRef = 4982FE8B157C0C3D00A1ED63 /* ATAppRatingMetrics.h */; }; - 4982FE91157C0C3D00A1ED63 /* ATAppRatingMetrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 4982FE8C157C0C3D00A1ED63 /* ATAppRatingMetrics.m */; }; - 4982FE92157C0C3D00A1ED63 /* ATAppRatingMetrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 4982FE8C157C0C3D00A1ED63 /* ATAppRatingMetrics.m */; }; - 4982FE94157C0C4D00A1ED63 /* ATWebClient_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4982FE93157C0C4D00A1ED63 /* ATWebClient_Private.h */; }; - 4982FE97157C0C5A00A1ED63 /* ATRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = 4982FE95157C0C5A00A1ED63 /* ATRecord.h */; }; - 4982FE98157C0C5A00A1ED63 /* ATRecord.m in Sources */ = {isa = PBXBuildFile; fileRef = 4982FE96157C0C5A00A1ED63 /* ATRecord.m */; }; - 4982FE99157C0C5A00A1ED63 /* ATRecord.m in Sources */ = {isa = PBXBuildFile; fileRef = 4982FE96157C0C5A00A1ED63 /* ATRecord.m */; }; - 4982FE9C157C0C6700A1ED63 /* ATRecordTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 4982FE9A157C0C6700A1ED63 /* ATRecordTask.h */; }; - 4982FE9D157C0C6700A1ED63 /* ATRecordTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 4982FE9B157C0C6700A1ED63 /* ATRecordTask.m */; }; - 4982FE9E157C0C6700A1ED63 /* ATRecordTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 4982FE9B157C0C6700A1ED63 /* ATRecordTask.m */; }; - 4989203013B539D6007967BA /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4989202F13B539D6007967BA /* AddressBook.framework */; }; - 4989204B13B53B04007967BA /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4989202F13B539D6007967BA /* AddressBook.framework */; }; - 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; - 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; }; - 9A5951EF1C1D332B009C17AA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A5951EE1C1D332B009C17AA /* QuartzCore.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 49626B7713942A760093534C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 8DC2EF4F0486A6940098B216; - remoteInfo = ApptentiveConnect; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; - 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; - 089C1667FE841158C02AAC07 /* InfoPlist.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = InfoPlist.strings; path = resources/English.lproj/InfoPlist.strings; sourceTree = ""; }; - 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; - 32DBCF5E0370ADEE00C91783 /* ApptentiveConnect_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ApptentiveConnect_Prefix.pch; path = source/ApptentiveConnect_Prefix.pch; sourceTree = ""; }; - 491CA38E15F019E20003BC38 /* PJSONKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PJSONKit.h; path = PrefixedJSONKit/PJSONKit.h; sourceTree = ""; }; - 491CA38F15F019E20003BC38 /* PJSONKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PJSONKit.m; path = PrefixedJSONKit/PJSONKit.m; sourceTree = ""; }; - 491CA3B315F029630003BC38 /* ATPlaceholderTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ATPlaceholderTextView.h; path = source/Misc/ATPlaceholderTextView.h; sourceTree = ""; }; - 491CA3B415F029630003BC38 /* ATPlaceholderTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ATPlaceholderTextView.m; path = source/Misc/ATPlaceholderTextView.m; sourceTree = ""; }; - 491CA3BA15F0663C0003BC38 /* at_logo_info@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "at_logo_info@2x.png"; path = "../apptentive-ios/ApptentiveConnect/art/generated/at_logo_info@2x.png"; sourceTree = ""; }; - 49598DBA15C62F1B00DF4ABD /* ATAppConfigurationUpdateTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATAppConfigurationUpdateTask.h; sourceTree = ""; }; - 49598DBB15C62F1B00DF4ABD /* ATAppConfigurationUpdateTask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATAppConfigurationUpdateTask.m; sourceTree = ""; }; - 49626B6D13942A2B0093534C /* ApptentiveUnitTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ApptentiveUnitTests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; - 49626B6E13942A2B0093534C /* ApptentiveUnitTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "ApptentiveUnitTests-Info.plist"; path = "tests/ApptentiveUnitTests-Info.plist"; sourceTree = ""; }; - 49626B7C13942A9A0093534C /* ATSampleTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ATSampleTest.h; path = tests/ATSampleTest.h; sourceTree = ""; }; - 49626B7D13942A9A0093534C /* ATSampleTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ATSampleTest.m; path = tests/ATSampleTest.m; sourceTree = ""; }; - 49626C2B139437070093534C /* ATAPIRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATAPIRequest.h; sourceTree = ""; }; - 49626C2C139437070093534C /* ATAPIRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATAPIRequest.m; sourceTree = ""; }; - 49626C2D139437070093534C /* ATConnectionChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATConnectionChannel.h; sourceTree = ""; }; - 49626C2E139437070093534C /* ATConnectionChannel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATConnectionChannel.m; sourceTree = ""; }; - 49626C2F139437070093534C /* ATConnectionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATConnectionManager.h; sourceTree = ""; }; - 49626C30139437070093534C /* ATConnectionManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATConnectionManager.m; sourceTree = ""; }; - 49626C31139437070093534C /* ATURLConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATURLConnection.h; sourceTree = ""; }; - 49626C32139437070093534C /* ATURLConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATURLConnection.m; sourceTree = ""; }; - 49626C33139437070093534C /* ATURLConnection_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATURLConnection_Private.h; sourceTree = ""; }; - 49626C34139437070093534C /* ATWebClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATWebClient.h; sourceTree = ""; }; - 49626C35139437070093534C /* ATWebClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATWebClient.m; sourceTree = ""; }; - 49626C44139437580093534C /* NSData+ATBase64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+ATBase64.h"; sourceTree = ""; }; - 49626C45139437580093534C /* NSData+ATBase64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+ATBase64.m"; sourceTree = ""; }; - 49626C56139437690093534C /* ATUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATUtilities.h; sourceTree = ""; }; - 49626C57139437690093534C /* ATUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATUtilities.m; sourceTree = ""; }; - 49626C65139437DD0093534C /* ATConnect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ATConnect.h; path = "../apptentive-ios/ApptentiveConnect/source/ATConnect.h"; sourceTree = SOURCE_ROOT; }; - 49626C66139437DD0093534C /* ATConnect.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ATConnect.m; path = "../apptentive-ios/ApptentiveConnect/source/ATConnect.m"; sourceTree = SOURCE_ROOT; }; - 49626C72139439050093534C /* ATBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATBackend.h; sourceTree = ""; }; - 49626C73139439050093534C /* ATBackend.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATBackend.m; sourceTree = ""; }; - 49626C74139439050093534C /* ATContactStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATContactStorage.h; sourceTree = ""; }; - 49626C75139439050093534C /* ATContactStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATContactStorage.m; sourceTree = ""; }; - 49626C78139439050093534C /* ATFeedback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATFeedback.h; sourceTree = ""; }; - 49626C79139439050093534C /* ATFeedback.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATFeedback.m; sourceTree = ""; }; - 49626C8F13943C310093534C /* ATReachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATReachability.h; sourceTree = ""; }; - 49626C9013943C310093534C /* ATReachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATReachability.m; sourceTree = ""; }; - 49626C9513943C520093534C /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; - 49626D13139444C20093534C /* ATFeedbackTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATFeedbackTask.h; sourceTree = ""; }; - 49626D14139444C20093534C /* ATFeedbackTask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATFeedbackTask.m; sourceTree = ""; }; - 49626D15139444C20093534C /* ATTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATTask.h; sourceTree = ""; }; - 49626D16139444C20093534C /* ATTask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATTask.m; sourceTree = ""; }; - 49626D17139444C20093534C /* ATTaskQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATTaskQueue.h; sourceTree = ""; }; - 49626D18139444C20093534C /* ATTaskQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATTaskQueue.m; sourceTree = ""; }; - 49626D4E1397047A0093534C /* ATFeedbackWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ATFeedbackWindow.xib; sourceTree = ""; }; - 49626D51139704D00093534C /* ATFeedbackWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ATFeedbackWindowController.h; path = source/Controllers/ATFeedbackWindowController.h; sourceTree = ""; }; - 49626D52139704D00093534C /* ATFeedbackWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ATFeedbackWindowController.m; path = source/Controllers/ATFeedbackWindowController.m; sourceTree = ""; }; - 4964BF2C17C5D12B000DC2E8 /* ATStaticLibraryBootstrap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATStaticLibraryBootstrap.h; sourceTree = ""; }; - 4964BF2D17C5D12B000DC2E8 /* ATStaticLibraryBootstrap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATStaticLibraryBootstrap.m; sourceTree = ""; }; - 4964BF3117C5D13E000DC2E8 /* ATLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATLog.h; sourceTree = ""; }; - 4964BF3217C5D13F000DC2E8 /* ATLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATLogger.h; sourceTree = ""; }; - 4964BF3317C5D13F000DC2E8 /* ATLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATLogger.m; sourceTree = ""; }; - 4964BF3817C5D2A8000DC2E8 /* ATURLConnection_Private.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATURLConnection_Private.m; sourceTree = ""; }; - 4964BF3B17C5D2B5000DC2E8 /* ATWebClient_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATWebClient_Private.h; sourceTree = ""; }; - 4964BF3C17C5D2B5000DC2E8 /* ATWebClient_Private.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATWebClient_Private.m; sourceTree = ""; }; - 4971AFF313BA871600774B70 /* ATImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ATImageView.h; path = source/Misc/ATImageView.h; sourceTree = ""; }; - 4971AFF413BA871600774B70 /* ATImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ATImageView.m; path = source/Misc/ATImageView.m; sourceTree = ""; }; - 4971B07713BAB12F00774B70 /* ATConnect_FeedbackWindowPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ATConnect_FeedbackWindowPrivate.h; path = source/Misc/ATConnect_FeedbackWindowPrivate.h; sourceTree = ""; }; - 4971B07813BAB12F00774B70 /* ATConnect_FeedbackWindowPrivate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ATConnect_FeedbackWindowPrivate.m; path = source/Misc/ATConnect_FeedbackWindowPrivate.m; sourceTree = ""; }; - 4971B47313BFBB7C00774B70 /* at_logo_info.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = at_logo_info.png; path = "../apptentive-ios/ApptentiveConnect/art/generated/at_logo_info.png"; sourceTree = SOURCE_ROOT; }; - 4971B4C913BFBEFF00774B70 /* ATImageButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ATImageButton.h; path = source/Misc/ATImageButton.h; sourceTree = ""; }; - 4971B4CA13BFBEFF00774B70 /* ATImageButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ATImageButton.m; path = source/Misc/ATImageButton.m; sourceTree = ""; }; - 4972847513CA625D002AD591 /* ATAppRatingFlow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATAppRatingFlow.h; sourceTree = ""; }; - 4972847613CA625D002AD591 /* ATAppRatingFlow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATAppRatingFlow.m; sourceTree = ""; }; - 4982FE69157C0BEF00A1ED63 /* ApptentiveMetrics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApptentiveMetrics.h; sourceTree = ""; }; - 4982FE6A157C0BEF00A1ED63 /* ApptentiveMetrics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ApptentiveMetrics.m; sourceTree = ""; }; - 4982FE6B157C0BEF00A1ED63 /* ATFeedbackMetrics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATFeedbackMetrics.h; sourceTree = ""; }; - 4982FE6C157C0BEF00A1ED63 /* ATFeedbackMetrics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATFeedbackMetrics.m; sourceTree = ""; }; - 4982FE6D157C0BEF00A1ED63 /* ATMetric.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATMetric.h; sourceTree = ""; }; - 4982FE6E157C0BEF00A1ED63 /* ATMetric.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATMetric.m; sourceTree = ""; }; - 4982FE6F157C0BEF00A1ED63 /* ATSurveyMetrics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATSurveyMetrics.h; sourceTree = ""; }; - 4982FE70157C0BEF00A1ED63 /* ATSurveyMetrics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATSurveyMetrics.m; sourceTree = ""; }; - 4982FE72157C0BEF00A1ED63 /* ATWebClient+Metrics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ATWebClient+Metrics.h"; sourceTree = ""; }; - 4982FE73157C0BEF00A1ED63 /* ATWebClient+Metrics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ATWebClient+Metrics.m"; sourceTree = ""; }; - 4982FE84157C0C2700A1ED63 /* ATAppConfigurationUpdater.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATAppConfigurationUpdater.h; sourceTree = ""; }; - 4982FE85157C0C2700A1ED63 /* ATAppConfigurationUpdater.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATAppConfigurationUpdater.m; sourceTree = ""; }; - 4982FE89157C0C3D00A1ED63 /* ATAppRatingFlow_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATAppRatingFlow_Private.h; sourceTree = ""; }; - 4982FE8A157C0C3D00A1ED63 /* ATAppRatingFlow_Private.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATAppRatingFlow_Private.m; sourceTree = ""; }; - 4982FE8B157C0C3D00A1ED63 /* ATAppRatingMetrics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATAppRatingMetrics.h; sourceTree = ""; }; - 4982FE8C157C0C3D00A1ED63 /* ATAppRatingMetrics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATAppRatingMetrics.m; sourceTree = ""; }; - 4982FE93157C0C4D00A1ED63 /* ATWebClient_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATWebClient_Private.h; sourceTree = ""; }; - 4982FE95157C0C5A00A1ED63 /* ATRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATRecord.h; sourceTree = ""; }; - 4982FE96157C0C5A00A1ED63 /* ATRecord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATRecord.m; sourceTree = ""; }; - 4982FE9A157C0C6700A1ED63 /* ATRecordTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATRecordTask.h; sourceTree = ""; }; - 4982FE9B157C0C6700A1ED63 /* ATRecordTask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATRecordTask.m; sourceTree = ""; }; - 4989202F13B539D6007967BA /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; }; - 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = resources/Info.plist; sourceTree = ""; }; - 8DC2EF5B0486A6940098B216 /* ApptentiveConnect.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ApptentiveConnect.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 9A5951EE1C1D332B009C17AA /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - D2F7E79907B2D74100F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 49626B6A13942A2B0093534C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 49626B7913942A7E0093534C /* ApptentiveConnect.framework in Frameworks */, - 4989203013B539D6007967BA /* AddressBook.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 8DC2EF560486A6940098B216 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9A5951EF1C1D332B009C17AA /* QuartzCore.framework in Frameworks */, - 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */, - 49626C9613943C520093534C /* SystemConfiguration.framework in Frameworks */, - 4989204B13B53B04007967BA /* AddressBook.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 034768DFFF38A50411DB9C8B /* Products */ = { - isa = PBXGroup; - children = ( - 8DC2EF5B0486A6940098B216 /* ApptentiveConnect.framework */, - 49626B6D13942A2B0093534C /* ApptentiveUnitTests.octest */, - ); - name = Products; - sourceTree = ""; - }; - 0867D691FE84028FC02AAC07 /* ApptentiveConnect */ = { - isa = PBXGroup; - children = ( - 9A5951EE1C1D332B009C17AA /* QuartzCore.framework */, - 49626BF5139436580093534C /* ext */, - 49626B7313942A4D0093534C /* source */, - 49626D4B139703D40093534C /* xibs */, - 49626B7413942A560093534C /* resources */, - 49626B7613942A630093534C /* tests */, - 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, - 034768DFFF38A50411DB9C8B /* Products */, - ); - name = ApptentiveConnect; - sourceTree = ""; - }; - 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { - isa = PBXGroup; - children = ( - 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */, - 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */, - ); - name = "External Frameworks and Libraries"; - sourceTree = ""; - }; - 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */ = { - isa = PBXGroup; - children = ( - 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */, - 49626C9513943C520093534C /* SystemConfiguration.framework */, - 4989202F13B539D6007967BA /* AddressBook.framework */, - ); - name = "Linked Frameworks"; - sourceTree = ""; - }; - 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */ = { - isa = PBXGroup; - children = ( - 0867D6A5FE840307C02AAC07 /* AppKit.framework */, - D2F7E79907B2D74100F64583 /* CoreData.framework */, - 0867D69BFE84028FC02AAC07 /* Foundation.framework */, - ); - name = "Other Frameworks"; - sourceTree = ""; - }; - 49626B7313942A4D0093534C /* source */ = { - isa = PBXGroup; - children = ( - 32DBCF5E0370ADEE00C91783 /* ApptentiveConnect_Prefix.pch */, - 49626D51139704D00093534C /* ATFeedbackWindowController.h */, - 49626D52139704D00093534C /* ATFeedbackWindowController.m */, - 4971AFF313BA871600774B70 /* ATImageView.h */, - 4971AFF413BA871600774B70 /* ATImageView.m */, - 4971B07713BAB12F00774B70 /* ATConnect_FeedbackWindowPrivate.h */, - 4971B07813BAB12F00774B70 /* ATConnect_FeedbackWindowPrivate.m */, - 4971B4C913BFBEFF00774B70 /* ATImageButton.h */, - 4971B4CA13BFBEFF00774B70 /* ATImageButton.m */, - 491CA3B315F029630003BC38 /* ATPlaceholderTextView.h */, - 491CA3B415F029630003BC38 /* ATPlaceholderTextView.m */, - ); - name = source; - sourceTree = ""; - }; - 49626B7413942A560093534C /* resources */ = { - isa = PBXGroup; - children = ( - 4971B47313BFBB7C00774B70 /* at_logo_info.png */, - 491CA3BA15F0663C0003BC38 /* at_logo_info@2x.png */, - 8DC2EF5A0486A6940098B216 /* Info.plist */, - 089C1666FE841158C02AAC07 /* InfoPlist.strings */, - ); - name = resources; - sourceTree = ""; - }; - 49626B7613942A630093534C /* tests */ = { - isa = PBXGroup; - children = ( - 49626B6E13942A2B0093534C /* ApptentiveUnitTests-Info.plist */, - 49626B7C13942A9A0093534C /* ATSampleTest.h */, - 49626B7D13942A9A0093534C /* ATSampleTest.m */, - ); - name = tests; - sourceTree = ""; - }; - 49626BF5139436580093534C /* ext */ = { - isa = PBXGroup; - children = ( - 49626BF6139436600093534C /* apptentive-ios */, - ); - name = ext; - sourceTree = ""; - }; - 49626BF6139436600093534C /* apptentive-ios */ = { - isa = PBXGroup; - children = ( - 49626C43139437580093534C /* ext */, - 49626BFB1394367B0093534C /* source */, - ); - name = "apptentive-ios"; - sourceTree = ""; - }; - 49626BFB1394367B0093534C /* source */ = { - isa = PBXGroup; - children = ( - 49626C65139437DD0093534C /* ATConnect.h */, - 49626C66139437DD0093534C /* ATConnect.m */, - 4982FE68157C0BEF00A1ED63 /* Metrics */, - 49626C55139437690093534C /* Misc */, - 4972847413CA625D002AD591 /* Rating Flow */, - 49626C71139439050093534C /* Persistence */, - 49626C8E13943C310093534C /* Reachability */, - 49626D12139444C20093534C /* Tasks */, - 49626C2A139437070093534C /* URL Loading */, - ); - name = source; - sourceTree = ""; - }; - 49626C2A139437070093534C /* URL Loading */ = { - isa = PBXGroup; - children = ( - 4982FE93157C0C4D00A1ED63 /* ATWebClient_Private.h */, - 49626C2B139437070093534C /* ATAPIRequest.h */, - 49626C2C139437070093534C /* ATAPIRequest.m */, - 49626C2D139437070093534C /* ATConnectionChannel.h */, - 49626C2E139437070093534C /* ATConnectionChannel.m */, - 49626C2F139437070093534C /* ATConnectionManager.h */, - 49626C30139437070093534C /* ATConnectionManager.m */, - 49626C31139437070093534C /* ATURLConnection.h */, - 49626C32139437070093534C /* ATURLConnection.m */, - 49626C33139437070093534C /* ATURLConnection_Private.h */, - 4964BF3817C5D2A8000DC2E8 /* ATURLConnection_Private.m */, - 49626C34139437070093534C /* ATWebClient.h */, - 49626C35139437070093534C /* ATWebClient.m */, - 4964BF3B17C5D2B5000DC2E8 /* ATWebClient_Private.h */, - 4964BF3C17C5D2B5000DC2E8 /* ATWebClient_Private.m */, - ); - name = "URL Loading"; - path = "../apptentive-ios/ApptentiveConnect/source/URL Loading"; - sourceTree = SOURCE_ROOT; - }; - 49626C43139437580093534C /* ext */ = { - isa = PBXGroup; - children = ( - 49626C44139437580093534C /* NSData+ATBase64.h */, - 49626C45139437580093534C /* NSData+ATBase64.m */, - 491CA38E15F019E20003BC38 /* PJSONKit.h */, - 491CA38F15F019E20003BC38 /* PJSONKit.m */, - ); - name = ext; - path = "../apptentive-ios/ApptentiveConnect/ext"; - sourceTree = SOURCE_ROOT; - }; - 49626C55139437690093534C /* Misc */ = { - isa = PBXGroup; - children = ( - 4964BF3117C5D13E000DC2E8 /* ATLog.h */, - 4964BF3217C5D13F000DC2E8 /* ATLogger.h */, - 4964BF3317C5D13F000DC2E8 /* ATLogger.m */, - 49626C56139437690093534C /* ATUtilities.h */, - 49626C57139437690093534C /* ATUtilities.m */, - 4964BF2C17C5D12B000DC2E8 /* ATStaticLibraryBootstrap.h */, - 4964BF2D17C5D12B000DC2E8 /* ATStaticLibraryBootstrap.m */, - ); - name = Misc; - path = "../apptentive-ios/ApptentiveConnect/source/Misc"; - sourceTree = SOURCE_ROOT; - }; - 49626C71139439050093534C /* Persistence */ = { - isa = PBXGroup; - children = ( - 49626C72139439050093534C /* ATBackend.h */, - 49626C73139439050093534C /* ATBackend.m */, - 49626C74139439050093534C /* ATContactStorage.h */, - 49626C75139439050093534C /* ATContactStorage.m */, - 49626C78139439050093534C /* ATFeedback.h */, - 49626C79139439050093534C /* ATFeedback.m */, - 4982FE84157C0C2700A1ED63 /* ATAppConfigurationUpdater.h */, - 4982FE85157C0C2700A1ED63 /* ATAppConfigurationUpdater.m */, - 4982FE95157C0C5A00A1ED63 /* ATRecord.h */, - 4982FE96157C0C5A00A1ED63 /* ATRecord.m */, - ); - name = Persistence; - path = "../apptentive-ios/ApptentiveConnect/source/Persistence"; - sourceTree = SOURCE_ROOT; - }; - 49626C8E13943C310093534C /* Reachability */ = { - isa = PBXGroup; - children = ( - 49626C8F13943C310093534C /* ATReachability.h */, - 49626C9013943C310093534C /* ATReachability.m */, - ); - name = Reachability; - path = "../apptentive-ios/ApptentiveConnect/source/Reachability"; - sourceTree = SOURCE_ROOT; - }; - 49626D12139444C20093534C /* Tasks */ = { - isa = PBXGroup; - children = ( - 49598DBA15C62F1B00DF4ABD /* ATAppConfigurationUpdateTask.h */, - 49598DBB15C62F1B00DF4ABD /* ATAppConfigurationUpdateTask.m */, - 4982FE9A157C0C6700A1ED63 /* ATRecordTask.h */, - 4982FE9B157C0C6700A1ED63 /* ATRecordTask.m */, - 49626D13139444C20093534C /* ATFeedbackTask.h */, - 49626D14139444C20093534C /* ATFeedbackTask.m */, - 49626D15139444C20093534C /* ATTask.h */, - 49626D16139444C20093534C /* ATTask.m */, - 49626D17139444C20093534C /* ATTaskQueue.h */, - 49626D18139444C20093534C /* ATTaskQueue.m */, - ); - name = Tasks; - path = "../apptentive-ios/ApptentiveConnect/source/Tasks"; - sourceTree = SOURCE_ROOT; - }; - 49626D4B139703D40093534C /* xibs */ = { - isa = PBXGroup; - children = ( - 49626D4E1397047A0093534C /* ATFeedbackWindow.xib */, - ); - path = xibs; - sourceTree = ""; - }; - 4972847413CA625D002AD591 /* Rating Flow */ = { - isa = PBXGroup; - children = ( - 4972847513CA625D002AD591 /* ATAppRatingFlow.h */, - 4972847613CA625D002AD591 /* ATAppRatingFlow.m */, - 4982FE89157C0C3D00A1ED63 /* ATAppRatingFlow_Private.h */, - 4982FE8A157C0C3D00A1ED63 /* ATAppRatingFlow_Private.m */, - 4982FE8B157C0C3D00A1ED63 /* ATAppRatingMetrics.h */, - 4982FE8C157C0C3D00A1ED63 /* ATAppRatingMetrics.m */, - ); - name = "Rating Flow"; - path = "../apptentive-ios/ApptentiveConnect/source/Rating Flow"; - sourceTree = SOURCE_ROOT; - }; - 4982FE68157C0BEF00A1ED63 /* Metrics */ = { - isa = PBXGroup; - children = ( - 4982FE69157C0BEF00A1ED63 /* ApptentiveMetrics.h */, - 4982FE6A157C0BEF00A1ED63 /* ApptentiveMetrics.m */, - 4982FE6B157C0BEF00A1ED63 /* ATFeedbackMetrics.h */, - 4982FE6C157C0BEF00A1ED63 /* ATFeedbackMetrics.m */, - 4982FE6D157C0BEF00A1ED63 /* ATMetric.h */, - 4982FE6E157C0BEF00A1ED63 /* ATMetric.m */, - 4982FE6F157C0BEF00A1ED63 /* ATSurveyMetrics.h */, - 4982FE70157C0BEF00A1ED63 /* ATSurveyMetrics.m */, - 4982FE71157C0BEF00A1ED63 /* URL Loading */, - ); - name = Metrics; - path = "../apptentive-ios/ApptentiveConnect/source/Metrics"; - sourceTree = ""; - }; - 4982FE71157C0BEF00A1ED63 /* URL Loading */ = { - isa = PBXGroup; - children = ( - 4982FE72157C0BEF00A1ED63 /* ATWebClient+Metrics.h */, - 4982FE73157C0BEF00A1ED63 /* ATWebClient+Metrics.m */, - ); - path = "URL Loading"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 8DC2EF500486A6940098B216 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 49626C36139437070093534C /* ATAPIRequest.h in Headers */, - 49626C38139437070093534C /* ATConnectionChannel.h in Headers */, - 49626C3A139437070093534C /* ATConnectionManager.h in Headers */, - 49626C3C139437070093534C /* ATURLConnection.h in Headers */, - 49626C3E139437070093534C /* ATURLConnection_Private.h in Headers */, - 49626C3F139437070093534C /* ATWebClient.h in Headers */, - 49626C46139437580093534C /* NSData+ATBase64.h in Headers */, - 49626C58139437690093534C /* ATUtilities.h in Headers */, - 49626C67139437DD0093534C /* ATConnect.h in Headers */, - 49626C7A139439050093534C /* ATBackend.h in Headers */, - 49626C7C139439050093534C /* ATContactStorage.h in Headers */, - 49626C80139439050093534C /* ATFeedback.h in Headers */, - 49626C9113943C310093534C /* ATReachability.h in Headers */, - 49626D19139444C20093534C /* ATFeedbackTask.h in Headers */, - 49626D1B139444C20093534C /* ATTask.h in Headers */, - 49626D1D139444C20093534C /* ATTaskQueue.h in Headers */, - 49626D53139704D00093534C /* ATFeedbackWindowController.h in Headers */, - 4971AFF513BA871600774B70 /* ATImageView.h in Headers */, - 4971B07913BAB12F00774B70 /* ATConnect_FeedbackWindowPrivate.h in Headers */, - 4971B4CB13BFBEFF00774B70 /* ATImageButton.h in Headers */, - 4972847713CA625D002AD591 /* ATAppRatingFlow.h in Headers */, - 4982FE74157C0BEF00A1ED63 /* ApptentiveMetrics.h in Headers */, - 4982FE77157C0BEF00A1ED63 /* ATFeedbackMetrics.h in Headers */, - 4982FE7A157C0BEF00A1ED63 /* ATMetric.h in Headers */, - 4982FE7D157C0BEF00A1ED63 /* ATSurveyMetrics.h in Headers */, - 4982FE80157C0BEF00A1ED63 /* ATWebClient+Metrics.h in Headers */, - 4982FE86157C0C2700A1ED63 /* ATAppConfigurationUpdater.h in Headers */, - 4982FE8D157C0C3D00A1ED63 /* ATAppRatingFlow_Private.h in Headers */, - 4982FE90157C0C3D00A1ED63 /* ATAppRatingMetrics.h in Headers */, - 4982FE94157C0C4D00A1ED63 /* ATWebClient_Private.h in Headers */, - 4982FE97157C0C5A00A1ED63 /* ATRecord.h in Headers */, - 4982FE9C157C0C6700A1ED63 /* ATRecordTask.h in Headers */, - 49598DBC15C62F1B00DF4ABD /* ATAppConfigurationUpdateTask.h in Headers */, - 491CA39015F019E20003BC38 /* PJSONKit.h in Headers */, - 491CA3B515F029630003BC38 /* ATPlaceholderTextView.h in Headers */, - 4964BF2E17C5D12B000DC2E8 /* ATStaticLibraryBootstrap.h in Headers */, - 4964BF3417C5D13F000DC2E8 /* ATLog.h in Headers */, - 4964BF3517C5D13F000DC2E8 /* ATLogger.h in Headers */, - 4964BF3D17C5D2B5000DC2E8 /* ATWebClient_Private.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 49626B6C13942A2B0093534C /* ApptentiveUnitTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 49626B7213942A2B0093534C /* Build configuration list for PBXNativeTarget "ApptentiveUnitTests" */; - buildPhases = ( - 49626B6813942A2B0093534C /* Resources */, - 49626B6913942A2B0093534C /* Sources */, - 49626B6A13942A2B0093534C /* Frameworks */, - 49626B6B13942A2B0093534C /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - 49626B7813942A760093534C /* PBXTargetDependency */, - ); - name = ApptentiveUnitTests; - productName = ApptentiveUnitTests; - productReference = 49626B6D13942A2B0093534C /* ApptentiveUnitTests.octest */; - productType = "com.apple.product-type.bundle.ocunit-test"; - }; - 8DC2EF4F0486A6940098B216 /* ApptentiveConnect */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "ApptentiveConnect" */; - buildPhases = ( - 4964BF4717C5D74E000DC2E8 /* Localize (Release Only) */, - 8DC2EF500486A6940098B216 /* Headers */, - 8DC2EF520486A6940098B216 /* Resources */, - 8DC2EF540486A6940098B216 /* Sources */, - 8DC2EF560486A6940098B216 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = ApptentiveConnect; - productInstallPath = "$(HOME)/Library/Frameworks"; - productName = ApptentiveConnect; - productReference = 8DC2EF5B0486A6940098B216 /* ApptentiveConnect.framework */; - productType = "com.apple.product-type.framework"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 0867D690FE84028FC02AAC07 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0420; - ORGANIZATIONNAME = "Apptentive, Inc."; - }; - buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "ApptentiveConnect" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 0867D691FE84028FC02AAC07 /* ApptentiveConnect */; - productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 8DC2EF4F0486A6940098B216 /* ApptentiveConnect */, - 49626B6C13942A2B0093534C /* ApptentiveUnitTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 49626B6813942A2B0093534C /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 8DC2EF520486A6940098B216 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */, - 49626D4F1397047A0093534C /* ATFeedbackWindow.xib in Resources */, - 4971B47413BFBB7C00774B70 /* at_logo_info.png in Resources */, - 491CA3BB15F0663C0003BC38 /* at_logo_info@2x.png in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 49626B6B13942A2B0093534C /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; - }; - 4964BF4717C5D74E000DC2E8 /* Localize (Release Only) */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Localize (Release Only)"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "echo \"Configuration is: ${CONFIGURATION}\"\nif [ \"${CONFIGURATION}\" = 'Release' ]; then\n if [ -e \"${PROJECT_DIR}/resources/English.lproj/Localizable.strings\" ]; then\n rm \"${PROJECT_DIR}/resources/English.lproj/Localizable.strings\"\n fi\n find \"${PROJECT_DIR}/source/\" -name *.m -print0 | xargs -0 genstrings -s ATLocalizedString -o \"${PROJECT_DIR}/resources/English.lproj\"\nfi"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 49626B6913942A2B0093534C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 49626B7E13942A9A0093534C /* ATSampleTest.m in Sources */, - 4982FE76157C0BEF00A1ED63 /* ApptentiveMetrics.m in Sources */, - 4982FE79157C0BEF00A1ED63 /* ATFeedbackMetrics.m in Sources */, - 4982FE7C157C0BEF00A1ED63 /* ATMetric.m in Sources */, - 4982FE7F157C0BEF00A1ED63 /* ATSurveyMetrics.m in Sources */, - 4982FE82157C0BEF00A1ED63 /* ATWebClient+Metrics.m in Sources */, - 4982FE88157C0C2700A1ED63 /* ATAppConfigurationUpdater.m in Sources */, - 4982FE8F157C0C3D00A1ED63 /* ATAppRatingFlow_Private.m in Sources */, - 4982FE92157C0C3D00A1ED63 /* ATAppRatingMetrics.m in Sources */, - 4982FE99157C0C5A00A1ED63 /* ATRecord.m in Sources */, - 4982FE9E157C0C6700A1ED63 /* ATRecordTask.m in Sources */, - 49598DBE15C62F1B00DF4ABD /* ATAppConfigurationUpdateTask.m in Sources */, - 491CA39215F019E20003BC38 /* PJSONKit.m in Sources */, - 491CA3B715F029630003BC38 /* ATPlaceholderTextView.m in Sources */, - 4964BF3017C5D12B000DC2E8 /* ATStaticLibraryBootstrap.m in Sources */, - 4964BF3717C5D13F000DC2E8 /* ATLogger.m in Sources */, - 4964BF3A17C5D2A8000DC2E8 /* ATURLConnection_Private.m in Sources */, - 4964BF3F17C5D2B5000DC2E8 /* ATWebClient_Private.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 8DC2EF540486A6940098B216 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 49626C37139437070093534C /* ATAPIRequest.m in Sources */, - 49626C39139437070093534C /* ATConnectionChannel.m in Sources */, - 49626C3B139437070093534C /* ATConnectionManager.m in Sources */, - 49626C3D139437070093534C /* ATURLConnection.m in Sources */, - 49626C40139437070093534C /* ATWebClient.m in Sources */, - 49626C47139437580093534C /* NSData+ATBase64.m in Sources */, - 49626C59139437690093534C /* ATUtilities.m in Sources */, - 49626C68139437DD0093534C /* ATConnect.m in Sources */, - 49626C7B139439050093534C /* ATBackend.m in Sources */, - 49626C7D139439050093534C /* ATContactStorage.m in Sources */, - 49626C81139439050093534C /* ATFeedback.m in Sources */, - 49626C9213943C310093534C /* ATReachability.m in Sources */, - 49626D1A139444C20093534C /* ATFeedbackTask.m in Sources */, - 49626D1C139444C20093534C /* ATTask.m in Sources */, - 49626D1E139444C20093534C /* ATTaskQueue.m in Sources */, - 49626D54139704D00093534C /* ATFeedbackWindowController.m in Sources */, - 4971AFF613BA871600774B70 /* ATImageView.m in Sources */, - 4971B07A13BAB12F00774B70 /* ATConnect_FeedbackWindowPrivate.m in Sources */, - 4971B4CC13BFBEFF00774B70 /* ATImageButton.m in Sources */, - 4972847813CA625D002AD591 /* ATAppRatingFlow.m in Sources */, - 4982FE75157C0BEF00A1ED63 /* ApptentiveMetrics.m in Sources */, - 4982FE78157C0BEF00A1ED63 /* ATFeedbackMetrics.m in Sources */, - 4982FE7B157C0BEF00A1ED63 /* ATMetric.m in Sources */, - 4982FE7E157C0BEF00A1ED63 /* ATSurveyMetrics.m in Sources */, - 4982FE81157C0BEF00A1ED63 /* ATWebClient+Metrics.m in Sources */, - 4982FE87157C0C2700A1ED63 /* ATAppConfigurationUpdater.m in Sources */, - 4982FE8E157C0C3D00A1ED63 /* ATAppRatingFlow_Private.m in Sources */, - 4982FE91157C0C3D00A1ED63 /* ATAppRatingMetrics.m in Sources */, - 4982FE98157C0C5A00A1ED63 /* ATRecord.m in Sources */, - 4982FE9D157C0C6700A1ED63 /* ATRecordTask.m in Sources */, - 49598DBD15C62F1B00DF4ABD /* ATAppConfigurationUpdateTask.m in Sources */, - 491CA39115F019E20003BC38 /* PJSONKit.m in Sources */, - 491CA3B615F029630003BC38 /* ATPlaceholderTextView.m in Sources */, - 4964BF2F17C5D12B000DC2E8 /* ATStaticLibraryBootstrap.m in Sources */, - 4964BF3617C5D13F000DC2E8 /* ATLogger.m in Sources */, - 4964BF3917C5D2A8000DC2E8 /* ATURLConnection_Private.m in Sources */, - 4964BF3E17C5D2B5000DC2E8 /* ATWebClient_Private.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 49626B7813942A760093534C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 8DC2EF4F0486A6940098B216 /* ApptentiveConnect */; - targetProxy = 49626B7713942A760093534C /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 089C1666FE841158C02AAC07 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 089C1667FE841158C02AAC07 /* InfoPlist.strings */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 1DEB91AE08733DA50010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - FRAMEWORK_VERSION = A; - GCC_DYNAMIC_NO_PIC = NO; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = source/ApptentiveConnect_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = ( - "JSONKIT_PREFIX=AT", - "APPTENTIVE_DEBUG=1", - "AT_LOGGING_LEVEL_INFO=1", - "AT_LOGGING_LEVEL_DEBUG=1", - "AT_LOGGING_LEVEL_ERROR=1", - ); - INFOPLIST_FILE = resources/Info.plist; - INSTALL_PATH = "@executable_path/../Frameworks"; - PRODUCT_NAME = ApptentiveConnect; - WRAPPER_EXTENSION = framework; - }; - name = Debug; - }; - 1DEB91AF08733DA50010E9CD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - FRAMEWORK_VERSION = A; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = source/ApptentiveConnect_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = ( - "JSONKIT_PREFIX=AT", - "AT_LOGGING_LEVEL_INFO=1", - "AT_LOGGING_LEVEL_ERROR=1", - ); - INFOPLIST_FILE = resources/Info.plist; - INSTALL_PATH = "@executable_path/../Frameworks"; - PRODUCT_NAME = ApptentiveConnect; - WRAPPER_EXTENSION = framework; - }; - name = Release; - }; - 1DEB91B208733DA50010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 1DEB91B308733DA50010E9CD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; - SDKROOT = macosx; - }; - name = Release; - }; - 49626B7013942A2B0093534C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks"; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h"; - INFOPLIST_FILE = "tests/ApptentiveUnitTests-Info.plist"; - INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; - OTHER_LDFLAGS = ( - "-framework", - Cocoa, - "-framework", - SenTestingKit, - ); - PRODUCT_NAME = ApptentiveUnitTests; - WRAPPER_EXTENSION = octest; - }; - name = Debug; - }; - 49626B7113942A2B0093534C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks"; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h"; - INFOPLIST_FILE = "tests/ApptentiveUnitTests-Info.plist"; - INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; - OTHER_LDFLAGS = ( - "-framework", - Cocoa, - "-framework", - SenTestingKit, - ); - PRODUCT_NAME = ApptentiveUnitTests; - WRAPPER_EXTENSION = octest; - ZERO_LINK = NO; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "ApptentiveConnect" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB91AE08733DA50010E9CD /* Debug */, - 1DEB91AF08733DA50010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "ApptentiveConnect" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB91B208733DA50010E9CD /* Debug */, - 1DEB91B308733DA50010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 49626B7213942A2B0093534C /* Build configuration list for PBXNativeTarget "ApptentiveUnitTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 49626B7013942A2B0093534C /* Debug */, - 49626B7113942A2B0093534C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 0867D690FE84028FC02AAC07 /* Project object */; -} diff --git a/Clocker/ApptentiveConnect/ApptentiveConnect/ApptentiveConnect.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Clocker/ApptentiveConnect/ApptentiveConnect/ApptentiveConnect.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a..0000000 --- a/Clocker/ApptentiveConnect/ApptentiveConnect/ApptentiveConnect.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Clocker/ApptentiveConnect/ApptentiveConnect/ApptentiveConnect.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate b/Clocker/ApptentiveConnect/ApptentiveConnect/ApptentiveConnect.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 387026e..0000000 Binary files a/Clocker/ApptentiveConnect/ApptentiveConnect/ApptentiveConnect.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/Clocker/ApptentiveConnect/ApptentiveConnect/ApptentiveConnect.xcodeproj/xcuserdata/abhishekbanthia.xcuserdatad/xcschemes/ApptentiveConnect.xcscheme b/Clocker/ApptentiveConnect/ApptentiveConnect/ApptentiveConnect.xcodeproj/xcuserdata/abhishekbanthia.xcuserdatad/xcschemes/ApptentiveConnect.xcscheme deleted file mode 100644 index d2ef782..0000000 --- a/Clocker/ApptentiveConnect/ApptentiveConnect/ApptentiveConnect.xcodeproj/xcuserdata/abhishekbanthia.xcuserdatad/xcschemes/ApptentiveConnect.xcscheme +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Clocker/ApptentiveConnect/ApptentiveConnect/ApptentiveConnect.xcodeproj/xcuserdata/abhishekbanthia.xcuserdatad/xcschemes/ApptentiveUnitTests.xcscheme b/Clocker/ApptentiveConnect/ApptentiveConnect/ApptentiveConnect.xcodeproj/xcuserdata/abhishekbanthia.xcuserdatad/xcschemes/ApptentiveUnitTests.xcscheme deleted file mode 100644 index 19c1fe2..0000000 --- a/Clocker/ApptentiveConnect/ApptentiveConnect/ApptentiveConnect.xcodeproj/xcuserdata/abhishekbanthia.xcuserdatad/xcschemes/ApptentiveUnitTests.xcscheme +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Clocker/ApptentiveConnect/ApptentiveConnect/ApptentiveConnect.xcodeproj/xcuserdata/abhishekbanthia.xcuserdatad/xcschemes/xcschememanagement.plist b/Clocker/ApptentiveConnect/ApptentiveConnect/ApptentiveConnect.xcodeproj/xcuserdata/abhishekbanthia.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 6804b92..0000000 --- a/Clocker/ApptentiveConnect/ApptentiveConnect/ApptentiveConnect.xcodeproj/xcuserdata/abhishekbanthia.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - SchemeUserState - - ApptentiveConnect.xcscheme - - orderHint - 0 - - ApptentiveUnitTests.xcscheme - - orderHint - 1 - - - SuppressBuildableAutocreation - - 49626B6C13942A2B0093534C - - primary - - - 8DC2EF4F0486A6940098B216 - - primary - - - - - diff --git a/Clocker/ApptentiveConnect/ApptentiveConnect/source/Controllers/ATFeedbackWindowController.m b/Clocker/ApptentiveConnect/ApptentiveConnect/source/Controllers/ATFeedbackWindowController.m index 007ec5b..744d60d 100755 --- a/Clocker/ApptentiveConnect/ApptentiveConnect/source/Controllers/ATFeedbackWindowController.m +++ b/Clocker/ApptentiveConnect/ApptentiveConnect/source/Controllers/ATFeedbackWindowController.m @@ -292,7 +292,7 @@ ABMultiValue *abEmails = [me valueForProperty:kABEmailProperty]; if (abEmails && [abEmails count]) { - for (int i = 0; i < [abEmails count]; i++) { + for (NSInteger i = 0; i < [abEmails count]; i++) { NSString *abEmail = [abEmails valueAtIndex:i]; if (contactStorage.email == nil || ![contactStorage.email isEqualToString:abEmail]) { [emails addObject:abEmail]; @@ -301,7 +301,7 @@ } ABMultiValue *abPhoneNumbers = [me valueForProperty:kABPhoneProperty]; if (abPhoneNumbers && [abPhoneNumbers count]) { - for (int i = 0; i < [abPhoneNumbers count]; i++) { + for (NSInteger i = 0; i < [abPhoneNumbers count]; i++) { NSString *abPhoneNumber = [abPhoneNumbers valueAtIndex:i]; if (contactStorage.phone == nil || ![contactStorage.phone isEqualToString:abPhoneNumber]) { [phoneNumbers addObject:abPhoneNumber]; diff --git a/Clocker/ApptentiveConnect/apptentive-ios/.gitignore b/Clocker/ApptentiveConnect/apptentive-ios/.gitignore deleted file mode 100755 index 5bcde55..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# xcode noise -build/ -build/* -*/build/* -*.pbxuser -*.mode1v3 -*.mode2v3 -*.perspectivev3 -xcuserdata/* -xcuserdata/ - -# OSX noise -.DS_Store -profile -Icon* - -# Emacs noise -*~ - -# other noise -.svn diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ApptentiveConnect.xcodeproj/project.pbxproj b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ApptentiveConnect.xcodeproj/project.pbxproj deleted file mode 100755 index 8a5b6d0..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ApptentiveConnect.xcodeproj/project.pbxproj +++ /dev/null @@ -1,1328 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 490B8158144274EF009801E9 /* ATCustomButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 490B8156144274EF009801E9 /* ATCustomButton.h */; }; - 490B8159144274EF009801E9 /* ATCustomButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 490B8157144274EF009801E9 /* ATCustomButton.m */; }; - 490B815A144274EF009801E9 /* ATCustomButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 490B8157144274EF009801E9 /* ATCustomButton.m */; }; - 490B815D1442751F009801E9 /* ATToolbar.h in Headers */ = {isa = PBXBuildFile; fileRef = 490B815B1442751F009801E9 /* ATToolbar.h */; }; - 490B815E1442751F009801E9 /* ATToolbar.m in Sources */ = {isa = PBXBuildFile; fileRef = 490B815C1442751F009801E9 /* ATToolbar.m */; }; - 490B815F1442751F009801E9 /* ATToolbar.m in Sources */ = {isa = PBXBuildFile; fileRef = 490B815C1442751F009801E9 /* ATToolbar.m */; }; - 490B8164144275B3009801E9 /* ATFeedbackController.h in Headers */ = {isa = PBXBuildFile; fileRef = 490B8162144275B3009801E9 /* ATFeedbackController.h */; }; - 490B8165144275B3009801E9 /* ATFeedbackController.m in Sources */ = {isa = PBXBuildFile; fileRef = 490B8163144275B3009801E9 /* ATFeedbackController.m */; }; - 490B8166144275B3009801E9 /* ATFeedbackController.m in Sources */ = {isa = PBXBuildFile; fileRef = 490B8163144275B3009801E9 /* ATFeedbackController.m */; }; - 490B816C14427A95009801E9 /* ATFeedbackController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 490B81601442759D009801E9 /* ATFeedbackController.xib */; }; - 491748BA1341177000A7D11E /* ATConnectionChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 491748B21341177000A7D11E /* ATConnectionChannel.h */; }; - 491748BB1341177000A7D11E /* ATConnectionChannel.m in Sources */ = {isa = PBXBuildFile; fileRef = 491748B31341177000A7D11E /* ATConnectionChannel.m */; }; - 491748BC1341177000A7D11E /* ATConnectionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 491748B41341177000A7D11E /* ATConnectionManager.h */; }; - 491748BD1341177000A7D11E /* ATConnectionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 491748B51341177000A7D11E /* ATConnectionManager.m */; }; - 491748BE1341177000A7D11E /* ATURLConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 491748B61341177000A7D11E /* ATURLConnection.h */; }; - 491748BF1341177000A7D11E /* ATURLConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 491748B71341177000A7D11E /* ATURLConnection.m */; }; - 491748C01341177000A7D11E /* ATWebClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 491748B81341177000A7D11E /* ATWebClient.h */; }; - 491748C11341177000A7D11E /* ATWebClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 491748B91341177000A7D11E /* ATWebClient.m */; }; - 493529FF138C7253000E464A /* ATInfoViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 49AA1022138B498C0082887A /* ATInfoViewController.xib */; }; - 49352A00138C7257000E464A /* ATInfoViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 49AA1024138B49A50082887A /* ATInfoViewController_iPad.xib */; }; - 49352A20138C73B8000E464A /* ATAboutApptentiveView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 49352A1F138C73B8000E464A /* ATAboutApptentiveView.xib */; }; - 49352A21138C73B8000E464A /* ATAboutApptentiveView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 49352A1F138C73B8000E464A /* ATAboutApptentiveView.xib */; }; - 49352AC3138C97A2000E464A /* ATAPIRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 49352AC2138C97A2000E464A /* ATAPIRequest.m */; }; - 49352AC4138C97A2000E464A /* ATAPIRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 49352AC1138C97A2000E464A /* ATAPIRequest.h */; }; - 49352AC5138C97A2000E464A /* ATAPIRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 49352AC2138C97A2000E464A /* ATAPIRequest.m */; }; - 49352ADD138CA1DC000E464A /* ATURLConnection_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 49352ADC138CA1DC000E464A /* ATURLConnection_Private.h */; }; - 49352B3F138DB3AA000E464A /* ATTaskProgressCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 49352B3E138DB3AA000E464A /* ATTaskProgressCell.xib */; }; - 4936AE511379DE3100A4B17F /* ATCenteringImageScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4936AE451379DE3100A4B17F /* ATCenteringImageScrollView.h */; }; - 4936AE521379DE3100A4B17F /* ATCenteringImageScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4936AE461379DE3100A4B17F /* ATCenteringImageScrollView.m */; }; - 4936AE531379DE3100A4B17F /* ATDefaultTextView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4936AE471379DE3100A4B17F /* ATDefaultTextView.h */; }; - 4936AE541379DE3100A4B17F /* ATDefaultTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4936AE481379DE3100A4B17F /* ATDefaultTextView.m */; }; - 4936AE551379DE3100A4B17F /* ATHUDView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4936AE491379DE3100A4B17F /* ATHUDView.h */; }; - 4936AE561379DE3100A4B17F /* ATHUDView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4936AE4A1379DE3100A4B17F /* ATHUDView.m */; }; - 4936AE5B1379DE3100A4B17F /* ATSimpleImageViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 4936AE4F1379DE3100A4B17F /* ATSimpleImageViewController.h */; }; - 4936AE5C1379DE3100A4B17F /* ATSimpleImageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4936AE501379DE3100A4B17F /* ATSimpleImageViewController.m */; }; - 4936AE5D1379DE3100A4B17F /* ATCenteringImageScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4936AE461379DE3100A4B17F /* ATCenteringImageScrollView.m */; }; - 4936AE5E1379DE3100A4B17F /* ATDefaultTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4936AE481379DE3100A4B17F /* ATDefaultTextView.m */; }; - 4936AE5F1379DE3100A4B17F /* ATHUDView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4936AE4A1379DE3100A4B17F /* ATHUDView.m */; }; - 4936AE621379DE3100A4B17F /* ATSimpleImageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4936AE501379DE3100A4B17F /* ATSimpleImageViewController.m */; }; - 4936AE771379DEBB00A4B17F /* ATUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 4936AE751379DEBB00A4B17F /* ATUtilities.h */; }; - 4936AE781379DEBB00A4B17F /* ATUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 4936AE761379DEBB00A4B17F /* ATUtilities.m */; }; - 4936AE791379DEBB00A4B17F /* ATUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 4936AE761379DEBB00A4B17F /* ATUtilities.m */; }; - 4936AE831379DECE00A4B17F /* ATBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = 4936AE7B1379DECE00A4B17F /* ATBackend.h */; }; - 4936AE841379DECE00A4B17F /* ATBackend.m in Sources */ = {isa = PBXBuildFile; fileRef = 4936AE7C1379DECE00A4B17F /* ATBackend.m */; }; - 4936AE851379DECE00A4B17F /* ATContactStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 4936AE7D1379DECE00A4B17F /* ATContactStorage.h */; }; - 4936AE861379DECE00A4B17F /* ATContactStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 4936AE7E1379DECE00A4B17F /* ATContactStorage.m */; }; - 4936AE891379DECE00A4B17F /* ATFeedback.h in Headers */ = {isa = PBXBuildFile; fileRef = 4936AE811379DECE00A4B17F /* ATFeedback.h */; }; - 4936AE8A1379DECE00A4B17F /* ATFeedback.m in Sources */ = {isa = PBXBuildFile; fileRef = 4936AE821379DECE00A4B17F /* ATFeedback.m */; }; - 4936AE8B1379DECE00A4B17F /* ATBackend.m in Sources */ = {isa = PBXBuildFile; fileRef = 4936AE7C1379DECE00A4B17F /* ATBackend.m */; }; - 4936AE8C1379DECE00A4B17F /* ATContactStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 4936AE7E1379DECE00A4B17F /* ATContactStorage.m */; }; - 4936AE8E1379DECE00A4B17F /* ATFeedback.m in Sources */ = {isa = PBXBuildFile; fileRef = 4936AE821379DECE00A4B17F /* ATFeedback.m */; }; - 493AEB2A15990A4D00DFD4C7 /* ATSurveys.h in Headers */ = {isa = PBXBuildFile; fileRef = 493AEB1615990A4D00DFD4C7 /* ATSurveys.h */; }; - 493AEB2B15990A4D00DFD4C7 /* ATSurveys.m in Sources */ = {isa = PBXBuildFile; fileRef = 493AEB1715990A4D00DFD4C7 /* ATSurveys.m */; }; - 493AEB2C15990A4D00DFD4C7 /* ATSurveys.m in Sources */ = {isa = PBXBuildFile; fileRef = 493AEB1715990A4D00DFD4C7 /* ATSurveys.m */; }; - 493AEB2D15990A4D00DFD4C7 /* ATSurvey.h in Headers */ = {isa = PBXBuildFile; fileRef = 493AEB1915990A4D00DFD4C7 /* ATSurvey.h */; }; - 493AEB2E15990A4D00DFD4C7 /* ATSurvey.m in Sources */ = {isa = PBXBuildFile; fileRef = 493AEB1A15990A4D00DFD4C7 /* ATSurvey.m */; }; - 493AEB2F15990A4D00DFD4C7 /* ATSurvey.m in Sources */ = {isa = PBXBuildFile; fileRef = 493AEB1A15990A4D00DFD4C7 /* ATSurvey.m */; }; - 493AEB3015990A4D00DFD4C7 /* ATSurveyParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 493AEB1B15990A4D00DFD4C7 /* ATSurveyParser.h */; }; - 493AEB3115990A4D00DFD4C7 /* ATSurveyParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 493AEB1C15990A4D00DFD4C7 /* ATSurveyParser.m */; }; - 493AEB3215990A4D00DFD4C7 /* ATSurveyParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 493AEB1C15990A4D00DFD4C7 /* ATSurveyParser.m */; }; - 493AEB3315990A4D00DFD4C7 /* ATSurveyQuestion.h in Headers */ = {isa = PBXBuildFile; fileRef = 493AEB1D15990A4D00DFD4C7 /* ATSurveyQuestion.h */; }; - 493AEB3415990A4D00DFD4C7 /* ATSurveyQuestion.m in Sources */ = {isa = PBXBuildFile; fileRef = 493AEB1E15990A4D00DFD4C7 /* ATSurveyQuestion.m */; }; - 493AEB3515990A4D00DFD4C7 /* ATSurveyQuestion.m in Sources */ = {isa = PBXBuildFile; fileRef = 493AEB1E15990A4D00DFD4C7 /* ATSurveyQuestion.m */; }; - 493AEB3615990A4D00DFD4C7 /* ATSurveyResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 493AEB2015990A4D00DFD4C7 /* ATSurveyResponse.h */; }; - 493AEB3715990A4D00DFD4C7 /* ATSurveyResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 493AEB2115990A4D00DFD4C7 /* ATSurveyResponse.m */; }; - 493AEB3815990A4D00DFD4C7 /* ATSurveyResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 493AEB2115990A4D00DFD4C7 /* ATSurveyResponse.m */; }; - 493AEB3915990A4D00DFD4C7 /* ATSurveysBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = 493AEB2215990A4D00DFD4C7 /* ATSurveysBackend.h */; }; - 493AEB3A15990A4D00DFD4C7 /* ATSurveysBackend.m in Sources */ = {isa = PBXBuildFile; fileRef = 493AEB2315990A4D00DFD4C7 /* ATSurveysBackend.m */; }; - 493AEB3B15990A4D00DFD4C7 /* ATSurveysBackend.m in Sources */ = {isa = PBXBuildFile; fileRef = 493AEB2315990A4D00DFD4C7 /* ATSurveysBackend.m */; }; - 493AEB3C15990A4D00DFD4C7 /* ATWebClient+SurveyAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 493AEB2515990A4D00DFD4C7 /* ATWebClient+SurveyAdditions.h */; }; - 493AEB3D15990A4D00DFD4C7 /* ATWebClient+SurveyAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 493AEB2615990A4D00DFD4C7 /* ATWebClient+SurveyAdditions.m */; }; - 493AEB3E15990A4D00DFD4C7 /* ATWebClient+SurveyAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 493AEB2615990A4D00DFD4C7 /* ATWebClient+SurveyAdditions.m */; }; - 493AEB3F15990A4D00DFD4C7 /* ATSurveyViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 493AEB2815990A4D00DFD4C7 /* ATSurveyViewController.h */; }; - 493AEB4015990A4D00DFD4C7 /* ATSurveyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 493AEB2915990A4D00DFD4C7 /* ATSurveyViewController.m */; }; - 493AEB4115990A4D00DFD4C7 /* ATSurveyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 493AEB2915990A4D00DFD4C7 /* ATSurveyViewController.m */; }; - 493AEB4515990A6B00DFD4C7 /* ApptentiveSurveysTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 493AEB4415990A6B00DFD4C7 /* ApptentiveSurveysTests.m */; }; - 493F8D1B1672A551000B5151 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49AAA17A1633716F00B26851 /* StoreKit.framework */; }; - 493F8D8C1672DEFD000B5151 /* ATStaticLibraryBootstrap.h in Headers */ = {isa = PBXBuildFile; fileRef = 493F8D8A1672DEFD000B5151 /* ATStaticLibraryBootstrap.h */; }; - 493F8D8D1672DEFD000B5151 /* ATStaticLibraryBootstrap.m in Sources */ = {isa = PBXBuildFile; fileRef = 493F8D8B1672DEFD000B5151 /* ATStaticLibraryBootstrap.m */; }; - 493F8D8E1672DEFD000B5151 /* ATStaticLibraryBootstrap.m in Sources */ = {isa = PBXBuildFile; fileRef = 493F8D8B1672DEFD000B5151 /* ATStaticLibraryBootstrap.m */; }; - 493F8D901672E07D000B5151 /* ATURLConnection_Private.m in Sources */ = {isa = PBXBuildFile; fileRef = 493F8D8F1672E07D000B5151 /* ATURLConnection_Private.m */; }; - 493F8D911672E07D000B5151 /* ATURLConnection_Private.m in Sources */ = {isa = PBXBuildFile; fileRef = 493F8D8F1672E07D000B5151 /* ATURLConnection_Private.m */; }; - 493F8D931672E15F000B5151 /* ATWebClient_Private.m in Sources */ = {isa = PBXBuildFile; fileRef = 493F8D921672E15F000B5151 /* ATWebClient_Private.m */; }; - 4942CC9113C7AD2D009BF758 /* ATAppRatingFlow.h in Headers */ = {isa = PBXBuildFile; fileRef = 4942CC8F13C7AD2D009BF758 /* ATAppRatingFlow.h */; settings = {ATTRIBUTES = (); }; }; - 4942CC9213C7AD2D009BF758 /* ATAppRatingFlow.m in Sources */ = {isa = PBXBuildFile; fileRef = 4942CC9013C7AD2D009BF758 /* ATAppRatingFlow.m */; }; - 4942CC9313C7AD2D009BF758 /* ATAppRatingFlow.m in Sources */ = {isa = PBXBuildFile; fileRef = 4942CC9013C7AD2D009BF758 /* ATAppRatingFlow.m */; }; - 49509A61135658E200793EEC /* ATReachability.h in Headers */ = {isa = PBXBuildFile; fileRef = 49509A5F135658E200793EEC /* ATReachability.h */; }; - 49509A62135658E200793EEC /* ATReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 49509A60135658E200793EEC /* ATReachability.m */; }; - 49509A6C1356596F00793EEC /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49509A6B1356596F00793EEC /* SystemConfiguration.framework */; }; - 49509DFB13583FB800793EEC /* ATUtilitiesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 49509DFA13583FB800793EEC /* ATUtilitiesTests.m */; }; - 49509E061358408600793EEC /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49B3D968133E6D6400B5A5CD /* CoreGraphics.framework */; }; - 49509E071358408C00793EEC /* CoreTelephony.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49B3D96E133E6DE700B5A5CD /* CoreTelephony.framework */; }; - 49509E081358409800793EEC /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49B3D969133E6D6400B5A5CD /* QuartzCore.framework */; }; - 49509E1B1358409C00793EEC /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49509A6B1356596F00793EEC /* SystemConfiguration.framework */; }; - 49509E1C135840A000793EEC /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49B3D96A133E6D6400B5A5CD /* UIKit.framework */; }; - 4960E154134A578F00F6311F /* generated in Resources */ = {isa = PBXBuildFile; fileRef = 4960E153134A578F00F6311F /* generated */; }; - 4967278216B9D9CB00C679B8 /* ATConnect_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4967278116B9D9CB00C679B8 /* ATConnect_Private.h */; }; - 4967278416B9FE6400C679B8 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4967278316B9FE6400C679B8 /* Info.plist */; }; - 496DC3831333D35600743F65 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 496DC3821333D35600743F65 /* Foundation.framework */; }; - 496DC38F1333D35600743F65 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 496DC3821333D35600743F65 /* Foundation.framework */; }; - 496DC3941333D35600743F65 /* libApptentiveConnect.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 496DC37F1333D35600743F65 /* libApptentiveConnect.a */; }; - 496F29E014496711005B7C01 /* ATSimpleImageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 496F29DE14496702005B7C01 /* ATSimpleImageViewController.xib */; }; - 4987FA80157ACAB500AF2078 /* ATSurveyMetrics.h in Headers */ = {isa = PBXBuildFile; fileRef = 4987FA7E157ACAB500AF2078 /* ATSurveyMetrics.h */; }; - 4987FA81157ACAB500AF2078 /* ATSurveyMetrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 4987FA7F157ACAB500AF2078 /* ATSurveyMetrics.m */; }; - 4987FA82157ACAB500AF2078 /* ATSurveyMetrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 4987FA7F157ACAB500AF2078 /* ATSurveyMetrics.m */; }; - 4987FA85157ACB0B00AF2078 /* ATFeedbackMetrics.h in Headers */ = {isa = PBXBuildFile; fileRef = 4987FA83157ACB0A00AF2078 /* ATFeedbackMetrics.h */; }; - 4987FA86157ACB0B00AF2078 /* ATFeedbackMetrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 4987FA84157ACB0A00AF2078 /* ATFeedbackMetrics.m */; }; - 4987FA87157ACB0B00AF2078 /* ATFeedbackMetrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 4987FA84157ACB0A00AF2078 /* ATFeedbackMetrics.m */; }; - 4987FA9C157AE53700AF2078 /* ApptentiveMetrics.h in Headers */ = {isa = PBXBuildFile; fileRef = 4987FA95157AE53500AF2078 /* ApptentiveMetrics.h */; }; - 4987FA9D157AE53700AF2078 /* ApptentiveMetrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 4987FA96157AE53500AF2078 /* ApptentiveMetrics.m */; }; - 4987FA9E157AE53700AF2078 /* ApptentiveMetrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 4987FA96157AE53500AF2078 /* ApptentiveMetrics.m */; }; - 4987FA9F157AE53700AF2078 /* ATMetric.h in Headers */ = {isa = PBXBuildFile; fileRef = 4987FA97157AE53500AF2078 /* ATMetric.h */; }; - 4987FAA0157AE53700AF2078 /* ATMetric.m in Sources */ = {isa = PBXBuildFile; fileRef = 4987FA98157AE53600AF2078 /* ATMetric.m */; }; - 4987FAA1157AE53700AF2078 /* ATMetric.m in Sources */ = {isa = PBXBuildFile; fileRef = 4987FA98157AE53600AF2078 /* ATMetric.m */; }; - 4987FAA2157AE53700AF2078 /* ATWebClient+Metrics.h in Headers */ = {isa = PBXBuildFile; fileRef = 4987FA9A157AE53700AF2078 /* ATWebClient+Metrics.h */; }; - 4987FAA3157AE53700AF2078 /* ATWebClient+Metrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 4987FA9B157AE53700AF2078 /* ATWebClient+Metrics.m */; }; - 4987FAA4157AE53700AF2078 /* ATWebClient+Metrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 4987FA9B157AE53700AF2078 /* ATWebClient+Metrics.m */; }; - 4987FAA7157AE59D00AF2078 /* ApptentiveMetricsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4987FAA6157AE59D00AF2078 /* ApptentiveMetricsTests.m */; }; - 498B8E3E1519691900CA9A58 /* ATRatingPredicateTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 498B8E3D1519691900CA9A58 /* ATRatingPredicateTests.m */; }; - 498EFB6B15BA414A00A1043B /* ATSurveyGetSurveysTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 498EFB6915BA414A00A1043B /* ATSurveyGetSurveysTask.h */; }; - 498EFB6C15BA414A00A1043B /* ATSurveyGetSurveysTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 498EFB6A15BA414A00A1043B /* ATSurveyGetSurveysTask.m */; }; - 498EFB6D15BA414A00A1043B /* ATSurveyGetSurveysTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 498EFB6A15BA414A00A1043B /* ATSurveyGetSurveysTask.m */; }; - 498EFB7015BA48B300A1043B /* ATAppConfigurationUpdateTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 498EFB6E15BA48B200A1043B /* ATAppConfigurationUpdateTask.h */; }; - 498EFB7115BA48B300A1043B /* ATAppConfigurationUpdateTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 498EFB6F15BA48B300A1043B /* ATAppConfigurationUpdateTask.m */; }; - 498EFB7215BA48B300A1043B /* ATAppConfigurationUpdateTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 498EFB6F15BA48B300A1043B /* ATAppConfigurationUpdateTask.m */; }; - 499B56CA15D305880063C23C /* PJSONKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 499B56C615D305880063C23C /* PJSONKit.h */; }; - 499B56CB15D305880063C23C /* PJSONKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 499B56C715D305880063C23C /* PJSONKit.m */; }; - 499B56CC15D305880063C23C /* PJSONKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 499B56C715D305880063C23C /* PJSONKit.m */; }; - 49AA101F138B44C00082887A /* ATInfoViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 49AA101D138B44C00082887A /* ATInfoViewController.h */; }; - 49AA1020138B44C00082887A /* ATInfoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 49AA101E138B44C00082887A /* ATInfoViewController.m */; }; - 49AA1021138B44C00082887A /* ATInfoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 49AA101E138B44C00082887A /* ATInfoViewController.m */; }; - 49AA1023138B498C0082887A /* ATInfoViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 49AA1022138B498C0082887A /* ATInfoViewController.xib */; }; - 49AA1025138B49A50082887A /* ATInfoViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 49AA1024138B49A50082887A /* ATInfoViewController_iPad.xib */; }; - 49AAA17B1633716F00B26851 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49AAA17A1633716F00B26851 /* StoreKit.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; - 49B2F452171B8985004E5FE0 /* ATLogViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 49B2F450171B8984004E5FE0 /* ATLogViewController.h */; }; - 49B2F453171B8985004E5FE0 /* ATLogViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 49B2F451171B8984004E5FE0 /* ATLogViewController.m */; }; - 49B2F455171B8990004E5FE0 /* ATFeedbackTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 49B2F454171B8990004E5FE0 /* ATFeedbackTypes.h */; }; - 49B2F459171B89C4004E5FE0 /* ATLog.h in Headers */ = {isa = PBXBuildFile; fileRef = 49B2F456171B89C4004E5FE0 /* ATLog.h */; }; - 49B2F45A171B89C4004E5FE0 /* ATLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = 49B2F457171B89C4004E5FE0 /* ATLogger.h */; }; - 49B2F45B171B89C4004E5FE0 /* ATLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 49B2F458171B89C4004E5FE0 /* ATLogger.m */; }; - 49B2F45C171B89C4004E5FE0 /* ATLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 49B2F458171B89C4004E5FE0 /* ATLogger.m */; }; - 49B3D96B133E6D6400B5A5CD /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49B3D968133E6D6400B5A5CD /* CoreGraphics.framework */; }; - 49B3D96D133E6D6400B5A5CD /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49B3D96A133E6D6400B5A5CD /* UIKit.framework */; }; - 49B3D96F133E6DE700B5A5CD /* CoreTelephony.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49B3D96E133E6DE700B5A5CD /* CoreTelephony.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; - 49B877111464958C00594A5D /* ATWebClient_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 49B877101464958C00594A5D /* ATWebClient_Private.h */; }; - 49BC2A5A144F75E20041E789 /* ATShadowView.h in Headers */ = {isa = PBXBuildFile; fileRef = 49BC2A58144F75E10041E789 /* ATShadowView.h */; }; - 49BC2A5B144F75E20041E789 /* ATShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 49BC2A59144F75E20041E789 /* ATShadowView.m */; }; - 49C0028E1334137E0071F088 /* ApptentiveConnectTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 49C0028A1334137E0071F088 /* ApptentiveConnectTests.m */; }; - 49C0028F1334137E0071F088 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 49C0028B1334137E0071F088 /* InfoPlist.strings */; }; - 49C002A1133413BB0071F088 /* ApptentiveConnect-Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = 49C00296133413BB0071F088 /* ApptentiveConnect-Prefix.pch */; }; - 49C002A2133413BB0071F088 /* ATConnect.h in Headers */ = {isa = PBXBuildFile; fileRef = 49C00297133413BB0071F088 /* ATConnect.h */; settings = {ATTRIBUTES = (); }; }; - 49C002A3133413BB0071F088 /* ATConnect.m in Sources */ = {isa = PBXBuildFile; fileRef = 49C00298133413BB0071F088 /* ATConnect.m */; }; - 49CEFF5D15168B54006D8BA8 /* ATAppConfigurationUpdater.h in Headers */ = {isa = PBXBuildFile; fileRef = 49CEFF5B15168B53006D8BA8 /* ATAppConfigurationUpdater.h */; }; - 49CEFF5E15168B54006D8BA8 /* ATAppConfigurationUpdater.m in Sources */ = {isa = PBXBuildFile; fileRef = 49CEFF5C15168B53006D8BA8 /* ATAppConfigurationUpdater.m */; }; - 49CEFF5F15168B54006D8BA8 /* ATAppConfigurationUpdater.m in Sources */ = {isa = PBXBuildFile; fileRef = 49CEFF5C15168B53006D8BA8 /* ATAppConfigurationUpdater.m */; }; - 49CEFF8115193EC2006D8BA8 /* ATAppRatingFlow_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 49CEFF7F15193EC2006D8BA8 /* ATAppRatingFlow_Private.h */; }; - 49CEFF8215193EC2006D8BA8 /* ATAppRatingFlow_Private.m in Sources */ = {isa = PBXBuildFile; fileRef = 49CEFF8015193EC2006D8BA8 /* ATAppRatingFlow_Private.m */; }; - 49D1123C13359BA000603373 /* NSData+ATBase64.h in Headers */ = {isa = PBXBuildFile; fileRef = 49D1123A13359BA000603373 /* NSData+ATBase64.h */; }; - 49D1123D13359BA000603373 /* NSData+ATBase64.m in Sources */ = {isa = PBXBuildFile; fileRef = 49D1123B13359BA000603373 /* NSData+ATBase64.m */; }; - 49D1124F13368CC200603373 /* ATTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 49D1124D13368CC200603373 /* ATTask.h */; }; - 49D1125013368CC200603373 /* ATTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 49D1124E13368CC200603373 /* ATTask.m */; }; - 49D1125313368CEF00603373 /* ATFeedbackTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 49D1125113368CEE00603373 /* ATFeedbackTask.h */; }; - 49D1125413368CEF00603373 /* ATFeedbackTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 49D1125213368CEF00603373 /* ATFeedbackTask.m */; }; - 49D112731337CC9F00603373 /* ATTaskQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 49D112711337CC9E00603373 /* ATTaskQueue.h */; }; - 49D112741337CC9F00603373 /* ATTaskQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 49D112721337CC9F00603373 /* ATTaskQueue.m */; }; - 49E891D0134FE2AB00DD098A /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 49E891CD134FE2AB00DD098A /* Localizable.strings */; }; - 49EA5AB014BD08AD004F8A4D /* ATRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EA5AAE14BD08AD004F8A4D /* ATRecord.h */; }; - 49EA5AB114BD08AD004F8A4D /* ATRecord.m in Sources */ = {isa = PBXBuildFile; fileRef = 49EA5AAF14BD08AD004F8A4D /* ATRecord.m */; }; - 49EA5AB214BD08AD004F8A4D /* ATRecord.m in Sources */ = {isa = PBXBuildFile; fileRef = 49EA5AAF14BD08AD004F8A4D /* ATRecord.m */; }; - 49EA5ABD14BD0F4D004F8A4D /* ATRecordTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EA5ABB14BD0F4D004F8A4D /* ATRecordTask.h */; }; - 49EA5ABE14BD0F4D004F8A4D /* ATRecordTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 49EA5ABC14BD0F4D004F8A4D /* ATRecordTask.m */; }; - 49EA5ABF14BD0F4D004F8A4D /* ATRecordTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 49EA5ABC14BD0F4D004F8A4D /* ATRecordTask.m */; }; - 49EF340F14AA7F2D00077F76 /* ATAppRatingMetrics.h in Headers */ = {isa = PBXBuildFile; fileRef = 49EF340D14AA7F2D00077F76 /* ATAppRatingMetrics.h */; }; - 49EF341014AA7F2D00077F76 /* ATAppRatingMetrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 49EF340E14AA7F2D00077F76 /* ATAppRatingMetrics.m */; }; - 49EF341114AA7F2D00077F76 /* ATAppRatingMetrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 49EF340E14AA7F2D00077F76 /* ATAppRatingMetrics.m */; }; - 49F3404E16BC8B1A008AA02B /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49AAA17A1633716F00B26851 /* StoreKit.framework */; }; - 9A5951ED1C1D327D009C17AA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49B3D969133E6D6400B5A5CD /* QuartzCore.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 4960E1101344265200F6311F /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 496DC3761333D35600743F65 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 49D1118B13341A7C00603373; - remoteInfo = ApptentiveResources; - }; - 496DC3921333D35600743F65 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 496DC3761333D35600743F65 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 496DC37E1333D35600743F65; - remoteInfo = ApptentiveConnect; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 490B8156144274EF009801E9 /* ATCustomButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATCustomButton.h; sourceTree = ""; }; - 490B8157144274EF009801E9 /* ATCustomButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATCustomButton.m; sourceTree = ""; }; - 490B815B1442751F009801E9 /* ATToolbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATToolbar.h; sourceTree = ""; }; - 490B815C1442751F009801E9 /* ATToolbar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATToolbar.m; sourceTree = ""; }; - 490B81601442759D009801E9 /* ATFeedbackController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ATFeedbackController.xib; sourceTree = ""; }; - 490B8162144275B3009801E9 /* ATFeedbackController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATFeedbackController.h; sourceTree = ""; }; - 490B8163144275B3009801E9 /* ATFeedbackController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATFeedbackController.m; sourceTree = ""; }; - 491748B21341177000A7D11E /* ATConnectionChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATConnectionChannel.h; sourceTree = ""; }; - 491748B31341177000A7D11E /* ATConnectionChannel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATConnectionChannel.m; sourceTree = ""; }; - 491748B41341177000A7D11E /* ATConnectionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATConnectionManager.h; sourceTree = ""; }; - 491748B51341177000A7D11E /* ATConnectionManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATConnectionManager.m; sourceTree = ""; }; - 491748B61341177000A7D11E /* ATURLConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATURLConnection.h; sourceTree = ""; }; - 491748B71341177000A7D11E /* ATURLConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATURLConnection.m; sourceTree = ""; }; - 491748B81341177000A7D11E /* ATWebClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATWebClient.h; sourceTree = ""; }; - 491748B91341177000A7D11E /* ATWebClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATWebClient.m; sourceTree = ""; }; - 49352A1F138C73B8000E464A /* ATAboutApptentiveView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ATAboutApptentiveView.xib; sourceTree = ""; }; - 49352AC1138C97A2000E464A /* ATAPIRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATAPIRequest.h; sourceTree = ""; }; - 49352AC2138C97A2000E464A /* ATAPIRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATAPIRequest.m; sourceTree = ""; }; - 49352ADC138CA1DC000E464A /* ATURLConnection_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATURLConnection_Private.h; sourceTree = ""; }; - 49352B3E138DB3AA000E464A /* ATTaskProgressCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ATTaskProgressCell.xib; sourceTree = ""; }; - 4936AE451379DE3100A4B17F /* ATCenteringImageScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATCenteringImageScrollView.h; sourceTree = ""; }; - 4936AE461379DE3100A4B17F /* ATCenteringImageScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATCenteringImageScrollView.m; sourceTree = ""; }; - 4936AE471379DE3100A4B17F /* ATDefaultTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATDefaultTextView.h; sourceTree = ""; }; - 4936AE481379DE3100A4B17F /* ATDefaultTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATDefaultTextView.m; sourceTree = ""; }; - 4936AE491379DE3100A4B17F /* ATHUDView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATHUDView.h; sourceTree = ""; }; - 4936AE4A1379DE3100A4B17F /* ATHUDView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATHUDView.m; sourceTree = ""; }; - 4936AE4F1379DE3100A4B17F /* ATSimpleImageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ATSimpleImageViewController.h; path = "../Custom Views/ATSimpleImageViewController.h"; sourceTree = ""; }; - 4936AE501379DE3100A4B17F /* ATSimpleImageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ATSimpleImageViewController.m; path = "../Custom Views/ATSimpleImageViewController.m"; sourceTree = ""; }; - 4936AE751379DEBB00A4B17F /* ATUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATUtilities.h; sourceTree = ""; }; - 4936AE761379DEBB00A4B17F /* ATUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATUtilities.m; sourceTree = ""; }; - 4936AE7B1379DECE00A4B17F /* ATBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATBackend.h; sourceTree = ""; }; - 4936AE7C1379DECE00A4B17F /* ATBackend.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATBackend.m; sourceTree = ""; }; - 4936AE7D1379DECE00A4B17F /* ATContactStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATContactStorage.h; sourceTree = ""; }; - 4936AE7E1379DECE00A4B17F /* ATContactStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATContactStorage.m; sourceTree = ""; }; - 4936AE811379DECE00A4B17F /* ATFeedback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATFeedback.h; sourceTree = ""; }; - 4936AE821379DECE00A4B17F /* ATFeedback.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATFeedback.m; sourceTree = ""; }; - 493AEB1615990A4D00DFD4C7 /* ATSurveys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ATSurveys.h; path = Surveys/ATSurveys.h; sourceTree = ""; }; - 493AEB1715990A4D00DFD4C7 /* ATSurveys.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATSurveys.m; sourceTree = ""; }; - 493AEB1915990A4D00DFD4C7 /* ATSurvey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATSurvey.h; sourceTree = ""; }; - 493AEB1A15990A4D00DFD4C7 /* ATSurvey.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATSurvey.m; sourceTree = ""; }; - 493AEB1B15990A4D00DFD4C7 /* ATSurveyParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATSurveyParser.h; sourceTree = ""; }; - 493AEB1C15990A4D00DFD4C7 /* ATSurveyParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATSurveyParser.m; sourceTree = ""; }; - 493AEB1D15990A4D00DFD4C7 /* ATSurveyQuestion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATSurveyQuestion.h; sourceTree = ""; }; - 493AEB1E15990A4D00DFD4C7 /* ATSurveyQuestion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATSurveyQuestion.m; sourceTree = ""; }; - 493AEB2015990A4D00DFD4C7 /* ATSurveyResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATSurveyResponse.h; sourceTree = ""; }; - 493AEB2115990A4D00DFD4C7 /* ATSurveyResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATSurveyResponse.m; sourceTree = ""; }; - 493AEB2215990A4D00DFD4C7 /* ATSurveysBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATSurveysBackend.h; sourceTree = ""; }; - 493AEB2315990A4D00DFD4C7 /* ATSurveysBackend.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATSurveysBackend.m; sourceTree = ""; }; - 493AEB2515990A4D00DFD4C7 /* ATWebClient+SurveyAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ATWebClient+SurveyAdditions.h"; sourceTree = ""; }; - 493AEB2615990A4D00DFD4C7 /* ATWebClient+SurveyAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ATWebClient+SurveyAdditions.m"; sourceTree = ""; }; - 493AEB2815990A4D00DFD4C7 /* ATSurveyViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATSurveyViewController.h; sourceTree = ""; }; - 493AEB2915990A4D00DFD4C7 /* ATSurveyViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATSurveyViewController.m; sourceTree = ""; }; - 493AEB4315990A6B00DFD4C7 /* ApptentiveSurveysTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApptentiveSurveysTests.h; sourceTree = ""; }; - 493AEB4415990A6B00DFD4C7 /* ApptentiveSurveysTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ApptentiveSurveysTests.m; sourceTree = ""; }; - 493F8D8A1672DEFD000B5151 /* ATStaticLibraryBootstrap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATStaticLibraryBootstrap.h; sourceTree = ""; }; - 493F8D8B1672DEFD000B5151 /* ATStaticLibraryBootstrap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATStaticLibraryBootstrap.m; sourceTree = ""; }; - 493F8D8F1672E07D000B5151 /* ATURLConnection_Private.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATURLConnection_Private.m; sourceTree = ""; }; - 493F8D921672E15F000B5151 /* ATWebClient_Private.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATWebClient_Private.m; sourceTree = ""; }; - 4942CC8F13C7AD2D009BF758 /* ATAppRatingFlow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATAppRatingFlow.h; sourceTree = ""; }; - 4942CC9013C7AD2D009BF758 /* ATAppRatingFlow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATAppRatingFlow.m; sourceTree = ""; }; - 49509A5F135658E200793EEC /* ATReachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ATReachability.h; path = Reachability/ATReachability.h; sourceTree = ""; }; - 49509A60135658E200793EEC /* ATReachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ATReachability.m; path = Reachability/ATReachability.m; sourceTree = ""; }; - 49509A6B1356596F00793EEC /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; - 49509DF913583FB800793EEC /* ATUtilitiesTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATUtilitiesTests.h; sourceTree = ""; }; - 49509DFA13583FB800793EEC /* ATUtilitiesTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATUtilitiesTests.m; sourceTree = ""; }; - 4960E153134A578F00F6311F /* generated */ = {isa = PBXFileReference; lastKnownFileType = folder; name = generated; path = art/generated; sourceTree = SOURCE_ROOT; }; - 4967278116B9D9CB00C679B8 /* ATConnect_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATConnect_Private.h; sourceTree = ""; }; - 4967278316B9FE6400C679B8 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = resources/ApptentiveResources/Info.plist; sourceTree = SOURCE_ROOT; }; - 496DC37F1333D35600743F65 /* libApptentiveConnect.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libApptentiveConnect.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 496DC3821333D35600743F65 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 496DC38C1333D35600743F65 /* ApptentiveConnectTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ApptentiveConnectTests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; - 496F29DE14496702005B7C01 /* ATSimpleImageViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ATSimpleImageViewController.xib; sourceTree = ""; }; - 4987FA7E157ACAB500AF2078 /* ATSurveyMetrics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ATSurveyMetrics.h; path = Metrics/ATSurveyMetrics.h; sourceTree = ""; }; - 4987FA7F157ACAB500AF2078 /* ATSurveyMetrics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ATSurveyMetrics.m; path = Metrics/ATSurveyMetrics.m; sourceTree = ""; }; - 4987FA83157ACB0A00AF2078 /* ATFeedbackMetrics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ATFeedbackMetrics.h; path = Metrics/ATFeedbackMetrics.h; sourceTree = ""; }; - 4987FA84157ACB0A00AF2078 /* ATFeedbackMetrics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ATFeedbackMetrics.m; path = Metrics/ATFeedbackMetrics.m; sourceTree = ""; }; - 4987FA95157AE53500AF2078 /* ApptentiveMetrics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ApptentiveMetrics.h; path = Metrics/ApptentiveMetrics.h; sourceTree = ""; }; - 4987FA96157AE53500AF2078 /* ApptentiveMetrics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ApptentiveMetrics.m; path = Metrics/ApptentiveMetrics.m; sourceTree = ""; }; - 4987FA97157AE53500AF2078 /* ATMetric.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ATMetric.h; path = Metrics/ATMetric.h; sourceTree = ""; }; - 4987FA98157AE53600AF2078 /* ATMetric.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ATMetric.m; path = Metrics/ATMetric.m; sourceTree = ""; }; - 4987FA9A157AE53700AF2078 /* ATWebClient+Metrics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ATWebClient+Metrics.h"; sourceTree = ""; }; - 4987FA9B157AE53700AF2078 /* ATWebClient+Metrics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ATWebClient+Metrics.m"; sourceTree = ""; }; - 4987FAA5157AE59D00AF2078 /* ApptentiveMetricsTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApptentiveMetricsTests.h; sourceTree = ""; }; - 4987FAA6157AE59D00AF2078 /* ApptentiveMetricsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ApptentiveMetricsTests.m; sourceTree = ""; }; - 498B8E3C1519691900CA9A58 /* ATRatingPredicateTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATRatingPredicateTests.h; sourceTree = ""; }; - 498B8E3D1519691900CA9A58 /* ATRatingPredicateTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATRatingPredicateTests.m; sourceTree = ""; }; - 498EFB6915BA414A00A1043B /* ATSurveyGetSurveysTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ATSurveyGetSurveysTask.h; path = Tasks/ATSurveyGetSurveysTask.h; sourceTree = ""; }; - 498EFB6A15BA414A00A1043B /* ATSurveyGetSurveysTask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ATSurveyGetSurveysTask.m; path = Tasks/ATSurveyGetSurveysTask.m; sourceTree = ""; }; - 498EFB6E15BA48B200A1043B /* ATAppConfigurationUpdateTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATAppConfigurationUpdateTask.h; sourceTree = ""; }; - 498EFB6F15BA48B300A1043B /* ATAppConfigurationUpdateTask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATAppConfigurationUpdateTask.m; sourceTree = ""; }; - 4995EDC3175959EC00AF7268 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = ""; }; - 4995EDC417595A0500AF7268 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = ""; }; - 4995EDC517595A0E00AF7268 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/Localizable.strings; sourceTree = ""; }; - 4995EDC617595A1800AF7268 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = ""; }; - 4995EDC717595A2200AF7268 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; - 499B56C615D305880063C23C /* PJSONKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PJSONKit.h; sourceTree = ""; }; - 499B56C715D305880063C23C /* PJSONKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PJSONKit.m; sourceTree = ""; }; - 49AA101D138B44C00082887A /* ATInfoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATInfoViewController.h; sourceTree = ""; }; - 49AA101E138B44C00082887A /* ATInfoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATInfoViewController.m; sourceTree = ""; }; - 49AA1022138B498C0082887A /* ATInfoViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ATInfoViewController.xib; sourceTree = ""; }; - 49AA1024138B49A50082887A /* ATInfoViewController_iPad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ATInfoViewController_iPad.xib; sourceTree = ""; }; - 49AAA17A1633716F00B26851 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; }; - 49B2F450171B8984004E5FE0 /* ATLogViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATLogViewController.h; sourceTree = ""; }; - 49B2F451171B8984004E5FE0 /* ATLogViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATLogViewController.m; sourceTree = ""; }; - 49B2F454171B8990004E5FE0 /* ATFeedbackTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATFeedbackTypes.h; sourceTree = ""; }; - 49B2F456171B89C4004E5FE0 /* ATLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATLog.h; sourceTree = ""; }; - 49B2F457171B89C4004E5FE0 /* ATLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATLogger.h; sourceTree = ""; }; - 49B2F458171B89C4004E5FE0 /* ATLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATLogger.m; sourceTree = ""; }; - 49B3D968133E6D6400B5A5CD /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 49B3D969133E6D6400B5A5CD /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - 49B3D96A133E6D6400B5A5CD /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - 49B3D96E133E6DE700B5A5CD /* CoreTelephony.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreTelephony.framework; path = System/Library/Frameworks/CoreTelephony.framework; sourceTree = SDKROOT; }; - 49B877101464958C00594A5D /* ATWebClient_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATWebClient_Private.h; sourceTree = ""; }; - 49BC2A58144F75E10041E789 /* ATShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ATShadowView.h; path = "source/Custom Views/ATShadowView.h"; sourceTree = SOURCE_ROOT; }; - 49BC2A59144F75E20041E789 /* ATShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ATShadowView.m; path = "source/Custom Views/ATShadowView.m"; sourceTree = SOURCE_ROOT; }; - 49C002871334137E0071F088 /* ApptentiveConnectTests-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "ApptentiveConnectTests-Info.plist"; sourceTree = ""; }; - 49C002881334137E0071F088 /* ApptentiveConnectTests-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ApptentiveConnectTests-Prefix.pch"; sourceTree = ""; }; - 49C002891334137E0071F088 /* ApptentiveConnectTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApptentiveConnectTests.h; sourceTree = ""; }; - 49C0028A1334137E0071F088 /* ApptentiveConnectTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ApptentiveConnectTests.m; sourceTree = ""; }; - 49C0028C1334137E0071F088 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - 49C00296133413BB0071F088 /* ApptentiveConnect-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ApptentiveConnect-Prefix.pch"; sourceTree = ""; }; - 49C00297133413BB0071F088 /* ATConnect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATConnect.h; sourceTree = ""; }; - 49C00298133413BB0071F088 /* ATConnect.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATConnect.m; sourceTree = ""; }; - 49CEFF5B15168B53006D8BA8 /* ATAppConfigurationUpdater.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATAppConfigurationUpdater.h; sourceTree = ""; }; - 49CEFF5C15168B53006D8BA8 /* ATAppConfigurationUpdater.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATAppConfigurationUpdater.m; sourceTree = ""; }; - 49CEFF7F15193EC2006D8BA8 /* ATAppRatingFlow_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATAppRatingFlow_Private.h; sourceTree = ""; }; - 49CEFF8015193EC2006D8BA8 /* ATAppRatingFlow_Private.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATAppRatingFlow_Private.m; sourceTree = ""; }; - 49D1118C13341A7C00603373 /* ApptentiveResources.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ApptentiveResources.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; - 49D1123A13359BA000603373 /* NSData+ATBase64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = "NSData+ATBase64.h"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 49D1123B13359BA000603373 /* NSData+ATBase64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = "NSData+ATBase64.m"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; - 49D1124D13368CC200603373 /* ATTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATTask.h; sourceTree = ""; }; - 49D1124E13368CC200603373 /* ATTask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATTask.m; sourceTree = ""; }; - 49D1125113368CEE00603373 /* ATFeedbackTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATFeedbackTask.h; sourceTree = ""; }; - 49D1125213368CEF00603373 /* ATFeedbackTask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATFeedbackTask.m; sourceTree = ""; }; - 49D112711337CC9E00603373 /* ATTaskQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATTaskQueue.h; sourceTree = ""; }; - 49D112721337CC9F00603373 /* ATTaskQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATTaskQueue.m; sourceTree = ""; }; - 49E891CE134FE2AB00DD098A /* English */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = ""; }; - 49E891CF134FE2AB00DD098A /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = ""; }; - 49EA5AAE14BD08AD004F8A4D /* ATRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATRecord.h; sourceTree = ""; }; - 49EA5AAF14BD08AD004F8A4D /* ATRecord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATRecord.m; sourceTree = ""; }; - 49EA5ABB14BD0F4D004F8A4D /* ATRecordTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATRecordTask.h; sourceTree = ""; }; - 49EA5ABC14BD0F4D004F8A4D /* ATRecordTask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATRecordTask.m; sourceTree = ""; }; - 49EF340D14AA7F2D00077F76 /* ATAppRatingMetrics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATAppRatingMetrics.h; sourceTree = ""; }; - 49EF340E14AA7F2D00077F76 /* ATAppRatingMetrics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATAppRatingMetrics.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 496DC37C1333D35600743F65 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9A5951ED1C1D327D009C17AA /* QuartzCore.framework in Frameworks */, - 49AAA17B1633716F00B26851 /* StoreKit.framework in Frameworks */, - 49B3D96F133E6DE700B5A5CD /* CoreTelephony.framework in Frameworks */, - 49B3D96B133E6D6400B5A5CD /* CoreGraphics.framework in Frameworks */, - 49B3D96D133E6D6400B5A5CD /* UIKit.framework in Frameworks */, - 496DC3831333D35600743F65 /* Foundation.framework in Frameworks */, - 49509A6C1356596F00793EEC /* SystemConfiguration.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 496DC3881333D35600743F65 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 49F3404E16BC8B1A008AA02B /* StoreKit.framework in Frameworks */, - 496DC38F1333D35600743F65 /* Foundation.framework in Frameworks */, - 496DC3941333D35600743F65 /* libApptentiveConnect.a in Frameworks */, - 49509E061358408600793EEC /* CoreGraphics.framework in Frameworks */, - 49509E071358408C00793EEC /* CoreTelephony.framework in Frameworks */, - 49509E081358409800793EEC /* QuartzCore.framework in Frameworks */, - 49509E1B1358409C00793EEC /* SystemConfiguration.framework in Frameworks */, - 49509E1C135840A000793EEC /* UIKit.framework in Frameworks */, - 493F8D1B1672A551000B5151 /* StoreKit.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 49D1118813341A7C00603373 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 491748B11341176E00A7D11E /* URL Loading */ = { - isa = PBXGroup; - children = ( - 491748B21341177000A7D11E /* ATConnectionChannel.h */, - 491748B31341177000A7D11E /* ATConnectionChannel.m */, - 491748B41341177000A7D11E /* ATConnectionManager.h */, - 491748B51341177000A7D11E /* ATConnectionManager.m */, - 49352ADC138CA1DC000E464A /* ATURLConnection_Private.h */, - 493F8D8F1672E07D000B5151 /* ATURLConnection_Private.m */, - 491748B61341177000A7D11E /* ATURLConnection.h */, - 491748B71341177000A7D11E /* ATURLConnection.m */, - 491748B81341177000A7D11E /* ATWebClient.h */, - 491748B91341177000A7D11E /* ATWebClient.m */, - 49B877101464958C00594A5D /* ATWebClient_Private.h */, - 493F8D921672E15F000B5151 /* ATWebClient_Private.m */, - 49352AC1138C97A2000E464A /* ATAPIRequest.h */, - 49352AC2138C97A2000E464A /* ATAPIRequest.m */, - ); - path = "URL Loading"; - sourceTree = ""; - }; - 4936AE681379DE6A00A4B17F /* Controllers */ = { - isa = PBXGroup; - children = ( - 490B8162144275B3009801E9 /* ATFeedbackController.h */, - 490B8163144275B3009801E9 /* ATFeedbackController.m */, - 49AA101D138B44C00082887A /* ATInfoViewController.h */, - 49AA101E138B44C00082887A /* ATInfoViewController.m */, - 4936AE4F1379DE3100A4B17F /* ATSimpleImageViewController.h */, - 4936AE501379DE3100A4B17F /* ATSimpleImageViewController.m */, - 49B2F450171B8984004E5FE0 /* ATLogViewController.h */, - 49B2F451171B8984004E5FE0 /* ATLogViewController.m */, - 49B2F454171B8990004E5FE0 /* ATFeedbackTypes.h */, - ); - path = Controllers; - sourceTree = ""; - }; - 4936AE741379DEBB00A4B17F /* Misc */ = { - isa = PBXGroup; - children = ( - 49B2F456171B89C4004E5FE0 /* ATLog.h */, - 49B2F457171B89C4004E5FE0 /* ATLogger.h */, - 49B2F458171B89C4004E5FE0 /* ATLogger.m */, - 4936AE751379DEBB00A4B17F /* ATUtilities.h */, - 4936AE761379DEBB00A4B17F /* ATUtilities.m */, - 493F8D8A1672DEFD000B5151 /* ATStaticLibraryBootstrap.h */, - 493F8D8B1672DEFD000B5151 /* ATStaticLibraryBootstrap.m */, - ); - path = Misc; - sourceTree = ""; - }; - 4936AE7A1379DECE00A4B17F /* Persistence */ = { - isa = PBXGroup; - children = ( - 4936AE7B1379DECE00A4B17F /* ATBackend.h */, - 4936AE7C1379DECE00A4B17F /* ATBackend.m */, - 4936AE7D1379DECE00A4B17F /* ATContactStorage.h */, - 4936AE7E1379DECE00A4B17F /* ATContactStorage.m */, - 4936AE811379DECE00A4B17F /* ATFeedback.h */, - 4936AE821379DECE00A4B17F /* ATFeedback.m */, - 49EA5AAE14BD08AD004F8A4D /* ATRecord.h */, - 49EA5AAF14BD08AD004F8A4D /* ATRecord.m */, - 49CEFF5B15168B53006D8BA8 /* ATAppConfigurationUpdater.h */, - 49CEFF5C15168B53006D8BA8 /* ATAppConfigurationUpdater.m */, - ); - path = Persistence; - sourceTree = ""; - }; - 493AEB1515990A4D00DFD4C7 /* Surveys */ = { - isa = PBXGroup; - children = ( - 493AEB1715990A4D00DFD4C7 /* ATSurveys.m */, - 493AEB1815990A4D00DFD4C7 /* Model */, - 493AEB1F15990A4D00DFD4C7 /* Persistence */, - 493AEB2415990A4D00DFD4C7 /* URL Loading */, - 493AEB2715990A4D00DFD4C7 /* View Controllers */, - 498EFB6715BA412100A1043B /* Tasks */, - ); - path = Surveys; - sourceTree = ""; - }; - 493AEB1815990A4D00DFD4C7 /* Model */ = { - isa = PBXGroup; - children = ( - 493AEB1915990A4D00DFD4C7 /* ATSurvey.h */, - 493AEB1A15990A4D00DFD4C7 /* ATSurvey.m */, - 493AEB1B15990A4D00DFD4C7 /* ATSurveyParser.h */, - 493AEB1C15990A4D00DFD4C7 /* ATSurveyParser.m */, - 493AEB1D15990A4D00DFD4C7 /* ATSurveyQuestion.h */, - 493AEB1E15990A4D00DFD4C7 /* ATSurveyQuestion.m */, - ); - path = Model; - sourceTree = ""; - }; - 493AEB1F15990A4D00DFD4C7 /* Persistence */ = { - isa = PBXGroup; - children = ( - 493AEB2015990A4D00DFD4C7 /* ATSurveyResponse.h */, - 493AEB2115990A4D00DFD4C7 /* ATSurveyResponse.m */, - 493AEB2215990A4D00DFD4C7 /* ATSurveysBackend.h */, - 493AEB2315990A4D00DFD4C7 /* ATSurveysBackend.m */, - ); - path = Persistence; - sourceTree = ""; - }; - 493AEB2415990A4D00DFD4C7 /* URL Loading */ = { - isa = PBXGroup; - children = ( - 493AEB2515990A4D00DFD4C7 /* ATWebClient+SurveyAdditions.h */, - 493AEB2615990A4D00DFD4C7 /* ATWebClient+SurveyAdditions.m */, - ); - path = "URL Loading"; - sourceTree = ""; - }; - 493AEB2715990A4D00DFD4C7 /* View Controllers */ = { - isa = PBXGroup; - children = ( - 493AEB2815990A4D00DFD4C7 /* ATSurveyViewController.h */, - 493AEB2915990A4D00DFD4C7 /* ATSurveyViewController.m */, - ); - path = "View Controllers"; - sourceTree = ""; - }; - 4942CC8E13C7AD2D009BF758 /* Rating Flow */ = { - isa = PBXGroup; - children = ( - 4942CC8F13C7AD2D009BF758 /* ATAppRatingFlow.h */, - 4942CC9013C7AD2D009BF758 /* ATAppRatingFlow.m */, - 49CEFF7F15193EC2006D8BA8 /* ATAppRatingFlow_Private.h */, - 49CEFF8015193EC2006D8BA8 /* ATAppRatingFlow_Private.m */, - 49EF340D14AA7F2D00077F76 /* ATAppRatingMetrics.h */, - 49EF340E14AA7F2D00077F76 /* ATAppRatingMetrics.m */, - ); - path = "Rating Flow"; - sourceTree = ""; - }; - 49509A5E135658CD00793EEC /* Reachability */ = { - isa = PBXGroup; - children = ( - 49509A5F135658E200793EEC /* ATReachability.h */, - 49509A60135658E200793EEC /* ATReachability.m */, - ); - name = Reachability; - sourceTree = ""; - }; - 4967278516B9FE7000C679B8 /* ApptentiveResources */ = { - isa = PBXGroup; - children = ( - 4967278316B9FE6400C679B8 /* Info.plist */, - ); - name = ApptentiveResources; - path = xibs; - sourceTree = ""; - }; - 496DC3741333D35600743F65 = { - isa = PBXGroup; - children = ( - 49D1123913359BA000603373 /* ext */, - 49C00295133413BB0071F088 /* source */, - 4960E153134A578F00F6311F /* generated */, - 49C00290133413AA0071F088 /* xibs */, - 4967278516B9FE7000C679B8 /* ApptentiveResources */, - 49C002861334137E0071F088 /* tests */, - 496DC3811333D35600743F65 /* Frameworks */, - 496DC3801333D35600743F65 /* Products */, - ); - sourceTree = ""; - usesTabs = 1; - }; - 496DC3801333D35600743F65 /* Products */ = { - isa = PBXGroup; - children = ( - 496DC37F1333D35600743F65 /* libApptentiveConnect.a */, - 496DC38C1333D35600743F65 /* ApptentiveConnectTests.octest */, - 49D1118C13341A7C00603373 /* ApptentiveResources.bundle */, - ); - name = Products; - sourceTree = ""; - }; - 496DC3811333D35600743F65 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 49B3D968133E6D6400B5A5CD /* CoreGraphics.framework */, - 49B3D96E133E6DE700B5A5CD /* CoreTelephony.framework */, - 496DC3821333D35600743F65 /* Foundation.framework */, - 49B3D969133E6D6400B5A5CD /* QuartzCore.framework */, - 49AAA17A1633716F00B26851 /* StoreKit.framework */, - 49509A6B1356596F00793EEC /* SystemConfiguration.framework */, - 49B3D96A133E6D6400B5A5CD /* UIKit.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 4987FA7C157ACA8C00AF2078 /* Metrics */ = { - isa = PBXGroup; - children = ( - 4987FA96157AE53500AF2078 /* ApptentiveMetrics.m */, - 4987FA97157AE53500AF2078 /* ATMetric.h */, - 4987FA98157AE53600AF2078 /* ATMetric.m */, - 4987FA83157ACB0A00AF2078 /* ATFeedbackMetrics.h */, - 4987FA84157ACB0A00AF2078 /* ATFeedbackMetrics.m */, - 4987FA7E157ACAB500AF2078 /* ATSurveyMetrics.h */, - 4987FA7F157ACAB500AF2078 /* ATSurveyMetrics.m */, - 4987FA99157AE53600AF2078 /* URL Loading */, - ); - name = Metrics; - sourceTree = ""; - }; - 4987FA99157AE53600AF2078 /* URL Loading */ = { - isa = PBXGroup; - children = ( - 4987FA9A157AE53700AF2078 /* ATWebClient+Metrics.h */, - 4987FA9B157AE53700AF2078 /* ATWebClient+Metrics.m */, - ); - name = "URL Loading"; - path = "Metrics/URL Loading"; - sourceTree = ""; - }; - 498EFB6715BA412100A1043B /* Tasks */ = { - isa = PBXGroup; - children = ( - 498EFB6915BA414A00A1043B /* ATSurveyGetSurveysTask.h */, - 498EFB6A15BA414A00A1043B /* ATSurveyGetSurveysTask.m */, - ); - name = Tasks; - sourceTree = ""; - }; - 499B56C415D305880063C23C /* PrefixedJSONKit */ = { - isa = PBXGroup; - children = ( - 499B56C615D305880063C23C /* PJSONKit.h */, - 499B56C715D305880063C23C /* PJSONKit.m */, - ); - path = PrefixedJSONKit; - sourceTree = ""; - }; - 49B3D964133D843D00B5A5CD /* Custom Views */ = { - isa = PBXGroup; - children = ( - 490B8156144274EF009801E9 /* ATCustomButton.h */, - 490B8157144274EF009801E9 /* ATCustomButton.m */, - 4936AE451379DE3100A4B17F /* ATCenteringImageScrollView.h */, - 4936AE461379DE3100A4B17F /* ATCenteringImageScrollView.m */, - 4936AE471379DE3100A4B17F /* ATDefaultTextView.h */, - 4936AE481379DE3100A4B17F /* ATDefaultTextView.m */, - 4936AE491379DE3100A4B17F /* ATHUDView.h */, - 4936AE4A1379DE3100A4B17F /* ATHUDView.m */, - 49BC2A58144F75E10041E789 /* ATShadowView.h */, - 49BC2A59144F75E20041E789 /* ATShadowView.m */, - 490B815B1442751F009801E9 /* ATToolbar.h */, - 490B815C1442751F009801E9 /* ATToolbar.m */, - ); - path = "Custom Views"; - sourceTree = ""; - }; - 49C002861334137E0071F088 /* tests */ = { - isa = PBXGroup; - children = ( - 49C002871334137E0071F088 /* ApptentiveConnectTests-Info.plist */, - 49C002881334137E0071F088 /* ApptentiveConnectTests-Prefix.pch */, - 49C002891334137E0071F088 /* ApptentiveConnectTests.h */, - 49C0028A1334137E0071F088 /* ApptentiveConnectTests.m */, - 49C0028B1334137E0071F088 /* InfoPlist.strings */, - 49509DF913583FB800793EEC /* ATUtilitiesTests.h */, - 49509DFA13583FB800793EEC /* ATUtilitiesTests.m */, - 498B8E3C1519691900CA9A58 /* ATRatingPredicateTests.h */, - 498B8E3D1519691900CA9A58 /* ATRatingPredicateTests.m */, - 4987FAA5157AE59D00AF2078 /* ApptentiveMetricsTests.h */, - 4987FAA6157AE59D00AF2078 /* ApptentiveMetricsTests.m */, - 493AEB4315990A6B00DFD4C7 /* ApptentiveSurveysTests.h */, - 493AEB4415990A6B00DFD4C7 /* ApptentiveSurveysTests.m */, - ); - path = tests; - sourceTree = ""; - }; - 49C00290133413AA0071F088 /* xibs */ = { - isa = PBXGroup; - children = ( - 490B81601442759D009801E9 /* ATFeedbackController.xib */, - 49AA1022138B498C0082887A /* ATInfoViewController.xib */, - 49AA1024138B49A50082887A /* ATInfoViewController_iPad.xib */, - 49352A1F138C73B8000E464A /* ATAboutApptentiveView.xib */, - 49352B3E138DB3AA000E464A /* ATTaskProgressCell.xib */, - 496F29DE14496702005B7C01 /* ATSimpleImageViewController.xib */, - ); - path = xibs; - sourceTree = ""; - }; - 49C00295133413BB0071F088 /* source */ = { - isa = PBXGroup; - children = ( - 49C00296133413BB0071F088 /* ApptentiveConnect-Prefix.pch */, - 49C00297133413BB0071F088 /* ATConnect.h */, - 4987FA95157AE53500AF2078 /* ApptentiveMetrics.h */, - 493AEB1615990A4D00DFD4C7 /* ATSurveys.h */, - 49C00298133413BB0071F088 /* ATConnect.m */, - 4967278116B9D9CB00C679B8 /* ATConnect_Private.h */, - 4987FA7C157ACA8C00AF2078 /* Metrics */, - 493AEB1515990A4D00DFD4C7 /* Surveys */, - 4936AE681379DE6A00A4B17F /* Controllers */, - 49B3D964133D843D00B5A5CD /* Custom Views */, - 4936AE741379DEBB00A4B17F /* Misc */, - 4936AE7A1379DECE00A4B17F /* Persistence */, - 49509A5E135658CD00793EEC /* Reachability */, - 49D1124C13368CA800603373 /* Tasks */, - 491748B11341176E00A7D11E /* URL Loading */, - 4942CC8E13C7AD2D009BF758 /* Rating Flow */, - 49E891CC134FE2AA00DD098A /* localization */, - ); - path = source; - sourceTree = ""; - }; - 49D1123913359BA000603373 /* ext */ = { - isa = PBXGroup; - children = ( - 49D1123A13359BA000603373 /* NSData+ATBase64.h */, - 49D1123B13359BA000603373 /* NSData+ATBase64.m */, - 499B56C415D305880063C23C /* PrefixedJSONKit */, - ); - path = ext; - sourceTree = ""; - }; - 49D1124C13368CA800603373 /* Tasks */ = { - isa = PBXGroup; - children = ( - 49D1124D13368CC200603373 /* ATTask.h */, - 49D1124E13368CC200603373 /* ATTask.m */, - 49D1125113368CEE00603373 /* ATFeedbackTask.h */, - 49D1125213368CEF00603373 /* ATFeedbackTask.m */, - 49EA5ABB14BD0F4D004F8A4D /* ATRecordTask.h */, - 49EA5ABC14BD0F4D004F8A4D /* ATRecordTask.m */, - 49D112711337CC9E00603373 /* ATTaskQueue.h */, - 49D112721337CC9F00603373 /* ATTaskQueue.m */, - 498EFB6E15BA48B200A1043B /* ATAppConfigurationUpdateTask.h */, - 498EFB6F15BA48B300A1043B /* ATAppConfigurationUpdateTask.m */, - ); - path = Tasks; - sourceTree = ""; - }; - 49E891CC134FE2AA00DD098A /* localization */ = { - isa = PBXGroup; - children = ( - 49E891CD134FE2AB00DD098A /* Localizable.strings */, - ); - name = localization; - path = resources/localization; - sourceTree = SOURCE_ROOT; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 496DC37D1333D35600743F65 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 49C002A1133413BB0071F088 /* ApptentiveConnect-Prefix.pch in Headers */, - 49D1123C13359BA000603373 /* NSData+ATBase64.h in Headers */, - 49C002A2133413BB0071F088 /* ATConnect.h in Headers */, - 49D1124F13368CC200603373 /* ATTask.h in Headers */, - 49D1125313368CEF00603373 /* ATFeedbackTask.h in Headers */, - 49D112731337CC9F00603373 /* ATTaskQueue.h in Headers */, - 491748BA1341177000A7D11E /* ATConnectionChannel.h in Headers */, - 4942CC9113C7AD2D009BF758 /* ATAppRatingFlow.h in Headers */, - 491748BC1341177000A7D11E /* ATConnectionManager.h in Headers */, - 491748BE1341177000A7D11E /* ATURLConnection.h in Headers */, - 491748C01341177000A7D11E /* ATWebClient.h in Headers */, - 49509A61135658E200793EEC /* ATReachability.h in Headers */, - 4936AE511379DE3100A4B17F /* ATCenteringImageScrollView.h in Headers */, - 4936AE531379DE3100A4B17F /* ATDefaultTextView.h in Headers */, - 4936AE551379DE3100A4B17F /* ATHUDView.h in Headers */, - 4936AE5B1379DE3100A4B17F /* ATSimpleImageViewController.h in Headers */, - 4936AE771379DEBB00A4B17F /* ATUtilities.h in Headers */, - 4936AE831379DECE00A4B17F /* ATBackend.h in Headers */, - 4936AE851379DECE00A4B17F /* ATContactStorage.h in Headers */, - 4936AE891379DECE00A4B17F /* ATFeedback.h in Headers */, - 49AA101F138B44C00082887A /* ATInfoViewController.h in Headers */, - 49352AC4138C97A2000E464A /* ATAPIRequest.h in Headers */, - 49352ADD138CA1DC000E464A /* ATURLConnection_Private.h in Headers */, - 490B8158144274EF009801E9 /* ATCustomButton.h in Headers */, - 490B815D1442751F009801E9 /* ATToolbar.h in Headers */, - 490B8164144275B3009801E9 /* ATFeedbackController.h in Headers */, - 49BC2A5A144F75E20041E789 /* ATShadowView.h in Headers */, - 49B877111464958C00594A5D /* ATWebClient_Private.h in Headers */, - 49EF340F14AA7F2D00077F76 /* ATAppRatingMetrics.h in Headers */, - 49EA5AB014BD08AD004F8A4D /* ATRecord.h in Headers */, - 49EA5ABD14BD0F4D004F8A4D /* ATRecordTask.h in Headers */, - 49CEFF5D15168B54006D8BA8 /* ATAppConfigurationUpdater.h in Headers */, - 49CEFF8115193EC2006D8BA8 /* ATAppRatingFlow_Private.h in Headers */, - 4987FA80157ACAB500AF2078 /* ATSurveyMetrics.h in Headers */, - 4987FA85157ACB0B00AF2078 /* ATFeedbackMetrics.h in Headers */, - 4987FA9C157AE53700AF2078 /* ApptentiveMetrics.h in Headers */, - 4987FA9F157AE53700AF2078 /* ATMetric.h in Headers */, - 4987FAA2157AE53700AF2078 /* ATWebClient+Metrics.h in Headers */, - 493AEB2A15990A4D00DFD4C7 /* ATSurveys.h in Headers */, - 493AEB2D15990A4D00DFD4C7 /* ATSurvey.h in Headers */, - 493AEB3015990A4D00DFD4C7 /* ATSurveyParser.h in Headers */, - 493AEB3315990A4D00DFD4C7 /* ATSurveyQuestion.h in Headers */, - 493AEB3615990A4D00DFD4C7 /* ATSurveyResponse.h in Headers */, - 493AEB3915990A4D00DFD4C7 /* ATSurveysBackend.h in Headers */, - 493AEB3C15990A4D00DFD4C7 /* ATWebClient+SurveyAdditions.h in Headers */, - 493AEB3F15990A4D00DFD4C7 /* ATSurveyViewController.h in Headers */, - 498EFB6B15BA414A00A1043B /* ATSurveyGetSurveysTask.h in Headers */, - 498EFB7015BA48B300A1043B /* ATAppConfigurationUpdateTask.h in Headers */, - 499B56CA15D305880063C23C /* PJSONKit.h in Headers */, - 4967278216B9D9CB00C679B8 /* ATConnect_Private.h in Headers */, - 49B2F452171B8985004E5FE0 /* ATLogViewController.h in Headers */, - 49B2F455171B8990004E5FE0 /* ATFeedbackTypes.h in Headers */, - 49B2F459171B89C4004E5FE0 /* ATLog.h in Headers */, - 49B2F45A171B89C4004E5FE0 /* ATLogger.h in Headers */, - 493F8D8C1672DEFD000B5151 /* ATStaticLibraryBootstrap.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 496DC37E1333D35600743F65 /* ApptentiveConnect */ = { - isa = PBXNativeTarget; - buildConfigurationList = 496DC3A21333D35600743F65 /* Build configuration list for PBXNativeTarget "ApptentiveConnect" */; - buildPhases = ( - 496DC37B1333D35600743F65 /* Sources */, - 496DC37C1333D35600743F65 /* Frameworks */, - 496DC37D1333D35600743F65 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - 4960E1111344265200F6311F /* PBXTargetDependency */, - ); - name = ApptentiveConnect; - productName = ApptentiveConnect; - productReference = 496DC37F1333D35600743F65 /* libApptentiveConnect.a */; - productType = "com.apple.product-type.library.static"; - }; - 496DC38B1333D35600743F65 /* ApptentiveConnectTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 496DC3A51333D35600743F65 /* Build configuration list for PBXNativeTarget "ApptentiveConnectTests" */; - buildPhases = ( - 496DC3871333D35600743F65 /* Sources */, - 496DC3881333D35600743F65 /* Frameworks */, - 496DC3891333D35600743F65 /* Resources */, - 496DC38A1333D35600743F65 /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - 496DC3931333D35600743F65 /* PBXTargetDependency */, - ); - name = ApptentiveConnectTests; - productName = ApptentiveConnectTests; - productReference = 496DC38C1333D35600743F65 /* ApptentiveConnectTests.octest */; - productType = "com.apple.product-type.bundle.ocunit-test"; - }; - 49D1118B13341A7C00603373 /* ApptentiveResources */ = { - isa = PBXNativeTarget; - buildConfigurationList = 49D1119B13341A7C00603373 /* Build configuration list for PBXNativeTarget "ApptentiveResources" */; - buildPhases = ( - 49E891C0134FDBC000DD098A /* Localize (Release Only) */, - 49D1118713341A7C00603373 /* Sources */, - 49D1118813341A7C00603373 /* Frameworks */, - 49D1118913341A7C00603373 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = ApptentiveResources; - productName = ApptentiveResources; - productReference = 49D1118C13341A7C00603373 /* ApptentiveResources.bundle */; - productType = "com.apple.product-type.bundle"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 496DC3761333D35600743F65 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0460; - ORGANIZATIONNAME = "Apptentive, Inc."; - }; - buildConfigurationList = 496DC3791333D35600743F65 /* Build configuration list for PBXProject "ApptentiveConnect" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - English, - Spanish, - es, - de, - ja, - pt, - ru, - "zh-Hans", - ); - mainGroup = 496DC3741333D35600743F65; - productRefGroup = 496DC3801333D35600743F65 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 496DC37E1333D35600743F65 /* ApptentiveConnect */, - 496DC38B1333D35600743F65 /* ApptentiveConnectTests */, - 49D1118B13341A7C00603373 /* ApptentiveResources */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 496DC3891333D35600743F65 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 49C0028F1334137E0071F088 /* InfoPlist.strings in Resources */, - 49AA1023138B498C0082887A /* ATInfoViewController.xib in Resources */, - 49AA1025138B49A50082887A /* ATInfoViewController_iPad.xib in Resources */, - 49352A21138C73B8000E464A /* ATAboutApptentiveView.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 49D1118913341A7C00603373 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 4960E154134A578F00F6311F /* generated in Resources */, - 49E891D0134FE2AB00DD098A /* Localizable.strings in Resources */, - 493529FF138C7253000E464A /* ATInfoViewController.xib in Resources */, - 49352A00138C7257000E464A /* ATInfoViewController_iPad.xib in Resources */, - 49352A20138C73B8000E464A /* ATAboutApptentiveView.xib in Resources */, - 49352B3F138DB3AA000E464A /* ATTaskProgressCell.xib in Resources */, - 490B816C14427A95009801E9 /* ATFeedbackController.xib in Resources */, - 496F29E014496711005B7C01 /* ATSimpleImageViewController.xib in Resources */, - 4967278416B9FE6400C679B8 /* Info.plist in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 496DC38A1333D35600743F65 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; - }; - 49E891C0134FDBC000DD098A /* Localize (Release Only) */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Localize (Release Only)"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "echo \"Configuration is: ${CONFIGURATION}\"\nif [ \"${CONFIGURATION}\" = 'Release' ]; then\n echo \"b\"\n if [ -e \"${PROJECT_DIR}/resources/localization/English.lproj/Localizable.strings\" ]; then\n echo \"c\"\n rm \"${PROJECT_DIR}/resources/localization/English.lproj/Localizable.strings\"\n fi\n find \"${PROJECT_DIR}/source/\" -name *.m -print0 | xargs -0 genstrings -s ATLocalizedString -o \"${PROJECT_DIR}/resources/localization/English.lproj\"\nfi\n"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 496DC37B1333D35600743F65 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 49C002A3133413BB0071F088 /* ATConnect.m in Sources */, - 49D1123D13359BA000603373 /* NSData+ATBase64.m in Sources */, - 49D1125013368CC200603373 /* ATTask.m in Sources */, - 49D1125413368CEF00603373 /* ATFeedbackTask.m in Sources */, - 49D112741337CC9F00603373 /* ATTaskQueue.m in Sources */, - 491748BB1341177000A7D11E /* ATConnectionChannel.m in Sources */, - 491748BD1341177000A7D11E /* ATConnectionManager.m in Sources */, - 491748BF1341177000A7D11E /* ATURLConnection.m in Sources */, - 491748C11341177000A7D11E /* ATWebClient.m in Sources */, - 49509A62135658E200793EEC /* ATReachability.m in Sources */, - 4936AE521379DE3100A4B17F /* ATCenteringImageScrollView.m in Sources */, - 4936AE541379DE3100A4B17F /* ATDefaultTextView.m in Sources */, - 4936AE561379DE3100A4B17F /* ATHUDView.m in Sources */, - 4936AE5C1379DE3100A4B17F /* ATSimpleImageViewController.m in Sources */, - 4936AE781379DEBB00A4B17F /* ATUtilities.m in Sources */, - 4936AE841379DECE00A4B17F /* ATBackend.m in Sources */, - 4936AE861379DECE00A4B17F /* ATContactStorage.m in Sources */, - 4936AE8A1379DECE00A4B17F /* ATFeedback.m in Sources */, - 49AA1020138B44C00082887A /* ATInfoViewController.m in Sources */, - 49352AC5138C97A2000E464A /* ATAPIRequest.m in Sources */, - 4942CC9213C7AD2D009BF758 /* ATAppRatingFlow.m in Sources */, - 490B8159144274EF009801E9 /* ATCustomButton.m in Sources */, - 490B815E1442751F009801E9 /* ATToolbar.m in Sources */, - 490B8165144275B3009801E9 /* ATFeedbackController.m in Sources */, - 49BC2A5B144F75E20041E789 /* ATShadowView.m in Sources */, - 49EF341014AA7F2D00077F76 /* ATAppRatingMetrics.m in Sources */, - 49EA5AB114BD08AD004F8A4D /* ATRecord.m in Sources */, - 49EA5ABE14BD0F4D004F8A4D /* ATRecordTask.m in Sources */, - 49CEFF5E15168B54006D8BA8 /* ATAppConfigurationUpdater.m in Sources */, - 49CEFF8215193EC2006D8BA8 /* ATAppRatingFlow_Private.m in Sources */, - 4987FA81157ACAB500AF2078 /* ATSurveyMetrics.m in Sources */, - 4987FA86157ACB0B00AF2078 /* ATFeedbackMetrics.m in Sources */, - 4987FA9D157AE53700AF2078 /* ApptentiveMetrics.m in Sources */, - 4987FAA0157AE53700AF2078 /* ATMetric.m in Sources */, - 4987FAA3157AE53700AF2078 /* ATWebClient+Metrics.m in Sources */, - 493AEB2B15990A4D00DFD4C7 /* ATSurveys.m in Sources */, - 493AEB2E15990A4D00DFD4C7 /* ATSurvey.m in Sources */, - 493AEB3115990A4D00DFD4C7 /* ATSurveyParser.m in Sources */, - 493AEB3415990A4D00DFD4C7 /* ATSurveyQuestion.m in Sources */, - 493AEB3715990A4D00DFD4C7 /* ATSurveyResponse.m in Sources */, - 493AEB3A15990A4D00DFD4C7 /* ATSurveysBackend.m in Sources */, - 493AEB3D15990A4D00DFD4C7 /* ATWebClient+SurveyAdditions.m in Sources */, - 493AEB4015990A4D00DFD4C7 /* ATSurveyViewController.m in Sources */, - 498EFB6C15BA414A00A1043B /* ATSurveyGetSurveysTask.m in Sources */, - 498EFB7115BA48B300A1043B /* ATAppConfigurationUpdateTask.m in Sources */, - 499B56CB15D305880063C23C /* PJSONKit.m in Sources */, - 493F8D8D1672DEFD000B5151 /* ATStaticLibraryBootstrap.m in Sources */, - 49B2F453171B8985004E5FE0 /* ATLogViewController.m in Sources */, - 49B2F45B171B89C4004E5FE0 /* ATLogger.m in Sources */, - 493F8D901672E07D000B5151 /* ATURLConnection_Private.m in Sources */, - 493F8D931672E15F000B5151 /* ATWebClient_Private.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 496DC3871333D35600743F65 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 49C0028E1334137E0071F088 /* ApptentiveConnectTests.m in Sources */, - 49509DFB13583FB800793EEC /* ATUtilitiesTests.m in Sources */, - 4936AE5D1379DE3100A4B17F /* ATCenteringImageScrollView.m in Sources */, - 4936AE5E1379DE3100A4B17F /* ATDefaultTextView.m in Sources */, - 4936AE5F1379DE3100A4B17F /* ATHUDView.m in Sources */, - 4936AE621379DE3100A4B17F /* ATSimpleImageViewController.m in Sources */, - 4936AE791379DEBB00A4B17F /* ATUtilities.m in Sources */, - 4936AE8B1379DECE00A4B17F /* ATBackend.m in Sources */, - 4936AE8C1379DECE00A4B17F /* ATContactStorage.m in Sources */, - 4936AE8E1379DECE00A4B17F /* ATFeedback.m in Sources */, - 49AA1021138B44C00082887A /* ATInfoViewController.m in Sources */, - 49352AC3138C97A2000E464A /* ATAPIRequest.m in Sources */, - 4942CC9313C7AD2D009BF758 /* ATAppRatingFlow.m in Sources */, - 490B815A144274EF009801E9 /* ATCustomButton.m in Sources */, - 490B815F1442751F009801E9 /* ATToolbar.m in Sources */, - 490B8166144275B3009801E9 /* ATFeedbackController.m in Sources */, - 49EF341114AA7F2D00077F76 /* ATAppRatingMetrics.m in Sources */, - 49EA5AB214BD08AD004F8A4D /* ATRecord.m in Sources */, - 49EA5ABF14BD0F4D004F8A4D /* ATRecordTask.m in Sources */, - 49CEFF5F15168B54006D8BA8 /* ATAppConfigurationUpdater.m in Sources */, - 498B8E3E1519691900CA9A58 /* ATRatingPredicateTests.m in Sources */, - 4987FA82157ACAB500AF2078 /* ATSurveyMetrics.m in Sources */, - 4987FA87157ACB0B00AF2078 /* ATFeedbackMetrics.m in Sources */, - 4987FA9E157AE53700AF2078 /* ApptentiveMetrics.m in Sources */, - 4987FAA1157AE53700AF2078 /* ATMetric.m in Sources */, - 4987FAA4157AE53700AF2078 /* ATWebClient+Metrics.m in Sources */, - 4987FAA7157AE59D00AF2078 /* ApptentiveMetricsTests.m in Sources */, - 493AEB2C15990A4D00DFD4C7 /* ATSurveys.m in Sources */, - 493AEB2F15990A4D00DFD4C7 /* ATSurvey.m in Sources */, - 493AEB3215990A4D00DFD4C7 /* ATSurveyParser.m in Sources */, - 493AEB3515990A4D00DFD4C7 /* ATSurveyQuestion.m in Sources */, - 493AEB3815990A4D00DFD4C7 /* ATSurveyResponse.m in Sources */, - 493AEB3B15990A4D00DFD4C7 /* ATSurveysBackend.m in Sources */, - 493AEB3E15990A4D00DFD4C7 /* ATWebClient+SurveyAdditions.m in Sources */, - 493AEB4115990A4D00DFD4C7 /* ATSurveyViewController.m in Sources */, - 493AEB4515990A6B00DFD4C7 /* ApptentiveSurveysTests.m in Sources */, - 498EFB6D15BA414A00A1043B /* ATSurveyGetSurveysTask.m in Sources */, - 498EFB7215BA48B300A1043B /* ATAppConfigurationUpdateTask.m in Sources */, - 499B56CC15D305880063C23C /* PJSONKit.m in Sources */, - 493F8D8E1672DEFD000B5151 /* ATStaticLibraryBootstrap.m in Sources */, - 493F8D911672E07D000B5151 /* ATURLConnection_Private.m in Sources */, - 49B2F45C171B89C4004E5FE0 /* ATLogger.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 49D1118713341A7C00603373 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 4960E1111344265200F6311F /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 49D1118B13341A7C00603373 /* ApptentiveResources */; - targetProxy = 4960E1101344265200F6311F /* PBXContainerItemProxy */; - }; - 496DC3931333D35600743F65 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 496DC37E1333D35600743F65 /* ApptentiveConnect */; - targetProxy = 496DC3921333D35600743F65 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 49C0028B1334137E0071F088 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 49C0028C1334137E0071F088 /* en */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; - 49E891CD134FE2AB00DD098A /* Localizable.strings */ = { - isa = PBXVariantGroup; - children = ( - 49E891CE134FE2AB00DD098A /* English */, - 49E891CF134FE2AB00DD098A /* es */, - 4995EDC3175959EC00AF7268 /* de */, - 4995EDC417595A0500AF7268 /* ja */, - 4995EDC517595A0E00AF7268 /* pt */, - 4995EDC617595A1800AF7268 /* ru */, - 4995EDC717595A2200AF7268 /* zh-Hans */, - ); - name = Localizable.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 496DC3A01333D35600743F65 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "JSONKIT_PREFIX=AT", - "APPTENTIVE_DEBUG=1", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_THUMB_SUPPORT = NO; - "GCC_THUMB_SUPPORT[arch=armv6]" = NO; - "GCC_THUMB_SUPPORT[arch=armv7]" = YES; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 496DC3A11333D35600743F65 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_PREPROCESSOR_DEFINITIONS = "JSONKIT_PREFIX=AT"; - GCC_THUMB_SUPPORT = NO; - "GCC_THUMB_SUPPORT[arch=armv6]" = NO; - "GCC_THUMB_SUPPORT[arch=armv7]" = YES; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; - 496DC3A31333D35600743F65 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - DSTROOT = /tmp/ApptentiveConnect.dst; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "source/ApptentiveConnect-Prefix.pch"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "JSONKIT_PREFIX=AT", - "APPTENTIVE_DEBUG=1", - "APPTENTIVE_DEBUG_LOG_VIEWER=1", - "AT_LOGGING_LEVEL_INFO=1", - "AT_LOGGING_LEVEL_DEBUG=1", - "AT_LOGGING_LEVEL_ERROR=1", - ); - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include; - }; - name = Debug; - }; - 496DC3A41333D35600743F65 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - DSTROOT = /tmp/ApptentiveConnect.dst; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "source/ApptentiveConnect-Prefix.pch"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "JSONKIT_PREFIX=AT", - "AT_LOGGING_LEVEL_INFO=1", - "AT_LOGGING_LEVEL_ERROR=1", - ); - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include; - }; - name = Release; - }; - 496DC3A61333D35600743F65 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(DEVELOPER_LIBRARY_DIR)/Frameworks", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "tests/ApptentiveConnectTests-Prefix.pch"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "JSONKIT_PREFIX=AT", - "APPTENTIVE_DEBUG=1", - "AT_LOGGING_LEVEL_INFO=1", - "AT_LOGGING_LEVEL_DEBUG=1", - "AT_LOGGING_LEVEL_ERROR=1", - ); - INFOPLIST_FILE = "tests/ApptentiveConnectTests-Info.plist"; - OTHER_LDFLAGS = ( - "-framework", - SenTestingKit, - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = octest; - }; - name = Debug; - }; - 496DC3A71333D35600743F65 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(DEVELOPER_LIBRARY_DIR)/Frameworks", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "tests/ApptentiveConnectTests-Prefix.pch"; - INFOPLIST_FILE = "tests/ApptentiveConnectTests-Info.plist"; - OTHER_LDFLAGS = ( - "-framework", - SenTestingKit, - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = octest; - }; - name = Release; - }; - 49D1119C13341A7C00603373 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(DEVELOPER_LIBRARY_DIR)/Frameworks", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "ApptentiveResources/ApptentiveResources-Prefix.pch"; - OTHER_LDFLAGS = ""; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = bundle; - }; - name = Debug; - }; - 49D1119D13341A7C00603373 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(DEVELOPER_LIBRARY_DIR)/Frameworks", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "ApptentiveResources/ApptentiveResources-Prefix.pch"; - OTHER_LDFLAGS = ""; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = bundle; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 496DC3791333D35600743F65 /* Build configuration list for PBXProject "ApptentiveConnect" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 496DC3A01333D35600743F65 /* Debug */, - 496DC3A11333D35600743F65 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 496DC3A21333D35600743F65 /* Build configuration list for PBXNativeTarget "ApptentiveConnect" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 496DC3A31333D35600743F65 /* Debug */, - 496DC3A41333D35600743F65 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 496DC3A51333D35600743F65 /* Build configuration list for PBXNativeTarget "ApptentiveConnectTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 496DC3A61333D35600743F65 /* Debug */, - 496DC3A71333D35600743F65 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 49D1119B13341A7C00603373 /* Build configuration list for PBXNativeTarget "ApptentiveResources" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 49D1119C13341A7C00603373 /* Debug */, - 49D1119D13341A7C00603373 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 496DC3761333D35600743F65 /* Project object */; -} diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ApptentiveConnect.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ApptentiveConnect.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100755 index a6edc42..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ApptentiveConnect.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ApptentiveConnect.xcodeproj/xcshareddata/xcschemes/ApptentiveConnect.xcscheme b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ApptentiveConnect.xcodeproj/xcshareddata/xcschemes/ApptentiveConnect.xcscheme deleted file mode 100755 index d265487..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ApptentiveConnect.xcodeproj/xcshareddata/xcschemes/ApptentiveConnect.xcscheme +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ApptentiveConnect.xcodeproj/xcshareddata/xcschemes/ApptentiveResources.xcscheme b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ApptentiveConnect.xcodeproj/xcshareddata/xcschemes/ApptentiveResources.xcscheme deleted file mode 100755 index 4aabb34..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ApptentiveConnect.xcodeproj/xcshareddata/xcschemes/ApptentiveResources.xcscheme +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/Checkmark.opacity b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/Checkmark.opacity deleted file mode 100755 index 42ad6d6..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/Checkmark.opacity and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/button_shadow_overlay.psd b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/button_shadow_overlay.psd deleted file mode 100755 index d95f6f6..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/button_shadow_overlay.psd and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/button_shadow_overlay@2x.psd b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/button_shadow_overlay@2x.psd deleted file mode 100755 index 5758554..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/button_shadow_overlay@2x.psd and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/camera icon button b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/camera icon button deleted file mode 100755 index c50a011..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/camera icon button and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/camera icon.opacity b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/camera icon.opacity deleted file mode 100755 index b23cea0..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/camera icon.opacity and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/camera icon.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/camera icon.png deleted file mode 100755 index a7ecb95..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/camera icon.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/cancel_bg.psd b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/cancel_bg.psd deleted file mode 100755 index 0ca68f7..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/cancel_bg.psd and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_apptentive_icon_small.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_apptentive_icon_small.png deleted file mode 100755 index 8e26e6b..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_apptentive_icon_small.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_apptentive_icon_small@2x.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_apptentive_icon_small@2x.png deleted file mode 100755 index ea56e73..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_apptentive_icon_small@2x.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_button_shadow_overlay.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_button_shadow_overlay.png deleted file mode 100755 index 3b8c12f..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_button_shadow_overlay.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_button_shadow_overlay@2x.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_button_shadow_overlay@2x.png deleted file mode 100755 index a076901..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_button_shadow_overlay@2x.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_cancel_bg.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_cancel_bg.png deleted file mode 100755 index fad1c55..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_cancel_bg.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_cancel_bg@2x.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_cancel_bg@2x.png deleted file mode 100755 index 29b5aef..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_cancel_bg@2x.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_cancel_highlighted_bg.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_cancel_highlighted_bg.png deleted file mode 100755 index 5c112e3..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_cancel_highlighted_bg.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_cancel_highlighted_bg@2x.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_cancel_highlighted_bg@2x.png deleted file mode 100755 index 4428437..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_cancel_highlighted_bg@2x.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_checkmark.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_checkmark.png deleted file mode 100755 index 62d9e5f..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_checkmark.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_checkmark@2x.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_checkmark@2x.png deleted file mode 100755 index a8420df..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_checkmark@2x.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_dialog_paper_bg.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_dialog_paper_bg.png deleted file mode 100755 index cd271ab..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_dialog_paper_bg.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_dialog_paper_bg@2x.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_dialog_paper_bg@2x.png deleted file mode 100755 index 3aff3c4..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_dialog_paper_bg@2x.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_dotted_red_line.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_dotted_red_line.png deleted file mode 100755 index bc6b893..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_dotted_red_line.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_dotted_red_line@2x.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_dotted_red_line@2x.png deleted file mode 100755 index 2f8931e..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_dotted_red_line@2x.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_gray_line.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_gray_line.png deleted file mode 100755 index 083c5a0..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_gray_line.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_gray_line@2x.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_gray_line@2x.png deleted file mode 100755 index 8c27d5d..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_gray_line@2x.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_logo_info.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_logo_info.png deleted file mode 100755 index b8c0ad4..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_logo_info.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_logo_info@2x.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_logo_info@2x.png deleted file mode 100755 index 9a5f55c..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_logo_info@2x.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_paperclip_background.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_paperclip_background.png deleted file mode 100755 index 01ba512..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_paperclip_background.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_paperclip_background@2x.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_paperclip_background@2x.png deleted file mode 100755 index 91dceef..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_paperclip_background@2x.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_paperclip_foreground.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_paperclip_foreground.png deleted file mode 100755 index 9713381..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_paperclip_foreground.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_paperclip_foreground@2x.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_paperclip_foreground@2x.png deleted file mode 100755 index 0ad283a..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_paperclip_foreground@2x.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_photo.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_photo.png deleted file mode 100755 index c1efbb8..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_photo.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_photo@2x.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_photo@2x.png deleted file mode 100755 index 5d28fb7..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_photo@2x.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_send_bg.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_send_bg.png deleted file mode 100755 index 5b39c1b..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_send_bg.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_send_bg@2x.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_send_bg@2x.png deleted file mode 100755 index 23f579b..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_send_bg@2x.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_send_disabled_bg.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_send_disabled_bg.png deleted file mode 100755 index 7ae16c0..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_send_disabled_bg.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_send_disabled_bg@2x.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_send_disabled_bg@2x.png deleted file mode 100755 index a389d00..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_send_disabled_bg@2x.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_send_highlighted_bg.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_send_highlighted_bg.png deleted file mode 100755 index f10ff6b..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_send_highlighted_bg.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_send_highlighted_bg@2x.png b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_send_highlighted_bg@2x.png deleted file mode 100755 index 3a4e0b4..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/generated/at_send_highlighted_bg@2x.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/placard.opacity b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/placard.opacity deleted file mode 100755 index 087c12b..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/placard.opacity and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/popup.opacity b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/popup.opacity deleted file mode 100755 index 8466d68..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/popup.opacity and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/send_bg.psd b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/send_bg.psd deleted file mode 100755 index 66a6745..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/art/send_bg.psd and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ext/NSData+ATBase64.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ext/NSData+ATBase64.h deleted file mode 100755 index a44d42a..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ext/NSData+ATBase64.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// NSData+Base64.h -// base64 -// -// Created by Matt Gallagher on 2009/06/03. -// Copyright 2009 Matt Gallagher. All rights reserved. -// -// Permission is given to use this source code file, free of charge, in any -// project, commercial or otherwise, entirely at your risk, with the condition -// that any redistribution (in part or whole) of source code must retain -// this copyright and permission notice. Attribution in compiled projects is -// appreciated but not required. -// - -#import - -void *ATNewBase64Decode( - const char *inputBuffer, - size_t length, - size_t *outputLength); - -char *ATNewBase64Encode( - const void *inputBuffer, - size_t length, - bool separateLines, - size_t *outputLength); - -@interface NSData (ATBase64) - -+ (NSData *)at_dataFromBase64String:(NSString *)aString; -- (NSString *)at_base64EncodedString; - -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ext/NSData+ATBase64.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ext/NSData+ATBase64.m deleted file mode 100755 index fb54299..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ext/NSData+ATBase64.m +++ /dev/null @@ -1,300 +0,0 @@ -// -// NSData+Base64.m -// base64 -// -// Created by Matt Gallagher on 2009/06/03. -// Copyright 2009 Matt Gallagher. All rights reserved. -// -// Permission is given to use this source code file, free of charge, in any -// project, commercial or otherwise, entirely at your risk, with the condition -// that any redistribution (in part or whole) of source code must retain -// this copyright and permission notice. Attribution in compiled projects is -// appreciated but not required. -// - -#import "NSData+ATBase64.h" - -// -// Mapping from 6 bit pattern to ASCII character. -// -static unsigned char base64EncodeLookup[65] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -// -// Definition for "masked-out" areas of the base64DecodeLookup mapping -// -#define xx 65 - -// -// Mapping from ASCII character to 6 bit pattern. -// -static unsigned char base64DecodeLookup[256] = -{ - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, 62, xx, xx, xx, 63, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, xx, xx, xx, xx, xx, xx, - xx, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, xx, xx, xx, xx, xx, - xx, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, -}; - -// -// Fundamental sizes of the binary and base64 encode/decode units in bytes -// -#define BINARY_UNIT_SIZE 3 -#define BASE64_UNIT_SIZE 4 - -// -// ATNewBase64Decode -// -// Decodes the base64 ASCII string in the inputBuffer to a newly malloced -// output buffer. -// -// inputBuffer - the source ASCII string for the decode -// length - the length of the string or -1 (to specify strlen should be used) -// outputLength - if not-NULL, on output will contain the decoded length -// -// returns the decoded buffer. Must be free'd by caller. Length is given by -// outputLength. -// -void *ATNewBase64Decode( - const char *inputBuffer, - size_t length, - size_t *outputLength) -{ - if (length == -1) - { - length = strlen(inputBuffer); - } - - size_t outputBufferSize = - ((length+BASE64_UNIT_SIZE-1) / BASE64_UNIT_SIZE) * BINARY_UNIT_SIZE; - unsigned char *outputBuffer = (unsigned char *)malloc(outputBufferSize); - - size_t i = 0; - size_t j = 0; - while (i < length) - { - // - // Accumulate 4 valid characters (ignore everything else) - // - unsigned char accumulated[BASE64_UNIT_SIZE]; - memset(&accumulated, 0, sizeof(unsigned char)*BASE64_UNIT_SIZE); - size_t accumulateIndex = 0; - while (i < length) - { - unsigned char decode = base64DecodeLookup[inputBuffer[i++]]; - if (decode != xx) - { - accumulated[accumulateIndex] = decode; - accumulateIndex++; - - if (accumulateIndex == BASE64_UNIT_SIZE) - { - break; - } - } - } - - // - // Store the 6 bits from each of the 4 characters as 3 bytes - // - outputBuffer[j] = (accumulated[0] << 2) | (accumulated[1] >> 4); - outputBuffer[j + 1] = (accumulated[1] << 4) | (accumulated[2] >> 2); - outputBuffer[j + 2] = (accumulated[2] << 6) | accumulated[3]; - j += accumulateIndex - 1; - } - - if (outputLength) - { - *outputLength = j; - } - return outputBuffer; -} - -// -// ATNewBase64Decode -// -// Encodes the arbitrary data in the inputBuffer as base64 into a newly malloced -// output buffer. -// -// inputBuffer - the source data for the encode -// length - the length of the input in bytes -// separateLines - if zero, no CR/LF characters will be added. Otherwise -// a CR/LF pair will be added every 64 encoded chars. -// outputLength - if not-NULL, on output will contain the encoded length -// (not including terminating 0 char) -// -// returns the encoded buffer. Must be free'd by caller. Length is given by -// outputLength. -// -char *ATNewBase64Encode( - const void *buffer, - size_t length, - bool separateLines, - size_t *outputLength) -{ - const unsigned char *inputBuffer = (const unsigned char *)buffer; - - #define MAX_NUM_PADDING_CHARS 2 - #define OUTPUT_LINE_LENGTH 64 - #define INPUT_LINE_LENGTH ((OUTPUT_LINE_LENGTH / BASE64_UNIT_SIZE) * BINARY_UNIT_SIZE) - #define CR_LF_SIZE 2 - - // - // Byte accurate calculation of final buffer size - // - size_t outputBufferSize = - ((length / BINARY_UNIT_SIZE) - + ((length % BINARY_UNIT_SIZE) ? 1 : 0)) - * BASE64_UNIT_SIZE; - if (separateLines) - { - outputBufferSize += - (outputBufferSize / OUTPUT_LINE_LENGTH) * CR_LF_SIZE; - } - - // - // Include space for a terminating zero - // - outputBufferSize += 1; - - // - // Allocate the output buffer - // - char *outputBuffer = (char *)malloc(outputBufferSize); - if (!outputBuffer) - { - return NULL; - } - - size_t i = 0; - size_t j = 0; - const size_t lineLength = separateLines ? INPUT_LINE_LENGTH : length; - size_t lineEnd = lineLength; - - while (true) - { - if (lineEnd > length) - { - lineEnd = length; - } - - for (; i + BINARY_UNIT_SIZE - 1 < lineEnd; i += BINARY_UNIT_SIZE) - { - // - // Inner loop: turn 48 bytes into 64 base64 characters - // - outputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2]; - outputBuffer[j++] = base64EncodeLookup[((inputBuffer[i] & 0x03) << 4) - | ((inputBuffer[i + 1] & 0xF0) >> 4)]; - outputBuffer[j++] = base64EncodeLookup[((inputBuffer[i + 1] & 0x0F) << 2) - | ((inputBuffer[i + 2] & 0xC0) >> 6)]; - outputBuffer[j++] = base64EncodeLookup[inputBuffer[i + 2] & 0x3F]; - } - - if (lineEnd == length) - { - break; - } - - // - // Add the newline - // - outputBuffer[j++] = '\r'; - outputBuffer[j++] = '\n'; - lineEnd += lineLength; - } - - if (i + 1 < length) - { - // - // Handle the single '=' case - // - outputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2]; - outputBuffer[j++] = base64EncodeLookup[((inputBuffer[i] & 0x03) << 4) - | ((inputBuffer[i + 1] & 0xF0) >> 4)]; - outputBuffer[j++] = base64EncodeLookup[(inputBuffer[i + 1] & 0x0F) << 2]; - outputBuffer[j++] = '='; - } - else if (i < length) - { - // - // Handle the double '=' case - // - outputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2]; - outputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0x03) << 4]; - outputBuffer[j++] = '='; - outputBuffer[j++] = '='; - } - outputBuffer[j] = 0; - - // - // Set the output length and return the buffer - // - if (outputLength) - { - *outputLength = j; - } - return outputBuffer; -} - -@implementation NSData (ATBase64) - -// -// dataFromBase64String: -// -// Creates an NSData object containing the base64 decoded representation of -// the base64 string 'aString' -// -// Parameters: -// aString - the base64 string to decode -// -// returns the autoreleased NSData representation of the base64 string -// -+ (NSData *)at_dataFromBase64String:(NSString *)aString -{ - NSData *data = [aString dataUsingEncoding:NSASCIIStringEncoding]; - size_t outputLength; - void *outputBuffer = ATNewBase64Decode([data bytes], [data length], &outputLength); - NSData *result = [NSData dataWithBytes:outputBuffer length:outputLength]; - free(outputBuffer); - return result; -} - -// -// base64EncodedString -// -// Creates an NSString object that contains the base 64 encoding of the -// receiver's data. Lines are broken at 64 characters long. -// -// returns an autoreleased NSString being the base 64 representation of the -// receiver. -// -- (NSString *)at_base64EncodedString -{ - size_t outputLength = 0; - char *outputBuffer = - ATNewBase64Encode([self bytes], [self length], true, &outputLength); - - NSString *result = - [[[NSString alloc] - initWithBytes:outputBuffer - length:outputLength - encoding:NSASCIIStringEncoding] - autorelease]; - free(outputBuffer); - return result; -} - -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ext/PrefixedJSONKit/CHANGELOG.md b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ext/PrefixedJSONKit/CHANGELOG.md deleted file mode 100755 index a23cefd..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ext/PrefixedJSONKit/CHANGELOG.md +++ /dev/null @@ -1,389 +0,0 @@ -# JSONKit Changelog - -## Version 1.X ????/??/?? - -**IMPORTANT:** The following changelog notes are a work in progress. They apply to the work done on JSONKit post v1.4. Since JSONKit itself is inbetween versions, these changelog notes are subject to change, may be wrong, and just about everything else you could expect at this point in development. - -### New Features - -* When `JKSerializeOptionPretty` is enabled, JSONKit now sorts the keys. - -* Normally, JSONKit can only serialize NSNull, NSNumber, NSString, NSArray, and NSDictioonary like objects. It is now possible to serialize an object of any class via either a delegate or a `^` block. - - The delegate or `^` block must return an object that can be serialized by JSONKit, however, otherwise JSONKit will fail to serialize the object. In other words, JSONKit tries to serialize an unsupported class of the object just once, and if the delegate or ^block returns another unsupported class, the second attempt to serialize will fail. In practice, this is not a problem at all, but it does prevent endless recursive attempts to serialize an unsupported class. - - This makes it trivial to serialize objects like NSDate or NSData. A NSDate object can be formatted using a NSDateFormatter to return a ISO-8601 `YYYY-MM-DDTHH:MM:SS.sssZ` type object, for example. Or a NSData object could be Base64 encoded. - - This greatly simplifies things when you have a complex, nested objects with objects that do not belong to the classes that JSONKit can serialize. - - It should be noted that the same caching that JSONKit does for the supported class types also applies to the objects of an unsupported class- if the same object is serialized more than once and the object is still in the serialization cache, JSONKit will copy the previous serialization result instead of invoking the delegate or `^` block again. Therefore, you should not expect or depend on your delegate or block being called each time the same object needs to be serialized AND the delegate or block MUST return a "formatted object" that is STRICTLY invariant (that is to say the same object must always return the exact same formatted output). - - To serialize NSArray or NSDictionary objects using a delegate– - - **NOTE:** The delegate is based a single argument, the object with the unsupported class, and the supplied `selector` method must be one that accepts a single `id` type argument (i.e., `formatObject:`). - **IMPORTANT:** The `^` block MUST return an object with a class that can be serialized by JSONKit, otherwise the serialization will fail. - -
-    ​- (NSData \*)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError \*\*)error;
-    ​- (NSString \*)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError \*\*)error;
-    
- - To serialize NSArray or NSDictionary objects using a `^` block– - - **NOTE:** The block is passed a single argument, the object with the unsupported class. - **IMPORTANT:** The `^` block MUST return an object with a class that can be serialized by JSONKit, otherwise the serialization will fail. - -
-    ​- (NSData \*)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError \*\*)error;
-    ​- (NSString \*)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError \*\*)error;
-    
- - Example using the delegate way: - -
-    @interface MYFormatter : NSObject {
-      NSDateFormatter \*outputFormatter;
-    }
-    @end
-    ​
-    @implementation MYFormatter
-    -(id)init
-    {
-      if((self = [super init]) == NULL) { return(NULL); }
-      if((outputFormatter = [[NSDateFormatter alloc] init]) == NULL) { [self autorelease]; return(NULL); }
-      [outputFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZZZ"];
-      return(self);
-    }
-    ​
-    -(void)dealloc
-    {
-      if(outputFormatter != NULL) { [outputFormatter release]; outputFormatter = NULL; }
-      [super dealloc];
-    }
-    ​
-    -(id)formatObject:(id)object
-    {
-      if([object isKindOfClass:[NSDate class]]) { return([outputFormatter stringFromDate:object]); }
-      return(NULL);
-    }
-    @end
-    ​
-    {
-      MYFormatter \*myFormatter = [[[MYFormatter alloc] init] autorelease];
-      NSArray \*array = [NSArray arrayWithObject:[NSDate dateWithTimeIntervalSinceNow:0.0]];
-
-      NSString \*jsonString = NULL;
-      jsonString = [array                    JSONStringWithOptions:JKSerializeOptionNone
-                          serializeUnsupportedClassesUsingDelegate:myFormatter
-                                                          selector:@selector(formatObject:)
-                                                             error:NULL];
-      NSLog(@"jsonString: '%@'", jsonString);
-      // 2011-03-25 11:42:16.175 formatter_example[59120:903] jsonString: '["2011-03-25T11:42:16.175-0400"]'
-    }
-    
- - Example using the `^` block way: - -
-    {
-      NSDateFormatter \*outputFormatter = [[[NSDateFormatter alloc] init] autorelease];
-      [outputFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZZZ"];
-      ​
-      jsonString = [array                 JSONStringWithOptions:encodeOptions
-                          serializeUnsupportedClassesUsingBlock:^id(id object) {
-                            if([object isKindOfClass:[NSDate class]]) { return([outputFormatter stringFromDate:object]); }
-                            return(NULL);
-                          }
-                                                          error:NULL];
-      NSLog(@"jsonString: '%@'", jsonString);
-      // 2011-03-25 11:49:56.434 json_parse[59167:903] jsonString: '["2011-03-25T11:49:56.434-0400"]'
-    }
-    
- -### Major Changes - -* The way that JSONKit implements the collection classes was modified. Specifically, JSONKit now follows the same strategy that the Cocoa collection classes use, which is to have a single subclass of the mutable collection class. This concrete subclass has an ivar bit that determines whether or not that instance is mutable, and when an immutable instance receives a mutating message, it throws an exception. - -## Version 1.4 2011/23/03 - -### Highlights - -* JSONKit v1.4 significantly improves the performance of serializing and deserializing. Deserializing is 23% faster than Apples binary `.plist`, and an amazing 549% faster than Apples binary `.plist` when serializing. - -### New Features - -* JSONKit can now return mutable collection classes. -* The `JKSerializeOptionFlags` option `JKSerializeOptionPretty` was implemented. -* It is now possible to serialize a single [`NSString`][NSString]. This functionality was requested in issue #4 and issue #11. - -### Deprecated Methods - -* The following `JSONDecoder` methods are deprecated beginning with JSONKit v1.4 and will be removed in a later release– - -
-    ​- (id)parseUTF8String:(const unsigned char \*)string length:(size_t)length;
-    ​- (id)parseUTF8String:(const unsigned char \*)string length:(size_t)length error:(NSError \*\*)error;
-    ​- (id)parseJSONData:(NSData \*)jsonData;
-    ​- (id)parseJSONData:(NSData \*)jsonData error:(NSError \*\*)error;
-    
- - The JSONKit v1.4 objectWith… methods should be used instead. - -### NEW API's - -* The following methods were added to `JSONDecoder`– - - These methods replace their deprecated parse… counterparts and return immutable collection objects. - -
-    ​- (id)objectWithUTF8String:(const unsigned char \*)string length:(NSUInteger)length;
-    ​- (id)objectWithUTF8String:(const unsigned char \*)string length:(NSUInteger)length error:(NSError \*\*)error;
-    ​- (id)objectWithData:(NSData \*)jsonData;
-    ​- (id)objectWithData:(NSData \*)jsonData error:(NSError \*\*)error;
-    
- - These methods are the same as their objectWith… counterparts except they return mutable collection objects. - -
-    ​- (id)mutableObjectWithUTF8String:(const unsigned char \*)string length:(NSUInteger)length;
-    ​- (id)mutableObjectWithUTF8String:(const unsigned char \*)string length:(NSUInteger)length error:(NSError \*\*)error;
-    ​- (id)mutableObjectWithData:(NSData \*)jsonData;
-    ​- (id)mutableObjectWithData:(NSData \*)jsonData error:(NSError \*\*)error;
-    
- -* The following methods were added to `NSString (JSONKitDeserializing)`– - - These methods are the same as their objectFrom… counterparts except they return mutable collection objects. - -
-    ​- (id)mutableObjectFromJSONString;
-    ​- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
-    ​- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError \*\*)error;
-    
- -* The following methods were added to `NSData (JSONKitDeserializing)`– - - These methods are the same as their objectFrom… counterparts except they return mutable collection objects. - -
-    ​- (id)mutableObjectFromJSONData;
-    ​- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
-    ​- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError \*\*)error;
-    
- -* The following methods were added to `NSString (JSONKitSerializing)`– - - These methods are for those uses that need to serialize a single [`NSString`][NSString]– - -
-    ​- (NSData \*)JSONData;
-    ​- (NSData \*)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError \*\*)error;
-    ​- (NSString \*)JSONString;
-    ​- (NSString \*)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError \*\*)error;
-    
- -### Bug Fixes - -* JSONKit has a fast and a slow path for parsing JSON Strings. The slow path is needed whenever special string processing is required, such as the conversion of `\` escape sequences or ill-formed UTF-8. Although the slow path had a check for characters < `0x20`, which are not permitted by the [RFC 4627][], there was a bug such that the condition was never actually checked. As a result, JSONKit would have incorrectly accepted JSON that contained characters < `0x20` if it was using the slow path to process a JSON String. -* The low surrogate in a \uhigh\ulow escape sequence in a JSON String was incorrectly treating `dfff` as ill-formed Unicode. This was due to a comparison that used `>= 0xdfff` instead of `> 0xdfff` as it should have. -* `JKParseOptionLooseUnicode` was not properly honored when parsing some types of ill-formed Unicode in \uHHHH escapes in JSON Strings. - -### Important Notes - -* JSONKit v1.4 now uses custom concrete subclasses of [`NSArray`][NSArray], [`NSMutableArray`][NSMutableArray], [`NSDictionary`][NSDictionary], and [`NSMutableDictionary`][NSMutableDictionary]— `JKArray`, `JKMutableArray`, `JKDictionary`, and `JKMutableDictionary`. respectively. These classes are internal and private to JSONKit, you should not instantiate objects from these classes directly. - - In theory, these custom classes should behave exactly the same as the respective Foundation / Cocoa counterparts. - - As usual, in practice may have non-linear excursions from what theory predicts. It is also virtually impossible to properly test or predict how these custom classes will interact with software in the wild. - - Most likely, if you do encounter a problem, it will happen very quickly, and you should report a bug via the [github.com JSONKit Issue Tracker][bugtracker]. - - In addition to the required class cluster primitive methods, the custom collection classes also include support for [`NSFastEnumeration`][NSFastEnumeration], along with methods that support the bulk retrieval of the objects contents. - - #### Exceptions Thrown - - The JSONKit collection classes will throw the same exceptions for the same conditions as their respective Foundation counterparts. If you find a discrepancy, please report a bug via the [github.com JSONKit Issue Tracker][bugtracker]. - - #### Multithreading Safety - - The same multithreading rules and caveats for the Foundation collection classes apply to the JSONKit collection classes. Specifically, it should be safe to use the immutable collections from multiple threads concurrently. - - The mutable collections can be used from multiple threads as long as you provide some form of mutex barrier that ensures that if a thread needs to mutate the collection, then it has exclusive access to the collection– no other thread can be reading from or writing to the collection until the mutating thread has finished. Failure to ensure that there are no other threads reading or writing from the mutable collection when a thread mutates the collection will result in `undefined` behavior. - - #### Mutable Collection Notes - - The mutable versions of the collection classes are meant to be used when you need to make minor modifications to the collection. Neither `JKMutableArray` or `JKMutableDictionary` have been optimized for nor are they intended to be used in situations where you are adding a large number of objects or new keys– these types of operations will cause both classes to frequently reallocate the memory used to hold the objects in the collection. - - #### `JKMutableArray` Usage Notes - - * You should minimize the number of new objects you added to the array. The array is not designed for high performance insertion and removal of objects. If the array does not have any extra capacity it must reallocate the backing store. When the array is forced to grow the backing store, it currently adds an additional 16 slots worth of spare capacity. The array is instantiated without any extra capacity on the assumption that dictionaries are going to be mutated more than arrays. The array never shrinks the backing store. - - * Replacing objects in the array via [`-replaceObjectAtIndex:withObject:`][-replaceObjectAtIndex:withObject:] is very fast since the array simply releases the current object at the index and replaces it with the new object. - - * Inserting an object in to the array via [`-insertObject:atIndex:`][-insertObject:atIndex:] cause the array to [`memmove()`][memmove] all the objects up one slot from the insertion index. This means this operation is fastest when inserting objects at the last index since no objects need to be moved. - - * Removing an object from the array via [`-removeObjectAtIndex:`][-removeObjectAtIndex:] causes the array to [`memmove()`][memmove] all the objects down one slot from the removal index. This means this operation is fastest when removing objects at the last index since no objects need to be moved. The array will not resize its backing store to a smaller size. - - * [`-copy`][-copy] and [`-mutableCopy`][-mutableCopy] will instantiate a new [`NSArray`][NSArray] or [`NSMutableArray`][NSMutableArray] class object, respectively, with the contents of the receiver. - - #### `JKMutableDictionary` Usage Notes - - * You should minimize the number of new keys you add to the dictionary. If the number of items in the dictionary exceeds a threshold value it will trigger a resizing operation. To do this, the dictionary must allocate a new, larger backing store, and then re-add all the items in the dictionary by rehashing them to the size of the newer, larger store. This is an expensive operation. While this is a limitation of nearly all hash tables, the capacity for the hash table used by `JKMutableDictionary` has been chosen to minimize the amount of memory used since it is anticipated that most dictionaries will not grow significantly once they are instantiated. - - * If the key already exists in the dictionary and you change the object associated with it via [`-setObject:forKey:`][-setObject:forKey:], this will not cause any performance problems or trigger a hash table resize. - - * Removing a key from the dictionary via [`-removeObjectForKey:`][-removeObjectForKey:] will not cause any performance problems. However, the dictionary will not resize its backing store to the smaller size. - - * [`-copy`][-copy] and [`-mutableCopy`][-mutableCopy] will instantiate a new [`NSDictionary`][NSDictionary] or [`NSMutableDictionary`][NSMutableDictionary] class object, respectively, with the contents of the receiver. - -### Major Changes - -* The `JK_ENABLE_CF_TRANSFER_OWNERSHIP_CALLBACKS` pre-processor define flag that was added to JSONKit v1.3 has been removed. - - `JK_ENABLE_CF_TRANSFER_OWNERSHIP_CALLBACKS` was added in JSONKit v1.3 as a temporary work around. While the author was aware of other ways to fix the particular problem caused by the usage of "transfer of ownership callbacks" with Core Foundation classes, the fix provided in JSONKit v1.3 was trivial to implement. This allowed people who needed that functionality to use JSONKit while a proper solution to the problem was worked on. JSONKit v1.4 is the result of that work. - - JSONKit v1.4 no longer uses the Core Foundation collection classes [`CFArray`][CFArray] and [`CFDictionary`][CFDictionary]. Instead, JSONKit v1.4 contains a concrete subclass of [`NSArray`][NSArray] and [`NSDictionary`][NSDictionary]– `JKArray` and `JKDictionary`, respectively. As a result, JSONKit has complete control over the behavior of how items are added and managed within an instantiated collection object. The `JKArray` and `JKDictionary` classes are private to JSONKit, you should not instantiate them direction. Since they are concrete subclasses of their respective collection class cluster, they behave and act exactly the same as [`NSArray`][NSArray] and [`NSDictionary`][NSDictionary]. - - The first benefit is that the "transfer of ownership" object ownership policy can now be safely used. Because the JSONKit collection objects understand that some methods, such as [`-mutableCopy`][-mutableCopy], should not inherit the same "transfer of ownership" object ownership policy, but must follow the standard Cocoa object ownership policy. The "transfer of ownership" object ownership policy reduces the number of [`-retain`][-retain] and [`-release`][-release] calls needed to add an object to a collection, and when creating a large number of objects very quickly (as you would expect when parsing JSON), this can result in a non-trivial amount of time. Eliminating these calls means faster JSON parsing. - - A second benefit is that the author encountered some unexpected behavior when using the [`CFDictionaryCreate`][CFDictionaryCreate] function to create a dictionary and the `keys` argument contained duplicate keys. This required JSONKit to de-duplicate the keys and values before calling [`CFDictionaryCreate`][CFDictionaryCreate]. Unfortunately, JSONKit always had to scan all the keys to make sure there were no duplicates, even though 99.99% of the time there were none. This was less than optimal, particularly because one of the solutions to this particular problem is to use a hash table to perform the de-duplication. Now JSONKit can do the de-duplication while it is instantiating the dictionary collection, solving two problems at once. - - Yet another benefit is that the recently instantiated object cache that JSONKit uses can be used to cache information about the keys used to create dictionary collections, in particular a keys [`-hash`][-hash] value. For a lot of real world JSON, this effectively means that the [`-hash`][-hash] for a key is calculated once, and that value is reused again and again when creating dictionaries. Because all the information required to create the hash table used by `JKDictionary` is already determined at the time the `JKDictionary` object is instantiated, populating the `JKDictionary` is now a very tight loop that only has to call [`-isEqual:`][-isEqual:] on the rare occasions that the JSON being parsed contains duplicate keys. Since the functions that handle this logic are all declared `static` and are internal to JSONKit, the compiler can heavily optimize this code. - - What does this mean in terms of performance? JSONKit was already fast, but now, it's even faster. Below is some benchmark times for [`twitter_public_timeline.json`][twitter_public_timeline.json] in [samsoffes / json-benchmarks](https://github.com/samsoffes/json-benchmarks), where _read_ means to convert the JSON to native Objective-C objects, and _write_ means to convert the native Objective-C to JSON— - -
-    v1.3 read : min:  456.000 us, avg:  460.056 us, char/s:  53341332.36 /  50.870 MB/s
-    v1.3 write: min:  150.000 us, avg:  151.816 us, char/s: 161643041.58 / 154.155 MB/s
- -
-    v1.4 read : min:  285.000 us, avg:  288.603 us, char/s:  85030301.14 /  81.091 MB/s
-    v1.4 write: min:  127.000 us, avg:  129.617 us, char/s: 189327017.29 / 180.556 MB/s
- - JSONKit v1.4 is nearly 60% faster at reading and 17% faster at writing than v1.3. - - The following is the JSON test file taken from the project available at [this blog post](http://psionides.jogger.pl/2010/12/12/cocoa-json-parsing-libraries-part-2/). The keys and information contained in the JSON was anonymized with random characters. Since JSONKit relies on its recently instantiated object cache for a lot of its performance, this JSON happens to be "the worst corner case possible". - -
-    v1.3 read : min: 5222.000 us, avg: 5262.344 us, char/s:  15585260.10 /  14.863 MB/s
-    v1.3 write: min: 1253.000 us, avg: 1259.914 us, char/s:  65095712.88 /  62.080 MB/s
- -
-    v1.4 read : min: 4096.000 us, avg: 4122.240 us, char/s:  19895736.30 /  18.974 MB/s
-    v1.4 write: min: 1319.000 us, avg: 1335.538 us, char/s:  61409709.05 /  58.565 MB/s
- - JSONKit v1.4 is 28% faster at reading and 6% faster at writing that v1.3 in this worst-case torture test. - - While your milage may vary, you will likely see improvements in the 50% for reading and 10% for writing on your real world JSON. The nature of JSONKits cache means performance improvements is statistical in nature and depends on the particular properties of the JSON being parsed. - - For comparison, [json-framework][], a popular Objective-C JSON parsing library, turns in the following benchmark times for [`twitter_public_timeline.json`][twitter_public_timeline.json]— - -
-    ​     read : min: 1670.000 us, avg: 1682.461 us, char/s:  14585776.43 /  13.910 MB/s
-    ​     write: min: 1021.000 us, avg: 1028.970 us, char/s:  23849091.81 /  22.744 MB/s
- - Since the benchmark for JSONKit and [json-framework][] was done on the same computer, it's safe to compare the timing results. The version of [json-framework][] used was the latest v3.0 available via the master branch at the time of this writing on github.com. - - JSONKit v1.4 is 483% faster at reading and 694% faster at writing than [json-framework][]. - -### Other Changes - -* Added a `__clang_analyzer__` pre-processor conditional around some code that the `clang` static analyzer was giving false positives for. However, `clang` versions ≤ 1.5 do not define `__clang_analyzer__` and therefore will continue to emit analyzer warnings. -* The cache now uses a Galois Linear Feedback Shift Register PRNG to select which item in the cache to randomly age. This should age items in the cache more fairly. -* To promote better L1 cache locality, the cache age structure was rearranged slightly along with modifying when an item is randomly chosen to be aged. -* Removed a lot of internal and private data structures from `JSONKit.h` and put them in `JSONKit.m`. -* Modified the way floating point values are serialized. Previously, the [`printf`][printf] format conversion `%.16g` was used. This was changed to `%.17g` which should theoretically allow for up to a full `float`, or [IEEE 754 Single 32-bit floating-point][Single Precision], of precision when converting floating point values to decimal representation. -* The usual sundry of inconsequential tidies and what not, such as updating the `README.md`, etc. -* The catagory additions to the Cocoa classes were changed from `JSONKit` to `JSONKitDeserializing` and `JSONKitSerializing`, as appropriate. - -## Version 1.3 2011/05/02 - -### New Features - -* Added the `JK_ENABLE_CF_TRANSFER_OWNERSHIP_CALLBACKS` pre-processor define flag. - - This is typically enabled by adding `-DJK_ENABLE_CF_TRANSFER_OWNERSHIP_CALLBACKS` to the compilers command line arguments or in `Xcode.app` by adding `JK_ENABLE_CF_TRANSFER_OWNERSHIP_CALLBACKS` to a projects / targets `Pre-Processor Macros` settings. - - The `JK_ENABLE_CF_TRANSFER_OWNERSHIP_CALLBACKS` option enables the use of custom Core Foundation collection call backs which omit the [`CFRetain`][CFRetain] calls. This results in saving several [`CFRetain`][CFRetain] and [`CFRelease`][CFRelease] calls typically needed for every single object from the parsed JSON. While the author has used this technique for years without any issues, an unexpected interaction with the Foundation [`-mutableCopy`][-mutableCopy] method and Core Foundation Toll-Free Bridging resulting in a condition in which the objects contained in the collection to be over released. This problem does not occur with the use of [`-copy`][-copy] due to the fact that the objects created by JSONKit are immutable, and therefore [`-copy`][-copy] does not require creating a completely new object and copying the contents, instead [`-copy`][-copy] simply returns a [`-retain`][-retain]'d version of the immutable object which is significantly faster along with the obvious reduction in memory usage. - - Prior to version 1.3, JSONKit always used custom "Transfer of Ownership Collection Callbacks", and thus `JK_ENABLE_CF_TRANSFER_OWNERSHIP_CALLBACKS` was effectively implicitly defined. - - Beginning with version 1.3, the default behavior of JSONKit is to use the standard Core Foundation collection callbacks ([`kCFTypeArrayCallBacks`][kCFTypeArrayCallBacks], [`kCFTypeDictionaryKeyCallBacks`][kCFTypeDictionaryKeyCallBacks], and [`kCFTypeDictionaryValueCallBacks`][kCFTypeDictionaryValueCallBacks]). The intention is to follow "the principle of least surprise", and the author believes the use of the standard Core Foundation collection callbacks as the default behavior for JSONKit results in the least surprise. - - **NOTE**: `JK_ENABLE_CF_TRANSFER_OWNERSHIP_CALLBACKS` is only applicable to `(CF|NS)` `Dictionary` and `Array` class objects. - - For the vast majority of users, the author believes JSONKits custom "Transfer of Ownership Collection Callbacks" will not cause any problems. As previously stated, the author has used this technique in performance critical code for years and has never had a problem. Until a user reported a problem with [`-mutableCopy`][-mutableCopy], the author was unaware that the use of the custom callbacks could even cause a problem. This is probably due to the fact that the vast majority of time the typical usage pattern tends to be "iterate the contents of the collection" and very rarely mutate the returned collection directly (although this last part is likely to vary significantly from programmer to programmer). The author tends to avoid the use of [`-mutableCopy`][-mutableCopy] as it results in a significant performance and memory consumption penalty. The reason for this is in "typical" Cocoa coding patterns, using [`-mutableCopy`][-mutableCopy] will instantiate an identical, albeit mutable, version of the original object. This requires both memory for the new object and time to iterate the contents of the original object and add them to the new object. Furthermore, under "typical" Cocoa coding patterns, the original collection object continues to consume memory until the autorelease pool is released. However, clearly there are cases where the use of [`-mutableCopy`][-mutableCopy] makes sense or may be used by an external library which is out of your direct control. - - The use of the standard Core Foundation collection callbacks results in a 9% to 23% reduction in parsing performance, with an "eye-balled average" of around 13% according to some benchmarking done by the author using Real World™ JSON (i.e., actual JSON from various web services, such as Twitter, etc) using `gcc-4.2 -arch x86_64 -O3 -DNS_BLOCK_ASSERTIONS` with the only change being the addition of `-DJK_ENABLE_CF_TRANSFER_OWNERSHIP_CALLBACKS`. - - `JK_ENABLE_CF_TRANSFER_OWNERSHIP_CALLBACKS` is only applicable to parsing / deserializing (i.e. converting from) of JSON. Serializing (i.e., converting to JSON) is completely unaffected by this change. - -### Bug Fixes - -* Fixed a [bug report regarding `-mutableCopy`](https://github.com/johnezang/JSONKit/issues#issue/3). This is related to the addition of the pre-processor define flag `JK_ENABLE_CF_TRANSFER_OWNERSHIP_CALLBACKS`. - -### Other Changes - -* Added `JK_EXPECTED` optimization hints around several conditionals. -* When serializing objects, JSONKit first starts with a small, on stack buffer. If the encoded JSON exceeds the size of the stack buffer, JSONKit switches to a heap allocated buffer. If JSONKit switched to a heap allocated buffer, [`CFDataCreateWithBytesNoCopy`][CFDataCreateWithBytesNoCopy] is used to create the [`NSData`][NSData] object, which in most cases causes the heap allocated buffer to "transfer" to the [`NSData`][NSData] object which is substantially faster than allocating a new buffer and copying the bytes. -* Added a pre-processor check in `JSONKit.m` to see if Objective-C Garbage Collection is enabled and issue a `#error` notice that JSONKit does not support Objective-C Garbage Collection. -* Various other minor or trivial modifications, such as updating `README.md`. - -### Other Issues - -* When using the `clang` static analyzer (the version used at the time of this writing was `Apple clang version 1.5 (tags/Apple/clang-60)`), the static analyzer reports a number of problems with `JSONKit.m`. - - The author has investigated these issues and determined that the problems reported by the current version of the static analyzer are "false positives". Not only that, the reported problems are not only "false positives", they are very clearly and obviously wrong. Therefore, the author has made the decision that no action will be taken on these non-problems, which includes not modifying the code for the sole purpose of silencing the static analyzer. The justification for this is "the dog wags the tail, not the other way around." - -## Version 1.2 2011/01/08 - -### Bug Fixes - -* When JSONKit attempted to parse and decode JSON that contained `{"key": value}` dictionaries that contained the same key more than once would likely result in a crash. This was a serious bug. -* Under some conditions, JSONKit could potentially leak memory. -* There was an off by one error in the code that checked whether or not the parser was at the end of the `UTF8` buffer. This could result in JSONKit reading one by past the buffer bounds in some cases. - -### Other Changes - -* Some of the methods were missing `NULL` pointer checks for some of their arguments. This was fixed. In generally, when JSONKit encounters invalid arguments, it throws a `NSInvalidArgumentException` exception. -* Various other minor changes such as tightening up numeric literals with `UL` or `L` qualification, assertion check tweaks and additions, etc. -* The README.md file was updated with additional information. - -### Version 1.1 - -No change log information was kept for versions prior to 1.2. - -[bugtracker]: https://github.com/johnezang/JSONKit/issues -[RFC 4627]: http://tools.ietf.org/html/rfc4627 -[twitter_public_timeline.json]: https://github.com/samsoffes/json-benchmarks/blob/master/Resources/twitter_public_timeline.json -[json-framework]: https://github.com/stig/json-framework -[Single Precision]: http://en.wikipedia.org/wiki/Single_precision -[kCFTypeArrayCallBacks]: http://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFArrayRef/Reference/reference.html#//apple_ref/c/data/kCFTypeArrayCallBacks -[kCFTypeDictionaryKeyCallBacks]: http://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFDictionaryRef/Reference/reference.html#//apple_ref/c/data/kCFTypeDictionaryKeyCallBacks -[kCFTypeDictionaryValueCallBacks]: http://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFDictionaryRef/Reference/reference.html#//apple_ref/c/data/kCFTypeDictionaryValueCallBacks -[CFRetain]: http://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFTypeRef/Reference/reference.html#//apple_ref/c/func/CFRetain -[CFRelease]: http://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFTypeRef/Reference/reference.html#//apple_ref/c/func/CFRelease -[CFDataCreateWithBytesNoCopy]: http://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFDataRef/Reference/reference.html#//apple_ref/c/func/CFDataCreateWithBytesNoCopy -[CFArray]: http://developer.apple.com/library/mac/#documentation/CoreFoundation/Reference/CFArrayRef/Reference/reference.html -[CFDictionary]: http://developer.apple.com/library/mac/#documentation/CoreFoundation/Reference/CFDictionaryRef/Reference/reference.html -[CFDictionaryCreate]: http://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFDictionaryRef/Reference/reference.html#//apple_ref/c/func/CFDictionaryCreate -[-mutableCopy]: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/Reference/Reference.html%23//apple_ref/occ/instm/NSObject/mutableCopy -[-copy]: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/Reference/Reference.html%23//apple_ref/occ/instm/NSObject/copy -[-retain]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Protocols/NSObject_Protocol/Reference/NSObject.html#//apple_ref/occ/intfm/NSObject/retain -[-release]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Protocols/NSObject_Protocol/Reference/NSObject.html#//apple_ref/occ/intfm/NSObject/release -[-isEqual:]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Protocols/NSObject_Protocol/Reference/NSObject.html#//apple_ref/occ/intfm/NSObject/isEqual: -[-hash]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Protocols/NSObject_Protocol/Reference/NSObject.html#//apple_ref/occ/intfm/NSObject/hash -[NSArray]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/index.html -[NSMutableArray]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/index.html -[-insertObject:atIndex:]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/Reference/Reference.html#//apple_ref/occ/instm/NSMutableArray/insertObject:atIndex: -[-removeObjectAtIndex:]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/Reference/Reference.html#//apple_ref/occ/instm/NSMutableArray/removeObjectAtIndex: -[-replaceObjectAtIndex:withObject:]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/Reference/Reference.html#//apple_ref/occ/instm/NSMutableArray/replaceObjectAtIndex:withObject: -[NSDictionary]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/index.html -[NSMutableDictionary]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSMutableDictionary_Class/index.html -[-setObject:forKey:]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSMutableDictionary_Class/Reference/Reference.html#//apple_ref/occ/instm/NSMutableDictionary/setObject:forKey: -[-removeObjectForKey:]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSMutableDictionary_Class/Reference/Reference.html#//apple_ref/occ/instm/NSMutableDictionary/removeObjectForKey: -[NSData]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/index.html -[NSFastEnumeration]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/NSFastEnumeration_protocol/Reference/NSFastEnumeration.html -[NSString]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/index.html -[printf]: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/printf.3.html -[memmove]: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/memmove.3.html diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ext/PrefixedJSONKit/PJSONKit.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ext/PrefixedJSONKit/PJSONKit.h deleted file mode 100755 index a84c122..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ext/PrefixedJSONKit/PJSONKit.h +++ /dev/null @@ -1,260 +0,0 @@ -// -// JSONKit.h -// http://github.com/johnezang/JSONKit -// Dual licensed under either the terms of the BSD License, or alternatively -// under the terms of the Apache License, Version 2.0, as specified below. -// - -/* - Copyright (c) 2011, John Engelhart - - 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. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of the Zang Industries 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "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 THE COPYRIGHT - OWNER OR CONTRIBUTORS 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. -*/ - -/* - Copyright 2011 John Engelhart - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#ifdef __OBJC__ -#import -#import -#import -#import -#import -#import -#endif // __OBJC__ - -#ifdef __cplusplus -extern "C" { -#endif - -// For Mac OS X < 10.5. -#ifndef NSINTEGER_DEFINED -#define NSINTEGER_DEFINED -#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) -typedef long NSInteger; -typedef unsigned long NSUInteger; -#define NSIntegerMin LONG_MIN -#define NSIntegerMax LONG_MAX -#define NSUIntegerMax ULONG_MAX -#else // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) -typedef int NSInteger; -typedef unsigned int NSUInteger; -#define NSIntegerMin INT_MIN -#define NSIntegerMax INT_MAX -#define NSUIntegerMax UINT_MAX -#endif // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) -#endif // NSINTEGER_DEFINED - - -#ifndef _PREFIXEDJSONKIT_H_ -#define _PREFIXEDJSONKIT_H_ - -#ifdef JSONKIT_PREFIX -#define _JSONKIT_CONCAT2(c, d) c ## d -#define _JSONKIT_CONCAT(a, b) _JSONKIT_CONCAT2(a, b) -#define JSONKIT_PREPEND(x) _JSONKIT_CONCAT(JSONKIT_PREFIX, x) -#define _JSONKIT_STRINGIFY2(x) #x -#define JSONKIT_STRINGIFY(x) _JSONKIT_STRINGIFY2(x) -#else -#define JSONKIT_PREPEND(x) x -#endif - -#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__APPLE_CC__) && (__APPLE_CC__ >= 5465) -#define PJK_DEPRECATED_ATTRIBUTE __attribute__((deprecated)) -#else -#define PJK_DEPRECATED_ATTRIBUTE -#endif - -#define PREFIXEDJSONKIT_VERSION_MAJOR 1 -#define PREFIXEDJSONKIT_VERSION_MINOR 4 - -typedef NSUInteger JSONKIT_PREPEND(JKFlags); - -/* - JKParseOptionComments : Allow C style // and /_* ... *_/ (without a _, obviously) comments in JSON. - JKParseOptionUnicodeNewlines : Allow Unicode recommended (?:\r\n|[\n\v\f\r\x85\p{Zl}\p{Zp}]) newlines. - JKParseOptionLooseUnicode : Normally the decoder will stop with an error at any malformed Unicode. - This option allows JSON with malformed Unicode to be parsed without reporting an error. - Any malformed Unicode is replaced with \uFFFD, or "REPLACEMENT CHARACTER". - */ - -enum { - JSONKIT_PREPEND(JKParseOptionNone) = 0, - JSONKIT_PREPEND(JKParseOptionStrict) = 0, - JSONKIT_PREPEND(JKParseOptionComments) = (1 << 0), - JSONKIT_PREPEND(JKParseOptionUnicodeNewlines) = (1 << 1), - JSONKIT_PREPEND(JKParseOptionLooseUnicode) = (1 << 2), - JSONKIT_PREPEND(JKParseOptionPermitTextAfterValidJSON) = (1 << 3), - JSONKIT_PREPEND(JKParseOptionValidFlags) = (JSONKIT_PREPEND(JKParseOptionComments) | JSONKIT_PREPEND(JKParseOptionUnicodeNewlines) | JSONKIT_PREPEND(JKParseOptionLooseUnicode) | JSONKIT_PREPEND(JKParseOptionPermitTextAfterValidJSON)), -}; -typedef JSONKIT_PREPEND(JKFlags) JSONKIT_PREPEND(JKParseOptionFlags); - -enum { - JSONKIT_PREPEND(JKSerializeOptionNone) = 0, - JSONKIT_PREPEND(JKSerializeOptionPretty) = (1 << 0), - JSONKIT_PREPEND(JKSerializeOptionEscapeUnicode) = (1 << 1), - JSONKIT_PREPEND(JKSerializeOptionEscapeForwardSlashes) = (1 << 4), - JSONKIT_PREPEND(JKSerializeOptionValidFlags) = (JSONKIT_PREPEND(JKSerializeOptionPretty) | JSONKIT_PREPEND(JKSerializeOptionEscapeUnicode) | JSONKIT_PREPEND(JKSerializeOptionEscapeForwardSlashes)), -}; -typedef JSONKIT_PREPEND(JKFlags) JSONKIT_PREPEND(JKSerializeOptionFlags); - -#ifdef __OBJC__ - -typedef struct JSONKIT_PREPEND(JKParseState) JSONKIT_PREPEND(JKParseState); // Opaque internal, private type. - -// As a general rule of thumb, if you use a method that doesn't accept a JKParseOptionFlags argument, it defaults to JKParseOptionStrict - -@interface JSONKIT_PREPEND(JSONDecoder) : NSObject { - JSONKIT_PREPEND(JKParseState) *parseState; -} -+ (id)decoder; -+ (id)decoderWithParseOptions:(JSONKIT_PREPEND(JKParseOptionFlags))parseOptionFlags; -- (id)initWithParseOptions:(JSONKIT_PREPEND(JKParseOptionFlags))parseOptionFlags; -- (void)clearCache; - -// The parse... methods were deprecated in v1.4 in favor of the v1.4 objectWith... methods. -- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length PJK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithUTF8String:length: instead. -- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length error:(NSError **)error PJK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithUTF8String:length:error: instead. -// The NSData MUST be UTF8 encoded JSON. -- (id)parseJSONData:(NSData *)jsonData PJK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithData: instead. -- (id)parseJSONData:(NSData *)jsonData error:(NSError **)error PJK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithData:error: instead. - -// Methods that return immutable collection objects. -- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length; -- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error; -// The NSData MUST be UTF8 encoded JSON. -- (id)objectWithData:(NSData *)jsonData; -- (id)objectWithData:(NSData *)jsonData error:(NSError **)error; - -// Methods that return mutable collection objects. -- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length; -- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error; -// The NSData MUST be UTF8 encoded JSON. -- (id)mutableObjectWithData:(NSData *)jsonData; -- (id)mutableObjectWithData:(NSData *)jsonData error:(NSError **)error; - -@end - -//////////// -#pragma mark Deserializing methods -//////////// - -@interface NSString (JSONKIT_PREPEND(JSONKitDeserializing)) -- (id)JSONKIT_PREPEND(objectFromJSONString); -- (id)JSONKIT_PREPEND(objectFromJSONStringWithParseOptions):(JSONKIT_PREPEND(JKParseOptionFlags))parseOptionFlags; -- (id)JSONKIT_PREPEND(objectFromJSONStringWithParseOptions):(JSONKIT_PREPEND(JKParseOptionFlags))parseOptionFlags error:(NSError **)error; -- (id)JSONKIT_PREPEND(mutableObjectFromJSONString); -- (id)JSONKIT_PREPEND(mutableObjectFromJSONStringWithParseOptions):(JSONKIT_PREPEND(JKParseOptionFlags))parseOptionFlags; -- (id)JSONKIT_PREPEND(mutableObjectFromJSONStringWithParseOptions):(JSONKIT_PREPEND(JKParseOptionFlags))parseOptionFlags error:(NSError **)error; -@end - -@interface NSData (JSONKIT_PREPEND(JSONKitDeserializing)) -// The NSData MUST be UTF8 encoded JSON. -- (id)JSONKIT_PREPEND(objectFromJSONData); -- (id)JSONKIT_PREPEND(objectFromJSONDataWithParseOptions):(JSONKIT_PREPEND(JKParseOptionFlags))parseOptionFlags; -- (id)JSONKIT_PREPEND(objectFromJSONDataWithParseOptions):(JSONKIT_PREPEND(JKParseOptionFlags))parseOptionFlags error:(NSError **)error; -- (id)JSONKIT_PREPEND(mutableObjectFromJSONData); -- (id)JSONKIT_PREPEND(mutableObjectFromJSONDataWithParseOptions):(JSONKIT_PREPEND(JKParseOptionFlags))parseOptionFlags; -- (id)JSONKIT_PREPEND(mutableObjectFromJSONDataWithParseOptions):(JSONKIT_PREPEND(JKParseOptionFlags))parseOptionFlags error:(NSError **)error; -@end - -//////////// -#pragma mark Serializing methods -//////////// - -@interface NSString (JSONKIT_PREPEND(JSONKitSerializing)) -// Convenience methods for those that need to serialize the receiving NSString (i.e., instead of having to serialize a NSArray with a single NSString, you can "serialize to JSON" just the NSString). -// Normally, a string that is serialized to JSON has quotation marks surrounding it, which you may or may not want when serializing a single string, and can be controlled with includeQuotes: -// includeQuotes:YES `a "test"...` -> `"a \"test\"..."` -// includeQuotes:NO `a "test"...` -> `a \"test\"...` -- (NSData *)JSONKIT_PREPEND(JSONData); // Invokes JSONDataWithOptions:JKSerializeOptionNone includeQuotes:YES -- (NSData *)JSONKIT_PREPEND(JSONDataWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error; -- (NSString *)JSONKIT_PREPEND(JSONString); // Invokes JSONStringWithOptions:JKSerializeOptionNone includeQuotes:YES -- (NSString *)JSONKIT_PREPEND(JSONStringWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error; -@end - -@interface NSArray (JSONKIT_PREPEND(JSONKitSerializing)) -- (NSData *)JSONKIT_PREPEND(JSONData); -- (NSData *)JSONKIT_PREPEND(JSONDataWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions error:(NSError **)error; -- (NSData *)JSONKIT_PREPEND(JSONDataWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error; -- (NSString *)JSONKIT_PREPEND(JSONString); -- (NSString *)JSONKIT_PREPEND(JSONStringWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions error:(NSError **)error; -- (NSString *)JSONKIT_PREPEND(JSONStringWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error; -@end - -@interface NSDictionary (JSONKIT_PREPEND(JSONKitSerializing)) -- (NSData *)JSONKIT_PREPEND(JSONData); -- (NSData *)JSONKIT_PREPEND(JSONDataWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions error:(NSError **)error; -- (NSData *)JSONKIT_PREPEND(JSONDataWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error; -- (NSString *)JSONKIT_PREPEND(JSONString); -- (NSString *)JSONKIT_PREPEND(JSONStringWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions error:(NSError **)error; -- (NSString *)JSONKIT_PREPEND(JSONStringWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error; -@end - -#ifdef __BLOCKS__ - -@interface NSArray (JSONKIT_PREPEND(JSONKitSerializingBlockAdditions)) -- (NSData *)JSONKIT_PREPEND(JSONDataWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error; -- (NSString *)JSONKIT_PREPEND(JSONStringWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error; -@end - -@interface NSDictionary (JSONKIT_PREPEND(JSONKitSerializingBlockAdditions)) -- (NSData *)JSONKIT_PREPEND(JSONDataWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error; -- (NSString *)JSONKIT_PREPEND(JSONStringWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error; -@end - -#endif - - -#endif // __OBJC__ - -#endif // _PREFIXEDJSONKIT_H_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ext/PrefixedJSONKit/PJSONKit.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ext/PrefixedJSONKit/PJSONKit.m deleted file mode 100755 index 817761a..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ext/PrefixedJSONKit/PJSONKit.m +++ /dev/null @@ -1,3084 +0,0 @@ -// -// JSONKit.m -// http://github.com/johnezang/JSONKit -// Dual licensed under either the terms of the BSD License, or alternatively -// under the terms of the Apache License, Version 2.0, as specified below. -// - -/* - Copyright (c) 2011, John Engelhart - - 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. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of the Zang Industries 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "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 THE COPYRIGHT - OWNER OR CONTRIBUTORS 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. -*/ - -/* - Copyright 2011 John Engelhart - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - - -/* - Acknowledgments: - - The bulk of the UTF8 / UTF32 conversion and verification comes - from ConvertUTF.[hc]. It has been modified from the original sources. - - The original sources were obtained from http://www.unicode.org/. - However, the web site no longer seems to host the files. Instead, - the Unicode FAQ http://www.unicode.org/faq//utf_bom.html#gen4 - points to International Components for Unicode (ICU) - http://site.icu-project.org/ as an example of how to write a UTF - converter. - - The decision to use the ConvertUTF.[ch] code was made to leverage - "proven" code. Hopefully the local modifications are bug free. - - The code in isValidCodePoint() is derived from the ICU code in - utf.h for the macros U_IS_UNICODE_NONCHAR and U_IS_UNICODE_CHAR. - - From the original ConvertUTF.[ch]: - - * Copyright 2001-2004 Unicode, Inc. - * - * Disclaimer - * - * This source code is provided as is by Unicode, Inc. No claims are - * made as to fitness for any particular purpose. No warranties of any - * kind are expressed or implied. The recipient agrees to determine - * applicability of information provided. If this file has been - * purchased on magnetic or optical media from Unicode, Inc., the - * sole remedy for any claim will be exchange of defective media - * within 90 days of receipt. - * - * Limitations on Rights to Redistribute This Code - * - * Unicode, Inc. hereby grants the right to freely use the information - * supplied in this file in the creation of products supporting the - * Unicode Standard, and to make copies of this file in any form - * for internal or external distribution as long as this notice - * remains attached. - -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#import "PJSONKit.h" - -//#include -#include -#include -#include -#include - -//#import -#import -#import -#import -#import -#import -#import -#import - -#ifndef __has_feature -#define __has_feature(x) 0 -#endif - -#ifdef JK_ENABLE_CF_TRANSFER_OWNERSHIP_CALLBACKS -#warning As of JSONKit v1.4, JK_ENABLE_CF_TRANSFER_OWNERSHIP_CALLBACKS is no longer required. It is no longer a valid option. -#endif - -#ifdef __OBJC_GC__ -#error JSONKit does not support Objective-C Garbage Collection -#endif - -#if __has_feature(objc_arc) -#error JSONKit does not support Objective-C Automatic Reference Counting (ARC) -#endif - -// The following checks are really nothing more than sanity checks. -// JSONKit technically has a few problems from a "strictly C99 conforming" standpoint, though they are of the pedantic nitpicking variety. -// In practice, though, for the compilers and architectures we can reasonably expect this code to be compiled for, these pedantic nitpicks aren't really a problem. -// Since we're limited as to what we can do with pre-processor #if checks, these checks are not nearly as through as they should be. - -#if (UINT_MAX != 0xffffffffU) || (INT_MIN != (-0x7fffffff-1)) || (ULLONG_MAX != 0xffffffffffffffffULL) || (LLONG_MIN != (-0x7fffffffffffffffLL-1LL)) -#error JSONKit requires the C 'int' and 'long long' types to be 32 and 64 bits respectively. -#endif - -#if !defined(__LP64__) && ((UINT_MAX != ULONG_MAX) || (INT_MAX != LONG_MAX) || (INT_MIN != LONG_MIN) || (WORD_BIT != LONG_BIT)) -#error JSONKit requires the C 'int' and 'long' types to be the same on 32-bit architectures. -#endif - -// Cocoa / Foundation uses NS*Integer as the type for a lot of arguments. We make sure that NS*Integer is something we are expecting and is reasonably compatible with size_t / ssize_t - -#if (NSUIntegerMax != ULONG_MAX) || (NSIntegerMax != LONG_MAX) || (NSIntegerMin != LONG_MIN) -#error JSONKit requires NSInteger and NSUInteger to be the same size as the C 'long' type. -#endif - -#if (NSUIntegerMax != SIZE_MAX) || (NSIntegerMax != SSIZE_MAX) -#error JSONKit requires NSInteger and NSUInteger to be the same size as the C 'size_t' type. -#endif - - -// For DJB hash. -#define PJK_HASH_INIT (1402737925UL) - -// Use __builtin_clz() instead of trailingBytesForUTF8[] table lookup. -#define PJK_FAST_TRAILING_BYTES - -// JK_CACHE_SLOTS must be a power of 2. Default size is 1024 slots. -#define PJK_CACHE_SLOTS_BITS (10) -#define PJK_CACHE_SLOTS (1UL << PJK_CACHE_SLOTS_BITS) -// JK_CACHE_PROBES is the number of probe attempts. -#define PJK_CACHE_PROBES (4UL) -// JK_INIT_CACHE_AGE must be < (1 << AGE) - 1, where AGE is sizeof(typeof(AGE)) * 8. -#define PJK_INIT_CACHE_AGE (0) - -// JK_TOKENBUFFER_SIZE is the default stack size for the temporary buffer used to hold "non-simple" strings (i.e., contains \ escapes) -#define PJK_TOKENBUFFER_SIZE (1024UL * 2UL) - -// JK_STACK_OBJS is the default number of spaces reserved on the stack for temporarily storing pointers to Obj-C objects before they can be transferred to a NSArray / NSDictionary. -#define PJK_STACK_OBJS (1024UL * 1UL) - -#define PJK_JSONBUFFER_SIZE (1024UL * 4UL) -#define PJK_UTF8BUFFER_SIZE (1024UL * 16UL) - -#define PJK_ENCODE_CACHE_SLOTS (1024UL) - - -#if defined (__GNUC__) && (__GNUC__ >= 4) -#define PJK_ATTRIBUTES(attr, ...) __attribute__((attr, ##__VA_ARGS__)) -#define PJK_EXPECTED(cond, expect) __builtin_expect((long)(cond), (expect)) -#define PJK_EXPECT_T(cond) PJK_EXPECTED(cond, 1U) -#define PJK_EXPECT_F(cond) PJK_EXPECTED(cond, 0U) -#define PJK_PREFETCH(ptr) __builtin_prefetch(ptr) -#else // defined (__GNUC__) && (__GNUC__ >= 4) -#define PJK_ATTRIBUTES(attr, ...) -#define PJK_EXPECTED(cond, expect) (cond) -#define PJK_EXPECT_T(cond) (cond) -#define PJK_EXPECT_F(cond) (cond) -#define PJK_PREFETCH(ptr) -#endif // defined (__GNUC__) && (__GNUC__ >= 4) - -#define PJK_STATIC_INLINE static __inline__ PJK_ATTRIBUTES(always_inline) -#define PJK_ALIGNED(arg) PJK_ATTRIBUTES(aligned(arg)) -#define PJK_UNUSED_ARG PJK_ATTRIBUTES(unused) -#define PJK_WARN_UNUSED PJK_ATTRIBUTES(warn_unused_result) -#define PJK_WARN_UNUSED_CONST PJK_ATTRIBUTES(warn_unused_result, const) -#define PJK_WARN_UNUSED_PURE PJK_ATTRIBUTES(warn_unused_result, pure) -#define PJK_WARN_UNUSED_SENTINEL PJK_ATTRIBUTES(warn_unused_result, sentinel) -#define PJK_NONNULL_ARGS(arg, ...) PJK_ATTRIBUTES(nonnull(arg, ##__VA_ARGS__)) -#define PJK_WARN_UNUSED_NONNULL_ARGS(arg, ...) PJK_ATTRIBUTES(warn_unused_result, nonnull(arg, ##__VA_ARGS__)) -#define PJK_WARN_UNUSED_CONST_NONNULL_ARGS(arg, ...) PJK_ATTRIBUTES(warn_unused_result, const, nonnull(arg, ##__VA_ARGS__)) -#define PJK_WARN_UNUSED_PURE_NONNULL_ARGS(arg, ...) PJK_ATTRIBUTES(warn_unused_result, pure, nonnull(arg, ##__VA_ARGS__)) - -#if defined (__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3) -#define PJK_ALLOC_SIZE_NON_NULL_ARGS_WARN_UNUSED(as, nn, ...) PJK_ATTRIBUTES(warn_unused_result, nonnull(nn, ##__VA_ARGS__), alloc_size(as)) -#else // defined (__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3) -#define PJK_ALLOC_SIZE_NON_NULL_ARGS_WARN_UNUSED(as, nn, ...) PJK_ATTRIBUTES(warn_unused_result, nonnull(nn, ##__VA_ARGS__)) -#endif // defined (__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3) - - -@class JSONKIT_PREPEND(JKArray), JSONKIT_PREPEND(JKDictionaryEnumerator), JSONKIT_PREPEND(JKDictionary); - -enum { - JSONNumberStateStart = 0, - JSONNumberStateFinished = 1, - JSONNumberStateError = 2, - JSONNumberStateWholeNumberStart = 3, - JSONNumberStateWholeNumberMinus = 4, - JSONNumberStateWholeNumberZero = 5, - JSONNumberStateWholeNumber = 6, - JSONNumberStatePeriod = 7, - JSONNumberStateFractionalNumberStart = 8, - JSONNumberStateFractionalNumber = 9, - JSONNumberStateExponentStart = 10, - JSONNumberStateExponentPlusMinus = 11, - JSONNumberStateExponent = 12, -}; - -enum { - JSONStringStateStart = 0, - JSONStringStateParsing = 1, - JSONStringStateFinished = 2, - JSONStringStateError = 3, - JSONStringStateEscape = 4, - JSONStringStateEscapedUnicode1 = 5, - JSONStringStateEscapedUnicode2 = 6, - JSONStringStateEscapedUnicode3 = 7, - JSONStringStateEscapedUnicode4 = 8, - JSONStringStateEscapedUnicodeSurrogate1 = 9, - JSONStringStateEscapedUnicodeSurrogate2 = 10, - JSONStringStateEscapedUnicodeSurrogate3 = 11, - JSONStringStateEscapedUnicodeSurrogate4 = 12, - JSONStringStateEscapedNeedEscapeForSurrogate = 13, - JSONStringStateEscapedNeedEscapedUForSurrogate = 14, -}; - -enum { - JKParseAcceptValue = (1 << 0), - JKParseAcceptComma = (1 << 1), - JKParseAcceptEnd = (1 << 2), - JKParseAcceptValueOrEnd = (JKParseAcceptValue | JKParseAcceptEnd), - JKParseAcceptCommaOrEnd = (JKParseAcceptComma | JKParseAcceptEnd), -}; - -enum { - JKClassUnknown = 0, - JKClassString = 1, - JKClassNumber = 2, - JKClassArray = 3, - JKClassDictionary = 4, - JKClassNull = 5, -}; - -enum { - JKManagedBufferOnStack = 1, - JKManagedBufferOnHeap = 2, - JKManagedBufferLocationMask = (0x3), - JKManagedBufferLocationShift = (0), - - JKManagedBufferMustFree = (1 << 2), -}; -typedef JSONKIT_PREPEND(JKFlags) JKManagedBufferFlags; - -enum { - JKObjectStackOnStack = 1, - JKObjectStackOnHeap = 2, - JKObjectStackLocationMask = (0x3), - JKObjectStackLocationShift = (0), - - JKObjectStackMustFree = (1 << 2), -}; -typedef JSONKIT_PREPEND(JKFlags) JKObjectStackFlags; - -enum { - JKTokenTypeInvalid = 0, - JKTokenTypeNumber = 1, - JKTokenTypeString = 2, - JKTokenTypeObjectBegin = 3, - JKTokenTypeObjectEnd = 4, - JKTokenTypeArrayBegin = 5, - JKTokenTypeArrayEnd = 6, - JKTokenTypeSeparator = 7, - JKTokenTypeComma = 8, - JKTokenTypeTrue = 9, - JKTokenTypeFalse = 10, - JKTokenTypeNull = 11, - JKTokenTypeWhiteSpace = 12, -}; -typedef NSUInteger JKTokenType; - -// These are prime numbers to assist with hash slot probing. -enum { - JKValueTypeNone = 0, - JKValueTypeString = 5, - JKValueTypeLongLong = 7, - JKValueTypeUnsignedLongLong = 11, - JKValueTypeDouble = 13, -}; -typedef NSUInteger JKValueType; - -enum { - JKEncodeOptionAsData = 1, - JKEncodeOptionAsString = 2, - JKEncodeOptionAsTypeMask = 0x7, - JKEncodeOptionCollectionObj = (1 << 3), - JKEncodeOptionStringObj = (1 << 4), - JKEncodeOptionStringObjTrimQuotes = (1 << 5), - -}; -typedef NSUInteger JKEncodeOptionType; - -typedef NSUInteger JKHash; - -typedef struct JKTokenCacheItem JKTokenCacheItem; -typedef struct JKTokenCache JKTokenCache; -typedef struct JKTokenValue JKTokenValue; -typedef struct JKParseToken JKParseToken; -typedef struct JKPtrRange JKPtrRange; -typedef struct JKObjectStack JKObjectStack; -typedef struct JKBuffer JKBuffer; -typedef struct JKConstBuffer JKConstBuffer; -typedef struct JKConstPtrRange JKConstPtrRange; -typedef struct JKRange JKRange; -typedef struct JKManagedBuffer JKManagedBuffer; -typedef struct JKFastClassLookup JKFastClassLookup; -typedef struct JKEncodeCache JKEncodeCache; -typedef struct JKEncodeState JKEncodeState; -typedef struct JKObjCImpCache JKObjCImpCache; -typedef struct JKHashTableEntry JKHashTableEntry; - -typedef id (*NSNumberAllocImp)(id receiver, SEL selector); -typedef id (*NSNumberInitWithUnsignedLongLongImp)(id receiver, SEL selector, unsigned long long value); -typedef id (*JKClassFormatterIMP)(id receiver, SEL selector, id object); -#ifdef __BLOCKS__ -typedef id (^JKClassFormatterBlock)(id formatObject); -#endif - - -struct JKPtrRange { - unsigned char *ptr; - size_t length; -}; - -struct JKConstPtrRange { - const unsigned char *ptr; - size_t length; -}; - -struct JKRange { - size_t location, length; -}; - -struct JKManagedBuffer { - JKPtrRange bytes; - JKManagedBufferFlags flags; - size_t roundSizeUpToMultipleOf; -}; - -struct JKObjectStack { - void **objects, **keys; - CFHashCode *cfHashes; - size_t count, index, roundSizeUpToMultipleOf; - JKObjectStackFlags flags; -}; - -struct JKBuffer { - JKPtrRange bytes; -}; - -struct JKConstBuffer { - JKConstPtrRange bytes; -}; - -struct JKTokenValue { - JKConstPtrRange ptrRange; - JKValueType type; - JKHash hash; - union { - long long longLongValue; - unsigned long long unsignedLongLongValue; - double doubleValue; - } number; - JKTokenCacheItem *cacheItem; -}; - -struct JKParseToken { - JKConstPtrRange tokenPtrRange; - JKTokenType type; - JKTokenValue value; - JKManagedBuffer tokenBuffer; -}; - -struct JKTokenCacheItem { - void *object; - JKHash hash; - CFHashCode cfHash; - size_t size; - unsigned char *bytes; - JKValueType type; -}; - -struct JKTokenCache { - JKTokenCacheItem *items; - size_t count; - unsigned int prng_lfsr; - unsigned char age[PJK_CACHE_SLOTS]; -}; - -struct JKObjCImpCache { - Class NSNumberClass; - NSNumberAllocImp NSNumberAlloc; - NSNumberInitWithUnsignedLongLongImp NSNumberInitWithUnsignedLongLong; -}; - -struct JSONKIT_PREPEND(JKParseState) { - JSONKIT_PREPEND(JKParseOptionFlags) parseOptionFlags; - JKConstBuffer stringBuffer; - size_t atIndex, lineNumber, lineStartIndex; - size_t prev_atIndex, prev_lineNumber, prev_lineStartIndex; - JKParseToken token; - JKObjectStack objectStack; - JKTokenCache cache; - JKObjCImpCache objCImpCache; - NSError *error; - int errorIsPrev; - BOOL mutableCollections; -}; - -struct JKFastClassLookup { - void *stringClass; - void *numberClass; - void *arrayClass; - void *dictionaryClass; - void *nullClass; -}; - -struct JKEncodeCache { - id object; - size_t offset; - size_t length; -}; - -struct JKEncodeState { - JKManagedBuffer utf8ConversionBuffer; - JKManagedBuffer stringBuffer; - size_t atIndex; - JKFastClassLookup fastClassLookup; - JKEncodeCache cache[PJK_ENCODE_CACHE_SLOTS]; - JSONKIT_PREPEND(JKSerializeOptionFlags) serializeOptionFlags; - JKEncodeOptionType encodeOption; - size_t depth; - NSError *error; - id classFormatterDelegate; - SEL classFormatterSelector; - JKClassFormatterIMP classFormatterIMP; -#ifdef __BLOCKS__ - JKClassFormatterBlock classFormatterBlock; -#endif -}; - -// This is a JSONKit private class. -@interface JSONKIT_PREPEND(JKSerializer) : NSObject { - JKEncodeState *encodeState; -} - -#ifdef __BLOCKS__ -#define JKSERIALIZER_BLOCKS_PROTO id(^)(id object) -#else -#define JKSERIALIZER_BLOCKS_PROTO id -#endif - -+ (id)serializeObject:(id)object options:(JSONKIT_PREPEND(JKSerializeOptionFlags))optionFlags encodeOption:(JKEncodeOptionType)encodeOption block:(JKSERIALIZER_BLOCKS_PROTO)block delegate:(id)delegate selector:(SEL)selector error:(NSError **)error; -- (id)serializeObject:(id)object options:(JSONKIT_PREPEND(JKSerializeOptionFlags))optionFlags encodeOption:(JKEncodeOptionType)encodeOption block:(JKSERIALIZER_BLOCKS_PROTO)block delegate:(id)delegate selector:(SEL)selector error:(NSError **)error; -- (void)releaseState; - -@end - -struct JKHashTableEntry { - NSUInteger keyHash; - id key, object; -}; - - -typedef uint32_t UTF32; /* at least 32 bits */ -typedef uint16_t UTF16; /* at least 16 bits */ -typedef uint8_t UTF8; /* typically 8 bits */ - -typedef enum { - conversionOK, /* conversion successful */ - sourceExhausted, /* partial character in source, but hit end */ - targetExhausted, /* insuff. room in target for conversion */ - sourceIllegal /* source sequence is illegal/malformed */ -} ConversionResult; - -#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD -#define UNI_MAX_BMP (UTF32)0x0000FFFF -#define UNI_MAX_UTF16 (UTF32)0x0010FFFF -#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF -#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF -#define UNI_SUR_HIGH_START (UTF32)0xD800 -#define UNI_SUR_HIGH_END (UTF32)0xDBFF -#define UNI_SUR_LOW_START (UTF32)0xDC00 -#define UNI_SUR_LOW_END (UTF32)0xDFFF - - -#if !defined(PJK_FAST_TRAILING_BYTES) -static const char trailingBytesForUTF8[256] = { - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 -}; -#endif - -static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL, 0x03C82080UL, 0xFA082080UL, 0x82082080UL }; -static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; - -#define JK_AT_STRING_PTR(x) (&((x)->stringBuffer.bytes.ptr[(x)->atIndex])) -#define JK_END_STRING_PTR(x) (&((x)->stringBuffer.bytes.ptr[(x)->stringBuffer.bytes.length])) - - -static JSONKIT_PREPEND(JKArray) *_JKArrayCreate(id *objects, NSUInteger count, BOOL mutableCollection); -static void _JKArrayInsertObjectAtIndex(JSONKIT_PREPEND(JKArray) *array, id newObject, NSUInteger objectIndex); -static void _JKArrayReplaceObjectAtIndexWithObject(JSONKIT_PREPEND(JKArray) *array, NSUInteger objectIndex, id newObject); -static void _JKArrayRemoveObjectAtIndex(JSONKIT_PREPEND(JKArray) *array, NSUInteger objectIndex); - - -static NSUInteger _JKDictionaryCapacityForCount(NSUInteger count); -static JSONKIT_PREPEND(JKDictionary) *_JKDictionaryCreate(id *keys, NSUInteger *keyHashes, id *objects, NSUInteger count, BOOL mutableCollection); -static JKHashTableEntry *_JKDictionaryHashEntry(JSONKIT_PREPEND(JKDictionary) *dictionary); -static NSUInteger _JKDictionaryCapacity(JSONKIT_PREPEND(JKDictionary) *dictionary); -static void _JKDictionaryResizeIfNeccessary(JSONKIT_PREPEND(JKDictionary) *dictionary); -static void _JKDictionaryRemoveObjectWithEntry(JSONKIT_PREPEND(JKDictionary) *dictionary, JKHashTableEntry *entry); -static void _JKDictionaryAddObject(JSONKIT_PREPEND(JKDictionary) *dictionary, NSUInteger keyHash, id key, id object); -static JKHashTableEntry *_JKDictionaryHashTableEntryForKey(JSONKIT_PREPEND(JKDictionary) *dictionary, id aKey); - - -static void _JSONDecoderCleanup(JSONKIT_PREPEND(JSONDecoder) *decoder); - -static id _NSStringObjectFromJSONString(NSString *jsonString, JSONKIT_PREPEND(JKParseOptionFlags) parseOptionFlags, NSError **error, BOOL mutableCollection); - - -static void jk_managedBuffer_release(JKManagedBuffer *managedBuffer); -static void jk_managedBuffer_setToStackBuffer(JKManagedBuffer *managedBuffer, unsigned char *ptr, size_t length); -static unsigned char *jk_managedBuffer_resize(JKManagedBuffer *managedBuffer, size_t newSize); -static void jk_objectStack_release(JKObjectStack *objectStack); -static void jk_objectStack_setToStackBuffer(JKObjectStack *objectStack, void **objects, void **keys, CFHashCode *cfHashes, size_t count); -static int jk_objectStack_resize(JKObjectStack *objectStack, size_t newCount); - -static void jk_error(JSONKIT_PREPEND(JKParseState) *parseState, NSString *format, ...); -static int jk_parse_string(JSONKIT_PREPEND(JKParseState) *parseState); -static int jk_parse_number(JSONKIT_PREPEND(JKParseState) *parseState); -static size_t jk_parse_is_newline(JSONKIT_PREPEND(JKParseState) *parseState, const unsigned char *atCharacterPtr); -PJK_STATIC_INLINE int jk_parse_skip_newline(JSONKIT_PREPEND(JKParseState) *parseState); -PJK_STATIC_INLINE void jk_parse_skip_whitespace(JSONKIT_PREPEND(JKParseState) *parseState); -static int jk_parse_next_token(JSONKIT_PREPEND(JKParseState) *parseState); -static void jk_error_parse_accept_or3(JSONKIT_PREPEND(JKParseState) *parseState, int state, NSString *or1String, NSString *or2String, NSString *or3String); -static void *jk_create_dictionary(JSONKIT_PREPEND(JKParseState) *parseState, size_t startingObjectIndex); -static void *jk_parse_dictionary(JSONKIT_PREPEND(JKParseState) *parseState); -static void *jk_parse_array(JSONKIT_PREPEND(JKParseState) *parseState); -static void *jk_object_for_token(JSONKIT_PREPEND(JKParseState) *parseState); -static void *jk_cachedObjects(JSONKIT_PREPEND(JKParseState) *parseState); -PJK_STATIC_INLINE void jk_cache_age(JSONKIT_PREPEND(JKParseState) *parseState); -PJK_STATIC_INLINE void jk_set_parsed_token(JSONKIT_PREPEND(JKParseState) *parseState, const unsigned char *ptr, size_t length, JKTokenType type, size_t advanceBy); - - -static void jk_encode_error(JKEncodeState *encodeState, NSString *format, ...); -static int jk_encode_printf(JKEncodeState *encodeState, JKEncodeCache *cacheSlot, size_t startingAtIndex, id object, const char *format, ...); -static int jk_encode_write(JKEncodeState *encodeState, JKEncodeCache *cacheSlot, size_t startingAtIndex, id object, const char *format); -static int jk_encode_writePrettyPrintWhiteSpace(JKEncodeState *encodeState); -static int jk_encode_write1slow(JKEncodeState *encodeState, ssize_t depthChange, const char *format); -static int jk_encode_write1fast(JKEncodeState *encodeState, ssize_t depthChange PJK_UNUSED_ARG, const char *format); -static int jk_encode_writen(JKEncodeState *encodeState, JKEncodeCache *cacheSlot, size_t startingAtIndex, id object, const char *format, size_t length); -PJK_STATIC_INLINE JKHash jk_encode_object_hash(void *objectPtr); -PJK_STATIC_INLINE void jk_encode_updateCache(JKEncodeState *encodeState, JKEncodeCache *cacheSlot, size_t startingAtIndex, id object); -static int jk_encode_add_atom_to_buffer(JKEncodeState *encodeState, void *objectPtr); - -#define jk_encode_write1(es, dc, f) (PJK_EXPECT_F(_jk_encode_prettyPrint) ? jk_encode_write1slow(es, dc, f) : jk_encode_write1fast(es, dc, f)) - - -PJK_STATIC_INLINE size_t jk_min(size_t a, size_t b); -PJK_STATIC_INLINE size_t jk_max(size_t a, size_t b); -PJK_STATIC_INLINE JKHash jk_calculateHash(JKHash currentHash, unsigned char c); - -// JSONKit v1.4 used both a JKArray : NSArray and JKMutableArray : NSMutableArray, and the same for the dictionary collection type. -// However, Louis Gerbarg (via cocoa-dev) pointed out that Cocoa / Core Foundation actually implements only a single class that inherits from the -// mutable version, and keeps an ivar bit for whether or not that instance is mutable. This means that the immutable versions of the collection -// classes receive the mutating methods, but this is handled by having those methods throw an exception when the ivar bit is set to immutable. -// We adopt the same strategy here. It's both cleaner and gets rid of the method swizzling hackery used in JSONKit v1.4. - - -// This is a workaround for issue #23 https://github.com/johnezang/JSONKit/pull/23 -// Basically, there seem to be a problem with using +load in static libraries on iOS. However, __attribute__ ((constructor)) does work correctly. -// Since we do not require anything "special" that +load provides, and we can accomplish the same thing using __attribute__ ((constructor)), the +load logic was moved here. - -static Class _JKArrayClass = NULL; -static size_t _JKArrayInstanceSize = 0UL; -static Class _JKDictionaryClass = NULL; -static size_t _JKDictionaryInstanceSize = 0UL; - -// For JSONDecoder... -static Class _jk_NSNumberClass = NULL; -static NSNumberAllocImp _jk_NSNumberAllocImp = NULL; -static NSNumberInitWithUnsignedLongLongImp _jk_NSNumberInitWithUnsignedLongLongImp = NULL; - -extern void JSONKIT_PREPEND(jk_collectionClassLoadTimeInitialization)(void) __attribute__ ((constructor)); - -void JSONKIT_PREPEND(jk_collectionClassLoadTimeInitialization)(void) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // Though technically not required, the run time environment at load time initialization may be less than ideal. - - _JKArrayClass = objc_getClass(JSONKIT_STRINGIFY(JSONKIT_PREPEND(JKArray))); - _JKArrayInstanceSize = jk_max(16UL, class_getInstanceSize(_JKArrayClass)); - - _JKDictionaryClass = objc_getClass(JSONKIT_STRINGIFY(JSONKIT_PREPEND(JKDictionary))); - _JKDictionaryInstanceSize = jk_max(16UL, class_getInstanceSize(_JKDictionaryClass)); - - // For JSONDecoder... - _jk_NSNumberClass = [NSNumber class]; - _jk_NSNumberAllocImp = (NSNumberAllocImp)[NSNumber methodForSelector:@selector(alloc)]; - - // Hacktacular. Need to do it this way due to the nature of class clusters. - id temp_NSNumber = [NSNumber alloc]; - _jk_NSNumberInitWithUnsignedLongLongImp = (NSNumberInitWithUnsignedLongLongImp)[temp_NSNumber methodForSelector:@selector(initWithUnsignedLongLong:)]; - [[temp_NSNumber init] release]; - temp_NSNumber = NULL; - - [pool release]; pool = NULL; -} - - -#pragma mark - -@interface JSONKIT_PREPEND(JKArray) : NSMutableArray { - id *objects; - NSUInteger count, capacity, mutations; -} -- (id)initWithCount:(NSUInteger)aCount; -@end - -@implementation JSONKIT_PREPEND(JKArray) - -+ (id)allocWithZone:(NSZone *)zone -{ -#pragma unused(zone) - [NSException raise:NSInvalidArgumentException format:@"*** - [%@ %@]: The %@ class is private to JSONKit and should not be used in this fashion.", NSStringFromClass([self class]), NSStringFromSelector(_cmd), NSStringFromClass([self class])]; - return(NULL); -} - -- (id)initWithCount:(NSUInteger)aCount { - if ((self = [self init])) { - count = aCount; - capacity = aCount; - } - return self; -} - -static JSONKIT_PREPEND(JKArray) *_JKArrayCreate(id *objects, NSUInteger count, BOOL mutableCollection) { - NSCParameterAssert((objects != NULL) && (_JKArrayClass != NULL) && (_JKArrayInstanceSize > 0UL)); - JSONKIT_PREPEND(JKArray) *array = NULL; - if(PJK_EXPECT_T((array = (JSONKIT_PREPEND(JKArray) *)calloc(1UL, _JKArrayInstanceSize)) != NULL)) { // Directly allocate the JKArray instance via calloc. - object_setClass(array, _JKArrayClass); - array = [array initWithCount:count]; - if (array == NULL) { - return NULL; - } - if(PJK_EXPECT_F((array->objects = (id *)malloc(sizeof(id) * array->capacity)) == NULL)) { [array autorelease]; return(NULL); } - memcpy(array->objects, objects, array->capacity * sizeof(id)); - array->mutations = (mutableCollection == NO) ? 0UL : 1UL; - } - return(array); -} - -// Note: The caller is responsible for -retaining the object that is to be added. -static void _JKArrayInsertObjectAtIndex(JSONKIT_PREPEND(JKArray) *array, id newObject, NSUInteger objectIndex) { - NSCParameterAssert((array != NULL) && (array->objects != NULL) && (array->count <= array->capacity) && (objectIndex <= array->count) && (newObject != NULL)); - if(!((array != NULL) && (array->objects != NULL) && (objectIndex <= array->count) && (newObject != NULL))) { [newObject autorelease]; return; } - if((array->count + 1UL) >= array->capacity) { - id *newObjects = NULL; - if((newObjects = (id *)realloc(array->objects, sizeof(id) * (array->capacity + 16UL))) == NULL) { [NSException raise:NSMallocException format:@"Unable to resize objects array."]; } - array->objects = newObjects; - array->capacity += 16UL; - memset(&array->objects[array->count], 0, sizeof(id) * (array->capacity - array->count)); - } - array->count++; - if((objectIndex + 1UL) < array->count) { memmove(&array->objects[objectIndex + 1UL], &array->objects[objectIndex], sizeof(id) * ((array->count - 1UL) - objectIndex)); array->objects[objectIndex] = NULL; } - array->objects[objectIndex] = newObject; -} - -// Note: The caller is responsible for -retaining the object that is to be added. -static void _JKArrayReplaceObjectAtIndexWithObject(JSONKIT_PREPEND(JKArray) *array, NSUInteger objectIndex, id newObject) { - NSCParameterAssert((array != NULL) && (array->objects != NULL) && (array->count <= array->capacity) && (objectIndex < array->count) && (array->objects[objectIndex] != NULL) && (newObject != NULL)); - if(!((array != NULL) && (array->objects != NULL) && (objectIndex < array->count) && (array->objects[objectIndex] != NULL) && (newObject != NULL))) { [newObject autorelease]; return; } - CFRelease(array->objects[objectIndex]); - array->objects[objectIndex] = NULL; - array->objects[objectIndex] = newObject; -} - -static void _JKArrayRemoveObjectAtIndex(JSONKIT_PREPEND(JKArray) *array, NSUInteger objectIndex) { - NSCParameterAssert((array != NULL) && (array->objects != NULL) && (array->count > 0UL) && (array->count <= array->capacity) && (objectIndex < array->count) && (array->objects[objectIndex] != NULL)); - if(!((array != NULL) && (array->objects != NULL) && (array->count > 0UL) && (array->count <= array->capacity) && (objectIndex < array->count) && (array->objects[objectIndex] != NULL))) { return; } - CFRelease(array->objects[objectIndex]); - array->objects[objectIndex] = NULL; - if((objectIndex + 1UL) < array->count) { memmove(&array->objects[objectIndex], &array->objects[objectIndex + 1UL], sizeof(id) * ((array->count - 1UL) - objectIndex)); array->objects[array->count - 1UL] = NULL; } - array->count--; -} - -- (void)dealloc -{ - if(PJK_EXPECT_T(objects != NULL)) { - NSUInteger atObject = 0UL; - for(atObject = 0UL; atObject < count; atObject++) { if(PJK_EXPECT_T(objects[atObject] != NULL)) { CFRelease(objects[atObject]); objects[atObject] = NULL; } } - free(objects); objects = NULL; - } - - [super dealloc]; -} - -- (NSUInteger)count -{ - NSParameterAssert((objects != NULL) && (count <= capacity)); - return(count); -} - -- (void)getObjects:(id *)objectsPtr range:(NSRange)range -{ - NSParameterAssert((objects != NULL) && (count <= capacity)); - if((objectsPtr == NULL) && (NSMaxRange(range) > 0UL)) { [NSException raise:NSRangeException format:@"*** -[%@ %@]: pointer to objects array is NULL but range length is %lu", NSStringFromClass([self class]), NSStringFromSelector(_cmd), (unsigned long)NSMaxRange(range)]; } - if((range.location > count) || (NSMaxRange(range) > count)) { [NSException raise:NSRangeException format:@"*** -[%@ %@]: index (%lu) beyond bounds (%lu)", NSStringFromClass([self class]), NSStringFromSelector(_cmd), (unsigned long)NSMaxRange(range), (unsigned long)count]; } -#ifndef __clang_analyzer__ - memcpy(objectsPtr, objects + range.location, range.length * sizeof(id)); -#endif -} - -- (id)objectAtIndex:(NSUInteger)objectIndex -{ - if(objectIndex >= count) { [NSException raise:NSRangeException format:@"*** -[%@ %@]: index (%lu) beyond bounds (%lu)", NSStringFromClass([self class]), NSStringFromSelector(_cmd), (unsigned long)objectIndex, (unsigned long)count]; } - NSParameterAssert((objects != NULL) && (count <= capacity) && (objects[objectIndex] != NULL)); - return(objects[objectIndex]); -} - -- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len -{ - NSParameterAssert((state != NULL) && (stackbuf != NULL) && (len > 0UL) && (objects != NULL) && (count <= capacity)); - if(PJK_EXPECT_F(state->state == 0UL)) { state->mutationsPtr = (unsigned long *)&mutations; state->itemsPtr = stackbuf; } - if(PJK_EXPECT_F(state->state >= count)) { return(0UL); } - - NSUInteger enumeratedCount = 0UL; - while(PJK_EXPECT_T(enumeratedCount < len) && PJK_EXPECT_T(state->state < count)) { NSParameterAssert(objects[state->state] != NULL); stackbuf[enumeratedCount++] = objects[state->state++]; } - - return(enumeratedCount); -} - -- (void)insertObject:(id)anObject atIndex:(NSUInteger)objectIndex -{ - if(mutations == 0UL) { [NSException raise:NSInternalInconsistencyException format:@"*** -[%@ %@]: mutating method sent to immutable object", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } - if(anObject == NULL) { [NSException raise:NSInvalidArgumentException format:@"*** -[%@ %@]: attempt to insert nil", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } - if(objectIndex > count) { [NSException raise:NSRangeException format:@"*** -[%@ %@]: index (%lu) beyond bounds (%lu)", NSStringFromClass([self class]), NSStringFromSelector(_cmd), (unsigned long)objectIndex, (unsigned long)(count + 1UL)]; } -#ifdef __clang_analyzer__ - [anObject retain]; // Stupid clang analyzer... Issue #19. -#else - anObject = [anObject retain]; -#endif - _JKArrayInsertObjectAtIndex(self, anObject, objectIndex); - mutations = (mutations == NSUIntegerMax) ? 1UL : mutations + 1UL; -} - -- (void)removeObjectAtIndex:(NSUInteger)objectIndex -{ - if(mutations == 0UL) { [NSException raise:NSInternalInconsistencyException format:@"*** -[%@ %@]: mutating method sent to immutable object", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } - if(objectIndex >= count) { [NSException raise:NSRangeException format:@"*** -[%@ %@]: index (%lu) beyond bounds (%lu)", NSStringFromClass([self class]), NSStringFromSelector(_cmd), (unsigned long)objectIndex, (unsigned long)count]; } - _JKArrayRemoveObjectAtIndex(self, objectIndex); - mutations = (mutations == NSUIntegerMax) ? 1UL : mutations + 1UL; -} - -- (void)replaceObjectAtIndex:(NSUInteger)objectIndex withObject:(id)anObject -{ - if(mutations == 0UL) { [NSException raise:NSInternalInconsistencyException format:@"*** -[%@ %@]: mutating method sent to immutable object", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } - if(anObject == NULL) { [NSException raise:NSInvalidArgumentException format:@"*** -[%@ %@]: attempt to insert nil", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } - if(objectIndex >= count) { [NSException raise:NSRangeException format:@"*** -[%@ %@]: index (%lu) beyond bounds (%lu)", NSStringFromClass([self class]), NSStringFromSelector(_cmd), (unsigned long)objectIndex, (unsigned long)count]; } -#ifdef __clang_analyzer__ - [anObject retain]; // Stupid clang analyzer... Issue #19. -#else - anObject = [anObject retain]; -#endif - _JKArrayReplaceObjectAtIndexWithObject(self, objectIndex, anObject); - mutations = (mutations == NSUIntegerMax) ? 1UL : mutations + 1UL; -} - -- (id)copyWithZone:(NSZone *)zone -{ - NSParameterAssert((objects != NULL) && (count <= capacity)); - return((mutations == 0UL) ? [self retain] : [(NSArray *)[NSArray allocWithZone:zone] initWithObjects:objects count:count]); -} - -- (id)mutableCopyWithZone:(NSZone *)zone -{ - NSParameterAssert((objects != NULL) && (count <= capacity)); - return([(NSMutableArray *)[NSMutableArray allocWithZone:zone] initWithObjects:objects count:count]); -} - -@end - - -#pragma mark - -@interface JSONKIT_PREPEND(JKDictionaryEnumerator) : NSEnumerator { - id collection; - NSUInteger nextObject; -} - -- (id)initWithJKDictionary:(JSONKIT_PREPEND(JKDictionary) *)initDictionary; -- (NSArray *)allObjects; -- (id)nextObject; - -@end - -@implementation JSONKIT_PREPEND(JKDictionaryEnumerator) - -- (id)initWithJKDictionary:(JSONKIT_PREPEND(JKDictionary) *)initDictionary -{ - NSParameterAssert(initDictionary != NULL); - if((self = [super init]) == NULL) { return(NULL); } - if((collection = (id)CFRetain(initDictionary)) == NULL) { [self autorelease]; return(NULL); } - return(self); -} - -- (void)dealloc -{ - if(collection != NULL) { CFRelease(collection); collection = NULL; } - [super dealloc]; -} - -- (NSArray *)allObjects -{ - NSParameterAssert(collection != NULL); - NSUInteger count = [(NSDictionary *)collection count], atObject = 0UL; - id objects[count]; - - while((objects[atObject] = [self nextObject]) != NULL) { NSParameterAssert(atObject < count); atObject++; } - - return([NSArray arrayWithObjects:objects count:atObject]); -} - -- (id)nextObject -{ - NSParameterAssert((collection != NULL) && (_JKDictionaryHashEntry(collection) != NULL)); - JKHashTableEntry *entry = _JKDictionaryHashEntry(collection); - NSUInteger capacity = _JKDictionaryCapacity(collection); - id returnObject = NULL; - - if(entry != NULL) { while((nextObject < capacity) && ((returnObject = entry[nextObject++].key) == NULL)) { /* ... */ } } - - return(returnObject); -} - -@end - -#pragma mark - -@interface JSONKIT_PREPEND(JKDictionary) : NSMutableDictionary { - NSUInteger count, capacity, mutations; - JKHashTableEntry *entry; -} -- (id)initWithCapacity:(NSUInteger)aCapacity; -@end - -@implementation JSONKIT_PREPEND(JKDictionary) - -+ (id)allocWithZone:(NSZone *)zone -{ -#pragma unused(zone) - [NSException raise:NSInvalidArgumentException format:@"*** - [%@ %@]: The %@ class is private to JSONKit and should not be used in this fashion.", NSStringFromClass([self class]), NSStringFromSelector(_cmd), NSStringFromClass([self class])]; - return(NULL); -} - -// These values are taken from Core Foundation CF-550 CFBasicHash.m. As a bonus, they align very well with our JKHashTableEntry struct too. -static const NSUInteger jk_dictionaryCapacities[] = { - 0UL, 3UL, 7UL, 13UL, 23UL, 41UL, 71UL, 127UL, 191UL, 251UL, 383UL, 631UL, 1087UL, 1723UL, - 2803UL, 4523UL, 7351UL, 11959UL, 19447UL, 31231UL, 50683UL, 81919UL, 132607UL, - 214519UL, 346607UL, 561109UL, 907759UL, 1468927UL, 2376191UL, 3845119UL, - 6221311UL, 10066421UL, 16287743UL, 26354171UL, 42641881UL, 68996069UL, - 111638519UL, 180634607UL, 292272623UL, 472907251UL -}; - -static NSUInteger _JKDictionaryCapacityForCount(NSUInteger count) { - NSUInteger bottom = 0UL, top = sizeof(jk_dictionaryCapacities) / sizeof(NSUInteger), mid = 0UL, tableSize = (NSUInteger)lround(floor(((double)count) * 1.33)); - while(top > bottom) { mid = (top + bottom) / 2UL; if(jk_dictionaryCapacities[mid] < tableSize) { bottom = mid + 1UL; } else { top = mid; } } - return(jk_dictionaryCapacities[bottom]); -} - -- (id)initWithCapacity:(NSUInteger)aCapacity { - if ((self = [self init])) { - capacity = aCapacity; - count = 0UL; - } - return self; -} - -static void _JKDictionaryResizeIfNeccessary(JSONKIT_PREPEND(JKDictionary) *dictionary) { - NSCParameterAssert((dictionary != NULL) && (dictionary->entry != NULL) && (dictionary->count <= dictionary->capacity)); - - NSUInteger capacityForCount = 0UL; - if(dictionary->capacity < (capacityForCount = _JKDictionaryCapacityForCount(dictionary->count + 1UL))) { // resize - NSUInteger oldCapacity = dictionary->capacity; -#ifndef NS_BLOCK_ASSERTIONS - NSUInteger oldCount = dictionary->count; -#endif - JKHashTableEntry *oldEntry = dictionary->entry; - if(PJK_EXPECT_F((dictionary->entry = (JKHashTableEntry *)calloc(1UL, sizeof(JKHashTableEntry) * capacityForCount)) == NULL)) { [NSException raise:NSMallocException format:@"Unable to allocate memory for hash table."]; } - dictionary->capacity = capacityForCount; - dictionary->count = 0UL; - - NSUInteger idx = 0UL; - for(idx = 0UL; idx < oldCapacity; idx++) { if(oldEntry[idx].key != NULL) { _JKDictionaryAddObject(dictionary, oldEntry[idx].keyHash, oldEntry[idx].key, oldEntry[idx].object); oldEntry[idx].keyHash = 0UL; oldEntry[idx].key = NULL; oldEntry[idx].object = NULL; } } - NSCParameterAssert((oldCount == dictionary->count)); - free(oldEntry); oldEntry = NULL; - } -} - -static JSONKIT_PREPEND(JKDictionary) *_JKDictionaryCreate(id *keys, NSUInteger *keyHashes, id *objects, NSUInteger count, BOOL mutableCollection) { - NSCParameterAssert((keys != NULL) && (keyHashes != NULL) && (objects != NULL) && (_JKDictionaryClass != NULL) && (_JKDictionaryInstanceSize > 0UL)); - JSONKIT_PREPEND(JKDictionary) *dictionary = NULL; - if(PJK_EXPECT_T((dictionary = (JSONKIT_PREPEND(JKDictionary) *)calloc(1UL, _JKDictionaryInstanceSize)) != NULL)) { // Directly allocate the JKDictionary instance via calloc. - object_setClass(dictionary, _JKDictionaryClass); - dictionary = [dictionary initWithCapacity:_JKDictionaryCapacityForCount(count)]; - - if(dictionary == NULL) { return(NULL); } - - if(PJK_EXPECT_F((dictionary->entry = (JKHashTableEntry *)calloc(1UL, sizeof(JKHashTableEntry) * dictionary->capacity)) == NULL)) { [dictionary autorelease]; return(NULL); } - - NSUInteger idx = 0UL; - for(idx = 0UL; idx < count; idx++) { _JKDictionaryAddObject(dictionary, keyHashes[idx], keys[idx], objects[idx]); } - - dictionary->mutations = (mutableCollection == NO) ? 0UL : 1UL; - } - return(dictionary); -} - -- (void)dealloc -{ - if(PJK_EXPECT_T(entry != NULL)) { - NSUInteger atEntry = 0UL; - for(atEntry = 0UL; atEntry < capacity; atEntry++) { - if(PJK_EXPECT_T(entry[atEntry].key != NULL)) { CFRelease(entry[atEntry].key); entry[atEntry].key = NULL; } - if(PJK_EXPECT_T(entry[atEntry].object != NULL)) { CFRelease(entry[atEntry].object); entry[atEntry].object = NULL; } - } - - free(entry); entry = NULL; - } - - [super dealloc]; -} - -static JKHashTableEntry *_JKDictionaryHashEntry(JSONKIT_PREPEND(JKDictionary) *dictionary) { - NSCParameterAssert(dictionary != NULL); - return(dictionary->entry); -} - -static NSUInteger _JKDictionaryCapacity(JSONKIT_PREPEND(JKDictionary) *dictionary) { - NSCParameterAssert(dictionary != NULL); - return(dictionary->capacity); -} - -static void _JKDictionaryRemoveObjectWithEntry(JSONKIT_PREPEND(JKDictionary) *dictionary, JKHashTableEntry *entry) { - NSCParameterAssert((dictionary != NULL) && (entry != NULL) && (entry->key != NULL) && (entry->object != NULL) && (dictionary->count > 0UL) && (dictionary->count <= dictionary->capacity)); - CFRelease(entry->key); entry->key = NULL; - CFRelease(entry->object); entry->object = NULL; - entry->keyHash = 0UL; - dictionary->count--; - // In order for certain invariants that are used to speed up the search for a particular key, we need to "re-add" all the entries in the hash table following this entry until we hit a NULL entry. - NSUInteger removeIdx = entry - dictionary->entry, idx = 0UL; - NSCParameterAssert((removeIdx < dictionary->capacity)); - for(idx = 0UL; idx < dictionary->capacity; idx++) { - NSUInteger entryIdx = (removeIdx + idx + 1UL) % dictionary->capacity; - JKHashTableEntry *atEntry = &dictionary->entry[entryIdx]; - if(atEntry->key == NULL) { break; } - NSUInteger keyHash = atEntry->keyHash; - id key = atEntry->key, object = atEntry->object; - NSCParameterAssert(object != NULL); - atEntry->keyHash = 0UL; - atEntry->key = NULL; - atEntry->object = NULL; - NSUInteger addKeyEntry = keyHash % dictionary->capacity, addIdx = 0UL; - for(addIdx = 0UL; addIdx < dictionary->capacity; addIdx++) { - JKHashTableEntry *atAddEntry = &dictionary->entry[((addKeyEntry + addIdx) % dictionary->capacity)]; - if(PJK_EXPECT_T(atAddEntry->key == NULL)) { NSCParameterAssert((atAddEntry->keyHash == 0UL) && (atAddEntry->object == NULL)); atAddEntry->key = key; atAddEntry->object = object; atAddEntry->keyHash = keyHash; break; } - } - } -} - -static void _JKDictionaryAddObject(JSONKIT_PREPEND(JKDictionary) *dictionary, NSUInteger keyHash, id key, id object) { - NSCParameterAssert((dictionary != NULL) && (key != NULL) && (object != NULL) && (dictionary->count < dictionary->capacity) && (dictionary->entry != NULL)); - NSUInteger keyEntry = keyHash % dictionary->capacity, idx = 0UL; - for(idx = 0UL; idx < dictionary->capacity; idx++) { - NSUInteger entryIdx = (keyEntry + idx) % dictionary->capacity; - JKHashTableEntry *atEntry = &dictionary->entry[entryIdx]; - if(PJK_EXPECT_F(atEntry->keyHash == keyHash) && PJK_EXPECT_T(atEntry->key != NULL) && (PJK_EXPECT_F(key == atEntry->key) || PJK_EXPECT_F(CFEqual(atEntry->key, key)))) { _JKDictionaryRemoveObjectWithEntry(dictionary, atEntry); } - if(PJK_EXPECT_T(atEntry->key == NULL)) { NSCParameterAssert((atEntry->keyHash == 0UL) && (atEntry->object == NULL)); atEntry->key = key; atEntry->object = object; atEntry->keyHash = keyHash; dictionary->count++; return; } - } - - // We should never get here. If we do, we -release the key / object because it's our responsibility. - CFRelease(key); - CFRelease(object); -} - -- (NSUInteger)count -{ - return(count); -} - -static JKHashTableEntry *_JKDictionaryHashTableEntryForKey(JSONKIT_PREPEND(JKDictionary) *dictionary, id aKey) { - NSCParameterAssert((dictionary != NULL) && (dictionary->entry != NULL) && (dictionary->count <= dictionary->capacity)); - if((aKey == NULL) || (dictionary->capacity == 0UL)) { return(NULL); } - NSUInteger keyHash = CFHash(aKey), keyEntry = (keyHash % dictionary->capacity), idx = 0UL; - JKHashTableEntry *atEntry = NULL; - for(idx = 0UL; idx < dictionary->capacity; idx++) { - atEntry = &dictionary->entry[(keyEntry + idx) % dictionary->capacity]; - if(PJK_EXPECT_T(atEntry->keyHash == keyHash) && PJK_EXPECT_T(atEntry->key != NULL) && ((atEntry->key == aKey) || CFEqual(atEntry->key, aKey))) { NSCParameterAssert(atEntry->object != NULL); return(atEntry); break; } - if(PJK_EXPECT_F(atEntry->key == NULL)) { NSCParameterAssert(atEntry->object == NULL); return(NULL); break; } // If the key was in the table, we would have found it by now. - } - return(NULL); -} - -- (id)objectForKey:(id)aKey -{ - NSParameterAssert((entry != NULL) && (count <= capacity)); - JKHashTableEntry *entryForKey = _JKDictionaryHashTableEntryForKey(self, aKey); - return((entryForKey != NULL) ? entryForKey->object : NULL); -} - -- (void)getObjects:(id *)objects andKeys:(id *)keys -{ - NSParameterAssert((entry != NULL) && (count <= capacity)); - NSUInteger atEntry = 0UL; NSUInteger arrayIdx = 0UL; - for(atEntry = 0UL; atEntry < capacity; atEntry++) { - if(PJK_EXPECT_T(entry[atEntry].key != NULL)) { - NSCParameterAssert((entry[atEntry].object != NULL) && (arrayIdx < count)); - if(PJK_EXPECT_T(keys != NULL)) { keys[arrayIdx] = entry[atEntry].key; } - if(PJK_EXPECT_T(objects != NULL)) { objects[arrayIdx] = entry[atEntry].object; } - arrayIdx++; - } - } -} - -- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len -{ - NSParameterAssert((state != NULL) && (stackbuf != NULL) && (len > 0UL) && (entry != NULL) && (count <= capacity)); - if(PJK_EXPECT_F(state->state == 0UL)) { state->mutationsPtr = (unsigned long *)&mutations; state->itemsPtr = stackbuf; } - if(PJK_EXPECT_F(state->state >= capacity)) { return(0UL); } - - NSUInteger enumeratedCount = 0UL; - while(PJK_EXPECT_T(enumeratedCount < len) && PJK_EXPECT_T(state->state < capacity)) { if(PJK_EXPECT_T(entry[state->state].key != NULL)) { stackbuf[enumeratedCount++] = entry[state->state].key; } state->state++; } - - return(enumeratedCount); -} - -- (NSEnumerator *)keyEnumerator -{ - return([[[JSONKIT_PREPEND(JKDictionaryEnumerator) alloc] initWithJKDictionary:self] autorelease]); -} - -- (void)setObject:(id)anObject forKey:(id)aKey -{ - if(mutations == 0UL) { [NSException raise:NSInternalInconsistencyException format:@"*** -[%@ %@]: mutating method sent to immutable object", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } - if(aKey == NULL) { [NSException raise:NSInvalidArgumentException format:@"*** -[%@ %@]: attempt to insert nil key", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } - if(anObject == NULL) { [NSException raise:NSInvalidArgumentException format:@"*** -[%@ %@]: attempt to insert nil value (key: %@)", NSStringFromClass([self class]), NSStringFromSelector(_cmd), aKey]; } - - _JKDictionaryResizeIfNeccessary(self); -#ifndef __clang_analyzer__ - aKey = [aKey copy]; // Why on earth would clang complain that this -copy "might leak", - anObject = [anObject retain]; // but this -retain doesn't!? -#endif // __clang_analyzer__ - _JKDictionaryAddObject(self, CFHash(aKey), aKey, anObject); - mutations = (mutations == NSUIntegerMax) ? 1UL : mutations + 1UL; -} - -- (void)removeObjectForKey:(id)aKey -{ - if(mutations == 0UL) { [NSException raise:NSInternalInconsistencyException format:@"*** -[%@ %@]: mutating method sent to immutable object", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } - if(aKey == NULL) { [NSException raise:NSInvalidArgumentException format:@"*** -[%@ %@]: attempt to remove nil key", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } - JKHashTableEntry *entryForKey = _JKDictionaryHashTableEntryForKey(self, aKey); - if(entryForKey != NULL) { - _JKDictionaryRemoveObjectWithEntry(self, entryForKey); - mutations = (mutations == NSUIntegerMax) ? 1UL : mutations + 1UL; - } -} - -- (id)copyWithZone:(NSZone *)zone -{ - NSParameterAssert((entry != NULL) && (count <= capacity)); - return((mutations == 0UL) ? [self retain] : [[NSDictionary allocWithZone:zone] initWithDictionary:self]); -} - -- (id)mutableCopyWithZone:(NSZone *)zone -{ - NSParameterAssert((entry != NULL) && (count <= capacity)); - return([[NSMutableDictionary allocWithZone:zone] initWithDictionary:self]); -} - -@end - - - -#pragma mark - - -PJK_STATIC_INLINE size_t jk_min(size_t a, size_t b) { return((a < b) ? a : b); } -PJK_STATIC_INLINE size_t jk_max(size_t a, size_t b) { return((a > b) ? a : b); } - -PJK_STATIC_INLINE JKHash jk_calculateHash(JKHash currentHash, unsigned char c) { return((((currentHash << 5) + currentHash) + (c - 29)) ^ (currentHash >> 19)); } - - -static void jk_error(JSONKIT_PREPEND(JKParseState) *parseState, NSString *format, ...) { - NSCParameterAssert((parseState != NULL) && (format != NULL)); - - va_list varArgsList; - va_start(varArgsList, format); - NSString *formatString = [[[NSString alloc] initWithFormat:format arguments:varArgsList] autorelease]; - va_end(varArgsList); - -#if 0 - const unsigned char *lineStart = parseState->stringBuffer.bytes.ptr + parseState->lineStartIndex; - const unsigned char *lineEnd = lineStart; - const unsigned char *atCharacterPtr = NULL; - - for(atCharacterPtr = lineStart; atCharacterPtr < JK_END_STRING_PTR(parseState); atCharacterPtr++) { lineEnd = atCharacterPtr; if(jk_parse_is_newline(parseState, atCharacterPtr)) { break; } } - - NSString *lineString = @"", *carretString = @""; - if(lineStart < JK_END_STRING_PTR(parseState)) { - lineString = [[[NSString alloc] initWithBytes:lineStart length:(lineEnd - lineStart) encoding:NSUTF8StringEncoding] autorelease]; - carretString = [NSString stringWithFormat:@"%*.*s^", (int)(parseState->atIndex - parseState->lineStartIndex), (int)(parseState->atIndex - parseState->lineStartIndex), " "]; - } -#endif - - if(parseState->error == NULL) { - parseState->error = [NSError errorWithDomain:@"JKErrorDomain" code:-1L userInfo: - [NSDictionary dictionaryWithObjectsAndKeys: - formatString, NSLocalizedDescriptionKey, - [NSNumber numberWithUnsignedLong:parseState->atIndex], @"JKAtIndexKey", - [NSNumber numberWithUnsignedLong:parseState->lineNumber], @"JKLineNumberKey", - //lineString, @"JKErrorLine0Key", - //carretString, @"JKErrorLine1Key", - NULL]]; - } -} - -#pragma mark - -#pragma mark Buffer and Object Stack management functions - -static void jk_managedBuffer_release(JKManagedBuffer *managedBuffer) { - if((managedBuffer->flags & JKManagedBufferMustFree)) { - if(managedBuffer->bytes.ptr != NULL) { free(managedBuffer->bytes.ptr); managedBuffer->bytes.ptr = NULL; } - managedBuffer->flags &= ~JKManagedBufferMustFree; - } - - managedBuffer->bytes.ptr = NULL; - managedBuffer->bytes.length = 0UL; - managedBuffer->flags &= ~JKManagedBufferLocationMask; -} - -static void jk_managedBuffer_setToStackBuffer(JKManagedBuffer *managedBuffer, unsigned char *ptr, size_t length) { - jk_managedBuffer_release(managedBuffer); - managedBuffer->bytes.ptr = ptr; - managedBuffer->bytes.length = length; - managedBuffer->flags = (managedBuffer->flags & ~JKManagedBufferLocationMask) | JKManagedBufferOnStack; -} - -static unsigned char *jk_managedBuffer_resize(JKManagedBuffer *managedBuffer, size_t newSize) { - size_t roundedUpNewSize = newSize; - - if(managedBuffer->roundSizeUpToMultipleOf > 0UL) { roundedUpNewSize = newSize + ((managedBuffer->roundSizeUpToMultipleOf - (newSize % managedBuffer->roundSizeUpToMultipleOf)) % managedBuffer->roundSizeUpToMultipleOf); } - - if((roundedUpNewSize != managedBuffer->bytes.length) && (roundedUpNewSize > managedBuffer->bytes.length)) { - if((managedBuffer->flags & JKManagedBufferLocationMask) == JKManagedBufferOnStack) { - NSCParameterAssert((managedBuffer->flags & JKManagedBufferMustFree) == 0); - unsigned char *newBuffer = NULL, *oldBuffer = managedBuffer->bytes.ptr; - - if((newBuffer = (unsigned char *)malloc(roundedUpNewSize)) == NULL) { return(NULL); } - memcpy(newBuffer, oldBuffer, jk_min(managedBuffer->bytes.length, roundedUpNewSize)); - managedBuffer->flags = (managedBuffer->flags & ~JKManagedBufferLocationMask) | (JKManagedBufferOnHeap | JKManagedBufferMustFree); - managedBuffer->bytes.ptr = newBuffer; - managedBuffer->bytes.length = roundedUpNewSize; - } else { - NSCParameterAssert(((managedBuffer->flags & JKManagedBufferMustFree) != 0) && ((managedBuffer->flags & JKManagedBufferLocationMask) == JKManagedBufferOnHeap)); - if((managedBuffer->bytes.ptr = (unsigned char *)reallocf(managedBuffer->bytes.ptr, roundedUpNewSize)) == NULL) { return(NULL); } - managedBuffer->bytes.length = roundedUpNewSize; - } - } - - return(managedBuffer->bytes.ptr); -} - - - -static void jk_objectStack_release(JKObjectStack *objectStack) { - NSCParameterAssert(objectStack != NULL); - - NSCParameterAssert(objectStack->index <= objectStack->count); - size_t atIndex = 0UL; - for(atIndex = 0UL; atIndex < objectStack->index; atIndex++) { - if(objectStack->objects[atIndex] != NULL) { CFRelease(objectStack->objects[atIndex]); objectStack->objects[atIndex] = NULL; } - if(objectStack->keys[atIndex] != NULL) { CFRelease(objectStack->keys[atIndex]); objectStack->keys[atIndex] = NULL; } - } - objectStack->index = 0UL; - - if(objectStack->flags & JKObjectStackMustFree) { - NSCParameterAssert((objectStack->flags & JKObjectStackLocationMask) == JKObjectStackOnHeap); - if(objectStack->objects != NULL) { free(objectStack->objects); objectStack->objects = NULL; } - if(objectStack->keys != NULL) { free(objectStack->keys); objectStack->keys = NULL; } - if(objectStack->cfHashes != NULL) { free(objectStack->cfHashes); objectStack->cfHashes = NULL; } - objectStack->flags &= ~JKObjectStackMustFree; - } - - objectStack->objects = NULL; - objectStack->keys = NULL; - objectStack->cfHashes = NULL; - - objectStack->count = 0UL; - objectStack->flags &= ~JKObjectStackLocationMask; -} - -static void jk_objectStack_setToStackBuffer(JKObjectStack *objectStack, void **objects, void **keys, CFHashCode *cfHashes, size_t count) { - NSCParameterAssert((objectStack != NULL) && (objects != NULL) && (keys != NULL) && (cfHashes != NULL) && (count > 0UL)); - jk_objectStack_release(objectStack); - objectStack->objects = objects; - objectStack->keys = keys; - objectStack->cfHashes = cfHashes; - objectStack->count = count; - objectStack->flags = (objectStack->flags & ~JKObjectStackLocationMask) | JKObjectStackOnStack; -#ifndef NS_BLOCK_ASSERTIONS - size_t idx; - for(idx = 0UL; idx < objectStack->count; idx++) { objectStack->objects[idx] = NULL; objectStack->keys[idx] = NULL; objectStack->cfHashes[idx] = 0UL; } -#endif -} - -static int jk_objectStack_resize(JKObjectStack *objectStack, size_t newCount) { - size_t roundedUpNewCount = newCount; - int returnCode = 0; - - void **newObjects = NULL, **newKeys = NULL; - CFHashCode *newCFHashes = NULL; - - if(objectStack->roundSizeUpToMultipleOf > 0UL) { roundedUpNewCount = newCount + ((objectStack->roundSizeUpToMultipleOf - (newCount % objectStack->roundSizeUpToMultipleOf)) % objectStack->roundSizeUpToMultipleOf); } - - if((roundedUpNewCount != objectStack->count) && (roundedUpNewCount > objectStack->count)) { - if((objectStack->flags & JKObjectStackLocationMask) == JKObjectStackOnStack) { - NSCParameterAssert((objectStack->flags & JKObjectStackMustFree) == 0); - - if((newObjects = (void ** )calloc(1UL, roundedUpNewCount * sizeof(void * ))) == NULL) { returnCode = 1; goto errorExit; } - memcpy(newObjects, objectStack->objects, jk_min(objectStack->count, roundedUpNewCount) * sizeof(void *)); - if((newKeys = (void ** )calloc(1UL, roundedUpNewCount * sizeof(void * ))) == NULL) { returnCode = 1; goto errorExit; } - memcpy(newKeys, objectStack->keys, jk_min(objectStack->count, roundedUpNewCount) * sizeof(void *)); - - if((newCFHashes = (CFHashCode *)calloc(1UL, roundedUpNewCount * sizeof(CFHashCode))) == NULL) { returnCode = 1; goto errorExit; } - memcpy(newCFHashes, objectStack->cfHashes, jk_min(objectStack->count, roundedUpNewCount) * sizeof(CFHashCode)); - - objectStack->flags = (objectStack->flags & ~JKObjectStackLocationMask) | (JKObjectStackOnHeap | JKObjectStackMustFree); - objectStack->objects = newObjects; newObjects = NULL; - objectStack->keys = newKeys; newKeys = NULL; - objectStack->cfHashes = newCFHashes; newCFHashes = NULL; - objectStack->count = roundedUpNewCount; - } else { - NSCParameterAssert(((objectStack->flags & JKObjectStackMustFree) != 0) && ((objectStack->flags & JKObjectStackLocationMask) == JKObjectStackOnHeap)); - if((newObjects = (void ** )realloc(objectStack->objects, roundedUpNewCount * sizeof(void * ))) != NULL) { objectStack->objects = newObjects; newObjects = NULL; } else { returnCode = 1; goto errorExit; } - if((newKeys = (void ** )realloc(objectStack->keys, roundedUpNewCount * sizeof(void * ))) != NULL) { objectStack->keys = newKeys; newKeys = NULL; } else { returnCode = 1; goto errorExit; } - if((newCFHashes = (CFHashCode *)realloc(objectStack->cfHashes, roundedUpNewCount * sizeof(CFHashCode))) != NULL) { objectStack->cfHashes = newCFHashes; newCFHashes = NULL; } else { returnCode = 1; goto errorExit; } - -#ifndef NS_BLOCK_ASSERTIONS - size_t idx; - for(idx = objectStack->count; idx < roundedUpNewCount; idx++) { objectStack->objects[idx] = NULL; objectStack->keys[idx] = NULL; objectStack->cfHashes[idx] = 0UL; } -#endif - objectStack->count = roundedUpNewCount; - } - } - - errorExit: - if(newObjects != NULL) { free(newObjects); newObjects = NULL; } - if(newKeys != NULL) { free(newKeys); newKeys = NULL; } - if(newCFHashes != NULL) { free(newCFHashes); newCFHashes = NULL; } - - return(returnCode); -} - -//////////// -#pragma mark - -#pragma mark Unicode related functions - -PJK_STATIC_INLINE ConversionResult isValidCodePoint(UTF32 *u32CodePoint) { - ConversionResult result = conversionOK; - UTF32 ch = *u32CodePoint; - - if(PJK_EXPECT_F(ch >= UNI_SUR_HIGH_START) && (PJK_EXPECT_T(ch <= UNI_SUR_LOW_END))) { result = sourceIllegal; ch = UNI_REPLACEMENT_CHAR; goto finished; } - if(PJK_EXPECT_F(ch >= 0xFDD0U) && (PJK_EXPECT_F(ch <= 0xFDEFU) || PJK_EXPECT_F((ch & 0xFFFEU) == 0xFFFEU)) && PJK_EXPECT_T(ch <= 0x10FFFFU)) { result = sourceIllegal; ch = UNI_REPLACEMENT_CHAR; goto finished; } - if(PJK_EXPECT_F(ch == 0U)) { result = sourceIllegal; ch = UNI_REPLACEMENT_CHAR; goto finished; } - - finished: - *u32CodePoint = ch; - return(result); -} - - -static int isLegalUTF8(const UTF8 *source, size_t length) { - const UTF8 *srcptr = source + length; - UTF8 a; - - switch(length) { - default: return(0); // Everything else falls through when "true"... - case 4: if(PJK_EXPECT_F(((a = (*--srcptr)) < 0x80) || (a > 0xBF))) { return(0); } - case 3: if(PJK_EXPECT_F(((a = (*--srcptr)) < 0x80) || (a > 0xBF))) { return(0); } - case 2: if(PJK_EXPECT_F( (a = (*--srcptr)) > 0xBF )) { return(0); } - - switch(*source) { // no fall-through in this inner switch - case 0xE0: if(PJK_EXPECT_F(a < 0xA0)) { return(0); } break; - case 0xED: if(PJK_EXPECT_F(a > 0x9F)) { return(0); } break; - case 0xF0: if(PJK_EXPECT_F(a < 0x90)) { return(0); } break; - case 0xF4: if(PJK_EXPECT_F(a > 0x8F)) { return(0); } break; - default: if(PJK_EXPECT_F(a < 0x80)) { return(0); } - } - - case 1: if(PJK_EXPECT_F((PJK_EXPECT_T(*source < 0xC2)) && PJK_EXPECT_F(*source >= 0x80))) { return(0); } - } - - if(PJK_EXPECT_F(*source > 0xF4)) { return(0); } - - return(1); -} - -static ConversionResult ConvertSingleCodePointInUTF8(const UTF8 *sourceStart, const UTF8 *sourceEnd, UTF8 const **nextUTF8, UTF32 *convertedUTF32) { - ConversionResult result = conversionOK; - const UTF8 *source = sourceStart; - UTF32 ch = 0UL; - -#if !defined(PJK_FAST_TRAILING_BYTES) - unsigned short extraBytesToRead = trailingBytesForUTF8[*source]; -#else - unsigned short extraBytesToRead = __builtin_clz(((*source)^0xff) << 25); -#endif - - if(PJK_EXPECT_F((source + extraBytesToRead + 1) > sourceEnd) || PJK_EXPECT_F(!isLegalUTF8(source, extraBytesToRead + 1))) { - source++; - while((source < sourceEnd) && (((*source) & 0xc0) == 0x80) && ((source - sourceStart) < (extraBytesToRead + 1))) { source++; } - NSCParameterAssert(source <= sourceEnd); - result = ((source < sourceEnd) && (((*source) & 0xc0) != 0x80)) ? sourceIllegal : ((sourceStart + extraBytesToRead + 1) > sourceEnd) ? sourceExhausted : sourceIllegal; - ch = UNI_REPLACEMENT_CHAR; - goto finished; - } - - switch(extraBytesToRead) { // The cases all fall through. - case 5: ch += *source++; ch <<= 6; - case 4: ch += *source++; ch <<= 6; - case 3: ch += *source++; ch <<= 6; - case 2: ch += *source++; ch <<= 6; - case 1: ch += *source++; ch <<= 6; - case 0: ch += *source++; - } - ch -= offsetsFromUTF8[extraBytesToRead]; - - result = isValidCodePoint(&ch); - - finished: - *nextUTF8 = source; - *convertedUTF32 = ch; - - return(result); -} - - -static ConversionResult ConvertUTF32toUTF8 (UTF32 u32CodePoint, UTF8 **targetStart, UTF8 *targetEnd) { - const UTF32 byteMask = 0xBF, byteMark = 0x80; - ConversionResult result = conversionOK; - UTF8 *target = *targetStart; - UTF32 ch = u32CodePoint; - unsigned short bytesToWrite = 0; - - result = isValidCodePoint(&ch); - - // Figure out how many bytes the result will require. Turn any illegally large UTF32 things (> Plane 17) into replacement chars. - if(ch < (UTF32)0x80) { bytesToWrite = 1; } - else if(ch < (UTF32)0x800) { bytesToWrite = 2; } - else if(ch < (UTF32)0x10000) { bytesToWrite = 3; } - else if(ch <= UNI_MAX_LEGAL_UTF32) { bytesToWrite = 4; } - else { bytesToWrite = 3; ch = UNI_REPLACEMENT_CHAR; result = sourceIllegal; } - - target += bytesToWrite; - if (target > targetEnd) { target -= bytesToWrite; result = targetExhausted; goto finished; } - - switch (bytesToWrite) { // note: everything falls through. - case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; - case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; - case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; - case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]); - } - - target += bytesToWrite; - - finished: - *targetStart = target; - return(result); -} - -PJK_STATIC_INLINE int jk_string_add_unicodeCodePoint(JSONKIT_PREPEND(JKParseState) *parseState, uint32_t unicodeCodePoint, size_t *tokenBufferIdx, JKHash *stringHash) { - UTF8 *u8s = &parseState->token.tokenBuffer.bytes.ptr[*tokenBufferIdx]; - ConversionResult result; - - if((result = ConvertUTF32toUTF8(unicodeCodePoint, &u8s, (parseState->token.tokenBuffer.bytes.ptr + parseState->token.tokenBuffer.bytes.length))) != conversionOK) { if(result == targetExhausted) { return(1); } } - size_t utf8len = u8s - &parseState->token.tokenBuffer.bytes.ptr[*tokenBufferIdx], nextIdx = (*tokenBufferIdx) + utf8len; - - while(*tokenBufferIdx < nextIdx) { *stringHash = jk_calculateHash(*stringHash, parseState->token.tokenBuffer.bytes.ptr[(*tokenBufferIdx)++]); } - - return(0); -} - -//////////// -#pragma mark - -#pragma mark Decoding / parsing / deserializing functions - -static int jk_parse_string(JSONKIT_PREPEND(JKParseState) *parseState) { - NSCParameterAssert((parseState != NULL) && (JK_AT_STRING_PTR(parseState) <= JK_END_STRING_PTR(parseState))); - const unsigned char *stringStart = JK_AT_STRING_PTR(parseState) + 1; - const unsigned char *endOfBuffer = JK_END_STRING_PTR(parseState); - const unsigned char *atStringCharacter = stringStart; - unsigned char *tokenBuffer = parseState->token.tokenBuffer.bytes.ptr; - size_t tokenStartIndex = parseState->atIndex; - size_t tokenBufferIdx = 0UL; - - int onlySimpleString = 1, stringState = JSONStringStateStart; - uint16_t escapedUnicode1 = 0U, escapedUnicode2 = 0U; - uint32_t escapedUnicodeCodePoint = 0U; - JKHash stringHash = PJK_HASH_INIT; - - while(1) { - unsigned long currentChar; - - if(PJK_EXPECT_F(atStringCharacter == endOfBuffer)) { /* XXX Add error message */ stringState = JSONStringStateError; goto finishedParsing; } - - if(PJK_EXPECT_F((currentChar = *atStringCharacter++) >= 0x80UL)) { - const unsigned char *nextValidCharacter = NULL; - UTF32 u32ch = 0U; - ConversionResult result; - - if(PJK_EXPECT_F((result = ConvertSingleCodePointInUTF8(atStringCharacter - 1, endOfBuffer, (UTF8 const **)&nextValidCharacter, &u32ch)) != conversionOK)) { goto switchToSlowPath; } - stringHash = jk_calculateHash(stringHash, currentChar); - while(atStringCharacter < nextValidCharacter) { NSCParameterAssert(JK_AT_STRING_PTR(parseState) <= JK_END_STRING_PTR(parseState)); stringHash = jk_calculateHash(stringHash, *atStringCharacter++); } - continue; - } else { - if(PJK_EXPECT_F(currentChar == (unsigned long)'"')) { stringState = JSONStringStateFinished; goto finishedParsing; } - - if(PJK_EXPECT_F(currentChar == (unsigned long)'\\')) { - switchToSlowPath: - onlySimpleString = 0; - stringState = JSONStringStateParsing; - tokenBufferIdx = (atStringCharacter - stringStart) - 1L; - if(PJK_EXPECT_F((tokenBufferIdx + 16UL) > parseState->token.tokenBuffer.bytes.length)) { if((tokenBuffer = jk_managedBuffer_resize(&parseState->token.tokenBuffer, tokenBufferIdx + 1024UL)) == NULL) { jk_error(parseState, @"Internal error: Unable to resize temporary buffer. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); stringState = JSONStringStateError; goto finishedParsing; } } - memcpy(tokenBuffer, stringStart, tokenBufferIdx); - goto slowMatch; - } - - if(PJK_EXPECT_F(currentChar < 0x20UL)) { jk_error(parseState, @"Invalid character < 0x20 found in string: 0x%2.2x.", currentChar); stringState = JSONStringStateError; goto finishedParsing; } - - stringHash = jk_calculateHash(stringHash, currentChar); - } - } - - slowMatch: - - for(atStringCharacter = (stringStart + ((atStringCharacter - stringStart) - 1L)); (atStringCharacter < endOfBuffer) && (tokenBufferIdx < parseState->token.tokenBuffer.bytes.length); atStringCharacter++) { - if((tokenBufferIdx + 16UL) > parseState->token.tokenBuffer.bytes.length) { if((tokenBuffer = jk_managedBuffer_resize(&parseState->token.tokenBuffer, tokenBufferIdx + 1024UL)) == NULL) { jk_error(parseState, @"Internal error: Unable to resize temporary buffer. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); stringState = JSONStringStateError; goto finishedParsing; } } - - NSCParameterAssert(tokenBufferIdx < parseState->token.tokenBuffer.bytes.length); - - unsigned long currentChar = (*atStringCharacter), escapedChar; - - if(PJK_EXPECT_T(stringState == JSONStringStateParsing)) { - if(PJK_EXPECT_T(currentChar >= 0x20UL)) { - if(PJK_EXPECT_T(currentChar < (unsigned long)0x80)) { // Not a UTF8 sequence - if(PJK_EXPECT_F(currentChar == (unsigned long)'"')) { stringState = JSONStringStateFinished; atStringCharacter++; goto finishedParsing; } - if(PJK_EXPECT_F(currentChar == (unsigned long)'\\')) { stringState = JSONStringStateEscape; continue; } - stringHash = jk_calculateHash(stringHash, currentChar); - tokenBuffer[tokenBufferIdx++] = currentChar; - continue; - } else { // UTF8 sequence - const unsigned char *nextValidCharacter = NULL; - UTF32 u32ch = 0U; - ConversionResult result; - - if(PJK_EXPECT_F((result = ConvertSingleCodePointInUTF8(atStringCharacter, endOfBuffer, (UTF8 const **)&nextValidCharacter, &u32ch)) != conversionOK)) { - if((result == sourceIllegal) && ((parseState->parseOptionFlags & JSONKIT_PREPEND(JKParseOptionLooseUnicode)) == 0)) { jk_error(parseState, @"Illegal UTF8 sequence found in \"\" string."); stringState = JSONStringStateError; goto finishedParsing; } - if(result == sourceExhausted) { jk_error(parseState, @"End of buffer reached while parsing UTF8 in \"\" string."); stringState = JSONStringStateError; goto finishedParsing; } - if(jk_string_add_unicodeCodePoint(parseState, u32ch, &tokenBufferIdx, &stringHash)) { jk_error(parseState, @"Internal error: Unable to add UTF8 sequence to internal string buffer. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); stringState = JSONStringStateError; goto finishedParsing; } - atStringCharacter = nextValidCharacter - 1; - continue; - } else { - while(atStringCharacter < nextValidCharacter) { tokenBuffer[tokenBufferIdx++] = *atStringCharacter; stringHash = jk_calculateHash(stringHash, *atStringCharacter++); } - atStringCharacter--; - continue; - } - } - } else { // currentChar < 0x20 - jk_error(parseState, @"Invalid character < 0x20 found in string: 0x%2.2x.", currentChar); stringState = JSONStringStateError; goto finishedParsing; - } - - } else { // stringState != JSONStringStateParsing - int isSurrogate = 1; - - switch(stringState) { - case JSONStringStateEscape: - switch(currentChar) { - case 'u': escapedUnicode1 = 0U; escapedUnicode2 = 0U; escapedUnicodeCodePoint = 0U; stringState = JSONStringStateEscapedUnicode1; break; - - case 'b': escapedChar = '\b'; goto parsedEscapedChar; - case 'f': escapedChar = '\f'; goto parsedEscapedChar; - case 'n': escapedChar = '\n'; goto parsedEscapedChar; - case 'r': escapedChar = '\r'; goto parsedEscapedChar; - case 't': escapedChar = '\t'; goto parsedEscapedChar; - case '\\': escapedChar = '\\'; goto parsedEscapedChar; - case '/': escapedChar = '/'; goto parsedEscapedChar; - case '"': escapedChar = '"'; goto parsedEscapedChar; - - parsedEscapedChar: - stringState = JSONStringStateParsing; - stringHash = jk_calculateHash(stringHash, escapedChar); - tokenBuffer[tokenBufferIdx++] = escapedChar; - break; - - default: jk_error(parseState, @"Invalid escape sequence found in \"\" string."); stringState = JSONStringStateError; goto finishedParsing; break; - } - break; - - case JSONStringStateEscapedUnicode1: - case JSONStringStateEscapedUnicode2: - case JSONStringStateEscapedUnicode3: - case JSONStringStateEscapedUnicode4: isSurrogate = 0; - case JSONStringStateEscapedUnicodeSurrogate1: - case JSONStringStateEscapedUnicodeSurrogate2: - case JSONStringStateEscapedUnicodeSurrogate3: - case JSONStringStateEscapedUnicodeSurrogate4: - { - uint16_t hexValue = 0U; - - switch(currentChar) { - case '0' ... '9': hexValue = currentChar - '0'; goto parsedHex; - case 'a' ... 'f': hexValue = (currentChar - 'a') + 10U; goto parsedHex; - case 'A' ... 'F': hexValue = (currentChar - 'A') + 10U; goto parsedHex; - - parsedHex: - if(!isSurrogate) { escapedUnicode1 = (escapedUnicode1 << 4) | hexValue; } else { escapedUnicode2 = (escapedUnicode2 << 4) | hexValue; } - - if(stringState == JSONStringStateEscapedUnicode4) { - if(((escapedUnicode1 >= 0xD800U) && (escapedUnicode1 < 0xE000U))) { - if((escapedUnicode1 >= 0xD800U) && (escapedUnicode1 < 0xDC00U)) { stringState = JSONStringStateEscapedNeedEscapeForSurrogate; } - else if((escapedUnicode1 >= 0xDC00U) && (escapedUnicode1 < 0xE000U)) { - if((parseState->parseOptionFlags & JSONKIT_PREPEND(JKParseOptionLooseUnicode))) { escapedUnicodeCodePoint = UNI_REPLACEMENT_CHAR; } - else { jk_error(parseState, @"Illegal \\u Unicode escape sequence."); stringState = JSONStringStateError; goto finishedParsing; } - } - } - else { escapedUnicodeCodePoint = escapedUnicode1; } - } - - if(stringState == JSONStringStateEscapedUnicodeSurrogate4) { - if((escapedUnicode2 < 0xdc00) || (escapedUnicode2 > 0xdfff)) { - if((parseState->parseOptionFlags & JSONKIT_PREPEND(JKParseOptionLooseUnicode))) { escapedUnicodeCodePoint = UNI_REPLACEMENT_CHAR; } - else { jk_error(parseState, @"Illegal \\u Unicode escape sequence."); stringState = JSONStringStateError; goto finishedParsing; } - } - else { escapedUnicodeCodePoint = ((escapedUnicode1 - 0xd800) * 0x400) + (escapedUnicode2 - 0xdc00) + 0x10000; } - } - - if((stringState == JSONStringStateEscapedUnicode4) || (stringState == JSONStringStateEscapedUnicodeSurrogate4)) { - if((isValidCodePoint(&escapedUnicodeCodePoint) == sourceIllegal) && ((parseState->parseOptionFlags & JSONKIT_PREPEND(JKParseOptionLooseUnicode)) == 0)) { jk_error(parseState, @"Illegal \\u Unicode escape sequence."); stringState = JSONStringStateError; goto finishedParsing; } - stringState = JSONStringStateParsing; - if(jk_string_add_unicodeCodePoint(parseState, escapedUnicodeCodePoint, &tokenBufferIdx, &stringHash)) { jk_error(parseState, @"Internal error: Unable to add UTF8 sequence to internal string buffer. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); stringState = JSONStringStateError; goto finishedParsing; } - } - else if((stringState >= JSONStringStateEscapedUnicode1) && (stringState <= JSONStringStateEscapedUnicodeSurrogate4)) { stringState++; } - break; - - default: jk_error(parseState, @"Unexpected character found in \\u Unicode escape sequence. Found '%c', expected [0-9a-fA-F].", currentChar); stringState = JSONStringStateError; goto finishedParsing; break; - } - } - break; - - case JSONStringStateEscapedNeedEscapeForSurrogate: - if(currentChar == '\\') { stringState = JSONStringStateEscapedNeedEscapedUForSurrogate; } - else { - if((parseState->parseOptionFlags & JSONKIT_PREPEND(JKParseOptionLooseUnicode)) == 0) { jk_error(parseState, @"Required a second \\u Unicode escape sequence following a surrogate \\u Unicode escape sequence."); stringState = JSONStringStateError; goto finishedParsing; } - else { stringState = JSONStringStateParsing; atStringCharacter--; if(jk_string_add_unicodeCodePoint(parseState, UNI_REPLACEMENT_CHAR, &tokenBufferIdx, &stringHash)) { jk_error(parseState, @"Internal error: Unable to add UTF8 sequence to internal string buffer. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); stringState = JSONStringStateError; goto finishedParsing; } } - } - break; - - case JSONStringStateEscapedNeedEscapedUForSurrogate: - if(currentChar == 'u') { stringState = JSONStringStateEscapedUnicodeSurrogate1; } - else { - if((parseState->parseOptionFlags & JSONKIT_PREPEND(JKParseOptionLooseUnicode)) == 0) { jk_error(parseState, @"Required a second \\u Unicode escape sequence following a surrogate \\u Unicode escape sequence."); stringState = JSONStringStateError; goto finishedParsing; } - else { stringState = JSONStringStateParsing; atStringCharacter -= 2; if(jk_string_add_unicodeCodePoint(parseState, UNI_REPLACEMENT_CHAR, &tokenBufferIdx, &stringHash)) { jk_error(parseState, @"Internal error: Unable to add UTF8 sequence to internal string buffer. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); stringState = JSONStringStateError; goto finishedParsing; } } - } - break; - - default: jk_error(parseState, @"Internal error: Unknown stringState. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); stringState = JSONStringStateError; goto finishedParsing; break; - } - } - } - -finishedParsing: - - if(PJK_EXPECT_T(stringState == JSONStringStateFinished)) { - NSCParameterAssert((parseState->stringBuffer.bytes.ptr + tokenStartIndex) < atStringCharacter); - - parseState->token.tokenPtrRange.ptr = parseState->stringBuffer.bytes.ptr + tokenStartIndex; - parseState->token.tokenPtrRange.length = (atStringCharacter - parseState->token.tokenPtrRange.ptr); - - if(PJK_EXPECT_T(onlySimpleString)) { - NSCParameterAssert(((parseState->token.tokenPtrRange.ptr + 1) < endOfBuffer) && (parseState->token.tokenPtrRange.length >= 2UL) && (((parseState->token.tokenPtrRange.ptr + 1) + (parseState->token.tokenPtrRange.length - 2)) < endOfBuffer)); - parseState->token.value.ptrRange.ptr = parseState->token.tokenPtrRange.ptr + 1; - parseState->token.value.ptrRange.length = parseState->token.tokenPtrRange.length - 2UL; - } else { - parseState->token.value.ptrRange.ptr = parseState->token.tokenBuffer.bytes.ptr; - parseState->token.value.ptrRange.length = tokenBufferIdx; - } - - parseState->token.value.hash = stringHash; - parseState->token.value.type = JKValueTypeString; - parseState->atIndex = (atStringCharacter - parseState->stringBuffer.bytes.ptr); - } - - if(PJK_EXPECT_F(stringState != JSONStringStateFinished)) { jk_error(parseState, @"Invalid string."); } - return(PJK_EXPECT_T(stringState == JSONStringStateFinished) ? 0 : 1); -} - -static int jk_parse_number(JSONKIT_PREPEND(JKParseState) *parseState) { - NSCParameterAssert((parseState != NULL) && (JK_AT_STRING_PTR(parseState) <= JK_END_STRING_PTR(parseState))); - const unsigned char *numberStart = JK_AT_STRING_PTR(parseState); - const unsigned char *endOfBuffer = JK_END_STRING_PTR(parseState); - const unsigned char *atNumberCharacter = NULL; - int numberState = JSONNumberStateWholeNumberStart, isFloatingPoint = 0, isNegative = 0, backup = 0; - size_t startingIndex = parseState->atIndex; - - for(atNumberCharacter = numberStart; (PJK_EXPECT_T(atNumberCharacter < endOfBuffer)) && (PJK_EXPECT_T(!(PJK_EXPECT_F(numberState == JSONNumberStateFinished) || PJK_EXPECT_F(numberState == JSONNumberStateError)))); atNumberCharacter++) { - unsigned long currentChar = (unsigned long)(*atNumberCharacter), lowerCaseCC = currentChar | 0x20UL; - - switch(numberState) { - case JSONNumberStateWholeNumberStart: if (currentChar == '-') { numberState = JSONNumberStateWholeNumberMinus; isNegative = 1; break; } - case JSONNumberStateWholeNumberMinus: if (currentChar == '0') { numberState = JSONNumberStateWholeNumberZero; break; } - else if( (currentChar >= '1') && (currentChar <= '9')) { numberState = JSONNumberStateWholeNumber; break; } - else { /* XXX Add error message */ numberState = JSONNumberStateError; break; } - case JSONNumberStateExponentStart: if( (currentChar == '+') || (currentChar == '-')) { numberState = JSONNumberStateExponentPlusMinus; break; } - case JSONNumberStateFractionalNumberStart: - case JSONNumberStateExponentPlusMinus:if(!((currentChar >= '0') && (currentChar <= '9'))) { /* XXX Add error message */ numberState = JSONNumberStateError; break; } - else { if(numberState == JSONNumberStateFractionalNumberStart) { numberState = JSONNumberStateFractionalNumber; } - else { numberState = JSONNumberStateExponent; } break; } - case JSONNumberStateWholeNumberZero: - case JSONNumberStateWholeNumber: if (currentChar == '.') { numberState = JSONNumberStateFractionalNumberStart; isFloatingPoint = 1; break; } - case JSONNumberStateFractionalNumber: if (lowerCaseCC == 'e') { numberState = JSONNumberStateExponentStart; isFloatingPoint = 1; break; } - case JSONNumberStateExponent: if(!((currentChar >= '0') && (currentChar <= '9')) || (numberState == JSONNumberStateWholeNumberZero)) { numberState = JSONNumberStateFinished; backup = 1; break; } - break; - default: /* XXX Add error message */ numberState = JSONNumberStateError; break; - } - } - - parseState->token.tokenPtrRange.ptr = parseState->stringBuffer.bytes.ptr + startingIndex; - parseState->token.tokenPtrRange.length = (atNumberCharacter - parseState->token.tokenPtrRange.ptr) - backup; - parseState->atIndex = (parseState->token.tokenPtrRange.ptr + parseState->token.tokenPtrRange.length) - parseState->stringBuffer.bytes.ptr; - - if(PJK_EXPECT_T(numberState == JSONNumberStateFinished)) { - unsigned char numberTempBuf[parseState->token.tokenPtrRange.length + 4UL]; - unsigned char *endOfNumber = NULL; - - memcpy(numberTempBuf, parseState->token.tokenPtrRange.ptr, parseState->token.tokenPtrRange.length); - numberTempBuf[parseState->token.tokenPtrRange.length] = 0; - - errno = 0; - - // Treat "-0" as a floating point number, which is capable of representing negative zeros. - if(PJK_EXPECT_F(parseState->token.tokenPtrRange.length == 2UL) && PJK_EXPECT_F(numberTempBuf[1] == '0') && PJK_EXPECT_F(isNegative)) { isFloatingPoint = 1; } - - if(isFloatingPoint) { - parseState->token.value.number.doubleValue = strtod((const char *)numberTempBuf, (char **)&endOfNumber); // strtod is documented to return U+2261 (identical to) 0.0 on an underflow error (along with setting errno to ERANGE). - parseState->token.value.type = JKValueTypeDouble; - parseState->token.value.ptrRange.ptr = (const unsigned char *)&parseState->token.value.number.doubleValue; - parseState->token.value.ptrRange.length = sizeof(double); - parseState->token.value.hash = (PJK_HASH_INIT + parseState->token.value.type); - } else { - if(isNegative) { - parseState->token.value.number.longLongValue = strtoll((const char *)numberTempBuf, (char **)&endOfNumber, 10); - parseState->token.value.type = JKValueTypeLongLong; - parseState->token.value.ptrRange.ptr = (const unsigned char *)&parseState->token.value.number.longLongValue; - parseState->token.value.ptrRange.length = sizeof(long long); - parseState->token.value.hash = (PJK_HASH_INIT + parseState->token.value.type) + (JKHash)parseState->token.value.number.longLongValue; - } else { - parseState->token.value.number.unsignedLongLongValue = strtoull((const char *)numberTempBuf, (char **)&endOfNumber, 10); - parseState->token.value.type = JKValueTypeUnsignedLongLong; - parseState->token.value.ptrRange.ptr = (const unsigned char *)&parseState->token.value.number.unsignedLongLongValue; - parseState->token.value.ptrRange.length = sizeof(unsigned long long); - parseState->token.value.hash = (PJK_HASH_INIT + parseState->token.value.type) + (JKHash)parseState->token.value.number.unsignedLongLongValue; - } - } - - if(PJK_EXPECT_F(errno != 0)) { - numberState = JSONNumberStateError; - if(errno == ERANGE) { - switch(parseState->token.value.type) { - case JKValueTypeDouble: jk_error(parseState, @"The value '%s' could not be represented as a 'double' due to %s.", numberTempBuf, (parseState->token.value.number.doubleValue == 0.0) ? "underflow" : "overflow"); break; // see above for == 0.0. - case JKValueTypeLongLong: jk_error(parseState, @"The value '%s' exceeded the minimum value that could be represented: %lld.", numberTempBuf, parseState->token.value.number.longLongValue); break; - case JKValueTypeUnsignedLongLong: jk_error(parseState, @"The value '%s' exceeded the maximum value that could be represented: %llu.", numberTempBuf, parseState->token.value.number.unsignedLongLongValue); break; - default: jk_error(parseState, @"Internal error: Unknown token value type. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); break; - } - } - } - if(PJK_EXPECT_F(endOfNumber != &numberTempBuf[parseState->token.tokenPtrRange.length]) && PJK_EXPECT_F(numberState != JSONNumberStateError)) { numberState = JSONNumberStateError; jk_error(parseState, @"The conversion function did not consume all of the number tokens characters."); } - - size_t hashIndex = 0UL; - for(hashIndex = 0UL; hashIndex < parseState->token.value.ptrRange.length; hashIndex++) { parseState->token.value.hash = jk_calculateHash(parseState->token.value.hash, parseState->token.value.ptrRange.ptr[hashIndex]); } - } - - if(PJK_EXPECT_F(numberState != JSONNumberStateFinished)) { jk_error(parseState, @"Invalid number."); } - return(PJK_EXPECT_T((numberState == JSONNumberStateFinished)) ? 0 : 1); -} - -PJK_STATIC_INLINE void jk_set_parsed_token(JSONKIT_PREPEND(JKParseState) *parseState, const unsigned char *ptr, size_t length, JKTokenType type, size_t advanceBy) { - parseState->token.tokenPtrRange.ptr = ptr; - parseState->token.tokenPtrRange.length = length; - parseState->token.type = type; - parseState->atIndex += advanceBy; -} - -static size_t jk_parse_is_newline(JSONKIT_PREPEND(JKParseState) *parseState, const unsigned char *atCharacterPtr) { - NSCParameterAssert((parseState != NULL) && (atCharacterPtr != NULL) && (atCharacterPtr >= parseState->stringBuffer.bytes.ptr) && (atCharacterPtr < JK_END_STRING_PTR(parseState))); - const unsigned char *endOfStringPtr = JK_END_STRING_PTR(parseState); - - if(PJK_EXPECT_F(atCharacterPtr >= endOfStringPtr)) { return(0UL); } - - if(PJK_EXPECT_F((*(atCharacterPtr + 0)) == '\n')) { return(1UL); } - if(PJK_EXPECT_F((*(atCharacterPtr + 0)) == '\r')) { if((PJK_EXPECT_T((atCharacterPtr + 1) < endOfStringPtr)) && ((*(atCharacterPtr + 1)) == '\n')) { return(2UL); } return(1UL); } - if(parseState->parseOptionFlags & JSONKIT_PREPEND(JKParseOptionUnicodeNewlines)) { - if((PJK_EXPECT_F((*(atCharacterPtr + 0)) == 0xc2)) && (((atCharacterPtr + 1) < endOfStringPtr) && ((*(atCharacterPtr + 1)) == 0x85))) { return(2UL); } - if((PJK_EXPECT_F((*(atCharacterPtr + 0)) == 0xe2)) && (((atCharacterPtr + 2) < endOfStringPtr) && ((*(atCharacterPtr + 1)) == 0x80) && (((*(atCharacterPtr + 2)) == 0xa8) || ((*(atCharacterPtr + 2)) == 0xa9)))) { return(3UL); } - } - - return(0UL); -} - -PJK_STATIC_INLINE int jk_parse_skip_newline(JSONKIT_PREPEND(JKParseState) *parseState) { - size_t newlineAdvanceAtIndex = 0UL; - if(PJK_EXPECT_F((newlineAdvanceAtIndex = jk_parse_is_newline(parseState, JK_AT_STRING_PTR(parseState))) > 0UL)) { parseState->lineNumber++; parseState->atIndex += (newlineAdvanceAtIndex - 1UL); parseState->lineStartIndex = parseState->atIndex + 1UL; return(1); } - return(0); -} - -PJK_STATIC_INLINE void jk_parse_skip_whitespace(JSONKIT_PREPEND(JKParseState) *parseState) { -#ifndef __clang_analyzer__ - NSCParameterAssert((parseState != NULL) && (JK_AT_STRING_PTR(parseState) <= JK_END_STRING_PTR(parseState))); - const unsigned char *atCharacterPtr = NULL; - const unsigned char *endOfStringPtr = JK_END_STRING_PTR(parseState); - - for(atCharacterPtr = JK_AT_STRING_PTR(parseState); (PJK_EXPECT_T((atCharacterPtr = JK_AT_STRING_PTR(parseState)) < endOfStringPtr)); parseState->atIndex++) { - if(((*(atCharacterPtr + 0)) == ' ') || ((*(atCharacterPtr + 0)) == '\t')) { continue; } - if(jk_parse_skip_newline(parseState)) { continue; } - if(parseState->parseOptionFlags & JSONKIT_PREPEND(JKParseOptionComments)) { - if((PJK_EXPECT_F((*(atCharacterPtr + 0)) == '/')) && (PJK_EXPECT_T((atCharacterPtr + 1) < endOfStringPtr))) { - if((*(atCharacterPtr + 1)) == '/') { - parseState->atIndex++; - for(atCharacterPtr = JK_AT_STRING_PTR(parseState); (PJK_EXPECT_T((atCharacterPtr = JK_AT_STRING_PTR(parseState)) < endOfStringPtr)); parseState->atIndex++) { if(jk_parse_skip_newline(parseState)) { break; } } - continue; - } - if((*(atCharacterPtr + 1)) == '*') { - parseState->atIndex++; - for(atCharacterPtr = JK_AT_STRING_PTR(parseState); (PJK_EXPECT_T((atCharacterPtr = JK_AT_STRING_PTR(parseState)) < endOfStringPtr)); parseState->atIndex++) { - if(jk_parse_skip_newline(parseState)) { continue; } - if(((*(atCharacterPtr + 0)) == '*') && (((atCharacterPtr + 1) < endOfStringPtr) && ((*(atCharacterPtr + 1)) == '/'))) { parseState->atIndex++; break; } - } - continue; - } - } - } - break; - } -#endif -} - -static int jk_parse_next_token(JSONKIT_PREPEND(JKParseState) *parseState) { - NSCParameterAssert((parseState != NULL) && (JK_AT_STRING_PTR(parseState) <= JK_END_STRING_PTR(parseState))); - const unsigned char *atCharacterPtr = NULL; - const unsigned char *endOfStringPtr = JK_END_STRING_PTR(parseState); - unsigned char currentCharacter = 0U; - int stopParsing = 0; - - parseState->prev_atIndex = parseState->atIndex; - parseState->prev_lineNumber = parseState->lineNumber; - parseState->prev_lineStartIndex = parseState->lineStartIndex; - - jk_parse_skip_whitespace(parseState); - - if((JK_AT_STRING_PTR(parseState) == endOfStringPtr)) { stopParsing = 1; } - - if((PJK_EXPECT_T(stopParsing == 0)) && (PJK_EXPECT_T((atCharacterPtr = JK_AT_STRING_PTR(parseState)) < endOfStringPtr))) { - currentCharacter = *atCharacterPtr; - - if(PJK_EXPECT_T(currentCharacter == '"')) { if(PJK_EXPECT_T((stopParsing = jk_parse_string(parseState)) == 0)) { jk_set_parsed_token(parseState, parseState->token.tokenPtrRange.ptr, parseState->token.tokenPtrRange.length, JKTokenTypeString, 0UL); } } - else if(PJK_EXPECT_T(currentCharacter == ':')) { jk_set_parsed_token(parseState, atCharacterPtr, 1UL, JKTokenTypeSeparator, 1UL); } - else if(PJK_EXPECT_T(currentCharacter == ',')) { jk_set_parsed_token(parseState, atCharacterPtr, 1UL, JKTokenTypeComma, 1UL); } - else if((PJK_EXPECT_T(currentCharacter >= '0') && PJK_EXPECT_T(currentCharacter <= '9')) || PJK_EXPECT_T(currentCharacter == '-')) { if(PJK_EXPECT_T((stopParsing = jk_parse_number(parseState)) == 0)) { jk_set_parsed_token(parseState, parseState->token.tokenPtrRange.ptr, parseState->token.tokenPtrRange.length, JKTokenTypeNumber, 0UL); } } - else if(PJK_EXPECT_T(currentCharacter == '{')) { jk_set_parsed_token(parseState, atCharacterPtr, 1UL, JKTokenTypeObjectBegin, 1UL); } - else if(PJK_EXPECT_T(currentCharacter == '}')) { jk_set_parsed_token(parseState, atCharacterPtr, 1UL, JKTokenTypeObjectEnd, 1UL); } - else if(PJK_EXPECT_T(currentCharacter == '[')) { jk_set_parsed_token(parseState, atCharacterPtr, 1UL, JKTokenTypeArrayBegin, 1UL); } - else if(PJK_EXPECT_T(currentCharacter == ']')) { jk_set_parsed_token(parseState, atCharacterPtr, 1UL, JKTokenTypeArrayEnd, 1UL); } - - else if(PJK_EXPECT_T(currentCharacter == 't')) { if(!((PJK_EXPECT_T((atCharacterPtr + 4UL) < endOfStringPtr)) && (PJK_EXPECT_T(atCharacterPtr[1] == 'r')) && (PJK_EXPECT_T(atCharacterPtr[2] == 'u')) && (PJK_EXPECT_T(atCharacterPtr[3] == 'e')))) { stopParsing = 1; /* XXX Add error message */ } else { jk_set_parsed_token(parseState, atCharacterPtr, 4UL, JKTokenTypeTrue, 4UL); } } - else if(PJK_EXPECT_T(currentCharacter == 'f')) { if(!((PJK_EXPECT_T((atCharacterPtr + 5UL) < endOfStringPtr)) && (PJK_EXPECT_T(atCharacterPtr[1] == 'a')) && (PJK_EXPECT_T(atCharacterPtr[2] == 'l')) && (PJK_EXPECT_T(atCharacterPtr[3] == 's')) && (PJK_EXPECT_T(atCharacterPtr[4] == 'e')))) { stopParsing = 1; /* XXX Add error message */ } else { jk_set_parsed_token(parseState, atCharacterPtr, 5UL, JKTokenTypeFalse, 5UL); } } - else if(PJK_EXPECT_T(currentCharacter == 'n')) { if(!((PJK_EXPECT_T((atCharacterPtr + 4UL) < endOfStringPtr)) && (PJK_EXPECT_T(atCharacterPtr[1] == 'u')) && (PJK_EXPECT_T(atCharacterPtr[2] == 'l')) && (PJK_EXPECT_T(atCharacterPtr[3] == 'l')))) { stopParsing = 1; /* XXX Add error message */ } else { jk_set_parsed_token(parseState, atCharacterPtr, 4UL, JKTokenTypeNull, 4UL); } } - else { stopParsing = 1; /* XXX Add error message */ } - } - - if(PJK_EXPECT_F(stopParsing)) { jk_error(parseState, @"Unexpected token, wanted '{', '}', '[', ']', ',', ':', 'true', 'false', 'null', '\"STRING\"', 'NUMBER'."); } - return(stopParsing); -} - -static void jk_error_parse_accept_or3(JSONKIT_PREPEND(JKParseState) *parseState, int state, NSString *or1String, NSString *or2String, NSString *or3String) { - NSString *acceptStrings[16]; - int acceptIdx = 0; - if(state & JKParseAcceptValue) { acceptStrings[acceptIdx++] = or1String; } - if(state & JKParseAcceptComma) { acceptStrings[acceptIdx++] = or2String; } - if(state & JKParseAcceptEnd) { acceptStrings[acceptIdx++] = or3String; } - if(acceptIdx == 1) { jk_error(parseState, @"Expected %@, not '%*.*s'", acceptStrings[0], (int)parseState->token.tokenPtrRange.length, (int)parseState->token.tokenPtrRange.length, parseState->token.tokenPtrRange.ptr); } - else if(acceptIdx == 2) { jk_error(parseState, @"Expected %@ or %@, not '%*.*s'", acceptStrings[0], acceptStrings[1], (int)parseState->token.tokenPtrRange.length, (int)parseState->token.tokenPtrRange.length, parseState->token.tokenPtrRange.ptr); } - else if(acceptIdx == 3) { jk_error(parseState, @"Expected %@, %@, or %@, not '%*.*s", acceptStrings[0], acceptStrings[1], acceptStrings[2], (int)parseState->token.tokenPtrRange.length, (int)parseState->token.tokenPtrRange.length, parseState->token.tokenPtrRange.ptr); } -} - -static void *jk_parse_array(JSONKIT_PREPEND(JKParseState) *parseState) { - size_t startingObjectIndex = parseState->objectStack.index; - int arrayState = JKParseAcceptValueOrEnd, stopParsing = 0; - void *parsedArray = NULL; - - while(PJK_EXPECT_T((PJK_EXPECT_T(stopParsing == 0)) && (PJK_EXPECT_T(parseState->atIndex < parseState->stringBuffer.bytes.length)))) { - if(PJK_EXPECT_F(parseState->objectStack.index > (parseState->objectStack.count - 4UL))) { if(jk_objectStack_resize(&parseState->objectStack, parseState->objectStack.count + 128UL)) { jk_error(parseState, @"Internal error: [array] objectsIndex > %zu, resize failed? %@ line %#ld", (parseState->objectStack.count - 4UL), [NSString stringWithUTF8String:__FILE__], (long)__LINE__); break; } } - - if(PJK_EXPECT_T((stopParsing = jk_parse_next_token(parseState)) == 0)) { - void *object = NULL; -#ifndef NS_BLOCK_ASSERTIONS - parseState->objectStack.objects[parseState->objectStack.index] = NULL; - parseState->objectStack.keys [parseState->objectStack.index] = NULL; -#endif - switch(parseState->token.type) { - case JKTokenTypeNumber: - case JKTokenTypeString: - case JKTokenTypeTrue: - case JKTokenTypeFalse: - case JKTokenTypeNull: - case JKTokenTypeArrayBegin: - case JKTokenTypeObjectBegin: - if(PJK_EXPECT_F((arrayState & JKParseAcceptValue) == 0)) { parseState->errorIsPrev = 1; jk_error(parseState, @"Unexpected value."); stopParsing = 1; break; } - if(PJK_EXPECT_F((object = jk_object_for_token(parseState)) == NULL)) { jk_error(parseState, @"Internal error: Object == NULL"); stopParsing = 1; break; } else { parseState->objectStack.objects[parseState->objectStack.index++] = object; arrayState = JKParseAcceptCommaOrEnd; } - break; - case JKTokenTypeArrayEnd: if(PJK_EXPECT_T(arrayState & JKParseAcceptEnd)) { NSCParameterAssert(parseState->objectStack.index >= startingObjectIndex); parsedArray = (void *)_JKArrayCreate((id *)&parseState->objectStack.objects[startingObjectIndex], (parseState->objectStack.index - startingObjectIndex), parseState->mutableCollections); } else { parseState->errorIsPrev = 1; jk_error(parseState, @"Unexpected ']'."); } stopParsing = 1; break; - case JKTokenTypeComma: if(PJK_EXPECT_T(arrayState & JKParseAcceptComma)) { arrayState = JKParseAcceptValue; } else { parseState->errorIsPrev = 1; jk_error(parseState, @"Unexpected ','."); stopParsing = 1; } break; - default: parseState->errorIsPrev = 1; jk_error_parse_accept_or3(parseState, arrayState, @"a value", @"a comma", @"a ']'"); stopParsing = 1; break; - } - } - } - - if(PJK_EXPECT_F(parsedArray == NULL)) { size_t idx = 0UL; for(idx = startingObjectIndex; idx < parseState->objectStack.index; idx++) { if(parseState->objectStack.objects[idx] != NULL) { CFRelease(parseState->objectStack.objects[idx]); parseState->objectStack.objects[idx] = NULL; } } } -#if !defined(NS_BLOCK_ASSERTIONS) - else { size_t idx = 0UL; for(idx = startingObjectIndex; idx < parseState->objectStack.index; idx++) { parseState->objectStack.objects[idx] = NULL; parseState->objectStack.keys[idx] = NULL; } } -#endif - - parseState->objectStack.index = startingObjectIndex; - return(parsedArray); -} - -static void *jk_create_dictionary(JSONKIT_PREPEND(JKParseState) *parseState, size_t startingObjectIndex) { - void *parsedDictionary = NULL; - - parseState->objectStack.index--; - - parsedDictionary = _JKDictionaryCreate((id *)&parseState->objectStack.keys[startingObjectIndex], (NSUInteger *)&parseState->objectStack.cfHashes[startingObjectIndex], (id *)&parseState->objectStack.objects[startingObjectIndex], (parseState->objectStack.index - startingObjectIndex), parseState->mutableCollections); - - return(parsedDictionary); -} - -static void *jk_parse_dictionary(JSONKIT_PREPEND(JKParseState) *parseState) { - size_t startingObjectIndex = parseState->objectStack.index; - int dictState = JKParseAcceptValueOrEnd, stopParsing = 0; - void *parsedDictionary = NULL; - - while(PJK_EXPECT_T((PJK_EXPECT_T(stopParsing == 0)) && (PJK_EXPECT_T(parseState->atIndex < parseState->stringBuffer.bytes.length)))) { - if(PJK_EXPECT_F(parseState->objectStack.index > (parseState->objectStack.count - 4UL))) { if(jk_objectStack_resize(&parseState->objectStack, parseState->objectStack.count + 128UL)) { jk_error(parseState, @"Internal error: [dictionary] objectsIndex > %zu, resize failed? %@ line #%ld", (parseState->objectStack.count - 4UL), [NSString stringWithUTF8String:__FILE__], (long)__LINE__); break; } } - - size_t objectStackIndex = parseState->objectStack.index++; - parseState->objectStack.keys[objectStackIndex] = NULL; - parseState->objectStack.objects[objectStackIndex] = NULL; - void *key = NULL, *object = NULL; - - if(PJK_EXPECT_T((PJK_EXPECT_T(stopParsing == 0)) && (PJK_EXPECT_T((stopParsing = jk_parse_next_token(parseState)) == 0)))) { - switch(parseState->token.type) { - case JKTokenTypeString: - if(PJK_EXPECT_F((dictState & JKParseAcceptValue) == 0)) { parseState->errorIsPrev = 1; jk_error(parseState, @"Unexpected string."); stopParsing = 1; break; } - if(PJK_EXPECT_F((key = jk_object_for_token(parseState)) == NULL)) { jk_error(parseState, @"Internal error: Key == NULL."); stopParsing = 1; break; } - else { - parseState->objectStack.keys[objectStackIndex] = key; - if(PJK_EXPECT_T(parseState->token.value.cacheItem != NULL)) { if(PJK_EXPECT_F(parseState->token.value.cacheItem->cfHash == 0UL)) { parseState->token.value.cacheItem->cfHash = CFHash(key); } parseState->objectStack.cfHashes[objectStackIndex] = parseState->token.value.cacheItem->cfHash; } - else { parseState->objectStack.cfHashes[objectStackIndex] = CFHash(key); } - } - break; - - case JKTokenTypeObjectEnd: if((PJK_EXPECT_T(dictState & JKParseAcceptEnd))) { NSCParameterAssert(parseState->objectStack.index >= startingObjectIndex); parsedDictionary = jk_create_dictionary(parseState, startingObjectIndex); } else { parseState->errorIsPrev = 1; jk_error(parseState, @"Unexpected '}'."); } stopParsing = 1; break; - case JKTokenTypeComma: if((PJK_EXPECT_T(dictState & JKParseAcceptComma))) { dictState = JKParseAcceptValue; parseState->objectStack.index--; continue; } else { parseState->errorIsPrev = 1; jk_error(parseState, @"Unexpected ','."); stopParsing = 1; } break; - - default: parseState->errorIsPrev = 1; jk_error_parse_accept_or3(parseState, dictState, @"a \"STRING\"", @"a comma", @"a '}'"); stopParsing = 1; break; - } - } - - if(PJK_EXPECT_T(stopParsing == 0)) { - if(PJK_EXPECT_T((stopParsing = jk_parse_next_token(parseState)) == 0)) { if(PJK_EXPECT_F(parseState->token.type != JKTokenTypeSeparator)) { parseState->errorIsPrev = 1; jk_error(parseState, @"Expected ':'."); stopParsing = 1; } } - } - - if((PJK_EXPECT_T(stopParsing == 0)) && (PJK_EXPECT_T((stopParsing = jk_parse_next_token(parseState)) == 0))) { - switch(parseState->token.type) { - case JKTokenTypeNumber: - case JKTokenTypeString: - case JKTokenTypeTrue: - case JKTokenTypeFalse: - case JKTokenTypeNull: - case JKTokenTypeArrayBegin: - case JKTokenTypeObjectBegin: - if(PJK_EXPECT_F((dictState & JKParseAcceptValue) == 0)) { parseState->errorIsPrev = 1; jk_error(parseState, @"Unexpected value."); stopParsing = 1; break; } - if(PJK_EXPECT_F((object = jk_object_for_token(parseState)) == NULL)) { jk_error(parseState, @"Internal error: Object == NULL."); stopParsing = 1; break; } else { parseState->objectStack.objects[objectStackIndex] = object; dictState = JKParseAcceptCommaOrEnd; } - break; - default: parseState->errorIsPrev = 1; jk_error_parse_accept_or3(parseState, dictState, @"a value", @"a comma", @"a '}'"); stopParsing = 1; break; - } - } - } - - if(PJK_EXPECT_F(parsedDictionary == NULL)) { size_t idx = 0UL; for(idx = startingObjectIndex; idx < parseState->objectStack.index; idx++) { if(parseState->objectStack.keys[idx] != NULL) { CFRelease(parseState->objectStack.keys[idx]); parseState->objectStack.keys[idx] = NULL; } if(parseState->objectStack.objects[idx] != NULL) { CFRelease(parseState->objectStack.objects[idx]); parseState->objectStack.objects[idx] = NULL; } } } -#if !defined(NS_BLOCK_ASSERTIONS) - else { size_t idx = 0UL; for(idx = startingObjectIndex; idx < parseState->objectStack.index; idx++) { parseState->objectStack.objects[idx] = NULL; parseState->objectStack.keys[idx] = NULL; } } -#endif - - parseState->objectStack.index = startingObjectIndex; - return(parsedDictionary); -} - -static id json_parse_it(JSONKIT_PREPEND(JKParseState) *parseState) { - id parsedObject = NULL; - int stopParsing = 0; - - while((PJK_EXPECT_T(stopParsing == 0)) && (PJK_EXPECT_T(parseState->atIndex < parseState->stringBuffer.bytes.length))) { - if((PJK_EXPECT_T(stopParsing == 0)) && (PJK_EXPECT_T((stopParsing = jk_parse_next_token(parseState)) == 0))) { - switch(parseState->token.type) { - case JKTokenTypeArrayBegin: - case JKTokenTypeObjectBegin: parsedObject = [(id)jk_object_for_token(parseState) autorelease]; stopParsing = 1; break; - default: jk_error(parseState, @"Expected either '[' or '{'."); stopParsing = 1; break; - } - } - } - - NSCParameterAssert((parseState->objectStack.index == 0) && (JK_AT_STRING_PTR(parseState) <= JK_END_STRING_PTR(parseState))); - - if((parsedObject == NULL) && (JK_AT_STRING_PTR(parseState) == JK_END_STRING_PTR(parseState))) { jk_error(parseState, @"Reached the end of the buffer."); } - if(parsedObject == NULL) { jk_error(parseState, @"Unable to parse JSON."); } - - if((parsedObject != NULL) && (JK_AT_STRING_PTR(parseState) < JK_END_STRING_PTR(parseState))) { - jk_parse_skip_whitespace(parseState); - if((parsedObject != NULL) && ((parseState->parseOptionFlags & JSONKIT_PREPEND(JKParseOptionPermitTextAfterValidJSON)) == 0) && (JK_AT_STRING_PTR(parseState) < JK_END_STRING_PTR(parseState))) { - jk_error(parseState, @"A valid JSON object was parsed but there were additional non-white-space characters remaining."); - parsedObject = NULL; - } - } - - return(parsedObject); -} - -//////////// -#pragma mark - -#pragma mark Object cache - -// This uses a Galois Linear Feedback Shift Register (LFSR) PRNG to pick which item in the cache to age. It has a period of (2^32)-1. -// NOTE: A LFSR *MUST* be initialized to a non-zero value and must always have a non-zero value. The LFSR is initalized to 1 in -initWithParseOptions: -PJK_STATIC_INLINE void jk_cache_age(JSONKIT_PREPEND(JKParseState) *parseState) { - NSCParameterAssert((parseState != NULL) && (parseState->cache.prng_lfsr != 0U)); - parseState->cache.prng_lfsr = (parseState->cache.prng_lfsr >> 1) ^ ((0U - (parseState->cache.prng_lfsr & 1U)) & 0x80200003U); - parseState->cache.age[parseState->cache.prng_lfsr & (parseState->cache.count - 1UL)] >>= 1; -} - -// The object cache is nothing more than a hash table with open addressing collision resolution that is bounded by JK_CACHE_PROBES attempts. -// -// The hash table is a linear C array of JKTokenCacheItem. The terms "item" and "bucket" are synonymous with the index in to the cache array, i.e. cache.items[bucket]. -// -// Items in the cache have an age associated with them. An items age is incremented using saturating unsigned arithmetic and decremeted using unsigned right shifts. -// Thus, an items age is managed using an AIMD policy- additive increase, multiplicative decrease. All age calculations and manipulations are branchless. -// The primitive C type MUST be unsigned. It is currently a "char", which allows (at a minimum and in practice) 8 bits. -// -// A "useable bucket" is a bucket that is not in use (never populated), or has an age == 0. -// -// When an item is found in the cache, it's age is incremented. -// If a useable bucket hasn't been found, the current item (bucket) is aged along with two random items. -// -// If a value is not found in the cache, and no useable bucket has been found, that value is not added to the cache. - -static void *jk_cachedObjects(JSONKIT_PREPEND(JKParseState) *parseState) { - unsigned long bucket = parseState->token.value.hash & (parseState->cache.count - 1UL), setBucket = 0UL, useableBucket = 0UL, x = 0UL; - void *parsedAtom = NULL; - - if(PJK_EXPECT_F(parseState->token.value.ptrRange.length == 0UL) && PJK_EXPECT_T(parseState->token.value.type == JKValueTypeString)) { return(@""); } - - for(x = 0UL; x < PJK_CACHE_PROBES; x++) { - if(PJK_EXPECT_F(parseState->cache.items[bucket].object == NULL)) { setBucket = 1UL; useableBucket = bucket; break; } - - if((PJK_EXPECT_T(parseState->cache.items[bucket].hash == parseState->token.value.hash)) && (PJK_EXPECT_T(parseState->cache.items[bucket].size == parseState->token.value.ptrRange.length)) && (PJK_EXPECT_T(parseState->cache.items[bucket].type == parseState->token.value.type)) && (PJK_EXPECT_T(parseState->cache.items[bucket].bytes != NULL)) && (PJK_EXPECT_T(memcmp(parseState->cache.items[bucket].bytes, parseState->token.value.ptrRange.ptr, parseState->token.value.ptrRange.length) == 0U))) { - parseState->cache.age[bucket] = (((uint32_t)parseState->cache.age[bucket]) + 1U) - (((((uint32_t)parseState->cache.age[bucket]) + 1U) >> 31) ^ 1U); - parseState->token.value.cacheItem = &parseState->cache.items[bucket]; - NSCParameterAssert(parseState->cache.items[bucket].object != NULL); - return((void *)CFRetain(parseState->cache.items[bucket].object)); - } else { - if(PJK_EXPECT_F(setBucket == 0UL) && PJK_EXPECT_F(parseState->cache.age[bucket] == 0U)) { setBucket = 1UL; useableBucket = bucket; } - if(PJK_EXPECT_F(setBucket == 0UL)) { parseState->cache.age[bucket] >>= 1; jk_cache_age(parseState); jk_cache_age(parseState); } - // This is the open addressing function. The values length and type are used as a form of "double hashing" to distribute values with the same effective value hash across different object cache buckets. - // The values type is a prime number that is relatively coprime to the other primes in the set of value types and the number of hash table buckets. - bucket = (parseState->token.value.hash + (parseState->token.value.ptrRange.length * (x + 1UL)) + (parseState->token.value.type * (x + 1UL)) + (3UL * (x + 1UL))) & (parseState->cache.count - 1UL); - } - } - - switch(parseState->token.value.type) { - case JKValueTypeString: parsedAtom = (void *)CFStringCreateWithBytes(NULL, parseState->token.value.ptrRange.ptr, parseState->token.value.ptrRange.length, kCFStringEncodingUTF8, 0); break; - case JKValueTypeLongLong: parsedAtom = (void *)CFNumberCreate(NULL, kCFNumberLongLongType, &parseState->token.value.number.longLongValue); break; - case JKValueTypeUnsignedLongLong: - if(parseState->token.value.number.unsignedLongLongValue <= LLONG_MAX) { parsedAtom = (void *)CFNumberCreate(NULL, kCFNumberLongLongType, &parseState->token.value.number.unsignedLongLongValue); } - else { parsedAtom = (void *)parseState->objCImpCache.NSNumberInitWithUnsignedLongLong(parseState->objCImpCache.NSNumberAlloc(parseState->objCImpCache.NSNumberClass, @selector(alloc)), @selector(initWithUnsignedLongLong:), parseState->token.value.number.unsignedLongLongValue); } - break; - case JKValueTypeDouble: parsedAtom = (void *)CFNumberCreate(NULL, kCFNumberDoubleType, &parseState->token.value.number.doubleValue); break; - default: jk_error(parseState, @"Internal error: Unknown token value type. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); break; - } - - if(PJK_EXPECT_T(setBucket) && (PJK_EXPECT_T(parsedAtom != NULL))) { - bucket = useableBucket; - if(PJK_EXPECT_T((parseState->cache.items[bucket].object != NULL))) { CFRelease(parseState->cache.items[bucket].object); parseState->cache.items[bucket].object = NULL; } - - if(PJK_EXPECT_T((parseState->cache.items[bucket].bytes = (unsigned char *)reallocf(parseState->cache.items[bucket].bytes, parseState->token.value.ptrRange.length)) != NULL)) { - memcpy(parseState->cache.items[bucket].bytes, parseState->token.value.ptrRange.ptr, parseState->token.value.ptrRange.length); - parseState->cache.items[bucket].object = (void *)CFRetain(parsedAtom); - parseState->cache.items[bucket].hash = parseState->token.value.hash; - parseState->cache.items[bucket].cfHash = 0UL; - parseState->cache.items[bucket].size = parseState->token.value.ptrRange.length; - parseState->cache.items[bucket].type = parseState->token.value.type; - parseState->token.value.cacheItem = &parseState->cache.items[bucket]; - parseState->cache.age[bucket] = PJK_INIT_CACHE_AGE; - } else { // The realloc failed, so clear the appropriate fields. - parseState->cache.items[bucket].hash = 0UL; - parseState->cache.items[bucket].cfHash = 0UL; - parseState->cache.items[bucket].size = 0UL; - parseState->cache.items[bucket].type = 0UL; - } - } - - return(parsedAtom); -} - - -static void *jk_object_for_token(JSONKIT_PREPEND(JKParseState) *parseState) { - void *parsedAtom = NULL; - - parseState->token.value.cacheItem = NULL; - switch(parseState->token.type) { - case JKTokenTypeString: parsedAtom = jk_cachedObjects(parseState); break; - case JKTokenTypeNumber: parsedAtom = jk_cachedObjects(parseState); break; - case JKTokenTypeObjectBegin: parsedAtom = jk_parse_dictionary(parseState); break; - case JKTokenTypeArrayBegin: parsedAtom = jk_parse_array(parseState); break; - case JKTokenTypeTrue: parsedAtom = (void *)kCFBooleanTrue; break; - case JKTokenTypeFalse: parsedAtom = (void *)kCFBooleanFalse; break; - case JKTokenTypeNull: parsedAtom = (void *)kCFNull; break; - default: jk_error(parseState, @"Internal error: Unknown token type. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); break; - } - - return(parsedAtom); -} - -#pragma mark - -@implementation JSONKIT_PREPEND(JSONDecoder) - -+ (id)decoder -{ - return([self decoderWithParseOptions:JSONKIT_PREPEND(JKParseOptionStrict)]); -} - -+ (id)decoderWithParseOptions:(JSONKIT_PREPEND(JKParseOptionFlags))parseOptionFlags -{ - return([[[self alloc] initWithParseOptions:parseOptionFlags] autorelease]); -} - -- (id)init -{ - return([self initWithParseOptions:JSONKIT_PREPEND(JKParseOptionStrict)]); -} - -- (id)initWithParseOptions:(JSONKIT_PREPEND(JKParseOptionFlags))parseOptionFlags -{ - if((self = [super init]) == NULL) { return(NULL); } - - if(parseOptionFlags & ~JSONKIT_PREPEND(JKParseOptionValidFlags)) { [self autorelease]; [NSException raise:NSInvalidArgumentException format:@"Invalid parse options."]; } - - if((parseState = (JSONKIT_PREPEND(JKParseState) *)calloc(1UL, sizeof(JSONKIT_PREPEND(JKParseState)))) == NULL) { goto errorExit; } - - parseState->parseOptionFlags = parseOptionFlags; - - parseState->token.tokenBuffer.roundSizeUpToMultipleOf = 4096UL; - parseState->objectStack.roundSizeUpToMultipleOf = 2048UL; - - parseState->objCImpCache.NSNumberClass = _jk_NSNumberClass; - parseState->objCImpCache.NSNumberAlloc = _jk_NSNumberAllocImp; - parseState->objCImpCache.NSNumberInitWithUnsignedLongLong = _jk_NSNumberInitWithUnsignedLongLongImp; - - parseState->cache.prng_lfsr = 1U; - parseState->cache.count = PJK_CACHE_SLOTS; - if((parseState->cache.items = (JKTokenCacheItem *)calloc(1UL, sizeof(JKTokenCacheItem) * parseState->cache.count)) == NULL) { goto errorExit; } - - return(self); - - errorExit: - if(self) { [self autorelease]; self = NULL; } - return(NULL); -} - -// This is here primarily to support the NSString and NSData convenience functions so the autoreleased JSONDecoder can release most of its resources before the pool pops. -static void _JSONDecoderCleanup(JSONKIT_PREPEND(JSONDecoder) *decoder) { - if((decoder != NULL) && (decoder->parseState != NULL)) { - jk_managedBuffer_release(&decoder->parseState->token.tokenBuffer); - jk_objectStack_release(&decoder->parseState->objectStack); - - [decoder clearCache]; - if(decoder->parseState->cache.items != NULL) { free(decoder->parseState->cache.items); decoder->parseState->cache.items = NULL; } - - free(decoder->parseState); decoder->parseState = NULL; - } -} - -- (void)dealloc -{ - _JSONDecoderCleanup(self); - [super dealloc]; -} - -- (void)clearCache -{ - if(PJK_EXPECT_T(parseState != NULL)) { - if(PJK_EXPECT_T(parseState->cache.items != NULL)) { - size_t idx = 0UL; - for(idx = 0UL; idx < parseState->cache.count; idx++) { - if(PJK_EXPECT_T(parseState->cache.items[idx].object != NULL)) { CFRelease(parseState->cache.items[idx].object); parseState->cache.items[idx].object = NULL; } - if(PJK_EXPECT_T(parseState->cache.items[idx].bytes != NULL)) { free(parseState->cache.items[idx].bytes); parseState->cache.items[idx].bytes = NULL; } - memset(&parseState->cache.items[idx], 0, sizeof(JKTokenCacheItem)); - parseState->cache.age[idx] = 0U; - } - } - } -} - -// This needs to be completely rewritten. -static id _JKParseUTF8String(JSONKIT_PREPEND(JKParseState) *parseState, BOOL mutableCollections, const unsigned char *string, size_t length, NSError **error) { - NSCParameterAssert((parseState != NULL) && (string != NULL) && (parseState->cache.prng_lfsr != 0U)); - parseState->stringBuffer.bytes.ptr = string; - parseState->stringBuffer.bytes.length = length; - parseState->atIndex = 0UL; - parseState->lineNumber = 1UL; - parseState->lineStartIndex = 0UL; - parseState->prev_atIndex = 0UL; - parseState->prev_lineNumber = 1UL; - parseState->prev_lineStartIndex = 0UL; - parseState->error = NULL; - parseState->errorIsPrev = 0; - parseState->mutableCollections = (mutableCollections == NO) ? NO : YES; - - unsigned char stackTokenBuffer[PJK_TOKENBUFFER_SIZE] PJK_ALIGNED(64); - jk_managedBuffer_setToStackBuffer(&parseState->token.tokenBuffer, stackTokenBuffer, sizeof(stackTokenBuffer)); - - void *stackObjects [PJK_STACK_OBJS] PJK_ALIGNED(64); - void *stackKeys [PJK_STACK_OBJS] PJK_ALIGNED(64); - CFHashCode stackCFHashes[PJK_STACK_OBJS] PJK_ALIGNED(64); - jk_objectStack_setToStackBuffer(&parseState->objectStack, stackObjects, stackKeys, stackCFHashes, PJK_STACK_OBJS); - - id parsedJSON = json_parse_it(parseState); - - if((error != NULL) && (parseState->error != NULL)) { *error = parseState->error; } - - jk_managedBuffer_release(&parseState->token.tokenBuffer); - jk_objectStack_release(&parseState->objectStack); - - parseState->stringBuffer.bytes.ptr = NULL; - parseState->stringBuffer.bytes.length = 0UL; - parseState->atIndex = 0UL; - parseState->lineNumber = 1UL; - parseState->lineStartIndex = 0UL; - parseState->prev_atIndex = 0UL; - parseState->prev_lineNumber = 1UL; - parseState->prev_lineStartIndex = 0UL; - parseState->error = NULL; - parseState->errorIsPrev = 0; - parseState->mutableCollections = NO; - - return(parsedJSON); -} - -//////////// -#pragma mark Deprecated as of v1.4 -//////////// - -// Deprecated in JSONKit v1.4. Use objectWithUTF8String:length: instead. -- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length -{ - return([self objectWithUTF8String:string length:length error:NULL]); -} - -// Deprecated in JSONKit v1.4. Use objectWithUTF8String:length:error: instead. -- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length error:(NSError **)error -{ - return([self objectWithUTF8String:string length:length error:error]); -} - -// Deprecated in JSONKit v1.4. Use objectWithData: instead. -- (id)parseJSONData:(NSData *)jsonData -{ - return([self objectWithData:jsonData error:NULL]); -} - -// Deprecated in JSONKit v1.4. Use objectWithData:error: instead. -- (id)parseJSONData:(NSData *)jsonData error:(NSError **)error -{ - return([self objectWithData:jsonData error:error]); -} - -//////////// -#pragma mark Methods that return immutable collection objects -//////////// - -- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length -{ - return([self objectWithUTF8String:string length:length error:NULL]); -} - -- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error -{ - if(parseState == NULL) { [NSException raise:NSInternalInconsistencyException format:@"parseState is NULL."]; } - if(string == NULL) { [NSException raise:NSInvalidArgumentException format:@"The string argument is NULL."]; } - - return(_JKParseUTF8String(parseState, NO, string, (size_t)length, error)); -} - -- (id)objectWithData:(NSData *)jsonData -{ - return([self objectWithData:jsonData error:NULL]); -} - -- (id)objectWithData:(NSData *)jsonData error:(NSError **)error -{ - if(jsonData == NULL) { [NSException raise:NSInvalidArgumentException format:@"The jsonData argument is NULL."]; } - return([self objectWithUTF8String:(const unsigned char *)[jsonData bytes] length:[jsonData length] error:error]); -} - -//////////// -#pragma mark Methods that return mutable collection objects -//////////// - -- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length -{ - return([self mutableObjectWithUTF8String:string length:length error:NULL]); -} - -- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error -{ - if(parseState == NULL) { [NSException raise:NSInternalInconsistencyException format:@"parseState is NULL."]; } - if(string == NULL) { [NSException raise:NSInvalidArgumentException format:@"The string argument is NULL."]; } - - return(_JKParseUTF8String(parseState, YES, string, (size_t)length, error)); -} - -- (id)mutableObjectWithData:(NSData *)jsonData -{ - return([self mutableObjectWithData:jsonData error:NULL]); -} - -- (id)mutableObjectWithData:(NSData *)jsonData error:(NSError **)error -{ - if(jsonData == NULL) { [NSException raise:NSInvalidArgumentException format:@"The jsonData argument is NULL."]; } - return([self mutableObjectWithUTF8String:(const unsigned char *)[jsonData bytes] length:[jsonData length] error:error]); -} - -@end - -/* - The NSString and NSData convenience methods need a little bit of explanation. - - Prior to JSONKit v1.4, the NSString -objectFromJSONStringWithParseOptions:error: method looked like - - const unsigned char *utf8String = (const unsigned char *)[self UTF8String]; - if(utf8String == NULL) { return(NULL); } - size_t utf8Length = strlen((const char *)utf8String); - return([[JSONDecoder decoderWithParseOptions:parseOptionFlags] parseUTF8String:utf8String length:utf8Length error:error]); - - This changed with v1.4 to a more complicated method. The reason for this is to keep the amount of memory that is - allocated, but not yet freed because it is dependent on the autorelease pool to pop before it can be reclaimed. - - In the simpler v1.3 code, this included all the bytes used to store the -UTF8String along with the JSONDecoder and all its overhead. - - Now we use an autoreleased CFMutableData that is sized to the UTF8 length of the NSString in question and is used to hold the UTF8 - conversion of said string. - - Once parsed, the CFMutableData has its length set to 0. This should, hopefully, allow the CFMutableData to realloc and/or free - the buffer. - - Another change made was a slight modification to JSONDecoder so that most of the cleanup work that was done in -dealloc was moved - to a private, internal function. These convenience routines keep the pointer to the autoreleased JSONDecoder and calls - _JSONDecoderCleanup() to early release the decoders resources since we already know that particular decoder is not going to be used - again. - - If everything goes smoothly, this will most likely result in perhaps a few hundred bytes that are allocated but waiting for the - autorelease pool to pop. This is compared to the thousands and easily hundreds of thousands of bytes that would have been in - autorelease limbo. It's more complicated for us, but a win for the user. - - Autorelease objects are used in case things don't go smoothly. By having them autoreleased, we effectively guarantee that our - requirement to -release the object is always met, not matter what goes wrong. The downside is having a an object or two in - autorelease limbo, but we've done our best to minimize that impact, so it all balances out. - */ - -@implementation NSString (JSONKIT_PREPEND(JSONKitDeserializing)) - -static id _NSStringObjectFromJSONString(NSString *jsonString, JSONKIT_PREPEND(JKParseOptionFlags) parseOptionFlags, NSError **error, BOOL mutableCollection) { - id returnObject = NULL; - CFMutableDataRef mutableData = NULL; - JSONKIT_PREPEND(JSONDecoder) *decoder = NULL; - - CFIndex stringLength = CFStringGetLength((CFStringRef)jsonString); - NSUInteger stringUTF8Length = [jsonString lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; - - if((mutableData = (CFMutableDataRef)[(id)CFDataCreateMutable(NULL, (NSUInteger)stringUTF8Length) autorelease]) != NULL) { - UInt8 *utf8String = CFDataGetMutableBytePtr(mutableData); - CFIndex usedBytes = 0L, convertedCount = 0L; - - convertedCount = CFStringGetBytes((CFStringRef)jsonString, CFRangeMake(0L, stringLength), kCFStringEncodingUTF8, '?', NO, utf8String, (NSUInteger)stringUTF8Length, &usedBytes); - if(PJK_EXPECT_F(convertedCount != stringLength) || PJK_EXPECT_F(usedBytes < 0L)) { if(error != NULL) { *error = [NSError errorWithDomain:@"JKErrorDomain" code:-1L userInfo:[NSDictionary dictionaryWithObject:@"An error occurred converting the contents of a NSString to UTF8." forKey:NSLocalizedDescriptionKey]]; } goto exitNow; } - - if(mutableCollection == NO) { returnObject = [(decoder = [JSONKIT_PREPEND(JSONDecoder) decoderWithParseOptions:parseOptionFlags]) objectWithUTF8String:(const unsigned char *)utf8String length:(size_t)usedBytes error:error]; } - else { returnObject = [(decoder = [JSONKIT_PREPEND(JSONDecoder) decoderWithParseOptions:parseOptionFlags]) mutableObjectWithUTF8String:(const unsigned char *)utf8String length:(size_t)usedBytes error:error]; } - } - -exitNow: - if(mutableData != NULL) { CFDataSetLength(mutableData, 0L); } - if(decoder != NULL) { _JSONDecoderCleanup(decoder); } - return(returnObject); -} - -- (id)JSONKIT_PREPEND(objectFromJSONString) -{ - return([self JSONKIT_PREPEND(objectFromJSONStringWithParseOptions):JSONKIT_PREPEND(JKParseOptionStrict) error:NULL]); -} - -- (id)JSONKIT_PREPEND(objectFromJSONStringWithParseOptions):(JSONKIT_PREPEND(JKParseOptionFlags))parseOptionFlags -{ - return([self JSONKIT_PREPEND(objectFromJSONStringWithParseOptions):parseOptionFlags error:NULL]); -} - -- (id)JSONKIT_PREPEND(objectFromJSONStringWithParseOptions):(JSONKIT_PREPEND(JKParseOptionFlags))parseOptionFlags error:(NSError **)error -{ - return(_NSStringObjectFromJSONString(self, parseOptionFlags, error, NO)); -} - - -- (id)JSONKIT_PREPEND(mutableObjectFromJSONString) -{ - return([self JSONKIT_PREPEND(mutableObjectFromJSONStringWithParseOptions):JSONKIT_PREPEND(JKParseOptionStrict) error:NULL]); -} - -- (id)JSONKIT_PREPEND(mutableObjectFromJSONStringWithParseOptions):(JSONKIT_PREPEND(JKParseOptionFlags))parseOptionFlags -{ - return([self JSONKIT_PREPEND(mutableObjectFromJSONStringWithParseOptions):parseOptionFlags error:NULL]); -} - -- (id)JSONKIT_PREPEND(mutableObjectFromJSONStringWithParseOptions):(JSONKIT_PREPEND(JKParseOptionFlags))parseOptionFlags error:(NSError **)error -{ - return(_NSStringObjectFromJSONString(self, parseOptionFlags, error, YES)); -} - -@end - -@implementation NSData (JSONKIT_PREPEND(JSONKitDeserializing)) - -- (id)JSONKIT_PREPEND(objectFromJSONData) -{ - return([self JSONKIT_PREPEND(objectFromJSONDataWithParseOptions):JSONKIT_PREPEND(JKParseOptionStrict) error:NULL]); -} - -- (id)JSONKIT_PREPEND(objectFromJSONDataWithParseOptions):(JSONKIT_PREPEND(JKParseOptionFlags))parseOptionFlags -{ - return([self JSONKIT_PREPEND(objectFromJSONDataWithParseOptions):parseOptionFlags error:NULL]); -} - -- (id)JSONKIT_PREPEND(objectFromJSONDataWithParseOptions):(JSONKIT_PREPEND(JKParseOptionFlags))parseOptionFlags error:(NSError **)error -{ - JSONKIT_PREPEND(JSONDecoder) *decoder = NULL; - id returnObject = [(decoder = [JSONKIT_PREPEND(JSONDecoder) decoderWithParseOptions:parseOptionFlags]) objectWithData:self error:error]; - if(decoder != NULL) { _JSONDecoderCleanup(decoder); } - return(returnObject); -} - -- (id)JSONKIT_PREPEND(mutableObjectFromJSONData) -{ - return([self JSONKIT_PREPEND(mutableObjectFromJSONDataWithParseOptions):JSONKIT_PREPEND(JKParseOptionStrict) error:NULL]); -} - -- (id)JSONKIT_PREPEND(mutableObjectFromJSONDataWithParseOptions):(JSONKIT_PREPEND(JKParseOptionFlags))parseOptionFlags -{ - return([self JSONKIT_PREPEND(mutableObjectFromJSONDataWithParseOptions):parseOptionFlags error:NULL]); -} - -- (id)JSONKIT_PREPEND(mutableObjectFromJSONDataWithParseOptions):(JSONKIT_PREPEND(JKParseOptionFlags))parseOptionFlags error:(NSError **)error -{ - JSONKIT_PREPEND(JSONDecoder) *decoder = NULL; - id returnObject = [(decoder = [JSONKIT_PREPEND(JSONDecoder) decoderWithParseOptions:parseOptionFlags]) mutableObjectWithData:self error:error]; - if(decoder != NULL) { _JSONDecoderCleanup(decoder); } - return(returnObject); -} - - -@end - -//////////// -#pragma mark - -#pragma mark Encoding / deserializing functions - -static void jk_encode_error(JKEncodeState *encodeState, NSString *format, ...) { - NSCParameterAssert((encodeState != NULL) && (format != NULL)); - - va_list varArgsList; - va_start(varArgsList, format); - NSString *formatString = [[[NSString alloc] initWithFormat:format arguments:varArgsList] autorelease]; - va_end(varArgsList); - - if(encodeState->error == NULL) { - encodeState->error = [NSError errorWithDomain:@"JKErrorDomain" code:-1L userInfo: - [NSDictionary dictionaryWithObjectsAndKeys: - formatString, NSLocalizedDescriptionKey, - NULL]]; - } -} - -PJK_STATIC_INLINE void jk_encode_updateCache(JKEncodeState *encodeState, JKEncodeCache *cacheSlot, size_t startingAtIndex, id object) { - NSCParameterAssert(encodeState != NULL); - if(PJK_EXPECT_T(cacheSlot != NULL)) { - NSCParameterAssert((object != NULL) && (startingAtIndex <= encodeState->atIndex)); - cacheSlot->object = object; - cacheSlot->offset = startingAtIndex; - cacheSlot->length = (size_t)(encodeState->atIndex - startingAtIndex); - } -} - -static int jk_encode_printf(JKEncodeState *encodeState, JKEncodeCache *cacheSlot, size_t startingAtIndex, id object, const char *format, ...) { - va_list varArgsList, varArgsListCopy; - va_start(varArgsList, format); - va_copy(varArgsListCopy, varArgsList); - - NSCParameterAssert((encodeState != NULL) && (encodeState->atIndex < encodeState->stringBuffer.bytes.length) && (startingAtIndex <= encodeState->atIndex) && (format != NULL)); - - ssize_t formattedStringLength = 0L; - int returnValue = 0; - - if(PJK_EXPECT_T((formattedStringLength = vsnprintf((char *)&encodeState->stringBuffer.bytes.ptr[encodeState->atIndex], (encodeState->stringBuffer.bytes.length - encodeState->atIndex), format, varArgsList)) >= (ssize_t)(encodeState->stringBuffer.bytes.length - encodeState->atIndex))) { - NSCParameterAssert(((encodeState->atIndex + (formattedStringLength * 2UL) + 256UL) > encodeState->stringBuffer.bytes.length)); - if(PJK_EXPECT_F(((encodeState->atIndex + (formattedStringLength * 2UL) + 256UL) > encodeState->stringBuffer.bytes.length)) && PJK_EXPECT_F((jk_managedBuffer_resize(&encodeState->stringBuffer, encodeState->atIndex + (formattedStringLength * 2UL)+ 4096UL) == NULL))) { jk_encode_error(encodeState, @"Unable to resize temporary buffer."); returnValue = 1; goto exitNow; } - if(PJK_EXPECT_F((formattedStringLength = vsnprintf((char *)&encodeState->stringBuffer.bytes.ptr[encodeState->atIndex], (encodeState->stringBuffer.bytes.length - encodeState->atIndex), format, varArgsListCopy)) >= (ssize_t)(encodeState->stringBuffer.bytes.length - encodeState->atIndex))) { jk_encode_error(encodeState, @"vsnprintf failed unexpectedly."); returnValue = 1; goto exitNow; } - } - -exitNow: - va_end(varArgsList); - va_end(varArgsListCopy); - if(PJK_EXPECT_T(returnValue == 0)) { encodeState->atIndex += formattedStringLength; jk_encode_updateCache(encodeState, cacheSlot, startingAtIndex, object); } - return(returnValue); -} - -static int jk_encode_write(JKEncodeState *encodeState, JKEncodeCache *cacheSlot, size_t startingAtIndex, id object, const char *format) { - NSCParameterAssert((encodeState != NULL) && (encodeState->atIndex < encodeState->stringBuffer.bytes.length) && (startingAtIndex <= encodeState->atIndex) && (format != NULL)); - if(PJK_EXPECT_F(((encodeState->atIndex + strlen(format) + 256UL) > encodeState->stringBuffer.bytes.length)) && PJK_EXPECT_F((jk_managedBuffer_resize(&encodeState->stringBuffer, encodeState->atIndex + strlen(format) + 1024UL) == NULL))) { jk_encode_error(encodeState, @"Unable to resize temporary buffer."); return(1); } - - size_t formatIdx = 0UL; - for(formatIdx = 0UL; format[formatIdx] != 0; formatIdx++) { NSCParameterAssert(encodeState->atIndex < encodeState->stringBuffer.bytes.length); encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = format[formatIdx]; } - jk_encode_updateCache(encodeState, cacheSlot, startingAtIndex, object); - return(0); -} - -static int jk_encode_writePrettyPrintWhiteSpace(JKEncodeState *encodeState) { - NSCParameterAssert((encodeState != NULL) && ((encodeState->serializeOptionFlags & JSONKIT_PREPEND(JKSerializeOptionPretty)) != 0UL)); - if(PJK_EXPECT_F((encodeState->atIndex + ((encodeState->depth + 1UL) * 2UL) + 16UL) > encodeState->stringBuffer.bytes.length) && PJK_EXPECT_T(jk_managedBuffer_resize(&encodeState->stringBuffer, encodeState->atIndex + ((encodeState->depth + 1UL) * 2UL) + 4096UL) == NULL)) { jk_encode_error(encodeState, @"Unable to resize temporary buffer."); return(1); } - encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\n'; - size_t depthWhiteSpace = 0UL; - for(depthWhiteSpace = 0UL; depthWhiteSpace < (encodeState->depth * 2UL); depthWhiteSpace++) { NSCParameterAssert(encodeState->atIndex < encodeState->stringBuffer.bytes.length); encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = ' '; } - return(0); -} - -static int jk_encode_write1slow(JKEncodeState *encodeState, ssize_t depthChange, const char *format) { - NSCParameterAssert((encodeState != NULL) && (encodeState->atIndex < encodeState->stringBuffer.bytes.length) && (format != NULL) && ((depthChange >= -1L) && (depthChange <= 1L)) && ((encodeState->depth == 0UL) ? (depthChange >= 0L) : 1) && ((encodeState->serializeOptionFlags & JSONKIT_PREPEND(JKSerializeOptionPretty)) != 0UL)); - if(PJK_EXPECT_F((encodeState->atIndex + ((encodeState->depth + 1UL) * 2UL) + 16UL) > encodeState->stringBuffer.bytes.length) && PJK_EXPECT_F(jk_managedBuffer_resize(&encodeState->stringBuffer, encodeState->atIndex + ((encodeState->depth + 1UL) * 2UL) + 4096UL) == NULL)) { jk_encode_error(encodeState, @"Unable to resize temporary buffer."); return(1); } - encodeState->depth += depthChange; - if(PJK_EXPECT_T(format[0] == ':')) { encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = format[0]; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = ' '; } - else { - if(PJK_EXPECT_F(depthChange == -1L)) { if(PJK_EXPECT_F(jk_encode_writePrettyPrintWhiteSpace(encodeState))) { return(1); } } - encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = format[0]; - if(PJK_EXPECT_T(depthChange != -1L)) { if(PJK_EXPECT_F(jk_encode_writePrettyPrintWhiteSpace(encodeState))) { return(1); } } - } - NSCParameterAssert(encodeState->atIndex < encodeState->stringBuffer.bytes.length); - return(0); -} - -static int jk_encode_write1fast(JKEncodeState *encodeState, ssize_t depthChange PJK_UNUSED_ARG, const char *format) { - NSCParameterAssert((encodeState != NULL) && (encodeState->atIndex < encodeState->stringBuffer.bytes.length) && ((encodeState->serializeOptionFlags & JSONKIT_PREPEND(JKSerializeOptionPretty)) == 0UL)); - if(PJK_EXPECT_T((encodeState->atIndex + 4UL) < encodeState->stringBuffer.bytes.length)) { encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = format[0]; } - else { return(jk_encode_write(encodeState, NULL, 0UL, NULL, format)); } - return(0); -} - -static int jk_encode_writen(JKEncodeState *encodeState, JKEncodeCache *cacheSlot, size_t startingAtIndex, id object, const char *format, size_t length) { - NSCParameterAssert((encodeState != NULL) && (encodeState->atIndex < encodeState->stringBuffer.bytes.length) && (startingAtIndex <= encodeState->atIndex)); - if(PJK_EXPECT_F((encodeState->stringBuffer.bytes.length - encodeState->atIndex) < (length + 4UL))) { if(jk_managedBuffer_resize(&encodeState->stringBuffer, encodeState->atIndex + 4096UL + length) == NULL) { jk_encode_error(encodeState, @"Unable to resize temporary buffer."); return(1); } } - memcpy(encodeState->stringBuffer.bytes.ptr + encodeState->atIndex, format, length); - encodeState->atIndex += length; - jk_encode_updateCache(encodeState, cacheSlot, startingAtIndex, object); - return(0); -} - -PJK_STATIC_INLINE JKHash jk_encode_object_hash(void *objectPtr) { - return( ( (((JKHash)objectPtr) >> 21) ^ (((JKHash)objectPtr) >> 9) ) + (((JKHash)objectPtr) >> 4) ); -} - -static int jk_encode_add_atom_to_buffer(JKEncodeState *encodeState, void *objectPtr) { - NSCParameterAssert((encodeState != NULL) && (encodeState->atIndex < encodeState->stringBuffer.bytes.length) && (objectPtr != NULL)); - - id object = (id)objectPtr, encodeCacheObject = object; - int isClass = JKClassUnknown; - size_t startingAtIndex = encodeState->atIndex; - - JKHash objectHash = jk_encode_object_hash(objectPtr); - JKEncodeCache *cacheSlot = &encodeState->cache[objectHash % PJK_ENCODE_CACHE_SLOTS]; - - if(PJK_EXPECT_T(cacheSlot->object == object)) { - NSCParameterAssert((cacheSlot->object != NULL) && - (cacheSlot->offset < encodeState->atIndex) && ((cacheSlot->offset + cacheSlot->length) < encodeState->atIndex) && - (cacheSlot->offset < encodeState->stringBuffer.bytes.length) && ((cacheSlot->offset + cacheSlot->length) < encodeState->stringBuffer.bytes.length) && - ((encodeState->stringBuffer.bytes.ptr + encodeState->atIndex) < (encodeState->stringBuffer.bytes.ptr + encodeState->stringBuffer.bytes.length)) && - ((encodeState->stringBuffer.bytes.ptr + cacheSlot->offset) < (encodeState->stringBuffer.bytes.ptr + encodeState->stringBuffer.bytes.length)) && - ((encodeState->stringBuffer.bytes.ptr + cacheSlot->offset + cacheSlot->length) < (encodeState->stringBuffer.bytes.ptr + encodeState->stringBuffer.bytes.length))); - if(PJK_EXPECT_F(((encodeState->atIndex + cacheSlot->length + 256UL) > encodeState->stringBuffer.bytes.length)) && PJK_EXPECT_F((jk_managedBuffer_resize(&encodeState->stringBuffer, encodeState->atIndex + cacheSlot->length + 1024UL) == NULL))) { jk_encode_error(encodeState, @"Unable to resize temporary buffer."); return(1); } - NSCParameterAssert(((encodeState->atIndex + cacheSlot->length) < encodeState->stringBuffer.bytes.length) && - ((encodeState->stringBuffer.bytes.ptr + encodeState->atIndex) < (encodeState->stringBuffer.bytes.ptr + encodeState->stringBuffer.bytes.length)) && - ((encodeState->stringBuffer.bytes.ptr + encodeState->atIndex + cacheSlot->length) < (encodeState->stringBuffer.bytes.ptr + encodeState->stringBuffer.bytes.length)) && - ((encodeState->stringBuffer.bytes.ptr + cacheSlot->offset) < (encodeState->stringBuffer.bytes.ptr + encodeState->stringBuffer.bytes.length)) && - ((encodeState->stringBuffer.bytes.ptr + cacheSlot->offset + cacheSlot->length) < (encodeState->stringBuffer.bytes.ptr + encodeState->stringBuffer.bytes.length)) && - ((encodeState->stringBuffer.bytes.ptr + cacheSlot->offset + cacheSlot->length) < (encodeState->stringBuffer.bytes.ptr + encodeState->atIndex))); - memcpy(encodeState->stringBuffer.bytes.ptr + encodeState->atIndex, encodeState->stringBuffer.bytes.ptr + cacheSlot->offset, cacheSlot->length); - encodeState->atIndex += cacheSlot->length; - return(0); - } - - // When we encounter a class that we do not handle, and we have either a delegate or block that the user supplied to format unsupported classes, - // we "re-run" the object check. However, we re-run the object check exactly ONCE. If the user supplies an object that isn't one of the - // supported classes, we fail the second time (i.e., double fault error). - BOOL rerunningAfterClassFormatter = NO; - rerunAfterClassFormatter:; - - // XXX XXX XXX XXX - // - // We need to work around a bug in 10.7, which breaks ABI compatibility with Objective-C going back not just to 10.0, but OpenStep and even NextStep. - // - // It has long been documented that "the very first thing that a pointer to an Objective-C object "points to" is a pointer to that objects class". - // - // This is euphemistically called "tagged pointers". There are a number of highly technical problems with this, most involving long passages from - // the C standard(s). In short, one can make a strong case, couched from the perspective of the C standard(s), that that 10.7 "tagged pointers" are - // fundamentally Wrong and Broken, and should have never been implemented. Assuming those points are glossed over, because the change is very clearly - // breaking ABI compatibility, this should have resulted in a minimum of a "minimum version required" bump in various shared libraries to prevent - // causes code that used to work just fine to suddenly break without warning. - // - // In fact, the C standard says that the hack below is "undefined behavior"- there is no requirement that the 10.7 tagged pointer hack of setting the - // "lower, unused bits" must be preserved when casting the result to an integer type, but this "works" because for most architectures - // `sizeof(long) == sizeof(void *)` and the compiler uses the same representation for both. (note: this is informal, not meant to be - // normative or pedantically correct). - // - // In other words, while this "works" for now, technically the compiler is not obligated to do "what we want", and a later version of the compiler - // is not required in any way to produce the same results or behavior that earlier versions of the compiler did for the statement below. - // - // Fan-fucking-tastic. - // - // Why not just use `object_getClass()`? Because `object->isa` reduces to (typically) a *single* instruction. Calling `object_getClass()` requires - // that the compiler potentially spill registers, establish a function call frame / environment, and finally execute a "jump subroutine" instruction. - // Then, the called subroutine must spend half a dozen instructions in its prolog, however many instructions doing whatever it does, then half a dozen - // instructions in its prolog. One instruction compared to dozens, maybe a hundred instructions. - // - // Yes, that's one to two orders of magnitude difference. Which is compelling in its own right. When going for performance, you're often happy with - // gains in the two to three percent range. - // - // XXX XXX XXX XXX - - - BOOL workAroundMacOSXABIBreakingBug = (PJK_EXPECT_F(((NSUInteger)object) & 0x1)) ? YES : NO; - void *objectISA = (PJK_EXPECT_F(workAroundMacOSXABIBreakingBug)) ? NULL : *((void **)objectPtr); - if(PJK_EXPECT_F(workAroundMacOSXABIBreakingBug)) { goto slowClassLookup; } - - if(PJK_EXPECT_T(objectISA == encodeState->fastClassLookup.stringClass)) { isClass = JKClassString; } - else if(PJK_EXPECT_T(objectISA == encodeState->fastClassLookup.numberClass)) { isClass = JKClassNumber; } - else if(PJK_EXPECT_T(objectISA == encodeState->fastClassLookup.dictionaryClass)) { isClass = JKClassDictionary; } - else if(PJK_EXPECT_T(objectISA == encodeState->fastClassLookup.arrayClass)) { isClass = JKClassArray; } - else if(PJK_EXPECT_T(objectISA == encodeState->fastClassLookup.nullClass)) { isClass = JKClassNull; } - else { - slowClassLookup: - if(PJK_EXPECT_T([object isKindOfClass:[NSString class]])) { if(workAroundMacOSXABIBreakingBug == NO) { encodeState->fastClassLookup.stringClass = objectISA; } isClass = JKClassString; } - else if(PJK_EXPECT_T([object isKindOfClass:[NSNumber class]])) { if(workAroundMacOSXABIBreakingBug == NO) { encodeState->fastClassLookup.numberClass = objectISA; } isClass = JKClassNumber; } - else if(PJK_EXPECT_T([object isKindOfClass:[NSDictionary class]])) { if(workAroundMacOSXABIBreakingBug == NO) { encodeState->fastClassLookup.dictionaryClass = objectISA; } isClass = JKClassDictionary; } - else if(PJK_EXPECT_T([object isKindOfClass:[NSArray class]])) { if(workAroundMacOSXABIBreakingBug == NO) { encodeState->fastClassLookup.arrayClass = objectISA; } isClass = JKClassArray; } - else if(PJK_EXPECT_T([object isKindOfClass:[NSNull class]])) { if(workAroundMacOSXABIBreakingBug == NO) { encodeState->fastClassLookup.nullClass = objectISA; } isClass = JKClassNull; } - else { - if((rerunningAfterClassFormatter == NO) && ( -#ifdef __BLOCKS__ - ((encodeState->classFormatterBlock) && ((object = encodeState->classFormatterBlock(object)) != NULL)) || -#endif - ((encodeState->classFormatterIMP) && ((object = encodeState->classFormatterIMP(encodeState->classFormatterDelegate, encodeState->classFormatterSelector, object)) != NULL)) )) { rerunningAfterClassFormatter = YES; goto rerunAfterClassFormatter; } - - if(rerunningAfterClassFormatter == NO) { jk_encode_error(encodeState, @"Unable to serialize object class %@.", NSStringFromClass([encodeCacheObject class])); return(1); } - else { jk_encode_error(encodeState, @"Unable to serialize object class %@ that was returned by the unsupported class formatter. Original object class was %@.", (object == NULL) ? @"NULL" : NSStringFromClass([object class]), NSStringFromClass([encodeCacheObject class])); return(1); } - } - } - - // This is here for the benefit of the optimizer. It allows the optimizer to do loop invariant code motion for the JKClassArray - // and JKClassDictionary cases when printing simple, single characters via jk_encode_write(), which is actually a macro: - // #define jk_encode_write1(es, dc, f) (_jk_encode_prettyPrint ? jk_encode_write1slow(es, dc, f) : jk_encode_write1fast(es, dc, f)) - int _jk_encode_prettyPrint = PJK_EXPECT_T((encodeState->serializeOptionFlags & JSONKIT_PREPEND(JKSerializeOptionPretty)) == 0) ? 0 : 1; - - switch(isClass) { - case JKClassString: - { - { - const unsigned char *cStringPtr = (const unsigned char *)CFStringGetCStringPtr((CFStringRef)object, kCFStringEncodingMacRoman); - if(cStringPtr != NULL) { - const unsigned char *utf8String = cStringPtr; - size_t utf8Idx = 0UL; - - CFIndex stringLength = CFStringGetLength((CFStringRef)object); - if(PJK_EXPECT_F(((encodeState->atIndex + (stringLength * 2UL) + 256UL) > encodeState->stringBuffer.bytes.length)) && PJK_EXPECT_F((jk_managedBuffer_resize(&encodeState->stringBuffer, encodeState->atIndex + (stringLength * 2UL) + 1024UL) == NULL))) { jk_encode_error(encodeState, @"Unable to resize temporary buffer."); return(1); } - - if(PJK_EXPECT_T((encodeState->encodeOption & JKEncodeOptionStringObjTrimQuotes) == 0UL)) { encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\"'; } - for(utf8Idx = 0UL; utf8String[utf8Idx] != 0U; utf8Idx++) { - NSCParameterAssert(((&encodeState->stringBuffer.bytes.ptr[encodeState->atIndex]) - encodeState->stringBuffer.bytes.ptr) < (ssize_t)encodeState->stringBuffer.bytes.length); - NSCParameterAssert(encodeState->atIndex < encodeState->stringBuffer.bytes.length); - if(PJK_EXPECT_F(utf8String[utf8Idx] >= 0x80U)) { encodeState->atIndex = startingAtIndex; goto slowUTF8Path; } - if(PJK_EXPECT_F(utf8String[utf8Idx] < 0x20U)) { - switch(utf8String[utf8Idx]) { - case '\b': encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = 'b'; break; - case '\f': encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = 'f'; break; - case '\n': encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = 'n'; break; - case '\r': encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = 'r'; break; - case '\t': encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = 't'; break; - default: if(PJK_EXPECT_F(jk_encode_printf(encodeState, NULL, 0UL, NULL, "\\u%4.4x", utf8String[utf8Idx]))) { return(1); } break; - } - } else { - if(PJK_EXPECT_F(utf8String[utf8Idx] == '\"') || PJK_EXPECT_F(utf8String[utf8Idx] == '\\') || (PJK_EXPECT_F(encodeState->serializeOptionFlags & JSONKIT_PREPEND(JKSerializeOptionEscapeForwardSlashes)) && PJK_EXPECT_F(utf8String[utf8Idx] == '/'))) { encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; } - encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = utf8String[utf8Idx]; - } - } - NSCParameterAssert((encodeState->atIndex + 1UL) < encodeState->stringBuffer.bytes.length); - if(PJK_EXPECT_T((encodeState->encodeOption & JKEncodeOptionStringObjTrimQuotes) == 0UL)) { encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\"'; } - jk_encode_updateCache(encodeState, cacheSlot, startingAtIndex, encodeCacheObject); - return(0); - } - } - - slowUTF8Path: - { - CFIndex stringLength = CFStringGetLength((CFStringRef)object); - CFIndex maxStringUTF8Length = CFStringGetMaximumSizeForEncoding(stringLength, kCFStringEncodingUTF8) + 32L; - - if(PJK_EXPECT_F((size_t)maxStringUTF8Length > encodeState->utf8ConversionBuffer.bytes.length) && PJK_EXPECT_F(jk_managedBuffer_resize(&encodeState->utf8ConversionBuffer, maxStringUTF8Length + 1024UL) == NULL)) { jk_encode_error(encodeState, @"Unable to resize temporary buffer."); return(1); } - - CFIndex usedBytes = 0L, convertedCount = 0L; - convertedCount = CFStringGetBytes((CFStringRef)object, CFRangeMake(0L, stringLength), kCFStringEncodingUTF8, '?', NO, encodeState->utf8ConversionBuffer.bytes.ptr, encodeState->utf8ConversionBuffer.bytes.length - 16L, &usedBytes); - if(PJK_EXPECT_F(convertedCount != stringLength) || PJK_EXPECT_F(usedBytes < 0L)) { jk_encode_error(encodeState, @"An error occurred converting the contents of a NSString to UTF8."); return(1); } - - if(PJK_EXPECT_F((encodeState->atIndex + (maxStringUTF8Length * 2UL) + 256UL) > encodeState->stringBuffer.bytes.length) && PJK_EXPECT_F(jk_managedBuffer_resize(&encodeState->stringBuffer, encodeState->atIndex + (maxStringUTF8Length * 2UL) + 1024UL) == NULL)) { jk_encode_error(encodeState, @"Unable to resize temporary buffer."); return(1); } - - const unsigned char *utf8String = encodeState->utf8ConversionBuffer.bytes.ptr; - - size_t utf8Idx = 0UL; - if(PJK_EXPECT_T((encodeState->encodeOption & JKEncodeOptionStringObjTrimQuotes) == 0UL)) { encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\"'; } - for(utf8Idx = 0UL; utf8Idx < (size_t)usedBytes; utf8Idx++) { - NSCParameterAssert(((&encodeState->stringBuffer.bytes.ptr[encodeState->atIndex]) - encodeState->stringBuffer.bytes.ptr) < (ssize_t)encodeState->stringBuffer.bytes.length); - NSCParameterAssert(encodeState->atIndex < encodeState->stringBuffer.bytes.length); - NSCParameterAssert((CFIndex)utf8Idx < usedBytes); - if(PJK_EXPECT_F(utf8String[utf8Idx] < 0x20U)) { - switch(utf8String[utf8Idx]) { - case '\b': encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = 'b'; break; - case '\f': encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = 'f'; break; - case '\n': encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = 'n'; break; - case '\r': encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = 'r'; break; - case '\t': encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = 't'; break; - default: if(PJK_EXPECT_F(jk_encode_printf(encodeState, NULL, 0UL, NULL, "\\u%4.4x", utf8String[utf8Idx]))) { return(1); } break; - } - } else { - if(PJK_EXPECT_F(utf8String[utf8Idx] >= 0x80U) && (encodeState->serializeOptionFlags & JSONKIT_PREPEND(JKSerializeOptionEscapeUnicode))) { - const unsigned char *nextValidCharacter = NULL; - UTF32 u32ch = 0U; - ConversionResult result; - - if(PJK_EXPECT_F((result = ConvertSingleCodePointInUTF8(&utf8String[utf8Idx], &utf8String[usedBytes], (UTF8 const **)&nextValidCharacter, &u32ch)) != conversionOK)) { jk_encode_error(encodeState, @"Error converting UTF8."); return(1); } - else { - utf8Idx = (nextValidCharacter - utf8String) - 1UL; - if(PJK_EXPECT_T(u32ch <= 0xffffU)) { if(PJK_EXPECT_F(jk_encode_printf(encodeState, NULL, 0UL, NULL, "\\u%4.4x", u32ch))) { return(1); } } - else { if(PJK_EXPECT_F(jk_encode_printf(encodeState, NULL, 0UL, NULL, "\\u%4.4x\\u%4.4x", (0xd7c0U + (u32ch >> 10)), (0xdc00U + (u32ch & 0x3ffU))))) { return(1); } } - } - } else { - if(PJK_EXPECT_F(utf8String[utf8Idx] == '\"') || PJK_EXPECT_F(utf8String[utf8Idx] == '\\') || (PJK_EXPECT_F(encodeState->serializeOptionFlags & JSONKIT_PREPEND(JKSerializeOptionEscapeForwardSlashes)) && PJK_EXPECT_F(utf8String[utf8Idx] == '/'))) { encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\\'; } - encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = utf8String[utf8Idx]; - } - } - } - NSCParameterAssert((encodeState->atIndex + 1UL) < encodeState->stringBuffer.bytes.length); - if(PJK_EXPECT_T((encodeState->encodeOption & JKEncodeOptionStringObjTrimQuotes) == 0UL)) { encodeState->stringBuffer.bytes.ptr[encodeState->atIndex++] = '\"'; } - jk_encode_updateCache(encodeState, cacheSlot, startingAtIndex, encodeCacheObject); - return(0); - } - } - break; - - case JKClassNumber: - { - if(object == (id)kCFBooleanTrue) { return(jk_encode_writen(encodeState, cacheSlot, startingAtIndex, encodeCacheObject, "true", 4UL)); } - else if(object == (id)kCFBooleanFalse) { return(jk_encode_writen(encodeState, cacheSlot, startingAtIndex, encodeCacheObject, "false", 5UL)); } - - const char *objCType = [object objCType]; - char anum[256], *aptr = &anum[255]; - int isNegative = 0; - unsigned long long ullv; - long long llv; - - if(PJK_EXPECT_F(objCType == NULL) || PJK_EXPECT_F(objCType[0] == 0) || PJK_EXPECT_F(objCType[1] != 0)) { jk_encode_error(encodeState, @"NSNumber conversion error, unknown type. Type: '%s'", (objCType == NULL) ? "" : objCType); return(1); } - - switch(objCType[0]) { - case 'c': case 'i': case 's': case 'l': case 'q': - if(PJK_EXPECT_T(CFNumberGetValue((CFNumberRef)object, kCFNumberLongLongType, &llv))) { - if(llv < 0LL) { ullv = -llv; isNegative = 1; } else { ullv = llv; isNegative = 0; } - goto convertNumber; - } else { jk_encode_error(encodeState, @"Unable to get scalar value from number object."); return(1); } - break; - case 'C': case 'I': case 'S': case 'L': case 'Q': case 'B': - if(PJK_EXPECT_T(CFNumberGetValue((CFNumberRef)object, kCFNumberLongLongType, &ullv))) { - convertNumber: - if(PJK_EXPECT_F(ullv < 10ULL)) { *--aptr = ullv + '0'; } else { while(PJK_EXPECT_T(ullv > 0ULL)) { *--aptr = (ullv % 10ULL) + '0'; ullv /= 10ULL; NSCParameterAssert(aptr > anum); } } - if(isNegative) { *--aptr = '-'; } - NSCParameterAssert(aptr > anum); - return(jk_encode_writen(encodeState, cacheSlot, startingAtIndex, encodeCacheObject, aptr, &anum[255] - aptr)); - } else { jk_encode_error(encodeState, @"Unable to get scalar value from number object."); return(1); } - break; - case 'f': case 'd': - { - double dv; - if(PJK_EXPECT_T(CFNumberGetValue((CFNumberRef)object, kCFNumberDoubleType, &dv))) { - if(PJK_EXPECT_F(!isfinite(dv))) { jk_encode_error(encodeState, @"Floating point values must be finite. JSON does not support NaN or Infinity."); return(1); } - return(jk_encode_printf(encodeState, cacheSlot, startingAtIndex, encodeCacheObject, "%.17g", dv)); - } else { jk_encode_error(encodeState, @"Unable to get floating point value from number object."); return(1); } - } - break; - default: jk_encode_error(encodeState, @"NSNumber conversion error, unknown type. Type: '%c' / 0x%2.2x", objCType[0], objCType[0]); return(1); break; - } - } - break; - - case JKClassArray: - { - int printComma = 0; - CFIndex arrayCount = CFArrayGetCount((CFArrayRef)object), idx = 0L; - if(PJK_EXPECT_F(jk_encode_write1(encodeState, 1L, "["))) { return(1); } - if(PJK_EXPECT_F(arrayCount > 1020L)) { - for(id arrayObject in object) { if(PJK_EXPECT_T(printComma)) { if(PJK_EXPECT_F(jk_encode_write1(encodeState, 0L, ","))) { return(1); } } printComma = 1; if(PJK_EXPECT_F(jk_encode_add_atom_to_buffer(encodeState, arrayObject))) { return(1); } } - } else { - void *objects[1024]; - CFArrayGetValues((CFArrayRef)object, CFRangeMake(0L, arrayCount), (const void **)objects); - for(idx = 0L; idx < arrayCount; idx++) { if(PJK_EXPECT_T(printComma)) { if(PJK_EXPECT_F(jk_encode_write1(encodeState, 0L, ","))) { return(1); } } printComma = 1; if(PJK_EXPECT_F(jk_encode_add_atom_to_buffer(encodeState, objects[idx]))) { return(1); } } - } - return(jk_encode_write1(encodeState, -1L, "]")); - } - break; - - case JKClassDictionary: - { - int printComma = 0; - CFIndex dictionaryCount = CFDictionaryGetCount((CFDictionaryRef)object), idx = 0L; - id enumerateObject = PJK_EXPECT_F(_jk_encode_prettyPrint) ? [[object allKeys] sortedArrayUsingSelector:@selector(compare:)] : object; - - if(PJK_EXPECT_F(jk_encode_write1(encodeState, 1L, "{"))) { return(1); } - if(PJK_EXPECT_F(_jk_encode_prettyPrint) || PJK_EXPECT_F(dictionaryCount > 1020L)) { - for(id keyObject in enumerateObject) { - if(PJK_EXPECT_T(printComma)) { if(PJK_EXPECT_F(jk_encode_write1(encodeState, 0L, ","))) { return(1); } } - printComma = 1; - void *keyObjectISA = *((void **)keyObject); - if(PJK_EXPECT_F((keyObjectISA != encodeState->fastClassLookup.stringClass)) && PJK_EXPECT_F(([keyObject isKindOfClass:[NSString class]] == NO))) { jk_encode_error(encodeState, @"Key must be a string object."); return(1); } - if(PJK_EXPECT_F(jk_encode_add_atom_to_buffer(encodeState, keyObject))) { return(1); } - if(PJK_EXPECT_F(jk_encode_write1(encodeState, 0L, ":"))) { return(1); } - if(PJK_EXPECT_F(jk_encode_add_atom_to_buffer(encodeState, (void *)CFDictionaryGetValue((CFDictionaryRef)object, keyObject)))) { return(1); } - } - } else { - void *keys[1024], *objects[1024]; - CFDictionaryGetKeysAndValues((CFDictionaryRef)object, (const void **)keys, (const void **)objects); - for(idx = 0L; idx < dictionaryCount; idx++) { - if(PJK_EXPECT_T(printComma)) { if(PJK_EXPECT_F(jk_encode_write1(encodeState, 0L, ","))) { return(1); } } - printComma = 1; - void *keyObjectISA = *((void **)keys[idx]); - if(PJK_EXPECT_F(keyObjectISA != encodeState->fastClassLookup.stringClass) && PJK_EXPECT_F([(id)keys[idx] isKindOfClass:[NSString class]] == NO)) { jk_encode_error(encodeState, @"Key must be a string object."); return(1); } - if(PJK_EXPECT_F(jk_encode_add_atom_to_buffer(encodeState, keys[idx]))) { return(1); } - if(PJK_EXPECT_F(jk_encode_write1(encodeState, 0L, ":"))) { return(1); } - if(PJK_EXPECT_F(jk_encode_add_atom_to_buffer(encodeState, objects[idx]))) { return(1); } - } - } - return(jk_encode_write1(encodeState, -1L, "}")); - } - break; - - case JKClassNull: return(jk_encode_writen(encodeState, cacheSlot, startingAtIndex, encodeCacheObject, "null", 4UL)); break; - - default: jk_encode_error(encodeState, @"Unable to serialize object class %@.", NSStringFromClass([object class])); return(1); break; - } - - return(0); -} - - -@implementation JSONKIT_PREPEND(JKSerializer) - -+ (id)serializeObject:(id)object options:(JSONKIT_PREPEND(JKSerializeOptionFlags))optionFlags encodeOption:(JKEncodeOptionType)encodeOption block:(JKSERIALIZER_BLOCKS_PROTO)block delegate:(id)delegate selector:(SEL)selector error:(NSError **)error -{ - return([[[[self alloc] init] autorelease] serializeObject:object options:optionFlags encodeOption:encodeOption block:block delegate:delegate selector:selector error:error]); -} - -- (id)serializeObject:(id)object options:(JSONKIT_PREPEND(JKSerializeOptionFlags))optionFlags encodeOption:(JKEncodeOptionType)encodeOption block:(JKSERIALIZER_BLOCKS_PROTO)block delegate:(id)delegate selector:(SEL)selector error:(NSError **)error -{ -#ifndef __BLOCKS__ -#pragma unused(block) -#endif - NSParameterAssert((object != NULL) && (encodeState == NULL) && ((delegate != NULL) ? (block == NULL) : 1) && ((block != NULL) ? (delegate == NULL) : 1) && - (((encodeOption & JKEncodeOptionCollectionObj) != 0UL) ? (((encodeOption & JKEncodeOptionStringObj) == 0UL) && ((encodeOption & JKEncodeOptionStringObjTrimQuotes) == 0UL)) : 1) && - (((encodeOption & JKEncodeOptionStringObj) != 0UL) ? ((encodeOption & JKEncodeOptionCollectionObj) == 0UL) : 1)); - - id returnObject = NULL; - - if(encodeState != NULL) { [self releaseState]; } - if((encodeState = (struct JKEncodeState *)calloc(1UL, sizeof(JKEncodeState))) == NULL) { [NSException raise:NSMallocException format:@"Unable to allocate state structure."]; return(NULL); } - - if((error != NULL) && (*error != NULL)) { *error = NULL; } - - if(delegate != NULL) { - if(selector == NULL) { [NSException raise:NSInvalidArgumentException format:@"The delegate argument is not NULL, but the selector argument is NULL."]; } - if([delegate respondsToSelector:selector] == NO) { [NSException raise:NSInvalidArgumentException format:@"The serializeUnsupportedClassesUsingDelegate: delegate does not respond to the selector argument."]; } - encodeState->classFormatterDelegate = delegate; - encodeState->classFormatterSelector = selector; - encodeState->classFormatterIMP = (JKClassFormatterIMP)[delegate methodForSelector:selector]; - NSCParameterAssert(encodeState->classFormatterIMP != NULL); - } - -#ifdef __BLOCKS__ - encodeState->classFormatterBlock = block; -#endif - encodeState->serializeOptionFlags = optionFlags; - encodeState->encodeOption = encodeOption; - encodeState->stringBuffer.roundSizeUpToMultipleOf = (1024UL * 32UL); - encodeState->utf8ConversionBuffer.roundSizeUpToMultipleOf = 4096UL; - - unsigned char stackJSONBuffer[PJK_JSONBUFFER_SIZE] PJK_ALIGNED(64); - jk_managedBuffer_setToStackBuffer(&encodeState->stringBuffer, stackJSONBuffer, sizeof(stackJSONBuffer)); - - unsigned char stackUTF8Buffer[PJK_UTF8BUFFER_SIZE] PJK_ALIGNED(64); - jk_managedBuffer_setToStackBuffer(&encodeState->utf8ConversionBuffer, stackUTF8Buffer, sizeof(stackUTF8Buffer)); - - if(((encodeOption & JKEncodeOptionCollectionObj) != 0UL) && (([object isKindOfClass:[NSArray class]] == NO) && ([object isKindOfClass:[NSDictionary class]] == NO))) { jk_encode_error(encodeState, @"Unable to serialize object class %@, expected a NSArray or NSDictionary.", NSStringFromClass([object class])); goto errorExit; } - if(((encodeOption & JKEncodeOptionStringObj) != 0UL) && ([object isKindOfClass:[NSString class]] == NO)) { jk_encode_error(encodeState, @"Unable to serialize object class %@, expected a NSString.", NSStringFromClass([object class])); goto errorExit; } - - if(jk_encode_add_atom_to_buffer(encodeState, object) == 0) { - BOOL stackBuffer = ((encodeState->stringBuffer.flags & JKManagedBufferMustFree) == 0UL) ? YES : NO; - - if((encodeState->atIndex < 2UL)) - if((stackBuffer == NO) && ((encodeState->stringBuffer.bytes.ptr = (unsigned char *)reallocf(encodeState->stringBuffer.bytes.ptr, encodeState->atIndex + 16UL)) == NULL)) { jk_encode_error(encodeState, @"Unable to realloc buffer"); goto errorExit; } - - switch((encodeOption & JKEncodeOptionAsTypeMask)) { - case JKEncodeOptionAsData: - if(stackBuffer == YES) { if((returnObject = [(id)CFDataCreate( NULL, encodeState->stringBuffer.bytes.ptr, (CFIndex)encodeState->atIndex) autorelease]) == NULL) { jk_encode_error(encodeState, @"Unable to create NSData object"); } } - else { if((returnObject = [(id)CFDataCreateWithBytesNoCopy( NULL, encodeState->stringBuffer.bytes.ptr, (CFIndex)encodeState->atIndex, NULL) autorelease]) == NULL) { jk_encode_error(encodeState, @"Unable to create NSData object"); } } - break; - - case JKEncodeOptionAsString: - if(stackBuffer == YES) { if((returnObject = [(id)CFStringCreateWithBytes( NULL, (const UInt8 *)encodeState->stringBuffer.bytes.ptr, (CFIndex)encodeState->atIndex, kCFStringEncodingUTF8, NO) autorelease]) == NULL) { jk_encode_error(encodeState, @"Unable to create NSString object"); } } - else { if((returnObject = [(id)CFStringCreateWithBytesNoCopy(NULL, (const UInt8 *)encodeState->stringBuffer.bytes.ptr, (CFIndex)encodeState->atIndex, kCFStringEncodingUTF8, NO, NULL) autorelease]) == NULL) { jk_encode_error(encodeState, @"Unable to create NSString object"); } } - break; - - default: jk_encode_error(encodeState, @"Unknown encode as type."); break; - } - - if((returnObject != NULL) && (stackBuffer == NO)) { encodeState->stringBuffer.flags &= ~JKManagedBufferMustFree; encodeState->stringBuffer.bytes.ptr = NULL; encodeState->stringBuffer.bytes.length = 0UL; } - } - -errorExit: - if((encodeState != NULL) && (error != NULL) && (encodeState->error != NULL)) { *error = encodeState->error; encodeState->error = NULL; } - [self releaseState]; - - return(returnObject); -} - -- (void)releaseState -{ - if(encodeState != NULL) { - jk_managedBuffer_release(&encodeState->stringBuffer); - jk_managedBuffer_release(&encodeState->utf8ConversionBuffer); - free(encodeState); encodeState = NULL; - } -} - -- (void)dealloc -{ - [self releaseState]; - [super dealloc]; -} - -@end - -@implementation NSString (JSONKIT_PREPEND(JSONKitSerializing)) - -//////////// -#pragma mark Methods for serializing a single NSString. -//////////// - -// Useful for those who need to serialize just a NSString. Otherwise you would have to do something like [NSArray arrayWithObject:stringToBeJSONSerialized], serializing the array, and then chopping of the extra ^\[.*\]$ square brackets. - -// NSData returning methods... - -- (NSData *)JSONKIT_PREPEND(JSONData) -{ - return([self JSONKIT_PREPEND(JSONDataWithOptions):JSONKIT_PREPEND(JKSerializeOptionNone) includeQuotes:YES error:NULL]); -} - -- (NSData *)JSONKIT_PREPEND(JSONDataWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error -{ - return([JSONKIT_PREPEND(JKSerializer) serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsData | ((includeQuotes == NO) ? JKEncodeOptionStringObjTrimQuotes : 0UL) | JKEncodeOptionStringObj) block:NULL delegate:NULL selector:NULL error:error]); -} - -// NSString returning methods... - -- (NSString *)JSONKIT_PREPEND(JSONString) -{ - return([self JSONKIT_PREPEND(JSONStringWithOptions):JSONKIT_PREPEND(JKSerializeOptionNone) includeQuotes:YES error:NULL]); -} - -- (NSString *)JSONKIT_PREPEND(JSONStringWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error -{ - return([JSONKIT_PREPEND(JKSerializer) serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsString | ((includeQuotes == NO) ? JKEncodeOptionStringObjTrimQuotes : 0UL) | JKEncodeOptionStringObj) block:NULL delegate:NULL selector:NULL error:error]); -} - -@end - -@implementation NSArray (JSONKIT_PREPEND(JSONKitSerializing)) - -// NSData returning methods... - -- (NSData *)JSONKIT_PREPEND(JSONData) -{ - return([JSONKIT_PREPEND(JKSerializer) serializeObject:self options:JSONKIT_PREPEND(JKSerializeOptionNone) encodeOption:(JKEncodeOptionAsData | JKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:NULL]); -} - -- (NSData *)JSONKIT_PREPEND(JSONDataWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions error:(NSError **)error -{ - return([JSONKIT_PREPEND(JKSerializer) serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsData | JKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:error]); -} - -- (NSData *)JSONKIT_PREPEND(JSONDataWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error -{ - return([JSONKIT_PREPEND(JKSerializer) serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsData | JKEncodeOptionCollectionObj) block:NULL delegate:delegate selector:selector error:error]); -} - -// NSString returning methods... - -- (NSString *)JSONKIT_PREPEND(JSONString) -{ - return([JSONKIT_PREPEND(JKSerializer) serializeObject:self options:JSONKIT_PREPEND(JKSerializeOptionNone) encodeOption:(JKEncodeOptionAsString | JKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:NULL]); -} - -- (NSString *)JSONKIT_PREPEND(JSONStringWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions error:(NSError **)error -{ - return([JSONKIT_PREPEND(JKSerializer) serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsString | JKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:error]); -} - -- (NSString *)JSONKIT_PREPEND(JSONStringWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error -{ - return([JSONKIT_PREPEND(JKSerializer) serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsString | JKEncodeOptionCollectionObj) block:NULL delegate:delegate selector:selector error:error]); -} - -@end - -@implementation NSDictionary (JSONKIT_PREPEND(JSONKitSerializing)) - -// NSData returning methods... - -- (NSData *)JSONKIT_PREPEND(JSONData) -{ - return([JSONKIT_PREPEND(JKSerializer) serializeObject:self options:JSONKIT_PREPEND(JKSerializeOptionNone) encodeOption:(JKEncodeOptionAsData | JKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:NULL]); -} - -- (NSData *)JSONKIT_PREPEND(JSONDataWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions error:(NSError **)error -{ - return([JSONKIT_PREPEND(JKSerializer) serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsData | JKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:error]); -} - -- (NSData *)JSONKIT_PREPEND(JSONDataWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error -{ - return([JSONKIT_PREPEND(JKSerializer) serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsData | JKEncodeOptionCollectionObj) block:NULL delegate:delegate selector:selector error:error]); -} - -// NSString returning methods... - -- (NSString *)JSONKIT_PREPEND(JSONString) -{ - return([JSONKIT_PREPEND(JKSerializer) serializeObject:self options:JSONKIT_PREPEND(JKSerializeOptionNone) encodeOption:(JKEncodeOptionAsString | JKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:NULL]); -} - -- (NSString *)JSONKIT_PREPEND(JSONStringWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions error:(NSError **)error -{ - return([JSONKIT_PREPEND(JKSerializer) serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsString | JKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:error]); -} - -- (NSString *)JSONKIT_PREPEND(JSONStringWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error -{ - return([JSONKIT_PREPEND(JKSerializer) serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsString | JKEncodeOptionCollectionObj) block:NULL delegate:delegate selector:selector error:error]); -} - -@end - - -#ifdef __BLOCKS__ - -@implementation NSArray (JSONKIT_PREPEND(JSONKitSerializingBlockAdditions)) - -- (NSData *)JSONKIT_PREPEND(JSONDataWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error -{ - return([JSONKIT_PREPEND(JKSerializer) serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsData | JKEncodeOptionCollectionObj) block:block delegate:NULL selector:NULL error:error]); -} - -- (NSString *)JSONKIT_PREPEND(JSONStringWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error -{ - return([JSONKIT_PREPEND(JKSerializer) serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsString | JKEncodeOptionCollectionObj) block:block delegate:NULL selector:NULL error:error]); -} - -@end - -@implementation NSDictionary (JSONKIT_PREPEND(JSONKitSerializingBlockAdditions)) - -- (NSData *)JSONKIT_PREPEND(JSONDataWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error -{ - return([JSONKIT_PREPEND(JKSerializer) serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsData | JKEncodeOptionCollectionObj) block:block delegate:NULL selector:NULL error:error]); -} - -- (NSString *)JSONKIT_PREPEND(JSONStringWithOptions):(JSONKIT_PREPEND(JKSerializeOptionFlags))serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error -{ - return([JSONKIT_PREPEND(JKSerializer) serializeObject:self options:serializeOptions encodeOption:(JKEncodeOptionAsString | JKEncodeOptionCollectionObj) block:block delegate:NULL selector:NULL error:error]); -} - -@end - -#endif // __BLOCKS__ - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ext/PrefixedJSONKit/README.md b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ext/PrefixedJSONKit/README.md deleted file mode 100755 index 9cf0e42..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/ext/PrefixedJSONKit/README.md +++ /dev/null @@ -1,316 +0,0 @@ -# PrefixedJSONKit - -PrefixedJSONKit is a fork of JSONKit which prefixes the symbols in JSONKit for easy embedding in static libraries to avoid conflicts with other uses of JSONKit in the same binary. - -To use, set a preprocessor macro for `JSONKIT_PREFIX`, for example: `JSONKIT_PREFIX=EXAMPLE_`. Now, all external JSONKit symbols will be prefixed with "EXAMPLE_", so `JSONDecoder` would become `EXAMPLE_JSONDecoder`. - -# JSONKit - -JSONKit is dual licensed under either the terms of the BSD License, or alternatively under the terms of the Apache License, Version 2.0.
-Copyright © 2011, John Engelhart. - -### A Very High Performance Objective-C JSON Library - -**UPDATE:** (2011/12/18) The benchmarks below were performed before Apples [`NSJSONSerialization`][NSJSONSerialization] was available (as of Mac OS X 10.7 and iOS 5). The obvious question is: Which is faster, [`NSJSONSerialization`][NSJSONSerialization] or JSONKit? According to [this site](http://www.bonto.ch/blog/2011/12/08/json-libraries-for-ios-comparison-updated/), JSONKit is faster than [`NSJSONSerialization`][NSJSONSerialization]. Some quick "back of the envelope" calculations using the numbers reported, JSONKit appears to be approximately 25% to 40% faster than [`NSJSONSerialization`][NSJSONSerialization], which is pretty significant. - - Parsing | Serializing -:---------:|:-------------: -Deserialize from JSON | Serialize to JSON -*23% Faster than Binary* .plist* !* | *549% Faster than Binary* .plist* !* - -* Benchmarking was performed on a MacBook Pro with a 2.66GHz Core 2. -* All JSON libraries were compiled with `gcc-4.2 -DNS_BLOCK_ASSERTIONS -O3 -arch x86_64`. -* Timing results are the average of 1,000 iterations of the user + system time reported by [`getrusage`][getrusage]. -* The JSON used was [`twitter_public_timeline.json`](https://github.com/samsoffes/json-benchmarks/blob/master/Resources/twitter_public_timeline.json) from [samsoffes / json-benchmarks](https://github.com/samsoffes/json-benchmarks). -* Since the `.plist` format does not support serializing [`NSNull`][NSNull], the `null` values in the original JSON were changed to `"null"`. -* The [experimental](https://github.com/johnezang/JSONKit/tree/experimental) branch contains the `gzip` compression changes. - * JSONKit automagically links to `libz.dylib` on the fly at run time– no manual linking required. - * Parsing / deserializing will automagically decompress a buffer if it detects a `gzip` signature header. - * You can compress / `gzip` the serialized JSON by passing `JKSerializeOptionCompress` to `-JSONDataWithOptions:error:`. - -[JSON versus PLIST, the Ultimate Showdown](http://www.cocoanetics.com/2011/03/json-versus-plist-the-ultimate-showdown/) benchmarks the common JSON libraries and compares them to Apples `.plist` format. - -*** - -JavaScript Object Notation, or [JSON][], is a lightweight, text-based, serialization format for structured data that is used by many web-based services and API's. It is defined by [RFC 4627][]. - -JSON provides the following primitive types: - -* `null` -* Boolean `true` and `false` -* Number -* String -* Array -* Object (a.k.a. Associative Arrays, Key / Value Hash Tables, Maps, Dictionaries, etc.) - -These primitive types are mapped to the following Objective-C Foundation classes: - -JSON | Objective-C --------------------|------------- -`null` | [`NSNull`][NSNull] -`true` and `false` | [`NSNumber`][NSNumber] -Number | [`NSNumber`][NSNumber] -String | [`NSString`][NSString] -Array | [`NSArray`][NSArray] -Object | [`NSDictionary`][NSDictionary] - -JSONKit uses Core Foundation internally, and it is assumed that Core Foundation ≡ Foundation for every equivalent base type, i.e. [`CFString`][CFString] ≡ [`NSString`][NSString]. - -The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119][]. - -### JSON To Objective-C Primitive Mapping Details - -* The [JSON specification][RFC 4627] is somewhat ambiguous about the details and requirements when it comes to Unicode, and it does not specify how Unicode issues and errors should be handled. Most of the ambiguity stems from the interpretation and scope [RFC 4627][] Section 3, Encoding: `JSON text SHALL be encoded in Unicode.` It is the authors opinion and interpretation that the language of [RFC 4627][] requires that a JSON implementation MUST follow the requirements specified in the [Unicode Standard][], and in particular the [Conformance][Unicode Standard - Conformance] chapter of the [Unicode Standard][], which specifies requirements related to handling, interpreting, and manipulating Unicode text. - - The default behavior for JSONKit is strict [RFC 4627][] conformance. It is the authors opinion and interpretation that [RFC 4627][] requires JSON to be encoded in Unicode, and therefore JSON that is not legal Unicode as defined by the [Unicode Standard][] is invalid JSON. Therefore, JSONKit will not accept JSON that contains ill-formed Unicode. The default, strict behavior implies that the `JKParseOptionLooseUnicode` option is not enabled. - - When the `JKParseOptionLooseUnicode` option is enabled, JSONKit follows the specifications and recommendations given in [The Unicode 6.0 standard, Chapter 3 - Conformance][Unicode Standard - Conformance], section 3.9 *Unicode Encoding Forms*. As a general rule of thumb, the Unicode code point `U+FFFD` is substituted for any ill-formed Unicode encountered. JSONKit attempts to follow the recommended *Best Practice for Using U+FFFD*: ***Replace each maximal subpart of an ill-formed subsequence by a single U+FFFD.*** - - The following Unicode code points are treated as ill-formed Unicode, and if `JKParseOptionLooseUnicode` is enabled, cause `U+FFFD` to be substituted in their place: - - `U+0000`.
- `U+D800` thru `U+DFFF`, inclusive.
- `U+FDD0` thru `U+FDEF`, inclusive.
- U+nFFFE and U+nFFFF, where *n* is from `0x0` to `0x10` - - The code points `U+FDD0` thru `U+FDEF`, U+nFFFE, and U+nFFFF (where *n* is from `0x0` to `0x10`), are defined as ***Noncharacters*** by the Unicode standard and "should never be interchanged". - - An exception is made for the code point `U+0000`, which is legal Unicode. The reason for this is that this particular code point is used by C string handling code to specify the end of the string, and any such string handling code will incorrectly stop processing a string at the point where `U+0000` occurs. Although reasonable people may have different opinions on this point, it is the authors considered opinion that the risks of permitting JSON Strings that contain `U+0000` outweigh the benefits. One of the risks in allowing `U+0000` to appear unaltered in a string is that it has the potential to create security problems by subtly altering the semantics of the string which can then be exploited by a malicious attacker. This is similar to the issue of [arbitrarily deleting characters from Unicode text][Unicode_UTR36_Deleting]. - - [RFC 4627][] allows for these limitations under section 4, Parsers: `An implementation may set limits on the length and character contents of strings.` While the [Unicode Standard][] permits the mutation of the original JSON (i.e., substituting `U+FFFD` for ill-formed Unicode), [RFC 4627][] is silent on this issue. It is the authors opinion and interpretation that [RFC 4627][], section 3 – *Encoding*, `JSON text SHALL be encoded in Unicode.` implies that such mutations are not only permitted but MUST be expected by any strictly conforming [RFC 4627][] JSON implementation. The author feels obligated to note that this opinion and interpretation may not be shared by others and, in fact, may be a minority opinion and interpretation. You should be aware that any mutation of the original JSON may subtly alter its semantics and, as a result, may have security related implications for anything that consumes the final result. - - It is important to note that JSONKit will not delete characters from the JSON being parsed as this is a [requirement specified by the Unicode Standard][Unicode_UTR36_Deleting]. Additional information can be found in the [Unicode Security FAQ][Unicode_Security_FAQ] and [Unicode Technical Report #36 - Unicode Security Consideration][Unicode_UTR36], in particular the section on [non-visual security][Unicode_UTR36_NonVisualSecurity]. - -* The [JSON specification][RFC 4627] does not specify the details or requirements for JSON String values, other than such strings must consist of Unicode code points, nor does it specify how errors should be handled. While JSONKit makes an effort (subject to the reasonable caveats above regarding Unicode) to preserve the parsed JSON String exactly, it can not guarantee that [`NSString`][NSString] will preserve the exact Unicode semantics of the original JSON String. - - JSONKit does not perform any form of Unicode Normalization on the parsed JSON Strings, but can not make any guarantees that the [`NSString`][NSString] class will not perform Unicode Normalization on the parsed JSON String used to instantiate the [`NSString`][NSString] object. The [`NSString`][NSString] class may place additional restrictions or otherwise transform the JSON String in such a way so that the JSON String is not bijective with the instantiated [`NSString`][NSString] object. In other words, JSONKit can not guarantee that when you round trip a JSON String to a [`NSString`][NSString] and then back to a JSON String that the two JSON Strings will be exactly the same, even though in practice they are. For clarity, "exactly" in this case means bit for bit identical. JSONKit can not even guarantee that the two JSON Strings will be [Unicode equivalent][Unicode_equivalence], even though in practice they will be and would be the most likely cause for the two round tripped JSON Strings to no longer be bit for bit identical. - -* JSONKit maps `true` and `false` to the [`CFBoolean`][CFBoolean] values [`kCFBooleanTrue`][kCFBooleanTrue] and [`kCFBooleanFalse`][kCFBooleanFalse], respectively. Conceptually, [`CFBoolean`][CFBoolean] values can be thought of, and treated as, [`NSNumber`][NSNumber] class objects. The benefit to using [`CFBoolean`][CFBoolean] is that `true` and `false` JSON values can be round trip deserialized and serialized without conversion or promotion to a [`NSNumber`][NSNumber] with a value of `0` or `1`. - -* The [JSON specification][RFC 4627] does not specify the details or requirements for JSON Number values, nor does it specify how errors due to conversion should be handled. In general, JSONKit will not accept JSON that contains JSON Number values that it can not convert with out error or loss of precision. - - For non-floating-point numbers (i.e., JSON Number values that do not include a `.` or `e|E`), JSONKit uses a 64-bit C primitive type internally, regardless of whether the target architecture is 32-bit or 64-bit. For unsigned values (i.e., those that do not begin with a `-`), this allows for values up to 264-1 and up to -263 for negative values. As a special case, the JSON Number `-0` is treated as a floating-point number since the underlying floating-point primitive type is capable of representing a negative zero, whereas the underlying twos-complement non-floating-point primitive type can not. JSON that contains Number values that exceed these limits will fail to parse and optionally return a [`NSError`][NSError] object. The functions [`strtoll()`][strtoll] and [`strtoull()`][strtoull] are used to perform the conversions. - - The C `double` primitive type, or [IEEE 754 Double 64-bit floating-point][Double Precision], is used to represent floating-point JSON Number values. JSON that contains floating-point Number values that can not be represented as a `double` (i.e., due to over or underflow) will fail to parse and optionally return a [`NSError`][NSError] object. The function [`strtod()`][strtod] is used to perform the conversion. Note that the JSON standard does not allow for infinities or `NaN` (Not a Number). The conversion and manipulation of [floating-point values is non-trivial](http://www.validlab.com/goldberg/paper.pdf). Unfortunately, [RFC 4627][] is silent on how such details should be handled. You should not depend on or expect that when a floating-point value is round tripped that it will have the same textual representation or even compare equal. This is true even when JSONKit is used as both the parser and creator of the JSON, let alone when transferring JSON between different systems and implementations. - -* For JSON Objects (or [`NSDictionary`][NSDictionary] in JSONKit nomenclature), [RFC 4627][] says `The names within an object SHOULD be unique` (note: `name` is a `key` in JSONKit nomenclature). At this time the JSONKit behavior is `undefined` for JSON that contains names within an object that are not unique. However, JSONKit currently tries to follow a "the last key / value pair parsed is the one chosen" policy. This behavior is not finalized and should not be depended on. - - The previously covered limitations regarding JSON Strings have important consequences for JSON Objects since JSON Strings are used as the `key`. The [JSON specification][RFC 4627] does not specify the details or requirements for JSON Strings used as `keys` in JSON Objects, specifically what it means for two `keys` to compare equal. Unfortunately, because [RFC 4627][] states `JSON text SHALL be encoded in Unicode.`, this means that one must use the [Unicode Standard][] to interpret the JSON, and the [Unicode Standard][] allows for strings that are encoded with different Unicode Code Points to "compare equal". JSONKit uses [`NSString`][NSString] exclusively to manage the parsed JSON Strings. Because [`NSString`][NSString] uses [Unicode][Unicode Standard] as its basis, there exists the possibility that [`NSString`][NSString] may subtly and silently convert the Unicode Code Points contained in the original JSON String in to a [Unicode equivalent][Unicode_equivalence] string. Due to this, the JSONKit behavior for JSON Strings used as `keys` in JSON Objects that may be [Unicode equivalent][Unicode_equivalence] but not binary equivalent is `undefined`. - - **See also:**
-     [W3C - Requirements for String Identity Matching and String Indexing](http://www.w3.org/TR/charreq/#sec2) - -### Objective-C To JSON Primitive Mapping Details - -* When serializing, the top level container, and all of its children, are required to be *strictly* [invariant][wiki_invariant] during enumeration. This property is used to make certain optimizations, such as if a particular object has already been serialized, the result of the previous serialized `UTF8` string can be reused (i.e., the `UTF8` string of the previous serialization can simply be copied instead of performing all the serialization work again). While this is probably only of interest to those who are doing extraordinarily unusual things with the run-time or custom classes inheriting from the classes that JSONKit will serialize (i.e, a custom object whose value mutates each time it receives a message requesting its value for serialization), it also covers the case where any of the objects to be serialized are mutated during enumeration (i.e., mutated by another thread). The number of times JSONKit will request an objects value is non-deterministic, from a minimum of once up to the number of times it appears in the serialized JSON– therefore an object MUST NOT depend on receiving a message requesting its value each time it appears in the serialized output. The behavior is `undefined` if these requirements are violated. - -* The objects to be serialized MUST be acyclic. If the objects to be serialized contain circular references the behavior is `undefined`. For example, - - ```objective-c - [arrayOne addObject:arrayTwo]; - [arrayTwo addObject:arrayOne]; - id json = [arrayOne JSONString]; - ``` - - … will result in `undefined` behavior. - -* The contents of [`NSString`][NSString] objects are encoded as `UTF8` and added to the serialized JSON. JSONKit assumes that [`NSString`][NSString] produces well-formed `UTF8` Unicode and does no additional validation of the conversion. When `JKSerializeOptionEscapeUnicode` is enabled, JSONKit will encode Unicode code points that can be encoded as a single `UTF16` code unit as \uXXXX, and will encode Unicode code points that require `UTF16` surrogate pairs as \uhigh\ulow. While JSONKit makes every effort to serialize the contents of a [`NSString`][NSString] object exactly, modulo any [RFC 4627][] requirements, the [`NSString`][NSString] class uses the [Unicode Standard][] as its basis for representing strings. You should be aware that the [Unicode Standard][] defines [string equivalence][Unicode_equivalence] in a such a way that two strings that compare equal are not required to be bit for bit identical. Therefore there exists the possibility that [`NSString`][NSString] may mutate a string in such a way that it is [Unicode equivalent][Unicode_equivalence], but not bit for bit identical with the original string. - -* The [`NSDictionary`][NSDictionary] class allows for any object, which can be of any class, to be used as a `key`. JSON, however, only permits Strings to be used as `keys`. Therefore JSONKit will fail with an error if it encounters a [`NSDictionary`][NSDictionary] that contains keys that are not [`NSString`][NSString] objects during serialization. More specifically, the keys must return `YES` when sent [`-isKindOfClass:[NSString class]`][-isKindOfClass:]. - -* JSONKit will fail with an error if it encounters an object that is not a [`NSNull`][NSNull], [`NSNumber`][NSNumber], [`NSString`][NSString], [`NSArray`][NSArray], or [`NSDictionary`][NSDictionary] class object during serialization. More specifically, JSONKit will fail with an error if it encounters an object where [`-isKindOfClass:`][-isKindOfClass:] returns `NO` for all of the previously mentioned classes. - -* JSON does not allow for Numbers that are ±Infinity or ±NaN. Therefore JSONKit will fail with an error if it encounters a [`NSNumber`][NSNumber] that contains such a value during serialization. - -* Objects created with [`[NSNumber numberWithBool:YES]`][NSNumber_numberWithBool] and [`[NSNumber numberWithBool:NO]`][NSNumber_numberWithBool] will be mapped to the JSON values of `true` and `false`, respectively. More specifically, an object must have pointer equality with [`kCFBooleanTrue`][kCFBooleanTrue] or [`kCFBooleanFalse`][kCFBooleanFalse] (i.e., `if((id)object == (id)kCFBooleanTrue)`) in order to be mapped to the JSON values `true` and `false`. - -* [`NSNumber`][NSNumber] objects that are not booleans (as defined above) are sent [`-objCType`][-objCType] to determine what type of C primitive type they represent. Those that respond with a type from the set `cislq` are treated as `long long`, those that respond with a type from the set `CISLQB` are treated as `unsigned long long`, and those that respond with a type from the set `fd` are treated as `double`. [`NSNumber`][NSNumber] objects that respond with a type not in the set of types mentioned will cause JSONKit to fail with an error. - - More specifically, [`CFNumberGetValue(object, kCFNumberLongLongType, &longLong)`][CFNumberGetValue] is used to retrieve the value of both the signed and unsigned integer values, and the type reported by [`-objCType`][-objCType] is used to determine whether the result is signed or unsigned. For floating-point values, [`CFNumberGetValue`][CFNumberGetValue] is used to retrieve the value using [`kCFNumberDoubleType`][kCFNumberDoubleType] for the type argument. - - Floating-point numbers are converted to their decimal representation using the [`printf`][printf] format conversion specifier `%.17g`. Theoretically this allows up to a `float`, or [IEEE 754 Single 32-bit floating-point][Single Precision], worth of precision to be represented. This means that for practical purposes, `double` values are converted to `float` values with the associated loss of precision. The [RFC 4627][] standard is silent on how floating-point numbers should be dealt with and the author has found that real world JSON implementations vary wildly in how they handle this issue. Furthermore, the `%g` format conversion specifier may convert floating-point values that can be exactly represented as an integer to a textual representation that does not include a `.` or `e`– essentially silently promoting a floating-point value to an integer value (i.e, `5.0` becomes `5`). Because of these and many other issues surrounding the conversion and manipulation of floating-point values, you should not expect or depend on floating point values to maintain their full precision, or when round tripped, to compare equal. - - -### Reporting Bugs - -Please use the [github.com JSONKit Issue Tracker](https://github.com/johnezang/JSONKit/issues) to report bugs. - -The author requests that you do not file a bug report with JSONKit regarding problems reported by the `clang` static analyzer unless you first manually verify that it is an actual, bona-fide problem with JSONKit and, if appropriate, is not "legal" C code as defined by the C99 language specification. If the `clang` static analyzer is reporting a problem with JSONKit that is not an actual, bona-fide problem and is perfectly legal code as defined by the C99 language specification, then the appropriate place to file a bug report or complaint is with the developers of the `clang` static analyzer. - -### Important Details - -* JSONKit is not designed to be used with the Mac OS X Garbage Collection. The behavior of JSONKit when compiled with `-fobjc-gc` is `undefined`. It is extremely unlikely that Mac OS X Garbage Collection will ever be supported. - -* JSONKit is not designed to be used with [Objective-C Automatic Reference Counting (ARC)][ARC]. The behavior of JSONKit when compiled with `-fobjc-arc` is `undefined`. The behavior of JSONKit compiled without [ARC][] mixed with code that has been compiled with [ARC][] is normatively `undefined` since at this time no analysis has been done to understand if this configuration is safe to use. At this time, there are no plans to support [ARC][] in JSONKit. Although tenative, it is extremely unlikely that [ARC][] will ever be supported, for many of the same reasons that Mac OS X Garbage Collection is not supported. - -* The JSON to be parsed by JSONKit MUST be encoded as Unicode. In the unlikely event you end up with JSON that is not encoded as Unicode, you must first convert the JSON to Unicode, preferably as `UTF8`. One way to accomplish this is with the [`NSString`][NSString] methods [`-initWithBytes:length:encoding:`][NSString_initWithBytes] and [`-initWithData:encoding:`][NSString_initWithData]. - -* Internally, the low level parsing engine uses `UTF8` exclusively. The `JSONDecoder` method `-objectWithData:` takes a [`NSData`][NSData] object as its argument and it is assumed that the raw bytes contained in the [`NSData`][NSData] is `UTF8` encoded, otherwise the behavior is `undefined`. - -* It is not safe to use the same instantiated `JSONDecoder` object from multiple threads at the same time. If you wish to share a `JSONDecoder` between threads, you are responsible for adding mutex barriers to ensure that only one thread is decoding JSON using the shared `JSONDecoder` object at a time. - -### Tips for speed - -* Enable the `NS_BLOCK_ASSERTIONS` pre-processor flag. JSONKit makes heavy use of [`NSCParameterAssert()`][NSCParameterAssert] internally to ensure that various arguments, variables, and other state contains only legal and expected values. If an assertion check fails it causes a run time exception that will normally cause a program to terminate. These checks and assertions come with a price: they take time to execute and do not contribute to the work being performed. It is perfectly safe to enable `NS_BLOCK_ASSERTIONS` as JSONKit always performs checks that are required for correct operation. The checks performed with [`NSCParameterAssert()`][NSCParameterAssert] are completely optional and are meant to be used in "debug" builds where extra integrity checks are usually desired. While your mileage may vary, the author has found that adding `-DNS_BLOCK_ASSERTIONS` to an `-O2` optimization setting can generally result in an approximate 7-12% increase in performance. - -* Since the very low level parsing engine works exclusively with `UTF8` byte streams, anything that is not already encoded as `UTF8` must first be converted to `UTF8`. While JSONKit provides additions to the [`NSString`][NSString] class which allows you to conveniently convert JSON contained in a [`NSString`][NSString], this convenience does come with a price. JSONKit must allocate an autoreleased [`NSMutableData`][NSMutableData] large enough to hold the strings `UTF8` conversion and then convert the string to `UTF8` before it can begin parsing. This takes both memory and time. Once the parsing has finished, JSONKit sets the autoreleased [`NSMutableData`][NSMutableData] length to `0`, which allows the [`NSMutableData`][NSMutableData] to release the memory. This helps to minimize the amount of memory that is in use but unavailable until the autorelease pool pops. Therefore, if speed and memory usage are a priority, you should avoid using the [`NSString`][NSString] convenience methods if possible. - -* If you are receiving JSON data from a web server, and you are able to determine that the raw bytes returned by the web server is JSON encoded as `UTF8`, you should use the `JSONDecoder` method `-objectWithUTF8String:length:` which immediately begins parsing the pointers bytes. In practice, every JSONKit method that converts JSON to an Objective-C object eventually calls this method to perform the conversion. - -* If you are using one of the various ways provided by the `NSURL` family of classes to receive JSON results from a web server, which typically return the results in the form of a [`NSData`][NSData] object, and you are able to determine that the raw bytes contained in the [`NSData`][NSData] are encoded as `UTF8`, then you should use either the `JSONDecoder` method `objectWithData:` or the [`NSData`][NSData] method `-objectFromJSONData`. If are going to be converting a lot of JSON, the better choice is to instantiate a `JSONDecoder` object once and use the same instantiated object to perform all your conversions. This has two benefits: - 1. The [`NSData`][NSData] method `-objectFromJSONData` creates an autoreleased `JSONDecoder` object to perform the one time conversion. By instantiating a `JSONDecoder` object once and using the `objectWithData:` method repeatedly, you can avoid this overhead. - 2. The instantiated object cache from the previous JSON conversion is reused. This can result in both better performance and a reduction in memory usage if the JSON your are converting is very similar. A typical example might be if you are converting JSON at periodic intervals that consists of real time status updates. - -* On average, the JSONData… methods are nearly four times faster than the JSONString… methods when serializing a [`NSDictionary`][NSDictionary] or [`NSArray`][NSArray] to JSON. The difference in speed is due entirely to the instantiation overhead of [`NSString`][NSString]. - -* If at all possible, use [`NSData`][NSData] instead of [`NSString`][NSString] methods when processing JSON. This avoids the sometimes significant conversion overhead that [`NSString`][NSString] performs in order to provide an object oriented interface for its contents. For many uses, using [`NSString`][NSString] is not needed and results in wasted effort– for example, using JSONKit to serialize a [`NSDictionary`][NSDictionary] or [`NSArray`][NSArray] to a [`NSString`][NSString]. This [`NSString`][NSString] is then passed to a method that sends the JSON to a web server, and this invariably requires converting the [`NSString`][NSString] to [`NSData`][NSData] before it can be sent. In this case, serializing the collection object directly to [`NSData`][NSData] would avoid the unnecessary conversions to and from a [`NSString`][NSString] object. - -### Parsing Interface - -#### JSONDecoder Interface - -The objectWith… methods return immutable collection objects and their respective mutableObjectWith… methods return mutable collection objects. - -**Note:** The bytes contained in a [`NSData`][NSData] object ***MUST*** be `UTF8` encoded. - -**Important:** Methods will raise [`NSInvalidArgumentException`][NSInvalidArgumentException] if `parseOptionFlags` is not valid. -**Important:** `objectWithUTF8String:` and `mutableObjectWithUTF8String:` will raise [`NSInvalidArgumentException`][NSInvalidArgumentException] if `string` is `NULL`. -**Important:** `objectWithData:` and `mutableObjectWithData:` will raise [`NSInvalidArgumentException`][NSInvalidArgumentException] if `jsonData` is `NULL`. - -```objective-c -+ (id)decoder; -+ (id)decoderWithParseOptions:(JKParseOptionFlags)parseOptionFlags; -- (id)initWithParseOptions:(JKParseOptionFlags)parseOptionFlags; - -- (void)clearCache; - -- (id)objectWithUTF8String:(const unsigned char *)string length:(size_t)length; -- (id)objectWithUTF8String:(const unsigned char *)string length:(size_t)length error:(NSError **)error; -- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(size_t)length; -- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(size_t)length error:(NSError **)error; - -- (id)objectWithData:(NSData *)jsonData; -- (id)objectWithData:(NSData *)jsonData error:(NSError **)error; -- (id)mutableObjectWithData:(NSData *)jsonData; -- (id)mutableObjectWithData:(NSData *)jsonData error:(NSError **)error; -``` - -#### NSString Interface - -```objective-c -- (id)objectFromJSONString; -- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags; -- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error; -- (id)mutableObjectFromJSONString; -- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags; -- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error; -``` - -#### NSData Interface - -```objective-c -- (id)objectFromJSONData; -- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags; -- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error; -- (id)mutableObjectFromJSONData; -- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags; -- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error; -``` - -#### JKParseOptionFlags - - - - - - - - - -
Parsing OptionDescription
JKParseOptionNoneThis is the default if no other other parse option flags are specified, and the option used when a convenience method does not provide an argument for explicitly specifying the parse options to use. Synonymous with JKParseOptionStrict.
JKParseOptionStrictThe JSON will be parsed in strict accordance with the RFC 4627 specification.
JKParseOptionCommentsAllow C style // and /* … */ comments in JSON. This is a fairly common extension to JSON, but JSON that contains C style comments is not strictly conforming JSON.
JKParseOptionUnicodeNewlinesAllow Unicode recommended (?:\r\n|[\n\v\f\r\x85\p{Zl}\p{Zp}]) newlines in JSON. The JSON specification only allows the newline characters \r and \n, but this option allows JSON that contains the Unicode recommended newline characters to be parsed. JSON that contains these additional newline characters is not strictly conforming JSON.
JKParseOptionLooseUnicodeNormally the decoder will stop with an error at any malformed Unicode. This option allows JSON with malformed Unicode to be parsed without reporting an error. Any malformed Unicode is replaced with \uFFFD, or REPLACEMENT CHARACTER, as specified in The Unicode 6.0 standard, Chapter 3, section 3.9 Unicode Encoding Forms.
JKParseOptionPermitTextAfterValidJSONNormally, non-white-space that follows the JSON is interpreted as a parsing failure. This option allows for any trailing non-white-space to be ignored and not cause a parsing error.
- -### Serializing Interface - -The serializing interface includes [`NSString`][NSString] convenience methods for those that need to serialize a single [`NSString`][NSString]. For those that need this functionality, the [`NSString`][NSString] additions are much more convenient than having to wrap a single [`NSString`][NSString] in a [`NSArray`][NSArray], which then requires stripping the unneeded `[`…`]` characters from the serialized JSON result. When serializing a single [`NSString`][NSString], you can control whether or not the serialized JSON result is surrounded by quotation marks using the `includeQuotes:` argument: - -Example | Result | Argument ---------------|-------------------|-------------------- -`a "test"...` | `"a \"test\"..."` | `includeQuotes:YES` -`a "test"...` | `a \"test\"...` | `includeQuotes:NO` - -**Note:** The [`NSString`][NSString] methods that do not include a `includeQuotes:` argument behave as if invoked with `includeQuotes:YES`. -**Note:** The bytes contained in the returned [`NSData`][NSData] object are `UTF8` encoded. - -#### NSArray and NSDictionary Interface - -```objective-c -- (NSData *)JSONData; -- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error; -- (NSString *)JSONString; -- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error; -``` - - -#### NSString Interface - -```objective-c -- (NSData *)JSONData; -- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error; -- (NSString *)JSONString; -- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error; -``` - -#### JKSerializeOptionFlags - - - - - - - -
Serializing OptionDescription
JKSerializeOptionNoneThis is the default if no other other serialize option flags are specified, and the option used when a convenience method does not provide an argument for explicitly specifying the serialize options to use.
JKSerializeOptionPrettyNormally the serialized JSON does not include any unnecessary white-space. While this form is the most compact, the lack of any white-space means that it's something only another JSON parser could love. Enabling this option causes JSONKit to add additional white-space that makes it easier for people to read. Other than the extra white-space, the serialized JSON is identical to the JSON that would have been produced had this option not been enabled.
JKSerializeOptionEscapeUnicodeWhen JSONKit encounters Unicode characters in NSString objects, the default behavior is to encode those Unicode characters as UTF8. This option causes JSONKit to encode those characters as \uXXXX. For example,
["w∈L⟺y(∣y∣≤∣w∣)"]
becomes:
["w\u2208L\u27fa\u2203y(\u2223y\u2223\u2264\u2223w\u2223)"]
JKSerializeOptionEscapeForwardSlashesAccording to the JSON specification, the / (U+002F) character may be backslash escaped (i.e., \/), but it is not required. The default behavior of JSONKit is to not backslash escape the / character. Unfortunately, it was found some real world implementations of the ASP.NET Date Format require the date to be strictly encoded as \/Date(...)\/, and the only way to achieve this is through the use of JKSerializeOptionEscapeForwardSlashes. See github issue #21 for more information.
- -[JSON]: http://www.json.org/ -[RFC 4627]: http://tools.ietf.org/html/rfc4627 -[RFC 2119]: http://tools.ietf.org/html/rfc2119 -[Single Precision]: http://en.wikipedia.org/wiki/Single_precision_floating-point_format -[Double Precision]: http://en.wikipedia.org/wiki/Double_precision_floating-point_format -[wiki_invariant]: http://en.wikipedia.org/wiki/Invariant_(computer_science) -[ARC]: http://clang.llvm.org/docs/AutomaticReferenceCounting.html -[CFBoolean]: http://developer.apple.com/mac/library/documentation/CoreFoundation/Reference/CFBooleanRef/index.html -[kCFBooleanTrue]: http://developer.apple.com/mac/library/documentation/CoreFoundation/Reference/CFBooleanRef/Reference/reference.html#//apple_ref/doc/c_ref/kCFBooleanTrue -[kCFBooleanFalse]: http://developer.apple.com/mac/library/documentation/CoreFoundation/Reference/CFBooleanRef/Reference/reference.html#//apple_ref/doc/c_ref/kCFBooleanFalse -[kCFNumberDoubleType]: http://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFNumberRef/Reference/reference.html#//apple_ref/doc/c_ref/kCFNumberDoubleType -[CFNumberGetValue]: http://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFNumberRef/Reference/reference.html#//apple_ref/c/func/CFNumberGetValue -[Unicode Standard]: http://www.unicode.org/versions/Unicode6.0.0/ -[Unicode Standard - Conformance]: http://www.unicode.org/versions/Unicode6.0.0/ch03.pdf -[Unicode_equivalence]: http://en.wikipedia.org/wiki/Unicode_equivalence -[UnicodeNewline]: http://en.wikipedia.org/wiki/Newline#Unicode -[Unicode_UTR36]: http://www.unicode.org/reports/tr36/ -[Unicode_UTR36_NonVisualSecurity]: http://www.unicode.org/reports/tr36/#Canonical_Represenation -[Unicode_UTR36_Deleting]: http://www.unicode.org/reports/tr36/#Deletion_of_Noncharacters -[Unicode_Security_FAQ]: http://www.unicode.org/faq/security.html -[NSNull]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSNull_Class/index.html -[NSNumber]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSNumber_Class/index.html -[NSNumber_numberWithBool]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSNumber_Class/Reference/Reference.html#//apple_ref/occ/clm/NSNumber/numberWithBool: -[NSString]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/index.html -[NSString_initWithBytes]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/occ/instm/NSString/initWithBytes:length:encoding: -[NSString_initWithData]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/occ/instm/NSString/initWithData:encoding: -[NSString_UTF8String]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/occ/instm/NSString/UTF8String -[NSArray]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/index.html -[NSDictionary]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/index.html -[NSError]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSError_Class/index.html -[NSData]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/index.html -[NSMutableData]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSMutableData_Class/index.html -[NSInvalidArgumentException]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Constants/Reference/reference.html#//apple_ref/doc/c_ref/NSInvalidArgumentException -[CFString]: http://developer.apple.com/library/mac/#documentation/CoreFoundation/Reference/CFStringRef/Reference/reference.html -[NSCParameterAssert]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html#//apple_ref/c/macro/NSCParameterAssert -[-mutableCopy]: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/Reference/Reference.html%23//apple_ref/occ/instm/NSObject/mutableCopy -[-isKindOfClass:]: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Protocols/NSObject_Protocol/Reference/NSObject.html%23//apple_ref/occ/intfm/NSObject/isKindOfClass: -[-objCType]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSNumber_Class/Reference/Reference.html#//apple_ref/occ/instm/NSNumber/objCType -[strtoll]: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/strtoll.3.html -[strtod]: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/strtod.3.html -[strtoull]: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/strtoull.3.html -[getrusage]: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man2/getrusage.2.html -[printf]: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/printf.3.html -[NSJSONSerialization]: http://developer.apple.com/library/ios/#documentation/Foundation/Reference/NSJSONSerialization_Class/Reference/Reference.html diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/ApptentiveResources/Info.plist b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/ApptentiveResources/Info.plist deleted file mode 100755 index e2ee789..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/ApptentiveResources/Info.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - ATInfoDistributionKey - source - - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/English.lproj/Localizable.strings b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/English.lproj/Localizable.strings deleted file mode 100755 index e474c3f..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/English.lproj/Localizable.strings and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/de.lproj/Localizable.strings b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/de.lproj/Localizable.strings deleted file mode 100755 index 9f775a5..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/de.lproj/Localizable.strings and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/es.lproj/Localizable.strings b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/es.lproj/Localizable.strings deleted file mode 100755 index b7ef32d..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/es.lproj/Localizable.strings and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/ja.lproj/Localizable.strings b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/ja.lproj/Localizable.strings deleted file mode 100755 index acaf437..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/ja.lproj/Localizable.strings and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/pt.lproj/Localizable.strings b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/pt.lproj/Localizable.strings deleted file mode 100755 index 3b39434..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/pt.lproj/Localizable.strings and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/ru.lproj/Localizable.strings b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/ru.lproj/Localizable.strings deleted file mode 100755 index 376e906..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/ru.lproj/Localizable.strings and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/zh-Hans.lproj/Localizable.strings b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/zh-Hans.lproj/Localizable.strings deleted file mode 100755 index 8a2cfb2..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/resources/localization/zh-Hans.lproj/Localizable.strings and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/ATConnect.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/ATConnect.h deleted file mode 100755 index 1329cbe..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/ATConnect.h +++ /dev/null @@ -1,95 +0,0 @@ -// -// ATConnect.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/12/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - - -#if TARGET_OS_IPHONE -#import -#elif TARGET_OS_MAC -#import -#endif - -#define kATConnectVersionString @"0.4.12" - -#if TARGET_OS_IPHONE -#define kATConnectPlatformString @"iOS" -@class ATFeedbackController; -#elif TARGET_OS_MAC -#define kATConnectPlatformString @"Mac OS X" -@class ATFeedbackWindowController; -#endif - -typedef enum { - ATFeedbackControllerDefault, - ATFeedbackControllerSimple -} ATFeedbackControllerType; - - -@interface ATConnect : NSObject { -@private -#if TARGET_OS_IPHONE - ATFeedbackController *feedbackController; - ATFeedbackController *currentFeedbackController; -#elif TARGET_OS_MAC - ATFeedbackWindowController *feedbackWindowController; -#endif - NSMutableDictionary *additionalFeedbackData; - NSString *apiKey; - BOOL showTagline; - BOOL shouldTakeScreenshot; - BOOL showEmailField; - NSString *initialName; - NSString *initialEmailAddress; - ATFeedbackControllerType feedbackControllerType; - NSString *customPlaceholderText; -} -@property (nonatomic, copy) NSString *apiKey; -@property (nonatomic, assign) BOOL showTagline; -@property (nonatomic, assign) BOOL shouldTakeScreenshot; -@property (nonatomic, assign) BOOL showEmailField; -@property (nonatomic, copy) NSString *initialName; -@property (nonatomic, copy) NSString *initialEmailAddress; -@property (nonatomic, assign) ATFeedbackControllerType feedbackControllerType; -/*! Set this if you want some custom text to appear as a placeholder in the - feedback text box. */ -@property (nonatomic, copy) NSString *customPlaceholderText; - -+ (ATConnect *)sharedConnection; - -#if TARGET_OS_IPHONE -/*! - * Presents a feedback controller in the window of the given view controller. - */ -- (void)presentFeedbackControllerFromViewController:(UIViewController *)viewController; - -/*! - * Dismisses the feedback controller. You normally won't need to call this. - */ -- (void)dismissFeedbackControllerAnimated:(BOOL)animated completion:(void (^)(void))completion; -#elif TARGET_OS_MAC -/*! - * Presents a feedback window. - */ -- (IBAction)showFeedbackWindow:(id)sender; -#endif - -/*! Adds an additional data field to any feedback sent. */ -- (void)addAdditionalInfoToFeedback:(NSObject *)object withKey:(NSString *)key; - -/*! Removes an additional data field from the feedback sent. */ -- (void)removeAdditionalInfoFromFeedbackWithKey:(NSString *)key; - -/*! - * Returns the NSBundle corresponding to the bundle containing ATConnect's - * images, xibs, strings files, etc. - */ -+ (NSBundle *)resourceBundle; -@end - -/*! Replacement for NSLocalizedString within ApptentiveConnect. Pulls - localized strings out of the resource bundle. */ -extern NSString *ATLocalizedString(NSString *key, NSString *comment); diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/ATConnect.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/ATConnect.m deleted file mode 100755 index e843793..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/ATConnect.m +++ /dev/null @@ -1,206 +0,0 @@ -// -// ATConnect.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/12/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import "ATConnect.h" -#import "ATBackend.h" -#import "ATContactStorage.h" -#import "ATFeedback.h" -#import "ATUtilities.h" -#if TARGET_OS_IPHONE -#import "ATFeedbackController.h" -#elif TARGET_OS_MAC -#import "ATFeedbackWindowController.h" -#endif - -@implementation ATConnect -@synthesize apiKey, showTagline, shouldTakeScreenshot, showEmailField, initialName, initialEmailAddress, feedbackControllerType, customPlaceholderText; - -+ (ATConnect *)sharedConnection { - static ATConnect *sharedConnection = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedConnection = [[ATConnect alloc] init]; - }); - return sharedConnection; -} - -- (id)init { - if ((self = [super init])) { - self.showEmailField = YES; - self.showTagline = YES; - self.shouldTakeScreenshot = NO; - additionalFeedbackData = [[NSMutableDictionary alloc] init]; - } - return self; -} - -- (void)dealloc { -#if TARGET_OS_IPHONE - if (feedbackController) { - [feedbackController release]; - feedbackController = nil; - } -#elif IF_TARGET_OS_MAC - if (feedbackWindowController) { - [feedbackWindowController release]; - feedbackWindowController = nil; - } -#endif - [additionalFeedbackData release], additionalFeedbackData = nil; - [customPlaceholderText release], customPlaceholderText = nil; - [apiKey release], apiKey = nil; - [initialName release], initialName = nil; - [initialEmailAddress release], initialEmailAddress = nil; - [super dealloc]; -} - -- (void)setApiKey:(NSString *)anAPIKey { - if (apiKey != anAPIKey) { - [apiKey release]; - apiKey = nil; - apiKey = [anAPIKey retain]; - [[ATBackend sharedBackend] setApiKey:self.apiKey]; - } -} - -- (NSDictionary *)additionFeedbackInfo { - return additionalFeedbackData; -} - -- (void)addAdditionalInfoToFeedback:(NSObject *)object withKey:(NSString *)key { - if ([object isKindOfClass:[NSDate class]]) { - [additionalFeedbackData setObject:[ATUtilities stringRepresentationOfDate:(NSDate *)object] forKey:key]; - } else { - [additionalFeedbackData setObject:object forKey:key]; - } -} - -- (void)removeAdditionalInfoFromFeedbackWithKey:(NSString *)key { - [additionalFeedbackData removeObjectForKey:key]; -} - -#if TARGET_OS_IPHONE -- (void)presentFeedbackControllerFromViewController:(UIViewController *)viewController { - @synchronized(self) { - if (currentFeedbackController) { - ATLogInfo(@"Apptentive feedback controller already shown."); - return; - } - UIImage *screenshot = nil; - - if (![[ATBackend sharedBackend] currentFeedback]) { - ATFeedback *feedback = [[ATFeedback alloc] init]; - if (additionalFeedbackData && [additionalFeedbackData count]) { - [feedback addExtraDataFromDictionary:additionalFeedbackData]; - } - if (self.initialName && [self.initialName length] > 0) { - feedback.name = self.initialName; - } - if (self.initialEmailAddress && [self.initialEmailAddress length] > 0) { - feedback.email = self.initialEmailAddress; - } - ATContactStorage *contact = [ATContactStorage sharedContactStorage]; - if (contact.name && [contact.name length] > 0) { - feedback.name = contact.name; - } - if (contact.phone) { - feedback.phone = contact.phone; - } - if (contact.email && [contact.email length] > 0) { - feedback.email = contact.email; - } - [[ATBackend sharedBackend] setCurrentFeedback:feedback]; - [feedback release]; - feedback = nil; - } - if ([[ATBackend sharedBackend] currentFeedback]) { - ATFeedback *currentFeedback = [[ATBackend sharedBackend] currentFeedback]; - if (self.shouldTakeScreenshot && ![currentFeedback hasScreenshot] && self.feedbackControllerType != ATFeedbackControllerSimple) { - screenshot = [ATUtilities imageByTakingScreenshot]; - // Get the rotation of the view hierarchy and rotate the screenshot as - // necessary. - CGFloat rotation = [ATUtilities rotationOfViewHierarchyInRadians:viewController.view]; - screenshot = [ATUtilities imageByRotatingImage:screenshot byRadians:rotation]; - [currentFeedback setScreenshot:screenshot]; - } else if (!self.shouldTakeScreenshot && [currentFeedback hasScreenshot] && (currentFeedback.imageSource == ATFeedbackImageSourceScreenshot)) { - [currentFeedback setScreenshot:nil]; - } - } - - ATFeedbackController *vc = [[ATFeedbackController alloc] init]; - [vc setShowEmailAddressField:self.showEmailField]; - if (self.feedbackControllerType == ATFeedbackControllerSimple) { - vc.deleteCurrentFeedbackOnCancel = YES; - } - if (self.customPlaceholderText) { - [vc setCustomPlaceholderText:self.customPlaceholderText]; - } - [vc setFeedback:[[ATBackend sharedBackend] currentFeedback]]; - - [vc presentFromViewController:viewController animated:YES]; - currentFeedbackController = vc; - } -} - - -- (void)dismissFeedbackControllerAnimated:(BOOL)animated completion:(void (^)(void))completion { - [currentFeedbackController dismissAnimated:animated completion:completion]; -} - - -- (void)feedbackControllerDidDismiss { - @synchronized(self) { - [currentFeedbackController release], currentFeedbackController = nil; - } -} - -#elif TARGET_OS_MAC -- (IBAction)showFeedbackWindow:(id)sender { - if (![[ATBackend sharedBackend] currentFeedback]) { - ATFeedback *feedback = [[ATFeedback alloc] init]; - if (additionalFeedbackData && [additionalFeedbackData count]) { - [feedback addExtraDataFromDictionary:additionalFeedbackData]; - } - if (self.initialName && [self.initialName length] > 0) { - feedback.name = self.initialName; - } - if (self.initialEmailAddress && [self.initialEmailAddress length] > 0) { - feedback.email = self.initialEmailAddress; - } - [[ATBackend sharedBackend] setCurrentFeedback:feedback]; - [feedback release]; - feedback = nil; - } - - if (!feedbackWindowController) { - feedbackWindowController = [[ATFeedbackWindowController alloc] initWithFeedback:[[ATBackend sharedBackend] currentFeedback]]; - } - [feedbackWindowController showWindow:self]; -} -#endif - -+ (NSBundle *)resourceBundle { -#ifdef AT_RESOURCE_BUNDLE - NSURL *bundleURL = [[NSBundle mainBundle] URLForResource:@"ApptentiveResources" withExtension:@"bundle"]; - NSBundle *bundle = [NSBundle bundleWithURL:bundleURL]; - return bundle; -#else - NSBundle *bundle = [NSBundle bundleForClass:[ATConnect class]]; - return bundle; -#endif -} -@end - -NSString *ATLocalizedString(NSString *key, NSString *comment) { - static NSBundle *bundle = nil; - if (!bundle) { - bundle = [[ATConnect resourceBundle] retain]; - } - NSString *result = [bundle localizedStringForKey:key value:key table:nil]; - return result; -} diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/ATConnect_Private.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/ATConnect_Private.h deleted file mode 100755 index e77eb63..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/ATConnect_Private.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ATConnect_Private.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 1/20/13. -// Copyright (c) 2013 Apptentive, Inc. All rights reserved. -// - -#import "ATConnect.h" - -@interface ATConnect () -- (void)feedbackControllerDidDismiss; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/ApptentiveConnect-Prefix.pch b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/ApptentiveConnect-Prefix.pch deleted file mode 100755 index 18b4136..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/ApptentiveConnect-Prefix.pch +++ /dev/null @@ -1,8 +0,0 @@ -// -// Prefix header for all source files of the 'ApptentiveConnect' target in the 'ApptentiveConnect' project -// - -#ifdef __OBJC__ - #import - #import "ATLog.h" -#endif diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATFeedbackController.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATFeedbackController.h deleted file mode 100755 index cb68d04..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATFeedbackController.h +++ /dev/null @@ -1,66 +0,0 @@ -// -// ATFeedbackController.h -// CustomWindow -// -// Created by Andrew Wooster on 9/24/11. -// Copyright 2011 Apptentive, Inc. All rights reserved. -// - -#import -#import "ATSimpleImageViewController.h" - -@class ATDefaultTextView; -@class ATFeedback; -@class ATToolbar; - -@interface ATFeedbackController : UIViewController { - UIViewController *presentingViewController; - -@private - UIStatusBarStyle startingStatusBarStyle; - UIImageView *paperclipView; - UIImageView *paperclipBackgroundView; - UIView *photoFrameContainerView; - UIControl *photoControl; - UIImage *currentImage; - BOOL showEmailAddressField; - BOOL deleteCurrentFeedbackOnCancel; - - UIPanGestureRecognizer *photoPanRecognizer; - CGPoint photoDragOffset; - CGAffineTransform photoFrameTransform; - - UIWindow *originalPresentingWindow; -} -@property (nonatomic, retain) IBOutlet UIWindow *window; -@property (nonatomic, retain) IBOutlet UIBarButtonItem *doneButton; -@property (nonatomic, retain) IBOutlet ATToolbar *toolbar; -@property (nonatomic, retain) IBOutlet UIView *redLineView; -@property (nonatomic, retain) IBOutlet UIView *grayLineView; -@property (nonatomic, retain) IBOutlet UIView *backgroundView; -@property (nonatomic, retain) IBOutlet UIScrollView *scrollView; -@property (nonatomic, retain) IBOutlet UITextField *emailField; -@property (nonatomic, retain) IBOutlet UIView *feedbackContainerView; -@property (nonatomic, retain) IBOutlet ATDefaultTextView *feedbackView; -@property (nonatomic, retain) IBOutlet UIControl *logoControl; -@property (nonatomic, retain) IBOutlet UIImageView *logoImageView; -@property (nonatomic, retain) IBOutlet UILabel *taglineLabel; - - -@property (nonatomic, retain) ATFeedback *feedback; -@property (nonatomic, copy) NSString *customPlaceholderText; -@property (nonatomic, assign) ATFeedbackAttachmentOptions attachmentOptions; -@property (nonatomic, assign) BOOL showEmailAddressField; -@property (nonatomic, assign) BOOL deleteCurrentFeedbackOnCancel; - -- (id)init; -- (IBAction)cancelFeedback:(id)sender; -- (IBAction)donePressed:(id)sender; -- (IBAction)photoPressed:(id)sender; -- (IBAction)showInfoView:(id)sender; - -- (void)presentFromViewController:(UIViewController *)presentingViewController animated:(BOOL)animated; -- (void)dismissAnimated:(BOOL)animated completion:(void (^)(void))completion; -- (void)dismiss:(BOOL)animated; -- (void)unhide:(BOOL)animated; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATFeedbackController.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATFeedbackController.m deleted file mode 100755 index 73a9050..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATFeedbackController.m +++ /dev/null @@ -1,1069 +0,0 @@ -// -// ATFeedbackController.m -// CustomWindow -// -// Created by Andrew Wooster on 9/24/11. -// Copyright 2011 Apptentive, Inc. All rights reserved. -// - -#import - -#import "ATFeedbackController.h" - -#import "ATConnect_Private.h" -#import "ATContactStorage.h" -#import "ATCustomButton.h" -#import "ATToolbar.h" -#import "ATDefaultTextView.h" -#import "ATBackend.h" -#import "ATConnect.h" -#import "ATFeedback.h" -#import "ATFeedbackMetrics.h" -#import "ATHUDView.h" -#import "ATInfoViewController.h" -#import "ATSimpleImageViewController.h" -#import "ATUtilities.h" -#import "ATShadowView.h" - -#define DEG_TO_RAD(angle) ((M_PI * angle) / 180.0) -#define RAD_TO_DEG(radians) (radians * (180.0/M_PI)) - -enum { - kFeedbackPaperclipTag = 400, - kFeedbackPaperclipBackgroundTag = 401, - kFeedbackPhotoFrameTag = 402, - kFeedbackPhotoControlTag = 403, - kFeedbackPhotoPreviewTag = 404, - kFeedbackPhotoFrameContainerTag = 405, - kFeedbackPhotoHighlightTag = 406, - kContainerViewTag = 1009, - kATEmailAlertTextFieldTag = 1010, - kFeedbackGradientLayerTag = 1011, -}; - -@interface ATFeedbackController (Private) -- (void)teardown; -- (void)setupFeedback; -- (BOOL)shouldReturn:(UIView *)view; -- (UIWindow *)findMainWindowPreferringMainScreen:(BOOL)preferMainScreen; -- (UIWindow *)windowForViewController:(UIViewController *)viewController; -+ (CGFloat)rotationOfViewHierarchyInRadians:(UIView *)leafView; -+ (CGAffineTransform)viewTransformInWindow:(UIWindow *)window; -- (void)statusBarChanged:(NSNotification *)notification; -- (void)applicationDidBecomeActive:(NSNotification *)notification; -- (BOOL)shouldShowPaperclip; -- (BOOL)shouldShowThumbnail; -- (void)captureFeedbackState; -- (void)hide:(BOOL)animated; -- (void)finishHide; -- (void)finishUnhide; -- (CGRect)photoControlFrame; -- (CGFloat)attachmentVerticalOffset; -- (void)updateThumbnail; -- (void)updateThumbnailOffsetWithScale:(CGSize)scale; -- (void)sendFeedbackAndDismiss; -- (void)updateSendButtonState; -- (void)photoDragged:(UIPanGestureRecognizer *)recognizer; -@end - -@interface ATFeedbackController (Positioning) -- (BOOL)isIPhoneAppInIPad; -- (CGRect)onscreenRectOfView; -- (CGPoint)offscreenPositionOfView; -- (void)positionInWindow; -@end - -@implementation ATFeedbackController -@synthesize feedbackContainerView; -@synthesize window; -@synthesize doneButton; -@synthesize toolbar; -@synthesize redLineView; -@synthesize grayLineView; -@synthesize backgroundView; -@synthesize scrollView; -@synthesize emailField; -@synthesize feedbackView; -@synthesize logoControl; -@synthesize logoImageView; -@synthesize taglineLabel; -@synthesize attachmentOptions; -@synthesize feedback; -@synthesize customPlaceholderText; -@synthesize showEmailAddressField; -@synthesize deleteCurrentFeedbackOnCancel; - -- (id)init { - self = [super initWithNibName:@"ATFeedbackController" bundle:[ATConnect resourceBundle]]; - if (self != nil) { - showEmailAddressField = YES; - startingStatusBarStyle = [[UIApplication sharedApplication] statusBarStyle]; - self.attachmentOptions = ATFeedbackAllowPhotoAttachment | ATFeedbackAllowTakePhotoAttachment; - } - return self; -} - -- (void)dealloc { - [super dealloc]; -} - -- (void)setFeedback:(ATFeedback *)newFeedback { - if (feedback != newFeedback) { - [feedback release]; - feedback = nil; - feedback = [newFeedback retain]; - [self setupFeedback]; - } -} - -- (void)presentFromViewController:(UIViewController *)newPresentingViewController animated:(BOOL)animated { - [self retain]; - - if (self.showEmailAddressField == NO) { - CGRect emailFrame = [self.emailField frame]; - CGRect feedbackFrame = [self.feedbackContainerView frame]; - feedbackFrame.size.height += (feedbackFrame.origin.y - emailFrame.origin.y); - feedbackFrame.origin.y = emailFrame.origin.y; - [self.emailField setHidden:YES]; - [self.grayLineView setHidden:YES]; - [self.feedbackContainerView setFrame:feedbackFrame]; - } - - if (presentingViewController != newPresentingViewController) { - [presentingViewController release], presentingViewController = nil; - presentingViewController = [newPresentingViewController retain]; - [presentingViewController.view setUserInteractionEnabled:NO]; - } - - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarChanged:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarChanged:) name:UIApplicationDidChangeStatusBarFrameNotification object:nil]; - - CALayer *l = self.view.layer; - - UIWindow *parentWindow = [self windowForViewController:presentingViewController]; - if (!parentWindow) { - ATLogError(@"Unable to find parentWindow!"); - } - if (originalPresentingWindow != parentWindow) { - [originalPresentingWindow release], originalPresentingWindow = nil; - originalPresentingWindow = [parentWindow retain]; - } - CGRect animationBounds = CGRectZero; - CGPoint animationCenter = CGPointZero; - - CGAffineTransform t = [ATFeedbackController viewTransformInWindow:parentWindow]; - self.window.transform = t; - self.window.hidden = NO; - [parentWindow resignKeyWindow]; - [self.window makeKeyAndVisible]; - animationBounds = parentWindow.bounds; - animationCenter = parentWindow.center; - - - // Animate in from above. - self.window.bounds = animationBounds; - self.window.windowLevel = UIWindowLevelNormal; - CGPoint center = animationCenter; - center.y = ceilf(center.y); - - CGRect endingFrame = [[UIScreen mainScreen] applicationFrame]; - - [self positionInWindow]; - - if ([self.emailField.text isEqualToString:@""] && self.showEmailAddressField) { - [self.emailField becomeFirstResponder]; - } else { - [self.feedbackView becomeFirstResponder]; - } - - self.window.center = CGPointMake(CGRectGetMidX(endingFrame), CGRectGetMidY(endingFrame)); - self.view.center = [self offscreenPositionOfView]; - - CGRect newFrame = [self onscreenRectOfView]; - CGPoint newViewCenter = CGPointMake(CGRectGetMidX(newFrame), CGRectGetMidY(newFrame)); - - ATShadowView *shadowView = [[ATShadowView alloc] initWithFrame:self.window.bounds]; - shadowView.tag = kFeedbackGradientLayerTag; - [self.window addSubview:shadowView]; - [self.window sendSubviewToBack:shadowView]; - shadowView.alpha = 1.0; - - l.cornerRadius = 10.0; - l.backgroundColor = [UIColor colorWithPatternImage:[ATBackend imageNamed:@"at_dialog_paper_bg"]].CGColor; - - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { - [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent]; - } else { - [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque]; - } - - [UIView animateWithDuration:0.3 animations:^(void){ - self.view.center = newViewCenter; - shadowView.alpha = 1.0; - } completion:^(BOOL finished) { - self.window.hidden = NO; - if ([self.emailField.text isEqualToString:@""] && self.showEmailAddressField) { - [self.emailField becomeFirstResponder]; - } else { - [self.feedbackView becomeFirstResponder]; - } - }]; - [shadowView release], shadowView = nil; - - [[NSNotificationCenter defaultCenter] postNotificationName:ATFeedbackDidShowWindowNotification object:self userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:ATFeedbackWindowTypeFeedback] forKey:ATFeedbackWindowTypeKey]]; -} - -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; -} - -#pragma mark - View lifecycle - -- (void)viewDidLoad { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(feedbackChanged:) name:UITextViewTextDidChangeNotification object:self.feedbackView]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenshotChanged:) name:ATImageViewChoseImage object:nil]; - - self.redLineView.backgroundColor = [UIColor colorWithPatternImage:[ATBackend imageNamed:@"at_dotted_red_line"]]; - self.grayLineView.backgroundColor = [UIColor colorWithPatternImage:[ATBackend imageNamed:@"at_gray_line"]]; - self.redLineView.opaque = NO; - self.grayLineView.opaque = NO; - self.redLineView.layer.opaque = NO; - self.grayLineView.layer.opaque = NO; - - self.logoImageView.image = [ATBackend imageNamed:@"at_apptentive_icon_small"]; - self.taglineLabel.text = ATLocalizedString(@"Feedback Powered by Apptentive", @"Tagline text"); - if (![[ATConnect sharedConnection] showTagline]) { - [self.logoControl setHidden:YES]; - } - - if ([self shouldShowPaperclip]) { - CGRect viewBounds = self.view.bounds; - UIImage *paperclipBackground = [ATBackend imageNamed:@"at_paperclip_background"]; - paperclipBackgroundView = [[UIImageView alloc] initWithImage:paperclipBackground]; - [self.view addSubview:paperclipBackgroundView]; - paperclipBackgroundView.frame = CGRectMake(viewBounds.size.width - paperclipBackground.size.width + 3.0, [self attachmentVerticalOffset] + 6.0, paperclipBackground.size.width, paperclipBackground.size.height); - paperclipBackgroundView.tag = kFeedbackPaperclipBackgroundTag; - paperclipBackgroundView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; - - UIImage *paperclip = [ATBackend imageNamed:@"at_paperclip_foreground"]; - paperclipView = [[UIImageView alloc] initWithImage:paperclip]; - [self.view addSubview:paperclipView]; - paperclipView.frame = CGRectMake(viewBounds.size.width - paperclip.size.width + 6.0, [self attachmentVerticalOffset], paperclip.size.width, paperclip.size.height); - paperclipView.tag = kFeedbackPaperclipTag; - paperclipView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; - - photoControl = [[UIControl alloc] initWithFrame:[self photoControlFrame]]; - photoControl.tag = kFeedbackPhotoControlTag; - [photoControl addTarget:self action:@selector(photoPressed:) forControlEvents:UIControlEventTouchUpInside]; - photoControl.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; - [self.view addSubview:photoControl]; - } - - ATCustomButton *cancelButton = [[ATCustomButton alloc] initWithButtonStyle:ATCustomButtonStyleCancel]; - [cancelButton setAction:@selector(cancelFeedback:) forTarget:self]; - - ATCustomButton *sendButton = [[ATCustomButton alloc] initWithButtonStyle:ATCustomButtonStyleSend]; - [sendButton setAction:@selector(donePressed:) forTarget:self]; - self.doneButton = sendButton; - - NSMutableArray *toolbarItems = [[self.toolbar items] mutableCopy]; - [toolbarItems insertObject:cancelButton atIndex:0]; - [toolbarItems addObject:sendButton]; - - UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; - titleLabel.text = ATLocalizedString(@"Give Feedback", @"Title of feedback screen."); - titleLabel.textAlignment = UITextAlignmentCenter; - titleLabel.textColor = [UIColor colorWithRed:105/256. green:105/256. blue:105/256. alpha:1.0]; - titleLabel.shadowColor = [UIColor whiteColor]; - titleLabel.shadowOffset = CGSizeMake(0.0, 1.0); - titleLabel.font = [UIFont boldSystemFontOfSize:18.0]; - titleLabel.backgroundColor = [UIColor clearColor]; - titleLabel.minimumFontSize = 12; - titleLabel.adjustsFontSizeToFitWidth = YES; - titleLabel.opaque = NO; - [titleLabel sizeToFit]; - CGRect titleFrame = titleLabel.frame; - titleLabel.frame = titleFrame; - - UIBarButtonItem *titleButton = [[UIBarButtonItem alloc] initWithCustomView:titleLabel]; - [toolbarItems insertObject:titleButton atIndex:2]; - [titleButton release], titleButton = nil; - [titleLabel release], titleLabel = nil; - - self.emailField.placeholder = ATLocalizedString(@"Email Address", @"Email Address Field Placeholder"); - - if (self.customPlaceholderText) { - self.feedbackView.placeholder = self.customPlaceholderText; - } else { - self.feedbackView.placeholder = ATLocalizedString(@"Feedback (required)", @"Feedback placeholder"); - } - - self.toolbar.items = toolbarItems; - [toolbarItems release], toolbarItems = nil; - [cancelButton release], cancelButton = nil; - [sendButton release], sendButton = nil; - - [self setupFeedback]; - [self updateSendButtonState]; - [super viewDidLoad]; -} - -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - // return YES; - return (interfaceOrientation == UIInterfaceOrientationPortrait); -} - -- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { -} - -- (IBAction)donePressed:(id)sender { - [self captureFeedbackState]; - if (self.showEmailAddressField && (!self.feedback.email || [self.feedback.email length] == 0)) { - self.window.windowLevel = UIWindowLevelNormal; - NSString *title = ATLocalizedString(@"No email address?", @"Lack of email dialog title."); - NSString *message = ATLocalizedString(@"We can't respond without one.", @"Lack of email dialog message."); - UIAlertView *emailAlert = [[UIAlertView alloc] initWithTitle:title message:message delegate:self cancelButtonTitle:nil otherButtonTitles:ATLocalizedString(@"Send Feedback", @"Send button title"), nil]; - BOOL useNativeTextField = [emailAlert respondsToSelector:@selector(alertViewStyle)]; - UITextField *field = nil; - - if (useNativeTextField) { - // iOS 5 and above. - [emailAlert setAlertViewStyle:2]; // UIAlertViewStylePlainTextInput - field = [emailAlert textFieldAtIndex:0]; - [field retain]; - } else { - NSString *messagePadded = [NSString stringWithFormat:@"%@\n\n\n", message]; - [emailAlert setMessage:messagePadded]; - field = [[UITextField alloc] initWithFrame:CGRectMake(16, 83, 252, 25)]; - field.font = [UIFont systemFontOfSize:18]; - field.textColor = [UIColor lightGrayColor]; - field.backgroundColor = [UIColor clearColor]; - field.keyboardAppearance = UIKeyboardAppearanceAlert; - field.borderStyle = UITextBorderStyleRoundedRect; - } - field.keyboardType = UIKeyboardTypeEmailAddress; - field.delegate = self; - field.autocapitalizationType = UITextAutocapitalizationTypeNone; - field.placeholder = ATLocalizedString(@"Email Address", @"Email address popup placeholder text."); - field.tag = kATEmailAlertTextFieldTag; - - if (!useNativeTextField) { - [field becomeFirstResponder]; - [emailAlert addSubview:field]; - } - [field release], field = nil; - [emailAlert sizeToFit]; - [emailAlert show]; - [emailAlert release]; - } else { - [self sendFeedbackAndDismiss]; - } - [[NSNotificationCenter defaultCenter] postNotificationName:ATFeedbackDidHideWindowNotification object:self userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:ATFeedbackEventTappedSend] forKey:ATFeedbackWindowHideEventKey]]; -} - -- (IBAction)photoPressed:(id)sender { - [self.emailField resignFirstResponder]; - [self.feedbackView resignFirstResponder]; - [self hide:YES]; - [self captureFeedbackState]; - [self retain]; - ATSimpleImageViewController *vc = [[ATSimpleImageViewController alloc] initWithDelegate:self]; - [presentingViewController presentModalViewController:vc animated:YES]; - [vc release]; -} - -- (IBAction)showInfoView:(id)sender { - [self hide:YES]; - ATInfoViewController *vc = [[ATInfoViewController alloc] initWithFeedbackController:self]; - [presentingViewController presentModalViewController:vc animated:YES]; - [vc release]; -} - -- (IBAction)cancelFeedback:(id)sender { - [self captureFeedbackState]; - [self dismiss:YES]; - [[NSNotificationCenter defaultCenter] postNotificationName:ATFeedbackDidHideWindowNotification object:self userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:ATFeedbackEventTappedCancel] forKey:ATFeedbackWindowHideEventKey]]; -} - -- (void)dismissAnimated:(BOOL)animated completion:(void (^)(void))completion { - [self captureFeedbackState]; - - [self.emailField resignFirstResponder]; - [self.feedbackView resignFirstResponder]; - - CGPoint endingPoint = [self offscreenPositionOfView]; - - UIView *gradientView = [self.window viewWithTag:kFeedbackGradientLayerTag]; - - CGFloat duration = 0; - if (animated) { - duration = 0.3; - } - [UIView animateWithDuration:duration animations:^(void){ - self.view.center = endingPoint; - gradientView.alpha = 0.0; - } completion:^(BOOL finished) { - [self.emailField resignFirstResponder]; - [self.feedbackView resignFirstResponder]; - UIView *gradientView = [self.window viewWithTag:kFeedbackGradientLayerTag]; - [gradientView removeFromSuperview]; - - [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidChangeStatusBarOrientationNotification object:nil]; - [presentingViewController.view setUserInteractionEnabled:YES]; - [self.window resignKeyWindow]; - [self.window removeFromSuperview]; - self.window.hidden = YES; - [[UIApplication sharedApplication] setStatusBarStyle:startingStatusBarStyle]; - [self teardown]; - [self release]; - - if (completion) { - completion(); - } - [[ATConnect sharedConnection] feedbackControllerDidDismiss]; - }]; -} - -- (void)dismiss:(BOOL)animated { - [self dismissAnimated:animated completion:nil]; -} - -- (void)unhide:(BOOL)animated { - self.window.windowLevel = UIWindowLevelNormal; - self.window.hidden = NO; - if (animated) { - [UIView animateWithDuration:0.2 animations:^(void){ - self.window.alpha = 1.0; - } completion:^(BOOL complete){ - [self finishUnhide]; - }]; - } else { - [self finishUnhide]; - } -} - -#pragma mark ATSimpleImageViewControllerDelegate -- (void)imageViewController:(ATSimpleImageViewController *)vc pickedImage:(UIImage *)image fromSource:(ATFeedbackImageSource)source { - self.feedback.imageSource = source; - [self.feedback setScreenshot:image]; -} - -- (void)imageViewControllerWillDismiss:(ATSimpleImageViewController *)vc animated:(BOOL)animated { - [self unhide:animated]; - [self release]; -} - -- (ATFeedbackAttachmentOptions)attachmentOptionsForImageViewController:(ATSimpleImageViewController *)vc { - return self.attachmentOptions; -} - -- (UIImage *)defaultImageForImageViewController:(ATSimpleImageViewController *)vc { - if ([self.feedback hasScreenshot]) { - return [[self.feedback copyScreenshot] autorelease]; - } - return nil; -} - -#pragma mark UITextFieldDelegate -- (BOOL)textFieldShouldReturn:(UITextField *)textField { - return [self shouldReturn:textField]; -} - -#pragma mark UIAlertViewDelegate -- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { - UITextField *textField = (UITextField *)[alertView viewWithTag:kATEmailAlertTextFieldTag]; - if (textField) { - self.feedback.email = textField.text; - [self sendFeedbackAndDismiss]; - } -} -@end - -@implementation ATFeedbackController (Private) - -- (void)teardown { - [[NSNotificationCenter defaultCenter] removeObserver:self]; - [self.window removeFromSuperview]; - self.window = nil; - - [paperclipBackgroundView removeFromSuperview]; - [paperclipBackgroundView release], paperclipBackgroundView = nil; - - [paperclipView removeFromSuperview]; - [paperclipView release], paperclipView = nil; - - [photoControl removeFromSuperview]; - [photoControl release], photoControl = nil; - - [photoFrameContainerView removeFromSuperview]; - [photoFrameContainerView release], photoFrameContainerView = nil; - - [feedbackContainerView release], feedbackContainerView = nil; - - self.doneButton = nil; - self.toolbar = nil; - self.redLineView = nil; - self.grayLineView = nil; - self.backgroundView = nil; - self.scrollView = nil; - self.emailField = nil; - self.feedbackView = nil; - self.logoControl = nil; - self.logoImageView = nil; - self.taglineLabel = nil; - self.feedback = nil; - self.customPlaceholderText = nil; - [currentImage release], currentImage = nil; - [originalPresentingWindow makeKeyWindow]; - [presentingViewController release], presentingViewController = nil; - [originalPresentingWindow release], originalPresentingWindow = nil; - if (self.deleteCurrentFeedbackOnCancel) { - [[ATBackend sharedBackend] setCurrentFeedback:nil]; - } -} - -- (void)setupFeedback { - if (self.feedbackView && [self.feedbackView isDefault] && self.feedback.text) { - self.feedbackView.text = self.feedback.text; - } - if (self.emailField && (!self.emailField.text || [@"" isEqualToString:self.emailField.text]) && self.feedback.email) { - self.emailField.text = self.feedback.email; - } - if ([self isViewLoaded]) { - // Avoid touching self.view before viewDidLoad. - [self updateThumbnail]; - } -} - -- (BOOL)shouldReturn:(UIView *)view { - if (view == self.emailField) { - [self.feedbackView becomeFirstResponder]; - return NO; - } else if (view == self.feedbackView) { - [self.feedbackView resignFirstResponder]; - return YES; - } - return YES; -} - -- (UIWindow *)findMainWindowPreferringMainScreen:(BOOL)preferMainScreen { - UIApplication *application = [UIApplication sharedApplication]; - for (UIWindow *tmpWindow in [[application windows] reverseObjectEnumerator]) { - if (tmpWindow.rootViewController || tmpWindow.isKeyWindow) { - if (preferMainScreen && [tmpWindow respondsToSelector:@selector(screen)]) { - if (tmpWindow.screen && [tmpWindow.screen isEqual:[UIScreen mainScreen]]) { - return tmpWindow; - } - } else { - return tmpWindow; - } - } - } - return nil; -} - -- (UIWindow *)windowForViewController:(UIViewController *)viewController { - UIWindow *result = nil; - UIView *rootView = [viewController view]; - if (rootView.window) { - result = rootView.window; - } - if (!result) { - result = [self findMainWindowPreferringMainScreen:YES]; - if (!result) { - result = [self findMainWindowPreferringMainScreen:NO]; - } - } - return result; -} - -+ (CGFloat)rotationOfViewHierarchyInRadians:(UIView *)leafView { - CGAffineTransform t = leafView.transform; - UIView *s = leafView.superview; - while (s && s != leafView.window) { - t = CGAffineTransformConcat(t, s.transform); - s = s.superview; - } - return atan2(t.b, t.a); -} - -+ (CGAffineTransform)viewTransformInWindow:(UIWindow *)window { - CGAffineTransform result = CGAffineTransformIdentity; - do { // once - if (!window) break; - - if ([[window rootViewController] view]) { - CGFloat rotation = [ATFeedbackController rotationOfViewHierarchyInRadians:[[window rootViewController] view]]; - result = CGAffineTransformMakeRotation(rotation); - break; - } - - if ([[window subviews] count]) { - for (UIView *v in [window subviews]) { - if (!CGAffineTransformIsIdentity(v.transform)) { - result = v.transform; - break; - } - } - } - } while (NO); - return result; -} - -- (void)statusBarChanged:(NSNotification *)notification { - [self positionInWindow]; -} - - -- (void)applicationDidBecomeActive:(NSNotification *)notification { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - if (self.window.hidden == NO) { - [self retain]; - [self unhide:NO]; - } - [pool release], pool = nil; -} - -- (BOOL)shouldShowPaperclip { - return (attachmentOptions != 0); -} - -- (BOOL)shouldShowThumbnail { - return [feedback hasScreenshot]; -} - -- (void)feedbackChanged:(NSNotification *)notification { - if (notification.object == self.feedbackView) { - [self updateSendButtonState]; - } -} - -- (void)contactInfoChanged:(NSNotification *)notification { - ATContactStorage *contact = [ATContactStorage sharedContactStorage]; - if (contact.name) { - feedback.name = contact.name; - } - if (contact.phone) { - feedback.phone = contact.phone; - } - if (contact.email) { - feedback.email = contact.email; - } -} - -- (void)screenshotChanged:(NSNotification *)notification { - if ([self.feedback hasScreenshot]) { - [self updateThumbnail]; - } -} - -- (void)captureFeedbackState { - self.feedback.text = self.feedbackView.text; - self.feedback.email = self.emailField.text; -} - - -- (void)hide:(BOOL)animated { - [self retain]; - - self.window.windowLevel = UIWindowLevelNormal; - [self.emailField resignFirstResponder]; - [self.feedbackView resignFirstResponder]; - - if (animated) { - [UIView animateWithDuration:0.2 animations:^(void){ - self.window.alpha = 0.0; - } completion:^(BOOL finished) { - [self finishHide]; - }]; - } else { - [self finishHide]; - } -} - -- (void)finishHide { - self.window.alpha = 0.0; - self.window.hidden = YES; - [self.emailField resignFirstResponder]; - [self.feedbackView resignFirstResponder]; - [self.window removeFromSuperview]; -} - -- (void)finishUnhide { - [self updateThumbnail]; - self.window.alpha = 1.0; - [self.window makeKeyAndVisible]; - [self positionInWindow]; - if (self.showEmailAddressField) { - [self.emailField becomeFirstResponder]; - } else { - [self.feedbackView becomeFirstResponder]; - } - [self release]; -} - - -- (CGRect)photoControlFrame { - if ([self shouldShowThumbnail] && [self shouldShowPaperclip]) { - return photoFrameContainerView.frame; - } else { - CGRect f = paperclipView.frame; - f.size.height += 10; - return f; - } -} - -- (CGFloat)attachmentVerticalOffset { - return self.toolbar.bounds.size.height - 4.0; -} - -- (void)updateThumbnail { - @synchronized(self) { - if (photoPanRecognizer) { - [photoPanRecognizer release], photoPanRecognizer = nil; - } - if ([self shouldShowPaperclip]) { - UIImage *image = [feedback copyScreenshot]; - UIImageView *thumbnailView = nil; - - CGRect paperclipBackgroundFrame = paperclipBackgroundView.frame; - paperclipBackgroundFrame.origin.y = [self attachmentVerticalOffset] + 6.0; - paperclipBackgroundView.frame = paperclipBackgroundFrame; - - CGRect paperclipFrame = paperclipView.frame; - paperclipFrame.origin.y = [self attachmentVerticalOffset]; - paperclipView.frame = paperclipFrame; - - if (image == nil) { - [currentImage release], currentImage = nil; - if (photoFrameContainerView != nil) { - [photoFrameContainerView removeFromSuperview]; - [photoFrameContainerView release], photoFrameContainerView = nil; - } - photoControl.transform = paperclipView.transform; - photoControl.frame = [self photoControlFrame]; - } else { - if (photoFrameContainerView == nil) { - CGRect viewBounds = self.view.bounds; - UIImage *photoFrameImage = [ATBackend imageNamed:@"at_photo"]; - CGRect photoFrameContainerFrame = CGRectMake(viewBounds.size.width - photoFrameImage.size.width - 2.0, [self attachmentVerticalOffset], photoFrameImage.size.width, photoFrameImage.size.height); - photoFrameContainerView = [[UIView alloc] initWithFrame:photoFrameContainerFrame]; - photoFrameContainerView.tag = kFeedbackPhotoFrameContainerTag; - [self.view addSubview:photoFrameContainerView]; - - UIImageView *photoFrameView = [[[UIImageView alloc] initWithImage:photoFrameImage] autorelease]; - photoFrameView.tag = kFeedbackPhotoFrameTag; - - [photoFrameContainerView addSubview:photoFrameView]; - photoFrameContainerView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; - } - CGRect photoFrameFrame = photoFrameContainerView.frame; - photoFrameFrame.origin.y = [self attachmentVerticalOffset]; - photoFrameContainerView.frame = photoFrameFrame; - thumbnailView = (UIImageView *)[photoFrameContainerView viewWithTag:kFeedbackPhotoPreviewTag]; - photoFrameTransform = photoFrameContainerView.transform; - - if (thumbnailView == nil) { - thumbnailView = [[[UIImageView alloc] init] autorelease]; - thumbnailView.tag = kFeedbackPhotoPreviewTag; - thumbnailView.contentMode = UIViewContentModeTop; - thumbnailView.clipsToBounds = YES; - - UIView *highlightView = [[[UIView alloc] initWithFrame:thumbnailView.frame] autorelease]; - highlightView.tag = kFeedbackPhotoHighlightTag; - - //thumbnailView.backgroundColor = [UIColor blackColor]; - [photoFrameContainerView addSubview:thumbnailView]; - [photoFrameContainerView sendSubviewToBack:thumbnailView]; - [photoFrameContainerView addSubview:highlightView]; - [photoFrameContainerView bringSubviewToFront:highlightView]; - - [self.view bringSubviewToFront:paperclipBackgroundView]; - [self.view bringSubviewToFront:photoFrameContainerView]; - [self.view bringSubviewToFront:paperclipView]; - [self.view bringSubviewToFront:photoControl]; - - thumbnailView.transform = CGAffineTransformMakeRotation(DEG_TO_RAD(3.5)); - } - - photoFrameContainerView.alpha = 1.0; - CGFloat scale = [[UIScreen mainScreen] scale]; - - if (![image isEqual:currentImage]) { - [currentImage release], currentImage = nil; - currentImage = [image retain]; - CGSize imageSize = image.size; - CGSize scaledImageSize = imageSize; - CGFloat fitDimension = 70.0 * scale; - - if (imageSize.width > imageSize.height) { - scaledImageSize.height = fitDimension; - scaledImageSize.width = (fitDimension/imageSize.height) * imageSize.width; - } else { - scaledImageSize.height = (fitDimension/imageSize.width) * imageSize.height; - scaledImageSize.width = fitDimension; - } - UIImage *scaledImage = [ATUtilities imageByScalingImage:image toSize:scaledImageSize scale:scale fromITouchCamera:(feedback.imageSource == ATFeedbackImageSourceCamera)]; - thumbnailView.bounds = CGRectMake(0.0, 0.0, 70.0, 70.0); - thumbnailView.image = scaledImage; - } - CGRect f = CGRectMake(11.5, 11.5, 70, 70); - thumbnailView.frame = f; - thumbnailView.bounds = CGRectMake(0.0, 0.0, 70.0, 70.0); - UIView *updatingHighlightView = [photoFrameContainerView viewWithTag:kFeedbackPhotoHighlightTag]; - CGRect highlightFrame = thumbnailView.frame; - highlightFrame.origin.x += 5; - highlightFrame.origin.y += 1; - highlightFrame.size.width -= 10; - highlightFrame.size.height -= 1; - updatingHighlightView.frame = highlightFrame; - updatingHighlightView.transform = thumbnailView.transform; - - photoControl.frame = [self photoControlFrame]; - photoControl.transform = photoFrameContainerView.transform; - - photoPanRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(photoDragged:)]; - photoPanRecognizer.minimumNumberOfTouches = 1; - photoPanRecognizer.maximumNumberOfTouches = 1; - photoPanRecognizer.delaysTouchesBegan = YES; - photoPanRecognizer.cancelsTouchesInView = YES; - [photoControl addGestureRecognizer:photoPanRecognizer]; - [image release], image = nil; - } - } - } -} - -- (void)updateThumbnailOffsetWithScale:(CGSize)scale { - @synchronized(self) { - if ([self shouldShowPaperclip]) { - CGAffineTransform newPhotoFrameTransform = photoFrameTransform; - if (!CGPointEqualToPoint(CGPointZero, photoDragOffset)) { - newPhotoFrameTransform = CGAffineTransformTranslate(newPhotoFrameTransform, photoDragOffset.x, photoDragOffset.y); - } - if (!CGSizeEqualToSize(CGSizeZero, scale)) { - newPhotoFrameTransform = CGAffineTransformScale(newPhotoFrameTransform, scale.width, scale.height); - } - photoControl.transform = newPhotoFrameTransform; - photoFrameContainerView.transform = newPhotoFrameTransform; - } - } -} - -- (void)sendFeedbackAndDismiss { - [[ATBackend sharedBackend] sendFeedback:self.feedback]; - UIWindow *parentWindow = originalPresentingWindow; - if (parentWindow) { - ATHUDView *hud = [[ATHUDView alloc] initWithWindow:parentWindow]; - hud.label.text = ATLocalizedString(@"Thanks!", @"Text in thank you display upon submitting feedback."); - [hud show]; - [hud autorelease]; - } - - [self dismiss:YES]; -} - -- (void)updateSendButtonState { - NSString *trimmedText = [self.feedbackView.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; - BOOL empty = [trimmedText length] == 0; - self.doneButton.enabled = !empty; - self.doneButton.style = empty == YES ? UIBarButtonItemStyleBordered : UIBarButtonItemStyleDone; -} - -- (void)photoDragged:(UIPanGestureRecognizer *)recognizer { - CGFloat dragDistance = 75; - if (recognizer == photoPanRecognizer) { - if (recognizer.state == UIGestureRecognizerStateCancelled) { - photoDragOffset = CGPointZero; - [self updateThumbnailOffsetWithScale:CGSizeZero]; - } else if (recognizer.state == UIGestureRecognizerStateBegan) { - photoDragOffset = CGPointZero; - [self updateThumbnailOffsetWithScale:CGSizeZero]; - } else if (recognizer.state == UIGestureRecognizerStateChanged) { - CGPoint translation = [recognizer translationInView:self.view]; - UIView *highlightView = [photoFrameContainerView viewWithTag:kFeedbackPhotoHighlightTag]; - translation.x = MIN(8, translation.x); - photoDragOffset = translation; - CGFloat distance = sqrt(photoDragOffset.x*photoDragOffset.x + photoDragOffset.y*photoDragOffset.y); - if (distance > dragDistance) { - highlightView.backgroundColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:0.2]; - } else { - highlightView.backgroundColor = [UIColor clearColor]; - } - [self updateThumbnailOffsetWithScale:CGSizeZero]; - } else if (recognizer.state == UIGestureRecognizerStateEnded) { - CGFloat distance = sqrt(photoDragOffset.x*photoDragOffset.x + photoDragOffset.y*photoDragOffset.y); - if (distance > dragDistance) { - [UIView animateWithDuration:0.3 animations:^(void){ - [self updateThumbnailOffsetWithScale:CGSizeMake(2, 2)]; - photoFrameContainerView.alpha = 0.0; - } completion:^(BOOL complete){ - [self.feedback setScreenshot:nil]; - photoDragOffset = CGPointZero; - [self updateThumbnail]; - }]; - } else { - [UIView animateWithDuration:0.3 animations:^(void){ - photoDragOffset = CGPointZero; - [self updateThumbnailOffsetWithScale:CGSizeZero]; - } completion:^(BOOL complete){ - // do nothing - }]; - } - } - } -} -@end - - -@implementation ATFeedbackController (Positioning) -- (BOOL)isIPhoneAppInIPad { - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { - NSString *model = [[UIDevice currentDevice] model]; - if ([model isEqualToString:@"iPad"]) { - return YES; - } - } - return NO; -} - -- (CGRect)onscreenRectOfView { - BOOL constrainViewWidth = [self isIPhoneAppInIPad]; - UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; - CGSize statusBarSize = [[UIApplication sharedApplication] statusBarFrame].size; - CGRect screenBounds = [[UIScreen mainScreen] bounds]; - CGFloat w = statusBarSize.width; - CGFloat h = statusBarSize.height; - if (CGSizeEqualToSize(CGSizeZero, statusBarSize)) { - w = screenBounds.size.width; - h = screenBounds.size.height; - } - - BOOL isLandscape = NO; - - CGFloat windowWidth = 0.0; - - switch (orientation) { - case UIInterfaceOrientationLandscapeLeft: - case UIInterfaceOrientationLandscapeRight: - isLandscape = YES; - windowWidth = h; - break; - case UIInterfaceOrientationPortraitUpsideDown: - case UIInterfaceOrientationPortrait: - default: - windowWidth = w; - break; - } - - CGFloat viewHeight = 0.0; - CGFloat viewWidth = 0.0; - CGFloat originY = 0.0; - CGFloat originX = 0.0; - - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { - viewHeight = isLandscape ? 368.0 : 368.0; - originY = isLandscape ? 20.0 : 200; - viewWidth = windowWidth - 12*2 - 100.0; - originX = floorf((windowWidth - viewWidth)/2.0); - } else { - CGFloat landscapeKeyboardHeight = 162; - CGFloat portraitKeyboardHeight = 216; - viewHeight = self.view.window.bounds.size.height - (isLandscape ? landscapeKeyboardHeight + 8 - 37 : portraitKeyboardHeight + 8); - viewWidth = windowWidth - 12; - originX = 6.0; - if (constrainViewWidth) { - viewWidth = MIN(320, windowWidth - 12); - } - } - - CGRect f = self.view.frame; - f.origin.y = originY; - f.origin.x = originX; - f.size.width = viewWidth; - f.size.height = viewHeight; - - return f; -} - -- (CGPoint)offscreenPositionOfView { - CGRect f = [self onscreenRectOfView]; - CGSize statusBarSize = [[UIApplication sharedApplication] statusBarFrame].size; - CGFloat statusBarHeight = MIN(statusBarSize.height, statusBarSize.width); - CGFloat viewHeight = f.size.height; - - CGRect offscreenViewRect = f; - offscreenViewRect.origin.y = -(viewHeight + statusBarHeight); - CGPoint offscreenPoint = CGPointMake(CGRectGetMidX(offscreenViewRect), CGRectGetMidY(offscreenViewRect)); - - return offscreenPoint; -} - -- (void)positionInWindow { - UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; - - CGFloat angle = 0.0; - CGRect newFrame = originalPresentingWindow.bounds; - CGSize statusBarSize = [[UIApplication sharedApplication] statusBarFrame].size; - - switch (orientation) { - case UIInterfaceOrientationPortraitUpsideDown: - angle = M_PI; - newFrame.size.height -= statusBarSize.height; - break; - case UIInterfaceOrientationLandscapeLeft: - angle = - M_PI / 2.0f; - newFrame.origin.x += statusBarSize.width; - newFrame.size.width -= statusBarSize.width; - break; - case UIInterfaceOrientationLandscapeRight: - angle = M_PI / 2.0f; - newFrame.size.width -= statusBarSize.width; - break; - case UIInterfaceOrientationPortrait: - default: - angle = 0.0; - newFrame.origin.y += statusBarSize.height; - newFrame.size.height -= statusBarSize.height; - break; - } - [self.toolbar sizeToFit]; - - CGRect toolbarBounds = self.toolbar.bounds; - UIView *containerView = [self.view viewWithTag:kContainerViewTag]; - if (containerView != nil) { - CGRect containerFrame = containerView.frame; - containerFrame.origin.y = toolbarBounds.size.height; - containerFrame.size.height = self.view.bounds.size.height - toolbarBounds.size.height; - containerView.frame = containerFrame; - } - - self.window.transform = CGAffineTransformMakeRotation(angle); - self.window.frame = newFrame; - CGRect onscreenRect = [self onscreenRectOfView]; - CGFloat viewWidth = onscreenRect.size.width; - self.view.frame = onscreenRect; - - CGRect feedbackViewFrame = self.feedbackView.frame; - feedbackViewFrame.origin.x = 0.0; - - // Either email field is shown and there's a thumbnail, or email is hidden. - BOOL textIsBlockedByPaperclip = NO; - if ([self shouldShowPaperclip] && [self shouldShowThumbnail]) { - textIsBlockedByPaperclip = YES; - } else if ([self shouldShowPaperclip] && ![self showEmailAddressField]) { - textIsBlockedByPaperclip = YES; - } - if (textIsBlockedByPaperclip) { - feedbackViewFrame.size.width = viewWidth - 100; - self.feedbackView.scrollIndicatorInsets = UIEdgeInsetsMake(0.0, 0.0, 0.0, -100.0); - } else { - feedbackViewFrame.size.width = viewWidth; - self.feedbackView.scrollIndicatorInsets = UIEdgeInsetsMake(0.0, 0.0, 0.0, 0.0); - } - self.feedbackView.frame = feedbackViewFrame; - - [self updateThumbnail]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATFeedbackTypes.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATFeedbackTypes.h deleted file mode 100755 index 1fb37ab..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATFeedbackTypes.h +++ /dev/null @@ -1,12 +0,0 @@ -// -// ATFeedbackTypes.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 10/30/12. -// Copyright (c) 2012 Apptentive, Inc. All rights reserved. -// - -typedef enum { - ATFeedbackAllowPhotoAttachment = 1 << 0, - ATFeedbackAllowTakePhotoAttachment = 1 << 1, -} ATFeedbackAttachmentOptions; diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATInfoViewController.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATInfoViewController.h deleted file mode 100755 index 8c55794..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATInfoViewController.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// ATInfoViewController.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 5/23/11. -// Copyright 2011 Apptentive, Inc. All rights reserved. -// - -#import - -@class ATFeedbackController; - -/*! View controller for showing information about Apptentive, as well as the - tasks which are currently in progress. */ -@interface ATInfoViewController : UIViewController { - IBOutlet UIView *headerView; - IBOutlet UITableViewCell *progressCell; -@private - ATFeedbackController *controller; - NSMutableArray *logicalSections; -} -@property (nonatomic, retain) IBOutlet UITableView *tableView; -@property (retain, nonatomic) IBOutlet UIView *headerView; - -- (id)init; -- (id)initWithFeedbackController:(ATFeedbackController *)aController; -- (IBAction)done:(id)sender; -- (IBAction)openApptentiveDotCom:(id)sender; -- (IBAction)openPrivacyPolicy:(id)sender; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATInfoViewController.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATInfoViewController.m deleted file mode 100755 index caddb89..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATInfoViewController.m +++ /dev/null @@ -1,274 +0,0 @@ -// -// ATInfoViewController.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 5/23/11. -// Copyright 2011 Apptentive, Inc. All rights reserved. -// - -#import "ATInfoViewController.h" -#import "ATAPIRequest.h" -#import "ATBackend.h" -#import "ATConnect.h" -#import "ATFeedback.h" -#import "ATFeedbackController.h" -#import "ATFeedbackMetrics.h" -#import "ATFeedbackTask.h" -#import "ATLogViewController.h" -#import "ATTask.h" -#import "ATTaskQueue.h" - -enum { - kSectionTasks, - kSectionDebugLog, - kSectionVersion, -}; - -@interface ATInfoViewController (Private) -- (void)setup; -- (void)teardown; -- (void)reload; -@end - -@implementation ATInfoViewController { - BOOL showingDebugController; -} -@synthesize tableView, headerView; - -- (id)init { - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { - self = [super initWithNibName:@"ATInfoViewController" bundle:[ATConnect resourceBundle]]; - } else { - self = [super initWithNibName:@"ATInfoViewController_iPad" bundle:[ATConnect resourceBundle]]; - self.modalPresentationStyle = UIModalPresentationFormSheet; - } - return self; -} - -- (id)initWithFeedbackController:(ATFeedbackController *)aController { - self = [self init]; - controller = [aController retain]; - return self; -} - -- (void)dealloc { - [logicalSections release], logicalSections = nil; - [controller release], controller = nil; - [self teardown]; - [super dealloc]; -} - - -- (void)didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - - // Release any cached data, images, etc that aren't in use. -} - -#pragma mark - View lifecycle -- (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - if (showingDebugController) { - showingDebugController = NO; - } else { - [[NSNotificationCenter defaultCenter] postNotificationName:ATFeedbackDidShowWindowNotification object:self userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:ATFeedbackWindowTypeInfo] forKey:ATFeedbackWindowTypeKey]]; - } -} - -- (void)viewDidLoad { - [super viewDidLoad]; - [self setup]; -} - -- (void)viewDidUnload { - [super viewDidUnload]; - [headerView release], headerView = nil; - self.tableView = nil; -} - -- (void)viewWillDisappear:(BOOL)animated { - if (!showingDebugController) { - if (controller != nil) { - [controller unhide:animated]; - [controller release], controller = nil; - } - } -} - -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - // Return YES for supported orientations - return YES; -} - -- (IBAction)done:(id)sender { - [self dismissModalViewControllerAnimated:YES]; - [[NSNotificationCenter defaultCenter] postNotificationName:ATFeedbackDidHideWindowNotification object:self userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:ATFeedbackWindowTypeInfo] forKey:ATFeedbackWindowTypeKey]]; -} - -- (IBAction)openApptentiveDotCom:(id)sender { - [[UIApplication sharedApplication] openURL:[[ATBackend sharedBackend] apptentiveHomepageURL]]; -} - -- (IBAction)openPrivacyPolicy:(id)sender { - [[UIApplication sharedApplication] openURL:[[ATBackend sharedBackend] apptentivePrivacyPolicyURL]]; -} - -#pragma mark UITableViewDelegate -- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - NSUInteger physicalSection = indexPath.section; - NSUInteger section = [[logicalSections objectAtIndex:physicalSection] integerValue]; - if (section == kSectionDebugLog) { - showingDebugController = YES; - ATLogViewController *vc = [[ATLogViewController alloc] init]; - UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:vc]; - [self presentModalViewController:nc animated:YES]; - [vc release], vc = nil; - [nc release], nc = nil; - } - [aTableView deselectRowAtIndexPath:indexPath animated:YES]; -} - -#pragma mark UITableViewDataSource -- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)physicalSection { - NSUInteger section = [[logicalSections objectAtIndex:physicalSection] integerValue]; - - if (section == kSectionTasks) { - ATTaskQueue *queue = [ATTaskQueue sharedTaskQueue]; - return [queue countOfTasksWithTaskNamesInSet:[NSSet setWithObjects:@"feedback", nil]]; - } else if (section == kSectionDebugLog) { - return 1; - } else { - return 0; - } -} - -- (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *taskCellIdentifier = @"ATTaskProgressCellIdentifier"; - static NSString *logCellIdentifier = @"ATLogViewCellIdentifier"; - UITableViewCell *result = nil; - - NSUInteger physicalSection = indexPath.section; - NSUInteger section = [[logicalSections objectAtIndex:physicalSection] integerValue]; - - if (section == kSectionTasks) { - ATTaskQueue *queue = [ATTaskQueue sharedTaskQueue]; - ATTask *task = [queue taskAtIndex:indexPath.row withTaskNameInSet:[NSSet setWithObjects:@"feedback", nil]]; - result = [aTableView dequeueReusableCellWithIdentifier:taskCellIdentifier]; - if (!result) { - UINib *nib = [UINib nibWithNibName:@"ATTaskProgressCell" bundle:[ATConnect resourceBundle]]; - [nib instantiateWithOwner:self options:nil]; - result = progressCell; - [[result retain] autorelease]; - [progressCell release], progressCell = nil; - } - - UILabel *label = (UILabel *)[result viewWithTag:1]; - UIProgressView *progressView = (UIProgressView *)[result viewWithTag:2]; - UILabel *detailLabel = (UILabel *)[result viewWithTag:4]; - - if ([task isKindOfClass:[ATFeedbackTask class]]) { - ATFeedbackTask *feedbackTask = (ATFeedbackTask *)task; - label.text = feedbackTask.feedback.text; - } else { - label.text = [task description]; - } - - if (task.failed) { - detailLabel.hidden = NO; - if (task.lastErrorTitle) { - detailLabel.text = [NSString stringWithFormat:@"Failed: %@", task.lastErrorTitle]; - } - progressView.hidden = YES; - } else if (task.inProgress) { - detailLabel.hidden = YES; - progressView.hidden = NO; - progressView.progress = [task percentComplete]; - } else { - detailLabel.hidden = NO; - detailLabel.text = @"Waiting…"; - progressView.hidden = YES; - } - } else if (section == kSectionDebugLog) { - result = [aTableView dequeueReusableCellWithIdentifier:logCellIdentifier]; - if (!result) { - result = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:logCellIdentifier] autorelease]; - } - result.textLabel.text = @"View Debug Logs"; - } else { - NSAssert(NO, @"Unknown section."); - } - return result; -} - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)aTableView { - return [logicalSections count]; -} - -- (NSString *)tableView:(UITableView *)aTableView titleForHeaderInSection:(NSInteger)physicalSection { - NSString *result = nil; - - NSUInteger section = [[logicalSections objectAtIndex:physicalSection] integerValue]; - if (section == kSectionTasks) { - result = ATLocalizedString(@"Running Tasks", @"Running tasks section header"); - } - return result; -} - -- (NSString *)tableView:(UITableView *)aTableView titleForFooterInSection:(NSInteger)physicalSection { - NSString *result = nil; - NSUInteger section = [[logicalSections objectAtIndex:physicalSection] integerValue]; - if (section == kSectionTasks) { - ATTaskQueue *queue = [ATTaskQueue sharedTaskQueue]; - if ([queue count]) { - result = ATLocalizedString(@"These are the pieces of feedback which are currently being submitted.", @"Section footer for feedback being uploaded."); - } else { - result = ATLocalizedString(@"No feedback waiting to upload.", @"Section footer for no feedback being updated."); - } - } else if (section == kSectionVersion) { - result = [NSString stringWithFormat:@"ApptentiveConnect v%@", kATConnectVersionString]; - } - return result; -} -@end - - -@implementation ATInfoViewController (Private) -- (void)setup { - if (headerView) { - [headerView release], headerView = nil; - } - if (logicalSections) { - [logicalSections release], logicalSections = nil; - } - logicalSections = [[NSMutableArray alloc] init]; - [logicalSections addObject:@(kSectionTasks)]; -#if APPTENTIVE_DEBUG_LOG_VIEWER - [logicalSections addObject:@(kSectionDebugLog)]; -#endif - [logicalSections addObject:@(kSectionVersion)]; - - UIImage *logoImage = [ATBackend imageNamed:@"at_logo_info"]; - UINib *nib = [UINib nibWithNibName:@"ATAboutApptentiveView" bundle:[ATConnect resourceBundle]]; - [nib instantiateWithOwner:self options:nil]; - UIImageView *logoView = (UIImageView *)[headerView viewWithTag:2]; - logoView.image = logoImage; - CGRect f = logoView.frame; - f.size = logoImage.size; - logoView.frame = f; - tableView.delegate = self; - tableView.dataSource = self; - tableView.tableHeaderView = self.headerView; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reload) name:ATAPIRequestStatusChanged object:nil]; -} - -- (void)teardown { - [[NSNotificationCenter defaultCenter] removeObserver:self]; - [headerView release], headerView = nil; - [tableView release], tableView = nil; -} - -- (void)reload { - [self.tableView reloadData]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATLogViewController.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATLogViewController.h deleted file mode 100755 index be7bc67..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATLogViewController.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// ATLogViewController.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/6/13. -// Copyright (c) 2013 Apptentive, Inc. All rights reserved. -// - -#import - -@interface ATLogViewController : UIViewController -@property (nonatomic, retain) UITextView *textView; - -- (IBAction)done:(id)sender; -- (IBAction)reloadLogs:(id)sender; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATLogViewController.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATLogViewController.m deleted file mode 100755 index e374daf..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Controllers/ATLogViewController.m +++ /dev/null @@ -1,69 +0,0 @@ -// -// ATLogViewController.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/6/13. -// Copyright (c) 2013 Apptentive, Inc. All rights reserved. -// - -#import "ATLogViewController.h" - -#import "ATLogger.h" -#import "ATTaskQueue.h" - -@implementation ATLogViewController -@synthesize textView; - -- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; - if (self) { - // Custom initialization - } - return self; -} - -- (void)dealloc { - [textView removeFromSuperview]; - [textView release], textView = nil; - [super dealloc]; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - textView = [[UITextView alloc] initWithFrame:self.view.bounds]; - textView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - textView.delegate = self; - textView.showsHorizontalScrollIndicator = YES; - [self.view addSubview:textView]; - - self.navigationItem.title = @"Debug Logs"; - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done:)]; - self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(reloadLogs:)]; - - ATLogInfo(@"%@", [[ATTaskQueue sharedTaskQueue] queueDescription]); - - self.textView.text = [[ATLogger sharedLogger] currentLogText]; - self.textView.editable = NO; - [self performSelector:@selector(reloadLogs:) withObject:nil afterDelay:0.1]; -} - -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - [textView removeFromSuperview]; - [textView release], textView = nil; -} - -- (void)done:(id)sender { - [self dismissModalViewControllerAnimated:YES]; -} - -- (IBAction)reloadLogs:(id)sender { - self.textView.text = [[ATLogger sharedLogger] currentLogText]; - [self.textView scrollRangeToVisible:NSMakeRange([[self.textView text] length] - 1, 1)]; -} - -#pragma mark - UITextViewDelegate -- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { - return NO; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATCenteringImageScrollView.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATCenteringImageScrollView.h deleted file mode 100755 index 1a3526f..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATCenteringImageScrollView.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// ATCenteringImageScrollView.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/27/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import - - -@interface ATCenteringImageScrollView : UIScrollView { -@private - UIImageView *imageView; -} -- (id)initWithImage:(UIImage *)image; -- (UIImageView *)imageView; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATCenteringImageScrollView.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATCenteringImageScrollView.m deleted file mode 100755 index b696d8f..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATCenteringImageScrollView.m +++ /dev/null @@ -1,53 +0,0 @@ -// -// ATCenteringImageScrollView.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/27/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import "ATCenteringImageScrollView.h" - - -@implementation ATCenteringImageScrollView - -- (id)initWithImage:(UIImage *)image { - if ((self = [super init])) { - imageView = [[UIImageView alloc] initWithImage:image]; - self.frame = imageView.bounds; - [self addSubview:imageView]; - self.contentSize = imageView.bounds.size; - } - return self; -} - -- (void)dealloc { - [imageView removeFromSuperview]; - [imageView release]; - imageView = nil; - [super dealloc]; -} - -- (UIImageView *)imageView { - return imageView; -} - -- (void)layoutSubviews { - [super layoutSubviews]; - - // Center the image. - CGSize boundsSize = self.bounds.size; - CGRect frameToCenter = imageView.frame; - if (frameToCenter.size.width < boundsSize.width) { - frameToCenter.origin.x = (boundsSize.width - frameToCenter.size.width)/2.0; - } else { - frameToCenter.origin.x = 0.0; - } - if (frameToCenter.size.height < boundsSize.height) { - frameToCenter.origin.y = (boundsSize.height - frameToCenter.size.height)/2.0; - } else { - frameToCenter.origin.y = 0.0; - } - imageView.frame = frameToCenter; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATCustomButton.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATCustomButton.h deleted file mode 100755 index 099045d..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATCustomButton.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// ATCustomButton.h -// CustomWindow -// -// Created by Andrew Wooster on 9/24/11. -// Copyright 2011 Apptentive, Inc. All rights reserved. -// - -#import -#import -#import "ATBackend.h" - -typedef enum { - ATCustomButtonStyleCancel, - ATCustomButtonStyleSend -} ATCustomButtonStyle; - -@interface ATTrackingButton : UIButton { -@private - UIImageView *shadowView; - UIEdgeInsets padding; -} -@property (nonatomic, assign) UIEdgeInsets padding; -@end - -@interface ATCustomButton : UIBarButtonItem -- (id)initWithButtonStyle:(ATCustomButtonStyle)style; -- (void)setAction:(SEL)action forTarget:(id)target; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATCustomButton.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATCustomButton.m deleted file mode 100755 index 57e1c1f..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATCustomButton.m +++ /dev/null @@ -1,125 +0,0 @@ -// -// ATCustomButton.m -// CustomWindow -// -// Created by Andrew Wooster on 9/24/11. -// Copyright 2011 Apptentive, Inc. All rights reserved. -// - -#import "ATCustomButton.h" -#import "ATConnect.h" - -@implementation ATCustomButton - -- (id)initWithButtonStyle:(ATCustomButtonStyle)style { - ATTrackingButton *button = [ATTrackingButton buttonWithType:UIButtonTypeCustom]; - button.padding = UIEdgeInsetsMake(-10, -20, -10, -15); - if (style == ATCustomButtonStyleCancel) { - [button setTitle:ATLocalizedString(@"Cancel", @"Cancel button title") forState:UIControlStateNormal]; - button.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin; - button.titleLabel.font = [UIFont boldSystemFontOfSize:12.0]; - button.titleLabel.shadowOffset = CGSizeMake(0.0, 1.0); - - [button setTitleShadowColor:[UIColor whiteColor] forState:UIControlStateNormal]; - [button setTitleColor:[UIColor colorWithRed:130./256. green:130./256. blue:130./256. alpha:1.0] forState:UIControlStateNormal]; - //[button setTitleColor:[UIColor blackColor] forState:UIControlStateHighlighted]; - [button setBackgroundImage:[ATBackend imageNamed:@"at_cancel_bg"] forState:UIControlStateNormal]; - [button setBackgroundImage:[ATBackend imageNamed:@"at_cancel_highlighted_bg"] forState:UIControlStateHighlighted]; - button.layer.cornerRadius = 4.0; - button.layer.masksToBounds = YES; - button.layer.borderWidth = 0.5; - button.layer.borderColor = [UIColor colorWithRed:171./256. green:171./256. blue:171./256. alpha:1.0].CGColor; - button.layer.shadowColor = [UIColor whiteColor].CGColor; - button.layer.shadowOffset = CGSizeMake(0.0, 1.0); - button.layer.shadowRadius = 2.0; - [button sizeToFit]; - } else if (style == ATCustomButtonStyleSend) { - [button setTitle:ATLocalizedString(@"Send", @"Send button title") forState:UIControlStateNormal]; - button.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin; - button.titleLabel.font = [UIFont boldSystemFontOfSize:12.0]; - button.titleLabel.shadowOffset = CGSizeMake(0.0, -1.0); - - [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; - [button setTitleShadowColor:[UIColor colorWithRed:63./256. green:63./256. blue:63./256. alpha:1.0] forState:UIControlStateNormal]; - [button setTitleColor:[UIColor colorWithRed: 0.79 green: 0.86 blue: 0.99 alpha: 1] forState:UIControlStateDisabled]; - [button setTitleShadowColor:[UIColor colorWithWhite:0 alpha:0.5] forState:UIControlStateDisabled]; - - [button setBackgroundImage:[ATBackend imageNamed:@"at_send_bg"] forState:UIControlStateNormal]; - [button setBackgroundImage:[ATBackend imageNamed:@"at_send_highlighted_bg"] forState:UIControlStateHighlighted]; - [button setBackgroundImage:[ATBackend imageNamed:@"at_send_disabled_bg"] forState:UIControlStateDisabled]; - button.layer.cornerRadius = 4.0; - button.layer.masksToBounds = YES; - button.layer.shadowColor = [UIColor whiteColor].CGColor; - button.layer.shadowOffset = CGSizeMake(0.0, 1.0); - button.layer.shadowRadius = 2.0; - [button sizeToFit]; - - } - - self = [super initWithCustomView:button]; - if (self) { - - } - return self; -} - -- (void)setAction:(SEL)action forTarget:(id)target { - if ([[self customView] isKindOfClass:[UIButton class]]) { - UIButton *button = (UIButton *)[self customView]; - [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside]; - self.target = target; - self.action = action; - } - self.target = target; - self.action = action; -} -@end - - -@implementation ATTrackingButton -@synthesize padding; - -- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event { - CGRect padded = UIEdgeInsetsInsetRect(self.bounds, padding); - return CGRectContainsPoint(padded, point); -} - -- (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { - CGRect padded = UIEdgeInsetsInsetRect(self.bounds, padding); - return CGRectContainsPoint(padded, [touch locationInView:self]); -} - -- (void)setupButtonShadow { - if (shadowView == nil) { - UIImage *shadowImage = [[ATBackend imageNamed:@"at_button_shadow_overlay"] stretchableImageWithLeftCapWidth:5 topCapHeight:5]; - shadowView = [[UIImageView alloc] initWithImage:shadowImage]; - //shadowView.backgroundColor = [UIColor redColor]; - [self addSubview:shadowView]; - } -} - -- (CGSize)sizeThatFits:(CGSize)size { - CGSize s = [super sizeThatFits:size]; - - CGSize textSize = [self.titleLabel.text sizeWithFont:self.titleLabel.font]; - s.height = size.height < 30 && CGSizeEqualToSize(CGSizeZero, size) == NO ? 23 : 30; - s.width = textSize.width + 20.0; - - return s; -} - -- (void)layoutSubviews { - [super layoutSubviews]; - [self setupButtonShadow]; - shadowView.frame = self.bounds; - [self bringSubviewToFront:shadowView]; -} - -- (void)dealloc { - if (shadowView) { - [shadowView removeFromSuperview]; - [shadowView release], shadowView = nil; - } - [super dealloc]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATDefaultTextView.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATDefaultTextView.h deleted file mode 100755 index 756479b..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATDefaultTextView.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// ATDefaultTextView.h -// DemoApp -// -// Created by Andrew Wooster on 3/16/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import - - -@interface ATDefaultTextView : UITextView { -@private - UILabel *placeholderLabel; -} -@property (nonatomic, copy) NSString *placeholder; -- (BOOL)isDefault; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATDefaultTextView.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATDefaultTextView.m deleted file mode 100755 index 8dd8a74..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATDefaultTextView.m +++ /dev/null @@ -1,103 +0,0 @@ -// -// ATDefaultTextView.m -// DemoApp -// -// Created by Andrew Wooster on 3/16/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import "ATDefaultTextView.h" - -@interface ATDefaultTextView (Private) -- (void)setup; -- (void)setupPlaceholder; -- (void)didEdit:(NSNotification *)notification; -@end - -@implementation ATDefaultTextView -@synthesize placeholder; - -- (id)initWithFrame:(CGRect)frame { - if ((self = [super initWithFrame:frame])) { - [self setup]; - } - return self; -} - -- (void)awakeFromNib { - [super awakeFromNib]; - [self setup]; -} - -- (void)dealloc { - self.placeholder = nil; - [placeholderLabel removeFromSuperview]; - [placeholderLabel release]; - placeholderLabel = nil; - [super dealloc]; -} - -- (void)layoutSubviews { - [super layoutSubviews]; - [self setupPlaceholder]; -} - -- (void)setPlaceholder:(NSString *)newPlaceholder { - if (placeholder != newPlaceholder) { - [placeholder release]; - placeholder = nil; - placeholder = [newPlaceholder retain]; - [self setupPlaceholder]; - } -} - -- (BOOL)isDefault { - if (!self.text || [self.text length] == 0) return YES; - return NO; -} -@end - - -@implementation ATDefaultTextView (Private) - -- (void)setup { - self.text = @""; - placeholderLabel = [[UILabel alloc] initWithFrame:CGRectZero]; - placeholderLabel.userInteractionEnabled = NO; - placeholderLabel.backgroundColor = [UIColor clearColor]; - placeholderLabel.opaque = NO; - placeholderLabel.textColor = [UIColor lightGrayColor]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didEdit:) name:UITextViewTextDidBeginEditingNotification object:self]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didEdit:) name:UITextViewTextDidChangeNotification object:self]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didEdit:) name:UITextViewTextDidEndEditingNotification object:self]; - [self setupPlaceholder]; -} - -- (void)setupPlaceholder { - if ([self isDefault]) { - placeholderLabel.text = self.placeholder; - placeholderLabel.font = self.font; - placeholderLabel.textAlignment = self.textAlignment; - placeholderLabel.numberOfLines = 0; - placeholderLabel.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; - [placeholderLabel sizeToFit]; - [self addSubview:placeholderLabel]; - CGFloat padding = 8.0; - CGRect b = placeholderLabel.bounds; - b.size.width = self.bounds.size.width - padding*2.0; - placeholderLabel.bounds = b; - CGRect f = placeholderLabel.frame; - f.origin = CGPointMake(padding, padding); - placeholderLabel.frame = f; - [self sendSubviewToBack:placeholderLabel]; - } else { - [placeholderLabel removeFromSuperview]; - } -} - -- (void)didEdit:(NSNotification *)notification { - if (notification.object == self) { - [self setupPlaceholder]; - } -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATHUDView.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATHUDView.h deleted file mode 100755 index 202f538..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATHUDView.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// ATHUDView.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/28/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import - -typedef enum { - ATHUDCheckmark -} ATHUDMarkType; - -@interface ATHUDView : UIWindow { -@private - UIWindow *parentWindow; - UIImageView *icon; -} -@property (nonatomic, readonly) UILabel *label; -@property (nonatomic, assign) ATHUDMarkType markType; -@property (nonatomic, assign) CGSize size; -@property (nonatomic, assign) CGFloat cornerRadius; -@property (nonatomic, assign) CGFloat fadeOutDuration; - -- (id)initWithWindow:(UIWindow *)window; -- (void)show; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATHUDView.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATHUDView.m deleted file mode 100755 index 42c1b0b..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATHUDView.m +++ /dev/null @@ -1,191 +0,0 @@ -// -// ATHUDView.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/28/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import "ATHUDView.h" -#import "ATBackend.h" -#import "ATConnect.h" -#import "ATUtilities.h" -#import -#import - -#define DRAW_ROUND_RECT 0 - -@interface ATHUDView (Private) -- (void)setup; -- (void)teardown; -- (void)animateIn; -- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context; -@end - -@implementation ATHUDView -@synthesize label, markType, size, cornerRadius, fadeOutDuration; - -- (id)initWithWindow:(UIWindow *)window { - if ((self = [super initWithFrame:CGRectMake(0.0, 0.0, 100.0, 100.0)])) { - parentWindow = window; - [self setup]; - } - return self; -} - -- (void)dealloc { - [self teardown]; - [super dealloc]; -} - -- (void)layoutSubviews { - [super layoutSubviews]; -#if !DRAW_ROUND_RECT - self.layer.cornerRadius = self.cornerRadius; -#endif - - [label sizeToFit]; - - CGFloat labelTopPadding = 2.0; - CGSize imageSize = icon.image.size; - [label sizeToFit]; - CGSize labelSize = [label sizeThatFits:CGSizeMake(200.0, label.bounds.size.height)]; - - CGRect imageRect = CGRectMake(0.0, 0.0, imageSize.width, imageSize.height); - CGRect labelRect = CGRectMake(0.0, imageSize.height + labelTopPadding, labelSize.width, labelSize.height); - - CGRect allRect = CGRectUnion(imageRect, labelRect); - CGFloat squareLength = MAX(allRect.size.width, allRect.size.height); - squareLength = ceil(squareLength + 2.0*self.cornerRadius); - - CGRect insetAllRect = CGRectMake(0.0, 0.0, squareLength, squareLength); - insetAllRect.size.width = squareLength; - insetAllRect.size.height = squareLength; - insetAllRect = ATCGRectOfEvenSize(insetAllRect); - - // Center imageRect. - CGRect finalImageRect = imageRect; - finalImageRect.origin.y += self.cornerRadius; - if (finalImageRect.size.width < insetAllRect.size.width) { - finalImageRect.origin.x += floorf((insetAllRect.size.width - imageRect.size.width)/2.0); - } - - // Center labelRect. - CGRect finalLabelRect = labelRect; - finalLabelRect.origin.y += self.cornerRadius; - if (finalLabelRect.size.width < insetAllRect.size.width) { - finalLabelRect.origin.x += floorf((insetAllRect.size.width - finalLabelRect.size.width)/2.0); - } - - self.bounds = CGRectIntegral(insetAllRect); - self.center = CGPointMake(floorf(parentWindow.center.x), floorf(parentWindow.center.y)); - label.frame = CGRectIntegral(finalLabelRect); - icon.frame = CGRectIntegral(finalImageRect); -} - -- (void)show { - [self animateIn]; -} - -#if DRAW_ROUND_RECT -- (void)drawRect:(CGRect)rect { - CGContextRef context = UIGraphicsGetCurrentContext(); - - CGRect roundRect = CGRectMake(0.0, 0.0, self.bounds.size.width, self.bounds.size.height); - CGFloat radius = self.cornerRadius; - - CGContextSaveGState(context); - CGContextTranslateCTM(context, self.bounds.origin.x, self.bounds.origin.y); - CGContextBeginPath(context); - CGContextSetGrayFillColor(context, 0.0, 0.8); - - - CGContextBeginPath(context); - CGContextMoveToPoint(context, CGRectGetMinX(roundRect) + radius, CGRectGetMinY(roundRect)); - CGContextAddArc(context, CGRectGetMaxX(roundRect) - radius, CGRectGetMinY(roundRect) + radius, radius, 3 * M_PI / 2, 0, 0); - CGContextAddArc(context, CGRectGetMaxX(roundRect) - radius, CGRectGetMaxY(roundRect) - radius, radius, 0, M_PI / 2, 0); - CGContextAddArc(context, CGRectGetMinX(roundRect) + radius, CGRectGetMaxY(roundRect) - radius, radius, M_PI / 2, M_PI, 0); - CGContextAddArc(context, CGRectGetMinX(roundRect) + radius, CGRectGetMinY(roundRect) + radius, radius, M_PI, 3 * M_PI / 2, 0); - CGContextClosePath(context); - - CGContextFillPath(context); - CGContextRestoreGState(context); -} -#endif - -@end - -@implementation ATHUDView (Private) -- (void)setup { - self.fadeOutDuration = 3.0; - self.transform = [ATUtilities viewTransformInWindow:parentWindow]; - - [self setUserInteractionEnabled:NO]; - - label = [[UILabel alloc] initWithFrame:CGRectZero]; - label.backgroundColor = [UIColor clearColor]; - label.opaque = NO; - label.textColor = [UIColor whiteColor]; - label.font = [UIFont boldSystemFontOfSize:17.0]; - label.textAlignment = UITextAlignmentCenter; - label.lineBreakMode = UILineBreakModeWordWrap; - label.adjustsFontSizeToFitWidth = YES; - label.numberOfLines = 0; - [self addSubview:label]; - - UIImage *iconImage = [ATBackend imageNamed:@"at_checkmark"]; - icon = [[UIImageView alloc] initWithImage:iconImage]; - icon.backgroundColor = [UIColor clearColor]; - icon.opaque = NO; - [self addSubview:icon]; - - self.size = CGSizeMake(100.0, 100.0); - self.cornerRadius = 10.0; -#if DRAW_ROUND_RECT - self.backgroundColor = [UIColor clearColor]; -#else - self.backgroundColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8]; -#endif - self.opaque = NO; - [self setNeedsLayout]; - [self setNeedsDisplay]; -} - -- (void)teardown { - [icon removeFromSuperview]; - [icon release]; - icon = nil; - [label removeFromSuperview]; - [label release]; - label = nil; - parentWindow = nil; -} - -- (void)animateIn { - self.alpha = 1.0; - [self layoutSubviews]; - self.windowLevel = UIWindowLevelAlert; - [self makeKeyAndVisible]; - self.center = parentWindow.center; - - [UIView beginAnimations:@"animateIn" context:NULL]; - [UIView setAnimationDuration:self.fadeOutDuration]; - [UIView setAnimationDelegate:self]; - [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)]; - [UIView setAnimationCurve:UIViewAnimationCurveEaseOut]; - self.alpha = 1.0; - [UIView commitAnimations]; -} - -- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context { - if ([animationID isEqualToString:@"animateIn"]) { - [UIView beginAnimations:@"animateOut" context:NULL]; - [UIView setAnimationDelegate:self]; - [UIView setAnimationDuration:2.0]; - self.alpha = 0.0; - [UIView commitAnimations]; - } else { - [[parentWindow window] makeKeyAndVisible]; - } -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATShadowView.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATShadowView.h deleted file mode 100755 index 8ab5466..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATShadowView.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// ATShadowView.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 10/19/11. -// Copyright (c) 2011 Apptentive, Inc. All rights reserved. -// - -#import - -@interface ATShadowView : UIView { -@private - CGPoint centerAt; - CGSize spotlightSize; -} -@property (nonatomic, assign) CGPoint centerAt; -@property (nonatomic, assign) CGSize spotlightSize; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATShadowView.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATShadowView.m deleted file mode 100755 index 542af76..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATShadowView.m +++ /dev/null @@ -1,107 +0,0 @@ -// -// ATShadowView.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 10/19/11. -// Copyright (c) 2011 Apptentive, Inc. All rights reserved. -// - -#import "ATShadowView.h" - -@implementation ATShadowView -@synthesize centerAt, spotlightSize; - -- (id)initWithFrame:(CGRect)frame { - self = [super initWithFrame:frame]; - if (self) { - self.centerAt = CGPointMake(CGRectGetMidX(frame), CGRectGetMidY(frame)); - self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - [self setOpaque:NO]; - } - return self; -} - -- (id)initWithCoder:(NSCoder *)coder { - self = [super initWithCoder:coder]; - if (self) { - [self setOpaque:NO]; - } - return self; -} - -- (CGSize)sizeThatFits:(CGSize)size { - return size; -} - -- (void)layoutSubviews { - [super layoutSubviews]; - [self setNeedsDisplay]; -} - -- (void)drawRect:(CGRect)dirtyRect { - CGRect imageBounds = [self bounds]; - CGRect bounds = [self bounds]; - CGContextRef context = UIGraphicsGetCurrentContext(); - CGFloat alignStroke; - CGFloat resolution; - CGMutablePathRef path; - CGRect drawRect; - CGGradientRef gradient; - NSMutableArray *colors; - UIColor *color; - CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB(); - CGAffineTransform transform; - CGRect pathBounds; - CGFloat locations[2]; - resolution = 0.5f * (bounds.size.width / imageBounds.size.width + bounds.size.height / imageBounds.size.height); - - CGContextSaveGState(context); - CGContextTranslateCTM(context, bounds.origin.x, bounds.origin.y); - CGContextScaleCTM(context, (bounds.size.width / imageBounds.size.width), (bounds.size.height / imageBounds.size.height)); - - // Layer 1 - - alignStroke = 0.0f; - path = CGPathCreateMutable(); - drawRect = CGRectMake(0.0f, 0.0f, imageBounds.size.width, imageBounds.size.height); - drawRect.origin.x = (roundf(resolution * drawRect.origin.x + alignStroke) - alignStroke) / resolution; - drawRect.origin.y = (roundf(resolution * drawRect.origin.y + alignStroke) - alignStroke) / resolution; - drawRect.size.width = roundf(resolution * drawRect.size.width) / resolution; - drawRect.size.height = roundf(resolution * drawRect.size.height) / resolution; - CGPathAddRect(path, NULL, drawRect); - CGContextAddPath(context, path); - CGContextSaveGState(context); - CGContextEOClip(context); - pathBounds = CGPathGetPathBoundingBox(path); - transform = CGAffineTransformMakeTranslation(CGRectGetMidX(pathBounds), CGRectGetMidY(pathBounds)); - CGFloat scale = MAX(0.5f * pathBounds.size.width, 0.5f * pathBounds.size.height); - transform = CGAffineTransformScale(transform, scale, scale); - - - - // Get the radius of our rectangle. - CGFloat width = pathBounds.size.width; - CGFloat height = pathBounds.size.height; - CGFloat radius = (sqrt(width*width + height*height))/2.0; - CGFloat radiusHeightRatio = radius/(MIN(height, width)*0.5); - - colors = [NSMutableArray arrayWithCapacity:2]; - color = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.0f]; - [colors addObject:(id)[color CGColor]]; - locations[0] = 1.0f; - color = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.5*radiusHeightRatio]; - [colors addObject:(id)[color CGColor]]; - locations[1] = 0.0f; - gradient = CGGradientCreateWithColors(space, (CFArrayRef)colors, locations); - - CGContextConcatCTM(context, transform); - CGContextDrawRadialGradient(context, gradient, CGPointZero, radiusHeightRatio, CGPointMake(0.02f, -0.02f), 0.0f, (kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation)); - CGContextRestoreGState(context); - CGGradientRelease(gradient); - CGPathRelease(path); - - CGContextRestoreGState(context); - CGColorSpaceRelease(space); -} - -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATSimpleImageViewController.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATSimpleImageViewController.h deleted file mode 100755 index b22af93..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATSimpleImageViewController.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// ATSimpleImageViewController.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/27/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import - -#import "ATFeedback.h" -#import "ATFeedbackTypes.h" - -@class ATCenteringImageScrollView; - -NSString * const ATImageViewChoseImage; - -@protocol ATSimpleImageViewControllerDelegate; - -@interface ATSimpleImageViewController : UIViewController { -@private - NSObject *delegate; - ATCenteringImageScrollView *scrollView; - UIBarButtonItem *cameraButtonItem; - BOOL shouldResign; - UIView *containerView; - BOOL isFromCamera; - - UIPopoverController *imagePickerPopover; -} -@property (nonatomic, retain) IBOutlet UIView *containerView; -@property (retain, nonatomic) IBOutlet UIBarButtonItem *cameraButtonItem; - -- (id)initWithDelegate:(NSObject *)delegate; -- (IBAction)donePressed:(id)sender; -- (IBAction)takePhoto:(id)sender; -@end - -@protocol ATSimpleImageViewControllerDelegate -- (void)imageViewController:(ATSimpleImageViewController *)vc pickedImage:(UIImage *)image fromSource:(ATFeedbackImageSource)source; -- (void)imageViewControllerWillDismiss:(ATSimpleImageViewController *)vc animated:(BOOL)animated; -- (ATFeedbackAttachmentOptions)attachmentOptionsForImageViewController:(ATSimpleImageViewController *)vc; - -@optional -- (UIImage *)defaultImageForImageViewController:(ATSimpleImageViewController *)vc; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATSimpleImageViewController.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATSimpleImageViewController.m deleted file mode 100755 index 66adf64..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATSimpleImageViewController.m +++ /dev/null @@ -1,272 +0,0 @@ -// -// ATSimpleImageViewController.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/27/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import "ATSimpleImageViewController.h" -#import "ATCenteringImageScrollView.h" -#import "ATConnect.h" -#import "ATFeedback.h" -#import "ATFeedbackController.h" - -NSString * const ATImageViewChoseImage = @"ATImageViewChoseImage"; - -#define kATContainerViewTag (5) -#define kATLabelViewTag (6) - -@interface ATSimpleImageViewController (Private) -- (void)chooseImage; -- (void)takePhoto; -@end - -@implementation ATSimpleImageViewController -@synthesize containerView; -@synthesize cameraButtonItem; - -- (id)initWithDelegate:(NSObject *)aDelegate { - self = [super initWithNibName:@"ATSimpleImageViewController" bundle:[ATConnect resourceBundle]]; - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { - self.modalPresentationStyle = UIModalPresentationFormSheet; - } - if (self != nil) { - delegate = [aDelegate retain]; - } - return self; -} - -- (void)dealloc { - [imagePickerPopover release], imagePickerPopover = nil; - [delegate release], delegate = nil; - [scrollView removeFromSuperview]; - [scrollView release], scrollView = nil; - [containerView removeFromSuperview]; - [containerView release], containerView = nil; - [cameraButtonItem release], cameraButtonItem = nil; - [super dealloc]; -} - -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; -} - -#pragma mark - View lifecycle -- (void)setupScrollView { - if (scrollView) { - [scrollView removeFromSuperview]; - [scrollView release]; - scrollView = nil; - } - - UIImage *defaultScreenshot = nil; - if (delegate && [delegate respondsToSelector:@selector(defaultImageForImageViewController:)]) { - defaultScreenshot = [delegate defaultImageForImageViewController:self]; - } - if (defaultScreenshot) { - for (UIView *subview in self.containerView.subviews) { - [subview removeFromSuperview]; - } - scrollView = [[ATCenteringImageScrollView alloc] initWithImage:defaultScreenshot]; - scrollView.backgroundColor = [UIColor blackColor]; - CGSize boundsSize = self.containerView.bounds.size; - CGSize imageSize = [scrollView imageView].image.size; - - CGFloat xScale = boundsSize.width / imageSize.width; - CGFloat yScale = boundsSize.height / imageSize.height; - CGFloat minScale = MIN(xScale, yScale); - CGFloat maxScale = 2.0; - - if (minScale > maxScale) { - minScale = maxScale; - } - scrollView.delegate = self; - scrollView.bounces = YES; - scrollView.bouncesZoom = YES; - scrollView.minimumZoomScale = minScale; - scrollView.maximumZoomScale = maxScale; - scrollView.alwaysBounceHorizontal = YES; - scrollView.alwaysBounceVertical = YES; - - [scrollView setZoomScale:minScale]; - scrollView.frame = self.containerView.bounds; - [self.containerView addSubview:scrollView]; - } else { - UIView *container = nil; - UITextView *label = nil; - if ([self.containerView viewWithTag:kATContainerViewTag]) { - container = [[self.containerView viewWithTag:kATContainerViewTag] retain]; - label = [(UITextView *)[self.containerView viewWithTag:kATLabelViewTag] retain]; - } else { - container = [[UIView alloc] initWithFrame:self.containerView.bounds]; - container.tag = kATContainerViewTag; - container.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; - container.backgroundColor = [UIColor blackColor]; - label = [[UITextView alloc] initWithFrame:CGRectZero]; - label.tag = kATLabelViewTag; - label.backgroundColor = [UIColor clearColor]; - label.font = [UIFont boldSystemFontOfSize:16.0]; - label.textColor = [UIColor whiteColor]; - label.userInteractionEnabled = NO; - label.textAlignment = UITextAlignmentCenter; - label.text = ATLocalizedString(@"You can include a screenshot by choosing a photo from your photo library above.\n\nTo take a screenshot, hold down the power and home buttons at the same time.", @"Description of what to do when there is no screenshot."); - } - [self.containerView addSubview:container]; - [container sizeToFit]; - [container addSubview:label]; - - CGFloat labelWidth = container.bounds.size.width - 40.0; - CGSize labelSize = [label sizeThatFits:CGSizeMake(labelWidth, CGFLOAT_MAX)]; - CGFloat topOffset = floor(labelSize.height/2.0); - CGRect labelRect = CGRectMake(20, topOffset, labelWidth, labelSize.height); - label.frame = labelRect; - label.center = container.center; - [label release]; - [container release]; - } -} - -- (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - [self setupScrollView]; -} - -- (void)viewDidAppear:(BOOL)animated { - //NSLog(@"size is: %@", NSStringFromCGRect(self.view.bounds)); -} - -- (void)viewWillDisappear:(BOOL)animated { - if (shouldResign) { - [delegate imageViewControllerWillDismiss:self animated:animated]; - [delegate release], delegate = nil; - } -} - -- (void)viewDidUnload { - [containerView removeFromSuperview]; - [containerView release], containerView = nil; - [self setCameraButtonItem:nil]; - [super viewDidUnload]; -} - -- (IBAction)donePressed:(id)sender { - shouldResign = YES; - [self dismissModalViewControllerAnimated:YES]; -} - -- (IBAction)takePhoto:(id)sender { - ATFeedbackAttachmentOptions options = [delegate attachmentOptionsForImageViewController:self]; - if (options & ATFeedbackAllowTakePhotoAttachment) { - UIActionSheet *actionSheet = nil; - if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { - actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:ATLocalizedString(@"Cancel", @"Cancel Button Title") destructiveButtonTitle:nil otherButtonTitles:ATLocalizedString(@"Choose From Library", @"Choose Photo Button Title"), ATLocalizedString(@"Take Photo", @"Take Photo Button Title"), nil]; - } else { - actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:ATLocalizedString(@"Cancel", @"Cancel Button Title") destructiveButtonTitle:nil otherButtonTitles:ATLocalizedString(@"Choose From Library", @"Choose Photo Button Title"), nil]; - } - - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { - [actionSheet showFromBarButtonItem:self.cameraButtonItem animated:YES]; - } else { - [actionSheet showInView:self.view]; - } - [actionSheet autorelease]; - } else { - [self chooseImage]; - } -} - -#pragma mark UIActionSheetDelegate -- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { - if (buttonIndex == 0) { - [self chooseImage]; - } else if (buttonIndex == 1 && [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { - [self takePhoto]; - } -} - -#pragma mark UIImagePickerControllerDelegate -- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { - UIImage *image = nil; - if ([info objectForKey:UIImagePickerControllerEditedImage]) { - image = [info objectForKey:UIImagePickerControllerEditedImage]; - } else if ([info objectForKey:UIImagePickerControllerOriginalImage]) { - image = [info objectForKey:UIImagePickerControllerOriginalImage]; - } - if (image) { - [delegate imageViewController:self pickedImage:image fromSource:isFromCamera ? ATFeedbackImageSourceCamera : ATFeedbackImageSourcePhotoLibrary]; - [[NSNotificationCenter defaultCenter] postNotificationName:ATImageViewChoseImage object:self]; - } - [self setupScrollView]; - - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { - if (imagePickerPopover) { - [imagePickerPopover dismissPopoverAnimated:YES]; - } - } - if (self.modalViewController) { - [self dismissModalViewControllerAnimated:YES]; - } -} - -- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { - [picker dismissModalViewControllerAnimated:YES]; -} - -#pragma mark Rotation -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - return YES; -} - -- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { - -} - -- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { - [self setupScrollView]; -} - -#pragma mark UIScrollViewDelegate -- (UIView *)viewForZoomingInScrollView:(UIScrollView *)aScrollView { - return [scrollView imageView]; -} - -#pragma mark UIPopoverControllerDelegate -- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController { - if (popoverController == imagePickerPopover) { - [imagePickerPopover release], imagePickerPopover = nil; - } -} -@end - -@implementation ATSimpleImageViewController (Private) -- (void)chooseImage { - isFromCamera = NO; - shouldResign = NO; - UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; - imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; - imagePicker.delegate = self; - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { - if (imagePickerPopover) { - [imagePickerPopover dismissPopoverAnimated:NO]; - [imagePickerPopover release], imagePickerPopover = nil; - } - imagePickerPopover = [[UIPopoverController alloc] initWithContentViewController:imagePicker]; - imagePickerPopover.delegate = self; - [imagePickerPopover presentPopoverFromBarButtonItem:self.cameraButtonItem permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; - } else { - [self presentModalViewController:imagePicker animated:YES]; - } - [imagePicker release]; -} - -- (void)takePhoto { - isFromCamera = YES; - shouldResign = NO; - UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; - imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; - imagePicker.delegate = self; - [self presentModalViewController:imagePicker animated:YES]; - [imagePicker release]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATToolbar.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATToolbar.h deleted file mode 100755 index 1be4f3d..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATToolbar.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ATToolbar.h -// CustomWindow -// -// Created by Andrew Wooster on 9/24/11. -// Copyright 2011 Apptentive, Inc. All rights reserved. -// - -#import - -@interface ATToolbar : UIToolbar -@end - -void ATToolbar_Bootstrap(); diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATToolbar.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATToolbar.m deleted file mode 100755 index ff09230..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Custom Views/ATToolbar.m +++ /dev/null @@ -1,88 +0,0 @@ -// -// ATToolbar.m -// CustomWindow -// -// Created by Andrew Wooster on 9/24/11. -// Copyright 2011 Apptentive, Inc. All rights reserved. -// - -#import "ATToolbar.h" -#import "ATCustomButton.h" - -@implementation ATToolbar -//!! Hack to adjust frame origin of left-most custom view and to force -//!! custom views to resize on orientation changes. -//!! Still has problems if the text is too big to fit and is rotated to portrait twice. -//!! This is a huge hack. -- (void)layoutSubviews { - [super layoutSubviews]; - - NSArray *items = [self items]; - CGFloat widthAvailable = self.bounds.size.width; - - BOOL viewHasTwoButtons = NO; - NSUInteger buttonCount = 0; - for (UIBarButtonItem *item in items) { - if ([item isKindOfClass:[ATCustomButton class]]) { - buttonCount++; - } - } - if (buttonCount == 2) { - viewHasTwoButtons = YES; - } - - NSUInteger customButtonIndex = 0; - for (UIBarButtonItem *item in items) { - if (item.customView != nil && item.customView.superview != nil) { - [item.customView sizeToFit]; - if (viewHasTwoButtons && [item isKindOfClass:[ATCustomButton class]]) { - CGRect frameInView = [item.customView.superview convertRect:item.customView.frame toView:self]; - if (customButtonIndex == 0) { - widthAvailable -= CGRectGetMaxX(frameInView); - } else if (customButtonIndex == 1) { - CGFloat buttonOriginWidth = (self.bounds.size.width - frameInView.origin.x); - widthAvailable -= buttonOriginWidth; - } - customButtonIndex++; - } - } - } - - if ([items count] > 0) { - UIBarButtonItem *firstItem = [items objectAtIndex:0]; - - BOOL adjustedFirstItem = NO; - if (firstItem.customView != nil) { - CGRect f = firstItem.customView.frame; - if (f.origin.x == 12.0) { - f.origin.x = 6.0; - firstItem.customView.frame = f; - adjustedFirstItem = YES; - } - } - - if (adjustedFirstItem) { - NSUInteger i = 0; - for (UIBarButtonItem *item in items) { - // Also don't adjust any custom buttons. - if (i != 0 && item.customView != nil && ![item isKindOfClass:[ATCustomButton class]]) { - CGRect customFrame = item.customView.frame; - customFrame.origin.x += 4.0; - customFrame.size.width = MIN(widthAvailable, customFrame.size.width); - item.customView.frame = customFrame; - } - i++; - } - } - } -} - -- (void)drawRect:(CGRect)rect { - // -} -@end - - -void ATToolbar_Bootstrap() { - NSLog(@"Loading ATToolbar_Bootstrap"); -} diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ATFeedbackMetrics.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ATFeedbackMetrics.h deleted file mode 100755 index d9102fa..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ATFeedbackMetrics.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// ATFeedbackMetrics.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 12/27/11. -// Copyright (c) 2011 Apptentive, Inc. All rights reserved. -// - -#import - -NSString *const ATFeedbackDidShowWindowNotification; -NSString *const ATFeedbackDidHideWindowNotification; - -NSString *const ATFeedbackWindowTypeKey; -NSString *const ATFeedbackWindowHideEventKey; - -typedef enum { - ATFeedbackWindowTypeFeedback, - ATFeedbackWindowTypeInfo, -} ATFeedbackWindowType; - -typedef enum { - ATFeedbackEventTappedCancel, - ATFeedbackEventTappedSend, -} ATFeedbackEvent; diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ATFeedbackMetrics.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ATFeedbackMetrics.m deleted file mode 100755 index bb18137..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ATFeedbackMetrics.m +++ /dev/null @@ -1,15 +0,0 @@ -// -// ATFeedbackMetrics.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 12/27/11. -// Copyright (c) 2011 Apptentive, Inc. All rights reserved. -// - -#import "ATFeedbackMetrics.h" - -NSString *const ATFeedbackDidShowWindowNotification = @"ATFeedbackDidShowWindowNotification"; -NSString *const ATFeedbackDidHideWindowNotification = @"ATFeedbackDidHideWindowNotification"; - -NSString *const ATFeedbackWindowTypeKey = @"ATFeedbackWindowTypeKey"; -NSString *const ATFeedbackWindowHideEventKey = @"ATFeedbackWindowHideEventKey"; diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ATMetric.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ATMetric.h deleted file mode 100755 index 96060f2..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ATMetric.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// ATMetric.h -// ApptentiveMetrics -// -// Created by Andrew Wooster on 12/27/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import -#import "ATRecord.h" - -@interface ATMetric : ATRecord { -@private - NSString *name; - NSMutableDictionary *info; -} -@property (nonatomic, copy) NSString *name; -@property (nonatomic, readonly) NSDictionary *info; - -- (void)setValue:(id)value forKey:(NSString *)key; -- (void)addEntriesFromDictionary:(NSDictionary *)dictionary; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ATMetric.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ATMetric.m deleted file mode 100755 index cecff87..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ATMetric.m +++ /dev/null @@ -1,93 +0,0 @@ -// -// ATMetric.m -// ApptentiveMetrics -// -// Created by Andrew Wooster on 12/27/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import "ATMetric.h" -#import "ATConnect.h" -#import "ATUtilities.h" -#import "ATWebClient.h" -#import "ATWebClient+Metrics.h" - -#define kATMetricStorageVersion 1 - -@implementation ATMetric -@synthesize name, info; - -- (id)init { - if ((self = [super init])) { - info = [[NSMutableDictionary alloc] init]; - } - return self; -} - -- (id)initWithCoder:(NSCoder *)coder { - if ((self = [super initWithCoder:coder])) { - int version = [coder decodeIntForKey:@"version"]; - if (version == kATMetricStorageVersion) { - self.name = [coder decodeObjectForKey:@"name"]; - NSDictionary *d = [coder decodeObjectForKey:@"info"]; - if (info) { - [info release], info = nil; - } - if (d != nil) { - info = [d mutableCopy]; - } else { - info = [[NSMutableDictionary alloc] init]; - } - } else { - [self release]; - return nil; - } - } - return self; -} - -- (void)encodeWithCoder:(NSCoder *)coder { - [super encodeWithCoder:coder]; - [coder encodeInt:kATMetricStorageVersion forKey:@"version"]; - [coder encodeObject:self.name forKey:@"name"]; - [coder encodeObject:self.info forKey:@"info"]; -} - -- (void)dealloc { - [name release], name = nil; - [info release], info = nil; - [super dealloc]; -} - -- (void)setValue:(id)value forKey:(NSString *)key { - [info setValue:value forKey:key]; -} - -- (void)addEntriesFromDictionary:(NSDictionary *)dictionary { - if (dictionary != nil) { - [info addEntriesFromDictionary:dictionary]; - } -} - -- (NSDictionary *)apiDictionary { - NSMutableDictionary *d = [NSMutableDictionary dictionaryWithDictionary:[super apiDictionary]]; - - if (self.name) [d setObject:self.name forKey:@"record[metric][event]"]; - - if (self.info) { - for (NSString *key in info) { - NSString *recordKey = [NSString stringWithFormat:@"record[metric][data][%@]", key]; - NSObject *value = [info objectForKey:key]; - if ([value isKindOfClass:[NSDate class]]) { - value = [ATUtilities stringRepresentationOfDate:(NSDate *)value]; - } - [d setObject:value forKey:recordKey]; - } - } - return d; -} - -- (ATAPIRequest *)requestForSendingRecord { - return [[ATWebClient sharedClient] requestForSendingMetric:self]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ATSurveyMetrics.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ATSurveyMetrics.h deleted file mode 100755 index afa9264..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ATSurveyMetrics.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// ATSurveyMetrics.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 6/2/12. -// Copyright (c) 2012 Apptentive, Inc. All rights reserved. -// - -#import - -NSString *const ATSurveyDidShowWindowNotification; // survey.launch -NSString *const ATSurveyDidHideWindowNotification; // survey.cancel or survey.submit -NSString *const ATSurveyDidAnswerQuestionNotification; // survey.question_response - -NSString *const ATSurveyWindowTypeKey; -NSString *const ATSurveyMetricsEventKey; -NSString *const ATSurveyMetricsSurveyIDKey; -NSString *const ATSurveyMetricsSurveyQuestionIDKey; - -typedef enum { - ATSurveyWindowTypeSurvey, -} ATSurveyWindowType; - -typedef enum { - ATSurveyEventUnknown, - ATSurveyEventTappedCancel, - ATSurveyEventTappedSend, - ATSurveyEventAnsweredQuestion, -} ATSurveyEvent; diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ATSurveyMetrics.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ATSurveyMetrics.m deleted file mode 100755 index a155c7f..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ATSurveyMetrics.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// ATSurveyMetrics.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 6/2/12. -// Copyright (c) 2012 Apptentive, Inc. All rights reserved. -// - -#import "ATSurveyMetrics.h" - -NSString *const ATSurveyDidShowWindowNotification = @"ATSurveyDidShowWindowNotification"; -NSString *const ATSurveyDidHideWindowNotification = @"ATSurveyDidHideWindowNotification"; -NSString *const ATSurveyDidAnswerQuestionNotification = @"ATSurveyDidAnswerQuestionNotification"; - -NSString *const ATSurveyWindowTypeKey = @"ATSurveyWindowTypeKey"; -NSString *const ATSurveyMetricsEventKey = @"ATSurveyMetricsEventKey"; -NSString *const ATSurveyMetricsSurveyIDKey = @"ATSurveyMetricsSurveyIDKey"; -NSString *const ATSurveyMetricsSurveyQuestionIDKey = @"ATSurveyMetricsSurveyQuestionIDKey"; diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ApptentiveMetrics.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ApptentiveMetrics.h deleted file mode 100755 index c612afb..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ApptentiveMetrics.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// ApptentiveMetrics.h -// ApptentiveMetrics -// -// Created by Andrew Wooster on 12/27/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#if TARGET_OS_IPHONE -#import -#elif TARGET_OS_MAC -#import -#endif - -@interface ApptentiveMetrics : NSObject { -@private - BOOL metricsEnabled; -} -+ (ApptentiveMetrics *)sharedMetrics; -@end - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ApptentiveMetrics.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ApptentiveMetrics.m deleted file mode 100755 index d615a58..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/ApptentiveMetrics.m +++ /dev/null @@ -1,333 +0,0 @@ -// -// ApptentiveMetrics.m -// ApptentiveMetrics -// -// Created by Andrew Wooster on 12/27/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import "ApptentiveMetrics.h" -#import "ATLog.h" -#import "ATAppConfigurationUpdater.h" -#import "ATFeedbackMetrics.h" -#import "ATAppRatingMetrics.h" -#import "ATMetric.h" -#import "ATRecordTask.h" -#import "ATSurveyMetrics.h" -#import "ATTaskQueue.h" - -static NSString *ATMetricNameEnjoymentDialogLaunch = @"enjoyment_dialog.launch"; -static NSString *ATMetricNameEnjoymentDialogYes = @"enjoyment_dialog.yes"; -static NSString *ATMetricNameEnjoymentDialogNo = @"enjoyment_dialog.no"; - -static NSString *ATMetricNameRatingDialogLaunch = @"rating_dialog.launch"; -static NSString *ATMetricNameRatingDialogRate = @"rating_dialog.rate"; -static NSString *ATMetricNameRatingDialogRemind = @"rating_dialog.remind"; -static NSString *ATMetricNameRatingDialogDecline = @"rating_dialog.decline"; - -static NSString *ATMetricNameFeedbackDialogLaunch = @"feedback_dialog.launch"; -static NSString *ATMetricNameFeedbackDialogCancel = @"feedback_dialog.cancel"; -static NSString *ATMetricNameFeedbackDialogSubmit = @"feedback_dialog.submit"; - -static NSString *ATMetricNameSurveyLaunch = @"survey.launch"; -static NSString *ATMetricNameSurveyCancel = @"survey.cancel"; -static NSString *ATMetricNameSurveySubmit = @"survey.submit"; -static NSString *ATMetricNameSurveyAnswerQuestion = @"survey.question_response"; - -static NSString *ATMetricNameAppLaunch = @"app.launch"; -static NSString *ATMetricNameAppExit = @"app.exit"; - -@interface ApptentiveMetrics (Private) -- (void)addLaunchMetric; -- (void)addMetricWithName:(NSString *)name info:(NSDictionary *)userInfo; -- (ATFeedbackWindowType)windowTypeFromNotification:(NSNotification *)notification; -- (void)feedbackDidShowWindow:(NSNotification *)notification; -- (void)feedbackDidHideWindow:(NSNotification *)notification; - -- (ATAppRatingEnjoymentButtonType)appEnjoymentButtonTypeFromNotification:(NSNotification *)notification; -- (void)ratingDidShowEnjoyment:(NSNotification *)notification; -- (void)ratingDidClickEnjoyment:(NSNotification *)notification; - -- (ATAppRatingButtonType)appRatingButtonTypeFromNotification:(NSNotification *)notification; -- (void)ratingDidShowRating:(NSNotification *)notification; -- (void)ratingDidClickRating:(NSNotification *)notification; - -- (ATSurveyEvent)surveyEventTypeFromNotification:(NSNotification *)notification; -- (void)surveyDidShow:(NSNotification *)notification; -- (void)surveyDidHide:(NSNotification *)notification; -- (void)surveyDidAnswerQuestion:(NSNotification *)notification; - -- (void)appWillTerminate:(NSNotification *)notification; -- (void)appDidEnterBackground:(NSNotification *)notification; -- (void)appWillEnterForeground:(NSNotification *)notification; - -- (void)preferencesChanged:(NSNotification *)notification; - -- (void)updateWithCurrentPreferences; -@end - -@implementation ApptentiveMetrics - -+ (ApptentiveMetrics *)sharedMetrics { - static ApptentiveMetrics *sharedSingleton = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedSingleton = [[ApptentiveMetrics alloc] init]; - }); - return sharedSingleton; -} - -+ (void)registerDefaults { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSDictionary *defaultPreferences = - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithBool:YES], ATAppConfigurationMetricsEnabledPreferenceKey, - nil]; - [defaults registerDefaults:defaultPreferences]; -} - -- (id)init { - self = [super init]; - if (self) { - metricsEnabled = NO; - [ApptentiveMetrics registerDefaults]; - [self updateWithCurrentPreferences]; - - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(feedbackDidShowWindow:) name:ATFeedbackDidShowWindowNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(feedbackDidHideWindow:) name:ATFeedbackDidHideWindowNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ratingDidShowEnjoyment:) name:ATAppRatingDidPromptForEnjoymentNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ratingDidClickEnjoyment:) name:ATAppRatingDidClickEnjoymentButtonNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ratingDidShowRating:) name:ATAppRatingDidPromptForRatingNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ratingDidClickRating:) name:ATAppRatingDidClickRatingButtonNotification object:nil]; - - - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(surveyDidShow:) name:ATSurveyDidShowWindowNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(surveyDidHide:) name:ATSurveyDidHideWindowNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(surveyDidAnswerQuestion:) name:ATSurveyDidAnswerQuestionNotification object:nil]; - - - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(preferencesChanged:) name:ATConfigurationPreferencesChangedNotification object:nil]; - -#if TARGET_OS_IPHONE - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillTerminate:) name:UIApplicationWillTerminateNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appDidEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillEnterForeground:) name:UIApplicationWillEnterForegroundNotification object:nil]; -#elif TARGET_OS_MAC - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillTerminate:) name:NSApplicationWillTerminateNotification object:nil]; - -#endif - [self performSelector:@selector(addLaunchMetric) withObject:nil afterDelay:0.1]; - } - - return self; -} - -- (void)dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; - [super dealloc]; -} -@end - - - -@implementation ApptentiveMetrics (Private) -- (void)addLaunchMetric { - @autoreleasepool { - [self addMetricWithName:ATMetricNameAppLaunch info:nil]; - } -} - -- (void)addMetricWithName:(NSString *)name info:(NSDictionary *)userInfo { - if (metricsEnabled == NO) { - return; - } - ATMetric *metric = [[ATMetric alloc] init]; - metric.name = name; - [metric addEntriesFromDictionary:userInfo]; - ATRecordTask *task = [[ATRecordTask alloc] init]; - [task setRecord:metric]; - [[ATTaskQueue sharedTaskQueue] addTask:task]; - [metric release], metric = nil; - [task release], task = nil; -} - -- (ATFeedbackWindowType)windowTypeFromNotification:(NSNotification *)notification { - ATFeedbackWindowType windowType = ATFeedbackWindowTypeFeedback; - if ([[notification userInfo] objectForKey:ATFeedbackWindowTypeKey]) { - windowType = [(NSNumber *)[[notification userInfo] objectForKey:ATFeedbackWindowTypeKey] intValue]; - } - if (windowType != ATFeedbackWindowTypeFeedback && windowType != ATFeedbackWindowTypeInfo) { - ATLogError(@"Unknown window type: %d", windowType); - } - return windowType; -} - -- (void)feedbackDidShowWindow:(NSNotification *)notification { - NSString *name = nil; - ATFeedbackWindowType windowType = [self windowTypeFromNotification:notification]; - - if (windowType == ATFeedbackWindowTypeFeedback) { - name = ATMetricNameFeedbackDialogLaunch; - } else if (windowType == ATFeedbackWindowTypeInfo) { - name = nil; - } - - if (name != nil) { - [self addMetricWithName:name info:nil]; - } -} - -- (void)feedbackDidHideWindow:(NSNotification *)notification { - ATFeedbackWindowType windowType = [self windowTypeFromNotification:notification]; - ATFeedbackEvent event = ATFeedbackEventTappedCancel; - if ([[notification userInfo] objectForKey:ATFeedbackWindowHideEventKey]) { - event = [(NSNumber *)[[notification userInfo] objectForKey:ATFeedbackWindowHideEventKey] intValue]; - } - - if (windowType == ATFeedbackWindowTypeFeedback) { - if (event == ATFeedbackEventTappedCancel) { - [self addMetricWithName:ATMetricNameFeedbackDialogCancel info:nil]; - } else if (event == ATFeedbackEventTappedSend) { - [self addMetricWithName:ATMetricNameFeedbackDialogSubmit info:nil]; - } - } else if (windowType == ATFeedbackWindowTypeInfo) { - // pass, for now - } -} - -- (ATAppRatingEnjoymentButtonType)appEnjoymentButtonTypeFromNotification:(NSNotification *)notification { - ATAppRatingEnjoymentButtonType buttonType = ATAppRatingEnjoymentButtonTypeUnknown; - if ([[notification userInfo] objectForKey:ATAppRatingButtonTypeKey]) { - buttonType = [(NSNumber *)[[notification userInfo] objectForKey:ATAppRatingButtonTypeKey] intValue]; - } - if (buttonType != ATAppRatingEnjoymentButtonTypeYes && buttonType != ATAppRatingEnjoymentButtonTypeNo) { - ATLogError(@"Unknown button type: %d", buttonType); - } - return buttonType; -} - -- (void)ratingDidShowEnjoyment:(NSNotification *)notification { - [self addMetricWithName:ATMetricNameEnjoymentDialogLaunch info:nil]; -} - -- (void)ratingDidClickEnjoyment:(NSNotification *)notification { - ATAppRatingEnjoymentButtonType buttonType = [self appEnjoymentButtonTypeFromNotification:notification]; - if (buttonType == ATAppRatingEnjoymentButtonTypeYes) { - [self addMetricWithName:ATMetricNameEnjoymentDialogYes info:nil]; - } else if (buttonType == ATAppRatingEnjoymentButtonTypeNo) { - [self addMetricWithName:ATMetricNameEnjoymentDialogNo info:nil]; - } -} - -- (ATAppRatingButtonType)appRatingButtonTypeFromNotification:(NSNotification *)notification { - ATAppRatingButtonType buttonType = ATAppRatingButtonTypeUnknown; - if ([[notification userInfo] objectForKey:ATAppRatingButtonTypeKey]) { - buttonType = [(NSNumber *)[[notification userInfo] objectForKey:ATAppRatingButtonTypeKey] intValue]; - } - if (buttonType != ATAppRatingButtonTypeNo && buttonType != ATAppRatingButtonTypeRemind && buttonType != ATAppRatingButtonTypeRateApp) { - ATLogError(@"Unknown button type: %d", buttonType); - } - return buttonType; -} - -- (void)ratingDidShowRating:(NSNotification *)notification { - [self addMetricWithName:ATMetricNameRatingDialogLaunch info:nil]; -} - -- (void)ratingDidClickRating:(NSNotification *)notification { - ATAppRatingButtonType buttonType = [self appRatingButtonTypeFromNotification:notification]; - NSString *name = nil; - if (buttonType == ATAppRatingButtonTypeNo) { - name = ATMetricNameRatingDialogDecline; - } else if (buttonType == ATAppRatingButtonTypeRateApp) { - name = ATMetricNameRatingDialogRate; - } else if (buttonType == ATAppRatingButtonTypeRemind) { - name = ATMetricNameRatingDialogRemind; - } - if (name != nil) { - [self addMetricWithName:name info:nil]; - } -} - -- (ATSurveyEvent)surveyEventTypeFromNotification:(NSNotification *)notification { - ATSurveyEvent event = ATSurveyEventUnknown; - if ([[notification userInfo] objectForKey:ATSurveyMetricsEventKey]) { - event = [(NSNumber *)[[notification userInfo] objectForKey:ATSurveyMetricsEventKey] intValue]; - } - if (event != ATSurveyEventTappedSend && event != ATSurveyEventTappedCancel && event != ATSurveyEventAnsweredQuestion) { - event = ATSurveyEventUnknown; - ATLogError(@"Unknown survey event type: %d", event); - } - return event; -} - -- (void)surveyDidShow:(NSNotification *)notification { - NSMutableDictionary *info = [[NSMutableDictionary alloc] init]; - NSString *surveyID = [[notification userInfo] objectForKey:ATSurveyMetricsSurveyIDKey]; - if (surveyID != nil) { - [info setObject:surveyID forKey:@"id"]; - } - [self addMetricWithName:ATMetricNameSurveyLaunch info:info]; - [info release], info = nil; -} - -- (void)surveyDidHide:(NSNotification *)notification { - NSMutableDictionary *info = [[NSMutableDictionary alloc] init]; - NSString *surveyID = [[notification userInfo] objectForKey:ATSurveyMetricsSurveyIDKey]; - if (surveyID != nil) { - [info setObject:surveyID forKey:@"id"]; - } - ATSurveyEvent eventType = [self surveyEventTypeFromNotification:notification]; - - if (eventType == ATSurveyEventTappedSend) { - [self addMetricWithName:ATMetricNameSurveySubmit info:info]; - } else if (eventType == ATSurveyEventTappedCancel) { - [self addMetricWithName:ATMetricNameSurveyCancel info:info]; - } - - [info release], info = nil; -} - -- (void)surveyDidAnswerQuestion:(NSNotification *)notification { - NSMutableDictionary *info = [[NSMutableDictionary alloc] init]; - NSString *surveyID = [[notification userInfo] objectForKey:ATSurveyMetricsSurveyIDKey]; - NSString *questionID = [[notification userInfo] objectForKey:ATSurveyMetricsSurveyQuestionIDKey]; - if (surveyID != nil) { - [info setObject:surveyID forKey:@"survey_id"]; - } - if (questionID != nil) { - [info setObject:questionID forKey:@"id"]; - } - ATSurveyEvent eventType = [self surveyEventTypeFromNotification:notification]; - if (eventType == ATSurveyEventAnsweredQuestion) { - [self addMetricWithName:ATMetricNameSurveyAnswerQuestion info:info]; - } - - [info release], info = nil; -} - -- (void)appWillTerminate:(NSNotification *)notification { - [self addMetricWithName:ATMetricNameAppExit info:nil]; -} - -- (void)appDidEnterBackground:(NSNotification *)notification { - [self addMetricWithName:ATMetricNameAppExit info:nil]; -} - -- (void)appWillEnterForeground:(NSNotification *)notification { - [self addMetricWithName:ATMetricNameAppLaunch info:nil]; -} - -- (void)preferencesChanged:(NSNotification *)notification { - [self updateWithCurrentPreferences]; -} - -- (void)updateWithCurrentPreferences { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - - NSNumber *enabled = [defaults objectForKey:ATAppConfigurationMetricsEnabledPreferenceKey]; - if (enabled) { - metricsEnabled = [enabled boolValue]; - } -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/URL Loading/ATWebClient+Metrics.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/URL Loading/ATWebClient+Metrics.h deleted file mode 100755 index f4a42fc..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/URL Loading/ATWebClient+Metrics.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// ATWebClient+Metrics.h -// ApptentiveMetrics -// -// Created by Andrew Wooster on 1/10/12. -// Copyright (c) 2012 Apptentive. All rights reserved. -// - -#import -#import "ATWebClient.h" - -@class ATAPIRequest, ATMetric; - -@interface ATWebClient (Metrics) -- (ATAPIRequest *)requestForSendingMetric:(ATMetric *)metric; -@end - - -void ATWebClient_Metrics_Bootstrap(); diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/URL Loading/ATWebClient+Metrics.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/URL Loading/ATWebClient+Metrics.m deleted file mode 100755 index b713b1b..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Metrics/URL Loading/ATWebClient+Metrics.m +++ /dev/null @@ -1,33 +0,0 @@ -// -// ATWebClient+Metrics.m -// ApptentiveMetrics -// -// Created by Andrew Wooster on 1/10/12. -// Copyright (c) 2012 Apptentive. All rights reserved. -// - -#import "ATWebClient+Metrics.h" -#import "ATWebClient_Private.h" -#import "ATAPIRequest.h" -#import "ATBackend.h" -#import "ATConnect.h" -#import "ATMetric.h" -#import "ATURLConnection.h" - -@implementation ATWebClient (Metrics) -- (ATAPIRequest *)requestForSendingMetric:(ATMetric *)metric { - NSDictionary *postData = [metric apiDictionary]; - NSString *url = [self apiURLStringWithPath:@"records"]; - ATURLConnection *conn = nil; - - conn = [self connectionToPost:[NSURL URLWithString:url] parameters:postData]; - conn.timeoutInterval = 240.0; - ATAPIRequest *request = [[ATAPIRequest alloc] initWithConnection:conn channelName:ATWebClientDefaultChannelName]; - request.returnType = ATAPIRequestReturnTypeJSON; - return [request autorelease]; -} -@end - -void ATWebClient_Metrics_Bootstrap() { - NSLog(@"Loading ATWebClient_Metrics_Bootstrap"); -} diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATLog.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATLog.h deleted file mode 100755 index a2a3758..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATLog.h +++ /dev/null @@ -1,54 +0,0 @@ -// -// ATLog.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 10/29/12. -// Copyright (c) 2012 Apptentive, Inc. All rights reserved. -// - -#import - -#import "ATLogger.h" - -#ifndef AT_LOGGING_ENABLED -# define AT_LOGGING_ENABLED 1 -#endif - -#ifndef AT_LOGGING_LEVEL_DEBUG -# define AT_LOGGING_LEVEL_DEBUG 0 -#endif - -#ifndef AT_LOGGING_LEVEL_INFO -# define AT_LOGGING_LEVEL_INFO 0 -#endif - -#ifndef AT_LOGGING_LEVEL_ERROR -# define AT_LOGGING_LEVEL_ERROR 1 -#endif - -#if !(defined(AT_LOGGING_ENABLED) && AT_LOGGING_ENABLED) -# undef AT_LOGGING_LEVEL_DEBUG -# undef AT_LOGGING_LEVEL_INFO -# undef AT_LOGGING_LEVEL_ERROR -#endif - -#define AT_LOG_FORMAT(format_val, level, ...) ([ATLogger logWithLevel:level file:__FILE__ function:__PRETTY_FUNCTION__ line:__LINE__ format:(format_val), ##__VA_ARGS__ ]) - -#if AT_LOGGING_LEVEL_DEBUG -# define ATLogDebug(s, ...) AT_LOG_FORMAT(s, @"debug", ##__VA_ARGS__) -#else -# define ATLogDebug(s, ...) -#endif - -#if AT_LOGGING_LEVEL_INFO -# define ATLogInfo(s, ...) AT_LOG_FORMAT(s, @"info", ##__VA_ARGS__) -#else -# define ATLogInfo(s, ...) -#endif - -#if AT_LOGGING_LEVEL_ERROR -# define ATLogError(s, ...) AT_LOG_FORMAT(s, @"error", ##__VA_ARGS__) -#else -# define ATLogError(s, ...) -#endif - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATLogger.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATLogger.h deleted file mode 100755 index 02156f9..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATLogger.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// ATLogger.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/8/13. -// Copyright (c) 2013 Apptentive, Inc. All rights reserved. -// - -#import - -@interface ATLogger : NSObject { -@private - // Tracks whether or not we can actually log to the log file. - BOOL creatingLogPathFailed; - - NSFileHandle *logHandle; -} -+ (ATLogger *)sharedLogger; -+ (void)logWithLevel:(NSString *)level file:(const char *)file function:(const char *)function line:(int)line format:(NSString *)format, ...; -+ (void)logWithLevel:(NSString *)level file:(const char *)file function:(const char *)function line:(int)line format:(NSString *)format args:(va_list)args; -- (NSString *)currentLogText; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATLogger.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATLogger.m deleted file mode 100755 index 8e10e6d..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATLogger.m +++ /dev/null @@ -1,207 +0,0 @@ -// -// ATLogger.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/8/13. -// Copyright (c) 2013 Apptentive, Inc. All rights reserved. -// - -#import "ATLogger.h" - -#import "ATUtilities.h" - -@interface ATLogger () -- (NSString *)logDirectoryPath; -- (NSString *)logFilePath; -- (NSString *)backupLogFilePath; -- (BOOL)rotateLog; -- (BOOL)startNewLog; -- (void)queueLogWithLevel:(NSString *)level file:(const char *)file function:(const char *)function line:(int)line message:(NSString *)message; -@end - -@implementation ATLogger - -static dispatch_queue_t loggingQueue; - -+ (void)initialize { - ATLogger *logger = [ATLogger sharedLogger]; - [logger startNewLog]; -} - -+ (ATLogger *)sharedLogger { - static ATLogger *sharedLogger; - static dispatch_once_t onceToken; - - dispatch_once(&onceToken, ^{ - loggingQueue = dispatch_queue_create("com.apptentive.logging-queue", NULL); - sharedLogger = [[self alloc] init]; - }); - return sharedLogger; -} - -- (void)dealloc { - if (logHandle != nil) { - [logHandle synchronizeFile]; - [logHandle closeFile]; - [logHandle release], logHandle = nil; - } - [super dealloc]; -} - -+ (void)logWithLevel:(NSString *)level file:(const char *)file function:(const char *)function line:(int)line format:(NSString *)format, ... { - va_list args; - if (format != nil) { - va_start(args, format); - - NSString *message = [[NSString alloc] initWithFormat:format arguments:args]; - [[ATLogger sharedLogger] queueLogWithLevel:level file:file function:function line:line message:message]; - [message release], message = nil; - va_end(args); - } -} - -+ (void)logWithLevel:(NSString *)level file:(const char *)file function:(const char *)function line:(int)line format:(NSString *)format args:(va_list)args { - if (format != nil) { - NSString *message = [[NSString alloc] initWithFormat:format arguments:args]; - [[ATLogger sharedLogger] queueLogWithLevel:level file:file function:function line:line message:message]; - [message release], message = nil; - } -} - - -- (NSString *)currentLogText { - NSError *error = nil; - NSString *text = [NSString stringWithContentsOfFile:[self logFilePath] encoding:NSUTF8StringEncoding error:&error]; - if (text == nil) { - NSLog(@"Unable to read contents of file: %@", error); - } - return text; -} - -#pragma mark - Private Methods -- (NSString *)logDirectoryPath { - NSFileManager *fm = [NSFileManager defaultManager]; - - NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); - NSString *path = ([paths count] > 0) ? [paths objectAtIndex:0] : nil; - - if (path == nil) { - creatingLogPathFailed = YES; - return nil; - } - - NSString *newPath = [path stringByAppendingPathComponent:@"com.apptentive.logs"]; - NSError *error = nil; - BOOL isDir = NO; - - BOOL pathExists = [fm fileExistsAtPath:newPath isDirectory:&isDir]; - if (pathExists == NO && isDir == YES) { - NSLog(@"ATLog path exists but is a directory: %@", newPath); - creatingLogPathFailed = YES; - return nil; - } else if (pathExists == YES) { - return newPath; - } - - BOOL pathCreated = [fm createDirectoryAtPath:newPath withIntermediateDirectories:YES attributes:nil error:&error]; - if (pathCreated == NO) { - NSLog(@"Failed to create log directory: %@", newPath); - NSLog(@"Error was: %@", error); - return nil; - } - return newPath; - -} - -- (NSString *)logFilePath { - NSString *logDir = [self logDirectoryPath]; - if (logDir == nil) { - return nil; - } - return [logDir stringByAppendingPathComponent:@"apptentive.log"]; -} - -- (NSString *)backupLogFilePath { - NSString *logDir = [self logDirectoryPath]; - if (logDir == nil) { - return nil; - } - return [logDir stringByAppendingPathComponent:@"apptentive.previous.log"]; -} - -- (BOOL)rotateLog { - __block BOOL result = YES; - - dispatch_sync(loggingQueue, ^{ - if (logHandle) { - [logHandle synchronizeFile]; - [logHandle closeFile]; - [logHandle release], logHandle = nil; - } - - NSFileManager *fm = [NSFileManager defaultManager]; - BOOL isDir = NO; - if ([fm fileExistsAtPath:[self logFilePath] isDirectory:&isDir] == YES && isDir == NO) { - [fm removeItemAtPath:[self backupLogFilePath] error:nil]; - NSError *error = nil; - if ([fm moveItemAtPath:[self logFilePath] toPath:[self backupLogFilePath] error:&error] == NO) { - NSLog(@"Unable to rotate logs: %@", error); - result = NO; - } - } - }); - return result; -} - -- (BOOL)startNewLog { - [self rotateLog]; - if (logHandle != nil) { - NSLog(@"logHandle should be nil here."); - return NO; - } - NSString *logPath = [self logFilePath]; - if (!logPath) { - NSLog(@"Unable to get log path."); - return NO; - } - NSFileManager *fm = [NSFileManager defaultManager]; - if ([fm createFileAtPath:logPath contents:nil attributes:nil] == NO) { - NSLog(@"Unable to create new log file."); - creatingLogPathFailed = YES; - return NO; - } - if (creatingLogPathFailed == YES) { - NSLog(@"Creating log path failed. Not starting new log."); - return NO; - } - logHandle = [[NSFileHandle fileHandleForWritingAtPath:logPath] retain]; - if (logHandle == nil) { - NSLog(@"Unable to create log handle."); - return NO; - } - return YES; -} - -- (void)queueLogWithLevel:(NSString *)level file:(const char *)file function:(const char *)function line:(int)line message:(NSString *)message { - NSDate *date = [NSDate date]; - - dispatch_async(loggingQueue, ^{ - @autoreleasepool { - NSString *fullFilename = [NSString stringWithUTF8String:file]; - NSString *filename = [fullFilename lastPathComponent]; - NSString *fullMessage = [[NSString alloc] initWithFormat:@"%@ %s:%d [%@] %@", filename, function, line, level, message]; - - NSLog(@"[%@] %@", level, message); - if (creatingLogPathFailed == NO && logHandle != nil) { - NSString *dateString = [ATUtilities stringRepresentationOfDate:date]; - NSMutableString *fileLogMessage = [NSMutableString stringWithFormat:@"%@ %@", dateString, fullMessage]; - if ([fileLogMessage hasSuffix:@"\n"] == NO) { - [fileLogMessage appendString:@"\n"]; - } - [logHandle writeData:[fileLogMessage dataUsingEncoding:NSUTF8StringEncoding]]; - } - [fullMessage release], fullMessage = nil; - } - }); -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATStaticLibraryBootstrap.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATStaticLibraryBootstrap.h deleted file mode 100755 index 58e34e4..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATStaticLibraryBootstrap.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ATStaticLibraryBootstrap.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 12/7/12. -// Copyright (c) 2012 Apptentive, Inc. All rights reserved. -// - -#import - -@interface ATStaticLibraryBootstrap : NSObject -+ (void)forceStaticLibrarySymbolUsage; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATStaticLibraryBootstrap.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATStaticLibraryBootstrap.m deleted file mode 100755 index 1a44918..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATStaticLibraryBootstrap.m +++ /dev/null @@ -1,29 +0,0 @@ -// -// ATStaticLibraryBootstrap.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 12/7/12. -// Copyright (c) 2012 Apptentive, Inc. All rights reserved. -// - -#import "ATStaticLibraryBootstrap.h" - -#if TARGET_OS_IPHONE -#import "ATToolbar.h" -#import "ATWebClient+SurveyAdditions.h" -#endif -#import "ATWebClient+Metrics.h" -#import "ATURLConnection_Private.h" -#import "ATWebClient_Private.h" - -@implementation ATStaticLibraryBootstrap -+ (void)forceStaticLibrarySymbolUsage { - ATWebClient_Metrics_Bootstrap(); - ATURLConnection_Private_Bootstrap(); - ATWebClient_Private_Bootstrap(); -#if TARGET_OS_IPHONE - ATToolbar_Bootstrap(); - ATWebClient_SurveyAdditions_Bootstrap(); -#endif -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATUtilities.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATUtilities.h deleted file mode 100755 index 33dbaf3..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATUtilities.h +++ /dev/null @@ -1,55 +0,0 @@ -// -// ATUtilities.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/19/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#if TARGET_OS_IPHONE -#import -#elif TARGET_OS_MAC -#import -#endif - -#define kApptentiveHostName @"apptentive.com" - -@interface ATUtilities : NSObject -#if TARGET_OS_IPHONE -+ (UIImage *)imageByTakingScreenshot; -+ (UIImage *)imageByRotatingImage:(UIImage *)image byRadians:(CGFloat)radians; -+ (UIImage *)imageByScalingImage:(UIImage *)image toSize:(CGSize)size scale:(CGFloat)contentScale fromITouchCamera:(BOOL)isFromITouchCamera; -+ (CGFloat)rotationOfViewHierarchyInRadians:(UIView *)leafView; -+ (CGAffineTransform)viewTransformInWindow:(UIWindow *)window; -#elif TARGET_OS_MAC -+ (NSData *)pngRepresentationOfImage:(NSImage *)image; -#endif -+ (NSString *)currentMachineName; -+ (NSString *)currentSystemName; -+ (NSString *)currentSystemVersion; - -+ (NSString *)stringByEscapingForURLArguments:(NSString *)string; -+ (NSString *)randomStringOfLength:(NSUInteger)length; - -+ (void)uniquifyArray:(NSMutableArray *)array; -+ (NSString *)stringRepresentationOfDate:(NSDate *)date; -+ (NSString *)stringRepresentationOfDate:(NSDate *)date timeZone:(NSTimeZone *)timeZone; -+ (NSDate *)dateFromISO8601String:(NSString *)string; - -+ (NSComparisonResult)compareVersionString:(NSString *)a toVersionString:(NSString *)b; -+ (BOOL)versionString:(NSString *)a isGreaterThanVersionString:(NSString *)b; -+ (BOOL)versionString:(NSString *)a isLessThanVersionString:(NSString *)b; -+ (BOOL)versionString:(NSString *)a isEqualToVersionString:(NSString *)b; - -+ (NSArray *)availableAppLocalizations; - -/*! Yes if there is only an app version, rather than an app version + build number in standard Cocoa versioning. */ -+ (BOOL)bundleVersionIsMainVersion; -+ (NSString *)appVersionString; -+ (NSString *)buildNumberString; - -+ (NSTimeInterval)maxAgeFromCacheControlHeader:(NSString *)cacheControl; -@end - -CGRect ATCGRectOfEvenSize(CGRect inRect); - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATUtilities.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATUtilities.m deleted file mode 100755 index 7f4974f..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Misc/ATUtilities.m +++ /dev/null @@ -1,594 +0,0 @@ -// -// ATUtilities.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/19/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import "ATUtilities.h" -#import -#if !TARGET_OS_IPHONE -#import -#import -#include -#include -#endif -#include - -#define KINDA_EQUALS(a, b) (fabs(a - b) < 0.1) -#define DEG_TO_RAD(angle) ((M_PI * angle) / 180.0) -#define RAD_TO_DEG(radians) (radians * (180.0/M_PI)) - -static NSDateFormatter *dateFormatter = nil; - -@interface ATUtilities (Private) -+ (void)setupDateFormatters; -@end - -@implementation ATUtilities - -#if TARGET_OS_IPHONE -// From QA1703: -// http://developer.apple.com/library/ios/#qa/qa1703/_index.html -// with changes to account for the application frame. -+ (UIImage*)imageByTakingScreenshot { - // Create a graphics context with the target size - // On iOS 4 and later, use UIGraphicsBeginImageContextWithOptions to take the scale into consideration - // On iOS prior to 4, fall back to use UIGraphicsBeginImageContext - CGRect applicationFrame = [[UIScreen mainScreen] applicationFrame]; - CGSize imageSize = applicationFrame.size; - if (NULL != UIGraphicsBeginImageContextWithOptions) { - UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0.0); - } else { - UIGraphicsBeginImageContext(imageSize); - } - - CGContextRef context = UIGraphicsGetCurrentContext(); - - // Iterate over every window from back to front - for (UIWindow *window in [[UIApplication sharedApplication] windows]) { - if (![window respondsToSelector:@selector(screen)] || [window screen] == [UIScreen mainScreen]) { - // -renderInContext: renders in the coordinate space of the layer, - // so we must first apply the layer's geometry to the graphics context - CGContextSaveGState(context); - // Adjust to account for the application frame offset. - CGContextTranslateCTM(context, -applicationFrame.origin.x, -applicationFrame.origin.y); - // Center the context around the window's anchor point - CGContextTranslateCTM(context, [window center].x, [window center].y); - // Apply the window's transform about the anchor point - CGContextConcatCTM(context, [window transform]); - // Offset by the portion of the bounds left of and above the anchor point - CGContextTranslateCTM(context, - -[window bounds].size.width * [[window layer] anchorPoint].x, - -[window bounds].size.height * [[window layer] anchorPoint].y); - - // Render the layer hierarchy to the current context - [[window layer] renderInContext:context]; - - // Restore the context - CGContextRestoreGState(context); - } - } - - // Retrieve the screenshot image - UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); - - UIGraphicsEndImageContext(); - return image; -} - -+ (UIImage *)imageByRotatingImage:(UIImage *)image byRadians:(CGFloat)radians { - UIImage *result = nil; - - if (KINDA_EQUALS(radians, 0.0) || KINDA_EQUALS(radians, M_PI * 2.0)) { - return image; - } - - CGAffineTransform t = CGAffineTransformIdentity; - CGSize size = image.size; - BOOL onSide = NO; - - if (KINDA_EQUALS(fabsf(radians), M_PI)) { - // Upside down, weeeee. - t = CGAffineTransformTranslate(t, size.width, size.height); - t = CGAffineTransformRotate(t, M_PI); - } else if (KINDA_EQUALS(radians, M_PI * 0.5)) { - // Home button on right. Image is rotated right 90 degrees. - onSide = YES; - size = CGSizeMake(size.height, size.width); - t = CGAffineTransformRotate(t, M_PI * 0.5); - t = CGAffineTransformScale(t, size.height/size.width, size.width/size.height); - t = CGAffineTransformTranslate(t, 0.0, -size.height); - } else if (KINDA_EQUALS(radians, -1.0 * M_PI * 0.5)) { - // Home button on left. Image is rotated left 90 degrees. - onSide = YES; - size = CGSizeMake(size.height, size.width);\ - t = CGAffineTransformRotate(t, -1.0 * M_PI * 0.5); - t = CGAffineTransformScale(t, size.height/size.width, size.width/size.height); - t = CGAffineTransformTranslate(t, -size.width, 0.0); - } - - UIGraphicsBeginImageContext(size); - CGRect r = CGRectMake(0.0, 0.0, size.width, size.height); - - CGContextRef context = UIGraphicsGetCurrentContext(); - if (onSide) { - CGContextScaleCTM(context, 1.0, -1.0); - CGContextTranslateCTM(context, 0.0, -size.height); - } else { - CGContextScaleCTM(context, 1.0, -1.0); - CGContextTranslateCTM(context, 0.0, -size.height); - } - CGContextConcatCTM(context, t); - CGContextDrawImage(context, r, image.CGImage); - - result = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - - return result; -} - -+ (UIImage *)imageByScalingImage:(UIImage *)image toSize:(CGSize)size scale:(CGFloat)contentScale fromITouchCamera:(BOOL)isFromITouchCamera { - UIImage *result = nil; - CGImageRef imageRef = nil; - size_t samplesPerPixel, bytesPerRow, bitsPerComponent; - CGFloat newHeight, newWidth; - CGRect newRect; - CGContextRef bitmapContext = nil; - CGImageRef newRef = nil; - CGAffineTransform transform = CGAffineTransformIdentity; - CGImageAlphaInfo newAlphaInfo; - CGColorSpaceRef colorSpaceRef; - - imageRef = [image CGImage]; - - samplesPerPixel = 4; - - size = CGSizeMake(floor(size.width), floor(size.height)); - newWidth = size.width; - newHeight = size.height; - - // Rotate and scale based on orientation. - if (image.imageOrientation == UIImageOrientationUpMirrored) { // EXIF 2 - // Image is mirrored horizontally. - transform = CGAffineTransformMakeTranslation(newWidth, 0); - transform = CGAffineTransformScale(transform, -1, 1); - } else if (image.imageOrientation == UIImageOrientationDown) { // EXIF 3 - // Image is rotated 180 degrees. - transform = CGAffineTransformMakeTranslation(newWidth, newHeight); - transform = CGAffineTransformRotate(transform, DEG_TO_RAD(180)); - } else if (image.imageOrientation == UIImageOrientationDownMirrored) { // EXIF 4 - // Image is mirrored vertically. - transform = CGAffineTransformMakeTranslation(0, newHeight); - transform = CGAffineTransformScale(transform, 1.0, -1.0); - } else if (image.imageOrientation == UIImageOrientationLeftMirrored) { // EXIF 5 - // Image is mirrored horizontally then rotated 270 degrees clockwise. - transform = CGAffineTransformRotate(transform, DEG_TO_RAD(90)); - transform = CGAffineTransformScale(transform, -newHeight/newWidth, newWidth/newHeight); - transform = CGAffineTransformTranslate(transform, -newWidth, -newHeight); - } else if (image.imageOrientation == UIImageOrientationLeft) { // EXIF 6 - // Image is rotated 270 degrees clockwise. - transform = CGAffineTransformRotate(transform, DEG_TO_RAD(-90)); - transform = CGAffineTransformScale(transform, newHeight/newWidth, newWidth/newHeight); - transform = CGAffineTransformTranslate(transform, -newWidth, 0); - } else if (image.imageOrientation == UIImageOrientationRightMirrored) { // EXIF 7 - // Image is mirrored horizontally then rotated 90 degrees clockwise. - transform = CGAffineTransformRotate(transform, DEG_TO_RAD(-90)); - transform = CGAffineTransformScale(transform, -newHeight/newWidth, newWidth/newHeight); - } else if (image.imageOrientation == UIImageOrientationRight) { // EXIF 8 - // Image is rotated 90 degrees clockwise. - transform = CGAffineTransformRotate(transform, DEG_TO_RAD(90)); - transform = CGAffineTransformScale(transform, newHeight/newWidth, newWidth/newHeight); - transform = CGAffineTransformTranslate(transform, 0.0, -newHeight); - } - newRect = CGRectIntegral(CGRectMake(0.0, 0.0, newWidth, newHeight)); - - bytesPerRow = samplesPerPixel * newWidth; - newAlphaInfo = kCGImageAlphaPremultipliedFirst; - bitsPerComponent = 8; - colorSpaceRef = CGColorSpaceCreateDeviceRGB(); - - bitmapContext = CGBitmapContextCreate(NULL, newWidth, newHeight, bitsPerComponent, bytesPerRow, colorSpaceRef, newAlphaInfo); - CGColorSpaceRelease(colorSpaceRef), colorSpaceRef = NULL; - CGContextSetInterpolationQuality(bitmapContext, kCGInterpolationHigh); - - // The iPhone tries to be "smart" about image orientation, and messes it - // up in the process. Here, UIImageOrientationLeft happens when the - // device is held upside down (camera on the end towards the ground). - // UIImageOrientationRight happens when the camera is in a normal, upright - // position. In both cases, the image is rotated 180 degrees from what - // the user actually saw through the image preview. - if (isFromITouchCamera && (image.imageOrientation == UIImageOrientationRight || image.imageOrientation == UIImageOrientationLeft)) { - CGContextScaleCTM(bitmapContext, -1.0, -1); - CGContextTranslateCTM(bitmapContext, -newWidth, -newHeight); - } - - CGContextConcatCTM(bitmapContext, transform); - CGContextDrawImage(bitmapContext, newRect, imageRef); - - newRef = CGBitmapContextCreateImage(bitmapContext); - result = [UIImage imageWithCGImage:newRef scale:contentScale orientation:UIImageOrientationUp]; - CGContextRelease(bitmapContext); - CGImageRelease(newRef); - - return result; -} - -+ (CGFloat)rotationOfViewHierarchyInRadians:(UIView *)leafView { - CGAffineTransform t = leafView.transform; - UIView *s = leafView.superview; - while (s && s != leafView.window) { - t = CGAffineTransformConcat(t, s.transform); - s = s.superview; - } - return atan2(t.b, t.a); -} - -+ (CGAffineTransform)viewTransformInWindow:(UIWindow *)window { - CGAffineTransform result = CGAffineTransformIdentity; - do { // once - if (!window) break; - - if ([[window rootViewController] view]) { - CGFloat rotation = [ATUtilities rotationOfViewHierarchyInRadians:[[window rootViewController] view]]; - result = CGAffineTransformMakeRotation(rotation); - break; - } - - if ([[window subviews] count]) { - for (UIView *v in [window subviews]) { - if (!CGAffineTransformIsIdentity(v.transform)) { - result = v.transform; - break; - } - } - } - } while (NO); - return result; -} -#elif TARGET_OS_MAC - -+ (NSData *)pngRepresentationOfImage:(NSImage *)image { - CGImageRef imageRef = [image CGImageForProposedRect:NULL context:NULL hints:nil]; - NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:imageRef]; - NSData *result = [imageRep representationUsingType:NSPNGFileType properties:nil]; - [imageRep release]; - return result; -} -#endif - -+ (NSString *)currentMachineName { -#if TARGET_OS_IPHONE - return [[UIDevice currentDevice] model]; -#elif TARGET_OS_MAC - char modelBuffer[256]; - size_t sz = sizeof(modelBuffer); - NSString *result = @"Unknown"; - if (0 == sysctlbyname("hw.model", modelBuffer, &sz, NULL, 0)) { - modelBuffer[sizeof(modelBuffer) - 1] = 0; - result = [NSString stringWithUTF8String:modelBuffer]; - } - return result; -#endif -} -+ (NSString *)currentSystemName { -#if TARGET_OS_IPHONE - return [[UIDevice currentDevice] systemName]; -#elif TARGET_OS_MAC - NSProcessInfo *info = [NSProcessInfo processInfo]; - NSString *osName = [info operatingSystemName]; - - if ([osName isEqualToString:@"NSMACHOperatingSystem"]) { - osName = @"Mac OS X"; - } - - return osName; -#endif -} - -+ (NSString *)currentSystemVersion { -#if TARGET_OS_PHONE - return [[UIDevice currentDevice] systemVersion]; -#elif TARGET_OS_MAC - NSProcessInfo *info = [NSProcessInfo processInfo]; - return [info operatingSystemVersionString]; -#endif -} - - -+ (NSString *)stringByEscapingForURLArguments:(NSString *)string { - CFStringRef result = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, (CFStringRef)@"%:/?#[]@!$&'()*+,;=", kCFStringEncodingUTF8); - return [NSMakeCollectable(result) autorelease]; -} - -+ (NSString *)randomStringOfLength:(NSUInteger)length { - static NSString *letters = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; - NSMutableString *result = [NSMutableString stringWithString:@""]; - for (NSUInteger i = 0; i < length; i++) { - [result appendFormat:@"%c", [letters characterAtIndex:arc4random()%[letters length]]]; - } - return result; -} - -+ (void)uniquifyArray:(NSMutableArray *)array { - NSUInteger location = [array count]; - for (NSObject *value in [array reverseObjectEnumerator]) { - location -= 1; - NSUInteger index = [array indexOfObject:value]; - if (index < location) { - [array removeObjectAtIndex:location]; - } - } -} - - -+ (NSString *)stringRepresentationOfDate:(NSDate *)aDate { - return [ATUtilities stringRepresentationOfDate:aDate timeZone:[NSTimeZone defaultTimeZone]]; -} - -+ (NSString *)stringRepresentationOfDate:(NSDate *)aDate timeZone:(NSTimeZone *)timeZone { - NSString *result = nil; - @synchronized(self) { // to avoid calendars stepping on themselves - [ATUtilities setupDateFormatters]; - dateFormatter.timeZone = timeZone; - NSString *dateString = [dateFormatter stringFromDate:aDate]; - - NSInteger timeZoneOffset = [timeZone secondsFromGMT]; - NSString *sign = (timeZoneOffset >= 0) ? @"+" : @"-"; - NSInteger hoursOffset = abs(floor(timeZoneOffset/60/60)); - NSInteger minutesOffset = abs((int)floor(timeZoneOffset/60) % 60); - NSString *timeZoneString = [NSString stringWithFormat:@"%@%.2d%.2d", sign, (int)hoursOffset, (int)minutesOffset]; - - NSTimeInterval interval = [aDate timeIntervalSince1970]; - double fractionalSeconds = interval - (long)interval; - - // This is all necessary because of rdar://10500679 in which NSDateFormatter won't - // format fractional seconds past two decimal places. Also, strftime() doesn't seem - // to have fractional seconds on iOS. - if (fractionalSeconds == 0.0) { - result = [NSString stringWithFormat:@"%@ %@", dateString, timeZoneString]; - } else { - NSString *f = [[NSString alloc] initWithFormat:@"%g", fractionalSeconds]; - NSRange r = [f rangeOfString:@"."]; - if (r.location != NSNotFound) { - NSString *truncatedFloat = [f substringFromIndex:r.location + r.length]; - result = [NSString stringWithFormat:@"%@.%@ %@", dateString, truncatedFloat, timeZoneString]; - } else { - // For some reason, we couldn't find the decimal place. - result = [NSString stringWithFormat:@"%@.%ld %@", dateString, (long)(fractionalSeconds * 1000), timeZoneString]; - } - [f release], f= nil; - } - } - return result; -} - -+ (NSDate *)dateFromISO8601String:(NSString *)string { - BOOL validDate = YES; - NSDate *result = nil; - - NSDate *now = [NSDate date]; - NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; - calendar.firstWeekday = 2; - calendar.timeZone = [NSTimeZone defaultTimeZone]; - - NSDateComponents *components = [[NSDateComponents alloc] init]; - NSDateComponents *nowComponents = [calendar components:NSYearCalendarUnit|NSMonthCalendarUnit|NSDayCalendarUnit fromDate:now]; - components.calendar = calendar; - - NSScanner *scanner = [[NSScanner alloc] initWithString:string]; - NSString *ymdString = nil; - [scanner scanUpToString:@"T" intoString:&ymdString]; - - if (ymdString && [ymdString length]) { - NSScanner *ymdScanner = [[NSScanner alloc] initWithString:ymdString]; - do { // once - NSInteger month = 0; - NSInteger day = 0; - NSString *yearString = nil; - if (![ymdScanner scanCharactersFromSet:[NSCharacterSet decimalDigitCharacterSet] intoString:&yearString] || [yearString length] != 4) { - validDate = NO; - break; - } - components.year = [yearString integerValue]; - if (![ymdScanner scanString:@"-" intoString:NULL]) break; - if (![ymdScanner scanInteger:&month]) break; - components.month = month; - if (![ymdScanner scanString:@"-" intoString:NULL]) break; - if (![ymdScanner scanInteger:&day]) break; - components.day = day; - } while (NO); - [ymdScanner release], ymdScanner = nil; - } else { - [components setYear:[nowComponents year]]; - [components setMonth:[nowComponents month]]; - [components setDay:[nowComponents day]]; - } - - if ([scanner scanString:@"T" intoString:NULL]) { - do { // once - NSInteger hour = 0; - NSInteger minute = 0; - if (![scanner scanInteger:&hour]) { - validDate = NO; - break; - } - components.hour = hour; - if (![scanner scanString:@":" intoString:NULL]) break; - if (![scanner scanInteger:&minute]) break; - components.minute = minute; - if (![scanner scanString:@":" intoString:NULL]) break; - double secondFraction = 0.0; - if (![scanner scanDouble:&secondFraction]) break; - components.second = (NSInteger)round(secondFraction); - } while (NO); - } - - if ([scanner scanString:@"Z" intoString:NULL]) { - // Use UTC. - components.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"UTC"]; - } else { - do { // once - BOOL isPositiveOffset = YES; - if ([scanner scanString:@"+" intoString:NULL]) { - isPositiveOffset = YES; - } else if ([scanner scanString:@"-" intoString:NULL]) { - isPositiveOffset = NO; - } else { - if (![scanner isAtEnd]) { - validDate = NO; - } - break; - } - NSInteger hours = 0; - NSInteger minutes = 0; - if (!([scanner scanInteger:&hours] && [scanner scanString:@":" intoString:NULL] && [scanner scanInteger:&minutes])) { - validDate = NO; - break; - } - NSInteger secondsFromGMT = hours*3600 + minutes*60; - if (!isPositiveOffset) { - secondsFromGMT = secondsFromGMT * -1; - } - components.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:secondsFromGMT]; - } while (NO); - } - - [calendar release], calendar = nil; - [scanner release], scanner = nil; - if (validDate) { - result = [components date]; - } - [components release], components = nil; - return result; -} - -+ (NSComparisonResult)compareVersionString:(NSString *)a toVersionString:(NSString *)b { - return [a compare:b options:NSNumericSearch]; -} - -+ (BOOL)versionString:(NSString *)a isGreaterThanVersionString:(NSString *)b { - NSComparisonResult comparisonResult = [ATUtilities compareVersionString:a toVersionString:b]; - return (comparisonResult == NSOrderedDescending); -} - -+ (BOOL)versionString:(NSString *)a isLessThanVersionString:(NSString *)b { - NSComparisonResult comparisonResult = [ATUtilities compareVersionString:a toVersionString:b]; - return (comparisonResult == NSOrderedAscending); -} - -+ (BOOL)versionString:(NSString *)a isEqualToVersionString:(NSString *)b { - NSComparisonResult comparisonResult = [ATUtilities compareVersionString:a toVersionString:b]; - return (comparisonResult == NSOrderedSame); -} - -+ (NSArray *)availableAppLocalizations { - static NSMutableArray *localAppLocalizations = nil; - @synchronized(self) { - if (localAppLocalizations == nil) { - NSArray *rawLocalizations = [[NSBundle mainBundle] localizations]; - localAppLocalizations = [[NSMutableArray alloc] init]; - for (NSString *loc in rawLocalizations) { - NSString *s = [NSLocale canonicalLocaleIdentifierFromString:loc]; - if (![localAppLocalizations containsObject:s]) { - [localAppLocalizations addObject:s]; - } - } - } - } - return localAppLocalizations; -} - -+ (BOOL)bundleVersionIsMainVersion { - BOOL result = NO; - NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; - NSString *bundleVersion = [infoDictionary objectForKey:(NSString *)kCFBundleVersionKey]; - NSString *shortVersion = [infoDictionary objectForKey:@"CFBundleShortVersionString"]; - - if (!shortVersion) { - result = YES; - } else if ([shortVersion isEqualToString:bundleVersion]) { - result = YES; - } - return result; -} - -+ (NSString *)appVersionString { - static NSString *appVersionString = nil; - @synchronized(self) { - if (appVersionString == nil) { - if ([ATUtilities bundleVersionIsMainVersion]) { - appVersionString = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey]; - } else { - appVersionString = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; - } - } - } - return appVersionString; -} - -+ (NSString *)buildNumberString { - static NSString *buildNumberString = nil; - @synchronized(self) { - if (buildNumberString == nil) { - if (![self bundleVersionIsMainVersion]) { - buildNumberString = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey]; - } else { - buildNumberString = @"?"; - } - } - } - if ([buildNumberString isEqualToString:@"?"]) { - return nil; - } else { - return buildNumberString; - } -} - -+ (NSTimeInterval)maxAgeFromCacheControlHeader:(NSString *)cacheControl { - if (cacheControl == nil || [cacheControl rangeOfString:@"max-age"].location == NSNotFound) { - return 0; - } - NSTimeInterval maxAge = 0; - NSScanner *scanner = [[NSScanner alloc] initWithString:[cacheControl lowercaseString]]; - [scanner scanUpToString:@"max-age" intoString:NULL]; - if ([scanner scanString:@"max-age" intoString:NULL] && [scanner scanString:@"=" intoString:NULL]) { - if (![scanner scanDouble:&maxAge]) { - maxAge = 0; - } - } - [scanner release], scanner = nil; - return maxAge; -} -@end - - -@implementation ATUtilities (Private) -+ (void)setupDateFormatters { - @synchronized(self) { - if (dateFormatter == nil) { - dateFormatter = [[NSDateFormatter alloc] init]; - NSLocale *enUSLocale = [[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"] autorelease]; - NSCalendar *calendar = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease]; - [dateFormatter setLocale:enUSLocale]; - [dateFormatter setCalendar:calendar]; - [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; - } - } -} - -@end - -extern CGRect ATCGRectOfEvenSize(CGRect inRect) { - CGRect result = CGRectMake(floor(inRect.origin.x), floor(inRect.origin.y), ceil(inRect.size.width), ceil(inRect.size.height)); - - if (fmod(result.size.width, 2.0) != 0.0) { - result.size.width += 1.0; - } - if (fmod(result.size.height, 2.0) != 0.0) { - result.size.height += 1.0; - } - - return result; -} diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATAppConfigurationUpdater.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATAppConfigurationUpdater.h deleted file mode 100755 index 99f3d11..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATAppConfigurationUpdater.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// ATAppConfigurationUpdater.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/18/12. -// Copyright (c) 2012 Apptentive, Inc. All rights reserved. -// - -#import -#import "ATAPIRequest.h" - -NSString *const ATConfigurationPreferencesChangedNotification; -NSString *const ATAppConfigurationLastUpdatePreferenceKey; -NSString *const ATAppConfigurationExpirationPreferenceKey; -NSString *const ATAppConfigurationMetricsEnabledPreferenceKey; - -@protocol ATAppConfigurationUpdaterDelegate -- (void)configurationUpdaterDidFinish:(BOOL)success; -@end - -@interface ATAppConfigurationUpdater : NSObject { -@private - ATAPIRequest *request; - NSObject *delegate; -} -+ (BOOL)shouldCheckForUpdate; -- (id)initWithDelegate:(NSObject *)delegate; -- (void)update; -- (void)cancel; -- (float)percentageComplete; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATAppConfigurationUpdater.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATAppConfigurationUpdater.m deleted file mode 100755 index d2290aa..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATAppConfigurationUpdater.m +++ /dev/null @@ -1,212 +0,0 @@ -// -// ATAppConfigurationUpdater.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/18/12. -// Copyright (c) 2012 Apptentive, Inc. All rights reserved. -// - -#import "ATAppConfigurationUpdater.h" -#import "ATAppRatingFlow_Private.h" -#import "ATLog.h" -#import "ATContactStorage.h" -#import "ATUtilities.h" -#import "ATWebClient.h" -#import "PJSONKit.h" - -NSString *const ATConfigurationPreferencesChangedNotification = @"ATConfigurationPreferencesChangedNotification"; -NSString *const ATAppConfigurationLastUpdatePreferenceKey = @"ATAppConfigurationLastUpdatePreferenceKey"; -NSString *const ATAppConfigurationExpirationPreferenceKey = @"ATAppConfigurationExpirationPreferenceKey"; -NSString *const ATAppConfigurationMetricsEnabledPreferenceKey = @"ATAppConfigurationMetricsEnabledPreferenceKey"; - -// Interval, in seconds, after which we'll update the configuration. -#if APPTENTIVE_DEBUG -#define kATAppConfigurationUpdateInterval (3) -#else -#define kATAppConfigurationUpdateInterval (60*60*24) -#endif - - -@interface ATAppConfigurationUpdater (Private) -- (void)processResult:(NSDictionary *)jsonRatingConfiguration; -@end - -@implementation ATAppConfigurationUpdater -+ (void)registerDefaults { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSDictionary *defaultPreferences = - [NSDictionary dictionaryWithObjectsAndKeys: - [NSDate distantPast], ATAppConfigurationLastUpdatePreferenceKey, - [NSNumber numberWithBool:YES], ATAppConfigurationMetricsEnabledPreferenceKey, - nil]; - [defaults registerDefaults:defaultPreferences]; -} - -+ (BOOL)shouldCheckForUpdate { - [ATAppConfigurationUpdater registerDefaults]; - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSDate *lastCheck = [defaults objectForKey:ATAppConfigurationLastUpdatePreferenceKey]; - -#ifndef APPTENTIVE_DEBUG - NSDate *expiration = [defaults objectForKey:ATAppConfigurationExpirationPreferenceKey]; - if (expiration) { - NSDate *now = [NSDate date]; - NSComparisonResult comparison = [expiration compare:now]; - if (comparison == NSOrderedSame || comparison == NSOrderedAscending) { - return YES; - } else { - return NO; - } - } -#endif - - // Fall back to the defaults. - NSTimeInterval interval = [lastCheck timeIntervalSinceNow]; - - if (interval <= -kATAppConfigurationUpdateInterval) { - return YES; - } else { - return NO; - } -} - - -- (id)initWithDelegate:(NSObject *)aDelegate { - if ((self = [super init])) { - delegate = aDelegate; - } - return self; -} - -- (void)dealloc { - delegate = nil; - [self cancel]; - [super dealloc]; -} - -- (void)update { - [self cancel]; - request = [[[ATWebClient sharedClient] requestForGettingAppConfiguration] retain]; - request.delegate = self; - [request start]; -} - -- (void)cancel { - if (request) { - request.delegate = nil; - [request cancel]; - [request release], request = nil; - } -} - -- (float)percentageComplete { - if (request) { - return [request percentageComplete]; - } else { - return 0.0f; - } -} - -#pragma mark ATATIRequestDelegate -- (void)at_APIRequestDidFinish:(ATAPIRequest *)sender result:(NSObject *)result { - @synchronized (self) { - if ([result isKindOfClass:[NSDictionary class]]) { - [self processResult:(NSDictionary *)result]; - [delegate configurationUpdaterDidFinish:YES]; - } else { - ATLogError(@"App configuration result is not NSDictionary!"); - [delegate configurationUpdaterDidFinish:NO]; - } - } -} - -- (void)at_APIRequestDidProgress:(ATAPIRequest *)sender { - // pass -} - -- (void)at_APIRequestDidFail:(ATAPIRequest *)sender { - @synchronized(self) { - ATLogInfo(@"Request failed: %@, %@", sender.errorTitle, sender.errorMessage); - - [delegate configurationUpdaterDidFinish:NO]; - } -} -@end - -@implementation ATAppConfigurationUpdater (Private) -- (void)processResult:(NSDictionary *)jsonConfiguration { - BOOL hasConfigurationChanges = NO; - - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - [ATAppConfigurationUpdater registerDefaults]; - [ATAppRatingFlow_Private registerDefaults]; - [defaults setObject:[NSDate date] forKey:ATAppConfigurationLastUpdatePreferenceKey]; - [defaults synchronize]; - - NSDictionary *numberObjects = - [NSDictionary dictionaryWithObjectsAndKeys: - @"ratings_clear_on_upgrade", ATAppRatingClearCountsOnUpgradePreferenceKey, - @"ratings_enabled", ATAppRatingEnabledPreferenceKey, - @"ratings_days_before_prompt", ATAppRatingDaysBeforePromptPreferenceKey, - @"ratings_days_between_prompts", ATAppRatingDaysBetweenPromptsPreferenceKey, - @"ratings_events_before_prompt", ATAppRatingSignificantEventsBeforePromptPreferenceKey, - @"ratings_uses_before_prompt", ATAppRatingUsesBeforePromptPreferenceKey, - @"metrics_enabled", ATAppConfigurationMetricsEnabledPreferenceKey, - nil]; - - NSArray *boolPreferences = [NSArray arrayWithObjects:@"ratings_clear_on_upgrade", @"ratings_enabled", @"metrics_enabled", nil]; - NSObject *ratingsPromptLogic = [jsonConfiguration objectForKey:@"ratings_prompt_logic"]; - - for (NSString *key in numberObjects) { - NSObject *value = [jsonConfiguration objectForKey:[numberObjects objectForKey:key]]; - if (!value || ![value isKindOfClass:[NSNumber class]]) { - continue; - } - - NSNumber *numberValue = (NSNumber *)value; - - NSNumber *existingNumber = [defaults objectForKey:key]; - if ([existingNumber isEqualToNumber:numberValue]) { - continue; - } - - if ([boolPreferences containsObject:[numberObjects objectForKey:key]]) { - [defaults setObject:numberValue forKey:key]; - } else { - NSUInteger unsignedIntegerValue = [numberValue unsignedIntegerValue]; - NSNumber *replacementValue = [NSNumber numberWithUnsignedInteger:unsignedIntegerValue]; - - [defaults setObject:replacementValue forKey:key]; - } - hasConfigurationChanges = YES; - } - - if (ratingsPromptLogic) { - NSPredicate *predicate = [ATAppRatingFlow_Private predicateForPromptLogic:ratingsPromptLogic withPredicateInfo:nil]; - if (predicate) { - [defaults setObject:ratingsPromptLogic forKey:ATAppRatingPromptLogicPreferenceKey]; - hasConfigurationChanges = YES; - } - } - - if ([jsonConfiguration objectForKey:@"review_url"]) { - NSString *reviewURLString = [jsonConfiguration objectForKey:@"review_url"]; - [defaults setObject:reviewURLString forKey:ATAppRatingReviewURLPreferenceKey]; - } - - if ([jsonConfiguration objectForKey:@"cache-expiration"]) { - NSString *expirationDateString = [jsonConfiguration objectForKey:@"cache-expiration"]; - NSDate *expirationDate = [ATUtilities dateFromISO8601String:expirationDateString]; - if (expirationDate) { - [defaults setObject:expirationDate forKey:ATAppConfigurationExpirationPreferenceKey]; - } - } - - if (hasConfigurationChanges) { - [defaults setObject:[NSNumber numberWithBool:YES] forKey:ATAppRatingSettingsAreFromServerPreferenceKey]; - [defaults synchronize]; - [[NSNotificationCenter defaultCenter] postNotificationName:ATConfigurationPreferencesChangedNotification object:nil]; - } -} -@end - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATBackend.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATBackend.h deleted file mode 100755 index 9c76046..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATBackend.h +++ /dev/null @@ -1,58 +0,0 @@ -// -// ATBackend.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/19/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#if TARGET_OS_IPHONE -#import -#elif TARGET_OS_MAC -#import -#endif - -NSString *const ATBackendNewAPIKeyNotification; - -#define USE_STAGING 0 - -@class ATAppConfigurationUpdater; -@class ATFeedback; -@class ATAPIRequest; - -/*! Handles all of the backend activities, such as sending feedback. */ -@interface ATBackend : NSObject { -@private - NSString *apiKey; - ATFeedback *currentFeedback; - BOOL networkAvailable; - BOOL apiKeySet; - BOOL shouldStopWorking; - BOOL working; -} -@property (nonatomic, copy) NSString *apiKey; -/*! The feedback currently being worked on by the user. */ -@property (nonatomic, retain) ATFeedback *currentFeedback; - -+ (ATBackend *)sharedBackend; -#if TARGET_OS_IPHONE -+ (UIImage *)imageNamed:(NSString *)name; -#elif TARGET_OS_MAC -+ (NSImage *)imageNamed:(NSString *)name; -#endif - -/*! Use this to add the feedback to a queue of feedback tasks which - will be sent in the background. */ -- (void)sendFeedback:(ATFeedback *)feedback; - -- (NSString *)supportDirectoryPath; - -/*! Path to directory for storing attachments. */ -- (NSString *)attachmentDirectoryPath; -- (NSString *)deviceUUID; - -- (NSURL *)apptentiveHomepageURL; -- (NSURL *)apptentivePrivacyPolicyURL; - -- (NSString *)distributionName; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATBackend.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATBackend.m deleted file mode 100755 index 3d6a30a..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATBackend.m +++ /dev/null @@ -1,346 +0,0 @@ -// -// ATBackend.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/19/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import "ATBackend.h" -#import "ATAppConfigurationUpdateTask.h" -#import "ATConnect.h" -#import "ATContactStorage.h" -#import "ATFeedback.h" -#import "ATFeedbackTask.h" -#import "ApptentiveMetrics.h" -#import "ATReachability.h" -#import "ATStaticLibraryBootstrap.h" -#import "ATTaskQueue.h" -#import "ATUtilities.h" -#import "ATWebClient.h" -#import "ATLog.h" - -NSString *const ATBackendNewAPIKeyNotification = @"ATBackendNewAPIKeyNotification"; -NSString *const ATUUIDPreferenceKey = @"ATUUIDPreferenceKey"; -NSString *const ATInfoDistributionKey = @"ATInfoDistributionKey"; - -@interface ATBackend () -- (void)updateRatingConfigurationIfNeeded; -@end - -@interface ATBackend (Private) -- (void)setup; -- (void)updateWorking; -- (void)networkStatusChanged:(NSNotification *)notification; -- (void)stopWorking:(NSNotification *)notification; -- (void)startWorking:(NSNotification *)notification; -@end - -@interface ATBackend () -@property (nonatomic, assign) BOOL working; -@end - -@implementation ATBackend -@synthesize apiKey, working, currentFeedback; - -+ (ATBackend *)sharedBackend { - static ATBackend *sharedBackend = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedBackend = [[self alloc] init]; - }); - [ApptentiveMetrics sharedMetrics]; - return sharedBackend; -} - -#if TARGET_OS_IPHONE -+ (UIImage *)imageNamed:(NSString *)name { - NSString *imagePath = nil; - UIImage *result = nil; - CGFloat scale = [[UIScreen mainScreen] scale]; - if (scale > 1.0) { - imagePath = [[ATConnect resourceBundle] pathForResource:[NSString stringWithFormat:@"%@@2x", name] ofType:@"png"]; - } else { - imagePath = [[ATConnect resourceBundle] pathForResource:[NSString stringWithFormat:@"%@", name] ofType:@"png"]; - } - - if (!imagePath) { - if (scale > 1.0) { - imagePath = [[ATConnect resourceBundle] pathForResource:[NSString stringWithFormat:@"%@@2x", name] ofType:@"png" inDirectory:@"generated"]; - } else { - imagePath = [[ATConnect resourceBundle] pathForResource:[NSString stringWithFormat:@"%@", name] ofType:@"png" inDirectory:@"generated"]; - } - } - - if (imagePath) { - result = [UIImage imageWithContentsOfFile:imagePath]; - } else { - result = [UIImage imageNamed:name]; - } - if (!result) { - ATLogError(@"Unable to find image named: %@", name); - ATLogError(@"sought at: %@", imagePath); - ATLogError(@"bundle is: %@", [ATConnect resourceBundle]); - } - return result; -} -#elif TARGET_OS_MAC -+ (NSImage *)imageNamed:(NSString *)name { - NSString *imagePath = nil; - NSImage *result = nil; - CGFloat scale = 1.0; - - if ([[NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)]) { - scale = (CGFloat)[[NSScreen mainScreen] backingScaleFactor]; - } - if (scale > 1.0) { - imagePath = [[ATConnect resourceBundle] pathForResource:[NSString stringWithFormat:@"%@@2x", name] ofType:@"png"]; - } else { - imagePath = [[ATConnect resourceBundle] pathForResource:[NSString stringWithFormat:@"%@", name] ofType:@"png"]; - } - - if (!imagePath) { - if (scale > 1.0) { - imagePath = [[ATConnect resourceBundle] pathForResource:[NSString stringWithFormat:@"%@@2x", name] ofType:@"png" inDirectory:@"generated"]; - } else { - imagePath = [[ATConnect resourceBundle] pathForResource:[NSString stringWithFormat:@"%@", name] ofType:@"png" inDirectory:@"generated"]; - } - } - - if (imagePath) { - result = [[[NSImage alloc] initWithContentsOfFile:imagePath] autorelease]; - } else { - result = [NSImage imageNamed:name]; - } - if (!result) { - ATLogError(@"Unable to find image named: %@", name); - ATLogError(@"sought at: %@", imagePath); - ATLogError(@"bundle is: %@", [ATConnect resourceBundle]); - } - return result; -} -#endif - -- (id)init { - if ((self = [super init])) { - [self setup]; - } - return self; -} - -- (void)dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; - [apiKey release], apiKey = nil; - [currentFeedback release], currentFeedback = nil; - [super dealloc]; -} - -- (void)setApiKey:(NSString *)anAPIKey { - if (apiKey != anAPIKey) { - [apiKey release]; - apiKey = nil; - apiKey = [anAPIKey retain]; - if (apiKey == nil) { - apiKeySet = NO; - } else { - apiKeySet = YES; - } - [self updateWorking]; - [[NSNotificationCenter defaultCenter] postNotificationName:ATBackendNewAPIKeyNotification object:nil]; - } -} - -- (void)sendFeedback:(ATFeedback *)feedback { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - if ([[NSThread currentThread] isMainThread]) { - [feedback retain]; - [self performSelectorInBackground:@selector(sendFeedback:) withObject:feedback]; - [pool release], pool = nil; - return; - } - if (feedback == self.currentFeedback) { - self.currentFeedback = nil; - } - ATContactStorage *contact = [ATContactStorage sharedContactStorage]; - contact.name = feedback.name; - contact.email = feedback.email; - contact.phone = feedback.phone; - [ATContactStorage releaseSharedContactStorage]; - contact = nil; - - ATFeedbackTask *task = [[ATFeedbackTask alloc] init]; - task.feedback = feedback; - [[ATTaskQueue sharedTaskQueue] addTask:task]; - [task release]; - task = nil; - - [feedback release]; - [pool release]; -} - -- (void)updateRatingConfigurationIfNeeded { - ATAppConfigurationUpdateTask *task = [[ATAppConfigurationUpdateTask alloc] init]; - [[ATTaskQueue sharedTaskQueue] addTask:task]; - [task release], task = nil; -} - -- (NSString *)supportDirectoryPath { - NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); - NSString *path = ([paths count] > 0) ? [paths objectAtIndex:0] : nil; - - NSString *newPath = [path stringByAppendingPathComponent:@"com.apptentive.feedback"]; - NSFileManager *fm = [NSFileManager defaultManager]; - NSError *error = nil; - BOOL result = [fm createDirectoryAtPath:newPath withIntermediateDirectories:YES attributes:nil error:&error]; - if (!result) { - ATLogError(@"Failed to create support directory: %@", newPath); - ATLogError(@"Error was: %@", error); - return nil; - } - return newPath; -} - -- (NSString *)attachmentDirectoryPath { - NSString *supportPath = [self supportDirectoryPath]; - if (!supportPath) { - return nil; - } - NSString *newPath = [supportPath stringByAppendingPathComponent:@"attachments"]; - NSFileManager *fm = [NSFileManager defaultManager]; - NSError *error = nil; - BOOL result = [fm createDirectoryAtPath:newPath withIntermediateDirectories:YES attributes:nil error:&error]; - if (!result) { - ATLogError(@"Failed to create attachments directory: %@", newPath); - ATLogError(@"Error was: %@", error); - return nil; - } - return newPath; -} - -- (NSString *)deviceUUID { -#if TARGET_OS_IPHONE - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSString *uuid = [defaults objectForKey:ATUUIDPreferenceKey]; - if (!uuid) { - CFUUIDRef uuidRef = CFUUIDCreate(NULL); - CFStringRef uuidStringRef = CFUUIDCreateString(NULL, uuidRef); - - uuid = [NSString stringWithFormat:@"ios:%@", (NSString *)uuidStringRef]; - - CFRelease(uuidRef), uuidRef = NULL; - CFRelease(uuidStringRef), uuidStringRef = NULL; - - [defaults setObject:uuid forKey:ATUUIDPreferenceKey]; - [defaults synchronize]; - } - return uuid; -#elif TARGET_OS_MAC - static CFStringRef keyRef = CFSTR("apptentiveUUID"); - static CFStringRef appIDRef = CFSTR("com.apptentive.feedback"); - NSString *uuid = nil; - uuid = (NSString *)CFPreferencesCopyAppValue(keyRef, appIDRef); - if (!uuid) { - CFUUIDRef uuidRef = CFUUIDCreate(NULL); - CFStringRef uuidStringRef = CFUUIDCreateString(NULL, uuidRef); - - uuid = [[NSString alloc] initWithFormat:@"osx:%@", (NSString *)uuidStringRef]; - - CFRelease(uuidRef), uuidRef = NULL; - CFRelease(uuidStringRef), uuidStringRef = NULL; - - CFPreferencesSetValue(keyRef, (CFStringRef)uuid, appIDRef, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost); - CFPreferencesSynchronize(appIDRef, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost); - } - return [uuid autorelease]; -#endif -} - -#pragma mark Accessors -- (void)setWorking:(BOOL)newWorking { - if (working != newWorking) { - working = newWorking; - if (working) { - [[ATTaskQueue sharedTaskQueue] start]; - - [self updateRatingConfigurationIfNeeded]; - } else { - [[ATTaskQueue sharedTaskQueue] stop]; - [ATTaskQueue releaseSharedTaskQueue]; - } - } -} - - -- (NSURL *)apptentiveHomepageURL { - return [NSURL URLWithString:@"http://www.apptentive.com/"]; -} - -- (NSURL *)apptentivePrivacyPolicyURL { - return [NSURL URLWithString:@"http://www.apptentive.com/privacy"]; -} - -- (NSString *)distributionName { - static NSString *cachedDistributionName = nil; - static dispatch_once_t onceToken = 0; - dispatch_once(&onceToken, ^{ - cachedDistributionName = [(NSString *)[[ATConnect resourceBundle] objectForInfoDictionaryKey:ATInfoDistributionKey] retain]; - }); - return cachedDistributionName; -} -@end - -@implementation ATBackend (Private) -- (void)setup { - [ATStaticLibraryBootstrap forceStaticLibrarySymbolUsage]; -#if TARGET_OS_IPHONE - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(stopWorking:) name:UIApplicationWillTerminateNotification object:nil]; - - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(startWorking:) name:UIApplicationDidBecomeActiveNotification object:nil]; - - - if (&UIApplicationDidEnterBackgroundNotification != nil) { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(stopWorking:) name:UIApplicationDidEnterBackgroundNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(startWorking:) name:UIApplicationWillEnterForegroundNotification object:nil]; - } -#elif TARGET_OS_MAC - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(stopWorking:) name:NSApplicationWillTerminateNotification object:nil]; -#endif - - [ATReachability sharedReachability]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkStatusChanged:) name:ATReachabilityStatusChanged object:nil]; -} - -- (void)updateWorking { - if (shouldStopWorking) { - // Probably going into the background or being terminated. - self.working = NO; - } else if (apiKeySet && networkAvailable) { - // API Key is set and the network is up. Start working. - self.working = YES; - } else { - // No API Key or not network, or both. Stop working. - self.working = NO; - } -} - -#pragma mark Notification Handling -- (void)networkStatusChanged:(NSNotification *)notification { - ATNetworkStatus status = [[ATReachability sharedReachability] currentNetworkStatus]; - if (status == ATNetworkNotReachable) { - networkAvailable = NO; - } else { - networkAvailable = YES; - } - [self updateWorking]; -} - -- (void)stopWorking:(NSNotification *)notification { - shouldStopWorking = YES; - [self updateWorking]; -} - -- (void)startWorking:(NSNotification *)notification { - shouldStopWorking = NO; - [self updateWorking]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATContactStorage.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATContactStorage.h deleted file mode 100755 index 9e1af97..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATContactStorage.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// ATContactStorage.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/21/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import - -@interface ATContactStorage : NSObject { -@private - NSString *name; - NSString *email; - NSString *phone; -} -@property (nonatomic, copy) NSString *name; -@property (nonatomic, copy) NSString *email; -@property (nonatomic, copy) NSString *phone; -+ (ATContactStorage *)sharedContactStorage; -+ (void)releaseSharedContactStorage; -- (void)save; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATContactStorage.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATContactStorage.m deleted file mode 100755 index 0a7cf20..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATContactStorage.m +++ /dev/null @@ -1,112 +0,0 @@ -// -// ATContactStorage.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/21/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import "ATContactStorage.h" -#import "ATLog.h" -#import "ATBackend.h" - -#define kATContactStorageVersion 1 - -// Interval, in seconds, after which we'll update the contact storage from the -// server, if it hasn't been modified locally. -#define kATContactStorageUpdateInterval (60*60*24*7) - -static ATContactStorage *sharedContactStorage = nil; - -@interface ATContactStorage (Private) -- (void)setup; -- (void)teardown; -@end - -@implementation ATContactStorage -@synthesize name, email, phone; - -+ (NSString *)contactStoragePath { - return [[[ATBackend sharedBackend] supportDirectoryPath] stringByAppendingPathComponent:@"contactinfo.objects"]; -} - -+ (BOOL)serializedVersionExists { - NSFileManager *fm = [NSFileManager defaultManager]; - return [fm fileExistsAtPath:[ATContactStorage contactStoragePath]]; -} - - -+ (ATContactStorage *)sharedContactStorage { - @synchronized(self) { - if (sharedContactStorage == nil) { - if ([ATContactStorage serializedVersionExists]) { - @try { - sharedContactStorage = [[NSKeyedUnarchiver unarchiveObjectWithFile:[ATContactStorage contactStoragePath]] retain]; - } - @catch (NSException *exception) { - ATLogError(@"Unable to unarchive cstorage: %@", exception); - } - } - if (!sharedContactStorage) { - sharedContactStorage = [[ATContactStorage alloc] init]; - } - } - } - return sharedContactStorage; -} - -+ (void)releaseSharedContactStorage { - @synchronized(self) { - if (sharedContactStorage != nil) { - [sharedContactStorage save]; - [sharedContactStorage release]; - sharedContactStorage = nil; - } - } -} - -- (void)save { - @synchronized(self) { - [NSKeyedArchiver archiveRootObject:sharedContactStorage toFile:[ATContactStorage contactStoragePath]]; - } -} - -- (id)initWithCoder:(NSCoder *)coder { - if ((self = [super init])) { - int version = [coder decodeIntForKey:@"version"]; - if (version == kATContactStorageVersion) { - self.name = [coder decodeObjectForKey:@"name"]; - self.email = [coder decodeObjectForKey:@"email"]; - self.phone = [coder decodeObjectForKey:@"phone"]; - } else { - [self release]; - return nil; - } - } - return self; -} - -- (void)encodeWithCoder:(NSCoder *)coder { - [coder encodeInt:kATContactStorageVersion forKey:@"version"]; - [coder encodeObject:self.name forKey:@"name"]; - [coder encodeObject:self.email forKey:@"email"]; - [coder encodeObject:self.phone forKey:@"phone"]; -} - -- (void)dealloc { - [self teardown]; - [super dealloc]; -} -@end - -@implementation ATContactStorage (Private) -- (void)setup { - -} - -- (void)teardown { - self.name = nil; - self.phone = nil; - self.email = nil; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATFeedback.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATFeedback.h deleted file mode 100755 index 8833e7c..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATFeedback.h +++ /dev/null @@ -1,73 +0,0 @@ -// -// ATFeedback.h -// DemoApp -// -// Created by Andrew Wooster on 3/16/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#if TARGET_OS_IPHONE -#import -#elif TARGET_OS_MAC -#import -#endif - -#import "ATRecord.h" - -typedef enum { - ATFeedbackTypeFeedback, - ATFeedbackTypePraise, - ATFeedbackTypeBug, - ATFeedbackTypeQuestion -} ATFeedbackType; - -typedef enum { - ATFeedbackSourceUnknown, - ATFeedbackSourceEnjoymentDialog, -} ATFeedbackSource; - -typedef enum { - ATFeedbackImageSourceScreenshot, - ATFeedbackImageSourceCamera, - ATFeedbackImageSourcePhotoLibrary, -} ATFeedbackImageSource; - -@interface ATFeedback : ATRecord { -@private - NSMutableDictionary *extraData; - ATFeedbackType type; - NSString *text; - NSString *name; - NSString *email; - NSString *phone; - ATFeedbackSource source; -#if TARGET_OS_IPHONE - UIImage *screenshot; -#elif TARGET_OS_MAC - NSImage *screenshot; -#endif - ATFeedbackImageSource imageSource; - - NSString *screenshotFilename; -} -@property (nonatomic, assign) ATFeedbackType type; -@property (nonatomic, copy) NSString *text; -@property (nonatomic, copy) NSString *name; -@property (nonatomic, copy) NSString *email; -@property (nonatomic, copy) NSString *phone; -@property (nonatomic, assign) ATFeedbackSource source; -@property (nonatomic, assign) ATFeedbackImageSource imageSource; - -- (NSDictionary *)apiDictionary; -- (void)addExtraDataFromDictionary:(NSDictionary *)dictionary; - -#if TARGET_OS_IPHONE -- (void)setScreenshot:(UIImage *)screenshot; -- (UIImage *)copyScreenshot; -#elif TARGET_OS_MAC -- (void)setScreenshot:(NSImage *)screenshot; -- (NSImage *)copyScreenshot; -#endif -- (BOOL)hasScreenshot; -- (NSData *)dataForScreenshot; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATFeedback.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATFeedback.m deleted file mode 100755 index 7f46d5c..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATFeedback.m +++ /dev/null @@ -1,308 +0,0 @@ -// -// ATFeedback.m -// DemoApp -// -// Created by Andrew Wooster on 3/16/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import "ATFeedback.h" -#import "ATLog.h" -#import "ATConnect.h" -#import "ATBackend.h" -#import "ATUtilities.h" -#import "ATWebClient.h" - -#if TARGET_OS_IPHONE -#import -#import -#endif - - -#define kFeedbackCodingVersion 2 - -@interface ATFeedback (Private) -- (void)setup; -- (ATFeedbackType)feedbackTypeFromString:(NSString *)feedbackString; -- (NSString *)stringForFeedbackType:(ATFeedbackType)feedbackType; -- (NSString *)stringForSource:(ATFeedbackSource)aSource; -- (NSString *)fullPathForScreenshotFilename:(NSString *)filename; -- (void)createScreenshotSidecarIfNecessary; -- (void)deleteScreenshotSidecar; -@end - -@implementation ATFeedback -@synthesize type, text, name, email, phone, source, imageSource; -- (id)init { - if ((self = [super init])) { - [self setup]; - } - return self; -} - -- (void)dealloc { - [extraData release], extraData = nil; - [text release], text = nil; - [name release], name = nil; - [email release], email = nil; - [phone release], phone = nil; - [screenshot release], screenshot = nil; - [screenshotFilename release], screenshotFilename = nil; - [super dealloc]; -} - -- (id)initWithCoder:(NSCoder *)coder { - if ((self = [super initWithCoder:coder])) { - [self setup]; - int version = [coder decodeIntForKey:@"version"]; - if ([coder containsValueForKey:@"source"]) { - self.source = [coder decodeIntForKey:@"source"]; - } else { - self.source = ATFeedbackSourceUnknown; - } - if (version == 1) { - self.type = [self feedbackTypeFromString:[coder decodeObjectForKey:@"type"]]; - self.text = [coder decodeObjectForKey:@"text"]; - self.name = [coder decodeObjectForKey:@"name"]; - self.email = [coder decodeObjectForKey:@"email"]; - self.phone = [coder decodeObjectForKey:@"phone"]; - if ([coder containsValueForKey:@"screenshot"]) { - NSData *data = [coder decodeObjectForKey:@"screenshot"]; -#if TARGET_OS_IPHONE - screenshot = [[UIImage imageWithData:data] retain]; -#elif TARGET_OS_MAC - screenshot = [[NSImage alloc] initWithData:data]; -#endif - } - } else if (version == kFeedbackCodingVersion) { - self.type = [coder decodeIntForKey:@"type"]; - self.text = [coder decodeObjectForKey:@"text"]; - self.name = [coder decodeObjectForKey:@"name"]; - self.email = [coder decodeObjectForKey:@"email"]; - self.phone = [coder decodeObjectForKey:@"phone"]; - if ([coder containsValueForKey:@"screenshot"]) { - NSData *data = [coder decodeObjectForKey:@"screenshot"]; -#if TARGET_OS_IPHONE - screenshot = [[UIImage imageWithData:data] retain]; -#elif TARGET_OS_MAC - screenshot = [[NSImage alloc] initWithData:data]; -#endif - } - if ([coder containsValueForKey:@"screenshotFilename"]) { - screenshotFilename = [[coder decodeObjectForKey:@"screenshotFilename"] retain]; - } - NSDictionary *oldExtraData = [coder decodeObjectForKey:@"extraData"]; - if (oldExtraData != nil) { - [extraData addEntriesFromDictionary:oldExtraData]; - } - } else { - [self release]; - return nil; - } - - // Upgrade screenshot data, if necessary. - [self createScreenshotSidecarIfNecessary]; - if (screenshotFilename && screenshot != nil) { - [screenshot release], screenshot = nil; - } - } - return self; -} - -- (void)encodeWithCoder:(NSCoder *)coder { - [super encodeWithCoder:coder]; - [coder encodeInt:kFeedbackCodingVersion forKey:@"version"]; - [coder encodeInt:self.type forKey:@"type"]; - [coder encodeObject:self.text forKey:@"text"]; - [coder encodeObject:self.name forKey:@"name"]; - [coder encodeObject:self.email forKey:@"email"]; - [coder encodeObject:self.phone forKey:@"phone"]; - if (self.source != ATFeedbackSourceUnknown) { - [coder encodeInt:self.source forKey:@"source"]; - } - [coder encodeObject:extraData forKey:@"extraData"]; - [self createScreenshotSidecarIfNecessary]; - [coder encodeObject:screenshotFilename forKey:@"screenshotFilename"]; -} - -- (NSDictionary *)apiDictionary { - NSMutableDictionary *d = [NSMutableDictionary dictionaryWithDictionary:[super apiDictionary]]; - if (self.name) [d setObject:self.name forKey:@"record[user][name]"]; - if (self.email) [d setObject:self.email forKey:@"record[user][email]"]; - if (self.phone) [d setObject:self.phone forKey:@"record[user][phone_number]"]; - if (self.text) [d setObject:self.text forKey:@"record[feedback][feedback]"]; - [d setObject:[self stringForFeedbackType:self.type] forKey:@"record[feedback][type]"]; - NSString *sourceString = [self stringForSource:self.source]; - if (sourceString != nil) { - [d setObject:sourceString forKey:@"record[feedback][source]"]; - } - if (extraData && [extraData count] > 0) { - for (NSString *key in extraData) { - NSString *fullKey = [NSString stringWithFormat:@"record[data][%@]", key]; - [d setObject:[extraData objectForKey:key] forKey:fullKey]; - } - } - return d; -} - -- (void)addExtraDataFromDictionary:(NSDictionary *)dictionary { - [extraData addEntriesFromDictionary:dictionary]; -} - -- (ATAPIRequest *)requestForSendingRecord { - return [[ATWebClient sharedClient] requestForPostingFeedback:self]; -} - -- (void)cleanup { - [self deleteScreenshotSidecar]; - [super cleanup]; -} - -#if TARGET_OS_IPHONE -- (void)setScreenshot:(UIImage *)aScreenshot -#elif TARGET_OS_MAC -- (void)setScreenshot:(NSImage *)aScreenshot -#endif -{ - if (screenshot != aScreenshot) { - [screenshot release], screenshot = nil; - [self deleteScreenshotSidecar]; - screenshot = [aScreenshot retain]; - } -} - -#if TARGET_OS_IPHONE -- (UIImage *)copyScreenshot -#elif TARGET_OS_MAC -- (NSImage *)copyScreenshot -#endif -{ - if (screenshot) { - return [screenshot copy]; - } else { - NSData *data = [self dataForScreenshot]; - if (data) { -# if TARGET_OS_IPHONE - return [[UIImage imageWithData:data] retain]; -# elif TARGET_OS_MAC - return [[NSImage alloc] initWithData:data]; -# endif - } - } - return nil; -} - -- (BOOL)hasScreenshot { - if (screenshotFilename) { - return YES; - } else if (screenshot) { - return YES; - } else { - return NO; - } -} - -- (NSData *)dataForScreenshot { - NSData *result = nil; - if (![self hasScreenshot]) { - return result; - } - NSFileManager *fm = [NSFileManager defaultManager]; - if (screenshotFilename && [fm fileExistsAtPath:[self fullPathForScreenshotFilename:screenshotFilename]]) { - result = [NSData dataWithContentsOfFile:[self fullPathForScreenshotFilename:screenshotFilename]]; - } else if (screenshot) { -# if TARGET_OS_IPHONE - result = UIImagePNGRepresentation(screenshot); -# elif TARGET_OS_MAC - result = [ATUtilities pngRepresentationOfImage:screenshot]; -# endif - } - return result; -} -@end - - -@implementation ATFeedback (Private) -- (void)setup { - if (!extraData) { - extraData = [[NSMutableDictionary alloc] init]; - } - self.type = ATFeedbackTypeFeedback; -} - -- (ATFeedbackType)feedbackTypeFromString:(NSString *)feedbackString { - if ([feedbackString isEqualToString:@"feedback"] || [feedbackString isEqualToString:@"suggestion"]) { - return ATFeedbackTypeFeedback; - } else if ([feedbackString isEqualToString:@"question"]) { - return ATFeedbackTypeQuestion; - } else if ([feedbackString isEqualToString:@"praise"]) { - return ATFeedbackTypePraise; - } else if ([feedbackString isEqualToString:@"bug"]) { - return ATFeedbackTypeBug; - } - return ATFeedbackTypeFeedback; -} - -- (NSString *)stringForFeedbackType:(ATFeedbackType)feedbackType { - NSString *result = nil; - switch (feedbackType) { - case ATFeedbackTypeBug: - result = @"bug"; - break; - case ATFeedbackTypePraise: - result = @"praise"; - break; - case ATFeedbackTypeQuestion: - result = @"question"; - break; - case ATFeedbackTypeFeedback: - default: - result = @"feedback"; - break; - } - return result; -} - -- (NSString *)stringForSource:(ATFeedbackSource)aSource { - NSString *result = nil; - switch (aSource) { - case ATFeedbackSourceEnjoymentDialog: - result = @"enjoyment_dialog"; - break; - default: - break; - } - return result; -} - -- (NSString *)fullPathForScreenshotFilename:(NSString *)filename { - return [[[ATBackend sharedBackend] attachmentDirectoryPath] stringByAppendingPathComponent:filename]; -} - -- (void)createScreenshotSidecarIfNecessary { - if (screenshot) { - if (!screenshotFilename) { - // First time this screenshot has been saved. - screenshotFilename = [[ATUtilities randomStringOfLength:20] retain]; - NSString *fullPath = [self fullPathForScreenshotFilename:screenshotFilename]; - NSData *screenshotData = [self dataForScreenshot]; - if (![screenshotData writeToFile:fullPath atomically:YES]) { - ATLogError(@"Unable to save screenshot data to path: %@", fullPath); - } - } - } -} - -- (void)deleteScreenshotSidecar { - if (screenshotFilename) { - NSFileManager *fm = [NSFileManager defaultManager]; - NSString *fullPath = [self fullPathForScreenshotFilename:screenshotFilename]; - NSError *error = nil; - if (![fm removeItemAtPath:fullPath error:&error]) { - ATLogError(@"Error removing screenshot at path: %@. %@", screenshotFilename, error); - return; - } - [screenshotFilename release], screenshotFilename = nil; - } -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATRecord.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATRecord.h deleted file mode 100755 index 450da67..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATRecord.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// ATRecord.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 1/10/12. -// Copyright (c) 2012 Apptentive, Inc. All rights reserved. -// - -#import - -@class ATAPIRequest; - -@interface ATRecord : NSObject { -@private - NSString *uuid; - NSString *model; - NSString *os_version; - NSString *carrier; - NSDate *date; -} -@property (nonatomic, copy) NSString *uuid; -@property (nonatomic, copy) NSString *model; -@property (nonatomic, copy) NSString *os_version; -@property (nonatomic, copy) NSString *carrier; -@property (nonatomic, retain) NSDate *date; - -- (NSString *)formattedDate:(NSDate *)aDate; - -- (NSDictionary *)apiJSON; -- (NSDictionary *)apiDictionary; -- (ATAPIRequest *)requestForSendingRecord; -/*! Called when we're done using this record. */ -- (void)cleanup; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATRecord.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATRecord.m deleted file mode 100755 index 1a0b62c..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Persistence/ATRecord.m +++ /dev/null @@ -1,188 +0,0 @@ -// -// ATRecord.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 1/10/12. -// Copyright (c) 2012 Apptentive, Inc. All rights reserved. -// - -#import "ATRecord.h" -#import "ATConnect.h" -#import "ATBackend.h" -#import "ATUtilities.h" - -#if TARGET_OS_IPHONE -#import -#import -#endif - -#define kRecordCodingVersion 1 - -@interface ATRecord (Private) -- (NSString *)primaryLocale; -- (NSArray *)availableLocales; -@end - -@implementation ATRecord -@synthesize uuid, model, os_version, carrier, date; -- (id)init { - if ((self = [super init])) { - self.uuid = [[ATBackend sharedBackend] deviceUUID]; -#if TARGET_OS_IPHONE - self.model = [[UIDevice currentDevice] model]; - self.os_version = [NSString stringWithFormat:@"%@ %@", [[UIDevice currentDevice] systemName], [[UIDevice currentDevice] systemVersion]]; - if ([CTTelephonyNetworkInfo class]) { - CTTelephonyNetworkInfo *netInfo = [[CTTelephonyNetworkInfo alloc] init]; - CTCarrier *c = [netInfo subscriberCellularProvider]; - if (c.carrierName) { - self.carrier = c.carrierName; - } - [netInfo release]; - } -#elif TARGET_OS_MAC - self.model = [ATUtilities currentMachineName]; - self.os_version = [NSString stringWithFormat:@"%@ %@", [ATUtilities currentSystemName], [ATUtilities currentSystemVersion]]; - self.carrier = @""; -#endif - self.date = [NSDate date]; - } - return self; -} - -- (void)dealloc { - [uuid release], uuid = nil; - [model release], model = nil; - [os_version release], os_version = nil; - [carrier release], carrier = nil; - [date release], date = nil; - [super dealloc]; -} - -- (id)initWithCoder:(NSCoder *)coder { - if ((self = [self init])) { - int version = 0; - BOOL hasVersion = YES; - if ([coder containsValueForKey:@"record_version"]) { - version = [coder decodeIntForKey:@"record_version"]; - } else { - version = [coder decodeIntForKey:@"version"]; - hasVersion = NO; - } - if ((hasVersion == NO && (version == 1 || version == 2)) || hasVersion == YES) { - self.uuid = [coder decodeObjectForKey:@"uuid"]; - self.model = [coder decodeObjectForKey:@"model"]; - self.os_version = [coder decodeObjectForKey:@"os_version"]; - self.carrier = [coder decodeObjectForKey:@"carrier"]; - if ([coder containsValueForKey:@"date"]) { - self.date = [coder decodeObjectForKey:@"date"]; - } - } else { - [self release]; - return nil; - } - } - return self; -} - -- (void)encodeWithCoder:(NSCoder *)coder { - [coder encodeInt:kRecordCodingVersion forKey:@"record_version"]; - [coder encodeObject:self.uuid forKey:@"uuid"]; - [coder encodeObject:self.model forKey:@"model"]; - [coder encodeObject:self.os_version forKey:@"os_version"]; - [coder encodeObject:self.carrier forKey:@"carrier"]; - [coder encodeObject:self.date forKey:@"date"]; -} - -- (NSDictionary *)apiJSON { - NSMutableDictionary *d = [NSMutableDictionary dictionary]; - NSMutableDictionary *record = [NSMutableDictionary dictionary]; - NSMutableDictionary *device = [NSMutableDictionary dictionary]; - if (self.uuid) [device setObject:self.uuid forKey:@"uuid"]; - if (self.model) [device setObject:self.model forKey:@"model"]; - if (self.os_version) [device setObject:self.os_version forKey:@"os_version"]; - if (self.carrier) [device setObject:self.carrier forKey:@"carrier"]; - - [record setObject:device forKey:@"device"]; - - [record setObject:[self formattedDate:self.date] forKey:@"date"]; - - // Add some client information. - NSMutableDictionary *client = [NSMutableDictionary dictionary]; - [client setObject:kATConnectVersionString forKey:@"version"]; - [client setObject:kATConnectPlatformString forKey:@"os"]; - [client setObject:@"Apptentive, Inc." forKey:@"author"]; - NSString *distribution = [[ATBackend sharedBackend] distributionName]; - if (distribution) { - [client setObject:distribution forKey:@"distribution"]; - } - [record setObject:client forKey:@"client"]; - [d setObject:record forKey:@"record"]; - - // Add some app information. - NSMutableDictionary *appVersion = [NSMutableDictionary dictionary]; - [appVersion setObject:[ATUtilities appVersionString] forKey:@"version"]; - NSString *buildNumber = [ATUtilities buildNumberString]; - if (buildNumber) { - [appVersion setObject:buildNumber forKey:@"build_number"]; - } - [appVersion setObject:[self primaryLocale] forKey:@"primary_locale"]; - [appVersion setObject:[self availableLocales] forKey:@"supported_locales"]; - [d setObject:appVersion forKey:@"app_version"]; - return d; -} - -- (NSDictionary *)apiDictionary { - NSMutableDictionary *d = [NSMutableDictionary dictionary]; - if (self.uuid) [d setObject:self.uuid forKey:@"record[device][uuid]"]; - if (self.model) [d setObject:self.model forKey:@"record[device][model]"]; - if (self.os_version) [d setObject:self.os_version forKey:@"record[device][os_version]"]; - if (self.carrier) [d setObject:self.carrier forKey:@"record[device][carrier]"]; - - [d setObject:[self formattedDate:self.date] forKey:@"record[date]"]; - - // Add some client information. - [d setObject:kATConnectVersionString forKey:@"record[client][version]"]; - [d setObject:kATConnectPlatformString forKey:@"record[client][os]"]; - [d setObject:@"Apptentive, Inc." forKey:@"record[client][author]"]; - NSString *distribution = [[ATBackend sharedBackend] distributionName]; - if (distribution) { - [d setObject:distribution forKey:@"record[client][distribution]"]; - } - - // Add some app information. - [d setObject:[ATUtilities appVersionString] forKey:@"record[app_version][version]"]; - NSString *buildNumber = [ATUtilities buildNumberString]; - if (buildNumber) { - [d setObject:buildNumber forKey:@"record[app_version][build_number]"]; - } - [d setObject:[self primaryLocale] forKey:@"record[app_version][primary_locale]"]; - for (NSString *locale in [self availableLocales]) { - [d setObject:locale forKey:@"record[app_version][supported_locales][]"]; - } - - return d; -} - -- (NSString *)formattedDate:(NSDate *)aDate { - return [ATUtilities stringRepresentationOfDate:aDate]; -} - -- (ATAPIRequest *)requestForSendingRecord { - return nil; -} - -- (void)cleanup { - // Do nothing by default. -} -@end - - -@implementation ATRecord (Private) -- (NSString *)primaryLocale { - return [[NSLocale currentLocale] localeIdentifier]; -} - -- (NSArray *)availableLocales { - return [ATUtilities availableAppLocalizations]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Rating Flow/ATAppRatingFlow.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Rating Flow/ATAppRatingFlow.h deleted file mode 100755 index d21948d..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Rating Flow/ATAppRatingFlow.h +++ /dev/null @@ -1,120 +0,0 @@ -// -// ATAppRatingFlow.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 7/8/11. -// Copyright 2011 Apptentive, Inc. All rights reserved. -// - -#if TARGET_OS_IPHONE -#import -#import -#elif TARGET_OS_MAC -#import -#endif - -/*! Notification sent when the user has agreed to rate the application. */ -extern NSString *const ATAppRatingFlowUserAgreedToRateAppNotification; - -/*! A workflow for a user either giving feedback on or rating the current - application. */ -@interface ATAppRatingFlow : NSObject -#if TARGET_OS_IPHONE - -#endif -{ -@private - NSString *iTunesAppID; -#if TARGET_OS_IPHONE - UIAlertView *enjoymentDialog; - UIAlertView *ratingDialog; -#endif - - NSUInteger daysBeforePrompt; - NSUInteger usesBeforePrompt; - NSUInteger significantEventsBeforePrompt; - NSUInteger daysBeforeRePrompting; - - NSDate *lastUseOfApp; - - NSString *appName; -} -/*! Set to a custom app name if you'd like to use something other than the bundle display name. */ -@property (nonatomic, copy) NSString *appName; - -/*! The default singleton constructor. Call with an iTunes Applicaiton ID as - an NSString */ -+ (ATAppRatingFlow *)sharedRatingFlowWithAppID:(NSString *)iTunesAppID; - -#if TARGET_OS_IPHONE -/*! - Call when the application is done launching. If we should be able to - prompt for a rating, pass YES for canPromptRating. The viewController is - the viewController from which a feedback dialog will be shown. - */ -- (void)appDidLaunch:(BOOL)canPromptForRating viewController:(UIViewController *)viewController; - -/*! - Call when the application enters the foreground. If we should be able to - prompt for a rating, pass YES. - - The viewController is the UIViewController from which a feedback dialog - will be shown. - */ -- (void)appDidEnterForeground:(BOOL)canPromptForRating viewController:(UIViewController *)viewController; - -/*! - Call whenever a significant event occurs in the application. So, for example, - if you want to have a rating show up after the user has played 20 levels of - a game, you would set significantEventsBeforePrompt to 20, and call this - after each level. - - If we should be able to prompt for a rating when this is called, pass YES. - - The viewController is the UIViewController from which a feedback dialog - will be shown. - */ -- (void)userDidPerformSignificantEvent:(BOOL)canPromptForRating viewController:(UIViewController *)viewController; - -#elif TARGET_OS_MAC -/*! - Call when the application is done launching. If we should be able to - prompt for a rating, pass YES. - */ -- (void)appDidLaunch:(BOOL)canPromptForRating; - -/*! - Call whenever a significant event occurs in the application. So, for example, - if you want to have a rating show up after the user has played 20 levels of - a game, you would set significantEventsBeforePrompt to 20, and call this - after each level. - - If we should be able to prompt for a rating when this is called, pass YES. - */ -- (void)userDidPerformSignificantEvent:(BOOL)canPromptForRating; -#endif - -#if TARGET_OS_IPHONE -/*! - Call if you want to show the enjoyment dialog directly. This enters the flow - for either bringing up the feedback view or the rating dialog. - */ -- (void)showEnjoymentDialog:(UIViewController *)vc; - -/*! - Call if you want to show the rating dialog directly. - */ -- (IBAction)showRatingDialog:(UIViewController *)vc; -#elif TARGET_OS_MAC -/*! - Call if you want to show the enjoyment dialog directly. This enters the flow - for either bringing up the feedback view or the rating dialog. - */ -- (IBAction)showEnjoymentDialog:(id)sender; - -/*! - Call if you want to show the rating dialog directly. - */ -- (IBAction)showRatingDialog:(id)sender; -#endif -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Rating Flow/ATAppRatingFlow.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Rating Flow/ATAppRatingFlow.m deleted file mode 100755 index 8f9fe6d..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Rating Flow/ATAppRatingFlow.m +++ /dev/null @@ -1,764 +0,0 @@ -// -// ATAppRatingFlow.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 7/8/11. -// Copyright 2011 Apptentive, Inc. All rights reserved. -// - -#import "ATAppRatingFlow.h" -#import "ATLog.h" -#import "ATAPIRequest.h" -#import "ATBackend.h" -#import "ATConnect.h" -#import "ATAppConfigurationUpdater.h" -#import "ATFeedback.h" -#import "ATReachability.h" -#import "ATAppRatingMetrics.h" -#import "ATAppRatingFlow_Private.h" -#import "ATUtilities.h" -#import "ATWebClient.h" - - -NSString *const ATAppRatingFlowUserAgreedToRateAppNotification = @"ATAppRatingFlowUserAgreedToRateAppNotification"; - -// Don't count an app re-launch within 20 seconds as -// an app launch. -#define kATAppAppUsageMinimumInterval (20) - -#if TARGET_OS_IPHONE -@interface ATAppRatingFlow () -@property (nonatomic, retain) UIViewController *viewController; -@end -#endif - -@interface ATAppRatingFlow () -/* Days since first app use when the user will first be prompted. */ -@property (nonatomic, readonly) NSUInteger daysBeforePrompt; - -/* Number of app uses before which the user will first be prompted. */ -@property (nonatomic, readonly) NSUInteger usesBeforePrompt; - -/* Significant events before the user will be prompted. */ -@property (nonatomic, readonly) NSUInteger significantEventsBeforePrompt; - -/* Days before the user will be re-prompted after having pressed the "Remind Me Later" button. */ -@property (nonatomic, readonly) NSUInteger daysBeforeRePrompting; -@end - - -@interface ATAppRatingFlow (Private) -- (void)updateLastUseOfApp; -- (void)postNotification:(NSString *)name; -- (void)postNotification:(NSString *)name forButton:(int)button; -- (NSURL *)URLForRatingApp; -- (void)openURLForRatingApp; -- (BOOL)requirementsToShowDialogMet; -- (BOOL)shouldShowDialog; -/*! Returns YES if a dialog was shown. */ -- (BOOL)showDialogIfNecessary; -- (void)updateVersionInfo; -- (void)userDidUseApp; -- (void)userDidSignificantEvent; -- (void)incrementPromptCount; -- (void)setRatingDialogWasShown; -- (void)setUserDislikesThisVersion; -- (void)setDeclinedToRateThisVersion; -- (void)setRatedApp:(BOOL)hasRated; -- (void)logDefaults; - -#if TARGET_OS_IPHONE -- (void)appDidFinishLaunching:(NSNotification *)notification; -- (void)appDidEnterBackground:(NSNotification *)notification; -- (void)appWillEnterForeground:(NSNotification *)notification; -- (void)appWillResignActive:(NSNotification *)notification; - -- (UIViewController *)rootViewControllerForCurrentWindow; -#endif -- (void)tryToShowDialogWaitingForReachability; -- (void)reachabilityChangedAndPendingDialog:(NSNotification *)notification; -- (void)preferencesChanged:(NSNotification *)notification; -- (void)loadPreferences; -@end - - -@implementation ATAppRatingFlow -@synthesize daysBeforePrompt, usesBeforePrompt, significantEventsBeforePrompt, daysBeforeRePrompting; -#if TARGET_OS_IPHONE -@synthesize viewController; -#endif - -- (id)initWithAppID:(NSString *)anITunesAppID { - if ((self = [super init])) { - [ATAppRatingFlow_Private registerDefaults]; - [self loadPreferences]; - iTunesAppID = [anITunesAppID retain]; -#if TARGET_OS_IPHONE - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appDidFinishLaunching:) name:UIApplicationDidFinishLaunchingNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillEnterForeground:) name:UIApplicationWillEnterForegroundNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appDidEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActive:) name:UIApplicationWillResignActiveNotification object:nil]; -#endif - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(preferencesChanged:) name:ATConfigurationPreferencesChangedNotification object:nil]; - } - return self; -} - -+ (ATAppRatingFlow *)sharedRatingFlowWithAppID:(NSString *)iTunesAppID { - static ATAppRatingFlow *sharedRatingFlow = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedRatingFlow = [[ATAppRatingFlow alloc] initWithAppID:iTunesAppID]; - }); - return sharedRatingFlow; -} - -#if TARGET_OS_IPHONE -- (void)appDidLaunch:(BOOL)canPromptForRating viewController:(UIViewController *)vc -#elif TARGET_OS_MAC -- (void)appDidLaunch:(BOOL)canPromptForRating -#endif -{ -#if TARGET_OS_IPHONE - self.viewController = vc; -#endif - -#if TARGET_IPHONE_SIMULATOR - [self logDefaults]; -#endif - [self userDidUseApp]; - BOOL showedDialog = NO; - if (canPromptForRating) { - showedDialog = [self showDialogIfNecessary]; - } -#if TARGET_OS_IPHONE - if (!showedDialog) { - self.viewController = nil; - } -#endif -} - -#if TARGET_OS_IPHONE -- (void)appDidEnterForeground:(BOOL)canPromptForRating viewController:(UIViewController *)vc { - self.viewController = vc; - [self userDidUseApp]; - - BOOL showedDialog = NO; - if (canPromptForRating) { - showedDialog = [self showDialogIfNecessary]; - } - - if (!showedDialog) { - self.viewController = nil; - } -} -#endif - -#if TARGET_OS_IPHONE -- (void)userDidPerformSignificantEvent:(BOOL)canPromptForRating viewController:(UIViewController *)vc -#elif TARGET_OS_MAC -- (void)userDidPerformSignificantEvent:(BOOL)canPromptForRating -#endif -{ -#if TARGET_OS_IPHONE - self.viewController = vc; -#endif - [self userDidSignificantEvent]; - -#if TARGET_OS_IPHONE - if (!showedDialog) { - self.viewController = nil; - } -#endif -} - -#if TARGET_OS_IPHONE -- (void)showEnjoymentDialog:(UIViewController *)vc -#elif TARGET_OS_MAC -- (IBAction)showEnjoymentDialog:(id)sender -#endif -{ - NSString *title = [NSString stringWithFormat:ATLocalizedString(@"Do you love %@?", @"Title for enjoyment alert view. Parameter is app name."), [self appName]]; -#if TARGET_OS_IPHONE - self.viewController = vc; - if (!enjoymentDialog) { - enjoymentDialog = [[UIAlertView alloc] initWithTitle:title message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:ATLocalizedString(@"No", @"no"), ATLocalizedString(@"Yes", @"yes"), nil]; - [enjoymentDialog show]; - } - [self postNotification:ATAppRatingDidPromptForEnjoymentNotification]; - [self incrementPromptCount]; - [self setRatingDialogWasShown]; -#elif TARGET_OS_MAC - NSAlert *alert = [[[NSAlert alloc] init] autorelease]; - [alert addButtonWithTitle:ATLocalizedString(@"Yes", @"yes")]; - [alert addButtonWithTitle:ATLocalizedString(@"No", @"no")]; - [alert setMessageText:title]; - [alert setInformativeText:ATLocalizedString(@"You've been using this app for a while. Do you love it?", @"Enjoyment dialog text")]; - [alert setAlertStyle:NSInformationalAlertStyle]; - [alert setIcon:[NSImage imageNamed:NSImageNameApplicationIcon]]; - [self postNotification:ATAppRatingDidPromptForEnjoymentNotification]; - [self incrementPromptCount]; - [self setRatingDialogWasShown]; - NSUInteger result = [alert runModal]; - if (result == NSAlertFirstButtonReturn) { // yes - [self showRatingDialog:self]; - } else if (result == NSAlertSecondButtonReturn) { // no - [self setUserDislikesThisVersion]; - - [[ATBackend sharedBackend] setCurrentFeedback:nil]; - ATConnect *connection = [ATConnect sharedConnection]; - connection.customPlaceholderText = ATLocalizedString(@"What can we do to ensure that you love our app? We appreciate your constructive feedback.", @"Custom placeholder feedback text when user is unhappy with the application."); - ATFeedbackControllerType oldType = connection.feedbackControllerType; - connection.feedbackControllerType = ATFeedbackControllerSimple; - [connection showFeedbackWindow:self]; - ATFeedback *inProgressFeedback = [[ATBackend sharedBackend] currentFeedback]; - inProgressFeedback.source = ATFeedbackSourceEnjoymentDialog; - connection.customPlaceholderText = nil; - connection.feedbackControllerType = oldType; - } -#endif -} - -#if TARGET_OS_IPHONE -- (void)showRatingDialog:(UIViewController *)vc -#elif TARGET_OS_MAC -- (IBAction)showRatingDialog:(id)sender -#endif -{ - NSString *title = ATLocalizedString(@"Thank You", @"Rate app title."); - NSString *message = [NSString stringWithFormat:ATLocalizedString(@"We're so happy to hear that you love %@! It'd be really helpful if you rated us in the App Store. Thanks so much for spending some time with us.", @"Rate app message. Parameter is app name."), [self appName]]; - NSString *rateAppTitle = [NSString stringWithFormat:ATLocalizedString(@"Rate %@", @"Rate app button title"), [self appName]]; - NSString *noThanksTitle = ATLocalizedString(@"No Thanks", @"cancel title for app rating dialog"); - NSString *remindMeTitle = ATLocalizedString(@"Remind Me Later", @"Remind me later button title"); -#if TARGET_OS_IPHONE - self.viewController = vc; - if (!ratingDialog) { - ratingDialog = [[UIAlertView alloc] initWithTitle:title message:message delegate:self cancelButtonTitle:noThanksTitle otherButtonTitles:rateAppTitle, remindMeTitle, nil]; - [ratingDialog show]; - } - [self postNotification:ATAppRatingDidPromptForRatingNotification]; - [self setRatingDialogWasShown]; -#elif TARGET_OS_MAC - NSAlert *alert = [[[NSAlert alloc] init] autorelease]; - [alert addButtonWithTitle:noThanksTitle]; - [alert addButtonWithTitle:remindMeTitle]; - [alert addButtonWithTitle:rateAppTitle]; - [alert setMessageText:title]; - [alert setInformativeText:message]; - [alert setAlertStyle:NSInformationalAlertStyle]; - [alert setIcon:[NSImage imageNamed:NSImageNameApplicationIcon]]; - [self postNotification:ATAppRatingDidPromptForRatingNotification]; - [self setRatingDialogWasShown]; - NSUInteger result = [alert runModal]; - if (result == NSAlertFirstButtonReturn) { // cancel - [self setDeclinedToRateThisVersion]; - } else if (result == NSAlertSecondButtonReturn) { // remind me - [self setRatingDialogWasShown]; - } else if (result == NSAlertThirdButtonReturn) { // rate app - [self openURLForRatingApp]; - } -#endif -} - -#pragma mark Properties - -- (void)setAppName:(NSString *)anAppName { - if (appName != anAppName) { - [appName release], appName = nil; - appName = [anAppName copy]; - } -} - -- (NSString *)appName { - if (appName != nil) { - return appName; - } - NSString *displayName = nil; - NSArray *appNameKeys = [NSArray arrayWithObjects:@"CFBundleDisplayName", (NSString *)kCFBundleNameKey, nil]; - NSMutableArray *infoDictionaries = [NSMutableArray array]; - if ([[NSBundle mainBundle] localizedInfoDictionary]) { - [infoDictionaries addObject:[[NSBundle mainBundle] localizedInfoDictionary]]; - } - if ([[NSBundle mainBundle] infoDictionary]) { - [infoDictionaries addObject:[[NSBundle mainBundle] infoDictionary]]; - } - for (NSDictionary *infoDictionary in infoDictionaries) { - if (displayName != nil) { - break; - } - for (NSString *appNameKey in appNameKeys) { - displayName = [infoDictionary objectForKey:appNameKey]; - if (displayName != nil) { - break; - } - } - } - return displayName; -} - -#if TARGET_OS_IPHONE -#pragma mark UIAlertViewDelegate -- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { - if (alertView == enjoymentDialog) { - [enjoymentDialog release], enjoymentDialog = nil; - if (buttonIndex == 0) { // no - [self postNotification:ATAppRatingDidClickEnjoymentButtonNotification forButton:ATAppRatingEnjoymentButtonTypeNo]; - [self setUserDislikesThisVersion]; - if (!self.viewController) { - ATLogError(@"No view controller to present feedback interface!!"); - } else { - [[ATBackend sharedBackend] setCurrentFeedback:nil]; - ATConnect *connection = [ATConnect sharedConnection]; - connection.customPlaceholderText = ATLocalizedString(@"What can we do to ensure that you love our app? We appreciate your constructive feedback.", @"Custom placeholder feedback text when user is unhappy with the application."); - ATFeedbackControllerType oldType = connection.feedbackControllerType; - connection.feedbackControllerType = ATFeedbackControllerSimple; - [connection presentFeedbackControllerFromViewController:self.viewController]; - ATFeedback *inProgressFeedback = [[ATBackend sharedBackend] currentFeedback]; - inProgressFeedback.source = ATFeedbackSourceEnjoymentDialog; - connection.customPlaceholderText = nil; - self.viewController = nil; - connection.feedbackControllerType = oldType; - } - } else if (buttonIndex == 1) { // yes - [self postNotification:ATAppRatingDidClickEnjoymentButtonNotification forButton:ATAppRatingEnjoymentButtonTypeYes]; - [self showRatingDialog:self.viewController]; - } - } else if (alertView == ratingDialog) { - [ratingDialog release], ratingDialog = nil; - if (buttonIndex == 1) { // rate - [self postNotification:ATAppRatingDidClickRatingButtonNotification forButton:ATAppRatingButtonTypeRateApp]; - [self openURLForRatingApp]; - } else if (buttonIndex == 2) { // remind later - [self postNotification:ATAppRatingDidClickRatingButtonNotification forButton:ATAppRatingButtonTypeRemind]; - [self setRatingDialogWasShown]; - } else if (buttonIndex == 0) { // no thanks - [self postNotification:ATAppRatingDidClickRatingButtonNotification forButton:ATAppRatingButtonTypeNo]; - [self setDeclinedToRateThisVersion]; - } - self.viewController = nil; - } -} - -- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { - ATLogDebug(@"ATAppRatingFlow dismissing alert view %@, %d", alertView, buttonIndex); - if (alertView == enjoymentDialog) { - [enjoymentDialog release], enjoymentDialog = nil; - self.viewController = nil; - } else if (alertView == ratingDialog) { - [ratingDialog release], ratingDialog = nil; - self.viewController = nil; - } -} - -#pragma mark SKStoreProductViewControllerDelegate -- (void)productViewControllerDidFinish:(SKStoreProductViewController *)productViewController { - [productViewController dismissModalViewControllerAnimated:YES]; -} -#endif -@end - - -@implementation ATAppRatingFlow (Private) -- (void)updateLastUseOfApp { - if (lastUseOfApp) { - [lastUseOfApp release], lastUseOfApp = nil; - } - lastUseOfApp = [[NSDate alloc] init]; -} - -- (void)postNotification:(NSString *)name { - [[NSNotificationCenter defaultCenter] postNotificationName:name object:self]; -} - -- (void)postNotification:(NSString *)name forButton:(int)button { - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:button] forKey:ATAppRatingButtonTypeKey]; - [[NSNotificationCenter defaultCenter] postNotificationName:name object:self userInfo:userInfo]; -} - -- (NSURL *)URLForRatingApp { - NSString *URLString = nil; - NSString *URLStringFromPreferences = [[NSUserDefaults standardUserDefaults] objectForKey:ATAppRatingReviewURLPreferenceKey]; - if (URLStringFromPreferences == nil) { -#if TARGET_OS_IPHONE - NSString *osVersion = [[UIDevice currentDevice] systemVersion]; - if ([ATUtilities versionString:osVersion isGreaterThanVersionString:@"6.0"] || [ATUtilities versionString:osVersion isEqualToVersionString:@"6.0"]) { - URLString = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/%@/app/id%@", [[NSLocale currentLocale] objectForKey: NSLocaleCountryCode], iTunesAppID]; - } else { - URLString = [NSString stringWithFormat:@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%@", iTunesAppID]; - } -#elif TARGET_OS_MAC - URLString = [NSString stringWithFormat:@"macappstore://itunes.apple.com/app/id%@?mt=12", iTunesAppID]; -#endif - } else { - URLString = URLStringFromPreferences; - } - return [NSURL URLWithString:URLString]; -} - -#if TARGET_OS_IPHONE -- (void)showUnableToOpenAppStoreDialog { - UIAlertView *errorAlert = [[[UIAlertView alloc] initWithTitle:ATLocalizedString(@"Oops!", @"Unable to load the App Store title") message:ATLocalizedString(@"Unable to load the App Store", @"Unable to load the App Store message") delegate:nil cancelButtonTitle:ATLocalizedString(@"Okay", @"Okay button title") otherButtonTitles:nil] autorelease]; - [errorAlert show]; - [self setRatedApp:NO]; -} -#endif - -- (void)openURLForRatingApp { - NSURL *url = [self URLForRatingApp]; - [self setRatedApp:YES]; -#if TARGET_OS_IPHONE - if ([SKStoreProductViewController class] != NULL && iTunesAppID) { -#if TARGET_IPHONE_SIMULATOR - [self showUnableToOpenAppStoreDialog]; -#else - SKStoreProductViewController *vc = [[[SKStoreProductViewController alloc] init] autorelease]; - vc.delegate = self; - [vc loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier:iTunesAppID} completionBlock:^(BOOL result, NSError *error) { - if (error) { - [self showUnableToOpenAppStoreDialog]; - ATLogError(@"Error loading product view: %@", error); - } else { - UIViewController *presentingVC = [self rootViewControllerForCurrentWindow]; - [presentingVC presentModalViewController:vc animated:YES]; - } - }]; -#endif - } else { - if (![[UIApplication sharedApplication] canOpenURL:url]) { - ATLogError(@"No application can open the URL: %@", url); - [self showUnableToOpenAppStoreDialog]; - } - [[UIApplication sharedApplication] openURL:url]; - } -#elif TARGET_OS_MAC - [[NSWorkspace sharedWorkspace] openURL:url]; -#endif - [[NSNotificationCenter defaultCenter] postNotificationName:ATAppRatingFlowUserAgreedToRateAppNotification object:nil]; -} - - -- (BOOL)requirementsToShowDialogMet { - BOOL result = NO; - - do { // once - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - - // Ratings are disabled, don't show dialog. - if ([[defaults objectForKey:ATAppRatingEnabledPreferenceKey] boolValue] == NO) { - break; - } - - // Check to see if the user has rated the app. - NSNumber *rated = [defaults objectForKey:ATAppRatingFlowRatedAppKey]; - if (rated != nil && [rated boolValue]) { - break; - } - - // Check to see if the user has rejected rating this version. - NSNumber *rejected = [defaults objectForKey:ATAppRatingFlowDeclinedToRateThisVersionKey]; - if (rejected != nil && [rejected boolValue]) { - break; - } - - // Check to see if the user dislikes this version of the app. - NSNumber *dislikes = [defaults objectForKey:ATAppRatingFlowUserDislikesThisVersionKey]; - if (dislikes != nil && [dislikes boolValue]) { - break; - } - - // If we don't have the last version set, update it and don't show - // the dialog. - NSString *lastBundleVersion = [defaults objectForKey:ATAppRatingFlowLastUsedVersionKey]; - if (lastBundleVersion == nil) { - [self updateVersionInfo]; - break; - } - - // If the user has been prompted already, make sure we're after the - // number of days for them to be re-prompted. - NSDate *lastPrompt = [defaults objectForKey:ATAppRatingFlowLastPromptDateKey]; - if (lastPrompt != nil && self.daysBeforeRePrompting != 0) { - double nextPromptDouble = [lastPrompt timeIntervalSince1970] + 60*60*24*self.daysBeforeRePrompting; - if ([[NSDate date] timeIntervalSince1970] < nextPromptDouble) { - break; - } - } - - NSInteger promptCount = [[defaults objectForKey:ATAppRatingFlowPromptCountThisVersionKey] integerValue]; - if (self.daysBeforeRePrompting == 0 && promptCount > 0) { - // Don't prompt more than once. - break; - } else if (promptCount > 1) { - // Don't prompt more than twice per update. - break; - } - - ATAppRatingFlowPredicateInfo *info = [[ATAppRatingFlowPredicateInfo alloc] init]; - info.firstUse = [defaults objectForKey:ATAppRatingFlowLastUsedVersionFirstUseDateKey]; - info.significantEvents = [[defaults objectForKey:ATAppRatingFlowSignificantEventsCountKey] unsignedIntegerValue]; - info.appUses = [[defaults objectForKey:ATAppRatingFlowUseCountKey] unsignedIntegerValue]; - info.daysBeforePrompt = self.daysBeforePrompt; - info.significantEventsBeforePrompt = self.significantEventsBeforePrompt; - info.usesBeforePrompt = self.usesBeforePrompt; - - NSPredicate *predicate = [ATAppRatingFlow_Private predicateForPromptLogic:[defaults objectForKey:ATAppRatingPromptLogicPreferenceKey] withPredicateInfo:info]; - if (predicate) { - result = [ATAppRatingFlow_Private evaluatePredicate:predicate withPredicateInfo:info]; - } - [info release], info = nil; - } while (NO); - - return result; -} - -- (BOOL)shouldShowDialog { - // No network connection, don't show dialog. - if ([[ATReachability sharedReachability] currentNetworkStatus] == ATNetworkNotReachable) { - return NO; - } - return [self requirementsToShowDialogMet]; -} - -- (BOOL)showDialogIfNecessary { -#if TARGET_OS_IPHONE - if ([self shouldShowDialog]) { - [self showEnjoymentDialog:self.viewController]; - return YES; - } else if ([self rootViewControllerForCurrentWindow]) { - [self tryToShowDialogWaitingForReachability]; - } -#elif TARGET_OS_MAC - if ([self shouldShowDialog]) { - [self showEnjoymentDialog:self]; - } else { - [self tryToShowDialogWaitingForReachability]; - } -#endif - return NO; -} - -- (void)updateVersionInfo { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - - NSString *currentBundleVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey]; - NSString *lastBundleVersion = [defaults objectForKey:ATAppRatingFlowLastUsedVersionKey]; - - if (lastBundleVersion == nil || ![lastBundleVersion isEqualToString:currentBundleVersion]) { - BOOL clearCounts = [(NSNumber *)[defaults objectForKey:ATAppRatingClearCountsOnUpgradePreferenceKey] boolValue]; - if (clearCounts) { - // Clear the counters. - [defaults setObject:[NSNumber numberWithUnsignedInteger:0] forKey:ATAppRatingFlowUseCountKey]; - [defaults setObject:[NSNumber numberWithUnsignedInteger:0] forKey:ATAppRatingFlowSignificantEventsCountKey]; - [defaults setObject:[NSNumber numberWithBool:NO] forKey:ATAppRatingFlowRatedAppKey]; - } - - [defaults setObject:currentBundleVersion forKey:ATAppRatingFlowLastUsedVersionKey]; - - [defaults setObject:[NSDate date] forKey:ATAppRatingFlowLastUsedVersionFirstUseDateKey]; - [defaults setObject:[NSNumber numberWithBool:NO] forKey:ATAppRatingFlowDeclinedToRateThisVersionKey]; - [defaults setObject:[NSNumber numberWithBool:NO] forKey:ATAppRatingFlowUserDislikesThisVersionKey]; - [defaults setObject:[NSNumber numberWithInteger:0] forKey:ATAppRatingFlowPromptCountThisVersionKey]; - - [defaults synchronize]; - } - -} - -- (void)userDidUseApp { - if (lastUseOfApp != nil) { - NSTimeInterval interval = [lastUseOfApp timeIntervalSinceNow]; - - if (interval >= -kATAppAppUsageMinimumInterval) { - [self updateLastUseOfApp]; - return; - } - } - [self updateLastUseOfApp]; - - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - - NSNumber *useCount = [defaults objectForKey:ATAppRatingFlowUseCountKey]; - NSUInteger count = 0; - if (useCount != nil) { - count = [useCount unsignedIntegerValue]; - } - count++; - - [defaults setObject:[NSNumber numberWithUnsignedInteger:count] forKey:ATAppRatingFlowUseCountKey]; - [defaults synchronize]; - - [self updateVersionInfo]; -} - -- (void)userDidSignificantEvent { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - - NSNumber *eventCount = [defaults objectForKey:ATAppRatingFlowSignificantEventsCountKey]; - NSUInteger count = 0; - if (eventCount != nil) { - count = [eventCount unsignedIntegerValue]; - } - - [defaults setObject:[NSNumber numberWithUnsignedInteger:count+1] forKey:ATAppRatingFlowSignificantEventsCountKey]; - [defaults synchronize]; - -} - -- (void)incrementPromptCount { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSInteger promptCount = [[defaults objectForKey:ATAppRatingFlowPromptCountThisVersionKey] integerValue]; - promptCount += 1; - [defaults setObject:[NSNumber numberWithInteger:promptCount] forKey:ATAppRatingFlowPromptCountThisVersionKey]; - [defaults synchronize]; -} - -- (void)setRatingDialogWasShown { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - [defaults setObject:[NSDate date] forKey:ATAppRatingFlowLastPromptDateKey]; - [defaults synchronize]; -} - -- (void)setUserDislikesThisVersion { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - [defaults setObject:[NSNumber numberWithBool:YES] forKey:ATAppRatingFlowUserDislikesThisVersionKey]; - [defaults synchronize]; -} - -- (void)setDeclinedToRateThisVersion { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - [defaults setObject:[NSNumber numberWithBool:YES] forKey:ATAppRatingFlowDeclinedToRateThisVersionKey]; - [defaults synchronize]; -} - -- (void)setRatedApp:(BOOL)hasRated { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - [defaults setObject:[NSNumber numberWithBool:hasRated] forKey:ATAppRatingFlowRatedAppKey]; - [defaults synchronize]; -} - -- (void)logDefaults { - NSArray *keys = [NSArray arrayWithObjects:ATAppRatingFlowLastUsedVersionKey, ATAppRatingFlowLastUsedVersionFirstUseDateKey, ATAppRatingFlowDeclinedToRateThisVersionKey, ATAppRatingFlowUserDislikesThisVersionKey, ATAppRatingFlowPromptCountThisVersionKey, ATAppRatingFlowLastPromptDateKey, ATAppRatingFlowUseCountKey, ATAppRatingFlowSignificantEventsCountKey, ATAppRatingFlowRatedAppKey, nil]; - ATLogDebug(@"-- BEGIN ATAppRatingFlow DEFAULTS --"); - for (NSString *key in keys) { - ATLogDebug(@"%@ == %@", key, [[NSUserDefaults standardUserDefaults] objectForKey:key]); - } - ATLogDebug(@"-- END ATAppRatingFlow DEFAULTS --"); -} - -#if TARGET_OS_IPHONE -- (void)appDidFinishLaunching:(NSNotification *)notification { - [self userDidUseApp]; -} - -- (void)appDidEnterBackground:(NSNotification *)notification { - [self updateLastUseOfApp]; -} - -- (void)appWillEnterForeground:(NSNotification *)notification { - [self userDidUseApp]; -} - -- (void)appWillResignActive:(NSNotification *)notification { - [self updateLastUseOfApp]; -} - -- (void)appWillEnterBackground:(NSNotification *)notification { - // We want to hide any dialogs here. - if (enjoymentDialog) { - [enjoymentDialog dismissWithClickedButtonIndex:3 animated:NO]; - } - if (ratingDialog) { - [ratingDialog dismissWithClickedButtonIndex:3 animated:NO]; - } - [self updateLastUseOfApp]; -} - - -- (UIViewController *)rootViewControllerForCurrentWindow { - UIWindow *window = nil; - if (self.viewController && self.viewController.view && self.viewController.view.window) { - window = self.viewController.view.window; - } else { - for (UIWindow *tmpWindow in [[UIApplication sharedApplication] windows]) { - if ([[tmpWindow screen] isEqual:[UIScreen mainScreen]] && [tmpWindow isKeyWindow]) { - window = tmpWindow; - break; - } - } - } - if (window && [window respondsToSelector:@selector(rootViewController)]) { - UIViewController *vc = [window rootViewController]; - if ([vc respondsToSelector:@selector(presentedViewController)] && [vc presentedViewController]) { - return [vc presentedViewController]; - } - if ([vc respondsToSelector:@selector(modalViewController)] && [vc modalViewController]) { - return [vc modalViewController]; - } - return vc; - } else { - return nil; - } -} -#endif - -- (void)tryToShowDialogWaitingForReachability { - if (![[NSThread currentThread] isMainThread]) { - [self performSelectorOnMainThread:@selector(tryToShowDialogWaitingForReachability) withObject:nil waitUntilDone:NO]; - return; - } - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; -#if TARGET_OS_IPHONE - UIViewController *vc = [self rootViewControllerForCurrentWindow]; - - if (vc && [self requirementsToShowDialogMet]) { - // We can get a root view controller and we should be showing a dialog. - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reachabilityChangedAndPendingDialog:) name:ATReachabilityStatusChanged object:nil]; - } -#elif TARGET_OS_MAC - if ([self requirementsToShowDialogMet]) { - // We should show a ratings dialog. - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reachabilityChangedAndPendingDialog:) name:ATReachabilityStatusChanged object:nil]; - } -#endif - [pool release], pool = nil; -} - -- (void)reachabilityChangedAndPendingDialog:(NSNotification *)notification { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - [[NSNotificationCenter defaultCenter] removeObserver:self name:ATReachabilityStatusChanged object:nil]; - -#if TARGET_OS_IPHONE - UIViewController *vc = [self rootViewControllerForCurrentWindow]; - - if (vc && [self requirementsToShowDialogMet]) { - if ([[ATReachability sharedReachability] currentNetworkStatus] == ATNetworkNotReachable) { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reachabilityChangedAndPendingDialog:) name:ATReachabilityStatusChanged object:nil]; - } else { - [self showEnjoymentDialog:vc]; - } - - } -#elif TARGET_OS_MAC - if ([self requirementsToShowDialogMet]) { - if ([[ATReachability sharedReachability] currentNetworkStatus] == ATNetworkNotReachable) { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reachabilityChangedAndPendingDialog:) name:ATReachabilityStatusChanged object:nil]; - } else { - [self showEnjoymentDialog:self]; - } - } -#endif - [pool release], pool = nil; -} - -- (void)preferencesChanged:(NSNotification *)notification { - [self loadPreferences]; -} - -- (void)loadPreferences { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - daysBeforePrompt = [(NSNumber *)[defaults objectForKey:ATAppRatingDaysBeforePromptPreferenceKey] unsignedIntegerValue]; - usesBeforePrompt = [(NSNumber *)[defaults objectForKey:ATAppRatingUsesBeforePromptPreferenceKey] unsignedIntegerValue]; - significantEventsBeforePrompt = [(NSNumber *)[defaults objectForKey:ATAppRatingSignificantEventsBeforePromptPreferenceKey] unsignedIntegerValue]; - daysBeforeRePrompting = [(NSNumber *)[defaults objectForKey:ATAppRatingDaysBetweenPromptsPreferenceKey] unsignedIntegerValue]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Rating Flow/ATAppRatingFlow_Private.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Rating Flow/ATAppRatingFlow_Private.h deleted file mode 100755 index 0289fc8..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Rating Flow/ATAppRatingFlow_Private.h +++ /dev/null @@ -1,69 +0,0 @@ -// -// ATAppRatingFlow_Private.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/20/12. -// Copyright (c) 2012 Apptentive, Inc. All rights reserved. -// - -#import - -NSString *const ATAppRatingClearCountsOnUpgradePreferenceKey; -NSString *const ATAppRatingEnabledPreferenceKey; - -NSString *const ATAppRatingUsesBeforePromptPreferenceKey; -NSString *const ATAppRatingDaysBeforePromptPreferenceKey; -NSString *const ATAppRatingDaysBetweenPromptsPreferenceKey; -NSString *const ATAppRatingSignificantEventsBeforePromptPreferenceKey; -NSString *const ATAppRatingPromptLogicPreferenceKey; - -NSString *const ATAppRatingSettingsAreFromServerPreferenceKey; - -NSString *const ATAppRatingReviewURLPreferenceKey; - - - -NSString *const ATAppRatingFlowLastUsedVersionKey; -NSString *const ATAppRatingFlowLastUsedVersionFirstUseDateKey; -NSString *const ATAppRatingFlowDeclinedToRateThisVersionKey; -NSString *const ATAppRatingFlowUserDislikesThisVersionKey; -NSString *const ATAppRatingFlowPromptCountThisVersionKey; -NSString *const ATAppRatingFlowLastPromptDateKey; -NSString *const ATAppRatingFlowRatedAppKey; - -NSString *const ATAppRatingFlowUseCountKey; -NSString *const ATAppRatingFlowSignificantEventsCountKey; - -@interface ATAppRatingFlowPredicateInfo : NSObject { -@private - NSDate *firstUse; - NSUInteger significantEvents; - NSUInteger appUses; - - NSUInteger daysBeforePrompt; - NSUInteger significantEventsBeforePrompt; - NSUInteger usesBeforePrompt; -} -@property (nonatomic, retain) NSDate *firstUse; -@property (nonatomic, assign) NSUInteger significantEvents; -@property (nonatomic, assign) NSUInteger appUses; - -@property (nonatomic, assign) NSUInteger daysBeforePrompt; -@property (nonatomic, assign) NSUInteger significantEventsBeforePrompt; -@property (nonatomic, assign) NSUInteger usesBeforePrompt; -- (double)now; -- (double)nextPromptDate; -- (NSString *)debugDescription; -@end - -@interface ATAppRatingFlow_Private : NSObject -+ (void)registerDefaults; - -/*! Can pass in nil for info to just check for a well formed predicate prompt logic object. */ -+ (NSString *)predicateStringForPromptLogic:(NSObject *)promptObject withPredicateInfo:(ATAppRatingFlowPredicateInfo *)info hasError:(BOOL *)hasError; - -/*! Can pass in nil for info to just check for a well formed predicate prompt logic object. */ -+ (NSPredicate *)predicateForPromptLogic:(NSObject *)promptObject withPredicateInfo:(ATAppRatingFlowPredicateInfo *)info; -+ (BOOL)evaluatePredicate:(NSPredicate *)ratingsPredicate withPredicateInfo:(ATAppRatingFlowPredicateInfo *)info; -@end - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Rating Flow/ATAppRatingFlow_Private.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Rating Flow/ATAppRatingFlow_Private.m deleted file mode 100755 index 3d6b785..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Rating Flow/ATAppRatingFlow_Private.m +++ /dev/null @@ -1,160 +0,0 @@ -// -// ATAppRatingFlow_Private.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/20/12. -// Copyright (c) 2012 Apptentive, Inc. All rights reserved. -// - -#import "ATAppRatingFlow_Private.h" - -#define kATAppRatingDefaultUsesBeforePrompt 20 -#define kATAppRatingDefaultDaysBeforePrompt 30 -#define kATAppRatingDefaultDaysBetweenPrompts 5 -#define kATAppRatingDefaultSignificantEventsBeforePrompt 10 - -NSString *const ATAppRatingClearCountsOnUpgradePreferenceKey = @"ATAppRatingClearCountsOnUpgradePreferenceKey"; -NSString *const ATAppRatingEnabledPreferenceKey = @"ATAppRatingEnabledPreferenceKey"; - -NSString *const ATAppRatingUsesBeforePromptPreferenceKey = @"ATAppRatingUsesBeforePromptPreferenceKey"; -NSString *const ATAppRatingDaysBeforePromptPreferenceKey = @"ATAppRatingDaysBeforePromptPreferenceKey"; -NSString *const ATAppRatingDaysBetweenPromptsPreferenceKey = @"ATAppRatingDaysBetweenPromptsPreferenceKey"; -NSString *const ATAppRatingSignificantEventsBeforePromptPreferenceKey = @"ATAppRatingSignificantEventsBeforePromptPreferenceKey"; -NSString *const ATAppRatingPromptLogicPreferenceKey = @"ATAppRatingPromptLogicPreferenceKey"; - -NSString *const ATAppRatingSettingsAreFromServerPreferenceKey = @"ATAppRatingSettingsAreFromServerPreferenceKey"; - -NSString *const ATAppRatingReviewURLPreferenceKey = @"ATAppRatingReviewURLPreferenceKey"; - -NSString *const ATAppRatingFlowLastUsedVersionKey = @"ATAppRatingFlowLastUsedVersionKey"; -NSString *const ATAppRatingFlowLastUsedVersionFirstUseDateKey = @"ATAppRatingFlowLastUsedVersionFirstUseDateKey"; -NSString *const ATAppRatingFlowDeclinedToRateThisVersionKey = @"ATAppRatingFlowDeclinedToRateThisVersionKey"; -NSString *const ATAppRatingFlowUserDislikesThisVersionKey = @"ATAppRatingFlowUserDislikesThisVersionKey"; -NSString *const ATAppRatingFlowPromptCountThisVersionKey = @"ATAppRatingFlowPromptCountThisVersionKey"; -NSString *const ATAppRatingFlowLastPromptDateKey = @"ATAppRatingFlowLastPromptDateKey"; -NSString *const ATAppRatingFlowRatedAppKey = @"ATAppRatingFlowRatedAppKey"; - -NSString *const ATAppRatingFlowUseCountKey = @"ATAppRatingFlowUseCountKey"; -NSString *const ATAppRatingFlowSignificantEventsCountKey = @"ATAppRatingFlowSignificantEventsCountKey"; - -@implementation ATAppRatingFlowPredicateInfo -@synthesize firstUse; -@synthesize significantEvents; -@synthesize appUses; - -@synthesize daysBeforePrompt; -@synthesize significantEventsBeforePrompt; -@synthesize usesBeforePrompt; - -- (double)now { - return [[NSDate date] timeIntervalSince1970]; -} - -- (double)nextPromptDate { - if (!self.firstUse) { - self.firstUse = [NSDate date]; - } - return [self.firstUse timeIntervalSince1970] + (double)(60*60*24*self.daysBeforePrompt); -} - -- (NSString *)debugDescription { - return [NSString stringWithFormat:@"%@ firstUse: %@, significantEvents: %ld, appUses: %ld, daysBeforePrompt: %ld, significantEventsBeforePrompt: %ld, usesBeforePrompt: %ld", [self description], self.firstUse, (long)self.significantEvents, (long)self.appUses, (long)self.daysBeforePrompt, (long)self.significantEventsBeforePrompt, (long)self.usesBeforePrompt]; -} -@end - -@implementation ATAppRatingFlow_Private -+ (void)registerDefaults { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - - NSDictionary *innerPromptLogic = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:@"events", @"uses", nil], @"or", nil]; - NSDictionary *defaultPromptLogic = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:@"days", innerPromptLogic, nil], @"and", nil]; - - NSDictionary *defaultPreferences = - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithBool:NO], ATAppRatingClearCountsOnUpgradePreferenceKey, - [NSNumber numberWithUnsignedInteger:kATAppRatingDefaultUsesBeforePrompt], ATAppRatingUsesBeforePromptPreferenceKey, - [NSNumber numberWithUnsignedInteger:kATAppRatingDefaultDaysBeforePrompt], ATAppRatingDaysBeforePromptPreferenceKey, - [NSNumber numberWithUnsignedInteger:kATAppRatingDefaultDaysBetweenPrompts], ATAppRatingDaysBetweenPromptsPreferenceKey, - [NSNumber numberWithUnsignedInteger:kATAppRatingDefaultSignificantEventsBeforePrompt], ATAppRatingSignificantEventsBeforePromptPreferenceKey, - [NSNumber numberWithInteger:0], ATAppRatingFlowPromptCountThisVersionKey, - defaultPromptLogic, ATAppRatingPromptLogicPreferenceKey, - [NSNumber numberWithBool:NO], ATAppRatingSettingsAreFromServerPreferenceKey, - [NSNumber numberWithBool:YES], ATAppRatingEnabledPreferenceKey, - nil]; - [defaults registerDefaults:defaultPreferences]; -} - -+ (NSString *)predicateStringForPromptLogic:(NSObject *)promptObject withPredicateInfo:(ATAppRatingFlowPredicateInfo *)info hasError:(BOOL *)hasError { - NSMutableString *result = [NSMutableString string]; - if ([promptObject isKindOfClass:[NSDictionary class]]) { - NSDictionary *promptDictionary = (NSDictionary *)promptObject; - for (NSString *key in promptDictionary) { - NSString *joinWith = nil; - if ([key isEqualToString:@"and"]) { - joinWith = @" AND "; - } else if ([key isEqualToString:@"or"]) { - joinWith = @" OR "; - } else { - *hasError = YES; - } - if (!joinWith) break; - NSMutableArray *parts = [NSMutableArray array]; - NSObject *value = [promptDictionary objectForKey:key]; - if ([value isKindOfClass:[NSString class]]) { - NSString *partString = [ATAppRatingFlow_Private predicateStringForPromptLogic:value withPredicateInfo:info hasError:hasError]; - if (partString && [partString length] != 0) { - [parts addObject:partString]; - } - } else if ([value isKindOfClass:[NSArray class]]) { - NSArray *promptArray = (NSArray *)value; - for (NSObject *part in promptArray) { - NSString *partString = [ATAppRatingFlow_Private predicateStringForPromptLogic:part withPredicateInfo:info hasError:hasError]; - if (partString && [partString length] != 0) { - [parts addObject:partString]; - } - } - } - if ([parts count] > 1) { - [result appendFormat:@"(%@)", [parts componentsJoinedByString:joinWith]]; - } else if ([parts count] == 1) { - [result appendFormat:@"(%@)", [parts objectAtIndex:0]]; - } else { - *hasError = YES; - } - } - } else if ([promptObject isKindOfClass:[NSString class]]) { - NSString *promptString = (NSString *)promptObject; - if ([promptString isEqualToString:@"days"]) { - if (info == nil || info.daysBeforePrompt != 0) { - [result appendString:@"(now >= nextPromptDate)"]; - } - } else if ([promptString isEqualToString:@"events"]) { - if (info == nil || info.significantEventsBeforePrompt != 0) { - [result appendString:@"(significantEvents >= significantEventsBeforePrompt)"]; - } - } else if ([promptString isEqualToString:@"uses"]) { - if (info == nil || info.usesBeforePrompt != 0) { - [result appendString:@"(appUses >= usesBeforePrompt)"]; - } - } else { - *hasError = YES; - } - } - return result; -} - -+ (NSPredicate *)predicateForPromptLogic:(NSObject *)promptObject withPredicateInfo:(ATAppRatingFlowPredicateInfo *)info { - BOOL error = NO; - NSString *predicateString = [ATAppRatingFlow_Private predicateStringForPromptLogic:promptObject withPredicateInfo:info hasError:&error]; - if (!predicateString || error || [predicateString length] == 0) { - return nil; - } - NSPredicate *predicate = [NSPredicate predicateWithFormat:predicateString]; - return predicate; -} - - -+ (BOOL)evaluatePredicate:(NSPredicate *)ratingsPredicate withPredicateInfo:(ATAppRatingFlowPredicateInfo *)info { - return [ratingsPredicate evaluateWithObject:info]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Rating Flow/ATAppRatingMetrics.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Rating Flow/ATAppRatingMetrics.h deleted file mode 100755 index d132688..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Rating Flow/ATAppRatingMetrics.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// ATAppRatingMetrics.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 12/27/11. -// Copyright (c) 2011 Apptentive, Inc. All rights reserved. -// - -#import - -#pragma mark Constants for Metrics - -NSString *const ATAppRatingDidPromptForEnjoymentNotification; -NSString *const ATAppRatingDidClickEnjoymentButtonNotification; - -NSString *const ATAppRatingDidPromptForRatingNotification; -NSString *const ATAppRatingDidClickRatingButtonNotification; - -NSString *const ATAppRatingButtonTypeKey; - -typedef enum { - ATAppRatingEnjoymentButtonTypeUnknown, - ATAppRatingEnjoymentButtonTypeYes, - ATAppRatingEnjoymentButtonTypeNo, -} ATAppRatingEnjoymentButtonType; - -typedef enum { - ATAppRatingButtonTypeUnknown, - ATAppRatingButtonTypeNo, - ATAppRatingButtonTypeRemind, - ATAppRatingButtonTypeRateApp, -} ATAppRatingButtonType; - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Rating Flow/ATAppRatingMetrics.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Rating Flow/ATAppRatingMetrics.m deleted file mode 100755 index a9ded9a..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Rating Flow/ATAppRatingMetrics.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// ATAppRatingMetrics.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 12/27/11. -// Copyright (c) 2011 Apptentive, Inc. All rights reserved. -// - -#import "ATAppRatingMetrics.h" - -NSString *const ATAppRatingDidPromptForEnjoymentNotification = @"ATAppRatingDidPromptForEnjoymentNotification"; -NSString *const ATAppRatingDidClickEnjoymentButtonNotification = @"ATAppRatingDidClickEnjoymentButtonNotification"; - -NSString *const ATAppRatingDidPromptForRatingNotification = @"ATAppRatingDidPromptForRatingNotification"; -NSString *const ATAppRatingDidClickRatingButtonNotification = @"ATAppRatingDidClickRatingButtonNotification"; - -NSString *const ATAppRatingButtonTypeKey = @"ATAppRatingButtonTypeKey"; diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Reachability/ATReachability.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Reachability/ATReachability.h deleted file mode 100755 index 350b394..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Reachability/ATReachability.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// ATReachability.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 4/13/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import -#import - -typedef enum { - ATNetworkNotReachable, - ATNetworkWifiReachable, - ATNetworkWWANReachable -} ATNetworkStatus; - -NSString *const ATReachabilityStatusChanged; - -@interface ATReachability : NSObject { - SCNetworkReachabilityRef reachabilityRef; -} -+ (ATReachability *)sharedReachability; -- (ATNetworkStatus)currentNetworkStatus; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Reachability/ATReachability.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Reachability/ATReachability.m deleted file mode 100755 index aab12eb..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Reachability/ATReachability.m +++ /dev/null @@ -1,127 +0,0 @@ -// -// ATReachability.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 4/13/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import "ATReachability.h" -#import "ATUtilities.h" - -NSString *const ATReachabilityStatusChanged = @"ATReachabilityStatusChanged"; - -@interface ATReachability (Private) -- (BOOL)start; -- (void)stop; -@end - - -@implementation ATReachability -+ (ATReachability *)sharedReachability { - static ATReachability *sharedSingleton = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedSingleton = [[ATReachability alloc] init]; - }); - return sharedSingleton; -} - -- (id)init { - if ((self = [super init])) { - SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [kApptentiveHostName UTF8String]); - if (reachability != NULL) { - reachabilityRef = reachability; - [self start]; - } - } - return self; -} - -static void ATReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *info) { - if (info == NULL) return; - if (![(NSObject *)info isKindOfClass:[ATReachability class]]) return; - - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - ATReachability *reachability = (ATReachability *)info; - [[NSNotificationCenter defaultCenter] postNotificationName:ATReachabilityStatusChanged object:reachability]; - [pool release]; -} - -- (void)dealloc { - [self stop]; - if (reachabilityRef != NULL) { - CFRelease(reachabilityRef); - reachabilityRef = NULL; - } - [super dealloc]; -} - - -- (ATNetworkStatus)currentNetworkStatus { - ATNetworkStatus status = ATNetworkNotReachable; - - do { // once - if (reachabilityRef == NULL) { - break; - } - - SCNetworkReachabilityFlags flags; - - if (!SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) { - break; - } - - if ((flags & kSCNetworkReachabilityFlagsReachable) == 0) { - break; - } - - if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0) { - status = ATNetworkWifiReachable; - } - - BOOL onDemand = ((flags & kSCNetworkReachabilityFlagsConnectionOnDemand) != 0); - BOOL onTraffic = ((flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0); - BOOL interventionRequired = ((flags & kSCNetworkReachabilityFlagsInterventionRequired) != 0); - - if ((onDemand || onTraffic) && !interventionRequired) { - status = ATNetworkWifiReachable; - } -#if TARGET_OS_IPHONE - BOOL isWWAN = ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN); - if (isWWAN) { - status = ATNetworkWWANReachable; - } -#endif - } while (NO); - - return status; -} -@end - - -@implementation ATReachability (Private) -- (BOOL)start { - BOOL result = NO; - SCNetworkReachabilityContext context = {0, self, NULL, NULL, NULL}; - do { // once - if (!SCNetworkReachabilitySetCallback(reachabilityRef, ATReachabilityCallback, &context)) { - break; - } - - if (!SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) { - break; - } - - result = YES; - } while (NO); - - return result; -} - -- (void)stop { - if (reachabilityRef != NULL) { - SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); - } -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/ATSurveys.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/ATSurveys.h deleted file mode 100755 index 50c0a85..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/ATSurveys.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// ATSurveys.h -// ApptentiveSurveys -// -// Created by Andrew Wooster on 11/4/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import -#import "ATConnect.h" - -extern NSString *const ATSurveyNewSurveyAvailableNotification; -extern NSString *const ATSurveySentNotification; - -extern NSString *const ATSurveyIDKey; - -/*! -When a survey is submitted by the user, the ATSurveySentNotification will be sent. -The userInfo dictionary will have a key named ATSurveyIDKey, with a value of the id of the survey that was sent. -*/ -@interface ATSurveys : NSObject -/*! Returns YES if there are any surveys available which have no tags. Returns NO otherwise. */ -+ (BOOL)hasSurveyAvailable; -/*! Returns YES if there are any surveys which have all of the given tags. Returns NO otherwise. If no tags are given, returns surveys which have tags. */ -+ (BOOL)hasSurveyAvailableWithTags:(NSSet *)tags; -+ (void)checkForAvailableSurveys; -#if TARGET_OS_IPHONE -/*! - * Presents a survey controller in the window of the given view controller. Will not present a survey which has tags. - */ -+ (void)presentSurveyControllerFromViewController:(UIViewController *)viewController; - -/*! - * Presents a survey controller in the window of the given view controller. The survey must have all of the given tags. - */ -+ (void)presentSurveyControllerWithTags:(NSSet *)tags fromViewController:(UIViewController *)viewController; -#endif -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/ATSurveys.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/ATSurveys.m deleted file mode 100755 index 60be8ad..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/ATSurveys.m +++ /dev/null @@ -1,53 +0,0 @@ -// -// ATSurveys.m -// ApptentiveSurveys -// -// Created by Andrew Wooster on 11/4/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import "ATSurveys.h" -#import "ATSurveysBackend.h" - -NSString *const ATSurveyNewSurveyAvailableNotification = @"ATSurveyNewSurveyAvailableNotification"; -NSString *const ATSurveySentNotification = @"ATSurveySentNotification"; - -NSString *const ATSurveyIDKey = @"ATSurveyIDKey"; - -@interface ATSurveys () -+ (ATSurveys *)sharedSurveys; -@end - -@implementation ATSurveys -+ (ATSurveys *)sharedSurveys { - static ATSurveys *sharedSingleton = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedSingleton = [[ATSurveys alloc] init]; - }); - return sharedSingleton; -} - -+ (BOOL)hasSurveyAvailable { - return [[ATSurveysBackend sharedBackend] hasSurveyAvailableWithNoTags]; -} - -+ (BOOL)hasSurveyAvailableWithTags:(NSSet *)tags { - return [[ATSurveysBackend sharedBackend] hasSurveyAvailableWithTags:tags]; -} - -+ (void)checkForAvailableSurveys { - ATSurveysBackend *backend = [ATSurveysBackend sharedBackend]; - [backend checkForAvailableSurveys]; -} - -+ (void)presentSurveyControllerFromViewController:(UIViewController *)viewController { - ATSurveysBackend *backend = [ATSurveysBackend sharedBackend]; - [backend presentSurveyControllerWithNoTagsFromViewController:viewController]; -} - -+ (void)presentSurveyControllerWithTags:(NSSet *)tags fromViewController:(UIViewController *)viewController { - ATSurveysBackend *backend = [ATSurveysBackend sharedBackend]; - [backend presentSurveyControllerWithTags:tags fromViewController:viewController]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Model/ATSurvey.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Model/ATSurvey.h deleted file mode 100755 index ed173c6..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Model/ATSurvey.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// ATSurvey.h -// ApptentiveSurveys -// -// Created by Andrew Wooster on 11/5/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import -#import "ATSurveyQuestion.h" - -@interface ATSurvey : NSObject { -@private - NSMutableArray *questions; - NSMutableArray *tags; -} -@property (nonatomic, getter=isActive) BOOL active; -@property (nonatomic, getter=responseIsRequired) BOOL responseRequired; -@property (nonatomic) BOOL multipleResponsesAllowed; -@property (nonatomic, copy) NSString *identifier; -@property (nonatomic, copy) NSString *name; -@property (nonatomic, copy) NSString *surveyDescription; -@property (nonatomic, readonly) NSArray *questions; -@property (nonatomic, readonly) NSArray *tags; -@property (nonatomic, copy) NSString *successMessage; - -- (void)addQuestion:(ATSurveyQuestion *)question; -- (void)addTag:(NSString *)tag; - -- (BOOL)surveyHasNoTags; -- (BOOL)surveyHasTags:(NSSet *)tagsToCheck; - -- (void)reset; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Model/ATSurvey.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Model/ATSurvey.m deleted file mode 100755 index 8f8f1db..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Model/ATSurvey.m +++ /dev/null @@ -1,134 +0,0 @@ -// -// ATSurvey.m -// ApptentiveSurveys -// -// Created by Andrew Wooster on 11/5/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import "ATSurvey.h" - -#define kATSurveyStorageVersion 1 - -@implementation ATSurvey -@synthesize responseRequired; -@synthesize multipleResponsesAllowed; -@synthesize active; -@synthesize identifier; -@synthesize name; -@synthesize surveyDescription; -@synthesize questions; -@synthesize tags; -@synthesize successMessage; - -- (id)init { - if ((self = [super init])) { - questions = [[NSMutableArray alloc] init]; - tags = [[NSMutableArray alloc] init]; - } - return self; -} - -- (id)initWithCoder:(NSCoder *)coder { - if ((self = [super init])) { - int version = [coder decodeIntForKey:@"version"]; - questions = [[NSMutableArray alloc] init]; - tags = [[NSMutableArray alloc] init]; - if (version == kATSurveyStorageVersion) { - self.active = [coder decodeBoolForKey:@"active"]; - self.responseRequired = [coder decodeBoolForKey:@"responseRequired"]; - self.multipleResponsesAllowed = [coder decodeBoolForKey:@"multipleResponsesAllowed"]; - self.identifier = [coder decodeObjectForKey:@"identifier"]; - self.name = [coder decodeObjectForKey:@"name"]; - self.surveyDescription = [coder decodeObjectForKey:@"surveyDescription"]; - NSArray *decodedQuestions = [coder decodeObjectForKey:@"questions"]; - if (decodedQuestions) { - [questions addObjectsFromArray:decodedQuestions]; - } - NSArray *decodedTags = [coder decodeObjectForKey:@"tags"]; - if (decodedTags) { - [tags addObjectsFromArray:decodedTags]; - } - self.successMessage = [coder decodeObjectForKey:@"successMessage"]; - } else { - [self release]; - return nil; - } - } - return self; -} - -- (void)encodeWithCoder:(NSCoder *)coder { - [coder encodeInt:kATSurveyStorageVersion forKey:@"version"]; - [coder encodeObject:self.identifier forKey:@"identifier"]; - [coder encodeBool:self.isActive forKey:@"active"]; - [coder encodeBool:self.responseIsRequired forKey:@"responseRequired"]; - [coder encodeBool:self.multipleResponsesAllowed forKey:@"multipleResponsesAllowed"]; - [coder encodeObject:self.name forKey:@"name"]; - [coder encodeObject:self.surveyDescription forKey:@"surveyDescription"]; - [coder encodeObject:self.questions forKey:@"questions"]; - [coder encodeObject:self.tags forKey:@"tags"]; - [coder encodeObject:self.successMessage forKey:@"successMessage"]; -} - -- (void)dealloc { - [questions release], questions = nil; - [identifier release], identifier = nil; - [name release], name = nil; - [surveyDescription release], surveyDescription = nil; - [successMessage release], successMessage = nil; - [tags release], tags = nil; - [super dealloc]; -} - -- (NSString *)description { - return [NSString stringWithFormat:@"", self, self.name, self.identifier]; -} - -- (void)addQuestion:(ATSurveyQuestion *)question { - [questions addObject:question]; -} - -- (void)addTag:(NSString *)tag { - if (tag && [tag length]) { - [tags addObject:[tag lowercaseString]]; - } -} - -- (BOOL)surveyHasNoTags { - if (self.tags == nil || [self.tags count] == 0) { - return YES; - } - return NO; -} - -- (BOOL)surveyHasTags:(NSSet *)tagsToCheck { - if (tagsToCheck == nil || [tagsToCheck count] == 0) { - return YES; - } - - // We want to make sure that all of the tags to check are present. - if (self.tags == nil || [self.tags count] == 0) { - return NO; - } - - NSSet *tagSet = [NSSet setWithArray:self.tags]; - BOOL isSubset = YES; - for (NSString *tag in tagsToCheck) { - // We want to check lower case tags, so don't just use NSSet methods. - NSString *lowercaseTag = [tag lowercaseString]; - if (![tagSet containsObject:lowercaseTag]) { - isSubset = NO; - break; - } - } - - return isSubset; -} - -- (void)reset { - for (ATSurveyQuestion *question in questions) { - [question reset]; - } -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Model/ATSurveyParser.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Model/ATSurveyParser.h deleted file mode 100755 index 343e6bd..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Model/ATSurveyParser.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// ATSurveyParser.h -// ApptentiveSurveys -// -// Created by Andrew Wooster on 11/5/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import -#import "AtSurvey.h" - -@interface ATSurveyParser : NSObject { -@private - NSError *parserError; -} -- (ATSurvey *)parseSurvey:(NSData *)jsonSurvey; -- (NSArray *)parseMultipleSurveys:(NSData *)jsonSurveys; -- (NSError *)parserError; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Model/ATSurveyParser.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Model/ATSurveyParser.m deleted file mode 100755 index 0fbd1ca..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Model/ATSurveyParser.m +++ /dev/null @@ -1,230 +0,0 @@ -// -// ATSurveyParser.m -// ApptentiveSurveys -// -// Created by Andrew Wooster on 11/5/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import "ATSurveyParser.h" -#import "PJSONKit.h" -#import "ATSurveyQuestion.h" - -@interface ATSurveyParser () -- (ATSurveyQuestionAnswer *)answerWithJSONDictionary:(NSDictionary *)jsonDictionary; -- (ATSurveyQuestion *)questionWithJSONDictionary:(NSDictionary *)jsonDictionary; -- (ATSurvey *)surveyWithJSONDictionary:(NSDictionary *)jsonDictionary; -@end - -@implementation ATSurveyParser - -- (ATSurveyQuestionAnswer *)answerWithJSONDictionary:(NSDictionary *)jsonDictionary { - ATSurveyQuestionAnswer *answer = [[ATSurveyQuestionAnswer alloc] init]; - BOOL failed = NO; - - NSDictionary *keyMapping = [NSDictionary dictionaryWithObjectsAndKeys:@"identifier", @"id", @"value", @"value", nil]; - - for (NSString *key in keyMapping) { - NSString *ivarName = [keyMapping objectForKey:key]; - NSObject *value = [jsonDictionary objectForKey:key]; - if (value && [value isKindOfClass:[NSString class]]) { - [answer setValue:value forKey:ivarName]; - } else { - failed = YES; - } - } - - if (failed == YES) { - [answer release], answer = nil; - } - return [answer autorelease]; -} - -- (ATSurveyQuestion *)questionWithJSONDictionary:(NSDictionary *)jsonDictionary { - ATSurveyQuestion *question = [[ATSurveyQuestion alloc] init]; - BOOL failed = YES; - - NSDictionary *keyMapping = [NSDictionary dictionaryWithObjectsAndKeys:@"identifier", @"id", @"questionText", @"value", @"instructionsText", @"instructions", nil]; - - for (NSString *key in keyMapping) { - NSString *ivarName = [keyMapping objectForKey:key]; - NSObject *value = [jsonDictionary objectForKey:key]; - if (value && [value isKindOfClass:[NSString class]]) { - [question setValue:value forKey:ivarName]; - } - } - - do { // once - NSObject *typeString = [jsonDictionary objectForKey:@"type"]; - if (typeString == nil || ![typeString isKindOfClass:[NSString class]]) { - break; - } - - if ([(NSString *)typeString isEqualToString:@"multichoice"]) { - question.type = ATSurveyQuestionTypeMultipleChoice; - } else if ([(NSString *)typeString isEqualToString:@"multiselect"]) { - question.type = ATSurveyQuestionTypeMultipleSelect; - } else if ([(NSString *)typeString isEqualToString:@"singleline"]) { - question.type = ATSurveyQuestionTypeSingeLine; - } else { - break; - } - - if ([jsonDictionary objectForKey:@"required"] != nil) { - question.responseRequired = [(NSNumber *)[jsonDictionary objectForKey:@"required"] boolValue]; - } - - if ([jsonDictionary objectForKey:@"max_selections"] != nil) { - question.maxSelectionCount = [(NSNumber *)[jsonDictionary objectForKey:@"max_selections"] unsignedIntegerValue]; - } - if ([jsonDictionary objectForKey:@"min_selections"] != nil) { - question.minSelectionCount = [(NSNumber *)[jsonDictionary objectForKey:@"min_selections"] unsignedIntegerValue]; - } - - if (question.type == ATSurveyQuestionTypeMultipleChoice || question.type == ATSurveyQuestionTypeMultipleSelect) { - NSObject *answerChoices = [jsonDictionary objectForKey:@"answer_choices"]; - if (answerChoices == nil || ![answerChoices isKindOfClass:[NSArray class]]) { - break; - } - - for (NSObject *answerDict in (NSDictionary *)answerChoices) { - if (![answerDict isKindOfClass:[NSDictionary class]]) { - continue; - } - ATSurveyQuestionAnswer *answer = [self answerWithJSONDictionary:(NSDictionary *)answerDict]; - if (answer != nil) { - [question addAnswerChoice:answer]; - } - } - } - - failed = NO; - } while (NO); - - if (failed == YES) { - [question release], question = nil; - } - - return [question autorelease]; -} - -- (ATSurvey *)surveyWithJSONDictionary:(NSDictionary *)jsonDictionary { - ATSurvey *survey = [[ATSurvey alloc] init]; - - NSDictionary *keyMapping = [NSDictionary dictionaryWithObjectsAndKeys:@"surveyDescription", @"description", @"identifier", @"id", @"name", @"name", @"successMessage", @"success_message", nil]; - - for (NSString *key in keyMapping) { - NSString *ivarName = [keyMapping objectForKey:key]; - NSObject *value = [jsonDictionary objectForKey:key]; - if (value && [value isKindOfClass:[NSString class]]) { - [survey setValue:value forKey:ivarName]; - } - } - - if ([jsonDictionary objectForKey:@"active"] != nil) { - survey.active = [(NSNumber *)[jsonDictionary objectForKey:@"active"] boolValue]; - } - if ([jsonDictionary objectForKey:@"required"] != nil) { - survey.responseRequired = [(NSNumber *)[jsonDictionary objectForKey:@"required"] boolValue]; - } - - if ([jsonDictionary objectForKey:@"multiple_responses"] != nil) { - survey.multipleResponsesAllowed = [(NSNumber *)[jsonDictionary objectForKey:@"multiple_responses"] boolValue]; - } - if ([jsonDictionary objectForKey:@"tags"] != nil) { - for (NSString *tag in [jsonDictionary objectForKey:@"tags"]) { - [survey addTag:tag]; - } - } - - NSObject *questions = [jsonDictionary objectForKey:@"questions"]; - if ([questions isKindOfClass:[NSArray class]]) { - for (NSObject *question in (NSArray *)questions) { - if ([question isKindOfClass:[NSDictionary class]]) { - ATSurveyQuestion *result = [self questionWithJSONDictionary:(NSDictionary *)question]; - if (result != nil) { - [survey addQuestion:result]; - } - } - } - } - - return [survey autorelease]; -} - -- (ATSurvey *)parseSurvey:(NSData *)jsonSurvey { - ATSurvey *survey = nil; - BOOL success = NO; - - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - ATJSONDecoder *decoder = [ATJSONDecoder decoder]; - NSError *error = nil; - id decodedObject = [decoder objectWithData:jsonSurvey error:&error]; - if (decodedObject && [decodedObject isKindOfClass:[NSDictionary class]]) { - success = YES; - NSDictionary *values = (NSDictionary *)decodedObject; - survey = [self surveyWithJSONDictionary:values]; - [survey retain]; - } else { - [parserError release], parserError = nil; - parserError = [error retain]; - success = NO; - } - - [pool release], pool = nil; - if (!success) { - survey = nil; - } else { - [survey autorelease]; - } - return survey; -} - -- (NSArray *)parseMultipleSurveys:(NSData *)jsonSurveys { - NSMutableArray *result = [NSMutableArray array]; - BOOL success = NO; - - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - ATJSONDecoder *decoder = [ATJSONDecoder decoder]; - NSError *error = nil; - - id decodedObject = [decoder objectWithData:jsonSurveys error:&error]; - if (decodedObject && [decodedObject isKindOfClass:[NSDictionary class]]) { - NSDictionary *surveysContainer = (NSDictionary *)decodedObject; - NSArray *surveys = [surveysContainer objectForKey:@"surveys"]; - if (surveys) { - success = YES; - for (NSObject *obj in surveys) { - if ([obj isKindOfClass:[NSDictionary class]]) { - NSDictionary *dict = (NSDictionary *)obj; - ATSurvey *survey = [self surveyWithJSONDictionary:dict]; - if (survey != nil) { - [result addObject:survey]; - } - } - } - } - } else { - [parserError release], parserError = nil; - parserError = [error retain]; - success = NO; - } - - [pool release], pool = nil; - - if (!success) { - result = nil; - } - - return result; -} - -- (NSError *)parserError { - return parserError; -} - -- (void)dealloc { - [parserError release], parserError = nil; - [super dealloc]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Model/ATSurveyQuestion.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Model/ATSurveyQuestion.h deleted file mode 100755 index 6b6bc9d..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Model/ATSurveyQuestion.h +++ /dev/null @@ -1,57 +0,0 @@ -// -// ATSurveyQuestion.h -// ApptentiveSurveys -// -// Created by Andrew Wooster on 11/4/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import - -typedef enum { - ATSurveyQuestionTypeUnknown, - ATSurveyQuestionTypeSingeLine, - ATSurveyQuestionTypeMultipleChoice, - ATSurveyQuestionTypeMultipleSelect, -} ATSurveyQuestionType; - -typedef enum { - ATSurveyQuestionValidationErrorNone, - ATSurveyQuestionValidationErrorMissingRequiredAnswer, - ATSurveyQuestionValidationErrorTooFewAnswers, - ATSurveyQuestionValidationErrorTooManyAnswers, -} ATSurveyQuestionValidationErrorType; - -@class ATSurveyQuestionAnswer; - -@interface ATSurveyQuestion : NSObject { -@private -} -@property (nonatomic, assign) ATSurveyQuestionType type; -@property (nonatomic, copy) NSString *identifier; -@property (nonatomic, getter=responseIsRequired) BOOL responseRequired; -@property (nonatomic, copy) NSString *questionText; -@property (nonatomic, copy) NSString *instructionsText; -@property (nonatomic, copy) NSString *value; -@property (nonatomic, readonly) NSMutableArray *answerChoices; -@property (nonatomic, copy) NSString *answerText; -// If this is a multiple choice or multiple select question: -@property (nonatomic, retain) NSMutableArray *selectedAnswerChoices; -@property (nonatomic, assign) NSUInteger minSelectionCount; -@property (nonatomic, assign) NSUInteger maxSelectionCount; - -- (void)addAnswerChoice:(ATSurveyQuestionAnswer *)answer; - -- (void)addSelectedAnswerChoice:(ATSurveyQuestionAnswer *)answer; -- (void)removeSelectedAnswerChoice:(ATSurveyQuestionAnswer *)answer; -- (ATSurveyQuestionValidationErrorType)validateAnswer; - -- (void)reset; -@end - -@interface ATSurveyQuestionAnswer : NSObject { -@private -} -@property (nonatomic, copy) NSString *identifier; -@property (nonatomic, copy) NSString *value; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Model/ATSurveyQuestion.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Model/ATSurveyQuestion.m deleted file mode 100755 index a86966f..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Model/ATSurveyQuestion.m +++ /dev/null @@ -1,164 +0,0 @@ -// -// ATSurveyQuestion.m -// ApptentiveSurveys -// -// Created by Andrew Wooster on 11/4/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import "ATSurveyQuestion.h" - -#define kATSurveyQuestionStorageVersion 1 -#define kATSurveyQuestionAnswerStorageVersion 1 - -@implementation ATSurveyQuestion -@synthesize type; -@synthesize responseRequired; -@synthesize identifier; -@synthesize questionText; -@synthesize instructionsText; -@synthesize value; -@synthesize answerChoices; -@synthesize answerText; -@synthesize selectedAnswerChoices; -@synthesize minSelectionCount; -@synthesize maxSelectionCount; - -- (id)init { - if ((self = [super init])) { - answerChoices = [[NSMutableArray alloc] init]; - selectedAnswerChoices = [[NSMutableArray alloc] init]; - } - return self; -} - -- (id)initWithCoder:(NSCoder *)coder { - if ((self = [super init])) { - int version = [coder decodeIntForKey:@"version"]; - answerChoices = [[NSMutableArray alloc] init]; - selectedAnswerChoices = [[NSMutableArray alloc] init]; - if (version == kATSurveyQuestionStorageVersion) { - self.type = [coder decodeIntForKey:@"type"]; - self.identifier = [coder decodeObjectForKey:@"identifier"]; - self.responseRequired = [coder decodeBoolForKey:@"responseRequired"]; - self.questionText = [coder decodeObjectForKey:@"questionText"]; - self.instructionsText = [coder decodeObjectForKey:@"instructionsText"]; - self.value = [coder decodeObjectForKey:@"value"]; - - NSArray *decodedAnswerChoices = [coder decodeObjectForKey:@"answerChoices"]; - if (decodedAnswerChoices) { - [answerChoices addObjectsFromArray:decodedAnswerChoices]; - } - - self.answerText = [coder decodeObjectForKey:@"answerText"]; - self.minSelectionCount = [(NSNumber *)[coder decodeObjectForKey:@"minSelectionCount"] unsignedIntegerValue]; - self.maxSelectionCount = [(NSNumber *)[coder decodeObjectForKey:@"maxSelectionCount"] unsignedIntegerValue]; - } else { - [self release]; - return nil; - } - } - return self; -} - -- (void)encodeWithCoder:(NSCoder *)coder { - [coder encodeInt:kATSurveyQuestionStorageVersion forKey:@"version"]; - [coder encodeInt:type forKey:@"type"]; - [coder encodeObject:identifier forKey:@"identifier"]; - [coder encodeBool:responseRequired forKey:@"responseRequired"]; - [coder encodeObject:questionText forKey:@"questionText"]; - [coder encodeObject:instructionsText forKey:@"instructionsText"]; - [coder encodeObject:value forKey:@"value"]; - [coder encodeObject:answerChoices forKey:@"answerChoices"]; - [coder encodeObject:answerText forKey:@"answerText"]; - [coder encodeObject:[NSNumber numberWithUnsignedInteger:minSelectionCount] forKey:@"minSelectionCount"]; - [coder encodeObject:[NSNumber numberWithUnsignedInteger:maxSelectionCount] forKey:@"maxSelectionCount"]; -} - -- (void)dealloc { - [identifier release], identifier = nil; - [questionText release], questionText = nil; - [instructionsText release], instructionsText = nil; - [value release], value = nil; - [answerChoices release], answerChoices = nil; - [answerText release], answerText = nil; - [selectedAnswerChoices release], selectedAnswerChoices = nil; - [super dealloc]; -} - -- (void)addAnswerChoice:(ATSurveyQuestionAnswer *)answer { - [self.answerChoices addObject:answer]; -} - -- (void)addSelectedAnswerChoice:(ATSurveyQuestionAnswer *)answer { - if (self.type == ATSurveyQuestionTypeMultipleChoice) { - [self.selectedAnswerChoices removeAllObjects]; - } - if (![self.selectedAnswerChoices containsObject:answer]) { - [self.selectedAnswerChoices addObject:answer]; - } -} - -- (void)removeSelectedAnswerChoice:(ATSurveyQuestionAnswer *)answer { - [self.selectedAnswerChoices removeObject:answer]; -} - -- (ATSurveyQuestionValidationErrorType)validateAnswer { - ATSurveyQuestionValidationErrorType error = ATSurveyQuestionValidationErrorNone; - - if (self.type == ATSurveyQuestionTypeSingeLine) { - if (self.responseIsRequired && (self.answerText == nil || [self.answerText length] == 0)) { - error = ATSurveyQuestionValidationErrorMissingRequiredAnswer; - } - } else if (self.type == ATSurveyQuestionTypeMultipleChoice) { - if (self.responseIsRequired && [self.selectedAnswerChoices count] == 0) { - error = ATSurveyQuestionValidationErrorMissingRequiredAnswer; - } - } else if (self.type == ATSurveyQuestionTypeMultipleSelect) { - if (self.responseIsRequired) { - if (minSelectionCount != 0 && [self.selectedAnswerChoices count] < minSelectionCount) { - error = ATSurveyQuestionValidationErrorTooFewAnswers; - } else if (maxSelectionCount != 0 && [self.selectedAnswerChoices count] > maxSelectionCount) { - error = ATSurveyQuestionValidationErrorTooManyAnswers; - } - } - } - return error; -} - -- (void)reset { - [selectedAnswerChoices removeAllObjects]; - self.answerText = nil; -} -@end - -@implementation ATSurveyQuestionAnswer -@synthesize identifier; -@synthesize value; - -- (id)initWithCoder:(NSCoder *)coder { - if ((self = [super init])) { - int version = [coder decodeIntForKey:@"version"]; - if (version == kATSurveyQuestionAnswerStorageVersion) { - self.identifier = [coder decodeObjectForKey:@"identifier"]; - self.value = [coder decodeObjectForKey:@"value"]; - } else { - [self release]; - return nil; - } - } - return self; -} - -- (void)encodeWithCoder:(NSCoder *)coder { - [coder encodeInt:kATSurveyQuestionAnswerStorageVersion forKey:@"version"]; - [coder encodeObject:identifier forKey:@"identifier"]; - [coder encodeObject:value forKey:@"value"]; -} - -- (void)dealloc { - [identifier release], identifier = nil; - [value release], value = nil; - [super dealloc]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Persistence/ATSurveyResponse.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Persistence/ATSurveyResponse.h deleted file mode 100755 index bdc2667..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Persistence/ATSurveyResponse.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// ATSurveyResponse.h -// ApptentiveSurveys -// -// Created by Andrew Wooster on 11/4/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import -#import "ATRecord.h" - -@class ATSurveyQuestionResponse; - -@interface ATSurveyResponse : ATRecord { - NSMutableArray *questionResponses; -} -@property (nonatomic, copy) NSString *identifier; -@property (nonatomic, assign) NSUInteger completionSeconds; - -- (void)addQuestionResponse:(ATSurveyQuestionResponse *)response; -- (NSDictionary *)apiJSON; -- (NSDictionary *)apiDictionary; -@end - - -@interface ATSurveyQuestionResponse : NSObject { -@private -} -@property (nonatomic, copy) NSString *identifier; -@property (nonatomic, retain) NSObject *response; -@end \ No newline at end of file diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Persistence/ATSurveyResponse.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Persistence/ATSurveyResponse.m deleted file mode 100755 index e453c5f..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Persistence/ATSurveyResponse.m +++ /dev/null @@ -1,154 +0,0 @@ -// -// ATSurveyResponse.m -// ApptentiveSurveys -// -// Created by Andrew Wooster on 11/4/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import "ATSurveyResponse.h" -#import "ATWebClient+SurveyAdditions.h" - -#define kATSurveyStorageVersion 1 -#define kATSurveyQuestionResponseStorageVersion 1 - -@implementation ATSurveyResponse -@synthesize identifier; -@synthesize completionSeconds; - -- (id)init { - if ((self = [super init])) { - questionResponses = [[NSMutableArray alloc] init]; - } - return self; -} - -- (id)initWithCoder:(NSCoder *)coder { - if ((self = [super initWithCoder:coder])) { - int version = [coder decodeIntForKey:@"survey_version"]; - if (version == kATSurveyStorageVersion) { - self.identifier = [coder decodeObjectForKey:@"identifier"]; - - if ([coder containsValueForKey:@"completion_seconds"]) { - self.completionSeconds = [(NSNumber *)[coder decodeObjectForKey:@"completion_seconds"] unsignedIntegerValue]; - } - - NSArray *d = [coder decodeObjectForKey:@"question_responses"]; - if (d != nil) { - questionResponses = [d mutableCopy]; - } else { - questionResponses = [[NSMutableArray alloc] init]; - } - } else { - [self release]; - return nil; - } - } - return self; -} - -- (void)encodeWithCoder:(NSCoder *)coder { - [super encodeWithCoder:coder]; - [coder encodeInt:kATSurveyStorageVersion forKey:@"survey_version"]; - [coder encodeObject:self.identifier forKey:@"identifier"]; - [coder encodeObject:questionResponses forKey:@"question_responses"]; - [coder encodeObject:[NSNumber numberWithUnsignedInteger:self.completionSeconds] forKey:@"completion_seconds"]; -} - -- (void)dealloc { - [identifier release], identifier = nil; - [questionResponses release], questionResponses = nil; - [super dealloc]; -} - -- (void)addQuestionResponse:(ATSurveyQuestionResponse *)response { - [questionResponses addObject:response]; -} - -- (NSDictionary *)apiJSON { - NSMutableDictionary *d = [NSMutableDictionary dictionaryWithDictionary:[super apiJSON]]; - NSMutableDictionary *record = [d objectForKey:@"record"]; - if (!record) { - record = [NSMutableDictionary dictionary]; - [d setObject:record forKey:@"record"]; - } - - NSMutableDictionary *survey = [NSMutableDictionary dictionary]; - - if (self.identifier) { - [survey setObject:self.identifier forKey:@"id"]; - } - - if (self.completionSeconds != 0) { - [survey setObject:[NSNumber numberWithUnsignedInteger:self.completionSeconds] forKey:@"completion_time"]; - } - - NSUInteger i = 0; - NSMutableDictionary *responses = [NSMutableDictionary dictionary]; - for (ATSurveyQuestionResponse *response in questionResponses) { - NSObject *responseObject = response.response; - if (!responseObject) { - responseObject = @""; - } - [responses setObject:responseObject forKey:response.identifier]; - i++; - } - [survey setObject:responses forKey:@"responses"]; - [record setObject:survey forKey:@"survey"]; - return d; -} - -- (NSDictionary *)apiDictionary { - NSMutableDictionary *d = [NSMutableDictionary dictionaryWithDictionary:[super apiDictionary]]; - - if (self.identifier) { - [d setObject:self.identifier forKey:@"record[survey][id]"]; - } - - NSUInteger i = 0; - for (ATSurveyQuestionResponse *response in questionResponses) { - NSObject *responseObject = response.response; - if (!responseObject) { - responseObject = @""; - } - [d setObject:responseObject forKey:[NSString stringWithFormat:@"record[survey][responses][%@]", response.identifier]]; - i++; - } - return d; -} - -- (ATAPIRequest *)requestForSendingRecord { - return [[ATWebClient sharedClient] requestForPostingSurveyResponse:self]; -} -@end - - -@implementation ATSurveyQuestionResponse -@synthesize identifier, response; - -- (id)initWithCoder:(NSCoder *)coder { - if ((self = [super init])) { - int version = [coder decodeIntForKey:@"survey_question_response_version"]; - if (version == kATSurveyQuestionResponseStorageVersion) { - self.identifier = [coder decodeObjectForKey:@"identifier"]; - self.response = [coder decodeObjectForKey:@"response"]; - } else { - [self release]; - return nil; - } - } - return self; -} - -- (void)encodeWithCoder:(NSCoder *)coder { - [coder encodeInt:kATSurveyQuestionResponseStorageVersion forKey:@"survey_question_response_version"]; - [coder encodeObject:self.identifier forKey:@"identifier"]; - [coder encodeObject:self.response forKey:@"response"]; -} - -- (void)dealloc { - [identifier release], identifier = nil; - [response release], response = nil; - [super dealloc]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Persistence/ATSurveysBackend.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Persistence/ATSurveysBackend.h deleted file mode 100755 index 740d67a..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Persistence/ATSurveysBackend.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// ATSurveysBackend.h -// ApptentiveSurveys -// -// Created by Andrew Wooster on 11/4/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import - -@class ATSurvey; - -@interface ATSurveysBackend : NSObject { -@private - NSMutableArray *availableSurveys; - ATSurvey *currentSurvey; -} -+ (ATSurveysBackend *)sharedBackend; -- (void)checkForAvailableSurveys; -- (ATSurvey *)currentSurvey; -- (void)resetSurvey; -- (void)presentSurveyControllerWithNoTagsFromViewController:(UIViewController *)viewController; -- (void)presentSurveyControllerWithTags:(NSSet *)tags fromViewController:(UIViewController *)viewController; -- (void)setDidSendSurvey:(ATSurvey *)survey; -- (BOOL)hasSurveyAvailableWithNoTags; -- (BOOL)hasSurveyAvailableWithTags:(NSSet *)tags; -@end - - -@interface ATSurveysBackend (Private) -- (BOOL)surveyAlreadySubmitted:(ATSurvey *)survey; -- (void)didReceiveNewSurveys:(NSArray *)surveys maxAge:(NSTimeInterval)expiresMaxAge; -@end \ No newline at end of file diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Persistence/ATSurveysBackend.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Persistence/ATSurveysBackend.m deleted file mode 100755 index 91681c0..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Persistence/ATSurveysBackend.m +++ /dev/null @@ -1,256 +0,0 @@ -// -// ATSurveysBackend.m -// ApptentiveSurveys -// -// Created by Andrew Wooster on 11/4/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import "ATSurveysBackend.h" -#import "ATBackend.h" -#import "ATSurvey.h" -#import "ATSurveyGetSurveysTask.h" -#import "ATSurveyMetrics.h" -#import "ATSurveys.h" -#import "ATSurveyParser.h" -#import "ATSurveyViewController.h" -#import "ATTaskQueue.h" -#import "PJSONKit.h" - -NSString *const ATSurveySentSurveysPreferenceKey = @"ATSurveySentSurveysPreferenceKey"; -NSString *const ATSurveyCachedSurveysExpirationPreferenceKey = @"ATSurveyCachedSurveysExpirationPreferenceKey"; - -@interface ATSurveysBackend () -+ (NSString *)cachedSurveysStoragePath; -- (BOOL)shouldRetrieveNewSurveys; -- (void)presentSurveyControllerFromViewControllerWithCurrentSurvey:(UIViewController *)viewController; -- (ATSurvey *)surveyWithTags:(NSSet *)tags; -@end - -@implementation ATSurveysBackend - -+ (ATSurveysBackend *)sharedBackend { - static ATSurveysBackend *sharedBackend = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSDictionary *defaultPreferences = [NSDictionary dictionaryWithObject:[NSArray array] forKey:ATSurveySentSurveysPreferenceKey]; - [defaults registerDefaults:defaultPreferences]; - - sharedBackend = [[ATSurveysBackend alloc] init]; - }); - return sharedBackend; -} - -+ (NSString *)cachedSurveysStoragePath { - return [[[ATBackend sharedBackend] supportDirectoryPath] stringByAppendingPathComponent:@"cachedsurveys.objects"]; -} - -- (id)init { - if ((self = [super init])) { - availableSurveys = [[NSMutableArray alloc] init]; - NSFileManager *fm = [NSFileManager defaultManager]; - if ([fm fileExistsAtPath:[ATSurveysBackend cachedSurveysStoragePath]]) { - @try { - NSArray *surveys = [NSKeyedUnarchiver unarchiveObjectWithFile:[ATSurveysBackend cachedSurveysStoragePath]]; - [availableSurveys addObjectsFromArray:surveys]; - } @catch (NSException *exception) { - ATLogError(@"Unable to unarchive surveys: %@", exception); - } - } - } - return self; -} - -- (void)dealloc { - [availableSurveys release], availableSurveys = nil; - [super dealloc]; -} - -- (BOOL)shouldRetrieveNewSurveys { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - - NSDate *expiration = [defaults objectForKey:ATSurveyCachedSurveysExpirationPreferenceKey]; - if (expiration) { - NSDate *now = [NSDate date]; - NSComparisonResult comparison = [expiration compare:now]; - if (comparison == NSOrderedSame || comparison == NSOrderedAscending) { - return YES; - } else { - NSFileManager *fm = [NSFileManager defaultManager]; - if (![fm fileExistsAtPath:[ATSurveysBackend cachedSurveysStoragePath]]) { - // If no file, check anyway. - return YES; - } - return NO; - } - } else { - return YES; - } -} - -- (void)checkForAvailableSurveys { - if ([self shouldRetrieveNewSurveys]) { - ATSurveyGetSurveysTask *task = [[ATSurveyGetSurveysTask alloc] init]; - [[ATTaskQueue sharedTaskQueue] addTask:task]; - [task release], task = nil; - } -} - -- (ATSurvey *)currentSurvey { - return currentSurvey; -} - -- (void)resetSurvey { - @synchronized(self) { - [currentSurvey reset]; - [currentSurvey release], currentSurvey = nil; - } -} - -- (void)presentSurveyControllerFromViewControllerWithCurrentSurvey:(UIViewController *)viewController { - ATSurveyViewController *vc = [[ATSurveyViewController alloc] initWithSurvey:currentSurvey]; - UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:vc]; - - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { - [viewController presentModalViewController:nc animated:YES]; - } else { - nc.modalPresentationStyle = UIModalPresentationFormSheet; - [viewController presentModalViewController:nc animated:YES]; - } - [nc release]; - [vc release]; - - NSDictionary *metricsInfo = [[NSDictionary alloc] initWithObjectsAndKeys:currentSurvey.identifier, ATSurveyMetricsSurveyIDKey, [NSNumber numberWithInt:ATSurveyWindowTypeSurvey], ATSurveyWindowTypeKey, nil]; - [[NSNotificationCenter defaultCenter] postNotificationName:ATSurveyDidShowWindowNotification object:nil userInfo:metricsInfo]; - [metricsInfo release], metricsInfo = nil; -} - -- (void)presentSurveyControllerWithNoTagsFromViewController:(UIViewController *)viewController { - if (currentSurvey != nil) { - [self resetSurvey]; - } - currentSurvey = [[self surveyWithNoTags] retain]; - if (currentSurvey == nil) { - return; - } - [self presentSurveyControllerFromViewControllerWithCurrentSurvey:viewController]; -} - -- (void)presentSurveyControllerWithTags:(NSSet *)tags fromViewController:(UIViewController *)viewController { - if (currentSurvey != nil) { - [self resetSurvey]; - } - currentSurvey = [[self surveyWithTags:tags] retain]; - if (currentSurvey == nil) { - return; - } - [self presentSurveyControllerFromViewControllerWithCurrentSurvey:viewController]; -} - -- (void)setDidSendSurvey:(ATSurvey *)survey { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSArray *sentSurveys = [defaults objectForKey:ATSurveySentSurveysPreferenceKey]; - if (![sentSurveys containsObject:survey.identifier]) { - NSMutableArray *replacementSurveys = [sentSurveys mutableCopy]; - [replacementSurveys addObject:survey.identifier]; - [defaults setObject:replacementSurveys forKey:ATSurveySentSurveysPreferenceKey]; - [defaults synchronize]; - [replacementSurveys release], replacementSurveys = nil; - } -} - -- (ATSurvey *)surveyWithNoTags { - ATSurvey *result = nil; - @synchronized(self) { - for (ATSurvey *survey in availableSurveys) { - if ([survey surveyHasNoTags]) { - if (![self surveyAlreadySubmitted:survey]) { - result = survey; - } else if (![survey multipleResponsesAllowed] || ![survey isActive]) { - continue; - } else { - result = survey; - } - } - } - } - return result; -} - -- (ATSurvey *)surveyWithTags:(NSSet *)tags { - ATSurvey *result = nil; - @synchronized(self) { - for (ATSurvey *survey in availableSurveys) { - if ([survey surveyHasTags:tags]) { - if (![self surveyAlreadySubmitted:survey]) { - result = survey; - break; - } else if (![survey multipleResponsesAllowed] || ![survey isActive]) { - continue; - } else { - result = survey; - } - } - } - } - return result; -} - -- (BOOL)hasSurveyAvailableWithNoTags { - ATSurvey *survey = [self surveyWithNoTags]; - if (survey) { - return YES; - } else { - return NO; - } -} - -- (BOOL)hasSurveyAvailableWithTags:(NSSet *)tags { - ATSurvey *survey = [self surveyWithTags:tags]; - if (survey) { - return YES; - } else { - return NO; - } -} -@end - - -@implementation ATSurveysBackend (Private) -- (BOOL)surveyAlreadySubmitted:(ATSurvey *)survey { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - BOOL sentSurvey = NO; - if ([[defaults objectForKey:ATSurveySentSurveysPreferenceKey] containsObject:survey.identifier]) { - sentSurvey = YES; - } - return sentSurvey; -} - -- (void)didReceiveNewSurveys:(NSArray *)surveys maxAge:(NSTimeInterval)expiresMaxAge { - BOOL hasNewSurvey = NO; - for (ATSurvey *survey in surveys) { - if (![self surveyAlreadySubmitted:survey]) { - hasNewSurvey = YES; - } - } - - @synchronized(self) { - [NSKeyedArchiver archiveRootObject:surveys toFile:[ATSurveysBackend cachedSurveysStoragePath]]; - // Store expiration. - if (expiresMaxAge > 0) { - NSDate *date = [NSDate dateWithTimeInterval:expiresMaxAge sinceDate:[NSDate date]]; - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - [defaults setObject:date forKey:ATSurveyCachedSurveysExpirationPreferenceKey]; - [defaults synchronize]; - } - - [availableSurveys removeAllObjects]; - [availableSurveys addObjectsFromArray:surveys]; - } - - if (hasNewSurvey) { - [[NSNotificationCenter defaultCenter] postNotificationName:ATSurveyNewSurveyAvailableNotification object:nil]; - } -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Tasks/ATSurveyGetSurveysTask.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Tasks/ATSurveyGetSurveysTask.h deleted file mode 100755 index cbe0d95..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Tasks/ATSurveyGetSurveysTask.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// ATSurveyGetSurveysTask.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 7/20/12. -// Copyright (c) 2012 Apptentive, Inc. All rights reserved. -// - -#import "ATTask.h" - -#import "ATAPIRequest.h" - -@interface ATSurveyGetSurveysTask : ATTask { -@private - ATAPIRequest *checkSurveysRequest; -} - -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Tasks/ATSurveyGetSurveysTask.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Tasks/ATSurveyGetSurveysTask.m deleted file mode 100755 index 1c92c85..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/Tasks/ATSurveyGetSurveysTask.m +++ /dev/null @@ -1,127 +0,0 @@ -// -// ATSurveyGetSurveysTask.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 7/20/12. -// Copyright (c) 2012 Apptentive, Inc. All rights reserved. -// - -#import "ATSurveyGetSurveysTask.h" -#import "ATBackend.h" -#import "ATSurveyParser.h" -#import "ATSurveysBackend.h" -#import "ATWebClient.h" -#import "ATWebClient+SurveyAdditions.h" -#import "PJSONKit.h" - -@interface ATSurveyGetSurveysTask (Private) -- (void)setup; -- (void)teardown; -@end - -@implementation ATSurveyGetSurveysTask -- (id)initWithCoder:(NSCoder *)coder { - if ((self = [super init])) { - } - return self; -} - -- (void)encodeWithCoder:(NSCoder *)coder { -} - -- (void)dealloc { - [self teardown]; - [super dealloc]; -} - -- (BOOL)canStart { - if ([[ATBackend sharedBackend] apiKey] == nil) { - return NO; - } - return YES; -} - -- (BOOL)shouldArchive { - return NO; -} - -- (void)start { - self.failureOkay = YES; - if (checkSurveysRequest == nil) { - ATWebClient *client = [ATWebClient sharedClient]; - checkSurveysRequest = [[client requestForGettingSurveys] retain]; - checkSurveysRequest.delegate = self; - self.inProgress = YES; - [checkSurveysRequest start]; - } else { - self.finished = YES; - } -} - -- (void)stop { - if (checkSurveysRequest) { - checkSurveysRequest.delegate = nil; - [checkSurveysRequest cancel]; - [checkSurveysRequest release], checkSurveysRequest = nil; - self.inProgress = NO; - } -} - -- (float)percentComplete { - if (checkSurveysRequest) { - return [checkSurveysRequest percentageComplete]; - } else { - return 0.0f; - } -} - -- (NSString *)taskName { - return @"survey check"; -} - -#pragma mark ATAPIRequestDelegate -- (void)at_APIRequestDidFinish:(ATAPIRequest *)request result:(NSObject *)result { - @synchronized(self) { - [self retain]; - if (request == checkSurveysRequest) { - ATSurveyParser *parser = [[ATSurveyParser alloc] init]; - - NSArray *surveys = [parser parseMultipleSurveys:(NSData *)result]; - if (surveys == nil) { - ATLogError(@"An error occurred parsing surveys: %@", [parser parserError]); - } else { - [[ATSurveysBackend sharedBackend] didReceiveNewSurveys:surveys maxAge:[request expiresMaxAge]]; - } - checkSurveysRequest.delegate = nil; - [checkSurveysRequest release], checkSurveysRequest = nil; - [parser release], parser = nil; - self.finished = YES; - } - [self release]; - } -} - -- (void)at_APIRequestDidFail:(ATAPIRequest *)request { - @synchronized(self) { - [self retain]; - if (request == checkSurveysRequest) { - ATLogError(@"Survey request failed: %@: %@", request.errorTitle, request.errorMessage); - self.lastErrorTitle = request.errorTitle; - self.lastErrorMessage = request.errorMessage; - self.failed = YES; - [self stop]; - } - [self release]; - } -} -@end - -@implementation ATSurveyGetSurveysTask (Private) -- (void)setup { - -} - -- (void)teardown { - [self stop]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/URL Loading/ATWebClient+SurveyAdditions.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/URL Loading/ATWebClient+SurveyAdditions.h deleted file mode 100755 index 8e212b7..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/URL Loading/ATWebClient+SurveyAdditions.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// ATWebClient+SurveyAdditions.h -// ApptentiveSurveys -// -// Created by Andrew Wooster on 11/4/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import "ATWebClient.h" - -@class ATAPIRequest; -@class ATSurveyResponse; - -@interface ATWebClient (SurveyAdditions) -- (ATAPIRequest *)requestForGettingSurveys; -- (ATAPIRequest *)requestForPostingSurveyResponse:(ATSurveyResponse *)surveyResponse; -@end - -void ATWebClient_SurveyAdditions_Bootstrap(); diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/URL Loading/ATWebClient+SurveyAdditions.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/URL Loading/ATWebClient+SurveyAdditions.m deleted file mode 100755 index 78f5d9d..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/URL Loading/ATWebClient+SurveyAdditions.m +++ /dev/null @@ -1,48 +0,0 @@ -// -// ATWebClient+SurveyAdditions.m -// ApptentiveSurveys -// -// Created by Andrew Wooster on 11/4/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import "ATWebClient+SurveyAdditions.h" -#import "ATWebClient_Private.h" -#import "ATAPIRequest.h" -#import "ATSurveyResponse.h" -#import "ATURLConnection.h" -#import "PJSONKit.h" - -@implementation ATWebClient (SurveyAdditions) -- (ATAPIRequest *)requestForGettingSurveys { - NSString *urlString = [NSString stringWithFormat:@"%@/surveys?active=1", [self baseURLString]]; - ATURLConnection *conn = [self connectionToGet:[NSURL URLWithString:urlString]]; - conn.timeoutInterval = 20.0; - ATAPIRequest *request = [[ATAPIRequest alloc] initWithConnection:conn channelName:[self commonChannelName]]; - request.returnType = ATAPIRequestReturnTypeData; - return [request autorelease]; -} - - -- (ATAPIRequest *)requestForPostingSurveyResponse:(ATSurveyResponse *)surveyResponse { - NSError *error = nil; - NSString *postString = [[surveyResponse apiJSON] ATJSONStringWithOptions:ATJKSerializeOptionPretty error:&error]; - if (!postString && error != nil) { - ATLogError(@"ATWebClient+SurveyAdditions: Error while encoding JSON: %@", error); - return nil; - } - NSString *url = [self apiURLStringWithPath:@"records"]; - ATURLConnection *conn = nil; - - conn = [self connectionToPost:[NSURL URLWithString:url] JSON:postString]; - - conn.timeoutInterval = 240.0; - ATAPIRequest *request = [[ATAPIRequest alloc] initWithConnection:conn channelName:ATWebClientDefaultChannelName]; - request.returnType = ATAPIRequestReturnTypeJSON; - return [request autorelease]; -} -@end - -void ATWebClient_SurveyAdditions_Bootstrap() { - NSLog(@"Loading ATWebClient_SurveyAdditions_Bootstrap"); -} diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/View Controllers/ATSurveyViewController.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/View Controllers/ATSurveyViewController.h deleted file mode 100755 index 880ac3c..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/View Controllers/ATSurveyViewController.h +++ /dev/null @@ -1,41 +0,0 @@ -// -// ATSurveyViewController.h -// ApptentiveSurveys -// -// Created by Andrew Wooster on 11/5/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import -#import "ATDefaultTextView.h" - -@class ATCellTextView; -@class ATSurvey; -@class ATSurveyQuestion; - -@interface ATSurveyViewController : UIViewController { -@private - ATSurvey *survey; - UITableView *tableView; - UITableViewCell *activeTextEntryCell; - ATCellTextView *activeTextView; - NSString *errorText; - - NSMutableSet *sentNotificationsAboutQuestionIDs; - - NSDate *startedSurveyDate; -} -@property (nonatomic, copy) NSString *errorText; -- (id)initWithSurvey:(ATSurvey *)survey; -- (IBAction)sendSurvey; -@end - - -@interface ATCellTextView : ATDefaultTextView { -@private - NSIndexPath *cellPath; - ATSurveyQuestion *question; -} -@property (nonatomic, retain) NSIndexPath *cellPath; -@property (nonatomic, retain) ATSurveyQuestion *question; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/View Controllers/ATSurveyViewController.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/View Controllers/ATSurveyViewController.m deleted file mode 100755 index cf1ab7f..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Surveys/View Controllers/ATSurveyViewController.m +++ /dev/null @@ -1,683 +0,0 @@ -// -// ATSurveyViewController.m -// ApptentiveSurveys -// -// Created by Andrew Wooster on 11/5/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import "ATSurveyViewController.h" -#import "ATConnect.h" -#import "ATHUDView.h" -#import "ATRecordTask.h" -#import "ATSurvey.h" -#import "ATSurveys.h" -#import "ATSurveysBackend.h" -#import "ATSurveyMetrics.h" -#import "ATSurveyQuestion.h" -#import "ATSurveyResponse.h" -#import "ATTaskQueue.h" - -#define DEBUG_CELL_HEIGHT_PROBLEM 0 - -enum { - kTextViewTag = 1 -}; - -@interface ATSurveyViewController (Private) -- (void)sendNotificationAboutTextViewQuestion:(ATSurveyQuestion *)question; -- (ATSurveyQuestion *)questionAtIndexPath:(NSIndexPath *)path; -- (BOOL)questionHasExtraInfo:(ATSurveyQuestion *)question; -- (BOOL)validateSurvey; -- (void)cancel:(id)sender; - -- (BOOL)sizeTextView:(ATCellTextView *)textView; - -#pragma mark Keyboard Handling -- (void)registerForKeyboardNotifications; -- (void)keyboardWasShown:(NSNotification*)aNotification; -- (void)keyboardWillBeHidden:(NSNotification*)aNotification; -@end - -@implementation ATSurveyViewController -@synthesize errorText; - -- (id)initWithSurvey:(ATSurvey *)aSurvey { - if ((self = [super init])) { - startedSurveyDate = [[NSDate alloc] init]; - survey = [aSurvey retain]; - sentNotificationsAboutQuestionIDs = [[NSMutableSet alloc] init]; - } - return self; -} - -- (void)dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; - if (tableView) { - [tableView removeFromSuperview]; - tableView.delegate = nil; - tableView.dataSource = nil; - [tableView release], tableView = nil; - } - [activeTextEntryCell release], activeTextEntryCell = nil; - [activeTextView release], activeTextView = nil; - [survey release], survey = nil; - [errorText release], errorText = nil; - [sentNotificationsAboutQuestionIDs release], sentNotificationsAboutQuestionIDs = nil; - [startedSurveyDate release], startedSurveyDate = nil; - [super dealloc]; -} - -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; -} - -- (IBAction)sendSurvey { - // Send text view notification, if applicable. - if (activeTextView) { - ATCellTextView *ctv = activeTextView; - ATSurveyQuestion *question = ctv.question; - - if (question) { - ctv.question.answerText = ctv.text; - [self sendNotificationAboutTextViewQuestion:question]; - } - } - - ATSurveyResponse *response = [[ATSurveyResponse alloc] init]; - NSTimeInterval interval = [[NSDate date] timeIntervalSinceDate:startedSurveyDate]; - if (interval > 0) { - response.completionSeconds = (NSUInteger)interval; - } - response.identifier = survey.identifier; - for (ATSurveyQuestion *question in [survey questions]) { - if (question.type == ATSurveyQuestionTypeSingeLine) { - ATSurveyQuestionResponse *answer = [[ATSurveyQuestionResponse alloc] init]; - answer.identifier = question.identifier; - answer.response = question.answerText; - [response addQuestionResponse:answer]; - [answer release], answer = nil; - } else if (question.type == ATSurveyQuestionTypeMultipleChoice) { - if ([question.selectedAnswerChoices count]) { - ATSurveyQuestionAnswer *selectedAnswer = [question.selectedAnswerChoices objectAtIndex:0]; - ATSurveyQuestionResponse *answer = [[ATSurveyQuestionResponse alloc] init]; - answer.identifier = question.identifier; - answer.response = selectedAnswer.identifier; - [response addQuestionResponse:answer]; - [answer release], answer = nil; - } - } else if (question.type == ATSurveyQuestionTypeMultipleSelect) { - if ([question.selectedAnswerChoices count]) { - ATSurveyQuestionResponse *answer = [[ATSurveyQuestionResponse alloc] init]; - answer.identifier = question.identifier; - NSMutableArray *responses = [NSMutableArray array]; - for (ATSurveyQuestionAnswer *selectedAnswer in question.selectedAnswerChoices) { - [responses addObject:selectedAnswer.identifier]; - } - answer.response = responses; - [response addQuestionResponse:answer]; - [answer release], answer = nil; - } - } - } - - ATRecordTask *task = [[ATRecordTask alloc] init]; - [task setRecord:response]; - [[ATTaskQueue sharedTaskQueue] addTask:task]; - [response release], response = nil; - [task release], task = nil; - - if (!survey.successMessage) { - ATHUDView *hud = [[ATHUDView alloc] initWithWindow:self.view.window]; - hud.label.text = ATLocalizedString(@"Thanks!", @"Text in thank you display upon submitting survey."); - hud.fadeOutDuration = 5.0; - [hud show]; - [hud autorelease]; - } else { - UIAlertView *successAlert = [[[UIAlertView alloc] initWithTitle:ATLocalizedString(@"Thanks!", @"Text in thank you display upon submitting survey.") message:survey.successMessage delegate:nil cancelButtonTitle:ATLocalizedString(@"Okay", @"Okay button title") otherButtonTitles:nil] autorelease]; - [successAlert show]; - } - - NSDictionary *notificationInfo = [[NSDictionary alloc] initWithObjectsAndKeys:survey.identifier, ATSurveyIDKey, nil]; - NSDictionary *metricsInfo = [[NSDictionary alloc] initWithObjectsAndKeys:survey.identifier, ATSurveyMetricsSurveyIDKey, [NSNumber numberWithInt:ATSurveyWindowTypeSurvey], ATSurveyWindowTypeKey, [NSNumber numberWithInt:ATSurveyEventTappedSend], ATSurveyMetricsEventKey, nil]; - [[NSNotificationCenter defaultCenter] postNotificationName:ATSurveyDidHideWindowNotification object:nil userInfo:metricsInfo]; - [metricsInfo release], metricsInfo = nil; - - - [[ATSurveysBackend sharedBackend] setDidSendSurvey:survey]; - [[ATSurveysBackend sharedBackend] resetSurvey]; - [self.navigationController dismissModalViewControllerAnimated:YES]; - - [[NSNotificationCenter defaultCenter] postNotificationName:ATSurveySentNotification object:nil userInfo:notificationInfo]; - [notificationInfo release], notificationInfo = nil; -} - -- (void)loadView { - [super loadView]; - self.view.backgroundColor = [UIColor whiteColor]; - tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped]; - tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - [self.view addSubview:tableView]; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - - if (![survey responseIsRequired]) { - self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel:)] autorelease]; - } - - self.title = ATLocalizedString(@"Survey", @"Survey view title"); - - tableView.delegate = self; - tableView.dataSource = self; - [tableView reloadData]; - [self registerForKeyboardNotifications]; -} - -- (void)viewDidUnload { - [super viewDidUnload]; - [[NSNotificationCenter defaultCenter] removeObserver:self]; - [tableView removeFromSuperview]; - tableView.delegate = nil; - tableView.dataSource = nil; - [tableView release], tableView = nil; -} - -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - return YES; -} - -- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { - if (activeTextView != nil) { - - } -} - -#pragma mark UITableViewDataSource - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)aTableView { - return [[survey questions] count] + 1; -} - -- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section { - if (section < [[survey questions] count]) { - NSUInteger result = 0; - ATSurveyQuestion *question = [[survey questions] objectAtIndex:section]; - if (question.type == ATSurveyQuestionTypeSingeLine) { - result = 2; - } else if (question.type == ATSurveyQuestionTypeMultipleChoice || question.type == ATSurveyQuestionTypeMultipleSelect) { - result = [[question answerChoices] count] + 1; - } - if ([self questionHasExtraInfo:question]) { - result++; - } - return result; - } else if (section == [[survey questions] count]) { - return 1; - } - return 0; -} - -- (CGFloat)tableView:(UITableView *)aTableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - UITableViewCell *cell = [self tableView:tableView cellForRowAtIndexPath:indexPath]; - ATCellTextView *textViewCell = (ATCellTextView *)[cell viewWithTag:kTextViewTag]; - CGFloat cellHeight = 0; - if (textViewCell != nil) { - CGSize cellSize = CGSizeMake(textViewCell.bounds.size.width, textViewCell.bounds.size.height + 20); - CGRect f = textViewCell.frame; - f.origin.y = 10.0; - textViewCell.frame = f; - cellHeight = MAX(44, cellSize.height); - } else if (cell.textLabel.text != nil) { - UIFont *font = cell.textLabel.font; - - if (indexPath.row == 0) { - CGRect textFrame = cell.textLabel.frame; - textFrame.size.width = cell.frame.size.width - 38.0; - cell.textLabel.frame = textFrame; -#if DEBUG_CELL_HEIGHT_PROBLEM - ATLogDebug(@"%@", NSStringFromCGRect(cell.textLabel.frame)); -#endif - } - - CGSize cellSize = CGSizeMake(cell.textLabel.bounds.size.width, 1024); - UILineBreakMode lbm = cell.textLabel.lineBreakMode; - CGSize s = [cell.textLabel.text sizeWithFont:font constrainedToSize:cellSize lineBreakMode:lbm]; - CGRect f = cell.textLabel.frame; - f.size = s; -#if DEBUG_CELL_HEIGHT_PROBLEM - if (s.height >= 50) { - ATLogDebug(@"cell width is: %f", cell.frame.size.width); - ATLogDebug(@"width is: %f", cellSize.width); - ATLogDebug(@"Hi"); - } -#endif - - ATSurveyQuestion *question = [self questionAtIndexPath:indexPath]; - if (question != nil && indexPath.row == 1 && [self questionHasExtraInfo:question]) { - f.origin.y = 4; - cell.textLabel.frame = f; - cellHeight = MAX(32, s.height + 8); - } else { - f.origin.y = 10; - cell.textLabel.frame = f; - cellHeight = MAX(44, s.height + 20); - } - } else { - cellHeight = 44; - } - return cellHeight; -} - -- (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *ATSurveyExtraInfoCellIdentifier = @"ATSurveyExtraInfoCellIdentifier"; - static NSString *ATSurveyCheckboxCellIdentifier = @"ATSurveyCheckboxCellIdentifier"; - static NSString *ATSurveyTextViewCellIdentifier = @"ATSurveyTextViewCellIdentifier"; - static NSString *ATSurveyQuestionCellIdentifier = @"ATSurveyQuestionCellIdentifier"; - static NSString *ATSurveySendCellIdentifier = @"ATSurveySendCellIdentifier"; - - if (indexPath.section == [[survey questions] count]) { - UITableViewCell *buttonCell = nil; - buttonCell = [tableView dequeueReusableCellWithIdentifier:ATSurveySendCellIdentifier]; - if (!buttonCell) { - buttonCell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ATSurveySendCellIdentifier] autorelease]; - buttonCell.textLabel.text = ATLocalizedString(@"Send Response", @"Survey send response button title"); - buttonCell.textLabel.textAlignment = UITextAlignmentCenter; - buttonCell.textLabel.textColor = [UIColor blueColor]; - buttonCell.selectionStyle = UITableViewCellSelectionStyleBlue; - } - return buttonCell; - } else if (indexPath.section >= [[survey questions] count]) { - return nil; - } - ATSurveyQuestion *question = [self questionAtIndexPath:indexPath]; - UITableViewCell *cell = nil; - if (indexPath.row == 0) { - // Show the question row. - cell = [tableView dequeueReusableCellWithIdentifier:ATSurveyQuestionCellIdentifier]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ATSurveyQuestionCellIdentifier] autorelease]; - cell.textLabel.numberOfLines = 0; - cell.textLabel.adjustsFontSizeToFitWidth = NO; - cell.textLabel.lineBreakMode = UILineBreakModeWordWrap; - cell.backgroundColor = [UIColor colorWithRed:223/255. green:235/255. blue:247/255. alpha:1.0]; -#if DEBUG_CELL_HEIGHT_PROBLEM - cell.textLabel.backgroundColor = [UIColor redColor]; -#endif - cell.textLabel.font = [UIFont boldSystemFontOfSize:20]; - } - cell.textLabel.text = question.questionText; - cell.selectionStyle = UITableViewCellSelectionStyleNone; - [cell layoutIfNeeded]; - } else if (indexPath.row == 1 && [self questionHasExtraInfo:question]) { - cell = [tableView dequeueReusableCellWithIdentifier:ATSurveyExtraInfoCellIdentifier]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ATSurveyExtraInfoCellIdentifier] autorelease]; - cell.backgroundColor = [UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1.0]; - cell.selectionStyle = UITableViewCellSelectionStyleNone; - cell.textLabel.font = [UIFont systemFontOfSize:15]; - cell.textLabel.numberOfLines = 0; - cell.textLabel.adjustsFontSizeToFitWidth = NO; - cell.textLabel.lineBreakMode = UILineBreakModeWordWrap; - } - NSString *text = nil; - if (question.instructionsText) { - if ([question.instructionsText length]) { - text = question.instructionsText; - } - } else if (question.responseIsRequired) { - text = ATLocalizedString(@"(required)", @"Survey required answer fallback label."); - } - cell.textLabel.text = text; - [cell layoutSubviews]; - } else { - NSUInteger answerIndex = indexPath.row - 1; - if ([self questionHasExtraInfo:question]) { - answerIndex = answerIndex - 1; - } - - if (question.type == ATSurveyQuestionTypeMultipleChoice || question.type == ATSurveyQuestionTypeMultipleSelect) { - ATSurveyQuestionAnswer *answer = [question.answerChoices objectAtIndex:answerIndex]; - // Make a checkbox cell. - cell = [tableView dequeueReusableCellWithIdentifier:ATSurveyCheckboxCellIdentifier]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ATSurveyCheckboxCellIdentifier] autorelease]; - } - cell.textLabel.font = [UIFont systemFontOfSize:18]; - cell.textLabel.text = answer.value; - cell.textLabel.numberOfLines = 0; - cell.textLabel.adjustsFontSizeToFitWidth = NO; - cell.textLabel.lineBreakMode = UILineBreakModeWordWrap; - if ([[question selectedAnswerChoices] containsObject:answer]) { - cell.accessoryType = UITableViewCellAccessoryCheckmark; - } else { - cell.accessoryType = UITableViewCellAccessoryNone; - } - [cell layoutSubviews]; - } else { - // Make a text entry cell. - if (activeTextView != nil && activeTextEntryCell != nil && activeTextView.cellPath.row == indexPath.row && activeTextView.cellPath.section == indexPath.section) { - cell = activeTextEntryCell; - } else { - cell = [tableView dequeueReusableCellWithIdentifier:ATSurveyTextViewCellIdentifier]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ATSurveyTextViewCellIdentifier] autorelease]; - ATCellTextView *textView = [[ATCellTextView alloc] initWithFrame:CGRectInset(cell.contentView.bounds, 10.0, 10.0)]; - textView.font = [UIFont systemFontOfSize:16]; - textView.backgroundColor = [UIColor clearColor]; - textView.tag = kTextViewTag; - textView.autoresizingMask = UIViewAutoresizingFlexibleWidth; - [cell.contentView addSubview:textView]; - textView.returnKeyType = UIReturnKeyDone; - [textView release], textView = nil; - cell.selectionStyle = UITableViewCellSelectionStyleNone; - } - } - - ATCellTextView *textView = (ATCellTextView *)[cell viewWithTag:kTextViewTag]; - textView.cellPath = [NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section]; - textView.placeholder = ATLocalizedString(@"Answer", @"Answer label"); - textView.delegate = self; - textView.question = question; - if (question.answerText != nil) { - textView.text = question.answerText; - } - //[textView sizeToFit]; - [self sizeTextView:textView]; - /* - CGRect cellFrame = cell.frame; - cellFrame.size.height = textView.frame.size.height + 20.0; - cell.frame = cellFrame; - */ - } - } - - return cell; -} - -#pragma mark UITableViewDelegate - -- (NSString *)tableView:(UITableView *)aTableView titleForHeaderInSection:(NSInteger)section { - if ([survey surveyDescription] != nil && section == 0) { - return [survey surveyDescription]; - } - return nil; -} - -- (NSString *)tableView:(UITableView *)aTableView titleForFooterInSection:(NSInteger)section { - if (section == [[survey questions] count] && errorText != nil) { - return errorText; - } - return nil; -} - -- (void)scrollToBottom { - if (tableView) { - NSIndexPath *path = [NSIndexPath indexPathForRow:0 inSection:[[survey questions] count]]; - [tableView scrollToRowAtIndexPath:path atScrollPosition:UITableViewScrollPositionTop animated:YES]; - } -} - -- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - if (indexPath.section == [[survey questions] count]) { - if ([self validateSurvey]) { - [self sendSurvey]; - } else { - [tableView reloadData]; - [self performSelector:@selector(scrollToBottom) withObject:nil afterDelay:0.1]; - } - } else { - ATSurveyQuestion *question = [self questionAtIndexPath:indexPath]; - UITableViewCell *cell = [aTableView cellForRowAtIndexPath:indexPath]; - if (indexPath.row == 0) { - // Question row. - } else if ([self questionHasExtraInfo:question] && indexPath.row == 1) { - - } else { - NSUInteger answerIndex = indexPath.row - 1; - if ([self questionHasExtraInfo:question]) { - answerIndex = answerIndex - 1; - } - if (question.type == ATSurveyQuestionTypeMultipleChoice || question.type == ATSurveyQuestionTypeMultipleSelect) { - ATSurveyQuestionAnswer *answer = [question.answerChoices objectAtIndex:answerIndex]; - BOOL isChecked = cell.accessoryType == UITableViewCellAccessoryCheckmark; - - NSUInteger maxSelections = question.maxSelectionCount; - if (maxSelections == 0) { - maxSelections = NSUIntegerMax; - } - if (isChecked == NO && question.type == ATSurveyQuestionTypeMultipleSelect && [[question selectedAnswerChoices] count] == maxSelections) { - // Do nothing if unchecked and have already selected the maximum number of answers. - } else if (isChecked == NO) { - cell.accessoryType = UITableViewCellAccessoryCheckmark; - [question addSelectedAnswerChoice:answer]; - } else if (isChecked == YES) { - cell.accessoryType = UITableViewCellAccessoryNone; - [question removeSelectedAnswerChoice:answer]; - } - // Deselect the other cells. - if (question.type == ATSurveyQuestionTypeMultipleChoice) { - UITableViewCell *otherCell = nil; - for (NSUInteger i = 1; i < [self tableView:aTableView numberOfRowsInSection:indexPath.section]; i++) { - if (i != indexPath.row) { - NSIndexPath *path = [NSIndexPath indexPathForRow:i inSection:indexPath.section]; - otherCell = [aTableView cellForRowAtIndexPath:path]; - otherCell.accessoryType = UITableViewCellAccessoryNone; - } - } - } - - // Send notification. - NSDictionary *metricsInfo = [[NSDictionary alloc] initWithObjectsAndKeys:survey.identifier, ATSurveyMetricsSurveyIDKey, question.identifier, ATSurveyMetricsSurveyQuestionIDKey, [NSNumber numberWithInt:ATSurveyEventAnsweredQuestion], ATSurveyMetricsEventKey, nil]; - [[NSNotificationCenter defaultCenter] postNotificationName:ATSurveyDidAnswerQuestionNotification object:nil userInfo:metricsInfo]; - [metricsInfo release], metricsInfo = nil; - } else if (question.type == ATSurveyQuestionTypeSingeLine) { - ATCellTextView *textView = (ATCellTextView *)[cell viewWithTag:kTextViewTag]; - [textView becomeFirstResponder]; - } - } - } - [tableView deselectRowAtIndexPath:indexPath animated:YES]; -} - -#pragma mark UITextViewDelegate -- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { - if ([text isEqualToString:@"\n"]) { - [textView resignFirstResponder]; - return NO; - } - return YES; -} - -- (void)textViewDidChange:(UITextView *)textView { - if ([textView isKindOfClass:[ATCellTextView class]]) { - ATCellTextView *ctv = (ATCellTextView *)textView; - ctv.question.answerText = ctv.text; - } - - if ([self sizeTextView:(ATCellTextView *)textView]) { - [tableView beginUpdates]; - [tableView endUpdates]; - [tableView scrollRectToVisible:CGRectInset(activeTextEntryCell.frame, 0, -10) animated:YES]; - } -} - -- (void)textViewDidBeginEditing:(UITextView *)textView { - [textView flashScrollIndicators]; - [activeTextEntryCell release], activeTextEntryCell = nil; - [activeTextView release], activeTextView = nil; - activeTextView = (ATCellTextView *)[textView retain]; - activeTextEntryCell = [(UITableViewCell *)activeTextView.superview.superview retain]; - [tableView scrollRectToVisible:textView.superview.superview.frame animated:YES]; -} - -- (void)textViewDidEndEditing:(UITextView *)textView { - if ([textView isKindOfClass:[ATCellTextView class]]) { - ATCellTextView *ctv = (ATCellTextView *)textView; - ATSurveyQuestion *question = ctv.question; - - if (question) { - ctv.question.answerText = ctv.text; - [self sendNotificationAboutTextViewQuestion:question]; - } - } - [activeTextEntryCell release], activeTextEntryCell = nil; - [activeTextView release], activeTextView = nil; -} - -- (BOOL)textViewShouldEndEditing:(UITextView *)textView { - [textView resignFirstResponder]; - return YES; -} -@end - -@implementation ATSurveyViewController (Private) -- (void)sendNotificationAboutTextViewQuestion:(ATSurveyQuestion *)question { - if (!question.type == ATSurveyQuestionTypeSingeLine) { - return; - } - - // Send notification. - if (![sentNotificationsAboutQuestionIDs containsObject:question.identifier]) { - NSDictionary *metricsInfo = [[NSDictionary alloc] initWithObjectsAndKeys:survey.identifier, ATSurveyMetricsSurveyIDKey, question.identifier, ATSurveyMetricsSurveyQuestionIDKey, [NSNumber numberWithInt:ATSurveyEventAnsweredQuestion], ATSurveyMetricsEventKey, nil]; - [[NSNotificationCenter defaultCenter] postNotificationName:ATSurveyDidAnswerQuestionNotification object:nil userInfo:metricsInfo]; - [metricsInfo release], metricsInfo = nil; - - [sentNotificationsAboutQuestionIDs addObject:question.identifier]; - } -} - - -- (ATSurveyQuestion *)questionAtIndexPath:(NSIndexPath *)indexPath { - if (indexPath.section >= [[survey questions] count]) { - return nil; - } - return [[survey questions] objectAtIndex:indexPath.section]; -} - -- (BOOL)questionHasExtraInfo:(ATSurveyQuestion *)question { - BOOL result = NO; - if (question.responseIsRequired) { - result = YES; - } else if (question.type == ATSurveyQuestionTypeMultipleSelect) { - result = YES; - } else if (question.type == ATSurveyQuestionTypeMultipleChoice) { - result = YES; - } - return result; -} - -- (BOOL)validateSurvey { - BOOL valid = YES; - NSUInteger missingAnswerCount = 0; - NSUInteger tooFewAnswersCount = 0; - NSUInteger tooManyAnswersCount = 0; - for (ATSurveyQuestion *question in [survey questions]) { - ATSurveyQuestionValidationErrorType error = [question validateAnswer]; - if (error == ATSurveyQuestionValidationErrorMissingRequiredAnswer) { - missingAnswerCount++; - valid = NO; - } else if (error == ATSurveyQuestionValidationErrorTooFewAnswers) { - tooFewAnswersCount++; - valid = NO; - } else if (error == ATSurveyQuestionValidationErrorTooManyAnswers) { - tooManyAnswersCount++; - valid = NO; - } - } - if (valid) { - self.errorText = nil; - } else { - if (missingAnswerCount == 1) { - self.errorText = ATLocalizedString(@"Missing a required answer.", @"Survey missing required answer label."); - } else if (missingAnswerCount > 1) { - self.errorText = [NSString stringWithFormat:ATLocalizedString(@"Missing %d required answers.", @"Survey missing required answers formatted label."), missingAnswerCount]; - } else if (tooFewAnswersCount == 1) { - self.errorText = ATLocalizedString(@"Too few selections made for a question above.", @"Survey too few selections label."); - } else if (tooFewAnswersCount > 1) { - self.errorText = [NSString stringWithFormat:ATLocalizedString(@"Too few selections made for %d questions above.", @"Survey too few selections formatted label."), tooFewAnswersCount]; - } else if (tooManyAnswersCount == 1) { - self.errorText = ATLocalizedString(@"Too many selections made for a question above.", @"Survey too many selections label."); - } else if (tooManyAnswersCount > 1) { - self.errorText = [NSString stringWithFormat:ATLocalizedString(@"Too many selections made for %d questions above.", @"Survey too many selections formatted label."), tooFewAnswersCount]; - } - } - return valid; -} - -- (BOOL)sizeTextView:(ATCellTextView *)textView { - BOOL didChange = NO; - CGRect f = textView.frame; - CGFloat originalHeight = f.size.height; - CGSize maxSize = CGSizeMake(f.size.width, 150); - // CGSize sizeThatFits = [textView.text sizeWithFont:textView.font constrainedToSize:maxSize lineBreakMode:UILineBreakModeWordWrap]; - CGSize sizeThatFits = [textView sizeThatFits:maxSize]; - if (originalHeight != sizeThatFits.height) { - // NSLog(@"old: %f, new: %f", originalHeight, sizeThatFits.height); - f.size.height = sizeThatFits.height; - textView.frame = f; - didChange = YES; - } - return didChange; -} - -- (void)cancel:(id)sender { - NSDictionary *metricsInfo = [[NSDictionary alloc] initWithObjectsAndKeys:survey.identifier, ATSurveyMetricsSurveyIDKey, [NSNumber numberWithInt:ATSurveyWindowTypeSurvey], ATSurveyWindowTypeKey, [NSNumber numberWithInt:ATSurveyEventTappedCancel], ATSurveyMetricsEventKey, nil]; - [[NSNotificationCenter defaultCenter] postNotificationName:ATSurveyDidHideWindowNotification object:nil userInfo:metricsInfo]; - [metricsInfo release], metricsInfo = nil; - - [self.navigationController dismissModalViewControllerAnimated:YES]; -} - -#pragma mark Keyboard Handling -- (void)registerForKeyboardNotifications { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasShown:) name:UIKeyboardDidShowNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillBeHidden:) name:UIKeyboardWillHideNotification object:nil]; -} - -- (void)keyboardWasShown:(NSNotification*)aNotification { - NSDictionary* info = [aNotification userInfo]; - CGRect kbFrame = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue]; - CGRect kbAdjustedFrame = [tableView.window convertRect:kbFrame toView:tableView]; - CGSize kbSize = kbAdjustedFrame.size; - - UIEdgeInsets contentInsets = UIEdgeInsetsMake(0.0, 0.0, kbSize.height, 0.0); - tableView.contentInset = contentInsets; - tableView.scrollIndicatorInsets = contentInsets; - - // If active text field is hidden by keyboard, scroll it so it's visible - if (activeTextView != nil && activeTextEntryCell) { - CGRect aRect = tableView.frame; - aRect.size.height -= kbSize.height; - CGRect r = [activeTextEntryCell convertRect:activeTextView.frame toView:tableView]; - if (!CGRectContainsPoint(aRect, r.origin) ) { - [activeTextView becomeFirstResponder]; - [tableView scrollRectToVisible:CGRectInset(activeTextEntryCell.frame, 0, -10) animated:YES]; - // CGPoint scrollPoint = CGPointMake(0.0, r.origin.y - kbSize.height); - // [tableView setContentOffset:scrollPoint animated:YES]; - } - } -} - -- (void)keyboardWillBeHidden:(NSNotification*)aNotification { - NSNumber *duration = [[aNotification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey]; - NSNumber *curve = [[aNotification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey]; - [UIView beginAnimations:nil context:nil]; - [UIView setAnimationDuration:[duration floatValue]]; - [UIView setAnimationCurve:[curve intValue]]; - UIEdgeInsets contentInsets = UIEdgeInsetsZero; - tableView.contentInset = contentInsets; - tableView.scrollIndicatorInsets = contentInsets; - [UIView commitAnimations]; -} -@end - -@implementation ATCellTextView -@synthesize cellPath, question; -- (void)dealloc { - [cellPath release], cellPath = nil; - [question release], question = nil; - [super dealloc]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATAppConfigurationUpdateTask.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATAppConfigurationUpdateTask.h deleted file mode 100755 index 5b3f053..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATAppConfigurationUpdateTask.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// ATAppConfigurationUpdateTask.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 7/20/12. -// Copyright (c) 2012 Apptentive, Inc. All rights reserved. -// - -#import "ATTask.h" -#import "ATAppConfigurationUpdater.h" - -@interface ATAppConfigurationUpdateTask : ATTask { -@private - ATAppConfigurationUpdater *configurationUpdater; -} - -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATAppConfigurationUpdateTask.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATAppConfigurationUpdateTask.m deleted file mode 100755 index 6970a62..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATAppConfigurationUpdateTask.m +++ /dev/null @@ -1,98 +0,0 @@ -// -// ATAppConfigurationUpdateTask.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 7/20/12. -// Copyright (c) 2012 Apptentive, Inc. All rights reserved. -// - -#import "ATAppConfigurationUpdateTask.h" -#import "ATBackend.h" - - -@interface ATAppConfigurationUpdateTask (Private) -- (void)setup; -- (void)teardown; -@end - -@implementation ATAppConfigurationUpdateTask -- (id)initWithCoder:(NSCoder *)coder { - if ((self = [super init])) { - } - return self; -} - -- (void)encodeWithCoder:(NSCoder *)coder { -} - -- (void)dealloc { - [self teardown]; - [super dealloc]; -} - -- (BOOL)canStart { - if ([[ATBackend sharedBackend] apiKey] == nil) { - return NO; - } - return YES; -} - -- (BOOL)shouldArchive { - return NO; -} - -- (void)start { - if (configurationUpdater == nil && [ATAppConfigurationUpdater shouldCheckForUpdate]) { - configurationUpdater = [[ATAppConfigurationUpdater alloc] initWithDelegate:self]; - self.inProgress = YES; - [configurationUpdater update]; - } else { - self.finished = YES; - } -} - -- (void)stop { - if (configurationUpdater) { - [configurationUpdater cancel]; - [configurationUpdater release]; - configurationUpdater = nil; - self.inProgress = NO; - } -} - -- (float)percentComplete { - if (configurationUpdater) { - return [configurationUpdater percentageComplete]; - } else { - return 0.0f; - } -} - -- (NSString *)taskName { - return @"configuration update"; -} - -#pragma mark ATAppConfigurationUpdaterDelegate -- (void)configurationUpdaterDidFinish:(BOOL)success { - @synchronized(self) { - if (configurationUpdater) { - if (!success) { - self.failed = YES; - [self stop]; - } else { - self.finished = YES; - } - } - } -} -@end - -@implementation ATAppConfigurationUpdateTask (Private) -- (void)setup { - -} - -- (void)teardown { - [self stop]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATFeedbackTask.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATFeedbackTask.h deleted file mode 100755 index f41bcb1..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATFeedbackTask.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// ATFeedbackTask.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/20/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import - -#import "ATTask.h" -#import "ATAPIRequest.h" - -@class ATFeedback; - -@interface ATFeedbackTask : ATTask { -@private - ATAPIRequest *request; - ATFeedback *feedback; -} -@property (nonatomic, retain) ATFeedback *feedback; - -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATFeedbackTask.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATFeedbackTask.m deleted file mode 100755 index 2058cdd..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATFeedbackTask.m +++ /dev/null @@ -1,129 +0,0 @@ -// -// ATFeedbackTask.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/20/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import "ATFeedbackTask.h" -#import "ATLog.h" -#import "ATBackend.h" -#import "ATFeedback.h" -#import "ATWebClient.h" - -#define kATFeedbackTaskCodingVersion 1 - -@interface ATFeedbackTask (Private) -- (void)setup; -- (void)teardown; -@end - -@implementation ATFeedbackTask -@synthesize feedback; - -- (id)initWithCoder:(NSCoder *)coder { - if ((self = [super init])) { - int version = [coder decodeIntForKey:@"version"]; - if (version == kATFeedbackTaskCodingVersion) { - self.feedback = [coder decodeObjectForKey:@"feedback"]; - } else { - [self release]; - return nil; - } - } - return self; -} - -- (void)encodeWithCoder:(NSCoder *)coder { - [coder encodeInt:kATFeedbackTaskCodingVersion forKey:@"version"]; - [coder encodeObject:self.feedback forKey:@"feedback"]; -} - -- (void)dealloc { - [self teardown]; - [feedback release], feedback = nil; - [super dealloc]; -} - -- (BOOL)canStart { - if ([[ATBackend sharedBackend] apiKey] == nil) { - return NO; - } - return YES; -} - -- (void)start { - if (!request) { - request = [[self.feedback requestForSendingRecord] retain]; - if (request != nil) { - request.delegate = self; - [request start]; - self.inProgress = YES; - } else { - self.finished = YES; - } - } -} - -- (void)stop { - if (request) { - request.delegate = nil; - [request cancel]; - [request release], request = nil; - self.inProgress = NO; - } -} - -- (float)percentComplete { - if (request) { - return [request percentageComplete]; - } else { - return 0.0f; - } -} - -- (NSString *)taskName { - return @"feedback"; -} - -#pragma mark ATAPIRequestDelegate -- (void)at_APIRequestDidFinish:(ATAPIRequest *)sender result:(NSObject *)result { - @synchronized(self) { - [self retain]; - self.finished = YES; - [self stop]; - [self release]; - } -} - -- (void)at_APIRequestDidProgress:(ATAPIRequest *)sender { - // pass -} - -- (void)at_APIRequestDidFail:(ATAPIRequest *)sender { - @synchronized(self) { - [self retain]; - self.failed = YES; - self.lastErrorTitle = sender.errorTitle; - self.lastErrorMessage = sender.errorMessage; - ATLogInfo(@"ATAPIRequest failed: %@, %@", sender.errorTitle, sender.errorMessage); - [self stop]; - [self release]; - } -} - -- (void)cleanup { - [feedback cleanup]; -} -@end - -@implementation ATFeedbackTask (Private) -- (void)setup { - -} - -- (void)teardown { - [self stop]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATRecordTask.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATRecordTask.h deleted file mode 100755 index ea5eef0..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATRecordTask.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// ATRecordTask.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 1/10/12. -// Copyright (c) 2012 Apptentive, Inc. All rights reserved. -// - -#import "ATTask.h" -#import "ATTask.h" -#import "ATAPIRequest.h" - -@class ATRecord; - -@interface ATRecordTask : ATTask { -@private - ATAPIRequest *request; - ATRecord *record; -} -@property (nonatomic, retain) ATRecord *record; - -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATRecordTask.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATRecordTask.m deleted file mode 100755 index e550712..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATRecordTask.m +++ /dev/null @@ -1,129 +0,0 @@ -// -// ATRecordTask.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 1/10/12. -// Copyright (c) 2012 Apptentive, Inc. All rights reserved. -// - -#import "ATRecordTask.h" -#import "ATLog.h" -#import "ATBackend.h" -#import "ATFeedback.h" -#import "ATWebClient.h" - -#define kATRecordTaskCodingVersion 1 - -@interface ATRecordTask (Private) -- (void)setup; -- (void)teardown; -@end - -@implementation ATRecordTask -@synthesize record; - -- (id)initWithCoder:(NSCoder *)coder { - if ((self = [super init])) { - int version = [coder decodeIntForKey:@"version"]; - if (version == kATRecordTaskCodingVersion) { - self.record = [coder decodeObjectForKey:@"record"]; - } else { - [self release]; - return nil; - } - } - return self; -} - -- (void)encodeWithCoder:(NSCoder *)coder { - [coder encodeInt:kATRecordTaskCodingVersion forKey:@"version"]; - [coder encodeObject:self.record forKey:@"record"]; -} - -- (void)dealloc { - [self teardown]; - [record release], record = nil; - [super dealloc]; -} - -- (BOOL)canStart { - if ([[ATBackend sharedBackend] apiKey] == nil) { - return NO; - } - return YES; -} - -- (void)start { - if (!request) { - request = [[self.record requestForSendingRecord] retain]; - if (request != nil) { - request.delegate = self; - [request start]; - self.inProgress = YES; - } else { - self.finished = YES; - } - } -} - -- (void)stop { - if (request) { - request.delegate = nil; - [request cancel]; - [request release], request = nil; - self.inProgress = NO; - } -} - -- (float)percentComplete { - if (request) { - return [request percentageComplete]; - } else { - return 0.0f; - } -} - -- (NSString *)taskName { - return @"record"; -} - -- (void)cleanup { - [record cleanup]; -} - -#pragma mark ATAPIRequestDelegate -- (void)at_APIRequestDidFinish:(ATAPIRequest *)sender result:(id)result { - @synchronized(self) { - [self retain]; - [self stop]; - self.finished = YES; - [self release]; - } -} - -- (void)at_APIRequestDidProgress:(ATAPIRequest *)sender { - // pass -} - -- (void)at_APIRequestDidFail:(ATAPIRequest *)sender { - @synchronized(self) { - [self retain]; - self.failed = YES; - self.lastErrorTitle = sender.errorTitle; - self.lastErrorMessage = sender.errorMessage; - ATLogInfo(@"ATAPIRequest failed: %@, %@", sender.errorTitle, sender.errorMessage); - [self stop]; - [self release]; - } -} -@end - -@implementation ATRecordTask (Private) -- (void)setup { - -} - -- (void)teardown { - [self stop]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATTask.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATTask.h deleted file mode 100755 index 6ebef27..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATTask.h +++ /dev/null @@ -1,43 +0,0 @@ -// -// ATTask.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/20/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import - - -@interface ATTask : NSObject { -@private - BOOL inProgress; - BOOL finished; - BOOL failed; - NSUInteger failureCount; - NSString *lastErrorTitle; - NSString *lastErrorMessage; - BOOL failureOkay; -} -@property (nonatomic, assign) BOOL inProgress; -@property (nonatomic, assign) BOOL finished; -@property (nonatomic, assign) BOOL failed; -@property (nonatomic, assign) NSUInteger failureCount; - -@property (nonatomic, copy) NSString *lastErrorTitle; -@property (nonatomic, copy) NSString *lastErrorMessage; -/*! Should we stop the task queue if this task fails, or just throw it away? Defaults to stopping task queue (failureOkay == NO). */ -@property (nonatomic, assign, getter=isFailureOkay) BOOL failureOkay; - - -- (BOOL)canStart; -- (BOOL)shouldArchive; -- (void)start; -- (void)stop; -/*! Called before we delete this task. */ -- (void)cleanup; -- (float)percentComplete; -- (NSString *)taskName; - -- (NSString *)taskDescription; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATTask.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATTask.m deleted file mode 100755 index 4b7a84d..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATTask.m +++ /dev/null @@ -1,97 +0,0 @@ -// -// ATTask.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/20/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import "ATTask.h" - -#define kATTaskCodingVersion 2 - -@implementation ATTask -@synthesize inProgress; -@synthesize finished; -@synthesize failed; -@synthesize failureCount; -@synthesize lastErrorTitle, lastErrorMessage; -@synthesize failureOkay; - -- (id)initWithCoder:(NSCoder *)coder { - if ((self = [super init])) { - int version = [coder decodeIntForKey:@"version"]; - self.failureCount = 0; - if (version >= 2) { - self.failureCount = [(NSNumber *)[coder decodeObjectForKey:@"failureCount"] unsignedIntegerValue]; - } else { - [self release]; - return nil; - } - } - return self; -} - -- (void)dealloc { - [lastErrorTitle release], lastErrorTitle = nil; - [lastErrorMessage release], lastErrorMessage = nil; - [super dealloc]; -} - -- (void)encodeWithCoder:(NSCoder *)coder { - [coder encodeInt:kATTaskCodingVersion forKey:@"version"]; - [coder encodeObject:[NSNumber numberWithUnsignedInteger:self.failureCount] forKey:@"failureCount"]; -} - -- (BOOL)canStart { - return YES; -} - -- (BOOL)shouldArchive { - return YES; -} - -- (void)start { - -} - -- (void)stop { - -} - -- (float)percentComplete { - return 0.0f; -} - -- (NSString *)taskName { - return @"task"; -} - -- (void)cleanup { - // Do nothing by default. -} - -- (NSString *)taskDescription { - NSMutableArray *parts = [[NSMutableArray alloc] init]; - if (lastErrorTitle) { - [parts addObject:[NSString stringWithFormat:@"lastErrorTitle: %@", lastErrorTitle]]; - } - if (lastErrorMessage) { - [parts addObject:[NSString stringWithFormat:@"lastErrorMessage: %@", lastErrorMessage]]; - } - [parts addObject:[NSString stringWithFormat:@"inProgress: %@", inProgress ? @"YES" : @"NO"]]; - [parts addObject:[NSString stringWithFormat:@"finished: %@", finished ? @"YES" : @"NO"]]; - [parts addObject:[NSString stringWithFormat:@"failed: %@", failed ? @"YES" : @"NO"]]; -#if TARGET_OS_IPHONE - [parts addObject:[NSString stringWithFormat:@"failureCount: %d", failureCount]]; -#elif TARGET_OS_MAC - [parts addObject:[NSString stringWithFormat:@"failureCount: %ld", (unsigned long)failureCount]]; -#endif - [parts addObject:[NSString stringWithFormat:@"percentComplete: %f", [self percentComplete]]]; - [parts addObject:[NSString stringWithFormat:@"taskName: %@", [self taskName]]]; - - NSString *d = [parts componentsJoinedByString:@", "]; - [parts dealloc], parts = nil; - return [NSString stringWithFormat:@"<%@ %p: %@>", NSStringFromClass([self class]), self, d]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATTaskQueue.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATTaskQueue.h deleted file mode 100755 index 2d9cf9b..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATTaskQueue.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// ATTaskQueue.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/21/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import - -@class ATTask; - -@interface ATTaskQueue : NSObject { -@private - ATTask *activeTask; - NSMutableArray *tasks; -} -+ (NSString *)taskQueuePath; -+ (BOOL)serializedQueueExists; -+ (ATTaskQueue *)sharedTaskQueue; -+ (void)releaseSharedTaskQueue; - -- (void)addTask:(ATTask *)task; -- (NSUInteger)count; -- (ATTask *)taskAtIndex:(NSUInteger)index; -- (NSUInteger)countOfTasksWithTaskNamesInSet:(NSSet *)taskNames; -- (ATTask *)taskAtIndex:(NSUInteger)index withTaskNameInSet:(NSSet *)taskNames; -- (void)start; -- (void)stop; - -- (NSString *)queueDescription; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATTaskQueue.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATTaskQueue.m deleted file mode 100755 index a4aa8e5..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/Tasks/ATTaskQueue.m +++ /dev/null @@ -1,288 +0,0 @@ -// -// ATTaskQueue.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/21/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import "ATTaskQueue.h" -#import "ATLog.h" -#import "ATBackend.h" -#import "ATTask.h" - -#define kATTaskQueueCodingVersion 1 -// Retry period in seconds. -#define kATTaskQueueRetryPeriod 180.0 - -#define kMaxFailureCount 30 - -static ATTaskQueue *sharedTaskQueue = nil; - -@interface ATTaskQueue (Private) -- (void)setup; -- (void)teardown; -- (void)archive; -- (void)unsetActiveTask; -@end - -@implementation ATTaskQueue -+ (NSString *)taskQueuePath { - return [[[ATBackend sharedBackend] supportDirectoryPath] stringByAppendingPathComponent:@"tasks.objects"]; -} - -+ (BOOL)serializedQueueExists { - NSFileManager *fm = [NSFileManager defaultManager]; - return [fm fileExistsAtPath:[ATTaskQueue taskQueuePath]]; -} - - -+ (ATTaskQueue *)sharedTaskQueue { - @synchronized(self) { - if (sharedTaskQueue == nil) { - if ([ATTaskQueue serializedQueueExists]) { - @try { - sharedTaskQueue = [[NSKeyedUnarchiver unarchiveObjectWithFile:[ATTaskQueue taskQueuePath]] retain]; - } @catch (NSException *exception) { - ATLogError(@"Unable to unarchive tasks at: %@, exception: %@", [ATTaskQueue taskQueuePath], exception); - sharedTaskQueue = [[ATTaskQueue alloc] init]; - } - } - if (!sharedTaskQueue) { - sharedTaskQueue = [[ATTaskQueue alloc] init]; - } - } - } - return sharedTaskQueue; -} - -+ (void)releaseSharedTaskQueue { - @synchronized(self) { - if (sharedTaskQueue != nil) { - [sharedTaskQueue archive]; - [sharedTaskQueue release]; - sharedTaskQueue = nil; - } - } -} - -- (id)init { - if ((self = [super init])) { - [self setup]; - } - return self; -} - -- (id)initWithCoder:(NSCoder *)coder { - if ((self = [super init])) { - int version = [coder decodeIntForKey:@"version"]; - if (version == kATTaskQueueCodingVersion) { - tasks = [[coder decodeObjectForKey:@"tasks"] retain]; - } else { - [self release]; - return nil; - } - } - return self; -} - -- (void)encodeWithCoder:(NSCoder *)coder { - [coder encodeInt:kATTaskQueueCodingVersion forKey:@"version"]; - @synchronized(self) { - NSMutableArray *archivableTasks = [[NSMutableArray alloc] init]; - for (ATTask *task in tasks) { - if ([task shouldArchive]) { - [archivableTasks addObject:task]; - } - } - [coder encodeObject:archivableTasks forKey:@"tasks"]; - [archivableTasks release], archivableTasks = nil; - } -} - -- (void)dealloc { - [self teardown]; - [super dealloc]; -} - - -- (void)addTask:(ATTask *)task { - @synchronized(self) { - [tasks addObject:task]; - [self archive]; - } - [self start]; -} - -- (NSUInteger)count { - NSUInteger count = 0; - @synchronized(self) { - count = [tasks count]; - } - return count; -} - -- (ATTask *)taskAtIndex:(NSUInteger)index { - @synchronized(self) { - return [tasks objectAtIndex:index]; - } -} - -- (NSUInteger)countOfTasksWithTaskNamesInSet:(NSSet *)taskNames { - NSUInteger count = 0; - @synchronized(self) { - for (ATTask *task in tasks) { - if ([taskNames containsObject:[task taskName]]) { - count++; - } - } - } - return count; -} - -- (ATTask *)taskAtIndex:(NSUInteger)index withTaskNameInSet:(NSSet *)taskNames { - NSMutableArray *accum = [NSMutableArray array]; - @synchronized(self) { - for (ATTask *task in tasks) { - if ([taskNames containsObject:[task taskName]]) { - [accum addObject:task]; - } - } - } - if (index < [accum count]) { - return [accum objectAtIndex:index]; - } - return nil; -} - -- (void)start { - if ([[NSThread currentThread] isMainThread]) { - [self performSelectorInBackground:@selector(start) withObject:nil]; - return; - } - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - @synchronized(self) { - if (activeTask) { - [pool release], pool = nil; - return; - } - - if ([tasks count]) { - for (ATTask *task in tasks) { - if ([task canStart]) { - activeTask = task; - [activeTask addObserver:self forKeyPath:@"finished" options:NSKeyValueObservingOptionNew context:NULL]; - [activeTask addObserver:self forKeyPath:@"failed" options:NSKeyValueObservingOptionNew context:NULL]; - [activeTask start]; - break; - } - } - } - } - [pool release], pool = nil; -} - -- (void)stop { - @synchronized(self) { - [activeTask stop]; - [self unsetActiveTask]; - } -} - -- (NSString *)queueDescription { - NSMutableString *result = [[NSMutableString alloc] init]; - @synchronized(self) { -#if TARGET_OS_IPHONE - [result appendString:[NSString stringWithFormat:@""]; - } - return [result autorelease]; -} - -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { - @synchronized(self) { - if (object != activeTask) return; - ATTask *task = (ATTask *)object; - if ([keyPath isEqualToString:@"finished"] && [task finished]) { - [self unsetActiveTask]; - [task cleanup]; - [tasks removeObject:object]; - [self archive]; - [self start]; - } else if ([keyPath isEqualToString:@"failed"] && [task failed]) { - if (task.isFailureOkay) { - task.failureCount = task.failureCount + 1; - [self unsetActiveTask]; - [tasks removeObject:task]; - [self start]; - } else { - [self stop]; - task.failureCount = task.failureCount + 1; - if (task.failureCount > kMaxFailureCount) { - ATLogError(@"Task %@ failed too many times, removing from queue.", task); - [self unsetActiveTask]; - [task cleanup]; - [tasks removeObject:task]; - [self start]; - } else { - // Put task on back of queue. - [task retain]; - [tasks removeObject:task]; - [tasks addObject:task]; - [task release]; - [self archive]; - - [self performSelector:@selector(start) withObject:nil afterDelay:kATTaskQueueRetryPeriod]; - } - } - } - } -} -@end - -@implementation ATTaskQueue (Private) -- (void)setup { - @synchronized(self) { - tasks = [[NSMutableArray alloc] init]; - } -} - -- (void)teardown { - @synchronized(self) { - [self stop]; - [tasks release], tasks = nil; - [NSObject cancelPreviousPerformRequestsWithTarget:self]; - } -} - -- (void)unsetActiveTask { - @synchronized(self) { - if (activeTask) { - [activeTask removeObserver:self forKeyPath:@"finished"]; - [activeTask removeObserver:self forKeyPath:@"failed"]; - activeTask = nil; - } - } -} - -- (void)archive { - @synchronized(self) { - if (![NSKeyedArchiver archiveRootObject:sharedTaskQueue toFile:[ATTaskQueue taskQueuePath]]) { - ATLogError(@"Unable to archive task queue to: %@", [ATTaskQueue taskQueuePath]); - } - } -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATAPIRequest.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATAPIRequest.h deleted file mode 100755 index 6e7793e..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATAPIRequest.h +++ /dev/null @@ -1,64 +0,0 @@ -// -// ATAPIRequest.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 5/24/11. -// Copyright 2011 Apptentive, Inc. All rights reserved. -// - -#import - -#import "ATURLConnection.h" - -NSString *const ATAPIRequestStatusChanged; - -@class ATAPIRequest; - -typedef enum { - ATAPIRequestReturnTypeData, - ATAPIRequestReturnTypeString, - ATAPIRequestReturnTypeJSON -} ATAPIRequestReturnType; - -@protocol ATAPIRequestDelegate -- (void)at_APIRequestDidFinish:(ATAPIRequest *)request result:(NSObject *)result; -- (void)at_APIRequestDidFail:(ATAPIRequest *)request; -@optional -- (void)at_APIRequestDidProgress:(ATAPIRequest *)request; -@end - -/*! API request for the apptentive.com service. Encapsulates the connection - connection state, completion percentage, etc. */ -@interface ATAPIRequest : NSObject { -@private - ATURLConnection *connection; - NSString *channelName; - BOOL cancelled; - float percentageComplete; - - ATAPIRequestReturnType returnType; - BOOL failed; - NSString *errorTitle; - NSString *errorMessage; - NSString *errorResponse; - NSTimeInterval timeoutInterval; - NSObject *delegate; - - NSTimeInterval expiresMaxAge; -} -@property (nonatomic, assign) ATAPIRequestReturnType returnType; -@property (nonatomic, assign) BOOL failed; -@property (nonatomic, copy) NSString *errorTitle; -@property (nonatomic, copy) NSString *errorMessage; -@property (nonatomic, copy) NSString *errorResponse; -@property (nonatomic, assign) NSTimeInterval timeoutInterval; -@property (nonatomic, assign) NSObject *delegate; - -- (id)initWithConnection:(ATURLConnection *)connection channelName:(NSString *)channelName; -- (void)start; -- (void)cancel; -- (void)showAlert; -- (float)percentageComplete; -- (NSTimeInterval)expiresMaxAge; -@end - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATAPIRequest.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATAPIRequest.m deleted file mode 100755 index 8e4ccdd..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATAPIRequest.m +++ /dev/null @@ -1,206 +0,0 @@ -// -// ATAPIRequest.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 5/24/11. -// Copyright 2011 Apptentive, Inc. All rights reserved. -// - -#import "ATAPIRequest.h" -#import "ATLog.h" -#import "ATConnect.h" -#import "ATConnectionManager.h" -#import "ATURLConnection.h" -#import "PJSONKit.h" - -#if TARGET_OS_IPHONE -#import -#endif - -NSString *const ATAPIRequestStatusChanged = @"ATAPIRequestStatusChanged"; - -@implementation ATAPIRequest -@synthesize returnType, failed, errorTitle, errorMessage, errorResponse, timeoutInterval, delegate; - -- (id)initWithConnection:(ATURLConnection *)aConnection channelName:(NSString *)aChannelName { - if ((self = [super init])) { - connection = [aConnection retain]; - connection.delegate = self; - channelName = [aChannelName retain]; - } - return self; -} - -- (void)dealloc { - self.delegate = nil; - if (connection) { - connection.delegate = nil; - [[ATConnectionManager sharedSingleton] cancelConnection:connection inChannel:channelName]; - [connection release], connection = nil; - } - [errorTitle release], errorTitle = nil; - [errorMessage release], errorMessage = nil; - [errorResponse release], errorResponse = nil; - [channelName release], channelName = nil; - - [super dealloc]; -} - -- (void)start { - @synchronized(self) { - if (connection) { - [[ATConnectionManager sharedSingleton] addConnection:connection toChannel:channelName]; - [[ATConnectionManager sharedSingleton] start]; - } - } -} - -- (void)cancel { - @synchronized(self) { - cancelled = YES; - if (connection) { - [[ATConnectionManager sharedSingleton] cancelConnection:connection inChannel:channelName]; - } - } -} - -- (void)showAlert { - if (self.failed) { -#if TARGET_OS_IPHONE - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:self.errorTitle message:self.errorMessage delegate:self cancelButtonTitle:ATLocalizedString(@"Close", nil) otherButtonTitles:nil]; - [alert show]; - [alert release]; -#endif - } -} - -- (float)percentageComplete { - return percentageComplete; -} - -- (NSTimeInterval)expiresMaxAge { - return expiresMaxAge; -} - -#pragma mark ATURLConnection Delegates -- (void)connectionFinishedSuccessfully:(ATURLConnection *)sender { - @synchronized(self) { - if (cancelled) return; - } - int statusCode = sender.statusCode; - expiresMaxAge = [sender expiresMaxAge]; - switch (statusCode) { - case 200: - case 201: - case 204: - case 400: // rate limit reached - case 403: // whatevs, probably private feed - break; - case 401: - self.failed = YES; - self.errorTitle = ATLocalizedString(@"Authentication Failed", @""); - self.errorMessage = ATLocalizedString(@"Wrong username and/or password.", @""); - break; - case 304: - break; - default: - self.failed = YES; - self.errorTitle = ATLocalizedString(@"Server error.", @""); - self.errorMessage = [NSHTTPURLResponse localizedStringForStatusCode:statusCode]; - break; - } - - NSObject *result = nil; - do { // once - NSData *d = [sender responseData]; - - if (self.failed) { - NSString *responseString = [[NSString alloc] initWithData:d encoding:NSUTF8StringEncoding]; - if (responseString != nil) { - self.errorResponse = responseString; - [responseString release], responseString = nil; - } - ATLogError(@"Connection failed. %@, %@", self.errorTitle, self.errorMessage); - ATLogInfo(@"Status was: %d", sender.statusCode); - ATLogDebug(@"Request was: %@", [connection requestAsString]); - ATLogDebug(@"Response was: %@", responseString); - } - - if (!d) break; - if (self.returnType == ATAPIRequestReturnTypeData) { - result = d; - break; - } - - NSString *s = [[[NSString alloc] initWithData:d encoding:NSUTF8StringEncoding] autorelease]; - if (!s) break; - if (self.returnType == ATAPIRequestReturnTypeString) { - result = s; - break; - } - - if (self.returnType == ATAPIRequestReturnTypeJSON && statusCode != 204) { - id json = [s ATobjectFromJSONString]; - if (!json) { - self.failed = YES; - self.errorTitle = ATLocalizedString(@"Invalid response from server.", @""); - self.errorMessage = ATLocalizedString(@"Server did not return properly formatted JSON.", @""); - } - result = json; - break; - } - } while (NO); - - if (delegate) { - if (self.failed) { - [delegate at_APIRequestDidFail:self]; - } else { - [delegate at_APIRequestDidFinish:self result:result]; - } - } - [[NSNotificationCenter defaultCenter] postNotificationName:ATAPIRequestStatusChanged object:self]; -} - -- (void)connectionFailed:(ATURLConnection *)sender { - @synchronized(self) { - if (cancelled) return; - } - self.failed = YES; - if (sender.failedAuthentication || sender.statusCode == 401) { - self.errorTitle = ATLocalizedString(@"Authentication Failed", @""); - self.errorMessage = ATLocalizedString(@"Wrong username and/or password.", @""); - } else { - self.errorTitle = ATLocalizedString(@"Network Connection Error", @""); - self.errorMessage = [sender.connectionError localizedDescription]; - } - NSData *d = [sender responseData]; - NSString *responseString = [[NSString alloc] initWithData:d encoding:NSUTF8StringEncoding]; - if (responseString != nil) { - self.errorResponse = responseString; - [responseString release], responseString = nil; - } - - /*!!!!! Prefix line with // to debug HTTP stuff. - if (YES) { - NSData *d = [sender responseData]; - NSString *a = [[[NSString alloc] initWithData:d encoding:NSUTF8StringEncoding] autorelease]; - ATLogError(@"Connection failed. %@, %@", self.errorTitle, self.errorMessage); - ATLogInfo(@"Status was: %d", sender.statusCode); - ATLogDebug(@"Request was: %@", [connection requestAsString]); - ATLogDebug(@"Response was: %@", a); - } - // */ - if (delegate) { - [delegate at_APIRequestDidFail:self]; - } - [[NSNotificationCenter defaultCenter] postNotificationName:ATAPIRequestStatusChanged object:self]; -} - -- (void)connectionDidProgress:(ATURLConnection *)sender { - percentageComplete = sender.percentComplete; - if (delegate && [delegate respondsToSelector:@selector(at_APIRequestDidProgress:)]) { - [delegate at_APIRequestDidProgress:self]; - } - [[NSNotificationCenter defaultCenter] postNotificationName:ATAPIRequestStatusChanged object:self]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATConnectionChannel.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATConnectionChannel.h deleted file mode 100755 index 2b171f8..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATConnectionChannel.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// PSURLChannel.h -// -// Created by Andrew Wooster on 12/14/08. -// Copyright 2008 Apptentive, Inc.. All rights reserved. -// - -#import - -@class ATURLConnection; - -@interface ATConnectionChannel : NSObject { - NSInteger maximumConnections; - NSMutableSet *active; - NSMutableArray *waiting; -} -@property (nonatomic, assign) NSInteger maximumConnections; - -- (void)update; -- (void)addConnection:(ATURLConnection *)connection; -- (void)cancelAllConnections; -- (void)cancelConnection:(ATURLConnection *)connection; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATConnectionChannel.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATConnectionChannel.m deleted file mode 100755 index 81ea113..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATConnectionChannel.m +++ /dev/null @@ -1,97 +0,0 @@ -// -// ATConnectionChannel.m -// -// Created by Andrew Wooster on 12/14/08. -// Copyright 2008 Apptentive, Inc.. All rights reserved. -// - -#import "ATConnectionChannel.h" -#import "ATURLConnection.h" -#import "ATURLConnection_Private.h" - -@implementation ATConnectionChannel -@synthesize maximumConnections; - -- (id)init { - if ((self = [super init])) { - maximumConnections = 2; - active = [[NSMutableSet alloc] init]; - waiting = [[NSMutableArray alloc] init]; - return self; - } - return nil; -} - -- (void)update { - if (![[NSThread currentThread] isMainThread]) { - [self performSelectorOnMainThread:@selector(update) withObject:nil waitUntilDone:NO]; - return; - } - - @synchronized(self) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - while ([active count] < maximumConnections && [waiting count] > 0) { - ATURLConnection *loader = [[waiting objectAtIndex:0] retain]; - [active addObject:loader]; - [loader addObserver:self forKeyPath:@"isFinished" options:NSKeyValueObservingOptionNew context:NULL]; - [waiting removeObjectAtIndex:0]; - [loader start]; - [loader release]; - } - [pool release], pool = nil; - } -} - -- (void)addConnection:(ATURLConnection *)connection { - @synchronized(self) { - [waiting addObject:connection]; - [self update]; - } -} - -- (void)cancelAllConnections { - @synchronized (self) { - for (ATURLConnection *loader in active) { - [loader removeObserver:self forKeyPath:@"isFinished"]; - [loader cancel]; - } - [active removeAllObjects]; - for (ATURLConnection *loader in waiting) { - [loader cancel]; - } - [waiting removeAllObjects]; - } -} - -- (void)cancelConnection:(ATURLConnection *)connection { - @synchronized(self) { - if ([active containsObject:connection]) { - [connection removeObserver:self forKeyPath:@"isFinished"]; - [connection cancel]; - [active removeObject:connection]; - } - - if ([waiting containsObject:connection]) { - [connection cancel]; - [waiting removeObject:connection]; - } - } -} - -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { - if ([keyPath isEqual:@"isFinished"] && [(ATURLConnection *)object isFinished]) { - @synchronized(self) { - [object removeObserver:self forKeyPath:@"isFinished"]; - [active removeObject:object]; - } - [self update]; - } -} - -- (void)dealloc { - [self cancelAllConnections]; - [active release]; - [waiting release]; - [super dealloc]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATConnectionManager.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATConnectionManager.h deleted file mode 100755 index 9226fda..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATConnectionManager.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// PSURLManager.h -// -// Created by Andrew Wooster on 12/14/08. -// Copyright 2008 Apptentive, Inc.. All rights reserved. -// - -#import - -@class ATURLConnection; - -@interface ATConnectionManager : NSObject { - NSMutableDictionary *channels; -} -+ (ATConnectionManager *)sharedSingleton; -- (void)start; -- (void)stop; -- (void)addConnection:(ATURLConnection *)connection toChannel:(NSString *)channelName; -- (void)cancelAllConnectionsInChannel:(NSString *)channelName; -- (void)cancelConnection:(ATURLConnection *)connection inChannel:(NSString *)channelName; -- (void)setMaximumActiveConnections:(NSInteger)maximumConnections forChannel:(NSString *)channelName; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATConnectionManager.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATConnectionManager.m deleted file mode 100755 index 89a338b..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATConnectionManager.m +++ /dev/null @@ -1,90 +0,0 @@ -// -// PSURLManager.m -// -// Created by Andrew Wooster on 12/14/08. -// Copyright 2008 Apptentive, Inc.. All rights reserved. -// - -#import "ATConnectionManager.h" -#import "ATConnectionChannel.h" - -static ATConnectionManager *sharedSingleton = nil; - -#define PLACEHOLDER_CHANNEL_NAME @"ATDefaultChannel" - -@interface ATConnectionManager () -- (ATConnectionChannel *)channelForName:(NSString *)channelName; -@end - -@implementation ATConnectionManager -+ (ATConnectionManager *)sharedSingleton { - @synchronized(self) { - if (!sharedSingleton) { - sharedSingleton = [[ATConnectionManager alloc] init]; - } - } - return sharedSingleton; -} - -- (id)init { - if ((self = [super init])) { - channels = [[NSMutableDictionary alloc] init]; - return self; - } - return nil; -} - -- (void)start { - for (ATConnectionChannel *channel in [channels allValues]) { - [channel update]; - } -} - -- (void)stop { - for (ATConnectionChannel *channel in [channels allValues]) { - [channel cancelAllConnections]; - } -} - -- (void)addConnection:(ATURLConnection *)connection toChannel:(NSString *)channelName { - ATConnectionChannel *channel = [self channelForName:channelName]; - [channel addConnection:connection]; -} - -- (void)cancelAllConnectionsInChannel:(NSString *)channelName { - ATConnectionChannel *channel = [self channelForName:channelName]; - [channel cancelAllConnections]; -} - -- (void)cancelConnection:(ATURLConnection *)connection inChannel:(NSString *)channelName { - ATConnectionChannel *channel = [self channelForName:channelName]; - [channel cancelConnection:connection]; -} - -- (void)setMaximumActiveConnections:(NSInteger)maximumConnections forChannel:(NSString *)channelName { - ATConnectionChannel *channel = [self channelForName:channelName]; - channel.maximumConnections = maximumConnections; -} - - -- (ATConnectionChannel *)channelForName:(NSString *)channelName { - if (!channelName) { - channelName = PLACEHOLDER_CHANNEL_NAME; - } - ATConnectionChannel *channel = [channels objectForKey:channelName]; - if (!channel) { - channel = [[ATConnectionChannel alloc] init]; - [channels setObject:channel forKey:channelName]; - [channel release]; - } - return channel; -} - -- (void)dealloc { - [self stop]; - [channels removeAllObjects]; - [channels release]; - channels = nil; - [super dealloc]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATURLConnection.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATURLConnection.h deleted file mode 100755 index 57ce1e8..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATURLConnection.h +++ /dev/null @@ -1,79 +0,0 @@ -// -// ATURLConnection.h -// -// Created by Andrew Wooster on 12/14/08. -// Copyright 2008 Apptentive, Inc.. All rights reserved. -// - -#import - -@protocol ATURLConnectionDelegate; - -@interface ATURLConnection : NSObject { - NSURL *targetURL; - NSObject *delegate; - - NSMutableURLRequest *request; - NSURLConnection *connection; - NSMutableData *data; - BOOL executing; - BOOL finished; - BOOL failed; - BOOL cancelled; - NSTimeInterval timeoutInterval; - NSURLCredential *credential; - - NSMutableDictionary *headers; - NSString *HTTPMethod; - NSData *HTTPBody; - NSInputStream *HTTPBodyStream; - - int statusCode; - BOOL failedAuthentication; - NSError *connectionError; - - float percentComplete; - - NSTimeInterval expiresMaxAge; -} -@property (nonatomic, readonly, copy) NSURL *targetURL; -@property (nonatomic, assign) NSObject *delegate; -@property (nonatomic, retain) NSURLConnection *connection; -@property (nonatomic, assign) BOOL executing; -@property (nonatomic, assign) BOOL finished; -@property (nonatomic, assign) BOOL failed; -@property (nonatomic, readonly) BOOL cancelled; -@property (nonatomic, assign) NSTimeInterval timeoutInterval; -@property (nonatomic, retain) NSURLCredential *credential; -@property (nonatomic, readonly) int statusCode; -@property (nonatomic, readonly) BOOL failedAuthentication; -@property (nonatomic, copy) NSError *connectionError; -@property (nonatomic, assign) float percentComplete; -@property (nonatomic, readonly) NSTimeInterval expiresMaxAge; - -/*! The delegate for this class is a weak reference. */ -- (id)initWithURL:(NSURL *)url delegate:(NSObject *)aDelegate; -- (id)initWithURL:(NSURL *)url; -- (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field; -- (void)removeHTTPHeaderField:(NSString *)field; -- (void)setHTTPMethod:(NSString *)method; -- (void)setHTTPBody:(NSData *)body; -- (void)setHTTPBodyStream:(NSInputStream *)HTTPBodyStream; - -- (void)start; - -- (BOOL)isExecuting; -- (BOOL)isCancelled; -- (BOOL)isFinished; -- (NSData *)responseData; - -- (NSString *)requestAsString; -- (NSDictionary *)headers; -@end - - -@protocol ATURLConnectionDelegate -- (void)connectionFinishedSuccessfully:(ATURLConnection *)sender; -- (void)connectionFailed:(ATURLConnection *)sender; -- (void)connectionDidProgress:(ATURLConnection *)sender; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATURLConnection.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATURLConnection.m deleted file mode 100755 index b1b0962..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATURLConnection.m +++ /dev/null @@ -1,365 +0,0 @@ -// -// ATURLConnection.m -// -// Created by Andrew Wooster on 12/14/08. -// Copyright 2008 Apptentive, Inc.. All rights reserved. -// - -#import "ATURLConnection.h" -#import "ATURLConnection_Private.h" -#import "ATLog.h" -#import "ATUtilities.h" - -@interface ATURLConnection () -- (void)cacheDataIfNeeded; -@end - - -@implementation ATURLConnection -@synthesize targetURL; -@synthesize delegate; -@synthesize connection; -@synthesize executing; -@synthesize finished; -@synthesize cancelled; -@synthesize failed; -@synthesize timeoutInterval; -@synthesize credential; -@synthesize statusCode; -@synthesize failedAuthentication; -@synthesize connectionError; -@synthesize percentComplete; -@synthesize expiresMaxAge; - -- (id)initWithURL:(NSURL *)url { - return [self initWithURL:url delegate:nil]; -} - -- (id)initWithURL:(NSURL *)url delegate:(id)aDelegate { - if ((self = [super init])) { - targetURL = [url copy]; - delegate = aDelegate; - data = [[NSMutableData alloc] init]; - finished = NO; - executing = NO; - failed = NO; - failedAuthentication = NO; - timeoutInterval = 10.0; - - headers = [[NSMutableDictionary alloc] init]; - HTTPMethod = nil; - - statusCode = 0; - percentComplete = 0.0f; - return self; - } - return nil; -} - -- (BOOL)isExecuting { - return self.executing; -} - -- (BOOL)isFinished { - return self.finished; -} - -- (BOOL)isCancelled { - return self.cancelled; -} - -- (NSDictionary *)headers { - return headers; -} - -- (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field { - [headers setValue:value forKey:field]; -} - -- (void)removeHTTPHeaderField:(NSString *)field { - if ([headers objectForKey:field]) { - [headers removeObjectForKey:field]; - } -} - -- (void)setHTTPMethod:(NSString *)method { - if (HTTPMethod != method) { - [HTTPMethod release]; - HTTPMethod = [method retain]; - } -} - -- (void)setHTTPBody:(NSData *)body { - if (HTTPBody != body) { - [HTTPBody release]; - HTTPBody = [body retain]; - } -} - -- (void)setHTTPBodyStream:(NSInputStream *)stream { - if (HTTPBodyStream != stream) { - [HTTPBodyStream release]; - HTTPBodyStream = [stream retain]; - } -} - -- (void)start { - @synchronized (self) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - do { // once - if ([self isCancelled]) { - self.finished = YES; - break; - } - if ([self isFinished]) { - break; - } - if (request) { - [request release], request = nil; - } - request = [[NSMutableURLRequest alloc] initWithURL:self.targetURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:timeoutInterval]; - for (NSString *key in headers) { - [request setValue:[headers objectForKey:key] forHTTPHeaderField:key]; - } - if (HTTPMethod) { - [request setHTTPMethod:HTTPMethod]; - } - if (HTTPBody) { - [request setHTTPBody:HTTPBody]; - } else if (HTTPBodyStream) { - [request setHTTPBodyStream:HTTPBodyStream]; - } - self.connection = [[[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:NO] autorelease]; - [self.connection scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode]; - [self.connection start]; - self.executing = YES; - } while (NO); - [pool drain]; - } -} - -- (NSData *)responseData { - if (data) { - return data; - } - return nil; -} - -#pragma mark Delegate Methods -- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSHTTPURLResponse *)response { - @synchronized (self) { - [data setLength:0]; - if (response ) { - if ([response isKindOfClass:[NSHTTPURLResponse class]]) { - statusCode = response.statusCode; - } else { - statusCode = 200; - } - - NSDictionary *responseHeaders = [response allHeaderFields]; - NSString *cacheControlHeader = [responseHeaders valueForKey:@"Cache-Control"]; - if (cacheControlHeader) { - expiresMaxAge = [ATUtilities maxAgeFromCacheControlHeader:cacheControlHeader]; - } else { - expiresMaxAge = 0; - } - } - } -} -- (void)connection:(NSURLConnection *)aConnection didFailWithError:(NSError *)error { - @synchronized (self) { - self.failed = YES; - self.finished = YES; - self.executing = NO; - if (error) { - self.connectionError = error; - } - if (delegate && [delegate respondsToSelector:@selector(connectionFailed:)]){ - [delegate performSelectorOnMainThread:@selector(connectionFailed:) withObject:self waitUntilDone:YES]; - } else { - ATLogError(@"Orphaned connection. No delegate or nonresponsive delegate."); - } - } -} - -- (void)connection:(NSURLConnection *)aConnection didReceiveData:(NSData *)someData { - @synchronized (self) { - [data appendData:someData]; - } -} - -- (void)connectionDidFinishLoading:(NSURLConnection *)aConnection { - @synchronized (self) { - if (data && !failed) { - if (delegate != nil && ![self isCancelled]) { - self.percentComplete = 1.0f; - [self cacheDataIfNeeded]; - if (delegate && [delegate respondsToSelector:@selector(connectionFinishedSuccessfully:)]){ - [delegate performSelectorOnMainThread:@selector(connectionFinishedSuccessfully:) withObject:self waitUntilDone:YES]; - } else { - ATLogError(@"Orphaned connection. No delegate or nonresponsive delegate."); - } - } - [data release]; - data = nil; - } else if (delegate && ![self isCancelled]) { - if (delegate && [delegate respondsToSelector:@selector(connectionFailed:)]){ - [delegate performSelectorOnMainThread:@selector(connectionFailed:) withObject:self waitUntilDone:YES]; - } else { - ATLogError(@"Orphaned connection. No delegate or nonresponsive delegate."); - } - } - self.executing = NO; - self.finished = YES; - } -} - --(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { - @synchronized (self) { - if (credential && [challenge previousFailureCount] == 0) { - [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge]; - } else { - failedAuthentication = YES; - [[challenge sender] cancelAuthenticationChallenge:challenge]; - } - } -} - -- (void)connection:(NSURLConnection *)connection didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { - @synchronized (self) { - self.failed = YES; - self.finished = YES; - self.executing = NO; - failedAuthentication = YES; - if (delegate && [delegate respondsToSelector:@selector(connectionFailed:)]){ - [delegate performSelectorOnMainThread:@selector(connectionFailed:) withObject:self waitUntilDone:YES]; - } else { - ATLogError(@"Orphaned connection. No delegate or nonresponsive delegate."); - } - } -} - -- (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite { - if (delegate && [delegate respondsToSelector:@selector(connectionDidProgress:)]) { - self.percentComplete = ((float)totalBytesWritten)/((float) totalBytesExpectedToWrite); - [delegate performSelectorOnMainThread:@selector(connectionDidProgress:) withObject:self waitUntilDone:YES]; - } else { - ATLogError(@"Orphaned connection. No delegate or nonresponsive delegate."); - } -} - -- (NSCachedURLResponse *)connection:(NSURLConnection *)aConnection willCacheResponse:(NSCachedURLResponse *)cachedResponse { - // See: http://blackpixel.com/blog/1659/caching-and-nsurlconnection/ - NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)[cachedResponse response]; - NSURLRequest *r = nil; -#if TARGET_OS_IPHONE - if ([aConnection respondsToSelector:@selector(currentRequest)]) { - r = [aConnection currentRequest]; - } -#endif -#if TARGET_OS_MAC - if (request) { - r = request; - } -#endif - if (r != nil && [r cachePolicy] == NSURLRequestUseProtocolCachePolicy) { - NSDictionary *responseHeaders = [httpResponse allHeaderFields]; - NSString *cacheControlHeader = [responseHeaders valueForKey:@"Cache-Control"]; - NSString *expiresHeader = [responseHeaders valueForKey:@"Expires"]; - if ((cacheControlHeader == nil) && (expiresHeader == nil)) { - return nil; - } - } - return cachedResponse; -} - -- (NSURLRequest *)connection:(NSURLConnection *)inConnection willSendRequest:(NSURLRequest *)inRequest redirectResponse: (NSURLResponse *)inRedirectResponse { - if (inRedirectResponse) { - NSMutableURLRequest *r = [[request mutableCopy] autorelease]; - [r setURL:[inRequest URL]]; - return r; - } else { - return inRequest; - } -} - -- (void)setExecuting:(BOOL)isExecuting { - [self willChangeValueForKey:@"isExecuting"]; - executing = isExecuting; - [self didChangeValueForKey:@"isExecuting"]; -} - -- (void)setFinished:(BOOL)isFinished { - [self willChangeValueForKey:@"isFinished"]; - finished = isFinished; - [self didChangeValueForKey:@"isFinished"]; -} - -- (void)cacheDataIfNeeded { - -} - -- (void)dealloc { - @synchronized (self) { - delegate = nil; - [request release], request = nil; - [targetURL release]; - if (connection) { - [connection release]; - } - [data release]; - data = nil; - - if (credential) { - [credential release]; - } - if (connectionError) { - [connectionError release]; - } - - [headers release]; - [HTTPMethod release]; - [HTTPBody release], HTTPBody = nil; - [HTTPBodyStream release], HTTPBodyStream = nil; - } - [super dealloc]; -} - -- (NSString *)requestAsString { - NSMutableString *result = [NSMutableString string]; - [result appendFormat:@"%@ %@\n", HTTPMethod ? HTTPMethod : @"GET", [targetURL absoluteURL]]; - for (NSString *key in headers) { - NSString *value = [headers valueForKey:key]; - [result appendFormat:@"%@: %@\n", key, value]; - } - [result appendString:@"\n\n"]; - if (HTTPBody) { - NSString *a = [[[NSString alloc] initWithData:HTTPBody encoding:NSUTF8StringEncoding] autorelease]; - if (a) { - [result appendString:a]; - } else { - [result appendFormat:@"", (long)[HTTPBody length]]; - } - } else if (HTTPBodyStream) { - [result appendString:@""]; - } - return result; -} -@end - -@implementation ATURLConnection (Private) -- (void)cancel { - @synchronized (self) { - if (self.finished) { - return; - } - delegate = nil; - if (connection) { - [connection cancel]; - } - self.executing = NO; - cancelled = YES; - } -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATURLConnection_Private.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATURLConnection_Private.h deleted file mode 100755 index 2c7a35c..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATURLConnection_Private.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// ATURLConnection_Private.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 5/24/11. -// Copyright 2011 Apptentive, Inc. All rights reserved. -// - -#import - -#import "ATURLConnection.h" - -@interface ATURLConnection (Private) -/*! It's important nobody but ATURLConnection and ATConnectionChannel call this - selector. */ -- (void)cancel; -@end - -void ATURLConnection_Private_Bootstrap(); diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATURLConnection_Private.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATURLConnection_Private.m deleted file mode 100755 index 64e2a0e..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATURLConnection_Private.m +++ /dev/null @@ -1,11 +0,0 @@ -// -// ATURLConnection_Private.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 12/07/12. -// Copyright 2012 Apptentive, Inc. All rights reserved. -// - -void ATURLConnection_Private_Bootstrap() { - NSLog(@"Loading ATURLConnection_Private_Bootstrap"); -} diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATWebClient.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATWebClient.h deleted file mode 100755 index 51a6f0b..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATWebClient.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// ATWebClient.h -// apptentive-ios -// -// Created by Andrew Wooster on 7/28/09. -// Copyright 2009 Apptentive, Inc.. All rights reserved. -// - -#import - -@class ATFeedback; -@class ATAPIRequest; - -extern NSString *const ATWebClientDefaultChannelName; - -/*! Singleton for generating API requests. */ -@interface ATWebClient : NSObject { -} -+ (ATWebClient *)sharedClient; -- (NSString *)baseURLString; -- (NSString *)commonChannelName; -- (ATAPIRequest *)requestForPostingFeedback:(ATFeedback *)feedback; -- (ATAPIRequest *)requestForGettingAppConfiguration; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATWebClient.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATWebClient.m deleted file mode 100755 index c8520d3..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATWebClient.m +++ /dev/null @@ -1,382 +0,0 @@ -// -// ATWebClient.m -// apptentive-ios -// -// Created by Andrew Wooster on 7/28/09. -// Copyright 2009 Apptentive, Inc.. All rights reserved. -// - -#import "ATWebClient.h" -#import "ATWebClient_Private.h" -#import "ATLog.h" -#import "ATAPIRequest.h" -#import "ATURLConnection.h" - -#import "ATBackend.h" -#import "ATConnect.h" -#import "ATFeedback.h" -#import "ATURLConnection.h" -#import "ATUtilities.h" -#import "ATWebClient_Private.h" - -#import "PJSONKit.h" - -#import "NSData+ATBase64.h" - -NSString *const ATWebClientDefaultChannelName = @"ATWebClient"; - -#define kUserAgentFormat (@"ApptentiveConnect/%@ (%@)") - -#if USE_STAGING -#define kApptentiveBaseURL (@"http://api.apptentive-beta.com") -#else -#define kApptentiveBaseURL (@"https://api.apptentive.com") -#endif - -@implementation ATWebClient -+ (ATWebClient *)sharedClient { - static ATWebClient *sharedSingleton = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedSingleton = [[ATWebClient alloc] init]; - }); - return sharedSingleton; -} - -- (NSString *)baseURLString { - return kApptentiveBaseURL; -} - -- (NSString *)commonChannelName { - return ATWebClientDefaultChannelName; -} - -- (ATAPIRequest *)requestForPostingFeedback:(ATFeedback *)feedback { - NSDictionary *postData = [feedback apiDictionary]; - NSString *url = [self apiURLStringWithPath:@"records"]; - ATURLConnection *conn = nil; - - if ([feedback hasScreenshot]) { - NSData *fileData = [feedback dataForScreenshot]; - conn = [self connectionToPost:[NSURL URLWithString:url] withFileData:fileData ofMimeType:@"image/png" fileDataKey:@"record[file][screenshot]" parameters:postData]; - } else { - conn = [self connectionToPost:[NSURL URLWithString:url] parameters:postData]; - } - conn.timeoutInterval = 240.0; - ATAPIRequest *request = [[ATAPIRequest alloc] initWithConnection:conn channelName:[self commonChannelName]]; - request.returnType = ATAPIRequestReturnTypeData; - return [request autorelease]; -} - -- (ATAPIRequest *)requestForGettingAppConfiguration { - NSString *uuid = [[ATBackend sharedBackend] deviceUUID]; - NSString *urlString = [self apiURLStringWithPath:[NSString stringWithFormat:@"devices/%@/configuration", uuid]]; - ATURLConnection *conn = [self connectionToGet:[NSURL URLWithString:urlString]]; - conn.timeoutInterval = 20.0; - ATAPIRequest *request = [[ATAPIRequest alloc] initWithConnection:conn channelName:[self commonChannelName]]; - request.returnType = ATAPIRequestReturnTypeJSON; - return [request autorelease]; -} -@end - - -@implementation ATWebClient (Private) - -- (NSString *)stringForParameters:(NSDictionary *)parameters { - NSMutableString *result = [[NSMutableString alloc] init]; - do { // once - if (!parameters || [parameters count] == 0) { - [result appendString:@""]; - break; - } - - BOOL appendAmpersand = NO; - for (NSString *key in [parameters keyEnumerator]) { - NSString *val = [self stringForParameter:[parameters objectForKey:key]]; - if (!val) continue; - - if (appendAmpersand) { - [result appendString:@"&"]; - } - [result appendString:[ATUtilities stringByEscapingForURLArguments:key]]; - [result appendString:@"="]; - [result appendString:[ATUtilities stringByEscapingForURLArguments:val]]; - appendAmpersand = YES; - } - } while (NO); - return [result autorelease]; -} - -- (NSString *)stringForParameter:(id)value { - NSString *result = nil; - if ([value isKindOfClass:[NSString class]]) { - result = (NSString *)value; - } else if ([value isKindOfClass:[NSNumber class]]) { - result = [(NSNumber *)value stringValue]; - } - return result; -} - - -- (NSString *)apiBaseURLString { - return kApptentiveBaseURL; -} - -- (NSString *)apiURLStringWithPath:(NSString *)path { - return [NSString stringWithFormat:@"%@/%@", kApptentiveBaseURL, path]; -} - -- (NSString *)userAgentString { - return [NSString stringWithFormat:kUserAgentFormat, kATConnectVersionString, kATConnectPlatformString]; -} - -- (ATURLConnection *)connectionToGet:(NSURL *)theURL { - ATURLConnection *conn = [[ATURLConnection alloc] initWithURL:theURL]; - [self addAPIHeaders:conn]; - return [conn autorelease]; -} - -- (ATURLConnection *)connectionToPost:(NSURL *)theURL { - ATURLConnection *conn = [[ATURLConnection alloc] initWithURL:theURL]; - [self addAPIHeaders:conn]; - [conn setHTTPMethod:@"POST"]; - return [conn autorelease]; -} - -- (ATURLConnection *)connectionToPost:(NSURL *)theURL JSON:(NSString *)body { - ATURLConnection *conn = [[ATURLConnection alloc] initWithURL:theURL]; - [self addAPIHeaders:conn]; - [conn setHTTPMethod:@"POST"]; - [conn setValue:@"application/json; charset=utf-8" forHTTPHeaderField:@"Content-Type"]; - int length = [body lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; - [conn setValue:[NSString stringWithFormat:@"%d", length] forHTTPHeaderField:@"Content-Length"]; - [conn setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]]; - return [conn autorelease]; -} - -- (ATURLConnection *)connectionToPost:(NSURL *)theURL parameters:(NSDictionary *)parameters { - NSDictionary *postParameters = [NSMutableDictionary dictionaryWithDictionary:parameters]; - NSString *bodyString = [self stringForParameters:postParameters]; - return [self connectionToPost:theURL body:bodyString]; -} - -- (ATURLConnection *)connectionToPost:(NSURL *)theURL body:(NSString *)body { - ATURLConnection *conn = [[ATURLConnection alloc] initWithURL:theURL]; - [self addAPIHeaders:conn]; - [conn setHTTPMethod:@"POST"]; - [conn setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; - int length = [body lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; - [conn setValue:[NSString stringWithFormat:@"%d", length] forHTTPHeaderField:@"Content-Length"]; - [conn setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]]; - return [conn autorelease]; -} - -- (ATURLConnection *)connectionToPost:(NSURL *)theURL withFileData:(NSData *)data ofMimeType:(NSString *)mimeType fileDataKey:(NSString *)fileDataKey parameters:(NSDictionary *)parameters { - ATURLConnection *conn = [[ATURLConnection alloc] initWithURL:theURL]; - [self addAPIHeaders:conn]; - [conn setHTTPMethod:@"POST"]; - - NSDictionary *postParameters = [NSMutableDictionary dictionaryWithDictionary:parameters]; - - // Figure out boundary string. - NSString *boundary = nil; - while (YES) { - boundary = [ATUtilities randomStringOfLength:20]; - NSData *boundaryData = [boundary dataUsingEncoding:NSUTF8StringEncoding]; - BOOL found = NO; - for (NSString *key in [postParameters allKeys]) { - id value = [postParameters objectForKey:key]; - if ([value isKindOfClass:[NSString class]]) { - NSRange range = [(NSString *)value rangeOfString:boundary]; - if (range.location != NSNotFound) { - found = YES; - break; - } - } else if ([value isKindOfClass:[NSData class]]) { - NSRange range = [(NSData *)value rangeOfData:boundaryData options:0 range:NSMakeRange(0, [(NSData *)value length])]; - if (range.location != NSNotFound) { - found = YES; - break; - } - } else { - NSString *className = @"id"; - if ([value isKindOfClass:[NSObject class]]) { - className = [NSString stringWithCString:object_getClassName((NSObject *)value) encoding:NSUTF8StringEncoding]; - } - [conn release], conn = nil; - @throw [NSException exceptionWithName:@"ATWebClientException" reason:[NSString stringWithFormat:@"Can't encode form data of class: %@", className] userInfo:nil]; - } - } - if (!found) { - break; - } - } - - NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; charset=utf-8; boundary=%@", boundary]; - [conn setValue:contentType forHTTPHeaderField:@"Content-Type"]; - - - NSMutableData *multipartEncodedData = [NSMutableData data]; - if (data) { - [postParameters setValue:data forKey:fileDataKey]; - } - - [multipartEncodedData appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; - for (NSString *key in [postParameters allKeys]) { - id value = [postParameters objectForKey:key]; - [multipartEncodedData appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; - if ([value isKindOfClass:[NSString class]]) { - [multipartEncodedData appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"\r\n\r\n", key] dataUsingEncoding:NSUTF8StringEncoding]]; - [multipartEncodedData appendData:[(NSString *)value dataUsingEncoding:NSUTF8StringEncoding]]; - } else if ([value isKindOfClass:[NSData class]]) { - [multipartEncodedData appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"; filename=\"%@\"\r\n", key, [ATUtilities randomStringOfLength:10]] dataUsingEncoding:NSUTF8StringEncoding]]; - [multipartEncodedData appendData:[[NSString stringWithFormat:@"Content-Type: %@\r\n", mimeType] dataUsingEncoding:NSUTF8StringEncoding]]; - [multipartEncodedData appendData:[@"Content-Transfer-Encoding: binary\r\n\r\n" dataUsingEncoding:NSASCIIStringEncoding]]; - [multipartEncodedData appendData:(NSData *)value]; - } // else Should be handled above. - } - [multipartEncodedData appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; - [conn setHTTPBody:multipartEncodedData]; - - // Debugging helpers: - /* - NSLog(@"wtf parameters: %@", parameters); - NSLog(@"-length: %d", [multipartEncodedData length]); - NSLog(@"-data: %@", [NSString stringWithUTF8String:[multipartEncodedData bytes]]); - */ - return [conn autorelease]; -} - -- (ATURLConnection *)connectionToPost:(NSURL *)theURL JSON:(NSString *)body withFile:(NSString *)path ofMimeType:(NSString *)mimeType { - ATURLConnection *conn = [[ATURLConnection alloc] initWithURL:theURL]; - [self addAPIHeaders:conn]; - [conn setHTTPMethod:@"POST"]; - - NSFileManager *fm = [NSFileManager defaultManager]; - - NSData *fileData = nil; - if (path && [fm fileExistsAtPath:path]) { - NSError *error = nil; - fileData = [NSData dataWithContentsOfFile:path options:NSDataReadingMappedIfSafe error:&error]; - if (!fileData) { - ATLogError(@"Unable to get contents of file path for uploading: %@", error); - // This is probably unrecoverable. - goto fail; - } - } - - - // Figure out boundary string. - NSString *boundary = nil; - while (YES) { - boundary = [ATUtilities randomStringOfLength:20]; - NSData *boundaryData = [boundary dataUsingEncoding:NSUTF8StringEncoding]; - - if (body) { - NSRange range = [body rangeOfString:boundary]; - if (range.location != NSNotFound) { - continue; - } - } - if (fileData != nil) { - NSRange range = [fileData rangeOfData:boundaryData options:0 range:NSMakeRange(0, [fileData length])]; - if (range.location != NSNotFound) { - continue; - } - } - break; - } - - NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary]; - [conn setValue:contentType forHTTPHeaderField:@"Content-Type"]; - - - NSMutableData *multipartEncodedData = [NSMutableData data]; - //[multipartEncodedData appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; - NSMutableString *debugString = [NSMutableString string]; - - for (NSString *key in [conn headers]) { - [debugString appendFormat:@"%@: %@\n", key, [[conn headers] objectForKey:key]]; - } - [debugString appendString:@"\n"]; - - - if (body) { - NSMutableString *bodyHeader = [NSMutableString string]; - [bodyHeader appendString:[NSString stringWithFormat:@"--%@\r\n", boundary]]; - [bodyHeader appendString:[NSString stringWithFormat:@"Content-Type: %@\r\n", @"text/plain"]]; - [bodyHeader appendString:[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"\r\n\r\n", @"message"]]; - [debugString appendString:bodyHeader]; - - [multipartEncodedData appendData:[bodyHeader dataUsingEncoding:NSUTF8StringEncoding]]; - [multipartEncodedData appendData:[(NSString *)body dataUsingEncoding:NSUTF8StringEncoding]]; - [debugString appendString:body]; - } - NSString *boundaryString = [NSString stringWithFormat:@"\r\n--%@\r\n", boundary]; - [multipartEncodedData appendData:[boundaryString dataUsingEncoding:NSUTF8StringEncoding]]; - - [debugString appendString:boundaryString]; - - if (fileData != nil) { - NSString *filename = [path lastPathComponent]; - NSMutableString *multipartHeader = [NSMutableString string]; - [multipartHeader appendString:[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"; filename=\"%@\"\r\n", @"file", filename]]; - [multipartHeader appendString:[NSString stringWithFormat:@"Content-Type: %@\r\n", mimeType]]; - [multipartHeader appendString:@"Content-Transfer-Encoding: binary\r\n\r\n"]; - [debugString appendString:multipartHeader]; - - [multipartEncodedData appendData:[multipartHeader dataUsingEncoding:NSUTF8StringEncoding]]; - [multipartEncodedData appendData:fileData]; -#if TARGET_OS_IPHONE - [debugString appendFormat:@"", [fileData length]]; -#elif TARGET_OS_MAC - [debugString appendFormat:@"", (unsigned long)[fileData length]]; -#endif - } - NSString *finalBoundary = [NSString stringWithFormat:@"\r\n--%@--\r\n", boundary]; - [multipartEncodedData appendData:[finalBoundary dataUsingEncoding:NSUTF8StringEncoding]]; - [debugString appendString:finalBoundary]; - - //NSLog(@"\n%@", debugString); - - [conn setHTTPBody:multipartEncodedData]; - - // Debugging helpers: - /* - NSLog(@"wtf parameters: %@", parameters); - NSLog(@"-length: %d", [multipartEncodedData length]); - NSLog(@"-data: %@", [NSString stringWithUTF8String:[multipartEncodedData bytes]]); - */ - return [conn autorelease]; - -fail: - [conn release], conn = nil; - return nil; -} - -- (ATURLConnection *)connectionToPut:(NSURL *)theURL JSON:(NSString *)body { - ATURLConnection *conn = [self connectionToPost:theURL JSON:body]; - [conn setHTTPMethod:@"PUT"]; - return conn; -} - -- (void)addAPIHeaders:(ATURLConnection *)conn { - [conn setValue:[self userAgentString] forHTTPHeaderField:@"User-Agent"]; - [conn setValue: @"gzip" forHTTPHeaderField: @"Accept-Encoding"]; - [conn setValue: @"text/xml" forHTTPHeaderField: @"Accept"]; - [conn setValue: @"utf-8" forHTTPHeaderField: @"Accept-Charset"]; - NSString *apiKey = [[ATBackend sharedBackend] apiKey]; - if (apiKey) { - [self updateConnection:conn withOAuthToken:apiKey]; - } -} - -- (void)updateConnection:(ATURLConnection *)conn withOAuthToken:(NSString *)token { - if (token) { - NSString *value = [NSString stringWithFormat:@"OAuth %@", token]; - [conn setValue:value forHTTPHeaderField:@"Authorization"]; - } else { - [conn removeHTTPHeaderField:@"Authorization"]; - } -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATWebClient_Private.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATWebClient_Private.h deleted file mode 100755 index b076339..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATWebClient_Private.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// ATWebClient_Private.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 11/4/11. -// Copyright (c) 2011 Apptentive, Inc. All rights reserved. -// - -#import - -@class ATURLConnection; -@class ATWebClient; - -@interface ATWebClient (Private) -- (NSString *)userAgentString; - -#pragma mark API URL String -- (NSString *)apiBaseURLString; -- (NSString *)apiURLStringWithPath:(NSString *)path; - -#pragma mark Query Parameter Encoding -- (NSString *)stringForParameters:(NSDictionary *)parameters; -- (NSString *)stringForParameter:(id)value; - -#pragma mark Internal Methods -- (ATURLConnection *)connectionToGet:(NSURL *)theURL; -- (ATURLConnection *)connectionToPost:(NSURL *)theURL; -- (ATURLConnection *)connectionToPost:(NSURL *)theURL JSON:(NSString *)body; -- (ATURLConnection *)connectionToPost:(NSURL *)theURL parameters:(NSDictionary *)parameters; -- (ATURLConnection *)connectionToPost:(NSURL *)theURL body:(NSString *)body; -- (ATURLConnection *)connectionToPost:(NSURL *)theURL withFileData:(NSData *)data ofMimeType:(NSString *)mimeType fileDataKey:(NSString *)fileDataKey parameters:(NSDictionary *)parameters; -- (ATURLConnection *)connectionToPost:(NSURL *)theURL JSON:(NSString *)body withFile:(NSString *)path ofMimeType:(NSString *)mimeType; -- (ATURLConnection *)connectionToPut:(NSURL *)theURL JSON:(NSString *)body; -- (void)addAPIHeaders:(ATURLConnection *)conn; -- (void)updateConnection:(ATURLConnection *)conn withOAuthToken:(NSString *)token; -@end - -void ATWebClient_Private_Bootstrap(); diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATWebClient_Private.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATWebClient_Private.m deleted file mode 100755 index 566649f..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/source/URL Loading/ATWebClient_Private.m +++ /dev/null @@ -1,11 +0,0 @@ -// -// ATWebClient_Private.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 12/07/12. -// Copyright 2012 Apptentive, Inc. All rights reserved. -// - -void ATWebClient_Private_Bootstrap() { - NSLog(@"Loading ATWebClient_Private_Bootstrap"); -} diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ATRatingPredicateTests.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ATRatingPredicateTests.h deleted file mode 100755 index 91f32a0..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ATRatingPredicateTests.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// ATRatingPredicateTests.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/20/12. -// Copyright (c) 2012 Apptentive, Inc. All rights reserved. -// - -#import -#import "ATAppRatingFlow.h" -#import "ATAppRatingFlow_Private.h" - -@interface ATRatingPredicateTests : SenTestCase -- (void)testPredicateStrings; -- (void)testDefaultPredicate1; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ATRatingPredicateTests.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ATRatingPredicateTests.m deleted file mode 100755 index f3a7702..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ATRatingPredicateTests.m +++ /dev/null @@ -1,137 +0,0 @@ -// -// ATRatingPredicateTests.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 3/20/12. -// Copyright (c) 2012 Apptentive, Inc. All rights reserved. -// - -#import "ATRatingPredicateTests.h" - -@implementation ATRatingPredicateTests -- (void)predicateForObject:(NSObject *)promptObject shouldEqualString:(NSString *)result { - BOOL hasError = NO; - NSString *predicateString = [ATAppRatingFlow_Private predicateStringForPromptLogic:promptObject withPredicateInfo:nil hasError:&hasError]; - STAssertEqualObjects(predicateString, result, [NSString stringWithFormat:@"%@ doesn't match %@", predicateString, result]); -} - -- (NSDictionary *)defaultPromptLogic { - NSDictionary *innerPromptLogic = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:@"events", @"uses", nil], @"or", nil]; - NSDictionary *defaultPromptLogic = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:@"days", innerPromptLogic, nil], @"and", nil]; - return defaultPromptLogic; -} - -- (NSDictionary *)allAndLogic { - return [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:@"days", @"events", @"uses", nil], @"and", nil]; -} - -- (NSDictionary *)allOrLogic { - return [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:@"days", @"events", @"uses", nil], @"or", nil]; -} - -- (void)testPredicateStrings { - [self predicateForObject:[self defaultPromptLogic] shouldEqualString:@"((now >= nextPromptDate) AND ((significantEvents >= significantEventsBeforePrompt) OR (appUses >= usesBeforePrompt)))"]; - [self predicateForObject:[self allAndLogic] shouldEqualString:@"((now >= nextPromptDate) AND (significantEvents >= significantEventsBeforePrompt) AND (appUses >= usesBeforePrompt))"]; - [self predicateForObject:[self allOrLogic] shouldEqualString:@"((now >= nextPromptDate) OR (significantEvents >= significantEventsBeforePrompt) OR (appUses >= usesBeforePrompt))"]; - - - ATAppRatingFlowPredicateInfo *info = [[ATAppRatingFlowPredicateInfo alloc] init]; - info.daysBeforePrompt = 0; - info.significantEventsBeforePrompt = 5; - info.usesBeforePrompt = 20; - - STAssertEqualObjects([ATAppRatingFlow_Private predicateStringForPromptLogic:[self allAndLogic] withPredicateInfo:info hasError:nil], @"((significantEvents >= significantEventsBeforePrompt) AND (appUses >= usesBeforePrompt))", @"Predicate should not contain disabled parameter."); - STAssertEqualObjects([ATAppRatingFlow_Private predicateStringForPromptLogic:[self allOrLogic] withPredicateInfo:info hasError:nil], @"((significantEvents >= significantEventsBeforePrompt) OR (appUses >= usesBeforePrompt))", @"Predicate should not contain disabled parameter."); - - - info.daysBeforePrompt = 1; - info.significantEventsBeforePrompt = 0; - STAssertEqualObjects([ATAppRatingFlow_Private predicateStringForPromptLogic:[self allAndLogic] withPredicateInfo:info hasError:nil], @"((now >= nextPromptDate) AND (appUses >= usesBeforePrompt))", @"Predicate should not contain disabled parameter."); - STAssertEqualObjects([ATAppRatingFlow_Private predicateStringForPromptLogic:[self allOrLogic] withPredicateInfo:info hasError:nil], @"((now >= nextPromptDate) OR (appUses >= usesBeforePrompt))", @"Predicate should not contain disabled parameter."); - - info.significantEventsBeforePrompt = 5; - info.usesBeforePrompt = 0; - STAssertEqualObjects([ATAppRatingFlow_Private predicateStringForPromptLogic:[self allAndLogic] withPredicateInfo:info hasError:nil], @"((now >= nextPromptDate) AND (significantEvents >= significantEventsBeforePrompt))", @"Predicate should not contain disabled parameter."); - STAssertEqualObjects([ATAppRatingFlow_Private predicateStringForPromptLogic:[self allOrLogic] withPredicateInfo:info hasError:nil], @"((now >= nextPromptDate) OR (significantEvents >= significantEventsBeforePrompt))", @"Predicate should not contain disabled parameter."); - - [info release], info = nil; -} - -- (void)testDefaultPredicate1 { - ATAppRatingFlowPredicateInfo *info = [[ATAppRatingFlowPredicateInfo alloc] init]; - info.daysBeforePrompt = 0; - info.significantEventsBeforePrompt = 5; - info.significantEvents = 4; - info.usesBeforePrompt = 20; - info.appUses = 3; - NSPredicate *predicate = [ATAppRatingFlow_Private predicateForPromptLogic:[self defaultPromptLogic] withPredicateInfo:info]; - STAssertFalse([ATAppRatingFlow_Private evaluatePredicate:predicate withPredicateInfo:info], @"Predicate should not be true."); - - info.significantEvents = 6; - predicate = [ATAppRatingFlow_Private predicateForPromptLogic:[self defaultPromptLogic] withPredicateInfo:info]; - STAssertTrue([ATAppRatingFlow_Private evaluatePredicate:predicate withPredicateInfo:info], @"Predicate should be true."); - - info.appUses = 21; - predicate = [ATAppRatingFlow_Private predicateForPromptLogic:[self defaultPromptLogic] withPredicateInfo:info]; - STAssertTrue([ATAppRatingFlow_Private evaluatePredicate:predicate withPredicateInfo:info], @"Predicate should be true."); - - info.significantEvents = 4; - predicate = [ATAppRatingFlow_Private predicateForPromptLogic:[self defaultPromptLogic] withPredicateInfo:info]; - STAssertTrue([ATAppRatingFlow_Private evaluatePredicate:predicate withPredicateInfo:info], @"Predicate should be true."); - - [info release], info = nil; -} - -- (void)testAllAndPredicate { - ATAppRatingFlowPredicateInfo *info = [[ATAppRatingFlowPredicateInfo alloc] init]; - info.daysBeforePrompt = 30; - info.significantEventsBeforePrompt = 10; - info.significantEvents = 4; - info.usesBeforePrompt = 5; - info.appUses = 3; - NSPredicate *predicate = [ATAppRatingFlow_Private predicateForPromptLogic:[self allAndLogic] withPredicateInfo:info]; - STAssertFalse([ATAppRatingFlow_Private evaluatePredicate:predicate withPredicateInfo:info], @"Predicate should not be true."); - - info.firstUse = [NSDate dateWithTimeInterval:-1.0*(31*60*60*24) sinceDate:[NSDate date]]; - info.significantEvents = 11; - info.appUses = 6; - predicate = [ATAppRatingFlow_Private predicateForPromptLogic:[self allAndLogic] withPredicateInfo:info]; - - STAssertTrue([ATAppRatingFlow_Private evaluatePredicate:predicate withPredicateInfo:info], @"Predicate should be true."); - - - info.firstUse = [NSDate dateWithTimeInterval:-1.0*(10*60*60*24) sinceDate:[NSDate date]]; - predicate = [ATAppRatingFlow_Private predicateForPromptLogic:[self allAndLogic] withPredicateInfo:info]; - - STAssertFalse([ATAppRatingFlow_Private evaluatePredicate:predicate withPredicateInfo:info], @"Predicate should not be true."); - [info release], info = nil; -} - -- (void)testOrPredicates { - ATAppRatingFlowPredicateInfo *info = [[ATAppRatingFlowPredicateInfo alloc] init]; - info.daysBeforePrompt = 15; - info.significantEventsBeforePrompt = 0; - info.significantEvents = 0; - info.usesBeforePrompt = 10; - info.appUses = 3; - NSPredicate *predicate = [ATAppRatingFlow_Private predicateForPromptLogic:[self allOrLogic] withPredicateInfo:info]; - STAssertFalse([ATAppRatingFlow_Private evaluatePredicate:predicate withPredicateInfo:info], @"Predicate should not be true."); - - NSPredicate *missingClause = [ATAppRatingFlow_Private predicateForPromptLogic:[NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:@"days", @"uses", nil], @"or", nil] withPredicateInfo:info]; - STAssertFalse([ATAppRatingFlow_Private evaluatePredicate:missingClause withPredicateInfo:info], @"Predicate should not be true."); - info.appUses = 11; - missingClause = [ATAppRatingFlow_Private predicateForPromptLogic:[NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:@"days", @"uses", nil], @"or", nil] withPredicateInfo:info]; - STAssertTrue([ATAppRatingFlow_Private evaluatePredicate:missingClause withPredicateInfo:info], @"Predicate should be true."); - info.appUses = 3; - missingClause = [ATAppRatingFlow_Private predicateForPromptLogic:[NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:@"days", @"uses", nil], @"or", nil] withPredicateInfo:info]; - - NSPredicate *noClauses = [ATAppRatingFlow_Private predicateForPromptLogic:[NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:nil], @"or", nil] withPredicateInfo:nil]; - STAssertTrue(noClauses == nil, @"noClauses should be nil"); - [info release], info = nil; -} - -- (void)testNilInfo { - NSPredicate *predicate = [ATAppRatingFlow_Private predicateForPromptLogic:[self allOrLogic] withPredicateInfo:nil]; - STAssertNotNil(predicate, @"Should be able to validate predicate with nil info."); -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ATUtilitiesTests.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ATUtilitiesTests.h deleted file mode 100755 index 91b10d9..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ATUtilitiesTests.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// ATUtilitiesTests.h -// ApptentiveConnect -// -// Created by Andrew Wooster on 4/15/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// -// See Also: http://developer.apple.com/iphone/library/documentation/Xcode/Conceptual/iphone_development/135-Unit_Testing_Applications/unit_testing_applications.html - -#import -#import -#import "ATUtilities.h" - -@interface ATUtilitiesTests : SenTestCase { - -} -- (void)testEvenRect; -- (void)testDateFormatting; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ATUtilitiesTests.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ATUtilitiesTests.m deleted file mode 100755 index 87d2660..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ATUtilitiesTests.m +++ /dev/null @@ -1,83 +0,0 @@ -// -// ATUtilitiesTests.m -// ApptentiveConnect -// -// Created by Andrew Wooster on 4/15/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import "ATUtilitiesTests.h" - - -@implementation ATUtilitiesTests -- (void)testEvenRect { - CGRect testRect1 = CGRectMake(0.0, 0.0, 17.0, 21.0); - CGRect result1 = ATCGRectOfEvenSize(testRect1); - STAssertEquals(result1.size.width, (CGFloat)18.0, @""); - STAssertEquals(result1.size.height, (CGFloat)22.0, @""); - - CGRect testRect2 = CGRectMake(0.0, 0.0, 18.0, 22.0); - CGRect result2 = ATCGRectOfEvenSize(testRect2); - STAssertEquals(result2.size.width, (CGFloat)18.0, @""); - STAssertEquals(result2.size.height, (CGFloat)22.0, @""); -} - -- (void)testDateFormatting { - // This test will only pass when the time zone is PST. *sigh* - NSDate *date = [NSDate dateWithTimeIntervalSince1970:1322609978.669914]; - STAssertEqualObjects(@"2011-11-29 15:39:38.669914 -0800", [ATUtilities stringRepresentationOfDate:date timeZone:[NSTimeZone timeZoneForSecondsFromGMT:-8*60*60]], @"date doesn't match"); - - date = [NSDate dateWithTimeIntervalSince1970:1322609978.669]; - STAssertEqualObjects(@"2011-11-29 15:39:38.669 -0800", [ATUtilities stringRepresentationOfDate:date timeZone:[NSTimeZone timeZoneForSecondsFromGMT:-8*60*60]], @"date doesn't match"); - - date = [NSDate dateWithTimeIntervalSince1970:1322609978.0]; - STAssertEqualObjects(@"2011-11-29 15:39:38 -0800", [ATUtilities stringRepresentationOfDate:date timeZone:[NSTimeZone timeZoneForSecondsFromGMT:-8*60*60]], @"date doesn't match"); - - date = [NSDate dateWithTimeIntervalSince1970:1322609978.0]; - STAssertEqualObjects(@"2011-11-29 23:39:38 +0000", [ATUtilities stringRepresentationOfDate:date timeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]], @"date doesn't match"); - - NSString *string = @"2012-09-07T23:01:07+00:00"; - date = [ATUtilities dateFromISO8601String:string]; - STAssertNotNil(date, @"date shouldn't be nil"); - STAssertEqualObjects(@"2012-09-07 23:01:07 +0000", [ATUtilities stringRepresentationOfDate:date timeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]], @"date doesn't match"); - - string = @"2012-09-07T23:01:07Z"; - date = [ATUtilities dateFromISO8601String:string]; - STAssertNotNil(date, @"date shouldn't be nil"); - STAssertEqualObjects(@"2012-09-07 23:01:07 +0000", [ATUtilities stringRepresentationOfDate:date timeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]], @"date doesn't match"); - - string = @"2012-09-07T23:01:07.111+00:00"; - date = [ATUtilities dateFromISO8601String:string]; - STAssertNotNil(date, @"date shouldn't be nil"); - STAssertEqualObjects(@"2012-09-07 23:01:07 +0000", [ATUtilities stringRepresentationOfDate:date timeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]], @"date doesn't match"); - - string = @"2012-09-07T23:01:07.111+02:33"; - date = [ATUtilities dateFromISO8601String:string]; - STAssertNotNil(date, @"date shouldn't be nil"); - STAssertEqualObjects(@"2012-09-07 20:28:07 +0000", [ATUtilities stringRepresentationOfDate:date timeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]], @"date doesn't match"); -} - -- (void)testVersionComparisons { - STAssertTrue([ATUtilities versionString:@"6.0" isEqualToVersionString:@"6.0"], @"Should be same"); - STAssertTrue([ATUtilities versionString:@"0.0" isEqualToVersionString:@"0.0"], @"Should be same"); - STAssertTrue([ATUtilities versionString:@"6.0.1" isEqualToVersionString:@"6.0.1"], @"Should be same"); - STAssertTrue([ATUtilities versionString:@"0.0.1" isEqualToVersionString:@"0.0.1"], @"Should be same"); - STAssertTrue([ATUtilities versionString:@"10.10.1" isEqualToVersionString:@"10.10.1"], @"Should be same"); - - STAssertTrue([ATUtilities versionString:@"10.10.1" isGreaterThanVersionString:@"10.10.0"], @"Should be greater"); - STAssertTrue([ATUtilities versionString:@"6.0" isGreaterThanVersionString:@"5.0.1"], @"Should be greater"); - STAssertTrue([ATUtilities versionString:@"6.0" isGreaterThanVersionString:@"5.1"], @"Should be greater"); - - STAssertTrue([ATUtilities versionString:@"5.0" isLessThanVersionString:@"5.1"], @"Should be less"); - STAssertTrue([ATUtilities versionString:@"5.0" isLessThanVersionString:@"6.0.1"], @"Should be less"); -} - -- (void)testCacheControlParsing { - STAssertEquals(0., [ATUtilities maxAgeFromCacheControlHeader:nil], @"Should be same"); - STAssertEquals(0., [ATUtilities maxAgeFromCacheControlHeader:@""], @"Should be same"); - STAssertEquals(86400., [ATUtilities maxAgeFromCacheControlHeader:@"Cache-Control: max-age=86400, private"], @"Should be same"); - STAssertEquals(86400., [ATUtilities maxAgeFromCacheControlHeader:@"max-age=86400, private"], @"Should be same"); - STAssertEquals(47.47, [ATUtilities maxAgeFromCacheControlHeader:@"max-age=47.47, private"], @"Should be same"); - STAssertEquals(0., [ATUtilities maxAgeFromCacheControlHeader:@"max-age=0, private"], @"Should be same"); -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveConnectTests-Info.plist b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveConnectTests-Info.plist deleted file mode 100755 index f74d065..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveConnectTests-Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.${PRODUCT_NAME:rfc1034identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveConnectTests-Prefix.pch b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveConnectTests-Prefix.pch deleted file mode 100755 index 14134f3..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveConnectTests-Prefix.pch +++ /dev/null @@ -1,8 +0,0 @@ -// -// Prefix header for all source files of the 'ApptentiveConnectTests' target in the 'ApptentiveConnectTests' project -// - -#ifdef __OBJC__ - #import - #import "ATLog.h" -#endif diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveConnectTests.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveConnectTests.h deleted file mode 100755 index 8e0f9fc..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveConnectTests.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// ApptentiveConnectTests.h -// ApptentiveConnectTests -// -// Created by Andrew Wooster on 3/18/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import - - -@interface ApptentiveConnectTests : SenTestCase { -@private - -} - -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveConnectTests.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveConnectTests.m deleted file mode 100755 index 9f9fcb2..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveConnectTests.m +++ /dev/null @@ -1,29 +0,0 @@ -// -// ApptentiveConnectTests.m -// ApptentiveConnectTests -// -// Created by Andrew Wooster on 3/18/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import "ApptentiveConnectTests.h" - - -@implementation ApptentiveConnectTests - -- (void)setUp { - [super setUp]; - - // Set-up code here. -} - -- (void)tearDown { - // Tear-down code here. - - [super tearDown]; -} - -- (void)testExample { -} - -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveMetricsTests.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveMetricsTests.h deleted file mode 100755 index 76fa5c1..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveMetricsTests.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ApptentiveMetricsTests.h -// ApptentiveMetricsTests -// -// Created by Andrew Wooster on 12/27/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import - -@interface ApptentiveMetricsTests : SenTestCase - -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveMetricsTests.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveMetricsTests.m deleted file mode 100755 index dc04196..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveMetricsTests.m +++ /dev/null @@ -1,25 +0,0 @@ -// -// ApptentiveMetricsTests.m -// ApptentiveMetricsTests -// -// Created by Andrew Wooster on 12/27/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import "ApptentiveMetricsTests.h" - -@implementation ApptentiveMetricsTests - -- (void)setUp { - [super setUp]; - - // Set-up code here. -} - -- (void)tearDown { - // Tear-down code here. - - [super tearDown]; -} - -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveSurveysTests.h b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveSurveysTests.h deleted file mode 100755 index 2ca3b5c..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveSurveysTests.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ApptentiveSurveysTests.h -// ApptentiveSurveysTests -// -// Created by Andrew Wooster on 11/4/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import - -@interface ApptentiveSurveysTests : SenTestCase - -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveSurveysTests.m b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveSurveysTests.m deleted file mode 100755 index d5df4a6..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/ApptentiveSurveysTests.m +++ /dev/null @@ -1,71 +0,0 @@ -// -// ApptentiveSurveysTests.m -// ApptentiveSurveysTests -// -// Created by Andrew Wooster on 11/4/11. -// Copyright (c) 2011 Apptentive. All rights reserved. -// - -#import "ApptentiveSurveysTests.h" -#import "ATSurvey.h" -#import "ATSurveyParser.h" -#import "ATSurveyQuestion.h" - -@implementation ApptentiveSurveysTests - -- (void)setUp -{ - [super setUp]; - - // Set-up code here. -} - -- (void)tearDown -{ - // Tear-down code here. - - [super tearDown]; -} - -- (void)testSurveyParsing { - NSString *surveyString = @"{\"surveys\":[{\"id\":\"4eb4877cd4d8f8000100002a\",\"questions\":[{\"id\":\"4eb4877cd4d8f8000100002b\",\"answer_choices\":[{\"id\":\"4eb4877cd4d8f8000100002c\",\"value\":\"BMW 335i\"},{\"id\":\"4eb4877cd4d8f8000100002d\",\"value\":\"BMW 335i\"},{\"id\":\"4eb4877cd4d8f8000100002e\",\"value\":\"Bugatti Veyron\"},{\"id\":\"4eb4877cd4d8f8000100002f\",\"value\":\"Tesla Model S\"},{\"id\":\"4eb4877cd4d8f80001000030\",\"value\":\"Dodge Charger\"},{\"id\":\"4eb4877cd4d8f80001000031\",\"value\":\"Other\"}],\"value\":\"Which car would you rather drive?\",\"type\":\"multichoice\"},{\"id\":\"4eb4877cd4d8f80001000032\",\"value\":\"If Other, Please Elaborate:\",\"type\":\"singleline\"},{\"id\":\"4eb4877cd4d8f80001000033\",\"value\":\"How does a really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really long question appear?\",\"type\":\"singleline\"}],\"responses\":[{\"question\":\"Which car would you rather drive?\",\"type\":\"multichoice\",\"responses\":{}},{\"question\":\"If Other, Please Elaborate:\",\"type\":\"singleline\",\"responses\":[]},{\"question\":\"How does a really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really long question appear?\",\"type\":\"singleline\",\"responses\":[]}],\"name\":\"Happy Fun Test Survey\",\"description\":\"This is a fun test survey with a description like this.\",\"active\":true}]}"; - NSData *surveyData = [surveyString dataUsingEncoding:NSUTF8StringEncoding]; - STAssertNotNil(surveyData, @"Survey data shouldn't be nil"); - - ATSurveyParser *parser = [[ATSurveyParser alloc] init]; - NSArray *surveys = [parser parseMultipleSurveys:surveyData]; - - STAssertTrue([surveys count] == 1, @"Should only be 1 survey"); - - ATSurvey *survey = [surveys objectAtIndex:0]; - STAssertTrue([survey.identifier isEqualToString:@"4eb4877cd4d8f8000100002a"], @"id mismatch"); - STAssertTrue([survey.name isEqualToString:@"Happy Fun Test Survey"], @"name mismatch"); - STAssertTrue([survey.surveyDescription isEqualToString:@"This is a fun test survey with a description like this."], @"description mismatch"); - STAssertTrue(survey.isActive, @"Survey should be active"); - STAssertTrue([[survey questions] count] == 3 , @"Should be 3 questions"); - STAssertTrue([survey surveyHasNoTags], @"Survey shouldn't have any tags."); - - [survey addTag:@"video"]; - [survey addTag:@"played"]; - NSSet *goodSet = [NSSet setWithObjects:@"video", @"played", nil]; - NSSet *badSet = [NSSet setWithObjects:@"video", @"paused", nil]; - STAssertTrue([survey surveyHasTags:goodSet], @"Survey should have some tags."); - STAssertFalse([survey surveyHasTags:badSet], @"Survey should not have these tags."); - - ATSurveyQuestion *question = [[survey questions] objectAtIndex:0]; - STAssertTrue([question.answerChoices count] == 6, @"First question should have 6 answers"); - - [parser release], parser = nil; -} - -- (void)testEmptySurvey { - NSString *surveyString = @"{\"surveys\":[]}"; - NSData *surveyData = [surveyString dataUsingEncoding:NSUTF8StringEncoding]; - STAssertNotNil(surveyData, @"Survey data shouldn't be nil"); - - ATSurveyParser *parser = [[ATSurveyParser alloc] init]; - NSArray *surveys = [parser parseMultipleSurveys:surveyData]; - STAssertNotNil(surveys, @"shouldn't be nil"); - STAssertTrue([surveys count] == 0, @"Should be zero surveys"); -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/en.lproj/InfoPlist.strings b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/en.lproj/InfoPlist.strings deleted file mode 100755 index 477b28f..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/tests/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/xibs/ATAboutApptentiveView.xib b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/xibs/ATAboutApptentiveView.xib deleted file mode 100755 index 90ca510..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/xibs/ATAboutApptentiveView.xib +++ /dev/null @@ -1,443 +0,0 @@ - - - - 1536 - 12C60 - 2844 - 1187.34 - 625.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 1930 - - - YES - IBProxyObject - IBUIButton - IBUIImageView - IBUITextView - IBUIView - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 290 - - YES - - - 293 - {{20, 5}, {299, 56}} - - - - - 3 - MCAwAA - - NO - 9 - 2 - NO - IBCocoaTouchFramework - - - - 290 - {{10, 69}, {318, 97}} - - - - - NO - YES - YES - NO - IBCocoaTouchFramework - NO - Apptentive is an in-app feedback mechanism which allows app developers to quickly get feedback from customers. - - 2 - IBCocoaTouchFramework - - - 1 - 17 - - - Helvetica - 17 - 16 - - - - - 290 - {{10, 163}, {318, 37}} - - - - - NO - IBCocoaTouchFramework - 0 - 0 - Find out more at apptentive.com - - 3 - MQA - - - 1 - MC4xOTYwNzg0MzE0IDAuMzA5ODAzOTIxNiAwLjUyMTU2ODYyNzUAA - - - 3 - MC41AA - - - 2 - 16 - - - Helvetica-Bold - 16 - 16 - - - - - 290 - {{10, 302}, {318, 23}} - - - - - NO - IBCocoaTouchFramework - 0 - 0 - Go to Apptentive's Privacy Policy - - - 1 - MC4xOTYwNzg0MzE0IDAuMzA5ODAzOTIxNiAwLjUyMTU2ODYyNzUAA - - - - 2 - 13 - - - Helvetica-Bold - 13 - 16 - - - - - 290 - {{20, 208}, {299, 86}} - - - - _NS:9 - - NO - YES - YES - IBCocoaTouchFramework - NO - Your feedback is hosted by Apptentive and is subject to Apptentive's privacy policy and the privacy policy of the developer of this app. - - 2 - IBCocoaTouchFramework - - - 1 - 14 - - - Helvetica - 14 - 16 - - - - {339, 345} - - - - _NS:9 - - NO - IBCocoaTouchFramework - - - - - YES - - - headerView - - - - 20 - - - - openApptentiveDotCom: - - - 7 - - 9 - - - - openApptentiveDotCom: - - - 7 - - 22 - - - - openPrivacyPolicy: - - - 7 - - 23 - - - - - YES - - 0 - - YES - - - - - - -1 - - - File's Owner - - - -2 - - - - - 17 - - - YES - - - - - - - - - - 3 - - - - - 4 - - - - - 8 - - - - - 21 - - - - - 24 - - - - - - - YES - - YES - -1.CustomClassName - -1.IBPluginDependency - -2.CustomClassName - -2.IBPluginDependency - 17.IBPluginDependency - 21.IBPluginDependency - 24.IBPluginDependency - 3.IBPluginDependency - 4.IBPluginDependency - 8.IBPluginDependency - - - YES - ATInfoViewController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - - - - YES - - - - - 24 - - - - YES - - ATInfoViewController - UIViewController - - YES - - YES - done: - openApptentiveDotCom: - openPrivacyPolicy: - - - YES - id - id - id - - - - YES - - YES - done: - openApptentiveDotCom: - openPrivacyPolicy: - - - YES - - done: - id - - - openApptentiveDotCom: - id - - - openPrivacyPolicy: - id - - - - - YES - - YES - headerView - progressCell - tableView - - - YES - UIView - UITableViewCell - UITableView - - - - YES - - YES - headerView - progressCell - tableView - - - YES - - headerView - UIView - - - progressCell - UITableViewCell - - - tableView - UITableView - - - - - IBProjectSource - ./Classes/ATInfoViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - 3 - 1930 - - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/xibs/ATFeedbackController.xib b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/xibs/ATFeedbackController.xib deleted file mode 100755 index 7279378..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/xibs/ATFeedbackController.xib +++ /dev/null @@ -1,810 +0,0 @@ - - - - 1552 - 12C60 - 3084 - 1187.34 - 625.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 2083 - - - YES - IBProxyObject - IBUIBarButtonItem - IBUIImageView - IBUILabel - IBUITextField - IBUITextView - IBUIToolbar - IBUIView - IBUIViewController - IBUIWindow - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 292 - - YES - - - 290 - - YES - - - 290 - {302, 44} - - - - NO - NO - IBCocoaTouchFramework - 2 - - YES - - IBCocoaTouchFramework - - 5 - - - IBCocoaTouchFramework - - 5 - - - - - - 274 - - YES - - - 290 - {302, 5} - - - - - 3 - MQA - - 2 - - - NO - IBCocoaTouchFramework - - - - 294 - {{8, 5}, {211, 31}} - - - - NO - YES - IBCocoaTouchFramework - 0 - - Email Address (optional) - - 3 - MAA - - - YES - 17 - - 1 - 7 - 4 - IBCocoaTouchFramework - - 1 - - Helvetica-Bold - Helvetica - 2 - 14 - - - Helvetica-Bold - 14 - 16 - - - - - 290 - {{0, 36}, {302, 3}} - - - - - 3 - MQA - - - NO - IBCocoaTouchFramework - - - - 268 - - YES - - - 292 - {{2, 3}, {17, 17}} - - - - NO - NO - IBCocoaTouchFramework - - - - 292 - {{22, 0}, {256, 21}} - - - NO - YES - 7 - NO - IBCocoaTouchFramework - Feedback Powered by Apptentive - - 3 - MC42NjY2NjY2NjY3AA - - - - 3 - MQA - - {0, 1} - 1 - 10 - - 1 - 13 - - - Helvetica - 13 - 16 - - - - {{6, 164}, {276, 23}} - - - - - 3 - MCAwAA - - NO - IBCocoaTouchFramework - - - - 274 - - YES - - - 274 - {202, 129} - - - - - NO - YES - IBCocoaTouchFramework - Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. - - 2 - IBCocoaTouchFramework - - - 1 - 17 - - - Helvetica - 17 - 16 - - - - {{0, 36}, {302, 129}} - - - - - YES - IBCocoaTouchFramework - - - {{0, 44}, {301, 193}} - - - - - NO - 1009 - IBCocoaTouchFramework - - - {{8, 32}, {302, 237}} - - - - - 1 - MC45NDEzMzM1MzQ0IDEgMC43MTQ5Nzc4NjcxAA - - IBCocoaTouchFramework - - - {320, 480} - - - - - NO - NO - - 1 - - IBCocoaTouchFramework - YES - - - - - 1 - 1 - - IBCocoaTouchFramework - NO - - - - - YES - - - view - - - - 3 - - - - window - - - - 14 - - - - toolbar - - - - 17 - - - - redLineView - - - - 31 - - - - emailField - - - - 47 - - - - grayLineView - - - - 34 - - - - logoImageView - - - - 39 - - - - logoControl - - - - 37 - - - - feedbackView - - - - 48 - - - - feedbackContainerView - - - - 64 - - - - taglineLabel - - - - 65 - - - - showInfoView: - - - 7 - - 51 - - - - - YES - - 0 - - YES - - - - - - -1 - - - File's Owner - - - -2 - - - - - 12 - - - YES - - - - - 13 - - - YES - - - - Window - - - 1 - - - YES - - - - - View - - - 4 - - - YES - - - - - - - 18 - - - - - 7 - - - - - 63 - - - YES - - - - - - - - Container View - - - 30 - - - Red Dotted Line - - - 46 - - - - - 33 - - - YES - - - Gray Line - - - 36 - - - YES - - - - - - - 62 - - - - - 38 - - - - - 27 - - - YES - - - - Text Input Containing View - - - 24 - - - - - - - YES - - YES - -1.CustomClassName - -1.IBPluginDependency - -2.CustomClassName - -2.IBPluginDependency - 1.IBPluginDependency - 12.IBPluginDependency - 13.IBPluginDependency - 18.IBPluginDependency - 24.CustomClassName - 24.IBPluginDependency - 27.IBPluginDependency - 30.IBPluginDependency - 33.IBPluginDependency - 36.CustomClassName - 36.IBPluginDependency - 38.IBPluginDependency - 4.CustomClassName - 4.IBPluginDependency - 46.IBPluginDependency - 62.IBPluginDependency - 63.IBPluginDependency - 7.IBPluginDependency - - - YES - ATFeedbackController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - ATDefaultTextView - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIControl - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - ATToolbar - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - - - - YES - - - - - 65 - - - - YES - - ATDefaultTextView - UITextView - - IBProjectSource - ./Classes/ATDefaultTextView.h - - - - ATFeedbackController - UIViewController - - YES - - YES - cancelFeedback: - donePressed: - photoPressed: - showInfoView: - - - YES - id - id - id - id - - - - YES - - YES - cancelFeedback: - donePressed: - photoPressed: - showInfoView: - - - YES - - cancelFeedback: - id - - - donePressed: - id - - - photoPressed: - id - - - showInfoView: - id - - - - - YES - - YES - backgroundView - doneButton - emailField - feedbackContainerView - feedbackView - grayLineView - logoControl - logoImageView - redLineView - scrollView - taglineLabel - toolbar - window - - - YES - UIView - UIBarButtonItem - UITextField - UIView - ATDefaultTextView - UIView - UIControl - UIImageView - UIView - UIScrollView - UILabel - ATToolbar - UIWindow - - - - YES - - YES - backgroundView - doneButton - emailField - feedbackContainerView - feedbackView - grayLineView - logoControl - logoImageView - redLineView - scrollView - taglineLabel - toolbar - window - - - YES - - backgroundView - UIView - - - doneButton - UIBarButtonItem - - - emailField - UITextField - - - feedbackContainerView - UIView - - - feedbackView - ATDefaultTextView - - - grayLineView - UIView - - - logoControl - UIControl - - - logoImageView - UIImageView - - - redLineView - UIView - - - scrollView - UIScrollView - - - taglineLabel - UILabel - - - toolbar - ATToolbar - - - window - UIWindow - - - - - IBProjectSource - ./Classes/ATFeedbackController.h - - - - ATToolbar - UIToolbar - - IBProjectSource - ./Classes/ATToolbar.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - 3 - 2083 - - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/xibs/ATInfoViewController.xib b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/xibs/ATInfoViewController.xib deleted file mode 100755 index c08b089..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/xibs/ATInfoViewController.xib +++ /dev/null @@ -1,577 +0,0 @@ - - - - 1056 - 10J567 - 851 - 1038.35 - 462.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 141 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - - YES - - - 274 - {{0, 44}, {320, 416}} - - - 10 - - 549453824 - {84, 1} - - YES - - YES - - - - TU0AKgAAAVjFzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/ -y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/ -xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/ -xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/ -xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/ -xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P8ADQEAAAMAAAABAFQAAAEB -AAMAAAABAAEAAAECAAMAAAAEAAAB+gEDAAMAAAABAAEAAAEGAAMAAAABAAIAAAERAAQAAAABAAAACAES -AAMAAAABAAEAAAEVAAMAAAABAAQAAAEWAAMAAAABAAEAAAEXAAQAAAABAAABUAEcAAMAAAABAAEAAAFS -AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA - - - - - - 3 - MCAwAA - - - groupTableViewBackgroundColor - - YES - IBCocoaTouchFramework - YES - 1 - 1 - 0 - YES - 44 - 10 - 10 - - - - 290 - {320, 44} - - IBCocoaTouchFramework - - YES - - - About Apptentive - - Okay - IBCocoaTouchFramework - 2 - - - IBCocoaTouchFramework - - - - - {320, 460} - - - 3 - MQA - - 2 - - - - IBCocoaTouchFramework - - - - - YES - - - tableView - - - - 4 - - - - view - - - - 5 - - - - done: - - - - 9 - - - - - YES - - 0 - - - - - - 1 - - - YES - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 3 - - - - - 6 - - - YES - - - - - - 7 - - - YES - - - - - - 8 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 1.IBEditorWindowLastContentRect - 1.IBPluginDependency - 3.IBPluginDependency - 6.IBPluginDependency - 7.IBPluginDependency - 8.IBPluginDependency - - - YES - ATInfoViewController - UIResponder - {{6, 238}, {320, 480}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 14 - - - - YES - - ATInfoViewController - UIViewController - - done: - id - - - done: - - done: - id - - - - YES - - YES - headerView - progressCell - tableView - - - YES - UIView - UITableViewCell - UITableView - - - - YES - - YES - headerView - progressCell - tableView - - - YES - - headerView - UIView - - - progressCell - UITableViewCell - - - tableView - UITableView - - - - - IBProjectSource - source/Controllers/ATInfoViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIBarButtonItem - UIBarItem - - IBFrameworkSource - UIKit.framework/Headers/UIBarButtonItem.h - - - - UIBarItem - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIBarItem.h - - - - UINavigationBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UINavigationBar.h - - - - UINavigationItem - NSObject - - - - UIResponder - NSObject - - - - UIScrollView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIScrollView.h - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UITableView - UIScrollView - - IBFrameworkSource - UIKit.framework/Headers/UITableView.h - - - - UITableViewCell - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITableViewCell.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIPrintFormatter.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../ApptentiveConnect.xcodeproj - 3 - 141 - - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/xibs/ATInfoViewController_iPad.xib b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/xibs/ATInfoViewController_iPad.xib deleted file mode 100755 index abcbbd6..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/xibs/ATInfoViewController_iPad.xib +++ /dev/null @@ -1,515 +0,0 @@ - - - - 1056 - 10J567 - 851 - 1038.35 - 462.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 141 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBIPadFramework - - - IBFirstResponder - IBIPadFramework - - - - 274 - - YES - - - 290 - {{2, 2}, {768, 44}} - - IBIPadFramework - - YES - - - About Apptentive - - Okay - IBIPadFramework - 2 - - - IBIPadFramework - - - - - - 274 - {{2, 46}, {766, 958}} - - - 1 - MCAwIDAgMAA - - YES - IBIPadFramework - YES - 1 - 1 - 0 - YES - 44 - 10 - 10 - - - {768, 1004} - - - 3 - MQA - - 2 - - - - 2 - - IBIPadFramework - - - - - YES - - - done: - - - - 7 - - - - view - - - - 9 - - - - tableView - - - - 10 - - - - - YES - - 0 - - - - - - 1 - - - YES - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 4 - - - YES - - - - - - 5 - - - YES - - - - - - 6 - - - - - 8 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 1.IBEditorWindowLastContentRect - 1.IBPluginDependency - 4.IBPluginDependency - 5.IBPluginDependency - 6.IBPluginDependency - 8.IBPluginDependency - - - YES - ATInfoViewController - UIResponder - {{19, -225}, {783, 852}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 10 - - - - YES - - ATInfoViewController - UIViewController - - done: - id - - - done: - - done: - id - - - - tableView - UITableView - - - tableView - - tableView - UITableView - - - - IBProjectSource - source/Controllers/ATInfoViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIBarButtonItem - UIBarItem - - IBFrameworkSource - UIKit.framework/Headers/UIBarButtonItem.h - - - - UIBarItem - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIBarItem.h - - - - UINavigationBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UINavigationBar.h - - - - UINavigationItem - NSObject - - - - UIResponder - NSObject - - - - UIScrollView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIScrollView.h - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UITableView - UIScrollView - - IBFrameworkSource - UIKit.framework/Headers/UITableView.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIPrintFormatter.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBIPadFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../ApptentiveConnect.xcodeproj - 3 - 141 - - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/xibs/ATSimpleImageViewController.xib b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/xibs/ATSimpleImageViewController.xib deleted file mode 100755 index fd03f1e..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/xibs/ATSimpleImageViewController.xib +++ /dev/null @@ -1,270 +0,0 @@ - - - - 1296 - 11E53 - 2182 - 1138.47 - 569.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 1181 - - - IBUINavigationItem - IBUIBarButtonItem - IBUIView - IBUINavigationBar - IBProxyObject - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - - - - 290 - {320, 44} - - - - IBCocoaTouchFramework - - - - Screenshot - - IBCocoaTouchFramework - 1 - - 15 - - - IBCocoaTouchFramework - 2 - - 0 - - IBCocoaTouchFramework - - - - - - 274 - {{0, 44}, {320, 416}} - - - - 3 - MQA - - 2 - - - IBCocoaTouchFramework - - - {{0, 20}, {320, 460}} - - - - - 3 - MQA - - - - IBCocoaTouchFramework - - - - - - - containerView - - - - 13 - - - - view - - - - 14 - - - - cameraButtonItem - - - - 16 - - - - donePressed: - - - - 11 - - - - takePhoto: - - - - 15 - - - - - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 3 - - - - - - - - - 4 - - - - - - - - 6 - - - - - - - - - 7 - - - - - 8 - - - - - 9 - - - - - - - ATSimpleImageViewController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - - 16 - - - - - ATSimpleImageViewController - UIViewController - - id - id - - - - donePressed: - id - - - takePhoto: - id - - - - UIBarButtonItem - UIView - - - - cameraButtonItem - UIBarButtonItem - - - containerView - UIView - - - - IBProjectSource - ./Classes/ATSimpleImageViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - YES - 3 - 1181 - - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/xibs/ATTaskProgressCell.xib b/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/xibs/ATTaskProgressCell.xib deleted file mode 100755 index ff9f10a..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/ApptentiveConnect/xibs/ATTaskProgressCell.xib +++ /dev/null @@ -1,264 +0,0 @@ - - - - 1280 - 10K549 - 1938 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 933 - - - YES - IBUIProgressView - IBUITableViewCell - IBUILabel - IBProxyObject - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 292 - - YES - - - 256 - - YES - - - 266 - {{6, 26}, {305, 9}} - - NO - 2 - IBCocoaTouchFramework - - - - 290 - {{6, 3}, {305, 21}} - - NO - YES - 7 - 1 - NO - IBCocoaTouchFramework - Label - - 1 - MCAwIDAAA - - - 3 - MQA - - 1 - 10 - - 1 - 17 - - - Helvetica - 17 - 16 - - - - - 292 - {{6, 23}, {305, 18}} - - NO - YES - 7 - 4 - NO - IBCocoaTouchFramework - Label - - 2 - MC41Mjk0MTE3OTI4IDAuNTI5NDExNzkyOCAwLjUyOTQxMTc5MjgAA - - - 1 - 10 - - Helvetica - Helvetica - 0 - 14 - - - Helvetica - 14 - 16 - - - - {320, 43} - - - 3 - MCAwAA - - NO - YES - 4 - YES - IBCocoaTouchFramework - - - {320, 44} - - - 1 - MSAxIDEAA - - IBCocoaTouchFramework - 0 - - - - - - YES - - - progressCell - - - - 6 - - - - - YES - - 0 - - YES - - - - - - -1 - - - File's Owner - - - -2 - - - - - 3 - - - YES - - - - - - progressCell - - - 4 - - - Big Label - - - 5 - - - - - 7 - - - Detail Label - - - - - YES - - YES - -1.CustomClassName - -1.IBPluginDependency - -2.CustomClassName - -2.IBPluginDependency - 3.IBPluginDependency - 4.IBPluginDependency - 5.IBPluginDependency - 7.IBPluginDependency - - - YES - ATInfoViewController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - - - - YES - - - - - 7 - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - 3 - 933 - - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/CHANGELOG.md b/Clocker/ApptentiveConnect/apptentive-ios/CHANGELOG.md deleted file mode 100755 index 2bafddf..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/CHANGELOG.md +++ /dev/null @@ -1,241 +0,0 @@ -2013-06-07 wooster v0.4.9 -------------------------- -We've finally added support for surveys with tags. - -- To check for surveys, call `ATSurveys +(void)checkForAvailableSurveys` as usual. -- Listen for the `ATSurveyNewSurveyAvailableNotification`. -- Check to see if surveys with a given set of tags are available with `ATSurveys +(BOOL)hasSurveyAvailableWithTags:(NSSet *)tags`. -- Display a survey with tags with: `ATSurveys +(void)presentSurveyControllerWithTags:(NSSet *)tags fromViewController:(UIViewController *)viewController`. - -Other fixes: - -* Fixes IOS-105 Add Russian Localization - * Thanks to Захаров Дмитрий for the translation! -* Fixes IOS-120 Get localizations for iOS Client strings -* Fixes IOS-63 Implement new client API for surveys (survey tags) -* Fixes IOS-106 Limit connections to 2 at once - * This prevents a potential problem in situations where the number of connections is limited. See [the problem AFNetworking+TestFlight hit](https://github.com/AFNetworking/AFNetworking/issues/307). -* Fixes IOS-92 Demo app should show a message when the API key is not set - * This will hopefully be a nice reminder, rather than an irritation. -* Fixes IOS-85 Setting days before re-prompt to 0 doesn't work as expected - * If this value is 0, we will now only prompt once per update. -* Fixes IOS-84 Re-prompt only once per version - * We will only prompt twice per update total (prompt and re-prompt). -* Fixes IOS-62 Add support for repeat surveys -* Fixes IOS-99 Add Callback after a user agrees to rate the app - * You can now listen for `ATAppRatingFlowUserAgreedToRateAppNotification` to know when a user agrees to rate the app. -* apptentive/apptentive-ios#32 Showing the rating dialog from a modal -* IOS-108 Fix for launches not being detected after IOS-76 changes -* IOS-107 Fix warnings in PrefixedJSONKit -* Fixes IOS-124 Surveys with tags shouldn't show up in bare surveys calls -* Fixes IOS-126 Long survey answers are truncated -* Also brings in pull requests #38 and #39. - -2013-05-31 wooster v0.4.8a --------------------------- -This is a localization minor bump. There are still a few edge cases in the UI. - -Thanks to Robert Lo Bue and Applingua (with help from SpaceInch) for the new localizations! - -2013-02-01 wooster v0.4.8 -------------------------- -This is a bug fix release. - -* Fixes IOS-80 Use StoreKit to show product page when reviewing app - * Your users on iOS 6 and above will no longer be bounced out of the app to rate your app. - * To use this, you'll need to link against StoreKit and build with the iOS 6 SDK. -* Fixes IOS-86 Always dismiss keyboard on feedback dialog going away -* Fixes IOS-76 Update launch logic for iOS 4 API (better last use of app metrics for iOS 4+) -* Fixes IOS-83 Distribution build script phase is buggy and runs even when not necessary -* Fixes IOS-72 Find out more button doesn't work in iOS 6 -* Fixes IOS-28 Show success message on survey completion when configured -* Fixes IOS-15 Privacy information on info screen -* Fixes [Issue #30](https://github.com/apptentive/apptentive-ios/issues/30) JSONKit warnings in Xcode 4.6 -* Fixes IOS-96 Text cut off in screenshot view in landscape -* Fixes IOS-94 Right side of feedback UI doesn't work on iPhone app running on iPad (in landscape) -* Fixes IOS-97 Sending file attachments is writing files to disk a lot -* Fixes IOS-88 Send CP suffix on client version for cocoa pod versions - -2012-09-27 wooster v0.4.7 -------------------------- -Major change: -* We're dropping armv6 support. This means no more iPhone 3G or iPod Touch 2 support. This is in line with what we're seeing from app developers and other vendors of 3rd party libraries. If you *really* need armv6 support, let us know. - -Other changes: - -* Fixes IOS-71 Add callback after survey completion - See the `ATSurveys.h` header for details. -* Added `showTagline` property on `ATConnect`. This allows you to hide the "Powered by Apptentive" logo text. -* Fixes IOS-78 Always send dates in english - - This bug was causing some dates to be sent localized to the server. Oops. -* Fixes IOS-79 Allow dev to prompt user to re-rate after new version installed - - When the "Reset rating prompt counters when app version changes" settings is enabled, if a user has already rated the app, that will be reset when they upgrade the app. The upshot of this is, users will be prompted to rate the app again after upgrade. You may want to do this if you want users to re-rate the app on a version change, as the iOS App Store is heavily geared towards ratings and reviews for the current version. This change makes our behavior match what developers expect when checking that box on the Apptentive site. -* URL Loading changes: - * Better cache policy handling, per http://blackpixel.com/blog/1659/caching-and-nsurlconnection/ - * Better URL redirection handling. -* Fixes IOS-39 No option to cancel a photo/screenshot attachment? - * To cancel a screenshot or photo attachment, just drag it away from the paperclip. - - -2012-09-11 wooster v0.4.6 -------------------------- -One major change in the API: -* The `shouldTakeScreenshot` property of `ATConnect` is now `NO` by default. - -Some changes for iOS 6 compatibility: -* Fixes for `viewDidUnload` deprecation (IOS-66 Fixes for deprecated API in iOS 6) -* Retrieves review URL for app store from our server (IOS-64) -* Fixes issue when taking a photo with the iPad camera. - -So, due to iOS 6 changing the review URL for opening the App Store and submitting a review, we're now computing this on the server. - -Other fixes: -* IOS-60 Respect "cache-expiration" setting returned with configuration -* #23 Modal window closes after feedback (Also logged as IOS-68 Modal Dialog Issue) -* IOS-70 Getting surveys returns 404 on no surveys -* IOS-67 Populate the feedback source field with "enjoyment_dialog" when launched from the ratings prompt -* Changes to `shouldTakeScreenshot` property with existing images attached to feedback work more like one would expect. - -Of these, the configuration expiration lets us be less aggressive in retrieving new configurations from the server on startup. #23 fixes a problem in which presenting the feedback dialog from within a modal view controller caused view hierarchy issues with the modal view controller. IOS-70 was, in cases where the app had no surveys, sometimes preventing configuration settings being retrieved from the server. IOS-67 lets us track which pieces of feedback were generated by people saying they don't like the app in the ratings flow. - -2012-08-29 wooster v0.4.6 -------------------------- -Changes for OS X compatibility: -* Added backing ivars for properties. -* Removed methods for displaying different feedback window types on OS X. - -2012-08-29 wooster v0.4.5 -------------------------- -Fixes in this version: - -* Fixes IOS-65, `[[UIApplication sharedApplication] keyWindow]` being nil after feedback window is dismissed. -* Fixes leak of feedback and custom placeholder text by feedback controller. -* Current feedback is cleared before feedback window is shown by ratings and after that window is dismissed. - -2012-08-08 wooster v0.4.4 -------------------------- -Major changes: - -We switched from JSONKit to our PrefixedJSONKit library, which prefixes all the JSONKit symbols. In this case, our prefix is `AT`. So, we no longer conflict with JSONKit. If you were using JSONKit already and removed it in favor of ours, you'll want to add the original JSONKit back to your project rather than using the PrefixedJSONKit project. - -Minor changes: -- Fix for IOS-59, which tweaks how `ATBackend` stops and restarts the task queue. - -2012-07-24 wooster v0.4.3 -------------------------- -* Fix for IOS-41, wherein the metrics were being sent incorrectly and metric for - text responses was being sent after the metric for survey submission. - -2012-07-23 wooster v0.4.2 -------------------------- -* Fix for [#20](https://github.com/apptentive/apptentive-ios/issues/20), wherein the image picker on iPad would cause the app to crash. - -2012-07-22 wooster v0.4.2 -------------------------- - -* IOS-52: Requests sent before API key is set won't succeed until next app start - - Thanks to [@kgn](https://github.com/kgn) for finding this and [proposing a fix](https://github.com/apptentive/apptentive-ios/pull/19). The fix we've chosen is a - bit more involved. We are now making each of our various URL requests be handled - by `ATTask` objects, which can tell the task queue whether or not they're able - to be executed at the current time. For the case of API requests, that will be - `NO` until such time as the API key is set. - -2012-07-09 wooster v0.4.2 -------------------------- -Minor changes: -* Adding Spanish localization courtesy of [Babble-on Inc](http://www.ibabbleon.com/). -* Fixes from [@kgn](https://github.com/kgn) for crash on original iPad and disabled styling on Send button ([pull request 18](https://github.com/apptentive/apptentive-ios/pull/18)). -* IOS-48: Use count is incremented twice at startup, again at location prompt See [a8dedf6abb5b08342aa564ca2a26fcbae80c9d6f](https://github.com/apptentive/apptentive-ios/commit/a8dedf6abb5b08342aa564ca2a26fcbae80c9d6f) - - -2012-06-25 wooster v0.4.1 -------------------------- -Major changes: - -The surveys module has been integrated into `ApptentiveConnect` proper, as the survey features are now live for all users on the site. If you have previously added the Surveys module to your app, you will need to update the configuration by removing it from your app and including the `ATSurveys.h` header file. - -Minor changes: -* Consistent use of tabs for indents. -* New icons with new Apptentive logo. - -2012-06-01 wooster v0.4.0 -------------------------- -Major changes: - -The metrics module has been integrated into `ApptentiveConnect` proper. Now that you can enable and disable metrics from the website, it didn't make sense to keep them separate. - -Bug fixes: -* IOS-40: On debug builds, the configuration is updated much more often to aid debugging. See [df7aa47dce369e6caad8c18ff72b8f9cb0485050](https://github.com/apptentive/apptentive-ios/commit/df7aa47dce369e6caad8c18ff72b8f9cb0485050) -* IOS-41: Added metrics for surveys and for feedback submission. See [e4ce211834737c08b8a5fe9591dffc14b884304f](https://github.com/apptentive/apptentive-ios/commit/e4ce211834737c08b8a5fe9591dffc14b884304f) -* IOS-38: Fixed bug where the paperclip blocked feedback text when there was no email field and no thumbnail. See [f0d7c6e52ee8053653d5ae346ddebb626f9b048e](https://github.com/apptentive/apptentive-ios/commit/f0d7c6e52ee8053653d5ae346ddebb626f9b048e) -* IOS-31: Now sending time to completion of surveys with the response. See [40b1e1e221a0fe60826da2b5ff31877485c72451](https://github.com/apptentive/apptentive-ios/commit/40b1e1e221a0fe60826da2b5ff31877485c72451) -* IOS-42: Should use the localized app name in the ratings flow, if available. See [dc2f59ef5cd347ecc5aa332323d9894092f635e7](https://github.com/apptentive/apptentive-ios/commit/dc2f59ef5cd347ecc5aa332323d9894092f635e7) -* IOS-43: Fixes a bug where sometimes the ratings dialog was not shown at startup due to network reachability. See [717b010ee01bbfd87ee3cca957e7c5bf76d0f648](https://github.com/apptentive/apptentive-ios/commit/717b010ee01bbfd87ee3cca957e7c5bf76d0f648) for more info. -* IOS-36: Fixes bug where the alert view asking for email addresses looks funny in landscape mode. This fix only works on iOS 5+. See [b1aa55dac9b4dc6ae9b10440901129572d271b21](https://github.com/apptentive/apptentive-ios/commit/b1aa55dac9b4dc6ae9b10440901129572d271b21) -* IOS-44: Where screenshots appear too small on Retina display devices. See [7a0d877b523a7f58ba94789bda6ceeebaaff1bd0](https://github.com/apptentive/apptentive-ios/commit/7a0d877b523a7f58ba94789bda6ceeebaaff1bd0) -* IOS-45: In which the application frame wasn't properly taken into account and whitespace appeared in the screenshot under non-default orientations. See [e8a7358f329797812e9d944412bd6708b0d238d4](https://github.com/apptentive/apptentive-ios/commit/e8a7358f329797812e9d944412bd6708b0d238d4) - -2012-03-26 wooster v0.3.3 -------------------------- - -Fixes problem wherein app wouldn't use the correct ratings configuration from the server. - -2012-03-25 wooster ------------------- -Major changes: - -* Start of version 0.3. -* Ratings flow configuration is now done server-side. Old parameters in SDK no longer exist. -* There are now server-side on/off switches for both ratings and metrics. -* Added initial version of surveys. -* Ratings parameter counters (days of use, significant events) can be reset on version upgrade. -* Including armv6 (non-thumb) architecture in all libraries. -* "Distribution" target in FeedbackDemo builds a static library distribution. -* Application exit events wired up in Metrics module. -* Adding `initialName` property to ATConnect for pre-populating the user's name. - -##### Metrics -The metrics module can be used by simply linking against the `libApptentiveMetrics.a` static library. That's it. You can turn metrics on or off server side in your app settings. - -##### Surveys -This is a very rough initial version of surveys. To use, link against `libApptentiveSurveys.a`. - -Specific bug fixes and features: - -* IOS-3: App Exit events don't seem to be sent? -* IOS-6: $ARCHS_STANDARD_32_BIT is now armv7 only, needs to be changed to armv6 and armv7 -* IOS-11: Surveys Module on iOS -* IOS-21: Support for Server Side Ratings Settings -* IOS-22: Option to clear ratings parameter values (days of use, events, etc.) on version upgrade -* IOS-34: Add support for prepopulating the user's name - -2012-01-13 wooster ------------------- -* Start of version 0.2. -* Added support for adding and removing extra data to feedback. -* Added initial version of metrics module. -* Added support for optionally showing or hiding the email address field on feedback. -* Added support for setting an initial email address on the feedback form. - -To add data to feedback, use these methods on `ATConnect`: - -``` objective-c -- (void)addAdditionalInfoToFeedback:(NSObject *)object withKey:(NSString *)key; -- (void)removeAdditionalInfoFromFeedbackWithKey:(NSString *)key; -``` - -The data objects should, at this time, either be of type `NSString` or `NSDate`. They will be added to the `record[data]` hash, with the key as the key, as in `record[data][key]`. - -If you add the metrics module to your project, it will load on run. It's experimental at this point, so I wouldn't recommend using it quite yet. - -You can use these properties to control email field behavior on the feedback form: - -``` objective-c -@property (nonatomic, assign) BOOL showEmailField; -@property (nonatomic, retain) NSString *initialEmailAddress; -``` - -`showEmailField` controls whether or not the email address field is shown on the feedback form. `initialEmailAddress` can be used to set the initial email address that populates the field. Note: if the user submits feedback with a different email address, `initialEmailAddress` will not be used. diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo.xcodeproj/project.pbxproj b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo.xcodeproj/project.pbxproj deleted file mode 100755 index 5e5ff59..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo.xcodeproj/project.pbxproj +++ /dev/null @@ -1,706 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 49173D89160176B1002A27CC /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 49173D88160176B1002A27CC /* Default-568h@2x.png */; }; - 493529BD138C712A000E464A /* ApptentiveResources.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 49D111A013341A7C00603373 /* ApptentiveResources.bundle */; }; - 493529C0138C7141000E464A /* libApptentiveConnect.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 49C0032D133417390071F088 /* libApptentiveConnect.a */; }; - 4960E1281344326B00F6311F /* icon-114x114.png in Resources */ = {isa = PBXBuildFile; fileRef = 4960E1221344326B00F6311F /* icon-114x114.png */; }; - 4960E1291344326B00F6311F /* icon-29x29.png in Resources */ = {isa = PBXBuildFile; fileRef = 4960E1231344326B00F6311F /* icon-29x29.png */; }; - 4960E12A1344326B00F6311F /* icon-58x58.png in Resources */ = {isa = PBXBuildFile; fileRef = 4960E1241344326B00F6311F /* icon-58x58.png */; }; - 4960E12B1344326B00F6311F /* icon-72x72.png in Resources */ = {isa = PBXBuildFile; fileRef = 4960E1251344326B00F6311F /* icon-72x72.png */; }; - 4960E12C1344326B00F6311F /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 4960E1261344326B00F6311F /* icon.png */; }; - 4960E139134432F400F6311F /* iTunesArtwork in Resources */ = {isa = PBXBuildFile; fileRef = 4960E138134432F400F6311F /* iTunesArtwork */; }; - 4982ECE6133C2DCF00B91781 /* MainWindow-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4982ECE4133C2DCF00B91781 /* MainWindow-iPad.xib */; }; - 49AA100E138B41A40082887A /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49AA100D138B41A40082887A /* SystemConfiguration.framework */; }; - 49AAA17E163373A800B26851 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49AAA17D163373A800B26851 /* StoreKit.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; - 49B3D9A31340084E00B5A5CD /* CoreTelephony.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49B3D9A21340084E00B5A5CD /* CoreTelephony.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; - 49C002EC1334172E0071F088 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49C002EB1334172E0071F088 /* UIKit.framework */; }; - 49C002EE1334172F0071F088 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49C002ED1334172F0071F088 /* Foundation.framework */; }; - 49C002F01334172F0071F088 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49C002EF1334172F0071F088 /* CoreGraphics.framework */; }; - 49C002F61334172F0071F088 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 49C002F41334172F0071F088 /* InfoPlist.strings */; }; - 49C002F91334172F0071F088 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 49C002F81334172F0071F088 /* main.m */; }; - 49C002FC1334172F0071F088 /* FeedbackDemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 49C002FB1334172F0071F088 /* FeedbackDemoAppDelegate.m */; }; - 49C002FF1334172F0071F088 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 49C002FD1334172F0071F088 /* MainWindow.xib */; }; - 49C003021334172F0071F088 /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 49C003011334172F0071F088 /* RootViewController.m */; }; - 49C003051334172F0071F088 /* RootViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 49C003031334172F0071F088 /* RootViewController.xib */; }; - 49C0030C1334172F0071F088 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49C002EB1334172E0071F088 /* UIKit.framework */; }; - 49C0030D1334172F0071F088 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49C002ED1334172F0071F088 /* Foundation.framework */; }; - 49C0030E1334172F0071F088 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49C002EF1334172F0071F088 /* CoreGraphics.framework */; }; - 49C003161334172F0071F088 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 49C003141334172F0071F088 /* InfoPlist.strings */; }; - 49C003191334172F0071F088 /* FeedbackDemoTests.h in Resources */ = {isa = PBXBuildFile; fileRef = 49C003181334172F0071F088 /* FeedbackDemoTests.h */; }; - 49C0031B1334172F0071F088 /* FeedbackDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 49C0031A1334172F0071F088 /* FeedbackDemoTests.m */; }; - 49E8918B134BF69C00DD098A /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49E8918A134BF69C00DD098A /* QuartzCore.framework */; }; - 49E891D5134FE40200DD098A /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 49E891D2134FE40200DD098A /* Localizable.strings */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 49AA1026138B4E500082887A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 49C00324133417390071F088 /* ApptentiveConnect.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 49D1118B13341A7C00603373; - remoteInfo = ApptentiveResources; - }; - 49C0030F1334172F0071F088 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 49C002DE1334172E0071F088 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 49C002E61334172E0071F088; - remoteInfo = FeedbackDemo; - }; - 49C0032C133417390071F088 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 49C00324133417390071F088 /* ApptentiveConnect.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 496DC37F1333D35600743F65; - remoteInfo = ApptentiveConnect; - }; - 49C0032E133417390071F088 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 49C00324133417390071F088 /* ApptentiveConnect.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 496DC38C1333D35600743F65; - remoteInfo = ApptentiveConnectTests; - }; - 49C00330133417740071F088 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 49C00324133417390071F088 /* ApptentiveConnect.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 496DC37E1333D35600743F65; - remoteInfo = ApptentiveConnect; - }; - 49D1119F13341A7C00603373 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 49C00324133417390071F088 /* ApptentiveConnect.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 49D1118C13341A7C00603373; - remoteInfo = ApptentiveResources; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 49173D88160176B1002A27CC /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "art/Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; - 493AEB4615990AB800DFD4C7 /* ATSurveys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ATSurveys.h; path = ../ApptentiveConnect/source/Surveys/ATSurveys.h; sourceTree = ""; }; - 4942CD5E13C8D68E009BF758 /* ATAppRatingFlow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ATAppRatingFlow.h; path = "../ApptentiveConnect/source/Rating Flow/ATAppRatingFlow.h"; sourceTree = SOURCE_ROOT; }; - 4960E1221344326B00F6311F /* icon-114x114.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-114x114.png"; sourceTree = ""; }; - 4960E1231344326B00F6311F /* icon-29x29.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-29x29.png"; sourceTree = ""; }; - 4960E1241344326B00F6311F /* icon-58x58.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-58x58.png"; sourceTree = ""; }; - 4960E1251344326B00F6311F /* icon-72x72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-72x72.png"; sourceTree = ""; }; - 4960E1261344326B00F6311F /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = ""; }; - 4960E138134432F400F6311F /* iTunesArtwork */ = {isa = PBXFileReference; lastKnownFileType = file; path = iTunesArtwork; sourceTree = ""; }; - 4960E13E13455ACE00F6311F /* ATConnect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ATConnect.h; path = ../ApptentiveConnect/source/ATConnect.h; sourceTree = ""; }; - 4982ECE5133C2DCF00B91781 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = "iPad/en.lproj/MainWindow-iPad.xib"; sourceTree = ""; }; - 4995EDC917595AF100AF7268 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = ""; }; - 4995EDCA17595AFC00AF7268 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = ""; }; - 4995EDCB17595B1F00AF7268 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/Localizable.strings; sourceTree = ""; }; - 4995EDCC17595B3100AF7268 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = ""; }; - 4995EDCD17595B3C00AF7268 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; - 49AA100D138B41A40082887A /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; - 49AAA17D163373A800B26851 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; }; - 49B3D9A21340084E00B5A5CD /* CoreTelephony.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreTelephony.framework; path = System/Library/Frameworks/CoreTelephony.framework; sourceTree = SDKROOT; }; - 49C002E71334172E0071F088 /* FeedbackDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FeedbackDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 49C002EB1334172E0071F088 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - 49C002ED1334172F0071F088 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 49C002EF1334172F0071F088 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 49C002F31334172F0071F088 /* FeedbackDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "FeedbackDemo-Info.plist"; sourceTree = ""; }; - 49C002F51334172F0071F088 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - 49C002F71334172F0071F088 /* FeedbackDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FeedbackDemo-Prefix.pch"; sourceTree = ""; }; - 49C002F81334172F0071F088 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 49C002FA1334172F0071F088 /* FeedbackDemoAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FeedbackDemoAppDelegate.h; sourceTree = ""; }; - 49C002FB1334172F0071F088 /* FeedbackDemoAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FeedbackDemoAppDelegate.m; sourceTree = ""; }; - 49C002FE1334172F0071F088 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = ""; }; - 49C003001334172F0071F088 /* RootViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; - 49C003011334172F0071F088 /* RootViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RootViewController.m; sourceTree = ""; }; - 49C003041334172F0071F088 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/RootViewController.xib; sourceTree = ""; }; - 49C0030B1334172F0071F088 /* FeedbackDemoTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FeedbackDemoTests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; - 49C003131334172F0071F088 /* FeedbackDemoTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "FeedbackDemoTests-Info.plist"; sourceTree = ""; }; - 49C003151334172F0071F088 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - 49C003171334172F0071F088 /* FeedbackDemoTests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FeedbackDemoTests-Prefix.pch"; sourceTree = ""; }; - 49C003181334172F0071F088 /* FeedbackDemoTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FeedbackDemoTests.h; sourceTree = ""; }; - 49C0031A1334172F0071F088 /* FeedbackDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FeedbackDemoTests.m; sourceTree = ""; }; - 49C00324133417390071F088 /* ApptentiveConnect.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ApptentiveConnect.xcodeproj; path = ../ApptentiveConnect/ApptentiveConnect.xcodeproj; sourceTree = ""; }; - 49C00332133417790071F088 /* libApptentiveConnect.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libApptentiveConnect.a; sourceTree = SOURCE_ROOT; }; - 49D111DA13355F4000603373 /* defines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = defines.h; sourceTree = ""; }; - 49E8918A134BF69C00DD098A /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - 49E891D3134FE40200DD098A /* English */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = ""; }; - 49E891D4134FE40200DD098A /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 49C002E41334172E0071F088 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 49AAA17E163373A800B26851 /* StoreKit.framework in Frameworks */, - 493529C0138C7141000E464A /* libApptentiveConnect.a in Frameworks */, - 49AA100E138B41A40082887A /* SystemConfiguration.framework in Frameworks */, - 49E8918B134BF69C00DD098A /* QuartzCore.framework in Frameworks */, - 49B3D9A31340084E00B5A5CD /* CoreTelephony.framework in Frameworks */, - 49C002EC1334172E0071F088 /* UIKit.framework in Frameworks */, - 49C002EE1334172F0071F088 /* Foundation.framework in Frameworks */, - 49C002F01334172F0071F088 /* CoreGraphics.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 49C003071334172F0071F088 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 49C0030C1334172F0071F088 /* UIKit.framework in Frameworks */, - 49C0030D1334172F0071F088 /* Foundation.framework in Frameworks */, - 49C0030E1334172F0071F088 /* CoreGraphics.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 4960E1211344326B00F6311F /* art */ = { - isa = PBXGroup; - children = ( - 49173D88160176B1002A27CC /* Default-568h@2x.png */, - 4960E1221344326B00F6311F /* icon-114x114.png */, - 4960E1231344326B00F6311F /* icon-29x29.png */, - 4960E1241344326B00F6311F /* icon-58x58.png */, - 4960E1251344326B00F6311F /* icon-72x72.png */, - 4960E1261344326B00F6311F /* icon.png */, - 4960E138134432F400F6311F /* iTunesArtwork */, - ); - name = art; - path = art/generated; - sourceTree = SOURCE_ROOT; - }; - 49C002DC1334172E0071F088 = { - isa = PBXGroup; - children = ( - 4960E13E13455ACE00F6311F /* ATConnect.h */, - 4942CD5E13C8D68E009BF758 /* ATAppRatingFlow.h */, - 493AEB4615990AB800DFD4C7 /* ATSurveys.h */, - 49C00324133417390071F088 /* ApptentiveConnect.xcodeproj */, - 49C002F11334172F0071F088 /* FeedbackDemo */, - 49C003111334172F0071F088 /* FeedbackDemoTests */, - 49C002EA1334172E0071F088 /* Frameworks */, - 49C002E81334172E0071F088 /* Products */, - ); - sourceTree = ""; - usesTabs = 1; - }; - 49C002E81334172E0071F088 /* Products */ = { - isa = PBXGroup; - children = ( - 49C002E71334172E0071F088 /* FeedbackDemo.app */, - 49C0030B1334172F0071F088 /* FeedbackDemoTests.octest */, - ); - name = Products; - sourceTree = ""; - }; - 49C002EA1334172E0071F088 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 49AAA17D163373A800B26851 /* StoreKit.framework */, - 49AA100D138B41A40082887A /* SystemConfiguration.framework */, - 49E8918A134BF69C00DD098A /* QuartzCore.framework */, - 49B3D9A21340084E00B5A5CD /* CoreTelephony.framework */, - 49C00332133417790071F088 /* libApptentiveConnect.a */, - 49C002EB1334172E0071F088 /* UIKit.framework */, - 49C002ED1334172F0071F088 /* Foundation.framework */, - 49C002EF1334172F0071F088 /* CoreGraphics.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 49C002F11334172F0071F088 /* FeedbackDemo */ = { - isa = PBXGroup; - children = ( - 49D111DA13355F4000603373 /* defines.h */, - 49C002FA1334172F0071F088 /* FeedbackDemoAppDelegate.h */, - 49C002FB1334172F0071F088 /* FeedbackDemoAppDelegate.m */, - 49C002FD1334172F0071F088 /* MainWindow.xib */, - 4982ECE4133C2DCF00B91781 /* MainWindow-iPad.xib */, - 49C003001334172F0071F088 /* RootViewController.h */, - 49C003011334172F0071F088 /* RootViewController.m */, - 49C003031334172F0071F088 /* RootViewController.xib */, - 49C002F21334172F0071F088 /* Supporting Files */, - ); - path = FeedbackDemo; - sourceTree = ""; - }; - 49C002F21334172F0071F088 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 49E891D1134FE40200DD098A /* localization */, - 4960E1211344326B00F6311F /* art */, - 49C002F31334172F0071F088 /* FeedbackDemo-Info.plist */, - 49C002F41334172F0071F088 /* InfoPlist.strings */, - 49C002F71334172F0071F088 /* FeedbackDemo-Prefix.pch */, - 49C002F81334172F0071F088 /* main.m */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 49C003111334172F0071F088 /* FeedbackDemoTests */ = { - isa = PBXGroup; - children = ( - 49C003181334172F0071F088 /* FeedbackDemoTests.h */, - 49C0031A1334172F0071F088 /* FeedbackDemoTests.m */, - 49C003121334172F0071F088 /* Supporting Files */, - ); - path = FeedbackDemoTests; - sourceTree = ""; - }; - 49C003121334172F0071F088 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 49C003131334172F0071F088 /* FeedbackDemoTests-Info.plist */, - 49C003141334172F0071F088 /* InfoPlist.strings */, - 49C003171334172F0071F088 /* FeedbackDemoTests-Prefix.pch */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 49C00325133417390071F088 /* Products */ = { - isa = PBXGroup; - children = ( - 49C0032D133417390071F088 /* libApptentiveConnect.a */, - 49C0032F133417390071F088 /* ApptentiveConnectTests.octest */, - 49D111A013341A7C00603373 /* ApptentiveResources.bundle */, - ); - name = Products; - sourceTree = ""; - }; - 49E891D1134FE40200DD098A /* localization */ = { - isa = PBXGroup; - children = ( - 49E891D2134FE40200DD098A /* Localizable.strings */, - ); - name = localization; - path = resources/localization; - sourceTree = SOURCE_ROOT; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 49C002E61334172E0071F088 /* FeedbackDemo */ = { - isa = PBXNativeTarget; - buildConfigurationList = 49C0031E1334172F0071F088 /* Build configuration list for PBXNativeTarget "FeedbackDemo" */; - buildPhases = ( - 49C002E31334172E0071F088 /* Sources */, - 49C002E41334172E0071F088 /* Frameworks */, - 49C002E51334172E0071F088 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 49AA1027138B4E500082887A /* PBXTargetDependency */, - 49C00331133417740071F088 /* PBXTargetDependency */, - ); - name = FeedbackDemo; - productName = FeedbackDemo; - productReference = 49C002E71334172E0071F088 /* FeedbackDemo.app */; - productType = "com.apple.product-type.application"; - }; - 49C0030A1334172F0071F088 /* FeedbackDemoTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 49C003211334172F0071F088 /* Build configuration list for PBXNativeTarget "FeedbackDemoTests" */; - buildPhases = ( - 49C003061334172F0071F088 /* Sources */, - 49C003071334172F0071F088 /* Frameworks */, - 49C003081334172F0071F088 /* Resources */, - 49C003091334172F0071F088 /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - 49C003101334172F0071F088 /* PBXTargetDependency */, - ); - name = FeedbackDemoTests; - productName = FeedbackDemoTests; - productReference = 49C0030B1334172F0071F088 /* FeedbackDemoTests.octest */; - productType = "com.apple.product-type.bundle"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 49C002DE1334172E0071F088 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0440; - ORGANIZATIONNAME = "Apptentive, Inc."; - }; - buildConfigurationList = 49C002E11334172E0071F088 /* Build configuration list for PBXProject "FeedbackDemo" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - English, - es, - ja, - de, - pt, - ru, - "zh-Hans", - ); - mainGroup = 49C002DC1334172E0071F088; - productRefGroup = 49C002E81334172E0071F088 /* Products */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 49C00325133417390071F088 /* Products */; - ProjectRef = 49C00324133417390071F088 /* ApptentiveConnect.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - 49C002E61334172E0071F088 /* FeedbackDemo */, - 49C0030A1334172F0071F088 /* FeedbackDemoTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - 49C0032D133417390071F088 /* libApptentiveConnect.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libApptentiveConnect.a; - remoteRef = 49C0032C133417390071F088 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 49C0032F133417390071F088 /* ApptentiveConnectTests.octest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = ApptentiveConnectTests.octest; - remoteRef = 49C0032E133417390071F088 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 49D111A013341A7C00603373 /* ApptentiveResources.bundle */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = ApptentiveResources.bundle; - remoteRef = 49D1119F13341A7C00603373 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXResourcesBuildPhase section */ - 49C002E51334172E0071F088 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 493529BD138C712A000E464A /* ApptentiveResources.bundle in Resources */, - 49C002F61334172F0071F088 /* InfoPlist.strings in Resources */, - 49C002FF1334172F0071F088 /* MainWindow.xib in Resources */, - 49C003051334172F0071F088 /* RootViewController.xib in Resources */, - 4982ECE6133C2DCF00B91781 /* MainWindow-iPad.xib in Resources */, - 4960E1281344326B00F6311F /* icon-114x114.png in Resources */, - 4960E1291344326B00F6311F /* icon-29x29.png in Resources */, - 4960E12A1344326B00F6311F /* icon-58x58.png in Resources */, - 4960E12B1344326B00F6311F /* icon-72x72.png in Resources */, - 4960E12C1344326B00F6311F /* icon.png in Resources */, - 4960E139134432F400F6311F /* iTunesArtwork in Resources */, - 49E891D5134FE40200DD098A /* Localizable.strings in Resources */, - 49173D89160176B1002A27CC /* Default-568h@2x.png in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 49C003081334172F0071F088 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 49C003161334172F0071F088 /* InfoPlist.strings in Resources */, - 49C003191334172F0071F088 /* FeedbackDemoTests.h in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 49C003091334172F0071F088 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 49C002E31334172E0071F088 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 49C002F91334172F0071F088 /* main.m in Sources */, - 49C002FC1334172F0071F088 /* FeedbackDemoAppDelegate.m in Sources */, - 49C003021334172F0071F088 /* RootViewController.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 49C003061334172F0071F088 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 49C0031B1334172F0071F088 /* FeedbackDemoTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 49AA1027138B4E500082887A /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = ApptentiveResources; - targetProxy = 49AA1026138B4E500082887A /* PBXContainerItemProxy */; - }; - 49C003101334172F0071F088 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 49C002E61334172E0071F088 /* FeedbackDemo */; - targetProxy = 49C0030F1334172F0071F088 /* PBXContainerItemProxy */; - }; - 49C00331133417740071F088 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = ApptentiveConnect; - targetProxy = 49C00330133417740071F088 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 4982ECE4133C2DCF00B91781 /* MainWindow-iPad.xib */ = { - isa = PBXVariantGroup; - children = ( - 4982ECE5133C2DCF00B91781 /* en */, - ); - name = "MainWindow-iPad.xib"; - sourceTree = ""; - }; - 49C002F41334172F0071F088 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 49C002F51334172F0071F088 /* en */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; - 49C002FD1334172F0071F088 /* MainWindow.xib */ = { - isa = PBXVariantGroup; - children = ( - 49C002FE1334172F0071F088 /* en */, - ); - name = MainWindow.xib; - sourceTree = ""; - }; - 49C003031334172F0071F088 /* RootViewController.xib */ = { - isa = PBXVariantGroup; - children = ( - 49C003041334172F0071F088 /* en */, - ); - name = RootViewController.xib; - sourceTree = ""; - }; - 49C003141334172F0071F088 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 49C003151334172F0071F088 /* en */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; - 49E891D2134FE40200DD098A /* Localizable.strings */ = { - isa = PBXVariantGroup; - children = ( - 49E891D3134FE40200DD098A /* English */, - 49E891D4134FE40200DD098A /* es */, - 4995EDC917595AF100AF7268 /* ja */, - 4995EDCA17595AFC00AF7268 /* de */, - 4995EDCB17595B1F00AF7268 /* pt */, - 4995EDCC17595B3100AF7268 /* ru */, - 4995EDCD17595B3C00AF7268 /* zh-Hans */, - ); - name = Localizable.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 49C0031C1334172F0071F088 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = DEBUG; - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_THUMB_SUPPORT = NO; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include"; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; - "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 49C0031D1334172F0071F088 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_THUMB_SUPPORT = NO; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include"; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; - OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; - SDKROOT = iphoneos; - }; - name = Release; - }; - 49C0031F1334172F0071F088 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "FeedbackDemo/FeedbackDemo-Prefix.pch"; - GCC_THUMB_SUPPORT = NO; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - HEADER_SEARCH_PATHS = ( - "$(BUILT_PRODUCTS_DIR)/usr/local/include", - "$(DSTROOT)/usr/local/include", - ); - INFOPLIST_FILE = "FeedbackDemo/FeedbackDemo-Info.plist"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)\"", - ); - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = ""; - TARGETED_DEVICE_FAMILY = "1,2"; - WRAPPER_EXTENSION = app; - }; - name = Debug; - }; - 49C003201334172F0071F088 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; - CODE_SIGN_IDENTITY = "iPhone Distribution"; - COPY_PHASE_STRIP = YES; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "FeedbackDemo/FeedbackDemo-Prefix.pch"; - GCC_THUMB_SUPPORT = NO; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - HEADER_SEARCH_PATHS = ( - "$(BUILT_PRODUCTS_DIR)/usr/local/include", - "$(DSTROOT)/usr/local/include", - ); - INFOPLIST_FILE = "FeedbackDemo/FeedbackDemo-Info.plist"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)\"", - ); - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = ""; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - WRAPPER_EXTENSION = app; - }; - name = Release; - }; - 49C003221334172F0071F088 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/FeedbackDemo.app/FeedbackDemo"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(DEVELOPER_LIBRARY_DIR)/Frameworks", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "FeedbackDemoTests/FeedbackDemoTests-Prefix.pch"; - GCC_THUMB_SUPPORT = NO; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - INFOPLIST_FILE = "FeedbackDemoTests/FeedbackDemoTests-Info.plist"; - OTHER_LDFLAGS = ( - "-framework", - SenTestingKit, - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUNDLE_LOADER)"; - WRAPPER_EXTENSION = octest; - }; - name = Debug; - }; - 49C003231334172F0071F088 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/FeedbackDemo.app/FeedbackDemo"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(DEVELOPER_LIBRARY_DIR)/Frameworks", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "FeedbackDemoTests/FeedbackDemoTests-Prefix.pch"; - GCC_THUMB_SUPPORT = NO; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - INFOPLIST_FILE = "FeedbackDemoTests/FeedbackDemoTests-Info.plist"; - OTHER_LDFLAGS = ( - "-framework", - SenTestingKit, - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUNDLE_LOADER)"; - WRAPPER_EXTENSION = octest; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 49C002E11334172E0071F088 /* Build configuration list for PBXProject "FeedbackDemo" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 49C0031C1334172F0071F088 /* Debug */, - 49C0031D1334172F0071F088 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 49C0031E1334172F0071F088 /* Build configuration list for PBXNativeTarget "FeedbackDemo" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 49C0031F1334172F0071F088 /* Debug */, - 49C003201334172F0071F088 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 49C003211334172F0071F088 /* Build configuration list for PBXNativeTarget "FeedbackDemoTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 49C003221334172F0071F088 /* Debug */, - 49C003231334172F0071F088 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 49C002DE1334172E0071F088 /* Project object */; -} diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100755 index 4338259..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo.xcodeproj/xcshareddata/xcschemes/FeedbackDemo.xcscheme b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo.xcodeproj/xcshareddata/xcschemes/FeedbackDemo.xcscheme deleted file mode 100755 index 925a2d2..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo.xcodeproj/xcshareddata/xcschemes/FeedbackDemo.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/FeedbackDemo-Info.plist b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/FeedbackDemo-Info.plist deleted file mode 100755 index 22b7d32..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/FeedbackDemo-Info.plist +++ /dev/null @@ -1,48 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleDisplayName - Apptentive - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIconFile - icon.png - CFBundleIdentifier - com.apptentive.internal.feedback-demo - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.2 - CFBundleSignature - ???? - CFBundleVersion - 29 - LSRequiresIPhoneOS - - NSMainNibFile - MainWindow - NSMainNibFile~ipad - MainWindow-iPad - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - CFBundleIconFiles - - icon.png - icon-114x114.png - icon-72x72.png - icon-29x29.png - icon-58x58.png - - - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/FeedbackDemo-Prefix.pch b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/FeedbackDemo-Prefix.pch deleted file mode 100755 index 7661cf4..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/FeedbackDemo-Prefix.pch +++ /dev/null @@ -1,14 +0,0 @@ -// -// Prefix header for all source files of the 'FeedbackDemo' target in the 'FeedbackDemo' project -// - -#import - -#ifndef __IPHONE_3_0 -#warning "This project uses features only available in iPhone SDK 3.0 and later." -#endif - -#ifdef __OBJC__ - #import - #import -#endif diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/FeedbackDemoAppDelegate.h b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/FeedbackDemoAppDelegate.h deleted file mode 100755 index 904c8e6..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/FeedbackDemoAppDelegate.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// FeedbackDemoAppDelegate.h -// FeedbackDemo -// -// Created by Andrew Wooster on 3/18/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import - -@interface FeedbackDemoAppDelegate : NSObject { - -} - -@property (nonatomic, retain) IBOutlet UIWindow *window; - -@property (nonatomic, retain) IBOutlet UINavigationController *navigationController; - -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/FeedbackDemoAppDelegate.m b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/FeedbackDemoAppDelegate.m deleted file mode 100755 index c9efa85..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/FeedbackDemoAppDelegate.m +++ /dev/null @@ -1,80 +0,0 @@ -// -// FeedbackDemoAppDelegate.m -// FeedbackDemo -// -// Created by Andrew Wooster on 3/18/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import "FeedbackDemoAppDelegate.h" -#import "ATConnect.h" -#import "ATAppRatingFlow.h" -#import "defines.h" -#import "ATSurveys.h" - -@implementation FeedbackDemoAppDelegate - - -@synthesize window=_window; - -@synthesize navigationController=_navigationController; - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Override point for customization after application launch. - // Add the navigation controller's view to the window and display. - if ([self.window respondsToSelector:@selector(setRootViewController:)]) { - [self.window setRootViewController:self.navigationController]; - } else { - [self.window addSubview:self.navigationController.view]; - } - [self.window makeKeyAndVisible]; - [[ATConnect sharedConnection] setApiKey:kApptentiveAPIKey]; - ATAppRatingFlow *ratingFlow = [ATAppRatingFlow sharedRatingFlowWithAppID:kApptentiveAppID]; - [ratingFlow appDidLaunch:YES viewController:self.navigationController]; - - [ATSurveys checkForAvailableSurveys]; - - return YES; -} - -- (void)applicationWillResignActive:(UIApplication *)application { - /* - Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. - */ -} - -- (void)applicationDidEnterBackground:(UIApplication *)application { - /* - Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. - */ -} - -- (void)applicationWillEnterForeground:(UIApplication *)application { - /* - Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. - */ -} - -- (void)applicationDidBecomeActive:(UIApplication *)application { - /* - Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. - */ - [[ATAppRatingFlow sharedRatingFlowWithAppID:kApptentiveAppID] appDidEnterForeground:YES viewController:self.navigationController]; -} - -- (void)applicationWillTerminate:(UIApplication *)application { - /* - Called when the application is about to terminate. - Save data if appropriate. - See also applicationDidEnterBackground:. - */ -} - -- (void)dealloc { - [_window release]; - [_navigationController release]; - [super dealloc]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/RootViewController.h b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/RootViewController.h deleted file mode 100755 index 2f9f5a0..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/RootViewController.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// RootViewController.h -// FeedbackDemo -// -// Created by Andrew Wooster on 3/18/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import - -@interface RootViewController : UITableViewController { - NSSet *tags; -} -- (IBAction)showFeedback:(id)sender; -- (IBAction)showRating:(id)sender; -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/RootViewController.m b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/RootViewController.m deleted file mode 100755 index 9460ec5..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/RootViewController.m +++ /dev/null @@ -1,221 +0,0 @@ -// -// RootViewController.m -// FeedbackDemo -// -// Created by Andrew Wooster on 3/18/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import "RootViewController.h" -#import "ATConnect.h" -#import "ATAppRatingFlow.h" -#import "ATSurveys.h" -#import "defines.h" - -enum kRootTableSections { - kFeedbackSection, - kRatingSection, - kSurveySection, - kSectionCount -}; - -@interface RootViewController () -- (void)surveyBecameAvailable:(NSNotification *)notification; -- (void)checkForProperConfiguration; -@end - -@implementation RootViewController - -- (IBAction)showFeedback:(id)sender { - ATConnect *connection = [ATConnect sharedConnection]; - connection.apiKey = kApptentiveAPIKey; - - [connection presentFeedbackControllerFromViewController:self]; -} - -- (IBAction)showRating:(id)sender { - ATAppRatingFlow *flow = [ATAppRatingFlow sharedRatingFlowWithAppID:kApptentiveAppID]; - [flow showEnjoymentDialog:self]; -} - -- (void)viewDidLoad { - ATConnect *connection = [ATConnect sharedConnection]; - connection.apiKey = kApptentiveAPIKey; - self.navigationItem.title = @"Apptentive Demo"; - UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"at_logo_info"]]; - imageView.contentMode = UIViewContentModeCenter; - self.tableView.tableHeaderView = imageView; - [imageView release], imageView = nil; - [super viewDidLoad]; - - tags = [[NSSet alloc] initWithObjects:@"testsurvey", @"testtag", nil]; - - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(surveyBecameAvailable:) name:ATSurveyNewSurveyAvailableNotification object:nil]; - [ATSurveys checkForAvailableSurveys]; -} - -- (void)surveyBecameAvailable:(NSNotification *)notification { - [self.tableView reloadData]; -} - -- (void)checkForProperConfiguration { - static BOOL checkedAlready = NO; - if (checkedAlready) { - // Don't display more than once. - return; - } - checkedAlready = YES; - if ([kApptentiveAPIKey isEqualToString:@""]) { - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Please Set API Key" message:@"This demo app will not work properly until you set your API key in defines.h" delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles: nil]; - [alert show]; - [alert autorelease]; - } else if ([kApptentiveAppID isEqualToString:@"ExampleAppID"]) { - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Please Set App ID" message:@"This demo app won't be able to show your app in the app store until you set your App ID in defines.h" delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles: nil]; - [alert show]; - [alert autorelease]; - } -} - -- (void)viewWillAppear:(BOOL)animated { - [self.tableView reloadData]; - [super viewWillAppear:animated]; -} - -- (void)viewDidAppear:(BOOL)animated { - [super viewDidAppear:animated]; - [self checkForProperConfiguration]; -} - -- (void)viewWillDisappear:(BOOL)animated { - [super viewWillDisappear:animated]; -} - -- (void)viewDidDisappear:(BOOL)animated { - [super viewDidDisappear:animated]; -} - -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - return YES; -} - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return kSectionCount; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - if (section == kFeedbackSection) { - return 2; - } else if (section == kSurveySection) { - return 2; - } - return 1; -} - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier = @"Cell"; - static NSString *SurveyTagsCell = @"SurveyTagsCell"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; - } - if (indexPath.section == kFeedbackSection) { - if (indexPath.row == 0) { - cell.textLabel.text = @"Send Feedback"; - } else { - cell.textLabel.text = @"Send Feedback with Screenshot"; - } - } else if (indexPath.section == kRatingSection) { - cell.textLabel.text = @"Start Rating Flow"; - } else if (indexPath.section == kSurveySection) { - if (indexPath.row == 0) { - if ([ATSurveys hasSurveyAvailable]) { - cell.textLabel.text = @"Show Survey"; - cell.textLabel.textColor = [UIColor blackColor]; - } else { - cell.textLabel.text = @"No Survey Available"; - cell.textLabel.textColor = [UIColor grayColor]; - } - } else if (indexPath.row == 1) { - cell = [tableView dequeueReusableCellWithIdentifier:SurveyTagsCell]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:SurveyTagsCell] autorelease]; - } - if ([ATSurveys hasSurveyAvailableWithTags:tags]) { - cell.textLabel.text = @"Show Survey With Tags"; - cell.textLabel.textColor = [UIColor blackColor]; - } else { - cell.textLabel.text = @"No Survey Available With Tags"; - cell.textLabel.textColor = [UIColor grayColor]; - } - NSArray *tagArray = [tags allObjects]; - cell.detailTextLabel.text = [NSString stringWithFormat:@"tags: %@", [tagArray componentsJoinedByString:@", "]]; - } - } - - return cell; -} - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - if (indexPath.section == kFeedbackSection) { - ATConnect *connection = [ATConnect sharedConnection]; - if (indexPath.row == 0) { - connection.shouldTakeScreenshot = NO; - } else if (indexPath.row == 1) { - connection.shouldTakeScreenshot = YES; - } - [self showFeedback:nil]; - } else if (indexPath.section == kRatingSection) { - [self showRating:nil]; - } else if (indexPath.section == kSurveySection) { - if (indexPath.row == 0) { - if ([ATSurveys hasSurveyAvailable]) { - [ATSurveys presentSurveyControllerFromViewController:self]; - } - } else if (indexPath.row == 1) { - if ([ATSurveys hasSurveyAvailableWithTags:tags]) { - [ATSurveys presentSurveyControllerWithTags:tags fromViewController:self]; - } - } - } - [tableView deselectRowAtIndexPath:indexPath animated:YES]; -} - -- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { - NSString *title = nil; - if (section == kFeedbackSection) { - title = @"Feedback"; - } else if (section == kRatingSection) { - title = @"Ratings"; - } else if (section == kSurveySection) { - title = @"Surveys"; - } - return title; -} - -- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section { - NSString *title = nil; - if (section == kFeedbackSection) { - title = @"Opens feedback screen."; - } else if (section == kRatingSection) { - title = nil; - } else if (section == kSurveySection) { - title = [NSString stringWithFormat:@"ApptentiveConnect v%@", kATConnectVersionString]; - } - return title; -} - -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; -} - -- (void)viewDidUnload { - [super viewDidUnload]; -} - -- (void)dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; - [tags release], tags = nil; - [super dealloc]; -} -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/defines.h b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/defines.h deleted file mode 100755 index 231dab4..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/defines.h +++ /dev/null @@ -1,10 +0,0 @@ -// -// defines.h -// FeedbackDemo -// -// Created by Andrew Wooster on 3/19/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#define kApptentiveAPIKey @"" -#define kApptentiveAppID @"ExampleAppID" diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/en.lproj/InfoPlist.strings b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/en.lproj/InfoPlist.strings deleted file mode 100755 index 477b28f..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/en.lproj/MainWindow.xib b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/en.lproj/MainWindow.xib deleted file mode 100755 index 6783bf9..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/en.lproj/MainWindow.xib +++ /dev/null @@ -1,346 +0,0 @@ - - - - 1280 - 11C74 - 1938 - 1138.23 - 567.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 933 - - - YES - IBProxyObject - IBUINavigationController - IBUIViewController - IBUICustomObject - IBUIWindow - IBUINavigationBar - IBUINavigationItem - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - IBCocoaTouchFramework - - - - 1316 - - {320, 480} - - - - - 1 - MSAxIDEAA - - NO - NO - - IBCocoaTouchFramework - YES - - - - - 1 - 1 - - IBCocoaTouchFramework - NO - - - 256 - {0, 0} - NO - YES - YES - IBCocoaTouchFramework - - - YES - - - - Root View Controller - IBCocoaTouchFramework - - - RootViewController - - - 1 - 1 - - IBCocoaTouchFramework - NO - - - - - - - YES - - - delegate - - - - 4 - - - - window - - - - 5 - - - - navigationController - - - - 15 - - - - - YES - - 0 - - YES - - - - - - 2 - - - YES - - - - - -1 - - - File's Owner - - - 3 - - - - - -2 - - - - - 9 - - - YES - - - - - - - 11 - - - - - 13 - - - YES - - - - - - 14 - - - - - - - YES - - YES - -1.CustomClassName - -1.IBPluginDependency - -2.CustomClassName - -2.IBPluginDependency - 11.IBPluginDependency - 13.CustomClassName - 13.IBPluginDependency - 14.IBPluginDependency - 2.IBAttributePlaceholdersKey - 2.IBPluginDependency - 3.CustomClassName - 3.IBPluginDependency - 9.IBPluginDependency - - - YES - UIApplication - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - RootViewController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - YES - - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - FeedbackDemoAppDelegate - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - - - - YES - - - - - 17 - - - - YES - - FeedbackDemoAppDelegate - NSObject - - YES - - YES - navigationController - window - - - YES - UINavigationController - UIWindow - - - - YES - - YES - navigationController - window - - - YES - - navigationController - UINavigationController - - - window - UIWindow - - - - - IBProjectSource - ./Classes/FeedbackDemoAppDelegate.h - - - - RootViewController - UITableViewController - - YES - - YES - showFeedback: - showRating: - - - YES - id - id - - - - YES - - YES - showFeedback: - showRating: - - - YES - - showFeedback: - id - - - showRating: - id - - - - - IBProjectSource - ./Classes/RootViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - 3 - 933 - - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/en.lproj/RootViewController.xib b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/en.lproj/RootViewController.xib deleted file mode 100755 index 4121e2b..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/en.lproj/RootViewController.xib +++ /dev/null @@ -1,270 +0,0 @@ - - - - 1280 - 10K549 - 1938 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 933 - - - YES - IBProxyObject - IBUITableView - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - {320, 247} - - - - 10 - - 549453824 - {512, 1} - - YES - - YES - - - - TU0AKgAACAjFzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/ -y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/ -xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/ -xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/ -xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/ -xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/ -xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/ -y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/ -y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/ -xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/ -xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/ -xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/ -xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/ -xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/ -y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/ -y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/ -xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/ -xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/ -xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/ -xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/ -xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/ -y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/ -y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/ -xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/ -xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/ -xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/ -xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/ -xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/ -y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/ -y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/ -xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/ -xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/ -xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/ -xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/ -xczS/8vS2P/L0tj/xczU/wANAQAAAwAAAAECAAAAAQEAAwAAAAEAAQAAAQIAAwAAAAQAAAiqAQMAAwAA -AAEAAQAAAQYAAwAAAAEAAgAAAREABAAAAAEAAAAIARIAAwAAAAEAAQAAARUAAwAAAAEABAAAARYAAwAA -AAEAAQAAARcABAAAAAEAAAgAARwAAwAAAAEAAQAAAVIAAwAAAAEAAQAAAVMAAwAAAAQAAAiyAAAAAAAI -AAgACAAIAAEAAQABAAE - - - - - - 3 - MCAwAA - - - groupTableViewBackgroundColor - - NO - YES - NO - - 3 - 3 - - IBCocoaTouchFramework - NO - 1 - 2 - 0 - YES - 44 - 10 - 10 - - - - - YES - - - view - - - - 3 - - - - dataSource - - - - 4 - - - - delegate - - - - 5 - - - - - YES - - 0 - - YES - - - - - - -1 - - - File's Owner - - - -2 - - - - - 2 - - - - - - - YES - - YES - -1.CustomClassName - -1.IBPluginDependency - -2.CustomClassName - -2.IBPluginDependency - 2.IBPluginDependency - - - YES - RootViewController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - - - - YES - - - - - 5 - - - - YES - - RootViewController - UITableViewController - - YES - - YES - showFeedback: - showRating: - - - YES - id - id - - - - YES - - YES - showFeedback: - showRating: - - - YES - - showFeedback: - id - - - showRating: - id - - - - - IBProjectSource - ./Classes/RootViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - 3 - 933 - - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/iPad/en.lproj/MainWindow-iPad.xib b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/iPad/en.lproj/MainWindow-iPad.xib deleted file mode 100755 index 13cc5f6..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/iPad/en.lproj/MainWindow-iPad.xib +++ /dev/null @@ -1,557 +0,0 @@ - - - - 1056 - 10J567 - 844 - 1038.35 - 462.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 141 - - - YES - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBIPadFramework - - - IBFirstResponder - IBIPadFramework - - - IBIPadFramework - - - - 1316 - - {768, 1004} - - 1 - MSAxIDEAA - - NO - NO - - 2 - - IBIPadFramework - YES - - - - - 1 - - IBIPadFramework - NO - - - 256 - {0, 0} - NO - YES - YES - IBIPadFramework - - - YES - - - IBIPadFramework - - - RootViewController - - - 1 - - IBIPadFramework - NO - - - - - - - YES - - - delegate - - - - 4 - - - - window - - - - 5 - - - - navigationController - - - - 15 - - - - - YES - - 0 - - - - - - 2 - - - YES - - - - - -1 - - - File's Owner - - - 3 - - - - - -2 - - - - - 9 - - - YES - - - - - - - 11 - - - - - 13 - - - YES - - - - - - 14 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 11.IBPluginDependency - 13.CustomClassName - 13.IBLastUsedUIStatusBarStylesToTargetRuntimesMap - 13.IBPluginDependency - 2.IBAttributePlaceholdersKey - 2.IBEditorWindowLastContentRect - 2.IBLastUsedUIStatusBarStylesToTargetRuntimesMap - 2.IBPluginDependency - 3.CustomClassName - 3.IBPluginDependency - 9.IBEditorWindowLastContentRect - 9.IBLastUsedUIStatusBarStylesToTargetRuntimesMap - 9.IBPluginDependency - - - YES - UIApplication - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - RootViewController - - IBCocoaTouchFramework - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - YES - - - YES - - - {{673, 376}, {320, 480}} - - IBCocoaTouchFramework - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - FeedbackDemoAppDelegate - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - {{186, 376}, {320, 480}} - - IBCocoaTouchFramework - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 16 - - - - YES - - FeedbackDemoAppDelegate - NSObject - - YES - - YES - navigationController - window - - - YES - UINavigationController - UIWindow - - - - YES - - YES - navigationController - window - - - YES - - navigationController - UINavigationController - - - window - UIWindow - - - - - IBProjectSource - FeedbackDemoAppDelegate.h - - - - RootViewController - UITableViewController - - IBProjectSource - RootViewController.h - - - - UIWindow - UIView - - IBUserSource - - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIApplication - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIApplication.h - - - - UIBarButtonItem - UIBarItem - - IBFrameworkSource - UIKit.framework/Headers/UIBarButtonItem.h - - - - UIBarItem - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIBarItem.h - - - - UINavigationBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UINavigationBar.h - - - - UINavigationController - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UINavigationItem - NSObject - - - - UIResponder - NSObject - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UITableViewController - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITableViewController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - UIWindow - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIWindow.h - - - - - 0 - IBIPadFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - FeedbackDemo.xcodeproj - 3 - 141 - - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/main.m b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/main.m deleted file mode 100755 index 5aef552..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemo/main.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// main.m -// FeedbackDemo -// -// Created by Andrew Wooster on 3/18/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import - -int main(int argc, char *argv[]) -{ - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - int retVal = UIApplicationMain(argc, argv, nil, nil); - [pool release]; - return retVal; -} diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemoTests/FeedbackDemoTests-Info.plist b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemoTests/FeedbackDemoTests-Info.plist deleted file mode 100755 index 165de61..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemoTests/FeedbackDemoTests-Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - com.apptentive.demoapp.${PRODUCT_NAME:rfc1034identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemoTests/FeedbackDemoTests-Prefix.pch b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemoTests/FeedbackDemoTests-Prefix.pch deleted file mode 100755 index 1892c27..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemoTests/FeedbackDemoTests-Prefix.pch +++ /dev/null @@ -1,7 +0,0 @@ -// -// Prefix header for all source files of the 'FeedbackDemoTests' target in the 'FeedbackDemoTests' project -// - -#ifdef __OBJC__ - #import -#endif diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemoTests/FeedbackDemoTests.h b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemoTests/FeedbackDemoTests.h deleted file mode 100755 index 4f69c3f..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemoTests/FeedbackDemoTests.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// FeedbackDemoTests.h -// FeedbackDemoTests -// -// Created by Andrew Wooster on 3/18/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import - - -@interface FeedbackDemoTests : SenTestCase { -@private - -} - -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemoTests/FeedbackDemoTests.m b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemoTests/FeedbackDemoTests.m deleted file mode 100755 index 3129fe4..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemoTests/FeedbackDemoTests.m +++ /dev/null @@ -1,33 +0,0 @@ -// -// FeedbackDemoTests.m -// FeedbackDemoTests -// -// Created by Andrew Wooster on 3/18/11. -// Copyright 2011 Apptentive, Inc.. All rights reserved. -// - -#import "FeedbackDemoTests.h" - - -@implementation FeedbackDemoTests - -- (void)setUp -{ - [super setUp]; - - // Set-up code here. -} - -- (void)tearDown -{ - // Tear-down code here. - - [super tearDown]; -} - -- (void)testExample -{ - //STFail(@"Unit tests are not implemented yet in FeedbackDemoTests"); -} - -@end diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemoTests/en.lproj/InfoPlist.strings b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemoTests/en.lproj/InfoPlist.strings deleted file mode 100755 index 477b28f..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/FeedbackDemoTests/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/art/Default-568h@2x.png b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/art/Default-568h@2x.png deleted file mode 100755 index e9c028d..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/art/Default-568h@2x.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/art/generated/at_logo_info.png b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/art/generated/at_logo_info.png deleted file mode 100755 index a67adc5..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/art/generated/at_logo_info.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/art/generated/at_logo_info@2x.png b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/art/generated/at_logo_info@2x.png deleted file mode 100755 index 6ba830e..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/art/generated/at_logo_info@2x.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/art/generated/iTunesArtwork b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/art/generated/iTunesArtwork deleted file mode 100755 index 902ab6a..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/art/generated/iTunesArtwork and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/English.lproj/Localizable.strings b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/English.lproj/Localizable.strings deleted file mode 100755 index 3a1680b..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/English.lproj/Localizable.strings and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/de.lproj/Localizable.strings b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/de.lproj/Localizable.strings deleted file mode 100755 index 3a1680b..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/de.lproj/Localizable.strings and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/es.lproj/Localizable.strings b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/es.lproj/Localizable.strings deleted file mode 100755 index a155f2f..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/es.lproj/Localizable.strings and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/ja.lproj/Localizable.strings b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/ja.lproj/Localizable.strings deleted file mode 100755 index 3a1680b..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/ja.lproj/Localizable.strings and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/pt.lproj/Localizable.strings b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/pt.lproj/Localizable.strings deleted file mode 100755 index 3a1680b..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/pt.lproj/Localizable.strings and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/ru.lproj/Localizable.strings b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/ru.lproj/Localizable.strings deleted file mode 100755 index 3a1680b..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/ru.lproj/Localizable.strings and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/zh-Hans.lproj/Localizable.strings b/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/zh-Hans.lproj/Localizable.strings deleted file mode 100755 index 3a1680b..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/FeedbackDemo/resources/localization/zh-Hans.lproj/Localizable.strings and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/LICENSE.txt b/Clocker/ApptentiveConnect/apptentive-ios/LICENSE.txt deleted file mode 100755 index 4e119d1..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/LICENSE.txt +++ /dev/null @@ -1,24 +0,0 @@ -Copyright (c) 2011, Apptentive, Inc. -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. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the Apptentive, Inc. 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 Apptentive, Inc. 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. \ No newline at end of file diff --git a/Clocker/ApptentiveConnect/apptentive-ios/README.md b/Clocker/ApptentiveConnect/apptentive-ios/README.md deleted file mode 100755 index 91a4fb4..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/README.md +++ /dev/null @@ -1,217 +0,0 @@ -Apptentive iOS SDK -================== - -This iOS library allows you to add a quick and easy in-app-feedback mechanism -to your iOS applications. Feedback is sent to the Apptentive web service. - -Quickstart -========== - -There are no external dependencies for this SDK. - -Sample Application ------------------- -The sample application FeedbackDemo demonstrates how to integrate the SDK -with your application. - -The demo app includes the normal feedback flow, which can be activated by -clicking the Feedback button. It's a one screen process which can gather -feedback, an email address, and even a screenshot: - -![Feedback Screen](etc/screenshots/feedback_iphone.png?raw=true) - -The rating flow can be activated by clicking on the Ratings button. It asks -the user if they are happy with the app. If not, then a simplified feedback -window is opened. If they are happy with the app, they are prompted to rate -the app in the App Store: - -![Popup](etc/screenshots/rating.png?raw=true) - - -Required Frameworks -------------------- -In order to use `ApptentiveConnect`, your project must link against the -following frameworks: - -* CoreGraphics -* CoreTelephony -* Foundation -* QuartzCore -* StoreKit -* SystemConfiguration -* UIKit - -Project Settings for Xcode 4 ----------------------------- -The instructions below are for source integration. For binary releases, see our [Binary Distributions](https://github.com/apptentive/apptentive-ios/wiki/Binary-Distributions) page. - -There is a video demoing integration in Xcode 4 here: -http://vimeo.com/23710908 - -Drag the `ApptentiveConnect.xcodeproj` project to your project in Xcode 4 and -add it as a subproject. You can do the same with a workspace. - -In your target's `Build Settings` section, add the following to your -`Other Linker Flags` settings: - - -ObjC -all_load - -In your target's `Build Phases` section, add the `ApptentiveConnect` and -`ApptentiveResources` targets to your `Target Dependencies`. - -Then, add `libApptentiveConnect.a` to `Link Binary With Libraries` - -Build the `ApptentiveResources` target for iOS devices. Then, add the -`ApptentiveResources.bundle` from the `ApptentiveConnect` products in the -file navigator into your `Copy Bundle Resources` build phase. Building -for iOS devices first works around a bug in Xcode 4. - -Now, drag `ATConnect.h` from `ApptentiveConnect.xcodeproj` to your app's -file list. - -Now see "Using the Library", below, for instructions on using the library in your code. - -Using the Library ------------------ - -`ApptentiveConnect` queues feedback and attempts to upload in the background. This -is intended to provide as quick a mechanism for submitting feedback as possible. - -In order for queued/interrupted feedback uploads to continue uploading, we -recommending instantiating `ATConnect` and setting the API key at application -startup, like: - -``` objective-c -#include "ATConnect.h" -// ... -- (void)applicationDidFinishLaunching:(UIApplication *)application /* ... */ { - ATConnect *connection = [ATConnect sharedConnection]; - connection.apiKey = kApptentiveAPIKey; - // ... -} -``` - -Where `kApptentiveAPIKey` is an `NSString` containing your API key. As soon -as you set the API key on the shared connection object, any queued feedback -will start to upload, pending network availability. You also should not have -to set the API key again on the shared connection object. - -Now, you can show the Apptentive feedback UI from a `UIViewController` with: - -``` objective-c -#include "ATConnect.h" -// ... -ATConnect *connection = [ATConnect sharedConnection]; -[connection presentFeedbackControllerFromViewController:self]; -``` - -Easy! - - -App Rating Flow ---------------- -`ApptentiveConnect` now provides an app rating flow similar to other projects -such as [appirator](https://github.com/arashpayan/appirater). This uses the number -of launches of your application, the amount of time users have been using it, and -the number of significant events the user has completed (for example, levels passed) -to determine when to display a ratings dialog. - -To use it, add the `ATAppRatingFlow.h` header file to your project. - -Then, at startup, instantiate a shared `ATAppRatingFlow` object with your -iTunes app ID (see "Finding Your iTunes App ID" below): - -``` objective-c -#include "ATAppRatingFlow.h" -// ... -- (void)applicationDidFinishLaunching:(UIApplication *)application /* ... */ { - ATAppRatingFlow *sharedFlow = [ATAppRatingFlow sharedRatingFlowWithAppID:@""]; - // The parameter is a BOOL indicating whether a rating dialog can be - // shown here. - [sharedFlow appDidLaunch:YES viewController:self.navigationController]; - - // ... -} - -- (void)applicationDidBecomeActive:(UIApplication *)application { - ATAppRatingFlow *sharedFlow = [ATAppRatingFlow sharedRatingFlowWithAppID:@""]; - [sharedFlow appDidEnterForeground:YES viewController:self.navigationController]; -} -``` - -The `viewController` parameter is necessary in order to be able to show the -feedback view controller if a user is unhappy with your app. - -If you're using significant events to determine when to show the ratings flow, you can -increment the number of significant events by calling: - -``` -[sharedFlow userDidPerformSignificantEvent:canPromptForRating viewController:aViewController]; -``` - -Above, `canPromptForRating` is a `BOOL` indicating whether the user could be prompted for a rating then and there, and `aViewController` is a `UIViewController` from which to display the feedback view controller if the user is unhappy with your app. - - -You can also choose to show the dialog manually: - -``` objective-c -ATAppRatingFlow *sharedFlow = [ATAppRatingFlow sharedRatingFlowWithAppID:kApptentiveAppID]; -[sharedFlow showEnjoymentDialog:aViewController]; -``` - -This is helpful if you want to implement custom triggers for the ratings -flow. - -You can modify the parameters which determine when the ratings dialog will be -shown in your app settings on apptentive.com. - - -Metrics -------- -Metrics provide insight into exactly where people begin and end interactions -with your app and with feedback, ratings, and surveys. You can enable and disable -metrics on your app settings page on apptentive.com. - - -Surveys -------- -To use surveys, add the `ATSurveys.h` header to your project. - -You can check for available surveys after having set up `ATConnect` (see above) -by calling `[ATSurveys checkForAvailableSurveys]` and registering for the -`ATSurveyNewSurveyAvailableNotification` notification. Then, you may present a -survey by calling `[ATSurveys presentSurveyControllerFromViewController:vc]`, -where `vc` is the view controller which will present the survey. - -For example: - -```objective-c -#include "ATSurveys.h" -// ... -- (void)applicationDidFinishLaunching:(UIApplication *)application /* ... */ { - // ... - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(surveyBecameAvailable:) name:ATSurveyNewSurveyAvailableNotification object:nil]; - [ATSurveys checkForAvailableSurveys]; -} - -- (void)surveyBecameAvailable:(NSNotification *)notification { - // Present survey here as appropriate. -} -``` - - -**Finding Your iTunes App ID** -In [iTunesConnect](https://itunesconnect.apple.com/), go to "Manage Your -Applications" and click on your application. In the "App Information" -section of the page, look for the "Apple ID". It will be a number. This is -your iTunes application ID. - -Contributing ------------- -We love contributions! - -Any contributions to the master apptentive-ios project must sign the [Individual Contributor License Agreement (CLA)](https://docs.google.com/a/apptentive.com/spreadsheet/viewform?formkey=dDhMaXJKQnRoX0dRMzZNYnp5bk1Sbmc6MQ#gid=0). It's a doc that makes our lawyers happy and ensures we can provide a solid open source project. - -When you want to submit a change, send us a [pull request](https://github.com/apptentive/apptentive-ios/pulls). Before we merge, we'll check to make sure you're on the list of people who've signed our CLA. - -Thanks! diff --git a/Clocker/ApptentiveConnect/apptentive-ios/etc/bin/build_distribution.py b/Clocker/ApptentiveConnect/apptentive-ios/etc/bin/build_distribution.py deleted file mode 100755 index 17e534a..0000000 --- a/Clocker/ApptentiveConnect/apptentive-ios/etc/bin/build_distribution.py +++ /dev/null @@ -1,193 +0,0 @@ -#!/usr/bin/env python -from contextlib import contextmanager -import os -import biplist -import re -import shutil -import subprocess -import sys - -HELP_MESSAGE = """ -./build_distribution.py -""" - -class Usage(Exception): - def __init__(self, msg): - super(Usage, self).__init__(msg) - self.msg = msg - -def log(msg): - print >> sys.stderr, msg - -@contextmanager -def chdir(path): - curdir = os.getcwd() - os.chdir(path) - try: - yield - finally: - os.chdir(curdir) - -def escape_arg(argument): - """Escapes an argument to a command line utility.""" - argument = argument.replace('\\', "\\\\").replace("'", "\'").replace('"', '\\"').replace("!", "\\!").replace("`", "\\`") - return "\"%s\"" % argument - -def run_command(command, verbose=False): - if verbose: - sys.stderr.write("Running: %s\n" % command) - p = subprocess.Popen(command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE) - stdin, stdout = (p.stdin, p.stdout) - output = stdout.read() - output = output.strip("\n") - status = stdin.close() - stdout.close() - p.wait() - return (p.returncode, output) - -class Builder(object): - COCOAPODS_DIST = "COCOAPODS_DIST" - BINARY_DIST = "BINARY_DIST" - build_root = "/tmp/apptentive_connect_build" - dist_type = None - def __init__(self, verbose=False, dist_type=None): - if not dist_type: - dist_type = self.BINARY_DIST - self.verbose = verbose - self.dist_type = dist_type - if dist_type not in [self.COCOAPODS_DIST, self.BINARY_DIST]: - log("Unknown dist_type: %s" % dist_type) - sys.exit(1) - - def build(self): - # First, build the simulator target. - with chdir(self._project_dir()): - sim_build_command = self._build_command(is_simulator=True) - (status, output) = run_command(sim_build_command, verbose=self.verbose) - if status != 0: - log("Building for simulator failed with code: %d" % status) - log(output) - return False - dev_build_command = self._build_command() - (status, output) = run_command(dev_build_command, verbose=self.verbose) - if status != 0: - log("Building for device failed with code: %d" % status) - log(output) - return False - library_dir = self._output_dir() - try: - if os.path.exists(library_dir): - shutil.rmtree(library_dir) - os.makedirs(library_dir) - os.makedirs(os.path.join(library_dir, 'include')) - except Exception as e: - log("Exception %s" % e) - pass - if not os.path.exists(library_dir): - log("Unable to create output directory at: %s" % library_dir) - return False - (status, output) = run_command(self._lipo_command(), verbose=self.verbose) - if status != 0: - log("Unable to lipo static libraries") - log(output) - return False - paths_to_copy = [("source/ATConnect.h", "include/ATConnect.h"), ("source/Rating Flow/ATAppRatingFlow.h", "include/ATAppRatingFlow.h"), ("source/Surveys/ATSurveys.h", "include/ATSurveys.h"), ("../LICENSE.txt", "LICENSE.txt"), ("../README.md", "README.md"), ("../CHANGELOG.md", "CHANGELOG.md")] - for (project_path, destination_path) in paths_to_copy: - full_project_path = project_path - full_destination_path = os.path.join(self._output_dir(), destination_path) - (status, output) = self._ditto_file(full_project_path, full_destination_path) - if status != 0: - log("Unable to ditto project path: %s" % full_project_path) - log(output) - return False - # Copy the ApptentiveResources.bundle. - bundle_source = os.path.join(self._products_dir(), "ApptentiveResources.bundle") - bundle_dest = os.path.join(self._output_dir(), "ApptentiveResources.bundle") - (status, output) = self._ditto_file(bundle_source, bundle_dest) - # Update the Info.plist in the ApptentiveResources.bundle. - bundle_plist_path = os.path.join(bundle_dest, "Info.plist") - if not os.path.exists(bundle_plist_path): - log("Unable to find bundle Info.plist at %s" % bundle_plist_path) - return False - plist = biplist.readPlist(bundle_plist_path) - plist_key = "ATInfoDistributionKey" - if self.dist_type == self.COCOAPODS_DIST: - plist[plist_key] = "CocoaPods" - elif self.dist_type == self.BINARY_DIST: - plist[plist_key] = "binary" - else: - log("Unknown dist_type") - return False - biplist.writePlist(plist, bundle_plist_path) - - # Try to get the version. - version = None - header_contents = open(os.path.join(self._project_dir(), "source", "ATConnect.h")).read() - match = re.search(r"#define kATConnectVersionString @\"(?P.+)\"", header_contents, re.MULTILINE) - if match and match.group('version'): - version = match.group('version') - with chdir(self._output_dir()): - filename = 'apptentive_ios_sdk.tar.gz' - if version: - if self.dist_type == self.BINARY_DIST: - filename = 'apptentive_ios_sdk-%s.tar.gz' % version - elif self.dist_type == self.COCOAPODS_DIST: - filename = 'apptentive_ios_sdk-cocoapods-%s.tar.gz' % version - tar_command = "tar -zcvf ../%s ." % filename - (status, output) = run_command(tar_command, verbose=self.verbose) - if status != 0: - log("Unable to create library archive") - log("output") - return False - run_command("open .") - return True - - def _project_dir(self): - return os.path.join("..", "..", "ApptentiveConnect") - - def _output_dir(self): - return os.path.join(self.build_root, "library_dir") - - def _products_dir(self, is_simulator=False): - products_dir = os.path.join(self.build_root, "device_product") - if is_simulator: - products_dir = os.path.join(self.build_root, "simulator_product") - return products_dir - - def _xcode_options(self, is_simulator=False): - products_dir = self._products_dir(is_simulator=is_simulator) - symroot = os.path.join(self.build_root, "symroot") - temp_dir = os.path.join(self.build_root, "target_temp_dir") - return "CONFIGURATION_BUILD_DIR=%s SYMROOT=%s TARGET_TEMP_DIR=%s" % (escape_arg(products_dir), escape_arg(symroot), escape_arg(temp_dir)) - - def _lipo_command(self): - output_dir = self._output_dir() - lib = "libApptentiveConnect.a" - output_library = os.path.join(output_dir, lib) - input_a = os.path.join(self._products_dir(is_simulator=True), lib) - input_b = os.path.join(self._products_dir(is_simulator=False), lib) - return """xcrun lipo -create -output %s %s %s""" % (escape_arg(output_library), escape_arg(input_a), escape_arg(input_b)) - - def _build_command(self, is_simulator=False): - sdk = 'iphoneos' - if is_simulator: - sdk = 'iphonesimulator' - return """xcrun xcodebuild -target ApptentiveConnect -configuration Debug -sdk %s %s""" % (sdk, self._xcode_options(is_simulator=is_simulator)) - - def _project_path(self, filename): - """Returns the file within the project directory for the given filename.""" - return os.path.join(self._project_dir(), filename) - - def _ditto_file(self, path_from, path_to): - command = """xcrun ditto %s %s""" % (escape_arg(path_from), escape_arg(path_to)) - return run_command(command, verbose=self.verbose) - -if __name__ == "__main__": - for dist_type in [Builder.BINARY_DIST, Builder.COCOAPODS_DIST]: - builder = Builder(dist_type=dist_type) - result = builder.build() - if result == True: - log("Build suceeded") - else: - log("Build failed!") - break diff --git a/Clocker/ApptentiveConnect/apptentive-ios/etc/screenshots/feedback_iphone.png b/Clocker/ApptentiveConnect/apptentive-ios/etc/screenshots/feedback_iphone.png deleted file mode 100755 index d8b85d1..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/etc/screenshots/feedback_iphone.png and /dev/null differ diff --git a/Clocker/ApptentiveConnect/apptentive-ios/etc/screenshots/rating.png b/Clocker/ApptentiveConnect/apptentive-ios/etc/screenshots/rating.png deleted file mode 100755 index 7d16e08..0000000 Binary files a/Clocker/ApptentiveConnect/apptentive-ios/etc/screenshots/rating.png and /dev/null differ diff --git a/Clocker/CLRatingCellView.m b/Clocker/CLRatingCellView.m index db6eaf5..7528266 100644 --- a/Clocker/CLRatingCellView.m +++ b/Clocker/CLRatingCellView.m @@ -10,10 +10,11 @@ #import "iRate.h" #import #import "PanelController.h" -#import @implementation CLRatingCellView +NSString *const CLGitHubIssueURL =@"https://github.com/Abhishaker17/Clocker/issues"; + - (void)drawRect:(NSRect)dirtyRect { [super drawRect:dirtyRect]; @@ -48,8 +49,7 @@ else if ([rightButton.title isEqualToString:@"Yes?"]) { [self updateMainTableView]; - ATConnect *connection = [ATConnect sharedConnection]; - [connection showFeedbackWindow:sender]; + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:CLGitHubIssueURL]]; } else diff --git a/Clocker/Clocker-Info.plist b/Clocker/Clocker-Info.plist index b85e51c..79b8c04 100755 --- a/Clocker/Clocker-Info.plist +++ b/Clocker/Clocker-Info.plist @@ -39,7 +39,7 @@ LSUIElement NSHumanReadableCopyright - Copyright © 2011, 2012 Shpakovski + Copyright © 2015, Abhishek Banthia NSMainNibFile MainMenu NSPrincipalClass diff --git a/Clocker/Preferences/CLPreferencesView.xib b/Clocker/Preferences/CLPreferencesView.xib index 99c0e59..9568d28 100644 --- a/Clocker/Preferences/CLPreferencesView.xib +++ b/Clocker/Preferences/CLPreferencesView.xib @@ -168,9 +168,9 @@ - + - + @@ -208,7 +208,7 @@ - +