Today's Menu  Portugal
journal and plan nutrition
Instance Methods | Properties | List of all members
V7GoogleLoginControlbar Class Reference

#import <V7GoogleLoginControlbar.h>

Inheritance diagram for V7GoogleLoginControlbar:
Inheritance graph
[legend]
Collaboration diagram for V7GoogleLoginControlbar:
Collaboration graph
[legend]

Instance Methods

(instancetype) - initWithFrame:andDelegate:
 
(void) - appear
 
(float) - heightRequirement [implementation]
 
(void) - appear: [implementation]
 
(void) - logOutGoogle [implementation]
 
(void) - createEntryOnDrive [implementation]
 
(void) - signInWillDispatch:error: [implementation]
 
(void) - signIn:presentViewController: [implementation]
 
(void) - signIn:dismissViewController: [implementation]
 
(void) - signedIn: [implementation]
 
(void) - signedOut: [implementation]
 

Properties

GIDSignInButtonsignInButton
 
UIButton * forwardButton
 

Detailed Description

Definition at line 26 of file V7GoogleLoginControlbar.h.

Method Documentation

◆ appear()

- (void) appear

Definition at line 41 of file V7GoogleLoginControlbar.m.

42 {
43  [self appear:controlbarFrame];
44 }

◆ appear:()

- (void) appear: (CGRect)  bound
implementation

Definition at line 45 of file V7GoogleLoginControlbar.m.

45  :(CGRect)bound
46 {
47  Z5GoogleLoginController *loginControl = [[[Z5DataController sharedInstance] remoteDataController] loginController];
48 
49  [loginControl addLoginListener:self];
50  // Boolean isLoggedIn = [[loginControl signedIn] boolValue];
51  Boolean isLoggedIn;
52  if (nil==[loginControl username]) {
53  isLoggedIn = NO;
54  NSLog(@"V7GoogleLoginControlbar.appear: not logged in");
55  } else {
56  isLoggedIn = YES;
57  NSLog(@"V7GoogleLoginControlbar.appear: user: %@",
58  [loginControl username]);
59  }
60  if (isLoggedIn) {
61  [self setBackgroundColor:[UIColor greenColor]];
62 
63  float submitButtonWidth = 132;
64  float submitButtonHeight = 32;
65  CGRect logOutFrame = CGRectMake(bound.size.width - (submitButtonWidth+ 20.0), 2.0, submitButtonWidth, submitButtonHeight);
66  CGRect forwardButtonFrame = CGRectMake(bound.size.width - 76, 4, 48, 48);
67  _forwardButton = [[UIButton alloc] initWithFrame: forwardButtonFrame];
68  [_forwardButton addTarget:self action:@selector(createEntryOnDrive) forControlEvents:UIControlEventTouchUpInside];
69  UIImage *forwardButtonImage = [UIImage imageNamed:@"forwardButton.png"];
70  [_forwardButton setImage:forwardButtonImage forState:UIControlStateNormal];
71  [self addSubview:_forwardButton];
72 
73  // ==========================
74 
75  CGRect loginInfoLabelFrame = CGRectMake(2.0, 2.0, bound.size.width/2, loginInfoViewHeight - 4.0);
76 
77  loginInfoLabel = [[UILabel alloc] initWithFrame:loginInfoLabelFrame];
78  [loginInfoLabel setFont:[UIFont fontWithName:@"Helvetica-Bold" size:16.0]];
79  NSString *loginName = [[loginControl getLoggedInProfile] name];
80  [loginInfoLabel postAttributedText:loginName];
81  [loginInfoLabel setTextAlignment:NSTextAlignmentCenter];
82  [loginInfoLabel setBackgroundColor:[[Z5DataController sharedInstance] wheatColor]];
83  [loginInfoLabel.layer setBorderColor: [[UIColor blackColor] CGColor]];
84  [loginInfoLabel.layer setBorderWidth: 2.0];
85  loginInfoLabel.layer.cornerRadius = 8.0f;
86  loginInfoLabel.layer.masksToBounds = YES;
87  [self addSubview:loginInfoLabel];
88  } else {
89  [self setBackgroundColor:[UIColor cyanColor]];
90 
91  CGRect signInButtonFrame = CGRectMake(bound.size.width/2 + 2,
92  2.0,
93  bound.size.width/2 - 4,
95 
96 
97 
98 
99  [loginControl configureGoogleSignIn];
100  GIDSignIn* signIn = [GIDSignIn sharedInstance];
101  signIn.uiDelegate = (id<GIDSignInUIDelegate>)self;
102  signIn.delegate = loginControl;
103 
104  _signInButton = [[GIDSignInButton alloc] init];
105  [_signInButton setFrame:signInButtonFrame];
106  _signInButton.layer.cornerRadius = 8;
107  _signInButton.layer.borderColor = [[UIColor blackColor] CGColor];
108  _signInButton.layer.borderWidth = 3.0;
109  _signInButton .clipsToBounds = YES;
110  [self addSubview:_signInButton];
111  }
112 
113 }
id< GIDSignInDelegate > delegate
Definition: GIDSignIn.h:103
void addLoginListener:(id< Z5GoogleLoginListener > ear)
instancetype sharedInstance()
float loginInfoViewHeight
UILabel * loginInfoLabel
id< GIDSignInUIDelegate > uiDelegate
Definition: GIDSignIn.h:106
GIDProfileData * getLoggedInProfile()
Singleton interface to both core and remote data sources.
NSString * name
GIDSignIn * sharedInstance()

◆ createEntryOnDrive()

- (void) createEntryOnDrive
implementation

Definition at line 122 of file V7GoogleLoginControlbar.m.

123 {
124  NSLog(@"V7GoogleLoginControlbar.createEntryOnDrive");
125  Z5GoogleDriveController *driveController = [[[Z5DataController sharedInstance] remoteDataController] driveController];
126  // TODO: FIX [driveController placeRecipe];
127 }
instancetype sharedInstance()
Singleton interface to both core and remote data sources.

◆ heightRequirement()

- (float) heightRequirement
implementation

Definition at line 37 of file V7GoogleLoginControlbar.m.

38 {
39  return 56.0;
40 }

◆ initWithFrame:andDelegate:()

- (instancetype) initWithFrame: (CGRect)  frame
andDelegate: (id<V7GoogleLoginProtocol>)  delegate 

Definition at line 23 of file V7GoogleLoginControlbar.m.

23  :(CGRect)frame andDelegate:(id<V7GoogleLoginProtocol>)delegate
24 {
25  self = [super initWithFrame:frame];
26  if (self) {
28  controlbarFrame = CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height);
29  loginInfoViewHeight = frame.size.height - 2.0;
30  }
31  return self;
32 }
CGRect controlbarFrame
float loginInfoViewHeight
id< U7ParamEditControlDelegate > delegate
id< V7GoogleLoginProtocol > loginGoogleDelegate

◆ logOutGoogle()

- (void) logOutGoogle
implementation

Definition at line 115 of file V7GoogleLoginControlbar.m.

116 {
117  Z5GoogleLoginController *loginControl = [[[Z5DataController sharedInstance] remoteDataController] loginController];
118  [loginControl logOutGoogle];
119 // [loginGoogleDelegate regenerateLoginView];
120 }
instancetype sharedInstance()
Singleton interface to both core and remote data sources.

◆ signedIn:()

- (void) signedIn: (GIDGoogleUser *)  user
implementation

Definition at line 173 of file V7GoogleLoginControlbar.m.

173  : (GIDGoogleUser *)user
174 {
175  NSLog(@"V7GoogleLoginControlbar.signedIn: %@", user.profile.name);
176  [loginGoogleDelegate regenerateLoginView];
177 }
GIDProfileData * profile
Definition: GIDGoogleUser.h:24
NSString * name

◆ signedOut:()

- (void) signedOut: (GIDGoogleUser *)  user
implementation

Definition at line 179 of file V7GoogleLoginControlbar.m.

179  :(GIDGoogleUser *)user
180 {
181  [loginGoogleDelegate regenerateLoginView];
182 }

◆ signIn:dismissViewController:()

- (void) signIn: (GIDSignIn *)  signIn
dismissViewController: (UIViewController *)  viewController 
implementation

If implemented, this method will be invoked when sign in needs to dismiss a view controller. (optional) Typically, this should be implemented by calling dismissViewController on the passed view controller.

Definition at line 159 of file V7GoogleLoginControlbar.m.

159  :(GIDSignIn *) signIn dismissViewController: (UIViewController *) viewController
160 {
161  NSLog(@"V7GoogleLoginControlbar.dismissViewController: %@",
162  NSStringFromClass([viewController class]));
163 }

◆ signIn:presentViewController:()

- (void) signIn: (GIDSignIn *)  signIn
presentViewController: (UIViewController *)  viewController 
implementation

If implemented, this method will be invoked when sign in needs to display a view controller. (optional)) The view controller should be displayed modally (via UIViewController's presentViewController method, and not pushed unto a navigation controller's stack.

Definition at line 148 of file V7GoogleLoginControlbar.m.

148  :(GIDSignIn *) signIn presentViewController:(UIViewController *) viewController
149 {
150  NSLog(@"V7GoogleLoginControlbar.presentViewController: %@",
151  NSStringFromClass([viewController class]));
152 }

◆ signInWillDispatch:error:()

- (void) signInWillDispatch: (GIDSignIn *)  signIn
error: (NSError *)  error 
implementation

The sign-in flow has finished selecting how to proceed, and the UI should no longer display a spinner or other "please wait" element. (optional)

Definition at line 135 of file V7GoogleLoginControlbar.m.

135  :(GIDSignIn *)signIn
136  error:(NSError *) error
137 {
138  NSLog(@"V7GoogleLoginControlbar.signInWillDispatch");
139 }

Property Documentation

◆ forwardButton

- (UIButton*) forwardButton
readwritenonatomicstrong

Definition at line 29 of file V7GoogleLoginControlbar.h.

◆ signInButton

- (GIDSignInButton*) signInButton
readwritenonatomicstrong

Definition at line 28 of file V7GoogleLoginControlbar.h.


The documentation for this class was generated from the following files: