2
0

Compare commits

...

298 Commits

Author SHA1 Message Date
Maarten Billemont
c1162c76d3 LoveLyndir & USM fixes.
[IMPROVED]      Sped up emergency display.
[UPDATED]       LoveLyndir and USM bump for fixes.
2013-11-09 20:18:36 -05:00
Maarten Billemont
231426d5b3 Add LoveLyndir module. 2013-11-09 19:54:55 -05:00
Maarten Billemont
783eb95438 LoveLyndir bump. 2013-11-07 22:07:46 -05:00
Maarten Billemont
7bdc3e153d Removed NSURL+UbiquityStoreManager from USM. 2013-11-07 22:06:06 -05:00
Maarten Billemont
28460d4576 Handle StoreUUID conflicts and new (offline) devices. 2013-11-07 22:03:34 -05:00
Maarten Billemont
396f6fa7bd Navbar overlap in all-sites VC.
[FIXED]     Navbar hack in all-sites causing overlap on device in iOS 7.
[UPDATED]   iCloud defaults to off.
2013-11-04 08:22:30 -05:00
Maarten Billemont
e39eafee7f Importing sites, activity in iOS 7, wipe cloud, love lyndir.
[FIXED]     Bugs when importing mpsites when the user doesn't exist yet.
[FIXED]     Activity now displayed using PearlOverlay, PearlAlert broke in iOS 7 for activity.
[ADDED]     Advanced option to wipe cloud container.
[UPDATED]   Love Lyndir completion.
2013-10-30 23:37:12 -04:00
Maarten Billemont
f1549fe922 Explain other solutions to the iCloud sites problem.
[UPDATED]   Site explains other solutions to iCloud sites disappearing.
2013-10-18 11:13:02 -04:00
Maarten Billemont
b16c539607 Initial LoveLyndir integration. 2013-10-18 01:16:26 -04:00
Maarten Billemont
b11b33da5f Fix potential crash due to reloading of main view and gesture recognizers.
[MOVED]     Search delegates and controllers and gesture recognizers are now fully handled by the storyboard.
2013-10-17 08:15:29 -04:00
Maarten Billemont
6e9cd5a1f5 Fixed app review URL.
[FIXED]     Review button from within app wasn't working anymore on iOS 7.
2013-10-05 21:25:11 -04:00
Maarten Billemont
b67132671a Modernized Obj-C syntax.
[UPDATED]   Modernized Obj-C syntax.
2013-09-27 21:23:52 -04:00
Maarten Billemont
14e34e8e7a Debug an issue with iOS 6 -> iOS 7 cloud store migration. 2013-09-27 20:06:07 -04:00
Maarten Billemont
16f5ab29fa Fix EXCLUDED_SOURCE_FILE_NAMES. 2013-09-22 23:58:21 -04:00
Maarten Billemont
2af717fe5e Bump USM. 2013-09-22 23:56:19 -04:00
Maarten Billemont
c5be6bd742 Fixed local store migration and possible crash.
[FIXED]     Migration to local store.
[FIXED]     Potential crash when enumerating sheets to dismiss.
2013-09-22 23:46:06 -04:00
Maarten Billemont
693eddb578 Bump libraries. 2013-09-22 01:12:19 -04:00
Maarten Billemont
46e5bc2cbf Bump Pearl. 2013-09-21 22:13:32 -04:00
Maarten Billemont
f11afaaa45 Bump Pearl. 2013-09-21 10:46:27 -04:00
Maarten Billemont
cf64ce96f2 Merge branch 'master' of github.com:Lyndir/MasterPassword 2013-09-21 10:44:04 -04:00
Maarten Billemont
b1eae1b06a Bump libs. 2013-09-21 10:43:39 -04:00
Maarten Billemont
d19af3aba8 Fixes for 64-bit and ubiquity logging.
[ADDED]     Debugging with DCIntrospect and Reveal.
[REMOVED]   A bunch of google+ files that are no longer necessary.
[FIXED]     Type and formatting fixes for 64-bit platform types.
[UPDATED]   Production logging of what StoreManager is doing to help people with trouble out.
[ADDED]     Log reason for ubiquity error to checkpoint.
2013-09-21 10:34:48 -04:00
Maarten Billemont
ece5341e27 Cloud store recovery procedure.
[ADDED]     Describe the procedure to recover cloud stores on the website.
2013-09-20 19:25:53 -04:00
Maarten Billemont
7f9aaf4642 Submodule fixes.
[UPDATED]   InAppSettingsKit now uses the lhunath repo.
[UPDATED]   Fix to updating submodule repo URLs in updateDependencies.
[UPDATED]   Minor fix to PearlEmail.
2013-09-19 11:27:47 -04:00
Maarten Billemont
d59c3690d4 Bump Pearl. 2013-09-18 00:22:47 -04:00
Maarten Billemont
37070e482d Fixed a bunch of UI quirks, iOS 6 & 7.
[FIXED]     UI Quirks in iOS 6 and iOS 7.
2013-09-18 00:21:52 -04:00
Maarten Billemont
7fd322a5c6 Fixed icon and version references in Info.plist.
[FIXED]     Remove obsolete icon Info.plist keys.
[FIXED]     Auto-generated CFBundleVersion hash->decimal must be 9 digits long or version bump may end up lowering version number.
2013-09-17 00:13:21 -04:00
Maarten Billemont
07dd98823f Fixes to migration of local store from old Master Password model persistence models. 2013-09-16 23:18:01 -04:00
Maarten Billemont
40d6019f71 Improvements to store migration.
[IMPROVED]  Don't ask to migrate store when there's no sites in it.
2013-09-15 23:14:51 -04:00
Maarten Billemont
32ec0038b6 Bump USM. 2013-09-14 20:24:07 -04:00
Maarten Billemont
99a1d505d3 Fix a deadlock.
[FIXED]     Deadlock when NSUserDefaultsDidChange is handled on the main queue when the main queue is waiting for the persistence queue.
[FIXED]     Logging of cloudEnabled.
[REMOVED]   Debug NSLogs.
2013-09-14 20:21:25 -04:00
Maarten Billemont
62076d8170 Bump USM. 2013-09-14 14:05:47 -04:00
Maarten Billemont
009b1ff996 Fixes to cloud store switching.
[UPDATED]   Log out when user is no longer available.
[UPDATED]   Re-enabled cloud store switching using new USM store enumeration facilities.
[UPDATED]   Lower log level for test and crash logs so we can see why stuff fails.
2013-09-14 14:04:06 -04:00
Maarten Billemont
27870c7420 Fix positioning of toggles.
[FIXED]     Positioning of on/off toggles.
2013-09-14 00:10:12 -04:00
Maarten Billemont
7a16b47e37 Fading improvement, re-login fixed, UI tweaks.
[IMPROVED]  Fading of share/tip delayed, nicer effect.
[FIXED]     No automatic re-login when store changes and saveKey is YES for the current user.
[UPDATED]   Misc UI improvements.
[REMOVED]   Unassigned app icons and launch images.
2013-09-13 23:58:00 -04:00
Maarten Billemont
48324735e1 Fixed counter issue, status bar issue and updated app icons.
[FIXED]     Counter should default to 1, not 0.
[FIXED]     Some issues with the status bar in the MPMainViewController.
[UPDATED]   AppIcons and LaunchImages converted to asset catalog.
[ADDED]     New iOS 7 size app icon images.
2013-09-13 22:32:32 -04:00
Maarten Billemont
f0dcc4c34c Fixed queuing of password generation logic.
[IMPROVED]  Removed password logic out of MPEntities so that it can be backgrounded without relying on the persistence layer staying up.
[IMPROVED]  Some workload removed from the main thread.
2013-09-13 08:14:58 -04:00
Maarten Billemont
36386c3213 iOS 7 cloud loading. 2013-09-08 10:42:28 -04:00
Maarten Billemont
8ea0f00cf0 Improved cloud store enumeration.
[ADDED]     Stores now enumerated in a TVC.
2013-09-07 10:08:49 -04:00
Maarten Billemont
0921796136 Log VC, iCloud toggling, iOS 7 fixes.
[UPDATED]   Show users and sites in cloud stores of log VC.
[ADDED]     Ability to turn off iCloud if corruption happens.
[ADDED]     When switching iCloud on/off, provide user the option to migrate his current sites.
[ADDED]     Ability to get to settings & logs from unlock VC.
2013-09-05 23:52:12 -04:00
Maarten Billemont
ab360066e5 More robust migration.
[FIXED]     Better recovery from failure to migrate local store.
[FIXED]     Ability to migrate outdated local store models.
2013-08-31 12:29:56 -04:00
Maarten Billemont
34645c9433 Theming for iOS 6, updated status hiding and more exception handling.
[ADDED]     More verbose log printing when trace enabled.
[ADDED]     More exception handling on application launch; we can't allow any of this to keep us from being able to open the emergency generator.
[UPDATED]   Only apply UI theming on iOS 6-.
[ADDED]     Modern way of hiding the status bar on iOS 7.
2013-08-27 23:28:51 -04:00
Maarten Billemont
b2a608824c Merge branch 'master' into ios7
Conflicts:
	MasterPassword/ObjC/iOS/MasterPassword-iOS.xcodeproj/project.pbxproj
2013-08-27 22:18:40 -04:00
Maarten Billemont
af56920fd9 Show all release checks that fail at once. 2013-08-27 22:15:45 -04:00
Maarten Billemont
784b741b60 Fix documentation of LocalyticsSession.h 2013-08-27 22:05:16 -04:00
Maarten Billemont
ea066bd828 Fix some warnings in Pearl. 2013-08-27 21:56:47 -04:00
Maarten Billemont
c5d88bd5c7 Bumping libraries and project configuration updates.
[UPDATED]   TestFlight SDK -> 2.0.0
[UPDATED]   USM to deal with exceptions better.
[UPDATED]   Project configuration.
2013-08-27 21:51:56 -04:00
Maarten Billemont
a8115fdced Bump USM. 2013-08-27 20:49:02 -04:00
Maarten Billemont
c0406888fc Fix storyboard inconsistencies.
[FIXED]     Storyboard had multiple resource references with the same name.
2013-08-26 23:25:03 -04:00
Maarten Billemont
c7f04f8449 Merge branch 'master' into ios7 2013-08-26 23:20:28 -04:00
Maarten Billemont
ae4be86ecf UI fix for iOS 7.
[FIXED]     New ActionSheet doesn't deal well with spacing in items.
[FIXED]     UI now works on iOS 7.
2013-08-26 23:20:19 -04:00
Maarten Billemont
d188985823 Revert "UI fix for iOS 7."
This reverts commit ac0d412123.
2013-08-26 23:20:08 -04:00
Maarten Billemont
ac0d412123 UI fix for iOS 7.
[FIXED]     New ActionSheet doesn't deal well with spacing in items.
[FIXED]     UI now works on iOS 7.
2013-08-26 23:19:44 -04:00
Maarten Billemont
19e35dbccd Unclutter the UI and revert to no news. 2013-08-26 23:18:04 -04:00
Maarten Billemont
3086baf523 Fix MPAppsVC pager positioning on 4".
[FIXED]     Manually added pager VC added to wrong superview.
2013-08-26 23:17:02 -04:00
Maarten Billemont
e3d8d3c31c statusbar/navbar visibility & news.html
[FIXED]     Handle statusbar/navbar visibility only from viewWillAppear.
[FIXED]     URL to news.html.
2013-08-26 21:43:34 -04:00
Maarten Billemont
7589b3a048 Revert Xcode 5 change to storyboard. 2013-08-25 18:50:17 -04:00
Maarten Billemont
72f0d69a71 Don't use Localytics or Crashlytics when disabled. 2013-08-25 18:49:13 -04:00
Maarten Billemont
2399156ee4 Conditionally enable crash/analytics. 2013-08-25 15:38:38 -04:00
Maarten Billemont
3d3f08da9b Add a release checking script to prevent bad releases. 2013-08-15 22:18:17 -04:00
Maarten Billemont
2a0abf0da7 Merge branch 'master' of github.com:Lyndir/MasterPassword 2013-08-15 19:38:16 -04:00
Maarten Billemont
2d8146edbd Fixed potential crashed due to rare nil values at checkpoints.
[FIXED]     Avoid nil values at checkpoints since they will cause crashes.
2013-08-15 19:38:05 -04:00
Maarten Billemont
dad198f5e1 Update radials in site to support other browsers. 2013-08-15 09:53:08 -04:00
Maarten Billemont
0a5329fe17 Email/support un news.
[UPDATED]   Refresh news whenever the app opens.
[UPDATED]   Email and support links in news.html
2013-08-11 16:20:56 -04:00
Maarten Billemont
64d9f09cf6 Minor USM bump. 2013-08-11 15:40:44 -04:00
Maarten Billemont
d583d12099 Option to turn off iCloud on corruption.
[ADDED]     Option to turn off iCloud when store is broken.
2013-08-11 15:37:51 -04:00
Maarten Billemont
17bb5706f8 Fixed some minor crash cases.
[FIXED]     Crash when changing iCloud store.
[FIXED]     Use main thread when holding down on a user.
2013-08-11 15:30:01 -04:00
Maarten Billemont
d583bdfd3c Added support page to site.
[ADDED]     Site support page.
2013-08-11 14:11:19 -04:00
Maarten Billemont
9eb9667163 Make sure CFBundleVersion is always higher, try 2... 2013-08-11 00:23:45 -04:00
Maarten Billemont
a315a9dfc3 Make sure CFBundleVersion is always higher... 2013-08-11 00:20:10 -04:00
Maarten Billemont
8375808cdc Bump External dependencies. 2013-08-11 00:08:25 -04:00
Maarten Billemont
77439af486 Bump Crashlytics SDK. 2013-08-10 23:49:43 -04:00
Maarten Billemont
76f4a00738 Revert Storyboard back to Xcode 4 compatible format. 2013-08-10 23:32:33 -04:00
Maarten Billemont
9d615b2d4c Merge branch 'master' of github.com:Lyndir/MasterPassword 2013-07-07 21:17:00 -04:00
Maarten Billemont
aaffc0297e Profile bump.
[UPDATED]   Master Password Ad Hoc profile.
2013-07-07 21:15:57 -04:00
Maarten Billemont
5dc5885582 Site updates.
[UPDATED]   Mention the value of passwords never leaving your device.
[UPDATED]   Added some emphasis in the algorithm section.
2013-06-28 09:07:53 -04:00
Maarten Billemont
7389f5bf45 Fix queue of observer/notification blocks.
[FIXED]     Make sure all notification and observer blocks that expect the main thread are scheduled on it.
2013-06-26 20:23:02 -04:00
Maarten Billemont
b06d461a36 Fix code active signing profile. 2013-06-16 20:27:53 -04:00
Maarten Billemont
802f57878b Bump Press. 2013-06-16 20:25:11 -04:00
Maarten Billemont
bccf35d057 More clear master password creation tip.
[IMPROVED]  Word wall tip.
2013-06-16 19:31:09 -04:00
Maarten Billemont
137a1c531c Legacy icon set. 2013-06-16 15:09:33 -04:00
Maarten Billemont
e96df9f990 Xcode 4 build fixes. 2013-06-16 15:08:05 -04:00
Maarten Billemont
691670cc43 Fix Xcode 4 issues & double type trigger. 2013-06-16 14:22:36 -04:00
Maarten Billemont
bd64bfec67 Password window improvements.
[FIXED]     Password window closes initially.
[FIXED]     Site label more visible.
2013-06-16 13:48:51 -04:00
Maarten Billemont
0813fb40d0 Retire use of confinement concurrency type.
[FIXED]     Confinement concurrency type is just all sorts of buggy.
2013-06-16 12:39:52 -04:00
Maarten Billemont
3cb8215d5a Migrate to xcassets for app icon. 2013-06-16 11:26:32 -04:00
Maarten Billemont
a7fe11e8db Press bump. 2013-06-16 01:01:53 -04:00
Maarten Billemont
4a9fc66b5a Fix new analysis and compiler warnings. 2013-06-16 01:00:57 -04:00
Maarten Billemont
fb81cd61a9 More project configuration. 2013-06-16 00:49:44 -04:00
Maarten Billemont
13034b4184 Project configuration improvements and warning fixes.
[UPDATED]   Fixed some warnings by explicitly type-casting NSNotFound checks.
[UPDATED]   Fixed some Xcode 5 warnings by doing project configuration improvements.
2013-06-16 00:47:33 -04:00
Maarten Billemont
b2345da9f3 Type selection for Mac.
[ADDED]     Mac: Type selection for site passwords.
[UPDATED]   Type changing refactored to be OS independant.
2013-06-15 01:39:49 -04:00
Maarten Billemont
08d3d9ad30 Improve lock/unlock assurance flow.
[FIXED]     Bug that caused the window to sometimes re-open when closed.
2013-06-09 19:03:54 -04:00
Maarten Billemont
797060f609 Add a space to the OS X wrapper name. 2013-06-08 20:37:53 -04:00
Maarten Billemont
ea09116929 Merge branch 'master' of github.com:Lyndir/MasterPassword 2013-06-08 18:13:20 -04:00
Maarten Billemont
86758b498c Open at Login and initial window improvements.
[ADDED]     Mac: Open at Login.
[UPDATED]   Mac: Mark users menu item when no user selected.
[ADDED]     Mac: Toggle open-at-login and enable-cloud from initial window.
2013-06-08 18:12:49 -04:00
Maarten Billemont
9115b56a42 Update updateDependencies. 2013-06-05 09:09:23 -04:00
Maarten Billemont
c400868026 Activate before no-user alert.
[FIXED]     Also activate app before no-user alert.
2013-06-04 21:31:02 -04:00
Maarten Billemont
b4dbb15853 Submodule maintenance. 2013-06-04 08:25:32 -04:00
Maarten Billemont
195f70db53 Menu and first-launch improvements.
[ADDED]     On first start, show the status item by highlighting and opening it.
[UPDATED]   Using RHStatusItemView for status item so we can highlight it programmatically.
[FIXED]     Activate app on startup so apps window shows.
[ADDED]     NSAlert when trying to open password window with no user selected.
[UPDATED]   Crisper menu icon.
2013-06-04 00:56:19 -04:00
Maarten Billemont
f3248f446c Missing news site causes error message in MP.
[ADDED]     Dummy news.html.
2013-06-04 00:52:29 -04:00
Maarten Billemont
80cb2c8a4f Based site on HTML5 boilerplate. 2013-06-02 19:12:25 -04:00
Maarten Billemont
35a600080b iCloud availability check.
[UPDATED]   Disable iCloud preference when iCloud is unavailable.
[FIXED]     Username in incorrect-mp error popup.
2013-05-31 00:14:04 -04:00
Maarten Billemont
af1efe7bc6 iCloud no longer required for Mac.
[UPDATED]   Mac: Allow iCloud to be disabled.
2013-05-30 00:16:03 -04:00
Maarten Billemont
8219ef10f5 New website. 2013-05-30 00:14:51 -04:00
Maarten Billemont
35411c3261 Added new website. 2013-05-26 01:06:44 -04:00
Maarten Billemont
e8bab69ed7 Mac: iOS App Advertisement + bug fixes.
[ADDED]     Window to advertise iOS app.
[FIXED]     Under some conditions, quit didn't work reliably.
[UPDATED]   Mac UI improvements.
[UPDATED]   Mac Executable Name 'Master Password'.
2013-05-19 16:55:43 -04:00
Maarten Billemont
9904fb2d57 Alert display issues fixed.
[FIXED]     Alert display issues.
[FIXED]     Access to activeUser from a different thread.
2013-05-16 00:59:32 -04:00
Maarten Billemont
d7f369350b Store loading and locking modal alerts.
[ADDED]     Waiting until the store is loaded.
[UPDATED]   Hide or lock password window when locked.
2013-05-16 00:19:50 -04:00
Maarten Billemont
0df322f648 Fixed saveKey getting unset and some MOC threading issues.
[FIXED]     Don't unset saveKey when loading the key fails.
            This causes saveKey to fail as soon as it's synced to a device that hasn't saved the key yet.
[FIXED]     A bunch of threading violation issues with thread-confined MOCs.
2013-05-15 22:42:21 -04:00
Maarten Billemont
cb860cec96 Prepare for new site. 2013-05-13 21:11:58 -04:00
Maarten Billemont
14c0b2dd27 Resource clean-up.
[REMOVED]   Unused resources removed from .app.
[DELETED]   Guide pages aren't used anymore.
[UPDATED]   pngcrush'ed all PNGs to reduce their size.
2013-05-13 00:22:24 -04:00
Maarten Billemont
a2521483c2 Fix orientation bug in lock screen.
[FIXED]     When navigating back from oriented main vc, lock vc isn't rotated back to portrait.
2013-05-12 16:48:54 -04:00
Maarten Billemont
fa4b2a9e54 Ability to select a different cloud store.
[ADDED]     Advanced feature to allow selecting a different cloud store.
2013-05-12 14:08:45 -04:00
Maarten Billemont
e3963a72ad Press bump. 2013-05-11 20:05:07 -04:00
Maarten Billemont
cefe8d144d Import fix, password type change fix, fancier generator appearance.
[FIXED]     Import of ubiquity changes was using wrong delegate method and MOC.
[FIXED]     Password type change broken when password type causes a class change.
[IMPROVED]  Fancier animation of emergency generator appearance.
2013-05-11 19:43:41 -04:00
Maarten Billemont
076cfb1257 MOC saving improvements, Mac app activation, loading overlay, USM update.
[MOVED]     iOS code from MPAppDelegate_Shared to MPiOSAppDelegate.
[FIXED]     Perform MOC saving in MOC perform blocks.
[FIXED]     Mac: Activate app when showing password window and not active.
[FIXED]     Hide overlay while corruption dialog is up.
[FIXED]     Hide corruption dialog when reloading store.
2013-05-11 08:55:09 -04:00
Maarten Billemont
71e3f44c8c Improved migration, file-based StoreUUID, Mac fixes.
[ADDED]     Migration to file-based StoreUUID.
[IMPROVED]  Cleaner, more modular, migration code.
[FIXED]     Don't hook activation to show password window: too annoying when focus shifts.
[FIXED]     Don't set the active user when just importing ubiquity changes, it causes a log-out.
[ADDED]     Mac: Ability to rebuild iCloud.
[REMOVED]   Mac: wasRunning logic to avoid password window appearance on first activation.
[FIXED]     Mac: Retrieve siteName from main thread.
2013-05-10 11:13:55 -04:00
Maarten Billemont
c36f34346d Output info level logs when sendInfo is enabled to aid in debugging. 2013-05-07 16:16:33 -04:00
Maarten Billemont
cd6b83ffe8 iPhone 5 alignment issue in unlock VC.
[FIXED]     Deselect new user avatar if MOC is unavailable when tapping it.
[FIXED]     Position of avatars & spinner on iPhone 5.
[IMPROVED]  Issue button in review dialog.
2013-05-07 13:25:05 -04:00
Maarten Billemont
d110fd18c1 Started checkpoint and executable name revert.
[ADDED]     "Started" checkpoint that logs some platform environment properties.
[REVERTED]  Executable/app name back to just MasterPassword.
2013-05-07 11:22:01 -04:00
Maarten Billemont
e45b9985c2 Mac: New sites.
[MOVED]     Creation of new elements moved to shared code.
[FIXED]     When switching user, unset active key.
[FIXED]     Synchronize content calculation to avoid race issues while typing.
[ADDED]     Ability to create new sites.
[FIXED]     Unset active element when hitting backspace or escape.
2013-05-07 00:48:48 -04:00
Maarten Billemont
8f4eb6df84 Merge branch 'master' of github.com:Lyndir/MasterPassword 2013-05-03 23:50:57 -04:00
Maarten Billemont
809bd60169 Info.plist fixes.
[FIXED]     Add extensions to Icon as well to CFBundleIconFiles because Xcode doesn't seem to listen to the Apple docs.
[FIXED]     Removed newsstand metadata: this is not a newsstand app.
2013-05-03 11:29:38 -04:00
Maarten Billemont
802c5949da More compatible way of specifying icon files.
[FIXED]     Add extensions to Icon as well to CFBundleIconFiles because Xcode doesn't seem to listen to the Apple docs.
2013-05-03 10:15:27 -04:00
Maarten Billemont
407c5528ee Fix sign comparison of enum. 2013-05-02 22:03:53 -04:00
Maarten Billemont
fed3a2bc10 Fix sign comparison of enum. 2013-05-02 22:03:53 -04:00
Maarten Billemont
7329353c6c Work-around for a weird Core Data bug. 2013-05-02 22:01:18 -04:00
Maarten Billemont
a7c861d1b0 Work-around for a weird Core Data bug. 2013-05-02 22:01:18 -04:00
Maarten Billemont
9af8ab3360 Merge branch 'master' of github.com:Lyndir/MasterPassword 2013-05-02 20:41:46 -04:00
Maarten Billemont
ddb5328019 Merge branch 'master' of github.com:Lyndir/MasterPassword 2013-05-02 20:41:46 -04:00
Maarten Billemont
96d97d95e1 New user on Mac.
[ADDED]     Mac: Support for creating a new user.
2013-05-02 20:40:12 -04:00
Maarten Billemont
ab15694d9a Safer migration, boolean description fix.
[ADDED]     Safer store migration: don't delete the old store, allowing the client to downgrade.
[ADDED]     Log checkpoints and send to TestFlight too.
[FIXED]     Describe booleans as YES/NO, not 1/0.
2013-05-02 11:19:34 -04:00
Maarten Billemont
81312e3ff4 Safer migration, boolean description fix.
[ADDED]     Safer store migration: don't delete the old store, allowing the client to downgrade.
[ADDED]     Log checkpoints and send to TestFlight too.
[FIXED]     Describe booleans as YES/NO, not 1/0.
2013-05-02 11:19:34 -04:00
Maarten Billemont
5e1e88bdeb Fancier password dialog.
[ADDED]     Mac: Shadows on labels so they're easier to read in regular mode.
[ADDED]     Mac: Some "subtle" bling on the password.
2013-04-30 21:10:52 -04:00
Maarten Billemont
9882bf408c Content generation fix.
[UPDATED]   For safer MOC usage API.
[FIXED]     Actually set the active element so that content is generated.
2013-04-30 20:49:42 -04:00
Maarten Billemont
40f34f3d77 Avoid using object.managedObjectContext - when no strong reference exists to the MOC, it may yield nil.
[FIXED]     Unexpected nil MOCs.
2013-04-30 01:49:53 -04:00
Maarten Billemont
0ee1e176ed Don't use temporary objectIDs for state.
[FIXED]     Make sure we have permanent ObjectIDs before storing them in state.
[FIXED]     MP-14
2013-04-30 00:32:30 -04:00
Maarten Billemont
c73f89e4a1 App versioning update.
[UPDATED]   App versioning: version is now: decimal short commit hash, short version is now tag+commit number.
2013-04-29 21:24:45 -04:00
Maarten Billemont
fe9a1cdbc4 Log Inspector and trace mode.
[ADDED]     Log Inspector, shake on preference screen to open log.
[ADDED]     Trace Mode: Log at trace level.
[FIXED]     Log messages weren't being recorded for inclusion in feedback.
2013-04-29 21:15:14 -04:00
Maarten Billemont
8a4eecd9fa Removed volume button.
[REMOVED]   Volume button in guide - there is no voice-over.
2013-04-28 00:46:08 -04:00
Maarten Billemont
d27a0fdbad Core Data context fixes and migration fixes.
[FIXED]     More careful Core Data threading and context usage.
[FIXED]     iOS bug when migrating, now using USM's copy migration.
[ADDED]     Better handling of store changes while in Main VC and Element List VCs.
2013-04-28 00:35:32 -04:00
Maarten Billemont
07e44a46ae Remove Facebook App ID & add icon to archive. 2013-04-27 17:53:54 -04:00
Maarten Billemont
dfda47bca0 Warn when secret data is unavailable so we notice when it is. 2013-04-27 17:39:31 -04:00
Maarten Billemont
6fb36035c2 TestFlight now uses an "Application Token". 2013-04-27 17:17:51 -04:00
Maarten Billemont
a6e3b83ebb Dumped Google+ SDK.
[UPDATED]   Google+ SDK.
2013-04-27 17:14:05 -04:00
Maarten Billemont
dc3c30a2f7 Localytics update.
[UPDATED]   Localytics update.
[ADDED]     When sendInfo is enabled, set the user identifier on Localytics.
2013-04-27 16:37:32 -04:00
Maarten Billemont
3219fc764f Fixed and updated InAppSettingsKit.
[UPDATED]   InAppSettingsKit
[IMPROVED]  Text in Settings.bundle.
2013-04-27 16:01:31 -04:00
Maarten Billemont
5d5e9395b3 Threading fixes for Mac, spinner fix for iOS.
[UPDATED]   TestFlight.
[FIXED]     Mac: References to MPAppDelegate that should be OS-independant now use MPAppDelegate_Shared.
[FIXED]     Mac: Threading and content UI updates.
[FIXED]     iOS: Spinner was showing when going back to unlock VC.
2013-04-27 00:34:28 -04:00
Maarten Billemont
291b408995 More workspace fixes to avoid iOS/Mac confusion by IDE.
[RENAMED]   MPAppDelegate -> MPiOSAppDelegate for iOS to avoid class name confusion in workspace.
2013-04-24 21:26:04 -04:00
Maarten Billemont
ceb0333fcf Active user switching for for password window.
[RENAMED]   MPAppDelegate -> MPMacAppDelegate for Mac to avoid class name confusion in workspace.
[FIXED]     Window behavior when switching user.
2013-04-24 21:23:53 -04:00
Maarten Billemont
44b4e5430a Password window style.
[ADDED]     Ability to change style of password window.
[FIXED]     Some window activation oddities (WIP).
[UPDATED]   Renamed executable iOS/Mac specific in the hopes of helping with IDE conflicts.
2013-04-24 00:25:51 -04:00
Maarten Billemont
cb7e145e83 Fixed a bunch of OS X issues.
[FIXED]     Don't create a moc when the main moc is unset.
[FIXED]     Load the MPUserEntity into the moc when doing selectUser:
[FIXED]     Remove KVO on activeUserObjectID, isn't used anymore.  Instead, override setActiveUser:
[FIXED]     Don't show the password window on launch.
[FIXED]     Don't force unlock of the key whenever unset - only when the window pops.
[REMOVED]   Migration - this app is not ready for explicit migration, additionally, this block appears to cause a lock-up of the PSC.
2013-04-23 20:38:56 -04:00
Maarten Billemont
35ef2b0789 Icon file restructuring. 2013-04-22 00:57:17 -04:00
Maarten Billemont
e34adae8f0 OS X build fixes. 2013-04-21 17:05:59 -04:00
Maarten Billemont
5137cbf14d Checkpoint for opening emergency generator. 2013-04-21 13:34:33 -04:00
Maarten Billemont
32fb52f48f Update emergencyContentTipContainer in storyboard. 2013-04-20 19:53:54 -04:00
Maarten Billemont
95d5d8b40c Reformat. 2013-04-20 14:11:19 -04:00
Maarten Billemont
c0d57b5561 MPCheckpoint
[UPDATED]   Refactoring of checkpoints.
2013-04-20 13:51:37 -04:00
Maarten Billemont
efcfbe2584 Fixed popup appearance.
[FIXED]     Appearance of popup when copying emergency password.
2013-04-20 12:14:44 -04:00
Maarten Billemont
eeac1d0dd3 Initial page-flip other apps, emergency password copy and marquee hint.
[ADDED]     Initial page-flip animation on opening of other apps VC to make it clear to the user that pages can be flipped.
[ADDED]     Copying of password from emergency generator.
[ADDED]     Marquee animate the bottom tip to also hint about the emergency generator.
2013-04-20 11:44:26 -04:00
Maarten Billemont
ac1358a0ec Emergency generator, action pictograms.
[ADDED]     Emergency Generator!
[ADDED]     Easier method for just using the master password algorithm bare.
[UPDATED]   Pictograms in action popup and centering of text.
2013-04-19 00:43:01 -04:00
Maarten Billemont
c31df49599 activeUser refactor, tool tip hiding and dismiss when logout.
[UPDATED]   Made activeUser access follow same pattern as activeElement which makes it more clear what the thread model is like.
[FIXED]     Save after update of all elements.
[UPDATED]   Tool tips hidden in IB now; makes it less cluttered.
[FIXED]     Dismissing view controllers when logging out.
2013-04-17 22:00:15 -04:00
Maarten Billemont
ee93412dd1 Search & AllSites improvements, sort by recency, rememberLogin setup.
[UPDATED]   Simplified AllSites VC in IB (removed the unused navVC).
[UPDATED]   Outdated sites are now shown in the AllSites VC.
[ADDED]     An update-all-sites button when showing outdated sites in the AllSites VC.
[REMOVED]   Search scopes.
[ADDED]     Sorting elements by recency and usage count now.
[FIXED]     Initial positioning of help container.
[ADDED]     Setup VC for rememberLogin.
2013-04-15 00:04:16 -04:00
Maarten Billemont
7cf2c7f5c6 Setup and guide.
[FIXED]     Setup wasn't showing up on app load.
[FIXED]     More temporary moc fixes and main thread fixes.
[IMPROVED]  Guide now plays an introduction animation.
[FIXED]     Setup iCloud switch is now functional.
2013-04-14 10:26:34 -04:00
Maarten Billemont
5bf8842031 More fixes of temporary moc accesses. 2013-04-13 14:03:50 -04:00
Maarten Billemont
abe874cda3 Temporary moc fix, setup & new guide.
[FIXED]     Pass along temporary mocs, they appear to be stored __weak in the object and we can't rely on them not being nil.
[ADDED]     Setup flow for initially setting the iCloud preference.
[ADDED]     New guide.
[IMPROVED]  Hierarchy and flow of unlock -> main.
2013-04-13 13:40:17 -04:00
Maarten Billemont
036c04f65f Migration cleanup and improvements.
[IMPROVED]  Migration code cleanup.
[FIXED]     When local store migration fails, fall back to opening the old local store if possible.
[FIXED]     Better migration of cloud preferences.
[FIXED]     Better checking of when to perform cloud store migration.
[FIXED]     Always migrate the local store, even when the cloud store is enabled.
[UPDATED]   Removed the loading indicator in favor of a loading overlay.
[UPDATED]   Sorted the file references lexicographically.
2013-04-07 19:43:14 -04:00
Maarten Billemont
418411769d Migration fixes.
[FIXED]     Moved migration into the persistence queue by performing it on willLoadStore.
[FIXED]     Re-enabled cloud after migration.
[UPDATED]   Allow rebuilding the old cloud store if it got deleted locally.
2013-04-06 19:41:20 -04:00
Maarten Billemont
12804984ba Merge branch 'master' of github.com:Lyndir/MasterPassword 2013-04-05 00:33:10 -04:00
Maarten Billemont
de36cf8645 Fixes for new properties in MPAppDelegate_Store
[FIXED]     Properties in categories aren't synthesized.  Using fancy new PearlAssociateObjectProperty from Pearl now to make a fake property.
[FIXED]     Show overlay on UI thread.
[FIXED]     ONLY_ACTIVE_ARCH = NO because weird codesign errors happen on second build with it set to YES.
	modified:   External/Pearl
2013-04-05 00:31:05 -04:00
Maarten Billemont
922230c54e Remove iCloudStoreManager.
[REMOVED]   iCloudStoreManager was replaced by UbiquityStoreManager.
2013-04-04 14:16:33 -04:00
Maarten Billemont
e0e548c611 Merge branch 'master' of github.com:Lyndir/MasterPassword 2013-04-04 10:54:07 -04:00
Maarten Billemont
5e40258f54 Updated for new UbiquityStoreManager API.
[UPDATED]   New and improved UbiquityStoreManager with better API.
2013-04-03 19:25:15 -04:00
Maarten Billemont
2f17639eeb Revert "Temporary build fix: Disable iCloudStoreManager integration."
This reverts commit b301d0bdd6.
2013-04-01 22:03:28 -04:00
Maarten Billemont
e22be0f97c Build fixes. 2013-03-30 11:53:26 -04:00
Maarten Billemont
0a394265fa Update Mac project after file restructuring. 2013-03-29 20:24:06 -04:00
Maarten Billemont
9c10a2c4e3 Xcode workspace
[UPDATED]   Crashlytics.
2013-03-29 17:41:22 -04:00
Maarten Billemont
93a672b22f Update build scripts for new paths.
[FIXED]     After relocation, the build scripts need path updates.
2013-03-29 12:10:01 -04:00
Maarten Billemont
b301d0bdd6 Temporary build fix: Disable iCloudStoreManager integration. 2013-03-29 12:03:31 -04:00
Maarten Billemont
1c79545245 Serious houskeeping: Better file structure & preparation for Xcode workspace. 2013-03-29 11:59:47 -04:00
Maarten Billemont
02b323d640 Keep track of some todos. 2013-03-29 09:07:01 -04:00
Maarten Billemont
4b8d30ac28 Initial android artifact.
[ADDED]     Added initial stub for an android MP app.
2013-03-29 09:05:15 -04:00
Maarten Billemont
cd475580ff iCloudStoreManager is now UbiquityStoreManager 2013-03-29 09:05:03 -04:00
Maarten Billemont
f937792fc2 Typo correction in site. 2013-03-28 10:19:30 -04:00
Maarten Billemont
31d4d5b6c6 Extract common code from SearchVC and AllVC.
[ADDED]     A more generic element listing controller, now used by the
            search controller and all elements listing controller.
[IMPROVED]  Improved change detection and UI handling in the element
            listing controllers.
[FIXED]     Bug with previewing generated password types for
            non-generated elements.
2013-02-10 15:28:58 -05:00
Maarten Billemont
d7d91d13c6 UI updates: site search & type change
[ADDED]     Display the password type when searching for sites.
[ADDED]     Indicate the strength of a password type by time to crack.
[ADDED]     Display a password prediction below each password type on
            the type selection screen.
[MOVED]     Moved the Short type below the Basic type because it's less
            secure.
[FIXED]     Some font regression bugs.
2013-02-08 18:11:24 -05:00
Maarten Billemont
16a7b87d2a Update content font to Source Code Pro.
[UPDATE]    Font of element content and loginName to Source Code Pro for
            improved legibility and distinguishment between O and 0.
[REMOVED]   Unused fonts from the bundle to save space.
2013-02-02 14:17:35 -05:00
Maarten Billemont
21f1e7ee49 New element fix and statusbar experimentation.
[FIXED]     Set lastUsed when creating a new site since elements can't
            be saved without that value set.
[UPDATED]   Configuration for tinting of status bar.
            Doesn't work yet with the custom navbar container image:
            Should check if last row of that image's pixels isn't too
            dark.  iOS 6 apparently averages it for the tint color.
2013-02-02 01:38:11 -05:00
Maarten Billemont
ad8317a7a0 All sites add button.
[ADDED]     An add site button in the all sites VC.
2013-02-02 00:45:30 -05:00
Maarten Billemont
820be14845 Add missing dependencies to updateDependencies. 2013-02-01 16:45:35 -05:00
Maarten Billemont
b7d3b2d02c Ignore IDE preferences of Java implementation. 2013-02-01 12:54:57 -05:00
Maarten Billemont
a710765336 Bump Java dependencies to release.
[UPDATED]   Java: property-list to 2.0.0
2013-02-01 12:53:17 -05:00
Maarten Billemont
9a68cbf533 Listing all sites now with bookmark button and modal VC.
[ADDED]     Modal VC to show all sites.
[UPDATED]   All sites button on search bar now uses bookmark button.
[REMOVED]   Query string hack for search results button.
2013-02-01 01:13:45 -05:00
Maarten Billemont
2bb0e2e3ef Icon update.
[UPDATED]   Icon graphics updated.
2013-01-31 20:58:27 -05:00
Maarten Billemont
17c47269a3 Startup UI improvements.
[IMPROVED]  Fade-in effect when opening Master Password.
[IMPROVED]  Shade of circular shadow fixed between launch image and
            background image.
2013-01-31 18:58:56 -05:00
Maarten Billemont
6c23134e47 Update Google+ integration.
[UPDATED]   Google+ SDK to 1.1.0.
2013-01-31 16:33:46 -05:00
Maarten Billemont
cc015ada1b Delete stale reference to facebook-ios-sdk
[REMOVED]   Stale reference to facebook-ios-sdk submodule.
2013-01-31 12:29:24 -05:00
Maarten Billemont
acd52e8ef6 Bump Pearl and TestFlight for iOS 6 fixes.
[UPDATED]   Pearl for iOS 6 compilation fixes.
[UPDATED]   TestFlight for close_file bugfix.
2013-01-31 12:25:17 -05:00
Maarten Billemont
f2ee139db6 Social update, CoreData overhaul & iOS6/rotation fixes.
[REMOVED]   Facebook SDK.
[ADDED]     Social framework integration for Twitter & Facebook.
[MOVED]     User migration warning state moved into MainVC, out of
            data model.
[UPDATED]   Major overhaul of Core Data integration.  Multiple contexts
            and making sure we're on the right thread and the right
            context even for read access.
[FIXED]     Some iOS 6 deprecation fixes.
[FIXED]     Some VC rotation issues.
2013-01-31 00:42:32 -05:00
Maarten Billemont
725da285da Minor code improvement.
[FIXED]     Some minor code fixes thanks to inspections.
[FIXED]     Some iOS6 deprecation issues.
[IMPROVED]  Cleanup with regards to store migration.
2013-01-27 16:27:49 -05:00
Maarten Billemont
1b3f5f5d25 Added a few missing resources.
[ADDED]     Mac: Missing menu icon.
[UPDATED]   Sketch source file for iOS app icon and Mac menu icon.
2013-01-27 01:02:41 -05:00
Maarten Billemont
ecd03ecf42 Update of iOS code for updated API of UbiquityStoreManager.
[UPDATED]   UbiquityStoreManager's new API uses cloudEnabled instead of iCloudEnabled.
2013-01-27 00:54:54 -05:00
Maarten Billemont
d5bffd86d6 Mac fixes and improvements to usability.
[FIXED]     Mac: Locking shouldn't unset the active user.
[IMPROVED]  Mac: Behavior of auto-completing site-name field improved.
[ADDED]     Mac: Alert when MP is incorrect when unlocking.
2013-01-26 22:12:34 -05:00
Maarten Billemont
b07298e203 Fixed migration of old store to new store + don't hold references to CoreData objects.
[FIXED]     Working migration of old store to new store.
[FIXED]     We shouldn't be holding references to CoreData objects anywhere.
            In that light, the user NSMenuItems have been fixed.
2013-01-25 01:05:31 -05:00
Maarten Billemont
4c19a29897 Mac support for user handling and iCloud improvements.
[MOVED]     Extract user migration out of iOS specific codebase.
[UPDATED]   iCloud persistence manager.
[ADDED]     Mac: Hotkey for signing the user out.
[IMPROVED]  Mac: Menu item handling and usability.
2013-01-17 00:37:20 -05:00
Maarten Billemont
32f870406c Mac UI fixes.
[FIXED]     Behavior of the Mac menu item and appearance of the password
            window.
[ADDED]     Disabling menu items while not usable and explaining
            disabled items with tooltips.
2012-11-01 10:55:11 -04:00
Maarten Billemont
05ab38b998 Facebook updates + Mac fixes.
[UPDATED]   Facebook integration bumped for iOS 6.
[FIXED]     Bringing Mac version back up to date.  Compiles again and
            runs with UI bugs.
[ADDED]     Mac: User selection.
2012-10-30 22:54:34 -04:00
Maarten Billemont
678545cc26 Make parent pom resolvable.
[FIXED]     Java: Make the parent POM resolvable for people that don't
            have the snapshot version of it.
2012-10-23 09:21:33 -04:00
Maarten Billemont
4c3e0f0c97 Site updates.
[ADDED]     Smart App Banner added to site.
[UPDATED]   Available-on-App-Store resource updated.
2012-10-09 09:58:44 +02:00
Maarten Billemont
a8752b5f28 Disable TestFlight's feedback dialog.
[REMOVED]   TestFlight's feedback dialog.  It's ugly and it doesn't
            allow log sending.
2012-09-23 17:38:05 +02:00
Maarten Billemont
f75f5c1b30 Signing profile bump. 2012-09-22 17:48:35 +02:00
Maarten Billemont
735a75df92 News file referenced by the new version. 2012-09-22 17:38:05 +02:00
Maarten Billemont
d8414aaab9 Fix the URL of the news page to point to the web. 2012-09-22 10:23:21 +02:00
Maarten Billemont
02a5d48ce4 Added a news view.
[ADDED]     A news view on the unlock screen.
2012-09-22 10:14:41 +02:00
Maarten Billemont
cdee54a0f7 TestFlight update to 1.1 2012-09-22 08:53:55 +02:00
Maarten Billemont
b1f0f70849 Localytics SDK update because of startup issue. 2012-09-21 19:42:18 +02:00
Maarten Billemont
850978cbe3 Fixed bug with scroll view in iOS5.
[FIXED]     On iOS5, the app crashed because gesture recognizers of a
            scrollview were being replaced.  Now properly adding the
            desired gesture recognizer to the scroll view preserving the
            existing gesture recognizers.
2012-09-21 16:45:57 +02:00
Maarten Billemont
e8c00296bd TestFligt identifier + Localytics crash.
[IMPROVED]  Use correct device identifier for TestFlight depending on
            whether we're in AdHoc mode or not.
[FIXED]     Crash when sending nil config values to Localytics.
2012-09-21 10:31:48 +02:00
Maarten Billemont
52b8033c37 Fixed issue with logs in feedback message.
[FIXED]     Including logs in the feedback message caused failure to
            parse attachments.
2012-09-20 21:37:58 +02:00
Maarten Billemont
6f2bc83806 Revert the renameID change to see if it causes model incompatibilties. 2012-09-20 21:19:44 +02:00
Maarten Billemont
2a48c9d272 Fixed some rare crashes.
[FIXED]     Crash for users with no name.
[FIXED]     Crash when copying an element with no content.
2012-09-20 21:16:34 +02:00
Maarten Billemont
27d0373a6e Add TestFlight back. 2012-09-19 23:52:23 +02:00
Maarten Billemont
96b50f7ef0 Not ready yet for ARMv7s.
[REVERTED]  Still too many of our dependant libs have no ARMv7s symbols.
2012-09-19 23:46:39 +02:00
Maarten Billemont
dc7ff5f668 Bump for ARMv7s Pearl libs. 2012-09-19 23:43:15 +02:00
Maarten Billemont
0c9c9737d9 Only show TestFlight feedback in Adhoc mode. 2012-09-19 23:34:17 +02:00
Maarten Billemont
8ef099d707 Signing configuration update. 2012-09-19 23:31:46 +02:00
Maarten Billemont
6da15306b0 Work-around for iOS 6 bug.
[FIXED]     iOS 6 SDK seems to crash on iOS 5 devices when doing
            scrollEnabled.
2012-09-19 23:29:21 +02:00
Maarten Billemont
699d0869fc ARMv7s
[UPDATED]   Project configuration update for ARMv7s support.
2012-09-19 22:11:16 +02:00
Maarten Billemont
83efa853fc Binary libraries only support armv7.
[FIXED]     Crashlytics only supports armv7 so force armv7 for now.
2012-09-13 00:48:45 +02:00
Maarten Billemont
75de4b443f iPhone 5 compatibility.
[ADDED]     Taller iPhone 5-size launch image.
[FIXED]     Missing PSC in MOC.
[IMPROVED]  Slower fade-in of unlock UI.
[FIXED]     Properly set enableHTTPS in Localytics.
2012-09-13 00:38:15 +02:00
Maarten Billemont
42c7fb446e Localytics project configuration update. 2012-09-12 16:07:36 +02:00
Maarten Billemont
bce6b96417 Tag screens in Localytics + email fix + psc fix
[FIXED]     Sending email with no recipient caused a crash.
[FIXED]     Duplicate persistence coordinator.
[UPDATED]   Crashlytics and Localytics SDKs.
[UPDATED]   Don't continue the Localytics session when device locked.
[UPDATED]   Put Localytics communication on HTTPS for confidentiality.
[ADDED]     Tagging screens in Localytics.
2012-09-12 16:02:02 +02:00
Maarten Billemont
6f82cf7f15 Fixed crashes related to over-released gesture recognizers.
[FIXED]     Memory warnings caused Master Password to crash due to
            gesture recognizers and an iOS 5 bug.
2012-09-07 23:55:12 +02:00
Maarten Billemont
fac419dd94 Fixes related to review feedback. 2012-09-02 21:16:16 +02:00
Maarten Billemont
c03d547ad8 Font improvements and copy-login fix.
[FIXED]     Login name copies content instead of login name.
[IMPROVED]  Font of password and login name improved for better
            differentiation between capital and lower-case letters.
2012-09-02 13:14:09 +02:00
Maarten Billemont
e2bf8cefa2 Migration of saved passwords.
[ADDED]     Migrate saved passwords when master password changes.
[IMPROVED]  UI improvements to apps.
2012-09-01 22:14:57 +02:00
Maarten Billemont
d75ec5c689 Added "Other Apps".
[REMOVED]   Cleaned up some check points that weren't really useful.
[ADDED]     Added a few new checkpoints with new functionality.
[ADDED]     An "other apps" page that introduces Gorillas and DeBlock.
[IMPROVED]  Help is now toggled with a drag handle instead of an action
            button.
2012-09-01 14:57:55 +02:00
Maarten Billemont
aa2d9eb202 Bump Pearl. 2012-08-31 16:30:05 +02:00
Maarten Billemont
ac52f38612 Disabled custom button title font because of odd iOS bug.
[FIXED]     Odd bug that causes imageViews to get oddly stretched.
2012-08-31 11:47:50 +02:00
Maarten Billemont
332808027f Make user name entry required.
[FIXED]     Prevent the ability to create a new user without user name.
2012-08-30 22:47:33 +02:00
Maarten Billemont
cd64bff5ef Layout Core Data model graph. 2012-08-30 22:30:42 +02:00
Maarten Billemont
7813ddee38 Fade unlock VC + search bar responder fix.
[ADDED]     Fade effect to unlock view.
[UPDATED]   Signing profiles.
[FIXED]     A rare bug that caused the search bar to remain first responder without making it take input or dismissable (hopefully fixed, at least).
2012-08-28 00:13:46 +02:00
Maarten Billemont
af744235bc Status bar issue.
[FIXED]     Status bar issue.
[FIXED]     Review dialog link and buttons.
2012-08-27 00:14:33 +02:00
Maarten Billemont
ca9cbc9fd1 Follow on social networks.
[UPDATED]   Migrated from MFMailComposeViewController to PearlEMail.
[ADDED]     Social network "follow" button.
2012-08-26 17:40:32 +02:00
Maarten Billemont
5e7b6ed60e Sharing on Facebook, Twitter and Google+
[FIXED]     Font of navbar.
[FIXED]     A few compile fixes.
[IMPROVED]  Made properties nonatomic.
[ADDED]     Support for facebook, twitter and google+ sharing.
2012-08-25 12:55:07 +02:00
Maarten Billemont
b9ccee398e Fixed a few crashes.
[UPDATED]   A nil type is never OK.  Crash early if it is so.
[UPDATED]   Set crashlytics identifiers using its userIdentifier and userName property for good metadata.
[FIXED]     Make sure the MOC has a PSC with stores when returning it.
[FIXED]     Don't reset the store for just any open error! Only if it's actually incompatible.
[IMPROVED]  Remove timestamps from Crashlytics and TestFlight logs, they already provide them.
[FIXED]     Avoid crashes in some odd cases where there's no type set.
2012-08-24 10:12:15 +02:00
Maarten Billemont
7921734740 Modernize ObjC syntax.
[IMPROVED]  Migrate to modern ObjC syntax for type boxing.
2012-08-19 20:02:23 +02:00
Maarten Billemont
9d883b6ff7 UserName -> LoginName 2012-08-19 19:54:06 +02:00
Maarten Billemont
75ef15bb4d Import improvements and core data fixes.
[FIXED]     Import fixes:
                - Wait for MOC to become available.
                - Progress UI while working.
                - Import files exported with a different master password.
                - Core Data crashes.
[RENAMED]   Site's User name -> Login name.
[FIXED]     Core Data crashes related to using entities from old MOCs.
2012-08-19 09:34:49 +02:00
Maarten Billemont
479d357bd1 Fixed importing with a different key and entity access after MOC changes.
[FIXED]   Importing stored content when not logged in with the same key.
[FIXED]   Holding entities is a bad idea when MOCs can change.  Holding ObjectIDs instead now.
2012-08-18 15:37:24 +02:00
Maarten Billemont
d429044f64 Remove debugging "Save" button + fix keybaord appearance.
[FIXED]     Keyboard didn't appear when app is reactivated.
[REMOVED]   "Save" option in user menu on lock screen was for debugging.
2012-08-05 11:40:50 +02:00
Maarten Billemont
b38e8d9ea6 Fix appearance of the Guide on start-up.
[FIXED]     When the unlock VC shows, the guide's appearance is aborted.
2012-08-05 11:18:58 +02:00
Maarten Billemont
c928b1ca2c Fix unlock screen when MOC unavailable.
[REMOVED]   Disable TestFlight for release, it doesn't work anyway.
[FIXED]     Properly handle unlock screen when there is no MOC yet.
[FIXED]     Some log statements format strings & arguments.
2012-08-04 23:15:50 +02:00
Maarten Billemont
553a14dced Empty SMS password in repo. 2012-08-04 13:46:43 +02:00
Maarten Billemont
8b8d727ee0 Fixes to key saving and searching.
[FIXED]     Saving of keyData in keychain.
[FIXED]     MPSearchDelegate before MOC is available.
[FIXED]     Tip during search didn't show up.
2012-08-04 12:22:36 +02:00
Maarten Billemont
4cdeab4256 Don't block the MOC lookup.
[IMPROVED]  Don't block when MOC is not yet ready, just return nil.
[IMPROVED]  Outdated tip links to info, icon links to site search.
[IMPROVED]  Minor improvements to error handling during import.
2012-08-04 10:16:58 +02:00
Maarten Billemont
bc3aa3255e Get rid of these binaries; they don't belong in a repo. 2012-07-30 10:19:46 +02:00
Maarten Billemont
f2fdca6a03 Add env var support to CLI.
[ADDED]     The Java CLI client can now take values for the username and
            master password from the environment.
2012-07-30 10:17:26 +02:00
Maarten Billemont
647235616e Fixes to import code.
[FIXED]     Don't recalculate key for each entry in import list.
[FIXED]     Use correct fetch request to find user entity for import.
[FIXED]     Properly schedule all use of MOC with performBlock*
[ADDED]     Use undoManager to revert failed import changes.
2012-07-30 07:58:18 +02:00
Maarten Billemont
b0b6dcc56b Make iCloud removal use file coordinators. 2012-07-29 15:36:00 +02:00
Maarten Billemont
918a240dba UI fixes to do with password type button and help.
[FIXED]     Password type button goes off-screen.
2012-07-29 13:43:11 +02:00
Maarten Billemont
830dcb45ff Word wall + fixes to: guide, export, UI.
[ADDED]     Word wall: Show some random dictionary words while user
            thinks of a new master password to give him some
            inspiration.
[IMPROVED]  Only select user after he choose to reset.
[IMPROVED]  Ugly backdrops in the guide images cleaned up.
[FIXED]     Export of sites should now include a password version field.
[FIXED]     Filename to save exported passwords into should use day of
            the month instead of day of the year.
[FIXED]     No search predicate was set when search scope button wasn't
            set.  As a result, sites from other users showed up.
2012-07-29 12:40:22 +02:00
Maarten Billemont
7be9884075 Better abstraction for key & algorithm + V1
[IMPROVED]  A master password key is now better abstracted in an object.
[IMPROVED]  A master password algorithm is now better astracted in an
            object.
[ADDED]     Elements now have a specific algorithm version.
[ADDED]     Automatic/explicit migration of elements.
[ADDED]     Searching outdated elements.
2012-07-17 22:57:11 +02:00
Maarten Billemont
5ca0d954bb UI improvements with regards to user name saving.
[IMPROVED]  Settings -> user button.
[IMPROVED]  More sensible and understandable logic.
[FIXED]     State handling of what to show when, etc.
2012-07-16 21:49:27 +02:00
Maarten Billemont
02d69261df Password settings alpha.
[FIXED]     Hide password settings when no element selected.
2012-07-16 21:03:15 +02:00
Maarten Billemont
fc60460935 Settings toggle and site user name.
[ADDED]     Allow saving a user name per site.  This is an optional
            addition, toggled by tapping the new settings icon.
            Obviously user names can't be recovered after loss.
2012-07-16 20:29:48 +02:00
Maarten Billemont
559e11b16e Video and send-to-phone.
[ADDED]     Site: Demo video.
[ADDED]     Site: Send-to-phone using email and SMS.
2012-07-16 18:45:11 +02:00
Maarten Billemont
0a72809b02 Add +1 to site & hide alert.
[FIXED]     Hide alert message when main view appears.
[ADDED]     Google +1 to site.
2012-07-15 15:23:40 +02:00
Maarten Billemont
8c71ed0081 Fix deleting of users.
[FIXED]     When retrieving content without a key set, return nil.
2012-07-15 00:09:20 +02:00
Maarten Billemont
3e19a026ba Accessibility improvements + Xcode 4.3 fixes.
[ADDED]     Accessibility hints and labels.
2012-07-14 23:57:06 +02:00
Maarten Billemont
8fa3c6c75d Improved algorithm page style.
[FIXED]     A few text fixes in algorithm page.
2012-07-14 23:55:22 +02:00
Maarten Billemont
217cf56d94 Versioning + automatic user selection + misc UI tweaks.
[ADDED]     Versioning and explicit migration to MPElementEntity.
[ADDED]     Upgrade button in case the element needs explicit migration.
[ADDED]     Messages in Crashlytics and TestFlight logs upon
            initialization so we can easily see it worked and what the
            client's versioning looks like.
[IMPROVED]  Only show firstRun UI tooltips once.
[IMPROVED]  Automatically select the latest user upon load of unlock.
[IMPROVED]  Automatically select the user when his password is reset.
[IMPROVED]  Hide active element when logging a user out.
2012-07-12 08:50:34 +02:00
Maarten Billemont
6f37f28a4c Element versioning + upgrade tool & tip.
[ADDED]     "version" to MPElementEntity.
[ADDED]     Tool tip, a tip that points at the content tool.
[ADDED]     Upgrade tool, a tool used for upgrading outdated elements.
2012-07-10 07:26:49 +02:00
Maarten Billemont
3b7d2dc08e Exclusion from GA.
[ADDED]     Site: Method of excluding oneself from Google Analytics.
2012-07-10 07:25:57 +02:00
Maarten Billemont
5e9af44736 Press Kit improvements and addition to site.
[IMPROVED]  Press Kit: Front page + grammar.
[ADDED]     Site: Press Kit download button.
[ADDED]     Site: GA /outbound/ events.
2012-07-09 10:47:00 +02:00
Maarten Billemont
be33a29fa0 AdWords + SEO
[ADDED]     Site: AdWords conversion detection.
[ADDED]     Site: SEO by schema.org tagging.
2012-07-07 01:20:37 +02:00
Maarten Billemont
29ed22d0b7 Badge + java version.
[ADDED]     Site: Price badge on front phone.
[ADDED]     Site: Mention Java version.
[ADDED]     Site: Sync script.
[IMPROVED]  Screenshots of lock screen.
2012-07-06 10:39:49 +02:00
Maarten Billemont
8b997528c9 Improved logging of password generation.
[IMPROVED]  Trace-level logging during password generation.
2012-07-05 13:47:50 +02:00
Maarten Billemont
04a6c8e68d A Java proof-of-concept CLI for Master Password. 2012-07-05 13:42:32 +02:00
Maarten Billemont
0e8e4dc06d Add site tip: Promo code for feedback. 2012-07-05 13:40:31 +02:00
Maarten Billemont
8b91c2a0b8 Press data and site experimentation with nivo-slider.
[ADDED]     Press resources: Releases, media, etc.
2012-07-05 00:02:45 +02:00
Maarten Billemont
e967affddb Added unit tests for playing around with the logic. 2012-07-04 23:57:29 +02:00
Maarten Billemont
dea7434bd4 prMac Press Release
[ADDED]     prMac press release for 1.2.1, REV1b
2012-07-03 11:02:58 +02:00
Maarten Billemont
1da63e450d High-resolution iTunesArtwork. 2012-07-03 11:00:25 +02:00
Maarten Billemont
029d240999 Fixed a crash when tapping a non-type row.
[FIXED]     MP-23 Crash when tapping non-type row
2012-07-03 10:04:39 +02:00
Maarten Billemont
110f7069e1 Lock when backgrounded.
[FIXED]     When backgrounding the app and re-showing it, don't reveal
            the UI when logout is enabled.
2012-06-28 00:02:00 +02:00
Maarten Billemont
d77cde1929 Moved MPSearchDelegate to code.
[FIXED]     Another potential crash because of an over-released
            top-level object in storyboard.
2012-06-27 23:44:37 +02:00
Maarten Billemont
2dba4c87ba Small build fixes.
[FIXED]     Linker warning about PIE.
[UPDATED]   Login failed is no longer recorded when login attempt was
            not using a password (noisy).
2012-06-27 15:01:58 +02:00
Maarten Billemont
6841ae2b0d Updated iTunesArtwork
[IMPROVED]  iTunesArtwork prettier & 1024px.
[ADDED]     FontReplacer target.
2012-06-27 13:53:39 +02:00
Maarten Billemont
a3698b9e47 Guide pager, fonts, crash.
[ADDED]     Page controller in guide to see where in the guide you are.
[ADDED]     FontReplacer to be able to "use" Exo from IB (by
            substituting "Futura").
[FIXED]     A crash when loading the main VC because of the reset
            password gesture recogniser.
[IMPROVED]  Font in tables to standard system fonts.
[IMPROVED]  Guide content positioning and sizing making space for pager.
2012-06-27 09:51:14 +02:00
Maarten Billemont
5b65c8c6bd Improve UI to be more HIG friendly.
[IMPROVED]  Use action sheets instead of alerts when showing destructive
            action choices.
[IMPROVED]  Make tappable regions at least 44x44pt.
[IMPROVED]  Title/message for alert/sheets.
2012-06-25 08:59:54 +02:00
Maarten Billemont
94c9d50a12 Ability to noop TestFlight and Crashlytics 2012-06-24 21:06:00 +02:00
Maarten Billemont
5849c9668f Format noise. 2012-06-24 18:27:10 +02:00
Maarten Billemont
4d4ba3425e Improvements to password import.
[FIXED]     Importing of mpsites with passwords showing for
            stored password types.
[FIXED]     Don't try to show mail composition dialog when the user has
            no mail account configured.  This will crash.  Instead,
            show a friendly popup explaining things.
[IMPROVED]  Message of password export emails.
[FIXED]     Hierarchy of MPUnlockVC so password field becomes touchable.
2012-06-24 16:32:22 +02:00
Maarten Billemont
b7e91358be Use only annotated tags for version determination. 2012-06-24 16:32:22 +02:00
Maarten Billemont
da860d74c4 More internal fixes. 2012-06-24 16:29:51 +02:00
Maarten Billemont
4e2ceb33a0 Fix an odd bug with a missing input handler for certain keyboard types. 2012-06-24 14:53:05 +02:00
Maarten Billemont
d14bde07bd Hardcoded signing profiles to avoid Xcode using the wrong one. 2012-06-23 14:34:26 +02:00
1468 changed files with 108386 additions and 22202 deletions

18
.gitignore vendored
View File

@@ -2,6 +2,7 @@
.DS_Store
# IntelliJ
/MasterPassword/Java/.idea
/.idea/*
!/.idea/encodings.xml
!/.idea/inspectionProfiles
@@ -12,14 +13,17 @@
/*.iws
# Xcode IDE
/*.xcodeproj/*
!/*.xcodeproj/*.pbxproj
!/*.xcodeproj/xcshareddata
!/*.xcodeproj/xcshareddata/*
!/*.xcodeproj/project.xcworkspace
!/*.xcodeproj/project.xcworkspace/*
/*.xcodeproj/project.xcworkspace/xcuserdata
xcuserdata/
/DerivedData/
# Media
Press/Background.png
Press/Front-Page.png
Press/MasterPassword_PressKit/MasterPassword_pressrelease_*.pdf
# IPA
/sendipa/*
!/sendipa/sendipa.conf
# Java
MasterPassword/Java/**/target

20
.gitmodules vendored
View File

@@ -3,7 +3,19 @@
url = git://github.com/Lyndir/Pearl.git
[submodule "External/InAppSettingsKit"]
path = External/InAppSettingsKit
url = git://github.com/futuretap/InAppSettingsKit.git
[submodule "External/iCloudStoreManager"]
path = External/iCloudStoreManager
url = git://github.com/lhunath/iCloudStoreManager.git
url = git://github.com/lhunath/InAppSettingsKit.git
[submodule "External/FontReplacer"]
path = External/FontReplacer
url = git://github.com/0xced/FontReplacer.git
[submodule "External/UbiquityStoreManager"]
path = External/UbiquityStoreManager
url = git://github.com/lhunath/UbiquityStoreManager.git
[submodule "External/RHStatusItemView"]
path = External/RHStatusItemView
url = git://github.com/lhunath/RHStatusItemView.git
[submodule "External/DCIntrospect"]
path = External/DCIntrospect
url = https://github.com/lhunath/DCIntrospect.git
[submodule "External/LoveLyndir"]
path = External/DCIntrospect
url = git://github.com/Lyndir/love-lyndir.client.git

View File

@@ -2,8 +2,15 @@
<profile version="1.0" is_locked="false">
<option name="myName" value="Project Default" />
<option name="myLocal" value="false" />
<inspection_tool class="FunctionImplicitDeclarationInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ImplicitIntegerAndEnumConversion" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LossyEncoding" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="MethodIsLaterInTheScope" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="OCNotLocalizedStringInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="OCUnusedMacroInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="OCUnusedMethodInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnavailableInDeploymentTarget" enabled="true" level="INFO" enabled_by_default="true" />
<inspection_tool class="UnusedLocalVariable" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnusedParameter" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View File

@@ -1 +0,0 @@
../../../run

View File

@@ -1,15 +0,0 @@
#!/usr/bin/ruby
#
# WARNING: DO NOT MODIFY THIS FILE.
#
# Crashlytics
# Crashlytics Version: 1.0.0.1
#
# Copyright Crashlytics, Inc. 2012. All rights reserved.
#
require 'pathname'
path = Pathname.new(__FILE__).parent
`#{path}/../../../run`

Binary file not shown.

Binary file not shown.

View File

@@ -2,17 +2,17 @@
// Crashlytics.h
// Crashlytics
//
// Copyright 2012 Crashlytics, Inc. All rights reserved.
// Copyright 2013 Crashlytics, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
*
* The CLS_LOG macro provides as easy way to gather more information in your log messages that are
* sent with your crash data. CLS_LOG prepends your custom log message with the function name and
* line number where the macro was used. If your app was built with the DEBUG preprocessor macro
* defined CLS_LOG uses the CLSNSLog function which forwards your log message to NSLog and CLSLog.
* The CLS_LOG macro provides as easy way to gather more information in your log messages that are
* sent with your crash data. CLS_LOG prepends your custom log message with the function name and
* line number where the macro was used. If your app was built with the DEBUG preprocessor macro
* defined CLS_LOG uses the CLSNSLog function which forwards your log message to NSLog and CLSLog.
* If the DEBUG preprocessor macro is not defined CLS_LOG uses CLSLog only.
*
* Example output:
@@ -26,41 +26,30 @@
*
**/
#ifdef DEBUG
#define CLS_LOG(__FORMAT__, ...) CLSNSLog((@"%s line %d $ " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#define CLS_LOG(__FORMAT__, ...) CLSNSLog((@"%s line %d $ " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define CLS_LOG(__FORMAT__, ...) CLSLog((@"%s line %d $ " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#define CLS_LOG(__FORMAT__, ...) CLSLog((@"%s line %d $ " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif
/**
*
*
* Add logging that will be sent with your crash data. This logging will not show up in the system.log
* and will only be visible in your Crashlytics dashboard.
*
**/
void CLSLog(NSString *format, ...);
OBJC_EXTERN void CLSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
/**
*
* Add logging that will be sent with your crash data. This logging will show up in the system.log
* and your Crashlytics dashboard. It is not reccomended for Release builds.
* and your Crashlytics dashboard. It is not recommended for Release builds.
*
**/
void CLSNSLog(NSString *format, ...);
OBJC_EXTERN void CLSNSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
@protocol CrashlyticsDelegate;
@interface Crashlytics : NSObject {
@private
NSString *_apiKey;
NSString *_dataDirectory;
NSString *_bundleIdentifier;
BOOL _installed;
NSMutableDictionary *_customAttributes;
id _user;
NSInteger _sendButtonIndex;
NSInteger _alwaysSendButtonIndex;
NSObject <CrashlyticsDelegate> *_delegate;
}
@interface Crashlytics : NSObject
@property (nonatomic, readonly, copy) NSString *apiKey;
@property (nonatomic, readonly, copy) NSString *version;
@@ -73,7 +62,7 @@ void CLSNSLog(NSString *format, ...);
* The recommended way to install Crashlytics into your application is to place a call
* to +startWithAPIKey: in your -application:didFinishLaunchingWithOptions: method.
*
* This delay defaults to 1 second in order to generally give the application time to
* This delay defaults to 1 second in order to generally give the application time to
* fully finish launching.
*
**/
@@ -105,21 +94,21 @@ void CLSNSLog(NSString *format, ...);
/**
*
* Many of our customers have requested the ability to tie crashes to specific end-users of their
* application in order to facilitate responses to support requests or permit the ability to reach
* out for more information. We allow you to specify up to three separate values for display within
* Many of our customers have requested the ability to tie crashes to specific end-users of their
* application in order to facilitate responses to support requests or permit the ability to reach
* out for more information. We allow you to specify up to three separate values for display within
* the Crashlytics UI - but please be mindful of your end-user's privacy.
*
* We recommend specifying a user identifier - an arbitrary string that ties an end-user to a record
* in your system. This could be a database id, hash, or other value that is meaningless to a
* We recommend specifying a user identifier - an arbitrary string that ties an end-user to a record
* in your system. This could be a database id, hash, or other value that is meaningless to a
* third-party observer but can be indexed and queried by you.
*
* Optionally, you may also specify the end-user's name or username, as well as email address if you
* Optionally, you may also specify the end-user's name or username, as well as email address if you
* do not have a system that works well with obscured identifiers.
*
* Pursuant to our EULA, this data is transferred securely throughout our system and we will not
* disseminate end-user data unless required to by law. That said, if you choose to provide end-user
* contact information, we strongly recommend that you disclose this in your application's privacy
* Pursuant to our EULA, this data is transferred securely throughout our system and we will not
* disseminate end-user data unless required to by law. That said, if you choose to provide end-user
* contact information, we strongly recommend that you disclose this in your application's privacy
* policy. Data privacy is of our utmost concern.
*
**/
@@ -148,10 +137,55 @@ void CLSNSLog(NSString *format, ...);
@end
/**
* The CLSCrashReport protocol exposes methods that you can call on crash report objects passed
* to delegate methods. If you want these values or the entire object to stay in memory retain
* them or copy them.
**/
@protocol CLSCrashReport <NSObject>
@required
/**
* Returns the session identifier for the crash report.
**/
@property (nonatomic, readonly) NSString *identifier;
/**
* Returns the custom key value data for the crash report.
**/
@property (nonatomic, readonly) NSDictionary *customKeys;
/**
* Returns the CFBundleVersion of the application that crashed.
**/
@property (nonatomic, readonly) NSString *bundleVersion;
/**
* Returns the CFBundleShortVersionString of the application that crashed.
**/
@property (nonatomic, readonly) NSString *bundleShortVersionString;
/**
* Returns the date that the application crashed at.
**/
@property (nonatomic, readonly) NSDate *crashedOnDate;
/**
* Returns the os version that the application crashed on.
**/
@property (nonatomic, readonly) NSString *OSVersion;
/**
* Returns the os build version that the application crashed on.
**/
@property (nonatomic, readonly) NSString *OSBuildVersion;
@end
/**
*
* The CrashlyticsDelegate protocol provides a mechanism for your application to take
* action on events that occur in the Crashlytics crash reporting system. You can make
* action on events that occur in the Crashlytics crash reporting system. You can make
* use of these calls by assigning an object to the Crashlytics' delegate property directly,
* or through the convenience startWithAPIKey:delegate:... methods.
*
@@ -161,7 +195,7 @@ void CLSNSLog(NSString *format, ...);
/**
*
* Called once a Crashlytics instance has determined that the last execution of the
* Called once a Crashlytics instance has determined that the last execution of the
* application ended in a crash. This is called some time after the crash reporting
* process has begun. If you have specified a delay in one of the
* startWithAPIKey:... calls, this will take at least that long to be invoked.
@@ -169,4 +203,15 @@ void CLSNSLog(NSString *format, ...);
**/
- (void)crashlyticsDidDetectCrashDuringPreviousExecution:(Crashlytics *)crashlytics;
/**
*
* Just like crashlyticsDidDetectCrashDuringPreviousExecution this delegate method is
* called once a Crashlytics instance has determined that the last execution of the
* application ended in a crash. A CLSCrashReport is passed back that contains data about
* the last crash report that was generated. See the CLSCrashReport protocol for method details.
* This method is called after crashlyticsDidDetectCrashDuringPreviousExecution.
*
**/
- (void)crashlytics:(Crashlytics *)crashlytics didDetectCrashDuringPreviousExecution:(id <CLSCrashReport>)crash;
@end

View File

@@ -2,8 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>11C74</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
@@ -17,38 +15,16 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.1.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<string>2.1.3</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>CFBundleVersion</key>
<string>0101.01.00</string>
<key>CrashlyticsAPIKey</key>
<string>0d10c90776f5ef5acd01ddbeaca9a6cba4814560</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>8H7</string>
<string>13</string>
<key>DTPlatformName</key>
<string>iphoneos</string>
<key>DTPlatformVersion</key>
<string>4.3</string>
<key>DTSDKBuild</key>
<string>8H7</string>
<key>DTSDKName</key>
<string>iphoneos4.3</string>
<key>DTXcode</key>
<string>0410</string>
<key>DTXcodeBuild</key>
<string>4B110</string>
<key>MinimumOSVersion</key>
<string>3.1</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
</array>
<string>4.0</string>
</dict>
</plist>

BIN
External/Crashlytics.framework/run vendored Executable file

Binary file not shown.

1
External/DCIntrospect vendored Submodule

Submodule External/DCIntrospect added at 3aa3122645

1
External/FontReplacer vendored Submodule

Submodule External/FontReplacer added at 4e3dea0870

1
External/GoogleOpenSource.framework vendored Symbolic link
View File

@@ -0,0 +1 @@
google-plus-ios-sdk/GoogleOpenSource.framework

1
External/GooglePlus.framework vendored Symbolic link
View File

@@ -0,0 +1 @@
google-plus-ios-sdk/GooglePlus.framework

22
External/Localytics/LICENSE vendored Normal file
View File

@@ -0,0 +1,22 @@
Copyright (c) 2013, Char Software, Inc. d/b/a Localytics
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Neither the name of Char Software, Inc., Localytics nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY CHAR SOFTWARE, INC. D/B/A LOCALYTICS ''AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL CHAR SOFTWARE, INC. D/B/A LOCALYTICS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -1,57 +1,78 @@
//
// LocalyticsDatabase.h
// LocalyticsDemo
//
// Created by jkaufman on 5/26/11.
// Copyright 2011 Localytics. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <sqlite3.h>
#define MAX_DATABASE_SIZE 500000 // The maximum allowed disk size of the primary database file at open, in bytes
#define VACUUM_THRESHOLD 0.8 // The database is vacuumed after its size exceeds this proportion of the maximum.
@interface LocalyticsDatabase : NSObject {
sqlite3 *_databaseConnection;
}
+ (LocalyticsDatabase *)sharedLocalyticsDatabase;
- (NSUInteger)databaseSize;
- (int)eventCount;
- (NSTimeInterval)createdTimestamp;
- (BOOL)beginTransaction:(NSString *)name;
- (BOOL)releaseTransaction:(NSString *)name;
- (BOOL)rollbackTransaction:(NSString *)name;
- (BOOL)incrementLastUploadNumber:(int *)uploadNumber;
- (BOOL)incrementLastSessionNumber:(int *)sessionNumber;
- (BOOL)addEventWithBlobString:(NSString *)blob;
- (BOOL)addCloseEventWithBlobString:(NSString *)blob;
- (BOOL)addFlowEventWithBlobString:(NSString *)blob;
- (BOOL)removeLastCloseAndFlowEvents;
- (BOOL)addHeaderWithSequenceNumber:(int)number blobString:(NSString *)blob rowId:(sqlite3_int64 *)insertedRowId;
- (int)unstagedEventCount;
- (BOOL)stageEventsForUpload:(sqlite3_int64)headerId;
- (BOOL)updateAppKey:(NSString *)appKey;
- (NSString *)uploadBlobString;
- (BOOL)deleteUploadedData;
- (BOOL)resetAnalyticsData;
- (BOOL)vacuumIfRequired;
- (NSTimeInterval)lastSessionStartTimestamp;
- (BOOL)setLastsessionStartTimestamp:(NSTimeInterval)timestamp;
- (BOOL)isOptedOut;
- (BOOL)setOptedOut:(BOOL)optOut;
- (NSString *)installId;
- (NSString *)appKey; // Most recent app key-- may not be that used to open the session.
- (NSString *)customDimension:(int)dimension;
- (BOOL)setCustomDimension:(int)dimension value:(NSString *)value;
@end
//
// LocalyticsDatabase.h
// Copyright (C) 2013 Char Software Inc., DBA Localytics
//
// This code is provided under the Localytics Modified BSD License.
// A copy of this license has been distributed in a file called LICENSE
// with this source code.
//
// Please visit www.localytics.com for more information.
#import <Foundation/Foundation.h>
#import <sqlite3.h>
#define MAX_DATABASE_SIZE 500000 // The maximum allowed disk size of the primary database file at open, in bytes
#define VACUUM_THRESHOLD 0.8 // The database is vacuumed after its size exceeds this proportion of the maximum.
@interface LocalyticsDatabase : NSObject {
sqlite3 *_databaseConnection;
}
@property (nonatomic, assign, readonly) BOOL firstRun;
- (unsigned long long)databaseSize;
- (int)eventCount;
- (NSTimeInterval)createdTimestamp;
- (BOOL)beginTransaction:(NSString *)name;
- (BOOL)releaseTransaction:(NSString *)name;
- (BOOL)rollbackTransaction:(NSString *)name;
- (BOOL)incrementLastUploadNumber:(int *)uploadNumber;
- (BOOL)incrementLastSessionNumber:(int *)sessionNumber;
- (BOOL)addEventWithBlobString:(NSString *)blob;
- (BOOL)addCloseEventWithBlobString:(NSString *)blob;
- (BOOL)queueCloseEventWithBlobString:(NSString *)blob;
- (NSString *)dequeueCloseEventBlobString;
- (BOOL)addFlowEventWithBlobString:(NSString *)blob;
- (BOOL)removeLastCloseAndFlowEvents;
- (BOOL)addHeaderWithSequenceNumber:(int)number blobString:(NSString *)blob rowId:(sqlite3_int64 *)insertedRowId;
- (int)unstagedEventCount;
- (BOOL)stageEventsForUpload:(sqlite3_int64)headerId;
- (BOOL)updateAppKey:(NSString *)appKey;
- (NSString *)uploadBlobString;
- (BOOL)deleteUploadedData;
- (BOOL)resetAnalyticsData;
- (BOOL)vacuumIfRequired;
- (NSTimeInterval)lastSessionStartTimestamp;
- (BOOL)setLastSessionStartTimestamp:(NSTimeInterval)timestamp;
- (BOOL)isOptedOut;
- (BOOL)setOptedOut:(BOOL)optOut;
- (NSString *)appVersion;
- (BOOL)updateAppVersion:(NSString *)appVersion;
- (NSString *)installId;
- (NSString *)appKey; // Most recent app key-- may not be that used to open the session.
- (NSString *)customDimension:(int)dimension;
- (BOOL)setCustomDimension:(int)dimension value:(NSString *)value;
- (BOOL)setValueForIdentifier:(NSString *)identifierName value:(NSString *)value;
- (NSString *)valueForIdentifier:(NSString *)identifierName;
- (BOOL)deleteIdentifer:(NSString *)identifierName;
- (NSDictionary *)identifiers;
- (BOOL)setFacebookAttribution:(NSString *)fbAttribution;
- (NSString *)facebookAttributionFromDb;
- (NSString *)facebookAttributionFromPasteboard;
- (NSInteger)safeIntegerValueFromDictionary:(NSDictionary *)dict forKey:(NSString *)key;
- (NSString *)safeStringValueFromDictionary:(NSDictionary *)dict forKey:(NSString *)key;
- (NSDictionary *)safeDictionaryFromDictionary:(NSDictionary *)dict forKey:(NSString *)key;
- (NSArray *)safeListFromDictionary:(NSDictionary *)dict forKey:(NSString *)key;
@end

1408
External/Localytics/LocalyticsDatabase.m vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,107 @@
// LocalyticsSession+Private.h
// Copyright (C) 2013 Char Software Inc., DBA Localytics
//
// This code is provided under the Localytics Modified BSD License.
// A copy of this license has been distributed in a file called LICENSE
// with this source code.
//
// Please visit www.localytics.com for more information.
#import "LocalyticsSession.h"
#import "LocalyticsUploader.h"
#import "LocalyticsDatabase.h"
#define CLIENT_VERSION_PREFIX @"iOS"
#define LOCALYTICS_LOGGING_ENABLED [[LocalyticsSession shared] loggingEnabled]
#define LocalyticsLog(message, ...)if([[LocalyticsSession shared] loggingEnabled]) \
[LocalyticsSession logMessage:[NSString stringWithFormat:@"%s:\n + " message "\n\n", __PRETTY_FUNCTION__, ##__VA_ARGS__]]
@interface LocalyticsSession()
{
BOOL _hasInitialized; // Whether or not the session object has been initialized.
BOOL _isSessionOpen; // Whether or not this session has been opened.
float _sessionTimeoutInterval; // If an App stays in the background for more
// than this many seconds, start a new session
// when it returns to foreground.
@private
#pragma mark Member Variables
dispatch_queue_t _queue; // Queue of Localytics block objects.
dispatch_group_t _criticalGroup; // Group of blocks the must complete before backgrounding.
NSString *_sessionUUID; // Unique identifier for this session.
NSString *_applicationKey; // Unique identifier for the instrumented application
NSString *_facebookAttribution; // Facebook attribution cookie
NSTimeInterval _lastSessionStartTimestamp; // The start time of the most recent session.
NSDate *_sessionResumeTime; // Time session was started or resumed.
NSDate *_sessionCloseTime; // Time session was closed.
NSMutableString *_unstagedFlowEvents; // Comma-delimited list of app screens and events tagged during this
// session that have NOT been staged for upload.
NSMutableString *_stagedFlowEvents; // App screens and events tagged during this session that HAVE been staged
// for upload.
NSMutableString *_screens; // Comma-delimited list of screens tagged during this session.
NSTimeInterval _sessionActiveDuration; // Duration that session open.
BOOL _sessionHasBeenOpen; // Whether or not this session has ever been open.
LocalyticsDatabase *_db; // Localytics database reference
LocalyticsUploader *_uploader; // Localytics uploader reference
}
@property (nonatomic, retain) NSString *applicationKey;
@property (nonatomic, retain) NSString *facebookAttribution;
@property (nonatomic,readonly) dispatch_queue_t queue;
@property (nonatomic,readonly) dispatch_group_t criticalGroup;
@property (atomic) BOOL isSessionOpen;
@property (atomic) BOOL hasInitialized;
@property (nonatomic, retain) NSString *sessionUUID;
@property (nonatomic, assign) NSTimeInterval lastSessionStartTimestamp;
@property (nonatomic, retain) NSDate *sessionResumeTime;
@property (nonatomic, retain) NSDate *sessionCloseTime;
@property (nonatomic, retain) NSMutableString *unstagedFlowEvents;
@property (nonatomic, retain) NSMutableString *stagedFlowEvents;
@property (nonatomic, retain) NSMutableString *screens;
@property (nonatomic, assign) NSTimeInterval sessionActiveDuration;
@property (nonatomic, assign) BOOL sessionHasBeenOpen;
@property (nonatomic, assign) NSInteger sessionNumber;
@property (nonatomic, assign) BOOL needsSessionStartActions;
@property (nonatomic, assign) BOOL needsFirstRunActions;
@property (nonatomic, assign) BOOL needsUpgradeActions;
// Private methods.
+ (id)allocFactory;
- (void)reopenPreviousSession;
- (void)addFlowEventWithName:(NSString *)name type:(NSString *)eventType;
- (void)addScreenWithName:(NSString *)name;
- (NSString *)blobHeaderStringWithSequenceNumber:(int)nextSequenceNumber;
- (BOOL)ll_isOptedIn;
- (BOOL)createOptEvent:(BOOL)optState;
- (BOOL)saveApplicationFlowAndRemoveOnResume:(BOOL)removeOnResume;
- (NSString *)formatAttributeWithName:(NSString *)paramName value:(NSString *)paramValue;
- (NSString *)formatAttributeWithName:(NSString *)paramName value:(NSString *)paramValue first:(BOOL)firstAttribute;
- (void)uploadCallback:(NSDictionary*)info;
+ (BOOL)appKeyIsValid:(NSString *)appKey;
- (void)ll_open;
- (LocalyticsDatabase *)db;
- (LocalyticsUploader *)uploader;
- (BOOL)uploadIsNeeded;
- (void)onStartSession;
- (void)onFirstRun;
- (void)onUpgrade;
// Datapoint methods.
- (NSString *)customDimensions;
- (NSString *)locationDimensions;
- (NSString *)hashString:(NSString *)input;
- (NSString *)randomUUID;
- (NSString *)escapeString:(NSString *)input;
- (NSString *)installationId;
- (NSString *)appVersion;
- (NSTimeInterval)currentTimestamp;
- (BOOL)isDeviceJailbroken;
- (NSString *)deviceModel;
- (NSString *)modelSizeString;
- (double)availableMemory;
- (NSString *)advertisingIdentifier;
- (NSString *)uniqueDeviceIdentifier;
@end

View File

@@ -1,216 +1,301 @@
// LocalyticsSession.h
// Copyright (C) 2009 Char Software Inc., DBA Localytics
//
// This code is provided under the Localytics Modified BSD License.
// A copy of this license has been distributed in a file called LICENSE
// with this source code.
//
// Please visit www.localytics.com for more information.
#import <UIKit/UIKit.h>
// Set this to true to enable localytics traces (useful for debugging)
#define DO_LOCALYTICS_LOGGING false
/*!
@class LocalyticsSession
@discussion The class which manages creating, collecting, & uploading a Localytics session.
Please see the following guides for information on how to best use this
library, sample code, and other useful information:
<ul>
<li><a href="http://wiki.localytics.com/index.php?title=Developer's_Integration_Guide">Main Developer's Integration Guide</a></li>
</ul>
<strong>Best Practices</strong>
<ul>
<li>Instantiate the LocalyticsSession object in applicationDidFinishLaunching.</li>
<li>Open your session and begin your uploads in applicationDidFinishLaunching. This way the
upload has time to complete and it all happens before your users have a
chance to begin any data intensive actions of their own.</li>
<li>Close the session in applicationWillTerminate, and in applicationDidEnterBackground.</li>
<li>Resume the session in applicationWillEnterForeground.</li>
<li>Do not call any Localytics functions inside a loop. Instead, calls
such as <code>tagEvent</code> should follow user actions. This limits the
amount of data which is stored and uploaded.</li>
<li>Do not use multiple LocalticsSession objects to upload data with
multiple application keys. This can cause invalid state.</li>
</ul>
@author Localytics
*/
@interface LocalyticsSession : NSObject {
BOOL _hasInitialized; // Whether or not the session object has been initialized.
BOOL _isSessionOpen; // Whether or not this session has been opened.
float _backgroundSessionTimeout; // If an App stays in the background for more
// than this many seconds, start a new session
// when it returns to foreground.
@private
#pragma mark Member Variables
dispatch_queue_t _queue; // Queue of Localytics block objects.
dispatch_group_t _criticalGroup; // Group of blocks the must complete before backgrounding.
NSString *_sessionUUID; // Unique identifier for this session.
NSString *_applicationKey; // Unique identifier for the instrumented application
NSTimeInterval _lastSessionStartTimestamp; // The start time of the most recent session.
NSDate *_sessionResumeTime; // Time session was started or resumed.
NSDate *_sessionCloseTime; // Time session was closed.
NSMutableString *_unstagedFlowEvents; // Comma-delimited list of app screens and events tagged during this
// session that have NOT been staged for upload.
NSMutableString *_stagedFlowEvents; // App screens and events tagged during this session that HAVE been staged
// for upload.
NSMutableString *_screens; // Comma-delimited list of screens tagged during this session.
NSTimeInterval _sessionActiveDuration; // Duration that session open.
BOOL _sessionHasBeenOpen; // Whether or not this session has ever been open.
}
@property dispatch_queue_t queue;
@property dispatch_group_t criticalGroup;
@property BOOL isSessionOpen;
@property BOOL hasInitialized;
@property float backgroundSessionTimeout;
#pragma mark Public Methods
/*!
@method sharedLocalyticsSession
@abstract Accesses the Session object. This is a Singleton class which maintains
a single session throughout your application. It is possible to manage your own
session, but this is the easiest way to access the Localytics object throughout your code.
The class is accessed within the code using the following syntax:
[[LocalyticsSession sharedLocalyticsSession] functionHere]
So, to tag an event, all that is necessary, anywhere in the code is:
[[LocalyticsSession sharedLocalyticsSession] tagEvent:@"MY_EVENT"];
*/
+ (LocalyticsSession *)sharedLocalyticsSession;
/*!
@method LocalyticsSession
@abstract Initializes the Localytics Object. Not necessary if you choose to use startSession.
@param applicationKey The key unique for each application generated at www.localytics.com
*/
- (void)LocalyticsSession:(NSString *)appKey;
/*!
@method startSession
@abstract An optional convenience initialize method that also calls the LocalyticsSession, open &
upload methods. Best Practice is to call open & upload immediately after Localytics Session when loading an app,
this method fascilitates that behavior.
It is recommended that this call be placed in <code>applicationDidFinishLaunching</code>.
@param applicationKey The key unique for each application generated
at www.localytics.com
*/
- (void)startSession:(NSString *)appKey;
/*!
@method setOptIn
@abstract (OPTIONAL) Allows the application to control whether or not it will collect user data.
Even if this call is used, it is necessary to continue calling upload(). No new data will be
collected, so nothing new will be uploaded but it is necessary to upload an event telling the
server this user has opted out.
@param optedIn True if the user is opted in, false otherwise.
*/
- (void)setOptIn:(BOOL)optedIn;
/*!
@method isOptedIn
@abstract (OPTIONAL) Whether or not this user has is opted in or out. The only way they can be
opted out is if setOptIn(false) has been called before this. This function should only be
used to pre-populate a checkbox in an options menu. It is not recommended that an application
branch based on Localytics instrumentation because this creates an additional test case. If
the app is opted out, all subsequent Localytics calls will return immediately.
@result true if the user is opted in, false otherwise.
*/
- (BOOL)isOptedIn;
/*!
@method open
@abstract Opens the Localytics session. Not necessary if you choose to use startSession.
The session time as presented on the website is the time between <code>open</code> and the
final <code>close</code> so it is recommended to open the session as early as possible, and close
it at the last moment. The session must be opened before any tags can
be written. It is recommended that this call be placed in <code>applicationDidFinishLaunching</code>.
<br>
If for any reason this is called more than once every subsequent open call
will be ignored.
*/
- (void)open;
/*!
@method resume
@abstract Resumes the Localytics session. When the App enters the background, the session is
closed and the time of closing is recorded. When the app returns to the foreground, the session
is resumed. If the time since closing is greater than BACKGROUND_SESSION_TIMEOUT, (15 seconds
by default) a new session is created, and uploading is triggered. Otherwise, the previous session
is reopened.
*/
- (void)resume;
/*!
@method close
@abstract Closes the Localytics session. This should be called in
<code>applicationWillTerminate</code>.
<br>
If close is not called, the session will still be uploaded but no
events will be processed and the session time will not appear. This is
because the session is not yet closed so it should not be used in
comparison with sessions which are closed.
*/
- (void)close;
/*!
@method tagEvent
@abstract Allows a session to tag a particular event as having occurred. For
example, if a view has three buttons, it might make sense to tag
each button click with the name of the button which was clicked.
For another example, in a game with many levels it might be valuable
to create a new tag every time the user gets to a new level in order
to determine how far the average user is progressing in the game.
<br>
<strong>Tagging Best Practices</strong>
<ul>
<li>DO NOT use tags to record personally identifiable information.</li>
<li>The best way to use tags is to create all the tag strings as predefined
constants and only use those. This is more efficient and removes the risk of
collecting personal information.</li>
<li>Do not set tags inside loops or any other place which gets called
frequently. This can cause a lot of data to be stored and uploaded.</li>
</ul>
<br>
See the tagging guide at: http://wiki.localytics.com/
@param event The name of the event which occurred.
*/
- (void)tagEvent:(NSString *)event;
- (void)tagEvent:(NSString *)event attributes:(NSDictionary *)attributes;
- (void)tagEvent:(NSString *)event attributes:(NSDictionary *)attributes reportAttributes:(NSDictionary *)reportAttributes;
/*!
@method tagScreen
@abstract Allows tagging the flow of screens encountered during the session.
@param screen The name of the screen
*/
- (void)tagScreen:(NSString *)screen;
/*!
@method upload
@abstract Creates a low priority thread which uploads any Localytics data already stored
on the device. This should be done early in the process life in order to
guarantee as much time as possible for slow connections to complete. It is also reasonable
to upload again when the application is exiting because if the upload is cancelled the data
will just get uploaded the next time the app comes up.
*/
- (void)upload;
/*!
@method setCustomDimension
@abstract (ENTERPRISE ONLY) Sets the value of a custom dimension. Custom dimensions are dimensions
which contain user defined data unlike the predefined dimensions such as carrier, model, and country.
Once a value for a custom dimension is set, the device it was set on will continue to upload that value
until the value is changed. To clear a value pass nil as the value.
The proper use of custom dimensions involves defining a dimension with less than ten distinct possible
values and assigning it to one of the four available custom dimensions. Once assigned this definition should
never be changed without changing the App Key otherwise old installs of the application will pollute new data.
*/
- (void)setCustomDimension:(int)dimension value:(NSString *)value;
@end
// LocalyticsSession.h
// Copyright (C) 2013 Char Software Inc., DBA Localytics
//
// This code is provided under the Localytics Modified BSD License.
// A copy of this license has been distributed in a file called LICENSE
// with this source code.
//
// Please visit www.localytics.com for more information.
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
#define CLIENT_VERSION @"2.18.0"
#define MARKETING_PLATFORM
// Forward declaration
@protocol LocalyticsSessionDelegate;
/*!
@class LocalyticsSession
@discussion The class which manages creating, collecting, & uploading a Localytics session.
Please see the following guides for information on how to best use this
library, sample code, and other useful information:
<ul>
<li><a href="http://wiki.localytics.com/index.php?title=Developer's_Integration_Guide">
Main Developer's Integration Guide</a></li>
</ul>
<strong>Best Practices</strong>
<ul>
<li>Instantiate the LocalyticsSession object in applicationDidFinishLaunching.</li>
<li>Open your session and begin your uploads in applicationDidFinishLaunching. This way the
upload has time to complete and it all happens before your users have a
chance to begin any data intensive actions of their own.</li>
<li>Close the session in applicationWillTerminate, and in applicationDidEnterBackground.</li>
<li>Resume the session in applicationWillEnterForeground.</li>
<li>Do not call any Localytics functions inside a loop. Instead, calls
such as <code>tagEvent</code> should follow user actions. This limits the
amount of data which is stored and uploaded.</li>
<li>Do not use multiple LocalticsSession objects to upload data with
multiple application keys. This can cause invalid state.</li>
</ul>
@author Localytics
*/
@interface LocalyticsSession : NSObject
+ (void)logMessage:(NSString *)message;
/*!
@property enableHTTPS
@abstract (Optional) Determines whether or not HTTPS is used when calling the Localytics
post URL. The default is NO.
*/
@property (nonatomic, assign) BOOL enableHTTPS;
/*!
@property loggingEnabled
@abstract (Optional) Determines whether or Localytics debugging information is shown
to the console. The default is NO
*/
@property (nonatomic, assign) BOOL loggingEnabled;
/*!
@property sessionTimeoutInterval
@abstract (Optional) If an App stays in the background for more than this many seconds,
start a new session when it returns to foreground.
*/
@property (atomic) float sessionTimeoutInterval;
/*!
@property localyticsDelegate
@abstract (Optional) Assign this delegate to the class you'd like to register to recieve
the Localytics delegate callbacks (Defined at the end of this file)
*/
@property (nonatomic, assign) id<LocalyticsSessionDelegate> localyticsDelegate;
#pragma mark Public Methods
/*!
@method shared
@abstract Accesses the Session object. This is a Singleton class which maintains
a single session throughout your application. It is possible to manage your own
session, but this is the easiest way to access the Localytics object throughout your code.
The class is accessed within the code using the following syntax:
[[LocalyticsSession shared] functionHere]
So, to tag an event, all that is necessary, anywhere in the code is:
[[LocalyticsSession shared] tagEvent:@"MY_EVENT"];
*/
+ (LocalyticsSession *)sharedLocalyticsSession;
+ (LocalyticsSession *)shared;
/*!
@method startSession
@abstract An optional convenience initialize method that also calls the LocalyticsSession, open &
upload methods. Best Practice is to call open & upload immediately after Localytics Session when loading an app,
this method fascilitates that behavior.
It is recommended that this call be placed in <code>applicationDidFinishLaunching</code>.
@param appKey The key unique for each application generated
at www.localytics.com
*/
- (void)startSession:(NSString *)appKey;
/*!
@method open
@abstract Opens the Localytics session. Not necessary if you choose to use startSession.
The session time as presented on the website is the time between <code>open</code> and the
final <code>close</code> so it is recommended to open the session as early as possible, and close
it at the last moment. The session must be opened before any tags can
be written. It is recommended that this call be placed in <code>applicationDidFinishLaunching</code>.
<br>
If for any reason this is called more than once every subsequent open call
will be ignored.
*/
- (void)open;
/*!
@method resume
@abstract Resumes the Localytics session. When the App enters the background, the session is
closed and the time of closing is recorded. When the app returns to the foreground, the session
is resumed. If the time since closing is greater than BACKGROUND_SESSION_TIMEOUT, (15 seconds
by default) a new session is created, and uploading is triggered. Otherwise, the previous session
is reopened.
*/
- (void)resume;
/*!
@method close
@abstract Closes the Localytics session. This should be called in
<code>applicationWillTerminate</code>.
<br>
If close is not called, the session will still be uploaded but no
events will be processed and the session time will not appear. This is
because the session is not yet closed so it should not be used in
comparison with sessions which are closed.
*/
- (void)close;
/*!
@method tagEvent
@abstract Allows a session to tag a particular event as having occurred. For
example, if a view has three buttons, it might make sense to tag
each button click with the name of the button which was clicked.
For another example, in a game with many levels it might be valuable
to create a new tag every time the user gets to a new level in order
to determine how far the average user is progressing in the game.
<br>
<strong>Tagging Best Practices</strong>
<ul>
<li>DO NOT use tags to record personally identifiable information.</li>
<li>The best way to use tags is to create all the tag strings as predefined
constants and only use those. This is more efficient and removes the risk of
collecting personal information.</li>
<li>Do not set tags inside loops or any other place which gets called
frequently. This can cause a lot of data to be stored and uploaded.</li>
</ul>
<br>
See the tagging guide at: http://wiki.localytics.com/
@param event The name of the event which occurred.
@param attributes (Optional) An object/hash/dictionary of key-value pairs, contains
contextual data specific to the event.
@param reportAttributes (Optional) Additional attributes used for custom reporting.
Available to Enterprise customers, please contact services for more details.
@param customerValueIncrease (Optional) Numeric value, added to customer lifetime value.
Integer expected. Try to use lowest possible unit, such as cents for US currency.
*/
- (void)tagEvent:(NSString *)event
attributes:(NSDictionary *)attributes
reportAttributes:(NSDictionary *)reportAttributes
customerValueIncrease:(NSNumber *)customerValueIncrease;
- (void)tagEvent:(NSString *)event
attributes:(NSDictionary *)attributes
reportAttributes:(NSDictionary *)reportAttributes;
- (void)tagEvent:(NSString *)event
attributes:(NSDictionary *)attributes
customerValueIncrease:(NSNumber *)customerValueIncrease;
- (void)tagEvent:(NSString *)event
attributes:(NSDictionary *)attributes;
- (void)tagEvent:(NSString *)event;
/*!
@method tagScreen
@abstract Allows tagging the flow of screens encountered during the session.
@param screen The name of the screen
*/
- (void)tagScreen:(NSString *)screen;
/*!
@method upload
@abstract Creates a low priority thread which uploads any Localytics data already stored
on the device. This should be done early in the process life in order to
guarantee as much time as possible for slow connections to complete. It is also reasonable
to upload again when the application is exiting because if the upload is cancelled the data
will just get uploaded the next time the app comes up.
*/
- (void)upload;
/*!
@method LocalyticsSession
@abstract Initializes the Localytics Object. Not necessary if you choose to use startSession.
@param appKey The key unique for each application generated at www.localytics.com
*/
- (void)LocalyticsSession:(NSString *)appKey;
/*!
@method setOptIn
@abstract (OPTIONAL) Allows the application to control whether or not it will collect user data.
Even if this call is used, it is necessary to continue calling upload(). No new data will be
collected, so nothing new will be uploaded but it is necessary to upload an event telling the
server this user has opted out.
@param optedIn True if the user is opted in, false otherwise.
*/
- (void)setOptIn:(BOOL)optedIn;
/*!
@method setLocation
@abstract Stores the user's location. This will be used in all event and session calls.
If your application has already collected the user's location, it may be passed to Localytics
via this function. This will cause all events and the session close to include the locatin
information. It is not required that you call this function.
@param deviceLocation The user's location.
*/
- (void)setLocation:(CLLocationCoordinate2D)deviceLocation;
/*!
@method setCustomDimension
@abstract Sets the value of a custom dimension. Custom dimensions are dimensions
which contain user defined data unlike the predefined dimensions such as carrier, model, and country.
Once a value for a custom dimension is set, the device it was set on will continue to upload that value
until the value is changed. To clear a value pass nil as the value.
The proper use of custom dimensions involves defining a dimension with less than ten distinct possible
values and assigning it to one of the four available custom dimensions. Once assigned this definition should
never be changed without changing the App Key otherwise old installs of the application will pollute new data.
*/
- (void)setCustomDimension:(int)dimension value:(NSString *)value;
/*!
@method customDimension
@abstract Gets the custom dimension value for a given dimension. Avoid calling this on the main thread, as it
may take some time for all pending database execution. */
- (NSString *)customDimension:(int)dimension;
/*!
@method setValueForIdentifier
@abstract Sets the value of a custom identifier. Identifiers are a form of key/value storage
which contain custom user data. Identifiers might include things like email addresses, customer IDs, twitter
handles, and facebook IDs.
Once a value is set, the device it was set on will continue to upload that value until the value is changed.
To delete a property, pass in nil as the value.
*/
- (void)setValueForIdentifier:(NSString *)identifierName value:(NSString *)value;
/*!
@method setCustomerName
@abstract Record the customer name
Once this value is set, the device it was set on will continue to upload that value until the value is changed.
To delete the value, pass in nil.
*/
- (void)setCustomerName:(NSString *)email;
/*!
@method setCustomerId
@abstract Record your custom customer identifier
Once this value is set, the device it was set on will continue to upload that value until the value is changed.
To delete the value, pass in nil.
*/
- (void)setCustomerId:(NSString *)customerId;
/*!
@method setCustomerId
@abstract Record the customer's email address
Once this value is set, the device it was set on will continue to upload that value until the value is changed.
To delete the value, pass in nil.
*/
- (void)setCustomerEmail:(NSString *)email;
@end
@protocol LocalyticsSessionDelegate <NSObject>
@optional
/*!
@method localyticsResumedSession
@abstract Register for this callback to be notified when Localytics has either
resumed a previous session or created a new one. See the on the 'resume' method
for additional details.
@param didResumeExistingSession This flag will indicate if Localytics restored an existing
session or started a new one.
*/
- (void)localyticsResumedSession:(BOOL)didResumeExistingSession;
@end

1492
External/Localytics/LocalyticsSession.m vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,65 @@
// LocalyticsUploader.h
// Copyright (C) 2013 Char Software Inc., DBA Localytics
//
// This code is provided under the Localytics Modified BSD License.
// A copy of this license has been distributed in a file called LICENSE
// with this source code.
//
// Please visit www.localytics.com for more information.
#import <UIKit/UIKit.h>
extern NSString * const kLocalyticsKeyResponseBody;
/*!
@class LocalyticsUploader
@discussion Singleton class to handle data uploads
*/
@interface LocalyticsUploader : NSObject {
}
@property (readonly, atomic) BOOL isUploading;
/*!
@method LocalyticsUploader
@abstract Creates a thread which uploads all queued header and event data.
All files starting with sessionFilePrefix are renamed,
uploaded and deleted on upload. This way the sessions can continue
writing data regardless of whether or not the upload succeeds. Files
which have been renamed still count towards the total number of Localytics
files which can be stored on the disk.
This version of the method now just calls the second version of it with a nil target and NULL callback method.
@param localyticsApplicationKey the Localytics application ID
@param useHTTPS Flag determining whether HTTP or HTTPS is used for the post URL.
@param installId Install id passed to the server in the x-install-id header field.
@param libraryVersion Library version to be passed to the server in the x-client-version header field.
*/
- (void)uploaderWithApplicationKey:(NSString *)localyticsApplicationKey useHTTPS:(BOOL)useHTTPS installId:(NSString *)installId libraryVersion:(NSString *)libraryVersion;
/*!
@method LocalyticsUploader
@abstract Creates a thread which uploads all queued header and event data.
All files starting with sessionFilePrefix are renamed,
uploaded and deleted on upload. This way the sessions can continue
writing data regardless of whether or not the upload succeeds. Files
which have been renamed still count towards the total number of Localytics
files which can be stored on the disk.
@param localyticsApplicationKey the Localytics application ID
@param useHTTPS Flag determining whether HTTP or HTTPS is used for the post URL.
@param installId Install id passed to the server in the x-install-id header field.
@param libraryVersion Library version to be passed to the server in the x-client-version header field.
@param resultTarget Result target is the target for the callback method that knows how to handle response data
@param callback Callback is the method of the target class that is to be called with the data begin returned by an upload
*/
- (void)uploaderWithApplicationKey:(NSString *)localyticsApplicationKey useHTTPS:(BOOL)useHTTPS installId:(NSString *)installId libraryVersion:(NSString *)libraryVersion resultTarget:(id)target callback:(SEL)callbackMethod;
/*!
@method uploadTimeStamp
@abstract Retrieve upload TimeStamp.
*/
- (NSString *)uploadTimeStamp;
@end

269
External/Localytics/LocalyticsUploader.m vendored Normal file
View File

@@ -0,0 +1,269 @@
// LocalyticsUploader.m
// Copyright (C) 2013 Char Software Inc., DBA Localytics
//
// This code is provided under the Localytics Modified BSD License.
// A copy of this license has been distributed in a file called LICENSE
// with this source code.
//
// Please visit www.localytics.com for more information.
#import "LocalyticsUploader.h"
#import "LocalyticsSession.h"
#import "LocalyticsSession+Private.h"
#import "LocalyticsDatabase.h"
#import "WebserviceConstants.h"
#import <zlib.h>
#ifndef LOCALYTICS_URL
#define LOCALYTICS_URL @"http://analytics.localytics.com/api/v2/applications/%@/uploads"
#endif
#ifndef LOCALYTICS_URL_SECURED
#define LOCALYTICS_URL_SECURED @"https://analytics.localytics.com/api/v2/applications/%@/uploads"
#endif
NSString * const kLocalyticsKeyResponseBody = @"localytics.key.responseBody";
@interface LocalyticsUploader ()
- (void)finishUpload;
- (NSData *)gzipDeflatedDataWithData:(NSData *)data;
@property (readwrite) BOOL isUploading;
@end
@implementation LocalyticsUploader
@synthesize isUploading = _isUploading;
#pragma mark - Class Methods
- (void)uploaderWithApplicationKey:(NSString *)localyticsApplicationKey useHTTPS:(BOOL)useHTTPS installId:(NSString *)installId libraryVersion:(NSString *)libraryVersion
{
[self uploaderWithApplicationKey:localyticsApplicationKey useHTTPS:useHTTPS installId:installId libraryVersion:libraryVersion resultTarget:nil callback:NULL];
}
- (void)uploaderWithApplicationKey:(NSString *)localyticsApplicationKey useHTTPS:(BOOL)useHTTPS installId:(NSString *)installId libraryVersion:(NSString *)libraryVersion resultTarget:(id)target callback:(SEL)callbackMethod
{
// Do nothing if already uploading.
if (self.isUploading == true)
{
LocalyticsLog("Upload already in progress. Aborting.");
return;
}
LocalyticsLog("Beginning upload process");
self.isUploading = true;
// Prepare the data for upload. The upload could take a long time, so some effort has to be made to be sure that events
// which get written while the upload is taking place don't get lost or duplicated. To achieve this, the logic is:
// 1) Append every header row blob string and and those of its associated events to the upload string.
// 2) Deflate and upload the data.
// 3) On success, delete all blob headers and staged events. Events added while an upload is in process are not
// deleted because they are not associated a header (and cannot be until the upload completes).
// Step 1
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
LocalyticsDatabase *db = [[LocalyticsSession shared] db];
NSString *blobString = [db uploadBlobString];
if ([blobString length] == 0) {
// There is nothing outstanding to upload.
LocalyticsLog("Abandoning upload. There are no new events.");
[pool drain];
[self finishUpload];
return;
}
NSData *requestData = [blobString dataUsingEncoding:NSUTF8StringEncoding];
if(LOCALYTICS_LOGGING_ENABLED) {
NSString *logString = [[[NSString alloc] initWithData:requestData
encoding:NSUTF8StringEncoding] autorelease];
NSUInteger stringLength = [logString length];
logString = [logString stringByReplacingOccurrencesOfString:@"{"
withString:@"\n\t{"];
logString = [logString stringByReplacingOccurrencesOfString:@",\""
withString:@",\n\t\""];
LocalyticsLog("Uploading data (length: %u)\n%@",
stringLength,
logString);
}
// Step 2
NSData *deflatedRequestData = [[self gzipDeflatedDataWithData:requestData] retain];
[pool drain];
NSString *urlStringFormat;
if (useHTTPS) {
urlStringFormat = LOCALYTICS_URL_SECURED;
} else {
urlStringFormat = LOCALYTICS_URL;
}
NSURL *apiUrl = [NSURL URLWithString:[NSString stringWithFormat:urlStringFormat,[localyticsApplicationKey stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
NSMutableURLRequest *submitRequest = [self createRequestWithURL:apiUrl
installId:installId
libraryVersion:libraryVersion
requestData:deflatedRequestData];
[deflatedRequestData release];
// Perform synchronous upload in an async dispatch. This is necessary because the calling block will not persist to
// receive the response data.
dispatch_group_async([[LocalyticsSession shared] criticalGroup], [[LocalyticsSession shared] queue], ^{
@try {
NSURLResponse *response = nil;
NSError *responseError = nil;
NSData *responseData = [NSURLConnection sendSynchronousRequest:submitRequest returningResponse:&response error:&responseError];
NSInteger responseStatusCode = [(NSHTTPURLResponse *)response statusCode];
if (responseError) {
// On error, simply print the error and close the uploader. We have to assume the data was not transmited
// so it is not deleted. In the event that we accidently store data which was succesfully uploaded, the
// duplicate data will be ignored by the server when it is next uploaded.
LocalyticsLog("Error Uploading. Code: %d, Description: %@",
[responseError code],
[responseError localizedDescription]);
} else {
// Step 3
// While response status codes in the 5xx range leave upload rows intact, the default case is to delete.
if (responseStatusCode >= 500 && responseStatusCode < 600) {
LocalyticsLog("Upload failed with response status code %d", responseStatusCode);
} else {
// Because only one instance of the uploader can be running at a time it should not be possible for
// new upload rows to appear so there is no fear of deleting data which has not yet been uploaded.
LocalyticsLog("Upload completed successfully. Response code %d", responseStatusCode);
[[[LocalyticsSession shared] db] deleteUploadedData];
}
}
if ([responseData length] > 0) {
if (LOCALYTICS_LOGGING_ENABLED) {
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
LocalyticsLog("Response body: %@", responseString);
[responseString release];
}
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:responseData forKey:kLocalyticsKeyResponseBody];
if (target) {
[target performSelector:callbackMethod withObject:userInfo];
}
}
[self finishUpload];
}
@catch (NSException * e) {}
});
}
- (NSMutableURLRequest *)createRequestWithURL:(NSURL *)URL installId:(NSString *)installId libraryVersion:(NSString *)libraryVersion requestData:(NSData *)requestData
{
NSMutableURLRequest *submitRequest = [NSMutableURLRequest requestWithURL:URL
cachePolicy:NSURLRequestReloadIgnoringCacheData
timeoutInterval:60.0];
[submitRequest setHTTPMethod:@"POST"];
[submitRequest setValue:[self uploadTimeStamp] forHTTPHeaderField:HEADER_CLIENT_TIME];
[submitRequest setValue:installId forHTTPHeaderField:HEADER_INSTALL_ID];
[submitRequest setValue:libraryVersion forHTTPHeaderField:HEADER_CLIENT_VERSION];
[submitRequest setValue:@"application/x-gzip" forHTTPHeaderField:@"Content-Type"];
[submitRequest setValue:@"gzip" forHTTPHeaderField:@"Content-Encoding"];
[submitRequest setValue:[NSString stringWithFormat:@"%d", requestData.length] forHTTPHeaderField:@"Content-Length"];
[submitRequest setHTTPBody:requestData];
return submitRequest;
}
- (void)finishUpload
{
self.isUploading = false;
// Upload data has been deleted. Recover the disk space if necessary.
[[[LocalyticsSession shared] db] vacuumIfRequired];
}
/*!
@method gzipDeflatedDataWithData
@abstract Deflates the provided data using gzip at the default compression level (6).
@return the deflated data
*/
- (NSData *)gzipDeflatedDataWithData:(NSData *)data
{
if ([data length] == 0) return data;
z_stream strm;
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
strm.total_out = 0;
strm.next_in=(Bytef *)[data bytes];
strm.avail_in = [data length];
// Compresssion Levels:
// Z_NO_COMPRESSION
// Z_BEST_SPEED
// Z_BEST_COMPRESSION
// Z_DEFAULT_COMPRESSION
if (deflateInit2(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, (15+16), 8, Z_DEFAULT_STRATEGY) != Z_OK) return nil;
NSMutableData *compressed = [NSMutableData dataWithLength:16384]; // 16K chunks for expansion
do {
if (strm.total_out >= [compressed length])
[compressed increaseLengthBy: 16384];
strm.next_out = [compressed mutableBytes] + strm.total_out;
strm.avail_out = [compressed length] - strm.total_out;
deflate(&strm, Z_FINISH);
} while (strm.avail_out == 0);
deflateEnd(&strm);
[compressed setLength: strm.total_out];
return [NSData dataWithData:compressed];
}
/*!
@method uploadTimeStamp
@abstract Gets the current time, along with local timezone, formatted as a DateTime for the webservice.
@return a DateTime of the current local time and timezone.
*/
- (NSString *)uploadTimeStamp {
return [ NSString stringWithFormat:@"%ld", (long)[[NSDate date] timeIntervalSince1970] ];
}
#pragma mark - System Functions
- (id)copyWithZone:(NSZone *)zone {
#pragma unused(zone)
return self;
}
- (id)retain {
return self;
}
- (unsigned)retainCount {
// maximum value of an unsigned int - prevents additional retains for the class
return UINT_MAX;
}
- (oneway void)release {
// ignore release commands
}
- (id)autorelease {
return self;
}
@end

View File

@@ -1,15 +1,22 @@
// WebserviceConstants.h
// Copyright (C) 2009 Char Software Inc., DBA Localytics
//
// Copyright (C) 2013 Char Software Inc., DBA Localytics
//
// This code is provided under the Localytics Modified BSD License.
// A copy of this license has been distributed in a file called LICENSE
// with this source code.
//
// with this source code.
//
// Please visit www.localytics.com for more information.
// The constants which are used to make up the JSON blob
// To save disk space and network bandwidth all the keywords have been
// abbreviated and are exploded by the server.
// abbreviated and are exploded by the server.
/*****************
* Upload Header *
*****************/
#define HEADER_CLIENT_TIME @"x-upload-time"
#define HEADER_INSTALL_ID @"x-install-id"
#define HEADER_CLIENT_VERSION @"x-client-version"
/*********************
* Shared Attributes *
@@ -22,6 +29,7 @@
#define PARAM_SESSION_UUID @"su" // UUID for an existing session
#define PARAM_NEW_SESSION_UUID @"u" // UUID for a new session
#define PARAM_ATTRIBUTES @"attrs" // Attributes (dictionary)
#define PARAM_SESSION_ELAPSE_TIME @"sl" // Number of seconds since the previous session start
/***************
* Blob Header *
@@ -31,7 +39,7 @@
// PARAM_DATA_TYPE => "h" for Header
// PARAM_ATTRIBUTES => dictionary containing Header Common Attributes
#define PARAM_PERSISTED_AT @"pa" // Persistent Storage Created At. A timestamp created when the app was
// first launched and the persistent storage was created. Stores as
// first launched and the persistent storage was created. Stores as
// seconds from Unix epoch. (int)
#define PARAM_SEQUENCE_NUMBER @"seq" // Sequence number - an increasing count for each blob, stored in the
// persistent store Consistent across app starts. (int)
@@ -42,9 +50,8 @@
// PARAM_DATA_TYPE
#define PARAM_APP_KEY @"au" // Localytics Application ID
#define PARAM_DEVICE_UUID @"du" // Device UUID
#define PARAM_DEVICE_UUID_HASHED @"udid" // Hashed version of the UUID
#define PARAM_DEVICE_MAC @"wmac" // Hashed version of the device Mac
#define PARAM_DEVICE_ADID @"adid" // Advertising Identifier
#define PARAM_INSTALL_ID @"iu" // Install ID
#define PARAM_JAILBROKEN @"j" // Jailbroken (boolean)
#define PARAM_LIBRARY_VERSION @"lv" // Client Version
@@ -52,15 +59,16 @@
#define PARAM_DEVICE_PLATFORM @"dp" // Device Platform
#define PARAM_LOCALE_LANGUAGE @"dll" // Locale Language
#define PARAM_LOCALE_COUNTRY @"dlc" // Locale Country
#define PARAM_NETWORK_COUNTRY @"nc" // Network Country (iso code) // ???: Never used on iPhone.
#define PARAM_DEVICE_COUNTRY @"dc" // Device Country (iso code)
#define PARAM_DEVICE_MANUFACTURER @"dma" // Device Manufacturer // ???: Never used on iPhone. Used to be "Device Make".
#define PARAM_DEVICE_MODEL @"dmo" // Device Model
#define PARAM_DEVICE_OS_VERSION @"dov" // Device OS Version
#define PARAM_NETWORK_CARRIER @"nca" // Network Carrier
#define PARAM_DATA_CONNECTION @"dac" // Data Connection Type // ???: Never used on iPhone.
#define PARAM_OPT_VALUE @"optin" // Opt In (boolean)
#define PARAM_OPT_VALUE @"out" // Opt Out (boolean)
#define PARAM_DEVICE_MEMORY @"dmem" // Device Memory
#define PARAM_IDENTIFIERS @"ids" // Identifiers (dictionary)
#define PARAM_BIRTH_TIME @"b" // Birth time (Since epoch)
#define PARAM_TIMEZONE_OFFSET @"tz" // Device offset from GMT in seconds
#define PARAM_FB_ATTRIBUTION @"fbat" // Facebook attribution cookie
/*****************
* Session Start *
@@ -98,6 +106,7 @@
// PARAM_ATTRIBUTES => dictionary containing attributes for this event as key-value string pairs
#define PARAM_EVENT_NAME @"n" // Event Name, (eg. 'Button Click')
#define PARAM_REPORT_ATTRIBUTES @"rattrs" // Attributes used in custom reports
#define PARAM_VALUE_NAME @"v" // Added customer value for an event, such as revenue
/********************
* Application flow *
@@ -108,4 +117,7 @@
// PARAM_CLIENT_TIME
#define PARAM_SESSION_START @"ss" // Start time for the current session.
#define PARAM_NEW_FLOW_EVENTS @"nw" // Events and screens encountered during this session that have NOT been staged for upload.
#define PARAM_OLD_FLOW_EVENTS @"od" // Events and screens encountered during this session that HAVE been staged for upload.
#define PARAM_OLD_FLOW_EVENTS @"od" // Events and screens encountered during this session that HAVE been staged for upload.

1
External/LoveLyndir vendored Submodule

Submodule External/LoveLyndir added at c2c0d1e45a

2
External/Pearl vendored

1
External/RHStatusItemView vendored Submodule

1
External/Reveal.framework/Headers vendored Symbolic link
View File

@@ -0,0 +1 @@
Versions/Current/Headers

1
External/Reveal.framework/Reveal vendored Symbolic link
View File

@@ -0,0 +1 @@
Versions/Current/Reveal

View File

@@ -0,0 +1,17 @@
//
// Copyright (c) 2013 Itty Bitty Apps. All rights reserved.
#import <Foundation/Foundation.h>
extern NSString * const IBARevealLoaderRequestStartNotification;
extern NSString * const IBARevealLoaderRequestStopNotification;
extern NSString * const IBARevealLoaderSetOptionsNotification;
extern NSString * const IBARevealLoaderOptionsLogLevelMaskKey;
@interface IBARevealLoader : NSObject
+ (void)startServer;
+ (void)stopServer;
@end

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2013 Itty Bitty Apps Pty Ltd. All rights reserved.
//
#import <Foundation/Foundation.h>
CF_EXTERN_C_BEGIN
/*!
\brief The Reveal Log level bit flags.
\discussion These flags are addative. Ie, you should bitwise OR them together.
\seealso IBARevealLoggerSetLevelMask
\seealso IBARevealLoggerGetLevelMask
Example:
// Enable Error, Warning and Info logger levels.
IBARevealLoggerSetLevelMask(IBARevealLogLevelError|IBARevealLogLevelWarn|IBARevealLogLevelInfo);
*/
typedef NS_OPTIONS(int32_t, IBARevealLogLevel)
{
IBARevealLogLevelNone = 0,
IBARevealLogLevelDebug = (1 << 0),
IBARevealLogLevelInfo = (1 << 1),
IBARevealLogLevelWarn = (1 << 2),
IBARevealLogLevelError = (1 << 3)
};
/*!
\brief Set the Reveal logger level mask.
\param mask A bit mask which is a combination of the IBARevealLogLevel enum options.
\discussion If you do not wish to see log messages from Reveal you should call this function with an appropriate level mask as early in your application's lifecycle as possible. For example in your application's main() function.
Example:
// Enable Error, Warning and Info logger levels.
IBARevealLoggerSetLevelMask(IBARevealLogLevelError|IBARevealLogLevelWarn|IBARevealLogLevelInfo);
*/
CF_EXPORT void IBARevealLoggerSetLevelMask(int32_t mask);
/*!
\brief Get the current Reveal logger level mask.
\return A bit mask representing the levels at which Reveal is currently logging.
\discussion The default Reveal Logger level mask is IBARevealLogLevelError|IBARevealLogLevelWarn|IBARevealLogLevelInfo.
Example:
// Turn off the Info log level.
IBARevealLoggerSetLevelMask(IBARevealLoggerGetLevelMask() & ~IBARevealLogLevelInfo);
*/
CF_EXPORT int32_t IBARevealLoggerGetLevelMask(void);
CF_EXTERN_C_END

View File

@@ -0,0 +1,5 @@
// Copyright (c) 2013 Itty Bitty Apps Pty Ltd. All rights reserved.
//
#import "IBARevealLogger.h"
#import "IBARevealLoader.h"

Binary file not shown.

View File

@@ -0,0 +1 @@
A

229
External/TestFlight/README.md vendored Normal file
View File

@@ -0,0 +1,229 @@
## Introduction
The TestFlight SDK allows you to track how beta testers are testing your application. Out of the box we track simple usage information, such as which tester is using your application, their device model/OS, how long they used the application, and automatic recording of any crashes they encounter.
The SDK can track more information if you pass it to TestFlight. The Checkpoint API is used to help you track exactly how your testers are using your application. Curious about which users passed level 5 in your game, or posted their high score to Twitter, or found that obscure feature? See "Checkpoint API" down below to see how.
The SDK also offers a remote logging solution. Find out more about our logging system in the "Remote Logging" section.
## Requirements
The TestFlight SDK requires iOS 4.3 or above, the Apple LLVM compiler, and the libz library to run.
The AdSupport.framework is required for iOS 6.0+ in order to uniquely identify users so we can estimate the number of users your app has (using `ASIdentifierManager`). You may weak link the framework in you app. If your app does not link with the AdSupport.framework, the TestFlight SDK will automatically load it for apps running on iOS 6.0+.
## Integration
1. Add the files to your project: File -> Add Files to " "
1. Find and select the folder that contains the SDK
2. Make sure that "Copy items into destination folder (if needed)" is checked
3. Set Folders to "Create groups for any added folders"
4. Select all targets that you want to add the SDK to
2. Verify that libTestFlight.a has been added to the Link Binary With Libraries Build Phase for the targets you want to use the SDK with
1. Select your Project in the Project Navigator
2. Select the target you want to enable the SDK for
3. Select the Build Phases tab
4. Open the Link Binary With Libraries Phase
5. If libTestFlight.a is not listed, drag and drop the library from your Project Navigator to the Link Binary With Libraries area
6. Repeat Steps 2 - 5 until all targets you want to use the SDK with have the SDK linked
3. Add libz to your Link Binary With Libraries Build Phase
1. Select your Project in the Project Navigator
2. Select the target you want to enable the SDK for
3. Select the Build Phases tab
4. Open the Link Binary With Libraries Phase
5. Click the + to add a new library
6. Find libz.dylib in the list and add it
7. Repeat Steps 2 - 6 until all targets you want to use the SDK with have libz.dylib
4. Get your App Token
1. If this is a new application, and you have not uploaded it to TestFlight before, first register it here: [https://testflightapp.com/dashboard/applications/create/]().
Otherwise, if you have previously uploaded your app to TestFlight, go to your list of applications ([http://testflightapp.com/dashboard/applications/]()) and click on the application you are using from the list.
2. Click on the "App Token" tab on the left. The App Token for that application will be there.
5. In your Application Delegate:
1. Import TestFlight: `#import "TestFlight.h"`
2. Launch TestFlight with your App Token
In your `-application:didFinishLaunchingWithOptions:` method, call `+[TestFlight takeOff:]` with your App Token.
-(BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// start of your application:didFinishLaunchingWithOptions
[TestFlight takeOff:@"Insert your Application Token here"];
// The rest of your application:didFinishLaunchingWithOptions method
// ...
}
3. To report crashes to you we install our own uncaught exception handler. If you are not currently using an exception handler of your own then all you need to do is go to the next step. If you currently use an Exception Handler, or you use another framework that does please go to the section on advanced exception handling.
## Setting the UDID
For **BETA** apps only: In order for "In App Updates" to work and for user data not to be anonymized, you may provide the device's unique identifier. To send the device identifier call the following method **before** your call to `+[TestFlight takeOff:]` like so:
[TestFlight setDeviceIdentifier:[[UIDevice currentDevice] uniqueIdentifier]];
[TestFlight takeOff:@"Insert your Application Token here"];
Note: `[[UIDevice currentDevice] uniqueIdentifier]` is deprecated, which means it may be removed from iOS in the future and that it should not be used in production apps. We recommend using it **only** in beta apps. If using it makes you feel uncomfortable, you are not required to include it.
**Note on iOS 7 and Xcode 5**: In iOS 7, `uniqueIdentifier` no longer returns the device's UDID, so iOS 7 users will show up anonymously on TestFlight. Also, when building with ARC, Xcode 5 will not allow you to call `uniqueIdentifier` because it has been removed in iOS 7 from `UIDevice`'s header. We are working on a workaround for this issue.
**DO NOT USE THIS IN PRODUCTION APPS**. When it is time to submit to the App Store comment this line out. Apple will probably reject your app if you leave this line in.
## Uploading your build
After you have integrated the SDK into your application you need to upload your build to TestFlight. You can upload your build on our [website](https://testflightapp.com/dashboard/builds/add/), using our [desktop app](https://testflightapp.com/desktop/), or by using our [upload API](https://testflightapp.com/api/doc/).
## Basic Features
### Session Information
View anonymous information about how often users use your app, how long they use it for, and when they use it. You can see what type of device the user is using, which OS, which language, etc.
Sessions automatically start at app launch, app did become active, and app will enter foreground and end at app will resign active, app did enter background, or app will terminate. Sessions that start shortly after an end continue the session instead of starting a new one.
For **beta** users, you can see who the users are if you are **setting the UDID**, they have a TestFlight account, and their device is registered to TestFlight. (See Setting the UDID for more information).
### Crash Reports
The TestFlight SDK automatically reports all crashes (beta and prod) to TestFlight's website where you can view them. Crash reports are sent **at** crash time. TestFlight will also automatically symbolicate all crashes (if you have uploaded your dSYM). For **beta** apps, on the site, you can see which checkpoints the user passed before the crash and see remote logs that were sent before the crash. For **prod** apps, you can see remote logs that were sent before the crash.
### Beta In App Updates
If a user is using a **beta** version of your app, you are **setting the UDID**, a new beta version is available, and that user has permission to install it; an in app popup will ask them if they would like to install the update. If they tap "Install", the new version is installed from inside the app.
NB: For this to work, you must increment your build version before uploading. Otherwise the new and old builds will have the same version number and we won't know if the user needs to update or is already using the new version.
To turn this off set this option before calling `takeOff:`
[TestFlight setOptions:@{ TFOptionDisableInAppUpdates : @YES }];
## Additional Features
### Checkpoints
When a tester does something you care about in your app, you can pass a checkpoint. For example completing a level, adding a todo item, etc. The checkpoint progress is used to provide insight into how your testers are testing your apps. The passed checkpoints are also attached to crashes, which can help when creating steps to replicate. Checkpoints are visible for all beta and prod builds.
[TestFlight passCheckpoint:@"CHECKPOINT_NAME"];
Use `passCheckpoint:` to track when a user performs certain tasks in your application. This can be useful for making sure testers are hitting all parts of your application, as well as tracking which testers are being thorough.
Checkpoints are meant to tell you if a user visited a place in your app or completed a task. They should not be used for debugging purposes. Instead, use Remote Logging for debugging information (more information below).
### Custom Environment Information
In **beta** builds, if you want to see some extra information about your user, you can add some custom environment information. You must add this information before the session starts (a session starts at `takeOff:`) to see it on TestFlight's website. NB: You can only see this information for **beta** users.
[TestFlight addCustomEnvironmentInformation:@"info" forKey:@"key"];
You may call this method as many times as you would like to add more information.
### User Feedback
In **beta** builds, if you collect feedback from your users, you may pass it back to TestFlight which will associate it with the user's current session.
[TestFlight submitFeedback:feedback];
Once users have submitted feedback from inside of the application you can view it in the feedback area of your build page.
### Remote Logging
Remote Logging allows you to see the logs your app prints out remotely, on TestFlight's website. You can see logs for **beta sessions** and **prod sessions with crashes**. NB: you cannot see the logs for all prod sessions.
To use it, simply replace all of your `NSLog` calls with `TFLog` calls. An easy way to do this without rewriting all your `NSLog` calls is to add the following macro to your `.pch` file.
#import "TestFlight.h"
#define NSLog TFLog
Not only will `TFLog` log remotely to TestFlight, it will also log to the console (viewable in a device's logs) and STDERR (shown while debugging) just like NSLog does, providing a complete replacement.
For even better information in your remote logs, such as file name and line number, you can use this macro instead:
#define NSLog(__FORMAT__, ...) TFLog((@"%s [Line %d] " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
Which will produce output that looks like
-[MyAppDelegate application:didFinishLaunchingWithOptions:] [Line 45] Launched!
**Custom Logging**
If you have your own custom logging, call `TFLog` from your custom logging function. If you do not need `TFLog` to log to the console or STDERR because you handle those yourself, you can turn them off with these calls:
[TestFlight setOptions:@{ TFOptionLogToConsole : @NO }];
[TestFlight setOptions:@{ TFOptionLogToSTDERR : @NO }];
## Advanced Notes
### Checkpoint API
When passing a checkpoint, TestFlight logs the checkpoint synchronously (See Remote Logging for more information). If your app has very high performance needs, you can turn the logging off with the `TFOptionLogOnCheckpoint` option.
### Remote Logging
All logging is done synchronously. Every time the SDK logs, it must write data to a file. This is to ensure log integrity at crash time. Without this, we could not trust logs at crash time. If you have a high performance app, please email support@testflightapp.com for more options.
### Advanced Session Control
Continuing sessions: You can adjust the amount of time a user can leave the app for and still continue the same session when they come back by changing the `TFOptionSessionKeepAliveTimeout` option. Change it to 0 to turn the feature off.
Manual Session Control: If your app is a music player that continues to play music in the background, a navigation app that continues to function in the background, or any app where a user is considered to be "using" the app even while the app is not active you should use Manual Session Control. Please only use manual session control if you know exactly what you are doing. There are many pitfalls which can result in bad session duration and counts. See `TestFlight+ManualSessions.h` for more information and instructions.
### Advanced Exception/Signal Handling
An uncaught exception means that your application is in an unknown state and there is not much that you can do but try and exit gracefully. Our SDK does its best to get the data we collect in this situation to you while it is crashing, but it is designed in such a way that the important act of saving the data occurs in as safe way a way as possible before trying to send anything. If you do use uncaught exception or signal handlers, install your handlers before calling `takeOff:`. Our SDK will then call your handler while ours is running. For example:
/*
My Apps Custom uncaught exception catcher, we do special stuff here, and TestFlight takes care of the rest
*/
void HandleExceptions(NSException *exception) {
NSLog(@"This is where we save the application data during a exception");
// Save application data on crash
}
/*
My Apps Custom signal catcher, we do special stuff here, and TestFlight takes care of the rest
*/
void SignalHandler(int sig) {
NSLog(@"This is where we save the application data during a signal");
// Save application data on crash
}
-(BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// installs HandleExceptions as the Uncaught Exception Handler
NSSetUncaughtExceptionHandler(&HandleExceptions);
// create the signal action structure
struct sigaction newSignalAction;
// initialize the signal action structure
memset(&newSignalAction, 0, sizeof(newSignalAction));
// set SignalHandler as the handler in the signal action structure
newSignalAction.sa_handler = &SignalHandler;
// set SignalHandler as the handlers for SIGABRT, SIGILL and SIGBUS
sigaction(SIGABRT, &newSignalAction, NULL);
sigaction(SIGILL, &newSignalAction, NULL);
sigaction(SIGBUS, &newSignalAction, NULL);
// Call takeOff after install your own unhandled exception and signal handlers
[TestFlight takeOff:@"Insert your Application Token here"];
// continue with your application initialization
}
You do not need to add the above code if your application does not use exception handling already.

View File

@@ -0,0 +1,30 @@
//
// TestFlight+AsyncLogging.h
// libTestFlight
//
// Created by Jason Gregori on 2/12/13.
// Copyright (c) 2013 TestFlight. All rights reserved.
//
/*
When logging, it is important that logs are written synchronously. In the event of a crash, all logs that happened before the crash are gauranteed to be on disk. If they were written asynchronously and a crash occurs, you might lose some very valuable logs that might have helped fixed the crash.
However, because TFLog waits until writing to disk is complete, it takes a while. If you have a very high preformance app that can't afford to wait for logs, these functions are for you.
USE THESE, BUT KNOW YOU RISK LOSING SOME LOGS AT CRASH TIME
*/
#import "TestFlight.h"
#if __cplusplus
extern "C" {
#endif
void TFLog_async(NSString *format, ...) __attribute__((format(__NSString__, 1, 2)));
void TFLogv_async(NSString *format, va_list arg_list);
#if __cplusplus
}
#endif

View File

@@ -0,0 +1,58 @@
//
// TestFlight+ManualSessions.h
// libTestFlight
//
// Created by Jason Gregori on 5/16/13.
// Copyright (c) 2013 TestFlight. All rights reserved.
//
/*
YOU ARE STRONGLY ADVISED NOT TO USE THESE METHODS unless you know exactly what you are doing. By using these you take on the responsibility of ensuring your session data is reported accurately.
The way TestFlight normally does sessions is to automatically start them at app launch, app did become active, and app will enter foreground and end them at app will resign active, app did enter background, or app will terminate.
If your app is a music player that continues to play music in the background, a navigation app that continues to function in the background, or any app where a user is considered to be "using" the app even while the app is not active, this file is for you.
Usage
-----
1. Add this file to your project.
2. Set the manual sessions option to true **before** calling `takeOff:`
[TestFlight setOptions:@{ TFOptionManualSessions : @YES }];
3. Use the manually start/end session methods to control you sessions.
Pitfalls
--------
When using manual sessions in the background, you must always be aware of the fact that iOS may suspend your app at any time without any warning. You must end your session before that happens. If you do not, the session will continue and include all the time the app was suspended in it's duration if the app is brought back from suspension. This will lead to very inaccurate session lengths and counts.
On app termination: For the most accurate sessions, try to end your session if you know the app is about to terminate. If you do not, the session will still be ended on the next launch, however, it's end time will not be exact. In that case, the end time will be within 30 seconds of the correct time (session information is saved every 30 seconds and when a checkpoint is sent).
Sessions do not continue across termination if you do not end a session before termination.
On crashes: Do not worry about ending sessions in the event of a crash. Even manual sessions are automatically ended in the event of a crash.
Continuing sessions: If a session is started without 30 seconds of the last session ending (and their was no termination between the sessions), the last session will continue instead of a new session starting. This is the case in manual and automatic sessions. You may change the timeout or turn this feature off using the `TFOptionSessionKeepAliveTimeout` option.
*/
#import "TestFlight.h"
extern NSString *const TFOptionManualSessions; // Defaults to @NO. Set to @YES before calling `takeOff:` in order to use manual session methods.
@interface TestFlight (ManualSessions)
// these methods are thread safe
+ (void)manuallyStartSession;
+ (void)manuallyEndSession;
@end

117
External/TestFlight/TestFlight.h vendored Normal file
View File

@@ -0,0 +1,117 @@
//
// TestFlight.h
// libTestFlight
//
// Created by Jonathan Janzen on 06/11/11.
// Copyright 2011 TestFlight. All rights reserved.
#import <Foundation/Foundation.h>
#define TESTFLIGHT_SDK_VERSION @"2.0.0"
#undef TFLog
#if __cplusplus
extern "C" {
#endif
/*
* Remote Logging
* Note: All Logging is synchronous, see the README for more information.
*/
void TFLog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2)));
void TFLogv(NSString *format, va_list arg_list);
void TFLogPreFormatted(NSString *message);
#if __cplusplus
}
#endif
/**
* TestFlight object
* All methods are class level
*/
@interface TestFlight : NSObject
/**
* Add custom environment information
* If you want to track custom information such as a user name from your application you can add it here.
* NB: This information must be added before the session starts, it is recorded only on session start.
*
* @param information A string containing the environment you are storing
* @param key The key to store the information with
*/
+ (void)addCustomEnvironmentInformation:(NSString *)information forKey:(NSString*)key;
/**
* Starts a TestFlight session using the Application Token for this Application
*
* @param applicationToken Will be the application token for the current application.
* The token for this application can be retrieved by going to https://testflightapp.com/dashboard/applications/
* selecting this application from the list then selecting SDK.
*/
+ (void)takeOff:(NSString *)applicationToken;
/**
* Sets custom options
*
* @param options NSDictionary containing the options you want to set. Available options are described below at "TestFlight Option Keys"
*
*/
+ (void)setOptions:(NSDictionary*)options;
/**
* Track when a user has passed a checkpoint after the flight has taken off. Eg. passed level 1, posted high score.
* Checkpoints are sent in the background.
* Note: The checkpoint is logged synchronously (See TFLog and TFOptionLogOnCheckpoint for more information).
*
* @param checkpointName The name of the checkpoint, this should be a static string
*/
+ (void)passCheckpoint:(NSString *)checkpointName;
/**
* Submits custom feedback to the site. Sends the data in feedback to the site. This is to be used as the method to submit
* feedback from custom feedback forms.
*
* @param feedback Your users feedback, method does nothing if feedback is nil
*/
+ (void)submitFeedback:(NSString*)feedback;
/**
* Sets the Device Identifier.
*
* !! DO NOT CALL IN SUBMITTED APP STORE APP.
*
* !! MUST BE CALLED BEFORE +takeOff:
*
* This method should only be used during testing so that you can identify a testers test data with them.
* If you do not provide the identifier you will still see all session data, with checkpoints
* and logs, but the data will be anonymized.
*
* It is recommended that you only use this method during testing.
* Apple may reject your app if left in a submitted app.
*
* Use:
* Only use this with the Apple device UDID. DO NOT use Open ID or your own identifier.
* [TestFlight setDeviceIdentifier:[[UIDevice currentDevice] uniqueIdentifier]];
*
* @param deviceIdentifer The current devices device identifier
*/
+ (void)setDeviceIdentifier:(NSString*)deviceIdentifer;
@end
/**
* TestFlight Option Keys
*
* Pass these as keys to the dictionary you pass to +`[TestFlight setOptions:]`.
* The values should be NSNumber BOOLs (`[NSNumber numberWithBool:YES]` or `@YES`)
*/
extern NSString *const TFOptionDisableInAppUpdates; // Defaults to @NO. Setting to @YES, disables the in app update screen shown in BETA apps when there is a new version available on TestFlight.
extern NSString *const TFOptionFlushSecondsInterval; // Defaults to @60. Set to a number. @0 turns off the flush timer. 30 seconds is the minimum flush interval.
extern NSString *const TFOptionLogOnCheckpoint; // Defaults to @YES. Because logging is synchronous, if you have a high preformance app, you might want to turn this off.
extern NSString *const TFOptionLogToConsole; // Defaults to @YES. Prints remote logs to Apple System Log.
extern NSString *const TFOptionLogToSTDERR; // Defaults to @YES. Sends remote logs to STDERR when debugger is attached.
extern NSString *const TFOptionReinstallCrashHandlers; // If set to @YES: Reinstalls crash handlers, to be used if a third party library installs crash handlers overtop of the TestFlight Crash Handlers.
extern NSString *const TFOptionReportCrashes; // Defaults to @YES. If set to @NO, crash handlers are never installed. Must be set **before** calling `takeOff:`.
extern NSString *const TFOptionSendLogOnlyOnCrash; // Defaults to @NO. Setting to @YES stops remote logs from being sent when sessions end. They would only be sent in the event of a crash.
extern NSString *const TFOptionSessionKeepAliveTimeout; // Defaults to @30. This is the amount of time a user can leave the app for and still continue the same session when they come back. If they are away from the app for longer, a new session is created when they come back. Must be a number. Change to @0 to turn off.

BIN
External/TestFlight/libTestFlight.a vendored Normal file

Binary file not shown.

273
External/TestFlight/release_notes.md vendored Normal file
View File

@@ -0,0 +1,273 @@
## 2.0
Improvements
- ARC
- All public TestFlight methods may be called from any thread or dispatch_queue
- All public TestFlight methods (except for `TFLog` and `takeOff:`) are asynchronous, so there is never a wait on them
- TestFlight never uses more than 1 network connection at a time
- All network traffic is grouped together, sent at once, and transferred in MessagePack. This results in using less bandwidth and less network calls.
- All network traffic if server is not reachable
- Size of SDK reduced by 70%
- New In App Update UI in an alert with landscape support. Should work for all different types of apps.
- Manual Sessions: You can manually control session start and end. See `TestFlight+ManualSessions.h` for more information
- Combining of back to back sessions. If a session starts less than 30 seconds from the last session which ended, the previous session is continued. You may change the time limit (or turn this off) using the `TFOptionSessionKeepAliveTimeout` option key.
- No longer automatically starts a session on `+takeOff:` in order to support new background modes that might launch an app in the background.
- `TFOptionReportCrashes` option to not install crash handlers
- Remove all calls to `dispatch_get_current_queue`, it is deprecated
Changes
- Removed all access to mac address
- Added AdSupport.framework requirement (as a replacement for mac address to get accurate user counts)
- Add format attribute to TFLog to show warnings for wrong format specifiers or not using a format string
- Removed Questions
- Removed Feedback View (along with backtrace option)
Bug Fixes
- Fixed addrinfo memory leak
- Fixed possible `-[TFAirTrafficController getNumberOrNilFrom:withKey:]` crash when bad data is received.
- CoreTelephony crash work around: this is a workaround of a iOS bug that causes deallocated instances of `CTTelephonyNetworkInfo` to receive notifications which causes crashes. Core Telephony is used to retrieve the device's mobile carrier.
- Fix bug with crash reporting in iOS 7
## 1.2.4 - February 19, 2013
- Fixed bug that caused crash reports to sometimes not send immediately (they would be resent later)
## 1.2.3 - January 8, 2013
- Fixed typos in readme
- Fixed bug where logs not sent on crash
- Fixed bug where empty crash files were created (but not sent)
- Cache path to TF's directory so it does not need to be regenerated every time
- Use consts for `setOptions:`
- Updated `setDeviceIdentifier:` comments to make them clearer
- Remove potentially conflicting function name `UIColorFromRGB`
- Fixed crash on bad in app update data
## 1.2.2 - December 26, 2012
- Fix typo in app token error message
## 1.2.1 - December 26, 2012
- The max number of concurrent network connections has been reduced from 4 to 2.
##1.2 - November 12, 2012
* Removed Team Token support. As of version 1.2 takeOff must be called with the Application Token, https://testflightapp.com/dashboard/applications/, choose your application, select SDK, get the Token for this Application.
##1.2 BETA 3 - October 11, 2012
* Added application token support. Application Tokens are currently optional if you do not have one you do not need one
##1.2 BETA 2 - October 9, 2012
* Resolved an instance of close_file being called on a bad file descriptor
##1.2 BETA 1 - October 1, 2012
* Removed support for armv6
* Exception handler now returns instead of raising a SIGTRAP
##1.1 - September 13, 2012
* armv7s and iOS 6 support
* Updated for general release
##1.1 BETA 3 - September 12, 2012
* armv7s slice added to library
* fixed typo for in application updates, inAppUdates changed to inAppUpdates
##1.1 BETA 2 - September 6, 2012
* Re-enabled armv6 support
* Added option to disable in application updates
##1.1 BETA 1 - July 13, 2012
* Added TFLogv to allow for log customizations. Check the README or online docs for more information.
* Added option attachBacktraceToFeedback, which attaches a backtrace to feedback sent from the SDK. For users who use feedback in more than one location in the application.
* Resolved issue where other exception handlers would not be called during an exception.
* SDK now sends the device language for a session.
* Documentation fixes.
* Stability fixes.
###1.0 - March 29, 2012
* Resolved occurrences of exceptions with the message "No background task exists with identifier 0"
###1.0 BETA 1 - March 23, 2012
* Privacy Updates
* UDID is no longer collected by the SDK. During testing please use `[TestFlight setDeviceIdentifier:[[UIDevice currentDevice] uniqueIdentifier]];` to send the UDID so you can identify your testers. For release do not set `+setDeviceIdentifier`. See Beta Testing and Release Differentiation in the README or online at [https://testflightapp.com/sdk/doc/1.0beta1/](http://testflightapp.com/sdk/doc/1.0beta1/)
###0.8.3 - February 14, 2012
* Rolled previous beta code into release builds
* No longer allow in application updates to occur in applications that were obtained from the app store.
**Tested compiled library with:**
* Xcode 4.3
* Xcode 4.2
* Xcode 4.1
* Xcode 3.2.6
###0.8.3 BETA 5 - February 10, 2012
* Changed logging from asynchronous to synchronous.
* Resolved crash when looking for a log path failed.
* Added submitFeedback to the TestFlight class to allow for custom feedback forms.
###0.8.3 BETA 4 - January 20, 2012
* Resolved an issue that occured when an application was upgraded from 0.8.3 BETA 1 to 0.8.3 BETA 3+ with unsent data from 0.8.3 BETA 1
###0.8.3 BETA 3 - January 19, 2012
* On crash log files over 64k will not be sent until next launch.
**Known Issues:**
* Logging massive amounts of data at the end of a session may prevent the application from launching in time on next launch
###0.8.3 BETA 2 - January 13, 2012
* libz.dylib is now required to be added to your "Link Binary with Libraries" build phase
* Log file compression, The compression is done on an as needed basis rather than before sending
* Changed all outgoing data from JSON to MessagePack
* Added option `logToSTDERR` to disable the `STDERR` logger
###0.8.3 BETA 1 - December 29, 2011
* In rare occurrences old session data that had not been sent to our server may have been discarded or attached to the wrong build. It is now no longer discarded
* Made sending of Session End events more robust
* Network queuing system does better bursting of unsent data
* Log files that are larger than 64K are now sent sometime after the next launch
* Log files that are larger than 16MB are no longer supported and will be replaced with a message indicating the log file was too large
* Fixed crashes while resuming from background
###0.8.2 - December 20, 2011
* Promoted 0.8.2 BETA 4 to stable
**Known Issues:**
* Under some circumstances Session End events may not be sent until the next launch.
* With large log files Session End events may take a long time to show up.
**Tested compiled library with:**
* Xcode 4.3
* Xcode 4.2
* Xcode 4.1
* Xcode 3.2.6
###0.8.2 BETA 4 - December 12, 2011
* Prevented "The string argument is NULL" from occuring during finishedHandshake in rare cases
* Resolved issue where data recorded while offline may not be sent
###0.8.2 BETA 3 - December 8, 2011
* Added auto-release pools to background setup and tear down
###0.8.2 BETA 2 - December 5, 2011
* Fixed the "pointer being freed was not allocated" bug
###0.8.1 - November 18, 2011
* Implemented TFLog logging system, see README for more information
* Fixed an issue where Session End events may not be sent until next launch
* Fixed an issue where duplicate events could be sent
* Fixed an issue with Session End events not being sent from some iPod touch models
**Tested compiled library with:**
* Xcode 4.2
* Xcode 4.1
* Xcode 3.2.6
###0.8 - November 8, 2011
* Added `SIGTRAP` as a signal type that we catch
* Removed all Objective-c from crash reporting
* Removed the use of non signal safe functions from signal handling
* Created a signal safe way to get symbols from a stack trace
* Changed the keyboardType for Long Answer Questions and Feedback to allow for international character input
* Changed `TESTFLIGHT_SDK_VERSION` string to be an `NSString`
* Changed cache folder from Library/Caches/TestFlight to Library/Caches/com.testflight.testflightsdk
* Fixed issue with saving data when device is offline
* Fixed compability issues with iOS 3
* Added calling into the rootViewController shouldAutorotateToInterfaceOrientation if a rootViewController is set
* Made the comments in TestFlight.h compatible with Appledoc
Tested compiled library with:
* Xcode 4.2
* Xcode 4.1
* Xcode 3.2
###0.7.2 - September 29, 2011
* Changed `TESTFLIGHT_SDK_VERSION` string to be an `NSString`
* Fixed an issue where exiting an application while the SDK is active caused modal views to be dismissed
###0.7.1 - September 22, 2011
* Internal release
* Refactoring
###0.7 - September 21, 2011
* Moved TestFlight images and data to the Library/Caches folder
* Resolved an issue where sometimes the rootViewController could not be found and feedback, questions and upgrade views would not be displayed
* In application upgrade changed to allow skipping until the next version is installed and allows upgrades to be forced
* Fixed a memory leak when launching questions
###0.6 - September 2, 2011
* Renamed base64_encode to testflight_base64_encode to remove a conflict with other third party libraries
* Added ability to reinstall crash handlers when they are overwritten using the setOptions API
* Fixed an issue where crash reports might not get sent under certain circumstances
* Fixed a deadlock when the application is put in the background and then resumed before all information can be sent
* Fixed an issue when attempting to un-install all signal handlers during a signal
* Added support for landscape mode on the iPad to the Questions and Feedback views
* Crash reporting now works in versions of Xcode earlier than 4.2
* Fixed a memory leak during handshake
###0.5 - August 19, 2011
* Feedback that is not attached to a checkpoint [TestFlight openFeedbackView]
* Usability changes to question views
* Removed pause and resume sessions, replaced with sessions being stopped and started
* Added text auto correction to the Long Answer question type
* Crash reports now send on crash instead of next launch
###0.4 - August 15, 2011
* In Application Feedback with Questions
* In application updates
* Custom Environment Information added
* Networking stack reimplementation
* Exception handling fixes
###0.3 - June 15, 2011
* Removed all mention of JSONKit from the README
* Added support for using both the Bundle Version and the Bundle Short Version string
###0.2 - June 14, 2011
* Removed all categories this allows users to use the SDK without having to set -ObjC and -load_all
* Prefixed JSONKit for use in TestFlight to remove reported issues where some users were already using JSONKit
* Added support for armv6 again
###0.1 - June 11, 2011
* Initial Version

20
External/google-plus-ios-sdk/Changelog vendored Normal file
View File

@@ -0,0 +1,20 @@
2013-05-07 -- v1.3.0
- Packaged as framework
- Bug fixes
2013-02-26 -- v1.2.1
- Interactive posts on Google+ share
- Improved sign-in and share APIs to use shared instances
- Automatic retrieval of user identity upon sign-in
- Expanded Google+ moments API support
- Updated sample app
2012-10-12 -- v1.1.0
- Content deep linking on Google+ share
- iOS6 support
- Shortened class names
- Bug fixes
2012-06-25 -- v1.0.0
- Google+ sign-in button, share plugin, and Google+ history integration library
with sample app.

View File

@@ -0,0 +1 @@
Versions/Current/GoogleOpenSource

View File

@@ -0,0 +1 @@
Versions/Current/Headers

View File

@@ -0,0 +1,25 @@
/* Copyright (c) 2012 Google Inc.
*
* 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.
*/
#import <Foundation/Foundation.h>
NSData *GTLDecodeBase64(NSString *base64Str);
NSString *GTLEncodeBase64(NSData *data);
// "Web-safe" encoding substitutes - and _ for + and / in the encoding table,
// per http://www.ietf.org/rfc/rfc4648.txt section 5.
NSData *GTLDecodeWebSafeBase64(NSString *base64Str);
NSString *GTLEncodeWebSafeBase64(NSData *data);

View File

@@ -0,0 +1,57 @@
/* Copyright (c) 2011 Google Inc.
*
* 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.
*/
//
// GTLBatchQuery.h
//
// Batch query documentation:
// https://code.google.com/p/google-api-objectivec-client/wiki/Introduction#Batch_Operations
#import "GTLQuery.h"
@interface GTLBatchQuery : NSObject <GTLQueryProtocol> {
@private
NSMutableArray *queries_;
NSMutableDictionary *requestIDMap_;
BOOL skipAuthorization_;
NSDictionary *additionalHTTPHeaders_;
NSDictionary *urlQueryParameters_;
}
// Queries included in this batch. Each query should have a unique requestID.
@property (retain) NSArray *queries;
// Clients may set this to YES to disallow authorization. Defaults to NO.
@property (assign) BOOL shouldSkipAuthorization;
// Any additional HTTP headers for this batch.
//
// These headers override the same keys from the service object's
// additionalHTTPHeaders.
@property (copy) NSDictionary *additionalHTTPHeaders;
// Any URL query parameters to add to the query (useful for debugging with some
// services).
@property (copy) NSDictionary *urlQueryParameters;
+ (id)batchQuery;
+ (id)batchQueryWithQueries:(NSArray *)array;
- (void)addQuery:(GTLQuery *)query GTL_NONNULL((1));
- (GTLQuery *)queryForRequestID:(NSString *)requestID GTL_NONNULL((1));
@end

View File

@@ -0,0 +1,58 @@
/* Copyright (c) 2011 Google Inc.
*
* 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.
*/
//
// GTLBatchResult.h
//
#import "GTLObject.h"
@interface GTLBatchResult : GTLObject <GTLBatchItemCreationProtocol> {
@private
NSMutableDictionary *successes_;
NSMutableDictionary *failures_;
}
// Dictionaries of results for all queries in the batch
//
// Dictionary keys are requestID strings; objects are results or
// GTLErrorObjects.
//
// For successes with no returned object (such as from delete operations),
// the object for the dictionary entry is NSNull.
//
//
// The original query for each result is available from the service ticket,
// for example
//
// NSDictionary *successes = batchResults.successes;
// for (NSString *requestID in successes) {
// GTLObject *obj = [successes objectForKey:requestID];
// GTLQuery *query = [ticket queryForRequestID:requestID];
// NSLog(@"Query %@ returned object %@", query, obj);
// }
//
// NSDictionary *failures = batchResults.failures;
// for (NSString *requestID in failures) {
// GTLErrorObject *errorObj = [failures objectForKey:requestID];
// GTLQuery *query = [ticket queryForRequestID:requestID];
// NSLog(@"Query %@ failed with error %@", query, errorObj);
// }
//
@property (retain) NSMutableDictionary *successes;
@property (retain) NSMutableDictionary *failures;
@end

View File

@@ -0,0 +1,60 @@
/* Copyright (c) 2011 Google Inc.
*
* 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.
*/
//
// GTLDateTime.h
//
// This is an immutable class representing a date and optionally a
// time with time zone.
//
#import <Foundation/Foundation.h>
#import "GTLDefines.h"
@interface GTLDateTime : NSObject <NSCopying> {
NSDateComponents *dateComponents_;
NSInteger milliseconds_; // This is only for the fraction of a second 0-999
NSInteger offsetSeconds_; // may be NSUndefinedDateComponent
BOOL isUniversalTime_; // preserves "Z"
NSTimeZone *timeZone_; // specific time zone by name, if known
}
+ (GTLDateTime *)dateTimeWithRFC3339String:(NSString *)str;
// timeZone may be nil if the time zone is not known.
+ (GTLDateTime *)dateTimeWithDate:(NSDate *)date timeZone:(NSTimeZone *)tz;
// Use this method to make a dateTime for an all-day event (date only, so
// hasTime is NO.)
+ (GTLDateTime *)dateTimeForAllDayWithDate:(NSDate *)date;
+ (GTLDateTime *)dateTimeWithDateComponents:(NSDateComponents *)date;
@property (nonatomic, readonly) NSDate *date;
@property (nonatomic, readonly) NSCalendar *calendar;
@property (nonatomic, readonly) NSString *RFC3339String;
@property (nonatomic, readonly) NSString *stringValue; // same as RFC3339String
@property (nonatomic, readonly, retain) NSTimeZone *timeZone;
@property (nonatomic, readonly, copy) NSDateComponents *dateComponents;
@property (nonatomic, readonly) NSInteger milliseconds; // This is only for the fraction of a second 0-999
@property (nonatomic, readonly) BOOL hasTime;
@property (nonatomic, readonly) NSInteger offsetSeconds;
@property (nonatomic, readonly, getter=isUniversalTime) BOOL universalTime;
@end

View File

@@ -0,0 +1,144 @@
/* Copyright (c) 2011 Google Inc.
*
* 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.
*/
//
// GTLDefines.h
//
// Ensure Apple's conditionals we depend on are defined.
#import <TargetConditionals.h>
#import <AvailabilityMacros.h>
//
// The developer may choose to define these in the project:
//
// #define GTL_TARGET_NAMESPACE Xxx // preface all GTL class names with Xxx (recommended for building plug-ins)
// #define GTL_FOUNDATION_ONLY 1 // builds without AppKit or Carbon (default for iPhone builds)
// #define STRIP_GTM_FETCH_LOGGING 1 // omit http logging code (default for iPhone release builds)
//
// Mac developers may find GTL_SIMPLE_DESCRIPTIONS and STRIP_GTM_FETCH_LOGGING useful for
// reducing code size.
//
// Define later OS versions when building on earlier versions
#ifdef MAC_OS_X_VERSION_10_0
#ifndef MAC_OS_X_VERSION_10_6
#define MAC_OS_X_VERSION_10_6 1060
#endif
#endif
#ifdef GTL_TARGET_NAMESPACE
// prefix all GTL class names with GTL_TARGET_NAMESPACE for this target
#import "GTLTargetNamespace.h"
#endif
// Provide a common definition for externing constants/functions
#if defined(__cplusplus)
#define GTL_EXTERN extern "C"
#else
#define GTL_EXTERN extern
#endif
#if TARGET_OS_IPHONE // iPhone SDK
#define GTL_IPHONE 1
#endif
#if GTL_IPHONE
#define GTL_FOUNDATION_ONLY 1
#endif
//
// GTL_ASSERT is like NSAssert, but takes a variable number of arguments:
//
// GTL_ASSERT(condition, @"Problem in argument %@", argStr);
//
// GTL_DEBUG_ASSERT is similar, but compiles in only for debug builds
//
#ifndef GTL_ASSERT
// we directly invoke the NSAssert handler so we can pass on the varargs
#if !defined(NS_BLOCK_ASSERTIONS)
#define GTL_ASSERT(condition, ...) \
do { \
if (!(condition)) { \
[[NSAssertionHandler currentHandler] \
handleFailureInFunction:[NSString stringWithUTF8String:__PRETTY_FUNCTION__] \
file:[NSString stringWithUTF8String:__FILE__] \
lineNumber:__LINE__ \
description:__VA_ARGS__]; \
} \
} while(0)
#else
#define GTL_ASSERT(condition, ...) do { } while (0)
#endif // !defined(NS_BLOCK_ASSERTIONS)
#endif // GTL_ASSERT
#ifndef GTL_DEBUG_ASSERT
#if DEBUG
#define GTL_DEBUG_ASSERT(condition, ...) GTL_ASSERT(condition, __VA_ARGS__)
#else
#define GTL_DEBUG_ASSERT(condition, ...) do { } while (0)
#endif
#endif
#ifndef GTL_DEBUG_LOG
#if DEBUG
#define GTL_DEBUG_LOG(...) NSLog(__VA_ARGS__)
#else
#define GTL_DEBUG_LOG(...) do { } while (0)
#endif
#endif
#ifndef STRIP_GTM_FETCH_LOGGING
#if GTL_IPHONE && !DEBUG
#define STRIP_GTM_FETCH_LOGGING 1
#else
#define STRIP_GTM_FETCH_LOGGING 0
#endif
#endif
// Some support for advanced clang static analysis functionality
// See http://clang-analyzer.llvm.org/annotations.html
#ifndef __has_feature // Optional.
#define __has_feature(x) 0 // Compatibility with non-clang compilers.
#endif
#ifndef NS_RETURNS_NOT_RETAINED
#if __has_feature(attribute_ns_returns_not_retained)
#define NS_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained))
#else
#define NS_RETURNS_NOT_RETAINED
#endif
#endif
#ifndef __has_attribute
#define __has_attribute(x) 0
#endif
#if 1
// We will start using nonnull declarations once the static analyzer seems
// to support it without false positives.
#define GTL_NONNULL(x)
#else
#if __has_attribute(nonnull)
#define GTL_NONNULL(x) __attribute__((nonnull x))
#else
#define GTL_NONNULL(x)
#endif
#endif

View File

@@ -0,0 +1,45 @@
/* Copyright (c) 2011 Google Inc.
*
* 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.
*/
//
// GTLErrorObject.h
//
#import "GTLObject.h"
@class GTLErrorObjectData;
@interface GTLErrorObject : GTLObject
@property (retain) NSNumber *code;
@property (retain) NSString *message;
@property (retain) NSArray *data; // of GTLErrorObjectData
// Convenience accessor for creating an NSError from a GTLErrorObject.
@property (readonly) NSError *foundationError;
// Convenience accessor for extracting the GTLErrorObject that was used to
// create an NSError.
//
// Returns nil if the error was not originally from a GTLErrorObject.
+ (GTLErrorObject *)underlyingObjectForError:(NSError *)foundationError;
@end
@interface GTLErrorObjectData : GTLObject
@property (retain) NSString *domain;
@property (retain) NSString *reason;
@property (retain) NSString *message;
@property (retain) NSString *location;
@end

View File

@@ -0,0 +1,35 @@
/* Copyright (c) 2011 Google Inc.
*
* 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.
*/
#ifndef _GTLFRAMEWORK_H_
#define _GTLFRAMEWORK_H_
#import <Foundation/Foundation.h>
#import "GTLDefines.h"
// Returns the version of the framework. Major and minor should
// match the bundle version in the Info.plist file.
//
// Pass NULL to ignore any of the parameters.
void GTLFrameworkVersion(NSUInteger* major, NSUInteger* minor, NSUInteger* release);
// Returns the version in @"a.b" or @"a.b.c" format
NSString *GTLFrameworkVersionString(void);
#endif

View File

@@ -0,0 +1,41 @@
/* Copyright (c) 2011 Google Inc.
*
* 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.
*/
//
// GTLJSONParser.h
//
// This class is a thin wrapper around the JSON parser. It uses
// NSJSONSerialization when available, and SBJSON otherwise.
#import <Foundation/Foundation.h>
#import "GTLDefines.h"
@interface GTLJSONParser : NSObject
+ (NSString*)stringWithObject:(id)value
humanReadable:(BOOL)humanReadable
error:(NSError**)error;
+ (NSData *)dataWithObject:(id)obj
humanReadable:(BOOL)humanReadable
error:(NSError**)error;
+ (id)objectWithString:(NSString *)jsonStr
error:(NSError **)error;
+ (id)objectWithData:(NSData *)jsonData
error:(NSError **)error;
@end

View File

@@ -0,0 +1,208 @@
/* Copyright (c) 2011 Google Inc.
*
* 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.
*/
//
// GTLObject.h
//
// GTLObject documentation:
// https://code.google.com/p/google-api-objectivec-client/wiki/Introduction#Objects_and_Queries
#import <Foundation/Foundation.h>
#import "GTLDefines.h"
#import "GTLUtilities.h"
#import "GTLDateTime.h"
#undef _EXTERN
#undef _INITIALIZE_AS
#ifdef GTLOBJECT_DEFINE_GLOBALS
#define _EXTERN
#define _INITIALIZE_AS(x) =x
#else
#define _EXTERN extern
#define _INITIALIZE_AS(x)
#endif
@protocol GTLCollectionProtocol
@optional
@property (retain) NSArray *items;
@end
@protocol GTLBatchItemCreationProtocol
- (void)createItemsWithClassMap:(NSDictionary *)batchClassMap;
@end
@interface GTLObject : NSObject <NSCopying> {
@private
NSMutableDictionary *json_;
// Used when creating the subobjects from this one.
NSDictionary *surrogates_;
// Any complex object hung off this object goes into the cache so the
// next fetch will get the same object back instead of having to recreate
// it.
NSMutableDictionary *childCache_;
// Anything defined by the client; retained but not used internally; not
// copied by copyWithZone:
NSMutableDictionary *userProperties_;
}
@property (nonatomic, retain) NSMutableDictionary *JSON;
@property (nonatomic, retain) NSDictionary *surrogates;
@property (nonatomic, retain) NSMutableDictionary *userProperties;
///////////////////////////////////////////////////////////////////////////////
//
// Public methods
//
// These methods are intended for users of the library
//
+ (id)object;
+ (id)objectWithJSON:(NSMutableDictionary *)dict;
- (id)copyWithZone:(NSZone *)zone;
- (NSString *)JSONString;
// generic access to json; also creates it if necessary
- (void)setJSONValue:(id)obj forKey:(NSString *)key GTL_NONNULL((2));
- (id)JSONValueForKey:(NSString *)key;
// Returns the list of keys in this object's JSON that aren't listed as
// properties on the object.
- (NSArray *)additionalJSONKeys;
// Any keys in the JSON that aren't listed as @properties on the object
// are counted as "additional properties". These allow you to get/set them.
- (id)additionalPropertyForName:(NSString *)name;
- (void)setAdditionalProperty:(id)obj forName:(NSString *)name GTL_NONNULL((2));
- (NSDictionary *)additionalProperties;
// User properties are supported for client convenience, but are not copied by
// copyWithZone. User Properties keys beginning with _ are reserved by the library.
//
// Set nil for obj to remove the property.
- (void)setProperty:(id)obj forKey:(NSString *)key GTL_NONNULL((2));
- (id)propertyForKey:(NSString *)key GTL_NONNULL((1));
// userData is stored as a property with key "_userData"
- (void)setUserData:(id)obj;
- (id)userData;
// Makes a partial query-compatible string describing the fields present
// in this object. (Note: only the first element of any array is examined.)
//
// http://code.google.com/apis/tasks/v1/performance.html#partial
//
- (NSString *)fieldsDescription;
// Makes an object containing only the changes needed to do a partial update
// (patch), where the patch would be to change an object from the original
// to the receiver, such as
//
// GTLSomeObject *patchObject = [newVersion patchObjectFromOriginal:oldVersion];
//
// http://code.google.com/apis/tasks/v1/performance.html#patch
//
// NOTE: this method returns nil if there are no changes between the original
// and the receiver.
- (id)patchObjectFromOriginal:(GTLObject *)original;
// Method creating a null value to set object properties for patch queries that
// delete fields. Do not use this except when setting an object property for
// a patch query.
+ (id)nullValue;
///////////////////////////////////////////////////////////////////////////////
//
// Protected methods
//
// These methods are intended for subclasses of GTLObject
//
// class registration ("kind" strings) for subclasses
+ (Class)registeredObjectClassForKind:(NSString *)kind;
+ (void)registerObjectClassForKind:(NSString *)kind;
// creation of objects from a JSON dictionary
+ (GTLObject *)objectForJSON:(NSMutableDictionary *)json
defaultClass:(Class)defaultClass
surrogates:(NSDictionary *)surrogates
batchClassMap:(NSDictionary *)batchClassMap;
// property-to-key mapping (for JSON keys which are not used as method names)
+ (NSDictionary *)propertyToJSONKeyMap;
// property-to-Class mapping for array properties (to say what is in the array)
+ (NSDictionary *)arrayPropertyToClassMap;
// The default class for additional JSON keys
+ (Class)classForAdditionalProperties;
@end
// Collection objects with an "items" property should derive from GTLCollection
// object. This provides support for fast object enumeration, the
// itemAtIndex: convenience method, and indexed subscripts.
//
// Subclasses must implement the items method dynamically.
@interface GTLCollectionObject : GTLObject <GTLCollectionProtocol, NSFastEnumeration> {
@private
NSDictionary *identifierMap_;
}
// itemAtIndex: and objectAtIndexedSubscript: return nil when the index exceeds
// the bounds of the items array.
- (id)itemAtIndex:(NSUInteger)idx;
- (id)objectAtIndexedSubscript:(NSInteger)idx;
// itemForIdentifier: looks up items from the collection object by identifier,
// and returns the first one.
//
// Typically, items will have a unique identifier (with key "id" in the
// object's JSON). This method returns the first item found in the collection
// with the specified identifier.
//
// The first time this method is used, the collection will cache a map of
// identifiers to items. If the items list for the instance somehow changes,
// use the reset method below to force a new cache to be created for this
// collection.
- (id)itemForIdentifier:(NSString *)key GTL_NONNULL((1));
// Identifiers for all items are cached when the first one is obtained.
// This method resets the cache. It is needed only if the item list has
// changed.
- (void)resetIdentifierMap;
@end
@interface GTLCollectionObject (DynamicMethods)
- (NSArray *)items;
@end
// Base object use for when an service method directly returns an array instead
// of an object. Normally methods should return an object with an 'items'
// property, but this exists for the methods not up to spec.
@interface GTLResultArray : GTLCollectionObject
// This method should only be called by subclasses.
- (NSArray *)itemsWithItemClass:(Class)itemClass;
@end

View File

@@ -0,0 +1,44 @@
/* Copyright (c) 2013 Google Inc.
*
* 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.
*/
//
// GTLPlus.h
//
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/api/
#import "GTLPlusConstants.h"
#import "GTLPlusAcl.h"
#import "GTLPlusAclentryResource.h"
#import "GTLPlusActivity.h"
#import "GTLPlusActivityFeed.h"
#import "GTLPlusComment.h"
#import "GTLPlusCommentFeed.h"
#import "GTLPlusItemScope.h"
#import "GTLPlusMoment.h"
#import "GTLPlusMomentsFeed.h"
#import "GTLPlusPeopleFeed.h"
#import "GTLPlusPerson.h"
#import "GTLQueryPlus.h"
#import "GTLServicePlus.h"

View File

@@ -0,0 +1,60 @@
/* Copyright (c) 2013 Google Inc.
*
* 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.
*/
//
// GTLPlusAcl.h
//
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/api/
// Classes:
// GTLPlusAcl (0 custom class methods, 3 custom properties)
#if GTL_BUILT_AS_FRAMEWORK
#import "GTL/GTLObject.h"
#else
#import "GTLObject.h"
#endif
@class GTLPlusAclentryResource;
// ----------------------------------------------------------------------------
//
// GTLPlusAcl
//
// This class supports NSFastEnumeration over its "items" property. It also
// supports -itemAtIndex: to retrieve individual objects from "items".
@interface GTLPlusAcl : GTLCollectionObject
// Description of the access granted, suitable for display.
// Remapped to 'descriptionProperty' to avoid NSObject's 'description'.
@property (copy) NSString *descriptionProperty;
// The list of access entries.
@property (retain) NSArray *items; // of GTLPlusAclentryResource
// Identifies this resource as a collection of access controls. Value:
// "plus#acl".
@property (copy) NSString *kind;
@end

View File

@@ -0,0 +1,61 @@
/* Copyright (c) 2013 Google Inc.
*
* 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.
*/
//
// GTLPlusAclentryResource.h
//
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/api/
// Classes:
// GTLPlusAclentryResource (0 custom class methods, 3 custom properties)
#if GTL_BUILT_AS_FRAMEWORK
#import "GTL/GTLObject.h"
#else
#import "GTLObject.h"
#endif
// ----------------------------------------------------------------------------
//
// GTLPlusAclentryResource
//
@interface GTLPlusAclentryResource : GTLObject
// A descriptive name for this entry. Suitable for display.
@property (copy) NSString *displayName;
// The ID of the entry. For entries of type "person" or "circle", this is the ID
// of the resource. For other types, this property is not set.
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
@property (copy) NSString *identifier;
// The type of entry describing to whom access is granted. Possible values are:
// - "person" - Access to an individual.
// - "circle" - Access to members of a circle.
// - "myCircles" - Access to members of all the person's circles.
// - "extendedCircles" - Access to members of everyone in a person's circles,
// plus all of the people in their circles.
// - "public" - Access to anyone on the web.
@property (copy) NSString *type;
@end

View File

@@ -0,0 +1,493 @@
/* Copyright (c) 2013 Google Inc.
*
* 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.
*/
//
// GTLPlusActivity.h
//
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/api/
// Classes:
// GTLPlusActivity (0 custom class methods, 19 custom properties)
// GTLPlusActivityActor (0 custom class methods, 5 custom properties)
// GTLPlusActivityObject (0 custom class methods, 10 custom properties)
// GTLPlusActivityProvider (0 custom class methods, 1 custom properties)
// GTLPlusActivityActorImage (0 custom class methods, 1 custom properties)
// GTLPlusActivityActorName (0 custom class methods, 2 custom properties)
// GTLPlusActivityObjectActor (0 custom class methods, 4 custom properties)
// GTLPlusActivityObjectAttachmentsItem (0 custom class methods, 9 custom properties)
// GTLPlusActivityObjectPlusoners (0 custom class methods, 2 custom properties)
// GTLPlusActivityObjectReplies (0 custom class methods, 2 custom properties)
// GTLPlusActivityObjectResharers (0 custom class methods, 2 custom properties)
// GTLPlusActivityObjectActorImage (0 custom class methods, 1 custom properties)
// GTLPlusActivityObjectAttachmentsItemEmbed (0 custom class methods, 2 custom properties)
// GTLPlusActivityObjectAttachmentsItemFullImage (0 custom class methods, 4 custom properties)
// GTLPlusActivityObjectAttachmentsItemImage (0 custom class methods, 4 custom properties)
// GTLPlusActivityObjectAttachmentsItemThumbnailsItem (0 custom class methods, 3 custom properties)
// GTLPlusActivityObjectAttachmentsItemThumbnailsItemImage (0 custom class methods, 4 custom properties)
#if GTL_BUILT_AS_FRAMEWORK
#import "GTL/GTLObject.h"
#else
#import "GTLObject.h"
#endif
@class GTLPlusAcl;
@class GTLPlusActivityActor;
@class GTLPlusActivityActorImage;
@class GTLPlusActivityActorName;
@class GTLPlusActivityObject;
@class GTLPlusActivityObjectActor;
@class GTLPlusActivityObjectActorImage;
@class GTLPlusActivityObjectAttachmentsItem;
@class GTLPlusActivityObjectAttachmentsItemEmbed;
@class GTLPlusActivityObjectAttachmentsItemFullImage;
@class GTLPlusActivityObjectAttachmentsItemImage;
@class GTLPlusActivityObjectAttachmentsItemThumbnailsItem;
@class GTLPlusActivityObjectAttachmentsItemThumbnailsItemImage;
@class GTLPlusActivityObjectPlusoners;
@class GTLPlusActivityObjectReplies;
@class GTLPlusActivityObjectResharers;
@class GTLPlusActivityProvider;
// ----------------------------------------------------------------------------
//
// GTLPlusActivity
//
@interface GTLPlusActivity : GTLObject
// Identifies who has access to see this activity.
@property (retain) GTLPlusAcl *access;
// The person who performed this activity.
@property (retain) GTLPlusActivityActor *actor;
// Street address where this activity occurred.
@property (copy) NSString *address;
// Additional content added by the person who shared this activity, applicable
// only when resharing an activity.
@property (copy) NSString *annotation;
// If this activity is a crosspost from another system, this property specifies
// the ID of the original activity.
@property (copy) NSString *crosspostSource;
// ETag of this response for caching purposes.
@property (copy) NSString *ETag;
// Latitude and longitude where this activity occurred. Format is latitude
// followed by longitude, space separated.
@property (copy) NSString *geocode;
// The ID of this activity.
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
@property (copy) NSString *identifier;
// Identifies this resource as an activity. Value: "plus#activity".
@property (copy) NSString *kind;
// The object of this activity.
@property (retain) GTLPlusActivityObject *object;
// ID of the place where this activity occurred.
@property (copy) NSString *placeId;
// Name of the place where this activity occurred.
@property (copy) NSString *placeName;
// The service provider that initially published this activity.
@property (retain) GTLPlusActivityProvider *provider;
// The time at which this activity was initially published. Formatted as an RFC
// 3339 timestamp.
@property (retain) GTLDateTime *published;
// Radius, in meters, of the region where this activity occurred, centered at
// the latitude and longitude identified in geocode.
@property (copy) NSString *radius;
// Title of this activity.
@property (copy) NSString *title;
// The time at which this activity was last updated. Formatted as an RFC 3339
// timestamp.
@property (retain) GTLDateTime *updated;
// The link to this activity.
@property (copy) NSString *url;
// This activity's verb, indicating what action was performed. Possible values
// are:
// - "post" - Publish content to the stream.
// - "share" - Reshare an activity.
@property (copy) NSString *verb;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusActivityActor
//
@interface GTLPlusActivityActor : GTLObject
// The name of the actor, suitable for display.
@property (copy) NSString *displayName;
// The ID of the actor's person resource.
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
@property (copy) NSString *identifier;
// The image representation of the actor.
@property (retain) GTLPlusActivityActorImage *image;
// An object representation of the individual components of name.
@property (retain) GTLPlusActivityActorName *name;
// The link to the actor's Google profile.
@property (copy) NSString *url;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusActivityObject
//
@interface GTLPlusActivityObject : GTLObject
// If this activity's object is itself another activity (for example, when a
// person reshares an activity), this property specifies the original activity's
// actor.
@property (retain) GTLPlusActivityObjectActor *actor;
// The media objects attached to this activity.
@property (retain) NSArray *attachments; // of GTLPlusActivityObjectAttachmentsItem
// The HTML-formatted content, suitable for display.
@property (copy) NSString *content;
// The ID of the object. When resharing an activity, this is the ID of the
// activity being reshared.
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
@property (copy) NSString *identifier;
// The type of the object. Possible values are:
// - "note" - Textual content.
// - "activity" - A Google+ activity.
@property (copy) NSString *objectType;
// The content (text) as provided by the author, stored without any HTML
// formatting. When creating or updating an activity, this value must be
// supplied as plain text in the request.
@property (copy) NSString *originalContent;
// People who +1'd this activity.
@property (retain) GTLPlusActivityObjectPlusoners *plusoners;
// Comments in reply to this activity.
@property (retain) GTLPlusActivityObjectReplies *replies;
// People who reshared this activity.
@property (retain) GTLPlusActivityObjectResharers *resharers;
// The URL that points to the linked resource.
@property (copy) NSString *url;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusActivityProvider
//
@interface GTLPlusActivityProvider : GTLObject
// Name of the service provider.
@property (copy) NSString *title;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusActivityActorImage
//
@interface GTLPlusActivityActorImage : GTLObject
// The URL of the actor's profile photo. To re-size the image and crop it to a
// square, append the query string ?sz=x, where x is the dimension in pixels of
// each side.
@property (copy) NSString *url;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusActivityActorName
//
@interface GTLPlusActivityActorName : GTLObject
// The family name (last name) of the actor.
@property (copy) NSString *familyName;
// The given name (first name) of the actor.
@property (copy) NSString *givenName;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusActivityObjectActor
//
@interface GTLPlusActivityObjectActor : GTLObject
// The original actor's name, suitable for display.
@property (copy) NSString *displayName;
// ID of the original actor.
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
@property (copy) NSString *identifier;
// The image representation of the original actor.
@property (retain) GTLPlusActivityObjectActorImage *image;
// A link to the original actor's Google profile.
@property (copy) NSString *url;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusActivityObjectAttachmentsItem
//
@interface GTLPlusActivityObjectAttachmentsItem : GTLObject
// If the attachment is an article, this property contains a snippet of text
// from the article. It can also include descriptions for other types.
@property (copy) NSString *content;
// The title of the attachment (such as a photo caption or an article title).
@property (copy) NSString *displayName;
// If the attachment is a video, the embeddable link.
@property (retain) GTLPlusActivityObjectAttachmentsItemEmbed *embed;
// The full image URL for photo attachments.
@property (retain) GTLPlusActivityObjectAttachmentsItemFullImage *fullImage;
// The ID of the attachment.
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
@property (copy) NSString *identifier;
// The preview image for photos or videos.
@property (retain) GTLPlusActivityObjectAttachmentsItemImage *image;
// The type of media object. Possible values are:
// - "photo" - A photo.
// - "album" - A photo album.
// - "video" - A video.
// - "article" - An article, specified by a link.
@property (copy) NSString *objectType;
// If the attachment is an album, potential additional thumbnails from the
// album.
@property (retain) NSArray *thumbnails; // of GTLPlusActivityObjectAttachmentsItemThumbnailsItem
// The link to the attachment, should be of type text/html.
@property (copy) NSString *url;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusActivityObjectPlusoners
//
@interface GTLPlusActivityObjectPlusoners : GTLObject
// The URL for the collection of people who +1'd this activity.
@property (copy) NSString *selfLink;
// Total number of people who +1'd this activity.
@property (retain) NSNumber *totalItems; // unsignedIntValue
@end
// ----------------------------------------------------------------------------
//
// GTLPlusActivityObjectReplies
//
@interface GTLPlusActivityObjectReplies : GTLObject
// The URL for the collection of comments in reply to this activity.
@property (copy) NSString *selfLink;
// Total number of comments on this activity.
@property (retain) NSNumber *totalItems; // unsignedIntValue
@end
// ----------------------------------------------------------------------------
//
// GTLPlusActivityObjectResharers
//
@interface GTLPlusActivityObjectResharers : GTLObject
// The URL for the collection of resharers.
@property (copy) NSString *selfLink;
// Total number of people who reshared this activity.
@property (retain) NSNumber *totalItems; // unsignedIntValue
@end
// ----------------------------------------------------------------------------
//
// GTLPlusActivityObjectActorImage
//
@interface GTLPlusActivityObjectActorImage : GTLObject
// A URL that points to a thumbnail photo of the original actor.
@property (copy) NSString *url;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusActivityObjectAttachmentsItemEmbed
//
@interface GTLPlusActivityObjectAttachmentsItemEmbed : GTLObject
// Media type of the link.
@property (copy) NSString *type;
// URL of the link.
@property (copy) NSString *url;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusActivityObjectAttachmentsItemFullImage
//
@interface GTLPlusActivityObjectAttachmentsItemFullImage : GTLObject
// The height, in pixels, of the linked resource.
@property (retain) NSNumber *height; // unsignedIntValue
// Media type of the link.
@property (copy) NSString *type;
// URL to the image.
@property (copy) NSString *url;
// The width, in pixels, of the linked resource.
@property (retain) NSNumber *width; // unsignedIntValue
@end
// ----------------------------------------------------------------------------
//
// GTLPlusActivityObjectAttachmentsItemImage
//
@interface GTLPlusActivityObjectAttachmentsItemImage : GTLObject
// The height, in pixels, of the linked resource.
@property (retain) NSNumber *height; // unsignedIntValue
// Media type of the link.
@property (copy) NSString *type;
// Image url.
@property (copy) NSString *url;
// The width, in pixels, of the linked resource.
@property (retain) NSNumber *width; // unsignedIntValue
@end
// ----------------------------------------------------------------------------
//
// GTLPlusActivityObjectAttachmentsItemThumbnailsItem
//
@interface GTLPlusActivityObjectAttachmentsItemThumbnailsItem : GTLObject
// Potential name of the thumbnail.
// Remapped to 'descriptionProperty' to avoid NSObject's 'description'.
@property (copy) NSString *descriptionProperty;
// Image resource.
@property (retain) GTLPlusActivityObjectAttachmentsItemThumbnailsItemImage *image;
// URL to the webpage containing the image.
@property (copy) NSString *url;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusActivityObjectAttachmentsItemThumbnailsItemImage
//
@interface GTLPlusActivityObjectAttachmentsItemThumbnailsItemImage : GTLObject
// The height, in pixels, of the linked resource.
@property (retain) NSNumber *height; // unsignedIntValue
// Media type of the link.
@property (copy) NSString *type;
// Image url.
@property (copy) NSString *url;
// The width, in pixels, of the linked resource.
@property (retain) NSNumber *width; // unsignedIntValue
@end

View File

@@ -0,0 +1,81 @@
/* Copyright (c) 2013 Google Inc.
*
* 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.
*/
//
// GTLPlusActivityFeed.h
//
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/api/
// Classes:
// GTLPlusActivityFeed (0 custom class methods, 9 custom properties)
#if GTL_BUILT_AS_FRAMEWORK
#import "GTL/GTLObject.h"
#else
#import "GTLObject.h"
#endif
@class GTLPlusActivity;
// ----------------------------------------------------------------------------
//
// GTLPlusActivityFeed
//
// This class supports NSFastEnumeration over its "items" property. It also
// supports -itemAtIndex: to retrieve individual objects from "items".
@interface GTLPlusActivityFeed : GTLCollectionObject
// ETag of this response for caching purposes.
@property (copy) NSString *ETag;
// The ID of this collection of activities. Deprecated.
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
@property (copy) NSString *identifier;
// The activities in this page of results.
@property (retain) NSArray *items; // of GTLPlusActivity
// Identifies this resource as a collection of activities. Value:
// "plus#activityFeed".
@property (copy) NSString *kind;
// Link to the next page of activities.
@property (copy) NSString *nextLink;
// The continuation token, which is used to page through large result sets.
// Provide this value in a subsequent request to return the next page of
// results.
@property (copy) NSString *nextPageToken;
// Link to this activity resource.
@property (copy) NSString *selfLink;
// The title of this collection of activities.
@property (copy) NSString *title;
// The time at which this collection of activities was last updated. Formatted
// as an RFC 3339 timestamp.
@property (retain) GTLDateTime *updated;
@end

View File

@@ -0,0 +1,183 @@
/* Copyright (c) 2013 Google Inc.
*
* 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.
*/
//
// GTLPlusComment.h
//
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/api/
// Classes:
// GTLPlusComment (0 custom class methods, 11 custom properties)
// GTLPlusCommentActor (0 custom class methods, 4 custom properties)
// GTLPlusCommentInReplyToItem (0 custom class methods, 2 custom properties)
// GTLPlusCommentObject (0 custom class methods, 3 custom properties)
// GTLPlusCommentPlusoners (0 custom class methods, 1 custom properties)
// GTLPlusCommentActorImage (0 custom class methods, 1 custom properties)
#if GTL_BUILT_AS_FRAMEWORK
#import "GTL/GTLObject.h"
#else
#import "GTLObject.h"
#endif
@class GTLPlusCommentActor;
@class GTLPlusCommentActorImage;
@class GTLPlusCommentInReplyToItem;
@class GTLPlusCommentObject;
@class GTLPlusCommentPlusoners;
// ----------------------------------------------------------------------------
//
// GTLPlusComment
//
@interface GTLPlusComment : GTLObject
// The person who posted this comment.
@property (retain) GTLPlusCommentActor *actor;
// ETag of this response for caching purposes.
@property (copy) NSString *ETag;
// The ID of this comment.
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
@property (copy) NSString *identifier;
// The activity this comment replied to.
@property (retain) NSArray *inReplyTo; // of GTLPlusCommentInReplyToItem
// Identifies this resource as a comment. Value: "plus#comment".
@property (copy) NSString *kind;
// The object of this comment.
@property (retain) GTLPlusCommentObject *object;
// People who +1'd this comment.
@property (retain) GTLPlusCommentPlusoners *plusoners;
// The time at which this comment was initially published. Formatted as an RFC
// 3339 timestamp.
@property (retain) GTLDateTime *published;
// Link to this comment resource.
@property (copy) NSString *selfLink;
// The time at which this comment was last updated. Formatted as an RFC 3339
// timestamp.
@property (retain) GTLDateTime *updated;
// This comment's verb, indicating what action was performed. Possible values
// are:
// - "post" - Publish content to the stream.
@property (copy) NSString *verb;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusCommentActor
//
@interface GTLPlusCommentActor : GTLObject
// The name of this actor, suitable for display.
@property (copy) NSString *displayName;
// The ID of the actor.
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
@property (copy) NSString *identifier;
// The image representation of this actor.
@property (retain) GTLPlusCommentActorImage *image;
// A link to the person resource for this actor.
@property (copy) NSString *url;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusCommentInReplyToItem
//
@interface GTLPlusCommentInReplyToItem : GTLObject
// The ID of the activity.
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
@property (copy) NSString *identifier;
// The URL of the activity.
@property (copy) NSString *url;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusCommentObject
//
@interface GTLPlusCommentObject : GTLObject
// The HTML-formatted content, suitable for display.
@property (copy) NSString *content;
// The object type of this comment. Possible values are:
// - "comment" - A comment in reply to an activity.
@property (copy) NSString *objectType;
// The content (text) as provided by the author, stored without any HTML
// formatting. When creating or updating a comment, this value must be supplied
// as plain text in the request.
@property (copy) NSString *originalContent;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusCommentPlusoners
//
@interface GTLPlusCommentPlusoners : GTLObject
// Total number of people who +1'd this comment.
@property (retain) NSNumber *totalItems; // unsignedIntValue
@end
// ----------------------------------------------------------------------------
//
// GTLPlusCommentActorImage
//
@interface GTLPlusCommentActorImage : GTLObject
// The URL of the actor's profile photo. To re-size the image and crop it to a
// square, append the query string ?sz=x, where x is the dimension in pixels of
// each side.
@property (copy) NSString *url;
@end

View File

@@ -0,0 +1,78 @@
/* Copyright (c) 2013 Google Inc.
*
* 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.
*/
//
// GTLPlusCommentFeed.h
//
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/api/
// Classes:
// GTLPlusCommentFeed (0 custom class methods, 8 custom properties)
#if GTL_BUILT_AS_FRAMEWORK
#import "GTL/GTLObject.h"
#else
#import "GTLObject.h"
#endif
@class GTLPlusComment;
// ----------------------------------------------------------------------------
//
// GTLPlusCommentFeed
//
// This class supports NSFastEnumeration over its "items" property. It also
// supports -itemAtIndex: to retrieve individual objects from "items".
@interface GTLPlusCommentFeed : GTLCollectionObject
// ETag of this response for caching purposes.
@property (copy) NSString *ETag;
// The ID of this collection of comments.
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
@property (copy) NSString *identifier;
// The comments in this page of results.
@property (retain) NSArray *items; // of GTLPlusComment
// Identifies this resource as a collection of comments. Value:
// "plus#commentFeed".
@property (copy) NSString *kind;
// Link to the next page of activities.
@property (copy) NSString *nextLink;
// The continuation token, which is used to page through large result sets.
// Provide this value in a subsequent request to return the next page of
// results.
@property (copy) NSString *nextPageToken;
// The title of this collection of comments.
@property (copy) NSString *title;
// The time at which this collection of comments was last updated. Formatted as
// an RFC 3339 timestamp.
@property (retain) GTLDateTime *updated;
@end

View File

@@ -0,0 +1,57 @@
/* Copyright (c) 2013 Google Inc.
*
* 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.
*/
//
// GTLPlusConstants.h
//
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/api/
#import <Foundation/Foundation.h>
#if GTL_BUILT_AS_FRAMEWORK
#import "GTL/GTLDefines.h"
#else
#import "GTLDefines.h"
#endif
// Authorization scope
// Know your name, basic info, and list of people you're connected to on Google+
GTL_EXTERN NSString * const kGTLAuthScopePlusLogin; // "https://www.googleapis.com/auth/plus.login"
// Know who you are on Google
GTL_EXTERN NSString * const kGTLAuthScopePlusMe; // "https://www.googleapis.com/auth/plus.me"
// Collection
GTL_EXTERN NSString * const kGTLPlusCollectionPlusoners; // "plusoners"
GTL_EXTERN NSString * const kGTLPlusCollectionPublic; // "public"
GTL_EXTERN NSString * const kGTLPlusCollectionResharers; // "resharers"
GTL_EXTERN NSString * const kGTLPlusCollectionVault; // "vault"
GTL_EXTERN NSString * const kGTLPlusCollectionVisible; // "visible"
// OrderBy
GTL_EXTERN NSString * const kGTLPlusOrderByAlphabetical; // "alphabetical"
GTL_EXTERN NSString * const kGTLPlusOrderByBest; // "best"
GTL_EXTERN NSString * const kGTLPlusOrderByRecent; // "recent"
// SortOrder
GTL_EXTERN NSString * const kGTLPlusSortOrderAscending; // "ascending"
GTL_EXTERN NSString * const kGTLPlusSortOrderDescending; // "descending"

View File

@@ -0,0 +1,225 @@
/* Copyright (c) 2013 Google Inc.
*
* 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.
*/
//
// GTLPlusItemScope.h
//
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/api/
// Classes:
// GTLPlusItemScope (0 custom class methods, 55 custom properties)
#if GTL_BUILT_AS_FRAMEWORK
#import "GTL/GTLObject.h"
#else
#import "GTLObject.h"
#endif
@class GTLPlusItemScope;
// ----------------------------------------------------------------------------
//
// GTLPlusItemScope
//
@interface GTLPlusItemScope : GTLObject
// The subject matter of the content.
@property (retain) GTLPlusItemScope *about;
// An additional name for a Person, can be used for a middle name.
@property (retain) NSArray *additionalName; // of NSString
// Postal address.
@property (retain) GTLPlusItemScope *address;
// Address country.
@property (copy) NSString *addressCountry;
// Address locality.
@property (copy) NSString *addressLocality;
// Address region.
@property (copy) NSString *addressRegion;
// The encoding.
@property (retain) NSArray *associatedMedia; // of GTLPlusItemScope
// Number of attendees.
@property (retain) NSNumber *attendeeCount; // intValue
// A person attending the event.
@property (retain) NSArray *attendees; // of GTLPlusItemScope
// From http://schema.org/MusicRecording, the audio file.
@property (retain) GTLPlusItemScope *audio;
// The person who created this scope.
@property (retain) NSArray *author; // of GTLPlusItemScope
// Best possible rating value.
@property (copy) NSString *bestRating;
// Date of birth.
@property (copy) NSString *birthDate;
// From http://schema.org/MusicRecording, the artist that performed this
// recording.
@property (retain) GTLPlusItemScope *byArtist;
// The caption for this object.
@property (copy) NSString *caption;
// File size in (mega/kilo) bytes.
@property (copy) NSString *contentSize;
// Actual bytes of the media object, for example the image file or video file.
@property (copy) NSString *contentUrl;
// The list of contributors for this scope.
@property (retain) NSArray *contributor; // of GTLPlusItemScope
// The date this scope was created.
@property (copy) NSString *dateCreated;
// The date this scope was last modified.
@property (copy) NSString *dateModified;
// The initial date this scope was published.
@property (copy) NSString *datePublished;
// The string describing the content of this scope.
// Remapped to 'descriptionProperty' to avoid NSObject's 'description'.
@property (copy) NSString *descriptionProperty;
// The duration of the item (movie, audio recording, event, etc.) in ISO 8601
// date format.
@property (copy) NSString *duration;
// A URL pointing to a player for a specific video. In general, this is the
// information in the src element of an embed tag and should not be the same as
// the content of the loc tag.
@property (copy) NSString *embedUrl;
// The end date and time of the event (in ISO 8601 date format).
@property (copy) NSString *endDate;
// Family name. In the U.S., the last name of an Person. This can be used along
// with givenName instead of the Name property.
@property (copy) NSString *familyName;
// Gender of the person.
@property (copy) NSString *gender;
// Geo coordinates.
@property (retain) GTLPlusItemScope *geo;
// Given name. In the U.S., the first name of a Person. This can be used along
// with familyName instead of the Name property.
@property (copy) NSString *givenName;
// The height of the media object.
@property (copy) NSString *height;
// The id for this item scope.
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
@property (copy) NSString *identifier;
// A url to the image for this scope.
@property (copy) NSString *image;
// From http://schema.org/MusicRecording, which album a song is in.
@property (retain) GTLPlusItemScope *inAlbum;
// Identifies this resource as an itemScope.
@property (copy) NSString *kind;
// Latitude.
@property (retain) NSNumber *latitude; // doubleValue
// The location of the event or organization.
@property (retain) GTLPlusItemScope *location;
// Longitude.
@property (retain) NSNumber *longitude; // doubleValue
// The name of this scope.
@property (copy) NSString *name;
// Property of http://schema.org/TVEpisode indicating which series the episode
// belongs to.
@property (retain) GTLPlusItemScope *partOfTVSeries;
// The main performer or performers of the event-for example, a presenter,
// musician, or actor.
@property (retain) NSArray *performers; // of GTLPlusItemScope
// Player type required-for example, Flash or Silverlight.
@property (copy) NSString *playerType;
// Postal code.
@property (copy) NSString *postalCode;
// Post office box number.
@property (copy) NSString *postOfficeBoxNumber;
// Rating value.
@property (copy) NSString *ratingValue;
// Review rating.
@property (retain) GTLPlusItemScope *reviewRating;
// The start date and time of the event (in ISO 8601 date format).
@property (copy) NSString *startDate;
// Street address.
@property (copy) NSString *streetAddress;
// Comment text, review text, etc.
@property (copy) NSString *text;
// Thumbnail image for an image or video.
@property (retain) GTLPlusItemScope *thumbnail;
// A url to a thumbnail image for this scope.
@property (copy) NSString *thumbnailUrl;
// The exchange traded instrument associated with a Corporation object. The
// tickerSymbol is expressed as an exchange and an instrument name separated by
// a space character. For the exchange component of the tickerSymbol attribute,
// we reccommend using the controlled vocaulary of Market Identifier Codes (MIC)
// specified in ISO15022.
@property (copy) NSString *tickerSymbol;
// The item type.
@property (copy) NSString *type;
// A URL for the item upon which the action was performed.
@property (copy) NSString *url;
// The width of the media object.
@property (copy) NSString *width;
// Worst possible rating value.
@property (copy) NSString *worstRating;
@end

View File

@@ -0,0 +1,65 @@
/* Copyright (c) 2013 Google Inc.
*
* 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.
*/
//
// GTLPlusMoment.h
//
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/api/
// Classes:
// GTLPlusMoment (0 custom class methods, 6 custom properties)
#if GTL_BUILT_AS_FRAMEWORK
#import "GTL/GTLObject.h"
#else
#import "GTLObject.h"
#endif
@class GTLPlusItemScope;
// ----------------------------------------------------------------------------
//
// GTLPlusMoment
//
@interface GTLPlusMoment : GTLObject
// The moment ID.
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
@property (copy) NSString *identifier;
// Identifies this resource as a moment.
@property (copy) NSString *kind;
// The object generated by performing the action on the item
@property (retain) GTLPlusItemScope *result;
// Time stamp of when the action occurred in RFC3339 format.
@property (retain) GTLDateTime *startDate;
// The object on which the action was performed.
@property (retain) GTLPlusItemScope *target;
// The schema.org activity type.
@property (copy) NSString *type;
@end

View File

@@ -0,0 +1,76 @@
/* Copyright (c) 2013 Google Inc.
*
* 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.
*/
//
// GTLPlusMomentsFeed.h
//
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/api/
// Classes:
// GTLPlusMomentsFeed (0 custom class methods, 8 custom properties)
#if GTL_BUILT_AS_FRAMEWORK
#import "GTL/GTLObject.h"
#else
#import "GTLObject.h"
#endif
@class GTLPlusMoment;
// ----------------------------------------------------------------------------
//
// GTLPlusMomentsFeed
//
// This class supports NSFastEnumeration over its "items" property. It also
// supports -itemAtIndex: to retrieve individual objects from "items".
@interface GTLPlusMomentsFeed : GTLCollectionObject
// ETag of this response for caching purposes.
@property (copy) NSString *ETag;
// The moments in this page of results.
@property (retain) NSArray *items; // of GTLPlusMoment
// Identifies this resource as a collection of moments. Value:
// "plus#momentsFeed".
@property (copy) NSString *kind;
// Link to the next page of moments.
@property (copy) NSString *nextLink;
// The continuation token, which is used to page through large result sets.
// Provide this value in a subsequent request to return the next page of
// results.
@property (copy) NSString *nextPageToken;
// Link to this page of moments.
@property (copy) NSString *selfLink;
// The title of this collection of moments.
@property (copy) NSString *title;
// The RFC 339 timestamp for when this collection of moments was last updated.
@property (retain) GTLDateTime *updated;
@end

View File

@@ -0,0 +1,76 @@
/* Copyright (c) 2013 Google Inc.
*
* 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.
*/
//
// GTLPlusPeopleFeed.h
//
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/api/
// Classes:
// GTLPlusPeopleFeed (0 custom class methods, 7 custom properties)
#if GTL_BUILT_AS_FRAMEWORK
#import "GTL/GTLObject.h"
#else
#import "GTLObject.h"
#endif
@class GTLPlusPerson;
// ----------------------------------------------------------------------------
//
// GTLPlusPeopleFeed
//
// This class supports NSFastEnumeration over its "items" property. It also
// supports -itemAtIndex: to retrieve individual objects from "items".
@interface GTLPlusPeopleFeed : GTLCollectionObject
// ETag of this response for caching purposes.
@property (copy) NSString *ETag;
// The people in this page of results. Each item includes the id, displayName,
// image, and url for the person. To retrieve additional profile data, see the
// people.get method.
@property (retain) NSArray *items; // of GTLPlusPerson
// Identifies this resource as a collection of people. Value: "plus#peopleFeed".
@property (copy) NSString *kind;
// The continuation token, which is used to page through large result sets.
// Provide this value in a subsequent request to return the next page of
// results.
@property (copy) NSString *nextPageToken;
// Link to this resource.
@property (copy) NSString *selfLink;
// The title of this collection of people.
@property (copy) NSString *title;
// The total number of people available in this list. The number of people in a
// response might be smaller due to paging. This might not be set for all
// collections.
@property (retain) NSNumber *totalItems; // intValue
@end

View File

@@ -0,0 +1,388 @@
/* Copyright (c) 2013 Google Inc.
*
* 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.
*/
//
// GTLPlusPerson.h
//
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/api/
// Classes:
// GTLPlusPerson (0 custom class methods, 28 custom properties)
// GTLPlusPersonAgeRange (0 custom class methods, 2 custom properties)
// GTLPlusPersonCover (0 custom class methods, 3 custom properties)
// GTLPlusPersonEmailsItem (0 custom class methods, 3 custom properties)
// GTLPlusPersonImage (0 custom class methods, 1 custom properties)
// GTLPlusPersonName (0 custom class methods, 6 custom properties)
// GTLPlusPersonOrganizationsItem (0 custom class methods, 9 custom properties)
// GTLPlusPersonPlacesLivedItem (0 custom class methods, 2 custom properties)
// GTLPlusPersonUrlsItem (0 custom class methods, 3 custom properties)
// GTLPlusPersonCoverCoverInfo (0 custom class methods, 2 custom properties)
// GTLPlusPersonCoverCoverPhoto (0 custom class methods, 3 custom properties)
#if GTL_BUILT_AS_FRAMEWORK
#import "GTL/GTLObject.h"
#else
#import "GTLObject.h"
#endif
@class GTLPlusPersonAgeRange;
@class GTLPlusPersonCover;
@class GTLPlusPersonCoverCoverInfo;
@class GTLPlusPersonCoverCoverPhoto;
@class GTLPlusPersonEmailsItem;
@class GTLPlusPersonImage;
@class GTLPlusPersonName;
@class GTLPlusPersonOrganizationsItem;
@class GTLPlusPersonPlacesLivedItem;
@class GTLPlusPersonUrlsItem;
// ----------------------------------------------------------------------------
//
// GTLPlusPerson
//
@interface GTLPlusPerson : GTLObject
// A short biography for this person.
@property (copy) NSString *aboutMe;
// The age range of the person.
@property (retain) GTLPlusPersonAgeRange *ageRange;
// The person's date of birth, represented as YYYY-MM-DD.
@property (copy) NSString *birthday;
// The "bragging rights" line of this person.
@property (copy) NSString *braggingRights;
// If a Google+ Page and for followers who are visible, the number of people who
// have added this page to a circle.
@property (retain) NSNumber *circledByCount; // intValue
// The cover photo content.
@property (retain) GTLPlusPersonCover *cover;
// The current location for this person.
@property (copy) NSString *currentLocation;
// The name of this person, suitable for display.
@property (copy) NSString *displayName;
// A list of email addresses for this person.
@property (retain) NSArray *emails; // of GTLPlusPersonEmailsItem
// ETag of this response for caching purposes.
@property (copy) NSString *ETag;
// The person's gender. Possible values are:
// - "male" - Male gender.
// - "female" - Female gender.
// - "other" - Other.
@property (copy) NSString *gender;
// If "true", indicates that the person has installed the app that is making the
// request and has chosen to expose this install state to the caller. A value of
// "false" indicates that the install state cannot be determined (it is either
// not installed or the person has chosen to keep this information private).
@property (retain) NSNumber *hasApp; // boolValue
// The ID of this person.
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
@property (copy) NSString *identifier;
// The representation of the person's profile photo.
@property (retain) GTLPlusPersonImage *image;
// Whether this user has signed up for Google+.
@property (retain) NSNumber *isPlusUser; // boolValue
// Identifies this resource as a person. Value: "plus#person".
@property (copy) NSString *kind;
// The user's preferred language for rendering.
@property (copy) NSString *language;
// An object representation of the individual components of a person's name.
@property (retain) GTLPlusPersonName *name;
// The nickname of this person.
@property (copy) NSString *nickname;
// Type of person within Google+. Possible values are:
// - "person" - represents an actual person.
// - "page" - represents a page.
@property (copy) NSString *objectType;
// A list of current or past organizations with which this person is associated.
@property (retain) NSArray *organizations; // of GTLPlusPersonOrganizationsItem
// A list of places where this person has lived.
@property (retain) NSArray *placesLived; // of GTLPlusPersonPlacesLivedItem
// If a Google+ Page, the number of people who have +1'ed this page.
@property (retain) NSNumber *plusOneCount; // intValue
// The person's relationship status. Possible values are:
// - "single" - Person is single.
// - "in_a_relationship" - Person is in a relationship.
// - "engaged" - Person is engaged.
// - "married" - Person is married.
// - "its_complicated" - The relationship is complicated.
// - "open_relationship" - Person is in an open relationship.
// - "widowed" - Person is widowed.
// - "in_domestic_partnership" - Person is in a domestic partnership.
// - "in_civil_union" - Person is in a civil union.
@property (copy) NSString *relationshipStatus;
// The brief description (tagline) of this person.
@property (copy) NSString *tagline;
// The URL of this person's profile.
@property (copy) NSString *url;
// A list of URLs for this person.
@property (retain) NSArray *urls; // of GTLPlusPersonUrlsItem
// Whether the person or Google+ Page has been verified.
@property (retain) NSNumber *verified; // boolValue
@end
// ----------------------------------------------------------------------------
//
// GTLPlusPersonAgeRange
//
@interface GTLPlusPersonAgeRange : GTLObject
// The age range's upper bound, if any.
@property (retain) NSNumber *max; // intValue
// The age range's lower bound, if any.
@property (retain) NSNumber *min; // intValue
@end
// ----------------------------------------------------------------------------
//
// GTLPlusPersonCover
//
@interface GTLPlusPersonCover : GTLObject
// Extra information about the cover photo.
@property (retain) GTLPlusPersonCoverCoverInfo *coverInfo;
// The person's primary cover image.
@property (retain) GTLPlusPersonCoverCoverPhoto *coverPhoto;
// The layout of the cover art. Possible values are:
// - "banner" - One large image banner.
@property (copy) NSString *layout;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusPersonEmailsItem
//
@interface GTLPlusPersonEmailsItem : GTLObject
// If "true", indicates this email address is the person's primary one.
@property (retain) NSNumber *primary; // boolValue
// The type of address. Possible values are:
// - "home" - Home email address.
// - "work" - Work email address.
// - "other" - Other.
@property (copy) NSString *type;
// The email address.
@property (copy) NSString *value;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusPersonImage
//
@interface GTLPlusPersonImage : GTLObject
// The URL of the person's profile photo. To re-size the image and crop it to a
// square, append the query string ?sz=x, where x is the dimension in pixels of
// each side.
@property (copy) NSString *url;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusPersonName
//
@interface GTLPlusPersonName : GTLObject
// The family name (last name) of this person.
@property (copy) NSString *familyName;
// The full name of this person, including middle names, suffixes, etc.
@property (copy) NSString *formatted;
// The given name (first name) of this person.
@property (copy) NSString *givenName;
// The honorific prefixes (such as "Dr." or "Mrs.") for this person.
@property (copy) NSString *honorificPrefix;
// The honorific suffixes (such as "Jr.") for this person.
@property (copy) NSString *honorificSuffix;
// The middle name of this person.
@property (copy) NSString *middleName;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusPersonOrganizationsItem
//
@interface GTLPlusPersonOrganizationsItem : GTLObject
// The department within the organization. Deprecated.
@property (copy) NSString *department;
// A short description of the person's role in this organization. Deprecated.
// Remapped to 'descriptionProperty' to avoid NSObject's 'description'.
@property (copy) NSString *descriptionProperty;
// The date the person left this organization.
@property (copy) NSString *endDate;
// The location of this organization. Deprecated.
@property (copy) NSString *location;
// The name of the organization.
@property (copy) NSString *name;
// If "true", indicates this organization is the person's primary one (typically
// interpreted as current one).
@property (retain) NSNumber *primary; // boolValue
// The date the person joined this organization.
@property (copy) NSString *startDate;
// The person's job title or role within the organization.
@property (copy) NSString *title;
// The type of organization. Possible values are:
// - "work" - Work.
// - "school" - School.
@property (copy) NSString *type;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusPersonPlacesLivedItem
//
@interface GTLPlusPersonPlacesLivedItem : GTLObject
// If "true", this place of residence is this person's primary residence.
@property (retain) NSNumber *primary; // boolValue
// A place where this person has lived. For example: "Seattle, WA", "Near
// Toronto".
@property (copy) NSString *value;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusPersonUrlsItem
//
@interface GTLPlusPersonUrlsItem : GTLObject
// If "true", this URL is the person's primary URL.
@property (retain) NSNumber *primary; // boolValue
// The type of URL. Possible values are:
// - "home" - URL for home.
// - "work" - URL for work.
// - "blog" - URL for blog.
// - "profile" - URL for profile.
// - "other" - Other.
@property (copy) NSString *type;
// The URL value.
@property (copy) NSString *value;
@end
// ----------------------------------------------------------------------------
//
// GTLPlusPersonCoverCoverInfo
//
@interface GTLPlusPersonCoverCoverInfo : GTLObject
// The difference between the left position of the image cover and the actual
// displayed cover image. Only valid for BANNER layout.
@property (retain) NSNumber *leftImageOffset; // intValue
// The difference between the top position of the image cover and the actual
// displayed cover image. Only valid for BANNER layout.
@property (retain) NSNumber *topImageOffset; // intValue
@end
// ----------------------------------------------------------------------------
//
// GTLPlusPersonCoverCoverPhoto
//
@interface GTLPlusPersonCoverCoverPhoto : GTLObject
// The height to the image.
@property (retain) NSNumber *height; // intValue
// The url to the image.
@property (copy) NSString *url;
// The width to the image.
@property (retain) NSNumber *width; // intValue
@end

View File

@@ -0,0 +1,136 @@
/* Copyright (c) 2011 Google Inc.
*
* 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.
*/
//
// GTLQuery.h
//
// Query documentation:
// https://code.google.com/p/google-api-objectivec-client/wiki/Introduction#Query_Operations
#import "GTLObject.h"
#import "GTLUploadParameters.h"
@protocol GTLQueryProtocol <NSObject, NSCopying>
- (BOOL)isBatchQuery;
- (BOOL)shouldSkipAuthorization;
- (void)executionDidStop;
- (NSDictionary *)additionalHTTPHeaders;
- (NSDictionary *)urlQueryParameters;
- (GTLUploadParameters *)uploadParameters;
@end
@protocol GTLQueryCollectionProtocol
@optional
@property (retain) NSString *pageToken;
@property (retain) NSNumber *startIndex;
@end
@class GTLServiceTicket;
@interface GTLQuery : NSObject <GTLQueryProtocol> {
@private
NSString *methodName_;
NSMutableDictionary *json_;
GTLObject *bodyObject_;
NSMutableDictionary *childCache_;
NSString *requestID_;
GTLUploadParameters *uploadParameters_;
NSDictionary *urlQueryParameters_;
NSDictionary *additionalHTTPHeaders_;
Class expectedObjectClass_;
BOOL skipAuthorization_;
#if NS_BLOCKS_AVAILABLE
void (^completionBlock_)(GTLServiceTicket *ticket, id object, NSError *error);
#elif !__LP64__
// Placeholders: for 32-bit builds, keep the size of the object's ivar section
// the same with and without blocks
id completionPlaceholder_;
#endif
}
// The rpc method name.
@property (readonly) NSString *methodName;
// The JSON dictionary of all the parameters set on this query.
@property (retain) NSMutableDictionary *JSON;
// The object set to be uploaded with the query.
@property (retain) GTLObject *bodyObject;
// Each query must have a request ID string. The user may replace the
// default assigned request ID with a custom string, provided that if
// used in a batch query, all request IDs in the batch must be unique.
@property (copy) NSString *requestID;
// For queries which support file upload, the MIME type and file handle
// or data must be provided.
@property (copy) GTLUploadParameters *uploadParameters;
// Any URL query parameters to add to the query (useful for debugging with some
// services).
@property (copy) NSDictionary *urlQueryParameters;
// Any additional HTTP headers for this query. Not valid when this query
// is added to a batch.
//
// These headers override the same keys from the service object's
// additionalHTTPHeaders.
@property (copy) NSDictionary *additionalHTTPHeaders;
// The GTLObject subclass expected for results (used if the result doesn't
// include a kind attribute).
@property (assign) Class expectedObjectClass;
// Clients may set this to YES to disallow authorization. Defaults to NO.
@property (assign) BOOL shouldSkipAuthorization;
#if NS_BLOCKS_AVAILABLE
// Clients may provide an optional callback block to be called immediately
// before the executeQuery: callback.
//
// The completionBlock property is particularly useful for queries executed
// in a batch.
//
// Errors passed to the completionBlock will have an "underlying" GTLErrorObject
// when the server returned an error for this specific query:
//
// GTLErrorObject *errorObj = [GTLErrorObject underlyingObjectForError:error];
// if (errorObj) {
// // the server returned this error for this specific query
// } else {
// // the batch execution failed
// }
@property (copy) void (^completionBlock)(GTLServiceTicket *ticket, id object, NSError *error);
#endif
// methodName is the RPC method name to use.
+ (id)queryWithMethodName:(NSString *)methodName GTL_NONNULL((1));
// methodName is the RPC method name to use.
- (id)initWithMethodName:(NSString *)method GTL_NONNULL((1));
// If you need to set a parameter that is not listed as a property for a
// query class, you can do so via this api. If you need to clear it after
// setting, pass nil for obj.
- (void)setCustomParameter:(id)obj forKey:(NSString *)key GTL_NONNULL((2));
// Auto-generated request IDs
+ (NSString *)nextRequestID;
// Methods for subclasses to override.
+ (NSDictionary *)parameterNameMap;
+ (NSDictionary *)arrayPropertyToClassMap;
@end

View File

@@ -0,0 +1,297 @@
/* Copyright (c) 2013 Google Inc.
*
* 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.
*/
//
// GTLQueryPlus.h
//
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/api/
// Classes:
// GTLQueryPlus (12 custom class methods, 15 custom properties)
#if GTL_BUILT_AS_FRAMEWORK
#import "GTL/GTLQuery.h"
#else
#import "GTLQuery.h"
#endif
@class GTLPlusMoment;
@interface GTLQueryPlus : GTLQuery
//
// Parameters valid on all methods.
//
// Selector specifying which fields to include in a partial response.
@property (copy) NSString *fields;
//
// Method-specific parameters; see the comments below for more information.
//
@property (copy) NSString *activityId;
@property (copy) NSString *collection;
@property (copy) NSString *commentId;
@property (assign) BOOL debug;
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
@property (copy) NSString *identifier;
@property (copy) NSString *language;
@property (assign) NSUInteger maxResults;
@property (copy) NSString *orderBy;
@property (copy) NSString *pageToken;
@property (copy) NSString *query;
@property (copy) NSString *sortOrder;
@property (copy) NSString *targetUrl;
@property (copy) NSString *type;
@property (copy) NSString *userId;
#pragma mark -
#pragma mark "activities" methods
// These create a GTLQueryPlus object.
// Method: plus.activities.get
// Get an activity.
// Required:
// activityId: The ID of the activity to get.
// Authorization scope(s):
// kGTLAuthScopePlusLogin
// kGTLAuthScopePlusMe
// Fetches a GTLPlusActivity.
+ (id)queryForActivitiesGetWithActivityId:(NSString *)activityId;
// Method: plus.activities.list
// List all of the activities in the specified collection for a particular user.
// Required:
// userId: The ID of the user to get activities for. The special value "me"
// can be used to indicate the authenticated user.
// collection: The collection of activities to list.
// kGTLPlusCollectionPublic: All public activities created by the specified
// user.
// Optional:
// maxResults: The maximum number of activities to include in the response,
// which is used for paging. For any response, the actual number returned
// might be less than the specified maxResults. (1..100, default 20)
// pageToken: The continuation token, which is used to page through large
// result sets. To get the next page of results, set this parameter to the
// value of "nextPageToken" from the previous response.
// Authorization scope(s):
// kGTLAuthScopePlusLogin
// kGTLAuthScopePlusMe
// Fetches a GTLPlusActivityFeed.
+ (id)queryForActivitiesListWithUserId:(NSString *)userId
collection:(NSString *)collection;
// Method: plus.activities.search
// Search public activities.
// Required:
// query: Full-text search query string.
// Optional:
// language: Specify the preferred language to search with. See search
// language codes for available values. (Default en-US)
// maxResults: The maximum number of activities to include in the response,
// which is used for paging. For any response, the actual number returned
// might be less than the specified maxResults. (1..20, default 10)
// orderBy: Specifies how to order search results. (Default
// kGTLPlusOrderByRecent)
// kGTLPlusOrderByBest: Sort activities by relevance to the user, most
// relevant first.
// kGTLPlusOrderByRecent: Sort activities by published date, most recent
// first.
// pageToken: The continuation token, which is used to page through large
// result sets. To get the next page of results, set this parameter to the
// value of "nextPageToken" from the previous response. This token can be of
// any length.
// Authorization scope(s):
// kGTLAuthScopePlusMe
// Fetches a GTLPlusActivityFeed.
+ (id)queryForActivitiesSearchWithQuery:(NSString *)query;
#pragma mark -
#pragma mark "comments" methods
// These create a GTLQueryPlus object.
// Method: plus.comments.get
// Get a comment.
// Required:
// commentId: The ID of the comment to get.
// Authorization scope(s):
// kGTLAuthScopePlusMe
// Fetches a GTLPlusComment.
+ (id)queryForCommentsGetWithCommentId:(NSString *)commentId;
// Method: plus.comments.list
// List all of the comments for an activity.
// Required:
// activityId: The ID of the activity to get comments for.
// Optional:
// maxResults: The maximum number of comments to include in the response,
// which is used for paging. For any response, the actual number returned
// might be less than the specified maxResults. (0..500, default 20)
// pageToken: The continuation token, which is used to page through large
// result sets. To get the next page of results, set this parameter to the
// value of "nextPageToken" from the previous response.
// sortOrder: The order in which to sort the list of comments. (Default
// kGTLPlusSortOrderAscending)
// kGTLPlusSortOrderAscending: Sort oldest comments first.
// kGTLPlusSortOrderDescending: Sort newest comments first.
// Authorization scope(s):
// kGTLAuthScopePlusMe
// Fetches a GTLPlusCommentFeed.
+ (id)queryForCommentsListWithActivityId:(NSString *)activityId;
#pragma mark -
#pragma mark "moments" methods
// These create a GTLQueryPlus object.
// Method: plus.moments.insert
// Record a moment representing a user's activity such as making a purchase or
// commenting on a blog.
// Required:
// userId: The ID of the user to record activities for. The only valid values
// are "me" and the ID of the authenticated user.
// collection: The collection to which to write moments.
// kGTLPlusCollectionVault: The default collection for writing new moments.
// Optional:
// debug: Return the moment as written. Should be used only for debugging.
// Authorization scope(s):
// kGTLAuthScopePlusLogin
// Fetches a GTLPlusMoment.
+ (id)queryForMomentsInsertWithObject:(GTLPlusMoment *)object
userId:(NSString *)userId
collection:(NSString *)collection;
// Method: plus.moments.list
// List all of the moments for a particular user.
// Required:
// userId: The ID of the user to get moments for. The special value "me" can
// be used to indicate the authenticated user.
// collection: The collection of moments to list.
// kGTLPlusCollectionVault: All moments created by the requesting
// application for the authenticated user.
// Optional:
// maxResults: The maximum number of moments to include in the response, which
// is used for paging. For any response, the actual number returned might be
// less than the specified maxResults. (1..100, default 20)
// pageToken: The continuation token, which is used to page through large
// result sets. To get the next page of results, set this parameter to the
// value of "nextPageToken" from the previous response.
// targetUrl: Only moments containing this targetUrl will be returned.
// type: Only moments of this type will be returned.
// Authorization scope(s):
// kGTLAuthScopePlusLogin
// Fetches a GTLPlusMomentsFeed.
+ (id)queryForMomentsListWithUserId:(NSString *)userId
collection:(NSString *)collection;
// Method: plus.moments.remove
// Delete a moment.
// Required:
// identifier: The ID of the moment to delete.
// Authorization scope(s):
// kGTLAuthScopePlusLogin
+ (id)queryForMomentsRemoveWithIdentifier:(NSString *)identifier;
#pragma mark -
#pragma mark "people" methods
// These create a GTLQueryPlus object.
// Method: plus.people.get
// Get a person's profile. If your app uses scope
// https://www.googleapis.com/auth/plus.login, this method is guaranteed to
// return ageRange and language.
// Required:
// userId: The ID of the person to get the profile for. The special value "me"
// can be used to indicate the authenticated user.
// Authorization scope(s):
// kGTLAuthScopePlusLogin
// kGTLAuthScopePlusMe
// Fetches a GTLPlusPerson.
+ (id)queryForPeopleGetWithUserId:(NSString *)userId;
// Method: plus.people.list
// List all of the people in the specified collection.
// Required:
// userId: Get the collection of people for the person identified by the ID or
// use "me" to indiciated the authenticated user.
// collection: The collection of people to list.
// kGTLPlusCollectionVisible: The list of people who this user has added to
// one or more circles, limited to the circles visible to the requesting
// application.
// Optional:
// maxResults: The maximum number of people to include in the response, which
// is used for paging. For any response, the actual number returned might be
// less than the specified maxResults. (1..100, default 100)
// orderBy: The order to return people in.
// kGTLPlusOrderByAlphabetical: Order the people by their display name.
// kGTLPlusOrderByBest: Order people based on the relevence to the viewer.
// pageToken: The continuation token, which is used to page through large
// result sets. To get the next page of results, set this parameter to the
// value of "nextPageToken" from the previous response.
// Authorization scope(s):
// kGTLAuthScopePlusLogin
// Fetches a GTLPlusPeopleFeed.
+ (id)queryForPeopleListWithUserId:(NSString *)userId
collection:(NSString *)collection;
// Method: plus.people.listByActivity
// List all of the people in the specified collection for a particular activity.
// Required:
// activityId: The ID of the activity to get the list of people for.
// collection: The collection of people to list.
// kGTLPlusCollectionPlusoners: List all people who have +1'd this
// activity.
// kGTLPlusCollectionResharers: List all people who have reshared this
// activity.
// Optional:
// maxResults: The maximum number of people to include in the response, which
// is used for paging. For any response, the actual number returned might be
// less than the specified maxResults. (1..100, default 20)
// pageToken: The continuation token, which is used to page through large
// result sets. To get the next page of results, set this parameter to the
// value of "nextPageToken" from the previous response.
// Authorization scope(s):
// kGTLAuthScopePlusMe
// Fetches a GTLPlusPeopleFeed.
+ (id)queryForPeopleListByActivityWithActivityId:(NSString *)activityId
collection:(NSString *)collection;
// Method: plus.people.search
// Search all public profiles.
// Required:
// query: Specify a query string for full text search of public text in all
// profiles.
// Optional:
// language: Specify the preferred language to search with. See search
// language codes for available values. (Default en-US)
// maxResults: The maximum number of people to include in the response, which
// is used for paging. For any response, the actual number returned might be
// less than the specified maxResults. (1..20, default 10)
// pageToken: The continuation token, which is used to page through large
// result sets. To get the next page of results, set this parameter to the
// value of "nextPageToken" from the previous response. This token can be of
// any length.
// Authorization scope(s):
// kGTLAuthScopePlusMe
// Fetches a GTLPlusPeopleFeed.
+ (id)queryForPeopleSearchWithQuery:(NSString *)query;
@end

View File

@@ -0,0 +1,57 @@
/* Copyright (c) 2011 Google Inc.
*
* 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.
*/
//
// GTLRuntimeCommon.h
//
#import <Foundation/Foundation.h>
#import "GTLDefines.h"
// This protocol and support class are an internal implementation detail so
// GTLObject and GTLQuery can share some code.
@protocol GTLRuntimeCommon <NSObject>
@required
// Get/Set properties
- (void)setJSONValue:(id)obj forKey:(NSString *)key;
- (id)JSONValueForKey:(NSString *)key;
// Child cache
- (void)setCacheChild:(id)obj forKey:(NSString *)key;
- (id)cacheChildForKey:(NSString *)key;
// Surrogate class mappings.
- (NSDictionary *)surrogates;
// Key map
+ (NSDictionary *)propertyToJSONKeyMapForClass:(Class<GTLRuntimeCommon>)aClass;
// Array item types
+ (NSDictionary *)arrayPropertyToClassMapForClass:(Class<GTLRuntimeCommon>)aClass;
// The parent class for dynamic support
+ (Class<GTLRuntimeCommon>)ancestorClass;
@end
@interface GTLRuntimeCommon : NSObject
// Wire things up.
+ (BOOL)resolveInstanceMethod:(SEL)sel onClass:(Class)onClass;
// Helpers
+ (id)objectFromJSON:(id)json
defaultClass:(Class)defaultClass
surrogates:(NSDictionary *)surrogates
isCacheable:(BOOL*)isCacheable;
+ (id)jsonFromAPIObject:(id)obj
expectedClass:(Class)expectedClass
isCacheable:(BOOL*)isCacheable;
@end

View File

@@ -0,0 +1,607 @@
/* Copyright (c) 2011 Google Inc.
*
* 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.
*/
//
// GTLService.h
//
// Service object documentation:
// https://code.google.com/p/google-api-objectivec-client/wiki/Introduction#Services_and_Tickets
#import <Foundation/Foundation.h>
#import "GTLDefines.h"
#import "GTMHTTPFetcherService.h"
#import "GTLBatchQuery.h"
#import "GTLBatchResult.h"
#import "GTLDateTime.h"
#import "GTLErrorObject.h"
#import "GTLFramework.h"
#import "GTLJSONParser.h"
#import "GTLObject.h"
#import "GTLQuery.h"
#import "GTLUtilities.h"
#undef _EXTERN
#undef _INITIALIZE_AS
#ifdef GTLSERVICE_DEFINE_GLOBALS
#define _EXTERN
#define _INITIALIZE_AS(x) =x
#else
#define _EXTERN extern
#define _INITIALIZE_AS(x)
#endif
// Error domains
_EXTERN NSString* const kGTLServiceErrorDomain _INITIALIZE_AS(@"com.google.GTLServiceDomain");
enum {
kGTLErrorQueryResultMissing = -3000,
kGTLErrorWaitTimedOut = -3001
};
_EXTERN NSString* const kGTLJSONRPCErrorDomain _INITIALIZE_AS(@"com.google.GTLJSONRPCErrorDomain");
// We'll consistently store the server error string in the userInfo under
// this key
_EXTERN NSString* const kGTLServerErrorStringKey _INITIALIZE_AS(@"error");
_EXTERN Class const kGTLUseRegisteredClass _INITIALIZE_AS(nil);
_EXTERN NSUInteger const kGTLStandardUploadChunkSize _INITIALIZE_AS(NSUIntegerMax);
// When servers return us structured JSON errors, the NSError will
// contain a GTLErrorObject in the userInfo dictionary under the key
// kGTLStructuredErrorsKey
_EXTERN NSString* const kGTLStructuredErrorKey _INITIALIZE_AS(@"GTLStructuredError");
// When specifying an ETag for updating or deleting a single entry, use
// kGTLETagWildcard to tell the server to replace the current value
// unconditionally. Do not use this in entries in a batch feed.
_EXTERN NSString* const kGTLETagWildcard _INITIALIZE_AS(@"*");
// Notifications when parsing of a fetcher feed or entry begins or ends
_EXTERN NSString* const kGTLServiceTicketParsingStartedNotification _INITIALIZE_AS(@"kGTLServiceTicketParsingStartedNotification");
_EXTERN NSString* const kGTLServiceTicketParsingStoppedNotification _INITIALIZE_AS(@"kGTLServiceTicketParsingStoppedNotification");
@class GTLServiceTicket;
// Block types used for fetch callbacks
//
// These typedefs are not used in the header file method declarations
// since it's more useful when code sense expansions show the argument
// types rather than the typedefs
#if NS_BLOCKS_AVAILABLE
typedef void (^GTLServiceCompletionHandler)(GTLServiceTicket *ticket, id object, NSError *error);
typedef void (^GTLServiceUploadProgressBlock)(GTLServiceTicket *ticket, unsigned long long numberOfBytesRead, unsigned long long dataLength);
#else
typedef void *GTLServiceCompletionHandler;
typedef void *GTLServiceUploadProgressBlock;
#endif // NS_BLOCKS_AVAILABLE
#pragma mark -
//
// Service base class
//
@interface GTLService : NSObject {
@private
NSOperationQueue *parseQueue_;
NSString *userAgent_;
GTMHTTPFetcherService *fetcherService_;
NSString *userAgentAddition_;
NSMutableDictionary *serviceProperties_; // initial values for properties in future tickets
NSDictionary *surrogates_; // initial value for surrogates in future tickets
SEL uploadProgressSelector_; // optional
#if NS_BLOCKS_AVAILABLE
BOOL (^retryBlock_)(GTLServiceTicket *, BOOL, NSError *);
void (^uploadProgressBlock_)(GTLServiceTicket *ticket,
unsigned long long numberOfBytesRead,
unsigned long long dataLength);
#elif !__LP64__
// Placeholders: for 32-bit builds, keep the size of the object's ivar section
// the same with and without blocks
id retryPlaceholder_;
id uploadProgressPlaceholder_;
#endif
NSUInteger uploadChunkSize_; // zero when uploading via multi-part MIME http body
BOOL isRetryEnabled_; // user allows auto-retries
SEL retrySelector_; // optional; set with setServiceRetrySelector
NSTimeInterval maxRetryInterval_; // default to 600. seconds
BOOL shouldFetchNextPages_;
NSString *apiKey_;
BOOL isRESTDataWrapperRequired_;
NSString *apiVersion_;
NSURL *rpcURL_;
NSURL *rpcUploadURL_;
NSDictionary *urlQueryParameters_;
NSDictionary *additionalHTTPHeaders_;
}
#pragma mark Query Execution
// The finishedSelector has a signature matching:
//
// - (void)serviceTicket:(GTLServiceTicket *)ticket
// finishedWithObject:(GTLObject *)object
// error:(NSError *)error
//
// If an error occurs, the error parameter will be non-nil. Otherwise,
// the object parameter will point to a GTLObject, if any was returned by
// the fetch. (Delete fetches return no object, so the second parameter will
// be nil.)
//
// If the query object is a GTLBatchQuery, the object passed to the callback
// will be a GTLBatchResult; see the batch query documentation:
// https://code.google.com/p/google-api-objectivec-client/wiki/Introduction#Batch_Operations
- (GTLServiceTicket *)executeQuery:(id<GTLQueryProtocol>)query
delegate:(id)delegate
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
#if NS_BLOCKS_AVAILABLE
- (GTLServiceTicket *)executeQuery:(id<GTLQueryProtocol>)query
completionHandler:(void (^)(GTLServiceTicket *ticket, id object, NSError *error))handler GTL_NONNULL((1));
#endif
// Automatic page fetches
//
// Tickets can optionally do a sequence of fetches for queries where
// repeated requests with nextPageToken or nextStartIndex values is required to
// retrieve items of all pages of the response collection. The client's
// callback is invoked only when all items have been retrieved, or an error has
// occurred. During the fetch, the items accumulated so far are available from
// the ticket.
//
// Note that the final object may be a combination of multiple page responses
// so it may not be the same as if all results had been returned in a single
// page. Some fields of the response such as total item counts may reflect only
// the final page's values.
//
// Automatic page fetches will return an error if more than 25 page fetches are
// required. For debug builds, this will log a warning to the console when more
// than 2 page fetches occur, as a reminder that the query's maxResults
// parameter should probably be increased to specify more items returned per
// page.
//
// Default value is NO.
@property (nonatomic, assign) BOOL shouldFetchNextPages;
// Retrying; see comments on retry support at the top of GTMHTTPFetcher.
//
// Default value is NO.
@property (nonatomic, assign, getter=isRetryEnabled) BOOL retryEnabled;
// Some services require a developer key for quotas and limits. Setting this
// will include it on all request sent to this service via a GTLQuery class.
@property (nonatomic, copy) NSString *APIKey;
// An authorizer adds user authentication headers to the request as needed.
@property (nonatomic, retain) id <GTMFetcherAuthorizationProtocol> authorizer;
// Retry selector is optional for retries.
//
// If present, it should have the signature:
// -(BOOL)ticket:(GTLServiceTicket *)ticket willRetry:(BOOL)suggestedWillRetry forError:(NSError *)error
// and return YES to cause a retry. Note that unlike the GTMHTTPFetcher retry
// selector, this selector's first argument is a ticket, not a fetcher.
@property (nonatomic, assign) SEL retrySelector;
#if NS_BLOCKS_AVAILABLE
@property (copy) BOOL (^retryBlock)(GTLServiceTicket *ticket, BOOL suggestedWillRetry, NSError *error);
#endif
@property (nonatomic, assign) NSTimeInterval maxRetryInterval;
//
// Fetches may be done using RPC or REST APIs, without creating
// a GTLQuery object
//
#pragma mark RPC Fetch Methods
//
// These methods may be used for RPC fetches without creating a GTLQuery object
//
- (GTLServiceTicket *)fetchObjectWithMethodNamed:(NSString *)methodName
parameters:(NSDictionary *)parameters
objectClass:(Class)objectClass
delegate:(id)delegate
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
- (GTLServiceTicket *)fetchObjectWithMethodNamed:(NSString *)methodName
insertingObject:(GTLObject *)bodyObject
objectClass:(Class)objectClass
delegate:(id)delegate
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
- (GTLServiceTicket *)fetchObjectWithMethodNamed:(NSString *)methodName
parameters:(NSDictionary *)parameters
insertingObject:(GTLObject *)bodyObject
objectClass:(Class)objectClass
delegate:(id)delegate
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
#if NS_BLOCKS_AVAILABLE
- (GTLServiceTicket *)fetchObjectWithMethodNamed:(NSString *)methodName
parameters:(NSDictionary *)parameters
objectClass:(Class)objectClass
completionHandler:(void (^)(GTLServiceTicket *ticket, id object, NSError *error))handler GTL_NONNULL((1));
- (GTLServiceTicket *)fetchObjectWithMethodNamed:(NSString *)methodName
insertingObject:(GTLObject *)bodyObject
objectClass:(Class)objectClass
completionHandler:(void (^)(GTLServiceTicket *ticket, id object, NSError *error))handler GTL_NONNULL((1));
- (GTLServiceTicket *)fetchObjectWithMethodNamed:(NSString *)methodName
parameters:(NSDictionary *)parameters
insertingObject:(GTLObject *)bodyObject
objectClass:(Class)objectClass
completionHandler:(void (^)(GTLServiceTicket *ticket, id object, NSError *error))handler GTL_NONNULL((1));
#endif
#pragma mark REST Fetch Methods
- (GTLServiceTicket *)fetchObjectWithURL:(NSURL *)objectURL
delegate:(id)delegate
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
- (GTLServiceTicket *)fetchObjectWithURL:(NSURL *)objectURL
objectClass:(Class)objectClass
delegate:(id)delegate
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
- (GTLServiceTicket *)fetchPublicObjectWithURL:(NSURL *)objectURL
objectClass:(Class)objectClass
delegate:(id)delegate
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
- (GTLServiceTicket *)fetchObjectByInsertingObject:(GTLObject *)bodyToPut
forURL:(NSURL *)destinationURL
delegate:(id)delegate
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1,2));
- (GTLServiceTicket *)fetchObjectByUpdatingObject:(GTLObject *)bodyToPut
forURL:(NSURL *)destinationURL
delegate:(id)delegate
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1,2));
- (GTLServiceTicket *)deleteResourceURL:(NSURL *)destinationURL
ETag:(NSString *)etagOrNil
delegate:(id)delegate
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
#if NS_BLOCKS_AVAILABLE
- (GTLServiceTicket *)fetchObjectWithURL:(NSURL *)objectURL
completionHandler:(void (^)(GTLServiceTicket *ticket, id object, NSError *error))handler GTL_NONNULL((1));
- (GTLServiceTicket *)fetchObjectByInsertingObject:(GTLObject *)bodyToPut
forURL:(NSURL *)destinationURL
completionHandler:(void (^)(GTLServiceTicket *ticket, id object, NSError *error))handler GTL_NONNULL((1));
- (GTLServiceTicket *)fetchObjectByUpdatingObject:(GTLObject *)bodyToPut
forURL:(NSURL *)destinationURL
completionHandler:(void (^)(GTLServiceTicket *ticket, id object, NSError *error))handler GTL_NONNULL((1));
- (GTLServiceTicket *)deleteResourceURL:(NSURL *)destinationURL
ETag:(NSString *)etagOrNil
completionHandler:(void (^)(GTLServiceTicket *ticket, id object, NSError *error))handler GTL_NONNULL((1));
#endif
#pragma mark User Properties
// Properties and userData are supported for client convenience.
//
// Property keys beginning with _ are reserved by the library.
//
// The service properties dictionary is copied to become the initial property
// dictionary for each ticket.
- (void)setServiceProperty:(id)obj forKey:(NSString *)key GTL_NONNULL((2)); // pass nil obj to remove property
- (id)servicePropertyForKey:(NSString *)key GTL_NONNULL((1));
@property (nonatomic, copy) NSDictionary *serviceProperties;
// The service userData becomes the initial value for each future ticket's
// userData.
@property (nonatomic, retain) id serviceUserData;
#pragma mark Request Settings
// Set the surrogates to be used for future tickets. Surrogates are subclasses
// to be used instead of standard classes when creating objects from the JSON.
// For example, this code will make the framework generate objects
// using MyCalendarItemSubclass instead of GTLItemCalendar and
// MyCalendarEventSubclass instead of GTLItemCalendarEvent.
//
// NSDictionary *surrogates = [NSDictionary dictionaryWithObjectsAndKeys:
// [MyCalendarEntrySubclass class], [GTLItemCalendar class],
// [MyCalendarEventSubclass class], [GTLItemCalendarEvent class],
// nil];
// [calendarService setServiceSurrogates:surrogates];
//
@property (nonatomic, retain) NSDictionary *surrogates;
// On iOS 4 and later, the fetch may optionally continue in the background
// until finished or stopped by OS expiration.
//
// The default value is NO.
//
// For Mac OS X, background fetches are always supported, and this property
// is ignored.
@property (nonatomic, assign) BOOL shouldFetchInBackground;
// Callbacks can be invoked on an operation queue rather than via the run loop
// starting on 10.7 and iOS 6. Do not specify both run loop modes and an
// operation queue. Specifying a delegate queue typically looks like this:
//
// service.delegateQueue = [[[NSOperationQueue alloc] init] autorelease];
//
// Since the callbacks will be on a thread of the operation queue, the client
// may re-dispatch from the callbacks to a known dispatch queue or to the
// main queue.
@property (nonatomic, retain) NSOperationQueue *delegateQueue;
// Run loop modes are used for scheduling NSURLConnections.
//
// The default value, nil, schedules connections using the current run
// loop mode. To use the service during a modal dialog, be sure to specify
// NSModalPanelRunLoopMode as one of the modes.
@property (nonatomic, retain) NSArray *runLoopModes;
// Applications needing an additional identifier in the server logs may specify
// one.
@property (nonatomic, copy) NSString *userAgentAddition;
// Applications have a default user-agent based on the application signature
// in the Info.plist settings. Most applications should not explicitly set
// this property.
@property (nonatomic, copy) NSString *userAgent;
// The request user agent includes the library and OS version appended to the
// base userAgent, along with the optional addition string.
@property (nonatomic, readonly) NSString *requestUserAgent;
// Applications may call requestForURL:httpMethod to get a request with the
// proper user-agent and ETag headers
//
// For http method, pass nil (for default GET method), POST, PUT, or DELETE
- (NSMutableURLRequest *)requestForURL:(NSURL *)url
ETag:(NSString *)etagOrNil
httpMethod:(NSString *)httpMethodOrNil GTL_NONNULL((1));
// objectRequestForURL returns an NSMutableURLRequest for a JSON GTL object
//
// The object is the object being sent to the server, or nil;
// the http method may be nil for GET, or POST, PUT, DELETE
- (NSMutableURLRequest *)objectRequestForURL:(NSURL *)url
object:(GTLObject *)object
ETag:(NSString *)etag
httpMethod:(NSString *)httpMethod
isREST:(BOOL)isREST
additionalHeaders:(NSDictionary *)additionalHeaders
ticket:(GTLServiceTicket *)ticket GTL_NONNULL((1));
// The queue used for parsing JSON responses (previously this property
// was called operationQueue)
@property (nonatomic, retain) NSOperationQueue *parseQueue;
// The fetcher service object issues the GTMHTTPFetcher instances
// for this API service
@property (nonatomic, retain) GTMHTTPFetcherService *fetcherService;
// Default storage for cookies is in the service object's fetchHistory.
//
// Apps that want to share cookies between all standalone fetchers and the
// service object may specify static application-wide cookie storage,
// kGTMHTTPFetcherCookieStorageMethodStatic.
@property (nonatomic, assign) NSInteger cookieStorageMethod;
// When sending REST style queries, should the payload be wrapped in a "data"
// element, and will the reply be wrapped in an "data" element.
@property (nonatomic, assign) BOOL isRESTDataWrapperRequired;
// Any url query parameters to add to urls (useful for debugging with some
// services).
@property (copy) NSDictionary *urlQueryParameters;
// Any extra http headers to set on requests for GTLObjects.
@property (copy) NSDictionary *additionalHTTPHeaders;
// The service API version.
@property (nonatomic, copy) NSString *apiVersion;
// The URL for sending RPC requests for this service.
@property (nonatomic, retain) NSURL *rpcURL;
// The URL for sending RPC requests which initiate file upload.
@property (nonatomic, retain) NSURL *rpcUploadURL;
// Set a non-zero value to enable uploading via chunked fetches
// (resumable uploads); typically this defaults to kGTLStandardUploadChunkSize
// for service subclasses that support chunked uploads
@property (nonatomic, assign) NSUInteger serviceUploadChunkSize;
// Service subclasses may specify their own default chunk size
+ (NSUInteger)defaultServiceUploadChunkSize;
// The service uploadProgressSelector becomes the initial value for each future
// ticket's uploadProgressSelector.
//
// The optional uploadProgressSelector will be called in the delegate as bytes
// are uploaded to the server. It should have a signature matching
//
// - (void)ticket:(GTLServiceTicket *)ticket
// hasDeliveredByteCount:(unsigned long long)numberOfBytesRead
// ofTotalByteCount:(unsigned long long)dataLength;
@property (nonatomic, assign) SEL uploadProgressSelector;
#if NS_BLOCKS_AVAILABLE
@property (copy) void (^uploadProgressBlock)(GTLServiceTicket *ticket, unsigned long long numberOfBytesRead, unsigned long long dataLength);
#endif
// Wait synchronously for fetch to complete (strongly discouraged)
//
// This just runs the current event loop until the fetch completes
// or the timout limit is reached. This may discard unexpected events
// that occur while spinning, so it's really not appropriate for use
// in serious applications.
//
// Returns true if an object was successfully fetched. If the wait
// timed out, returns false and the returned error is nil.
//
// The returned object or error, if any, will be already autoreleased
//
// This routine will likely be removed in some future releases of the library.
- (BOOL)waitForTicket:(GTLServiceTicket *)ticket
timeout:(NSTimeInterval)timeoutInSeconds
fetchedObject:(GTLObject **)outObjectOrNil
error:(NSError **)outErrorOrNil GTL_NONNULL((1));
@end
#pragma mark -
//
// Ticket base class
//
@interface GTLServiceTicket : NSObject {
GTLService *service_;
NSMutableDictionary *ticketProperties_;
NSDictionary *surrogates_;
GTMHTTPFetcher *objectFetcher_;
SEL uploadProgressSelector_;
BOOL shouldFetchNextPages_;
BOOL isRetryEnabled_;
SEL retrySelector_;
NSTimeInterval maxRetryInterval_;
#if NS_BLOCKS_AVAILABLE
BOOL (^retryBlock_)(GTLServiceTicket *, BOOL, NSError *);
void (^uploadProgressBlock_)(GTLServiceTicket *ticket,
unsigned long long numberOfBytesRead,
unsigned long long dataLength);
#elif !__LP64__
// Placeholders: for 32-bit builds, keep the size of the object's ivar section
// the same with and without blocks
id retryPlaceholder_;
id uploadProgressPlaceholder_;
#endif
GTLObject *postedObject_;
GTLObject *fetchedObject_;
id<GTLQueryProtocol> executingQuery_;
id<GTLQueryProtocol> originalQuery_;
NSError *fetchError_;
BOOL hasCalledCallback_;
NSUInteger pagesFetchedCounter_;
NSString *apiKey_;
BOOL isREST_;
NSOperation *parseOperation_;
}
+ (id)ticketForService:(GTLService *)service;
- (id)initWithService:(GTLService *)service;
- (id)service;
#pragma mark Execution Control
// if cancelTicket is called, the fetch is stopped if it is in progress,
// the callbacks will not be called, and the ticket will no longer be useful
// (though the client must still release the ticket if it retained the ticket)
- (void)cancelTicket;
// chunked upload tickets may be paused
- (void)pauseUpload;
- (void)resumeUpload;
- (BOOL)isUploadPaused;
@property (nonatomic, retain) GTMHTTPFetcher *objectFetcher;
@property (nonatomic, assign) SEL uploadProgressSelector;
// Services which do not require an user authorization may require a developer
// API key for quota management
@property (nonatomic, copy) NSString *APIKey;
#pragma mark User Properties
// Properties and userData are supported for client convenience.
//
// Property keys beginning with _ are reserved by the library.
- (void)setProperty:(id)obj forKey:(NSString *)key GTL_NONNULL((1)); // pass nil obj to remove property
- (id)propertyForKey:(NSString *)key;
@property (nonatomic, copy) NSDictionary *properties;
@property (nonatomic, retain) id userData;
#pragma mark Payload
@property (nonatomic, retain) GTLObject *postedObject;
@property (nonatomic, retain) GTLObject *fetchedObject;
@property (nonatomic, retain) id<GTLQueryProtocol> executingQuery; // Query currently being fetched by this ticket
@property (nonatomic, retain) id<GTLQueryProtocol> originalQuery; // Query used to create this ticket
- (GTLQuery *)queryForRequestID:(NSString *)requestID GTL_NONNULL((1)); // Returns the query from within the batch with the given id.
@property (nonatomic, retain) NSDictionary *surrogates;
#pragma mark Retry
@property (nonatomic, assign, getter=isRetryEnabled) BOOL retryEnabled;
@property (nonatomic, assign) SEL retrySelector;
#if NS_BLOCKS_AVAILABLE
@property (copy) BOOL (^retryBlock)(GTLServiceTicket *ticket, BOOL suggestedWillRetry, NSError *error);
#endif
@property (nonatomic, assign) NSTimeInterval maxRetryInterval;
#pragma mark Status
@property (nonatomic, readonly) NSInteger statusCode; // server status from object fetch
@property (nonatomic, retain) NSError *fetchError;
@property (nonatomic, assign) BOOL hasCalledCallback;
#pragma mark Pagination
@property (nonatomic, assign) BOOL shouldFetchNextPages;
@property (nonatomic, assign) NSUInteger pagesFetchedCounter;
#pragma mark Upload
#if NS_BLOCKS_AVAILABLE
@property (copy) void (^uploadProgressBlock)(GTLServiceTicket *ticket, unsigned long long numberOfBytesRead, unsigned long long dataLength);
#endif
@end
// Category to provide opaque access to tickets stored in fetcher properties
@interface GTMHTTPFetcher (GTLServiceTicketAdditions)
- (id)ticket;
@end

View File

@@ -0,0 +1,61 @@
/* Copyright (c) 2013 Google Inc.
*
* 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.
*/
//
// GTLServicePlus.h
//
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/api/
// Classes:
// GTLServicePlus (0 custom class methods, 0 custom properties)
#if GTL_BUILT_AS_FRAMEWORK
#import "GTL/GTLService.h"
#else
#import "GTLService.h"
#endif
@interface GTLServicePlus : GTLService
// No new methods
// Clients should create a standard query with any of the class methods in
// GTLQueryPlus.h. The query can the be sent with GTLService's execute methods,
//
// - (GTLServiceTicket *)executeQuery:(GTLQuery *)query
// completionHandler:(void (^)(GTLServiceTicket *ticket,
// id object, NSError *error))handler;
// or
// - (GTLServiceTicket *)executeQuery:(GTLQuery *)query
// delegate:(id)delegate
// didFinishSelector:(SEL)finishedSelector;
//
// where finishedSelector has a signature of:
//
// - (void)serviceTicket:(GTLServiceTicket *)ticket
// finishedWithObject:(id)object
// error:(NSError *)error;
//
// The object passed to the completion handler or delegate method
// is a subclass of GTLObject, determined by the query method executed.
@end

View File

@@ -0,0 +1,58 @@
//
// Makes the value of GTL_TARGET_NAMESPACE a prefix for all GTL
// library class names
//
//
// To avoid global namespace issues, define GTL_TARGET_NAMESPACE to a short
// string in your target if you are using the GTL library in a shared-code
// environment like a plug-in.
//
// For example: -DGTL_TARGET_NAMESPACE=MyPlugin
//
//
// com.google.GTLFramework v. 2.0 (29 classes) 2011-10-25 19:25:36 -0700
//
#if defined(__OBJC__) && defined(GTL_TARGET_NAMESPACE)
#define _GTL_NS_SYMBOL_INNER(ns, symbol) ns ## _ ## symbol
#define _GTL_NS_SYMBOL_MIDDLE(ns, symbol) _GTL_NS_SYMBOL_INNER(ns, symbol)
#define _GTL_NS_SYMBOL(symbol) _GTL_NS_SYMBOL_MIDDLE(GTL_TARGET_NAMESPACE, symbol)
#define _GTL_NS_STRING_INNER(ns) #ns
#define _GTL_NS_STRING_MIDDLE(ns) _GTL_NS_STRING_INNER(ns)
#define GTL_TARGET_NAMESPACE_STRING _GTL_NS_STRING_MIDDLE(GTL_TARGET_NAMESPACE)
#define GTLBatchQuery _GTL_NS_SYMBOL(GTLBatchQuery)
#define GTLBatchResult _GTL_NS_SYMBOL(GTLBatchResult)
#define GTLCollectionObject _GTL_NS_SYMBOL(GTLCollectionObject)
#define GTLDateTime _GTL_NS_SYMBOL(GTLDateTime)
#define GTLErrorObject _GTL_NS_SYMBOL(GTLErrorObject)
#define GTLErrorObjectData _GTL_NS_SYMBOL(GTLErrorObjectData)
#define GTLJSONParser _GTL_NS_SYMBOL(GTLJSONParser)
#define GTLObject _GTL_NS_SYMBOL(GTLObject)
#define GTLQuery _GTL_NS_SYMBOL(GTLQuery)
#define GTLRuntimeCommon _GTL_NS_SYMBOL(GTLRuntimeCommon)
#define GTLService _GTL_NS_SYMBOL(GTLService)
#define GTLServiceTicket _GTL_NS_SYMBOL(GTLServiceTicket)
#define GTLUploadParameters _GTL_NS_SYMBOL(GTLUploadParameters)
#define GTLUtilities _GTL_NS_SYMBOL(GTLUtilities)
#define GTMCachedURLResponse _GTL_NS_SYMBOL(GTMCachedURLResponse)
#define GTMCookieStorage _GTL_NS_SYMBOL(GTMCookieStorage)
#define GTMGatherInputStream _GTL_NS_SYMBOL(GTMGatherInputStream)
#define GTMHTTPFetcher _GTL_NS_SYMBOL(GTMHTTPFetcher)
#define GTMHTTPFetcherService _GTL_NS_SYMBOL(GTMHTTPFetcherService)
#define GTMHTTPFetchHistory _GTL_NS_SYMBOL(GTMHTTPFetchHistory)
#define GTMHTTPUploadFetcher _GTL_NS_SYMBOL(GTMHTTPUploadFetcher)
#define GTMMIMEDocument _GTL_NS_SYMBOL(GTMMIMEDocument)
#define GTMMIMEPart _GTL_NS_SYMBOL(GTMMIMEPart)
#define GTMOAuth2Authentication _GTL_NS_SYMBOL(GTMOAuth2Authentication)
#define GTMOAuth2AuthorizationArgs _GTL_NS_SYMBOL(GTMOAuth2AuthorizationArgs)
#define GTMOAuth2SignIn _GTL_NS_SYMBOL(GTMOAuth2SignIn)
#define GTMOAuth2WindowController _GTL_NS_SYMBOL(GTMOAuth2WindowController)
#define GTMReadMonitorInputStream _GTL_NS_SYMBOL(GTMReadMonitorInputStream)
#define GTMURLCache _GTL_NS_SYMBOL(GTMURLCache)
#endif

View File

@@ -0,0 +1,60 @@
/* Copyright (c) 2011 Google Inc.
*
* 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.
*/
//
// GTLUploadParameters.h
//
// Uploading documentation:
// https://code.google.com/p/google-api-objectivec-client/wiki/Introduction#Uploading_Files
#import <Foundation/Foundation.h>
#import "GTLDefines.h"
@interface GTLUploadParameters : NSObject <NSCopying> {
@private
NSString *MIMEType_;
NSData *data_;
NSFileHandle *fileHandle_;
NSURL *uploadLocationURL_;
NSString *slug_;
BOOL shouldSendUploadOnly_;
}
// Uploading requires MIME type and one of
// - data to be uploaded
// - file handle for uploading
@property (copy) NSString *MIMEType;
@property (retain) NSData *data;
@property (retain) NSFileHandle *fileHandle;
// Resuming an in-progress upload is done with the upload location URL,
// and requires a file handle for uploading
@property (retain) NSURL *uploadLocationURL;
// Some services need a slug (filename) header
@property (copy) NSString *slug;
// Uploads may be done without a JSON body in the initial request
@property (assign) BOOL shouldSendUploadOnly;
+ (GTLUploadParameters *)uploadParametersWithData:(NSData *)data
MIMEType:(NSString *)mimeType GTL_NONNULL((1,2));
+ (GTLUploadParameters *)uploadParametersWithFileHandle:(NSFileHandle *)fileHandle
MIMEType:(NSString *)mimeType GTL_NONNULL((1,2));
@end

View File

@@ -0,0 +1,93 @@
/* Copyright (c) 2011 Google Inc.
*
* 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.
*/
#import <Foundation/Foundation.h>
#ifndef SKIP_GTL_DEFINES
#import "GTLDefines.h"
#endif
// helper functions for implementing isEqual:
BOOL GTL_AreEqualOrBothNil(id obj1, id obj2);
BOOL GTL_AreBoolsEqual(BOOL b1, BOOL b2);
// Helper to ensure a number is a number.
//
// The GoogleAPI servers will send numbers >53 bits as strings to avoid
// bugs in some JavaScript implementations. Work around this by catching
// the string and turning it back into a number.
NSNumber *GTL_EnsureNSNumber(NSNumber *num);
@interface GTLUtilities : NSObject
//
// String encoding
//
// URL encoding, different for parts of URLs and parts of URL parameters
//
// +stringByURLEncodingString just makes a string legal for a URL
//
// +stringByURLEncodingForURI also encodes some characters that are legal in
// URLs but should not be used in URIs,
// per http://bitworking.org/projects/atom/rfc5023.html#rfc.section.9.7
//
// +stringByURLEncodingStringParameter is like +stringByURLEncodingForURI but
// replaces space characters with + characters rather than percent-escaping them
//
+ (NSString *)stringByURLEncodingString:(NSString *)str;
+ (NSString *)stringByURLEncodingForURI:(NSString *)str;
+ (NSString *)stringByURLEncodingStringParameter:(NSString *)str;
// Percent-encoded UTF-8
+ (NSString *)stringByPercentEncodingUTF8ForString:(NSString *)str;
// Key-value coding searches in an array
//
// Utilities to get from an array objects having a known value (or nil)
// at a keyPath
+ (NSArray *)objectsFromArray:(NSArray *)sourceArray
withValue:(id)desiredValue
forKeyPath:(NSString *)keyPath;
+ (id)firstObjectFromArray:(NSArray *)sourceArray
withValue:(id)desiredValue
forKeyPath:(NSString *)keyPath;
//
// Version helpers
//
+ (NSComparisonResult)compareVersion:(NSString *)ver1 toVersion:(NSString *)ver2;
//
// URL builder
//
// If there are already query parameters on urlString, the new ones are simple
// appended after them.
+ (NSURL *)URLWithString:(NSString *)urlString
queryParameters:(NSDictionary *)queryParameters;
// Allocate a global dictionary
+ (NSMutableDictionary *)newStaticDictionary;
// Walk up the class tree merging dictionaries and return the result.
+ (NSDictionary *)mergedClassDictionaryForSelector:(SEL)selector
startClass:(Class)startClass
ancestorClass:(Class)ancestorClass
cache:(NSMutableDictionary *)cache;
@end

View File

@@ -0,0 +1,441 @@
//
// GTMDefines.h
//
// Copyright 2008 Google Inc.
//
// 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 <AvailabilityMacros.h>
#include <TargetConditionals.h>
#ifdef __OBJC__
#include <Foundation/NSObjCRuntime.h>
#endif // __OBJC__
#if TARGET_OS_IPHONE
#include <Availability.h>
#endif // TARGET_OS_IPHONE
// Not all MAC_OS_X_VERSION_10_X macros defined in past SDKs
#ifndef MAC_OS_X_VERSION_10_5
#define MAC_OS_X_VERSION_10_5 1050
#endif
#ifndef MAC_OS_X_VERSION_10_6
#define MAC_OS_X_VERSION_10_6 1060
#endif
#ifndef MAC_OS_X_VERSION_10_7
#define MAC_OS_X_VERSION_10_7 1070
#endif
// Not all __IPHONE_X macros defined in past SDKs
#ifndef __IPHONE_3_0
#define __IPHONE_3_0 30000
#endif
#ifndef __IPHONE_3_1
#define __IPHONE_3_1 30100
#endif
#ifndef __IPHONE_3_2
#define __IPHONE_3_2 30200
#endif
#ifndef __IPHONE_4_0
#define __IPHONE_4_0 40000
#endif
#ifndef __IPHONE_4_3
#define __IPHONE_4_3 40300
#endif
#ifndef __IPHONE_5_0
#define __IPHONE_5_0 50000
#endif
// ----------------------------------------------------------------------------
// CPP symbols that can be overridden in a prefix to control how the toolbox
// is compiled.
// ----------------------------------------------------------------------------
// By setting the GTM_CONTAINERS_VALIDATION_FAILED_LOG and
// GTM_CONTAINERS_VALIDATION_FAILED_ASSERT macros you can control what happens
// when a validation fails. If you implement your own validators, you may want
// to control their internals using the same macros for consistency.
#ifndef GTM_CONTAINERS_VALIDATION_FAILED_ASSERT
#define GTM_CONTAINERS_VALIDATION_FAILED_ASSERT 0
#endif
// Give ourselves a consistent way to do inlines. Apple's macros even use
// a few different actual definitions, so we're based off of the foundation
// one.
#if !defined(GTM_INLINE)
#if (defined (__GNUC__) && (__GNUC__ == 4)) || defined (__clang__)
#define GTM_INLINE static __inline__ __attribute__((always_inline))
#else
#define GTM_INLINE static __inline__
#endif
#endif
// Give ourselves a consistent way of doing externs that links up nicely
// when mixing objc and objc++
#if !defined (GTM_EXTERN)
#if defined __cplusplus
#define GTM_EXTERN extern "C"
#define GTM_EXTERN_C_BEGIN extern "C" {
#define GTM_EXTERN_C_END }
#else
#define GTM_EXTERN extern
#define GTM_EXTERN_C_BEGIN
#define GTM_EXTERN_C_END
#endif
#endif
// Give ourselves a consistent way of exporting things if we have visibility
// set to hidden.
#if !defined (GTM_EXPORT)
#define GTM_EXPORT __attribute__((visibility("default")))
#endif
// Give ourselves a consistent way of declaring something as unused. This
// doesn't use __unused because that is only supported in gcc 4.2 and greater.
#if !defined (GTM_UNUSED)
#define GTM_UNUSED(x) ((void)(x))
#endif
// _GTMDevLog & _GTMDevAssert
//
// _GTMDevLog & _GTMDevAssert are meant to be a very lightweight shell for
// developer level errors. This implementation simply macros to NSLog/NSAssert.
// It is not intended to be a general logging/reporting system.
//
// Please see http://code.google.com/p/google-toolbox-for-mac/wiki/DevLogNAssert
// for a little more background on the usage of these macros.
//
// _GTMDevLog log some error/problem in debug builds
// _GTMDevAssert assert if conditon isn't met w/in a method/function
// in all builds.
//
// To replace this system, just provide different macro definitions in your
// prefix header. Remember, any implementation you provide *must* be thread
// safe since this could be called by anything in what ever situtation it has
// been placed in.
//
// We only define the simple macros if nothing else has defined this.
#ifndef _GTMDevLog
#ifdef DEBUG
#define _GTMDevLog(...) NSLog(__VA_ARGS__)
#else
#define _GTMDevLog(...) do { } while (0)
#endif
#endif // _GTMDevLog
#ifndef _GTMDevAssert
// we directly invoke the NSAssert handler so we can pass on the varargs
// (NSAssert doesn't have a macro we can use that takes varargs)
#if !defined(NS_BLOCK_ASSERTIONS)
#define _GTMDevAssert(condition, ...) \
do { \
if (!(condition)) { \
[[NSAssertionHandler currentHandler] \
handleFailureInFunction:[NSString stringWithUTF8String:__PRETTY_FUNCTION__] \
file:[NSString stringWithUTF8String:__FILE__] \
lineNumber:__LINE__ \
description:__VA_ARGS__]; \
} \
} while(0)
#else // !defined(NS_BLOCK_ASSERTIONS)
#define _GTMDevAssert(condition, ...) do { } while (0)
#endif // !defined(NS_BLOCK_ASSERTIONS)
#endif // _GTMDevAssert
// _GTMCompileAssert
// _GTMCompileAssert is an assert that is meant to fire at compile time if you
// want to check things at compile instead of runtime. For example if you
// want to check that a wchar is 4 bytes instead of 2 you would use
// _GTMCompileAssert(sizeof(wchar_t) == 4, wchar_t_is_4_bytes_on_OS_X)
// Note that the second "arg" is not in quotes, and must be a valid processor
// symbol in it's own right (no spaces, punctuation etc).
// Wrapping this in an #ifndef allows external groups to define their own
// compile time assert scheme.
#ifndef _GTMCompileAssert
// We got this technique from here:
// http://unixjunkie.blogspot.com/2007/10/better-compile-time-asserts_29.html
#define _GTMCompileAssertSymbolInner(line, msg) _GTMCOMPILEASSERT ## line ## __ ## msg
#define _GTMCompileAssertSymbol(line, msg) _GTMCompileAssertSymbolInner(line, msg)
#define _GTMCompileAssert(test, msg) \
typedef char _GTMCompileAssertSymbol(__LINE__, msg) [ ((test) ? 1 : -1) ]
#endif // _GTMCompileAssert
// ----------------------------------------------------------------------------
// CPP symbols defined based on the project settings so the GTM code has
// simple things to test against w/o scattering the knowledge of project
// setting through all the code.
// ----------------------------------------------------------------------------
// Provide a single constant CPP symbol that all of GTM uses for ifdefing
// iPhone code.
#if TARGET_OS_IPHONE // iPhone SDK
// For iPhone specific stuff
#define GTM_IPHONE_SDK 1
#if TARGET_IPHONE_SIMULATOR
#define GTM_IPHONE_SIMULATOR 1
#else
#define GTM_IPHONE_DEVICE 1
#endif // TARGET_IPHONE_SIMULATOR
// By default, GTM has provided it's own unittesting support, define this
// to use the support provided by Xcode, especially for the Xcode4 support
// for unittesting.
#ifndef GTM_IPHONE_USE_SENTEST
#define GTM_IPHONE_USE_SENTEST 0
#endif
#else
// For MacOS specific stuff
#define GTM_MACOS_SDK 1
#endif
// Some of our own availability macros
#if GTM_MACOS_SDK
#define GTM_AVAILABLE_ONLY_ON_IPHONE UNAVAILABLE_ATTRIBUTE
#define GTM_AVAILABLE_ONLY_ON_MACOS
#else
#define GTM_AVAILABLE_ONLY_ON_IPHONE
#define GTM_AVAILABLE_ONLY_ON_MACOS UNAVAILABLE_ATTRIBUTE
#endif
// GC was dropped by Apple, define the old constant incase anyone still keys
// off of it.
#ifndef GTM_SUPPORT_GC
#define GTM_SUPPORT_GC 0
#endif
// To simplify support for 64bit (and Leopard in general), we provide the type
// defines for non Leopard SDKs
#if !(MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
// NSInteger/NSUInteger and Max/Mins
#ifndef NSINTEGER_DEFINED
#if __LP64__ || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif
#define NSIntegerMax LONG_MAX
#define NSIntegerMin LONG_MIN
#define NSUIntegerMax ULONG_MAX
#define NSINTEGER_DEFINED 1
#endif // NSINTEGER_DEFINED
// CGFloat
#ifndef CGFLOAT_DEFINED
#if defined(__LP64__) && __LP64__
// This really is an untested path (64bit on Tiger?)
typedef double CGFloat;
#define CGFLOAT_MIN DBL_MIN
#define CGFLOAT_MAX DBL_MAX
#define CGFLOAT_IS_DOUBLE 1
#else /* !defined(__LP64__) || !__LP64__ */
typedef float CGFloat;
#define CGFLOAT_MIN FLT_MIN
#define CGFLOAT_MAX FLT_MAX
#define CGFLOAT_IS_DOUBLE 0
#endif /* !defined(__LP64__) || !__LP64__ */
#define CGFLOAT_DEFINED 1
#endif // CGFLOAT_DEFINED
#endif // MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
// Some support for advanced clang static analysis functionality
// See http://clang-analyzer.llvm.org/annotations.html
#ifndef __has_feature // Optional.
#define __has_feature(x) 0 // Compatibility with non-clang compilers.
#endif
#ifndef NS_RETURNS_RETAINED
#if __has_feature(attribute_ns_returns_retained)
#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained))
#else
#define NS_RETURNS_RETAINED
#endif
#endif
#ifndef NS_RETURNS_NOT_RETAINED
#if __has_feature(attribute_ns_returns_not_retained)
#define NS_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained))
#else
#define NS_RETURNS_NOT_RETAINED
#endif
#endif
#ifndef CF_RETURNS_RETAINED
#if __has_feature(attribute_cf_returns_retained)
#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained))
#else
#define CF_RETURNS_RETAINED
#endif
#endif
#ifndef CF_RETURNS_NOT_RETAINED
#if __has_feature(attribute_cf_returns_not_retained)
#define CF_RETURNS_NOT_RETAINED __attribute__((cf_returns_not_retained))
#else
#define CF_RETURNS_NOT_RETAINED
#endif
#endif
#ifndef NS_CONSUMED
#if __has_feature(attribute_ns_consumed)
#define NS_CONSUMED __attribute__((ns_consumed))
#else
#define NS_CONSUMED
#endif
#endif
#ifndef CF_CONSUMED
#if __has_feature(attribute_cf_consumed)
#define CF_CONSUMED __attribute__((cf_consumed))
#else
#define CF_CONSUMED
#endif
#endif
#ifndef NS_CONSUMES_SELF
#if __has_feature(attribute_ns_consumes_self)
#define NS_CONSUMES_SELF __attribute__((ns_consumes_self))
#else
#define NS_CONSUMES_SELF
#endif
#endif
// Defined on 10.6 and above.
#ifndef NS_FORMAT_ARGUMENT
#define NS_FORMAT_ARGUMENT(A)
#endif
// Defined on 10.6 and above.
#ifndef NS_FORMAT_FUNCTION
#define NS_FORMAT_FUNCTION(F,A)
#endif
// Defined on 10.6 and above.
#ifndef CF_FORMAT_ARGUMENT
#define CF_FORMAT_ARGUMENT(A)
#endif
// Defined on 10.6 and above.
#ifndef CF_FORMAT_FUNCTION
#define CF_FORMAT_FUNCTION(F,A)
#endif
#ifndef GTM_NONNULL
#if defined(__has_attribute)
#if __has_attribute(nonnull)
#define GTM_NONNULL(x) __attribute__((nonnull x))
#else
#define GTM_NONNULL(x)
#endif
#else
#define GTM_NONNULL(x)
#endif
#endif
// Invalidates the initializer from which it's called.
#ifndef GTMInvalidateInitializer
#if __has_feature(objc_arc)
#define GTMInvalidateInitializer() \
do { \
[self class]; /* Avoid warning of dead store to |self|. */ \
_GTMDevAssert(NO, @"Invalid initializer."); \
return nil; \
} while (0)
#else
#define GTMInvalidateInitializer() \
do { \
[self release]; \
_GTMDevAssert(NO, @"Invalid initializer."); \
return nil; \
} while (0)
#endif
#endif
#ifdef __OBJC__
// Declared here so that it can easily be used for logging tracking if
// necessary. See GTMUnitTestDevLog.h for details.
@class NSString;
GTM_EXTERN void _GTMUnitTestDevLog(NSString *format, ...) NS_FORMAT_FUNCTION(1, 2);
// Macro to allow you to create NSStrings out of other macros.
// #define FOO foo
// NSString *fooString = GTM_NSSTRINGIFY(FOO);
#if !defined (GTM_NSSTRINGIFY)
#define GTM_NSSTRINGIFY_INNER(x) @#x
#define GTM_NSSTRINGIFY(x) GTM_NSSTRINGIFY_INNER(x)
#endif
// Macro to allow fast enumeration when building for 10.5 or later, and
// reliance on NSEnumerator for 10.4. Remember, NSDictionary w/ FastEnumeration
// does keys, so pick the right thing, nothing is done on the FastEnumeration
// side to be sure you're getting what you wanted.
#ifndef GTM_FOREACH_OBJECT
#if TARGET_OS_IPHONE || !(MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
#define GTM_FOREACH_ENUMEREE(element, enumeration) \
for (element in enumeration)
#define GTM_FOREACH_OBJECT(element, collection) \
for (element in collection)
#define GTM_FOREACH_KEY(element, collection) \
for (element in collection)
#else
#define GTM_FOREACH_ENUMEREE(element, enumeration) \
for (NSEnumerator *_ ## element ## _enum = enumeration; \
(element = [_ ## element ## _enum nextObject]) != nil; )
#define GTM_FOREACH_OBJECT(element, collection) \
GTM_FOREACH_ENUMEREE(element, [collection objectEnumerator])
#define GTM_FOREACH_KEY(element, collection) \
GTM_FOREACH_ENUMEREE(element, [collection keyEnumerator])
#endif
#endif
// ============================================================================
// To simplify support for both Leopard and Snow Leopard we declare
// the Snow Leopard protocols that we need here.
#if !defined(GTM_10_6_PROTOCOLS_DEFINED) && !(MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
#define GTM_10_6_PROTOCOLS_DEFINED 1
@protocol NSConnectionDelegate
@end
@protocol NSAnimationDelegate
@end
@protocol NSImageDelegate
@end
@protocol NSTabViewDelegate
@end
#endif // !defined(GTM_10_6_PROTOCOLS_DEFINED) && !(MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
// GTM_SEL_STRING is for specifying selector (usually property) names to KVC
// or KVO methods.
// In debug it will generate warnings for undeclared selectors if
// -Wunknown-selector is turned on.
// In release it will have no runtime overhead.
#ifndef GTM_SEL_STRING
#ifdef DEBUG
#define GTM_SEL_STRING(selName) NSStringFromSelector(@selector(selName))
#else
#define GTM_SEL_STRING(selName) @#selName
#endif // DEBUG
#endif // GTM_SEL_STRING
#endif // __OBJC__

View File

@@ -0,0 +1,72 @@
//
// GTMGarbageCollection.h
//
// Copyright 2007-2008 Google Inc.
//
// 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.
//
#import <Foundation/Foundation.h>
#import "GTMDefines.h"
// This allows us to easily move our code from GC to non GC.
// They are no-ops unless we are require Leopard or above.
// See
// http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/index.html
// and
// http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcCoreFoundation.html#//apple_ref/doc/uid/TP40006687-SW1
// for details.
#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) && !GTM_IPHONE_SDK
// General use would be to call this through GTMCFAutorelease
// but there may be a reason the you want to make something collectable
// but not autoreleased, especially in pure GC code where you don't
// want to bother with the nop autorelease. Done as a define instead of an
// inline so that tools like Clang's scan-build don't report code as leaking.
#define GTMNSMakeCollectable(cf) ((id)NSMakeCollectable(cf))
// GTMNSMakeUncollectable is for global maps, etc. that we don't
// want released ever. You should still retain these in non-gc code.
GTM_INLINE void GTMNSMakeUncollectable(id object) {
[[NSGarbageCollector defaultCollector] disableCollectorForPointer:object];
}
// Hopefully no code really needs this, but GTMIsGarbageCollectionEnabled is
// a common way to check at runtime if GC is on.
// There are some places where GC doesn't work w/ things w/in Apple's
// frameworks, so this is here so GTM unittests and detect it, and not run
// individual tests to work around bugs in Apple's frameworks.
GTM_INLINE BOOL GTMIsGarbageCollectionEnabled(void) {
return ([NSGarbageCollector defaultCollector] != nil);
}
#else
#define GTMNSMakeCollectable(cf) ((id)(cf))
GTM_INLINE void GTMNSMakeUncollectable(id object) {
}
GTM_INLINE BOOL GTMIsGarbageCollectionEnabled(void) {
return NO;
}
#endif
// GTMCFAutorelease makes a CF object collectable in GC mode, or adds it
// to the autorelease pool in non-GC mode. Either way it is taken care
// of. Done as a define instead of an inline so that tools like Clang's
// scan-build don't report code as leaking.
#define GTMCFAutorelease(cf) ([GTMNSMakeCollectable(cf) autorelease])

View File

@@ -0,0 +1,187 @@
/* Copyright (c) 2011 Google Inc.
*
* 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.
*/
//
// GTMHTTPFetchHistory.h
//
//
// Users of the GTMHTTPFetcher class may optionally create and set a fetch
// history object. The fetch history provides "memory" between subsequent
// fetches, including:
//
// - For fetch responses with Etag headers, the fetch history
// remembers the response headers. Future fetcher requests to the same URL
// will be given an "If-None-Match" header, telling the server to return
// a 304 Not Modified status if the response is unchanged, reducing the
// server load and network traffic.
//
// - Optionally, the fetch history can cache the ETagged data that was returned
// in the responses that contained Etag headers. If a later fetch
// results in a 304 status, the fetcher will return the cached ETagged data
// to the client along with a 200 status, hiding the 304.
//
// - The fetch history can track cookies.
//
#pragma once
#import <Foundation/Foundation.h>
#import "GTMHTTPFetcher.h"
#undef _EXTERN
#undef _INITIALIZE_AS
#ifdef GTMHTTPFETCHHISTORY_DEFINE_GLOBALS
#define _EXTERN
#define _INITIALIZE_AS(x) =x
#else
#if defined(__cplusplus)
#define _EXTERN extern "C"
#else
#define _EXTERN extern
#endif
#define _INITIALIZE_AS(x)
#endif
// default data cache size for when we're caching responses to handle "not
// modified" errors for the client
#if GTM_IPHONE
// iPhone: up to 1MB memory
_EXTERN const NSUInteger kGTMDefaultETaggedDataCacheMemoryCapacity _INITIALIZE_AS(1*1024*1024);
#else
// Mac OS X: up to 15MB memory
_EXTERN const NSUInteger kGTMDefaultETaggedDataCacheMemoryCapacity _INITIALIZE_AS(15*1024*1024);
#endif
// forward declarations
@class GTMURLCache;
@class GTMCookieStorage;
@interface GTMHTTPFetchHistory : NSObject <GTMHTTPFetchHistoryProtocol> {
@private
GTMURLCache *etaggedDataCache_;
BOOL shouldRememberETags_;
BOOL shouldCacheETaggedData_; // if NO, then only headers are cached
GTMCookieStorage *cookieStorage_;
}
// With caching enabled, previously-cached data will be returned instead of
// 304 Not Modified responses when repeating a fetch of an URL that previously
// included an ETag header in its response
@property (assign) BOOL shouldRememberETags; // default: NO
@property (assign) BOOL shouldCacheETaggedData; // default: NO
// the default ETag data cache capacity is kGTMDefaultETaggedDataCacheMemoryCapacity
@property (assign) NSUInteger memoryCapacity;
@property (retain) GTMCookieStorage *cookieStorage;
- (id)initWithMemoryCapacity:(NSUInteger)totalBytes
shouldCacheETaggedData:(BOOL)shouldCacheETaggedData;
- (void)updateRequest:(NSMutableURLRequest *)request isHTTPGet:(BOOL)isHTTPGet;
- (void)clearETaggedDataCache;
- (void)clearHistory;
- (void)removeAllCookies;
@end
// GTMURLCache and GTMCachedURLResponse have interfaces similar to their
// NSURLCache counterparts, in hopes that someday the NSURLCache versions
// can be used. But in 10.5.8, those are not reliable enough except when
// used with +setSharedURLCache. Our goal here is just to cache
// responses for handling If-None-Match requests that return
// "Not Modified" responses, not for replacing the general URL
// caches.
@interface GTMCachedURLResponse : NSObject {
@private
NSURLResponse *response_;
NSData *data_;
NSDate *useDate_; // date this response was last saved or used
NSDate *reservationDate_; // date this response's ETag was used
}
@property (readonly) NSURLResponse* response;
@property (readonly) NSData* data;
// date the response was saved or last accessed
@property (retain) NSDate *useDate;
// date the response's ETag header was last used for a fetch request
@property (retain) NSDate *reservationDate;
- (id)initWithResponse:(NSURLResponse *)response data:(NSData *)data;
@end
@interface GTMURLCache : NSObject {
NSMutableDictionary *responses_; // maps request URL to GTMCachedURLResponse
NSUInteger memoryCapacity_; // capacity of NSDatas in the responses
NSUInteger totalDataSize_; // sum of sizes of NSDatas of all responses
NSTimeInterval reservationInterval_; // reservation expiration interval
}
@property (assign) NSUInteger memoryCapacity;
- (id)initWithMemoryCapacity:(NSUInteger)totalBytes;
- (GTMCachedURLResponse *)cachedResponseForRequest:(NSURLRequest *)request;
- (void)storeCachedResponse:(GTMCachedURLResponse *)cachedResponse forRequest:(NSURLRequest *)request;
- (void)removeCachedResponseForRequest:(NSURLRequest *)request;
- (void)removeAllCachedResponses;
// for unit testing
- (void)setReservationInterval:(NSTimeInterval)secs;
- (NSDictionary *)responses;
- (NSUInteger)totalDataSize;
@end
@interface GTMCookieStorage : NSObject <GTMCookieStorageProtocol> {
@private
// The cookie storage object manages an array holding cookies, but the array
// is allocated externally (it may be in a fetcher object or the static
// fetcher cookie array.) See the fetcher's setCookieStorageMethod:
// for allocation of this object and assignment of its cookies array.
NSMutableArray *cookies_;
}
// add all NSHTTPCookies in the supplied array to the storage array,
// replacing cookies in the storage array as appropriate
// Side effect: removes expired cookies from the storage array
- (void)setCookies:(NSArray *)newCookies;
// retrieve all cookies appropriate for the given URL, considering
// domain, path, cookie name, expiration, security setting.
// Side effect: removes expired cookies from the storage array
- (NSArray *)cookiesForURL:(NSURL *)theURL;
// return a cookie with the same name, domain, and path as the
// given cookie, or else return nil if none found
//
// Both the cookie being tested and all stored cookies should
// be valid (non-nil name, domains, paths)
- (NSHTTPCookie *)cookieMatchingCookie:(NSHTTPCookie *)cookie;
// remove any expired cookies, excluding cookies with nil expirations
- (void)removeExpiredCookies;
- (void)removeAllCookies;
@end

View File

@@ -0,0 +1,765 @@
/* Copyright (c) 2011 Google Inc.
*
* 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.
*/
//
// GTMHTTPFetcher.h
//
// This is essentially a wrapper around NSURLConnection for POSTs and GETs.
// If setPostData: is called, then POST is assumed.
//
// When would you use this instead of NSURLConnection?
//
// - When you just want the result from a GET, POST, or PUT
// - When you want the "standard" behavior for connections (redirection handling
// an so on)
// - When you want automatic retry on failures
// - When you want to avoid cookie collisions with Safari and other applications
// - When you are fetching resources with ETags and want to avoid the overhead
// of repeated fetches of unchanged data
// - When you need to set a credential for the http operation
//
// This is assumed to be a one-shot fetch request; don't reuse the object
// for a second fetch.
//
// The fetcher may be created auto-released, in which case it will release
// itself after the fetch completion callback. The fetcher is implicitly
// retained as long as a connection is pending.
//
// But if you may need to cancel the fetcher, retain it and have the delegate
// release the fetcher in the callbacks.
//
// Sample usage:
//
// NSURLRequest *request = [NSURLRequest requestWithURL:myURL];
// GTMHTTPFetcher* myFetcher = [GTMHTTPFetcher fetcherWithRequest:request];
//
// // optional upload body data
// [myFetcher setPostData:[postString dataUsingEncoding:NSUTF8StringEncoding]];
//
// [myFetcher beginFetchWithDelegate:self
// didFinishSelector:@selector(myFetcher:finishedWithData:error:)];
//
// Upon fetch completion, the callback selector is invoked; it should have
// this signature (you can use any callback method name you want so long as
// the signature matches this):
//
// - (void)myFetcher:(GTMHTTPFetcher *)fetcher finishedWithData:(NSData *)retrievedData error:(NSError *)error;
//
// The block callback version looks like:
//
// [myFetcher beginFetchWithCompletionHandler:^(NSData *retrievedData, NSError *error) {
// if (error != nil) {
// // status code or network error
// } else {
// // succeeded
// }
// }];
//
// NOTE: Fetches may retrieve data from the server even though the server
// returned an error. The failure selector is called when the server
// status is >= 300, with an NSError having domain
// kGTMHTTPFetcherStatusDomain and code set to the server status.
//
// Status codes are at <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html>
//
//
// Threading and queue support:
//
// Callbacks require either that the thread used to start the fetcher have a run
// loop spinning (typically the main thread), or that an NSOperationQueue be
// provided upon which the delegate callbacks will be called. Starting with
// iOS 6 and Mac OS X 10.7, clients may simply create an operation queue for
// callbacks on a background thread:
//
// NSOperationQueue *queue = [[[NSOperationQueue alloc] init] autorelease];
// [queue setMaxConcurrentOperationCount:1];
// fetcher.delegateQueue = queue;
//
// or specify the main queue for callbacks on the main thread:
//
// fetcher.delegateQueue = [NSOperationQueue mainQueue];
//
// The client may also re-dispatch from the callbacks and notifications to
// a known dispatch queue:
//
// [myFetcher beginFetchWithCompletionHandler:^(NSData *retrievedData, NSError *error) {
// if (error == nil) {
// dispatch_async(myDispatchQueue, ^{
// ...
// });
// }
// }];
//
//
//
// Downloading to disk:
//
// To have downloaded data saved directly to disk, specify either a path for the
// downloadPath property, or a file handle for the downloadFileHandle property.
// When downloading to disk, callbacks will be passed a nil for the NSData*
// arguments.
//
//
// HTTP methods and headers:
//
// Alternative HTTP methods, like PUT, and custom headers can be specified by
// creating the fetcher with an appropriate NSMutableURLRequest
//
//
// Proxies:
//
// Proxy handling is invisible so long as the system has a valid credential in
// the keychain, which is normally true (else most NSURL-based apps would have
// difficulty.) But when there is a proxy authetication error, the the fetcher
// will call the failedWithError: method with the NSURLChallenge in the error's
// userInfo. The error method can get the challenge info like this:
//
// NSURLAuthenticationChallenge *challenge
// = [[error userInfo] objectForKey:kGTMHTTPFetcherErrorChallengeKey];
// BOOL isProxyChallenge = [[challenge protectionSpace] isProxy];
//
// If a proxy error occurs, you can ask the user for the proxy username/password
// and call fetcher's setProxyCredential: to provide those for the
// next attempt to fetch.
//
//
// Cookies:
//
// There are three supported mechanisms for remembering cookies between fetches.
//
// By default, GTMHTTPFetcher uses a mutable array held statically to track
// cookies for all instantiated fetchers. This avoids server cookies being set
// by servers for the application from interfering with Safari cookie settings,
// and vice versa. The fetcher cookies are lost when the application quits.
//
// To rely instead on WebKit's global NSHTTPCookieStorage, call
// setCookieStorageMethod: with kGTMHTTPFetcherCookieStorageMethodSystemDefault.
//
// If the fetcher is created from a GTMHTTPFetcherService object
// then the cookie storage mechanism is set to use the cookie storage in the
// service object rather than the static storage.
//
//
// Fetching for periodic checks:
//
// The fetcher object tracks ETag headers from responses and
// provide an "If-None-Match" header. This allows the server to save
// bandwidth by providing a status message instead of repeated response
// data.
//
// To get this behavior, create the fetcher from an GTMHTTPFetcherService object
// and look for a fetch callback error with code 304
// (kGTMHTTPFetcherStatusNotModified) like this:
//
// - (void)myFetcher:(GTMHTTPFetcher *)fetcher finishedWithData:(NSData *)data error:(NSError *)error {
// if ([error code] == kGTMHTTPFetcherStatusNotModified) {
// // |data| is empty; use the data from the previous finishedWithData: for this URL
// } else {
// // handle other server status code
// }
// }
//
//
// Monitoring received data
//
// The optional received data selector can be set with setReceivedDataSelector:
// and should have the signature
//
// - (void)myFetcher:(GTMHTTPFetcher *)fetcher receivedData:(NSData *)dataReceivedSoFar;
//
// The number bytes received so far is available as [fetcher downloadedLength].
// This number may go down if a redirect causes the download to begin again from
// a new server.
//
// If supplied by the server, the anticipated total download size is available
// as [[myFetcher response] expectedContentLength] (and may be -1 for unknown
// download sizes.)
//
//
// Automatic retrying of fetches
//
// The fetcher can optionally create a timer and reattempt certain kinds of
// fetch failures (status codes 408, request timeout; 503, service unavailable;
// 504, gateway timeout; networking errors NSURLErrorTimedOut and
// NSURLErrorNetworkConnectionLost.) The user may set a retry selector to
// customize the type of errors which will be retried.
//
// Retries are done in an exponential-backoff fashion (that is, after 1 second,
// 2, 4, 8, and so on.)
//
// Enabling automatic retries looks like this:
// [myFetcher setRetryEnabled:YES];
//
// With retries enabled, the success or failure callbacks are called only
// when no more retries will be attempted. Calling the fetcher's stopFetching
// method will terminate the retry timer, without the finished or failure
// selectors being invoked.
//
// Optionally, the client may set the maximum retry interval:
// [myFetcher setMaxRetryInterval:60.0]; // in seconds; default is 60 seconds
// // for downloads, 600 for uploads
//
// Also optionally, the client may provide a callback selector to determine
// if a status code or other error should be retried.
// [myFetcher setRetrySelector:@selector(myFetcher:willRetry:forError:)];
//
// If set, the retry selector should have the signature:
// -(BOOL)fetcher:(GTMHTTPFetcher *)fetcher willRetry:(BOOL)suggestedWillRetry forError:(NSError *)error
// and return YES to set the retry timer or NO to fail without additional
// fetch attempts.
//
// The retry method may return the |suggestedWillRetry| argument to get the
// default retry behavior. Server status codes are present in the
// error argument, and have the domain kGTMHTTPFetcherStatusDomain. The
// user's method may look something like this:
//
// -(BOOL)myFetcher:(GTMHTTPFetcher *)fetcher willRetry:(BOOL)suggestedWillRetry forError:(NSError *)error {
//
// // perhaps examine [error domain] and [error code], or [fetcher retryCount]
// //
// // return YES to start the retry timer, NO to proceed to the failure
// // callback, or |suggestedWillRetry| to get default behavior for the
// // current error domain and code values.
// return suggestedWillRetry;
// }
#pragma once
#import <Foundation/Foundation.h>
#if defined(GTL_TARGET_NAMESPACE)
// we're using target namespace macros
#import "GTLDefines.h"
#elif defined(GDATA_TARGET_NAMESPACE)
#import "GDataDefines.h"
#else
#if TARGET_OS_IPHONE
#ifndef GTM_FOUNDATION_ONLY
#define GTM_FOUNDATION_ONLY 1
#endif
#ifndef GTM_IPHONE
#define GTM_IPHONE 1
#endif
#endif
#endif
#if TARGET_OS_IPHONE && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 40000)
#define GTM_BACKGROUND_FETCHING 1
#endif
#undef _EXTERN
#undef _INITIALIZE_AS
#ifdef GTMHTTPFETCHER_DEFINE_GLOBALS
#define _EXTERN
#define _INITIALIZE_AS(x) =x
#else
#if defined(__cplusplus)
#define _EXTERN extern "C"
#else
#define _EXTERN extern
#endif
#define _INITIALIZE_AS(x)
#endif
// notifications
//
// fetch started and stopped, and fetch retry delay started and stopped
_EXTERN NSString* const kGTMHTTPFetcherStartedNotification _INITIALIZE_AS(@"kGTMHTTPFetcherStartedNotification");
_EXTERN NSString* const kGTMHTTPFetcherStoppedNotification _INITIALIZE_AS(@"kGTMHTTPFetcherStoppedNotification");
_EXTERN NSString* const kGTMHTTPFetcherRetryDelayStartedNotification _INITIALIZE_AS(@"kGTMHTTPFetcherRetryDelayStartedNotification");
_EXTERN NSString* const kGTMHTTPFetcherRetryDelayStoppedNotification _INITIALIZE_AS(@"kGTMHTTPFetcherRetryDelayStoppedNotification");
// callback constants
_EXTERN NSString* const kGTMHTTPFetcherErrorDomain _INITIALIZE_AS(@"com.google.GTMHTTPFetcher");
_EXTERN NSString* const kGTMHTTPFetcherStatusDomain _INITIALIZE_AS(@"com.google.HTTPStatus");
_EXTERN NSString* const kGTMHTTPFetcherErrorChallengeKey _INITIALIZE_AS(@"challenge");
_EXTERN NSString* const kGTMHTTPFetcherStatusDataKey _INITIALIZE_AS(@"data"); // data returned with a kGTMHTTPFetcherStatusDomain error
enum {
kGTMHTTPFetcherErrorDownloadFailed = -1,
kGTMHTTPFetcherErrorAuthenticationChallengeFailed = -2,
kGTMHTTPFetcherErrorChunkUploadFailed = -3,
kGTMHTTPFetcherErrorFileHandleException = -4,
kGTMHTTPFetcherErrorBackgroundExpiration = -6,
// The code kGTMHTTPFetcherErrorAuthorizationFailed (-5) has been removed;
// look for status 401 instead.
kGTMHTTPFetcherStatusNotModified = 304,
kGTMHTTPFetcherStatusBadRequest = 400,
kGTMHTTPFetcherStatusUnauthorized = 401,
kGTMHTTPFetcherStatusForbidden = 403,
kGTMHTTPFetcherStatusPreconditionFailed = 412
};
// cookie storage methods
enum {
kGTMHTTPFetcherCookieStorageMethodStatic = 0,
kGTMHTTPFetcherCookieStorageMethodFetchHistory = 1,
kGTMHTTPFetcherCookieStorageMethodSystemDefault = 2,
kGTMHTTPFetcherCookieStorageMethodNone = 3
};
#ifdef __cplusplus
extern "C" {
#endif
void GTMAssertSelectorNilOrImplementedWithArgs(id obj, SEL sel, ...);
// Utility functions for applications self-identifying to servers via a
// user-agent header
// Make a proper app name without whitespace from the given string, removing
// whitespace and other characters that may be special parsed marks of
// the full user-agent string.
NSString *GTMCleanedUserAgentString(NSString *str);
// Make an identifier like "MacOSX/10.7.1" or "iPod_Touch/4.1"
NSString *GTMSystemVersionString(void);
// Make a generic name and version for the current application, like
// com.example.MyApp/1.2.3 relying on the bundle identifier and the
// CFBundleShortVersionString or CFBundleVersion. If no bundle ID
// is available, the process name preceded by "proc_" is used.
NSString *GTMApplicationIdentifier(NSBundle *bundle);
#ifdef __cplusplus
} // extern "C"
#endif
@class GTMHTTPFetcher;
@protocol GTMCookieStorageProtocol <NSObject>
// This protocol allows us to call into the service without requiring
// GTMCookieStorage sources in this project
//
// The public interface for cookie handling is the GTMCookieStorage class,
// accessible from a fetcher service object's fetchHistory or from the fetcher's
// +staticCookieStorage method.
- (NSArray *)cookiesForURL:(NSURL *)theURL;
- (void)setCookies:(NSArray *)newCookies;
@end
@protocol GTMHTTPFetchHistoryProtocol <NSObject>
// This protocol allows us to call the fetch history object without requiring
// GTMHTTPFetchHistory sources in this project
- (void)updateRequest:(NSMutableURLRequest *)request isHTTPGet:(BOOL)isHTTPGet;
- (BOOL)shouldCacheETaggedData;
- (NSData *)cachedDataForRequest:(NSURLRequest *)request;
- (id <GTMCookieStorageProtocol>)cookieStorage;
- (void)updateFetchHistoryWithRequest:(NSURLRequest *)request
response:(NSURLResponse *)response
downloadedData:(NSData *)downloadedData;
- (void)removeCachedDataForRequest:(NSURLRequest *)request;
@end
@protocol GTMHTTPFetcherServiceProtocol <NSObject>
// This protocol allows us to call into the service without requiring
// GTMHTTPFetcherService sources in this project
@property (retain) NSOperationQueue *delegateQueue;
- (BOOL)fetcherShouldBeginFetching:(GTMHTTPFetcher *)fetcher;
- (void)fetcherDidStop:(GTMHTTPFetcher *)fetcher;
- (GTMHTTPFetcher *)fetcherWithRequest:(NSURLRequest *)request;
- (BOOL)isDelayingFetcher:(GTMHTTPFetcher *)fetcher;
@end
@protocol GTMFetcherAuthorizationProtocol <NSObject>
@required
// This protocol allows us to call the authorizer without requiring its sources
// in this project.
- (void)authorizeRequest:(NSMutableURLRequest *)request
delegate:(id)delegate
didFinishSelector:(SEL)sel;
- (void)stopAuthorization;
- (void)stopAuthorizationForRequest:(NSURLRequest *)request;
- (BOOL)isAuthorizingRequest:(NSURLRequest *)request;
- (BOOL)isAuthorizedRequest:(NSURLRequest *)request;
@property (retain, readonly) NSString *userEmail;
@optional
// Indicate if authorization may be attempted. Even if this succeeds,
// authorization may fail if the user's permissions have been revoked.
@property (readonly) BOOL canAuthorize;
// For development only, allow authorization of non-SSL requests, allowing
// transmission of the bearer token unencrypted.
@property (assign) BOOL shouldAuthorizeAllRequests;
#if NS_BLOCKS_AVAILABLE
- (void)authorizeRequest:(NSMutableURLRequest *)request
completionHandler:(void (^)(NSError *error))handler;
#endif
@property (assign) id <GTMHTTPFetcherServiceProtocol> fetcherService; // WEAK
- (BOOL)primeForRefresh;
@end
// GTMHTTPFetcher objects are used for async retrieval of an http get or post
//
// See additional comments at the beginning of this file
@interface GTMHTTPFetcher : NSObject {
@protected
NSMutableURLRequest *request_;
NSURLConnection *connection_;
NSMutableData *downloadedData_;
NSString *downloadPath_;
NSString *temporaryDownloadPath_;
NSFileHandle *downloadFileHandle_;
unsigned long long downloadedLength_;
NSURLCredential *credential_; // username & password
NSURLCredential *proxyCredential_; // credential supplied to proxy servers
NSData *postData_;
NSInputStream *postStream_;
NSMutableData *loggedStreamData_;
NSURLResponse *response_; // set in connection:didReceiveResponse:
id delegate_;
SEL finishedSel_; // should by implemented by delegate
SEL sentDataSel_; // optional, set with setSentDataSelector
SEL receivedDataSel_; // optional, set with setReceivedDataSelector
#if NS_BLOCKS_AVAILABLE
void (^completionBlock_)(NSData *, NSError *);
void (^receivedDataBlock_)(NSData *);
void (^sentDataBlock_)(NSInteger, NSInteger, NSInteger);
BOOL (^retryBlock_)(BOOL, NSError *);
#elif !__LP64__
// placeholders: for 32-bit builds, keep the size of the object's ivar section
// the same with and without blocks
id completionPlaceholder_;
id receivedDataPlaceholder_;
id sentDataPlaceholder_;
id retryPlaceholder_;
#endif
BOOL hasConnectionEnded_; // set if the connection need not be cancelled
BOOL isCancellingChallenge_; // set only when cancelling an auth challenge
BOOL isStopNotificationNeeded_; // set when start notification has been sent
BOOL shouldFetchInBackground_;
#if GTM_BACKGROUND_FETCHING
NSUInteger backgroundTaskIdentifer_; // UIBackgroundTaskIdentifier
#endif
id userData_; // retained, if set by caller
NSMutableDictionary *properties_; // more data retained for caller
NSArray *runLoopModes_; // optional
NSOperationQueue *delegateQueue_; // optional; available iOS 6/10.7 and later
id <GTMHTTPFetchHistoryProtocol> fetchHistory_; // if supplied by the caller, used for Last-Modified-Since checks and cookies
NSInteger cookieStorageMethod_; // constant from above
id <GTMCookieStorageProtocol> cookieStorage_;
id <GTMFetcherAuthorizationProtocol> authorizer_;
// the service object that created and monitors this fetcher, if any
id <GTMHTTPFetcherServiceProtocol> service_;
NSString *serviceHost_;
NSInteger servicePriority_;
NSThread *thread_;
BOOL isRetryEnabled_; // user wants auto-retry
SEL retrySel_; // optional; set with setRetrySelector
NSTimer *retryTimer_;
NSUInteger retryCount_;
NSTimeInterval maxRetryInterval_; // default 600 seconds
NSTimeInterval minRetryInterval_; // random between 1 and 2 seconds
NSTimeInterval retryFactor_; // default interval multiplier is 2
NSTimeInterval lastRetryInterval_;
BOOL hasAttemptedAuthRefresh_;
NSString *comment_; // comment for log
NSString *log_;
#if !STRIP_GTM_FETCH_LOGGING
NSString *logRequestBody_;
NSString *logResponseBody_;
BOOL shouldDeferResponseBodyLogging_;
#endif
}
// Create a fetcher
//
// fetcherWithRequest will return an autoreleased fetcher, but if
// the connection is successfully created, the connection should retain the
// fetcher for the life of the connection as well. So the caller doesn't have
// to retain the fetcher explicitly unless they want to be able to cancel it.
+ (GTMHTTPFetcher *)fetcherWithRequest:(NSURLRequest *)request;
// Convenience methods that make a request, like +fetcherWithRequest
+ (GTMHTTPFetcher *)fetcherWithURL:(NSURL *)requestURL;
+ (GTMHTTPFetcher *)fetcherWithURLString:(NSString *)requestURLString;
// Designated initializer
- (id)initWithRequest:(NSURLRequest *)request;
// Fetcher request
//
// The underlying request is mutable and may be modified by the caller
@property (retain) NSMutableURLRequest *mutableRequest;
// Setting the credential is optional; it is used if the connection receives
// an authentication challenge
@property (retain) NSURLCredential *credential;
// Setting the proxy credential is optional; it is used if the connection
// receives an authentication challenge from a proxy
@property (retain) NSURLCredential *proxyCredential;
// If post data or stream is not set, then a GET retrieval method is assumed
@property (retain) NSData *postData;
@property (retain) NSInputStream *postStream;
// The default cookie storage method is kGTMHTTPFetcherCookieStorageMethodStatic
// without a fetch history set, and kGTMHTTPFetcherCookieStorageMethodFetchHistory
// with a fetch history set
//
// Applications needing control of cookies across a sequence of fetches should
// create fetchers from a GTMHTTPFetcherService object (which encapsulates
// fetch history) for a well-defined cookie store
@property (assign) NSInteger cookieStorageMethod;
+ (id <GTMCookieStorageProtocol>)staticCookieStorage;
// Object to add authorization to the request, if needed
@property (retain) id <GTMFetcherAuthorizationProtocol> authorizer;
// The service object that created and monitors this fetcher, if any
@property (retain) id <GTMHTTPFetcherServiceProtocol> service;
// The host, if any, used to classify this fetcher in the fetcher service
@property (copy) NSString *serviceHost;
// The priority, if any, used for starting fetchers in the fetcher service
//
// Lower values are higher priority; the default is 0, and values may
// be negative or positive. This priority affects only the start order of
// fetchers that are being delayed by a fetcher service.
@property (assign) NSInteger servicePriority;
// The thread used to run this fetcher in the fetcher service when no operation
// queue is provided.
@property (retain) NSThread *thread;
// The delegate is retained during the connection
@property (retain) id delegate;
// On iOS 4 and later, the fetch may optionally continue while the app is in the
// background until finished or stopped by OS expiration
//
// The default value is NO
//
// For Mac OS X, background fetches are always supported, and this property
// is ignored
@property (assign) BOOL shouldFetchInBackground;
// The delegate's optional sentData selector may be used to monitor upload
// progress. It should have a signature like:
// - (void)myFetcher:(GTMHTTPFetcher *)fetcher
// didSendBytes:(NSInteger)bytesSent
// totalBytesSent:(NSInteger)totalBytesSent
// totalBytesExpectedToSend:(NSInteger)totalBytesExpectedToSend;
//
// +doesSupportSentDataCallback indicates if this delegate method is supported
+ (BOOL)doesSupportSentDataCallback;
@property (assign) SEL sentDataSelector;
// The delegate's optional receivedData selector may be used to monitor download
// progress. It should have a signature like:
// - (void)myFetcher:(GTMHTTPFetcher *)fetcher
// receivedData:(NSData *)dataReceivedSoFar;
//
// The dataReceived argument will be nil when downloading to a path or to a
// file handle.
//
// Applications should not use this method to accumulate the received data;
// the callback method or block supplied to the beginFetch call will have
// the complete NSData received.
@property (assign) SEL receivedDataSelector;
#if NS_BLOCKS_AVAILABLE
// The full interface to the block is provided rather than just a typedef for
// its parameter list in order to get more useful code completion in the Xcode
// editor
@property (copy) void (^sentDataBlock)(NSInteger bytesSent, NSInteger totalBytesSent, NSInteger bytesExpectedToSend);
// The dataReceived argument will be nil when downloading to a path or to
// a file handle
@property (copy) void (^receivedDataBlock)(NSData *dataReceivedSoFar);
#endif
// retrying; see comments at the top of the file. Calling
// setRetryEnabled(YES) resets the min and max retry intervals.
@property (assign, getter=isRetryEnabled) BOOL retryEnabled;
// Retry selector or block is optional for retries.
//
// If present, it should have the signature:
// -(BOOL)fetcher:(GTMHTTPFetcher *)fetcher willRetry:(BOOL)suggestedWillRetry forError:(NSError *)error
// and return YES to cause a retry. See comments at the top of this file.
@property (assign) SEL retrySelector;
#if NS_BLOCKS_AVAILABLE
@property (copy) BOOL (^retryBlock)(BOOL suggestedWillRetry, NSError *error);
#endif
// Retry intervals must be strictly less than maxRetryInterval, else
// they will be limited to maxRetryInterval and no further retries will
// be attempted. Setting maxRetryInterval to 0.0 will reset it to the
// default value, 600 seconds.
@property (assign) NSTimeInterval maxRetryInterval;
// Starting retry interval. Setting minRetryInterval to 0.0 will reset it
// to a random value between 1.0 and 2.0 seconds. Clients should normally not
// call this except for unit testing.
@property (assign) NSTimeInterval minRetryInterval;
// Multiplier used to increase the interval between retries, typically 2.0.
// Clients should not need to call this.
@property (assign) double retryFactor;
// Number of retries attempted
@property (readonly) NSUInteger retryCount;
// interval delay to precede next retry
@property (readonly) NSTimeInterval nextRetryInterval;
// Begin fetching the request
//
// The delegate can optionally implement the finished selectors or pass NULL
// for it.
//
// Returns YES if the fetch is initiated. The delegate is retained between
// the beginFetch call until after the finish callback.
//
// An error is passed to the callback for server statuses 300 or
// higher, with the status stored as the error object's code.
//
// finishedSEL has a signature like:
// - (void)fetcher:(GTMHTTPFetcher *)fetcher finishedWithData:(NSData *)data error:(NSError *)error;
//
// If the application has specified a downloadPath or downloadFileHandle
// for the fetcher, the data parameter passed to the callback will be nil.
- (BOOL)beginFetchWithDelegate:(id)delegate
didFinishSelector:(SEL)finishedSEL;
#if NS_BLOCKS_AVAILABLE
- (BOOL)beginFetchWithCompletionHandler:(void (^)(NSData *data, NSError *error))handler;
#endif
// Returns YES if this is in the process of fetching a URL
- (BOOL)isFetching;
// Cancel the fetch of the request that's currently in progress
- (void)stopFetching;
// Return the status code from the server response
@property (readonly) NSInteger statusCode;
// Return the http headers from the response
@property (retain, readonly) NSDictionary *responseHeaders;
// The response, once it's been received
@property (retain) NSURLResponse *response;
// Bytes downloaded so far
@property (readonly) unsigned long long downloadedLength;
// Buffer of currently-downloaded data
@property (readonly, retain) NSData *downloadedData;
// Path in which to non-atomically create a file for storing the downloaded data
//
// The path must be set before fetching begins. The download file handle
// will be created for the path, and can be used to monitor progress. If a file
// already exists at the path, it will be overwritten.
@property (copy) NSString *downloadPath;
// If downloadFileHandle is set, data received is immediately appended to
// the file handle rather than being accumulated in the downloadedData property
//
// The file handle supplied must allow writing and support seekToFileOffset:,
// and must be set before fetching begins. Setting a download path will
// override the file handle property.
@property (retain) NSFileHandle *downloadFileHandle;
// The optional fetchHistory object is used for a sequence of fetchers to
// remember ETags, cache ETagged data, and store cookies. Typically, this
// is set by a GTMFetcherService object when it creates a fetcher.
//
// Side effect: setting fetch history implicitly calls setCookieStorageMethod:
@property (retain) id <GTMHTTPFetchHistoryProtocol> fetchHistory;
// userData is retained for the convenience of the caller
@property (retain) id userData;
// Stored property values are retained for the convenience of the caller
@property (copy) NSMutableDictionary *properties;
- (void)setProperty:(id)obj forKey:(NSString *)key; // pass nil obj to remove property
- (id)propertyForKey:(NSString *)key;
- (void)addPropertiesFromDictionary:(NSDictionary *)dict;
// Comments are useful for logging
@property (copy) NSString *comment;
- (void)setCommentWithFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1, 2);
// Log of request and response, if logging is enabled
@property (copy) NSString *log;
// Callbacks can be invoked on an operation queue rather than via the run loop,
// starting on 10.7 and iOS 6. If a delegate queue is supplied. the run loop
// modes are ignored.
@property (retain) NSOperationQueue *delegateQueue;
// Using the fetcher while a modal dialog is displayed requires setting the
// run-loop modes to include NSModalPanelRunLoopMode
@property (retain) NSArray *runLoopModes;
// Users who wish to replace GTMHTTPFetcher's use of NSURLConnection
// can do so globally here. The replacement should be a subclass of
// NSURLConnection.
+ (Class)connectionClass;
+ (void)setConnectionClass:(Class)theClass;
// Spin the run loop, discarding events, until the fetch has completed
//
// This is only for use in testing or in tools without a user interface.
//
// Synchronous fetches should never be done by shipping apps; they are
// sufficient reason for rejection from the app store.
- (void)waitForCompletionWithTimeout:(NSTimeInterval)timeoutInSeconds;
#if STRIP_GTM_FETCH_LOGGING
// if logging is stripped, provide a stub for the main method
// for controlling logging
+ (void)setLoggingEnabled:(BOOL)flag;
#endif // STRIP_GTM_FETCH_LOGGING
@end

View File

@@ -0,0 +1,125 @@
/* Copyright (c) 2010 Google Inc.
*
* 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.
*/
//
// GTMHTTPFetcherService.h
//
// The fetcher service class maintains a history to be used by a sequence
// of fetchers objects generated by the service.
//
// Fetchers that do not need to share a history may be generated independently,
// like
//
// GTMHTTPFetcher* myFetcher = [GTMHTTPFetcher fetcherWithRequest:request];
//
// Fetchers that should share cookies or an ETagged data cache should be
// generated by a common GTMHTTPFetcherService instance, like
//
// GTMHTTPFetcherService *myFetcherService = [[GTMHTTPFetcherService alloc] init];
// GTMHTTPFetcher* myFirstFetcher = [myFetcherService fetcherWithRequest:request1];
// GTMHTTPFetcher* mySecondFetcher = [myFetcherService fetcherWithRequest:request2];
#import "GTMHTTPFetcher.h"
#import "GTMHTTPFetchHistory.h"
@interface GTMHTTPFetcherService : NSObject<GTMHTTPFetcherServiceProtocol> {
@private
NSMutableDictionary *delayedHosts_;
NSMutableDictionary *runningHosts_;
NSUInteger maxRunningFetchersPerHost_;
GTMHTTPFetchHistory *fetchHistory_;
NSOperationQueue *delegateQueue_;
NSArray *runLoopModes_;
NSString *userAgent_;
NSTimeInterval timeout_;
NSURLCredential *credential_; // username & password
NSURLCredential *proxyCredential_; // credential supplied to proxy servers
NSInteger cookieStorageMethod_;
BOOL shouldFetchInBackground_;
id <GTMFetcherAuthorizationProtocol> authorizer_;
}
// Create a fetcher
//
// These methods will return an autoreleased fetcher, but if
// the fetcher is successfully created, the connection will retain the
// fetcher for the life of the connection as well. So the caller doesn't have
// to retain the fetcher explicitly unless they want to be able to monitor
// or cancel it.
- (GTMHTTPFetcher *)fetcherWithRequest:(NSURLRequest *)request;
- (GTMHTTPFetcher *)fetcherWithURL:(NSURL *)requestURL;
- (GTMHTTPFetcher *)fetcherWithURLString:(NSString *)requestURLString;
- (id)fetcherWithRequest:(NSURLRequest *)request
fetcherClass:(Class)fetcherClass;
// Queues of delayed and running fetchers. Each dictionary contains arrays
// of fetchers, keyed by host
//
// A max value of 0 means no fetchers should be delayed.
//
// The default limit is 10 simultaneous fetchers targeting each host.
@property (assign) NSUInteger maxRunningFetchersPerHost;
@property (retain, readonly) NSDictionary *delayedHosts;
@property (retain, readonly) NSDictionary *runningHosts;
- (BOOL)isDelayingFetcher:(GTMHTTPFetcher *)fetcher;
- (NSUInteger)numberOfFetchers; // running + delayed fetchers
- (NSUInteger)numberOfRunningFetchers;
- (NSUInteger)numberOfDelayedFetchers;
// Search for running or delayed fetchers with the specified URL.
//
// Returns an array of fetcher objects found, or nil if none found.
- (NSArray *)issuedFetchersWithRequestURL:(NSURL *)requestURL;
- (void)stopAllFetchers;
// Properties to be applied to each fetcher;
// see GTMHTTPFetcher.h for descriptions
@property (copy) NSString *userAgent;
@property (assign) NSTimeInterval timeout;
@property (retain) NSOperationQueue *delegateQueue;
@property (retain) NSArray *runLoopModes;
@property (retain) NSURLCredential *credential;
@property (retain) NSURLCredential *proxyCredential;
@property (assign) BOOL shouldFetchInBackground;
// Fetch history
@property (retain) GTMHTTPFetchHistory *fetchHistory;
@property (assign) NSInteger cookieStorageMethod;
@property (assign) BOOL shouldRememberETags; // default: NO
@property (assign) BOOL shouldCacheETaggedData; // default: NO
- (void)clearETaggedDataCache;
- (void)clearHistory;
@property (nonatomic, retain) id <GTMFetcherAuthorizationProtocol> authorizer;
// Spin the run loop, discarding events, until all running and delayed fetchers
// have completed
//
// This is only for use in testing or in tools without a user interface.
//
// Synchronous fetches should never be done by shipping apps; they are
// sufficient reason for rejection from the app store.
- (void)waitForCompletionOfAllFetchersWithTimeout:(NSTimeInterval)timeoutInSeconds;
@end

View File

@@ -0,0 +1,504 @@
//
// GTMLogger.h
//
// Copyright 2007-2008 Google Inc.
//
// 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.
//
// Key Abstractions
// ----------------
//
// This file declares multiple classes and protocols that are used by the
// GTMLogger logging system. The 4 main abstractions used in this file are the
// following:
//
// * logger (GTMLogger) - The main logging class that users interact with. It
// has methods for logging at different levels and uses a log writer, a log
// formatter, and a log filter to get the job done.
//
// * log writer (GTMLogWriter) - Writes a given string to some log file, where
// a "log file" can be a physical file on disk, a POST over HTTP to some URL,
// or even some in-memory structure (e.g., a ring buffer).
//
// * log formatter (GTMLogFormatter) - Given a format string and arguments as
// a va_list, returns a single formatted NSString. A "formatted string" could
// be a string with the date prepended, a string with values in a CSV format,
// or even a string of XML.
//
// * log filter (GTMLogFilter) - Given a formatted log message as an NSString
// and the level at which the message is to be logged, this class will decide
// whether the given message should be logged or not. This is a flexible way
// to filter out messages logged at a certain level, messages that contain
// certain text, or filter nothing out at all. This gives the caller the
// flexibility to dynamically enable debug logging in Release builds.
//
// This file also declares some classes to handle the common log writer, log
// formatter, and log filter cases. Callers can also create their own writers,
// formatters, and filters and they can even build them on top of the ones
// declared here. Keep in mind that your custom writer/formatter/filter may be
// called from multiple threads, so it must be thread-safe.
#import <Foundation/Foundation.h>
#import "GTMDefines.h"
// Predeclaration of used protocols that are declared later in this file.
@protocol GTMLogWriter, GTMLogFormatter, GTMLogFilter;
// GTMLogger
//
// GTMLogger is the primary user-facing class for an object-oriented logging
// system. It is built on the concept of log formatters (GTMLogFormatter), log
// writers (GTMLogWriter), and log filters (GTMLogFilter). When a message is
// sent to a GTMLogger to log a message, the message is formatted using the log
// formatter, then the log filter is consulted to see if the message should be
// logged, and if so, the message is sent to the log writer to be written out.
//
// GTMLogger is intended to be a flexible and thread-safe logging solution. Its
// flexibility comes from the fact that GTMLogger instances can be customized
// with user defined formatters, filters, and writers. And these writers,
// filters, and formatters can be combined, stacked, and customized in arbitrary
// ways to suit the needs at hand. For example, multiple writers can be used at
// the same time, and a GTMLogger instance can even be used as another
// GTMLogger's writer. This allows for arbitrarily deep logging trees.
//
// A standard GTMLogger uses a writer that sends messages to standard out, a
// formatter that smacks a timestamp and a few other bits of interesting
// information on the message, and a filter that filters out debug messages from
// release builds. Using the standard log settings, a log message will look like
// the following:
//
// 2007-12-30 10:29:24.177 myapp[4588/0xa07d0f60] [lvl=1] foo=<Foo: 0x123>
//
// The output contains the date and time of the log message, the name of the
// process followed by its process ID/thread ID, the log level at which the
// message was logged (in the previous example the level was 1:
// kGTMLoggerLevelDebug), and finally, the user-specified log message itself (in
// this case, the log message was @"foo=%@", foo).
//
// Multiple instances of GTMLogger can be created, each configured their own
// way. Though GTMLogger is not a singleton (in the GoF sense), it does provide
// access to a shared (i.e., globally accessible) GTMLogger instance. This makes
// it convenient for all code in a process to use the same GTMLogger instance.
// The shared GTMLogger instance can also be configured in an arbitrary, and
// these configuration changes will affect all code that logs through the shared
// instance.
//
// Log Levels
// ----------
// GTMLogger has 3 different log levels: Debug, Info, and Error. GTMLogger
// doesn't take any special action based on the log level; it simply forwards
// this information on to formatters, filters, and writers, each of which may
// optionally take action based on the level. Since log level filtering is
// performed at runtime, log messages are typically not filtered out at compile
// time. The exception to this rule is that calls to the GTMLoggerDebug() macro
// *ARE* filtered out of non-DEBUG builds. This is to be backwards compatible
// with behavior that many developers are currently used to. Note that this
// means that GTMLoggerDebug(@"hi") will be compiled out of Release builds, but
// [[GTMLogger sharedLogger] logDebug:@"hi"] will NOT be compiled out.
//
// Standard loggers are created with the GTMLogLevelFilter log filter, which
// filters out certain log messages based on log level, and some other settings.
//
// In addition to the -logDebug:, -logInfo:, and -logError: methods defined on
// GTMLogger itself, there are also C macros that make usage of the shared
// GTMLogger instance very convenient. These macros are:
//
// GTMLoggerDebug(...)
// GTMLoggerInfo(...)
// GTMLoggerError(...)
//
// Again, a notable feature of these macros is that GTMLogDebug() calls *will be
// compiled out of non-DEBUG builds*.
//
// Standard Loggers
// ----------------
// GTMLogger has the concept of "standard loggers". A standard logger is simply
// a logger that is pre-configured with some standard/common writer, formatter,
// and filter combination. Standard loggers are created using the creation
// methods beginning with "standard". The alternative to a standard logger is a
// regular logger, which will send messages to stdout, with no special
// formatting, and no filtering.
//
// How do I use GTMLogger?
// ----------------------
// The typical way you will want to use GTMLogger is to simply use the
// GTMLogger*() macros for logging from code. That way we can easily make
// changes to the GTMLogger class and simply update the macros accordingly. Only
// your application startup code (perhaps, somewhere in main()) should use the
// GTMLogger class directly in order to configure the shared logger, which all
// of the code using the macros will be using. Again, this is just the typical
// situation.
//
// To be complete, there are cases where you may want to use GTMLogger directly,
// or even create separate GTMLogger instances for some reason. That's fine,
// too.
//
// Examples
// --------
// The following show some common GTMLogger use cases.
//
// 1. You want to log something as simply as possible. Also, this call will only
// appear in debug builds. In non-DEBUG builds it will be completely removed.
//
// GTMLoggerDebug(@"foo = %@", foo);
//
// 2. The previous example is similar to the following. The major difference is
// that the previous call (example 1) will be compiled out of Release builds
// but this statement will not be compiled out.
//
// [[GTMLogger sharedLogger] logDebug:@"foo = %@", foo];
//
// 3. Send all logging output from the shared logger to a file. We do this by
// creating an NSFileHandle for writing associated with a file, and setting
// that file handle as the logger's writer.
//
// NSFileHandle *f = [NSFileHandle fileHandleForWritingAtPath:@"/tmp/f.log"
// create:YES];
// [[GTMLogger sharedLogger] setWriter:f];
// GTMLoggerError(@"hi"); // This will be sent to /tmp/f.log
//
// 4. Create a new GTMLogger that will log to a file. This example differs from
// the previous one because here we create a new GTMLogger that is different
// from the shared logger.
//
// GTMLogger *logger = [GTMLogger standardLoggerWithPath:@"/tmp/temp.log"];
// [logger logInfo:@"hi temp log file"];
//
// 5. Create a logger that writes to stdout and does NOT do any formatting to
// the log message. This might be useful, for example, when writing a help
// screen for a command-line tool to standard output.
//
// GTMLogger *logger = [GTMLogger logger];
// [logger logInfo:@"%@ version 0.1 usage", progName];
//
// 6. Send log output to stdout AND to a log file. The trick here is that
// NSArrays function as composite log writers, which means when an array is
// set as the log writer, it forwards all logging messages to all of its
// contained GTMLogWriters.
//
// // Create array of GTMLogWriters
// NSArray *writers = [NSArray arrayWithObjects:
// [NSFileHandle fileHandleForWritingAtPath:@"/tmp/f.log" create:YES],
// [NSFileHandle fileHandleWithStandardOutput], nil];
//
// GTMLogger *logger = [GTMLogger standardLogger];
// [logger setWriter:writers];
// [logger logInfo:@"hi"]; // Output goes to stdout and /tmp/f.log
//
// For futher details on log writers, formatters, and filters, see the
// documentation below.
//
// NOTE: GTMLogger is application level logging. By default it does nothing
// with _GTMDevLog/_GTMDevAssert (see GTMDefines.h). An application can choose
// to bridge _GTMDevLog/_GTMDevAssert to GTMLogger by providing macro
// definitions in its prefix header (see GTMDefines.h for how one would do
// that).
//
@interface GTMLogger : NSObject {
@private
id<GTMLogWriter> writer_;
id<GTMLogFormatter> formatter_;
id<GTMLogFilter> filter_;
}
//
// Accessors for the shared logger instance
//
// Returns a shared/global standard GTMLogger instance. Callers should typically
// use this method to get a GTMLogger instance, unless they explicitly want
// their own instance to configure for their own needs. This is the only method
// that returns a shared instance; all the rest return new GTMLogger instances.
+ (id)sharedLogger;
// Sets the shared logger instance to |logger|. Future calls to +sharedLogger
// will return |logger| instead.
+ (void)setSharedLogger:(GTMLogger *)logger;
//
// Creation methods
//
// Returns a new autoreleased GTMLogger instance that will log to stdout, using
// the GTMLogStandardFormatter, and the GTMLogLevelFilter filter.
+ (id)standardLogger;
// Same as +standardLogger, but logs to stderr.
+ (id)standardLoggerWithStderr;
// Same as +standardLogger but levels >= kGTMLoggerLevelError are routed to
// stderr, everything else goes to stdout.
+ (id)standardLoggerWithStdoutAndStderr;
// Returns a new standard GTMLogger instance with a log writer that will
// write to the file at |path|, and will use the GTMLogStandardFormatter and
// GTMLogLevelFilter classes. If |path| does not exist, it will be created.
+ (id)standardLoggerWithPath:(NSString *)path;
// Returns an autoreleased GTMLogger instance that will use the specified
// |writer|, |formatter|, and |filter|.
+ (id)loggerWithWriter:(id<GTMLogWriter>)writer
formatter:(id<GTMLogFormatter>)formatter
filter:(id<GTMLogFilter>)filter;
// Returns an autoreleased GTMLogger instance that logs to stdout, with the
// basic formatter, and no filter. The returned logger differs from the logger
// returned by +standardLogger because this one does not do any filtering and
// does not do any special log formatting; this is the difference between a
// "regular" logger and a "standard" logger.
+ (id)logger;
// Designated initializer. This method returns a GTMLogger initialized with the
// specified |writer|, |formatter|, and |filter|. See the setter methods below
// for what values will be used if nil is passed for a parameter.
- (id)initWithWriter:(id<GTMLogWriter>)writer
formatter:(id<GTMLogFormatter>)formatter
filter:(id<GTMLogFilter>)filter;
//
// Logging methods
//
// Logs a message at the debug level (kGTMLoggerLevelDebug).
- (void)logDebug:(NSString *)fmt, ... NS_FORMAT_FUNCTION(1, 2);
// Logs a message at the info level (kGTMLoggerLevelInfo).
- (void)logInfo:(NSString *)fmt, ... NS_FORMAT_FUNCTION(1, 2);
// Logs a message at the error level (kGTMLoggerLevelError).
- (void)logError:(NSString *)fmt, ... NS_FORMAT_FUNCTION(1, 2);
// Logs a message at the assert level (kGTMLoggerLevelAssert).
- (void)logAssert:(NSString *)fmt, ... NS_FORMAT_FUNCTION(1, 2);
//
// Accessors
//
// Accessor methods for the log writer. If the log writer is set to nil,
// [NSFileHandle fileHandleWithStandardOutput] is used.
- (id<GTMLogWriter>)writer;
- (void)setWriter:(id<GTMLogWriter>)writer;
// Accessor methods for the log formatter. If the log formatter is set to nil,
// GTMLogBasicFormatter is used. This formatter will format log messages in a
// plain printf style.
- (id<GTMLogFormatter>)formatter;
- (void)setFormatter:(id<GTMLogFormatter>)formatter;
// Accessor methods for the log filter. If the log filter is set to nil,
// GTMLogNoFilter is used, which allows all log messages through.
- (id<GTMLogFilter>)filter;
- (void)setFilter:(id<GTMLogFilter>)filter;
@end // GTMLogger
// Helper functions that are used by the convenience GTMLogger*() macros that
// enable the logging of function names.
@interface GTMLogger (GTMLoggerMacroHelpers)
- (void)logFuncDebug:(const char *)func msg:(NSString *)fmt, ...
NS_FORMAT_FUNCTION(2, 3);
- (void)logFuncInfo:(const char *)func msg:(NSString *)fmt, ...
NS_FORMAT_FUNCTION(2, 3);
- (void)logFuncError:(const char *)func msg:(NSString *)fmt, ...
NS_FORMAT_FUNCTION(2, 3);
- (void)logFuncAssert:(const char *)func msg:(NSString *)fmt, ...
NS_FORMAT_FUNCTION(2, 3);
@end // GTMLoggerMacroHelpers
// The convenience macros are only defined if they haven't already been defined.
#ifndef GTMLoggerInfo
// Convenience macros that log to the shared GTMLogger instance. These macros
// are how users should typically log to GTMLogger. Notice that GTMLoggerDebug()
// calls will be compiled out of non-Debug builds.
#define GTMLoggerDebug(...) \
[[GTMLogger sharedLogger] logFuncDebug:__func__ msg:__VA_ARGS__]
#define GTMLoggerInfo(...) \
[[GTMLogger sharedLogger] logFuncInfo:__func__ msg:__VA_ARGS__]
#define GTMLoggerError(...) \
[[GTMLogger sharedLogger] logFuncError:__func__ msg:__VA_ARGS__]
#define GTMLoggerAssert(...) \
[[GTMLogger sharedLogger] logFuncAssert:__func__ msg:__VA_ARGS__]
// If we're not in a debug build, remove the GTMLoggerDebug statements. This
// makes calls to GTMLoggerDebug "compile out" of Release builds
#ifndef DEBUG
#undef GTMLoggerDebug
#define GTMLoggerDebug(...) do {} while(0)
#endif
#endif // !defined(GTMLoggerInfo)
// Log levels.
typedef enum {
kGTMLoggerLevelUnknown,
kGTMLoggerLevelDebug,
kGTMLoggerLevelInfo,
kGTMLoggerLevelError,
kGTMLoggerLevelAssert,
} GTMLoggerLevel;
//
// Log Writers
//
// Protocol to be implemented by a GTMLogWriter instance.
@protocol GTMLogWriter <NSObject>
// Writes the given log message to where the log writer is configured to write.
- (void)logMessage:(NSString *)msg level:(GTMLoggerLevel)level;
@end // GTMLogWriter
// Simple category on NSFileHandle that makes NSFileHandles valid log writers.
// This is convenient because something like, say, +fileHandleWithStandardError
// now becomes a valid log writer. Log messages are written to the file handle
// with a newline appended.
@interface NSFileHandle (GTMFileHandleLogWriter) <GTMLogWriter>
// Opens the file at |path| in append mode, and creates the file with |mode|
// if it didn't previously exist.
+ (id)fileHandleForLoggingAtPath:(NSString *)path mode:(mode_t)mode;
@end // NSFileHandle
// This category makes NSArray a GTMLogWriter that can be composed of other
// GTMLogWriters. This is the classic Composite GoF design pattern. When the
// GTMLogWriter -logMessage:level: message is sent to the array, the array
// forwards the message to all of its elements that implement the GTMLogWriter
// protocol.
//
// This is useful in situations where you would like to send log output to
// multiple log writers at the same time. Simply create an NSArray of the log
// writers you wish to use, then set the array as the "writer" for your
// GTMLogger instance.
@interface NSArray (GTMArrayCompositeLogWriter) <GTMLogWriter>
@end // GTMArrayCompositeLogWriter
// This category adapts the GTMLogger interface so that it can be used as a log
// writer; it's an "adapter" in the GoF Adapter pattern sense.
//
// This is useful when you want to configure a logger to log to a specific
// writer with a specific formatter and/or filter. But you want to also compose
// that with a different log writer that may have its own formatter and/or
// filter.
@interface GTMLogger (GTMLoggerLogWriter) <GTMLogWriter>
@end // GTMLoggerLogWriter
//
// Log Formatters
//
// Protocol to be implemented by a GTMLogFormatter instance.
@protocol GTMLogFormatter <NSObject>
// Returns a formatted string using the format specified in |fmt| and the va
// args specified in |args|.
- (NSString *)stringForFunc:(NSString *)func
withFormat:(NSString *)fmt
valist:(va_list)args
level:(GTMLoggerLevel)level NS_FORMAT_FUNCTION(2, 0);
@end // GTMLogFormatter
// A basic log formatter that formats a string the same way that NSLog (or
// printf) would. It does not do anything fancy, nor does it add any data of its
// own.
@interface GTMLogBasicFormatter : NSObject <GTMLogFormatter>
// Helper method for prettying C99 __func__ and GCC __PRETTY_FUNCTION__
- (NSString *)prettyNameForFunc:(NSString *)func;
@end // GTMLogBasicFormatter
// A log formatter that formats the log string like the basic formatter, but
// also prepends a timestamp and some basic process info to the message, as
// shown in the following sample output.
// 2007-12-30 10:29:24.177 myapp[4588/0xa07d0f60] [lvl=1] log mesage here
@interface GTMLogStandardFormatter : GTMLogBasicFormatter {
@private
NSDateFormatter *dateFormatter_; // yyyy-MM-dd HH:mm:ss.SSS
NSString *pname_;
pid_t pid_;
}
@end // GTMLogStandardFormatter
//
// Log Filters
//
// Protocol to be imlemented by a GTMLogFilter instance.
@protocol GTMLogFilter <NSObject>
// Returns YES if |msg| at |level| should be filtered out; NO otherwise.
- (BOOL)filterAllowsMessage:(NSString *)msg level:(GTMLoggerLevel)level;
@end // GTMLogFilter
// A log filter that filters messages at the kGTMLoggerLevelDebug level out of
// non-debug builds. Messages at the kGTMLoggerLevelInfo level are also filtered
// out of non-debug builds unless GTMVerboseLogging is set in the environment or
// the processes's defaults. Messages at the kGTMLoggerLevelError level are
// never filtered.
@interface GTMLogLevelFilter : NSObject <GTMLogFilter>
@end // GTMLogLevelFilter
// A simple log filter that does NOT filter anything out;
// -filterAllowsMessage:level will always return YES. This can be a convenient
// way to enable debug-level logging in release builds (if you so desire).
@interface GTMLogNoFilter : NSObject <GTMLogFilter>
@end // GTMLogNoFilter
// Base class for custom level filters. Not for direct use, use the minimum
// or maximum level subclasses below.
@interface GTMLogAllowedLevelFilter : NSObject <GTMLogFilter> {
@private
NSIndexSet *allowedLevels_;
}
@end
// A log filter that allows you to set a minimum log level. Messages below this
// level will be filtered.
@interface GTMLogMininumLevelFilter : GTMLogAllowedLevelFilter
// Designated initializer, logs at levels < |level| will be filtered.
- (id)initWithMinimumLevel:(GTMLoggerLevel)level;
@end
// A log filter that allows you to set a maximum log level. Messages whose level
// exceeds this level will be filtered. This is really only useful if you have
// a composite GTMLogger that is sending the other messages elsewhere.
@interface GTMLogMaximumLevelFilter : GTMLogAllowedLevelFilter
// Designated initializer, logs at levels > |level| will be filtered.
- (id)initWithMaximumLevel:(GTMLoggerLevel)level;
@end
// For subclasses only
@interface GTMLogger (PrivateMethods)
- (void)logInternalFunc:(const char *)func
format:(NSString *)fmt
valist:(va_list)args
level:(GTMLoggerLevel)level NS_FORMAT_FUNCTION(2, 0);
@end

View File

@@ -0,0 +1,88 @@
//
// GTMMethodCheck.h
//
// Copyright 2006-2008 Google Inc.
//
// 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.
//
#import <Foundation/Foundation.h>
#import <stdio.h>
#import <sysexits.h>
/// A macro for enforcing debug time checks to make sure all required methods are linked in
//
// When using categories, it can be very easy to forget to include the
// implementation of a category.
// Let's say you had a class foo that depended on method bar of class baz, and
// method bar was implemented as a member of a category.
// You could add the following code:
// @implementation foo
// GTM_METHOD_CHECK(baz, bar)
// @end
// and the code would check to make sure baz was implemented just before main
// was called. This works for both dynamic libraries, and executables.
//
// Classes (or one of their superclasses) being checked must conform to the
// NSObject protocol. We will check this, and spit out a warning if a class does
// not conform to NSObject.
//
// This is not compiled into release builds.
#ifdef DEBUG
#ifdef __cplusplus
extern "C" {
#endif
// If you get an error for GTMMethodCheckMethodChecker not being defined,
// you need to link in GTMMethodCheck.m. We keep it hidden so that we can have
// it living in several separate images without conflict.
// Functions with the ((constructor)) attribute are called after all +loads
// have been called. See "Initializing Objective-C Classes" in
// http://developer.apple.com/documentation/DeveloperTools/Conceptual/DynamicLibraries/Articles/DynamicLibraryDesignGuidelines.html#//apple_ref/doc/uid/TP40002013-DontLinkElementID_20
__attribute__ ((constructor, visibility("hidden"))) void GTMMethodCheckMethodChecker(void);
#ifdef __cplusplus
};
#endif
// This is the "magic".
// A) we need a multi layer define here so that the stupid preprocessor
// expands __LINE__ out the way we want it. We need LINE so that each of
// out GTM_METHOD_CHECKs generates a unique class method for the class.
#define GTM_METHOD_CHECK(class, method) GTM_METHOD_CHECK_INNER(class, method, __LINE__)
#define GTM_METHOD_CHECK_INNER(class, method, line) GTM_METHOD_CHECK_INNER_INNER(class, method, line)
// B) Create up a class method called xxGMethodCheckMethod+class+line that the
// GTMMethodCheckMethodChecker function can look for and call. We
// look for GTMMethodCheckMethodChecker to enforce linkage of
// GTMMethodCheck.m.
#define GTM_METHOD_CHECK_INNER_INNER(class, method, line) \
+ (void)xxGTMMethodCheckMethod ## class ## line { \
void (*addr)() = GTMMethodCheckMethodChecker; \
if (addr && ![class instancesRespondToSelector:@selector(method)] \
&& ![class respondsToSelector:@selector(method)]) { \
fprintf(stderr, "%s:%d: error: We need method '%s' to be linked in for class '%s'\n", \
__FILE__, line, #method, #class); \
exit(EX_SOFTWARE); \
} \
}
#else // !DEBUG
// Do nothing in release.
#define GTM_METHOD_CHECK(class, method)
#endif // DEBUG

View File

@@ -0,0 +1,36 @@
//
// GTMNSDictionary+URLArguments.h
//
// Copyright 2006-2008 Google Inc.
//
// 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.
//
#import <Foundation/Foundation.h>
/// Utility for building a URL or POST argument string.
@interface NSDictionary (GTMNSDictionaryURLArgumentsAdditions)
/// Returns a dictionary of the decoded key-value pairs in a http arguments
/// string of the form key1=value1&key2=value2&...&keyN=valueN.
/// Keys and values will be unescaped automatically.
/// Only the first value for a repeated key is returned.
+ (NSDictionary *)gtm_dictionaryWithHttpArgumentsString:(NSString *)argString;
/// Gets a string representation of the dictionary in the form
/// key1=value1&key2=value2&...&keyN=valueN, suitable for use as either
/// URL arguments (after a '?') or POST body. Keys and values will be escaped
/// automatically, so should be unescaped in the dictionary.
- (NSString *)gtm_httpArgumentsString;
@end

View File

@@ -0,0 +1,41 @@
//
// GTMNSString+URLArguments.h
//
// Copyright 2006-2008 Google Inc.
//
// 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.
//
#import <Foundation/Foundation.h>
/// Utilities for encoding and decoding URL arguments.
@interface NSString (GTMNSStringURLArgumentsAdditions)
/// Returns a string that is escaped properly to be a URL argument.
//
/// This differs from stringByAddingPercentEscapesUsingEncoding: in that it
/// will escape all the reserved characters (per RFC 3986
/// <http://www.ietf.org/rfc/rfc3986.txt>) which
/// stringByAddingPercentEscapesUsingEncoding would leave.
///
/// This will also escape '%', so this should not be used on a string that has
/// already been escaped unless double-escaping is the desired result.
- (NSString*)gtm_stringByEscapingForURLArgument;
/// Returns the unescaped version of a URL argument
//
/// This has the same behavior as stringByReplacingPercentEscapesUsingEncoding:,
/// except that it will also convert '+' to space.
- (NSString*)gtm_stringByUnescapingFromURLArgument;
@end

View File

@@ -0,0 +1,356 @@
/* Copyright (c) 2011 Google Inc.
*
* 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.
*/
#if GTM_INCLUDE_OAUTH2 || !GDATA_REQUIRE_SERVICE_INCLUDES
// This class implements the OAuth 2 protocol for authorizing requests.
// http://tools.ietf.org/html/draft-ietf-oauth-v2
#import <Foundation/Foundation.h>
// GTMHTTPFetcher.h brings in GTLDefines/GDataDefines
#import "GTMHTTPFetcher.h"
#undef _EXTERN
#undef _INITIALIZE_AS
#ifdef GTMOAUTH2AUTHENTICATION_DEFINE_GLOBALS
#define _EXTERN
#define _INITIALIZE_AS(x) =x
#else
#if defined(__cplusplus)
#define _EXTERN extern "C"
#else
#define _EXTERN extern
#endif
#define _INITIALIZE_AS(x)
#endif
// Until all OAuth 2 providers are up to the same spec, we'll provide a crude
// way here to override the "Bearer" string in the Authorization header
#ifndef GTM_OAUTH2_BEARER
#define GTM_OAUTH2_BEARER "Bearer"
#endif
// Service provider name allows stored authorization to be associated with
// the authorizing service
_EXTERN NSString* const kGTMOAuth2ServiceProviderGoogle _INITIALIZE_AS(@"Google");
//
// GTMOAuth2SignIn constants, included here for use by clients
//
_EXTERN NSString* const kGTMOAuth2ErrorDomain _INITIALIZE_AS(@"com.google.GTMOAuth2");
// Error userInfo keys
_EXTERN NSString* const kGTMOAuth2ErrorMessageKey _INITIALIZE_AS(@"error");
_EXTERN NSString* const kGTMOAuth2ErrorRequestKey _INITIALIZE_AS(@"request");
_EXTERN NSString* const kGTMOAuth2ErrorJSONKey _INITIALIZE_AS(@"json");
enum {
// Error code indicating that the window was prematurely closed
kGTMOAuth2ErrorWindowClosed = -1000,
kGTMOAuth2ErrorAuthorizationFailed = -1001,
kGTMOAuth2ErrorTokenExpired = -1002,
kGTMOAuth2ErrorTokenUnavailable = -1003,
kGTMOAuth2ErrorUnauthorizableRequest = -1004
};
// Notifications for token fetches
_EXTERN NSString* const kGTMOAuth2FetchStarted _INITIALIZE_AS(@"kGTMOAuth2FetchStarted");
_EXTERN NSString* const kGTMOAuth2FetchStopped _INITIALIZE_AS(@"kGTMOAuth2FetchStopped");
_EXTERN NSString* const kGTMOAuth2FetcherKey _INITIALIZE_AS(@"fetcher");
_EXTERN NSString* const kGTMOAuth2FetchTypeKey _INITIALIZE_AS(@"FetchType");
_EXTERN NSString* const kGTMOAuth2FetchTypeToken _INITIALIZE_AS(@"token");
_EXTERN NSString* const kGTMOAuth2FetchTypeRefresh _INITIALIZE_AS(@"refresh");
_EXTERN NSString* const kGTMOAuth2FetchTypeAssertion _INITIALIZE_AS(@"assertion");
_EXTERN NSString* const kGTMOAuth2FetchTypeUserInfo _INITIALIZE_AS(@"userInfo");
// Token-issuance errors
_EXTERN NSString* const kGTMOAuth2ErrorKey _INITIALIZE_AS(@"error");
_EXTERN NSString* const kGTMOAuth2ErrorObjectKey _INITIALIZE_AS(@"kGTMOAuth2ErrorObjectKey");
_EXTERN NSString* const kGTMOAuth2ErrorInvalidRequest _INITIALIZE_AS(@"invalid_request");
_EXTERN NSString* const kGTMOAuth2ErrorInvalidClient _INITIALIZE_AS(@"invalid_client");
_EXTERN NSString* const kGTMOAuth2ErrorInvalidGrant _INITIALIZE_AS(@"invalid_grant");
_EXTERN NSString* const kGTMOAuth2ErrorUnauthorizedClient _INITIALIZE_AS(@"unauthorized_client");
_EXTERN NSString* const kGTMOAuth2ErrorUnsupportedGrantType _INITIALIZE_AS(@"unsupported_grant_type");
_EXTERN NSString* const kGTMOAuth2ErrorInvalidScope _INITIALIZE_AS(@"invalid_scope");
// Notification that sign-in has completed, and token fetches will begin (useful
// for displaying interstitial messages after the window has closed)
_EXTERN NSString* const kGTMOAuth2UserSignedIn _INITIALIZE_AS(@"kGTMOAuth2UserSignedIn");
// Notification for token changes
_EXTERN NSString* const kGTMOAuth2AccessTokenRefreshed _INITIALIZE_AS(@"kGTMOAuth2AccessTokenRefreshed");
_EXTERN NSString* const kGTMOAuth2RefreshTokenChanged _INITIALIZE_AS(@"kGTMOAuth2RefreshTokenChanged");
_EXTERN NSString* const kGTMOAuth2AccessTokenRefreshFailed _INITIALIZE_AS(@"kGTMOAuth2AccessTokenRefreshFailed");
// Notification for WebView loading
_EXTERN NSString* const kGTMOAuth2WebViewStartedLoading _INITIALIZE_AS(@"kGTMOAuth2WebViewStartedLoading");
_EXTERN NSString* const kGTMOAuth2WebViewStoppedLoading _INITIALIZE_AS(@"kGTMOAuth2WebViewStoppedLoading");
_EXTERN NSString* const kGTMOAuth2WebViewKey _INITIALIZE_AS(@"kGTMOAuth2WebViewKey");
_EXTERN NSString* const kGTMOAuth2WebViewStopKindKey _INITIALIZE_AS(@"kGTMOAuth2WebViewStopKindKey");
_EXTERN NSString* const kGTMOAuth2WebViewFinished _INITIALIZE_AS(@"finished");
_EXTERN NSString* const kGTMOAuth2WebViewFailed _INITIALIZE_AS(@"failed");
_EXTERN NSString* const kGTMOAuth2WebViewCancelled _INITIALIZE_AS(@"cancelled");
// Notification for network loss during html sign-in display
_EXTERN NSString* const kGTMOAuth2NetworkLost _INITIALIZE_AS(@"kGTMOAuthNetworkLost");
_EXTERN NSString* const kGTMOAuth2NetworkFound _INITIALIZE_AS(@"kGTMOAuthNetworkFound");
@interface GTMOAuth2Authentication : NSObject <GTMFetcherAuthorizationProtocol> {
@private
NSString *clientID_;
NSString *clientSecret_;
NSString *redirectURI_;
NSMutableDictionary *parameters_;
// authorization parameters
NSURL *tokenURL_;
NSDate *expirationDate_;
NSString *authorizationTokenKey_;
NSDictionary *additionalTokenRequestParameters_;
NSDictionary *additionalGrantTypeRequestParameters_;
// queue of requests for authorization waiting for a valid access token
GTMHTTPFetcher *refreshFetcher_;
NSMutableArray *authorizationQueue_;
id <GTMHTTPFetcherServiceProtocol> fetcherService_; // WEAK
Class parserClass_;
BOOL shouldAuthorizeAllRequests_;
// arbitrary data retained for the user
id userData_;
NSMutableDictionary *properties_;
}
// OAuth2 standard protocol parameters
//
// These should be the plain strings; any needed escaping will be provided by
// the library.
// Request properties
@property (copy) NSString *clientID;
@property (copy) NSString *clientSecret;
@property (copy) NSString *redirectURI;
@property (retain) NSString *scope;
@property (retain) NSString *tokenType;
@property (retain) NSString *assertion;
@property (retain) NSString *refreshScope;
// Apps may optionally add parameters here to be provided to the token
// endpoint on token requests and refreshes.
@property (retain) NSDictionary *additionalTokenRequestParameters;
// Apps may optionally add parameters here to be provided to the token
// endpoint on specific token requests and refreshes, keyed by the grant_type.
// For example, if a different "type" parameter is required for obtaining
// the auth code and on refresh, this might be:
//
// viewController.authentication.additionalGrantTypeRequestParameters = @{
// @"authorization_code" : @{ @"type" : @"code" },
// @"refresh_token" : @{ @"type" : @"refresh" }
// };
@property (retain) NSDictionary *additionalGrantTypeRequestParameters;
// Response properties
@property (retain) NSMutableDictionary *parameters;
@property (retain) NSString *accessToken;
@property (retain) NSString *refreshToken;
@property (retain) NSNumber *expiresIn;
@property (retain) NSString *code;
@property (retain) NSString *errorString;
// URL for obtaining access tokens
@property (copy) NSURL *tokenURL;
// Calculated expiration date (expiresIn seconds added to the
// time the access token was received.)
@property (copy) NSDate *expirationDate;
// Service identifier, like "Google"; not used for authentication
//
// The provider name is just for allowing stored authorization to be associated
// with the authorizing service.
@property (copy) NSString *serviceProvider;
// User ID; not used for authentication
@property (retain) NSString *userID;
// User email and verified status; not used for authentication
//
// The verified string can be checked with -boolValue. If the result is false,
// then the email address is listed with the account on the server, but the
// address has not been confirmed as belonging to the owner of the account.
@property (retain) NSString *userEmail;
@property (retain) NSString *userEmailIsVerified;
// Property indicating if this auth has a refresh or access token so is suitable
// for authorizing a request. This does not guarantee that the token is valid.
@property (readonly) BOOL canAuthorize;
// Property indicating if this object will authorize plain http request
// (as well as any non-https requests.) Default is NO, only requests with the
// scheme https are authorized, since security may be compromised if tokens
// are sent over the wire using an unencrypted protocol like http.
@property (assign) BOOL shouldAuthorizeAllRequests;
// userData is retained for the convenience of the caller
@property (retain) id userData;
// Stored property values are retained for the convenience of the caller
@property (retain) NSDictionary *properties;
// Property for the optional fetcher service instance to be used to create
// fetchers
//
// Fetcher service objects retain authorizations, so this is weak to avoid
// circular retains.
@property (assign) id <GTMHTTPFetcherServiceProtocol> fetcherService; // WEAK
// Alternative JSON parsing class; this should implement the
// GTMOAuth2ParserClass informal protocol. If this property is
// not set, the class SBJSON must be available in the runtime.
@property (assign) Class parserClass;
// Key for the response parameter used for the authorization header; by default,
// "access_token" is used, but some servers may expect alternatives, like
// "id_token".
@property (copy) NSString *authorizationTokenKey;
// Convenience method for creating an authentication object
+ (id)authenticationWithServiceProvider:(NSString *)serviceProvider
tokenURL:(NSURL *)tokenURL
redirectURI:(NSString *)redirectURI
clientID:(NSString *)clientID
clientSecret:(NSString *)clientSecret;
// Clear out any authentication values, prepare for a new request fetch
- (void)reset;
// Main authorization entry points
//
// These will refresh the access token, if necessary, add the access token to
// the request, then invoke the callback.
//
// The request argument may be nil to just force a refresh of the access token,
// if needed.
//
// NOTE: To avoid accidental leaks of bearer tokens, the request must
// be for a URL with the scheme https unless the shouldAuthorizeAllRequests
// property is set.
// The finish selector should have a signature matching
// - (void)authentication:(GTMOAuth2Authentication *)auth
// request:(NSMutableURLRequest *)request
// finishedWithError:(NSError *)error;
- (void)authorizeRequest:(NSMutableURLRequest *)request
delegate:(id)delegate
didFinishSelector:(SEL)sel;
#if NS_BLOCKS_AVAILABLE
- (void)authorizeRequest:(NSMutableURLRequest *)request
completionHandler:(void (^)(NSError *error))handler;
#endif
// Synchronous entry point; authorizing this way cannot refresh an expired
// access token
- (BOOL)authorizeRequest:(NSMutableURLRequest *)request;
// If the authentication is waiting for a refresh to complete, spin the run
// loop, discarding events, until the fetch has completed
//
// This is only for use in testing or in tools without a user interface.
- (void)waitForCompletionWithTimeout:(NSTimeInterval)timeoutInSeconds;
//////////////////////////////////////////////////////////////////////////////
//
// Internal properties and methods for use by GTMOAuth2SignIn
//
// Pending fetcher to get a new access token, if any
@property (retain) GTMHTTPFetcher *refreshFetcher;
// Check if a request is queued up to be authorized
- (BOOL)isAuthorizingRequest:(NSURLRequest *)request;
// Check if a request appears to be authorized
- (BOOL)isAuthorizedRequest:(NSURLRequest *)request;
// Stop any pending refresh fetch. This will also cancel the authorization
// for all fetch requests pending authorization.
- (void)stopAuthorization;
// Prevents authorization callback for a given request.
- (void)stopAuthorizationForRequest:(NSURLRequest *)request;
// OAuth fetch user-agent header value
- (NSString *)userAgent;
// Parse and set token and token secret from response data
- (void)setKeysForResponseString:(NSString *)str;
- (void)setKeysForResponseDictionary:(NSDictionary *)dict;
// Persistent token string for keychain storage
//
// We'll use the format "refresh_token=foo&serviceProvider=bar" so we can
// easily alter what portions of the auth data are stored
//
// Use these methods for serialization
- (NSString *)persistenceResponseString;
- (void)setKeysForPersistenceResponseString:(NSString *)str;
// method to begin fetching an access token, used by the sign-in object
- (GTMHTTPFetcher *)beginTokenFetchWithDelegate:(id)delegate
didFinishSelector:(SEL)finishedSel;
// Entry point to post a notification about a fetcher currently used for
// obtaining or refreshing a token; the sign-in object will also use this
// to indicate when the user's email address is being fetched.
//
// Fetch type constants are above under "notifications for token fetches"
- (void)notifyFetchIsRunning:(BOOL)isStarting
fetcher:(GTMHTTPFetcher *)fetcher
type:(NSString *)fetchType;
// Arbitrary key-value properties retained for the user
- (void)setProperty:(id)obj forKey:(NSString *)key;
- (id)propertyForKey:(NSString *)key;
//
// Utilities
//
+ (NSString *)encodedOAuthValueForString:(NSString *)str;
+ (NSString *)encodedQueryParametersForDictionary:(NSDictionary *)dict;
+ (NSDictionary *)dictionaryWithResponseString:(NSString *)responseStr;
+ (NSDictionary *)dictionaryWithJSONData:(NSData *)data;
+ (NSString *)scopeWithStrings:(NSString *)firsStr, ... NS_REQUIRES_NIL_TERMINATION;
@end
#endif // GTM_INCLUDE_OAUTH2 || !GDATA_REQUIRE_SERVICE_INCLUDES

View File

@@ -0,0 +1,187 @@
/* Copyright (c) 2011 Google Inc.
*
* 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.
*/
//
// This sign-in object opens and closes the web view window as needed for
// users to sign in. For signing in to Google, it also obtains
// the authenticated user's email address.
//
// Typically, this will be managed for the application by
// GTMOAuth2ViewControllerTouch or GTMOAuth2WindowController, so this
// class's interface is interesting only if
// you are creating your own window controller for sign-in.
//
//
// Delegate methods implemented by the window controller
//
// The window controller implements two methods for use by the sign-in object,
// the webRequestSelector and the finishedSelector:
//
// webRequestSelector has a signature matching
// - (void)signIn:(GTMOAuth2SignIn *)signIn displayRequest:(NSURLRequest *)request
//
// The web request selector will be invoked with a request to be displayed, or
// nil to close the window when the final callback request has been encountered.
//
//
// finishedSelector has a signature matching
// - (void)signin:(GTMOAuth2SignIn *)signin finishedWithAuth:(GTMOAuth2Authentication *)auth error:(NSError *)error
//
// The finished selector will be invoked when sign-in has completed, except
// when explicitly canceled by calling cancelSigningIn
//
#if GTM_INCLUDE_OAUTH2 || !GDATA_REQUIRE_SERVICE_INCLUDES
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
// GTMHTTPFetcher brings in GTLDefines/GDataDefines
#import "GTMHTTPFetcher.h"
#import "GTMOAuth2Authentication.h"
@interface GTMOAuth2SignIn : NSObject {
@private
GTMOAuth2Authentication *auth_;
// the endpoint for displaying the sign-in page
NSURL *authorizationURL_;
NSDictionary *additionalAuthorizationParameters_;
id delegate_;
SEL webRequestSelector_;
SEL finishedSelector_;
BOOL hasHandledCallback_;
GTMHTTPFetcher *pendingFetcher_;
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
BOOL shouldFetchGoogleUserEmail_;
BOOL shouldFetchGoogleUserProfile_;
NSDictionary *userProfile_;
#endif
SCNetworkReachabilityRef reachabilityRef_;
NSTimer *networkLossTimer_;
NSTimeInterval networkLossTimeoutInterval_;
BOOL hasNotifiedNetworkLoss_;
id userData_;
}
@property (nonatomic, retain) GTMOAuth2Authentication *authentication;
@property (nonatomic, retain) NSURL *authorizationURL;
@property (nonatomic, retain) NSDictionary *additionalAuthorizationParameters;
// The delegate is released when signing in finishes or is cancelled
@property (nonatomic, retain) id delegate;
@property (nonatomic, assign) SEL webRequestSelector;
@property (nonatomic, assign) SEL finishedSelector;
@property (nonatomic, retain) id userData;
// By default, signing in to Google will fetch the user's email, but will not
// fetch the user's profile.
//
// The email is saved in the auth object.
// The profile is available immediately after sign-in.
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
@property (nonatomic, assign) BOOL shouldFetchGoogleUserEmail;
@property (nonatomic, assign) BOOL shouldFetchGoogleUserProfile;
@property (nonatomic, retain, readonly) NSDictionary *userProfile;
#endif
// The default timeout for an unreachable network during display of the
// sign-in page is 30 seconds; set this to 0 to have no timeout
@property (nonatomic, assign) NSTimeInterval networkLossTimeoutInterval;
// The delegate is retained until sign-in has completed or been canceled
//
// designated initializer
- (id)initWithAuthentication:(GTMOAuth2Authentication *)auth
authorizationURL:(NSURL *)authorizationURL
delegate:(id)delegate
webRequestSelector:(SEL)webRequestSelector
finishedSelector:(SEL)finishedSelector;
// A default authentication object for signing in to Google services
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
+ (GTMOAuth2Authentication *)standardGoogleAuthenticationForScope:(NSString *)scope
clientID:(NSString *)clientID
clientSecret:(NSString *)clientSecret;
#endif
#pragma mark Methods used by the Window Controller
// Start the sequence of fetches and sign-in window display for sign-in
- (BOOL)startSigningIn;
// Stop any pending fetches, and close the window (but don't call the
// delegate's finishedSelector)
- (void)cancelSigningIn;
// Window controllers must tell the sign-in object about any redirect
// requested by the web view, and any changes in the webview window title
//
// If these return YES then the event was handled by the
// sign-in object (typically by closing the window) and should be ignored by
// the window controller's web view
- (BOOL)requestRedirectedToRequest:(NSURLRequest *)redirectedRequest;
- (BOOL)titleChanged:(NSString *)title;
- (BOOL)cookiesChanged:(NSHTTPCookieStorage *)cookieStorage;
- (BOOL)loadFailedWithError:(NSError *)error;
// Window controllers must tell the sign-in object if the window was closed
// prematurely by the user (but not by the sign-in object); this calls the
// delegate's finishedSelector
- (void)windowWasClosed;
// Start the sequences for signing in with an authorization code. The
// authentication must contain an authorization code, otherwise the process
// will fail.
- (void)authCodeObtained;
#pragma mark -
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
// Revocation of an authorized token from Google
+ (void)revokeTokenForGoogleAuthentication:(GTMOAuth2Authentication *)auth;
// Create a fetcher for obtaining the user's Google email address or profile,
// according to the current auth scopes.
//
// The auth object must have been created with appropriate scopes.
//
// The fetcher's response data can be parsed with NSJSONSerialization.
+ (GTMHTTPFetcher *)userInfoFetcherWithAuth:(GTMOAuth2Authentication *)auth;
#endif
#pragma mark -
// Standard authentication values
+ (NSString *)nativeClientRedirectURI;
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
+ (NSURL *)googleAuthorizationURL;
+ (NSURL *)googleTokenURL;
+ (NSURL *)googleUserInfoURL;
#endif
@end
#endif // #if GTM_INCLUDE_OAUTH2 || !GDATA_REQUIRE_SERVICE_INCLUDES

View File

@@ -0,0 +1,366 @@
/* Copyright (c) 2011 Google Inc.
*
* 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.
*/
//
// GTMOAuth2ViewControllerTouch.h
//
// This view controller for iPhone handles sign-in via OAuth to Google or
// other services.
//
// This controller is not reusable; create a new instance of this controller
// every time the user will sign in.
//
#if GTM_INCLUDE_OAUTH2 || !GDATA_REQUIRE_SERVICE_INCLUDES
#import <Foundation/Foundation.h>
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#import "GTMOAuth2Authentication.h"
#undef _EXTERN
#undef _INITIALIZE_AS
#ifdef GTMOAUTH2VIEWCONTROLLERTOUCH_DEFINE_GLOBALS
#define _EXTERN
#define _INITIALIZE_AS(x) =x
#else
#define _EXTERN extern
#define _INITIALIZE_AS(x)
#endif
_EXTERN NSString* const kGTMOAuth2KeychainErrorDomain _INITIALIZE_AS(@"com.google.GTMOAuthKeychain");
@class GTMOAuth2SignIn;
@class GTMOAuth2ViewControllerTouch;
typedef void (^GTMOAuth2ViewControllerCompletionHandler)(GTMOAuth2ViewControllerTouch *viewController, GTMOAuth2Authentication *auth, NSError *error);
@interface GTMOAuth2ViewControllerTouch : UIViewController<UINavigationControllerDelegate, UIWebViewDelegate> {
@private
UIButton *backButton_;
UIButton *forwardButton_;
UIActivityIndicatorView *initialActivityIndicator_;
UIView *navButtonsView_;
UIBarButtonItem *rightBarButtonItem_;
UIWebView *webView_;
// The object responsible for the sign-in networking sequence; it holds
// onto the authentication object as well.
GTMOAuth2SignIn *signIn_;
// the page request to load when awakeFromNib occurs
NSURLRequest *request_;
// The user we're calling back
//
// The delegate is retained only until the callback is invoked
// or the sign-in is canceled
id delegate_;
SEL finishedSelector_;
#if NS_BLOCKS_AVAILABLE
GTMOAuth2ViewControllerCompletionHandler completionBlock_;
void (^popViewBlock_)(void);
#endif
NSString *keychainItemName_;
CFTypeRef keychainItemAccessibility_;
// if non-nil, the html string to be displayed immediately upon opening
// of the web view
NSString *initialHTMLString_;
// set to 1 or -1 if the user sets the showsInitialActivityIndicator
// property
int mustShowActivityIndicator_;
// if non-nil, the URL for which cookies will be deleted when the
// browser view is dismissed
NSURL *browserCookiesURL_;
id userData_;
NSMutableDictionary *properties_;
#if __IPHONE_OS_VERSION_MIN_REQUIRED < 60000
// We delegate the decision to our owning NavigationController (if any).
// But, the NavigationController will call us back, and ask us.
// BOOL keeps us from infinite looping.
BOOL isInsideShouldAutorotateToInterfaceOrientation_;
#endif
// YES, when view first shown in this signIn session.
BOOL isViewShown_;
// YES, after the view has fully transitioned in.
BOOL didViewAppear_;
// YES between sends of start and stop notifications
BOOL hasNotifiedWebViewStartedLoading_;
// To prevent us from calling our delegate's selector more than once.
BOOL hasCalledFinished_;
// Set in a webView callback.
BOOL hasDoneFinalRedirect_;
// Set during the pop initiated by the sign-in object; otherwise,
// viewWillDisappear indicates that some external change of the view
// has stopped the sign-in.
BOOL didDismissSelf_;
}
// the application and service name to use for saving the auth tokens
// to the keychain
@property (nonatomic, copy) NSString *keychainItemName;
// the keychain item accessibility is a system constant for use
// with kSecAttrAccessible.
//
// Since it's a system constant, we do not need to retain it.
@property (nonatomic, assign) CFTypeRef keychainItemAccessibility;
// optional html string displayed immediately upon opening the web view
//
// This string is visible just until the sign-in web page loads, and
// may be used for a "Loading..." type of message or to set the
// initial view color
@property (nonatomic, copy) NSString *initialHTMLString;
// an activity indicator shows during initial webview load when no initial HTML
// string is specified, but the activity indicator can be forced to be shown
// with this property
@property (nonatomic, assign) BOOL showsInitialActivityIndicator;
// the underlying object to hold authentication tokens and authorize http
// requests
@property (nonatomic, retain, readonly) GTMOAuth2Authentication *authentication;
// the underlying object which performs the sign-in networking sequence
@property (nonatomic, retain, readonly) GTMOAuth2SignIn *signIn;
// user interface elements
@property (nonatomic, retain) IBOutlet UIButton *backButton;
@property (nonatomic, retain) IBOutlet UIButton *forwardButton;
@property (nonatomic, retain) IBOutlet UIActivityIndicatorView *initialActivityIndicator;
@property (nonatomic, retain) IBOutlet UIView *navButtonsView;
@property (nonatomic, retain) IBOutlet UIBarButtonItem *rightBarButtonItem;
@property (nonatomic, retain) IBOutlet UIWebView *webView;
#if NS_BLOCKS_AVAILABLE
// An optional block to be called when the view should be popped. If not set,
// the view controller will use its navigation controller to pop the view.
@property (nonatomic, copy) void (^popViewBlock)(void);
#endif
// the default timeout for an unreachable network during display of the
// sign-in page is 30 seconds; set this to 0 to have no timeout
@property (nonatomic, assign) NSTimeInterval networkLossTimeoutInterval;
// if set, cookies are deleted for this URL when the view is hidden
//
// For Google sign-ins, this is set by default to https://google.com/accounts
// but it may be explicitly set to nil to disable clearing of browser cookies
@property (nonatomic, retain) NSURL *browserCookiesURL;
// userData is retained for the convenience of the caller
@property (nonatomic, retain) id userData;
// Stored property values are retained for the convenience of the caller
- (void)setProperty:(id)obj forKey:(NSString *)key;
- (id)propertyForKey:(NSString *)key;
@property (nonatomic, retain) NSDictionary *properties;
// Method for creating a controller to authenticate to Google services
//
// scope is the requested scope of authorization
// (like "http://www.google.com/m8/feeds")
//
// keychain item name is used for storing the token on the keychain,
// keychainItemName should be like "My Application: Google Latitude"
// (or set to nil if no persistent keychain storage is desired)
//
// the delegate is retained only until the finished selector is invoked
// or the sign-in is canceled
//
// If you don't like the default nibName and bundle, you can change them
// using the UIViewController properties once you've made one of these.
//
// finishedSelector is called after authentication completes. It should follow
// this signature.
//
// - (void)viewController:(GTMOAuth2ViewControllerTouch *)viewController
// finishedWithAuth:(GTMOAuth2Authentication *)auth
// error:(NSError *)error;
//
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
+ (id)controllerWithScope:(NSString *)scope
clientID:(NSString *)clientID
clientSecret:(NSString *)clientSecret
keychainItemName:(NSString *)keychainItemName
delegate:(id)delegate
finishedSelector:(SEL)finishedSelector;
- (id)initWithScope:(NSString *)scope
clientID:(NSString *)clientID
clientSecret:(NSString *)clientSecret
keychainItemName:(NSString *)keychainItemName
delegate:(id)delegate
finishedSelector:(SEL)finishedSelector;
#if NS_BLOCKS_AVAILABLE
+ (id)controllerWithScope:(NSString *)scope
clientID:(NSString *)clientID
clientSecret:(NSString *)clientSecret
keychainItemName:(NSString *)keychainItemName
completionHandler:(GTMOAuth2ViewControllerCompletionHandler)handler;
- (id)initWithScope:(NSString *)scope
clientID:(NSString *)clientID
clientSecret:(NSString *)clientSecret
keychainItemName:(NSString *)keychainItemName
completionHandler:(GTMOAuth2ViewControllerCompletionHandler)handler;
#endif
#endif
// Create a controller for authenticating to non-Google services, taking
// explicit endpoint URLs and an authentication object
+ (id)controllerWithAuthentication:(GTMOAuth2Authentication *)auth
authorizationURL:(NSURL *)authorizationURL
keychainItemName:(NSString *)keychainItemName // may be nil
delegate:(id)delegate
finishedSelector:(SEL)finishedSelector;
// This is the designated initializer
- (id)initWithAuthentication:(GTMOAuth2Authentication *)auth
authorizationURL:(NSURL *)authorizationURL
keychainItemName:(NSString *)keychainItemName
delegate:(id)delegate
finishedSelector:(SEL)finishedSelector;
#if NS_BLOCKS_AVAILABLE
+ (id)controllerWithAuthentication:(GTMOAuth2Authentication *)auth
authorizationURL:(NSURL *)authorizationURL
keychainItemName:(NSString *)keychainItemName // may be nil
completionHandler:(GTMOAuth2ViewControllerCompletionHandler)handler;
- (id)initWithAuthentication:(GTMOAuth2Authentication *)auth
authorizationURL:(NSURL *)authorizationURL
keychainItemName:(NSString *)keychainItemName
completionHandler:(GTMOAuth2ViewControllerCompletionHandler)handler;
#endif
// subclasses may override authNibName to specify a custom name
+ (NSString *)authNibName;
// subclasses may override authNibBundle to specify a custom bundle
+ (NSBundle *)authNibBundle;
// subclasses may override setUpNavigation to provide their own navigation
// controls
- (void)setUpNavigation;
// apps may replace the sign-in class with their own subclass of it
+ (Class)signInClass;
+ (void)setSignInClass:(Class)theClass;
- (void)cancelSigningIn;
// revocation of an authorized token from Google
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
+ (void)revokeTokenForGoogleAuthentication:(GTMOAuth2Authentication *)auth;
#endif
//
// Keychain
//
// create an authentication object for Google services from the access
// token and secret stored in the keychain; if no token is available, return
// an unauthorized auth object
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
+ (GTMOAuth2Authentication *)authForGoogleFromKeychainForName:(NSString *)keychainItemName
clientID:(NSString *)clientID
clientSecret:(NSString *)clientSecret;
#endif
// add tokens from the keychain, if available, to the authentication object
//
// returns YES if the authentication object was authorized from the keychain
+ (BOOL)authorizeFromKeychainForName:(NSString *)keychainItemName
authentication:(GTMOAuth2Authentication *)auth;
// method for deleting the stored access token and secret, useful for "signing
// out"
+ (BOOL)removeAuthFromKeychainForName:(NSString *)keychainItemName;
// method for saving the stored access token and secret
+ (BOOL)saveParamsToKeychainForName:(NSString *)keychainItemName
accessibility:(CFTypeRef)accessibility
authentication:(GTMOAuth2Authentication *)auth;
// older version, defaults to kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly
+ (BOOL)saveParamsToKeychainForName:(NSString *)keychainItemName
authentication:(GTMOAuth2Authentication *)auth;
@end
// To function, GTMOAuth2ViewControllerTouch needs a certain amount of access
// to the iPhone's keychain. To keep things simple, its keychain access is
// broken out into a helper class. We declare it here in case you'd like to use
// it too, to store passwords.
enum {
kGTMOAuth2KeychainErrorBadArguments = -1301,
kGTMOAuth2KeychainErrorNoPassword = -1302
};
@interface GTMOAuth2Keychain : NSObject
+ (GTMOAuth2Keychain *)defaultKeychain;
// OK to pass nil for the error parameter.
- (NSString *)passwordForService:(NSString *)service
account:(NSString *)account
error:(NSError **)error;
// OK to pass nil for the error parameter.
- (BOOL)removePasswordForService:(NSString *)service
account:(NSString *)account
error:(NSError **)error;
// OK to pass nil for the error parameter.
//
// accessibility should be one of the constants for kSecAttrAccessible
// such as kSecAttrAccessibleWhenUnlocked
- (BOOL)setPassword:(NSString *)password
forService:(NSString *)service
accessibility:(CFTypeRef)accessibility
account:(NSString *)account
error:(NSError **)error;
// For unit tests: allow setting a mock object
+ (void)setDefaultKeychain:(GTMOAuth2Keychain *)keychain;
@end
#endif // TARGET_OS_IPHONE
#endif // #if GTM_INCLUDE_OAUTH2 || !GDATA_REQUIRE_SERVICE_INCLUDES

View File

@@ -0,0 +1,113 @@
//
// GTMObjC2Runtime.h
//
// Copyright 2007-2008 Google Inc.
//
// 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.
//
#import <objc/objc-api.h>
#import <objc/objc-auto.h>
#import "GTMDefines.h"
// These functions exist for code that we want to compile on both the < 10.5
// sdks and on the >= 10.5 sdks without warnings. It basically reimplements
// certain parts of the objc2 runtime in terms of the objc1 runtime. It is not
// a complete implementation as I've only implemented the routines I know we
// use. Feel free to add more as necessary.
// These functions are not documented because they conform to the documentation
// for the ObjC2 Runtime.
#if OBJC_API_VERSION >= 2 // Only have optional and req'd keywords in ObjC2.
#define AT_OPTIONAL @optional
#define AT_REQUIRED @required
#else
#define AT_OPTIONAL
#define AT_REQUIRED
#endif
// The file objc-runtime.h was moved to runtime.h and in Leopard, objc-runtime.h
// was just a wrapper around runtime.h. For the iPhone SDK, this objc-runtime.h
// is removed in the iPhoneOS2.0 SDK.
//
// The |Object| class was removed in the iPhone2.0 SDK too.
#if GTM_IPHONE_SDK
#import <objc/message.h>
#import <objc/runtime.h>
#else
#import <objc/objc-runtime.h>
#import <objc/Object.h>
#endif
#import <libkern/OSAtomic.h>
#if GTM_MACOS_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
#import "objc/Protocol.h"
OBJC_EXPORT Class object_getClass(id obj);
OBJC_EXPORT const char *class_getName(Class cls);
OBJC_EXPORT BOOL class_conformsToProtocol(Class cls, Protocol *protocol);
OBJC_EXPORT BOOL class_respondsToSelector(Class cls, SEL sel);
OBJC_EXPORT Class class_getSuperclass(Class cls);
OBJC_EXPORT Method *class_copyMethodList(Class cls, unsigned int *outCount);
OBJC_EXPORT SEL method_getName(Method m);
OBJC_EXPORT void method_exchangeImplementations(Method m1, Method m2);
OBJC_EXPORT IMP method_getImplementation(Method method);
OBJC_EXPORT IMP method_setImplementation(Method method, IMP imp);
OBJC_EXPORT struct objc_method_description protocol_getMethodDescription(Protocol *p,
SEL aSel,
BOOL isRequiredMethod,
BOOL isInstanceMethod);
OBJC_EXPORT BOOL sel_isEqual(SEL lhs, SEL rhs);
// If building for 10.4 but using the 10.5 SDK, don't include these.
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
// atomics
// On Leopard these are GC aware
// Intentionally did not include the non-barrier versions, because I couldn't
// come up with a case personally where you wouldn't want to use the
// barrier versions.
GTM_INLINE bool OSAtomicCompareAndSwapPtrBarrier(void *predicate,
void *replacement,
void * volatile *theValue) {
#if defined(__LP64__) && __LP64__
return OSAtomicCompareAndSwap64Barrier((int64_t)predicate,
(int64_t)replacement,
(int64_t *)theValue);
#else // defined(__LP64__) && __LP64__
return OSAtomicCompareAndSwap32Barrier((int32_t)predicate,
(int32_t)replacement,
(int32_t *)theValue);
#endif // defined(__LP64__) && __LP64__
}
#endif // MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
#endif // GTM_MACOS_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
#if GTM_MACOS_SDK && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5)
GTM_INLINE BOOL objc_atomicCompareAndSwapGlobalBarrier(id predicate,
id replacement,
volatile id *objectLocation) {
return OSAtomicCompareAndSwapPtrBarrier(predicate,
replacement,
(void * volatile *)objectLocation);
}
GTM_INLINE BOOL objc_atomicCompareAndSwapInstanceVariableBarrier(id predicate,
id replacement,
volatile id *objectLocation) {
return OSAtomicCompareAndSwapPtrBarrier(predicate,
replacement,
(void * volatile *)objectLocation);
}
#endif // GTM_MACOS_SDK && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5)

View File

@@ -0,0 +1,44 @@
//
// GoogleOpenSource.h
// Google+ iOS SDK
//
// Copyright 2013 Google Inc.
//
// Use of this SDK is subject to the Google+ Platform Terms of Service:
// https://developers.google.com/+/terms
//
// GTM.
#import "GTMDefines.h"
#import "GTMHTTPFetcher.h"
#import "GTMHTTPFetcherService.h"
#import "GTMHTTPFetchHistory.h"
#import "GTMLogger.h"
#import "GTMMethodCheck.h"
#import "GTMNSDictionary+URLArguments.h"
#import "GTMNSString+URLArguments.h"
#import "GTMOAuth2Authentication.h"
#import "GTMOAuth2SignIn.h"
#import "GTMOAuth2ViewControllerTouch.h"
#import "GTMObjC2Runtime.h"
// Chrome.
#import "OpenInChromeController.h"
// GTL.
#import "GTLDefines.h"
#import "GTLBatchQuery.h"
#import "GTLBatchResult.h"
#import "GTLDateTime.h"
#import "GTLErrorObject.h"
#import "GTLObject.h"
#import "GTLQuery.h"
#import "GTLRuntimeCommon.h"
#import "GTLService.h"
#import "GTLFramework.h"
#import "GTLJSONParser.h"
#import "GTLUtilities.h"
// GTLPlus.
#import "GTLPlus.h"

View File

@@ -0,0 +1,54 @@
// Copyright 2012, Google 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 Google 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 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.
#import <Foundation/Foundation.h>
// This class is used to check if Google Chrome is installed in the system and
// to open a URL in Google Chrome either with or without a callback URL.
@interface OpenInChromeController : NSObject
// Returns a shared instance of the OpenInChromeController.
+ (OpenInChromeController *)sharedInstance;
// Returns YES if Google Chrome is installed in the user's system.
- (BOOL)isChromeInstalled;
// Opens a URL in Google Chrome.
- (BOOL)openInChrome:(NSURL *)url;
// Open a URL in Google Chrome providing a |callbackURL| to return to the app.
// URLs from the same app will be opened in the same tab unless |createNewTab|
// is set to YES.
// |callbackURL| can be nil.
// The return value of this method is YES if the URL is successfully opened.
- (BOOL)openInChrome:(NSURL *)url
withCallbackURL:(NSURL *)callbackURL
createNewTab:(BOOL)createNewTab;
@end

View File

@@ -0,0 +1 @@
A

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More