forked from organicmaps/organicmaps
[ios] Added GooglePlus support to AccountManager
This commit is contained in:
parent
de5ce6aca0
commit
6c661b226a
97 changed files with 24792 additions and 20 deletions
|
@ -1,12 +1,24 @@
|
|||
|
||||
#import "AccountManager.h"
|
||||
#import <FacebookSDK/FacebookSDK.h>
|
||||
#import "GPPSignIn.h"
|
||||
#import "GTLPlusConstants.h"
|
||||
#import "GPPURLHandler.h"
|
||||
#import "GPPShare.h"
|
||||
|
||||
@implementation PostMessage
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface AccountManager () <GPPSignInDelegate, GPPShareDelegate>
|
||||
|
||||
@property (nonatomic, copy) CompletionBlock googlePlusLoginCompletion;
|
||||
@property (nonatomic, copy) CompletionBlock googlePlusShareCompletion;
|
||||
@property (nonatomic) PostMessage * googlePlusMessage;
|
||||
|
||||
@end
|
||||
|
||||
@implementation AccountManager
|
||||
|
||||
+ (instancetype)sharedManager
|
||||
|
@ -32,11 +44,33 @@
|
|||
}
|
||||
case AccountTypeGooglePlus:
|
||||
{
|
||||
if ([[GPPSignIn sharedInstance] hasAuthInKeychain])
|
||||
{
|
||||
self.googlePlusMessage = nil;
|
||||
self.googlePlusShareCompletion = block;
|
||||
|
||||
[GPPShare sharedInstance].delegate = self;
|
||||
id <GPPShareBuilder> shareBuilder = [[GPPShare sharedInstance] shareDialog];
|
||||
[shareBuilder setPrefillText:message.info];
|
||||
[shareBuilder open];
|
||||
}
|
||||
else
|
||||
{
|
||||
self.googlePlusMessage = message;
|
||||
[[self googlePlusSignIn] trySilentAuthentication];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)finishedSharing:(BOOL)shared
|
||||
{
|
||||
if (self.googlePlusShareCompletion)
|
||||
self.googlePlusShareCompletion(shared);
|
||||
|
||||
self.googlePlusShareCompletion = nil;
|
||||
}
|
||||
|
||||
- (void)postMessage:(PostMessage *)message toFacebookAndCheckPermissionsWithCompletion:(CompletionBlock)block
|
||||
{
|
||||
|
@ -172,11 +206,52 @@
|
|||
}
|
||||
case AccountTypeGooglePlus:
|
||||
{
|
||||
self.googlePlusLoginCompletion = block;
|
||||
[[self googlePlusSignIn] authenticate];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (GPPSignIn *)googlePlusSignIn
|
||||
{
|
||||
GPPSignIn * signIn = [GPPSignIn sharedInstance];
|
||||
signIn.clientID = [self googlePlusClientId];
|
||||
signIn.scopes = @[kGTLAuthScopePlusLogin];
|
||||
signIn.shouldFetchGoogleUserEmail = YES;
|
||||
signIn.shouldFetchGoogleUserID = YES;
|
||||
signIn.delegate = self;
|
||||
return signIn;
|
||||
}
|
||||
|
||||
- (void)finishedWithAuth:(GTMOAuth2Authentication *)auth error:(NSError *)error
|
||||
{
|
||||
if (self.googlePlusMessage)
|
||||
[self postMessage:self.googlePlusMessage toAccountType:AccountTypeGooglePlus completion:self.googlePlusShareCompletion];
|
||||
else if (self.googlePlusLoginCompletion)
|
||||
self.googlePlusLoginCompletion(!error);
|
||||
|
||||
self.googlePlusLoginCompletion = nil;
|
||||
}
|
||||
|
||||
- (NSString *)googlePlusClientId
|
||||
{
|
||||
NSString * bundleId = [[NSBundle mainBundle] bundleIdentifier];
|
||||
if ([bundleId isEqualToString:@"com.mapswithme.full"])
|
||||
return @"516376788119-olu39qq0md9h8nd0p8ku35i5oiid78i7.apps.googleusercontent.com";
|
||||
else if ([bundleId isEqualToString:@"com.mapswithme.travelguide"])
|
||||
return @"516376788119-a0kr4j3767gagjf3dn0pmhqkmg6vnpp5.apps.googleusercontent.com";
|
||||
else if ([bundleId isEqualToString:@"com.mapswithme.full.debug"])
|
||||
return @"516376788119-taf0agjba07a75dpumrlr31qoa9iu8ag.apps.googleusercontent.com";
|
||||
else if ([bundleId isEqualToString:@"com.mapswithme.full.simulator"])
|
||||
return @"516376788119-k6fr1m85v6osun317i22qaelb3gevcn8.apps.googleusercontent.com";
|
||||
else if ([bundleId isEqualToString:@"com.mapswithme.full.beta"])
|
||||
return @"516376788119-hj5sm0s62uul62jgh5f2iqem0e04i3lo.apps.googleusercontent.com";
|
||||
else if ([bundleId isEqualToString:@"com.mapswithme.travelguide.beta"])
|
||||
return @"516376788119-4bo5vnkl653u2gtlv7sc161ig1om3mu7.apps.googleusercontent.com";
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
|
||||
{
|
||||
[[FBSession activeSession] setStateChangeHandler:^(FBSession * session, FBSessionState state, NSError * error) {
|
||||
|
@ -190,6 +265,9 @@
|
|||
if ([FBAppCall handleOpenURL:url sourceApplication:sourceApplication])
|
||||
return YES;
|
||||
|
||||
if ([GPPURLHandler handleURL:url sourceApplication:sourceApplication annotation:annotation])
|
||||
return YES;
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
|
59
iphone/Maps/GooglePlusSDK/GPPDeepLink.h
Normal file
59
iphone/Maps/GooglePlusSDK/GPPDeepLink.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
//
|
||||
// GPPDeepLink.h
|
||||
// Google+ iOS SDK
|
||||
//
|
||||
// Copyright 2012 Google Inc.
|
||||
//
|
||||
// Use of this SDK is subject to the Google+ Platform Terms of Service:
|
||||
// https://developers.google.com/+/terms
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class GPPDeepLink;
|
||||
|
||||
// A protocol optionally implemented by the client of |GPPDeepLink|.
|
||||
@protocol GPPDeepLinkDelegate
|
||||
|
||||
// Notifies the client that a deep link has been received either from
|
||||
// |readDeepLinkAfterInstall| or |handleURL:sourceApplication:annotation:|.
|
||||
- (void)didReceiveDeepLink:(GPPDeepLink *)deepLink;
|
||||
|
||||
@end
|
||||
|
||||
// This class handles a deep link within a share posted on Google+.
|
||||
// For more information on deep links, see
|
||||
// http://developers.google.com/+/mobile/ios/share .
|
||||
@interface GPPDeepLink : NSObject
|
||||
|
||||
// Sets the delegate to handle the deep link.
|
||||
+ (void)setDelegate:(id<GPPDeepLinkDelegate>)delegate;
|
||||
|
||||
// Returns a |GPPDeepLink| for your app to handle, or |nil| if not found. The
|
||||
// deep-link ID can be obtained from |GPPDeepLink|. It is stored when a user
|
||||
// clicks a link to your app from a Google+ post, but hasn't yet installed your
|
||||
// app. The user will be redirected to the App Store to install your app. This
|
||||
// method should be called on or near your app launch to take the user to
|
||||
// deep-link ID within your app. The delegate will be called if set and if a
|
||||
// deep link is found.
|
||||
+ (GPPDeepLink *)readDeepLinkAfterInstall;
|
||||
|
||||
// This method should be called from your |UIApplicationDelegate|'s
|
||||
// |application:openURL:sourceApplication:annotation|. Returns
|
||||
// |GooglePlusDeepLink| if |GooglePlusDeepLink| handled this URL, |nil|
|
||||
// otherwise. The delegate will be called if set and if a deep link is found.
|
||||
// Also see |handleURL:sourceApplication:annotation:| in |GPPURLHandler|.
|
||||
+ (GPPDeepLink *)handleURL:(NSURL *)url
|
||||
sourceApplication:(NSString *)sourceApplication
|
||||
annotation:(id)annotation;
|
||||
|
||||
// The deep-link ID in |GPPDeepLink| that was passed to the app.
|
||||
- (NSString *)deepLinkID;
|
||||
|
||||
// This instance method indicates where the user came from before arriving in
|
||||
// your app. This method is provided for you to collect engagement metrics.
|
||||
// For the possible values, see
|
||||
// http://developers.google.com/+/mobile/ios/source-values .
|
||||
- (NSString *)source;
|
||||
|
||||
@end
|
154
iphone/Maps/GooglePlusSDK/GPPShare.h
Normal file
154
iphone/Maps/GooglePlusSDK/GPPShare.h
Normal file
|
@ -0,0 +1,154 @@
|
|||
//
|
||||
// GPPShare.h
|
||||
// Google+ iOS SDK
|
||||
//
|
||||
// Copyright 2012 Google Inc.
|
||||
//
|
||||
// Use of this SDK is subject to the Google+ Platform Terms of Service:
|
||||
// https://developers.google.com/+/terms
|
||||
//
|
||||
|
||||
// To allow a user to share with Google+, please follow these steps:
|
||||
//
|
||||
// 0. Create a project on Google API console,
|
||||
// https://code.google.com/apis/console . Under "API Access", create a
|
||||
// client ID as "Installed application" with the type "iOS", and
|
||||
// register the bundle ID of your app.
|
||||
//
|
||||
// 1. Initialize the |GPPSignIn| instance with your registered client ID,
|
||||
// and get the |GPPShare| instance.
|
||||
//
|
||||
// [[GPPSignIn shareInstance] setClientID:myClientID];
|
||||
// GPPShare *gppShare = [GPPShare sharedInstance];
|
||||
//
|
||||
// 2. In the code where the share dialog will be opened,
|
||||
//
|
||||
// [[gppShare shareDialog] open];
|
||||
//
|
||||
// you can optionally call any of the |GPPShareBuilder| methods before
|
||||
// calling |open|, for example, if there is a particular URL resource to be
|
||||
// shared, or if you want to set text to prefill user comment in the share
|
||||
// dialog, such as:
|
||||
//
|
||||
// NSURL *urlToShare = [NSURL URLWithString:@"http://www.google.com/"];
|
||||
// NSString *prefillText = @"You probably already know this site...";
|
||||
// [[[[gppShare shareDialog] setURLToShare:urlToShare]
|
||||
// setPrefillText:prefillText] open];
|
||||
//
|
||||
// 3. In the '<YourApp>-info.plist' settings for your app, add a URL type to be
|
||||
// handled by your app. Make the URL scheme the same as your app bundle ID.
|
||||
//
|
||||
// 4. In your application delegate, implement:
|
||||
// - (BOOL)application:(NSString*)application
|
||||
// openURL:(NSURL *)url
|
||||
// sourceApplication:(NSString*)sourceApplication
|
||||
// annotation:(id)annotation {
|
||||
// if ([gppShare handleURL:url
|
||||
// sourceApplication:sourceApplication
|
||||
// annotation:annotation]) {
|
||||
// return YES;
|
||||
// }
|
||||
// // Other handling code here...
|
||||
// }
|
||||
//
|
||||
// 5. Optionally, if you want to be notified of the result of the share action,
|
||||
// have a delegate class implement |GPPShareDelegate|, for example:
|
||||
//
|
||||
// @interface MyDelegateClass : NSObject<GPPShareDelegate>;
|
||||
//
|
||||
// - (void)finishedSharing:(BOOL)shared {
|
||||
// // The share action was successful if |shared| is YES.
|
||||
// }
|
||||
//
|
||||
// MyDelegateClass *myDelegate = [[MyDelegateClass alloc] init];
|
||||
// gppShare.delegate = myDelegate;
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class GPPSignIn;
|
||||
|
||||
// The protocol to receive the result of the share action.
|
||||
@protocol GPPShareDelegate
|
||||
|
||||
// Reports the status of the share action, |shared| is |YES| if user has
|
||||
// successfully shared her post, |NO| otherwise, such as if the user canceled
|
||||
// the post.
|
||||
- (void)finishedSharing:(BOOL)shared;
|
||||
|
||||
@end
|
||||
|
||||
// The builder protocol to open the share dialog.
|
||||
// For more information on sharing, see
|
||||
// http://developers.google.com/+/mobile/ios/share .
|
||||
@protocol GPPShareBuilder<NSCopying>
|
||||
|
||||
// Sets the URL resource to be shared.
|
||||
- (id<GPPShareBuilder>)setURLToShare:(NSURL *)urlToShare;
|
||||
|
||||
// Sets the text to prefill user's comment in the share dialog.
|
||||
- (id<GPPShareBuilder>)setPrefillText:(NSString *)prefillText;
|
||||
|
||||
// Sets the title, description, and thumbnail URL of the shared content preview
|
||||
// in the share dialog. Only set these fields if you are sharing with a content
|
||||
// deep link and don't have a URL resource. |title| is required.
|
||||
- (id<GPPShareBuilder>)setTitle:(NSString *)title
|
||||
description:(NSString *)description
|
||||
thumbnailURL:(NSURL *)thumbnailURL;
|
||||
|
||||
// Sets the content deep-link ID that takes the user straight to your shared
|
||||
// content. Only set this field if you want the content deep-linking feature.
|
||||
// The content deep-link ID can either be a fully qualified URI, or URI path,
|
||||
// which can be up to 512 characters in length.
|
||||
- (id<GPPShareBuilder>)setContentDeepLinkID:(NSString *)contentDeepLinkID;
|
||||
|
||||
// Sets the call-to-action button of the shared content preview.
|
||||
// The call-to-action button consists of a label, URL, and deep-link ID.
|
||||
// The |label| is a string key defined under "data-calltoactionlabel" on
|
||||
// http://developers.google.com/+/web/share/interactive#button_attr_calltoactionlabel
|
||||
// that maps to the actual button text.
|
||||
// You must set either the |url| or |deepLinkID|, or both.
|
||||
// The |url| is where the user is taken to after tapping on the button.
|
||||
// The |deepLinkID| is the call-to-action deep-link ID that takes the user
|
||||
// straight to a specific action in your app. It can either be a fully qualified
|
||||
// URI, or URI path, which can be up to 512 characters in length.
|
||||
// Note: In order to set the call-to-action button:
|
||||
// 1. User must have been authenticated with scopes including
|
||||
// "https://www.googleapis.com/auth/plus.login".
|
||||
// 2. Either |setURLToShare:| or |setTitle:description:thumbnailURL:| must also
|
||||
// be called.
|
||||
- (id<GPPShareBuilder>)setCallToActionButtonWithLabel:(NSString *)label
|
||||
URL:(NSURL *)url
|
||||
deepLinkID:(NSString *)deepLinkID;
|
||||
|
||||
// Opens the share dialog. Returns |NO| if there was an error, |YES| otherwise.
|
||||
- (BOOL)open;
|
||||
|
||||
@end
|
||||
|
||||
// The primary class for the share action on Google+.
|
||||
// For more information on sharing, see
|
||||
// http://developers.google.com/+/mobile/ios/share .
|
||||
@interface GPPShare : NSObject
|
||||
|
||||
// The object to be notified when the share action has finished.
|
||||
@property (nonatomic, assign) id<GPPShareDelegate> delegate;
|
||||
|
||||
// Returns a shared |GPPShare| instance.
|
||||
// |[GPPSignIn sharedInstance].clientID| must be initialized with a client ID
|
||||
// registered in the Google API console, https://code.google.com/apis/console/
|
||||
// with the app's bundle ID.
|
||||
+ (GPPShare *)sharedInstance;
|
||||
|
||||
// Returns a share dialog builder instance. Call its |open| method to
|
||||
// create the dialog after setting the parameters as needed.
|
||||
- (id<GPPShareBuilder>)shareDialog;
|
||||
|
||||
// This method should be called from your |UIApplicationDelegate|'s
|
||||
// |application:openURL:sourceApplication:annotation|. Returns |YES| if
|
||||
// |GPPShare| handled this URL.
|
||||
// Also see |handleURL:sourceApplication:annotation:| in |GPPURLHandler|.
|
||||
- (BOOL)handleURL:(NSURL *)url
|
||||
sourceApplication:(NSString *)sourceApplication
|
||||
annotation:(id)annotation;
|
||||
|
||||
@end
|
150
iphone/Maps/GooglePlusSDK/GPPSignIn.h
Normal file
150
iphone/Maps/GooglePlusSDK/GPPSignIn.h
Normal file
|
@ -0,0 +1,150 @@
|
|||
//
|
||||
// GPPSignIn.h
|
||||
// Google+ iOS SDK
|
||||
//
|
||||
// Copyright 2012 Google Inc.
|
||||
//
|
||||
// Use of this SDK is subject to the Google+ Platform Terms of Service:
|
||||
// https://developers.google.com/+/terms
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class GTMOAuth2Authentication;
|
||||
@class GTMOAuth2ViewControllerTouch;
|
||||
|
||||
// A protocol implemented by the client of |GPPSignIn| to receive a refresh
|
||||
// token or an error.
|
||||
@protocol GPPSignInDelegate
|
||||
|
||||
// The authorization has finished and is successful if |error| is |nil|.
|
||||
- (void)finishedWithAuth:(GTMOAuth2Authentication *)auth
|
||||
error:(NSError *)error;
|
||||
|
||||
// Finished disconnecting user from the app.
|
||||
// The operation was successful if |error| is |nil|.
|
||||
@optional
|
||||
- (void)didDisconnectWithError:(NSError *)error;
|
||||
|
||||
@end
|
||||
|
||||
// This class signs the user in with Google. It provides single sign-on
|
||||
// via the Google+ app (if installed), Chrome for iOS (if installed), or Mobile
|
||||
// Safari.
|
||||
//
|
||||
// For reference, please see "Google+ Sign-In for iOS" at
|
||||
// https://developers.google.com/+/mobile/ios/sign-in .
|
||||
// Here is sample code to use |GPPSignIn|:
|
||||
// 1) Get a reference to the |GPPSignIn| shared instance:
|
||||
// GPPSignIn *signIn = [GPPSignIn sharedInstance];
|
||||
// 2) Set the OAuth 2.0 scopes you want to request:
|
||||
// [signIn setScopes:[NSArray arrayWithObject:
|
||||
// @"https://www.googleapis.com/auth/plus.login"]];
|
||||
// 2) Call [signIn setDelegate:self];
|
||||
// 3) Set up delegate method |finishedWithAuth:error:|.
|
||||
// 4) Call |handleURL| on the shared instance from |application:openUrl:...|
|
||||
// in your app delegate.
|
||||
// 5) Call [signIn authenticate];
|
||||
@interface GPPSignIn : NSObject
|
||||
|
||||
// The authentication object for the current user, or |nil| if there is
|
||||
// currently no logged in user.
|
||||
@property (nonatomic, readonly) GTMOAuth2Authentication *authentication;
|
||||
|
||||
// The Google user ID. It is only available if |shouldFetchGoogleUserID| is set
|
||||
// and either |trySilentAuthentication| or |authenticate| has been completed
|
||||
// successfully.
|
||||
@property (nonatomic, readonly) NSString *userID;
|
||||
|
||||
// The Google user's email. It is only available if |shouldFetchGoogleUserEmail|
|
||||
// is set and either |trySilentAuthentication| or |authenticate| has been
|
||||
// completed successfully.
|
||||
@property (nonatomic, readonly) NSString *userEmail;
|
||||
|
||||
// The object to be notified when authentication is finished.
|
||||
@property (nonatomic, assign) id<GPPSignInDelegate> delegate;
|
||||
|
||||
// All properties below are optional parameters. If they need to be set, set
|
||||
// before calling |authenticate|.
|
||||
|
||||
// The client ID of the app from the Google APIs console.
|
||||
// Must set for sign-in to work.
|
||||
@property (nonatomic, copy) NSString *clientID;
|
||||
|
||||
// The API scopes requested by the app in an array of |NSString|s.
|
||||
// The default value is |@[@"https://www.googleapis.com/auth/plus.login"]|.
|
||||
@property (nonatomic, copy) NSArray *scopes;
|
||||
|
||||
// Whether or not to attempt Single-Sign-On when signing in.
|
||||
// If |attemptSSO| is true, the sign-in button tries to authenticate with the
|
||||
// Google+ application if it is installed. If false, it always uses Google+ via
|
||||
// Chrome for iOS, if installed, or Mobile Safari for authentication.
|
||||
// The default value is |YES|.
|
||||
@property (nonatomic, assign) BOOL attemptSSO;
|
||||
|
||||
// The language for sign-in, in the form of ISO 639-1 language code
|
||||
// optionally followed by a dash and ISO 3166-1 alpha-2 region code,
|
||||
// such as |@"it"| or |@"pt-PT"|.
|
||||
// Only set if different from system default.
|
||||
@property (nonatomic, copy) NSString *language;
|
||||
|
||||
// Name of the keychain to save the sign-in state.
|
||||
// Only set if a custom name needs to be used.
|
||||
@property (nonatomic, copy) NSString *keychainName;
|
||||
|
||||
// An |NSString| array of moment types used by your app. Use values from the
|
||||
// full list at
|
||||
// https://developers.google.com/+/api/moment-types .
|
||||
// such as "http://schemas.google.com/AddActivity".
|
||||
// This property is required only for writing moments, with
|
||||
// "https://www.googleapis.com/auth/plus.login" as a scope.
|
||||
@property (nonatomic, copy) NSArray *actions;
|
||||
|
||||
// Whether or not to fetch user email after signing in. The email is saved in
|
||||
// the |GTMOAuth2Authentication| object. Note that using this flag automatically
|
||||
// adds "https://www.googleapis.com/auth/userinfo.email" scope to the request.
|
||||
@property (nonatomic, assign) BOOL shouldFetchGoogleUserEmail;
|
||||
|
||||
// Whether or not to fetch user ID after signing in. The ID can be retrieved
|
||||
// by |googleUserID| after user has been authenticated.
|
||||
// Note, a scope, such as "https://www.googleapis.com/auth/plus.login" or
|
||||
// "https://www.googleapis.com/auth/plus.me", that provides user ID must be
|
||||
// included in |scopes| for this flag to work.
|
||||
@property (nonatomic, assign) BOOL shouldFetchGoogleUserID;
|
||||
|
||||
// Returns a shared |GPPSignIn| instance.
|
||||
+ (GPPSignIn *)sharedInstance;
|
||||
|
||||
// Checks whether the user has either currently signed in or has previous
|
||||
// authentication saved in keychain.
|
||||
- (BOOL)hasAuthInKeychain;
|
||||
|
||||
// Attempts to authenticate silently without user interaction.
|
||||
// Returns |YES| and calls the delegate if the user has either currently signed
|
||||
// in or has previous authentication saved in keychain.
|
||||
- (BOOL)trySilentAuthentication;
|
||||
|
||||
// Starts the authentication process. Set |attemptSSO| to try single sign-on.
|
||||
// If |attemptSSO| is true, try to authenticate with the Google+ app, if
|
||||
// installed. If false, always use Google+ via Chrome or Mobile Safari for
|
||||
// authentication. The delegate will be called at the end of this process.
|
||||
- (void)authenticate;
|
||||
|
||||
// This method should be called from your |UIApplicationDelegate|'s
|
||||
// |application:openURL:sourceApplication:annotation|. Returns |YES| if
|
||||
// |GPPSignIn| handled this URL.
|
||||
// Also see |handleURL:sourceApplication:annotation:| in |GPPURLHandler|.
|
||||
- (BOOL)handleURL:(NSURL *)url
|
||||
sourceApplication:(NSString *)sourceApplication
|
||||
annotation:(id)annotation;
|
||||
|
||||
// Removes the OAuth 2.0 token from the keychain.
|
||||
- (void)signOut;
|
||||
|
||||
// Disconnects the user from the app and revokes previous authentication.
|
||||
// If the operation succeeds, the OAuth 2.0 token is also removed from keychain.
|
||||
// The token is needed to disconnect so do not call |signOut| if |disconnect| is
|
||||
// to be called.
|
||||
- (void)disconnect;
|
||||
|
||||
@end
|
44
iphone/Maps/GooglePlusSDK/GPPSignInButton.h
Normal file
44
iphone/Maps/GooglePlusSDK/GPPSignInButton.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
//
|
||||
// GPPSignInButton.h
|
||||
// Google+ iOS SDK
|
||||
//
|
||||
// Copyright 2012 Google Inc.
|
||||
//
|
||||
// Use of this SDK is subject to the Google+ Platform Terms of Service:
|
||||
// https://developers.google.com/+/terms
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
// The various layout styles supported by the GPPSignInButton.
|
||||
// The minmum size of the button depends on the language used for text.
|
||||
// The following dimensions (in points) fit for all languages:
|
||||
// kGPPSignInButtonStyleStandard: 226 x 48
|
||||
// kGPPSignInButtonStyleWide: 308 x 48
|
||||
// kGPPSignInButtonStyleIconOnly: 46 x 48 (no text, fixed size)
|
||||
typedef enum {
|
||||
kGPPSignInButtonStyleStandard = 0,
|
||||
kGPPSignInButtonStyleWide = 1,
|
||||
kGPPSignInButtonStyleIconOnly = 2
|
||||
} GPPSignInButtonStyle;
|
||||
|
||||
// The various color schemes supported by the GPPSignInButton.
|
||||
typedef enum {
|
||||
kGPPSignInButtonColorSchemeDark = 0,
|
||||
kGPPSignInButtonColorSchemeLight = 1
|
||||
} GPPSignInButtonColorScheme;
|
||||
|
||||
// This class provides the Google+ sign-in button. You can instantiate this
|
||||
// class programmatically or from a NIB file. You should set up the
|
||||
// |GPPSignIn| shared instance with your client ID and any additional scopes,
|
||||
// implement the delegate methods for |GPPSignIn|, and add this button to your
|
||||
// view hierarchy.
|
||||
@interface GPPSignInButton : UIButton
|
||||
|
||||
// Sets the sign-in button layout style. The default style is standard.
|
||||
- (void)setStyle:(GPPSignInButtonStyle)style;
|
||||
|
||||
// Sets the sign-in button color scheme. The default scheme is dark.
|
||||
- (void)setColorScheme:(GPPSignInButtonColorScheme)colorScheme;
|
||||
|
||||
@end
|
25
iphone/Maps/GooglePlusSDK/GPPURLHandler.h
Normal file
25
iphone/Maps/GooglePlusSDK/GPPURLHandler.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
// GPPURLHandler.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
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface GPPURLHandler : NSObject
|
||||
|
||||
// Calls |handleURL:sourceApplication:annotation:| for
|
||||
// |[GPPSignIn sharedInstance]|, |[GPPShare sharedInstance]|, and
|
||||
// |GPPDeepLink|, and returns |YES| if any of them handles the URL.
|
||||
// This method can be called from your |UIApplicationDelegate|'s
|
||||
// |application:openURL:sourceApplication:annotation| instead of calling
|
||||
// those methods individually.
|
||||
+ (BOOL)handleURL:(NSURL *)url
|
||||
sourceApplication:(NSString *)sourceApplication
|
||||
annotation:(id)annotation;
|
||||
|
||||
@end
|
25
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLBase64.h
Normal file
25
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLBase64.h
Normal 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);
|
139
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLBase64.m
Normal file
139
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLBase64.m
Normal file
|
@ -0,0 +1,139 @@
|
|||
/* 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 "GTLBase64.h"
|
||||
|
||||
// Based on Cyrus Najmabadi's elegent little encoder and decoder from
|
||||
// http://www.cocoadev.com/index.pl?BaseSixtyFour
|
||||
|
||||
static char gStandardEncodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
static char gWebSafeEncodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
||||
|
||||
#pragma mark Encode
|
||||
|
||||
static NSString *EncodeBase64StringCommon(NSData *data, const char *table) {
|
||||
if (data == nil) return nil;
|
||||
|
||||
const uint8_t* input = [data bytes];
|
||||
NSUInteger length = [data length];
|
||||
|
||||
NSUInteger bufferSize = ((length + 2) / 3) * 4;
|
||||
NSMutableData* buffer = [NSMutableData dataWithLength:bufferSize];
|
||||
|
||||
int8_t *output = [buffer mutableBytes];
|
||||
|
||||
for (NSUInteger i = 0; i < length; i += 3) {
|
||||
NSUInteger value = 0;
|
||||
for (NSUInteger j = i; j < (i + 3); j++) {
|
||||
value <<= 8;
|
||||
|
||||
if (j < length) {
|
||||
value |= (0xFF & input[j]);
|
||||
}
|
||||
}
|
||||
|
||||
NSInteger idx = (i / 3) * 4;
|
||||
output[idx + 0] = table[(value >> 18) & 0x3F];
|
||||
output[idx + 1] = table[(value >> 12) & 0x3F];
|
||||
output[idx + 2] = (i + 1) < length ? table[(value >> 6) & 0x3F] : '=';
|
||||
output[idx + 3] = (i + 2) < length ? table[(value >> 0) & 0x3F] : '=';
|
||||
}
|
||||
|
||||
NSString *result = [[[NSString alloc] initWithData:buffer
|
||||
encoding:NSASCIIStringEncoding] autorelease];
|
||||
return result;
|
||||
}
|
||||
|
||||
NSString *GTLEncodeBase64(NSData *data) {
|
||||
return EncodeBase64StringCommon(data, gStandardEncodingTable);
|
||||
}
|
||||
|
||||
NSString *GTLEncodeWebSafeBase64(NSData *data) {
|
||||
return EncodeBase64StringCommon(data, gWebSafeEncodingTable);
|
||||
}
|
||||
|
||||
#pragma mark Decode
|
||||
|
||||
static void CreateDecodingTable(const char *encodingTable,
|
||||
size_t encodingTableSize, char *decodingTable) {
|
||||
memset(decodingTable, 0, 128);
|
||||
for (unsigned int i = 0; i < encodingTableSize; i++) {
|
||||
decodingTable[(unsigned int) encodingTable[i]] = (char)i;
|
||||
}
|
||||
}
|
||||
|
||||
static NSData *DecodeBase64StringCommon(NSString *base64Str,
|
||||
char *decodingTable) {
|
||||
// The input string should be plain ASCII
|
||||
const char *cString = [base64Str cStringUsingEncoding:NSASCIIStringEncoding];
|
||||
if (cString == nil) return nil;
|
||||
|
||||
NSInteger inputLength = (NSInteger)strlen(cString);
|
||||
if (inputLength % 4 != 0) return nil;
|
||||
if (inputLength == 0) return [NSData data];
|
||||
|
||||
while (inputLength > 0 && cString[inputLength - 1] == '=') {
|
||||
inputLength--;
|
||||
}
|
||||
|
||||
NSInteger outputLength = inputLength * 3 / 4;
|
||||
NSMutableData* data = [NSMutableData dataWithLength:(NSUInteger)outputLength];
|
||||
uint8_t *output = [data mutableBytes];
|
||||
|
||||
NSInteger inputPoint = 0;
|
||||
NSInteger outputPoint = 0;
|
||||
char *table = decodingTable;
|
||||
|
||||
while (inputPoint < inputLength) {
|
||||
int i0 = cString[inputPoint++];
|
||||
int i1 = cString[inputPoint++];
|
||||
int i2 = inputPoint < inputLength ? cString[inputPoint++] : 'A'; // 'A' will decode to \0
|
||||
int i3 = inputPoint < inputLength ? cString[inputPoint++] : 'A';
|
||||
|
||||
output[outputPoint++] = (uint8_t)((table[i0] << 2) | (table[i1] >> 4));
|
||||
if (outputPoint < outputLength) {
|
||||
output[outputPoint++] = (uint8_t)(((table[i1] & 0xF) << 4) | (table[i2] >> 2));
|
||||
}
|
||||
if (outputPoint < outputLength) {
|
||||
output[outputPoint++] = (uint8_t)(((table[i2] & 0x3) << 6) | table[i3]);
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
NSData *GTLDecodeBase64(NSString *base64Str) {
|
||||
static char decodingTable[128];
|
||||
static BOOL hasInited = NO;
|
||||
|
||||
if (!hasInited) {
|
||||
CreateDecodingTable(gStandardEncodingTable, sizeof(gStandardEncodingTable),
|
||||
decodingTable);
|
||||
hasInited = YES;
|
||||
}
|
||||
return DecodeBase64StringCommon(base64Str, decodingTable);
|
||||
}
|
||||
|
||||
NSData *GTLDecodeWebSafeBase64(NSString *base64Str) {
|
||||
static char decodingTable[128];
|
||||
static BOOL hasInited = NO;
|
||||
|
||||
if (!hasInited) {
|
||||
CreateDecodingTable(gWebSafeEncodingTable, sizeof(gWebSafeEncodingTable),
|
||||
decodingTable);
|
||||
hasInited = YES;
|
||||
}
|
||||
return DecodeBase64StringCommon(base64Str, decodingTable);
|
||||
}
|
52
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLBatchQuery.h
Normal file
52
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLBatchQuery.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/* 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_;
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
+ (id)batchQuery;
|
||||
+ (id)batchQueryWithQueries:(NSArray *)array;
|
||||
|
||||
- (void)addQuery:(GTLQuery *)query GTL_NONNULL((1));
|
||||
|
||||
- (GTLQuery *)queryForRequestID:(NSString *)requestID GTL_NONNULL((1));
|
||||
|
||||
@end
|
133
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLBatchQuery.m
Normal file
133
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLBatchQuery.m
Normal file
|
@ -0,0 +1,133 @@
|
|||
/* 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.m
|
||||
//
|
||||
|
||||
#import "GTLBatchQuery.h"
|
||||
|
||||
@implementation GTLBatchQuery
|
||||
|
||||
@synthesize shouldSkipAuthorization = skipAuthorization_,
|
||||
additionalHTTPHeaders = additionalHTTPHeaders_;
|
||||
|
||||
+ (id)batchQuery {
|
||||
GTLBatchQuery *obj = [[[self alloc] init] autorelease];
|
||||
return obj;
|
||||
}
|
||||
|
||||
+ (id)batchQueryWithQueries:(NSArray *)queries {
|
||||
GTLBatchQuery *obj = [self batchQuery];
|
||||
obj.queries = queries;
|
||||
return obj;
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone {
|
||||
// Deep copy the list of queries
|
||||
NSArray *copiesOfQueries = [[[NSArray alloc] initWithArray:self.queries
|
||||
copyItems:YES] autorelease];
|
||||
GTLBatchQuery *newBatch = [[[self class] allocWithZone:zone] init];
|
||||
newBatch.queries = copiesOfQueries;
|
||||
newBatch.shouldSkipAuthorization = self.shouldSkipAuthorization;
|
||||
newBatch.additionalHTTPHeaders = self.additionalHTTPHeaders;
|
||||
return newBatch;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[queries_ release];
|
||||
[additionalHTTPHeaders_ release];
|
||||
[requestIDMap_ release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
NSArray *queries = self.queries;
|
||||
NSArray *methodNames = [queries valueForKey:@"methodName"];
|
||||
NSArray *dedupedNames = [[NSSet setWithArray:methodNames] allObjects];
|
||||
NSString *namesStr = [dedupedNames componentsJoinedByString:@","];
|
||||
|
||||
return [NSString stringWithFormat:@"%@ %p (queries:%lu methods:%@)",
|
||||
[self class], self, (unsigned long) [queries count], namesStr];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (BOOL)isBatchQuery {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (GTLUploadParameters *)uploadParameters {
|
||||
// File upload is not supported for batches
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)executionDidStop {
|
||||
NSArray *queries = self.queries;
|
||||
[queries makeObjectsPerformSelector:@selector(executionDidStop)];
|
||||
}
|
||||
|
||||
- (GTLQuery *)queryForRequestID:(NSString *)requestID {
|
||||
GTLQuery *result = [requestIDMap_ objectForKey:requestID];
|
||||
if (result) return result;
|
||||
|
||||
// We've not before tried to look up a query, or the map is stale
|
||||
[requestIDMap_ release];
|
||||
requestIDMap_ = [[NSMutableDictionary alloc] init];
|
||||
|
||||
for (GTLQuery *query in queries_) {
|
||||
[requestIDMap_ setObject:query forKey:query.requestID];
|
||||
}
|
||||
|
||||
result = [requestIDMap_ objectForKey:requestID];
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)setQueries:(NSArray *)array {
|
||||
#if DEBUG
|
||||
for (id obj in array) {
|
||||
GTLQuery *query = obj;
|
||||
GTL_DEBUG_ASSERT([query isKindOfClass:[GTLQuery class]],
|
||||
@"unexpected query class: %@", [obj class]);
|
||||
GTL_DEBUG_ASSERT(query.uploadParameters == nil,
|
||||
@"batch may not contain upload: %@", query);
|
||||
}
|
||||
#endif
|
||||
|
||||
[queries_ autorelease];
|
||||
queries_ = [array mutableCopy];
|
||||
}
|
||||
|
||||
- (NSArray *)queries {
|
||||
return queries_;
|
||||
}
|
||||
|
||||
- (void)addQuery:(GTLQuery *)query {
|
||||
GTL_DEBUG_ASSERT([query isKindOfClass:[GTLQuery class]],
|
||||
@"unexpected query class: %@", [query class]);
|
||||
GTL_DEBUG_ASSERT(query.uploadParameters == nil,
|
||||
@"batch may not contain upload: %@", query);
|
||||
|
||||
if (queries_ == nil) {
|
||||
queries_ = [[NSMutableArray alloc] init];
|
||||
}
|
||||
|
||||
[queries_ addObject:query];
|
||||
}
|
||||
|
||||
@end
|
58
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLBatchResult.h
Normal file
58
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLBatchResult.h
Normal 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
|
92
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLBatchResult.m
Normal file
92
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLBatchResult.m
Normal file
|
@ -0,0 +1,92 @@
|
|||
/* 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.m
|
||||
//
|
||||
|
||||
#import "GTLBatchResult.h"
|
||||
|
||||
#import "GTLErrorObject.h"
|
||||
|
||||
@implementation GTLBatchResult
|
||||
|
||||
@synthesize successes = successes_,
|
||||
failures = failures_;
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone {
|
||||
GTLBatchResult* newObject = [super copyWithZone:zone];
|
||||
newObject.successes = [[self.successes mutableCopyWithZone:zone] autorelease];
|
||||
newObject.failures = [[self.failures mutableCopyWithZone:zone] autorelease];
|
||||
return newObject;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[successes_ release];
|
||||
[failures_ release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
return [NSString stringWithFormat:@"%@ %p (successes:%lu failures:%lu)",
|
||||
[self class], self,
|
||||
(unsigned long) [self.successes count],
|
||||
(unsigned long) [self.failures count]];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)createItemsWithClassMap:(NSDictionary *)batchClassMap {
|
||||
// This is called by GTLObject objectForJSON:defaultClass:
|
||||
// JSON is defined to be a dictionary, but for batch results, it really
|
||||
// is any array.
|
||||
id json = self.JSON;
|
||||
GTL_DEBUG_ASSERT([json isKindOfClass:[NSArray class]],
|
||||
@"didn't get an array for the batch results");
|
||||
NSArray *jsonArray = json;
|
||||
|
||||
NSMutableDictionary *successes = [NSMutableDictionary dictionary];
|
||||
NSMutableDictionary *failures = [NSMutableDictionary dictionary];
|
||||
|
||||
for (NSMutableDictionary *rpcResponse in jsonArray) {
|
||||
NSString *responseID = [rpcResponse objectForKey:@"id"];
|
||||
|
||||
NSMutableDictionary *errorJSON = [rpcResponse objectForKey:@"error"];
|
||||
if (errorJSON) {
|
||||
GTLErrorObject *errorObject = [GTLErrorObject objectWithJSON:errorJSON];
|
||||
[failures setValue:errorObject forKey:responseID];
|
||||
} else {
|
||||
NSMutableDictionary *resultJSON = [rpcResponse objectForKey:@"result"];
|
||||
|
||||
NSDictionary *surrogates = self.surrogates;
|
||||
Class defaultClass = [batchClassMap objectForKey:responseID];
|
||||
|
||||
id resultObject = [[self class] objectForJSON:resultJSON
|
||||
defaultClass:defaultClass
|
||||
surrogates:surrogates
|
||||
batchClassMap:nil];
|
||||
if (resultObject == nil) {
|
||||
// methods like delete return no object
|
||||
resultObject = [NSNull null];
|
||||
}
|
||||
[successes setValue:resultObject forKey:responseID];
|
||||
}
|
||||
}
|
||||
self.successes = successes;
|
||||
self.failures = failures;
|
||||
}
|
||||
|
||||
@end
|
60
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLDateTime.h
Normal file
60
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLDateTime.h
Normal 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
|
471
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLDateTime.m
Normal file
471
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLDateTime.m
Normal file
|
@ -0,0 +1,471 @@
|
|||
/* 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.m
|
||||
//
|
||||
|
||||
#import "GTLDateTime.h"
|
||||
|
||||
@interface GTLDateTime ()
|
||||
|
||||
- (void)setFromDate:(NSDate *)date timeZone:(NSTimeZone *)tz;
|
||||
- (void)setFromRFC3339String:(NSString *)str;
|
||||
|
||||
@property (nonatomic, retain, readwrite) NSTimeZone *timeZone;
|
||||
@property (nonatomic, copy, readwrite) NSDateComponents *dateComponents;
|
||||
@property (nonatomic, assign, readwrite) NSInteger milliseconds;
|
||||
|
||||
@property (nonatomic, assign, readwrite) BOOL hasTime;
|
||||
@property (nonatomic, assign, readwrite) NSInteger offsetSeconds;
|
||||
@property (nonatomic, assign, getter=isUniversalTime, readwrite) BOOL universalTime;
|
||||
|
||||
@end
|
||||
|
||||
static NSCharacterSet *gDashSet = nil;
|
||||
static NSCharacterSet *gTSet = nil;
|
||||
static NSCharacterSet *gColonSet = nil;
|
||||
static NSCharacterSet *gPlusMinusZSet = nil;
|
||||
static NSMutableDictionary *gCalendarsForTimeZones = nil;
|
||||
|
||||
@implementation GTLDateTime
|
||||
|
||||
// A note about milliseconds_:
|
||||
// RFC 3339 has support for fractions of a second. NSDateComponents is all
|
||||
// NSInteger based, so it can't handle a fraction of a second. NSDate is
|
||||
// built on NSTimeInterval so it has sub-millisecond precision. GTL takes
|
||||
// the compromise of supporting the RFC's optional fractional second support
|
||||
// by maintaining a number of milliseconds past what fits in the
|
||||
// NSDateComponents. The parsing and string conversions will include
|
||||
// 3 decimal digits (hence milliseconds). When going to a string, the decimal
|
||||
// digits are only included if the milliseconds are non zero.
|
||||
|
||||
@dynamic date;
|
||||
@dynamic calendar;
|
||||
@dynamic RFC3339String;
|
||||
@dynamic stringValue;
|
||||
@dynamic timeZone;
|
||||
@dynamic hasTime;
|
||||
|
||||
@synthesize dateComponents = dateComponents_,
|
||||
milliseconds = milliseconds_,
|
||||
offsetSeconds = offsetSeconds_,
|
||||
universalTime = isUniversalTime_;
|
||||
|
||||
+ (void)initialize {
|
||||
// Note that initialize is guaranteed by the runtime to be called in a
|
||||
// thread-safe manner.
|
||||
if (gDashSet == nil) {
|
||||
gDashSet = [[NSCharacterSet characterSetWithCharactersInString:@"-"] retain];
|
||||
gTSet = [[NSCharacterSet characterSetWithCharactersInString:@"Tt "] retain];
|
||||
gColonSet = [[NSCharacterSet characterSetWithCharactersInString:@":"] retain];
|
||||
gPlusMinusZSet = [[NSCharacterSet characterSetWithCharactersInString:@"+-zZ"] retain];
|
||||
|
||||
gCalendarsForTimeZones = [[NSMutableDictionary alloc] init];
|
||||
}
|
||||
}
|
||||
|
||||
+ (GTLDateTime *)dateTimeWithRFC3339String:(NSString *)str {
|
||||
if (str == nil) return nil;
|
||||
|
||||
GTLDateTime *result = [[[self alloc] init] autorelease];
|
||||
[result setFromRFC3339String:str];
|
||||
return result;
|
||||
}
|
||||
|
||||
+ (GTLDateTime *)dateTimeWithDate:(NSDate *)date timeZone:(NSTimeZone *)tz {
|
||||
if (date == nil) return nil;
|
||||
|
||||
GTLDateTime *result = [[[self alloc] init] autorelease];
|
||||
[result setFromDate:date timeZone:tz];
|
||||
return result;
|
||||
}
|
||||
|
||||
+ (GTLDateTime *)dateTimeForAllDayWithDate:(NSDate *)date {
|
||||
if (date == nil) return nil;
|
||||
|
||||
GTLDateTime *result = [[[self alloc] init] autorelease];
|
||||
[result setFromDate:date timeZone:nil];
|
||||
result.hasTime = NO;
|
||||
return result;
|
||||
}
|
||||
|
||||
+ (GTLDateTime *)dateTimeWithDateComponents:(NSDateComponents *)components {
|
||||
NSCalendar *cal = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
|
||||
NSDate *date = [cal dateFromComponents:components];
|
||||
#if GTL_IPHONE
|
||||
NSTimeZone *tz = [components timeZone];
|
||||
#else
|
||||
// NSDateComponents added timeZone: in Mac OS X 10.7.
|
||||
NSTimeZone *tz = nil;
|
||||
if ([components respondsToSelector:@selector(timeZone)]) {
|
||||
tz = [components timeZone];
|
||||
}
|
||||
#endif
|
||||
return [self dateTimeWithDate:date timeZone:tz];
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[dateComponents_ release];
|
||||
[timeZone_ release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone {
|
||||
// Object is immutable
|
||||
return [self retain];
|
||||
}
|
||||
|
||||
// until NSDateComponent implements isEqual, we'll use this
|
||||
- (BOOL)doesDateComponents:(NSDateComponents *)dc1
|
||||
equalDateComponents:(NSDateComponents *)dc2 {
|
||||
|
||||
return [dc1 era] == [dc2 era]
|
||||
&& [dc1 year] == [dc2 year]
|
||||
&& [dc1 month] == [dc2 month]
|
||||
&& [dc1 day] == [dc2 day]
|
||||
&& [dc1 hour] == [dc2 hour]
|
||||
&& [dc1 minute] == [dc2 minute]
|
||||
&& [dc1 second] == [dc2 second]
|
||||
&& [dc1 week] == [dc2 week]
|
||||
&& [dc1 weekday] == [dc2 weekday]
|
||||
&& [dc1 weekdayOrdinal] == [dc2 weekdayOrdinal];
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(GTLDateTime *)other {
|
||||
|
||||
if (self == other) return YES;
|
||||
if (![other isKindOfClass:[GTLDateTime class]]) return NO;
|
||||
|
||||
BOOL areDateComponentsEqual = [self doesDateComponents:self.dateComponents
|
||||
equalDateComponents:other.dateComponents];
|
||||
NSTimeZone *tz1 = self.timeZone;
|
||||
NSTimeZone *tz2 = other.timeZone;
|
||||
BOOL areTimeZonesEqual = (tz1 == tz2 || (tz2 && [tz1 isEqual:tz2]));
|
||||
|
||||
return self.offsetSeconds == other.offsetSeconds
|
||||
&& self.isUniversalTime == other.isUniversalTime
|
||||
&& self.milliseconds == other.milliseconds
|
||||
&& areDateComponentsEqual
|
||||
&& areTimeZonesEqual;
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
return [NSString stringWithFormat:@"%@ %p: {%@}",
|
||||
[self class], self, self.RFC3339String];
|
||||
}
|
||||
|
||||
- (NSTimeZone *)timeZone {
|
||||
if (timeZone_) {
|
||||
return timeZone_;
|
||||
}
|
||||
|
||||
if (self.isUniversalTime) {
|
||||
NSTimeZone *ztz = [NSTimeZone timeZoneWithName:@"Universal"];
|
||||
return ztz;
|
||||
}
|
||||
|
||||
NSInteger offsetSeconds = self.offsetSeconds;
|
||||
|
||||
if (offsetSeconds != NSUndefinedDateComponent) {
|
||||
NSTimeZone *tz = [NSTimeZone timeZoneForSecondsFromGMT:offsetSeconds];
|
||||
return tz;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)setTimeZone:(NSTimeZone *)timeZone {
|
||||
[timeZone_ release];
|
||||
timeZone_ = [timeZone retain];
|
||||
|
||||
if (timeZone) {
|
||||
NSInteger offsetSeconds = [timeZone secondsFromGMTForDate:self.date];
|
||||
self.offsetSeconds = offsetSeconds;
|
||||
} else {
|
||||
self.offsetSeconds = NSUndefinedDateComponent;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSCalendar *)calendarForTimeZone:(NSTimeZone *)tz {
|
||||
NSCalendar *cal = nil;
|
||||
@synchronized(gCalendarsForTimeZones) {
|
||||
id tzKey = (tz ? tz : [NSNull null]);
|
||||
cal = [gCalendarsForTimeZones objectForKey:tzKey];
|
||||
if (cal == nil) {
|
||||
cal = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
|
||||
if (tz) {
|
||||
[cal setTimeZone:tz];
|
||||
}
|
||||
[gCalendarsForTimeZones setObject:cal forKey:tzKey];
|
||||
}
|
||||
}
|
||||
return cal;
|
||||
}
|
||||
|
||||
- (NSCalendar *)calendar {
|
||||
NSTimeZone *tz = self.timeZone;
|
||||
return [self calendarForTimeZone:tz];
|
||||
}
|
||||
|
||||
- (NSDate *)date {
|
||||
NSDateComponents *dateComponents = self.dateComponents;
|
||||
NSTimeInterval extraMillisecondsAsSeconds = 0.0;
|
||||
NSCalendar *cal;
|
||||
|
||||
if (!self.hasTime) {
|
||||
// We're not keeping track of a time, but NSDate always is based on
|
||||
// an absolute time. We want to avoid returning an NSDate where the
|
||||
// calendar date appears different from what was used to create our
|
||||
// date-time object.
|
||||
//
|
||||
// We'll make a copy of the date components, setting the time on our
|
||||
// copy to noon GMT, since that ensures the date renders correctly for
|
||||
// any time zone.
|
||||
NSDateComponents *noonDateComponents = [[dateComponents copy] autorelease];
|
||||
[noonDateComponents setHour:12];
|
||||
[noonDateComponents setMinute:0];
|
||||
[noonDateComponents setSecond:0];
|
||||
dateComponents = noonDateComponents;
|
||||
|
||||
NSTimeZone *gmt = [NSTimeZone timeZoneWithName:@"Universal"];
|
||||
cal = [self calendarForTimeZone:gmt];
|
||||
} else {
|
||||
cal = self.calendar;
|
||||
|
||||
// Add in the fractional seconds that don't fit into NSDateComponents.
|
||||
extraMillisecondsAsSeconds = ((NSTimeInterval)self.milliseconds) / 1000.0;
|
||||
}
|
||||
|
||||
NSDate *date = [cal dateFromComponents:dateComponents];
|
||||
|
||||
// Add in any milliseconds that didn't fit into the dateComponents.
|
||||
if (extraMillisecondsAsSeconds > 0.0) {
|
||||
#if GTL_IPHONE || (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5)
|
||||
date = [date dateByAddingTimeInterval:extraMillisecondsAsSeconds];
|
||||
#else
|
||||
date = [date addTimeInterval:extraMillisecondsAsSeconds];
|
||||
#endif
|
||||
}
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
- (NSString *)stringValue {
|
||||
return self.RFC3339String;
|
||||
}
|
||||
|
||||
- (NSString *)RFC3339String {
|
||||
NSDateComponents *dateComponents = self.dateComponents;
|
||||
NSInteger offset = self.offsetSeconds;
|
||||
|
||||
NSString *timeString = @""; // timeString like "T15:10:46-08:00"
|
||||
|
||||
if (self.hasTime) {
|
||||
|
||||
NSString *timeOffsetString; // timeOffsetString like "-08:00"
|
||||
|
||||
if (self.isUniversalTime) {
|
||||
timeOffsetString = @"Z";
|
||||
} else if (offset == NSUndefinedDateComponent) {
|
||||
// unknown offset is rendered as -00:00 per
|
||||
// http://www.ietf.org/rfc/rfc3339.txt section 4.3
|
||||
timeOffsetString = @"-00:00";
|
||||
} else {
|
||||
NSString *sign = @"+";
|
||||
if (offset < 0) {
|
||||
sign = @"-";
|
||||
offset = -offset;
|
||||
}
|
||||
timeOffsetString = [NSString stringWithFormat:@"%@%02ld:%02ld",
|
||||
sign, (long)(offset/(60*60)) % 24, (long)(offset / 60) % 60];
|
||||
}
|
||||
|
||||
NSString *fractionalSecondsString = @"";
|
||||
if (self.milliseconds > 0.0) {
|
||||
fractionalSecondsString = [NSString stringWithFormat:@".%03ld", (long)self.milliseconds];
|
||||
}
|
||||
|
||||
timeString = [NSString stringWithFormat:@"T%02ld:%02ld:%02ld%@%@",
|
||||
(long)[dateComponents hour], (long)[dateComponents minute],
|
||||
(long)[dateComponents second], fractionalSecondsString, timeOffsetString];
|
||||
}
|
||||
|
||||
// full dateString like "2006-11-17T15:10:46-08:00"
|
||||
NSString *dateString = [NSString stringWithFormat:@"%04ld-%02ld-%02ld%@",
|
||||
(long)[dateComponents year], (long)[dateComponents month],
|
||||
(long)[dateComponents day], timeString];
|
||||
|
||||
return dateString;
|
||||
}
|
||||
|
||||
- (void)setFromDate:(NSDate *)date timeZone:(NSTimeZone *)tz {
|
||||
NSCalendar *cal = [self calendarForTimeZone:tz];
|
||||
|
||||
NSUInteger const kComponentBits = (NSYearCalendarUnit | NSMonthCalendarUnit
|
||||
| NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit
|
||||
| NSSecondCalendarUnit);
|
||||
|
||||
NSDateComponents *components = [cal components:kComponentBits fromDate:date];
|
||||
self.dateComponents = components;
|
||||
|
||||
// Extract the fractional seconds.
|
||||
NSTimeInterval asTimeInterval = [date timeIntervalSince1970];
|
||||
NSTimeInterval worker = asTimeInterval - trunc(asTimeInterval);
|
||||
self.milliseconds = (NSInteger)round(worker * 1000.0);
|
||||
|
||||
self.universalTime = NO;
|
||||
|
||||
NSInteger offset = NSUndefinedDateComponent;
|
||||
|
||||
if (tz) {
|
||||
offset = [tz secondsFromGMTForDate:date];
|
||||
|
||||
if (offset == 0 && [tz isEqualToTimeZone:[NSTimeZone timeZoneWithName:@"Universal"]]) {
|
||||
self.universalTime = YES;
|
||||
}
|
||||
}
|
||||
self.offsetSeconds = offset;
|
||||
|
||||
// though offset seconds are authoritative, we'll retain the time zone
|
||||
// since we can't regenerate it reliably from just the offset
|
||||
timeZone_ = [tz retain];
|
||||
}
|
||||
|
||||
- (void)setFromRFC3339String:(NSString *)str {
|
||||
|
||||
NSInteger year = NSUndefinedDateComponent;
|
||||
NSInteger month = NSUndefinedDateComponent;
|
||||
NSInteger day = NSUndefinedDateComponent;
|
||||
NSInteger hour = NSUndefinedDateComponent;
|
||||
NSInteger minute = NSUndefinedDateComponent;
|
||||
NSInteger sec = NSUndefinedDateComponent;
|
||||
NSInteger milliseconds = 0;
|
||||
double secDouble = -1.0;
|
||||
NSString* sign = nil;
|
||||
NSInteger offsetHour = 0;
|
||||
NSInteger offsetMinute = 0;
|
||||
|
||||
if ([str length] > 0) {
|
||||
NSScanner* scanner = [NSScanner scannerWithString:str];
|
||||
// There should be no whitespace, so no skip characters.
|
||||
[scanner setCharactersToBeSkipped:nil];
|
||||
|
||||
// for example, scan 2006-11-17T15:10:46-08:00
|
||||
// or 2006-11-17T15:10:46Z
|
||||
if (// yyyy-mm-dd
|
||||
[scanner scanInteger:&year] &&
|
||||
[scanner scanCharactersFromSet:gDashSet intoString:NULL] &&
|
||||
[scanner scanInteger:&month] &&
|
||||
[scanner scanCharactersFromSet:gDashSet intoString:NULL] &&
|
||||
[scanner scanInteger:&day] &&
|
||||
// Thh:mm:ss
|
||||
[scanner scanCharactersFromSet:gTSet intoString:NULL] &&
|
||||
[scanner scanInteger:&hour] &&
|
||||
[scanner scanCharactersFromSet:gColonSet intoString:NULL] &&
|
||||
[scanner scanInteger:&minute] &&
|
||||
[scanner scanCharactersFromSet:gColonSet intoString:NULL] &&
|
||||
[scanner scanDouble:&secDouble]) {
|
||||
|
||||
// At this point we got secDouble, pull it apart.
|
||||
sec = (NSInteger)secDouble;
|
||||
double worker = secDouble - ((double)sec);
|
||||
milliseconds = (NSInteger)round(worker * 1000.0);
|
||||
|
||||
// Finish parsing, now the offset info.
|
||||
if (// Z or +hh:mm
|
||||
[scanner scanCharactersFromSet:gPlusMinusZSet intoString:&sign] &&
|
||||
[scanner scanInteger:&offsetHour] &&
|
||||
[scanner scanCharactersFromSet:gColonSet intoString:NULL] &&
|
||||
[scanner scanInteger:&offsetMinute]) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NSDateComponents *dateComponents = [[[NSDateComponents alloc] init] autorelease];
|
||||
[dateComponents setYear:year];
|
||||
[dateComponents setMonth:month];
|
||||
[dateComponents setDay:day];
|
||||
[dateComponents setHour:hour];
|
||||
[dateComponents setMinute:minute];
|
||||
[dateComponents setSecond:sec];
|
||||
|
||||
self.dateComponents = dateComponents;
|
||||
self.milliseconds = milliseconds;
|
||||
|
||||
// determine the offset, like from Z, or -08:00:00.0
|
||||
|
||||
self.timeZone = nil;
|
||||
|
||||
NSInteger totalOffset = NSUndefinedDateComponent;
|
||||
self.universalTime = NO;
|
||||
|
||||
if ([sign caseInsensitiveCompare:@"Z"] == NSOrderedSame) {
|
||||
|
||||
self.universalTime = YES;
|
||||
totalOffset = 0;
|
||||
|
||||
} else if (sign != nil) {
|
||||
|
||||
totalOffset = (60 * offsetMinute) + (60 * 60 * offsetHour);
|
||||
|
||||
if ([sign isEqual:@"-"]) {
|
||||
|
||||
if (totalOffset == 0) {
|
||||
// special case: offset of -0.00 means undefined offset
|
||||
totalOffset = NSUndefinedDateComponent;
|
||||
} else {
|
||||
totalOffset *= -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.offsetSeconds = totalOffset;
|
||||
}
|
||||
|
||||
- (BOOL)hasTime {
|
||||
NSDateComponents *dateComponents = self.dateComponents;
|
||||
|
||||
BOOL hasTime = ([dateComponents hour] != NSUndefinedDateComponent
|
||||
&& [dateComponents minute] != NSUndefinedDateComponent);
|
||||
|
||||
return hasTime;
|
||||
}
|
||||
|
||||
- (void)setHasTime:(BOOL)shouldHaveTime {
|
||||
|
||||
// we'll set time values to zero or NSUndefinedDateComponent as appropriate
|
||||
BOOL hadTime = self.hasTime;
|
||||
|
||||
if (shouldHaveTime && !hadTime) {
|
||||
[dateComponents_ setHour:0];
|
||||
[dateComponents_ setMinute:0];
|
||||
[dateComponents_ setSecond:0];
|
||||
milliseconds_ = 0;
|
||||
offsetSeconds_ = NSUndefinedDateComponent;
|
||||
isUniversalTime_ = NO;
|
||||
|
||||
} else if (hadTime && !shouldHaveTime) {
|
||||
[dateComponents_ setHour:NSUndefinedDateComponent];
|
||||
[dateComponents_ setMinute:NSUndefinedDateComponent];
|
||||
[dateComponents_ setSecond:NSUndefinedDateComponent];
|
||||
milliseconds_ = 0;
|
||||
offsetSeconds_ = NSUndefinedDateComponent;
|
||||
isUniversalTime_ = NO;
|
||||
self.timeZone = nil;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
144
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLDefines.h
Normal file
144
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLDefines.h
Normal 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
|
45
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLErrorObject.h
Normal file
45
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLErrorObject.h
Normal 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
|
78
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLErrorObject.m
Normal file
78
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLErrorObject.m
Normal file
|
@ -0,0 +1,78 @@
|
|||
/* 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.m
|
||||
//
|
||||
|
||||
#import "GTLErrorObject.h"
|
||||
#import "GTLService.h"
|
||||
|
||||
@implementation GTLErrorObject
|
||||
|
||||
@dynamic code;
|
||||
@dynamic message;
|
||||
@dynamic data;
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map = [NSDictionary dictionaryWithObject:[GTLErrorObjectData class]
|
||||
forKey:@"data"];
|
||||
return map;
|
||||
}
|
||||
|
||||
- (NSError *)foundationError {
|
||||
NSMutableDictionary *userInfo;
|
||||
|
||||
// This structured GTLErrorObject will be available in the error's userInfo
|
||||
// dictionary
|
||||
userInfo = [NSMutableDictionary dictionaryWithObject:self
|
||||
forKey:kGTLStructuredErrorKey];
|
||||
|
||||
NSString *reasonStr = self.message;
|
||||
if (reasonStr) {
|
||||
// We always store an error in the userInfo key "error"
|
||||
[userInfo setObject:reasonStr
|
||||
forKey:kGTLServerErrorStringKey];
|
||||
|
||||
// Store a user-readable "reason" to show up when an error is logged,
|
||||
// in parentheses like NSError does it
|
||||
NSString *parenthesized = [NSString stringWithFormat:@"(%@)", reasonStr];
|
||||
[userInfo setObject:parenthesized
|
||||
forKey:NSLocalizedFailureReasonErrorKey];
|
||||
}
|
||||
|
||||
NSInteger code = [self.code integerValue];
|
||||
NSError *error = [NSError errorWithDomain:kGTLJSONRPCErrorDomain
|
||||
code:code
|
||||
userInfo:userInfo];
|
||||
return error;
|
||||
}
|
||||
|
||||
+ (GTLErrorObject *)underlyingObjectForError:(NSError *)foundationError {
|
||||
NSDictionary *userInfo = [foundationError userInfo];
|
||||
GTLErrorObject *errorObj = [userInfo objectForKey:kGTLStructuredErrorKey];
|
||||
return errorObj;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation GTLErrorObjectData
|
||||
@dynamic domain;
|
||||
@dynamic reason;
|
||||
@dynamic message;
|
||||
@dynamic location;
|
||||
@end
|
||||
|
||||
|
35
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLFramework.h
Normal file
35
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLFramework.h
Normal 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
|
40
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLFramework.m
Normal file
40
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLFramework.m
Normal file
|
@ -0,0 +1,40 @@
|
|||
/* 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.
|
||||
*/
|
||||
|
||||
#include "GTLFramework.h"
|
||||
|
||||
void GTLFrameworkVersion(NSUInteger* major, NSUInteger* minor, NSUInteger* release) {
|
||||
// version 2.0.0
|
||||
if (major) *major = 2;
|
||||
if (minor) *minor = 0;
|
||||
if (release) *release = 0;
|
||||
}
|
||||
|
||||
NSString *GTLFrameworkVersionString(void) {
|
||||
NSUInteger major, minor, release;
|
||||
NSString *libVersionString;
|
||||
|
||||
GTLFrameworkVersion(&major, &minor, &release);
|
||||
|
||||
// most library releases will have a release value of zero
|
||||
if (release != 0) {
|
||||
libVersionString = [NSString stringWithFormat:@"%d.%d.%d",
|
||||
(int)major, (int)minor, (int)release];
|
||||
} else {
|
||||
libVersionString = [NSString stringWithFormat:@"%d.%d",
|
||||
(int)major, (int)minor];
|
||||
}
|
||||
return libVersionString;
|
||||
}
|
41
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLJSONParser.h
Normal file
41
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLJSONParser.h
Normal 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
|
150
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLJSONParser.m
Normal file
150
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLJSONParser.m
Normal file
|
@ -0,0 +1,150 @@
|
|||
/* 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.m
|
||||
//
|
||||
|
||||
#import "GTLJSONParser.h"
|
||||
|
||||
// We can assume NSJSONSerialization is present on Mac OS X 10.7 and iOS 5
|
||||
#if !defined(GTL_REQUIRES_NSJSONSERIALIZATION)
|
||||
#if (!TARGET_OS_IPHONE && (MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)) || \
|
||||
(TARGET_OS_IPHONE && (__IPHONE_OS_VERSION_MIN_REQUIRED >= 50000))
|
||||
#define GTL_REQUIRES_NSJSONSERIALIZATION 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// If GTMNSJSONSerialization is available, it is used for parsing and
|
||||
// formatting JSON
|
||||
#if !GTL_REQUIRES_NSJSONSERIALIZATION
|
||||
@interface GTMNSJSONSerialization : NSObject
|
||||
+ (NSData *)dataWithJSONObject:(id)obj options:(NSUInteger)opt error:(NSError **)error;
|
||||
+ (id)JSONObjectWithData:(NSData *)data options:(NSUInteger)opt error:(NSError **)error;
|
||||
@end
|
||||
|
||||
// As a fallback, SBJSON is used for parsing and formatting JSON
|
||||
@interface GTLSBJSON
|
||||
- (void)setHumanReadable:(BOOL)flag;
|
||||
- (NSString*)stringWithObject:(id)value error:(NSError**)error;
|
||||
- (id)objectWithString:(NSString*)jsonrep error:(NSError**)error;
|
||||
@end
|
||||
#endif // !GTL_REQUIRES_NSJSONSERIALIZATION
|
||||
|
||||
@implementation GTLJSONParser
|
||||
|
||||
#if DEBUG && !GTL_REQUIRES_NSJSONSERIALIZATION
|
||||
// When compiling for iOS 4 compatibility, SBJSON must be available
|
||||
+ (void)load {
|
||||
Class writer = NSClassFromString(@"SBJsonWriter");
|
||||
Class parser = NSClassFromString(@"SBJsonParser");
|
||||
Class oldParser = NSClassFromString(@"SBJSON");
|
||||
GTL_ASSERT((oldParser != Nil)
|
||||
|| (writer != Nil && parser != Nil),
|
||||
@"No parsing class found");
|
||||
}
|
||||
#endif // DEBUG && !GTL_REQUIRES_NSJSONSERIALIZATION
|
||||
|
||||
+ (NSString*)stringWithObject:(id)obj
|
||||
humanReadable:(BOOL)humanReadable
|
||||
error:(NSError**)error {
|
||||
NSData *data = [self dataWithObject:obj
|
||||
humanReadable:humanReadable
|
||||
error:error];
|
||||
if (data) {
|
||||
NSString *jsonStr = [[[NSString alloc] initWithData:data
|
||||
encoding:NSUTF8StringEncoding] autorelease];
|
||||
return jsonStr;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSData *)dataWithObject:(id)obj
|
||||
humanReadable:(BOOL)humanReadable
|
||||
error:(NSError**)error {
|
||||
const NSUInteger kOpts = humanReadable ? (1UL << 0) : 0; // NSJSONWritingPrettyPrinted
|
||||
|
||||
#if GTL_REQUIRES_NSJSONSERIALIZATION
|
||||
NSData *data = [NSJSONSerialization dataWithJSONObject:obj
|
||||
options:kOpts
|
||||
error:error];
|
||||
return data;
|
||||
#else
|
||||
Class serializer = NSClassFromString(@"NSJSONSerialization");
|
||||
if (serializer) {
|
||||
NSData *data = [serializer dataWithJSONObject:obj
|
||||
options:kOpts
|
||||
error:error];
|
||||
return data;
|
||||
} else {
|
||||
Class jsonWriteClass = NSClassFromString(@"SBJsonWriter");
|
||||
if (!jsonWriteClass) {
|
||||
jsonWriteClass = NSClassFromString(@"SBJSON");
|
||||
}
|
||||
|
||||
if (error) *error = nil;
|
||||
|
||||
GTLSBJSON *writer = [[[jsonWriteClass alloc] init] autorelease];
|
||||
[writer setHumanReadable:humanReadable];
|
||||
NSString *jsonStr = [writer stringWithObject:obj
|
||||
error:error];
|
||||
NSData *data = [jsonStr dataUsingEncoding:NSUTF8StringEncoding];
|
||||
return data;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (id)objectWithString:(NSString *)jsonStr
|
||||
error:(NSError **)error {
|
||||
NSData *data = [jsonStr dataUsingEncoding:NSUTF8StringEncoding];
|
||||
return [self objectWithData:data
|
||||
error:error];
|
||||
}
|
||||
|
||||
+ (id)objectWithData:(NSData *)jsonData
|
||||
error:(NSError **)error {
|
||||
#if GTL_REQUIRES_NSJSONSERIALIZATION
|
||||
NSMutableDictionary *obj = [NSJSONSerialization JSONObjectWithData:jsonData
|
||||
options:NSJSONReadingMutableContainers
|
||||
error:error];
|
||||
return obj;
|
||||
#else
|
||||
Class serializer = NSClassFromString(@"NSJSONSerialization");
|
||||
if (serializer) {
|
||||
const NSUInteger kOpts = (1UL << 0); // NSJSONReadingMutableContainers
|
||||
NSMutableDictionary *obj = [serializer JSONObjectWithData:jsonData
|
||||
options:kOpts
|
||||
error:error];
|
||||
return obj;
|
||||
} else {
|
||||
Class jsonParseClass = NSClassFromString(@"SBJsonParser");
|
||||
if (!jsonParseClass) {
|
||||
jsonParseClass = NSClassFromString(@"SBJSON");
|
||||
}
|
||||
|
||||
if (error) *error = nil;
|
||||
|
||||
GTLSBJSON *parser = [[[jsonParseClass alloc] init] autorelease];
|
||||
|
||||
NSString *jsonrep = [[[NSString alloc] initWithData:jsonData
|
||||
encoding:NSUTF8StringEncoding] autorelease];
|
||||
id obj = [parser objectWithString:jsonrep
|
||||
error:error];
|
||||
return obj;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@end
|
208
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLObject.h
Normal file
208
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLObject.h
Normal 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
|
722
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLObject.m
Normal file
722
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLObject.m
Normal file
|
@ -0,0 +1,722 @@
|
|||
/* 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.m
|
||||
//
|
||||
|
||||
#define GTLOBJECT_DEFINE_GLOBALS 1
|
||||
|
||||
#include <objc/runtime.h>
|
||||
|
||||
#import "GTLObject.h"
|
||||
#import "GTLRuntimeCommon.h"
|
||||
#import "GTLJSONParser.h"
|
||||
|
||||
static NSString *const kUserDataPropertyKey = @"_userData";
|
||||
|
||||
@interface GTLObject () <GTLRuntimeCommon>
|
||||
+ (NSMutableArray *)allDeclaredProperties;
|
||||
+ (NSArray *)allKnownKeys;
|
||||
|
||||
+ (NSArray *)fieldsElementsForJSON:(NSDictionary *)targetJSON;
|
||||
+ (NSString *)fieldsDescriptionForJSON:(NSDictionary *)targetJSON;
|
||||
|
||||
+ (NSMutableDictionary *)patchDictionaryForJSON:(NSDictionary *)newJSON
|
||||
fromOriginalJSON:(NSDictionary *)originalJSON;
|
||||
@end
|
||||
|
||||
@implementation GTLObject
|
||||
|
||||
@synthesize JSON = json_,
|
||||
surrogates = surrogates_,
|
||||
userProperties = userProperties_;
|
||||
|
||||
+ (id)object {
|
||||
return [[[self alloc] init] autorelease];
|
||||
}
|
||||
|
||||
+ (id)objectWithJSON:(NSMutableDictionary *)dict {
|
||||
GTLObject *obj = [self object];
|
||||
obj.JSON = dict;
|
||||
return obj;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (Class)classForAdditionalProperties {
|
||||
return Nil;
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(GTLObject *)other {
|
||||
if (self == other) return YES;
|
||||
if (other == nil) return NO;
|
||||
|
||||
// The objects should be the same class, or one should be a subclass of the
|
||||
// other's class
|
||||
if (![other isKindOfClass:[self class]]
|
||||
&& ![self isKindOfClass:[other class]]) return NO;
|
||||
|
||||
// What we're not comparing here:
|
||||
// properties
|
||||
return GTL_AreEqualOrBothNil(json_, [other JSON]);
|
||||
}
|
||||
|
||||
// By definition, for two objects to potentially be considered equal,
|
||||
// they must have the same hash value. The hash is mostly ignored,
|
||||
// but removeObjectsInArray: in Leopard does seem to check the hash,
|
||||
// and NSObject's default hash method just returns the instance pointer.
|
||||
// We'll define hash here for all of our GTLObjects.
|
||||
- (NSUInteger)hash {
|
||||
return (NSUInteger) (void *) [GTLObject class];
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone {
|
||||
GTLObject* newObject = [[[self class] allocWithZone:zone] init];
|
||||
CFPropertyListRef ref = CFPropertyListCreateDeepCopy(kCFAllocatorDefault,
|
||||
json_, kCFPropertyListMutableContainers);
|
||||
GTL_DEBUG_ASSERT(ref != NULL, @"GTLObject: copy failed (probably a non-plist type in the JSON)");
|
||||
newObject.JSON = [NSMakeCollectable(ref) autorelease];
|
||||
newObject.surrogates = self.surrogates;
|
||||
|
||||
// What we're not copying:
|
||||
// userProperties
|
||||
return newObject;
|
||||
}
|
||||
|
||||
- (NSString *)descriptionWithLocale:(id)locale {
|
||||
return [self description];
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[json_ release];
|
||||
[surrogates_ release];
|
||||
[childCache_ release];
|
||||
[userProperties_ release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
#pragma mark JSON values
|
||||
|
||||
- (void)setJSONValue:(id)obj forKey:(NSString *)key {
|
||||
NSMutableDictionary *dict = self.JSON;
|
||||
if (dict == nil && obj != nil) {
|
||||
dict = [NSMutableDictionary dictionaryWithCapacity:1];
|
||||
self.JSON = dict;
|
||||
}
|
||||
[dict setValue:obj forKey:key];
|
||||
}
|
||||
|
||||
- (id)JSONValueForKey:(NSString *)key {
|
||||
id obj = [self.JSON objectForKey:key];
|
||||
return obj;
|
||||
}
|
||||
|
||||
- (NSString *)JSONString {
|
||||
NSError *error = nil;
|
||||
NSString *str = [GTLJSONParser stringWithObject:[self JSON]
|
||||
humanReadable:YES
|
||||
error:&error];
|
||||
if (error) {
|
||||
return [error description];
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
- (NSArray *)additionalJSONKeys {
|
||||
NSArray *knownKeys = [[self class] allKnownKeys];
|
||||
NSMutableArray *result = [NSMutableArray arrayWithArray:[json_ allKeys]];
|
||||
[result removeObjectsInArray:knownKeys];
|
||||
// Return nil instead of an empty array.
|
||||
if ([result count] == 0) {
|
||||
result = nil;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma mark Partial - Fields
|
||||
|
||||
- (NSString *)fieldsDescription {
|
||||
NSString *str = [GTLObject fieldsDescriptionForJSON:self.JSON];
|
||||
return str;
|
||||
}
|
||||
|
||||
+ (NSString *)fieldsDescriptionForJSON:(NSDictionary *)targetJSON {
|
||||
// Internal routine: recursively generate a string field description
|
||||
// by joining elements
|
||||
NSArray *array = [self fieldsElementsForJSON:targetJSON];
|
||||
NSString *str = [array componentsJoinedByString:@","];
|
||||
return str;
|
||||
}
|
||||
|
||||
+ (NSArray *)fieldsElementsForJSON:(NSDictionary *)targetJSON {
|
||||
// Internal routine: recursively generate an array of field description
|
||||
// element strings
|
||||
NSMutableArray *resultFields = [NSMutableArray array];
|
||||
|
||||
// Sorting the dictionary keys gives us deterministic results when iterating
|
||||
NSArray *sortedKeys = [[targetJSON allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
|
||||
for (NSString *key in sortedKeys) {
|
||||
// We'll build a comma-separated list of fields
|
||||
id value = [targetJSON objectForKey:key];
|
||||
if ([value isKindOfClass:[NSString class]]
|
||||
|| [value isKindOfClass:[NSNumber class]]) {
|
||||
// Basic type (string, number), so the key is what we want
|
||||
[resultFields addObject:key];
|
||||
} else if ([value isKindOfClass:[NSDictionary class]]) {
|
||||
// Object (dictionary): "parent/child1,parent/child2,parent/child3"
|
||||
NSArray *subElements = [self fieldsElementsForJSON:value];
|
||||
for (NSString *subElem in subElements) {
|
||||
NSString *prepended = [NSString stringWithFormat:@"%@/%@",
|
||||
key, subElem];
|
||||
[resultFields addObject:prepended];
|
||||
}
|
||||
} else if ([value isKindOfClass:[NSArray class]]) {
|
||||
// Array; we'll generate from the first array entry:
|
||||
// "parent(child1,child2,child3)"
|
||||
//
|
||||
// Open question: should this instead create the union of elements for
|
||||
// all items in the array, rather than just get fields from the first
|
||||
// array object?
|
||||
if ([(NSArray *)value count] > 0) {
|
||||
id firstObj = [value objectAtIndex:0];
|
||||
if ([firstObj isKindOfClass:[NSDictionary class]]) {
|
||||
// An array of objects
|
||||
NSString *contentsStr = [self fieldsDescriptionForJSON:firstObj];
|
||||
NSString *encapsulated = [NSString stringWithFormat:@"%@(%@)",
|
||||
key, contentsStr];
|
||||
[resultFields addObject:encapsulated];
|
||||
} else {
|
||||
// An array of some basic type, or of arrays
|
||||
[resultFields addObject:key];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
GTL_ASSERT(0, @"GTLObject unknown field element for %@ (%@)",
|
||||
key, NSStringFromClass([value class]));
|
||||
}
|
||||
}
|
||||
return resultFields;
|
||||
}
|
||||
|
||||
#pragma mark Partial - Patch
|
||||
|
||||
- (id)patchObjectFromOriginal:(GTLObject *)original {
|
||||
id resultObj;
|
||||
NSMutableDictionary *resultJSON = [GTLObject patchDictionaryForJSON:self.JSON
|
||||
fromOriginalJSON:original.JSON];
|
||||
if ([resultJSON count] > 0) {
|
||||
resultObj = [[self class] objectWithJSON:resultJSON];
|
||||
} else {
|
||||
// Client apps should not attempt to patch with an object containing
|
||||
// empty JSON
|
||||
resultObj = nil;
|
||||
}
|
||||
return resultObj;
|
||||
}
|
||||
|
||||
+ (NSMutableDictionary *)patchDictionaryForJSON:(NSDictionary *)newJSON
|
||||
fromOriginalJSON:(NSDictionary *)originalJSON {
|
||||
// Internal recursive routine to create an object suitable for
|
||||
// our patch semantics
|
||||
NSMutableDictionary *resultJSON = [NSMutableDictionary dictionary];
|
||||
|
||||
// Iterate through keys present in the old object
|
||||
NSArray *originalKeys = [originalJSON allKeys];
|
||||
for (NSString *key in originalKeys) {
|
||||
id originalValue = [originalJSON objectForKey:key];
|
||||
id newValue = [newJSON valueForKey:key];
|
||||
if (newValue == nil) {
|
||||
// There is no new value for this key, so set the value to NSNull
|
||||
[resultJSON setValue:[NSNull null] forKey:key];
|
||||
} else if (!GTL_AreEqualOrBothNil(originalValue, newValue)) {
|
||||
// The values for this key differ
|
||||
if ([originalValue isKindOfClass:[NSDictionary class]]
|
||||
&& [newValue isKindOfClass:[NSDictionary class]]) {
|
||||
// Both are objects; recurse
|
||||
NSMutableDictionary *subDict = [self patchDictionaryForJSON:newValue
|
||||
fromOriginalJSON:originalValue];
|
||||
[resultJSON setValue:subDict forKey:key];
|
||||
} else {
|
||||
// They are non-object values; the new replaces the old. Per the
|
||||
// documentation for patch, this replaces entire arrays.
|
||||
[resultJSON setValue:newValue forKey:key];
|
||||
}
|
||||
} else {
|
||||
// The values are the same; omit this key-value pair
|
||||
}
|
||||
}
|
||||
|
||||
// Iterate through keys present only in the new object, and add them to the
|
||||
// result
|
||||
NSMutableArray *newKeys = [NSMutableArray arrayWithArray:[newJSON allKeys]];
|
||||
[newKeys removeObjectsInArray:originalKeys];
|
||||
|
||||
for (NSString *key in newKeys) {
|
||||
id value = [newJSON objectForKey:key];
|
||||
[resultJSON setValue:value forKey:key];
|
||||
}
|
||||
return resultJSON;
|
||||
}
|
||||
|
||||
+ (id)nullValue {
|
||||
return [NSNull null];
|
||||
}
|
||||
|
||||
#pragma mark Additional Properties
|
||||
|
||||
- (id)additionalPropertyForName:(NSString *)name {
|
||||
// Return the cached object, if any, before creating one.
|
||||
id result = [self cacheChildForKey:name];
|
||||
if (result != nil) {
|
||||
return result;
|
||||
}
|
||||
|
||||
Class defaultClass = [[self class] classForAdditionalProperties];
|
||||
id jsonObj = [self JSONValueForKey:name];
|
||||
BOOL shouldCache = NO;
|
||||
if (jsonObj != nil) {
|
||||
NSDictionary *surrogates = self.surrogates;
|
||||
result = [GTLRuntimeCommon objectFromJSON:jsonObj
|
||||
defaultClass:defaultClass
|
||||
surrogates:surrogates
|
||||
isCacheable:&shouldCache];
|
||||
}
|
||||
|
||||
[self setCacheChild:(shouldCache ? result : nil)
|
||||
forKey:name];
|
||||
return result;
|
||||
}
|
||||
|
||||
- (void)setAdditionalProperty:(id)obj forName:(NSString *)name {
|
||||
BOOL shouldCache = NO;
|
||||
Class defaultClass = [[self class] classForAdditionalProperties];
|
||||
id json = [GTLRuntimeCommon jsonFromAPIObject:obj
|
||||
expectedClass:defaultClass
|
||||
isCacheable:&shouldCache];
|
||||
[self setJSONValue:json forKey:name];
|
||||
[self setCacheChild:(shouldCache ? obj : nil)
|
||||
forKey:name];
|
||||
}
|
||||
|
||||
- (NSDictionary *)additionalProperties {
|
||||
NSMutableDictionary *result = [NSMutableDictionary dictionary];
|
||||
|
||||
NSArray *propertyNames = [self additionalJSONKeys];
|
||||
for (NSString *name in propertyNames) {
|
||||
id obj = [self additionalPropertyForName:name];
|
||||
[result setObject:obj forKey:name];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma mark Child Cache methods
|
||||
|
||||
// There is no property for childCache_ as there shouldn't be KVC/KVO
|
||||
// support for it, it's an implementation detail.
|
||||
|
||||
- (void)setCacheChild:(id)obj forKey:(NSString *)key {
|
||||
if (childCache_ == nil && obj != nil) {
|
||||
childCache_ = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
|
||||
obj, key, nil];
|
||||
} else {
|
||||
[childCache_ setValue:obj forKey:key];
|
||||
}
|
||||
}
|
||||
|
||||
- (id)cacheChildForKey:(NSString *)key {
|
||||
id obj = [childCache_ objectForKey:key];
|
||||
return obj;
|
||||
}
|
||||
|
||||
#pragma mark userData and user properties
|
||||
|
||||
- (void)setUserData:(id)userData {
|
||||
[self setProperty:userData forKey:kUserDataPropertyKey];
|
||||
}
|
||||
|
||||
- (id)userData {
|
||||
// be sure the returned pointer has the life of the autorelease pool,
|
||||
// in case self is released immediately
|
||||
return [[[self propertyForKey:kUserDataPropertyKey] retain] autorelease];
|
||||
}
|
||||
|
||||
- (void)setProperty:(id)obj forKey:(NSString *)key {
|
||||
if (obj == nil) {
|
||||
// user passed in nil, so delete the property
|
||||
[userProperties_ removeObjectForKey:key];
|
||||
} else {
|
||||
// be sure the property dictionary exists
|
||||
if (userProperties_ == nil) {
|
||||
self.userProperties = [NSMutableDictionary dictionary];
|
||||
}
|
||||
[userProperties_ setObject:obj forKey:key];
|
||||
}
|
||||
}
|
||||
|
||||
- (id)propertyForKey:(NSString *)key {
|
||||
id obj = [userProperties_ objectForKey:key];
|
||||
|
||||
// be sure the returned pointer has the life of the autorelease pool,
|
||||
// in case self is released immediately
|
||||
return [[obj retain] autorelease];
|
||||
}
|
||||
|
||||
#pragma mark Support methods
|
||||
|
||||
+ (NSMutableArray *)allDeclaredProperties {
|
||||
NSMutableArray *array = [NSMutableArray array];
|
||||
|
||||
// walk from this class up the hierarchy to GTLObject
|
||||
Class topClass = class_getSuperclass([GTLObject class]);
|
||||
for (Class currClass = self;
|
||||
currClass != topClass;
|
||||
currClass = class_getSuperclass(currClass)) {
|
||||
// step through this class's properties, and add the property names to the
|
||||
// array
|
||||
objc_property_t *properties = class_copyPropertyList(currClass, NULL);
|
||||
if (properties) {
|
||||
for (objc_property_t *prop = properties;
|
||||
*prop != NULL;
|
||||
++prop) {
|
||||
const char *propName = property_getName(*prop);
|
||||
// We only want dynamic properties; their attributes contain ",D".
|
||||
const char *attr = property_getAttributes(*prop);
|
||||
const char *dynamicMarker = strstr(attr, ",D");
|
||||
if (dynamicMarker &&
|
||||
(dynamicMarker[2] == 0 || dynamicMarker[2] == ',' )) {
|
||||
[array addObject:[NSString stringWithUTF8String:propName]];
|
||||
}
|
||||
}
|
||||
free(properties);
|
||||
}
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
+ (NSArray *)allKnownKeys {
|
||||
NSArray *allProps = [self allDeclaredProperties];
|
||||
NSMutableArray *knownKeys = [NSMutableArray arrayWithArray:allProps];
|
||||
|
||||
NSDictionary *propMap = [GTLObject propertyToJSONKeyMapForClass:[self class]];
|
||||
|
||||
NSUInteger idx = 0;
|
||||
for (NSString *propName in allProps) {
|
||||
NSString *jsonKey = [propMap objectForKey:propName];
|
||||
if (jsonKey) {
|
||||
[knownKeys replaceObjectAtIndex:idx
|
||||
withObject:jsonKey];
|
||||
}
|
||||
++idx;
|
||||
}
|
||||
return knownKeys;
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
// find the list of declared and otherwise known JSON keys for this class
|
||||
NSArray *knownKeys = [[self class] allKnownKeys];
|
||||
|
||||
NSMutableString *descStr = [NSMutableString string];
|
||||
|
||||
NSString *spacer = @"";
|
||||
for (NSString *key in json_) {
|
||||
NSString *value = nil;
|
||||
// show question mark for JSON keys not supported by a declared property:
|
||||
// foo?:"Hi mom."
|
||||
NSString *qmark = [knownKeys containsObject:key] ? @"" : @"?";
|
||||
|
||||
// determine property value to dislay
|
||||
id rawValue = [json_ valueForKey:key];
|
||||
if ([rawValue isKindOfClass:[NSDictionary class]]) {
|
||||
// for dictionaries, show the list of keys:
|
||||
// {key1,key2,key3}
|
||||
NSString *subkeyList = [[rawValue allKeys] componentsJoinedByString:@","];
|
||||
value = [NSString stringWithFormat:@"{%@}", subkeyList];
|
||||
} else if ([rawValue isKindOfClass:[NSArray class]]) {
|
||||
// for arrays, show the number of items in the array:
|
||||
// [3]
|
||||
value = [NSString stringWithFormat:@"[%lu]", (unsigned long)[(NSArray *)rawValue count]];
|
||||
} else if ([rawValue isKindOfClass:[NSString class]]) {
|
||||
// for strings, show the string in quotes:
|
||||
// "Hi mom."
|
||||
value = [NSString stringWithFormat:@"\"%@\"", rawValue];
|
||||
} else {
|
||||
// for numbers, show just the number
|
||||
value = [rawValue description];
|
||||
}
|
||||
[descStr appendFormat:@"%@%@%@:%@", spacer, key, qmark, value];
|
||||
spacer = @" ";
|
||||
}
|
||||
|
||||
NSString *str = [NSString stringWithFormat:@"%@ %p: {%@}",
|
||||
[self class], self, descStr];
|
||||
return str;
|
||||
}
|
||||
|
||||
#pragma mark Class Registration
|
||||
|
||||
static NSMutableDictionary *gKindMap = nil;
|
||||
|
||||
+ (Class)registeredObjectClassForKind:(NSString *)kind {
|
||||
Class resultClass = [gKindMap objectForKey:kind];
|
||||
return resultClass;
|
||||
}
|
||||
|
||||
+ (void)registerObjectClassForKind:(NSString *)kind {
|
||||
// there's no autorelease pool in place at +load time, so we'll create our own
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
if (gKindMap == nil) {
|
||||
gKindMap = [GTLUtilities newStaticDictionary];
|
||||
}
|
||||
|
||||
Class selfClass = [self class];
|
||||
|
||||
#if DEBUG
|
||||
// ensure this is a unique registration
|
||||
if ([gKindMap objectForKey:kind] != nil ) {
|
||||
GTL_DEBUG_LOG(@"%@ (%@) registration conflicts with %@",
|
||||
selfClass, kind, [gKindMap objectForKey:kind]);
|
||||
}
|
||||
if ([[gKindMap allKeysForObject:selfClass] count] != 0) {
|
||||
GTL_DEBUG_LOG(@"%@ (%@) registration conflicts with %@",
|
||||
selfClass, kind, [gKindMap allKeysForObject:selfClass]);
|
||||
}
|
||||
#endif
|
||||
|
||||
[gKindMap setValue:selfClass forKey:kind];
|
||||
|
||||
// we drain here to keep the clang static analyzer quiet
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
#pragma mark Object Instantiation
|
||||
|
||||
+ (GTLObject *)objectForJSON:(NSMutableDictionary *)json
|
||||
defaultClass:(Class)defaultClass
|
||||
surrogates:(NSDictionary *)surrogates
|
||||
batchClassMap:(NSDictionary *)batchClassMap {
|
||||
if ([json count] == 0 || [json isEqual:[NSNull null]]) {
|
||||
// no actual result, such as the response from a delete
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Determine the class to instantiate, based on the original fetch
|
||||
// request or by looking up "kind" string from the registration at
|
||||
// +load time of GTLObject subclasses
|
||||
//
|
||||
// We're letting the dynamic kind override the default class so
|
||||
// feeds of heterogenous entries can use the defaultClass as a
|
||||
// fallback
|
||||
Class classToCreate = defaultClass;
|
||||
NSString *kind = nil;
|
||||
if ([json isKindOfClass:[NSDictionary class]]) {
|
||||
kind = [json valueForKey:@"kind"];
|
||||
if ([kind isKindOfClass:[NSString class]] && [kind length] > 0) {
|
||||
Class dynamicClass = [GTLObject registeredObjectClassForKind:kind];
|
||||
if (dynamicClass) {
|
||||
classToCreate = dynamicClass;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Warn the developer that no specific class of GTLObject
|
||||
// was requested with the fetch call, and no class is found
|
||||
// compiled in to match the "kind" attribute of the JSON
|
||||
// returned by the server
|
||||
GTL_ASSERT(classToCreate != nil,
|
||||
@"Could not find registered GTLObject subclass to "
|
||||
"match JSON with kind \"%@\"", kind);
|
||||
|
||||
if (classToCreate == nil) {
|
||||
classToCreate = [self class];
|
||||
}
|
||||
|
||||
// See if the top-level class for the JSON is listed in the surrogates;
|
||||
// if so, instantiate the surrogate class instead
|
||||
Class baseSurrogate = [surrogates objectForKey:classToCreate];
|
||||
if (baseSurrogate) {
|
||||
classToCreate = baseSurrogate;
|
||||
}
|
||||
|
||||
// now instantiate the GTLObject
|
||||
GTLObject *parsedObject = [classToCreate object];
|
||||
|
||||
parsedObject.surrogates = surrogates;
|
||||
parsedObject.JSON = json;
|
||||
|
||||
// it's time to instantiate inner items
|
||||
if ([parsedObject conformsToProtocol:@protocol(GTLBatchItemCreationProtocol)]) {
|
||||
id <GTLBatchItemCreationProtocol> batch =
|
||||
(id <GTLBatchItemCreationProtocol>) parsedObject;
|
||||
[batch createItemsWithClassMap:batchClassMap];
|
||||
}
|
||||
|
||||
return parsedObject;
|
||||
}
|
||||
|
||||
#pragma mark Runtime Utilities
|
||||
|
||||
static NSMutableDictionary *gJSONKeyMapCache = nil;
|
||||
static NSMutableDictionary *gArrayPropertyToClassMapCache = nil;
|
||||
|
||||
+ (void)initialize {
|
||||
// Note that initialize is guaranteed by the runtime to be called in a
|
||||
// thread-safe manner
|
||||
if (gJSONKeyMapCache == nil) {
|
||||
gJSONKeyMapCache = [GTLUtilities newStaticDictionary];
|
||||
}
|
||||
if (gArrayPropertyToClassMapCache == nil) {
|
||||
gArrayPropertyToClassMapCache = [GTLUtilities newStaticDictionary];
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMapForClass:(Class<GTLRuntimeCommon>)aClass {
|
||||
NSDictionary *resultMap =
|
||||
[GTLUtilities mergedClassDictionaryForSelector:@selector(propertyToJSONKeyMap)
|
||||
startClass:aClass
|
||||
ancestorClass:[GTLObject class]
|
||||
cache:gJSONKeyMapCache];
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMapForClass:(Class<GTLRuntimeCommon>)aClass {
|
||||
NSDictionary *resultMap =
|
||||
[GTLUtilities mergedClassDictionaryForSelector:@selector(arrayPropertyToClassMap)
|
||||
startClass:aClass
|
||||
ancestorClass:[GTLObject class]
|
||||
cache:gArrayPropertyToClassMapCache];
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
#pragma mark Runtime Support
|
||||
|
||||
+ (Class<GTLRuntimeCommon>)ancestorClass {
|
||||
return [GTLObject class];
|
||||
}
|
||||
|
||||
+ (BOOL)resolveInstanceMethod:(SEL)sel {
|
||||
BOOL resolved = [GTLRuntimeCommon resolveInstanceMethod:sel onClass:self];
|
||||
if (resolved)
|
||||
return YES;
|
||||
|
||||
return [super resolveInstanceMethod:sel];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation GTLCollectionObject
|
||||
// Subclasses must implement the items method dynamically.
|
||||
|
||||
- (void)dealloc {
|
||||
[identifierMap_ release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)itemAtIndex:(NSUInteger)idx {
|
||||
NSArray *items = [self performSelector:@selector(items)];
|
||||
if (idx < [items count]) {
|
||||
return [items objectAtIndex:idx];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id)objectAtIndexedSubscript:(NSInteger)idx {
|
||||
if (idx >= 0) {
|
||||
return [self itemAtIndex:(NSUInteger)idx];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id)itemForIdentifier:(NSString *)key {
|
||||
if (identifierMap_ == nil) {
|
||||
NSArray *items = [self performSelector:@selector(items)];
|
||||
NSMutableDictionary *dict =
|
||||
[NSMutableDictionary dictionaryWithCapacity:[items count]];
|
||||
for (id item in items) {
|
||||
id identifier = [item valueForKey:@"identifier"];
|
||||
if (identifier != nil && identifier != [NSNull null]) {
|
||||
if ([dict objectForKey:identifier] == nil) {
|
||||
[dict setObject:item forKey:identifier];
|
||||
}
|
||||
}
|
||||
}
|
||||
identifierMap_ = [dict copy];
|
||||
}
|
||||
return [identifierMap_ objectForKey:key];
|
||||
}
|
||||
|
||||
- (void)resetIdentifierMap {
|
||||
[identifierMap_ release];
|
||||
identifierMap_ = nil;
|
||||
}
|
||||
|
||||
// NSFastEnumeration protocol
|
||||
- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
|
||||
objects:(id *)stackbuf
|
||||
count:(NSUInteger)len {
|
||||
NSArray *items = [self performSelector:@selector(items)];
|
||||
NSUInteger result = [items countByEnumeratingWithState:state
|
||||
objects:stackbuf
|
||||
count:len];
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation GTLResultArray
|
||||
|
||||
- (NSArray *)itemsWithItemClass:(Class)itemClass {
|
||||
// Return the cached array before creating on demand.
|
||||
NSString *cacheKey = @"result_array_items";
|
||||
NSMutableArray *cachedArray = [self cacheChildForKey:cacheKey];
|
||||
if (cachedArray != nil) {
|
||||
return cachedArray;
|
||||
}
|
||||
NSArray *result = nil;
|
||||
NSArray *array = (NSArray *)[self JSON];
|
||||
if (array != nil) {
|
||||
if ([array isKindOfClass:[NSArray class]]) {
|
||||
NSDictionary *surrogates = self.surrogates;
|
||||
result = [GTLRuntimeCommon objectFromJSON:array
|
||||
defaultClass:itemClass
|
||||
surrogates:surrogates
|
||||
isCacheable:NULL];
|
||||
} else {
|
||||
#if DEBUG
|
||||
if (![array isKindOfClass:[NSNull class]]) {
|
||||
GTL_DEBUG_LOG(@"GTLObject: unexpected JSON: %@ should be an array, actually is a %@:\n%@",
|
||||
NSStringFromClass([self class]),
|
||||
NSStringFromClass([array class]),
|
||||
array);
|
||||
}
|
||||
#endif
|
||||
result = array;
|
||||
}
|
||||
}
|
||||
|
||||
[self setCacheChild:result forKey:cacheKey];
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
44
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLPlus/GTLPlus.h
Normal file
44
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLPlus/GTLPlus.h
Normal 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"
|
|
@ -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
|
|
@ -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.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusAcl.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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)
|
||||
|
||||
#import "GTLPlusAcl.h"
|
||||
|
||||
#import "GTLPlusAclentryResource.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusAcl
|
||||
//
|
||||
|
||||
@implementation GTLPlusAcl
|
||||
@dynamic descriptionProperty, items, kind;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"description"
|
||||
forKey:@"descriptionProperty"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:[GTLPlusAclentryResource class]
|
||||
forKey:@"items"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (void)load {
|
||||
[self registerObjectClassForKind:@"plus#acl"];
|
||||
}
|
||||
|
||||
@end
|
|
@ -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
|
|
@ -0,0 +1,48 @@
|
|||
/* 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.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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)
|
||||
|
||||
#import "GTLPlusAclentryResource.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusAclentryResource
|
||||
//
|
||||
|
||||
@implementation GTLPlusAclentryResource
|
||||
@dynamic displayName, identifier, type;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"id"
|
||||
forKey:@"identifier"];
|
||||
return map;
|
||||
}
|
||||
|
||||
@end
|
|
@ -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
|
|
@ -0,0 +1,290 @@
|
|||
/* 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.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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)
|
||||
|
||||
#import "GTLPlusActivity.h"
|
||||
|
||||
#import "GTLPlusAcl.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivity
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivity
|
||||
@dynamic access, actor, address, annotation, crosspostSource, ETag, geocode,
|
||||
identifier, kind, object, placeId, placeName, provider, published,
|
||||
radius, title, updated, url, verb;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"etag", @"ETag",
|
||||
@"id", @"identifier",
|
||||
nil];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (void)load {
|
||||
[self registerObjectClassForKind:@"plus#activity"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityActor
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityActor
|
||||
@dynamic displayName, identifier, image, name, url;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"id"
|
||||
forKey:@"identifier"];
|
||||
return map;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObject
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObject
|
||||
@dynamic actor, attachments, content, identifier, objectType, originalContent,
|
||||
plusoners, replies, resharers, url;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"id"
|
||||
forKey:@"identifier"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:[GTLPlusActivityObjectAttachmentsItem class]
|
||||
forKey:@"attachments"];
|
||||
return map;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityProvider
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityProvider
|
||||
@dynamic title;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityActorImage
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityActorImage
|
||||
@dynamic url;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityActorName
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityActorName
|
||||
@dynamic familyName, givenName;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectActor
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectActor
|
||||
@dynamic displayName, identifier, image, url;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"id"
|
||||
forKey:@"identifier"];
|
||||
return map;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectAttachmentsItem
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectAttachmentsItem
|
||||
@dynamic content, displayName, embed, fullImage, identifier, image, objectType,
|
||||
thumbnails, url;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"id"
|
||||
forKey:@"identifier"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:[GTLPlusActivityObjectAttachmentsItemThumbnailsItem class]
|
||||
forKey:@"thumbnails"];
|
||||
return map;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectPlusoners
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectPlusoners
|
||||
@dynamic selfLink, totalItems;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectReplies
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectReplies
|
||||
@dynamic selfLink, totalItems;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectResharers
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectResharers
|
||||
@dynamic selfLink, totalItems;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectActorImage
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectActorImage
|
||||
@dynamic url;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectAttachmentsItemEmbed
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectAttachmentsItemEmbed
|
||||
@dynamic type, url;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectAttachmentsItemFullImage
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectAttachmentsItemFullImage
|
||||
@dynamic height, type, url, width;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectAttachmentsItemImage
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectAttachmentsItemImage
|
||||
@dynamic height, type, url, width;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectAttachmentsItemThumbnailsItem
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectAttachmentsItemThumbnailsItem
|
||||
@dynamic descriptionProperty, image, url;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"description"
|
||||
forKey:@"descriptionProperty"];
|
||||
return map;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectAttachmentsItemThumbnailsItemImage
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectAttachmentsItemThumbnailsItemImage
|
||||
@dynamic height, type, url, width;
|
||||
@end
|
|
@ -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
|
|
@ -0,0 +1,64 @@
|
|||
/* 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.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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)
|
||||
|
||||
#import "GTLPlusActivityFeed.h"
|
||||
|
||||
#import "GTLPlusActivity.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityFeed
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityFeed
|
||||
@dynamic ETag, identifier, items, kind, nextLink, nextPageToken, selfLink,
|
||||
title, updated;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"etag", @"ETag",
|
||||
@"id", @"identifier",
|
||||
nil];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:[GTLPlusActivity class]
|
||||
forKey:@"items"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (void)load {
|
||||
[self registerObjectClassForKind:@"plus#activityFeed"];
|
||||
}
|
||||
|
||||
@end
|
|
@ -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
|
|
@ -0,0 +1,133 @@
|
|||
/* 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.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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)
|
||||
|
||||
#import "GTLPlusComment.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusComment
|
||||
//
|
||||
|
||||
@implementation GTLPlusComment
|
||||
@dynamic actor, ETag, identifier, inReplyTo, kind, object, plusoners, published,
|
||||
selfLink, updated, verb;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"etag", @"ETag",
|
||||
@"id", @"identifier",
|
||||
nil];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:[GTLPlusCommentInReplyToItem class]
|
||||
forKey:@"inReplyTo"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (void)load {
|
||||
[self registerObjectClassForKind:@"plus#comment"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusCommentActor
|
||||
//
|
||||
|
||||
@implementation GTLPlusCommentActor
|
||||
@dynamic displayName, identifier, image, url;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"id"
|
||||
forKey:@"identifier"];
|
||||
return map;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusCommentInReplyToItem
|
||||
//
|
||||
|
||||
@implementation GTLPlusCommentInReplyToItem
|
||||
@dynamic identifier, url;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"id"
|
||||
forKey:@"identifier"];
|
||||
return map;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusCommentObject
|
||||
//
|
||||
|
||||
@implementation GTLPlusCommentObject
|
||||
@dynamic content, objectType, originalContent;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusCommentPlusoners
|
||||
//
|
||||
|
||||
@implementation GTLPlusCommentPlusoners
|
||||
@dynamic totalItems;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusCommentActorImage
|
||||
//
|
||||
|
||||
@implementation GTLPlusCommentActorImage
|
||||
@dynamic url;
|
||||
@end
|
|
@ -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
|
|
@ -0,0 +1,63 @@
|
|||
/* 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.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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)
|
||||
|
||||
#import "GTLPlusCommentFeed.h"
|
||||
|
||||
#import "GTLPlusComment.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusCommentFeed
|
||||
//
|
||||
|
||||
@implementation GTLPlusCommentFeed
|
||||
@dynamic ETag, identifier, items, kind, nextLink, nextPageToken, title, updated;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"etag", @"ETag",
|
||||
@"id", @"identifier",
|
||||
nil];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:[GTLPlusComment class]
|
||||
forKey:@"items"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (void)load {
|
||||
[self registerObjectClassForKind:@"plus#commentFeed"];
|
||||
}
|
||||
|
||||
@end
|
|
@ -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"
|
|
@ -0,0 +1,49 @@
|
|||
/* 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.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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"
|
||||
|
||||
// Authorization scope
|
||||
NSString * const kGTLAuthScopePlusLogin = @"https://www.googleapis.com/auth/plus.login";
|
||||
NSString * const kGTLAuthScopePlusMe = @"https://www.googleapis.com/auth/plus.me";
|
||||
|
||||
// Collection
|
||||
NSString * const kGTLPlusCollectionPlusoners = @"plusoners";
|
||||
NSString * const kGTLPlusCollectionPublic = @"public";
|
||||
NSString * const kGTLPlusCollectionResharers = @"resharers";
|
||||
NSString * const kGTLPlusCollectionVault = @"vault";
|
||||
NSString * const kGTLPlusCollectionVisible = @"visible";
|
||||
|
||||
// OrderBy
|
||||
NSString * const kGTLPlusOrderByAlphabetical = @"alphabetical";
|
||||
NSString * const kGTLPlusOrderByBest = @"best";
|
||||
NSString * const kGTLPlusOrderByRecent = @"recent";
|
||||
|
||||
// SortOrder
|
||||
NSString * const kGTLPlusSortOrderAscending = @"ascending";
|
||||
NSString * const kGTLPlusSortOrderDescending = @"descending";
|
|
@ -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
|
|
@ -0,0 +1,77 @@
|
|||
/* 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.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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)
|
||||
|
||||
#import "GTLPlusItemScope.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusItemScope
|
||||
//
|
||||
|
||||
@implementation GTLPlusItemScope
|
||||
@dynamic about, additionalName, address, addressCountry, addressLocality,
|
||||
addressRegion, associatedMedia, attendeeCount, attendees, audio,
|
||||
author, bestRating, birthDate, byArtist, caption, contentSize,
|
||||
contentUrl, contributor, dateCreated, dateModified, datePublished,
|
||||
descriptionProperty, duration, embedUrl, endDate, familyName, gender,
|
||||
geo, givenName, height, identifier, image, inAlbum, kind, latitude,
|
||||
location, longitude, name, partOfTVSeries, performers, playerType,
|
||||
postalCode, postOfficeBoxNumber, ratingValue, reviewRating, startDate,
|
||||
streetAddress, text, thumbnail, thumbnailUrl, tickerSymbol, type, url,
|
||||
width, worstRating;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"associated_media", @"associatedMedia",
|
||||
@"description", @"descriptionProperty",
|
||||
@"id", @"identifier",
|
||||
nil];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSString class], @"additionalName",
|
||||
[GTLPlusItemScope class], @"associated_media",
|
||||
[GTLPlusItemScope class], @"attendees",
|
||||
[GTLPlusItemScope class], @"author",
|
||||
[GTLPlusItemScope class], @"contributor",
|
||||
[GTLPlusItemScope class], @"performers",
|
||||
nil];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (void)load {
|
||||
[self registerObjectClassForKind:@"plus#itemScope"];
|
||||
}
|
||||
|
||||
@end
|
|
@ -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
|
|
@ -0,0 +1,54 @@
|
|||
/* 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.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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)
|
||||
|
||||
#import "GTLPlusMoment.h"
|
||||
|
||||
#import "GTLPlusItemScope.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusMoment
|
||||
//
|
||||
|
||||
@implementation GTLPlusMoment
|
||||
@dynamic identifier, kind, result, startDate, target, type;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"id"
|
||||
forKey:@"identifier"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (void)load {
|
||||
[self registerObjectClassForKind:@"plus#moment"];
|
||||
}
|
||||
|
||||
@end
|
|
@ -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
|
|
@ -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.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusMomentsFeed.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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)
|
||||
|
||||
#import "GTLPlusMomentsFeed.h"
|
||||
|
||||
#import "GTLPlusMoment.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusMomentsFeed
|
||||
//
|
||||
|
||||
@implementation GTLPlusMomentsFeed
|
||||
@dynamic ETag, items, kind, nextLink, nextPageToken, selfLink, title, updated;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"etag"
|
||||
forKey:@"ETag"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:[GTLPlusMoment class]
|
||||
forKey:@"items"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (void)load {
|
||||
[self registerObjectClassForKind:@"plus#momentsFeed"];
|
||||
}
|
||||
|
||||
@end
|
|
@ -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
|
|
@ -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.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusPeopleFeed.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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)
|
||||
|
||||
#import "GTLPlusPeopleFeed.h"
|
||||
|
||||
#import "GTLPlusPerson.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPeopleFeed
|
||||
//
|
||||
|
||||
@implementation GTLPlusPeopleFeed
|
||||
@dynamic ETag, items, kind, nextPageToken, selfLink, title, totalItems;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"etag"
|
||||
forKey:@"ETag"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:[GTLPlusPerson class]
|
||||
forKey:@"items"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (void)load {
|
||||
[self registerObjectClassForKind:@"plus#peopleFeed"];
|
||||
}
|
||||
|
||||
@end
|
388
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLPlus/GTLPlusPerson.h
Normal file
388
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLPlus/GTLPlusPerson.h
Normal 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
|
189
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLPlus/GTLPlusPerson.m
Normal file
189
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLPlus/GTLPlusPerson.m
Normal file
|
@ -0,0 +1,189 @@
|
|||
/* 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.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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)
|
||||
|
||||
#import "GTLPlusPerson.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPerson
|
||||
//
|
||||
|
||||
@implementation GTLPlusPerson
|
||||
@dynamic aboutMe, ageRange, birthday, braggingRights, circledByCount, cover,
|
||||
currentLocation, displayName, emails, ETag, gender, hasApp, identifier,
|
||||
image, isPlusUser, kind, language, name, nickname, objectType,
|
||||
organizations, placesLived, plusOneCount, relationshipStatus, tagline,
|
||||
url, urls, verified;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"etag", @"ETag",
|
||||
@"id", @"identifier",
|
||||
nil];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[GTLPlusPersonEmailsItem class], @"emails",
|
||||
[GTLPlusPersonOrganizationsItem class], @"organizations",
|
||||
[GTLPlusPersonPlacesLivedItem class], @"placesLived",
|
||||
[GTLPlusPersonUrlsItem class], @"urls",
|
||||
nil];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (void)load {
|
||||
[self registerObjectClassForKind:@"plus#person"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonAgeRange
|
||||
//
|
||||
|
||||
@implementation GTLPlusPersonAgeRange
|
||||
@dynamic max, min;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonCover
|
||||
//
|
||||
|
||||
@implementation GTLPlusPersonCover
|
||||
@dynamic coverInfo, coverPhoto, layout;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonEmailsItem
|
||||
//
|
||||
|
||||
@implementation GTLPlusPersonEmailsItem
|
||||
@dynamic primary, type, value;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonImage
|
||||
//
|
||||
|
||||
@implementation GTLPlusPersonImage
|
||||
@dynamic url;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonName
|
||||
//
|
||||
|
||||
@implementation GTLPlusPersonName
|
||||
@dynamic familyName, formatted, givenName, honorificPrefix, honorificSuffix,
|
||||
middleName;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonOrganizationsItem
|
||||
//
|
||||
|
||||
@implementation GTLPlusPersonOrganizationsItem
|
||||
@dynamic department, descriptionProperty, endDate, location, name, primary,
|
||||
startDate, title, type;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"description"
|
||||
forKey:@"descriptionProperty"];
|
||||
return map;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonPlacesLivedItem
|
||||
//
|
||||
|
||||
@implementation GTLPlusPersonPlacesLivedItem
|
||||
@dynamic primary, value;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonUrlsItem
|
||||
//
|
||||
|
||||
@implementation GTLPlusPersonUrlsItem
|
||||
@dynamic primary, type, value;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonCoverCoverInfo
|
||||
//
|
||||
|
||||
@implementation GTLPlusPersonCoverCoverInfo
|
||||
@dynamic leftImageOffset, topImageOffset;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonCoverCoverPhoto
|
||||
//
|
||||
|
||||
@implementation GTLPlusPersonCoverCoverPhoto
|
||||
@dynamic height, url, width;
|
||||
@end
|
297
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLPlus/GTLQueryPlus.h
Normal file
297
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLPlus/GTLQueryPlus.h
Normal 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
|
182
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLPlus/GTLQueryPlus.m
Normal file
182
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLPlus/GTLQueryPlus.m
Normal file
|
@ -0,0 +1,182 @@
|
|||
/* 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.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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)
|
||||
|
||||
#import "GTLQueryPlus.h"
|
||||
|
||||
#import "GTLPlusActivity.h"
|
||||
#import "GTLPlusActivityFeed.h"
|
||||
#import "GTLPlusComment.h"
|
||||
#import "GTLPlusCommentFeed.h"
|
||||
#import "GTLPlusMoment.h"
|
||||
#import "GTLPlusMomentsFeed.h"
|
||||
#import "GTLPlusPeopleFeed.h"
|
||||
#import "GTLPlusPerson.h"
|
||||
|
||||
@implementation GTLQueryPlus
|
||||
|
||||
@dynamic activityId, collection, commentId, debug, fields, identifier, language,
|
||||
maxResults, orderBy, pageToken, query, sortOrder, targetUrl, type,
|
||||
userId;
|
||||
|
||||
+ (NSDictionary *)parameterNameMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"id"
|
||||
forKey:@"identifier"];
|
||||
return map;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark "activities" methods
|
||||
// These create a GTLQueryPlus object.
|
||||
|
||||
+ (id)queryForActivitiesGetWithActivityId:(NSString *)activityId {
|
||||
NSString *methodName = @"plus.activities.get";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.activityId = activityId;
|
||||
query.expectedObjectClass = [GTLPlusActivity class];
|
||||
return query;
|
||||
}
|
||||
|
||||
+ (id)queryForActivitiesListWithUserId:(NSString *)userId
|
||||
collection:(NSString *)collection {
|
||||
NSString *methodName = @"plus.activities.list";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.userId = userId;
|
||||
query.collection = collection;
|
||||
query.expectedObjectClass = [GTLPlusActivityFeed class];
|
||||
return query;
|
||||
}
|
||||
|
||||
+ (id)queryForActivitiesSearchWithQuery:(NSString *)query_param {
|
||||
NSString *methodName = @"plus.activities.search";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.query = query_param;
|
||||
query.expectedObjectClass = [GTLPlusActivityFeed class];
|
||||
return query;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark "comments" methods
|
||||
// These create a GTLQueryPlus object.
|
||||
|
||||
+ (id)queryForCommentsGetWithCommentId:(NSString *)commentId {
|
||||
NSString *methodName = @"plus.comments.get";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.commentId = commentId;
|
||||
query.expectedObjectClass = [GTLPlusComment class];
|
||||
return query;
|
||||
}
|
||||
|
||||
+ (id)queryForCommentsListWithActivityId:(NSString *)activityId {
|
||||
NSString *methodName = @"plus.comments.list";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.activityId = activityId;
|
||||
query.expectedObjectClass = [GTLPlusCommentFeed class];
|
||||
return query;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark "moments" methods
|
||||
// These create a GTLQueryPlus object.
|
||||
|
||||
+ (id)queryForMomentsInsertWithObject:(GTLPlusMoment *)object
|
||||
userId:(NSString *)userId
|
||||
collection:(NSString *)collection {
|
||||
if (object == nil) {
|
||||
GTL_DEBUG_ASSERT(object != nil, @"%@ got a nil object", NSStringFromSelector(_cmd));
|
||||
return nil;
|
||||
}
|
||||
NSString *methodName = @"plus.moments.insert";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.bodyObject = object;
|
||||
query.userId = userId;
|
||||
query.collection = collection;
|
||||
query.expectedObjectClass = [GTLPlusMoment class];
|
||||
return query;
|
||||
}
|
||||
|
||||
+ (id)queryForMomentsListWithUserId:(NSString *)userId
|
||||
collection:(NSString *)collection {
|
||||
NSString *methodName = @"plus.moments.list";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.userId = userId;
|
||||
query.collection = collection;
|
||||
query.expectedObjectClass = [GTLPlusMomentsFeed class];
|
||||
return query;
|
||||
}
|
||||
|
||||
+ (id)queryForMomentsRemoveWithIdentifier:(NSString *)identifier {
|
||||
NSString *methodName = @"plus.moments.remove";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.identifier = identifier;
|
||||
return query;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark "people" methods
|
||||
// These create a GTLQueryPlus object.
|
||||
|
||||
+ (id)queryForPeopleGetWithUserId:(NSString *)userId {
|
||||
NSString *methodName = @"plus.people.get";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.userId = userId;
|
||||
query.expectedObjectClass = [GTLPlusPerson class];
|
||||
return query;
|
||||
}
|
||||
|
||||
+ (id)queryForPeopleListWithUserId:(NSString *)userId
|
||||
collection:(NSString *)collection {
|
||||
NSString *methodName = @"plus.people.list";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.userId = userId;
|
||||
query.collection = collection;
|
||||
query.expectedObjectClass = [GTLPlusPeopleFeed class];
|
||||
return query;
|
||||
}
|
||||
|
||||
+ (id)queryForPeopleListByActivityWithActivityId:(NSString *)activityId
|
||||
collection:(NSString *)collection {
|
||||
NSString *methodName = @"plus.people.listByActivity";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.activityId = activityId;
|
||||
query.collection = collection;
|
||||
query.expectedObjectClass = [GTLPlusPeopleFeed class];
|
||||
return query;
|
||||
}
|
||||
|
||||
+ (id)queryForPeopleSearchWithQuery:(NSString *)query_param {
|
||||
NSString *methodName = @"plus.people.search";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.query = query_param;
|
||||
query.expectedObjectClass = [GTLPlusPeopleFeed class];
|
||||
return query;
|
||||
}
|
||||
|
||||
@end
|
|
@ -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
|
|
@ -0,0 +1,71 @@
|
|||
/* 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.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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)
|
||||
|
||||
#import "GTLPlus.h"
|
||||
|
||||
@implementation GTLServicePlus
|
||||
|
||||
#if DEBUG
|
||||
// Method compiled in debug builds just to check that all the needed support
|
||||
// classes are present at link time.
|
||||
+ (NSArray *)checkClasses {
|
||||
NSArray *classes = [NSArray arrayWithObjects:
|
||||
[GTLQueryPlus class],
|
||||
[GTLPlusAcl class],
|
||||
[GTLPlusAclentryResource class],
|
||||
[GTLPlusActivity class],
|
||||
[GTLPlusActivityFeed class],
|
||||
[GTLPlusComment class],
|
||||
[GTLPlusCommentFeed class],
|
||||
[GTLPlusItemScope class],
|
||||
[GTLPlusMoment class],
|
||||
[GTLPlusMomentsFeed class],
|
||||
[GTLPlusPeopleFeed class],
|
||||
[GTLPlusPerson class],
|
||||
nil];
|
||||
return classes;
|
||||
}
|
||||
#endif // DEBUG
|
||||
|
||||
- (id)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
// Version from discovery.
|
||||
self.apiVersion = @"v1";
|
||||
|
||||
// From discovery. Where to send JSON-RPC.
|
||||
// Turn off prettyPrint for this service to save bandwidth (especially on
|
||||
// mobile). The fetcher logging will pretty print.
|
||||
self.rpcURL = [NSURL URLWithString:@"https://www.googleapis.com/rpc?prettyPrint=false"];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
135
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLQuery.h
Normal file
135
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLQuery.h
Normal file
|
@ -0,0 +1,135 @@
|
|||
/* 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;
|
||||
- (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
|
267
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLQuery.m
Normal file
267
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLQuery.m
Normal file
|
@ -0,0 +1,267 @@
|
|||
/* 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.m
|
||||
//
|
||||
|
||||
#include <objc/runtime.h>
|
||||
|
||||
#import "GTLQuery.h"
|
||||
#import "GTLRuntimeCommon.h"
|
||||
#import "GTLUtilities.h"
|
||||
|
||||
@interface GTLQuery () <GTLRuntimeCommon>
|
||||
@end
|
||||
|
||||
@implementation GTLQuery
|
||||
|
||||
// Implementation Note: bodyObject could be done as a dynamic property and map
|
||||
// it to the key "resource". But we expose the object on the ServiceTicket
|
||||
// for developers, and so sending it through the plumbing already in the
|
||||
// parameters and outside of that gets into a grey area. For requests sent
|
||||
// via this class, we don't need to touch the JSON, but for developers that
|
||||
// have to use the lower level apis for something we'd need to know to add
|
||||
// it to the JSON.
|
||||
|
||||
@synthesize methodName = methodName_,
|
||||
JSON = json_,
|
||||
bodyObject = bodyObject_,
|
||||
requestID = requestID_,
|
||||
uploadParameters = uploadParameters_,
|
||||
urlQueryParameters = urlQueryParameters_,
|
||||
additionalHTTPHeaders = additionalHTTPHeaders_,
|
||||
expectedObjectClass = expectedObjectClass_,
|
||||
shouldSkipAuthorization = skipAuthorization_;
|
||||
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
@synthesize completionBlock = completionBlock_;
|
||||
#endif
|
||||
|
||||
+ (id)queryWithMethodName:(NSString *)methodName {
|
||||
return [[[self alloc] initWithMethodName:methodName] autorelease];
|
||||
}
|
||||
|
||||
- (id)initWithMethodName:(NSString *)methodName {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
requestID_ = [[[self class] nextRequestID] retain];
|
||||
|
||||
methodName_ = [methodName copy];
|
||||
if ([methodName_ length] == 0) {
|
||||
[self release];
|
||||
self = nil;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[methodName_ release];
|
||||
[json_ release];
|
||||
[bodyObject_ release];
|
||||
[childCache_ release];
|
||||
[requestID_ release];
|
||||
[uploadParameters_ release];
|
||||
[urlQueryParameters_ release];
|
||||
[additionalHTTPHeaders_ release];
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
[completionBlock_ release];
|
||||
#endif
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone {
|
||||
GTLQuery *query =
|
||||
[[[self class] allocWithZone:zone] initWithMethodName:self.methodName];
|
||||
|
||||
if ([json_ count] > 0) {
|
||||
// Deep copy the parameters
|
||||
CFPropertyListRef ref = CFPropertyListCreateDeepCopy(kCFAllocatorDefault,
|
||||
json_, kCFPropertyListMutableContainers);
|
||||
query.JSON = [NSMakeCollectable(ref) autorelease];
|
||||
}
|
||||
query.bodyObject = self.bodyObject;
|
||||
query.requestID = self.requestID;
|
||||
query.uploadParameters = self.uploadParameters;
|
||||
query.urlQueryParameters = self.urlQueryParameters;
|
||||
query.additionalHTTPHeaders = self.additionalHTTPHeaders;
|
||||
query.expectedObjectClass = self.expectedObjectClass;
|
||||
query.shouldSkipAuthorization = self.shouldSkipAuthorization;
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
query.completionBlock = self.completionBlock;
|
||||
#endif
|
||||
return query;
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
NSArray *keys = [self.JSON allKeys];
|
||||
NSArray *params = [keys sortedArrayUsingSelector:@selector(compare:)];
|
||||
NSString *paramsSummary = @"";
|
||||
if ([params count] > 0) {
|
||||
paramsSummary = [NSString stringWithFormat:@" params:(%@)",
|
||||
[params componentsJoinedByString:@","]];
|
||||
}
|
||||
|
||||
keys = [self.urlQueryParameters allKeys];
|
||||
NSArray *urlQParams = [keys sortedArrayUsingSelector:@selector(compare:)];
|
||||
NSString *urlQParamsSummary = @"";
|
||||
if ([urlQParams count] > 0) {
|
||||
urlQParamsSummary = [NSString stringWithFormat:@" urlQParams:(%@)",
|
||||
[urlQParams componentsJoinedByString:@","]];
|
||||
}
|
||||
|
||||
GTLObject *bodyObj = self.bodyObject;
|
||||
NSString *bodyObjSummary = @"";
|
||||
if (bodyObj != nil) {
|
||||
bodyObjSummary = [NSString stringWithFormat:@" bodyObject:%@", [bodyObj class]];
|
||||
}
|
||||
|
||||
NSString *uploadStr = @"";
|
||||
GTLUploadParameters *uploadParams = self.uploadParameters;
|
||||
if (uploadParams) {
|
||||
uploadStr = [NSString stringWithFormat:@" %@", uploadParams];
|
||||
}
|
||||
|
||||
return [NSString stringWithFormat:@"%@ %p: {method:%@%@%@%@%@}",
|
||||
[self class], self, self.methodName,
|
||||
paramsSummary, urlQParamsSummary, bodyObjSummary, uploadStr];
|
||||
}
|
||||
|
||||
- (void)setCustomParameter:(id)obj forKey:(NSString *)key {
|
||||
[self setJSONValue:obj forKey:key];
|
||||
}
|
||||
|
||||
- (BOOL)isBatchQuery {
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)executionDidStop {
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
self.completionBlock = nil;
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (NSString *)nextRequestID {
|
||||
static unsigned long lastRequestID = 0;
|
||||
NSString *result;
|
||||
|
||||
@synchronized([GTLQuery class]) {
|
||||
++lastRequestID;
|
||||
result = [NSString stringWithFormat:@"gtl_%lu",
|
||||
(unsigned long) lastRequestID];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma mark GTLRuntimeCommon Support
|
||||
|
||||
- (void)setJSONValue:(id)obj forKey:(NSString *)key {
|
||||
NSMutableDictionary *dict = self.JSON;
|
||||
if (dict == nil && obj != nil) {
|
||||
dict = [NSMutableDictionary dictionaryWithCapacity:1];
|
||||
self.JSON = dict;
|
||||
}
|
||||
[dict setValue:obj forKey:key];
|
||||
}
|
||||
|
||||
- (id)JSONValueForKey:(NSString *)key {
|
||||
id obj = [self.JSON objectForKey:key];
|
||||
return obj;
|
||||
}
|
||||
|
||||
// There is no property for childCache_ as there shouldn't be KVC/KVO
|
||||
// support for it, it's an implementation detail.
|
||||
|
||||
- (void)setCacheChild:(id)obj forKey:(NSString *)key {
|
||||
if (childCache_ == nil && obj != nil) {
|
||||
childCache_ =
|
||||
[[NSMutableDictionary alloc] initWithObjectsAndKeys:obj, key, nil];
|
||||
} else {
|
||||
[childCache_ setValue:obj forKey:key];
|
||||
}
|
||||
}
|
||||
|
||||
- (id)cacheChildForKey:(NSString *)key {
|
||||
id obj = [childCache_ objectForKey:key];
|
||||
return obj;
|
||||
}
|
||||
|
||||
#pragma mark Methods for Subclasses to Override
|
||||
|
||||
+ (NSDictionary *)parameterNameMap {
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark Runtime Utilities
|
||||
|
||||
static NSMutableDictionary *gParameterNameMapCache = nil;
|
||||
static NSMutableDictionary *gArrayPropertyToClassMapCache = nil;
|
||||
|
||||
+ (void)initialize {
|
||||
// note that initialize is guaranteed by the runtime to be called in a
|
||||
// thread-safe manner
|
||||
if (gParameterNameMapCache == nil) {
|
||||
gParameterNameMapCache = [GTLUtilities newStaticDictionary];
|
||||
}
|
||||
if (gArrayPropertyToClassMapCache == nil) {
|
||||
gArrayPropertyToClassMapCache = [GTLUtilities newStaticDictionary];
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMapForClass:(Class<GTLRuntimeCommon>)aClass {
|
||||
NSDictionary *resultMap =
|
||||
[GTLUtilities mergedClassDictionaryForSelector:@selector(parameterNameMap)
|
||||
startClass:aClass
|
||||
ancestorClass:[GTLQuery class]
|
||||
cache:gParameterNameMapCache];
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMapForClass:(Class<GTLRuntimeCommon>)aClass {
|
||||
NSDictionary *resultMap =
|
||||
[GTLUtilities mergedClassDictionaryForSelector:@selector(arrayPropertyToClassMap)
|
||||
startClass:aClass
|
||||
ancestorClass:[GTLQuery class]
|
||||
cache:gArrayPropertyToClassMapCache];
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
#pragma mark Runtime Support
|
||||
|
||||
- (NSDictionary *)surrogates {
|
||||
// Stub method just needed for RumtimeCommon, query doesn't use surrogates.
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (Class<GTLRuntimeCommon>)ancestorClass {
|
||||
return [GTLQuery class];
|
||||
}
|
||||
|
||||
+ (BOOL)resolveInstanceMethod:(SEL)sel {
|
||||
BOOL resolved = [GTLRuntimeCommon resolveInstanceMethod:sel onClass:self];
|
||||
if (resolved)
|
||||
return YES;
|
||||
|
||||
return [super resolveInstanceMethod:sel];
|
||||
}
|
||||
|
||||
@end
|
57
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLRuntimeCommon.h
Normal file
57
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLRuntimeCommon.h
Normal 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
|
1141
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLRuntimeCommon.m
Normal file
1141
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLRuntimeCommon.m
Normal file
File diff suppressed because it is too large
Load diff
607
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLService.h
Normal file
607
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLService.h
Normal 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
|
||||
|
2407
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLService.m
Normal file
2407
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLService.m
Normal file
File diff suppressed because it is too large
Load diff
|
@ -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
|
|
@ -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
|
107
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLUploadParameters.m
Normal file
107
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLUploadParameters.m
Normal file
|
@ -0,0 +1,107 @@
|
|||
/* 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.m
|
||||
//
|
||||
|
||||
#include <objc/runtime.h>
|
||||
|
||||
#import "GTLUploadParameters.h"
|
||||
|
||||
@implementation GTLUploadParameters
|
||||
|
||||
@synthesize MIMEType = MIMEType_,
|
||||
data = data_,
|
||||
fileHandle = fileHandle_,
|
||||
uploadLocationURL = uploadLocationURL_,
|
||||
slug = slug_,
|
||||
shouldSendUploadOnly = shouldSendUploadOnly_;
|
||||
|
||||
+ (GTLUploadParameters *)uploadParametersWithData:(NSData *)data
|
||||
MIMEType:(NSString *)mimeType {
|
||||
GTLUploadParameters *params = [[[GTLUploadParameters alloc] init] autorelease];
|
||||
params.data = data;
|
||||
params.MIMEType = mimeType;
|
||||
return params;
|
||||
}
|
||||
|
||||
+ (GTLUploadParameters *)uploadParametersWithFileHandle:(NSFileHandle *)fileHandle
|
||||
MIMEType:(NSString *)mimeType {
|
||||
GTLUploadParameters *params = [[[GTLUploadParameters alloc] init] autorelease];
|
||||
params.fileHandle = fileHandle;
|
||||
params.MIMEType = mimeType;
|
||||
return params;
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone {
|
||||
GTLUploadParameters *newParams = [[[self class] allocWithZone:zone] init];
|
||||
newParams.MIMEType = self.MIMEType;
|
||||
newParams.data = self.data;
|
||||
newParams.fileHandle = self.fileHandle;
|
||||
newParams.uploadLocationURL = self.uploadLocationURL;
|
||||
newParams.slug = self.slug;
|
||||
newParams.shouldSendUploadOnly = self.shouldSendUploadOnly;
|
||||
return newParams;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[MIMEType_ release];
|
||||
[data_ release];
|
||||
[fileHandle_ release];
|
||||
[uploadLocationURL_ release];
|
||||
[slug_ release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
NSMutableArray *array = [NSMutableArray array];
|
||||
NSString *str = [NSString stringWithFormat:@"MIMEType:%@", MIMEType_];
|
||||
[array addObject:str];
|
||||
|
||||
if (data_) {
|
||||
str = [NSString stringWithFormat:@"data:%llu bytes",
|
||||
(unsigned long long)[data_ length]];
|
||||
[array addObject:str];
|
||||
}
|
||||
|
||||
if (fileHandle_) {
|
||||
str = [NSString stringWithFormat:@"fileHandle:%@", fileHandle_];
|
||||
[array addObject:str];
|
||||
}
|
||||
|
||||
if (uploadLocationURL_) {
|
||||
str = [NSString stringWithFormat:@"uploadLocation:%@",
|
||||
[uploadLocationURL_ absoluteString]];
|
||||
[array addObject:str];
|
||||
}
|
||||
|
||||
if (slug_) {
|
||||
str = [NSString stringWithFormat:@"slug:%@", slug_];
|
||||
[array addObject:str];
|
||||
}
|
||||
|
||||
if (shouldSendUploadOnly_) {
|
||||
[array addObject:@"shouldSendUploadOnly"];
|
||||
}
|
||||
|
||||
NSString *descStr = [array componentsJoinedByString:@", "];
|
||||
str = [NSString stringWithFormat:@"%@ %p: {%@}",
|
||||
[self class], self, descStr];
|
||||
return str;
|
||||
}
|
||||
|
||||
@end
|
93
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLUtilities.h
Normal file
93
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLUtilities.h
Normal 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
|
358
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLUtilities.m
Normal file
358
iphone/Maps/GooglePlusSDK/OpenSource/GTL/GTLUtilities.m
Normal file
|
@ -0,0 +1,358 @@
|
|||
/* 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 "GTLUtilities.h"
|
||||
|
||||
#include <objc/runtime.h>
|
||||
|
||||
@implementation GTLUtilities
|
||||
|
||||
#pragma mark String encoding
|
||||
|
||||
// URL Encoding
|
||||
|
||||
+ (NSString *)stringByURLEncodingString:(NSString *)str {
|
||||
NSString *result = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
return result;
|
||||
}
|
||||
|
||||
// NSURL's stringByAddingPercentEscapesUsingEncoding: does not escape
|
||||
// some characters that should be escaped in URL parameters, like / and ?;
|
||||
// we'll use CFURL to force the encoding of those
|
||||
//
|
||||
// Reference: http://www.ietf.org/rfc/rfc3986.txt
|
||||
|
||||
const CFStringRef kCharsToForceEscape = CFSTR("!*'();:@&=+$,/?%#[]");
|
||||
|
||||
+ (NSString *)stringByURLEncodingForURI:(NSString *)str {
|
||||
|
||||
NSString *resultStr = str;
|
||||
|
||||
CFStringRef originalString = (CFStringRef) str;
|
||||
CFStringRef leaveUnescaped = NULL;
|
||||
|
||||
CFStringRef escapedStr;
|
||||
escapedStr = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
|
||||
originalString,
|
||||
leaveUnescaped,
|
||||
kCharsToForceEscape,
|
||||
kCFStringEncodingUTF8);
|
||||
if (escapedStr) {
|
||||
resultStr = [(id)CFMakeCollectable(escapedStr) autorelease];
|
||||
}
|
||||
return resultStr;
|
||||
}
|
||||
|
||||
+ (NSString *)stringByURLEncodingStringParameter:(NSString *)str {
|
||||
// For parameters, we'll explicitly leave spaces unescaped now, and replace
|
||||
// them with +'s
|
||||
NSString *resultStr = str;
|
||||
|
||||
CFStringRef originalString = (CFStringRef) str;
|
||||
CFStringRef leaveUnescaped = CFSTR(" ");
|
||||
|
||||
CFStringRef escapedStr;
|
||||
escapedStr = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
|
||||
originalString,
|
||||
leaveUnescaped,
|
||||
kCharsToForceEscape,
|
||||
kCFStringEncodingUTF8);
|
||||
|
||||
if (escapedStr) {
|
||||
NSMutableString *mutableStr = [NSMutableString stringWithString:(NSString *)escapedStr];
|
||||
CFRelease(escapedStr);
|
||||
|
||||
// replace spaces with plusses
|
||||
[mutableStr replaceOccurrencesOfString:@" "
|
||||
withString:@"+"
|
||||
options:0
|
||||
range:NSMakeRange(0, [mutableStr length])];
|
||||
resultStr = mutableStr;
|
||||
}
|
||||
return resultStr;
|
||||
}
|
||||
|
||||
+ (NSString *)stringByPercentEncodingUTF8ForString:(NSString *)inputStr {
|
||||
|
||||
// Encode per http://bitworking.org/projects/atom/rfc5023.html#rfc.section.9.7
|
||||
//
|
||||
// This is used for encoding upload slug headers
|
||||
//
|
||||
// Step through the string as UTF-8, and replace characters outside 20..7E
|
||||
// (and the percent symbol itself, 25) with percent-encodings
|
||||
//
|
||||
// We avoid creating an encoding string unless we encounter some characters
|
||||
// that require it
|
||||
const char* utf8 = [inputStr UTF8String];
|
||||
if (utf8 == NULL) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSMutableString *encoded = nil;
|
||||
|
||||
for (unsigned int idx = 0; utf8[idx] != '\0'; idx++) {
|
||||
|
||||
unsigned char currChar = (unsigned char)utf8[idx];
|
||||
if (currChar < 0x20 || currChar == 0x25 || currChar > 0x7E) {
|
||||
|
||||
if (encoded == nil) {
|
||||
// Start encoding and catch up on the character skipped so far
|
||||
encoded = [[[NSMutableString alloc] initWithBytes:utf8
|
||||
length:idx
|
||||
encoding:NSUTF8StringEncoding] autorelease];
|
||||
}
|
||||
|
||||
// append this byte as a % and then uppercase hex
|
||||
[encoded appendFormat:@"%%%02X", currChar];
|
||||
|
||||
} else {
|
||||
// This character does not need encoding
|
||||
//
|
||||
// Encoded is nil here unless we've encountered a previous character
|
||||
// that needed encoding
|
||||
[encoded appendFormat:@"%c", currChar];
|
||||
}
|
||||
}
|
||||
|
||||
if (encoded) {
|
||||
return encoded;
|
||||
}
|
||||
|
||||
return inputStr;
|
||||
}
|
||||
|
||||
#pragma mark Key-Value Coding Searches in an Array
|
||||
|
||||
+ (NSArray *)objectsFromArray:(NSArray *)sourceArray
|
||||
withValue:(id)desiredValue
|
||||
forKeyPath:(NSString *)keyPath {
|
||||
// Step through all entries, get the value from
|
||||
// the key path, and see if it's equal to the
|
||||
// desired value
|
||||
NSMutableArray *results = [NSMutableArray array];
|
||||
|
||||
for(id obj in sourceArray) {
|
||||
id val = [obj valueForKeyPath:keyPath];
|
||||
if (GTL_AreEqualOrBothNil(val, desiredValue)) {
|
||||
|
||||
// found a match; add it to the results array
|
||||
[results addObject:obj];
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
+ (id)firstObjectFromArray:(NSArray *)sourceArray
|
||||
withValue:(id)desiredValue
|
||||
forKeyPath:(NSString *)keyPath {
|
||||
for (id obj in sourceArray) {
|
||||
id val = [obj valueForKeyPath:keyPath];
|
||||
if (GTL_AreEqualOrBothNil(val, desiredValue)) {
|
||||
// found a match; return it
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark Version helpers
|
||||
|
||||
// compareVersion compares two strings in 1.2.3.4 format
|
||||
// missing fields are interpreted as zeros, so 1.2 = 1.2.0.0
|
||||
+ (NSComparisonResult)compareVersion:(NSString *)ver1 toVersion:(NSString *)ver2 {
|
||||
|
||||
static NSCharacterSet* dotSet = nil;
|
||||
if (dotSet == nil) {
|
||||
dotSet = [[NSCharacterSet characterSetWithCharactersInString:@"."] retain];
|
||||
}
|
||||
|
||||
if (ver1 == nil) ver1 = @"";
|
||||
if (ver2 == nil) ver2 = @"";
|
||||
|
||||
NSScanner* scanner1 = [NSScanner scannerWithString:ver1];
|
||||
NSScanner* scanner2 = [NSScanner scannerWithString:ver2];
|
||||
|
||||
[scanner1 setCharactersToBeSkipped:dotSet];
|
||||
[scanner2 setCharactersToBeSkipped:dotSet];
|
||||
|
||||
int partA1 = 0, partA2 = 0, partB1 = 0, partB2 = 0;
|
||||
int partC1 = 0, partC2 = 0, partD1 = 0, partD2 = 0;
|
||||
|
||||
if ([scanner1 scanInt:&partA1] && [scanner1 scanInt:&partB1]
|
||||
&& [scanner1 scanInt:&partC1] && [scanner1 scanInt:&partD1]) {
|
||||
}
|
||||
if ([scanner2 scanInt:&partA2] && [scanner2 scanInt:&partB2]
|
||||
&& [scanner2 scanInt:&partC2] && [scanner2 scanInt:&partD2]) {
|
||||
}
|
||||
|
||||
if (partA1 != partA2) return ((partA1 < partA2) ? NSOrderedAscending : NSOrderedDescending);
|
||||
if (partB1 != partB2) return ((partB1 < partB2) ? NSOrderedAscending : NSOrderedDescending);
|
||||
if (partC1 != partC2) return ((partC1 < partC2) ? NSOrderedAscending : NSOrderedDescending);
|
||||
if (partD1 != partD2) return ((partD1 < partD2) ? NSOrderedAscending : NSOrderedDescending);
|
||||
return NSOrderedSame;
|
||||
}
|
||||
|
||||
#pragma mark URL builder
|
||||
|
||||
+ (NSURL *)URLWithString:(NSString *)urlString
|
||||
queryParameters:(NSDictionary *)queryParameters {
|
||||
if ([urlString length] == 0) return nil;
|
||||
|
||||
NSString *fullURLString;
|
||||
if ([queryParameters count] > 0) {
|
||||
NSMutableArray *queryItems = [NSMutableArray arrayWithCapacity:[queryParameters count]];
|
||||
|
||||
// sort the custom parameter keys so that we have deterministic parameter
|
||||
// order for unit tests
|
||||
NSArray *queryKeys = [queryParameters allKeys];
|
||||
NSArray *sortedQueryKeys = [queryKeys sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
|
||||
|
||||
for (NSString *paramKey in sortedQueryKeys) {
|
||||
NSString *paramValue = [queryParameters valueForKey:paramKey];
|
||||
|
||||
NSString *paramItem = [NSString stringWithFormat:@"%@=%@",
|
||||
[self stringByURLEncodingStringParameter:paramKey],
|
||||
[self stringByURLEncodingStringParameter:paramValue]];
|
||||
|
||||
[queryItems addObject:paramItem];
|
||||
}
|
||||
|
||||
NSString *paramStr = [queryItems componentsJoinedByString:@"&"];
|
||||
|
||||
BOOL hasQMark = ([urlString rangeOfString:@"?"].location == NSNotFound);
|
||||
char joiner = hasQMark ? '?' : '&';
|
||||
fullURLString = [NSString stringWithFormat:@"%@%c%@",
|
||||
urlString, joiner, paramStr];
|
||||
} else {
|
||||
fullURLString = urlString;
|
||||
}
|
||||
NSURL *result = [NSURL URLWithString:fullURLString];
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma mark Collections
|
||||
|
||||
+ (NSMutableDictionary *)newStaticDictionary {
|
||||
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
|
||||
|
||||
// make the dictionary ineligible for garbage collection
|
||||
#if !GTL_IPHONE
|
||||
[[NSGarbageCollector defaultCollector] disableCollectorForPointer:dict];
|
||||
#endif
|
||||
return dict;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)mergedClassDictionaryForSelector:(SEL)selector
|
||||
startClass:(Class)startClass
|
||||
ancestorClass:(Class)ancestorClass
|
||||
cache:(NSMutableDictionary *)cache {
|
||||
NSDictionary *result;
|
||||
@synchronized(cache) {
|
||||
result = [cache objectForKey:startClass];
|
||||
if (result == nil) {
|
||||
// Collect the class's dictionary.
|
||||
NSDictionary *classDict = [startClass performSelector:selector];
|
||||
|
||||
// Collect the parent class's merged dictionary.
|
||||
NSDictionary *parentClassMergedDict;
|
||||
if ([startClass isEqual:ancestorClass]) {
|
||||
parentClassMergedDict = nil;
|
||||
} else {
|
||||
Class parentClass = class_getSuperclass(startClass);
|
||||
parentClassMergedDict =
|
||||
[GTLUtilities mergedClassDictionaryForSelector:selector
|
||||
startClass:parentClass
|
||||
ancestorClass:ancestorClass
|
||||
cache:cache];
|
||||
}
|
||||
|
||||
// Merge this class's into the parent's so things properly override.
|
||||
NSMutableDictionary *mergeDict;
|
||||
if (parentClassMergedDict != nil) {
|
||||
mergeDict =
|
||||
[NSMutableDictionary dictionaryWithDictionary:parentClassMergedDict];
|
||||
} else {
|
||||
mergeDict = [NSMutableDictionary dictionary];
|
||||
}
|
||||
if (classDict != nil) {
|
||||
[mergeDict addEntriesFromDictionary:classDict];
|
||||
}
|
||||
|
||||
// Make an immutable version.
|
||||
result = [NSDictionary dictionaryWithDictionary:mergeDict];
|
||||
|
||||
// Save it.
|
||||
[cache setObject:result forKey:(id<NSCopying>)startClass];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
// isEqual: has the fatal flaw that it doesn't deal well with the receiver
|
||||
// being nil. We'll use this utility instead.
|
||||
BOOL GTL_AreEqualOrBothNil(id obj1, id obj2) {
|
||||
if (obj1 == obj2) {
|
||||
return YES;
|
||||
}
|
||||
if (obj1 && obj2) {
|
||||
BOOL areEqual = [obj1 isEqual:obj2];
|
||||
return areEqual;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL GTL_AreBoolsEqual(BOOL b1, BOOL b2) {
|
||||
// avoid comparison problems with boolean types by negating
|
||||
// both booleans
|
||||
return (!b1 == !b2);
|
||||
}
|
||||
|
||||
NSNumber *GTL_EnsureNSNumber(NSNumber *num) {
|
||||
// If the server returned a string object where we expect a number, try
|
||||
// to make a number object.
|
||||
if ([num isKindOfClass:[NSString class]]) {
|
||||
NSNumber *newNum;
|
||||
NSString *str = (NSString *)num;
|
||||
if ([str rangeOfString:@"."].location != NSNotFound) {
|
||||
// This is a floating-point number.
|
||||
// Force the parser to use '.' as the decimal separator.
|
||||
static NSLocale *usLocale = nil;
|
||||
@synchronized([GTLUtilities class]) {
|
||||
if (usLocale == nil) {
|
||||
usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
|
||||
}
|
||||
newNum = [NSDecimalNumber decimalNumberWithString:(NSString*)num
|
||||
locale:(id)usLocale];
|
||||
}
|
||||
} else {
|
||||
// NSDecimalNumber +decimalNumberWithString:locale:
|
||||
// does not correctly create an NSNumber for large values like
|
||||
// 71100000000007780.
|
||||
if ([str hasPrefix:@"-"]) {
|
||||
newNum = [NSNumber numberWithLongLong:[str longLongValue]];
|
||||
} else {
|
||||
const char *utf8 = [str UTF8String];
|
||||
unsigned long long ull = strtoull(utf8, NULL, 10);
|
||||
newNum = [NSNumber numberWithUnsignedLongLong:ull];
|
||||
}
|
||||
}
|
||||
if (newNum) {
|
||||
num = newNum;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
441
iphone/Maps/GooglePlusSDK/OpenSource/GTMDefines.h
Normal file
441
iphone/Maps/GooglePlusSDK/OpenSource/GTMDefines.h
Normal 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__
|
72
iphone/Maps/GooglePlusSDK/OpenSource/GTMGarbageCollection.h
Normal file
72
iphone/Maps/GooglePlusSDK/OpenSource/GTMGarbageCollection.h
Normal 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])
|
||||
|
187
iphone/Maps/GooglePlusSDK/OpenSource/GTMHTTPFetchHistory.h
Normal file
187
iphone/Maps/GooglePlusSDK/OpenSource/GTMHTTPFetchHistory.h
Normal 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
|
605
iphone/Maps/GooglePlusSDK/OpenSource/GTMHTTPFetchHistory.m
Normal file
605
iphone/Maps/GooglePlusSDK/OpenSource/GTMHTTPFetchHistory.m
Normal file
|
@ -0,0 +1,605 @@
|
|||
/* 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.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTMHTTPFetchHistory.m
|
||||
//
|
||||
|
||||
#define GTMHTTPFETCHHISTORY_DEFINE_GLOBALS 1
|
||||
|
||||
#import "GTMHTTPFetchHistory.h"
|
||||
|
||||
const NSTimeInterval kCachedURLReservationInterval = 60.0; // 1 minute
|
||||
static NSString* const kGTMIfNoneMatchHeader = @"If-None-Match";
|
||||
static NSString* const kGTMETagHeader = @"Etag";
|
||||
|
||||
@implementation GTMCookieStorage
|
||||
|
||||
- (id)init {
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
cookies_ = [[NSMutableArray alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[cookies_ release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
// Add all cookies in the new cookie array to the storage,
|
||||
// replacing stored cookies as appropriate.
|
||||
//
|
||||
// Side effect: removes expired cookies from the storage array.
|
||||
- (void)setCookies:(NSArray *)newCookies {
|
||||
|
||||
@synchronized(cookies_) {
|
||||
[self removeExpiredCookies];
|
||||
|
||||
for (NSHTTPCookie *newCookie in newCookies) {
|
||||
if ([[newCookie name] length] > 0
|
||||
&& [[newCookie domain] length] > 0
|
||||
&& [[newCookie path] length] > 0) {
|
||||
|
||||
// remove the cookie if it's currently in the array
|
||||
NSHTTPCookie *oldCookie = [self cookieMatchingCookie:newCookie];
|
||||
if (oldCookie) {
|
||||
[cookies_ removeObjectIdenticalTo:oldCookie];
|
||||
}
|
||||
|
||||
// make sure the cookie hasn't already expired
|
||||
NSDate *expiresDate = [newCookie expiresDate];
|
||||
if ((!expiresDate) || [expiresDate timeIntervalSinceNow] > 0) {
|
||||
[cookies_ addObject:newCookie];
|
||||
}
|
||||
|
||||
} else {
|
||||
NSAssert1(NO, @"Cookie incomplete: %@", newCookie);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)deleteCookie:(NSHTTPCookie *)cookie {
|
||||
@synchronized(cookies_) {
|
||||
NSHTTPCookie *foundCookie = [self cookieMatchingCookie:cookie];
|
||||
if (foundCookie) {
|
||||
[cookies_ removeObjectIdenticalTo:foundCookie];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieve all cookies appropriate for the given URL, considering
|
||||
// domain, path, cookie name, expiration, security setting.
|
||||
// Side effect: removed expired cookies from the storage array.
|
||||
- (NSArray *)cookiesForURL:(NSURL *)theURL {
|
||||
|
||||
NSMutableArray *foundCookies = nil;
|
||||
|
||||
@synchronized(cookies_) {
|
||||
[self removeExpiredCookies];
|
||||
|
||||
// We'll prepend "." to the desired domain, since we want the
|
||||
// actual domain "nytimes.com" to still match the cookie domain
|
||||
// ".nytimes.com" when we check it below with hasSuffix.
|
||||
NSString *host = [[theURL host] lowercaseString];
|
||||
NSString *path = [theURL path];
|
||||
NSString *scheme = [theURL scheme];
|
||||
|
||||
NSString *domain = nil;
|
||||
BOOL isLocalhostRetrieval = NO;
|
||||
|
||||
if ([host isEqual:@"localhost"]) {
|
||||
isLocalhostRetrieval = YES;
|
||||
} else {
|
||||
if (host) {
|
||||
domain = [@"." stringByAppendingString:host];
|
||||
}
|
||||
}
|
||||
|
||||
NSUInteger numberOfCookies = [cookies_ count];
|
||||
for (NSUInteger idx = 0; idx < numberOfCookies; idx++) {
|
||||
|
||||
NSHTTPCookie *storedCookie = [cookies_ objectAtIndex:idx];
|
||||
|
||||
NSString *cookieDomain = [[storedCookie domain] lowercaseString];
|
||||
NSString *cookiePath = [storedCookie path];
|
||||
BOOL cookieIsSecure = [storedCookie isSecure];
|
||||
|
||||
BOOL isDomainOK;
|
||||
|
||||
if (isLocalhostRetrieval) {
|
||||
// prior to 10.5.6, the domain stored into NSHTTPCookies for localhost
|
||||
// is "localhost.local"
|
||||
isDomainOK = [cookieDomain isEqual:@"localhost"]
|
||||
|| [cookieDomain isEqual:@"localhost.local"];
|
||||
} else {
|
||||
isDomainOK = [domain hasSuffix:cookieDomain];
|
||||
}
|
||||
|
||||
BOOL isPathOK = [cookiePath isEqual:@"/"] || [path hasPrefix:cookiePath];
|
||||
BOOL isSecureOK = (!cookieIsSecure) || [scheme isEqual:@"https"];
|
||||
|
||||
if (isDomainOK && isPathOK && isSecureOK) {
|
||||
if (foundCookies == nil) {
|
||||
foundCookies = [NSMutableArray arrayWithCapacity:1];
|
||||
}
|
||||
[foundCookies addObject:storedCookie];
|
||||
}
|
||||
}
|
||||
}
|
||||
return foundCookies;
|
||||
}
|
||||
|
||||
// Return a cookie from the array 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 cookies in the storage array should
|
||||
// be valid (non-nil name, domains, paths).
|
||||
//
|
||||
// Note: this should only be called from inside a @synchronized(cookies_) block
|
||||
- (NSHTTPCookie *)cookieMatchingCookie:(NSHTTPCookie *)cookie {
|
||||
|
||||
NSUInteger numberOfCookies = [cookies_ count];
|
||||
NSString *name = [cookie name];
|
||||
NSString *domain = [cookie domain];
|
||||
NSString *path = [cookie path];
|
||||
|
||||
NSAssert3(name && domain && path, @"Invalid cookie (name:%@ domain:%@ path:%@)",
|
||||
name, domain, path);
|
||||
|
||||
for (NSUInteger idx = 0; idx < numberOfCookies; idx++) {
|
||||
|
||||
NSHTTPCookie *storedCookie = [cookies_ objectAtIndex:idx];
|
||||
|
||||
if ([[storedCookie name] isEqual:name]
|
||||
&& [[storedCookie domain] isEqual:domain]
|
||||
&& [[storedCookie path] isEqual:path]) {
|
||||
|
||||
return storedCookie;
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
// Internal routine to remove any expired cookies from the array, excluding
|
||||
// cookies with nil expirations.
|
||||
//
|
||||
// Note: this should only be called from inside a @synchronized(cookies_) block
|
||||
- (void)removeExpiredCookies {
|
||||
|
||||
// count backwards since we're deleting items from the array
|
||||
for (NSInteger idx = (NSInteger)[cookies_ count] - 1; idx >= 0; idx--) {
|
||||
|
||||
NSHTTPCookie *storedCookie = [cookies_ objectAtIndex:(NSUInteger)idx];
|
||||
|
||||
NSDate *expiresDate = [storedCookie expiresDate];
|
||||
if (expiresDate && [expiresDate timeIntervalSinceNow] < 0) {
|
||||
[cookies_ removeObjectAtIndex:(NSUInteger)idx];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeAllCookies {
|
||||
@synchronized(cookies_) {
|
||||
[cookies_ removeAllObjects];
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
||||
//
|
||||
// GTMCachedURLResponse
|
||||
//
|
||||
|
||||
@implementation GTMCachedURLResponse
|
||||
|
||||
@synthesize response = response_;
|
||||
@synthesize data = data_;
|
||||
@synthesize reservationDate = reservationDate_;
|
||||
@synthesize useDate = useDate_;
|
||||
|
||||
- (id)initWithResponse:(NSURLResponse *)response data:(NSData *)data {
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
response_ = [response retain];
|
||||
data_ = [data retain];
|
||||
useDate_ = [[NSDate alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[response_ release];
|
||||
[data_ release];
|
||||
[useDate_ release];
|
||||
[reservationDate_ release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
NSString *reservationStr = reservationDate_ ?
|
||||
[NSString stringWithFormat:@" resDate:%@", reservationDate_] : @"";
|
||||
|
||||
return [NSString stringWithFormat:@"%@ %p: {bytes:%@ useDate:%@%@}",
|
||||
[self class], self,
|
||||
data_ ? [NSNumber numberWithInt:(int)[data_ length]] : nil,
|
||||
useDate_,
|
||||
reservationStr];
|
||||
}
|
||||
|
||||
- (NSComparisonResult)compareUseDate:(GTMCachedURLResponse *)other {
|
||||
return [useDate_ compare:[other useDate]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
//
|
||||
// GTMURLCache
|
||||
//
|
||||
|
||||
@implementation GTMURLCache
|
||||
|
||||
@dynamic memoryCapacity;
|
||||
|
||||
- (id)init {
|
||||
return [self initWithMemoryCapacity:kGTMDefaultETaggedDataCacheMemoryCapacity];
|
||||
}
|
||||
|
||||
- (id)initWithMemoryCapacity:(NSUInteger)totalBytes {
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
memoryCapacity_ = totalBytes;
|
||||
|
||||
responses_ = [[NSMutableDictionary alloc] initWithCapacity:5];
|
||||
|
||||
reservationInterval_ = kCachedURLReservationInterval;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[responses_ release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
return [NSString stringWithFormat:@"%@ %p: {responses:%@}",
|
||||
[self class], self, [responses_ allValues]];
|
||||
}
|
||||
|
||||
// Setters/getters
|
||||
|
||||
- (void)pruneCacheResponses {
|
||||
// Internal routine to remove the least-recently-used responses when the
|
||||
// cache has grown too large
|
||||
if (memoryCapacity_ >= totalDataSize_) return;
|
||||
|
||||
// Sort keys by date
|
||||
SEL sel = @selector(compareUseDate:);
|
||||
NSArray *sortedKeys = [responses_ keysSortedByValueUsingSelector:sel];
|
||||
|
||||
// The least-recently-used keys are at the beginning of the sorted array;
|
||||
// remove those (except ones still reserved) until the total data size is
|
||||
// reduced sufficiently
|
||||
for (NSURL *key in sortedKeys) {
|
||||
GTMCachedURLResponse *response = [responses_ objectForKey:key];
|
||||
|
||||
NSDate *resDate = [response reservationDate];
|
||||
BOOL isResponseReserved = (resDate != nil)
|
||||
&& ([resDate timeIntervalSinceNow] > -reservationInterval_);
|
||||
|
||||
if (!isResponseReserved) {
|
||||
// We can remove this response from the cache
|
||||
NSUInteger storedSize = [[response data] length];
|
||||
totalDataSize_ -= storedSize;
|
||||
[responses_ removeObjectForKey:key];
|
||||
}
|
||||
|
||||
// If we've removed enough response data, then we're done
|
||||
if (memoryCapacity_ >= totalDataSize_) break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)storeCachedResponse:(GTMCachedURLResponse *)cachedResponse
|
||||
forRequest:(NSURLRequest *)request {
|
||||
@synchronized(self) {
|
||||
// Remove any previous entry for this request
|
||||
[self removeCachedResponseForRequest:request];
|
||||
|
||||
// cache this one only if it's not bigger than our cache
|
||||
NSUInteger storedSize = [[cachedResponse data] length];
|
||||
if (storedSize < memoryCapacity_) {
|
||||
|
||||
NSURL *key = [request URL];
|
||||
[responses_ setObject:cachedResponse forKey:key];
|
||||
totalDataSize_ += storedSize;
|
||||
|
||||
[self pruneCacheResponses];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (GTMCachedURLResponse *)cachedResponseForRequest:(NSURLRequest *)request {
|
||||
GTMCachedURLResponse *response;
|
||||
|
||||
@synchronized(self) {
|
||||
NSURL *key = [request URL];
|
||||
response = [[[responses_ objectForKey:key] retain] autorelease];
|
||||
|
||||
// Touch the date to indicate this was recently retrieved
|
||||
[response setUseDate:[NSDate date]];
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
- (void)removeCachedResponseForRequest:(NSURLRequest *)request {
|
||||
@synchronized(self) {
|
||||
NSURL *key = [request URL];
|
||||
totalDataSize_ -= [[[responses_ objectForKey:key] data] length];
|
||||
[responses_ removeObjectForKey:key];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeAllCachedResponses {
|
||||
@synchronized(self) {
|
||||
[responses_ removeAllObjects];
|
||||
totalDataSize_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSUInteger)memoryCapacity {
|
||||
return memoryCapacity_;
|
||||
}
|
||||
|
||||
- (void)setMemoryCapacity:(NSUInteger)totalBytes {
|
||||
@synchronized(self) {
|
||||
BOOL didShrink = (totalBytes < memoryCapacity_);
|
||||
memoryCapacity_ = totalBytes;
|
||||
|
||||
if (didShrink) {
|
||||
[self pruneCacheResponses];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Methods for unit testing.
|
||||
- (void)setReservationInterval:(NSTimeInterval)secs {
|
||||
reservationInterval_ = secs;
|
||||
}
|
||||
|
||||
- (NSDictionary *)responses {
|
||||
return responses_;
|
||||
}
|
||||
|
||||
- (NSUInteger)totalDataSize {
|
||||
return totalDataSize_;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
//
|
||||
// GTMHTTPFetchHistory
|
||||
//
|
||||
|
||||
@interface GTMHTTPFetchHistory ()
|
||||
- (NSString *)cachedETagForRequest:(NSURLRequest *)request;
|
||||
- (void)removeCachedDataForRequest:(NSURLRequest *)request;
|
||||
@end
|
||||
|
||||
@implementation GTMHTTPFetchHistory
|
||||
|
||||
@synthesize cookieStorage = cookieStorage_;
|
||||
|
||||
@dynamic shouldRememberETags;
|
||||
@dynamic shouldCacheETaggedData;
|
||||
@dynamic memoryCapacity;
|
||||
|
||||
- (id)init {
|
||||
return [self initWithMemoryCapacity:kGTMDefaultETaggedDataCacheMemoryCapacity
|
||||
shouldCacheETaggedData:NO];
|
||||
}
|
||||
|
||||
- (id)initWithMemoryCapacity:(NSUInteger)totalBytes
|
||||
shouldCacheETaggedData:(BOOL)shouldCacheETaggedData {
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
etaggedDataCache_ = [[GTMURLCache alloc] initWithMemoryCapacity:totalBytes];
|
||||
shouldRememberETags_ = shouldCacheETaggedData;
|
||||
shouldCacheETaggedData_ = shouldCacheETaggedData;
|
||||
cookieStorage_ = [[GTMCookieStorage alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[etaggedDataCache_ release];
|
||||
[cookieStorage_ release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)updateRequest:(NSMutableURLRequest *)request isHTTPGet:(BOOL)isHTTPGet {
|
||||
@synchronized(self) {
|
||||
if ([self shouldRememberETags]) {
|
||||
// If this URL is in the history, and no ETag has been set, then
|
||||
// set the ETag header field
|
||||
|
||||
// If we have a history, we're tracking across fetches, so we don't
|
||||
// want to pull results from any other cache
|
||||
[request setCachePolicy:NSURLRequestReloadIgnoringCacheData];
|
||||
|
||||
if (isHTTPGet) {
|
||||
// We'll only add an ETag if there's no ETag specified in the user's
|
||||
// request
|
||||
NSString *specifiedETag = [request valueForHTTPHeaderField:kGTMIfNoneMatchHeader];
|
||||
if (specifiedETag == nil) {
|
||||
// No ETag: extract the previous ETag for this request from the
|
||||
// fetch history, and add it to the request
|
||||
NSString *cachedETag = [self cachedETagForRequest:request];
|
||||
|
||||
if (cachedETag != nil) {
|
||||
[request addValue:cachedETag forHTTPHeaderField:kGTMIfNoneMatchHeader];
|
||||
}
|
||||
} else {
|
||||
// Has an ETag: remove any stored response in the fetch history
|
||||
// for this request, as the If-None-Match header could lead to
|
||||
// a 304 Not Modified, and we want that error delivered to the
|
||||
// user since they explicitly specified the ETag
|
||||
[self removeCachedDataForRequest:request];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateFetchHistoryWithRequest:(NSURLRequest *)request
|
||||
response:(NSURLResponse *)response
|
||||
downloadedData:(NSData *)downloadedData {
|
||||
@synchronized(self) {
|
||||
if (![self shouldRememberETags]) return;
|
||||
|
||||
if (![response respondsToSelector:@selector(allHeaderFields)]) return;
|
||||
|
||||
NSInteger statusCode = [(NSHTTPURLResponse *)response statusCode];
|
||||
|
||||
if (statusCode != kGTMHTTPFetcherStatusNotModified) {
|
||||
// Save this ETag string for successful results (<300)
|
||||
// If there's no last modified string, clear the dictionary
|
||||
// entry for this URL. Also cache or delete the data, if appropriate
|
||||
// (when etaggedDataCache is non-nil.)
|
||||
NSDictionary *headers = [(NSHTTPURLResponse *)response allHeaderFields];
|
||||
NSString* etag = [headers objectForKey:kGTMETagHeader];
|
||||
|
||||
if (etag != nil && statusCode < 300) {
|
||||
|
||||
// we want to cache responses for the headers, even if the client
|
||||
// doesn't want the response body data caches
|
||||
NSData *dataToStore = shouldCacheETaggedData_ ? downloadedData : nil;
|
||||
|
||||
GTMCachedURLResponse *cachedResponse;
|
||||
cachedResponse = [[[GTMCachedURLResponse alloc] initWithResponse:response
|
||||
data:dataToStore] autorelease];
|
||||
[etaggedDataCache_ storeCachedResponse:cachedResponse
|
||||
forRequest:request];
|
||||
} else {
|
||||
[etaggedDataCache_ removeCachedResponseForRequest:request];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)cachedETagForRequest:(NSURLRequest *)request {
|
||||
// Internal routine.
|
||||
GTMCachedURLResponse *cachedResponse;
|
||||
cachedResponse = [etaggedDataCache_ cachedResponseForRequest:request];
|
||||
|
||||
NSURLResponse *response = [cachedResponse response];
|
||||
NSDictionary *headers = [(NSHTTPURLResponse *)response allHeaderFields];
|
||||
NSString *cachedETag = [headers objectForKey:kGTMETagHeader];
|
||||
if (cachedETag) {
|
||||
// Since the request having an ETag implies this request is about
|
||||
// to be fetched again, reserve the cached response to ensure that
|
||||
// that it will be around at least until the fetch completes.
|
||||
//
|
||||
// When the fetch completes, either the cached response will be replaced
|
||||
// with a new response, or the cachedDataForRequest: method below will
|
||||
// clear the reservation.
|
||||
[cachedResponse setReservationDate:[NSDate date]];
|
||||
}
|
||||
return cachedETag;
|
||||
}
|
||||
|
||||
- (NSData *)cachedDataForRequest:(NSURLRequest *)request {
|
||||
@synchronized(self) {
|
||||
GTMCachedURLResponse *cachedResponse;
|
||||
cachedResponse = [etaggedDataCache_ cachedResponseForRequest:request];
|
||||
|
||||
NSData *cachedData = [cachedResponse data];
|
||||
|
||||
// Since the data for this cached request is being obtained from the cache,
|
||||
// we can clear the reservation as the fetch has completed.
|
||||
[cachedResponse setReservationDate:nil];
|
||||
|
||||
return cachedData;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeCachedDataForRequest:(NSURLRequest *)request {
|
||||
@synchronized(self) {
|
||||
[etaggedDataCache_ removeCachedResponseForRequest:request];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)clearETaggedDataCache {
|
||||
@synchronized(self) {
|
||||
[etaggedDataCache_ removeAllCachedResponses];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)clearHistory {
|
||||
@synchronized(self) {
|
||||
[self clearETaggedDataCache];
|
||||
[cookieStorage_ removeAllCookies];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeAllCookies {
|
||||
@synchronized(self) {
|
||||
[cookieStorage_ removeAllCookies];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)shouldRememberETags {
|
||||
return shouldRememberETags_;
|
||||
}
|
||||
|
||||
- (void)setShouldRememberETags:(BOOL)flag {
|
||||
BOOL wasRemembering = shouldRememberETags_;
|
||||
shouldRememberETags_ = flag;
|
||||
|
||||
if (wasRemembering && !flag) {
|
||||
// Free up the cache memory
|
||||
[self clearETaggedDataCache];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)shouldCacheETaggedData {
|
||||
return shouldCacheETaggedData_;
|
||||
}
|
||||
|
||||
- (void)setShouldCacheETaggedData:(BOOL)flag {
|
||||
BOOL wasCaching = shouldCacheETaggedData_;
|
||||
shouldCacheETaggedData_ = flag;
|
||||
|
||||
if (flag) {
|
||||
self.shouldRememberETags = YES;
|
||||
}
|
||||
|
||||
if (wasCaching && !flag) {
|
||||
// users expect turning off caching to free up the cache memory
|
||||
[self clearETaggedDataCache];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSUInteger)memoryCapacity {
|
||||
return [etaggedDataCache_ memoryCapacity];
|
||||
}
|
||||
|
||||
- (void)setMemoryCapacity:(NSUInteger)totalBytes {
|
||||
[etaggedDataCache_ setMemoryCapacity:totalBytes];
|
||||
}
|
||||
|
||||
@end
|
748
iphone/Maps/GooglePlusSDK/OpenSource/GTMHTTPFetcher.h
Normal file
748
iphone/Maps/GooglePlusSDK/OpenSource/GTMHTTPFetcher.h
Normal file
|
@ -0,0 +1,748 @@
|
|||
/* 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:
|
||||
//
|
||||
// fetcher.delegateQueue = [[[NSOperationQueue alloc] init] autorelease];
|
||||
//
|
||||
// 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;
|
||||
|
||||
- (NSString *)userEmail;
|
||||
|
||||
@optional
|
||||
@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
|
1935
iphone/Maps/GooglePlusSDK/OpenSource/GTMHTTPFetcher.m
Normal file
1935
iphone/Maps/GooglePlusSDK/OpenSource/GTMHTTPFetcher.m
Normal file
File diff suppressed because it is too large
Load diff
98
iphone/Maps/GooglePlusSDK/OpenSource/GTMHTTPFetcherLogging.h
Normal file
98
iphone/Maps/GooglePlusSDK/OpenSource/GTMHTTPFetcherLogging.h
Normal file
|
@ -0,0 +1,98 @@
|
|||
/* 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.
|
||||
*/
|
||||
|
||||
#import "GTMHTTPFetcher.h"
|
||||
|
||||
// GTM HTTP Logging
|
||||
//
|
||||
// All traffic using GTMHTTPFetcher can be easily logged. Call
|
||||
//
|
||||
// [GTMHTTPFetcher setLoggingEnabled:YES];
|
||||
//
|
||||
// to begin generating log files.
|
||||
//
|
||||
// Log files are put into a folder on the desktop called "GTMHTTPDebugLogs"
|
||||
// unless another directory is specified with +setLoggingDirectory.
|
||||
//
|
||||
// In the iPhone simulator, the default logs location is the user's home
|
||||
// directory in ~/Library/Application Support. On the iPhone device, the
|
||||
// default logs location is the application's documents directory on the device.
|
||||
//
|
||||
// Tip: use the Finder's "Sort By Date" to find the most recent logs.
|
||||
//
|
||||
// Each run of an application gets a separate set of log files. An html
|
||||
// file is generated to simplify browsing the run's http transactions.
|
||||
// The html file includes javascript links for inline viewing of uploaded
|
||||
// and downloaded data.
|
||||
//
|
||||
// A symlink is created in the logs folder to simplify finding the html file
|
||||
// for the latest run of the application; the symlink is called
|
||||
//
|
||||
// AppName_http_log_newest.html
|
||||
//
|
||||
// For better viewing of XML logs, use Camino or Firefox rather than Safari.
|
||||
//
|
||||
// Each fetcher may be given a comment to be inserted as a label in the logs,
|
||||
// such as
|
||||
// [fetcher setCommentWithFormat:@"retrieve item %@", itemName];
|
||||
//
|
||||
// Projects may define STRIP_GTM_FETCH_LOGGING to remove logging code.
|
||||
|
||||
#if !STRIP_GTM_FETCH_LOGGING
|
||||
|
||||
@interface GTMHTTPFetcher (GTMHTTPFetcherLogging)
|
||||
|
||||
// Note: the default logs directory is ~/Desktop/GTMHTTPDebugLogs; it will be
|
||||
// created as needed. If a custom directory is set, the directory should
|
||||
// already exist.
|
||||
+ (void)setLoggingDirectory:(NSString *)path;
|
||||
+ (NSString *)loggingDirectory;
|
||||
|
||||
// client apps can turn logging on and off
|
||||
+ (void)setLoggingEnabled:(BOOL)flag;
|
||||
+ (BOOL)isLoggingEnabled;
|
||||
|
||||
// client apps can turn off logging to a file if they want to only check
|
||||
// the fetcher's log property
|
||||
+ (void)setLoggingToFileEnabled:(BOOL)flag;
|
||||
+ (BOOL)isLoggingToFileEnabled;
|
||||
|
||||
// client apps can optionally specify process name and date string used in
|
||||
// log file names
|
||||
+ (void)setLoggingProcessName:(NSString *)str;
|
||||
+ (NSString *)loggingProcessName;
|
||||
|
||||
+ (void)setLoggingDateStamp:(NSString *)str;
|
||||
+ (NSString *)loggingDateStamp;
|
||||
|
||||
// internal; called by fetcher
|
||||
- (void)logFetchWithError:(NSError *)error;
|
||||
- (BOOL)logCapturePostStream;
|
||||
|
||||
// Applications may provide alternative body strings to be displayed in the
|
||||
// log, such as for binary requests or responses. If deferring is turned
|
||||
// on, the response log will not be sent until deferring is turned off,
|
||||
// allowing the application to write the response body after the response
|
||||
// data has been parsed.
|
||||
- (void)setLogRequestBody:(NSString *)bodyString;
|
||||
- (NSString *)logRequestBody;
|
||||
- (void)setLogResponseBody:(NSString *)bodyString;
|
||||
- (NSString *)logResponseBody;
|
||||
- (void)setShouldDeferResponseBodyLogging:(BOOL)flag;
|
||||
- (BOOL)shouldDeferResponseBodyLogging;
|
||||
|
||||
@end
|
||||
|
||||
#endif // !STRIP_GTM_FETCH_LOGGING
|
1101
iphone/Maps/GooglePlusSDK/OpenSource/GTMHTTPFetcherLogging.m
Normal file
1101
iphone/Maps/GooglePlusSDK/OpenSource/GTMHTTPFetcherLogging.m
Normal file
File diff suppressed because it is too large
Load diff
125
iphone/Maps/GooglePlusSDK/OpenSource/GTMHTTPFetcherService.h
Normal file
125
iphone/Maps/GooglePlusSDK/OpenSource/GTMHTTPFetcherService.h
Normal 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
|
490
iphone/Maps/GooglePlusSDK/OpenSource/GTMHTTPFetcherService.m
Normal file
490
iphone/Maps/GooglePlusSDK/OpenSource/GTMHTTPFetcherService.m
Normal file
|
@ -0,0 +1,490 @@
|
|||
/* 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.m
|
||||
//
|
||||
|
||||
#import "GTMHTTPFetcherService.h"
|
||||
|
||||
@interface GTMHTTPFetcher (ServiceMethods)
|
||||
- (BOOL)beginFetchMayDelay:(BOOL)mayDelay
|
||||
mayAuthorize:(BOOL)mayAuthorize;
|
||||
@end
|
||||
|
||||
@interface GTMHTTPFetcherService ()
|
||||
@property (retain, readwrite) NSDictionary *delayedHosts;
|
||||
@property (retain, readwrite) NSDictionary *runningHosts;
|
||||
|
||||
- (void)detachAuthorizer;
|
||||
@end
|
||||
|
||||
@implementation GTMHTTPFetcherService
|
||||
|
||||
@synthesize maxRunningFetchersPerHost = maxRunningFetchersPerHost_,
|
||||
userAgent = userAgent_,
|
||||
timeout = timeout_,
|
||||
delegateQueue = delegateQueue_,
|
||||
runLoopModes = runLoopModes_,
|
||||
credential = credential_,
|
||||
proxyCredential = proxyCredential_,
|
||||
cookieStorageMethod = cookieStorageMethod_,
|
||||
shouldFetchInBackground = shouldFetchInBackground_,
|
||||
fetchHistory = fetchHistory_;
|
||||
|
||||
- (id)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
fetchHistory_ = [[GTMHTTPFetchHistory alloc] init];
|
||||
delayedHosts_ = [[NSMutableDictionary alloc] init];
|
||||
runningHosts_ = [[NSMutableDictionary alloc] init];
|
||||
cookieStorageMethod_ = kGTMHTTPFetcherCookieStorageMethodFetchHistory;
|
||||
|
||||
maxRunningFetchersPerHost_ = 10;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[self detachAuthorizer];
|
||||
|
||||
[delayedHosts_ release];
|
||||
[runningHosts_ release];
|
||||
[fetchHistory_ release];
|
||||
[userAgent_ release];
|
||||
[delegateQueue_ release];
|
||||
[runLoopModes_ release];
|
||||
[credential_ release];
|
||||
[proxyCredential_ release];
|
||||
[authorizer_ release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
#pragma mark Generate a new fetcher
|
||||
|
||||
- (id)fetcherWithRequest:(NSURLRequest *)request
|
||||
fetcherClass:(Class)fetcherClass {
|
||||
GTMHTTPFetcher *fetcher = [fetcherClass fetcherWithRequest:request];
|
||||
|
||||
fetcher.fetchHistory = self.fetchHistory;
|
||||
fetcher.delegateQueue = self.delegateQueue;
|
||||
fetcher.runLoopModes = self.runLoopModes;
|
||||
fetcher.cookieStorageMethod = self.cookieStorageMethod;
|
||||
fetcher.credential = self.credential;
|
||||
fetcher.proxyCredential = self.proxyCredential;
|
||||
fetcher.shouldFetchInBackground = self.shouldFetchInBackground;
|
||||
fetcher.authorizer = self.authorizer;
|
||||
fetcher.service = self;
|
||||
|
||||
NSString *userAgent = self.userAgent;
|
||||
if ([userAgent length] > 0
|
||||
&& [request valueForHTTPHeaderField:@"User-Agent"] == nil) {
|
||||
[fetcher.mutableRequest setValue:userAgent
|
||||
forHTTPHeaderField:@"User-Agent"];
|
||||
}
|
||||
|
||||
NSTimeInterval timeout = self.timeout;
|
||||
if (timeout > 0.0) {
|
||||
[fetcher.mutableRequest setTimeoutInterval:timeout];
|
||||
}
|
||||
|
||||
return fetcher;
|
||||
}
|
||||
|
||||
- (GTMHTTPFetcher *)fetcherWithRequest:(NSURLRequest *)request {
|
||||
return [self fetcherWithRequest:request
|
||||
fetcherClass:[GTMHTTPFetcher class]];
|
||||
}
|
||||
|
||||
- (GTMHTTPFetcher *)fetcherWithURL:(NSURL *)requestURL {
|
||||
return [self fetcherWithRequest:[NSURLRequest requestWithURL:requestURL]];
|
||||
}
|
||||
|
||||
- (GTMHTTPFetcher *)fetcherWithURLString:(NSString *)requestURLString {
|
||||
return [self fetcherWithURL:[NSURL URLWithString:requestURLString]];
|
||||
}
|
||||
|
||||
#pragma mark Queue Management
|
||||
|
||||
- (void)addRunningFetcher:(GTMHTTPFetcher *)fetcher
|
||||
forHost:(NSString *)host {
|
||||
// Add to the array of running fetchers for this host, creating the array
|
||||
// if needed
|
||||
NSMutableArray *runningForHost = [runningHosts_ objectForKey:host];
|
||||
if (runningForHost == nil) {
|
||||
runningForHost = [NSMutableArray arrayWithObject:fetcher];
|
||||
[runningHosts_ setObject:runningForHost forKey:host];
|
||||
} else {
|
||||
[runningForHost addObject:fetcher];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)addDelayedFetcher:(GTMHTTPFetcher *)fetcher
|
||||
forHost:(NSString *)host {
|
||||
// Add to the array of delayed fetchers for this host, creating the array
|
||||
// if needed
|
||||
NSMutableArray *delayedForHost = [delayedHosts_ objectForKey:host];
|
||||
if (delayedForHost == nil) {
|
||||
delayedForHost = [NSMutableArray arrayWithObject:fetcher];
|
||||
[delayedHosts_ setObject:delayedForHost forKey:host];
|
||||
} else {
|
||||
[delayedForHost addObject:fetcher];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)isDelayingFetcher:(GTMHTTPFetcher *)fetcher {
|
||||
@synchronized(self) {
|
||||
NSString *host = [[[fetcher mutableRequest] URL] host];
|
||||
NSArray *delayedForHost = [delayedHosts_ objectForKey:host];
|
||||
NSUInteger idx = [delayedForHost indexOfObjectIdenticalTo:fetcher];
|
||||
BOOL isDelayed = (delayedForHost != nil) && (idx != NSNotFound);
|
||||
return isDelayed;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)fetcherShouldBeginFetching:(GTMHTTPFetcher *)fetcher {
|
||||
// Entry point from the fetcher
|
||||
@synchronized(self) {
|
||||
NSString *host = [[[fetcher mutableRequest] URL] host];
|
||||
|
||||
if ([host length] == 0) {
|
||||
#if DEBUG
|
||||
NSAssert1(0, @"%@ lacks host", fetcher);
|
||||
#endif
|
||||
return YES;
|
||||
}
|
||||
|
||||
NSMutableArray *runningForHost = [runningHosts_ objectForKey:host];
|
||||
if (runningForHost != nil
|
||||
&& [runningForHost indexOfObjectIdenticalTo:fetcher] != NSNotFound) {
|
||||
#if DEBUG
|
||||
NSAssert1(0, @"%@ was already running", fetcher);
|
||||
#endif
|
||||
return YES;
|
||||
}
|
||||
|
||||
// We'll save the host that serves as the key for this fetcher's array
|
||||
// to avoid any chance of the underlying request changing, stranding
|
||||
// the fetcher in the wrong array
|
||||
fetcher.serviceHost = host;
|
||||
fetcher.thread = [NSThread currentThread];
|
||||
|
||||
if (maxRunningFetchersPerHost_ == 0
|
||||
|| maxRunningFetchersPerHost_ > [runningForHost count]) {
|
||||
[self addRunningFetcher:fetcher forHost:host];
|
||||
return YES;
|
||||
} else {
|
||||
[self addDelayedFetcher:fetcher forHost:host];
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
// Fetcher start and stop methods, invoked on the appropriate thread for
|
||||
// the fetcher
|
||||
- (void)performSelector:(SEL)sel onStartThreadForFetcher:(GTMHTTPFetcher *)fetcher {
|
||||
NSOperationQueue *delegateQueue = fetcher.delegateQueue;
|
||||
NSThread *thread = fetcher.thread;
|
||||
if (delegateQueue != nil || [thread isEqual:[NSThread currentThread]]) {
|
||||
// The fetcher should run on the thread we're on now, or there's a delegate
|
||||
// queue specified so it doesn't matter what thread the fetcher is started
|
||||
// on, since it will call back on the queue.
|
||||
[self performSelector:sel withObject:fetcher];
|
||||
} else {
|
||||
// Fetcher must run on a specified thread (and that thread must have a
|
||||
// run loop.)
|
||||
[self performSelector:sel
|
||||
onThread:thread
|
||||
withObject:fetcher
|
||||
waitUntilDone:NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)startFetcherOnCurrentThread:(GTMHTTPFetcher *)fetcher {
|
||||
[fetcher beginFetchMayDelay:NO
|
||||
mayAuthorize:YES];
|
||||
}
|
||||
|
||||
- (void)startFetcher:(GTMHTTPFetcher *)fetcher {
|
||||
[self performSelector:@selector(startFetcherOnCurrentThread:)
|
||||
onStartThreadForFetcher:fetcher];
|
||||
}
|
||||
|
||||
- (void)stopFetcherOnCurrentThread:(GTMHTTPFetcher *)fetcher {
|
||||
[fetcher stopFetching];
|
||||
}
|
||||
|
||||
- (void)stopFetcher:(GTMHTTPFetcher *)fetcher {
|
||||
[self performSelector:@selector(stopFetcherOnCurrentThread:)
|
||||
onStartThreadForFetcher:fetcher];
|
||||
}
|
||||
|
||||
- (void)fetcherDidStop:(GTMHTTPFetcher *)fetcher {
|
||||
// Entry point from the fetcher
|
||||
@synchronized(self) {
|
||||
NSString *host = fetcher.serviceHost;
|
||||
if (!host) {
|
||||
// fetcher has been stopped previously
|
||||
return;
|
||||
}
|
||||
|
||||
NSMutableArray *runningForHost = [runningHosts_ objectForKey:host];
|
||||
[runningForHost removeObject:fetcher];
|
||||
|
||||
NSMutableArray *delayedForHost = [delayedHosts_ objectForKey:host];
|
||||
[delayedForHost removeObject:fetcher];
|
||||
|
||||
while ([delayedForHost count] > 0
|
||||
&& [runningForHost count] < maxRunningFetchersPerHost_) {
|
||||
// Start another delayed fetcher running, scanning for the minimum
|
||||
// priority value, defaulting to FIFO for equal priorities
|
||||
GTMHTTPFetcher *nextFetcher = nil;
|
||||
for (GTMHTTPFetcher *delayedFetcher in delayedForHost) {
|
||||
if (nextFetcher == nil
|
||||
|| delayedFetcher.servicePriority < nextFetcher.servicePriority) {
|
||||
nextFetcher = delayedFetcher;
|
||||
}
|
||||
}
|
||||
|
||||
[self addRunningFetcher:nextFetcher forHost:host];
|
||||
runningForHost = [runningHosts_ objectForKey:host];
|
||||
|
||||
[delayedForHost removeObjectIdenticalTo:nextFetcher];
|
||||
[self startFetcher:nextFetcher];
|
||||
}
|
||||
|
||||
if ([runningForHost count] == 0) {
|
||||
// None left; remove the empty array
|
||||
[runningHosts_ removeObjectForKey:host];
|
||||
}
|
||||
|
||||
if ([delayedForHost count] == 0) {
|
||||
[delayedHosts_ removeObjectForKey:host];
|
||||
}
|
||||
|
||||
// The fetcher is no longer in the running or the delayed array,
|
||||
// so remove its host and thread properties
|
||||
fetcher.serviceHost = nil;
|
||||
fetcher.thread = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSUInteger)numberOfFetchers {
|
||||
@synchronized(self) {
|
||||
NSUInteger running = [self numberOfRunningFetchers];
|
||||
NSUInteger delayed = [self numberOfDelayedFetchers];
|
||||
return running + delayed;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSUInteger)numberOfRunningFetchers {
|
||||
@synchronized(self) {
|
||||
NSUInteger sum = 0;
|
||||
for (NSString *host in runningHosts_) {
|
||||
NSArray *fetchers = [runningHosts_ objectForKey:host];
|
||||
sum += [fetchers count];
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSUInteger)numberOfDelayedFetchers {
|
||||
@synchronized(self) {
|
||||
NSUInteger sum = 0;
|
||||
for (NSString *host in delayedHosts_) {
|
||||
NSArray *fetchers = [delayedHosts_ objectForKey:host];
|
||||
sum += [fetchers count];
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSArray *)issuedFetchersWithRequestURL:(NSURL *)requestURL {
|
||||
@synchronized(self) {
|
||||
NSMutableArray *array = nil;
|
||||
NSString *host = [requestURL host];
|
||||
if ([host length] == 0) return nil;
|
||||
|
||||
NSURL *absRequestURL = [requestURL absoluteURL];
|
||||
|
||||
NSArray *runningForHost = [runningHosts_ objectForKey:host];
|
||||
for (GTMHTTPFetcher *fetcher in runningForHost) {
|
||||
NSURL *fetcherURL = [[[fetcher mutableRequest] URL] absoluteURL];
|
||||
if ([fetcherURL isEqual:absRequestURL]) {
|
||||
if (array == nil) {
|
||||
array = [NSMutableArray array];
|
||||
}
|
||||
[array addObject:fetcher];
|
||||
}
|
||||
}
|
||||
|
||||
NSArray *delayedForHost = [delayedHosts_ objectForKey:host];
|
||||
for (GTMHTTPFetcher *fetcher in delayedForHost) {
|
||||
NSURL *fetcherURL = [[[fetcher mutableRequest] URL] absoluteURL];
|
||||
if ([fetcherURL isEqual:absRequestURL]) {
|
||||
if (array == nil) {
|
||||
array = [NSMutableArray array];
|
||||
}
|
||||
[array addObject:fetcher];
|
||||
}
|
||||
}
|
||||
return array;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)stopAllFetchers {
|
||||
@synchronized(self) {
|
||||
// Remove fetchers from the delayed list to avoid fetcherDidStop: from
|
||||
// starting more fetchers running as a side effect of stopping one
|
||||
NSArray *delayedForHosts = [delayedHosts_ allValues];
|
||||
[delayedHosts_ removeAllObjects];
|
||||
|
||||
for (NSArray *delayedForHost in delayedForHosts) {
|
||||
for (GTMHTTPFetcher *fetcher in delayedForHost) {
|
||||
[self stopFetcher:fetcher];
|
||||
}
|
||||
}
|
||||
|
||||
NSArray *runningForHosts = [runningHosts_ allValues];
|
||||
[runningHosts_ removeAllObjects];
|
||||
|
||||
for (NSArray *runningForHost in runningForHosts) {
|
||||
for (GTMHTTPFetcher *fetcher in runningForHost) {
|
||||
[self stopFetcher:fetcher];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark Fetch History Settings
|
||||
|
||||
// Turn on data caching to receive a copy of previously-retrieved objects.
|
||||
// Otherwise, fetches may return status 304 (No Change) rather than actual data
|
||||
- (void)setShouldCacheETaggedData:(BOOL)flag {
|
||||
self.fetchHistory.shouldCacheETaggedData = flag;
|
||||
}
|
||||
|
||||
- (BOOL)shouldCacheETaggedData {
|
||||
return self.fetchHistory.shouldCacheETaggedData;
|
||||
}
|
||||
|
||||
- (void)setETaggedDataCacheCapacity:(NSUInteger)totalBytes {
|
||||
self.fetchHistory.memoryCapacity = totalBytes;
|
||||
}
|
||||
|
||||
- (NSUInteger)ETaggedDataCacheCapacity {
|
||||
return self.fetchHistory.memoryCapacity;
|
||||
}
|
||||
|
||||
- (void)setShouldRememberETags:(BOOL)flag {
|
||||
self.fetchHistory.shouldRememberETags = flag;
|
||||
}
|
||||
|
||||
- (BOOL)shouldRememberETags {
|
||||
return self.fetchHistory.shouldRememberETags;
|
||||
}
|
||||
|
||||
// reset the ETag cache to avoid getting a Not Modified status
|
||||
// based on prior queries
|
||||
- (void)clearETaggedDataCache {
|
||||
[self.fetchHistory clearETaggedDataCache];
|
||||
}
|
||||
|
||||
- (void)clearHistory {
|
||||
[self clearETaggedDataCache];
|
||||
[self.fetchHistory removeAllCookies];
|
||||
}
|
||||
|
||||
#pragma mark Synchronous Wait for Unit Testing
|
||||
|
||||
- (void)waitForCompletionOfAllFetchersWithTimeout:(NSTimeInterval)timeoutInSeconds {
|
||||
NSDate* giveUpDate = [NSDate dateWithTimeIntervalSinceNow:timeoutInSeconds];
|
||||
BOOL isMainThread = [NSThread isMainThread];
|
||||
|
||||
while ([self numberOfFetchers] > 0
|
||||
&& [giveUpDate timeIntervalSinceNow] > 0) {
|
||||
// Run the current run loop 1/1000 of a second to give the networking
|
||||
// code a chance to work
|
||||
if (isMainThread || delegateQueue_ == nil) {
|
||||
NSDate *stopDate = [NSDate dateWithTimeIntervalSinceNow:0.001];
|
||||
[[NSRunLoop currentRunLoop] runUntilDate:stopDate];
|
||||
} else {
|
||||
// Sleep on the delegate queue's background thread.
|
||||
[NSThread sleepForTimeInterval:0.001];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark Accessors
|
||||
|
||||
- (NSDictionary *)runningHosts {
|
||||
return runningHosts_;
|
||||
}
|
||||
|
||||
- (void)setRunningHosts:(NSDictionary *)dict {
|
||||
[runningHosts_ autorelease];
|
||||
runningHosts_ = [dict mutableCopy];
|
||||
}
|
||||
|
||||
- (NSDictionary *)delayedHosts {
|
||||
return delayedHosts_;
|
||||
}
|
||||
|
||||
- (void)setDelayedHosts:(NSDictionary *)dict {
|
||||
[delayedHosts_ autorelease];
|
||||
delayedHosts_ = [dict mutableCopy];
|
||||
}
|
||||
|
||||
- (id <GTMFetcherAuthorizationProtocol>)authorizer {
|
||||
return authorizer_;
|
||||
}
|
||||
|
||||
- (void)setAuthorizer:(id <GTMFetcherAuthorizationProtocol>)obj {
|
||||
if (obj != authorizer_) {
|
||||
[self detachAuthorizer];
|
||||
}
|
||||
|
||||
[authorizer_ autorelease];
|
||||
authorizer_ = [obj retain];
|
||||
|
||||
// Use the fetcher service for the authorization fetches if the auth
|
||||
// object supports fetcher services
|
||||
if ([authorizer_ respondsToSelector:@selector(setFetcherService:)]) {
|
||||
[authorizer_ setFetcherService:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)detachAuthorizer {
|
||||
// This method is called by the fetcher service's dealloc and setAuthorizer:
|
||||
// methods; do not override.
|
||||
//
|
||||
// The fetcher service retains the authorizer, and the authorizer has a
|
||||
// weak pointer to the fetcher service (a non-zeroing pointer for
|
||||
// compatibility with iOS 4 and Mac OS X 10.5/10.6.)
|
||||
//
|
||||
// When this fetcher service no longer uses the authorizer, we want to remove
|
||||
// the authorizer's dependence on the fetcher service. Authorizers can still
|
||||
// function without a fetcher service.
|
||||
if ([authorizer_ respondsToSelector:@selector(fetcherService)]) {
|
||||
GTMHTTPFetcherService *authFS = [authorizer_ fetcherService];
|
||||
if (authFS == self) {
|
||||
[authorizer_ setFetcherService:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
504
iphone/Maps/GooglePlusSDK/OpenSource/GTMLogger.h
Normal file
504
iphone/Maps/GooglePlusSDK/OpenSource/GTMLogger.h
Normal 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
|
||||
|
612
iphone/Maps/GooglePlusSDK/OpenSource/GTMLogger.m
Normal file
612
iphone/Maps/GooglePlusSDK/OpenSource/GTMLogger.m
Normal file
|
@ -0,0 +1,612 @@
|
|||
//
|
||||
// GTMLogger.m
|
||||
//
|
||||
// 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 "GTMLogger.h"
|
||||
#import "GTMGarbageCollection.h"
|
||||
#import <fcntl.h>
|
||||
#import <unistd.h>
|
||||
#import <stdlib.h>
|
||||
#import <pthread.h>
|
||||
|
||||
|
||||
#if !defined(__clang__) && (__GNUC__*10+__GNUC_MINOR__ >= 42)
|
||||
// Some versions of GCC (4.2 and below AFAIK) aren't great about supporting
|
||||
// -Wmissing-format-attribute
|
||||
// when the function is anything more complex than foo(NSString *fmt, ...).
|
||||
// You see the error inside the function when you turn ... into va_args and
|
||||
// attempt to call another function (like vsprintf for example).
|
||||
// So we just shut off the warning for this file. We reenable it at the end.
|
||||
#pragma GCC diagnostic ignored "-Wmissing-format-attribute"
|
||||
#endif // !__clang__
|
||||
|
||||
// Reference to the shared GTMLogger instance. This is not a singleton, it's
|
||||
// just an easy reference to one shared instance.
|
||||
static GTMLogger *gSharedLogger = nil;
|
||||
|
||||
|
||||
@implementation GTMLogger
|
||||
|
||||
// Returns a pointer to the shared logger instance. If none exists, a standard
|
||||
// logger is created and returned.
|
||||
+ (id)sharedLogger {
|
||||
@synchronized(self) {
|
||||
if (gSharedLogger == nil) {
|
||||
gSharedLogger = [[self standardLogger] retain];
|
||||
}
|
||||
}
|
||||
return [[gSharedLogger retain] autorelease];
|
||||
}
|
||||
|
||||
+ (void)setSharedLogger:(GTMLogger *)logger {
|
||||
@synchronized(self) {
|
||||
[gSharedLogger autorelease];
|
||||
gSharedLogger = [logger retain];
|
||||
}
|
||||
}
|
||||
|
||||
+ (id)standardLogger {
|
||||
// Don't trust NSFileHandle not to throw
|
||||
@try {
|
||||
id<GTMLogWriter> writer = [NSFileHandle fileHandleWithStandardOutput];
|
||||
id<GTMLogFormatter> fr = [[[GTMLogStandardFormatter alloc] init]
|
||||
autorelease];
|
||||
id<GTMLogFilter> filter = [[[GTMLogLevelFilter alloc] init] autorelease];
|
||||
return [[[self alloc] initWithWriter:writer
|
||||
formatter:fr
|
||||
filter:filter] autorelease];
|
||||
}
|
||||
@catch (id e) {
|
||||
// Ignored
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (id)standardLoggerWithStderr {
|
||||
// Don't trust NSFileHandle not to throw
|
||||
@try {
|
||||
id me = [self standardLogger];
|
||||
[me setWriter:[NSFileHandle fileHandleWithStandardError]];
|
||||
return me;
|
||||
}
|
||||
@catch (id e) {
|
||||
// Ignored
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (id)standardLoggerWithStdoutAndStderr {
|
||||
// We're going to take advantage of the GTMLogger to GTMLogWriter adaptor
|
||||
// and create a composite logger that an outer "standard" logger can use
|
||||
// as a writer. Our inner loggers should apply no formatting since the main
|
||||
// logger does that and we want the caller to be able to change formatters
|
||||
// or add writers without knowing the inner structure of our composite.
|
||||
|
||||
// Don't trust NSFileHandle not to throw
|
||||
@try {
|
||||
GTMLogBasicFormatter *formatter = [[[GTMLogBasicFormatter alloc] init]
|
||||
autorelease];
|
||||
GTMLogger *stdoutLogger =
|
||||
[self loggerWithWriter:[NSFileHandle fileHandleWithStandardOutput]
|
||||
formatter:formatter
|
||||
filter:[[[GTMLogMaximumLevelFilter alloc]
|
||||
initWithMaximumLevel:kGTMLoggerLevelInfo]
|
||||
autorelease]];
|
||||
GTMLogger *stderrLogger =
|
||||
[self loggerWithWriter:[NSFileHandle fileHandleWithStandardError]
|
||||
formatter:formatter
|
||||
filter:[[[GTMLogMininumLevelFilter alloc]
|
||||
initWithMinimumLevel:kGTMLoggerLevelError]
|
||||
autorelease]];
|
||||
GTMLogger *compositeWriter =
|
||||
[self loggerWithWriter:[NSArray arrayWithObjects:
|
||||
stdoutLogger, stderrLogger, nil]
|
||||
formatter:formatter
|
||||
filter:[[[GTMLogNoFilter alloc] init] autorelease]];
|
||||
GTMLogger *outerLogger = [self standardLogger];
|
||||
[outerLogger setWriter:compositeWriter];
|
||||
return outerLogger;
|
||||
}
|
||||
@catch (id e) {
|
||||
// Ignored
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (id)standardLoggerWithPath:(NSString *)path {
|
||||
@try {
|
||||
NSFileHandle *fh = [NSFileHandle fileHandleForLoggingAtPath:path mode:0644];
|
||||
if (fh == nil) return nil;
|
||||
id me = [self standardLogger];
|
||||
[me setWriter:fh];
|
||||
return me;
|
||||
}
|
||||
@catch (id e) {
|
||||
// Ignored
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (id)loggerWithWriter:(id<GTMLogWriter>)writer
|
||||
formatter:(id<GTMLogFormatter>)formatter
|
||||
filter:(id<GTMLogFilter>)filter {
|
||||
return [[[self alloc] initWithWriter:writer
|
||||
formatter:formatter
|
||||
filter:filter] autorelease];
|
||||
}
|
||||
|
||||
+ (id)logger {
|
||||
return [[[self alloc] init] autorelease];
|
||||
}
|
||||
|
||||
- (id)init {
|
||||
return [self initWithWriter:nil formatter:nil filter:nil];
|
||||
}
|
||||
|
||||
- (id)initWithWriter:(id<GTMLogWriter>)writer
|
||||
formatter:(id<GTMLogFormatter>)formatter
|
||||
filter:(id<GTMLogFilter>)filter {
|
||||
if ((self = [super init])) {
|
||||
[self setWriter:writer];
|
||||
[self setFormatter:formatter];
|
||||
[self setFilter:filter];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
// Unlikely, but |writer_| may be an NSFileHandle, which can throw
|
||||
@try {
|
||||
[formatter_ release];
|
||||
[filter_ release];
|
||||
[writer_ release];
|
||||
}
|
||||
@catch (id e) {
|
||||
// Ignored
|
||||
}
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id<GTMLogWriter>)writer {
|
||||
return [[writer_ retain] autorelease];
|
||||
}
|
||||
|
||||
- (void)setWriter:(id<GTMLogWriter>)writer {
|
||||
@synchronized(self) {
|
||||
[writer_ autorelease];
|
||||
writer_ = nil;
|
||||
if (writer == nil) {
|
||||
// Try to use stdout, but don't trust NSFileHandle
|
||||
@try {
|
||||
writer_ = [[NSFileHandle fileHandleWithStandardOutput] retain];
|
||||
}
|
||||
@catch (id e) {
|
||||
// Leave |writer_| nil
|
||||
}
|
||||
} else {
|
||||
writer_ = [writer retain];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (id<GTMLogFormatter>)formatter {
|
||||
return [[formatter_ retain] autorelease];
|
||||
}
|
||||
|
||||
- (void)setFormatter:(id<GTMLogFormatter>)formatter {
|
||||
@synchronized(self) {
|
||||
[formatter_ autorelease];
|
||||
formatter_ = nil;
|
||||
if (formatter == nil) {
|
||||
@try {
|
||||
formatter_ = [[GTMLogBasicFormatter alloc] init];
|
||||
}
|
||||
@catch (id e) {
|
||||
// Leave |formatter_| nil
|
||||
}
|
||||
} else {
|
||||
formatter_ = [formatter retain];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (id<GTMLogFilter>)filter {
|
||||
return [[filter_ retain] autorelease];
|
||||
}
|
||||
|
||||
- (void)setFilter:(id<GTMLogFilter>)filter {
|
||||
@synchronized(self) {
|
||||
[filter_ autorelease];
|
||||
filter_ = nil;
|
||||
if (filter == nil) {
|
||||
@try {
|
||||
filter_ = [[GTMLogNoFilter alloc] init];
|
||||
}
|
||||
@catch (id e) {
|
||||
// Leave |filter_| nil
|
||||
}
|
||||
} else {
|
||||
filter_ = [filter retain];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)logDebug:(NSString *)fmt, ... {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
[self logInternalFunc:NULL format:fmt valist:args level:kGTMLoggerLevelDebug];
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
- (void)logInfo:(NSString *)fmt, ... {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
[self logInternalFunc:NULL format:fmt valist:args level:kGTMLoggerLevelInfo];
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
- (void)logError:(NSString *)fmt, ... {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
[self logInternalFunc:NULL format:fmt valist:args level:kGTMLoggerLevelError];
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
- (void)logAssert:(NSString *)fmt, ... {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
[self logInternalFunc:NULL format:fmt valist:args level:kGTMLoggerLevelAssert];
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
@end // GTMLogger
|
||||
|
||||
@implementation GTMLogger (GTMLoggerMacroHelpers)
|
||||
|
||||
- (void)logFuncDebug:(const char *)func msg:(NSString *)fmt, ... {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
[self logInternalFunc:func format:fmt valist:args level:kGTMLoggerLevelDebug];
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
- (void)logFuncInfo:(const char *)func msg:(NSString *)fmt, ... {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
[self logInternalFunc:func format:fmt valist:args level:kGTMLoggerLevelInfo];
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
- (void)logFuncError:(const char *)func msg:(NSString *)fmt, ... {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
[self logInternalFunc:func format:fmt valist:args level:kGTMLoggerLevelError];
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
- (void)logFuncAssert:(const char *)func msg:(NSString *)fmt, ... {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
[self logInternalFunc:func format:fmt valist:args level:kGTMLoggerLevelAssert];
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
@end // GTMLoggerMacroHelpers
|
||||
|
||||
@implementation GTMLogger (PrivateMethods)
|
||||
|
||||
- (void)logInternalFunc:(const char *)func
|
||||
format:(NSString *)fmt
|
||||
valist:(va_list)args
|
||||
level:(GTMLoggerLevel)level {
|
||||
// Primary point where logging happens, logging should never throw, catch
|
||||
// everything.
|
||||
@try {
|
||||
NSString *fname = func ? [NSString stringWithUTF8String:func] : nil;
|
||||
NSString *msg = [formatter_ stringForFunc:fname
|
||||
withFormat:fmt
|
||||
valist:args
|
||||
level:level];
|
||||
if (msg && [filter_ filterAllowsMessage:msg level:level])
|
||||
[writer_ logMessage:msg level:level];
|
||||
}
|
||||
@catch (id e) {
|
||||
// Ignored
|
||||
}
|
||||
}
|
||||
|
||||
@end // PrivateMethods
|
||||
|
||||
|
||||
@implementation NSFileHandle (GTMFileHandleLogWriter)
|
||||
|
||||
+ (id)fileHandleForLoggingAtPath:(NSString *)path mode:(mode_t)mode {
|
||||
int fd = -1;
|
||||
if (path) {
|
||||
int flags = O_WRONLY | O_APPEND | O_CREAT;
|
||||
fd = open([path fileSystemRepresentation], flags, mode);
|
||||
}
|
||||
if (fd == -1) return nil;
|
||||
return [[[self alloc] initWithFileDescriptor:fd
|
||||
closeOnDealloc:YES] autorelease];
|
||||
}
|
||||
|
||||
- (void)logMessage:(NSString *)msg level:(GTMLoggerLevel)level {
|
||||
@synchronized(self) {
|
||||
// Closed pipes should not generate exceptions in our caller. Catch here
|
||||
// as well [GTMLogger logInternalFunc:...] so that an exception in this
|
||||
// writer does not prevent other writers from having a chance.
|
||||
@try {
|
||||
NSString *line = [NSString stringWithFormat:@"%@\n", msg];
|
||||
[self writeData:[line dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
@catch (id e) {
|
||||
// Ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end // GTMFileHandleLogWriter
|
||||
|
||||
|
||||
@implementation NSArray (GTMArrayCompositeLogWriter)
|
||||
|
||||
- (void)logMessage:(NSString *)msg level:(GTMLoggerLevel)level {
|
||||
@synchronized(self) {
|
||||
id<GTMLogWriter> child = nil;
|
||||
GTM_FOREACH_OBJECT(child, self) {
|
||||
if ([child conformsToProtocol:@protocol(GTMLogWriter)])
|
||||
[child logMessage:msg level:level];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end // GTMArrayCompositeLogWriter
|
||||
|
||||
|
||||
@implementation GTMLogger (GTMLoggerLogWriter)
|
||||
|
||||
- (void)logMessage:(NSString *)msg level:(GTMLoggerLevel)level {
|
||||
switch (level) {
|
||||
case kGTMLoggerLevelDebug:
|
||||
[self logDebug:@"%@", msg];
|
||||
break;
|
||||
case kGTMLoggerLevelInfo:
|
||||
[self logInfo:@"%@", msg];
|
||||
break;
|
||||
case kGTMLoggerLevelError:
|
||||
[self logError:@"%@", msg];
|
||||
break;
|
||||
case kGTMLoggerLevelAssert:
|
||||
[self logAssert:@"%@", msg];
|
||||
break;
|
||||
default:
|
||||
// Ignore the message.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@end // GTMLoggerLogWriter
|
||||
|
||||
|
||||
@implementation GTMLogBasicFormatter
|
||||
|
||||
- (NSString *)prettyNameForFunc:(NSString *)func {
|
||||
NSString *name = [func stringByTrimmingCharactersInSet:
|
||||
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
NSString *function = @"(unknown)";
|
||||
if ([name length]) {
|
||||
if (// Objective C __func__ and __PRETTY_FUNCTION__
|
||||
[name hasPrefix:@"-["] || [name hasPrefix:@"+["] ||
|
||||
// C++ __PRETTY_FUNCTION__ and other preadorned formats
|
||||
[name hasSuffix:@")"]) {
|
||||
function = name;
|
||||
} else {
|
||||
// Assume C99 __func__
|
||||
function = [NSString stringWithFormat:@"%@()", name];
|
||||
}
|
||||
}
|
||||
return function;
|
||||
}
|
||||
|
||||
- (NSString *)stringForFunc:(NSString *)func
|
||||
withFormat:(NSString *)fmt
|
||||
valist:(va_list)args
|
||||
level:(GTMLoggerLevel)level {
|
||||
// Performance note: We may want to do a quick check here to see if |fmt|
|
||||
// contains a '%', and if not, simply return 'fmt'.
|
||||
if (!(fmt && args)) return nil;
|
||||
return [[[NSString alloc] initWithFormat:fmt arguments:args] autorelease];
|
||||
}
|
||||
|
||||
@end // GTMLogBasicFormatter
|
||||
|
||||
|
||||
@implementation GTMLogStandardFormatter
|
||||
|
||||
- (id)init {
|
||||
if ((self = [super init])) {
|
||||
dateFormatter_ = [[NSDateFormatter alloc] init];
|
||||
[dateFormatter_ setFormatterBehavior:NSDateFormatterBehavior10_4];
|
||||
[dateFormatter_ setDateFormat:@"yyyy-MM-dd HH:mm:ss.SSS"];
|
||||
pname_ = [[[NSProcessInfo processInfo] processName] copy];
|
||||
pid_ = [[NSProcessInfo processInfo] processIdentifier];
|
||||
if (!(dateFormatter_ && pname_)) {
|
||||
[self release];
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[dateFormatter_ release];
|
||||
[pname_ release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *)stringForFunc:(NSString *)func
|
||||
withFormat:(NSString *)fmt
|
||||
valist:(va_list)args
|
||||
level:(GTMLoggerLevel)level {
|
||||
NSString *tstamp = nil;
|
||||
@synchronized (dateFormatter_) {
|
||||
tstamp = [dateFormatter_ stringFromDate:[NSDate date]];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%@ %@[%d/%p] [lvl=%d] %@ %@",
|
||||
tstamp, pname_, pid_, pthread_self(),
|
||||
level, [self prettyNameForFunc:func],
|
||||
// |super| has guard for nil |fmt| and |args|
|
||||
[super stringForFunc:func withFormat:fmt valist:args level:level]];
|
||||
}
|
||||
|
||||
@end // GTMLogStandardFormatter
|
||||
|
||||
|
||||
@implementation GTMLogLevelFilter
|
||||
|
||||
// Check the environment and the user preferences for the GTMVerboseLogging key
|
||||
// to see if verbose logging has been enabled. The environment variable will
|
||||
// override the defaults setting, so check the environment first.
|
||||
// COV_NF_START
|
||||
static BOOL IsVerboseLoggingEnabled(void) {
|
||||
static NSString *const kVerboseLoggingKey = @"GTMVerboseLogging";
|
||||
NSString *value = [[[NSProcessInfo processInfo] environment]
|
||||
objectForKey:kVerboseLoggingKey];
|
||||
if (value) {
|
||||
// Emulate [NSString boolValue] for pre-10.5
|
||||
value = [value stringByTrimmingCharactersInSet:
|
||||
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
if ([[value uppercaseString] hasPrefix:@"Y"] ||
|
||||
[[value uppercaseString] hasPrefix:@"T"] ||
|
||||
[value intValue]) {
|
||||
return YES;
|
||||
} else {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
return [[NSUserDefaults standardUserDefaults] boolForKey:kVerboseLoggingKey];
|
||||
}
|
||||
// COV_NF_END
|
||||
|
||||
// In DEBUG builds, log everything. If we're not in a debug build we'll assume
|
||||
// that we're in a Release build.
|
||||
- (BOOL)filterAllowsMessage:(NSString *)msg level:(GTMLoggerLevel)level {
|
||||
#if DEBUG
|
||||
return YES;
|
||||
#endif
|
||||
|
||||
BOOL allow = YES;
|
||||
|
||||
switch (level) {
|
||||
case kGTMLoggerLevelDebug:
|
||||
allow = NO;
|
||||
break;
|
||||
case kGTMLoggerLevelInfo:
|
||||
allow = IsVerboseLoggingEnabled();
|
||||
break;
|
||||
case kGTMLoggerLevelError:
|
||||
allow = YES;
|
||||
break;
|
||||
case kGTMLoggerLevelAssert:
|
||||
allow = YES;
|
||||
break;
|
||||
default:
|
||||
allow = YES;
|
||||
break;
|
||||
}
|
||||
|
||||
return allow;
|
||||
}
|
||||
|
||||
@end // GTMLogLevelFilter
|
||||
|
||||
|
||||
@implementation GTMLogNoFilter
|
||||
|
||||
- (BOOL)filterAllowsMessage:(NSString *)msg level:(GTMLoggerLevel)level {
|
||||
return YES; // Allow everything through
|
||||
}
|
||||
|
||||
@end // GTMLogNoFilter
|
||||
|
||||
|
||||
@implementation GTMLogAllowedLevelFilter
|
||||
|
||||
// Private designated initializer
|
||||
- (id)initWithAllowedLevels:(NSIndexSet *)levels {
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
allowedLevels_ = [levels retain];
|
||||
// Cap min/max level
|
||||
if (!allowedLevels_ ||
|
||||
// NSIndexSet is unsigned so only check the high bound, but need to
|
||||
// check both first and last index because NSIndexSet appears to allow
|
||||
// wraparound.
|
||||
([allowedLevels_ firstIndex] > kGTMLoggerLevelAssert) ||
|
||||
([allowedLevels_ lastIndex] > kGTMLoggerLevelAssert)) {
|
||||
[self release];
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)init {
|
||||
// Allow all levels in default init
|
||||
return [self initWithAllowedLevels:[NSIndexSet indexSetWithIndexesInRange:
|
||||
NSMakeRange(kGTMLoggerLevelUnknown,
|
||||
(kGTMLoggerLevelAssert - kGTMLoggerLevelUnknown + 1))]];
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[allowedLevels_ release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (BOOL)filterAllowsMessage:(NSString *)msg level:(GTMLoggerLevel)level {
|
||||
return [allowedLevels_ containsIndex:level];
|
||||
}
|
||||
|
||||
@end // GTMLogAllowedLevelFilter
|
||||
|
||||
|
||||
@implementation GTMLogMininumLevelFilter
|
||||
|
||||
- (id)initWithMinimumLevel:(GTMLoggerLevel)level {
|
||||
return [super initWithAllowedLevels:[NSIndexSet indexSetWithIndexesInRange:
|
||||
NSMakeRange(level,
|
||||
(kGTMLoggerLevelAssert - level + 1))]];
|
||||
}
|
||||
|
||||
@end // GTMLogMininumLevelFilter
|
||||
|
||||
|
||||
@implementation GTMLogMaximumLevelFilter
|
||||
|
||||
- (id)initWithMaximumLevel:(GTMLoggerLevel)level {
|
||||
return [super initWithAllowedLevels:[NSIndexSet indexSetWithIndexesInRange:
|
||||
NSMakeRange(kGTMLoggerLevelUnknown, level + 1)]];
|
||||
}
|
||||
|
||||
@end // GTMLogMaximumLevelFilter
|
||||
|
||||
#if !defined(__clang__) && (__GNUC__*10+__GNUC_MINOR__ >= 42)
|
||||
// See comment at top of file.
|
||||
#pragma GCC diagnostic error "-Wmissing-format-attribute"
|
||||
#endif // !__clang__
|
||||
|
88
iphone/Maps/GooglePlusSDK/OpenSource/GTMMethodCheck.h
Normal file
88
iphone/Maps/GooglePlusSDK/OpenSource/GTMMethodCheck.h
Normal 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
|
174
iphone/Maps/GooglePlusSDK/OpenSource/GTMMethodCheck.m
Normal file
174
iphone/Maps/GooglePlusSDK/OpenSource/GTMMethodCheck.m
Normal file
|
@ -0,0 +1,174 @@
|
|||
//
|
||||
// GTMMethodCheck.m
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
// Don't want any of this in release builds
|
||||
#ifdef DEBUG
|
||||
#import "GTMDefines.h"
|
||||
#import "GTMMethodCheck.h"
|
||||
#import "GTMObjC2Runtime.h"
|
||||
#import <dlfcn.h>
|
||||
|
||||
// Checks to see if the cls passed in (or one of it's superclasses) conforms
|
||||
// to NSObject protocol. Inheriting from NSObject is the easiest way to do this
|
||||
// but not all classes (i.e. NSProxy) inherit from NSObject. Also, some classes
|
||||
// inherit from Object instead of NSObject which is fine, and we'll count as
|
||||
// conforming to NSObject for our needs.
|
||||
static BOOL ConformsToNSObjectProtocol(Class cls) {
|
||||
// If we get nil, obviously doesn't conform.
|
||||
if (!cls) return NO;
|
||||
const char *className = class_getName(cls);
|
||||
if (!className) return NO;
|
||||
|
||||
// We're going to assume that all Apple classes will work
|
||||
// (and aren't being checked)
|
||||
// Note to apple: why doesn't obj-c have real namespaces instead of two
|
||||
// letter hacks? If you name your own classes starting with NS this won't
|
||||
// work for you.
|
||||
// Some classes (like _NSZombie) start with _NS.
|
||||
// On Leopard we have to look for CFObject as well.
|
||||
// On iPhone we check Object as well
|
||||
if ((strncmp(className, "NS", 2) == 0)
|
||||
|| (strncmp(className, "_NS", 3) == 0)
|
||||
|| (strncmp(className, "__NS", 4) == 0)
|
||||
|| (strcmp(className, "CFObject") == 0)
|
||||
|| (strcmp(className, "__IncompleteProtocol") == 0)
|
||||
|| (strcmp(className, "__ARCLite__") == 0)
|
||||
|| (strcmp(className, "WebMIMETypeRegistry") == 0)
|
||||
#if GTM_IPHONE_SDK
|
||||
|| (strcmp(className, "Object") == 0)
|
||||
|| (strcmp(className, "UIKeyboardCandidateUtilities") == 0)
|
||||
#endif
|
||||
) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
// iPhone and Mac OS X 10.8 with Obj-C 2 SDKs do not define the |Object|
|
||||
// class, so we instead test for the |NSObject| class.
|
||||
#if GTM_IPHONE_SDK || \
|
||||
(__OBJC2__ && defined(MAC_OS_X_VERSION_10_8) && \
|
||||
MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8)
|
||||
// Iterate through all the protocols |cls| supports looking for NSObject.
|
||||
if (cls == [NSObject class]
|
||||
|| class_conformsToProtocol(cls, @protocol(NSObject))) {
|
||||
return YES;
|
||||
}
|
||||
#else
|
||||
// Iterate through all the protocols |cls| supports looking for NSObject.
|
||||
if (cls == [Object class]
|
||||
|| class_conformsToProtocol(cls, @protocol(NSObject))) {
|
||||
return YES;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Recursively check the superclasses.
|
||||
return ConformsToNSObjectProtocol(class_getSuperclass(cls));
|
||||
}
|
||||
|
||||
void GTMMethodCheckMethodChecker(void) {
|
||||
// Run through all the classes looking for class methods that are
|
||||
// prefixed with xxGMMethodCheckMethod. If it finds one, it calls it.
|
||||
// See GTMMethodCheck.h to see what it does.
|
||||
#if !defined(__has_feature) || !__has_feature(objc_arc)
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
#else
|
||||
@autoreleasepool {
|
||||
#endif
|
||||
int numClasses = 0;
|
||||
int newNumClasses = objc_getClassList(NULL, 0);
|
||||
int i;
|
||||
Class *classes = NULL;
|
||||
while (numClasses < newNumClasses) {
|
||||
numClasses = newNumClasses;
|
||||
classes = (Class *)realloc(classes, sizeof(Class) * numClasses);
|
||||
_GTMDevAssert(classes, @"Unable to allocate memory for classes");
|
||||
newNumClasses = objc_getClassList(classes, numClasses);
|
||||
}
|
||||
for (i = 0; i < numClasses && classes; ++i) {
|
||||
Class cls = classes[i];
|
||||
|
||||
// Since we are directly calling objc_msgSend, we need to conform to
|
||||
// @protocol(NSObject), or else we will tumble into a _objc_msgForward
|
||||
// recursive loop when we try and call a function by name.
|
||||
if (!ConformsToNSObjectProtocol(cls)) {
|
||||
// COV_NF_START
|
||||
_GTMDevLog(@"GTMMethodCheckMethodChecker: Class %s does not conform to "
|
||||
"@protocol(NSObject), so won't be checked",
|
||||
class_getName(cls));
|
||||
continue;
|
||||
// COV_NF_END
|
||||
}
|
||||
// Since we are looking for a class method (+xxGMMethodCheckMethod...)
|
||||
// we need to query the isa pointer to see what methods it support, but
|
||||
// send the method (if it's supported) to the class itself.
|
||||
unsigned int count;
|
||||
Class metaClass = objc_getMetaClass(class_getName(cls));
|
||||
Method *methods = class_copyMethodList(metaClass, &count);
|
||||
unsigned int j;
|
||||
for (j = 0; j < count; ++j) {
|
||||
SEL selector = method_getName(methods[j]);
|
||||
const char *name = sel_getName(selector);
|
||||
if (strstr(name, "xxGTMMethodCheckMethod") == name) {
|
||||
// Check to make sure that the method we are checking comes
|
||||
// from the same image that we are in. Since GTMMethodCheckMethodChecker
|
||||
// is not exported, we should always find the copy in our local
|
||||
// image. We compare the address of it's image with the address of
|
||||
// the image which implements the method we want to check. If
|
||||
// they match we continue. This does two things:
|
||||
// a) minimizes the amount of calls we make to the xxxGTMMethodCheck
|
||||
// methods. They should only be called once.
|
||||
// b) prevents initializers for various classes being called too early
|
||||
Dl_info methodCheckerInfo;
|
||||
if (!dladdr(GTMMethodCheckMethodChecker,
|
||||
&methodCheckerInfo)) {
|
||||
// COV_NF_START
|
||||
// Don't know how to force this case in a unittest.
|
||||
// Certainly hope we never see it.
|
||||
_GTMDevLog(@"GTMMethodCheckMethodChecker: Unable to get dladdr info "
|
||||
"for GTMMethodCheckMethodChecker while introspecting +[%s %s]]",
|
||||
class_getName(cls), name);
|
||||
continue;
|
||||
// COV_NF_END
|
||||
}
|
||||
Dl_info methodInfo;
|
||||
if (!dladdr(method_getImplementation(methods[j]),
|
||||
&methodInfo)) {
|
||||
// COV_NF_START
|
||||
// Don't know how to force this case in a unittest
|
||||
// Certainly hope we never see it.
|
||||
_GTMDevLog(@"GTMMethodCheckMethodChecker: Unable to get dladdr info "
|
||||
"for %s while introspecting +[%s %s]]", name,
|
||||
class_getName(cls), name);
|
||||
continue;
|
||||
// COV_NF_END
|
||||
}
|
||||
if (methodCheckerInfo.dli_fbase == methodInfo.dli_fbase) {
|
||||
objc_msgSend(cls, selector);
|
||||
}
|
||||
}
|
||||
}
|
||||
free(methods);
|
||||
}
|
||||
free(classes);
|
||||
#if !defined(__has_feature) || !__has_feature(objc_arc)
|
||||
[pool drain];
|
||||
#else
|
||||
} // @autoreleasepool
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // DEBUG
|
|
@ -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
|
|
@ -0,0 +1,71 @@
|
|||
//
|
||||
// GTMNSDictionary+URLArguments.m
|
||||
//
|
||||
// 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 "GTMNSDictionary+URLArguments.h"
|
||||
#import "GTMNSString+URLArguments.h"
|
||||
#import "GTMMethodCheck.h"
|
||||
#import "GTMDefines.h"
|
||||
|
||||
@implementation NSDictionary (GTMNSDictionaryURLArgumentsAdditions)
|
||||
|
||||
GTM_METHOD_CHECK(NSString, gtm_stringByEscapingForURLArgument);
|
||||
GTM_METHOD_CHECK(NSString, gtm_stringByUnescapingFromURLArgument);
|
||||
|
||||
+ (NSDictionary *)gtm_dictionaryWithHttpArgumentsString:(NSString *)argString {
|
||||
NSMutableDictionary* ret = [NSMutableDictionary dictionary];
|
||||
NSArray* components = [argString componentsSeparatedByString:@"&"];
|
||||
NSString* component;
|
||||
// Use reverse order so that the first occurrence of a key replaces
|
||||
// those subsequent.
|
||||
GTM_FOREACH_ENUMEREE(component, [components reverseObjectEnumerator]) {
|
||||
if ([component length] == 0)
|
||||
continue;
|
||||
NSRange pos = [component rangeOfString:@"="];
|
||||
NSString *key;
|
||||
NSString *val;
|
||||
if (pos.location == NSNotFound) {
|
||||
key = [component gtm_stringByUnescapingFromURLArgument];
|
||||
val = @"";
|
||||
} else {
|
||||
key = [[component substringToIndex:pos.location]
|
||||
gtm_stringByUnescapingFromURLArgument];
|
||||
val = [[component substringFromIndex:pos.location + pos.length]
|
||||
gtm_stringByUnescapingFromURLArgument];
|
||||
}
|
||||
// gtm_stringByUnescapingFromURLArgument returns nil on invalid UTF8
|
||||
// and NSMutableDictionary raises an exception when passed nil values.
|
||||
if (!key) key = @"";
|
||||
if (!val) val = @"";
|
||||
[ret setObject:val forKey:key];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
- (NSString *)gtm_httpArgumentsString {
|
||||
NSMutableArray* arguments = [NSMutableArray arrayWithCapacity:[self count]];
|
||||
NSString* key;
|
||||
GTM_FOREACH_KEY(key, self) {
|
||||
[arguments addObject:[NSString stringWithFormat:@"%@=%@",
|
||||
[key gtm_stringByEscapingForURLArgument],
|
||||
[[[self objectForKey:key] description] gtm_stringByEscapingForURLArgument]]];
|
||||
}
|
||||
|
||||
return [arguments componentsJoinedByString:@"&"];
|
||||
}
|
||||
|
||||
@end
|
|
@ -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
|
|
@ -0,0 +1,45 @@
|
|||
//
|
||||
// GTMNSString+URLArguments.m
|
||||
//
|
||||
// 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 "GTMNSString+URLArguments.h"
|
||||
#import "GTMGarbageCollection.h"
|
||||
|
||||
@implementation NSString (GTMNSStringURLArgumentsAdditions)
|
||||
|
||||
- (NSString*)gtm_stringByEscapingForURLArgument {
|
||||
// Encode all the reserved characters, per RFC 3986
|
||||
// (<http://www.ietf.org/rfc/rfc3986.txt>)
|
||||
CFStringRef escaped =
|
||||
CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
|
||||
(CFStringRef)self,
|
||||
NULL,
|
||||
(CFStringRef)@"!*'();:@&=+$,/?%#[]",
|
||||
kCFStringEncodingUTF8);
|
||||
return GTMCFAutorelease(escaped);
|
||||
}
|
||||
|
||||
- (NSString*)gtm_stringByUnescapingFromURLArgument {
|
||||
NSMutableString *resultString = [NSMutableString stringWithString:self];
|
||||
[resultString replaceOccurrencesOfString:@"+"
|
||||
withString:@" "
|
||||
options:NSLiteralSearch
|
||||
range:NSMakeRange(0, [resultString length])];
|
||||
return [resultString stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
}
|
||||
|
||||
@end
|
333
iphone/Maps/GooglePlusSDK/OpenSource/GTMOAuth2Authentication.h
Normal file
333
iphone/Maps/GooglePlusSDK/OpenSource/GTMOAuth2Authentication.h
Normal file
|
@ -0,0 +1,333 @@
|
|||
/* 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 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");
|
||||
|
||||
// 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_;
|
||||
|
||||
NSDictionary *additionalTokenRequestParameters_;
|
||||
|
||||
// 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;
|
||||
|
||||
// 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;
|
||||
|
||||
// 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;
|
||||
|
||||
+ (NSString *)scopeWithStrings:(NSString *)firsStr, ... NS_REQUIRES_NIL_TERMINATION;
|
||||
@end
|
||||
|
||||
#endif // GTM_INCLUDE_OAUTH2 || !GDATA_REQUIRE_SERVICE_INCLUDES
|
1231
iphone/Maps/GooglePlusSDK/OpenSource/GTMOAuth2Authentication.m
Normal file
1231
iphone/Maps/GooglePlusSDK/OpenSource/GTMOAuth2Authentication.m
Normal file
File diff suppressed because it is too large
Load diff
187
iphone/Maps/GooglePlusSDK/OpenSource/GTMOAuth2SignIn.h
Normal file
187
iphone/Maps/GooglePlusSDK/OpenSource/GTMOAuth2SignIn.h
Normal 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
|
835
iphone/Maps/GooglePlusSDK/OpenSource/GTMOAuth2SignIn.m
Normal file
835
iphone/Maps/GooglePlusSDK/OpenSource/GTMOAuth2SignIn.m
Normal file
|
@ -0,0 +1,835 @@
|
|||
/* 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
|
||||
|
||||
#define GTMOAUTH2SIGNIN_DEFINE_GLOBALS 1
|
||||
#import "GTMOAuth2SignIn.h"
|
||||
|
||||
// we'll default to timing out if the network becomes unreachable for more
|
||||
// than 30 seconds when the sign-in page is displayed
|
||||
static const NSTimeInterval kDefaultNetworkLossTimeoutInterval = 30.0;
|
||||
|
||||
// URI indicating an installed app is signing in. This is described at
|
||||
//
|
||||
// http://code.google.com/apis/accounts/docs/OAuth2.html#IA
|
||||
//
|
||||
NSString *const kOOBString = @"urn:ietf:wg:oauth:2.0:oob";
|
||||
|
||||
|
||||
@interface GTMOAuth2Authentication (InternalMethods)
|
||||
- (NSDictionary *)dictionaryWithJSONData:(NSData *)data;
|
||||
@end
|
||||
|
||||
@interface GTMOAuth2SignIn ()
|
||||
@property (assign) BOOL hasHandledCallback;
|
||||
@property (retain) GTMHTTPFetcher *pendingFetcher;
|
||||
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
|
||||
@property (nonatomic, retain, readwrite) NSDictionary *userProfile;
|
||||
#endif
|
||||
|
||||
- (void)invokeFinalCallbackWithError:(NSError *)error;
|
||||
|
||||
- (BOOL)startWebRequest;
|
||||
+ (NSMutableURLRequest *)mutableURLRequestWithURL:(NSURL *)oldURL
|
||||
paramString:(NSString *)paramStr;
|
||||
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
|
||||
- (void)addScopeForGoogleUserInfo;
|
||||
- (void)fetchGoogleUserInfo;
|
||||
#endif
|
||||
- (void)finishSignInWithError:(NSError *)error;
|
||||
|
||||
- (void)auth:(GTMOAuth2Authentication *)auth
|
||||
finishedWithFetcher:(GTMHTTPFetcher *)fetcher
|
||||
error:(NSError *)error;
|
||||
|
||||
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
|
||||
- (void)infoFetcher:(GTMHTTPFetcher *)fetcher
|
||||
finishedWithData:(NSData *)data
|
||||
error:(NSError *)error;
|
||||
#endif
|
||||
|
||||
- (void)closeTheWindow;
|
||||
|
||||
- (void)startReachabilityCheck;
|
||||
- (void)stopReachabilityCheck;
|
||||
- (void)reachabilityTarget:(SCNetworkReachabilityRef)reachabilityRef
|
||||
changedFlags:(SCNetworkConnectionFlags)flags;
|
||||
- (void)reachabilityTimerFired:(NSTimer *)timer;
|
||||
@end
|
||||
|
||||
@implementation GTMOAuth2SignIn
|
||||
|
||||
@synthesize authentication = auth_;
|
||||
|
||||
@synthesize authorizationURL = authorizationURL_;
|
||||
@synthesize additionalAuthorizationParameters = additionalAuthorizationParameters_;
|
||||
|
||||
@synthesize delegate = delegate_;
|
||||
@synthesize webRequestSelector = webRequestSelector_;
|
||||
@synthesize finishedSelector = finishedSelector_;
|
||||
@synthesize hasHandledCallback = hasHandledCallback_;
|
||||
@synthesize pendingFetcher = pendingFetcher_;
|
||||
@synthesize userData = userData_;
|
||||
|
||||
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
|
||||
@synthesize shouldFetchGoogleUserEmail = shouldFetchGoogleUserEmail_;
|
||||
@synthesize shouldFetchGoogleUserProfile = shouldFetchGoogleUserProfile_;
|
||||
@synthesize userProfile = userProfile_;
|
||||
#endif
|
||||
|
||||
@synthesize networkLossTimeoutInterval = networkLossTimeoutInterval_;
|
||||
|
||||
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
|
||||
+ (NSURL *)googleAuthorizationURL {
|
||||
NSString *str = @"https://accounts.google.com/o/oauth2/auth";
|
||||
return [NSURL URLWithString:str];
|
||||
}
|
||||
|
||||
+ (NSURL *)googleTokenURL {
|
||||
NSString *str = @"https://accounts.google.com/o/oauth2/token";
|
||||
return [NSURL URLWithString:str];
|
||||
}
|
||||
|
||||
+ (NSURL *)googleRevocationURL {
|
||||
NSString *urlStr = @"https://accounts.google.com/o/oauth2/revoke";
|
||||
return [NSURL URLWithString:urlStr];
|
||||
}
|
||||
|
||||
+ (NSURL *)googleUserInfoURL {
|
||||
NSString *urlStr = @"https://www.googleapis.com/oauth2/v1/userinfo";
|
||||
return [NSURL URLWithString:urlStr];
|
||||
}
|
||||
#endif
|
||||
|
||||
+ (NSString *)nativeClientRedirectURI {
|
||||
return kOOBString;
|
||||
}
|
||||
|
||||
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
|
||||
+ (GTMOAuth2Authentication *)standardGoogleAuthenticationForScope:(NSString *)scope
|
||||
clientID:(NSString *)clientID
|
||||
clientSecret:(NSString *)clientSecret {
|
||||
NSString *redirectURI = [self nativeClientRedirectURI];
|
||||
NSURL *tokenURL = [self googleTokenURL];
|
||||
|
||||
GTMOAuth2Authentication *auth;
|
||||
auth = [GTMOAuth2Authentication authenticationWithServiceProvider:kGTMOAuth2ServiceProviderGoogle
|
||||
tokenURL:tokenURL
|
||||
redirectURI:redirectURI
|
||||
clientID:clientID
|
||||
clientSecret:clientSecret];
|
||||
auth.scope = scope;
|
||||
|
||||
return auth;
|
||||
}
|
||||
|
||||
- (void)addScopeForGoogleUserInfo {
|
||||
GTMOAuth2Authentication *auth = self.authentication;
|
||||
if (self.shouldFetchGoogleUserEmail) {
|
||||
NSString *const emailScope = @"https://www.googleapis.com/auth/userinfo.email";
|
||||
NSString *scope = auth.scope;
|
||||
if ([scope rangeOfString:emailScope].location == NSNotFound) {
|
||||
scope = [GTMOAuth2Authentication scopeWithStrings:scope, emailScope, nil];
|
||||
auth.scope = scope;
|
||||
}
|
||||
}
|
||||
|
||||
if (self.shouldFetchGoogleUserProfile) {
|
||||
NSString *const profileScope = @"https://www.googleapis.com/auth/userinfo.profile";
|
||||
NSString *scope = auth.scope;
|
||||
if ([scope rangeOfString:profileScope].location == NSNotFound) {
|
||||
scope = [GTMOAuth2Authentication scopeWithStrings:scope, profileScope, nil];
|
||||
auth.scope = scope;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
- (id)initWithAuthentication:(GTMOAuth2Authentication *)auth
|
||||
authorizationURL:(NSURL *)authorizationURL
|
||||
delegate:(id)delegate
|
||||
webRequestSelector:(SEL)webRequestSelector
|
||||
finishedSelector:(SEL)finishedSelector {
|
||||
// check the selectors on debug builds
|
||||
GTMAssertSelectorNilOrImplementedWithArgs(delegate, webRequestSelector,
|
||||
@encode(GTMOAuth2SignIn *), @encode(NSURLRequest *), 0);
|
||||
GTMAssertSelectorNilOrImplementedWithArgs(delegate, finishedSelector,
|
||||
@encode(GTMOAuth2SignIn *), @encode(GTMOAuth2Authentication *),
|
||||
@encode(NSError *), 0);
|
||||
|
||||
// designated initializer
|
||||
self = [super init];
|
||||
if (self) {
|
||||
auth_ = [auth retain];
|
||||
authorizationURL_ = [authorizationURL retain];
|
||||
delegate_ = [delegate retain];
|
||||
webRequestSelector_ = webRequestSelector;
|
||||
finishedSelector_ = finishedSelector;
|
||||
|
||||
// for Google authentication, we want to automatically fetch user info
|
||||
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
|
||||
NSString *host = [authorizationURL host];
|
||||
if ([host hasSuffix:@".google.com"]) {
|
||||
shouldFetchGoogleUserEmail_ = YES;
|
||||
}
|
||||
#endif
|
||||
|
||||
// default timeout for a lost internet connection while the server
|
||||
// UI is displayed is 30 seconds
|
||||
networkLossTimeoutInterval_ = kDefaultNetworkLossTimeoutInterval;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[self stopReachabilityCheck];
|
||||
|
||||
[auth_ release];
|
||||
[authorizationURL_ release];
|
||||
[additionalAuthorizationParameters_ release];
|
||||
[delegate_ release];
|
||||
[pendingFetcher_ release];
|
||||
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
|
||||
[userProfile_ release];
|
||||
#endif
|
||||
[userData_ release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
#pragma mark Sign-in Sequence Methods
|
||||
|
||||
// stop any pending fetches, and close the window (but don't call the
|
||||
// delegate's finishedSelector)
|
||||
- (void)cancelSigningIn {
|
||||
[self.pendingFetcher stopFetching];
|
||||
self.pendingFetcher = nil;
|
||||
|
||||
[self.authentication stopAuthorization];
|
||||
|
||||
[self closeTheWindow];
|
||||
|
||||
[delegate_ autorelease];
|
||||
delegate_ = nil;
|
||||
}
|
||||
|
||||
//
|
||||
// This is the entry point to begin the sequence
|
||||
// - display the authentication web page, and monitor redirects
|
||||
// - exchange the code for an access token and a refresh token
|
||||
// - for Google sign-in, fetch the user's email address
|
||||
// - tell the delegate we're finished
|
||||
//
|
||||
- (BOOL)startSigningIn {
|
||||
// For signing in to Google, append the scope for obtaining the authenticated
|
||||
// user email and profile, as appropriate
|
||||
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
|
||||
[self addScopeForGoogleUserInfo];
|
||||
#endif
|
||||
|
||||
// start the authorization
|
||||
return [self startWebRequest];
|
||||
}
|
||||
|
||||
- (NSMutableDictionary *)parametersForWebRequest {
|
||||
GTMOAuth2Authentication *auth = self.authentication;
|
||||
NSString *clientID = auth.clientID;
|
||||
NSString *redirectURI = auth.redirectURI;
|
||||
|
||||
BOOL hasClientID = ([clientID length] > 0);
|
||||
BOOL hasRedirect = ([redirectURI length] > 0
|
||||
|| redirectURI == [[self class] nativeClientRedirectURI]);
|
||||
if (!hasClientID || !hasRedirect) {
|
||||
#if DEBUG
|
||||
NSAssert(hasClientID, @"GTMOAuth2SignIn: clientID needed");
|
||||
NSAssert(hasRedirect, @"GTMOAuth2SignIn: redirectURI needed");
|
||||
#endif
|
||||
return NO;
|
||||
}
|
||||
|
||||
// invoke the UI controller's web request selector to display
|
||||
// the authorization page
|
||||
|
||||
// add params to the authorization URL
|
||||
NSString *scope = auth.scope;
|
||||
if ([scope length] == 0) scope = nil;
|
||||
|
||||
NSMutableDictionary *paramsDict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
@"code", @"response_type",
|
||||
clientID, @"client_id",
|
||||
scope, @"scope", // scope may be nil
|
||||
nil];
|
||||
if (redirectURI) {
|
||||
[paramsDict setObject:redirectURI forKey:@"redirect_uri"];
|
||||
}
|
||||
return paramsDict;
|
||||
}
|
||||
|
||||
- (BOOL)startWebRequest {
|
||||
NSMutableDictionary *paramsDict = [self parametersForWebRequest];
|
||||
|
||||
NSDictionary *additionalParams = self.additionalAuthorizationParameters;
|
||||
if (additionalParams) {
|
||||
[paramsDict addEntriesFromDictionary:additionalParams];
|
||||
}
|
||||
|
||||
NSString *paramStr = [GTMOAuth2Authentication encodedQueryParametersForDictionary:paramsDict];
|
||||
|
||||
NSURL *authorizationURL = self.authorizationURL;
|
||||
NSMutableURLRequest *request;
|
||||
request = [[self class] mutableURLRequestWithURL:authorizationURL
|
||||
paramString:paramStr];
|
||||
|
||||
[delegate_ performSelector:self.webRequestSelector
|
||||
withObject:self
|
||||
withObject:request];
|
||||
|
||||
// at this point, we're waiting on the server-driven html UI, so
|
||||
// we want notification if we lose connectivity to the web server
|
||||
[self startReachabilityCheck];
|
||||
return YES;
|
||||
}
|
||||
|
||||
// utility for making a request from an old URL with some additional parameters
|
||||
+ (NSMutableURLRequest *)mutableURLRequestWithURL:(NSURL *)oldURL
|
||||
paramString:(NSString *)paramStr {
|
||||
NSString *query = [oldURL query];
|
||||
if ([query length] > 0) {
|
||||
query = [query stringByAppendingFormat:@"&%@", paramStr];
|
||||
} else {
|
||||
query = paramStr;
|
||||
}
|
||||
|
||||
NSString *portStr = @"";
|
||||
NSString *oldPort = [[oldURL port] stringValue];
|
||||
if ([oldPort length] > 0) {
|
||||
portStr = [@":" stringByAppendingString:oldPort];
|
||||
}
|
||||
|
||||
NSString *qMark = [query length] > 0 ? @"?" : @"";
|
||||
NSString *newURLStr = [NSString stringWithFormat:@"%@://%@%@%@%@%@",
|
||||
[oldURL scheme], [oldURL host], portStr,
|
||||
[oldURL path], qMark, query];
|
||||
NSURL *newURL = [NSURL URLWithString:newURLStr];
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:newURL];
|
||||
return request;
|
||||
}
|
||||
|
||||
// entry point for the window controller to tell us that the window
|
||||
// prematurely closed
|
||||
- (void)windowWasClosed {
|
||||
[self stopReachabilityCheck];
|
||||
|
||||
NSError *error = [NSError errorWithDomain:kGTMOAuth2ErrorDomain
|
||||
code:kGTMOAuth2ErrorWindowClosed
|
||||
userInfo:nil];
|
||||
[self invokeFinalCallbackWithError:error];
|
||||
}
|
||||
|
||||
// internal method to tell the window controller to close the window
|
||||
- (void)closeTheWindow {
|
||||
[self stopReachabilityCheck];
|
||||
|
||||
// a nil request means the window should be closed
|
||||
[delegate_ performSelector:self.webRequestSelector
|
||||
withObject:self
|
||||
withObject:nil];
|
||||
}
|
||||
|
||||
// entry point for the window controller to tell us what web page has been
|
||||
// requested
|
||||
//
|
||||
// When the request is for the callback URL, this method invokes
|
||||
// authCodeObtained and returns YES
|
||||
- (BOOL)requestRedirectedToRequest:(NSURLRequest *)redirectedRequest {
|
||||
// for Google's installed app sign-in protocol, we'll look for the
|
||||
// end-of-sign-in indicator in the titleChanged: method below
|
||||
NSString *redirectURI = self.authentication.redirectURI;
|
||||
if (redirectURI == nil) return NO;
|
||||
|
||||
// when we're searching for the window title string, then we can ignore
|
||||
// redirects
|
||||
NSString *standardURI = [[self class] nativeClientRedirectURI];
|
||||
if (standardURI != nil && [redirectURI isEqual:standardURI]) return NO;
|
||||
|
||||
// compare the redirectURI, which tells us when the web sign-in is done,
|
||||
// to the actual redirection
|
||||
NSURL *redirectURL = [NSURL URLWithString:redirectURI];
|
||||
NSURL *requestURL = [redirectedRequest URL];
|
||||
|
||||
// avoid comparing to nil host and path values (such as when redirected to
|
||||
// "about:blank")
|
||||
NSString *requestHost = [requestURL host];
|
||||
NSString *requestPath = [requestURL path];
|
||||
BOOL isCallback;
|
||||
if (requestHost && requestPath) {
|
||||
isCallback = [[redirectURL host] isEqual:[requestURL host]]
|
||||
&& [[redirectURL path] isEqual:[requestURL path]];
|
||||
} else if (requestURL) {
|
||||
// handle "about:blank"
|
||||
isCallback = [redirectURL isEqual:requestURL];
|
||||
} else {
|
||||
isCallback = NO;
|
||||
}
|
||||
|
||||
if (!isCallback) {
|
||||
// tell the caller that this request is nothing interesting
|
||||
return NO;
|
||||
}
|
||||
|
||||
// we've reached the callback URL
|
||||
|
||||
// try to get the access code
|
||||
if (!self.hasHandledCallback) {
|
||||
NSString *responseStr = [[redirectedRequest URL] query];
|
||||
[self.authentication setKeysForResponseString:responseStr];
|
||||
|
||||
#if DEBUG
|
||||
NSAssert([self.authentication.code length] > 0
|
||||
|| [self.authentication.errorString length] > 0,
|
||||
@"response lacks auth code or error");
|
||||
#endif
|
||||
|
||||
[self authCodeObtained];
|
||||
}
|
||||
// tell the delegate that we did handle this request
|
||||
return YES;
|
||||
}
|
||||
|
||||
// entry point for the window controller to tell us when a new page title has
|
||||
// been loadded
|
||||
//
|
||||
// When the title indicates sign-in has completed, this method invokes
|
||||
// authCodeObtained and returns YES
|
||||
- (BOOL)titleChanged:(NSString *)title {
|
||||
// return YES if the OAuth flow ending title was detected
|
||||
|
||||
// right now we're just looking for a parameter list following the last space
|
||||
// in the title string, but hopefully we'll eventually get something better
|
||||
// from the server to search for
|
||||
NSRange paramsRange = [title rangeOfString:@" "
|
||||
options:NSBackwardsSearch];
|
||||
NSUInteger spaceIndex = paramsRange.location;
|
||||
if (spaceIndex != NSNotFound) {
|
||||
NSString *responseStr = [title substringFromIndex:(spaceIndex + 1)];
|
||||
|
||||
NSDictionary *dict = [GTMOAuth2Authentication dictionaryWithResponseString:responseStr];
|
||||
|
||||
NSString *code = [dict objectForKey:@"code"];
|
||||
NSString *error = [dict objectForKey:@"error"];
|
||||
if ([code length] > 0 || [error length] > 0) {
|
||||
|
||||
if (!self.hasHandledCallback) {
|
||||
[self.authentication setKeysForResponseDictionary:dict];
|
||||
|
||||
[self authCodeObtained];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)cookiesChanged:(NSHTTPCookieStorage *)cookieStorage {
|
||||
// We're ignoring these.
|
||||
return NO;
|
||||
};
|
||||
|
||||
// entry point for the window controller to tell us when a load has failed
|
||||
// in the webview
|
||||
//
|
||||
// if the initial authorization URL fails, bail out so the user doesn't
|
||||
// see an empty webview
|
||||
- (BOOL)loadFailedWithError:(NSError *)error {
|
||||
NSURL *authorizationURL = self.authorizationURL;
|
||||
NSURL *failedURL = [[error userInfo] valueForKey:@"NSErrorFailingURLKey"]; // NSURLErrorFailingURLErrorKey defined in 10.6
|
||||
|
||||
BOOL isAuthURL = [[failedURL host] isEqual:[authorizationURL host]]
|
||||
&& [[failedURL path] isEqual:[authorizationURL path]];
|
||||
|
||||
if (isAuthURL) {
|
||||
// We can assume that we have no pending fetchers, since we only
|
||||
// handle failure to load the initial authorization URL
|
||||
[self closeTheWindow];
|
||||
[self invokeFinalCallbackWithError:error];
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)authCodeObtained {
|
||||
// the callback page was requested, or the authenticate code was loaded
|
||||
// into a page's title, so exchange the auth code for access & refresh tokens
|
||||
// and tell the window to close
|
||||
|
||||
// avoid duplicate signals that the callback point has been reached
|
||||
self.hasHandledCallback = YES;
|
||||
|
||||
// If the signin was request for exchanging an authentication token to a
|
||||
// refresh token, there is no window to close.
|
||||
if (self.webRequestSelector) {
|
||||
[self closeTheWindow];
|
||||
} else {
|
||||
// For signing in to Google, append the scope for obtaining the
|
||||
// authenticated user email and profile, as appropriate. This is usually
|
||||
// done by the startSigningIn method, but this method is not called when
|
||||
// exchanging an authentication token for a refresh token.
|
||||
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
|
||||
[self addScopeForGoogleUserInfo];
|
||||
#endif
|
||||
}
|
||||
|
||||
NSError *error = nil;
|
||||
|
||||
GTMOAuth2Authentication *auth = self.authentication;
|
||||
NSString *code = auth.code;
|
||||
if ([code length] > 0) {
|
||||
// exchange the code for a token
|
||||
SEL sel = @selector(auth:finishedWithFetcher:error:);
|
||||
GTMHTTPFetcher *fetcher = [auth beginTokenFetchWithDelegate:self
|
||||
didFinishSelector:sel];
|
||||
if (fetcher == nil) {
|
||||
error = [NSError errorWithDomain:kGTMHTTPFetcherStatusDomain
|
||||
code:-1
|
||||
userInfo:nil];
|
||||
} else {
|
||||
self.pendingFetcher = fetcher;
|
||||
}
|
||||
|
||||
// notify the app so it can put up a post-sign in, pre-token exchange UI
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
[nc postNotificationName:kGTMOAuth2UserSignedIn
|
||||
object:self
|
||||
userInfo:nil];
|
||||
} else {
|
||||
// the callback lacked an auth code
|
||||
NSString *errStr = auth.errorString;
|
||||
NSDictionary *userInfo = nil;
|
||||
if ([errStr length] > 0) {
|
||||
userInfo = [NSDictionary dictionaryWithObject:errStr
|
||||
forKey:kGTMOAuth2ErrorMessageKey];
|
||||
}
|
||||
|
||||
error = [NSError errorWithDomain:kGTMOAuth2ErrorDomain
|
||||
code:kGTMOAuth2ErrorAuthorizationFailed
|
||||
userInfo:userInfo];
|
||||
}
|
||||
|
||||
if (error) {
|
||||
[self finishSignInWithError:error];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)auth:(GTMOAuth2Authentication *)auth
|
||||
finishedWithFetcher:(GTMHTTPFetcher *)fetcher
|
||||
error:(NSError *)error {
|
||||
self.pendingFetcher = nil;
|
||||
|
||||
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
|
||||
if (error == nil
|
||||
&& (self.shouldFetchGoogleUserEmail || self.shouldFetchGoogleUserProfile)
|
||||
&& [self.authentication.serviceProvider isEqual:kGTMOAuth2ServiceProviderGoogle]) {
|
||||
// fetch the user's information from the Google server
|
||||
[self fetchGoogleUserInfo];
|
||||
} else {
|
||||
// we're not authorizing with Google, so we're done
|
||||
[self finishSignInWithError:error];
|
||||
}
|
||||
#else
|
||||
[self finishSignInWithError:error];
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
|
||||
+ (GTMHTTPFetcher *)userInfoFetcherWithAuth:(GTMOAuth2Authentication *)auth {
|
||||
// create a fetcher for obtaining the user's email or profile
|
||||
NSURL *infoURL = [[self class] googleUserInfoURL];
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:infoURL];
|
||||
|
||||
NSString *userAgent = [auth userAgent];
|
||||
[request setValue:userAgent forHTTPHeaderField:@"User-Agent"];
|
||||
[request setValue:@"no-cache" forHTTPHeaderField:@"Cache-Control"];
|
||||
|
||||
GTMHTTPFetcher *fetcher;
|
||||
id <GTMHTTPFetcherServiceProtocol> fetcherService = auth.fetcherService;
|
||||
if (fetcherService) {
|
||||
fetcher = [fetcherService fetcherWithRequest:request];
|
||||
} else {
|
||||
fetcher = [GTMHTTPFetcher fetcherWithRequest:request];
|
||||
}
|
||||
fetcher.authorizer = auth;
|
||||
fetcher.retryEnabled = YES;
|
||||
fetcher.maxRetryInterval = 15.0;
|
||||
fetcher.comment = @"user info";
|
||||
return fetcher;
|
||||
}
|
||||
|
||||
- (void)fetchGoogleUserInfo {
|
||||
// fetch the user's email address or profile
|
||||
GTMOAuth2Authentication *auth = self.authentication;
|
||||
GTMHTTPFetcher *fetcher = [[self class] userInfoFetcherWithAuth:auth];
|
||||
[fetcher beginFetchWithDelegate:self
|
||||
didFinishSelector:@selector(infoFetcher:finishedWithData:error:)];
|
||||
|
||||
self.pendingFetcher = fetcher;
|
||||
|
||||
[auth notifyFetchIsRunning:YES
|
||||
fetcher:fetcher
|
||||
type:kGTMOAuth2FetchTypeUserInfo];
|
||||
}
|
||||
|
||||
- (void)infoFetcher:(GTMHTTPFetcher *)fetcher
|
||||
finishedWithData:(NSData *)data
|
||||
error:(NSError *)error {
|
||||
GTMOAuth2Authentication *auth = self.authentication;
|
||||
[auth notifyFetchIsRunning:NO
|
||||
fetcher:fetcher
|
||||
type:nil];
|
||||
|
||||
self.pendingFetcher = nil;
|
||||
|
||||
if (error) {
|
||||
#if DEBUG
|
||||
if (data) {
|
||||
NSString *dataStr = [[[NSString alloc] initWithData:data
|
||||
encoding:NSUTF8StringEncoding] autorelease];
|
||||
NSLog(@"infoFetcher error: %@\n%@", error, dataStr);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
// We have the authenticated user's info
|
||||
if (data) {
|
||||
NSDictionary *profileDict = [auth dictionaryWithJSONData:data];
|
||||
if (profileDict) {
|
||||
self.userProfile = profileDict;
|
||||
|
||||
// Save the ID into the auth object
|
||||
NSString *identifier = [profileDict objectForKey:@"id"];
|
||||
[auth setUserID:identifier];
|
||||
|
||||
// Save the email into the auth object
|
||||
NSString *email = [profileDict objectForKey:@"email"];
|
||||
[auth setUserEmail:email];
|
||||
|
||||
NSNumber *verified = [profileDict objectForKey:@"verified_email"];
|
||||
[auth setUserEmailIsVerified:[verified stringValue]];
|
||||
}
|
||||
}
|
||||
}
|
||||
[self finishSignInWithError:error];
|
||||
}
|
||||
|
||||
#endif // !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
|
||||
|
||||
- (void)finishSignInWithError:(NSError *)error {
|
||||
[self invokeFinalCallbackWithError:error];
|
||||
}
|
||||
|
||||
// convenience method for making the final call to our delegate
|
||||
- (void)invokeFinalCallbackWithError:(NSError *)error {
|
||||
if (delegate_ && finishedSelector_) {
|
||||
GTMOAuth2Authentication *auth = self.authentication;
|
||||
|
||||
NSMethodSignature *sig = [delegate_ methodSignatureForSelector:finishedSelector_];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:sig];
|
||||
[invocation setSelector:finishedSelector_];
|
||||
[invocation setTarget:delegate_];
|
||||
[invocation setArgument:&self atIndex:2];
|
||||
[invocation setArgument:&auth atIndex:3];
|
||||
[invocation setArgument:&error atIndex:4];
|
||||
[invocation invoke];
|
||||
}
|
||||
|
||||
// we'll no longer send messages to the delegate
|
||||
//
|
||||
// we want to autorelease it rather than assign to the property in case
|
||||
// the delegate is below us in the call stack
|
||||
[delegate_ autorelease];
|
||||
delegate_ = nil;
|
||||
}
|
||||
|
||||
#pragma mark Reachability monitoring
|
||||
|
||||
static void ReachabilityCallBack(SCNetworkReachabilityRef target,
|
||||
SCNetworkConnectionFlags flags,
|
||||
void *info) {
|
||||
// pass the flags to the signIn object
|
||||
GTMOAuth2SignIn *signIn = (GTMOAuth2SignIn *)info;
|
||||
|
||||
[signIn reachabilityTarget:target
|
||||
changedFlags:flags];
|
||||
}
|
||||
|
||||
- (void)startReachabilityCheck {
|
||||
// the user may set the timeout to 0 to skip the reachability checking
|
||||
// during display of the sign-in page
|
||||
if (networkLossTimeoutInterval_ <= 0.0 || reachabilityRef_ != NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
// create a reachability target from the authorization URL, add our callback,
|
||||
// and schedule it on the run loop so we'll be notified if the network drops
|
||||
NSURL *url = self.authorizationURL;
|
||||
const char* host = [[url host] UTF8String];
|
||||
reachabilityRef_ = SCNetworkReachabilityCreateWithName(kCFAllocatorSystemDefault,
|
||||
host);
|
||||
if (reachabilityRef_) {
|
||||
BOOL isScheduled = NO;
|
||||
SCNetworkReachabilityContext ctx = { 0, self, NULL, NULL, NULL };
|
||||
|
||||
if (SCNetworkReachabilitySetCallback(reachabilityRef_,
|
||||
ReachabilityCallBack, &ctx)) {
|
||||
if (SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef_,
|
||||
CFRunLoopGetCurrent(),
|
||||
kCFRunLoopDefaultMode)) {
|
||||
isScheduled = YES;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isScheduled) {
|
||||
CFRelease(reachabilityRef_);
|
||||
reachabilityRef_ = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)destroyUnreachabilityTimer {
|
||||
[networkLossTimer_ invalidate];
|
||||
[networkLossTimer_ autorelease];
|
||||
networkLossTimer_ = nil;
|
||||
}
|
||||
|
||||
- (void)reachabilityTarget:(SCNetworkReachabilityRef)reachabilityRef
|
||||
changedFlags:(SCNetworkConnectionFlags)flags {
|
||||
BOOL isConnected = (flags & kSCNetworkFlagsReachable) != 0
|
||||
&& (flags & kSCNetworkFlagsConnectionRequired) == 0;
|
||||
|
||||
if (isConnected) {
|
||||
// server is again reachable
|
||||
[self destroyUnreachabilityTimer];
|
||||
|
||||
if (hasNotifiedNetworkLoss_) {
|
||||
// tell the user that the network has been found
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
[nc postNotificationName:kGTMOAuth2NetworkFound
|
||||
object:self
|
||||
userInfo:nil];
|
||||
hasNotifiedNetworkLoss_ = NO;
|
||||
}
|
||||
} else {
|
||||
// the server has become unreachable; start the timer, if necessary
|
||||
if (networkLossTimer_ == nil
|
||||
&& networkLossTimeoutInterval_ > 0
|
||||
&& !hasNotifiedNetworkLoss_) {
|
||||
SEL sel = @selector(reachabilityTimerFired:);
|
||||
networkLossTimer_ = [[NSTimer scheduledTimerWithTimeInterval:networkLossTimeoutInterval_
|
||||
target:self
|
||||
selector:sel
|
||||
userInfo:nil
|
||||
repeats:NO] retain];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)reachabilityTimerFired:(NSTimer *)timer {
|
||||
// the user may call [[notification object] cancelSigningIn] to
|
||||
// dismiss the sign-in
|
||||
if (!hasNotifiedNetworkLoss_) {
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
[nc postNotificationName:kGTMOAuth2NetworkLost
|
||||
object:self
|
||||
userInfo:nil];
|
||||
hasNotifiedNetworkLoss_ = YES;
|
||||
}
|
||||
|
||||
[self destroyUnreachabilityTimer];
|
||||
}
|
||||
|
||||
- (void)stopReachabilityCheck {
|
||||
[self destroyUnreachabilityTimer];
|
||||
|
||||
if (reachabilityRef_) {
|
||||
SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityRef_,
|
||||
CFRunLoopGetCurrent(),
|
||||
kCFRunLoopDefaultMode);
|
||||
SCNetworkReachabilitySetCallback(reachabilityRef_, NULL, NULL);
|
||||
|
||||
CFRelease(reachabilityRef_);
|
||||
reachabilityRef_ = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark Token Revocation
|
||||
|
||||
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
|
||||
+ (void)revokeTokenForGoogleAuthentication:(GTMOAuth2Authentication *)auth {
|
||||
if (auth.refreshToken != nil
|
||||
&& auth.canAuthorize
|
||||
&& [auth.serviceProvider isEqual:kGTMOAuth2ServiceProviderGoogle]) {
|
||||
|
||||
// create a signed revocation request for this authentication object
|
||||
NSURL *url = [self googleRevocationURL];
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
|
||||
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
|
||||
|
||||
NSString *token = auth.refreshToken;
|
||||
NSString *encoded = [GTMOAuth2Authentication encodedOAuthValueForString:token];
|
||||
if (encoded != nil) {
|
||||
NSString *body = [@"token=" stringByAppendingString:encoded];
|
||||
|
||||
[request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
[request setHTTPMethod:@"POST"];
|
||||
|
||||
NSString *userAgent = [auth userAgent];
|
||||
[request setValue:userAgent forHTTPHeaderField:@"User-Agent"];
|
||||
|
||||
// there's nothing to be done if revocation succeeds or fails
|
||||
GTMHTTPFetcher *fetcher;
|
||||
id <GTMHTTPFetcherServiceProtocol> fetcherService = auth.fetcherService;
|
||||
if (fetcherService) {
|
||||
fetcher = [fetcherService fetcherWithRequest:request];
|
||||
} else {
|
||||
fetcher = [GTMHTTPFetcher fetcherWithRequest:request];
|
||||
}
|
||||
fetcher.comment = @"revoke token";
|
||||
|
||||
// Use a completion handler fetch for better debugging, but only if we're
|
||||
// guaranteed that blocks are available in the runtime
|
||||
#if (!TARGET_OS_IPHONE && (MAC_OS_X_VERSION_MIN_REQUIRED >= 1060)) || \
|
||||
(TARGET_OS_IPHONE && (__IPHONE_OS_VERSION_MIN_REQUIRED >= 40000))
|
||||
// Blocks are available
|
||||
[fetcher beginFetchWithCompletionHandler:^(NSData *data, NSError *error) {
|
||||
#if DEBUG
|
||||
if (error) {
|
||||
NSString *errStr = [[[NSString alloc] initWithData:data
|
||||
encoding:NSUTF8StringEncoding] autorelease];
|
||||
NSLog(@"revoke error: %@", errStr);
|
||||
}
|
||||
#endif // DEBUG
|
||||
}];
|
||||
#else
|
||||
// Blocks may not be available
|
||||
[fetcher beginFetchWithDelegate:nil didFinishSelector:NULL];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
[auth reset];
|
||||
}
|
||||
#endif // !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
|
||||
|
||||
@end
|
||||
|
||||
#endif // #if GTM_INCLUDE_OAUTH2 || !GDATA_REQUIRE_SERVICE_INCLUDES
|
|
@ -0,0 +1,361 @@
|
|||
/* 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;
|
||||
|
||||
@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
|
||||
void (^completionBlock_)(GTMOAuth2ViewControllerTouch *, GTMOAuth2Authentication *, NSError *);
|
||||
|
||||
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 10 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:(void (^)(GTMOAuth2ViewControllerTouch *viewController, GTMOAuth2Authentication *auth, NSError *error))handler;
|
||||
|
||||
- (id)initWithScope:(NSString *)scope
|
||||
clientID:(NSString *)clientID
|
||||
clientSecret:(NSString *)clientSecret
|
||||
keychainItemName:(NSString *)keychainItemName
|
||||
completionHandler:(void (^)(GTMOAuth2ViewControllerTouch *viewController, GTMOAuth2Authentication *auth, NSError *error))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:(void (^)(GTMOAuth2ViewControllerTouch *viewController, GTMOAuth2Authentication *auth, NSError *error))handler;
|
||||
|
||||
- (id)initWithAuthentication:(GTMOAuth2Authentication *)auth
|
||||
authorizationURL:(NSURL *)authorizationURL
|
||||
keychainItemName:(NSString *)keychainItemName
|
||||
completionHandler:(void (^)(GTMOAuth2ViewControllerTouch *viewController, GTMOAuth2Authentication *auth, NSError *error))handler;
|
||||
#endif
|
||||
|
||||
// subclasses may override authNibName to specify a custom name
|
||||
+ (NSString *)authNibName;
|
||||
|
||||
// subclasses may override authNibBundle to specify a custom bundle
|
||||
+ (NSBundle *)authNibBundle;
|
||||
|
||||
// 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
|
1035
iphone/Maps/GooglePlusSDK/OpenSource/GTMOAuth2ViewControllerTouch.m
Normal file
1035
iphone/Maps/GooglePlusSDK/OpenSource/GTMOAuth2ViewControllerTouch.m
Normal file
File diff suppressed because it is too large
Load diff
494
iphone/Maps/GooglePlusSDK/OpenSource/GTMOAuth2ViewTouch.xib
Normal file
494
iphone/Maps/GooglePlusSDK/OpenSource/GTMOAuth2ViewTouch.xib
Normal file
|
@ -0,0 +1,494 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1024</int>
|
||||
<string key="IBDocument.SystemVersion">12C60</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">2840</string>
|
||||
<string key="IBDocument.AppKitVersion">1187.34</string>
|
||||
<string key="IBDocument.HIToolboxVersion">625.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="NS.object.0">1926</string>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>IBProxyObject</string>
|
||||
<string>IBUIActivityIndicatorView</string>
|
||||
<string>IBUIBarButtonItem</string>
|
||||
<string>IBUIButton</string>
|
||||
<string>IBUINavigationItem</string>
|
||||
<string>IBUIView</string>
|
||||
<string>IBUIWebView</string>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
|
||||
<integer value="1" key="NS.object.0"/>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBProxyObject" id="372490531">
|
||||
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBProxyObject" id="975951072">
|
||||
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUINavigationItem" id="1047805472">
|
||||
<string key="IBUITitle">OAuth</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUIBarButtonItem" id="961671599">
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<int key="IBUIStyle">1</int>
|
||||
</object>
|
||||
<object class="IBUIView" id="808907889">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBUIButton" id="453250804">
|
||||
<reference key="NSNextResponder" ref="808907889"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrameSize">{30, 30}</string>
|
||||
<reference key="NSSuperview" ref="808907889"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="981703116"/>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<int key="IBUIContentHorizontalAlignment">0</int>
|
||||
<int key="IBUIContentVerticalAlignment">0</int>
|
||||
<string key="IBUITitleShadowOffset">{0, -2}</string>
|
||||
<string key="IBUINormalTitle">◀</string>
|
||||
<object class="NSColor" key="IBUIHighlightedTitleColor" id="193465259">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
</object>
|
||||
<object class="NSColor" key="IBUIDisabledTitleColor">
|
||||
<int key="NSColorSpace">2</int>
|
||||
<bytes key="NSRGB">MC41OTYwNzg0NiAwLjY4NjI3NDUzIDAuOTUyOTQxMjQgMC42MDAwMDAwMgA</bytes>
|
||||
</object>
|
||||
<reference key="IBUINormalTitleColor" ref="193465259"/>
|
||||
<object class="NSColor" key="IBUINormalTitleShadowColor" id="999379443">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MC41AA</bytes>
|
||||
</object>
|
||||
<object class="IBUIFontDescription" key="IBUIFontDescription" id="621440819">
|
||||
<string key="name">Helvetica-Bold</string>
|
||||
<string key="family">Helvetica</string>
|
||||
<int key="traits">2</int>
|
||||
<double key="pointSize">24</double>
|
||||
</object>
|
||||
<object class="NSFont" key="IBUIFont" id="530402572">
|
||||
<string key="NSName">Helvetica-Bold</string>
|
||||
<double key="NSSize">24</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUIButton" id="981703116">
|
||||
<reference key="NSNextResponder" ref="808907889"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{30, 0}, {30, 30}}</string>
|
||||
<reference key="NSSuperview" ref="808907889"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<int key="IBUIContentHorizontalAlignment">0</int>
|
||||
<int key="IBUIContentVerticalAlignment">0</int>
|
||||
<string key="IBUITitleShadowOffset">{0, -2}</string>
|
||||
<string key="IBUINormalTitle">▶</string>
|
||||
<reference key="IBUIHighlightedTitleColor" ref="193465259"/>
|
||||
<object class="NSColor" key="IBUIDisabledTitleColor">
|
||||
<int key="NSColorSpace">2</int>
|
||||
<bytes key="NSRGB">MC41ODQzMTM3NSAwLjY3NDUwOTgyIDAuOTUyOTQxMjQgMC42MDAwMDAwMgA</bytes>
|
||||
</object>
|
||||
<reference key="IBUINormalTitleColor" ref="193465259"/>
|
||||
<reference key="IBUINormalTitleShadowColor" ref="999379443"/>
|
||||
<reference key="IBUIFontDescription" ref="621440819"/>
|
||||
<reference key="IBUIFont" ref="530402572"/>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{60, 30}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="453250804"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MSAwAA</bytes>
|
||||
</object>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
|
||||
<object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
|
||||
<int key="IBUIInterfaceOrientation">3</int>
|
||||
<int key="interfaceOrientation">3</int>
|
||||
</object>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUIView" id="426018584">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBUIWebView" id="663477729">
|
||||
<reference key="NSNextResponder" ref="426018584"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<string key="NSFrameSize">{320, 460}</string>
|
||||
<reference key="NSSuperview" ref="426018584"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="268967673"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MSAxIDEAA</bytes>
|
||||
</object>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<bool key="IBUIMultipleTouchEnabled">YES</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<int key="IBUIDataDetectorTypes">1</int>
|
||||
<bool key="IBUIDetectsPhoneNumbers">YES</bool>
|
||||
</object>
|
||||
<object class="IBUIActivityIndicatorView" id="268967673">
|
||||
<reference key="NSNextResponder" ref="426018584"/>
|
||||
<int key="NSvFlags">301</int>
|
||||
<string key="NSFrame">{{150, 115}, {20, 20}}</string>
|
||||
<reference key="NSSuperview" ref="426018584"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<bool key="IBUIHidesWhenStopped">NO</bool>
|
||||
<bool key="IBUIAnimating">YES</bool>
|
||||
<int key="IBUIStyle">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{320, 460}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="663477729"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
<object class="NSColorSpace" key="NSCustomColorSpace">
|
||||
<int key="NSID">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<object class="NSMutableArray" key="connectionRecords">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">rightBarButtonItem</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="961671599"/>
|
||||
</object>
|
||||
<int key="connectionID">20</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">navButtonsView</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="808907889"/>
|
||||
</object>
|
||||
<int key="connectionID">22</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">backButton</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="453250804"/>
|
||||
</object>
|
||||
<int key="connectionID">25</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">forwardButton</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="981703116"/>
|
||||
</object>
|
||||
<int key="connectionID">26</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">view</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="426018584"/>
|
||||
</object>
|
||||
<int key="connectionID">28</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">webView</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="663477729"/>
|
||||
</object>
|
||||
<int key="connectionID">29</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">initialActivityIndicator</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="268967673"/>
|
||||
</object>
|
||||
<int key="connectionID">33</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
<reference key="source" ref="663477729"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
</object>
|
||||
<int key="connectionID">9</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">rightBarButtonItem</string>
|
||||
<reference key="source" ref="1047805472"/>
|
||||
<reference key="destination" ref="961671599"/>
|
||||
</object>
|
||||
<int key="connectionID">14</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">goBack</string>
|
||||
<reference key="source" ref="453250804"/>
|
||||
<reference key="destination" ref="663477729"/>
|
||||
<int key="IBEventType">7</int>
|
||||
</object>
|
||||
<int key="connectionID">18</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">goForward</string>
|
||||
<reference key="source" ref="981703116"/>
|
||||
<reference key="destination" ref="663477729"/>
|
||||
<int key="IBEventType">7</int>
|
||||
</object>
|
||||
<int key="connectionID">19</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<object class="NSArray" key="orderedObjects">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">0</int>
|
||||
<object class="NSArray" key="object" id="0">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<reference key="children" ref="1000"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-1</int>
|
||||
<reference key="object" ref="372490531"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">File's Owner</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-2</int>
|
||||
<reference key="object" ref="975951072"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">6</int>
|
||||
<reference key="object" ref="1047805472"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">10</int>
|
||||
<reference key="object" ref="961671599"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">15</int>
|
||||
<reference key="object" ref="808907889"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="453250804"/>
|
||||
<reference ref="981703116"/>
|
||||
</object>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">16</int>
|
||||
<reference key="object" ref="453250804"/>
|
||||
<reference key="parent" ref="808907889"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">17</int>
|
||||
<reference key="object" ref="981703116"/>
|
||||
<reference key="parent" ref="808907889"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">27</int>
|
||||
<reference key="object" ref="426018584"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="663477729"/>
|
||||
<reference ref="268967673"/>
|
||||
</object>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">4</int>
|
||||
<reference key="object" ref="663477729"/>
|
||||
<reference key="parent" ref="426018584"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">31</int>
|
||||
<reference key="object" ref="268967673"/>
|
||||
<reference key="parent" ref="426018584"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="flattenedProperties">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>-1.CustomClassName</string>
|
||||
<string>-1.IBPluginDependency</string>
|
||||
<string>-2.CustomClassName</string>
|
||||
<string>-2.IBPluginDependency</string>
|
||||
<string>10.IBPluginDependency</string>
|
||||
<string>15.IBPluginDependency</string>
|
||||
<string>16.IBPluginDependency</string>
|
||||
<string>17.IBPluginDependency</string>
|
||||
<string>27.IBPluginDependency</string>
|
||||
<string>31.IBPluginDependency</string>
|
||||
<string>4.IBPluginDependency</string>
|
||||
<string>6.IBPluginDependency</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>GTMOAuth2ViewControllerTouch</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>UIResponder</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="unlocalizedProperties">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference key="dict.sortedKeys" ref="0"/>
|
||||
<reference key="dict.values" ref="0"/>
|
||||
</object>
|
||||
<nil key="activeLocalization"/>
|
||||
<object class="NSMutableDictionary" key="localizations">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference key="dict.sortedKeys" ref="0"/>
|
||||
<reference key="dict.values" ref="0"/>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">33</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">GTMOAuth2ViewControllerTouch</string>
|
||||
<string key="superclassName">UIViewController</string>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>backButton</string>
|
||||
<string>forwardButton</string>
|
||||
<string>initialActivityIndicator</string>
|
||||
<string>navButtonsView</string>
|
||||
<string>rightBarButtonItem</string>
|
||||
<string>webView</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>UIButton</string>
|
||||
<string>UIButton</string>
|
||||
<string>UIActivityIndicatorView</string>
|
||||
<string>UIView</string>
|
||||
<string>UIBarButtonItem</string>
|
||||
<string>UIWebView</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>backButton</string>
|
||||
<string>forwardButton</string>
|
||||
<string>initialActivityIndicator</string>
|
||||
<string>navButtonsView</string>
|
||||
<string>rightBarButtonItem</string>
|
||||
<string>webView</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">backButton</string>
|
||||
<string key="candidateClassName">UIButton</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">forwardButton</string>
|
||||
<string key="candidateClassName">UIButton</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">initialActivityIndicator</string>
|
||||
<string key="candidateClassName">UIActivityIndicatorView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">navButtonsView</string>
|
||||
<string key="candidateClassName">UIView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">rightBarButtonItem</string>
|
||||
<string key="candidateClassName">UIBarButtonItem</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">webView</string>
|
||||
<string key="candidateClassName">UIWebView</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/GTMOAuth2ViewControllerTouch.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
|
||||
<real value="1024" key="NS.object.0"/>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
|
||||
<real value="1536" key="NS.object.0"/>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
|
||||
<integer value="3000" key="NS.object.0"/>
|
||||
</object>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<string key="IBCocoaTouchPluginVersion">1926</string>
|
||||
</data>
|
||||
</archive>
|
113
iphone/Maps/GooglePlusSDK/OpenSource/GTMObjC2Runtime.h
Normal file
113
iphone/Maps/GooglePlusSDK/OpenSource/GTMObjC2Runtime.h
Normal 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)
|
163
iphone/Maps/GooglePlusSDK/OpenSource/GTMObjC2Runtime.m
Normal file
163
iphone/Maps/GooglePlusSDK/OpenSource/GTMObjC2Runtime.m
Normal file
|
@ -0,0 +1,163 @@
|
|||
//
|
||||
// GTMObjC2Runtime.m
|
||||
//
|
||||
// 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 "GTMObjC2Runtime.h"
|
||||
|
||||
#if GTM_MACOS_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
|
||||
#import <stdlib.h>
|
||||
#import <string.h>
|
||||
|
||||
Class object_getClass(id obj) {
|
||||
if (!obj) return NULL;
|
||||
return obj->isa;
|
||||
}
|
||||
|
||||
const char *class_getName(Class cls) {
|
||||
if (!cls) return "nil";
|
||||
return cls->name;
|
||||
}
|
||||
|
||||
BOOL class_conformsToProtocol(Class cls, Protocol *protocol) {
|
||||
// We intentionally don't check cls as it crashes on Leopard so we want
|
||||
// to crash on Tiger as well.
|
||||
// I logged
|
||||
// Radar 5572978 class_conformsToProtocol crashes when arg1 is passed as nil
|
||||
// because it seems odd that this API won't accept nil for cls considering
|
||||
// all the other apis will accept nil args.
|
||||
// If this does get fixed, remember to enable the unit tests.
|
||||
if (!protocol) return NO;
|
||||
|
||||
struct objc_protocol_list *protos;
|
||||
for (protos = cls->protocols; protos != NULL; protos = protos->next) {
|
||||
for (long i = 0; i < protos->count; i++) {
|
||||
if ([protos->list[i] conformsTo:protocol]) {
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
Class class_getSuperclass(Class cls) {
|
||||
if (!cls) return NULL;
|
||||
return cls->super_class;
|
||||
}
|
||||
|
||||
BOOL class_respondsToSelector(Class cls, SEL sel) {
|
||||
return class_getInstanceMethod(cls, sel) != nil;
|
||||
}
|
||||
|
||||
Method *class_copyMethodList(Class cls, unsigned int *outCount) {
|
||||
if (!cls) return NULL;
|
||||
|
||||
unsigned int count = 0;
|
||||
void *iterator = NULL;
|
||||
struct objc_method_list *mlist;
|
||||
Method *methods = NULL;
|
||||
if (outCount) *outCount = 0;
|
||||
|
||||
while ( (mlist = class_nextMethodList(cls, &iterator)) ) {
|
||||
if (mlist->method_count == 0) continue;
|
||||
methods = (Method *)realloc(methods,
|
||||
sizeof(Method) * (count + mlist->method_count + 1));
|
||||
if (!methods) {
|
||||
//Memory alloc failed, so what can we do?
|
||||
return NULL; // COV_NF_LINE
|
||||
}
|
||||
for (int i = 0; i < mlist->method_count; i++) {
|
||||
methods[i + count] = &mlist->method_list[i];
|
||||
}
|
||||
count += mlist->method_count;
|
||||
}
|
||||
|
||||
// List must be NULL terminated
|
||||
if (methods) {
|
||||
methods[count] = NULL;
|
||||
}
|
||||
if (outCount) *outCount = count;
|
||||
return methods;
|
||||
}
|
||||
|
||||
SEL method_getName(Method method) {
|
||||
if (!method) return NULL;
|
||||
return method->method_name;
|
||||
}
|
||||
|
||||
IMP method_getImplementation(Method method) {
|
||||
if (!method) return NULL;
|
||||
return method->method_imp;
|
||||
}
|
||||
|
||||
IMP method_setImplementation(Method method, IMP imp) {
|
||||
// We intentionally don't test method for nil.
|
||||
// Leopard fails here, so should we.
|
||||
// I logged this as Radar:
|
||||
// 5572981 method_setImplementation crashes if you pass nil for the
|
||||
// method arg (arg 1)
|
||||
// because it seems odd that this API won't accept nil for method considering
|
||||
// all the other apis will accept nil args.
|
||||
// If this does get fixed, remember to enable the unit tests.
|
||||
// This method works differently on SnowLeopard than
|
||||
// on Leopard. If you pass in a nil for IMP on SnowLeopard
|
||||
// it doesn't change anything. On Leopard it will. Since
|
||||
// attempting to change a sel to nil is probably an error
|
||||
// we follow the SnowLeopard way of doing things.
|
||||
IMP oldImp = NULL;
|
||||
if (imp) {
|
||||
oldImp = method->method_imp;
|
||||
method->method_imp = imp;
|
||||
}
|
||||
return oldImp;
|
||||
}
|
||||
|
||||
void method_exchangeImplementations(Method m1, Method m2) {
|
||||
if (m1 == m2) return;
|
||||
if (!m1 || !m2) return;
|
||||
IMP imp2 = method_getImplementation(m2);
|
||||
IMP imp1 = method_setImplementation(m1, imp2);
|
||||
method_setImplementation(m2, imp1);
|
||||
}
|
||||
|
||||
struct objc_method_description protocol_getMethodDescription(Protocol *p,
|
||||
SEL aSel,
|
||||
BOOL isRequiredMethod,
|
||||
BOOL isInstanceMethod) {
|
||||
struct objc_method_description *descPtr = NULL;
|
||||
// No such thing as required in ObjC1.
|
||||
if (isInstanceMethod) {
|
||||
descPtr = [p descriptionForInstanceMethod:aSel];
|
||||
} else {
|
||||
descPtr = [p descriptionForClassMethod:aSel];
|
||||
}
|
||||
|
||||
struct objc_method_description desc;
|
||||
if (descPtr) {
|
||||
desc = *descPtr;
|
||||
} else {
|
||||
bzero(&desc, sizeof(desc));
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
BOOL sel_isEqual(SEL lhs, SEL rhs) {
|
||||
// Apple (informally) promises this will work in the future:
|
||||
// http://twitter.com/#!/gparker/status/2400099786
|
||||
return (lhs == rhs) ? YES : NO;
|
||||
}
|
||||
|
||||
#endif // GTM_MACOS_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
|
|
@ -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
|
135
iphone/Maps/GooglePlusSDK/OpenSource/OpenInChromeController.m
Normal file
135
iphone/Maps/GooglePlusSDK/OpenSource/OpenInChromeController.m
Normal file
|
@ -0,0 +1,135 @@
|
|||
// 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 <UIKit/UIKit.h>
|
||||
|
||||
#import "OpenInChromeController.h"
|
||||
|
||||
static NSString * const kGoogleChromeHTTPScheme = @"googlechrome:";
|
||||
static NSString * const kGoogleChromeHTTPSScheme = @"googlechromes:";
|
||||
static NSString * const kGoogleChromeCallbackScheme =
|
||||
@"googlechrome-x-callback:";
|
||||
|
||||
static NSString * encodeByAddingPercentEscapes(NSString *input) {
|
||||
NSString *encodedValue =
|
||||
(NSString *)CFURLCreateStringByAddingPercentEscapes(
|
||||
kCFAllocatorDefault,
|
||||
(CFStringRef)input,
|
||||
NULL,
|
||||
(CFStringRef)@"!*'();:@&=+$,/?%#[]",
|
||||
kCFStringEncodingUTF8);
|
||||
return [encodedValue autorelease];
|
||||
}
|
||||
|
||||
@implementation OpenInChromeController
|
||||
|
||||
+ (OpenInChromeController *)sharedInstance {
|
||||
static OpenInChromeController *sharedInstance;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
sharedInstance = [[self alloc] init];
|
||||
});
|
||||
return sharedInstance;
|
||||
}
|
||||
|
||||
- (BOOL)isChromeInstalled {
|
||||
NSURL *simpleURL = [NSURL URLWithString:kGoogleChromeHTTPScheme];
|
||||
NSURL *callbackURL = [NSURL URLWithString:kGoogleChromeCallbackScheme];
|
||||
return [[UIApplication sharedApplication] canOpenURL:simpleURL] ||
|
||||
[[UIApplication sharedApplication] canOpenURL:callbackURL];
|
||||
}
|
||||
|
||||
- (BOOL)openInChrome:(NSURL *)url {
|
||||
return [self openInChrome:url withCallbackURL:nil createNewTab:NO];
|
||||
}
|
||||
|
||||
- (BOOL)openInChrome:(NSURL *)url
|
||||
withCallbackURL:(NSURL *)callbackURL
|
||||
createNewTab:(BOOL)createNewTab {
|
||||
NSURL *chromeSimpleURL = [NSURL URLWithString:kGoogleChromeHTTPScheme];
|
||||
NSURL *chromeCallbackURL = [NSURL URLWithString:kGoogleChromeCallbackScheme];
|
||||
if ([[UIApplication sharedApplication] canOpenURL:chromeCallbackURL]) {
|
||||
NSString *appName =
|
||||
[[NSBundle mainBundle]
|
||||
objectForInfoDictionaryKey:@"CFBundleDisplayName"];
|
||||
|
||||
NSString *scheme = [url.scheme lowercaseString];
|
||||
|
||||
// Proceed only if scheme is http or https.
|
||||
if ([scheme isEqualToString:@"http"] ||
|
||||
[scheme isEqualToString:@"https"]) {
|
||||
|
||||
NSMutableString *chromeURLString = [NSMutableString string];
|
||||
[chromeURLString appendFormat:
|
||||
@"%@//x-callback-url/open/?x-source=%@&url=%@",
|
||||
kGoogleChromeCallbackScheme,
|
||||
encodeByAddingPercentEscapes(appName),
|
||||
encodeByAddingPercentEscapes([url absoluteString])];
|
||||
if (callbackURL) {
|
||||
[chromeURLString appendFormat:@"&x-success=%@",
|
||||
encodeByAddingPercentEscapes([callbackURL absoluteString])];
|
||||
}
|
||||
if (createNewTab) {
|
||||
[chromeURLString appendString:@"&create-new-tab"];
|
||||
}
|
||||
|
||||
NSURL *chromeURL = [NSURL URLWithString:chromeURLString];
|
||||
|
||||
// Open the URL with Google Chrome.
|
||||
return [[UIApplication sharedApplication] openURL:chromeURL];
|
||||
}
|
||||
} else if ([[UIApplication sharedApplication] canOpenURL:chromeSimpleURL]) {
|
||||
NSString *scheme = [url.scheme lowercaseString];
|
||||
|
||||
// Replace the URL Scheme with the Chrome equivalent.
|
||||
NSString *chromeScheme = nil;
|
||||
if ([scheme isEqualToString:@"http"]) {
|
||||
chromeScheme = kGoogleChromeHTTPScheme;
|
||||
} else if ([scheme isEqualToString:@"https"]) {
|
||||
chromeScheme = kGoogleChromeHTTPSScheme;
|
||||
}
|
||||
|
||||
// Proceed only if a valid Google Chrome URI Scheme is available.
|
||||
if (chromeScheme) {
|
||||
NSString *absoluteString = [url absoluteString];
|
||||
NSRange rangeForScheme = [absoluteString rangeOfString:@":"];
|
||||
NSString *urlNoScheme =
|
||||
[absoluteString substringFromIndex:rangeForScheme.location + 1];
|
||||
NSString *chromeURLString =
|
||||
[chromeScheme stringByAppendingString:urlNoScheme];
|
||||
NSURL *chromeURL = [NSURL URLWithString:chromeURLString];
|
||||
|
||||
// Open the URL with Google Chrome.
|
||||
return [[UIApplication sharedApplication] openURL:chromeURL];
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
BIN
iphone/Maps/GooglePlusSDK/libGooglePlus.a
Normal file
BIN
iphone/Maps/GooglePlusSDK/libGooglePlus.a
Normal file
Binary file not shown.
BIN
iphone/Maps/GooglePlusSDK/libGooglePlusUniversal.a
Normal file
BIN
iphone/Maps/GooglePlusSDK/libGooglePlusUniversal.a
Normal file
Binary file not shown.
|
@ -123,6 +123,92 @@
|
|||
97DD585918A8EB060079837E /* MobileAppTracker.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 97DD585718A8EB060079837E /* MobileAppTracker.framework */; };
|
||||
97DD585C18A8EB130079837E /* libFlurry_4.3.2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 97DD585A18A8EB120079837E /* libFlurry_4.3.2.a */; };
|
||||
97DD585D18A8EB130079837E /* libFlurry_4.3.2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 97DD585A18A8EB120079837E /* libFlurry_4.3.2.a */; };
|
||||
97DDBF45197005BA00B3A4FD /* libGooglePlusUniversal.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 97DDBF43197005BA00B3A4FD /* libGooglePlusUniversal.a */; };
|
||||
97DDBF46197005BA00B3A4FD /* libGooglePlusUniversal.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 97DDBF43197005BA00B3A4FD /* libGooglePlusUniversal.a */; };
|
||||
97DDBF47197005BB00B3A4FD /* libGooglePlus.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 97DDBF44197005BA00B3A4FD /* libGooglePlus.a */; };
|
||||
97DDBF48197005BB00B3A4FD /* libGooglePlus.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 97DDBF44197005BA00B3A4FD /* libGooglePlus.a */; };
|
||||
97DDBFA81970079500B3A4FD /* GTLBase64.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF521970079500B3A4FD /* GTLBase64.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFA91970079500B3A4FD /* GTLBase64.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF521970079500B3A4FD /* GTLBase64.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFAA1970079500B3A4FD /* GTLBatchQuery.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF541970079500B3A4FD /* GTLBatchQuery.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFAB1970079500B3A4FD /* GTLBatchQuery.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF541970079500B3A4FD /* GTLBatchQuery.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFAC1970079500B3A4FD /* GTLBatchResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF561970079500B3A4FD /* GTLBatchResult.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFAD1970079500B3A4FD /* GTLBatchResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF561970079500B3A4FD /* GTLBatchResult.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFAE1970079500B3A4FD /* GTLDateTime.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF581970079500B3A4FD /* GTLDateTime.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFAF1970079500B3A4FD /* GTLDateTime.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF581970079500B3A4FD /* GTLDateTime.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFB01970079500B3A4FD /* GTLErrorObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF5B1970079500B3A4FD /* GTLErrorObject.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFB11970079500B3A4FD /* GTLErrorObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF5B1970079500B3A4FD /* GTLErrorObject.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFB21970079500B3A4FD /* GTLFramework.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF5D1970079500B3A4FD /* GTLFramework.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFB31970079500B3A4FD /* GTLFramework.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF5D1970079500B3A4FD /* GTLFramework.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFB41970079500B3A4FD /* GTLJSONParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF5F1970079500B3A4FD /* GTLJSONParser.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFB51970079500B3A4FD /* GTLJSONParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF5F1970079500B3A4FD /* GTLJSONParser.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFB61970079500B3A4FD /* GTLObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF611970079500B3A4FD /* GTLObject.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFB71970079500B3A4FD /* GTLObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF611970079500B3A4FD /* GTLObject.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFB81970079500B3A4FD /* GTLPlusAcl.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF651970079500B3A4FD /* GTLPlusAcl.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFB91970079500B3A4FD /* GTLPlusAcl.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF651970079500B3A4FD /* GTLPlusAcl.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFBA1970079500B3A4FD /* GTLPlusAclentryResource.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF671970079500B3A4FD /* GTLPlusAclentryResource.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFBB1970079500B3A4FD /* GTLPlusAclentryResource.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF671970079500B3A4FD /* GTLPlusAclentryResource.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFBC1970079500B3A4FD /* GTLPlusActivity.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF691970079500B3A4FD /* GTLPlusActivity.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFBD1970079500B3A4FD /* GTLPlusActivity.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF691970079500B3A4FD /* GTLPlusActivity.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFBE1970079500B3A4FD /* GTLPlusActivityFeed.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF6B1970079500B3A4FD /* GTLPlusActivityFeed.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFBF1970079500B3A4FD /* GTLPlusActivityFeed.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF6B1970079500B3A4FD /* GTLPlusActivityFeed.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFC01970079500B3A4FD /* GTLPlusComment.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF6D1970079500B3A4FD /* GTLPlusComment.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFC11970079500B3A4FD /* GTLPlusComment.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF6D1970079500B3A4FD /* GTLPlusComment.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFC21970079500B3A4FD /* GTLPlusCommentFeed.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF6F1970079500B3A4FD /* GTLPlusCommentFeed.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFC31970079500B3A4FD /* GTLPlusCommentFeed.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF6F1970079500B3A4FD /* GTLPlusCommentFeed.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFC41970079500B3A4FD /* GTLPlusConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF711970079500B3A4FD /* GTLPlusConstants.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFC51970079500B3A4FD /* GTLPlusConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF711970079500B3A4FD /* GTLPlusConstants.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFC61970079500B3A4FD /* GTLPlusItemScope.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF731970079500B3A4FD /* GTLPlusItemScope.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFC71970079500B3A4FD /* GTLPlusItemScope.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF731970079500B3A4FD /* GTLPlusItemScope.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFC81970079500B3A4FD /* GTLPlusMoment.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF751970079500B3A4FD /* GTLPlusMoment.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFC91970079500B3A4FD /* GTLPlusMoment.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF751970079500B3A4FD /* GTLPlusMoment.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFCA1970079500B3A4FD /* GTLPlusMomentsFeed.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF771970079500B3A4FD /* GTLPlusMomentsFeed.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFCB1970079500B3A4FD /* GTLPlusMomentsFeed.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF771970079500B3A4FD /* GTLPlusMomentsFeed.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFCC1970079500B3A4FD /* GTLPlusPeopleFeed.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF791970079500B3A4FD /* GTLPlusPeopleFeed.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFCD1970079500B3A4FD /* GTLPlusPeopleFeed.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF791970079500B3A4FD /* GTLPlusPeopleFeed.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFCE1970079500B3A4FD /* GTLPlusPerson.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF7B1970079500B3A4FD /* GTLPlusPerson.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFCF1970079500B3A4FD /* GTLPlusPerson.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF7B1970079500B3A4FD /* GTLPlusPerson.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFD01970079500B3A4FD /* GTLQueryPlus.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF7D1970079500B3A4FD /* GTLQueryPlus.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFD11970079500B3A4FD /* GTLQueryPlus.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF7D1970079500B3A4FD /* GTLQueryPlus.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFD21970079500B3A4FD /* GTLServicePlus.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF7F1970079500B3A4FD /* GTLServicePlus.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFD31970079500B3A4FD /* GTLServicePlus.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF7F1970079500B3A4FD /* GTLServicePlus.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFD41970079500B3A4FD /* GTLQuery.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF811970079500B3A4FD /* GTLQuery.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFD51970079500B3A4FD /* GTLQuery.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF811970079500B3A4FD /* GTLQuery.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFD61970079500B3A4FD /* GTLRuntimeCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF831970079500B3A4FD /* GTLRuntimeCommon.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFD71970079500B3A4FD /* GTLRuntimeCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF831970079500B3A4FD /* GTLRuntimeCommon.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFD81970079500B3A4FD /* GTLService.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF851970079500B3A4FD /* GTLService.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFD91970079500B3A4FD /* GTLService.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF851970079500B3A4FD /* GTLService.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFDA1970079500B3A4FD /* GTLUploadParameters.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF881970079500B3A4FD /* GTLUploadParameters.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFDB1970079500B3A4FD /* GTLUploadParameters.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF881970079500B3A4FD /* GTLUploadParameters.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFDC1970079500B3A4FD /* GTLUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF8A1970079500B3A4FD /* GTLUtilities.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFDD1970079500B3A4FD /* GTLUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF8A1970079500B3A4FD /* GTLUtilities.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFDE1970079500B3A4FD /* GTMHTTPFetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF8E1970079500B3A4FD /* GTMHTTPFetcher.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFDF1970079500B3A4FD /* GTMHTTPFetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF8E1970079500B3A4FD /* GTMHTTPFetcher.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFE01970079500B3A4FD /* GTMHTTPFetcherLogging.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF901970079500B3A4FD /* GTMHTTPFetcherLogging.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFE11970079500B3A4FD /* GTMHTTPFetcherLogging.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF901970079500B3A4FD /* GTMHTTPFetcherLogging.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFE21970079500B3A4FD /* GTMHTTPFetcherService.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF921970079500B3A4FD /* GTMHTTPFetcherService.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFE31970079500B3A4FD /* GTMHTTPFetcherService.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF921970079500B3A4FD /* GTMHTTPFetcherService.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFE41970079500B3A4FD /* GTMHTTPFetchHistory.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF941970079500B3A4FD /* GTMHTTPFetchHistory.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFE51970079500B3A4FD /* GTMHTTPFetchHistory.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF941970079500B3A4FD /* GTMHTTPFetchHistory.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFE61970079500B3A4FD /* GTMLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF961970079500B3A4FD /* GTMLogger.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFE71970079500B3A4FD /* GTMLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF961970079500B3A4FD /* GTMLogger.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFE81970079500B3A4FD /* GTMMethodCheck.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF981970079500B3A4FD /* GTMMethodCheck.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFE91970079500B3A4FD /* GTMMethodCheck.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF981970079500B3A4FD /* GTMMethodCheck.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFEA1970079500B3A4FD /* GTMNSDictionary+URLArguments.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF9A1970079500B3A4FD /* GTMNSDictionary+URLArguments.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFEB1970079500B3A4FD /* GTMNSDictionary+URLArguments.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF9A1970079500B3A4FD /* GTMNSDictionary+URLArguments.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFEC1970079500B3A4FD /* GTMNSString+URLArguments.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF9C1970079500B3A4FD /* GTMNSString+URLArguments.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFED1970079500B3A4FD /* GTMNSString+URLArguments.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF9C1970079500B3A4FD /* GTMNSString+URLArguments.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFEE1970079500B3A4FD /* GTMOAuth2Authentication.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF9E1970079500B3A4FD /* GTMOAuth2Authentication.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFEF1970079500B3A4FD /* GTMOAuth2Authentication.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBF9E1970079500B3A4FD /* GTMOAuth2Authentication.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFF01970079500B3A4FD /* GTMOAuth2SignIn.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBFA01970079500B3A4FD /* GTMOAuth2SignIn.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFF11970079500B3A4FD /* GTMOAuth2SignIn.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBFA01970079500B3A4FD /* GTMOAuth2SignIn.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFF21970079500B3A4FD /* GTMOAuth2ViewControllerTouch.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBFA21970079500B3A4FD /* GTMOAuth2ViewControllerTouch.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFF31970079500B3A4FD /* GTMOAuth2ViewControllerTouch.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBFA21970079500B3A4FD /* GTMOAuth2ViewControllerTouch.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFF41970079500B3A4FD /* GTMOAuth2ViewTouch.xib in Resources */ = {isa = PBXBuildFile; fileRef = 97DDBFA31970079500B3A4FD /* GTMOAuth2ViewTouch.xib */; };
|
||||
97DDBFF51970079500B3A4FD /* GTMOAuth2ViewTouch.xib in Resources */ = {isa = PBXBuildFile; fileRef = 97DDBFA31970079500B3A4FD /* GTMOAuth2ViewTouch.xib */; };
|
||||
97DDBFF61970079500B3A4FD /* GTMObjC2Runtime.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBFA51970079500B3A4FD /* GTMObjC2Runtime.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFF71970079500B3A4FD /* GTMObjC2Runtime.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBFA51970079500B3A4FD /* GTMObjC2Runtime.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFF81970079500B3A4FD /* OpenInChromeController.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBFA71970079500B3A4FD /* OpenInChromeController.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DDBFF91970079500B3A4FD /* OpenInChromeController.m in Sources */ = {isa = PBXBuildFile; fileRef = 97DDBFA71970079500B3A4FD /* OpenInChromeController.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
97DEA09618D75BB000C5F963 /* ContextViews.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97DEA09518D75BB000C5F963 /* ContextViews.mm */; };
|
||||
97DEA09718D75BB000C5F963 /* ContextViews.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97DEA09518D75BB000C5F963 /* ContextViews.mm */; };
|
||||
97ECD871183620CE00F77A46 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 97ECD870183620CE00F77A46 /* AdSupport.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
|
||||
|
@ -1451,6 +1537,99 @@
|
|||
97DD585718A8EB060079837E /* MobileAppTracker.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = MobileAppTracker.framework; sourceTree = "<group>"; };
|
||||
97DD585A18A8EB120079837E /* libFlurry_4.3.2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libFlurry_4.3.2.a; sourceTree = "<group>"; };
|
||||
97DD585B18A8EB120079837E /* Flurry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Flurry.h; sourceTree = "<group>"; };
|
||||
97DDBF43197005BA00B3A4FD /* libGooglePlusUniversal.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libGooglePlusUniversal.a; path = GooglePlusSDK/libGooglePlusUniversal.a; sourceTree = "<group>"; };
|
||||
97DDBF44197005BA00B3A4FD /* libGooglePlus.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libGooglePlus.a; path = GooglePlusSDK/libGooglePlus.a; sourceTree = "<group>"; };
|
||||
97DDBF4A197005D200B3A4FD /* GPPShare.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GPPShare.h; path = GooglePlusSDK/GPPShare.h; sourceTree = "<group>"; };
|
||||
97DDBF4B197005D200B3A4FD /* GPPSignIn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GPPSignIn.h; path = GooglePlusSDK/GPPSignIn.h; sourceTree = "<group>"; };
|
||||
97DDBF4C197005D200B3A4FD /* GPPDeepLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GPPDeepLink.h; path = GooglePlusSDK/GPPDeepLink.h; sourceTree = "<group>"; };
|
||||
97DDBF4D197005D200B3A4FD /* GPPSignInButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GPPSignInButton.h; path = GooglePlusSDK/GPPSignInButton.h; sourceTree = "<group>"; };
|
||||
97DDBF4E197005D200B3A4FD /* GPPURLHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GPPURLHandler.h; path = GooglePlusSDK/GPPURLHandler.h; sourceTree = "<group>"; };
|
||||
97DDBF511970079500B3A4FD /* GTLBase64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLBase64.h; sourceTree = "<group>"; };
|
||||
97DDBF521970079500B3A4FD /* GTLBase64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLBase64.m; sourceTree = "<group>"; };
|
||||
97DDBF531970079500B3A4FD /* GTLBatchQuery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLBatchQuery.h; sourceTree = "<group>"; };
|
||||
97DDBF541970079500B3A4FD /* GTLBatchQuery.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLBatchQuery.m; sourceTree = "<group>"; };
|
||||
97DDBF551970079500B3A4FD /* GTLBatchResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLBatchResult.h; sourceTree = "<group>"; };
|
||||
97DDBF561970079500B3A4FD /* GTLBatchResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLBatchResult.m; sourceTree = "<group>"; };
|
||||
97DDBF571970079500B3A4FD /* GTLDateTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLDateTime.h; sourceTree = "<group>"; };
|
||||
97DDBF581970079500B3A4FD /* GTLDateTime.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLDateTime.m; sourceTree = "<group>"; };
|
||||
97DDBF591970079500B3A4FD /* GTLDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLDefines.h; sourceTree = "<group>"; };
|
||||
97DDBF5A1970079500B3A4FD /* GTLErrorObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLErrorObject.h; sourceTree = "<group>"; };
|
||||
97DDBF5B1970079500B3A4FD /* GTLErrorObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLErrorObject.m; sourceTree = "<group>"; };
|
||||
97DDBF5C1970079500B3A4FD /* GTLFramework.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLFramework.h; sourceTree = "<group>"; };
|
||||
97DDBF5D1970079500B3A4FD /* GTLFramework.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLFramework.m; sourceTree = "<group>"; };
|
||||
97DDBF5E1970079500B3A4FD /* GTLJSONParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLJSONParser.h; sourceTree = "<group>"; };
|
||||
97DDBF5F1970079500B3A4FD /* GTLJSONParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLJSONParser.m; sourceTree = "<group>"; };
|
||||
97DDBF601970079500B3A4FD /* GTLObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLObject.h; sourceTree = "<group>"; };
|
||||
97DDBF611970079500B3A4FD /* GTLObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLObject.m; sourceTree = "<group>"; };
|
||||
97DDBF631970079500B3A4FD /* GTLPlus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLPlus.h; sourceTree = "<group>"; };
|
||||
97DDBF641970079500B3A4FD /* GTLPlusAcl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLPlusAcl.h; sourceTree = "<group>"; };
|
||||
97DDBF651970079500B3A4FD /* GTLPlusAcl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLPlusAcl.m; sourceTree = "<group>"; };
|
||||
97DDBF661970079500B3A4FD /* GTLPlusAclentryResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLPlusAclentryResource.h; sourceTree = "<group>"; };
|
||||
97DDBF671970079500B3A4FD /* GTLPlusAclentryResource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLPlusAclentryResource.m; sourceTree = "<group>"; };
|
||||
97DDBF681970079500B3A4FD /* GTLPlusActivity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLPlusActivity.h; sourceTree = "<group>"; };
|
||||
97DDBF691970079500B3A4FD /* GTLPlusActivity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLPlusActivity.m; sourceTree = "<group>"; };
|
||||
97DDBF6A1970079500B3A4FD /* GTLPlusActivityFeed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLPlusActivityFeed.h; sourceTree = "<group>"; };
|
||||
97DDBF6B1970079500B3A4FD /* GTLPlusActivityFeed.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLPlusActivityFeed.m; sourceTree = "<group>"; };
|
||||
97DDBF6C1970079500B3A4FD /* GTLPlusComment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLPlusComment.h; sourceTree = "<group>"; };
|
||||
97DDBF6D1970079500B3A4FD /* GTLPlusComment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLPlusComment.m; sourceTree = "<group>"; };
|
||||
97DDBF6E1970079500B3A4FD /* GTLPlusCommentFeed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLPlusCommentFeed.h; sourceTree = "<group>"; };
|
||||
97DDBF6F1970079500B3A4FD /* GTLPlusCommentFeed.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLPlusCommentFeed.m; sourceTree = "<group>"; };
|
||||
97DDBF701970079500B3A4FD /* GTLPlusConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLPlusConstants.h; sourceTree = "<group>"; };
|
||||
97DDBF711970079500B3A4FD /* GTLPlusConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLPlusConstants.m; sourceTree = "<group>"; };
|
||||
97DDBF721970079500B3A4FD /* GTLPlusItemScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLPlusItemScope.h; sourceTree = "<group>"; };
|
||||
97DDBF731970079500B3A4FD /* GTLPlusItemScope.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLPlusItemScope.m; sourceTree = "<group>"; };
|
||||
97DDBF741970079500B3A4FD /* GTLPlusMoment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLPlusMoment.h; sourceTree = "<group>"; };
|
||||
97DDBF751970079500B3A4FD /* GTLPlusMoment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLPlusMoment.m; sourceTree = "<group>"; };
|
||||
97DDBF761970079500B3A4FD /* GTLPlusMomentsFeed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLPlusMomentsFeed.h; sourceTree = "<group>"; };
|
||||
97DDBF771970079500B3A4FD /* GTLPlusMomentsFeed.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLPlusMomentsFeed.m; sourceTree = "<group>"; };
|
||||
97DDBF781970079500B3A4FD /* GTLPlusPeopleFeed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLPlusPeopleFeed.h; sourceTree = "<group>"; };
|
||||
97DDBF791970079500B3A4FD /* GTLPlusPeopleFeed.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLPlusPeopleFeed.m; sourceTree = "<group>"; };
|
||||
97DDBF7A1970079500B3A4FD /* GTLPlusPerson.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLPlusPerson.h; sourceTree = "<group>"; };
|
||||
97DDBF7B1970079500B3A4FD /* GTLPlusPerson.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLPlusPerson.m; sourceTree = "<group>"; };
|
||||
97DDBF7C1970079500B3A4FD /* GTLQueryPlus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLQueryPlus.h; sourceTree = "<group>"; };
|
||||
97DDBF7D1970079500B3A4FD /* GTLQueryPlus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLQueryPlus.m; sourceTree = "<group>"; };
|
||||
97DDBF7E1970079500B3A4FD /* GTLServicePlus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLServicePlus.h; sourceTree = "<group>"; };
|
||||
97DDBF7F1970079500B3A4FD /* GTLServicePlus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLServicePlus.m; sourceTree = "<group>"; };
|
||||
97DDBF801970079500B3A4FD /* GTLQuery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLQuery.h; sourceTree = "<group>"; };
|
||||
97DDBF811970079500B3A4FD /* GTLQuery.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLQuery.m; sourceTree = "<group>"; };
|
||||
97DDBF821970079500B3A4FD /* GTLRuntimeCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLRuntimeCommon.h; sourceTree = "<group>"; };
|
||||
97DDBF831970079500B3A4FD /* GTLRuntimeCommon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLRuntimeCommon.m; sourceTree = "<group>"; };
|
||||
97DDBF841970079500B3A4FD /* GTLService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLService.h; sourceTree = "<group>"; };
|
||||
97DDBF851970079500B3A4FD /* GTLService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLService.m; sourceTree = "<group>"; };
|
||||
97DDBF861970079500B3A4FD /* GTLTargetNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLTargetNamespace.h; sourceTree = "<group>"; };
|
||||
97DDBF871970079500B3A4FD /* GTLUploadParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLUploadParameters.h; sourceTree = "<group>"; };
|
||||
97DDBF881970079500B3A4FD /* GTLUploadParameters.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLUploadParameters.m; sourceTree = "<group>"; };
|
||||
97DDBF891970079500B3A4FD /* GTLUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTLUtilities.h; sourceTree = "<group>"; };
|
||||
97DDBF8A1970079500B3A4FD /* GTLUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTLUtilities.m; sourceTree = "<group>"; };
|
||||
97DDBF8B1970079500B3A4FD /* GTMDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GTMDefines.h; path = ../GooglePlusSDK/OpenSource/GTMDefines.h; sourceTree = "<group>"; };
|
||||
97DDBF8C1970079500B3A4FD /* GTMGarbageCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GTMGarbageCollection.h; path = ../GooglePlusSDK/OpenSource/GTMGarbageCollection.h; sourceTree = "<group>"; };
|
||||
97DDBF8D1970079500B3A4FD /* GTMHTTPFetcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GTMHTTPFetcher.h; path = ../GooglePlusSDK/OpenSource/GTMHTTPFetcher.h; sourceTree = "<group>"; };
|
||||
97DDBF8E1970079500B3A4FD /* GTMHTTPFetcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GTMHTTPFetcher.m; path = ../GooglePlusSDK/OpenSource/GTMHTTPFetcher.m; sourceTree = "<group>"; };
|
||||
97DDBF8F1970079500B3A4FD /* GTMHTTPFetcherLogging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GTMHTTPFetcherLogging.h; path = ../GooglePlusSDK/OpenSource/GTMHTTPFetcherLogging.h; sourceTree = "<group>"; };
|
||||
97DDBF901970079500B3A4FD /* GTMHTTPFetcherLogging.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GTMHTTPFetcherLogging.m; path = ../GooglePlusSDK/OpenSource/GTMHTTPFetcherLogging.m; sourceTree = "<group>"; };
|
||||
97DDBF911970079500B3A4FD /* GTMHTTPFetcherService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GTMHTTPFetcherService.h; path = ../GooglePlusSDK/OpenSource/GTMHTTPFetcherService.h; sourceTree = "<group>"; };
|
||||
97DDBF921970079500B3A4FD /* GTMHTTPFetcherService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GTMHTTPFetcherService.m; path = ../GooglePlusSDK/OpenSource/GTMHTTPFetcherService.m; sourceTree = "<group>"; };
|
||||
97DDBF931970079500B3A4FD /* GTMHTTPFetchHistory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GTMHTTPFetchHistory.h; path = ../GooglePlusSDK/OpenSource/GTMHTTPFetchHistory.h; sourceTree = "<group>"; };
|
||||
97DDBF941970079500B3A4FD /* GTMHTTPFetchHistory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GTMHTTPFetchHistory.m; path = ../GooglePlusSDK/OpenSource/GTMHTTPFetchHistory.m; sourceTree = "<group>"; };
|
||||
97DDBF951970079500B3A4FD /* GTMLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GTMLogger.h; path = ../GooglePlusSDK/OpenSource/GTMLogger.h; sourceTree = "<group>"; };
|
||||
97DDBF961970079500B3A4FD /* GTMLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GTMLogger.m; path = ../GooglePlusSDK/OpenSource/GTMLogger.m; sourceTree = "<group>"; };
|
||||
97DDBF971970079500B3A4FD /* GTMMethodCheck.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GTMMethodCheck.h; path = ../GooglePlusSDK/OpenSource/GTMMethodCheck.h; sourceTree = "<group>"; };
|
||||
97DDBF981970079500B3A4FD /* GTMMethodCheck.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GTMMethodCheck.m; path = ../GooglePlusSDK/OpenSource/GTMMethodCheck.m; sourceTree = "<group>"; };
|
||||
97DDBF991970079500B3A4FD /* GTMNSDictionary+URLArguments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "GTMNSDictionary+URLArguments.h"; path = "../GooglePlusSDK/OpenSource/GTMNSDictionary+URLArguments.h"; sourceTree = "<group>"; };
|
||||
97DDBF9A1970079500B3A4FD /* GTMNSDictionary+URLArguments.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "GTMNSDictionary+URLArguments.m"; path = "../GooglePlusSDK/OpenSource/GTMNSDictionary+URLArguments.m"; sourceTree = "<group>"; };
|
||||
97DDBF9B1970079500B3A4FD /* GTMNSString+URLArguments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "GTMNSString+URLArguments.h"; path = "../GooglePlusSDK/OpenSource/GTMNSString+URLArguments.h"; sourceTree = "<group>"; };
|
||||
97DDBF9C1970079500B3A4FD /* GTMNSString+URLArguments.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "GTMNSString+URLArguments.m"; path = "../GooglePlusSDK/OpenSource/GTMNSString+URLArguments.m"; sourceTree = "<group>"; };
|
||||
97DDBF9D1970079500B3A4FD /* GTMOAuth2Authentication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GTMOAuth2Authentication.h; path = ../GooglePlusSDK/OpenSource/GTMOAuth2Authentication.h; sourceTree = "<group>"; };
|
||||
97DDBF9E1970079500B3A4FD /* GTMOAuth2Authentication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GTMOAuth2Authentication.m; path = ../GooglePlusSDK/OpenSource/GTMOAuth2Authentication.m; sourceTree = "<group>"; };
|
||||
97DDBF9F1970079500B3A4FD /* GTMOAuth2SignIn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GTMOAuth2SignIn.h; path = ../GooglePlusSDK/OpenSource/GTMOAuth2SignIn.h; sourceTree = "<group>"; };
|
||||
97DDBFA01970079500B3A4FD /* GTMOAuth2SignIn.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GTMOAuth2SignIn.m; path = ../GooglePlusSDK/OpenSource/GTMOAuth2SignIn.m; sourceTree = "<group>"; };
|
||||
97DDBFA11970079500B3A4FD /* GTMOAuth2ViewControllerTouch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GTMOAuth2ViewControllerTouch.h; path = ../GooglePlusSDK/OpenSource/GTMOAuth2ViewControllerTouch.h; sourceTree = "<group>"; };
|
||||
97DDBFA21970079500B3A4FD /* GTMOAuth2ViewControllerTouch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GTMOAuth2ViewControllerTouch.m; path = ../GooglePlusSDK/OpenSource/GTMOAuth2ViewControllerTouch.m; sourceTree = "<group>"; };
|
||||
97DDBFA31970079500B3A4FD /* GTMOAuth2ViewTouch.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = GTMOAuth2ViewTouch.xib; path = ../GooglePlusSDK/OpenSource/GTMOAuth2ViewTouch.xib; sourceTree = "<group>"; };
|
||||
97DDBFA41970079500B3A4FD /* GTMObjC2Runtime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GTMObjC2Runtime.h; path = ../GooglePlusSDK/OpenSource/GTMObjC2Runtime.h; sourceTree = "<group>"; };
|
||||
97DDBFA51970079500B3A4FD /* GTMObjC2Runtime.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GTMObjC2Runtime.m; path = ../GooglePlusSDK/OpenSource/GTMObjC2Runtime.m; sourceTree = "<group>"; };
|
||||
97DDBFA61970079500B3A4FD /* OpenInChromeController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OpenInChromeController.h; path = ../GooglePlusSDK/OpenSource/OpenInChromeController.h; sourceTree = "<group>"; };
|
||||
97DDBFA71970079500B3A4FD /* OpenInChromeController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OpenInChromeController.m; path = ../GooglePlusSDK/OpenSource/OpenInChromeController.m; sourceTree = "<group>"; };
|
||||
97DEA09018D706C300C5F963 /* Common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Common.h; sourceTree = "<group>"; };
|
||||
97DEA09418D75BB000C5F963 /* ContextViews.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextViews.h; sourceTree = "<group>"; };
|
||||
97DEA09518D75BB000C5F963 /* ContextViews.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ContextViews.mm; sourceTree = "<group>"; };
|
||||
|
@ -2118,6 +2297,7 @@
|
|||
97ECD87F1836594400F77A46 /* StoreKit.framework in Frameworks */,
|
||||
97ECD87A18362B5400F77A46 /* MobileCoreServices.framework in Frameworks */,
|
||||
97ECD87818362B3D00F77A46 /* CoreTelephony.framework in Frameworks */,
|
||||
97DDBF45197005BA00B3A4FD /* libGooglePlusUniversal.a in Frameworks */,
|
||||
97ECD871183620CE00F77A46 /* AdSupport.framework in Frameworks */,
|
||||
EDBB18B816972B0600AF0742 /* libzlib.a in Frameworks */,
|
||||
EEFC0BBF12B5656A002914FF /* libfreetype.a in Frameworks */,
|
||||
|
@ -2140,6 +2320,7 @@
|
|||
FA87151B12B1518F00592DAF /* SystemConfiguration.framework in Frameworks */,
|
||||
FA04373212CAB83F00017494 /* libstorage.a in Frameworks */,
|
||||
EEF5745512DE1AD50082F472 /* libfribidi.a in Frameworks */,
|
||||
97DDBF47197005BB00B3A4FD /* libGooglePlus.a in Frameworks */,
|
||||
FA8F8938132D5DB00048E3FE /* libtomcrypt.a in Frameworks */,
|
||||
49DE1CA413437D7A00A93417 /* libbzip2.a in Frameworks */,
|
||||
FA2EF9C713630C3B00E3E484 /* libplatform.a in Frameworks */,
|
||||
|
@ -2196,8 +2377,10 @@
|
|||
FAFB090C151215EE0041901D /* libtomcrypt.a in Frameworks */,
|
||||
FAFB090D151215EE0041901D /* libbzip2.a in Frameworks */,
|
||||
FAFB090E151215EE0041901D /* libplatform.a in Frameworks */,
|
||||
97DDBF46197005BA00B3A4FD /* libGooglePlusUniversal.a in Frameworks */,
|
||||
FAFB090F151215EE0041901D /* libsearch.a in Frameworks */,
|
||||
FAFB0910151215EE0041901D /* libjansson.a in Frameworks */,
|
||||
97DDBF48197005BB00B3A4FD /* libGooglePlus.a in Frameworks */,
|
||||
FAFB0911151215EE0041901D /* libprotobuf.a in Frameworks */,
|
||||
EE5A34E7156FCBD800E34FFE /* libgui.a in Frameworks */,
|
||||
EEFFB4E915DCDD8A00BACE1C /* libanim.a in Frameworks */,
|
||||
|
@ -2330,6 +2513,7 @@
|
|||
97354B6B196EDCE200352536 /* Login & sharing */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
97DDBF49197005C500B3A4FD /* Google Plus */,
|
||||
EDC5C541175F2CA600420E92 /* ShareActionSheet.h */,
|
||||
EDC5C542175F2CA600420E92 /* ShareActionSheet.mm */,
|
||||
97354B6C196EDD3A00352536 /* AccountManager.h */,
|
||||
|
@ -2477,6 +2661,131 @@
|
|||
name = Cells;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97DDBF49197005C500B3A4FD /* Google Plus */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
97DDBF4F1970079500B3A4FD /* OpenSource */,
|
||||
97DDBF4A197005D200B3A4FD /* GPPShare.h */,
|
||||
97DDBF4B197005D200B3A4FD /* GPPSignIn.h */,
|
||||
97DDBF4C197005D200B3A4FD /* GPPDeepLink.h */,
|
||||
97DDBF4D197005D200B3A4FD /* GPPSignInButton.h */,
|
||||
97DDBF4E197005D200B3A4FD /* GPPURLHandler.h */,
|
||||
97DDBF43197005BA00B3A4FD /* libGooglePlusUniversal.a */,
|
||||
97DDBF44197005BA00B3A4FD /* libGooglePlus.a */,
|
||||
);
|
||||
name = "Google Plus";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97DDBF4F1970079500B3A4FD /* OpenSource */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
97DDBF501970079500B3A4FD /* GTL */,
|
||||
97DDBF8B1970079500B3A4FD /* GTMDefines.h */,
|
||||
97DDBF8C1970079500B3A4FD /* GTMGarbageCollection.h */,
|
||||
97DDBF8D1970079500B3A4FD /* GTMHTTPFetcher.h */,
|
||||
97DDBF8E1970079500B3A4FD /* GTMHTTPFetcher.m */,
|
||||
97DDBF8F1970079500B3A4FD /* GTMHTTPFetcherLogging.h */,
|
||||
97DDBF901970079500B3A4FD /* GTMHTTPFetcherLogging.m */,
|
||||
97DDBF911970079500B3A4FD /* GTMHTTPFetcherService.h */,
|
||||
97DDBF921970079500B3A4FD /* GTMHTTPFetcherService.m */,
|
||||
97DDBF931970079500B3A4FD /* GTMHTTPFetchHistory.h */,
|
||||
97DDBF941970079500B3A4FD /* GTMHTTPFetchHistory.m */,
|
||||
97DDBF951970079500B3A4FD /* GTMLogger.h */,
|
||||
97DDBF961970079500B3A4FD /* GTMLogger.m */,
|
||||
97DDBF971970079500B3A4FD /* GTMMethodCheck.h */,
|
||||
97DDBF981970079500B3A4FD /* GTMMethodCheck.m */,
|
||||
97DDBF991970079500B3A4FD /* GTMNSDictionary+URLArguments.h */,
|
||||
97DDBF9A1970079500B3A4FD /* GTMNSDictionary+URLArguments.m */,
|
||||
97DDBF9B1970079500B3A4FD /* GTMNSString+URLArguments.h */,
|
||||
97DDBF9C1970079500B3A4FD /* GTMNSString+URLArguments.m */,
|
||||
97DDBF9D1970079500B3A4FD /* GTMOAuth2Authentication.h */,
|
||||
97DDBF9E1970079500B3A4FD /* GTMOAuth2Authentication.m */,
|
||||
97DDBF9F1970079500B3A4FD /* GTMOAuth2SignIn.h */,
|
||||
97DDBFA01970079500B3A4FD /* GTMOAuth2SignIn.m */,
|
||||
97DDBFA11970079500B3A4FD /* GTMOAuth2ViewControllerTouch.h */,
|
||||
97DDBFA21970079500B3A4FD /* GTMOAuth2ViewControllerTouch.m */,
|
||||
97DDBFA31970079500B3A4FD /* GTMOAuth2ViewTouch.xib */,
|
||||
97DDBFA41970079500B3A4FD /* GTMObjC2Runtime.h */,
|
||||
97DDBFA51970079500B3A4FD /* GTMObjC2Runtime.m */,
|
||||
97DDBFA61970079500B3A4FD /* OpenInChromeController.h */,
|
||||
97DDBFA71970079500B3A4FD /* OpenInChromeController.m */,
|
||||
);
|
||||
path = OpenSource;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97DDBF501970079500B3A4FD /* GTL */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
97DDBF511970079500B3A4FD /* GTLBase64.h */,
|
||||
97DDBF521970079500B3A4FD /* GTLBase64.m */,
|
||||
97DDBF531970079500B3A4FD /* GTLBatchQuery.h */,
|
||||
97DDBF541970079500B3A4FD /* GTLBatchQuery.m */,
|
||||
97DDBF551970079500B3A4FD /* GTLBatchResult.h */,
|
||||
97DDBF561970079500B3A4FD /* GTLBatchResult.m */,
|
||||
97DDBF571970079500B3A4FD /* GTLDateTime.h */,
|
||||
97DDBF581970079500B3A4FD /* GTLDateTime.m */,
|
||||
97DDBF591970079500B3A4FD /* GTLDefines.h */,
|
||||
97DDBF5A1970079500B3A4FD /* GTLErrorObject.h */,
|
||||
97DDBF5B1970079500B3A4FD /* GTLErrorObject.m */,
|
||||
97DDBF5C1970079500B3A4FD /* GTLFramework.h */,
|
||||
97DDBF5D1970079500B3A4FD /* GTLFramework.m */,
|
||||
97DDBF5E1970079500B3A4FD /* GTLJSONParser.h */,
|
||||
97DDBF5F1970079500B3A4FD /* GTLJSONParser.m */,
|
||||
97DDBF601970079500B3A4FD /* GTLObject.h */,
|
||||
97DDBF611970079500B3A4FD /* GTLObject.m */,
|
||||
97DDBF621970079500B3A4FD /* GTLPlus */,
|
||||
97DDBF801970079500B3A4FD /* GTLQuery.h */,
|
||||
97DDBF811970079500B3A4FD /* GTLQuery.m */,
|
||||
97DDBF821970079500B3A4FD /* GTLRuntimeCommon.h */,
|
||||
97DDBF831970079500B3A4FD /* GTLRuntimeCommon.m */,
|
||||
97DDBF841970079500B3A4FD /* GTLService.h */,
|
||||
97DDBF851970079500B3A4FD /* GTLService.m */,
|
||||
97DDBF861970079500B3A4FD /* GTLTargetNamespace.h */,
|
||||
97DDBF871970079500B3A4FD /* GTLUploadParameters.h */,
|
||||
97DDBF881970079500B3A4FD /* GTLUploadParameters.m */,
|
||||
97DDBF891970079500B3A4FD /* GTLUtilities.h */,
|
||||
97DDBF8A1970079500B3A4FD /* GTLUtilities.m */,
|
||||
);
|
||||
name = GTL;
|
||||
path = ../GooglePlusSDK/OpenSource/GTL;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97DDBF621970079500B3A4FD /* GTLPlus */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
97DDBF631970079500B3A4FD /* GTLPlus.h */,
|
||||
97DDBF641970079500B3A4FD /* GTLPlusAcl.h */,
|
||||
97DDBF651970079500B3A4FD /* GTLPlusAcl.m */,
|
||||
97DDBF661970079500B3A4FD /* GTLPlusAclentryResource.h */,
|
||||
97DDBF671970079500B3A4FD /* GTLPlusAclentryResource.m */,
|
||||
97DDBF681970079500B3A4FD /* GTLPlusActivity.h */,
|
||||
97DDBF691970079500B3A4FD /* GTLPlusActivity.m */,
|
||||
97DDBF6A1970079500B3A4FD /* GTLPlusActivityFeed.h */,
|
||||
97DDBF6B1970079500B3A4FD /* GTLPlusActivityFeed.m */,
|
||||
97DDBF6C1970079500B3A4FD /* GTLPlusComment.h */,
|
||||
97DDBF6D1970079500B3A4FD /* GTLPlusComment.m */,
|
||||
97DDBF6E1970079500B3A4FD /* GTLPlusCommentFeed.h */,
|
||||
97DDBF6F1970079500B3A4FD /* GTLPlusCommentFeed.m */,
|
||||
97DDBF701970079500B3A4FD /* GTLPlusConstants.h */,
|
||||
97DDBF711970079500B3A4FD /* GTLPlusConstants.m */,
|
||||
97DDBF721970079500B3A4FD /* GTLPlusItemScope.h */,
|
||||
97DDBF731970079500B3A4FD /* GTLPlusItemScope.m */,
|
||||
97DDBF741970079500B3A4FD /* GTLPlusMoment.h */,
|
||||
97DDBF751970079500B3A4FD /* GTLPlusMoment.m */,
|
||||
97DDBF761970079500B3A4FD /* GTLPlusMomentsFeed.h */,
|
||||
97DDBF771970079500B3A4FD /* GTLPlusMomentsFeed.m */,
|
||||
97DDBF781970079500B3A4FD /* GTLPlusPeopleFeed.h */,
|
||||
97DDBF791970079500B3A4FD /* GTLPlusPeopleFeed.m */,
|
||||
97DDBF7A1970079500B3A4FD /* GTLPlusPerson.h */,
|
||||
97DDBF7B1970079500B3A4FD /* GTLPlusPerson.m */,
|
||||
97DDBF7C1970079500B3A4FD /* GTLQueryPlus.h */,
|
||||
97DDBF7D1970079500B3A4FD /* GTLQueryPlus.m */,
|
||||
97DDBF7E1970079500B3A4FD /* GTLServicePlus.h */,
|
||||
97DDBF7F1970079500B3A4FD /* GTLServicePlus.m */,
|
||||
);
|
||||
path = GTLPlus;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CB252D6816FF82C8001E41E9 /* Statistics */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -3735,6 +4044,7 @@
|
|||
FAF804E71417E3510024E8C1 /* pm@2x.png in Resources */,
|
||||
FAF804E81417E3510024E8C1 /* pn@2x.png in Resources */,
|
||||
FAF804E91417E3510024E8C1 /* pr@2x.png in Resources */,
|
||||
97DDBFF41970079500B3A4FD /* GTMOAuth2ViewTouch.xib in Resources */,
|
||||
FAF804EA1417E3510024E8C1 /* ps@2x.png in Resources */,
|
||||
FAF804EB1417E3510024E8C1 /* pt@2x.png in Resources */,
|
||||
FAF804EC1417E3510024E8C1 /* pw@2x.png in Resources */,
|
||||
|
@ -3915,6 +4225,7 @@
|
|||
FAFB06FB151215EE0041901D /* cd.png in Resources */,
|
||||
FAFB06FC151215EE0041901D /* cf.png in Resources */,
|
||||
FAFB06FD151215EE0041901D /* cg.png in Resources */,
|
||||
97DDBFF51970079500B3A4FD /* GTMOAuth2ViewTouch.xib in Resources */,
|
||||
FAFB06FE151215EE0041901D /* ch.png in Resources */,
|
||||
FAFB06FF151215EE0041901D /* ci.png in Resources */,
|
||||
FAFB0700151215EE0041901D /* ck.png in Resources */,
|
||||
|
@ -4440,23 +4751,36 @@
|
|||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
1D60589B0D05DD56006BFB54 /* main.mm in Sources */,
|
||||
97DDBFC01970079500B3A4FD /* GTLPlusComment.m in Sources */,
|
||||
97A0EEFA192F3B43009B2779 /* BottomMenu.mm in Sources */,
|
||||
9747278418338F0C006B7CB7 /* UIViewController+Navigation.m in Sources */,
|
||||
97908B30196591F7003DD7C6 /* SearchShowOnMapCell.m in Sources */,
|
||||
1D3623260D0F684500981E51 /* MapsAppDelegate.mm in Sources */,
|
||||
9746492718EEE2F8004B4658 /* ToolbarView.m in Sources */,
|
||||
97DDBFBE1970079500B3A4FD /* GTLPlusActivityFeed.m in Sources */,
|
||||
46F26CD810F623BA00ECCA39 /* EAGLView.mm in Sources */,
|
||||
EED10A4511F78D120095FAD4 /* MapViewController.mm in Sources */,
|
||||
97DDBFE41970079500B3A4FD /* GTMHTTPFetchHistory.m in Sources */,
|
||||
FA4135EA120A263C0062D5B4 /* CountriesViewController.mm in Sources */,
|
||||
FA4135ED120A263C0062D5B4 /* SettingsManager.mm in Sources */,
|
||||
EE7F29811219ECA300EB67A9 /* RenderBuffer.mm in Sources */,
|
||||
97D092B5190A6E1D00FF645B /* PlacePageEditCell.mm in Sources */,
|
||||
978F9253183BD530000D6C7C /* NavigationController.mm in Sources */,
|
||||
97354B65196AF97200352536 /* PlacePageRoutingCell.m in Sources */,
|
||||
97DDBFE21970079500B3A4FD /* GTMHTTPFetcherService.m in Sources */,
|
||||
97DDBFE81970079500B3A4FD /* GTMMethodCheck.m in Sources */,
|
||||
97DDBFD41970079500B3A4FD /* GTLQuery.m in Sources */,
|
||||
974386DD19373EA400FD5659 /* ToastView.m in Sources */,
|
||||
97DDBFE01970079500B3A4FD /* GTMHTTPFetcherLogging.m in Sources */,
|
||||
97C9851E186AE3C500AF7E9E /* Reachability.m in Sources */,
|
||||
EE7F29821219ECA300EB67A9 /* RenderContext.mm in Sources */,
|
||||
97DDBFDA1970079500B3A4FD /* GTLUploadParameters.m in Sources */,
|
||||
97DDBFEC1970079500B3A4FD /* GTMNSString+URLArguments.m in Sources */,
|
||||
97DDBFC41970079500B3A4FD /* GTLPlusConstants.m in Sources */,
|
||||
97DDBFF01970079500B3A4FD /* GTMOAuth2SignIn.m in Sources */,
|
||||
FAFCB63613366E78001A5C59 /* WebViewController.mm in Sources */,
|
||||
97DDBFC81970079500B3A4FD /* GTLPlusMoment.m in Sources */,
|
||||
97DDBFB61970079500B3A4FD /* GTLObject.m in Sources */,
|
||||
FA34BECA1338D72F00FFB2A7 /* CustomAlertView.mm in Sources */,
|
||||
97F61781183E6172009919E2 /* LocationButton.mm in Sources */,
|
||||
9747264318323080006B7CB7 /* UIKitCategories.m in Sources */,
|
||||
|
@ -4464,43 +4788,70 @@
|
|||
97D092B9190AA69700FF645B /* SmallCompassView.mm in Sources */,
|
||||
97A8001418B2140A000C07A2 /* SearchResultCell.m in Sources */,
|
||||
97A8002718B2741C000C07A2 /* SearchCell.m in Sources */,
|
||||
97DDBFF61970079500B3A4FD /* GTMObjC2Runtime.m in Sources */,
|
||||
97DDBFEA1970079500B3A4FD /* GTMNSDictionary+URLArguments.m in Sources */,
|
||||
97DDBFC21970079500B3A4FD /* GTLPlusCommentFeed.m in Sources */,
|
||||
97DDBFAC1970079500B3A4FD /* GTLBatchResult.m in Sources */,
|
||||
97908B2C19658767003DD7C6 /* SearchCategoryCell.m in Sources */,
|
||||
97DDBFBA1970079500B3A4FD /* GTLPlusAclentryResource.m in Sources */,
|
||||
9778E9A5191A86D800AD850A /* SelectedColorView.m in Sources */,
|
||||
97D807B818A92AAB00D416E0 /* MoreAppsVC.mm in Sources */,
|
||||
97DDBFDC1970079500B3A4FD /* GTLUtilities.m in Sources */,
|
||||
97DDBFD61970079500B3A4FD /* GTLRuntimeCommon.m in Sources */,
|
||||
9789DB5A188D94F9007C6FAE /* InterstitialView.mm in Sources */,
|
||||
FA29FDAA141E77F8004ADF66 /* Preferences.mm in Sources */,
|
||||
97DDBFEE1970079500B3A4FD /* GTMOAuth2Authentication.m in Sources */,
|
||||
97DDBFB01970079500B3A4FD /* GTLErrorObject.m in Sources */,
|
||||
97A8000C18B21363000C07A2 /* SearchView.mm in Sources */,
|
||||
FAA5C2A2144F135F005337F6 /* LocationManager.mm in Sources */,
|
||||
97DDBFC61970079500B3A4FD /* GTLPlusItemScope.m in Sources */,
|
||||
97AA2821190AD21100AE1AAB /* PlacePageShareCell.m in Sources */,
|
||||
97DDBFB21970079500B3A4FD /* GTLFramework.m in Sources */,
|
||||
97DEA09618D75BB000C5F963 /* ContextViews.mm in Sources */,
|
||||
978F9240183B660F000D6C7C /* SettingsViewController.mm in Sources */,
|
||||
97DDBFDE1970079500B3A4FD /* GTMHTTPFetcher.m in Sources */,
|
||||
97DDBFCC1970079500B3A4FD /* GTLPlusPeopleFeed.m in Sources */,
|
||||
97D807BC18A933FB00D416E0 /* MoreAppsCell.m in Sources */,
|
||||
97DDBFD21970079500B3A4FD /* GTLServicePlus.m in Sources */,
|
||||
F7B90CD31521E6D200C054EE /* CustomNavigationView.mm in Sources */,
|
||||
FA36B80D15403A4F004560CC /* BookmarksVC.mm in Sources */,
|
||||
9769D6EF1912BF3000CA6158 /* ContainerView.mm in Sources */,
|
||||
97DDBFCA1970079500B3A4FD /* GTLPlusMomentsFeed.m in Sources */,
|
||||
97DDBFD81970079500B3A4FD /* GTLService.m in Sources */,
|
||||
FAF457E715597D4600DCCC49 /* Framework.cpp in Sources */,
|
||||
97CC93BB19599F4700369B42 /* SearchSuggestCell.m in Sources */,
|
||||
FA054612155C465E001F4E37 /* SelectSetVC.mm in Sources */,
|
||||
FAA614B8155F16950031C345 /* AddSetVC.mm in Sources */,
|
||||
FAAEA7D5161D8D3100CCD661 /* BookmarksRootVC.mm in Sources */,
|
||||
F785EB4016386FC4003A38A8 /* BookmarkCell.mm in Sources */,
|
||||
97DDBFF81970079500B3A4FD /* OpenInChromeController.m in Sources */,
|
||||
9789DB56188D5E2A007C6FAE /* InAppMessagesManager.mm in Sources */,
|
||||
9778E99D191A5B6600AD850A /* BookmarkDescriptionVC.mm in Sources */,
|
||||
97DDBFBC1970079500B3A4FD /* GTLPlusActivity.m in Sources */,
|
||||
97387546184E475000170BC4 /* MessageComposeViewController.m in Sources */,
|
||||
97354B6E196EDD3A00352536 /* AccountManager.m in Sources */,
|
||||
97C98522186AE3CF00AF7E9E /* AppInfo.mm in Sources */,
|
||||
97DDBFA81970079500B3A4FD /* GTLBase64.m in Sources */,
|
||||
97DDBFAE1970079500B3A4FD /* GTLDateTime.m in Sources */,
|
||||
97DDBFAA1970079500B3A4FD /* GTLBatchQuery.m in Sources */,
|
||||
978F9242183B660F000D6C7C /* SelectableCell.m in Sources */,
|
||||
97DDBFB81970079500B3A4FD /* GTLPlusAcl.m in Sources */,
|
||||
CB252D6F16FF82C9001E41E9 /* Statistics.mm in Sources */,
|
||||
978F9244183B660F000D6C7C /* SwitchCell.m in Sources */,
|
||||
EDB811A3175E1A9C00E36BF2 /* TwoButtonsView.m in Sources */,
|
||||
97ABBA4518C8DF620079333C /* PlacePageView.mm in Sources */,
|
||||
97F61794183E7445009919E2 /* LinkCell.m in Sources */,
|
||||
97DDBFF21970079500B3A4FD /* GTMOAuth2ViewControllerTouch.m in Sources */,
|
||||
97D092B1190A681F00FF645B /* PlacePageInfoCell.mm in Sources */,
|
||||
97DDBFCE1970079500B3A4FD /* GTLPlusPerson.m in Sources */,
|
||||
97A8001018B21395000C07A2 /* SearchBar.mm in Sources */,
|
||||
97DDBFB41970079500B3A4FD /* GTLJSONParser.m in Sources */,
|
||||
97DDBFE61970079500B3A4FD /* GTMLogger.m in Sources */,
|
||||
EDC5C543175F2CA600420E92 /* ShareActionSheet.mm in Sources */,
|
||||
9778E9A1191A663700AD850A /* BookmarkNameVC.mm in Sources */,
|
||||
ED48BBB517C267F5003E7E92 /* ColorPickerView.mm in Sources */,
|
||||
97D40C0E184E389000A1D572 /* MailComposeViewController.m in Sources */,
|
||||
97DDBFD01970079500B3A4FD /* GTLQueryPlus.m in Sources */,
|
||||
ED48BBBA17C2B1E2003E7E92 /* CircleView.mm in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -4510,23 +4861,36 @@
|
|||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
FAFB08E9151215EE0041901D /* main.mm in Sources */,
|
||||
97DDBFC11970079500B3A4FD /* GTLPlusComment.m in Sources */,
|
||||
9747278518338F0C006B7CB7 /* UIViewController+Navigation.m in Sources */,
|
||||
FAFB08EA151215EE0041901D /* MapsAppDelegate.mm in Sources */,
|
||||
97908B31196591FB003DD7C6 /* SearchShowOnMapCell.m in Sources */,
|
||||
FAFB08EB151215EE0041901D /* EAGLView.mm in Sources */,
|
||||
97A8001118B21395000C07A2 /* SearchBar.mm in Sources */,
|
||||
97DDBFBF1970079500B3A4FD /* GTLPlusActivityFeed.m in Sources */,
|
||||
FAFB08EC151215EE0041901D /* MapViewController.mm in Sources */,
|
||||
FAFB08ED151215EE0041901D /* CountriesViewController.mm in Sources */,
|
||||
97DDBFE51970079500B3A4FD /* GTMHTTPFetchHistory.m in Sources */,
|
||||
FAFB08EE151215EE0041901D /* SettingsManager.mm in Sources */,
|
||||
FAFB08EF151215EE0041901D /* RenderBuffer.mm in Sources */,
|
||||
97DEA09718D75BB000C5F963 /* ContextViews.mm in Sources */,
|
||||
978F9254183BD530000D6C7C /* NavigationController.mm in Sources */,
|
||||
97A0EEFD192F3B43009B2779 /* BottomMenuCell.m in Sources */,
|
||||
97354B66196AF97200352536 /* PlacePageRoutingCell.m in Sources */,
|
||||
97DDBFE31970079500B3A4FD /* GTMHTTPFetcherService.m in Sources */,
|
||||
97DDBFE91970079500B3A4FD /* GTMMethodCheck.m in Sources */,
|
||||
97DDBFD51970079500B3A4FD /* GTLQuery.m in Sources */,
|
||||
97C9851F186AE3C500AF7E9E /* Reachability.m in Sources */,
|
||||
97DDBFE11970079500B3A4FD /* GTMHTTPFetcherLogging.m in Sources */,
|
||||
97ABBA4618C8DF620079333C /* PlacePageView.mm in Sources */,
|
||||
9789DB5B188D94F9007C6FAE /* InterstitialView.mm in Sources */,
|
||||
97DDBFDB1970079500B3A4FD /* GTLUploadParameters.m in Sources */,
|
||||
97DDBFED1970079500B3A4FD /* GTMNSString+URLArguments.m in Sources */,
|
||||
97DDBFC51970079500B3A4FD /* GTLPlusConstants.m in Sources */,
|
||||
97DDBFF11970079500B3A4FD /* GTMOAuth2SignIn.m in Sources */,
|
||||
FAFB08F0151215EE0041901D /* RenderContext.mm in Sources */,
|
||||
97DDBFC91970079500B3A4FD /* GTLPlusMoment.m in Sources */,
|
||||
97DDBFB71970079500B3A4FD /* GTLObject.m in Sources */,
|
||||
FAFB08F1151215EE0041901D /* WebViewController.mm in Sources */,
|
||||
9769D6F01912BF3000CA6158 /* ContainerView.mm in Sources */,
|
||||
FAFB08F2151215EE0041901D /* CustomAlertView.mm in Sources */,
|
||||
|
@ -4534,43 +4898,70 @@
|
|||
9747264418323080006B7CB7 /* UIKitCategories.m in Sources */,
|
||||
FAFB08F5151215EE0041901D /* Preferences.mm in Sources */,
|
||||
97D807BD18A933FB00D416E0 /* MoreAppsCell.m in Sources */,
|
||||
97DDBFF71970079500B3A4FD /* GTMObjC2Runtime.m in Sources */,
|
||||
97DDBFEB1970079500B3A4FD /* GTMNSDictionary+URLArguments.m in Sources */,
|
||||
97DDBFC31970079500B3A4FD /* GTLPlusCommentFeed.m in Sources */,
|
||||
97DDBFAD1970079500B3A4FD /* GTLBatchResult.m in Sources */,
|
||||
97908B2D1965876C003DD7C6 /* SearchCategoryCell.m in Sources */,
|
||||
97DDBFBB1970079500B3A4FD /* GTLPlusAclentryResource.m in Sources */,
|
||||
FAFB08F6151215EE0041901D /* LocationManager.mm in Sources */,
|
||||
9789DB57188D5E2A007C6FAE /* InAppMessagesManager.mm in Sources */,
|
||||
97DDBFDD1970079500B3A4FD /* GTLUtilities.m in Sources */,
|
||||
97DDBFD71970079500B3A4FD /* GTLRuntimeCommon.m in Sources */,
|
||||
97AA2822190AD21100AE1AAB /* PlacePageShareCell.m in Sources */,
|
||||
97D092BA190AA69700FF645B /* SmallCompassView.mm in Sources */,
|
||||
97DDBFEF1970079500B3A4FD /* GTMOAuth2Authentication.m in Sources */,
|
||||
97DDBFB11970079500B3A4FD /* GTLErrorObject.m in Sources */,
|
||||
978F9241183B660F000D6C7C /* SettingsViewController.mm in Sources */,
|
||||
97A8001518B2140A000C07A2 /* SearchResultCell.m in Sources */,
|
||||
97DDBFC71970079500B3A4FD /* GTLPlusItemScope.m in Sources */,
|
||||
F7B90CD41521E6D200C054EE /* CustomNavigationView.mm in Sources */,
|
||||
97DDBFB31970079500B3A4FD /* GTLFramework.m in Sources */,
|
||||
9778E9A2191A663700AD850A /* BookmarkNameVC.mm in Sources */,
|
||||
FA36B80E15403A4F004560CC /* BookmarksVC.mm in Sources */,
|
||||
97DDBFDF1970079500B3A4FD /* GTMHTTPFetcher.m in Sources */,
|
||||
97DDBFCD1970079500B3A4FD /* GTLPlusPeopleFeed.m in Sources */,
|
||||
97D807B918A92AAB00D416E0 /* MoreAppsVC.mm in Sources */,
|
||||
97DDBFD31970079500B3A4FD /* GTLServicePlus.m in Sources */,
|
||||
FAF457E815597D4600DCCC49 /* Framework.cpp in Sources */,
|
||||
97A8002818B2741C000C07A2 /* SearchCell.m in Sources */,
|
||||
974386DE19373EA400FD5659 /* ToastView.m in Sources */,
|
||||
97DDBFCB1970079500B3A4FD /* GTLPlusMomentsFeed.m in Sources */,
|
||||
97DDBFD91970079500B3A4FD /* GTLService.m in Sources */,
|
||||
FA054613155C465E001F4E37 /* SelectSetVC.mm in Sources */,
|
||||
97CC93BC19599F4700369B42 /* SearchSuggestCell.m in Sources */,
|
||||
FAA614B9155F16950031C345 /* AddSetVC.mm in Sources */,
|
||||
FAAEA7D6161D8D3100CCD661 /* BookmarksRootVC.mm in Sources */,
|
||||
97D092B6190A6E1D00FF645B /* PlacePageEditCell.mm in Sources */,
|
||||
F785EB4116386FC4003A38A8 /* BookmarkCell.mm in Sources */,
|
||||
97DDBFF91970079500B3A4FD /* OpenInChromeController.m in Sources */,
|
||||
97387547184E475000170BC4 /* MessageComposeViewController.m in Sources */,
|
||||
97C98523186AE3CF00AF7E9E /* AppInfo.mm in Sources */,
|
||||
97DDBFBD1970079500B3A4FD /* GTLPlusActivity.m in Sources */,
|
||||
978F9243183B660F000D6C7C /* SelectableCell.m in Sources */,
|
||||
97354B6F196EDD3F00352536 /* AccountManager.m in Sources */,
|
||||
97A0EEFB192F3B43009B2779 /* BottomMenu.mm in Sources */,
|
||||
97DDBFA91970079500B3A4FD /* GTLBase64.m in Sources */,
|
||||
97DDBFAF1970079500B3A4FD /* GTLDateTime.m in Sources */,
|
||||
97DDBFAB1970079500B3A4FD /* GTLBatchQuery.m in Sources */,
|
||||
CB252D7016FF82C9001E41E9 /* Statistics.mm in Sources */,
|
||||
97DDBFB91970079500B3A4FD /* GTLPlusAcl.m in Sources */,
|
||||
9778E99E191A5B6600AD850A /* BookmarkDescriptionVC.mm in Sources */,
|
||||
978F9245183B660F000D6C7C /* SwitchCell.m in Sources */,
|
||||
EDB811A4175E1A9C00E36BF2 /* TwoButtonsView.m in Sources */,
|
||||
97F61795183E7445009919E2 /* LinkCell.m in Sources */,
|
||||
EDC5C544175F2CA600420E92 /* ShareActionSheet.mm in Sources */,
|
||||
97DDBFF31970079500B3A4FD /* GTMOAuth2ViewControllerTouch.m in Sources */,
|
||||
9778E9A6191A86D800AD850A /* SelectedColorView.m in Sources */,
|
||||
97DDBFCF1970079500B3A4FD /* GTLPlusPerson.m in Sources */,
|
||||
97A8000D18B21363000C07A2 /* SearchView.mm in Sources */,
|
||||
97DDBFB51970079500B3A4FD /* GTLJSONParser.m in Sources */,
|
||||
97DDBFE71970079500B3A4FD /* GTMLogger.m in Sources */,
|
||||
ED48BBBB17C2B1E2003E7E92 /* CircleView.mm in Sources */,
|
||||
97D092B2190A681F00FF645B /* PlacePageInfoCell.mm in Sources */,
|
||||
9746492818EEE2F8004B4658 /* ToolbarView.m in Sources */,
|
||||
97D40C0F184E389000A1D572 /* MailComposeViewController.m in Sources */,
|
||||
97DDBFD11970079500B3A4FD /* GTLQueryPlus.m in Sources */,
|
||||
ED48BBC417C3B3BF003E7E92 /* ColorPickerView.mm in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -4623,6 +5014,11 @@
|
|||
"${SRCROOT}/Statistics",
|
||||
"${SRCROOT}",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
"-ObjC",
|
||||
);
|
||||
PROVISIONING_PROFILE = "";
|
||||
};
|
||||
|
@ -4737,6 +5133,11 @@
|
|||
"${SRCROOT}/Statistics",
|
||||
"${SRCROOT}",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
"-ObjC",
|
||||
);
|
||||
PROVISIONING_PROFILE = "";
|
||||
};
|
||||
|
@ -4805,6 +5206,11 @@
|
|||
"${SRCROOT}/Statistics",
|
||||
"${SRCROOT}",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
"-ObjC",
|
||||
);
|
||||
PROVISIONING_PROFILE = "";
|
||||
};
|
||||
|
@ -4877,6 +5283,11 @@
|
|||
"${SRCROOT}/Statistics",
|
||||
"${SRCROOT}",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
"-ObjC",
|
||||
);
|
||||
PROVISIONING_PROFILE = "";
|
||||
};
|
||||
|
@ -4944,6 +5355,11 @@
|
|||
"${SRCROOT}/Statistics",
|
||||
"${SRCROOT}",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
"-ObjC",
|
||||
);
|
||||
PROVISIONING_PROFILE = "";
|
||||
};
|
||||
|
@ -5012,6 +5428,11 @@
|
|||
"${SRCROOT}/Statistics",
|
||||
"${SRCROOT}",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
"-ObjC",
|
||||
);
|
||||
PROVISIONING_PROFILE = "";
|
||||
};
|
||||
|
@ -5084,6 +5505,11 @@
|
|||
"${SRCROOT}/Statistics",
|
||||
"${SRCROOT}",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
"-ObjC",
|
||||
);
|
||||
PROVISIONING_PROFILE = "";
|
||||
};
|
||||
|
@ -5156,6 +5582,11 @@
|
|||
"${SRCROOT}/Statistics",
|
||||
"${SRCROOT}",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
"-ObjC",
|
||||
);
|
||||
PROVISIONING_PROFILE = "";
|
||||
};
|
||||
|
@ -5227,6 +5658,11 @@
|
|||
"${SRCROOT}/Statistics",
|
||||
"${SRCROOT}",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
"-ObjC",
|
||||
);
|
||||
PROVISIONING_PROFILE = "";
|
||||
};
|
||||
|
@ -5298,6 +5734,11 @@
|
|||
"${SRCROOT}/Statistics",
|
||||
"${SRCROOT}",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
"-ObjC",
|
||||
);
|
||||
PROVISIONING_PROFILE = "";
|
||||
};
|
||||
|
@ -5368,6 +5809,11 @@
|
|||
"${SRCROOT}/Statistics",
|
||||
"${SRCROOT}",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
"-ObjC",
|
||||
);
|
||||
PROVISIONING_PROFILE = "";
|
||||
};
|
||||
|
@ -5396,6 +5842,7 @@
|
|||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/GoogleAdMob/SDK",
|
||||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/Millennial/SDK",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
|
@ -5428,6 +5875,7 @@
|
|||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/GoogleAdMob/SDK",
|
||||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/Millennial/SDK",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
|
@ -5460,6 +5908,7 @@
|
|||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/GoogleAdMob/SDK",
|
||||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/Millennial/SDK",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
|
@ -5492,6 +5941,7 @@
|
|||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/GoogleAdMob/SDK",
|
||||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/Millennial/SDK",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
|
@ -5524,6 +5974,7 @@
|
|||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/GoogleAdMob/SDK",
|
||||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/Millennial/SDK",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
|
@ -5556,6 +6007,7 @@
|
|||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/GoogleAdMob/SDK",
|
||||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/Millennial/SDK",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
|
@ -5588,6 +6040,7 @@
|
|||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/GoogleAdMob/SDK",
|
||||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/Millennial/SDK",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
|
@ -5620,6 +6073,7 @@
|
|||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/GoogleAdMob/SDK",
|
||||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/Millennial/SDK",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
|
@ -5652,6 +6106,7 @@
|
|||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/GoogleAdMob/SDK",
|
||||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/Millennial/SDK",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
|
@ -5684,6 +6139,7 @@
|
|||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/GoogleAdMob/SDK",
|
||||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/Millennial/SDK",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
|
@ -5716,6 +6172,7 @@
|
|||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/GoogleAdMob/SDK",
|
||||
"$(SRCROOT)/MoPubSDK/AdNetworkSupport/Millennial/SDK",
|
||||
"/Users/Alex/Developer/omim/omim-debug/out/debug",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lstats_client",
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>AarkiClientSecurityKey</key>
|
||||
<string>lN96dHHOKoi6mGD5NtsFx8NmuQqM</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
|
@ -36,13 +38,41 @@
|
|||
<string>mapswithmelite</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>com.mapswithme.travelguide</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>com.mapswithme.travelguide</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>com.mapswithme.travelguide.beta</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>com.mapswithme.travelguide.beta</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>FacebookAppID</key>
|
||||
<string>272257082798521</string>
|
||||
<key>FacebookDisplayName</key>
|
||||
<string>MapsWithMe Lite, offline maps</string>
|
||||
<key>FlurryKey</key>
|
||||
<string>***REMOVED***</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>MobileAppTrackerAdvertiserId</key>
|
||||
<string>14130</string>
|
||||
<key>MobileAppTrackerConversionKey</key>
|
||||
<string>***REMOVED***</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainWindow</string>
|
||||
<key>NSMainNibFile~ipad</key>
|
||||
|
@ -60,15 +90,5 @@
|
|||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>FacebookDisplayName</key>
|
||||
<string>MapsWithMe Lite, offline maps</string>
|
||||
<key>FacebookAppID</key>
|
||||
<string>272257082798521</string>
|
||||
<key>AarkiClientSecurityKey</key>
|
||||
<string>lN96dHHOKoi6mGD5NtsFx8NmuQqM</string>
|
||||
<key>MobileAppTrackerConversionKey</key>
|
||||
<string>***REMOVED***</string>
|
||||
<key>MobileAppTrackerAdvertiserId</key>
|
||||
<string>14130</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>AarkiClientSecurityKey</key>
|
||||
<string>2mWtcnLWDuXgdKEhYLmatwh3cby3</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
|
@ -69,13 +71,61 @@
|
|||
<string>mapswithmepro</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>com.mapswithme.full</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>com.mapswithme.full</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>com.mapswithme.full.debug</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>com.mapswithme.full.debug</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>com.mapswithme.full.simulator</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>com.mapswithme.full.simulator</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>com.mapswithme.full.beta</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>com.mapswithme.full.beta</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>FacebookAppID</key>
|
||||
<string>185237551520383</string>
|
||||
<key>FacebookDisplayName</key>
|
||||
<string>MapsWithMe, offline maps</string>
|
||||
<key>FlurryKey</key>
|
||||
<string>***REMOVED***</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>MobileAppTrackerAdvertiserId</key>
|
||||
<string>14130</string>
|
||||
<key>MobileAppTrackerConversionKey</key>
|
||||
<string>***REMOVED***</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainWindow</string>
|
||||
<key>NSMainNibFile~ipad</key>
|
||||
|
@ -142,15 +192,5 @@
|
|||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
<key>FacebookDisplayName</key>
|
||||
<string>MapsWithMe, offline maps</string>
|
||||
<key>FacebookAppID</key>
|
||||
<string>185237551520383</string>
|
||||
<key>AarkiClientSecurityKey</key>
|
||||
<string>2mWtcnLWDuXgdKEhYLmatwh3cby3</string>
|
||||
<key>MobileAppTrackerConversionKey</key>
|
||||
<string>***REMOVED***</string>
|
||||
<key>MobileAppTrackerAdvertiserId</key>
|
||||
<string>14130</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
Loading…
Add table
Reference in a new issue