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

#import <V7GoogDriveViewController.h>

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

Instance Methods

(void) - viewDidLoad [implementation]
 
(void) - viewWillAppear: [implementation]
 
(void) - placeUIComponents [implementation]
 
(NSMutableArray *) - provideFocusFoodListDriveArray [implementation]
 
(void) - viewDidLoadAnonymous [implementation]
 
(GTLRDriveService *) - viewDidLoadLoggedIn: [implementation]
 
(void) - unloadViewLoggedIn [implementation]
 
(void) - signedIn: [implementation]
 
(void) - signedOut: [implementation]
 
(void) - ticketCompleted: [implementation]
 
(void) - resultStage:returnedFiles: [implementation]
 
(void) - createFoodItem [implementation]
 
(void) - clickRecipeButton [implementation]
 
(NSInteger) - numberOfSectionsInTableView: [implementation]
 
(NSInteger) - tableView:numberOfRowsInSection: [implementation]
 
(nonnull UITableViewCell *) - tableView:cellForRowAtIndexPath: [implementation]
 
(void) - tableView:didSelectRowAtIndexPath: [implementation]
 
(void) - didReceiveMemoryWarning [implementation]
 

Properties

UIButton * listFilesButton
 

Detailed Description

Drive View Controller

These modules provide access to a folder within the user's Google Drive cloud storage, for storing created menu items, and for orgainizing (and sharing) recipe revisions.

dot_inline_dotgraph_13.png

Definition at line 20 of file V7GoogDriveViewController.h.

Method Documentation

◆ clickRecipeButton()

- (void) clickRecipeButton
implementation

Definition at line 337 of file V7GoogDriveViewController.m.

338 {
339  NSLog(@"V7GoogDriveViewController.clickRecipeBuuton");
340 }

◆ createFoodItem()

- (void) createFoodItem
implementation

Definition at line 325 of file V7GoogDriveViewController.m.

326 {
327  NSLog(@"V7GoogDriveViewController.createFoodItem");
328  /* Create folder within root directory'journalItemRoot' with name of food */
329  V7GoogDriveMenuItemViewController *driveMenuItem =
330  [[V7GoogDriveMenuItemViewController alloc] initWithNibName:nil bundle:nil];
331 
332  // [parameterView setText:@"from the Snippet controller"];
333 
334  [self.navigationController pushViewController:driveMenuItem animated:YES];
335 
336 }

◆ didReceiveMemoryWarning()

- (void) didReceiveMemoryWarning
implementation

Definition at line 422 of file V7GoogDriveViewController.m.

422  {
423  [super didReceiveMemoryWarning];
424  // Dispose of any resources that can be recreated.
425 }

◆ numberOfSectionsInTableView:()

- (NSInteger) numberOfSectionsInTableView: (UITableView *)  tableView
implementation

Definition at line 344 of file V7GoogDriveViewController.m.

344  :(UITableView *)tableView
345 {
346  NSInteger ret = 1;
347  // Z5LocalDataController *localData = [[Z5DataController sharedInstance] localDataController];
348 
349  NSLog(@"V7GoogDriveViewController.numberOfSectionsInTableView: %ld", (long)ret);
350 
351  return ret;
352 }

◆ placeUIComponents()

- (void) placeUIComponents
implementation

Definition at line 143 of file V7GoogDriveViewController.m.

144 {
145  // [self.view setBackgroundColor:[[Z5DataController sharedInstance] grapeSkinDeepPurple]];
146  // [self.view setBackgroundColor:[UIColor redColor]];
147  float snugMargin = 2.0;
148  CGRect totalFrame = self.view.frame;
149  float totalWidth = totalFrame.size.width - (2*snugMargin);
150  float tableWidth = totalFrame.size.width - (2*snugMargin);
151  CGRect topNavigationFrame = [[[self navigationController] navigationBar] frame];
152  float topOfContent = topNavigationFrame.origin.y + topNavigationFrame.size.height;
153 
154  float controlbarHeight = 52.0;
155  googDriveControlBarFrame = CGRectMake(snugMargin,
156  topOfContent+snugMargin,
157  totalWidth - (2*snugMargin),
158  controlbarHeight);
159  controlBar = [[V7GoogDriveControlbarView alloc] initWithDelegate:self andFrame:googDriveControlBarFrame];
160 
161  float tableTop = topOfContent + controlbarHeight+(2*snugMargin);
163  = CGRectMake(snugMargin,
164  tableTop,
165  tableWidth,
166  totalFrame.size.height - tableTop - 150);
167 
168  float focusFoodLabelFrameHeight = 60;
169  CGRect focusFoodLabelFrame = CGRectMake(4.0,
170  0.0,
171  tableWidth - 8.0,
172  focusFoodLabelFrameHeight);
173  focusFoodLabel = [[Z1ContainedLabel alloc] initWithFrame:focusFoodLabelFrame];
174 
175  NSNumber *labelHeight = [NSNumber numberWithFloat:36.0];
176  [focusFoodLabel setContainedHeight:labelHeight];
177  [focusFoodLabel setBackgroundColor:[UIColor greenColor]];
178 
180  initWithFrame:googDriveListTableViewFrame
181  andHeader:focusFoodLabel
182  inContainer:self];
183  [googDriveListTableView setDataSource:self];
184  [googDriveListTableView setDelegate:self];
185  [googDriveListTableView setTableCaption:focusFoodLabel];
186  [googDriveListTableView setBackgroundColor:[UIColor wheatColor]];
187 
188  [self.view addSubview:controlBar];
189  [self.view addSubview:googDriveListTableView];
190 }
V7GoogDriveTableView * googDriveListTableView
CGRect googDriveControlBarFrame
Z1ContainedLabel * focusFoodLabel
CGRect googDriveListTableViewFrame

◆ provideFocusFoodListDriveArray()

- (NSMutableArray *) provideFocusFoodListDriveArray
implementation

Definition at line 192 of file V7GoogDriveViewController.m.

193 {
194  return focusFoodDriveArray;
195 }
NSMutableArray * focusFoodDriveArray

◆ resultStage:returnedFiles:()

- (void) resultStage: (QueryStage stage
returnedFiles: (NSArray<GTLRDrive_File *> *)  files 
implementation

Definition at line 270 of file V7GoogDriveViewController.m.

270  : (QueryStage)stage returnedFiles: (NSArray<GTLRDrive_File *> *)files
271 {
272  switch(stage){
273  case qNone:
274  {
275  NSLog(@"V7GoogDriveViewController.resultStage: qNone");
276  }
277  break;
278  case qRoot:
279  {
280  NSLog(@"V7GoogDriveViewController.resultStage: qRoot");
281  }
282  break;
283  case qJournalRoot:
284  {
285  NSLog(@"V7GoogDriveViewController.resultStage: qJournalRoot");
286 
287  // this is original work for chase-journal-root
288 // for (GTLRDrive_File *file in files) {
289 // [focusFoodDriveArray addObject:file];
290 //
291 // NSLog(@"V7GoogDriveViewController.resultStage: mimeType %@", file.mimeType);
292 //
293 // if ([file.mimeType isEqualToString:@"application/vnd.google-apps.folder"]) {
294 // NSLog(@"V7GoogDriveViewController.resultStage: Folder in Journal-Root, request parts");
295 // [driveControl listJournaItemPartRoot:file.identifier];
296 // } else {
297 // ;
298 // }
299 // }
300  [googDriveListTableView reloadData];
301 
302 
303  }
304  break;
305  case qJournalPartRoot:
306  {
307  NSLog(@"V7GoogDriveViewController.resultStage: qJournalPartRoot");
308 
309  }
310  break;
311  case kOblateSpheroid:
312  {
313  NSLog(@"V7GoogDriveViewController.resultStage: kOblateSpheroid");
314 
315  }
316  break;
317  }
318 
319 
320  }

◆ signedIn:()

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

Definition at line 246 of file V7GoogDriveViewController.m.

246  : (GIDGoogleUser *)user
247 {
248  NSLog(@"GoogDriveViewController.signedIn: user-auth: %@", user.authentication.fetcherAuthorizer);
249 
250 // Z5GoogleDriveController *driveControl = [[[Z5DataController sharedInstance] remoteDataController] driveController];
251 // self.service = [driveControl service];
252 
253  // [_signInButton removeFromSuperview];
254  [controlBar userLoggedIn:YES];
255  // [self loadViewLoggedIn];
256 }
id< GTMFetcherAuthorizationProtocol > fetcherAuthorizer()
GIDAuthentication * authentication
Definition: GIDGoogleUser.h:27

◆ signedOut:()

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

Definition at line 258 of file V7GoogDriveViewController.m.

258  :(GIDGoogleUser *)user {
259  // self.service = nil;
260  [controlBar userLoggedIn:NO];
261  [self unloadViewLoggedIn];
262  [self viewDidLoadAnonymous];
263 }

◆ tableView:cellForRowAtIndexPath:()

- (nonnull UITableViewCell *) tableView: (nonnull UITableView *)  tableView
cellForRowAtIndexPath: (nonnull NSIndexPath *)  indexPath 
implementation

Definition at line 363 of file V7GoogDriveViewController.m.

363  :(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
364 
365  UITableViewCell *cell = nil;
366  // UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"usda-data-display"];
367  // NSLog(@"U3parameterTableView.tableCellForRow: %ld cell: %@", (long)[indexPath row], cell);
368  if (cell == nil) {
369  cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"usda-pdata-display"];
370 
371  cell.contentView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
372 
373  CGRect contentRect = [cell.contentView frame];
374  CGRect fetchPublishButton1Frame = CGRectMake(contentRect.size.width - 86.0f, 5.0, 64.0f, contentRect.size.height - 10);
375  UIButton *pushMe = [[UIButton alloc] initWithFrame:fetchPublishButton1Frame];
376  [pushMe setBackgroundColor:[UIColor grayColor]];
377  [pushMe setTitle:@"GO" forState:UIControlStateNormal];
378  [pushMe setTitleColor:[UIColor yellowColor] forState:UIControlStateNormal];
379 
380  [cell.contentView addSubview:pushMe];
381 
382  [cell.layer setCornerRadius:7.0f];
383  [cell.layer setMasksToBounds:YES];
384  [cell.layer setBorderWidth:1.0f];
385 
386  [cell.textLabel setTextColor:[UIColor purpleColor]];
387  [cell.textLabel setOpaque:YES];
388  }
389  [cell setBackgroundColor:[UIColor brownColor]];
390  NSInteger nComponents = [focusFoodDriveArray count];
391 
392  if (nComponents > [indexPath row]) {
393 
394  GTLRDrive_File *driveFile = [focusFoodDriveArray objectAtIndex:[indexPath row]];
395  [Z5DataController labelizeCell:cell withText:[driveFile name] inColor:[UIColor pearlColor] andDetail:nil];
396 
397  } else if (0 == nComponents) {
398  cell.textLabel.text = @"no food data";
399  }
400  // NSLog(@"U3parameterTableView.tableCellForRow: %ld return cell: %@", (long)[indexPath row], cell);
401  return cell;
402 }
Singleton interface to both core and remote data sources.
void labelizeCell:withText:inColor:andDetail:(UITableViewCell *targCell, [withText] NSString *txt, [inColor] UIColor *color, [andDetail] NSString *detailTxt)

◆ tableView:didSelectRowAtIndexPath:()

- (void) tableView: (UITableView *)  tableView
didSelectRowAtIndexPath: (NSIndexPath *)  indexPath 
implementation

Definition at line 406 of file V7GoogDriveViewController.m.

406  :(UITableView *)tableView
407 didSelectRowAtIndexPath:(NSIndexPath *)indexPath
408 {
409  NSUInteger row_n = [indexPath row];
410  GTLRDrive_File *file = [focusFoodDriveArray objectAtIndex:row_n];
411  NSLog(@"V7GoogDriveViewController.didSelectRowAtIndexPath: %@, mimeType %@", [file name], file.mimeType);
412  if ([file.mimeType isEqualToString:@"application/vnd.google-apps.folder"]){
413  [driveControl listJournaItemPartRoot:file.identifier];
414  } else {
415  NSLog(@"V7GoogDriveViewController.didSelectRowAtIndexPath: no directory");
416  }
417 
418 }

◆ tableView:numberOfRowsInSection:()

- (NSInteger) tableView: (UITableView *)  tableView
numberOfRowsInSection: (NSInteger)  section 
implementation

Definition at line 353 of file V7GoogDriveViewController.m.

353  :(UITableView *)tableView
354  numberOfRowsInSection:(NSInteger)section
355 {
356  NSInteger ret = [focusFoodDriveArray count];
357 
358  NSLog(@"V7GoogDriveViewController.numberOfRowsInSection: section# %ld, rows: %ld", (long)section, (long)ret);
359 
360  return ret;
361 }

◆ ticketCompleted:()

- (void) ticketCompleted: (GTLRServiceTicket *)  ticket
implementation

Definition at line 266 of file V7GoogDriveViewController.m.

266  :(GTLRServiceTicket *)ticket;
267 {
268  NSLog(@"GoogDriveViewController.ticketCompleted");
269 }

◆ unloadViewLoggedIn()

- (void) unloadViewLoggedIn
implementation

Definition at line 241 of file V7GoogDriveViewController.m.

242 {
243  [self.listFilesButton removeFromSuperview];
244  [self viewDidLoadAnonymous];
245 }

◆ viewDidLoad()

- (void) viewDidLoad
implementation

Definition at line 75 of file V7GoogDriveViewController.m.

75  {
76  [super viewDidLoad];
77  // Do any additional setup after loading the view.
78  self.title = @"Google Drive";
79 
80  [[self view] setBackgroundColor:[UIColor colorWithHue:0.32
81  saturation:0.8
82  brightness:0.5
83  alpha:1.0]];
84  UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Create item"
85  style:UIBarButtonItemStylePlain
86  target:self
87  action:@selector(createFoodItem)];
88  self.navigationItem.rightBarButtonItem = anotherButton;
89  self.navigationItem.rightBarButtonItem.enabled = YES;
90 
91  // This array manages all the drive-menu-itmes shown.
92  focusFoodDriveArray = [[NSMutableArray alloc] init];
93 
94  [self placeUIComponents];
95 
96  Z5GoogleLoginController *loginControl = [[[Z5DataController sharedInstance] remoteDataController] loginController];
97 
98  driveControl = [[[Z5DataController sharedInstance] remoteDataController] driveController];
99  // driveAPIcontroller = [[V7GoogDriveAPIController alloc] initWithDelegate:self];
100  if ([[loginControl signedIn] boolValue]) {
101  [self viewDidLoadLoggedIn:[loginControl signedInUser]];
102 
103  [driveControl listRootFor:self];
104  /*
105  -(void) listRootFor:(id<V7GoogDriveAPIProtocol>rqstor
106  {
107  GTLRServiceTicket *rootListTicket = [self listRoot];
108 
109  NSDictionary<NSString *,id> *extraTicketProps = [rootListTicket ticketProperties];
110  NSString *rootFetchKey = [extraTicketProps objectForKey:@"query-stage"];
111  NSLog(@"V7GoogleDriveViewController.viewDidLoad: rootFetechKey: %@", rootFetchKey);
112  }
113  */
114 // self.service = [driveControl service];
115 
116 // GTLRServiceTicket *rootListTicket = [self listRoot];
117 //
118 // NSDictionary<NSString *,id> *extraTicketProps = [rootListTicket ticketProperties];
119 // NSString *rootFetchKey = [extraTicketProps objectForKey:@"query-stage"];
120 // NSLog(@"V7GoogleDriveViewController.viewDidLoad: rootFetechKey: %@", rootFetchKey);
121 
122  } else {
123  [self viewDidLoadAnonymous];
124  }
125 }
NSMutableArray * focusFoodDriveArray
instancetype sharedInstance()
Z5GoogleDriveController * driveControl
Singleton interface to both core and remote data sources.

◆ viewDidLoadAnonymous()

- (void) viewDidLoadAnonymous
implementation

Definition at line 196 of file V7GoogDriveViewController.m.

197 {
198  // CGRect totalFrame = self.view.frame;
199  Z5GoogleLoginController *loginControl = [[[Z5DataController sharedInstance] remoteDataController] loginController];
200 
201  [loginControl configureGoogleSignIn];
202  GIDSignIn* signIn = [GIDSignIn sharedInstance];
203  signIn.uiDelegate = self;
204 
205  [controlBar placeLoginButton];
206 }
instancetype sharedInstance()
id< GIDSignInUIDelegate > uiDelegate
Definition: GIDSignIn.h:106
Singleton interface to both core and remote data sources.
GIDSignIn * sharedInstance()

◆ viewDidLoadLoggedIn:()

- (GTLRDriveService *) viewDidLoadLoggedIn: (GIDGoogleUser *)  signedInUser
implementation

Definition at line 207 of file V7GoogDriveViewController.m.

207  :(GIDGoogleUser *) signedInUser
208 {
209  Z5GoogleDriveController *driveControl = [[[Z5DataController sharedInstance] remoteDataController] driveController];
210 
211  [driveControl signedIn:signedInUser];
212 
213  // [self loadViewLoggedIn];
214 
215  GTLRDriveService *ret = [driveControl service];
216 
217  return ret;
218 }
instancetype sharedInstance()
Z5GoogleDriveController * driveControl
void signedIn:(GIDGoogleUser *user)
Singleton interface to both core and remote data sources.

◆ viewWillAppear:()

- (void) viewWillAppear: (BOOL)  animated
implementation

Definition at line 126 of file V7GoogDriveViewController.m.

126  :(BOOL)animated
127 {
128  CGRect totalFrame = self.view.frame;
129  float tableWidth = totalFrame.size.width - 8;
130  CGRect tableBound = CGRectMake(0.0, 0.0, tableWidth, 70.0);
131 
132  CGRect focusFoodBaseLabelFrame = CGRectMake(4.0, 0.0, tableWidth - 8.0, 36);
133  UILabel *focusFoodBaseLabel = [[UILabel alloc] initWithFrame:focusFoodBaseLabelFrame];
134 
135  [Z5DataController extraLabelize:focusFoodBaseLabel withText:@"Menu Items"];
136  [focusFoodLabel setMessageLabel:focusFoodBaseLabel];
137  [focusFoodLabel appear:tableBound];
138 
139  [controlBar appear:googDriveControlBarFrame];
140 
141  NSLog(@"V7GoogDriveViewController.viewWillAppear end");
142 }
void extraLabelize:withText:(UILabel *targLabel, [withText] NSString *txt)
Singleton interface to both core and remote data sources.

Property Documentation

◆ listFilesButton

- (UIButton*) listFilesButton
readwritenonatomicstrong

Definition at line 31 of file V7GoogDriveViewController.h.


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