commit 17d2acf841c6e539bf91719031c52ae70098a146
parent 28b61ff0d09f863c8e56fe87e58fe660584deadd
Author: Kyle Milz <kyle@Kyles-MacBook-Pro.local>
Date: Sat, 19 Sep 2015 16:19:37 -0600
ios: rename some SharedList members
Diffstat:
5 files changed, 35 insertions(+), 39 deletions(-)
diff --git a/ios-ng/shlist/DataStructures.h b/ios-ng/shlist/DataStructures.h
@@ -1,27 +1,30 @@
#import <UIKit/UIKit.h>
+
+// This object contains a lists meta information
@interface SharedList : NSObject
// @property (weak, nonatomic) IBOutlet;
// UILabel *names;
-@property NSString *list_name;
-@property NSData *list_id;
-@property NSString *list_members;
-@property NSDate *list_date;
+@property NSString *name;
+@property NSData *id;
+@property NSString *members;
+@property NSDate *date;
+@property int items_ready;
+@property int items_total;
@property UITableViewCell *cell;
-@property int items_ready;
-@property int items_total;
-
@end
+
+// This object is an individual item in a list
@interface ListItem : NSObject
-@property int modifier;
-@property NSString *name;
-@property int quantity;
-@property NSString *owner;
-@property int completed;
+@property int modifier;
+@property NSString *name;
+@property int quantity;
+@property NSString *owner;
+@property int completed;
@end
\ No newline at end of file
diff --git a/ios-ng/shlist/ListTableViewController.m b/ios-ng/shlist/ListTableViewController.m
@@ -69,7 +69,7 @@
- (void) setMetadata:(SharedList *)metadata
{
_list_metadata = metadata;
- self.title = _list_metadata.list_name;
+ self.title = _list_metadata.name;
}
diff --git a/ios-ng/shlist/MainTableViewController.m b/ios-ng/shlist/MainTableViewController.m
@@ -26,7 +26,7 @@
[self.tableView reloadData];
// send new list message with new list name as payload
- NSData *payload = [list.list_name dataUsingEncoding:NSUTF8StringEncoding];
+ NSData *payload = [list.name dataUsingEncoding:NSUTF8StringEncoding];
[_server send_message:1 contents:payload];
NSLog(@"unwindToList(): done");
@@ -88,17 +88,17 @@
// we're in section 1 now, a tap down here means we're doing a join list request
SharedList *list = [self.indirect_lists objectAtIndex:[indexPath row]];
- NSLog(@"info: joining list '%@'", list.list_name);
+ NSLog(@"info: joining list '%@'", list.name);
// the response for this does all of the heavy row moving work
- [_server send_message:4 contents:list.list_id];
+ [_server send_message:4 contents:list.id];
}
- (void) finished_join_list_request:(SharedList *) shlist
{
SharedList *needle = nil;
for (SharedList *temp in _indirect_lists) {
- if ([temp.list_id isEqualToData:shlist.list_id]) {
+ if ([temp.id isEqualToData:shlist.id]) {
needle = temp;
break;
}
@@ -118,7 +118,6 @@
// compute new position and start moving row as soon as possible
// XXX: sorting
NSIndexPath *new_index_path = [NSIndexPath indexPathForRow:[_shared_lists count] - 1 inSection:0];
- NSLog(@"index paths: %@/%@", orig_index_path, new_index_path);
[self.tableView moveRowAtIndexPath:orig_index_path toIndexPath:new_index_path];
@@ -132,22 +131,16 @@
- (void) finished_leave_list_request:(SharedList *) shlist
{
SharedList *list = nil;
- NSLog(@"target is %@", shlist.list_id);
for (SharedList *temp in _shared_lists) {
- NSLog(@"comparing %@", temp.list_id);
- if ([temp.list_id isEqualToData:shlist.list_id]) {
+ if ([temp.id isEqualToData:shlist.id]) {
list = temp;
break;
}
}
- NSLog(@"got here");
-
if (list == nil)
return;
- NSLog(@"got here");
-
// insert the new object at the beginning to match gui moving below
[_indirect_lists insertObject:list atIndex:0];
[_shared_lists removeObject:list];
@@ -177,8 +170,8 @@
if ([indexPath section] == 0) {
shared_list = [self.shared_lists objectAtIndex:row];
- cell.textLabel.text = shared_list.list_name;
- cell.detailTextLabel.text = shared_list.list_members;
+ cell.textLabel.text = shared_list.name;
+ cell.detailTextLabel.text = shared_list.members;
// fill in the completion fraction
UILabel *completion_fraction;
@@ -202,8 +195,8 @@
}
else if ([indexPath section] == 1) {
shared_list = [self.indirect_lists objectAtIndex:row];
- cell.textLabel.text = shared_list.list_name;
- cell.detailTextLabel.text = shared_list.list_members;
+ cell.textLabel.text = shared_list.name;
+ cell.detailTextLabel.text = shared_list.members;
shared_list.cell = cell;
// Modify the look of the off the shelf cell
@@ -260,10 +253,10 @@
{
// we don't need to check for !section 0 because of canEditRowAtIndexPath
SharedList *list = [self.shared_lists objectAtIndex:[indexPath row]];
- NSLog(@"info: leaving '%@' id '%@'", list.list_name, list.list_id);
+ NSLog(@"info: leaving '%@' id '%@'", list.name, list.id);
// send leave list message, response will do all heavy lifting
- [_server send_message:5 contents:list.list_id];
+ [_server send_message:5 contents:list.id];
}
- (NSString *)tableView:(UITableView *)tableView
@@ -291,7 +284,7 @@
_server->shlist_ldvc = segue.destinationViewController;
// send update list items message
- [_server send_message:6 contents:list.list_id];
+ [_server send_message:6 contents:list.id];
}
// DetailObject *detail = [self detailForIndexPath:path];ß
diff --git a/ios-ng/shlist/NewListViewController.m b/ios-ng/shlist/NewListViewController.m
@@ -33,9 +33,9 @@
if (self.textField.text.length > 0) {
self.shared_list = [[SharedList alloc] init];
- self.shared_list.list_name = self.textField.text;
+ self.shared_list.name = self.textField.text;
// self.shared_list.list_date = self.datePicker.date;
- self.shared_list.list_members = @"You";
+ self.shared_list.members = @"You";
NSLog(@"NewListViewController::prepareForSegue(): %@", self.textField.text);
}
diff --git a/ios-ng/shlist/ShlistServer.m b/ios-ng/shlist/ShlistServer.m
@@ -237,7 +237,7 @@
NSLog(@"info: join list response '%@'", output);
SharedList *shlist = [[SharedList alloc] init];
- shlist.list_id = data;
+ shlist.id = data;
// XXX: these need to be sent from the server
shlist.items_ready = 0;
@@ -260,7 +260,7 @@
}
SharedList *shlist = [[SharedList alloc] init];
- shlist.list_id = [[fields objectAtIndex:0] dataUsingEncoding:NSUTF8StringEncoding];
+ shlist.id = [[fields objectAtIndex:0] dataUsingEncoding:NSUTF8StringEncoding];
// XXX: these need to be sent from the server
// shlist.list_name = <network>;
@@ -385,9 +385,9 @@
// we've got everything we need
SharedList *shared_list = [[SharedList alloc] init];
- shared_list.list_name = [list_fields objectAtIndex:0];
- shared_list.list_id = [[list_fields objectAtIndex:1] dataUsingEncoding:NSUTF8StringEncoding];
- shared_list.list_members = members_str;
+ shared_list.name = [list_fields objectAtIndex:0];
+ shared_list.id = [[list_fields objectAtIndex:1] dataUsingEncoding:NSUTF8StringEncoding];
+ shared_list.members = members_str;
// we don't currently get this information back
// XXX: lists your not in will not return this information