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

#import <V7GoogDriveMenuItemViewController.h>

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

Instance Methods

(instancetype) - initWithNibName:bundle: [implementation]
 
(void) - viewDidLoad [implementation]
 
(void) - placeLogoutButton [implementation]
 
(GIDProfileData *) - getLoggedInProfile [implementation]
 
(void) - signedOut: [implementation]
 
(void) - saveToDrive [implementation]
 
(void) - regenerateLoginView [implementation]
 
(void) - signedIn: [implementation]
 

Properties

id< V7GoogDriveMenuViewProtocol > delegate
 
NSString * titleTextStr
 
NSDictionary< NSString *, NSString * > * ingredientsDict
 
NSMutableArray< NSString * > * instructionArr
 

Detailed Description

Definition at line 24 of file V7GoogDriveMenuItemViewController.h.

Method Documentation

◆ getLoggedInProfile()

- (GIDProfileData *) getLoggedInProfile
implementation

Definition at line 107 of file V7GoogDriveMenuItemViewController.m.

108 {
109  Z5GoogleLoginController *loginData = [[[Z5DataController sharedInstance] remoteDataController] loginController];
110  return loginData.signedInUser.profile;
111 }
GIDProfileData * profile
Definition: GIDGoogleUser.h:24
instancetype sharedInstance()
Singleton interface to both core and remote data sources.

◆ initWithNibName:bundle:()

- (instancetype) initWithNibName: (NSString *)  nibNameOrNil
bundle: (NSBundle *)  nibBundleOrNil 
implementation

Definition at line 18 of file V7GoogDriveMenuItemViewController.m.

18  :(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
19 {
20  self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
21  if (self) {
22  self.titleTextStr = [[NSString alloc] init];
23  }
24  return self;
25 }

◆ placeLogoutButton()

- (void) placeLogoutButton
implementation

Definition at line 94 of file V7GoogDriveMenuItemViewController.m.

95 {
96  Z5GoogleLoginController *loginControl = [[[Z5DataController sharedInstance] remoteDataController] loginController];
97  UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Logout"
98  style:UIBarButtonItemStylePlain
99  target:loginControl
100  action:@selector(logOutGoogle)];
101  self.navigationItem.rightBarButtonItem = anotherButton;
102  self.navigationItem.rightBarButtonItem.enabled = YES;
103 }
instancetype sharedInstance()
Singleton interface to both core and remote data sources.

◆ regenerateLoginView()

- (void) regenerateLoginView
implementation

Definition at line 126 of file V7GoogDriveMenuItemViewController.m.

126  {
127  NSLog(@"V7GoogDriveMenuItemViewController.regenerateLoginView: NO-OP");
128 }

◆ saveToDrive()

- (void) saveToDrive
implementation

Definition at line 121 of file V7GoogDriveMenuItemViewController.m.

122 {
123  NSLog(@"V7GoogDriveMenuItemViewController.saveToDrive");
124 }

◆ signedIn:()

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

Definition at line 131 of file V7GoogDriveMenuItemViewController.m.

131  :(GIDGoogleUser *)user {
132  NSLog(@"V7GoogDriveMenuItemViewController.signedIn");
133 }

◆ signedOut:()

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

Definition at line 113 of file V7GoogDriveMenuItemViewController.m.

113  :(GIDGoogleUser *)user {
114  NSLog(@"V7GoogDriveMenuItemViewController.signedOut");
115  [self placeLogoutButton];
116 }

◆ viewDidLoad()

- (void) viewDidLoad
implementation

Definition at line 26 of file V7GoogDriveMenuItemViewController.m.

27 {
28  [super viewDidLoad];
29  // Do any additional setup after loading the view.
30 
31  self.title = @"Google Drive Menu Item";
32  Z5GoogleLoginController *loginData = [[[Z5DataController sharedInstance] remoteDataController] loginController];
33 
34  float navbarBottomEdge = self.navigationController.navigationBar.frame.origin.y
35  + self.navigationController.navigationBar.frame.size.height;
36 
37  // fetch, scale, and add a subview background image
38  UIImage *backgrdImage = [UIImage imageNamed:@"tiffany_gradient.png"];
39  CGSize photoSize = [backgrdImage size];
40  CGRect totalFrame = self.view.frame;
41  CGSize overallSize = totalFrame.size;
42  float resizeRatio = photoSize.height / totalFrame.size.height;
43  UIImage *resizedImage = [UIImage imageWithCGImage:[backgrdImage CGImage]
44  scale:backgrdImage.scale * resizeRatio
45  orientation:(backgrdImage.imageOrientation) ];
46  UIImageView *backgrd = [[UIImageView alloc] initWithImage:resizedImage];
47  [self.view addSubview:backgrd];
48  // end - fetch, scale, and add a subview background image
49 
50  float controlbarFrameHeight = 60.0;
51  CGRect controlbarFrame = CGRectMake(8.0,
52  navbarBottomEdge + 2.0,
53  overallSize.width - 16.0,
54  controlbarFrameHeight);
55  V7GoogleLoginControlbar *controlBar =
56  [[V7GoogleLoginControlbar alloc] initWithFrame:controlbarFrame andDelegate:self];
57  [controlBar appear:totalFrame];
58 
59  float titleTextFrameHeight = 64.0;
60  CGRect titleTextFrame = CGRectMake(8.0,
61  navbarBottomEdge + controlbarFrameHeight + 4.0,
62  overallSize.width - 16.0,
63  titleTextFrameHeight);
64  UITextView *titleTextView = [[UITextView alloc] initWithFrame:titleTextFrame
65  textContainer:nil];
66  [titleTextView setText:_titleTextStr];
67 
68  float ingredientsDictFrameHeight = 280;
69  CGRect ingredientsDictFrame = CGRectMake(8.0,
70  navbarBottomEdge + controlbarFrameHeight + titleTextFrameHeight + 8.0,
71  overallSize.width - 16.0,
72  ingredientsDictFrameHeight);
73  UITableView *ingredientsTableView = [[UITableView alloc] initWithFrame:ingredientsDictFrame style:UITableViewStylePlain];
74 
75  float instructionsTextFrameHeight = 180.0;
76  CGRect instructionsTextFrame = CGRectMake(8.0,
77  navbarBottomEdge + controlbarFrameHeight + titleTextFrameHeight + ingredientsDictFrameHeight + 12.0,
78  overallSize.width - 16.0,
79  instructionsTextFrameHeight);
80  UITextView *instructionsTextView = [[UITextView alloc] initWithFrame:instructionsTextFrame
81  textContainer:nil];
82  // [instructionsTextView setText:_instructionArr];
83  [instructionsTextView setText:@"Instructions"];
84 
85  [self.view addSubview:controlBar];
86  [self.view addSubview:titleTextView];
87  [self.view addSubview:ingredientsTableView];
88  [self.view addSubview:instructionsTextView];
89  if ([[loginData signedIn] boolValue]) {
90  [self placeLogoutButton];
91  }
92  [loginData addLoginListener:self];
93 }
void addLoginListener:(id< Z5GoogleLoginListener > ear)
instancetype sharedInstance()
CGRect controlbarFrame
CGSize overallSize
Singleton interface to both core and remote data sources.
float navbarBottomEdge

Property Documentation

◆ delegate

- (id<V7GoogDriveMenuViewProtocol>) delegate
readwritenonatomicstrong

Definition at line 26 of file V7GoogDriveMenuItemViewController.h.

◆ ingredientsDict

- (NSDictionary<NSString*,NSString*>*) ingredientsDict
readwritenonatomicstrong

Definition at line 28 of file V7GoogDriveMenuItemViewController.h.

◆ instructionArr

- (NSMutableArray<NSString *>*) instructionArr
readwritenonatomicstrong

Definition at line 29 of file V7GoogDriveMenuItemViewController.h.

◆ titleTextStr

- (NSString*) titleTextStr
readwritenonatomicstrong

Definition at line 27 of file V7GoogDriveMenuItemViewController.h.


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