Bump External dependencies.
This commit is contained in:
30
External/google-plus-ios-sdk/SampleCode/AppDelegate.h
vendored
Normal file
30
External/google-plus-ios-sdk/SampleCode/AppDelegate.h
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// AppDelegate.h
|
||||
//
|
||||
// Copyright 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 <UIKit/UIKit.h>
|
||||
|
||||
@class GTMOAuth2Authentication;
|
||||
|
||||
@interface AppDelegate : UIResponder<UIApplicationDelegate>
|
||||
|
||||
// The sample app's |UIWindow|.
|
||||
@property (retain, nonatomic) UIWindow *window;
|
||||
// The navigation controller.
|
||||
@property (retain, nonatomic) UINavigationController *navigationController;
|
||||
|
||||
@end
|
90
External/google-plus-ios-sdk/SampleCode/AppDelegate.m
vendored
Normal file
90
External/google-plus-ios-sdk/SampleCode/AppDelegate.m
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// AppDelegate.m
|
||||
//
|
||||
// Copyright 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 "AppDelegate.h"
|
||||
|
||||
#import <GooglePlus/GooglePlus.h>
|
||||
#import "MasterViewController.h"
|
||||
|
||||
@interface AppDelegate () <GPPDeepLinkDelegate>
|
||||
|
||||
@end
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
@synthesize window = window_;
|
||||
@synthesize navigationController = navigationController_;
|
||||
|
||||
// DO NOT USE THIS CLIENT ID. IT WILL NOT WORK FOR YOUR APP.
|
||||
// Please use the client ID created for you by Google.
|
||||
static NSString * const kClientID =
|
||||
@"452265719636.apps.googleusercontent.com";
|
||||
|
||||
#pragma mark Object life-cycle.
|
||||
|
||||
- (void)dealloc {
|
||||
[window_ release];
|
||||
[navigationController_ release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (BOOL)application:(UIApplication *)application
|
||||
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
// Set app's client ID for |GPPSignIn| and |GPPShare|.
|
||||
[GPPSignIn sharedInstance].clientID = kClientID;
|
||||
|
||||
self.window = [[[UIWindow alloc]
|
||||
initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
|
||||
MasterViewController *masterViewController =
|
||||
[[[MasterViewController alloc] initWithNibName:@"MasterViewController"
|
||||
bundle:nil] autorelease];
|
||||
self.navigationController =
|
||||
[[[UINavigationController alloc]
|
||||
initWithRootViewController:masterViewController] autorelease];
|
||||
self.window.rootViewController = self.navigationController;
|
||||
[self.window makeKeyAndVisible];
|
||||
|
||||
// Read Google+ deep-link data.
|
||||
[GPPDeepLink setDelegate:self];
|
||||
[GPPDeepLink readDeepLinkAfterInstall];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)application:(UIApplication *)application
|
||||
openURL:(NSURL *)url
|
||||
sourceApplication:(NSString *)sourceApplication
|
||||
annotation:(id)annotation {
|
||||
return [GPPURLHandler handleURL:url
|
||||
sourceApplication:sourceApplication
|
||||
annotation:annotation];
|
||||
}
|
||||
|
||||
#pragma mark - GPPDeepLinkDelegate
|
||||
|
||||
- (void)didReceiveDeepLink:(GPPDeepLink *)deepLink {
|
||||
// An example to handle the deep link data.
|
||||
UIAlertView *alert = [[[UIAlertView alloc]
|
||||
initWithTitle:@"Deep-link Data"
|
||||
message:[deepLink deepLinkID]
|
||||
delegate:nil
|
||||
cancelButtonTitle:@"OK"
|
||||
otherButtonTitles:nil] autorelease];
|
||||
[alert show];
|
||||
}
|
||||
|
||||
@end
|
@@ -11,6 +11,8 @@
|
||||
<key>CFBundleIconFiles</key>
|
||||
<array>
|
||||
<string>Icon.png</string>
|
||||
<string>Icon-72.png</string>
|
||||
<string>Icon-144.png</string>
|
||||
<string>Icon@2x.png</string>
|
||||
</array>
|
||||
<key>CFBundleIcons</key>
|
||||
@@ -20,6 +22,8 @@
|
||||
<key>CFBundleIconFiles</key>
|
||||
<array>
|
||||
<string>Icon.png</string>
|
||||
<string>Icon-72.png</string>
|
||||
<string>Icon-144.png</string>
|
||||
<string>Icon@2x.png</string>
|
||||
</array>
|
||||
</dict>
|
||||
|
File diff suppressed because it is too large
Load Diff
48
External/google-plus-ios-sdk/SampleCode/ListMomentsViewController.h
vendored
Normal file
48
External/google-plus-ios-sdk/SampleCode/ListMomentsViewController.h
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// ListMomentsViewController.h
|
||||
//
|
||||
// Copyright 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 <UIKit/UIKit.h>
|
||||
|
||||
@class GTLPlusMoment;
|
||||
|
||||
@interface ListMomentsViewController : UIViewController<
|
||||
UITableViewDelegate,
|
||||
UITableViewDataSource> {
|
||||
// A map from activities to verbs used for display.
|
||||
NSDictionary *verbMap_;
|
||||
// An array of |GTLPlusMoment|, as the data source.
|
||||
NSMutableArray *momentsData_;
|
||||
// Currently selected moment in the |momentsData_| array.
|
||||
GTLPlusMoment *selectedMoment_;
|
||||
}
|
||||
|
||||
// The table that displays the list of moments for the user.
|
||||
@property (retain, nonatomic) IBOutlet UITableView *momentsTable;
|
||||
// A label to display the status of selected moment, or general status.
|
||||
@property (retain, nonatomic) IBOutlet UILabel *momentStatus;
|
||||
// A label to display the target of selected moment.
|
||||
@property (retain, nonatomic) IBOutlet UILabel *momentTarget;
|
||||
// A label to display the time of selected moment.
|
||||
@property (retain, nonatomic) IBOutlet UILabel *momentTime;
|
||||
// A button to remove selected moment.
|
||||
@property (retain, nonatomic) IBOutlet UIButton *momentRemoval;
|
||||
|
||||
// Called when the remove button is pressed.
|
||||
- (IBAction)removeMoment:(id)sender;
|
||||
|
||||
@end
|
216
External/google-plus-ios-sdk/SampleCode/ListMomentsViewController.m
vendored
Normal file
216
External/google-plus-ios-sdk/SampleCode/ListMomentsViewController.m
vendored
Normal file
@@ -0,0 +1,216 @@
|
||||
//
|
||||
// ListMomentsViewController.m
|
||||
//
|
||||
// Copyright 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 "ListMomentsViewController.h"
|
||||
|
||||
#import <GoogleOpenSource/GoogleOpenSource.h>
|
||||
#import <GooglePlus/GooglePlus.h>
|
||||
|
||||
@interface ListMomentsViewController ()
|
||||
- (void)clearSelectedMoment;
|
||||
- (void)refreshData;
|
||||
- (NSString *)textForMoment:(GTLPlusMoment *)moment;
|
||||
@end
|
||||
|
||||
#pragma mark - View lifecycle
|
||||
|
||||
@implementation ListMomentsViewController
|
||||
|
||||
@synthesize momentsTable = momentsTable_;
|
||||
@synthesize momentStatus = momentStatus_;
|
||||
@synthesize momentTarget = momentTarget_;
|
||||
@synthesize momentTime = momentTime_;
|
||||
@synthesize momentRemoval = momentsRemoval_;
|
||||
|
||||
#pragma mark - Object lifecycle
|
||||
|
||||
- (id)initWithNibName:(NSString *)nibNameOrNil
|
||||
bundle:(NSBundle *)nibBundleOrNil {
|
||||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||||
if (self) {
|
||||
verbMap_ = [[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"Added", @"http://schemas.google.com/AddActivity",
|
||||
@"Bought", @"http://schemas.google.com/BuyActivity",
|
||||
@"Checked in", @"http://schemas.google.com/CheckInActivity",
|
||||
@"Commented on", @"http://schemas.google.com/CommentActivity",
|
||||
@"Created", @"http://schemas.google.com/CreateActivity",
|
||||
@"Listened to", @"http://schemas.google.com/ListenActivity",
|
||||
@"Made a reservation at", @"http://schemas.google.com/ReserveActivity",
|
||||
@"Reviewed", @"http://schemas.google.com/ReviewActivity",
|
||||
nil] retain];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[verbMap_ release];
|
||||
[momentsData_ release];
|
||||
[selectedMoment_ release];
|
||||
[momentsTable_ release];
|
||||
[momentStatus_ release];
|
||||
[momentTarget_ release];
|
||||
[momentTime_ release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
#pragma mark - View lifecycle
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self refreshData];
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate/UITableViewDataSource
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView
|
||||
numberOfRowsInSection:(NSInteger)section {
|
||||
return momentsData_.count;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView
|
||||
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
static NSString * const kCellIdentifier = @"Cell";
|
||||
UITableViewCell *cell =
|
||||
[tableView dequeueReusableCellWithIdentifier:kCellIdentifier];
|
||||
if (cell == nil) {
|
||||
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
|
||||
reuseIdentifier:kCellIdentifier]
|
||||
autorelease];
|
||||
cell.accessoryType = UITableViewCellAccessoryNone;
|
||||
}
|
||||
|
||||
// Configure the cell.
|
||||
GTLPlusMoment *moment = momentsData_[indexPath.row];
|
||||
cell.textLabel.text = [self textForMoment:moment];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView
|
||||
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
GTLPlusMoment *moment = momentsData_[indexPath.row];
|
||||
[selectedMoment_ autorelease];
|
||||
selectedMoment_ = [moment retain];
|
||||
momentStatus_.text = [NSString stringWithFormat:@"Target for \"%@\":",
|
||||
[self textForMoment:moment]];
|
||||
momentTarget_.text = moment.target.url;
|
||||
momentTime_.text = [NSString stringWithFormat:@"Start time: %@",
|
||||
[NSDateFormatter localizedStringFromDate:moment.startDate.date
|
||||
dateStyle:kCFDateFormatterMediumStyle
|
||||
timeStyle:kCFDateFormatterMediumStyle]];
|
||||
momentsRemoval_.hidden = NO;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView
|
||||
didDeselectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[self clearSelectedMoment];
|
||||
}
|
||||
|
||||
#pragma mark - IBActions
|
||||
|
||||
- (IBAction)removeMoment:(id)sender {
|
||||
if (!selectedMoment_) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Here is an example of removing a moment from Google+:
|
||||
// 1. Create a |GTLQuery| object to remove the moment.
|
||||
GTLQueryPlus *query = [GTLQueryPlus
|
||||
queryForMomentsRemoveWithIdentifier:selectedMoment_.identifier];
|
||||
|
||||
// 2. Execute the query.
|
||||
[[[GPPSignIn sharedInstance] plusService] executeQuery:query
|
||||
completionHandler:^(GTLServiceTicket *ticket,
|
||||
id object,
|
||||
NSError *error) {
|
||||
if (error) {
|
||||
momentStatus_.text =
|
||||
[NSString stringWithFormat:@"Error: %@", error];
|
||||
GTMLoggerError(@"Status: Error: %@", error);
|
||||
} else {
|
||||
[momentsData_ removeObject:selectedMoment_];
|
||||
[self clearSelectedMoment];
|
||||
[momentsTable_ reloadData];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Helper methods
|
||||
|
||||
- (void)clearSelectedMoment {
|
||||
[selectedMoment_ autorelease];
|
||||
selectedMoment_ = nil;
|
||||
momentStatus_.text = @"";
|
||||
momentTarget_.text = @"";
|
||||
momentTime_.text = @"";
|
||||
momentsRemoval_.hidden = YES;
|
||||
}
|
||||
|
||||
- (void)refreshData {
|
||||
GTMOAuth2Authentication *auth = [GPPSignIn sharedInstance].authentication;
|
||||
if (!auth) {
|
||||
// To authenticate, use Google+ sign-in button.
|
||||
momentStatus_.text = @"Status: Not authenticated";
|
||||
return;
|
||||
}
|
||||
// Clear old moments data.
|
||||
[momentsData_ autorelease];
|
||||
momentsData_ = nil;
|
||||
[momentsTable_ reloadData];
|
||||
[self clearSelectedMoment];
|
||||
momentStatus_.text = @"Status: Loading";
|
||||
|
||||
// Here is an example of reading list of moments from Google+:
|
||||
// 1. Create a |GTLQuery| object to list moments.
|
||||
GTLQueryPlus *query =
|
||||
[GTLQueryPlus queryForMomentsListWithUserId:@"me"
|
||||
collection:kGTLPlusCollectionVault];
|
||||
|
||||
// 2. Execute the query.
|
||||
[[[GPPSignIn sharedInstance] plusService] executeQuery:query
|
||||
completionHandler:^(GTLServiceTicket *ticket,
|
||||
id object,
|
||||
NSError *error) {
|
||||
if (error) {
|
||||
momentStatus_.text =
|
||||
[NSString stringWithFormat:@"Error: %@", error];
|
||||
GTMLoggerError(@"Status: Error: %@", error);
|
||||
} else {
|
||||
GTLPlusMomentsFeed *moments = (GTLPlusMomentsFeed *)object;
|
||||
momentsData_ =
|
||||
[[NSMutableArray arrayWithArray:moments.items] retain];
|
||||
momentStatus_.text = [NSString stringWithFormat:
|
||||
@"Status: Loaded %d moment(s)", momentsData_.count];
|
||||
[momentsTable_ reloadData];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (NSString *)textForMoment:(GTLPlusMoment *)moment {
|
||||
NSString *verb = [verbMap_ objectForKey:moment.type];
|
||||
if (!verb) {
|
||||
// Fallback for verbs we don't recognize.
|
||||
verb = [moment.type lastPathComponent];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%@ %@", verb, moment.target.name];
|
||||
}
|
||||
|
||||
@end
|
429
External/google-plus-ios-sdk/SampleCode/ListMomentsViewController.xib
vendored
Normal file
429
External/google-plus-ios-sdk/SampleCode/ListMomentsViewController.xib
vendored
Normal file
@@ -0,0 +1,429 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1552</int>
|
||||
<string key="IBDocument.SystemVersion">12C60</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">3084</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">2083</string>
|
||||
</object>
|
||||
<array key="IBDocument.IntegratedClassDependencies">
|
||||
<string>IBProxyObject</string>
|
||||
<string>IBUIButton</string>
|
||||
<string>IBUILabel</string>
|
||||
<string>IBUITableView</string>
|
||||
<string>IBUIView</string>
|
||||
</array>
|
||||
<array key="IBDocument.PluginDependencies">
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</array>
|
||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
|
||||
<integer value="1" key="NS.object.0"/>
|
||||
</object>
|
||||
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
|
||||
<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="IBUIView" id="191373211">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="IBUILabel" id="1065162584">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{15, 240}, {285, 42}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<int key="IBUIContentMode">7</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<string key="IBUIText"/>
|
||||
<object class="NSColor" key="IBUITextColor" id="535034633">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MCAwIDAAA</bytes>
|
||||
<string key="IBUIColorCocoaTouchKeyPath">darkTextColor</string>
|
||||
</object>
|
||||
<nil key="IBUIHighlightedColor"/>
|
||||
<int key="IBUIBaselineAdjustment">0</int>
|
||||
<int key="IBUINumberOfLines">2</int>
|
||||
<object class="IBUIFontDescription" key="IBUIFontDescription" id="301803659">
|
||||
<int key="type">1</int>
|
||||
<double key="pointSize">17</double>
|
||||
</object>
|
||||
<object class="NSFont" key="IBUIFont" id="965205771">
|
||||
<string key="NSName">Helvetica</string>
|
||||
<double key="NSSize">17</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
|
||||
<double key="preferredMaxLayoutWidth">285</double>
|
||||
</object>
|
||||
<object class="IBUIButton" id="550280117">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{15, 359}, {89, 44}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<int key="IBUIContentHorizontalAlignment">0</int>
|
||||
<int key="IBUIContentVerticalAlignment">0</int>
|
||||
<int key="IBUIButtonType">1</int>
|
||||
<string key="IBUINormalTitle">Remove</string>
|
||||
<object class="NSColor" key="IBUIHighlightedTitleColor" id="475673723">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
</object>
|
||||
<object class="NSColor" key="IBUINormalTitleColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
|
||||
</object>
|
||||
<object class="NSColor" key="IBUINormalTitleShadowColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MC41AA</bytes>
|
||||
</object>
|
||||
<object class="IBUIFontDescription" key="IBUIFontDescription">
|
||||
<int key="type">2</int>
|
||||
<double key="pointSize">15</double>
|
||||
</object>
|
||||
<object class="NSFont" key="IBUIFont">
|
||||
<string key="NSName">Helvetica-Bold</string>
|
||||
<double key="NSSize">15</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUIView" id="624954994">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="IBUITableView" id="307593524">
|
||||
<reference key="NSNextResponder" ref="624954994"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<string key="NSFrame">{{20, 20}, {320, 238}}</string>
|
||||
<reference key="NSSuperview" ref="624954994"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="1065162584"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<reference key="IBUIBackgroundColor" ref="475673723"/>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<bool key="IBUIAlwaysBounceVertical">YES</bool>
|
||||
<int key="IBUISeparatorStyle">1</int>
|
||||
<int key="IBUISectionIndexMinimumDisplayRowCount">0</int>
|
||||
<bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool>
|
||||
<float key="IBUIRowHeight">44</float>
|
||||
<float key="IBUISectionHeaderHeight">22</float>
|
||||
<float key="IBUISectionFooterHeight">22</float>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{-20, -20}, {360, 258}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="307593524"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:10</string>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
<object class="NSColorSpace" key="NSCustomColorSpace" id="619355701">
|
||||
<int key="NSID">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUILabel" id="422188795">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{15, 284}, {285, 42}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="153778411"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<int key="IBUIContentMode">7</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<string key="IBUIText"/>
|
||||
<reference key="IBUITextColor" ref="535034633"/>
|
||||
<nil key="IBUIHighlightedColor"/>
|
||||
<int key="IBUIBaselineAdjustment">0</int>
|
||||
<int key="IBUINumberOfLines">2</int>
|
||||
<reference key="IBUIFontDescription" ref="301803659"/>
|
||||
<reference key="IBUIFont" ref="965205771"/>
|
||||
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
|
||||
<double key="preferredMaxLayoutWidth">285</double>
|
||||
</object>
|
||||
<object class="IBUILabel" id="153778411">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{15, 330}, {285, 21}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="550280117"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<int key="IBUIContentMode">7</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<string key="IBUIText"/>
|
||||
<reference key="IBUITextColor" ref="535034633"/>
|
||||
<nil key="IBUIHighlightedColor"/>
|
||||
<int key="IBUIBaselineAdjustment">0</int>
|
||||
<reference key="IBUIFontDescription" ref="301803659"/>
|
||||
<reference key="IBUIFont" ref="965205771"/>
|
||||
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="624954994"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
<reference key="NSCustomColorSpace" ref="619355701"/>
|
||||
</object>
|
||||
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<array class="NSMutableArray" key="connectionRecords">
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">view</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="191373211"/>
|
||||
</object>
|
||||
<int key="connectionID">3</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">momentRemoval</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="550280117"/>
|
||||
</object>
|
||||
<int key="connectionID">61</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">momentsTable</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="307593524"/>
|
||||
</object>
|
||||
<int key="connectionID">33</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">momentStatus</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="1065162584"/>
|
||||
</object>
|
||||
<int key="connectionID">76</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">momentTarget</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="422188795"/>
|
||||
</object>
|
||||
<int key="connectionID">101</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">momentTime</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="153778411"/>
|
||||
</object>
|
||||
<int key="connectionID">107</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
<reference key="source" ref="307593524"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
</object>
|
||||
<int key="connectionID">35</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">dataSource</string>
|
||||
<reference key="source" ref="307593524"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
</object>
|
||||
<int key="connectionID">34</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">removeMoment:</string>
|
||||
<reference key="source" ref="550280117"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
<int key="IBEventType">7</int>
|
||||
</object>
|
||||
<int key="connectionID">62</int>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<array key="orderedObjects">
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">0</int>
|
||||
<array key="object" id="0"/>
|
||||
<reference key="children" ref="1000"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">1</int>
|
||||
<reference key="object" ref="191373211"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="624954994"/>
|
||||
<reference ref="153778411"/>
|
||||
<reference ref="1065162584"/>
|
||||
<reference ref="422188795"/>
|
||||
<reference ref="550280117"/>
|
||||
</array>
|
||||
<reference key="parent" ref="0"/>
|
||||
</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">14</int>
|
||||
<reference key="object" ref="1065162584"/>
|
||||
<array class="NSMutableArray" key="children"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">56</int>
|
||||
<reference key="object" ref="550280117"/>
|
||||
<array class="NSMutableArray" key="children"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">66</int>
|
||||
<reference key="object" ref="624954994"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="307593524"/>
|
||||
</array>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">4</int>
|
||||
<reference key="object" ref="307593524"/>
|
||||
<array class="NSMutableArray" key="children"/>
|
||||
<reference key="parent" ref="624954994"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">93</int>
|
||||
<reference key="object" ref="422188795"/>
|
||||
<array class="NSMutableArray" key="children"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">103</int>
|
||||
<reference key="object" ref="153778411"/>
|
||||
<array class="NSMutableArray" key="children"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
<string key="-1.CustomClassName">ListMomentsViewController</string>
|
||||
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="-2.CustomClassName">UIResponder</string>
|
||||
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="103.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="14.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="56.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<real value="0.0" key="56.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
|
||||
<string key="66.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="93.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
|
||||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">151</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">ListMomentsViewController</string>
|
||||
<string key="superclassName">UIViewController</string>
|
||||
<object class="NSMutableDictionary" key="actions">
|
||||
<string key="NS.key.0">removeMoment:</string>
|
||||
<string key="NS.object.0">id</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="actionInfosByName">
|
||||
<string key="NS.key.0">removeMoment:</string>
|
||||
<object class="IBActionInfo" key="NS.object.0">
|
||||
<string key="name">removeMoment:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="outlets">
|
||||
<string key="momentRemoval">UIButton</string>
|
||||
<string key="momentStatus">UILabel</string>
|
||||
<string key="momentTarget">UILabel</string>
|
||||
<string key="momentTime">UILabel</string>
|
||||
<string key="momentsTable">UITableView</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<object class="IBToOneOutletInfo" key="momentRemoval">
|
||||
<string key="name">momentRemoval</string>
|
||||
<string key="candidateClassName">UIButton</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="momentStatus">
|
||||
<string key="name">momentStatus</string>
|
||||
<string key="candidateClassName">UILabel</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="momentTarget">
|
||||
<string key="name">momentTarget</string>
|
||||
<string key="candidateClassName">UILabel</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="momentTime">
|
||||
<string key="name">momentTime</string>
|
||||
<string key="candidateClassName">UILabel</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="momentsTable">
|
||||
<string key="name">momentsTable</string>
|
||||
<string key="candidateClassName">UITableView</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/ListMomentsViewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<string key="IBCocoaTouchPluginVersion">2083</string>
|
||||
</data>
|
||||
</archive>
|
38
External/google-plus-ios-sdk/SampleCode/ListPeopleViewController.h
vendored
Normal file
38
External/google-plus-ios-sdk/SampleCode/ListPeopleViewController.h
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// GooglePlusSamplePeopleListViewController.h
|
||||
//
|
||||
// Copyright 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 <UIKit/UIKit.h>
|
||||
|
||||
// A view controller for listing people that are visible to this sample app.
|
||||
// The open-source GTLPlus libraries are required.
|
||||
@interface ListPeopleViewController : UIViewController<
|
||||
UITableViewDelegate,
|
||||
UITableViewDataSource>
|
||||
|
||||
// A label to display the result of the listing people action.
|
||||
@property (retain, nonatomic) IBOutlet UILabel *peopleStatus;
|
||||
// The table that displays a list of people that is visible to this sample app.
|
||||
@property (retain, nonatomic) IBOutlet UITableView *peopleTable;
|
||||
|
||||
// A list of people that is visible to this sample app.
|
||||
@property (retain, nonatomic) NSArray *peopleList;
|
||||
// A list of people profile images that we will prefetch that is
|
||||
// visible to this sample app.
|
||||
@property (retain, nonatomic) NSMutableArray *peopleImageList;
|
||||
|
||||
@end
|
186
External/google-plus-ios-sdk/SampleCode/ListPeopleViewController.m
vendored
Normal file
186
External/google-plus-ios-sdk/SampleCode/ListPeopleViewController.m
vendored
Normal file
@@ -0,0 +1,186 @@
|
||||
//
|
||||
// ListPeopleViewController.m
|
||||
//
|
||||
// Copyright 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 "ListPeopleViewController.h"
|
||||
|
||||
#import <GoogleOpenSource/GoogleOpenSource.h>
|
||||
#import <GooglePlus/GooglePlus.h>
|
||||
|
||||
@interface ListPeopleViewController()
|
||||
- (void)listPeople:(NSString *)collection;
|
||||
- (void)reportAuthStatus;
|
||||
- (void)fetchPeopleImages;
|
||||
@end
|
||||
|
||||
@implementation ListPeopleViewController
|
||||
|
||||
@synthesize peopleTable = peopleTable_;
|
||||
@synthesize peopleList = peopleList_;
|
||||
@synthesize peopleStatus = peopleStatus_;
|
||||
@synthesize peopleImageList = peopleImageList_;
|
||||
|
||||
#pragma mark - Object lifecycle
|
||||
|
||||
- (void)dealloc {
|
||||
[peopleStatus_ release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
#pragma mark - View lifecycle
|
||||
|
||||
- (void)viewDidLoad {
|
||||
// Report whether the user is authenticated with
|
||||
// https://www.googleapis.com/auth/plus.login scope.
|
||||
[self reportAuthStatus];
|
||||
// Send Google+ request to get list of people that is visible to this app.
|
||||
[self listPeople:kGTLPlusCollectionVisible];
|
||||
[super viewDidLoad];
|
||||
}
|
||||
|
||||
- (void)viewDidUnload {
|
||||
[peopleImageList_ release];
|
||||
[peopleList_ release];
|
||||
[peopleStatus_ release];
|
||||
[super viewDidUnload];
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate/UITableViewDataSource
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView
|
||||
numberOfRowsInSection:(NSInteger)section {
|
||||
return peopleList_.count;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView
|
||||
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
static NSString *const kCellIdentifier = @"Cell";
|
||||
UITableViewCell *cell =
|
||||
[tableView dequeueReusableCellWithIdentifier:kCellIdentifier];
|
||||
if (cell == nil) {
|
||||
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
|
||||
reuseIdentifier:kCellIdentifier]
|
||||
autorelease];
|
||||
cell.accessoryType = UITableViewCellAccessoryNone;
|
||||
}
|
||||
|
||||
// Configure the cell by extracting a person's name and image from the list
|
||||
// of people.
|
||||
if (indexPath.row < peopleList_.count) {
|
||||
GTLPlusPerson *person = peopleList_[indexPath.row];
|
||||
NSString *name = person.displayName;
|
||||
cell.textLabel.text = name;
|
||||
|
||||
if (indexPath.row < [peopleImageList_ count] &&
|
||||
![[peopleImageList_ objectAtIndex:indexPath.row]
|
||||
isEqual:[NSNull null]]) {
|
||||
cell.imageView.image =
|
||||
[[[UIImage alloc]
|
||||
initWithData:[peopleImageList_ objectAtIndex:indexPath.row]]
|
||||
autorelease];
|
||||
} else {
|
||||
cell.imageView.image = nil;
|
||||
}
|
||||
}
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
#pragma mark - Helper methods
|
||||
|
||||
- (void)listPeople:(NSString *)collection {
|
||||
GTMOAuth2Authentication *auth = [GPPSignIn sharedInstance].authentication;
|
||||
if (!auth) {
|
||||
// To authenticate, use Google+ sign-in button.
|
||||
peopleStatus_.text = @"Status: Not authenticated";
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. Create a |GTLQuery| object to list people that are visible to this
|
||||
// sample app.
|
||||
GTLQueryPlus *query =
|
||||
[GTLQueryPlus queryForPeopleListWithUserId:@"me"
|
||||
collection:collection];
|
||||
|
||||
// 2. Execute the query.
|
||||
[[[GPPSignIn sharedInstance] plusService] executeQuery:query
|
||||
completionHandler:^(GTLServiceTicket *ticket,
|
||||
GTLPlusPeopleFeed *peopleFeed,
|
||||
NSError *error) {
|
||||
if (error) {
|
||||
GTMLoggerError(@"Error: %@", error);
|
||||
peopleStatus_.text =
|
||||
[NSString stringWithFormat:@"Status: Error: %@", error];
|
||||
} else {
|
||||
// Get an array of people from |GTLPlusPeopleFeed| and reload
|
||||
// the table view.
|
||||
peopleList_ = [peopleFeed.items retain];
|
||||
[peopleTable_ reloadData];
|
||||
|
||||
// Render the status of the Google+ request.
|
||||
NSNumber *count = peopleFeed.totalItems;
|
||||
if (count.intValue == 1) {
|
||||
peopleStatus_.text = [NSString stringWithFormat:
|
||||
@"Status: Listed 1 person"];
|
||||
} else {
|
||||
peopleStatus_.text = [NSString stringWithFormat:
|
||||
@"Status: Listed %@ people", count];
|
||||
}
|
||||
[self fetchPeopleImages];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)fetchPeopleImages {
|
||||
NSInteger index = 0;
|
||||
peopleImageList_ =
|
||||
[[NSMutableArray alloc] initWithCapacity:[peopleList_ count]];
|
||||
for (GTLPlusPerson *person in peopleList_) {
|
||||
NSData *imageData = nil;
|
||||
NSString *imageURLString = person.image.url;
|
||||
if (imageURLString) {
|
||||
NSURL *imageURL = [NSURL URLWithString:imageURLString];
|
||||
imageData = [NSData dataWithContentsOfURL:imageURL];
|
||||
}
|
||||
if (imageData) {
|
||||
[peopleImageList_ setObject:imageData atIndexedSubscript:index];
|
||||
} else {
|
||||
[peopleImageList_ setObject:[NSNull null] atIndexedSubscript:index];
|
||||
}
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)reportAuthStatus {
|
||||
if (![GPPSignIn sharedInstance].authentication) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ([[GPPSignIn sharedInstance].scopes containsObject:
|
||||
kGTLAuthScopePlusLogin]) {
|
||||
peopleStatus_.text = @"Status: Authenticated with plus.login scope";
|
||||
} else {
|
||||
// To authenticate, use Google+ sign-in button.
|
||||
peopleStatus_.text = @"Status: Not authenticated with plus.login scope";
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
300
External/google-plus-ios-sdk/SampleCode/ListPeopleViewController.xib
vendored
Normal file
300
External/google-plus-ios-sdk/SampleCode/ListPeopleViewController.xib
vendored
Normal file
@@ -0,0 +1,300 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1552</int>
|
||||
<string key="IBDocument.SystemVersion">12C60</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">3084</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">2083</string>
|
||||
</object>
|
||||
<array key="IBDocument.IntegratedClassDependencies">
|
||||
<string>IBProxyObject</string>
|
||||
<string>IBUILabel</string>
|
||||
<string>IBUITableView</string>
|
||||
<string>IBUIView</string>
|
||||
</array>
|
||||
<array key="IBDocument.PluginDependencies">
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</array>
|
||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
|
||||
<integer value="1" key="NS.object.0"/>
|
||||
</object>
|
||||
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
|
||||
<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="IBUIView" id="191373211">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="IBUILabel" id="407476461">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{6, 11}, {253, 21}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="523394245"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<string key="NSHuggingPriority">{250, 250}</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<int key="IBUIContentMode">7</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<string key="IBUIText">People visible to this sample app:</string>
|
||||
<object class="NSColor" key="IBUITextColor" id="586080610">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MCAwIDAAA</bytes>
|
||||
<string key="IBUIColorCocoaTouchKeyPath">darkTextColor</string>
|
||||
</object>
|
||||
<nil key="IBUIHighlightedColor"/>
|
||||
<int key="IBUIBaselineAdjustment">0</int>
|
||||
<object class="IBUIFontDescription" key="IBUIFontDescription" id="889799447">
|
||||
<int key="type">1</int>
|
||||
<double key="pointSize">17</double>
|
||||
</object>
|
||||
<object class="NSFont" key="IBUIFont" id="516920208">
|
||||
<string key="NSName">Helvetica</string>
|
||||
<double key="NSSize">17</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
|
||||
</object>
|
||||
<object class="IBUILabel" id="421795987">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{6, 329}, {285, 67}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<string key="IBUIText">Status:</string>
|
||||
<reference key="IBUITextColor" ref="586080610"/>
|
||||
<nil key="IBUIHighlightedColor"/>
|
||||
<int key="IBUIBaselineAdjustment">0</int>
|
||||
<int key="IBUINumberOfLines">2</int>
|
||||
<reference key="IBUIFontDescription" ref="889799447"/>
|
||||
<reference key="IBUIFont" ref="516920208"/>
|
||||
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
|
||||
<double key="preferredMaxLayoutWidth">285</double>
|
||||
</object>
|
||||
<object class="IBUIView" id="523394245">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="IBUITableView" id="580697286">
|
||||
<reference key="NSNextResponder" ref="523394245"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<string key="NSFrame">{{20, 20}, {320, 263}}</string>
|
||||
<reference key="NSSuperview" ref="523394245"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="421795987"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
</object>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<bool key="IBUIAlwaysBounceVertical">YES</bool>
|
||||
<int key="IBUISeparatorStyle">1</int>
|
||||
<int key="IBUISectionIndexMinimumDisplayRowCount">0</int>
|
||||
<bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool>
|
||||
<float key="IBUIRowHeight">44</float>
|
||||
<float key="IBUISectionHeaderHeight">22</float>
|
||||
<float key="IBUISectionFooterHeight">22</float>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{-20, 40}, {360, 303}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="580697286"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:10</string>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
<object class="NSColorSpace" key="NSCustomColorSpace" id="165733047">
|
||||
<int key="NSID">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{0, 64}, {320, 416}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="407476461"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
<reference key="NSCustomColorSpace" ref="165733047"/>
|
||||
</object>
|
||||
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
|
||||
<object class="IBUISimulatedNavigationBarMetrics" key="IBUISimulatedTopBarMetrics">
|
||||
<bool key="IBUIPrompted">NO</bool>
|
||||
</object>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<array class="NSMutableArray" key="connectionRecords">
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">peopleStatus</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="421795987"/>
|
||||
</object>
|
||||
<int key="connectionID">55</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">view</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="191373211"/>
|
||||
</object>
|
||||
<int key="connectionID">56</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">peopleTable</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="580697286"/>
|
||||
</object>
|
||||
<int key="connectionID">54</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
<reference key="source" ref="580697286"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
</object>
|
||||
<int key="connectionID">32</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">dataSource</string>
|
||||
<reference key="source" ref="580697286"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
</object>
|
||||
<int key="connectionID">31</int>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<array key="orderedObjects">
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">0</int>
|
||||
<array key="object" id="0"/>
|
||||
<reference key="children" ref="1000"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">1</int>
|
||||
<reference key="object" ref="191373211"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="407476461"/>
|
||||
<reference ref="523394245"/>
|
||||
<reference ref="421795987"/>
|
||||
</array>
|
||||
<reference key="parent" ref="0"/>
|
||||
</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">10</int>
|
||||
<reference key="object" ref="407476461"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">34</int>
|
||||
<reference key="object" ref="421795987"/>
|
||||
<array class="NSMutableArray" key="children"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">129</int>
|
||||
<reference key="object" ref="523394245"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="580697286"/>
|
||||
</array>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">3</int>
|
||||
<reference key="object" ref="580697286"/>
|
||||
<array class="NSMutableArray" key="children"/>
|
||||
<reference key="parent" ref="523394245"/>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
<string key="-1.CustomClassName">ListPeopleViewController</string>
|
||||
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="-2.CustomClassName">UIResponder</string>
|
||||
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="10.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="129.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="3.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="34.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
|
||||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">157</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">ListPeopleViewController</string>
|
||||
<string key="superclassName">UIViewController</string>
|
||||
<dictionary class="NSMutableDictionary" key="outlets">
|
||||
<string key="peopleStatus">UILabel</string>
|
||||
<string key="peopleTable">UITableView</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<object class="IBToOneOutletInfo" key="peopleStatus">
|
||||
<string key="name">peopleStatus</string>
|
||||
<string key="candidateClassName">UILabel</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="peopleTable">
|
||||
<string key="name">peopleTable</string>
|
||||
<string key="candidateClassName">UITableView</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/ListPeopleViewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<string key="IBCocoaTouchPluginVersion">2083</string>
|
||||
</data>
|
||||
</archive>
|
23
External/google-plus-ios-sdk/SampleCode/MasterViewController.h
vendored
Normal file
23
External/google-plus-ios-sdk/SampleCode/MasterViewController.h
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// MasterViewController.h
|
||||
//
|
||||
// Copyright 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 <UIKit/UIKit.h>
|
||||
|
||||
@interface MasterViewController : UITableViewController
|
||||
|
||||
@end
|
135
External/google-plus-ios-sdk/SampleCode/MasterViewController.m
vendored
Normal file
135
External/google-plus-ios-sdk/SampleCode/MasterViewController.m
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
//
|
||||
// MasterViewController.m
|
||||
//
|
||||
// Copyright 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 "MasterViewController.h"
|
||||
|
||||
#import <GooglePlus/GooglePlus.h>
|
||||
|
||||
static const int kNumViewControllers = 5;
|
||||
static NSString * const kMenuOptions[kNumViewControllers] = {
|
||||
@"Sign in", @"Share", @"List people", @"Write moments",
|
||||
@"List & remove moments" };
|
||||
static NSString * const kUnselectableMenuOptions[kNumViewControllers] = {
|
||||
nil, nil, @"Sign in to list people", @"Sign in to write moments",
|
||||
@"Sign in to list/remove moments" };
|
||||
static NSString * const kNibNames[kNumViewControllers] = {
|
||||
@"SignInViewController",
|
||||
@"ShareViewController",
|
||||
@"ListPeopleViewController",
|
||||
@"MomentsViewController",
|
||||
@"ListMomentsViewController" };
|
||||
|
||||
@interface MasterViewController ()
|
||||
- (BOOL)isSelectable:(NSIndexPath *)indexPath;
|
||||
@end
|
||||
|
||||
@implementation MasterViewController
|
||||
|
||||
- (id)initWithNibName:(NSString *)nibNameOrNil
|
||||
bundle:(NSBundle *)nibBundleOrNil {
|
||||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||||
if (self) {
|
||||
self.title = @"Google+ SDK Sample";
|
||||
UIBarButtonItem *backButton = [[[UIBarButtonItem alloc]
|
||||
initWithTitle:@"Back"
|
||||
style:UIBarButtonItemStylePlain
|
||||
target:self
|
||||
action:@selector(backPressed)] autorelease];
|
||||
self.navigationItem.backBarButtonItem = backButton;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
#pragma mark - View lifecycle
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)
|
||||
interfaceOrientation {
|
||||
if ([[UIDevice currentDevice] userInterfaceIdiom] ==
|
||||
UIUserInterfaceIdiomPhone) {
|
||||
return interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate/UITableViewDataSource
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView
|
||||
numberOfRowsInSection:(NSInteger)section {
|
||||
return kNumViewControllers;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView
|
||||
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
BOOL selectable = [self isSelectable:indexPath];
|
||||
NSString * const kCellIdentifier = selectable ? @"Cell" : @"GreyCell";
|
||||
UITableViewCell *cell =
|
||||
[tableView dequeueReusableCellWithIdentifier:kCellIdentifier];
|
||||
if (cell == nil) {
|
||||
cell =
|
||||
[[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
|
||||
reuseIdentifier:kCellIdentifier] autorelease];
|
||||
if (selectable) {
|
||||
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
|
||||
} else {
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
cell.textLabel.textColor = [UIColor lightGrayColor];
|
||||
}
|
||||
}
|
||||
cell.textLabel.text = (selectable ? kMenuOptions : kUnselectableMenuOptions)
|
||||
[indexPath.row];
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView
|
||||
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (![self isSelectable:indexPath]) {
|
||||
return;
|
||||
}
|
||||
Class nibClass = NSClassFromString(kNibNames[indexPath.row]);
|
||||
UIViewController *controller =
|
||||
[[[nibClass alloc] initWithNibName:nil bundle:nil] autorelease];
|
||||
controller.navigationItem.title = kMenuOptions[indexPath.row];
|
||||
|
||||
[self.navigationController pushViewController:controller animated:YES];
|
||||
}
|
||||
|
||||
#pragma mark - Helper methods
|
||||
|
||||
- (BOOL)isSelectable:(NSIndexPath *)indexPath {
|
||||
if (kUnselectableMenuOptions[indexPath.row]) {
|
||||
// To use Google+ moments, you need to sign in.
|
||||
return [GPPSignIn sharedInstance].authentication != nil;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
251
External/google-plus-ios-sdk/SampleCode/MasterViewController.xib
vendored
Normal file
251
External/google-plus-ios-sdk/SampleCode/MasterViewController.xib
vendored
Normal file
@@ -0,0 +1,251 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1280</int>
|
||||
<string key="IBDocument.SystemVersion">10K549</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">1938</string>
|
||||
<string key="IBDocument.AppKitVersion">1038.36</string>
|
||||
<string key="IBDocument.HIToolboxVersion">461.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="NS.object.0">933</string>
|
||||
</object>
|
||||
<array key="IBDocument.IntegratedClassDependencies">
|
||||
<string>IBUINavigationItem</string>
|
||||
<string>IBUITableView</string>
|
||||
<string>IBUITableViewController</string>
|
||||
<string>IBUINavigationController</string>
|
||||
<string>IBUINavigationBar</string>
|
||||
<string>IBProxyObject</string>
|
||||
</array>
|
||||
<array key="IBDocument.PluginDependencies">
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</array>
|
||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
|
||||
<integer value="1" key="NS.object.0"/>
|
||||
</object>
|
||||
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
|
||||
<object class="IBProxyObject" id="841351856">
|
||||
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBProxyObject" id="371349661">
|
||||
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUITableView" id="709618507">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor" id="800680415">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
</object>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<bool key="IBUIAlwaysBounceVertical">YES</bool>
|
||||
<int key="IBUISeparatorStyle">1</int>
|
||||
<int key="IBUISectionIndexMinimumDisplayRowCount">0</int>
|
||||
<bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool>
|
||||
<float key="IBUIRowHeight">44</float>
|
||||
<float key="IBUISectionHeaderHeight">22</float>
|
||||
<float key="IBUISectionFooterHeight">22</float>
|
||||
</object>
|
||||
<object class="IBUINavigationController" id="271496582">
|
||||
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
|
||||
<object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
|
||||
<int key="IBUIInterfaceOrientation">1</int>
|
||||
<int key="interfaceOrientation">1</int>
|
||||
</object>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<bool key="IBUIHorizontal">NO</bool>
|
||||
<object class="IBUINavigationBar" key="IBUINavigationBar" id="264651278">
|
||||
<nil key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<string key="NSFrameSize">{0, 0}</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<bool key="IBUIMultipleTouchEnabled">YES</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<array key="IBUIViewControllers">
|
||||
<object class="IBUITableViewController" id="84492071">
|
||||
<object class="IBUITableView" key="IBUIView" id="1024288683">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<string key="NSFrame">{{0, 64}, {320, 416}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<reference key="IBUIBackgroundColor" ref="800680415"/>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<bool key="IBUIAlwaysBounceVertical">YES</bool>
|
||||
<int key="IBUISeparatorStyle">1</int>
|
||||
<int key="IBUISectionIndexMinimumDisplayRowCount">0</int>
|
||||
<bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool>
|
||||
<float key="IBUIRowHeight">44</float>
|
||||
<float key="IBUISectionHeaderHeight">22</float>
|
||||
<float key="IBUISectionFooterHeight">22</float>
|
||||
</object>
|
||||
<object class="IBUINavigationItem" key="IBUINavigationItem" id="848890509">
|
||||
<reference key="IBUINavigationBar"/>
|
||||
<string key="IBUITitle">Google Plus Sample App</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<reference key="IBUIParentViewController" ref="271496582"/>
|
||||
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
|
||||
<object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
|
||||
<int key="IBUIInterfaceOrientation">1</int>
|
||||
<int key="interfaceOrientation">1</int>
|
||||
</object>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<bool key="IBUIHorizontal">NO</bool>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<array class="NSMutableArray" key="connectionRecords">
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">view</string>
|
||||
<reference key="source" ref="841351856"/>
|
||||
<reference key="destination" ref="709618507"/>
|
||||
</object>
|
||||
<int key="connectionID">3</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">dataSource</string>
|
||||
<reference key="source" ref="709618507"/>
|
||||
<reference key="destination" ref="841351856"/>
|
||||
</object>
|
||||
<int key="connectionID">4</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
<reference key="source" ref="709618507"/>
|
||||
<reference key="destination" ref="841351856"/>
|
||||
</object>
|
||||
<int key="connectionID">5</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
<reference key="source" ref="1024288683"/>
|
||||
<reference key="destination" ref="84492071"/>
|
||||
</object>
|
||||
<int key="connectionID">12</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">dataSource</string>
|
||||
<reference key="source" ref="1024288683"/>
|
||||
<reference key="destination" ref="84492071"/>
|
||||
</object>
|
||||
<int key="connectionID">13</int>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<array key="orderedObjects">
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">0</int>
|
||||
<array key="object" id="0"/>
|
||||
<reference key="children" ref="1000"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-1</int>
|
||||
<reference key="object" ref="841351856"/>
|
||||
<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="371349661"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">2</int>
|
||||
<reference key="object" ref="709618507"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">6</int>
|
||||
<reference key="object" ref="271496582"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="264651278"/>
|
||||
<reference ref="84492071"/>
|
||||
</array>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">7</int>
|
||||
<reference key="object" ref="264651278"/>
|
||||
<reference key="parent" ref="271496582"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">10</int>
|
||||
<reference key="object" ref="84492071"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="1024288683"/>
|
||||
<reference ref="848890509"/>
|
||||
</array>
|
||||
<reference key="parent" ref="271496582"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">11</int>
|
||||
<reference key="object" ref="1024288683"/>
|
||||
<reference key="parent" ref="84492071"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">14</int>
|
||||
<reference key="object" ref="848890509"/>
|
||||
<reference key="parent" ref="84492071"/>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
<string key="-1.CustomClassName">MasterViewController</string>
|
||||
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="-2.CustomClassName">UIResponder</string>
|
||||
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="10.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="11.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="14.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
|
||||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">14</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">MasterViewController</string>
|
||||
<string key="superclassName">UITableViewController</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/MasterViewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<string key="IBCocoaTouchPluginVersion">933</string>
|
||||
</data>
|
||||
</archive>
|
47
External/google-plus-ios-sdk/SampleCode/MomentsViewController.h
vendored
Normal file
47
External/google-plus-ios-sdk/SampleCode/MomentsViewController.h
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// MomentsViewController.h
|
||||
//
|
||||
// Copyright 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 <UIKit/UIKit.h>
|
||||
|
||||
// A view controller for writing different kinds of moments to Google+.
|
||||
// The open-source GTLPlus libraries are required. For more details, see
|
||||
// https://developers.google.com/+/features/app-activities .
|
||||
@interface MomentsViewController : UIViewController<
|
||||
UITableViewDelegate,
|
||||
UITableViewDataSource,
|
||||
UITextFieldDelegate> {
|
||||
BOOL keyboardVisible_;
|
||||
}
|
||||
|
||||
// A label to prompt the selection of a moment.
|
||||
@property (retain, nonatomic) IBOutlet UILabel *selectionLabel;
|
||||
// The table that displays the different kinds of moments available.
|
||||
@property (retain, nonatomic) IBOutlet UITableView *momentsTable;
|
||||
// The view for the bootom controls.
|
||||
@property (retain, nonatomic) IBOutlet UIView *bottomControls;
|
||||
// The target URL to associate with this moment.
|
||||
@property (retain, nonatomic) IBOutlet UITextField *momentURL;
|
||||
// A label to display the result of writing a moment.
|
||||
@property (retain, nonatomic) IBOutlet UILabel *momentStatus;
|
||||
// The "Add Moment" button.
|
||||
@property (retain, nonatomic) IBOutlet UIButton *addButton;
|
||||
|
||||
// Called when the user presses the "Add Moment" button.
|
||||
- (IBAction)momentButton:(id)sender;
|
||||
|
||||
@end
|
332
External/google-plus-ios-sdk/SampleCode/MomentsViewController.m
vendored
Normal file
332
External/google-plus-ios-sdk/SampleCode/MomentsViewController.m
vendored
Normal file
@@ -0,0 +1,332 @@
|
||||
//
|
||||
// MomentsViewController.m
|
||||
//
|
||||
// Copyright 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 "MomentsViewController.h"
|
||||
|
||||
#import <GoogleOpenSource/GoogleOpenSource.h>
|
||||
#import <GooglePlus/GooglePlus.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
@interface MomentsViewController ()
|
||||
- (GTLPlusItemScope *)resultFor:(NSString *)selectedMoment;
|
||||
- (void)animateKeyboard:(NSNotification *)notification
|
||||
shouldShow:(BOOL)shouldShow;
|
||||
- (NSString *)momentURLForIndex:(int)i;
|
||||
- (void)reportAuthStatus;
|
||||
@end
|
||||
|
||||
@implementation MomentsViewController
|
||||
|
||||
@synthesize selectionLabel = selectionLabel_;
|
||||
@synthesize momentsTable = momentsTable_;
|
||||
@synthesize bottomControls = bottomControls_;
|
||||
@synthesize momentURL = momentURL_;
|
||||
@synthesize momentStatus = momentStatus_;
|
||||
@synthesize addButton = addButton_;
|
||||
|
||||
// The different kinds of moments.
|
||||
static const int kNumMomentTypes = 8;
|
||||
static NSString * const kMomentTypes[kNumMomentTypes] = {
|
||||
@"AddActivity",
|
||||
@"BuyActivity",
|
||||
@"CheckInActivity",
|
||||
@"CommentActivity",
|
||||
@"CreateActivity",
|
||||
@"ListenActivity",
|
||||
@"ReserveActivity",
|
||||
@"ReviewActivity" };
|
||||
static NSString * const kMomentURLs[kNumMomentTypes] = {
|
||||
@"thing",
|
||||
@"a-book",
|
||||
@"place",
|
||||
@"blog-entry",
|
||||
@"photo",
|
||||
@"song",
|
||||
@"restaurant",
|
||||
@"widget" };
|
||||
static NSString * const kMomentURLFormat =
|
||||
@"https://developers.google.com/+/plugins/snippet/examples/%@";
|
||||
|
||||
#pragma mark - Object lifecycle
|
||||
|
||||
- (void)dealloc {
|
||||
// Unregister for keyboard notifications while not visible.
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver:self
|
||||
name:UIKeyboardWillShowNotification
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver:self
|
||||
name:UIKeyboardWillHideNotification
|
||||
object:nil];
|
||||
[selectionLabel_ release];
|
||||
[momentsTable_ release];
|
||||
[bottomControls_ release];
|
||||
[momentURL_ release];
|
||||
[momentStatus_ release];
|
||||
[addButton_ release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
#pragma mark - View lifecycle
|
||||
|
||||
- (void)viewDidLoad {
|
||||
// Set up "Add Moment" button.
|
||||
[[addButton_ layer] setCornerRadius:5];
|
||||
[[addButton_ layer] setMasksToBounds:YES];
|
||||
CGColorRef borderColor = [[UIColor colorWithWhite:203.0/255.0
|
||||
alpha:1.0] CGColor];
|
||||
[[addButton_ layer] setBorderColor:borderColor];
|
||||
[[addButton_ layer] setBorderWidth:1.0];
|
||||
|
||||
// Set up sample view of writing moments.
|
||||
int selectedRow = [[momentsTable_ indexPathForSelectedRow] row];
|
||||
momentURL_.text = [self momentURLForIndex:selectedRow];
|
||||
|
||||
[self reportAuthStatus];
|
||||
[super viewDidLoad];
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
// Register for keyboard notifications while visible.
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(keyboardWillShow:)
|
||||
name:UIKeyboardWillShowNotification
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(keyboardWillHide:)
|
||||
name:UIKeyboardWillHideNotification
|
||||
object:nil];
|
||||
|
||||
// Scale the table view vertically down to its contents if necessary.
|
||||
[momentsTable_ reloadData];
|
||||
CGRect frame = momentsTable_.frame;
|
||||
if (frame.size.height > momentsTable_.contentSize.height) {
|
||||
CGFloat shift = frame.size.height - momentsTable_.contentSize.height;
|
||||
frame.size.height = momentsTable_.contentSize.height;
|
||||
momentsTable_.frame = frame;
|
||||
|
||||
// Also update the prompt by removing the "scroll for more" part.
|
||||
selectionLabel_.text = @"Select an activity";
|
||||
|
||||
// And move the bottom view up for the same shift amount.
|
||||
frame = bottomControls_.frame;
|
||||
frame.origin.y -= shift;
|
||||
bottomControls_.frame = frame;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
// Unregister for keyboard notifications while not visible.
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver:self
|
||||
name:UIKeyboardWillShowNotification
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver:self
|
||||
name:UIKeyboardWillHideNotification
|
||||
object:nil];
|
||||
|
||||
[super viewWillDisappear:animated];
|
||||
}
|
||||
|
||||
#pragma mark - IBActions
|
||||
|
||||
- (IBAction)momentButton:(id)sender {
|
||||
GTMOAuth2Authentication *auth = [GPPSignIn sharedInstance].authentication;
|
||||
if (!auth) {
|
||||
// To authenticate, use Google+ sign-in button.
|
||||
momentStatus_.text = @"Status: Not authenticated";
|
||||
return;
|
||||
}
|
||||
|
||||
// Here is an example of writing a moment to Google+:
|
||||
// 1. Create a |GTLPlusMoment| object with required fields. For reference, see
|
||||
// https://developers.google.com/+/features/app-activities .
|
||||
int selectedRow = [[momentsTable_ indexPathForSelectedRow] row];
|
||||
NSString *selectedMoment = kMomentTypes[selectedRow];
|
||||
|
||||
GTLPlusMoment *moment = [[[GTLPlusMoment alloc] init] autorelease];
|
||||
moment.type = [NSString stringWithFormat:@"http://schemas.google.com/%@",
|
||||
selectedMoment];
|
||||
GTLPlusItemScope *target = [[[GTLPlusItemScope alloc] init] autorelease];
|
||||
target.url = momentURL_.text;
|
||||
if ([target.url isEqualToString:@""]) {
|
||||
target.url = [self momentURLForIndex:selectedRow];
|
||||
}
|
||||
moment.target = target;
|
||||
|
||||
// CommentActivity, ReserveActivity, and ReviewActivity require setting a
|
||||
// |result| field in the request.
|
||||
GTLPlusItemScope *result = [self resultFor:selectedMoment];
|
||||
if (result) {
|
||||
moment.result = result;
|
||||
}
|
||||
|
||||
// 2. Create a |GTLQuery| object to write a moment.
|
||||
GTLQueryPlus *query =
|
||||
[GTLQueryPlus queryForMomentsInsertWithObject:moment
|
||||
userId:@"me"
|
||||
collection:kGTLPlusCollectionVault];
|
||||
|
||||
// 3. Execute the query.
|
||||
[[[GPPSignIn sharedInstance] plusService] executeQuery:query
|
||||
completionHandler:^(GTLServiceTicket *ticket,
|
||||
id object,
|
||||
NSError *error) {
|
||||
if (error) {
|
||||
GTMLoggerError(@"Error: %@", error);
|
||||
momentStatus_.text =
|
||||
[NSString stringWithFormat:@"Status: Error: %@", error];
|
||||
} else {
|
||||
momentStatus_.text = [NSString stringWithFormat:
|
||||
@"Status: Saved to Google+ (%@)",
|
||||
selectedMoment];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate/UITableViewDataSource
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView
|
||||
numberOfRowsInSection:(NSInteger)section {
|
||||
return kNumMomentTypes;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView
|
||||
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
static NSString * const kCellIdentifier = @"Cell";
|
||||
UITableViewCell *cell =
|
||||
[tableView dequeueReusableCellWithIdentifier:kCellIdentifier];
|
||||
if (cell == nil) {
|
||||
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
|
||||
reuseIdentifier:kCellIdentifier]
|
||||
autorelease];
|
||||
cell.accessoryType = UITableViewCellAccessoryNone;
|
||||
}
|
||||
|
||||
// Configure the cell.
|
||||
cell.textLabel.text = kMomentTypes[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView
|
||||
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
int selectedRow = [[momentsTable_ indexPathForSelectedRow] row];
|
||||
momentURL_.text = [self momentURLForIndex:selectedRow];
|
||||
}
|
||||
|
||||
#pragma mark - UITextFieldDelegate
|
||||
|
||||
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
|
||||
[textField resignFirstResponder];
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark - UIKeyboard
|
||||
|
||||
- (void)keyboardWillShow:(NSNotification *)notification {
|
||||
[self animateKeyboard:notification shouldShow:YES];
|
||||
}
|
||||
|
||||
- (void)keyboardWillHide:(NSNotification *)notification {
|
||||
[self animateKeyboard:notification shouldShow:NO];
|
||||
}
|
||||
|
||||
#pragma mark - Private methods
|
||||
|
||||
// Helps set required result field for select moment types.
|
||||
- (GTLPlusItemScope *)resultFor:(NSString *)selectedMoment {
|
||||
GTLPlusItemScope *result = [[[GTLPlusItemScope alloc] init] autorelease];
|
||||
if ([selectedMoment isEqualToString:@"CommentActivity"]) {
|
||||
result.type = @"http://schema.org/Comment";
|
||||
result.url = @"https://developers.google.com/+/plugins/snippet/"
|
||||
@"examples/blog-entry#comment-1";
|
||||
result.name = @"This is amazing!";
|
||||
result.text = @"I can't wait to use it on my site :)";
|
||||
return result;
|
||||
} else if ([selectedMoment isEqualToString:@"ReserveActivity"]) {
|
||||
result.type = @"http://schemas.google.com/Reservation";
|
||||
result.startDate = @"2012-06-28T19:00:00-08:00";
|
||||
result.attendeeCount = [[[NSNumber alloc] initWithInt:3] autorelease];
|
||||
return result;
|
||||
} else if ([selectedMoment isEqualToString:@"ReviewActivity"]) {
|
||||
result.type = @"http://schema.org/Review";
|
||||
result.name = @"A Humble Review of Widget";
|
||||
result.url =
|
||||
@"https://developers.google.com/+/plugins/snippet/examples/review";
|
||||
result.text =
|
||||
@"It's amazingly effective at whatever it is that it's supposed to do.";
|
||||
GTLPlusItemScope *rating = [[[GTLPlusItemScope alloc] init] autorelease];
|
||||
rating.type = @"http://schema.org/Rating";
|
||||
rating.ratingValue = @"100";
|
||||
rating.bestRating = @"100";
|
||||
rating.worstRating = @"0";
|
||||
result.reviewRating = rating;
|
||||
return result;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Helps animate keyboard for target URL text field.
|
||||
- (void)animateKeyboard:(NSNotification *)notification
|
||||
shouldShow:(BOOL)shouldShow {
|
||||
NSDictionary *userInfo = [notification userInfo];
|
||||
CGFloat height = [[userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey]
|
||||
CGRectValue].size.height;
|
||||
CGFloat duration = [[userInfo
|
||||
objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
|
||||
[UIView beginAnimations:nil context:NULL];
|
||||
[UIView setAnimationDuration:duration];
|
||||
CGRect newFrame = self.view.frame;
|
||||
if (shouldShow) {
|
||||
newFrame.size.height -= height;
|
||||
} else {
|
||||
newFrame.size.height += height;
|
||||
}
|
||||
self.view.frame = newFrame;
|
||||
[UIView commitAnimations];
|
||||
if (shouldShow) {
|
||||
keyboardVisible_ = YES;
|
||||
} else {
|
||||
keyboardVisible_ = NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)momentURLForIndex:(int)i {
|
||||
return [NSString stringWithFormat:kMomentURLFormat, kMomentURLs[i]];
|
||||
}
|
||||
|
||||
- (void)reportAuthStatus {
|
||||
if ([GPPSignIn sharedInstance].authentication) {
|
||||
momentStatus_.text = @"Status: Authenticated";
|
||||
} else {
|
||||
// To authenticate, use Google+ sign-in button.
|
||||
momentStatus_.text = @"Status: Not authenticated";
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
479
External/google-plus-ios-sdk/SampleCode/MomentsViewController.xib
vendored
Normal file
479
External/google-plus-ios-sdk/SampleCode/MomentsViewController.xib
vendored
Normal file
@@ -0,0 +1,479 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1552</int>
|
||||
<string key="IBDocument.SystemVersion">12C60</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">3084</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">2083</string>
|
||||
</object>
|
||||
<array key="IBDocument.IntegratedClassDependencies">
|
||||
<string>IBProxyObject</string>
|
||||
<string>IBUIButton</string>
|
||||
<string>IBUILabel</string>
|
||||
<string>IBUITableView</string>
|
||||
<string>IBUITextField</string>
|
||||
<string>IBUIView</string>
|
||||
</array>
|
||||
<array key="IBDocument.PluginDependencies">
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</array>
|
||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
|
||||
<integer value="1" key="NS.object.0"/>
|
||||
</object>
|
||||
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
|
||||
<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="IBUIView" id="191373211">
|
||||
<nil key="NSNextResponder"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="IBUILabel" id="29623071">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">290</int>
|
||||
<string key="NSFrame">{{10, 5}, {296, 21}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSNextKeyView" ref="1013113918"/>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<int key="IBUIContentMode">7</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<string key="IBUIText">Select an activity (scroll for more)</string>
|
||||
<object class="NSColor" key="IBUITextColor" id="216027142">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MCAwIDAAA</bytes>
|
||||
<string key="IBUIColorCocoaTouchKeyPath">darkTextColor</string>
|
||||
</object>
|
||||
<nil key="IBUIHighlightedColor"/>
|
||||
<int key="IBUIBaselineAdjustment">1</int>
|
||||
<float key="IBUIMinimumFontSize">10</float>
|
||||
<object class="IBUIFontDescription" key="IBUIFontDescription" id="950407250">
|
||||
<int key="type">1</int>
|
||||
<double key="pointSize">17</double>
|
||||
</object>
|
||||
<object class="NSFont" key="IBUIFont" id="63576769">
|
||||
<string key="NSName">Helvetica</string>
|
||||
<double key="NSSize">17</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUITableView" id="1013113918">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<string key="NSFrame">{{0, 32}, {320, 132}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSNextKeyView" ref="885245054"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor" id="373936525">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
</object>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<bool key="IBUIAlwaysBounceVertical">YES</bool>
|
||||
<int key="IBUISeparatorStyle">1</int>
|
||||
<int key="IBUISectionIndexMinimumDisplayRowCount">0</int>
|
||||
<bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool>
|
||||
<float key="IBUIRowHeight">44</float>
|
||||
<float key="IBUISectionHeaderHeight">22</float>
|
||||
<float key="IBUISectionFooterHeight">22</float>
|
||||
</object>
|
||||
<object class="IBUIView" id="885245054">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">266</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="IBUILabel" id="625104685">
|
||||
<reference key="NSNextResponder" ref="885245054"/>
|
||||
<int key="NSvFlags">266</int>
|
||||
<string key="NSFrame">{{11, 20}, {296, 21}}</string>
|
||||
<reference key="NSSuperview" ref="885245054"/>
|
||||
<reference key="NSNextKeyView" ref="621451586"/>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<int key="IBUIContentMode">7</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<string key="IBUIText">Enter a Moment URL</string>
|
||||
<reference key="IBUITextColor" ref="216027142"/>
|
||||
<nil key="IBUIHighlightedColor"/>
|
||||
<int key="IBUIBaselineAdjustment">1</int>
|
||||
<float key="IBUIMinimumFontSize">10</float>
|
||||
<reference key="IBUIFontDescription" ref="950407250"/>
|
||||
<reference key="IBUIFont" ref="63576769"/>
|
||||
</object>
|
||||
<object class="IBUITextField" id="621451586">
|
||||
<reference key="NSNextResponder" ref="885245054"/>
|
||||
<int key="NSvFlags">266</int>
|
||||
<string key="NSFrame">{{11, 51}, {291, 31}}</string>
|
||||
<reference key="NSSuperview" ref="885245054"/>
|
||||
<reference key="NSNextKeyView" ref="525343048"/>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<int key="IBUIContentVerticalAlignment">0</int>
|
||||
<string key="IBUIText"/>
|
||||
<int key="IBUIBorderStyle">3</int>
|
||||
<object class="NSColor" key="IBUITextColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MAA</bytes>
|
||||
<object class="NSColorSpace" key="NSCustomColorSpace" id="523142132">
|
||||
<int key="NSID">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
|
||||
<float key="IBUIMinimumFontSize">17</float>
|
||||
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUIFontDescription" key="IBUIFontDescription">
|
||||
<int key="type">1</int>
|
||||
<double key="pointSize">14</double>
|
||||
</object>
|
||||
<object class="NSFont" key="IBUIFont">
|
||||
<string key="NSName">Helvetica</string>
|
||||
<double key="NSSize">14</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUIButton" id="525343048">
|
||||
<reference key="NSNextResponder" ref="885245054"/>
|
||||
<int key="NSvFlags">264</int>
|
||||
<string key="NSFrame">{{12, 113}, {142, 37}}</string>
|
||||
<reference key="NSSuperview" ref="885245054"/>
|
||||
<reference key="NSNextKeyView" ref="851809288"/>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<int key="IBUIContentHorizontalAlignment">0</int>
|
||||
<int key="IBUIContentVerticalAlignment">0</int>
|
||||
<string key="IBUINormalTitle">Add Moment</string>
|
||||
<object class="NSColor" key="IBUIHighlightedTitleColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MC40MzkyMTU2ODYzIDAuMTI1NDkwMTk2MSAwLjA2Mjc0NTA5ODA0AA</bytes>
|
||||
</object>
|
||||
<object class="NSColor" key="IBUINormalTitleColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MC42MzUyOTQxMTc2IDAuMzIxNTY4NjI3NSAwLjI1ODgyMzUyOTQAA</bytes>
|
||||
</object>
|
||||
<object class="NSColor" key="IBUINormalTitleShadowColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MC41AA</bytes>
|
||||
</object>
|
||||
<object class="NSCustomResource" key="IBUINormalBackgroundImage">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">button_background.png</string>
|
||||
</object>
|
||||
<object class="IBUIFontDescription" key="IBUIFontDescription">
|
||||
<int key="type">2</int>
|
||||
<double key="pointSize">15</double>
|
||||
</object>
|
||||
<object class="NSFont" key="IBUIFont">
|
||||
<string key="NSName">Helvetica-Bold</string>
|
||||
<double key="NSSize">15</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUILabel" id="851809288">
|
||||
<reference key="NSNextResponder" ref="885245054"/>
|
||||
<int key="NSvFlags">266</int>
|
||||
<string key="NSFrame">{{11, 180}, {290, 21}}</string>
|
||||
<reference key="NSSuperview" ref="885245054"/>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<int key="IBUIContentMode">7</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<string key="IBUIText">Status:</string>
|
||||
<reference key="IBUITextColor" ref="216027142"/>
|
||||
<nil key="IBUIHighlightedColor"/>
|
||||
<int key="IBUIBaselineAdjustment">1</int>
|
||||
<float key="IBUIMinimumFontSize">11</float>
|
||||
<reference key="IBUIFontDescription" ref="950407250"/>
|
||||
<reference key="IBUIFont" ref="63576769"/>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{0, 172}, {320, 244}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSNextKeyView" ref="625104685"/>
|
||||
<reference key="IBUIBackgroundColor" ref="373936525"/>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{0, 64}, {320, 416}}</string>
|
||||
<reference key="NSNextKeyView" ref="29623071"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
<reference key="NSCustomColorSpace" ref="523142132"/>
|
||||
</object>
|
||||
<array key="IBUIGestureRecognizers" id="0"/>
|
||||
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
|
||||
<object class="IBUISimulatedNavigationBarMetrics" key="IBUISimulatedTopBarMetrics">
|
||||
<bool key="IBUIPrompted">NO</bool>
|
||||
</object>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<array class="NSMutableArray" key="connectionRecords">
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">view</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="191373211"/>
|
||||
</object>
|
||||
<int key="connectionID">3</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">momentsTable</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="1013113918"/>
|
||||
</object>
|
||||
<int key="connectionID">17</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">momentStatus</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="851809288"/>
|
||||
</object>
|
||||
<int key="connectionID">25</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">addButton</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="525343048"/>
|
||||
</object>
|
||||
<int key="connectionID">28</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">momentURL</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="621451586"/>
|
||||
</object>
|
||||
<int key="connectionID">30</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">selectionLabel</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="29623071"/>
|
||||
</object>
|
||||
<int key="connectionID">32</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">bottomControls</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="885245054"/>
|
||||
</object>
|
||||
<int key="connectionID">34</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">dataSource</string>
|
||||
<reference key="source" ref="1013113918"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
</object>
|
||||
<int key="connectionID">18</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
<reference key="source" ref="1013113918"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
</object>
|
||||
<int key="connectionID">19</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
<reference key="source" ref="621451586"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
</object>
|
||||
<int key="connectionID">31</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">momentButton:</string>
|
||||
<reference key="source" ref="525343048"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
<int key="IBEventType">7</int>
|
||||
</object>
|
||||
<int key="connectionID">20</int>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<array key="orderedObjects">
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">0</int>
|
||||
<reference key="object" ref="0"/>
|
||||
<reference key="children" ref="1000"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">1</int>
|
||||
<reference key="object" ref="191373211"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="29623071"/>
|
||||
<reference ref="885245054"/>
|
||||
<reference ref="1013113918"/>
|
||||
</array>
|
||||
<reference key="parent" ref="0"/>
|
||||
</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">7</int>
|
||||
<reference key="object" ref="1013113918"/>
|
||||
<array class="NSMutableArray" key="children"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">26</int>
|
||||
<reference key="object" ref="29623071"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">27</int>
|
||||
<reference key="object" ref="885245054"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="621451586"/>
|
||||
<reference ref="525343048"/>
|
||||
<reference ref="625104685"/>
|
||||
<reference ref="851809288"/>
|
||||
</array>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">13</int>
|
||||
<reference key="object" ref="625104685"/>
|
||||
<reference key="parent" ref="885245054"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">12</int>
|
||||
<reference key="object" ref="621451586"/>
|
||||
<reference key="parent" ref="885245054"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">16</int>
|
||||
<reference key="object" ref="525343048"/>
|
||||
<reference key="parent" ref="885245054"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">22</int>
|
||||
<reference key="object" ref="851809288"/>
|
||||
<reference key="parent" ref="885245054"/>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
<string key="-1.CustomClassName">MomentsViewController</string>
|
||||
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="-2.CustomClassName">UIResponder</string>
|
||||
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="12.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="13.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="16.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<real value="0.0" key="16.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
|
||||
<string key="22.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="26.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="27.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
|
||||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">34</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">MomentsViewController</string>
|
||||
<string key="superclassName">UIViewController</string>
|
||||
<object class="NSMutableDictionary" key="actions">
|
||||
<string key="NS.key.0">momentButton:</string>
|
||||
<string key="NS.object.0">id</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="actionInfosByName">
|
||||
<string key="NS.key.0">momentButton:</string>
|
||||
<object class="IBActionInfo" key="NS.object.0">
|
||||
<string key="name">momentButton:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="outlets">
|
||||
<string key="addButton">UIButton</string>
|
||||
<string key="bottomView">UIView</string>
|
||||
<string key="momentStatus">UILabel</string>
|
||||
<string key="momentURL">UITextField</string>
|
||||
<string key="momentsTable">UITableView</string>
|
||||
<string key="selectionLabel">UILabel</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<object class="IBToOneOutletInfo" key="addButton">
|
||||
<string key="name">addButton</string>
|
||||
<string key="candidateClassName">UIButton</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="bottomView">
|
||||
<string key="name">bottomView</string>
|
||||
<string key="candidateClassName">UIView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="momentStatus">
|
||||
<string key="name">momentStatus</string>
|
||||
<string key="candidateClassName">UILabel</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="momentURL">
|
||||
<string key="name">momentURL</string>
|
||||
<string key="candidateClassName">UITextField</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="momentsTable">
|
||||
<string key="name">momentsTable</string>
|
||||
<string key="candidateClassName">UITableView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="selectionLabel">
|
||||
<string key="name">selectionLabel</string>
|
||||
<string key="candidateClassName">UILabel</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/MomentsViewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
|
||||
<string key="NS.key.0">button_background.png</string>
|
||||
<string key="NS.object.0">{1, 1}</string>
|
||||
</object>
|
||||
<string key="IBCocoaTouchPluginVersion">2083</string>
|
||||
</data>
|
||||
</archive>
|
BIN
External/google-plus-ios-sdk/SampleCode/Resources/Default-568h@2x.png
vendored
Normal file
BIN
External/google-plus-ios-sdk/SampleCode/Resources/Default-568h@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
BIN
External/google-plus-ios-sdk/SampleCode/Resources/Default@2x~iphone.png
vendored
Normal file
BIN
External/google-plus-ios-sdk/SampleCode/Resources/Default@2x~iphone.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
External/google-plus-ios-sdk/SampleCode/Resources/Default~iphone.png
vendored
Normal file
BIN
External/google-plus-ios-sdk/SampleCode/Resources/Default~iphone.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.2 KiB |
BIN
External/google-plus-ios-sdk/SampleCode/Resources/Icon-144.png
vendored
Normal file
BIN
External/google-plus-ios-sdk/SampleCode/Resources/Icon-144.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
BIN
External/google-plus-ios-sdk/SampleCode/Resources/Icon-72.png
vendored
Normal file
BIN
External/google-plus-ios-sdk/SampleCode/Resources/Icon-72.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.5 KiB |
87
External/google-plus-ios-sdk/SampleCode/ShareViewController.h
vendored
Normal file
87
External/google-plus-ios-sdk/SampleCode/ShareViewController.h
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
//
|
||||
// ShareViewController.h
|
||||
//
|
||||
// Copyright 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 <MessageUI/MFMailComposeViewController.h>
|
||||
#import <MessageUI/MessageUI.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
// A view controller for the Google+ share dialog which contains a text field
|
||||
// to prefill the user comment, and a text field for an optional URL to share.
|
||||
// A Google+ share button is provided to launch the share dialog.
|
||||
@interface ShareViewController : UIViewController<
|
||||
UITextFieldDelegate,
|
||||
UIActionSheetDelegate,
|
||||
UIPickerViewDataSource,
|
||||
UIPickerViewDelegate,
|
||||
MFMailComposeViewControllerDelegate> {
|
||||
// Whether the keyboard is visible or not.
|
||||
BOOL keyboardVisible_;
|
||||
// The text field being edited.
|
||||
UITextField *activeField_;
|
||||
}
|
||||
|
||||
@property (retain, nonatomic) NSArray *callToActions;
|
||||
@property (copy, nonatomic) NSString *selectedCallToAction;
|
||||
@property (retain, nonatomic) UIPickerView *callToActionPickerView;
|
||||
// The text to prefill the user comment in the share dialog.
|
||||
@property (retain, nonatomic) IBOutlet UITextField *sharePrefillText;
|
||||
// The URL resource to share in the share dialog.
|
||||
@property (retain, nonatomic) IBOutlet UITextField *shareURL;
|
||||
// A label to display the result of the share action.
|
||||
@property (retain, nonatomic) IBOutlet UILabel *shareStatus;
|
||||
// A toolbar to share via Google+ or email.
|
||||
@property (retain, nonatomic) IBOutlet UIToolbar *shareToolbar;
|
||||
// A switch to toggle Google+ share with content deep linking.
|
||||
@property (retain, nonatomic) IBOutlet UISwitch *addContentDeepLinkSwitch;
|
||||
// The content deep-link ID to be attached with the Google+ share to qualify as
|
||||
// a deep-link share.
|
||||
@property (retain, nonatomic) IBOutlet UITextField *contentDeepLinkID;
|
||||
// The share's title.
|
||||
@property (retain, nonatomic) IBOutlet UITextField *contentDeepLinkTitle;
|
||||
// The share's description.
|
||||
@property (retain, nonatomic) IBOutlet UITextField *contentDeepLinkDescription;
|
||||
// The share's thumbnail URL.
|
||||
@property (retain, nonatomic) IBOutlet UITextField *contentDeepLinkThumbnailURL;
|
||||
// The share view.
|
||||
@property (retain, nonatomic) IBOutlet UIScrollView *shareScrollView;
|
||||
@property (retain, nonatomic) IBOutlet UIView *shareView;
|
||||
// Labels for Google+ share sample.
|
||||
@property (retain, nonatomic) IBOutlet UILabel *addContentDeepLinkLabel;
|
||||
@property (retain, nonatomic) IBOutlet UILabel *urlToShareLabel;
|
||||
@property (retain, nonatomic) IBOutlet UILabel *prefillTextLabel;
|
||||
@property (retain, nonatomic) IBOutlet UILabel *contentDeepLinkIDLabel;
|
||||
@property (retain, nonatomic) IBOutlet UILabel *contentDeepLinkTitleLabel;
|
||||
@property (retain, nonatomic) IBOutlet UILabel *contentDeepLinkDescriptionLabel;
|
||||
@property (retain, nonatomic) IBOutlet UILabel *contentDeepLinkThumbnailURLLabel;
|
||||
@property (retain, nonatomic) IBOutlet UIButton *shareButton;
|
||||
@property (retain, nonatomic) IBOutlet UISwitch *urlForContentDeepLinkMetadataSwitch;
|
||||
@property (retain, nonatomic) IBOutlet UILabel *urlForContentDeepLinkMetadataLabel;
|
||||
// The switch for adding call-to-action button.
|
||||
@property (retain, nonatomic) IBOutlet UISwitch *addCallToActionButtonSwitch;
|
||||
@property (retain, nonatomic) IBOutlet UILabel *addCallToActionButtonLabel;
|
||||
|
||||
// Called when the switch for content deep link is toggled.
|
||||
- (IBAction)contentDeepLinkSwitchToggle:(id)sender;
|
||||
// Called when the switch for metadata from URL preview is toggled.
|
||||
- (IBAction)urlForContentDeepLinkMetadataSwitchToggle:(id)sender;
|
||||
// Called when the share button is pressed.
|
||||
- (IBAction)shareButton:(id)sender;
|
||||
// Called when the toolbar share button is pressed.
|
||||
- (IBAction)shareToolbar:(id)sender;
|
||||
|
||||
@end
|
702
External/google-plus-ios-sdk/SampleCode/ShareViewController.m
vendored
Normal file
702
External/google-plus-ios-sdk/SampleCode/ShareViewController.m
vendored
Normal file
@@ -0,0 +1,702 @@
|
||||
//
|
||||
// ShareViewController.m
|
||||
//
|
||||
// Copyright 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 "ShareViewController.h"
|
||||
|
||||
#import <GoogleOpenSource/GoogleOpenSource.h>
|
||||
#import <GooglePlus/GooglePlus.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
@interface ShareViewController() <GPPShareDelegate>
|
||||
- (void)animateKeyboard:(NSNotification *)notification
|
||||
shouldShow:(BOOL)shouldShow;
|
||||
- (void)layout;
|
||||
- (void)placeView:(UIView *)view x:(CGFloat)x y:(CGFloat)y;
|
||||
- (void)populateTextFields;
|
||||
@end
|
||||
|
||||
@implementation ShareViewController
|
||||
|
||||
@synthesize callToActions = callToActions_;
|
||||
@synthesize selectedCallToAction = selectedCallToAction_;
|
||||
@synthesize callToActionPickerView = callToActionPickerView_;
|
||||
@synthesize addContentDeepLinkSwitch = addContentDeepLinkSwitch_;
|
||||
@synthesize contentDeepLinkDescription = contentDeepLinkDescription_;
|
||||
@synthesize contentDeepLinkID = contentDeepLinkID_;
|
||||
@synthesize contentDeepLinkTitle = contentDeepLinkTitle_;
|
||||
@synthesize contentDeepLinkThumbnailURL = contentDeepLinkThumbnailURL_;
|
||||
@synthesize sharePrefillText = sharePrefillText_;
|
||||
@synthesize shareURL = shareURL_;
|
||||
@synthesize shareStatus = shareStatus_;
|
||||
@synthesize shareToolbar = shareToolbar_;
|
||||
@synthesize shareScrollView = shareScrollView_;
|
||||
@synthesize shareView = shareView_;
|
||||
@synthesize addContentDeepLinkLabel = addContentDeepLinkLabel_;
|
||||
@synthesize urlToShareLabel = urlToShareLabel_;
|
||||
@synthesize prefillTextLabel = prefillTextLabel_;
|
||||
@synthesize contentDeepLinkIDLabel = contentDeepLinkIDLabel_;
|
||||
@synthesize contentDeepLinkTitleLabel = contentDeepLinkTitleLabel_;
|
||||
@synthesize contentDeepLinkDescriptionLabel =
|
||||
contentDeepLinkDescriptionLabel_;
|
||||
@synthesize contentDeepLinkThumbnailURLLabel =
|
||||
contentDeepLinkThumbnailURLLabel_;
|
||||
@synthesize shareButton = shareButton_;
|
||||
@synthesize urlForContentDeepLinkMetadataSwitch =
|
||||
urlForContentDeepLinkMetadataSwitch_;
|
||||
@synthesize urlForContentDeepLinkMetadataLabel =
|
||||
urlForContentDeepLinkMetadataLabel_;
|
||||
@synthesize addCallToActionButtonSwitch = addCallToActionButtonSwitch_;
|
||||
@synthesize addCallToActionButtonLabel = addCallToActionButtonLabel_;
|
||||
|
||||
- (void)dealloc {
|
||||
[callToActions_ release];
|
||||
[selectedCallToAction_ release];
|
||||
[callToActionPickerView_ release];
|
||||
[addContentDeepLinkSwitch_ release];
|
||||
[contentDeepLinkID_ release];
|
||||
[contentDeepLinkTitle_ release];
|
||||
[contentDeepLinkDescription_ release];
|
||||
[contentDeepLinkThumbnailURL_ release];
|
||||
[sharePrefillText_ release];
|
||||
[shareURL_ release];
|
||||
[shareStatus_ release];
|
||||
[shareToolbar_ release];
|
||||
[shareScrollView_ release];
|
||||
[shareView_ release];
|
||||
[addContentDeepLinkLabel_ release];
|
||||
[urlToShareLabel_ release];
|
||||
[prefillTextLabel_ release];
|
||||
[contentDeepLinkIDLabel_ release];
|
||||
[contentDeepLinkTitleLabel_ release];
|
||||
[contentDeepLinkDescriptionLabel_ release];
|
||||
[contentDeepLinkThumbnailURLLabel_ release];
|
||||
[shareButton_ release];
|
||||
[urlForContentDeepLinkMetadataSwitch_ release];
|
||||
[urlForContentDeepLinkMetadataLabel_ release];
|
||||
[addCallToActionButtonSwitch_ release];
|
||||
[addCallToActionButtonLabel_ release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
#pragma mark - View lifecycle
|
||||
|
||||
- (void)viewDidLoad {
|
||||
// Set up Google+ share dialog.
|
||||
[GPPShare sharedInstance].delegate = self;
|
||||
|
||||
[addCallToActionButtonSwitch_ setOn:NO];
|
||||
[addContentDeepLinkSwitch_ setOn:NO];
|
||||
if (![GPPSignIn sharedInstance].authentication ||
|
||||
![[GPPSignIn sharedInstance].scopes containsObject:
|
||||
kGTLAuthScopePlusLogin]) {
|
||||
addCallToActionButtonLabel_.text = @"Sign in for call-to-action";
|
||||
addCallToActionButtonSwitch_.enabled = NO;
|
||||
}
|
||||
addCallToActionButtonLabel_.adjustsFontSizeToFitWidth = YES;
|
||||
|
||||
self.callToActions = [NSArray arrayWithObjects:
|
||||
@"ACCEPT",
|
||||
@"ACCEPT_GIFT",
|
||||
@"ADD",
|
||||
@"ANSWER",
|
||||
@"ADD_TO_CALENDAR",
|
||||
@"APPLY",
|
||||
@"ASK",
|
||||
@"ATTACK",
|
||||
@"BEAT",
|
||||
@"BID",
|
||||
@"BOOK",
|
||||
@"BOOKMARK",
|
||||
@"BROWSE",
|
||||
@"BUY",
|
||||
@"CAPTURE",
|
||||
@"CHALLENGE",
|
||||
@"CHANGE",
|
||||
@"CHECKIN",
|
||||
@"CLICK_HERE",
|
||||
@"CLICK_ME",
|
||||
@"COLLECT",
|
||||
@"COMMENT",
|
||||
@"COMPARE",
|
||||
@"COMPLAIN",
|
||||
@"CONFIRM",
|
||||
@"CONNECT",
|
||||
@"CONTRIBUTE",
|
||||
@"COOK",
|
||||
@"CREATE",
|
||||
@"DEFEND",
|
||||
@"DINE",
|
||||
@"DISCOVER",
|
||||
@"DISCUSS",
|
||||
@"DONATE",
|
||||
@"DOWNLOAD",
|
||||
@"EARN",
|
||||
@"EAT",
|
||||
@"EXPLAIN",
|
||||
@"FOLLOW",
|
||||
@"GET",
|
||||
@"GIFT",
|
||||
@"GIVE",
|
||||
@"GO",
|
||||
@"HELP",
|
||||
@"IDENTIFY",
|
||||
@"INSTALL_APP",
|
||||
@"INTRODUCE",
|
||||
@"INVITE",
|
||||
@"JOIN",
|
||||
@"JOIN_ME",
|
||||
@"LEARN",
|
||||
@"LEARN_MORE",
|
||||
@"LISTEN",
|
||||
@"LOVE",
|
||||
@"MAKE",
|
||||
@"MATCH",
|
||||
@"OFFER",
|
||||
@"OPEN",
|
||||
@"OPEN_APP",
|
||||
@"OWN",
|
||||
@"PAY",
|
||||
@"PIN",
|
||||
@"PLAN",
|
||||
@"PLAY",
|
||||
@"RATE",
|
||||
@"READ",
|
||||
@"RECOMMEND",
|
||||
@"RECORD",
|
||||
@"REDEEM",
|
||||
@"REPLY",
|
||||
@"RESERVE",
|
||||
@"REVIEW",
|
||||
@"RSVP",
|
||||
@"SAVE",
|
||||
@"SAVE_OFFER",
|
||||
@"SELL",
|
||||
@"SEND",
|
||||
@"SHARE_X",
|
||||
@"SIGN_IN",
|
||||
@"SIGN_UP",
|
||||
@"START",
|
||||
@"ST0P",
|
||||
@"TEST",
|
||||
@"UPVOTE",
|
||||
@"VIEW",
|
||||
@"VIEW_ITEM",
|
||||
@"VIEW_PROFILE",
|
||||
@"VISIT",
|
||||
@"VOTE",
|
||||
@"WANT",
|
||||
@"WATCH",
|
||||
@"WRITE",
|
||||
nil
|
||||
];
|
||||
self.selectedCallToAction = [callToActions_ objectAtIndex:0];
|
||||
self.callToActionPickerView = [[[UIPickerView alloc] init] autorelease];
|
||||
callToActionPickerView_.delegate = self;
|
||||
callToActionPickerView_.dataSource = self;
|
||||
[addCallToActionButtonSwitch_ addTarget:self
|
||||
action:@selector(addCallToActionSwitched)
|
||||
forControlEvents:UIControlEventValueChanged];
|
||||
|
||||
[self layout];
|
||||
[self populateTextFields];
|
||||
[super viewDidLoad];
|
||||
}
|
||||
|
||||
- (void)viewDidUnload {
|
||||
[GPPShare sharedInstance].delegate = nil;
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver:self
|
||||
name:UIKeyboardWillShowNotification
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver:self
|
||||
name:UIKeyboardWillHideNotification
|
||||
object:nil];
|
||||
|
||||
[self setAddContentDeepLinkSwitch:nil];
|
||||
[self setContentDeepLinkID:nil];
|
||||
[self setContentDeepLinkTitle:nil];
|
||||
[self setContentDeepLinkDescription:nil];
|
||||
[self setContentDeepLinkThumbnailURL:nil];
|
||||
[self setShareScrollView:nil];
|
||||
[self setShareView:nil];
|
||||
[self setShareToolbar:nil];
|
||||
[self setAddContentDeepLinkLabel:nil];
|
||||
[self setUrlToShareLabel:nil];
|
||||
[self setPrefillTextLabel:nil];
|
||||
[self setContentDeepLinkIDLabel:nil];
|
||||
[self setContentDeepLinkTitleLabel:nil];
|
||||
[self setContentDeepLinkDescriptionLabel:nil];
|
||||
[self setContentDeepLinkThumbnailURLLabel:nil];
|
||||
[self setShareButton:nil];
|
||||
[self setUrlForContentDeepLinkMetadataSwitch:nil];
|
||||
[self setUrlForContentDeepLinkMetadataLabel:nil];
|
||||
[self setAddCallToActionButtonSwitch:nil];
|
||||
[self setAddCallToActionButtonLabel:nil];
|
||||
[super viewDidUnload];
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
if ([[UIDevice currentDevice] userInterfaceIdiom]
|
||||
== UIUserInterfaceIdiomPad) {
|
||||
shareScrollView_.frame = self.view.frame;
|
||||
}
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
// Register for keyboard notifications while visible.
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(keyboardWillShow:)
|
||||
name:UIKeyboardWillShowNotification
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(keyboardWillHide:)
|
||||
name:UIKeyboardWillHideNotification
|
||||
object:nil];
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
// Unregister for keyboard notifications while not visible.
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver:self
|
||||
name:UIKeyboardWillShowNotification
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver:self
|
||||
name:UIKeyboardWillHideNotification
|
||||
object:nil];
|
||||
|
||||
[super viewWillDisappear:animated];
|
||||
}
|
||||
|
||||
#pragma mark - UITextFieldDelegate
|
||||
|
||||
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
|
||||
[textField resignFirstResponder];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)textFieldDidBeginEditing:(UITextField *)textField {
|
||||
activeField_ = textField;
|
||||
}
|
||||
|
||||
- (void)textFieldDidEndEditing:(UITextField *)textField {
|
||||
activeField_ = nil;
|
||||
}
|
||||
|
||||
#pragma mark - GPPShareDelegate
|
||||
|
||||
- (void)finishedSharing:(BOOL)shared {
|
||||
NSString *text = shared ? @"Success" : @"Canceled";
|
||||
shareStatus_.text = [NSString stringWithFormat:@"Status: %@", text];
|
||||
}
|
||||
|
||||
#pragma mark - UIActionSheetDelegate
|
||||
|
||||
- (void)actionSheet:(UIActionSheet *)actionSheet
|
||||
didDismissWithButtonIndex:(NSInteger)buttonIndex {
|
||||
if (buttonIndex == 0) {
|
||||
[self shareButton:nil];
|
||||
} else if (buttonIndex == 1) {
|
||||
shareStatus_.text = @"Status: Sharing...";
|
||||
MFMailComposeViewController *picker =
|
||||
[[[MFMailComposeViewController alloc] init] autorelease];
|
||||
picker.mailComposeDelegate = self;
|
||||
[picker setSubject:sharePrefillText_.text];
|
||||
[picker setMessageBody:shareURL_.text isHTML:NO];
|
||||
|
||||
[self presentModalViewController:picker animated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - MFMailComposeViewControllerDelegate
|
||||
|
||||
- (void)mailComposeController:(MFMailComposeViewController *)controller
|
||||
didFinishWithResult:(MFMailComposeResult)result
|
||||
error:(NSError*)error {
|
||||
NSString *text;
|
||||
switch (result) {
|
||||
case MFMailComposeResultCancelled:
|
||||
text = @"Canceled";
|
||||
break;
|
||||
case MFMailComposeResultSaved:
|
||||
text = @"Saved";
|
||||
break;
|
||||
case MFMailComposeResultSent:
|
||||
text = @"Sent";
|
||||
break;
|
||||
case MFMailComposeResultFailed:
|
||||
text = @"Failed";
|
||||
break;
|
||||
default:
|
||||
text = @"Not sent";
|
||||
break;
|
||||
}
|
||||
shareStatus_.text = [NSString stringWithFormat:@"Status: %@", text];
|
||||
[self dismissModalViewControllerAnimated:YES];
|
||||
}
|
||||
|
||||
#pragma mark - UIKeyboard
|
||||
|
||||
- (void)keyboardWillShow:(NSNotification *)notification {
|
||||
[self animateKeyboard:notification shouldShow:YES];
|
||||
}
|
||||
|
||||
- (void)keyboardWillHide:(NSNotification *)notification {
|
||||
[self animateKeyboard:notification shouldShow:NO];
|
||||
}
|
||||
|
||||
#pragma mark - IBActions
|
||||
|
||||
- (IBAction)shareButton:(id)sender {
|
||||
shareStatus_.text = @"Status: Sharing...";
|
||||
id<GPPShareBuilder> shareBuilder = [[GPPShare sharedInstance] shareDialog];
|
||||
|
||||
NSString *inputURL = shareURL_.text;
|
||||
NSURL *urlToShare = [inputURL length] ? [NSURL URLWithString:inputURL] : nil;
|
||||
if (urlToShare) {
|
||||
[shareBuilder setURLToShare:urlToShare];
|
||||
}
|
||||
|
||||
if ([contentDeepLinkID_ text]) {
|
||||
[shareBuilder setContentDeepLinkID:[contentDeepLinkID_ text]];
|
||||
NSString *title = [contentDeepLinkTitle_ text];
|
||||
NSString *description = [contentDeepLinkDescription_ text];
|
||||
if (title && description) {
|
||||
NSURL *thumbnailURL =
|
||||
[NSURL URLWithString:[contentDeepLinkThumbnailURL_ text]];
|
||||
[shareBuilder setTitle:title
|
||||
description:description
|
||||
thumbnailURL:thumbnailURL];
|
||||
}
|
||||
}
|
||||
|
||||
NSString *inputText = sharePrefillText_.text;
|
||||
NSString *text = [inputText length] ? inputText : nil;
|
||||
if (text) {
|
||||
[shareBuilder setPrefillText:text];
|
||||
}
|
||||
|
||||
if ([addCallToActionButtonSwitch_ isOn]) {
|
||||
// Please replace the URL below with your own call-to-action button URL.
|
||||
NSURL *callToActionURL = [NSURL URLWithString:
|
||||
@"http://developers.google.com/+/mobile/ios/"];
|
||||
[shareBuilder setCallToActionButtonWithLabel:selectedCallToAction_
|
||||
URL:callToActionURL
|
||||
deepLinkID:@"call-to-action"];
|
||||
}
|
||||
|
||||
if (![shareBuilder open]) {
|
||||
shareStatus_.text = @"Status: Error (see console).";
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)shareToolbar:(id)sender {
|
||||
UIActionSheet *actionSheet =
|
||||
[[[UIActionSheet alloc] initWithTitle:@"Share this post"
|
||||
delegate:self
|
||||
cancelButtonTitle:@"Cancel"
|
||||
destructiveButtonTitle:nil
|
||||
otherButtonTitles:@"Google+", @"Email", nil]
|
||||
autorelease];
|
||||
[actionSheet showFromToolbar:shareToolbar_];
|
||||
}
|
||||
|
||||
- (IBAction)urlForContentDeepLinkMetadataSwitchToggle:(id)sender {
|
||||
[self layout];
|
||||
[self populateTextFields];
|
||||
}
|
||||
|
||||
- (IBAction)contentDeepLinkSwitchToggle:(id)sender {
|
||||
if (!addContentDeepLinkSwitch_.on) {
|
||||
[urlForContentDeepLinkMetadataSwitch_ setOn:YES];
|
||||
}
|
||||
[self layout];
|
||||
[self populateTextFields];
|
||||
}
|
||||
|
||||
#pragma mark - Helper methods
|
||||
|
||||
- (void)placeView:(UIView *)view x:(CGFloat)x y:(CGFloat)y {
|
||||
CGSize frameSize = view.frame.size;
|
||||
view.frame = CGRectMake(x, y, frameSize.width, frameSize.height);
|
||||
}
|
||||
|
||||
- (void)layout {
|
||||
CGFloat originX = 20.0;
|
||||
CGFloat originY = 10.0;
|
||||
CGFloat yPadding = 10.0;
|
||||
CGFloat currentY = originY;
|
||||
CGFloat middleX = 150;
|
||||
|
||||
// Place the switch for adding call-to-action button.
|
||||
[self placeView:addCallToActionButtonLabel_ x:originX y:currentY];
|
||||
[self placeView:addCallToActionButtonSwitch_ x:middleX * 1.5 y:currentY];
|
||||
CGSize frameSize = addCallToActionButtonSwitch_.frame.size;
|
||||
currentY += frameSize.height + yPadding;
|
||||
|
||||
// Place the switch for attaching content deep-link data.
|
||||
[self placeView:addContentDeepLinkLabel_ x:originX y:currentY];
|
||||
[self placeView:addContentDeepLinkSwitch_ x:middleX * 1.5 y:currentY];
|
||||
frameSize = addContentDeepLinkSwitch_.frame.size;
|
||||
currentY += frameSize.height + yPadding;
|
||||
|
||||
// Place the switch for preview URL.
|
||||
if (addContentDeepLinkSwitch_.on) {
|
||||
[self placeView:urlForContentDeepLinkMetadataLabel_ x:originX y:currentY];
|
||||
[self placeView:urlForContentDeepLinkMetadataSwitch_
|
||||
x:middleX * 1.5
|
||||
y:currentY];
|
||||
frameSize = urlForContentDeepLinkMetadataSwitch_.frame.size;
|
||||
currentY += frameSize.height + yPadding;
|
||||
urlForContentDeepLinkMetadataSwitch_.hidden = NO;
|
||||
urlForContentDeepLinkMetadataLabel_.hidden = NO;
|
||||
} else {
|
||||
urlForContentDeepLinkMetadataSwitch_.hidden = YES;
|
||||
urlForContentDeepLinkMetadataLabel_.hidden = YES;
|
||||
}
|
||||
|
||||
// Place the field for URL to share.
|
||||
if (urlForContentDeepLinkMetadataSwitch_.on) {
|
||||
[self placeView:urlToShareLabel_ x:originX y:currentY];
|
||||
frameSize = urlToShareLabel_.frame.size;
|
||||
currentY += frameSize.height + 0.5 * yPadding;
|
||||
|
||||
[self placeView:shareURL_ x:originX y:currentY];
|
||||
frameSize = shareURL_.frame.size;
|
||||
currentY += frameSize.height + yPadding;
|
||||
urlToShareLabel_.hidden = NO;
|
||||
shareURL_.hidden = NO;
|
||||
} else {
|
||||
urlToShareLabel_.hidden = YES;
|
||||
shareURL_.hidden = YES;
|
||||
}
|
||||
|
||||
// Place the field for prefill text.
|
||||
[self placeView:prefillTextLabel_ x:originX y:currentY];
|
||||
frameSize = prefillTextLabel_.frame.size;
|
||||
currentY += frameSize.height + 0.5 * yPadding;
|
||||
[self placeView:sharePrefillText_ x:originX y:currentY];
|
||||
frameSize = sharePrefillText_.frame.size;
|
||||
currentY += frameSize.height + yPadding;
|
||||
|
||||
// Place the content deep-link ID field.
|
||||
if (addContentDeepLinkSwitch_.on) {
|
||||
[self placeView:contentDeepLinkIDLabel_ x:originX y:currentY];
|
||||
frameSize = contentDeepLinkIDLabel_.frame.size;
|
||||
currentY += frameSize.height + 0.5 * yPadding;
|
||||
[self placeView:contentDeepLinkID_ x:originX y:currentY];
|
||||
frameSize = contentDeepLinkID_.frame.size;
|
||||
currentY += frameSize.height + yPadding;
|
||||
contentDeepLinkIDLabel_.hidden = NO;
|
||||
contentDeepLinkID_.hidden = NO;
|
||||
} else {
|
||||
contentDeepLinkIDLabel_.hidden = YES;
|
||||
contentDeepLinkID_.hidden = YES;
|
||||
}
|
||||
|
||||
// Place fields for content deep-link metadata.
|
||||
if (addContentDeepLinkSwitch_.on &&
|
||||
!urlForContentDeepLinkMetadataSwitch_.on) {
|
||||
[self placeView:contentDeepLinkTitleLabel_ x:originX y:currentY];
|
||||
frameSize = contentDeepLinkTitleLabel_.frame.size;
|
||||
currentY += frameSize.height + 0.5 * yPadding;
|
||||
[self placeView:contentDeepLinkTitle_ x:originX y:currentY];
|
||||
frameSize = contentDeepLinkTitle_.frame.size;
|
||||
currentY += frameSize.height + yPadding;
|
||||
|
||||
[self placeView:contentDeepLinkDescriptionLabel_ x:originX y:currentY];
|
||||
frameSize = contentDeepLinkDescriptionLabel_.frame.size;
|
||||
currentY += frameSize.height + 0.5 * yPadding;
|
||||
[self placeView:contentDeepLinkDescription_ x:originX y:currentY];
|
||||
frameSize = contentDeepLinkDescription_.frame.size;
|
||||
currentY += frameSize.height + yPadding;
|
||||
|
||||
[self placeView:contentDeepLinkThumbnailURLLabel_ x:originX y:currentY];
|
||||
frameSize = contentDeepLinkThumbnailURLLabel_.frame.size;
|
||||
currentY += frameSize.height + 0.5 * yPadding;
|
||||
[self placeView:contentDeepLinkThumbnailURL_ x:originX y:currentY];
|
||||
frameSize = contentDeepLinkThumbnailURL_.frame.size;
|
||||
currentY += frameSize.height + yPadding;
|
||||
|
||||
contentDeepLinkTitle_.hidden = NO;
|
||||
contentDeepLinkTitleLabel_.hidden = NO;
|
||||
contentDeepLinkDescriptionLabel_.hidden = NO;
|
||||
contentDeepLinkDescription_.hidden = NO;
|
||||
contentDeepLinkThumbnailURLLabel_.hidden = NO;
|
||||
contentDeepLinkThumbnailURL_.hidden = NO;
|
||||
} else {
|
||||
contentDeepLinkTitle_.hidden = YES;
|
||||
contentDeepLinkTitleLabel_.hidden = YES;
|
||||
contentDeepLinkDescriptionLabel_.hidden = YES;
|
||||
contentDeepLinkDescription_.hidden = YES;
|
||||
contentDeepLinkThumbnailURLLabel_.hidden = YES;
|
||||
contentDeepLinkThumbnailURL_.hidden = YES;
|
||||
}
|
||||
|
||||
// Place the share button and status.
|
||||
[[shareButton_ layer] setCornerRadius:5];
|
||||
[[shareButton_ layer] setMasksToBounds:YES];
|
||||
CGColorRef borderColor = [[UIColor colorWithWhite:203.0/255.0
|
||||
alpha:1.0] CGColor];
|
||||
[[shareButton_ layer] setBorderColor:borderColor];
|
||||
[[shareButton_ layer] setBorderWidth:1.0];
|
||||
|
||||
[self placeView:shareButton_ x:originX y:currentY + yPadding];
|
||||
frameSize = shareButton_.frame.size;
|
||||
currentY += frameSize.height + yPadding * 2;
|
||||
|
||||
[self placeView:shareStatus_ x:originX y:currentY];
|
||||
frameSize = shareStatus_.frame.size;
|
||||
currentY += frameSize.height + yPadding;
|
||||
|
||||
shareScrollView_.contentSize =
|
||||
CGSizeMake(shareScrollView_.frame.size.width, currentY);
|
||||
}
|
||||
|
||||
- (void)populateTextFields {
|
||||
// Pre-populate text fields for Google+ share sample.
|
||||
if (sharePrefillText_.hidden) {
|
||||
sharePrefillText_.text = @"";
|
||||
} else {
|
||||
sharePrefillText_.text = @"Welcome to Google+ Platform";
|
||||
}
|
||||
|
||||
if (shareURL_.hidden) {
|
||||
shareURL_.text = @"";
|
||||
} else {
|
||||
shareURL_.text = @"http://developers.google.com/+/mobile/ios/";
|
||||
}
|
||||
|
||||
if (contentDeepLinkID_.hidden) {
|
||||
contentDeepLinkID_.text = @"";
|
||||
} else {
|
||||
contentDeepLinkID_.text = @"playlist/314159265358";
|
||||
}
|
||||
|
||||
if (contentDeepLinkTitle_.hidden) {
|
||||
contentDeepLinkTitle_.text = @"";
|
||||
} else {
|
||||
contentDeepLinkTitle_.text = @"Joe's Pop Music Playlist";
|
||||
}
|
||||
|
||||
if (contentDeepLinkDescription_.hidden) {
|
||||
contentDeepLinkDescription_.text = @"";
|
||||
} else {
|
||||
contentDeepLinkDescription_.text =
|
||||
@"Check out this playlist of my favorite pop songs!";
|
||||
}
|
||||
|
||||
if (contentDeepLinkThumbnailURL_.hidden) {
|
||||
contentDeepLinkThumbnailURL_.text = @"";
|
||||
} else {
|
||||
contentDeepLinkThumbnailURL_.text =
|
||||
@"http://www.google.com/logos/2012/childrensday-2012-hp.jpg";
|
||||
}
|
||||
}
|
||||
|
||||
- (void)animateKeyboard:(NSNotification *)notification
|
||||
shouldShow:(BOOL)shouldShow {
|
||||
if (!shouldShow) {
|
||||
UIEdgeInsets contentInsets = UIEdgeInsetsZero;
|
||||
shareScrollView_.contentInset = contentInsets;
|
||||
shareScrollView_.scrollIndicatorInsets = contentInsets;
|
||||
return;
|
||||
}
|
||||
|
||||
NSDictionary *userInfo = [notification userInfo];
|
||||
CGRect kbFrame =
|
||||
[[userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue];
|
||||
CGSize kbSize = kbFrame.size;
|
||||
UIEdgeInsets contentInsets = UIEdgeInsetsMake(0.0, 0.0, kbSize.height, 0.0);
|
||||
shareScrollView_.contentInset = contentInsets;
|
||||
shareScrollView_.scrollIndicatorInsets = contentInsets;
|
||||
|
||||
// If active text field is hidden by keyboard, scroll so it's visible.
|
||||
CGRect aRect = self.view.frame;
|
||||
aRect.size.height -= kbSize.height;
|
||||
CGPoint bottomLeft =
|
||||
CGPointMake(0.0, activeField_.frame.origin.y +
|
||||
activeField_.frame.size.height + 10);
|
||||
if (!CGRectContainsPoint(aRect, bottomLeft)) {
|
||||
CGPoint scrollPoint = CGPointMake(0.0, bottomLeft.y - aRect.size.height);
|
||||
[shareScrollView_ setContentOffset:scrollPoint animated:YES];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
- (void)addCallToActionSwitched {
|
||||
if (!addCallToActionButtonSwitch_.on) {
|
||||
return;
|
||||
}
|
||||
[self.view addSubview:callToActionPickerView_];
|
||||
}
|
||||
|
||||
#pragma mark - UIPickerViewDataSource
|
||||
|
||||
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (NSInteger)pickerView:(UIPickerView *)pickerView
|
||||
numberOfRowsInComponent:(NSInteger)component {
|
||||
return callToActions_.count;
|
||||
}
|
||||
|
||||
#pragma mark - UIPickerViewDelegate
|
||||
|
||||
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row
|
||||
forComponent:(NSInteger)component reusingView:(UIView *)view {
|
||||
UITableViewCell *cell = (UITableViewCell *)view;
|
||||
if (cell == nil) {
|
||||
cell = [[[UITableViewCell alloc]
|
||||
initWithStyle:UITableViewCellStyleDefault
|
||||
reuseIdentifier:nil] autorelease];
|
||||
[cell setBackgroundColor:[UIColor clearColor]];
|
||||
[cell setBounds: CGRectMake(0, 0, cell.frame.size.width - 20 , 44)];
|
||||
UITapGestureRecognizer *singleTapGestureRecognizer =
|
||||
[[[UITapGestureRecognizer alloc]
|
||||
initWithTarget:self
|
||||
action:@selector(toggleSelection:)] autorelease];
|
||||
singleTapGestureRecognizer.numberOfTapsRequired = 1;
|
||||
[cell addGestureRecognizer:singleTapGestureRecognizer];
|
||||
}
|
||||
NSString *callToAction = [callToActions_ objectAtIndex:row];
|
||||
if ([selectedCallToAction_ isEqualToString:callToAction]) {
|
||||
cell.accessoryType = UITableViewCellAccessoryCheckmark;
|
||||
} else {
|
||||
cell.accessoryType = UITableViewCellAccessoryNone;
|
||||
}
|
||||
cell.textLabel.text = callToAction;
|
||||
cell.textLabel.font = [UIFont systemFontOfSize:12];
|
||||
cell.tag = row;
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)toggleSelection:(UITapGestureRecognizer *)recognizer {
|
||||
int row = recognizer.view.tag;
|
||||
self.selectedCallToAction = [callToActions_ objectAtIndex:row];
|
||||
[callToActionPickerView_ removeFromSuperview];
|
||||
// Force refresh checked/unchecked marks.
|
||||
[callToActionPickerView_ reloadAllComponents];
|
||||
addCallToActionButtonLabel_.text =
|
||||
[NSString stringWithFormat:@"Call-to-Action: %@", selectedCallToAction_];
|
||||
}
|
||||
|
||||
@end
|
1231
External/google-plus-ios-sdk/SampleCode/ShareViewController.xib
vendored
Normal file
1231
External/google-plus-ios-sdk/SampleCode/ShareViewController.xib
vendored
Normal file
File diff suppressed because it is too large
Load Diff
51
External/google-plus-ios-sdk/SampleCode/SignInViewController.h
vendored
Normal file
51
External/google-plus-ios-sdk/SampleCode/SignInViewController.h
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// SignInViewController.h
|
||||
//
|
||||
// Copyright 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 <UIKit/UIKit.h>
|
||||
|
||||
@class GPPSignInButton;
|
||||
|
||||
// A view controller for the Google+ sign-in button which initiates a standard
|
||||
// OAuth 2.0 flow and provides an access token and a refresh token. A "Sign out"
|
||||
// button is provided to allow users to sign out of this application.
|
||||
@interface SignInViewController : UIViewController
|
||||
|
||||
// The button that handles Google+ sign-in.
|
||||
@property (retain, nonatomic) IBOutlet GPPSignInButton *signInButton;
|
||||
// A label to display the result of the sign-in action.
|
||||
@property (retain, nonatomic) IBOutlet UILabel *signInAuthStatus;
|
||||
// A label to display the signed-in user's display name.
|
||||
@property (retain, nonatomic) IBOutlet UILabel *signInDisplayName;
|
||||
// A button to sign out of this application.
|
||||
@property (retain, nonatomic) IBOutlet UIButton *signOutButton;
|
||||
// A button to disconnect user from this application.
|
||||
@property (retain, nonatomic) IBOutlet UIButton *disconnectButton;
|
||||
// A switch for whether to request
|
||||
// https://www.googleapis.com/auth/userinfo.email scope to get user's email
|
||||
// address after the sign-in action.
|
||||
@property (retain, nonatomic) IBOutlet UISwitch *userinfoEmailScope;
|
||||
|
||||
// Called when the user presses the "Sign out" button.
|
||||
- (IBAction)signOut:(id)sender;
|
||||
// Called when the user presses the "Disconnect" button.
|
||||
- (IBAction)disconnect:(id)sender;
|
||||
// Called when the user toggles the
|
||||
// https://www.googleapis.com/auth/userinfo.email scope.
|
||||
- (IBAction)userinfoEmailScopeToggle:(id)sender;
|
||||
|
||||
@end
|
168
External/google-plus-ios-sdk/SampleCode/SignInViewController.m
vendored
Normal file
168
External/google-plus-ios-sdk/SampleCode/SignInViewController.m
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
//
|
||||
// SignInViewController.m
|
||||
//
|
||||
// Copyright 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 "SignInViewController.h"
|
||||
|
||||
#import <GoogleOpenSource/GoogleOpenSource.h>
|
||||
#import <GooglePlus/GooglePlus.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
@interface SignInViewController () <GPPSignInDelegate>
|
||||
- (void)enableSignInSettings:(BOOL)enable;
|
||||
- (void)reportAuthStatus;
|
||||
- (void)retrieveUserInfo;
|
||||
@end
|
||||
|
||||
@implementation SignInViewController
|
||||
|
||||
@synthesize signInButton = signInButton_;
|
||||
@synthesize signInAuthStatus = signInAuthStatus_;
|
||||
@synthesize signInDisplayName = signInDisplayName_;
|
||||
@synthesize signOutButton = signOutButton_;
|
||||
@synthesize disconnectButton = disconnectButton_;
|
||||
@synthesize userinfoEmailScope = userinfoEmailScope_;
|
||||
|
||||
- (void)dealloc {
|
||||
[signInButton_ release];
|
||||
[signInAuthStatus_ release];
|
||||
[signInDisplayName_ release];
|
||||
[signOutButton_ release];
|
||||
[userinfoEmailScope_ release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
#pragma mark - View lifecycle
|
||||
|
||||
- (void)viewDidLoad {
|
||||
// Make sure the GPPSignInButton class is linked in because references from
|
||||
// xib file doesn't count.
|
||||
[GPPSignInButton class];
|
||||
|
||||
GPPSignIn *signIn = [GPPSignIn sharedInstance];
|
||||
userinfoEmailScope_.on =
|
||||
signIn.shouldFetchGoogleUserEmail;
|
||||
|
||||
// Set up sign-out and disconnect buttons.
|
||||
[self setUpButton:signOutButton_];
|
||||
[self setUpButton:disconnectButton_];
|
||||
|
||||
// Set up sample view of Google+ sign-in.
|
||||
// The client ID has been set in the app delegate.
|
||||
signIn.delegate = self;
|
||||
signIn.shouldFetchGoogleUserEmail = userinfoEmailScope_.on;
|
||||
signIn.actions = [NSArray arrayWithObjects:
|
||||
@"http://schemas.google.com/AddActivity",
|
||||
@"http://schemas.google.com/BuyActivity",
|
||||
@"http://schemas.google.com/CheckInActivity",
|
||||
@"http://schemas.google.com/CommentActivity",
|
||||
@"http://schemas.google.com/CreateActivity",
|
||||
@"http://schemas.google.com/ListenActivity",
|
||||
@"http://schemas.google.com/ReserveActivity",
|
||||
@"http://schemas.google.com/ReviewActivity",
|
||||
nil];
|
||||
|
||||
[self reportAuthStatus];
|
||||
[signIn trySilentAuthentication];
|
||||
[super viewDidLoad];
|
||||
}
|
||||
|
||||
- (void)viewDidUnload {
|
||||
[self setSignInButton:nil];
|
||||
[self setSignInAuthStatus:nil];
|
||||
[self setSignInDisplayName:nil];
|
||||
[self setSignOutButton:nil];
|
||||
[self setDisconnectButton:nil];
|
||||
[self setUserinfoEmailScope:nil];
|
||||
[super viewDidUnload];
|
||||
}
|
||||
|
||||
#pragma mark - GPPSignInDelegate
|
||||
|
||||
- (void)finishedWithAuth:(GTMOAuth2Authentication *)auth
|
||||
error:(NSError *)error {
|
||||
if (error) {
|
||||
signInAuthStatus_.text =
|
||||
[NSString stringWithFormat:@"Status: Authentication error: %@", error];
|
||||
return;
|
||||
}
|
||||
[self reportAuthStatus];
|
||||
}
|
||||
|
||||
- (void)didDisconnectWithError:(NSError *)error {
|
||||
if (error) {
|
||||
signInAuthStatus_.text =
|
||||
[NSString stringWithFormat:@"Status: Failed to disconnect: %@", error];
|
||||
} else {
|
||||
signInAuthStatus_.text =
|
||||
[NSString stringWithFormat:@"Status: Disconnected"];
|
||||
signInDisplayName_.text = @"";
|
||||
[self enableSignInSettings:YES];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Helper methods
|
||||
|
||||
- (void)setUpButton:(UIButton *)button {
|
||||
[[button layer] setCornerRadius:5];
|
||||
[[button layer] setMasksToBounds:YES];
|
||||
CGColorRef borderColor = [[UIColor colorWithWhite:203.0/255.0
|
||||
alpha:1.0] CGColor];
|
||||
[[button layer] setBorderColor:borderColor];
|
||||
[[button layer] setBorderWidth:1.0];
|
||||
}
|
||||
|
||||
- (void)enableSignInSettings:(BOOL)enable {
|
||||
userinfoEmailScope_.enabled = enable;
|
||||
}
|
||||
|
||||
- (void)reportAuthStatus {
|
||||
if ([GPPSignIn sharedInstance].authentication) {
|
||||
signInAuthStatus_.text = @"Status: Authenticated";
|
||||
[self retrieveUserInfo];
|
||||
[self enableSignInSettings:NO];
|
||||
} else {
|
||||
// To authenticate, use Google+ sign-in button.
|
||||
signInAuthStatus_.text = @"Status: Not authenticated";
|
||||
[self enableSignInSettings:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)retrieveUserInfo {
|
||||
signInDisplayName_.text = [NSString stringWithFormat:@"Email: %@",
|
||||
[GPPSignIn sharedInstance].authentication.userEmail];
|
||||
}
|
||||
|
||||
#pragma mark - IBActions
|
||||
|
||||
- (IBAction)signOut:(id)sender {
|
||||
[[GPPSignIn sharedInstance] signOut];
|
||||
|
||||
[self reportAuthStatus];
|
||||
signInDisplayName_.text = @"";
|
||||
}
|
||||
|
||||
- (IBAction)disconnect:(id)sender {
|
||||
[[GPPSignIn sharedInstance] disconnect];
|
||||
}
|
||||
|
||||
- (IBAction)userinfoEmailScopeToggle:(id)sender {
|
||||
[GPPSignIn sharedInstance].shouldFetchGoogleUserEmail =
|
||||
userinfoEmailScope_.on;
|
||||
}
|
||||
|
||||
@end
|
514
External/google-plus-ios-sdk/SampleCode/SignInViewController.xib
vendored
Normal file
514
External/google-plus-ios-sdk/SampleCode/SignInViewController.xib
vendored
Normal file
@@ -0,0 +1,514 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1552</int>
|
||||
<string key="IBDocument.SystemVersion">12C60</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">3084</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">2083</string>
|
||||
</object>
|
||||
<array key="IBDocument.IntegratedClassDependencies">
|
||||
<string>IBProxyObject</string>
|
||||
<string>IBUIButton</string>
|
||||
<string>IBUILabel</string>
|
||||
<string>IBUISwitch</string>
|
||||
<string>IBUIView</string>
|
||||
</array>
|
||||
<array key="IBDocument.PluginDependencies">
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</array>
|
||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
|
||||
<integer value="1" key="NS.object.0"/>
|
||||
</object>
|
||||
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
|
||||
<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="IBUIView" id="191373211">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="IBUIButton" id="306965198">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{19, 171}, {117, 35}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="81911376"/>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<int key="IBUIContentHorizontalAlignment">0</int>
|
||||
<int key="IBUIContentVerticalAlignment">0</int>
|
||||
<string key="IBUINormalTitle">Sign out</string>
|
||||
<object class="NSColor" key="IBUIHighlightedTitleColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MC42MzUyOTQxMTc2IDAuMzIxNTY4NjI3NSAwLjI1ODgyMzUyOTQAA</bytes>
|
||||
</object>
|
||||
<object class="NSColor" key="IBUINormalTitleColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MC42MzUyOTQxMTc2IDAuMzIxNTY4NjI3NSAwLjI1ODgyMzUyOTQAA</bytes>
|
||||
</object>
|
||||
<object class="NSColor" key="IBUINormalTitleShadowColor" id="292633723">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MC41AA</bytes>
|
||||
</object>
|
||||
<object class="NSCustomResource" key="IBUINormalBackgroundImage" id="497516568">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">button_background.png</string>
|
||||
</object>
|
||||
<object class="IBUIFontDescription" key="IBUIFontDescription" id="579453245">
|
||||
<int key="type">2</int>
|
||||
<double key="pointSize">15</double>
|
||||
</object>
|
||||
<object class="NSFont" key="IBUIFont" id="966414073">
|
||||
<string key="NSName">Helvetica-Bold</string>
|
||||
<double key="NSSize">15</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUIView" id="984977003">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{18, 112}, {118, 32}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="306965198"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
<object class="NSColorSpace" key="NSCustomColorSpace" id="670943165">
|
||||
<int key="NSID">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUILabel" id="419255470">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">290</int>
|
||||
<string key="NSFrame">{{20, 241}, {280, 21}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="534305484"/>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<int key="IBUIContentMode">7</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<string key="IBUIText">Status:</string>
|
||||
<object class="NSColor" key="IBUITextColor" id="515161017">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MCAwIDAAA</bytes>
|
||||
<string key="IBUIColorCocoaTouchKeyPath">darkTextColor</string>
|
||||
</object>
|
||||
<nil key="IBUIHighlightedColor"/>
|
||||
<int key="IBUIBaselineAdjustment">1</int>
|
||||
<float key="IBUIMinimumFontSize">13</float>
|
||||
<object class="IBUIFontDescription" key="IBUIFontDescription" id="136904364">
|
||||
<int key="type">1</int>
|
||||
<double key="pointSize">17</double>
|
||||
</object>
|
||||
<object class="NSFont" key="IBUIFont" id="445796440">
|
||||
<string key="NSName">Helvetica</string>
|
||||
<double key="NSSize">17</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUILabel" id="534305484">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">290</int>
|
||||
<string key="NSFrame">{{20, 270}, {280, 65}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<int key="IBUIContentMode">7</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<string key="IBUIText"/>
|
||||
<reference key="IBUITextColor" ref="515161017"/>
|
||||
<nil key="IBUIHighlightedColor"/>
|
||||
<int key="IBUIBaselineAdjustment">1</int>
|
||||
<float key="IBUIMinimumFontSize">13</float>
|
||||
<int key="IBUINumberOfLines">2</int>
|
||||
<reference key="IBUIFontDescription" ref="136904364"/>
|
||||
<reference key="IBUIFont" ref="445796440"/>
|
||||
<double key="preferredMaxLayoutWidth">280</double>
|
||||
</object>
|
||||
<object class="IBUILabel" id="11644204">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{18, 15}, {273, 21}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="175024995"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<int key="IBUIContentMode">7</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<string key="IBUIText">Sign-in setting (sign out to change)</string>
|
||||
<reference key="IBUITextColor" ref="515161017"/>
|
||||
<nil key="IBUIHighlightedColor"/>
|
||||
<int key="IBUIBaselineAdjustment">0</int>
|
||||
<reference key="IBUIFontDescription" ref="136904364"/>
|
||||
<reference key="IBUIFont" ref="445796440"/>
|
||||
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
|
||||
</object>
|
||||
<object class="IBUILabel" id="175024995">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{18, 44}, {197, 27}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="300876298"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<int key="IBUIContentMode">7</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<string key="IBUIText">get userinfo.email scope</string>
|
||||
<reference key="IBUITextColor" ref="515161017"/>
|
||||
<nil key="IBUIHighlightedColor"/>
|
||||
<int key="IBUIBaselineAdjustment">0</int>
|
||||
<reference key="IBUIFontDescription" ref="136904364"/>
|
||||
<reference key="IBUIFont" ref="445796440"/>
|
||||
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
|
||||
</object>
|
||||
<object class="IBUISwitch" id="300876298">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{208, 44}, {94, 27}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="984977003"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<bool key="IBUIEnabled">NO</bool>
|
||||
<int key="IBUIContentHorizontalAlignment">0</int>
|
||||
<int key="IBUIContentVerticalAlignment">0</int>
|
||||
</object>
|
||||
<object class="IBUIButton" id="81911376">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{181, 171}, {119, 35}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="419255470"/>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<int key="IBUIContentHorizontalAlignment">0</int>
|
||||
<int key="IBUIContentVerticalAlignment">0</int>
|
||||
<string key="IBUINormalTitle">Disconnect</string>
|
||||
<object class="NSColor" key="IBUIHighlightedTitleColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MC42MzUyOTQxMTc2IDAuMzIxNTY4NjI3NSAwLjI1ODgyMzUyOTQAA</bytes>
|
||||
</object>
|
||||
<object class="NSColor" key="IBUINormalTitleColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MC42MzUyOTQxMTc2IDAuMzIxNTY4NjI3NSAwLjI1ODgyMzUyOTQAA</bytes>
|
||||
</object>
|
||||
<reference key="IBUINormalTitleShadowColor" ref="292633723"/>
|
||||
<reference key="IBUINormalBackgroundImage" ref="497516568"/>
|
||||
<reference key="IBUIFontDescription" ref="579453245"/>
|
||||
<reference key="IBUIFont" ref="966414073"/>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="11644204"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
<reference key="NSCustomColorSpace" ref="670943165"/>
|
||||
</object>
|
||||
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<array class="NSMutableArray" key="connectionRecords">
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">view</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="191373211"/>
|
||||
</object>
|
||||
<int key="connectionID">4</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">signInButton</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="984977003"/>
|
||||
</object>
|
||||
<int key="connectionID">14</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">signInAuthStatus</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="419255470"/>
|
||||
</object>
|
||||
<int key="connectionID">23</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">signOutButton</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="306965198"/>
|
||||
</object>
|
||||
<int key="connectionID">24</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">signInDisplayName</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="534305484"/>
|
||||
</object>
|
||||
<int key="connectionID">28</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">userinfoEmailScope</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="300876298"/>
|
||||
</object>
|
||||
<int key="connectionID">39</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">disconnectButton</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="81911376"/>
|
||||
</object>
|
||||
<int key="connectionID">51</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">signOut:</string>
|
||||
<reference key="source" ref="306965198"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
<int key="IBEventType">7</int>
|
||||
</object>
|
||||
<int key="connectionID">26</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">userinfoEmailScopeToggle:</string>
|
||||
<reference key="source" ref="300876298"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
<int key="IBEventType">13</int>
|
||||
</object>
|
||||
<int key="connectionID">40</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">disconnect:</string>
|
||||
<reference key="source" ref="81911376"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
<int key="IBEventType">7</int>
|
||||
</object>
|
||||
<int key="connectionID">50</int>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<array key="orderedObjects">
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">0</int>
|
||||
<array key="object" id="0"/>
|
||||
<reference key="children" ref="1000"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">1</int>
|
||||
<reference key="object" ref="191373211"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="306965198"/>
|
||||
<reference ref="984977003"/>
|
||||
<reference ref="419255470"/>
|
||||
<reference ref="300876298"/>
|
||||
<reference ref="11644204"/>
|
||||
<reference ref="534305484"/>
|
||||
<reference ref="175024995"/>
|
||||
<reference ref="81911376"/>
|
||||
</array>
|
||||
<reference key="parent" ref="0"/>
|
||||
</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">7</int>
|
||||
<reference key="object" ref="984977003"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">6</int>
|
||||
<reference key="object" ref="306965198"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">22</int>
|
||||
<reference key="object" ref="419255470"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">27</int>
|
||||
<reference key="object" ref="534305484"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">37</int>
|
||||
<reference key="object" ref="175024995"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">38</int>
|
||||
<reference key="object" ref="300876298"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">30</int>
|
||||
<reference key="object" ref="11644204"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">48</int>
|
||||
<reference key="object" ref="81911376"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
<string key="-1.CustomClassName">SignInViewController</string>
|
||||
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="-2.CustomClassName">UIResponder</string>
|
||||
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="22.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="27.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="30.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="37.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="38.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="48.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<real value="0.0" key="48.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
|
||||
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<real value="0.0" key="6.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
|
||||
<string key="7.CustomClassName">GPPSignInButton</string>
|
||||
<string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
|
||||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">51</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">GPPSignInButton</string>
|
||||
<string key="superclassName">UIButton</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/GPPSignInButton.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">SignInViewController</string>
|
||||
<string key="superclassName">UIViewController</string>
|
||||
<dictionary class="NSMutableDictionary" key="actions">
|
||||
<string key="disconnect:">id</string>
|
||||
<string key="signOut:">id</string>
|
||||
<string key="userinfoEmailScopeToggle:">id</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="actionInfosByName">
|
||||
<object class="IBActionInfo" key="disconnect:">
|
||||
<string key="name">disconnect:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="signOut:">
|
||||
<string key="name">signOut:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="userinfoEmailScopeToggle:">
|
||||
<string key="name">userinfoEmailScopeToggle:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="outlets">
|
||||
<string key="disconnectButton">UIButton</string>
|
||||
<string key="signInAuthStatus">UILabel</string>
|
||||
<string key="signInButton">GPPSignInButton</string>
|
||||
<string key="signInDisplayName">UILabel</string>
|
||||
<string key="signOutButton">UIButton</string>
|
||||
<string key="userinfoEmailScope">UISwitch</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<object class="IBToOneOutletInfo" key="disconnectButton">
|
||||
<string key="name">disconnectButton</string>
|
||||
<string key="candidateClassName">UIButton</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="signInAuthStatus">
|
||||
<string key="name">signInAuthStatus</string>
|
||||
<string key="candidateClassName">UILabel</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="signInButton">
|
||||
<string key="name">signInButton</string>
|
||||
<string key="candidateClassName">GPPSignInButton</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="signInDisplayName">
|
||||
<string key="name">signInDisplayName</string>
|
||||
<string key="candidateClassName">UILabel</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="signOutButton">
|
||||
<string key="name">signOutButton</string>
|
||||
<string key="candidateClassName">UIButton</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="userinfoEmailScope">
|
||||
<string key="name">userinfoEmailScope</string>
|
||||
<string key="candidateClassName">UISwitch</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/SignInViewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
|
||||
<real value="1552" key="NS.object.0"/>
|
||||
</object>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
|
||||
<string key="NS.key.0">button_background.png</string>
|
||||
<string key="NS.object.0">{1, 1}</string>
|
||||
</object>
|
||||
<string key="IBCocoaTouchPluginVersion">2083</string>
|
||||
</data>
|
||||
</archive>
|
@@ -18,11 +18,11 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "GooglePlusSampleAppDelegate.h"
|
||||
#import "AppDelegate.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
@autoreleasepool {
|
||||
return UIApplicationMain(argc, argv, nil,
|
||||
NSStringFromClass([GooglePlusSampleAppDelegate class]));
|
||||
return UIApplicationMain(argc, argv, nil,
|
||||
NSStringFromClass([AppDelegate class]));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user