Permalink
Browse files

Rudimentary messag showing

  • Loading branch information...
1 parent a37b13e commit fab1a9de1bc0796b8605edfa4ab22760cedbaf5b @crunchysue committed Nov 30, 2009
Showing with 235 additions and 11 deletions.
  1. +16 −3 Classes/PlaceDetailsVC.m
  2. +154 −0 Classes/_SHIZZEEPS_MORE_DATA.txt
  3. +2 −2 Classes/discovery.m
  4. +2 −2 Classes/place.h
  5. +57 −4 Classes/place.m
  6. +4 −0 shizzeeps.xcodeproj/project.pbxproj
View
@@ -94,26 +94,39 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
+ cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
+ reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell...
NSString *curPlaceName = nil;
NSString *pop = nil;
NSString *addr = nil;
-
+ NSString *curPersonName = nil;
+ NSDictionary *curPerson = nil;
+ NSArray *curMsgs = nil;
+ NSString *msgsKey = nil;
switch (indexPath.section) {
+
+ // Population
case 0:
pop = self.thePlace.population;
cell.textLabel.text = [NSString stringWithFormat:@"Population: %@", pop];
break;
+ // One cell for each person
case 1:
- cell.textLabel.text = [self.thePlace.people objectAtIndex:indexPath.row];
+ curPersonName = [self.thePlace.people objectAtIndex:indexPath.row];
+ cell.textLabel.text = curPersonName;
+ curPerson = [self.thePlace.shouts objectForKey:curPersonName];
+ msgsKey = [NSString stringWithFormat:@"messages_from_%@", curPersonName];
+ curMsgs = [[curPerson objectForKey:msgsKey] allValues];
+ cell.detailTextLabel.text = [curMsgs description];
break;
+ // The place's address
case 2:
curPlaceName = self.thePlace.name;
addr = [NSString stringWithFormat:@"%@\n%@\n%@\n%@, %@ %@\n%@",
@@ -0,0 +1,154 @@
+2009-11-29 18:41:59.793 shizzeeps[12188:207] shouts->results->shouts: (
+ {
+ address1 = "29th & Clinton";
+ address2 = "";
+ altitude = "0.0000000";
+ "application_id" = "";
+ "application_name" = "";
+ "application_website" = "";
+ arrived = "2009-11-29T16:26:30-0800";
+ city = Portland;
+ "country_iso" = US;
+ "country_name" = "United States";
+ "is_listener" = 0;
+ "is_listening" = 0;
+ "is_person" = 0;
+ latitude = "45.50354400000000";
+ longitude = "-122.63560100000000";
+ modified = "2009-11-29T16:26:30-0800";
+ "people_images" = {
+ "people_image_16" = "http://people.shizzow.com/crunchydev3_16.jpg";
+ "people_image_24" = "http://people.shizzow.com/crunchydev3_24.jpg";
+ "people_image_32" = "http://people.shizzow.com/crunchydev3_32.jpg";
+ "people_image_48" = "http://people.shizzow.com/crunchydev3_48.jpg";
+ "people_image_64" = "http://people.shizzow.com/crunchydev3_64.jpg";
+ "people_image_80" = "http://people.shizzow.com/crunchydev3_80.jpg";
+ "people_image_96" = "http://people.shizzow.com/crunchydev3_96.jpg";
+ };
+ "people_name" = crunchydev3;
+ phone = "";
+ "places_key" = Lgbyc9;
+ "places_name" = "Shizzeeps World HQ";
+ "profiles_name" = "Sue Brown Dev 3";
+ public = 1;
+ "shout_time" = "2 hours ago";
+ "shouts_history_id" = 28796;
+ "shouts_messages" = (
+ {
+ "application_id" = <null>;
+ "application_name" = <null>;
+ "application_website" = <null>;
+ message = "crunchysue seems to really like this couch.";
+ "shout_time" = "2 hours ago";
+ "shouts_history_id" = 28796;
+ time = "2009-11-29T16:26:30-0800";
+ }
+ );
+ "state_iso" = OR;
+ "state_name" = Oregon;
+ status = here;
+ website = "http://shizzeeps.com";
+ zip = 97202;
+ },
+ {
+ address1 = "29th &amp; Clinton";
+ address2 = "";
+ altitude = "0.0000000";
+ "application_id" = "";
+ "application_name" = "";
+ "application_website" = "";
+ arrived = "2009-11-29T16:10:51-0800";
+ city = Portland;
+ "country_iso" = US;
+ "country_name" = "United States";
+ "is_listener" = 0;
+ "is_listening" = 0;
+ "is_person" = 0;
+ latitude = "45.50354400000000";
+ longitude = "-122.63560100000000";
+ modified = "2009-11-29T16:25:23-0800";
+ "people_images" = {
+ "people_image_16" = "http://people.shizzow.com/crunchysue_16.jpg";
+ "people_image_24" = "http://people.shizzow.com/crunchysue_24.jpg";
+ "people_image_32" = "http://people.shizzow.com/crunchysue_32.jpg";
+ "people_image_48" = "http://people.shizzow.com/crunchysue_48.jpg";
+ "people_image_64" = "http://people.shizzow.com/crunchysue_64.jpg";
+ "people_image_80" = "http://people.shizzow.com/crunchysue_80.jpg";
+ "people_image_96" = "http://people.shizzow.com/crunchysue_96.jpg";
+ };
+ "people_name" = crunchysue;
+ phone = "";
+ "places_key" = Lgbyc9;
+ "places_name" = "Shizzeeps World HQ";
+ "profiles_name" = "Sue Brown";
+ public = 1;
+ "shout_time" = "2 hours ago";
+ "shouts_history_id" = 28795;
+ "shouts_messages" = (
+ {
+ "application_id" = <null>;
+ "application_name" = <null>;
+ "application_website" = <null>;
+ message = "Have I mentioned how much I love my couch lately?";
+ "shout_time" = "2 hours ago";
+ "shouts_history_id" = 28795;
+ time = "2009-11-29T16:25:23-0800";
+ },
+ {
+ "application_id" = <null>;
+ "application_name" = <null>;
+ "application_website" = <null>;
+ message = "My Brompton needs a name. Maybe.";
+ "shout_time" = "2 hours ago";
+ "shouts_history_id" = 28795;
+ time = "2009-11-29T16:10:51-0800";
+ }
+ );
+ "state_iso" = OR;
+ "state_name" = Oregon;
+ status = here;
+ website = "http://shizzeeps.com";
+ zip = 97202;
+ },
+ {
+ address1 = "29th &amp; Clinton";
+ address2 = "";
+ altitude = "0.0000000";
+ "application_id" = "";
+ "application_name" = "";
+ "application_website" = "";
+ arrived = "2009-11-29T12:49:54-0800";
+ city = Portland;
+ "country_iso" = US;
+ "country_name" = "United States";
+ "is_listener" = 0;
+ "is_listening" = 0;
+ "is_person" = 0;
+ latitude = "45.50354400000000";
+ longitude = "-122.63560100000000";
+ modified = "2009-11-29T12:49:54-0800";
+ "people_images" = {
+ "people_image_16" = "http://people.shizzow.com/crunchydev2_16.jpg";
+ "people_image_24" = "http://people.shizzow.com/crunchydev2_24.jpg";
+ "people_image_32" = "http://people.shizzow.com/crunchydev2_32.jpg";
+ "people_image_48" = "http://people.shizzow.com/crunchydev2_48.jpg";
+ "people_image_64" = "http://people.shizzow.com/crunchydev2_64.jpg";
+ "people_image_80" = "http://people.shizzow.com/crunchydev2_80.jpg";
+ "people_image_96" = "http://people.shizzow.com/crunchydev2_96.jpg";
+ };
+ "people_name" = crunchydev2;
+ phone = "";
+ "places_key" = Lgbyc9;
+ "places_name" = "Shizzeeps World HQ";
+ "profiles_name" = "Shizzeeps PDX";
+ public = 1;
+ "shout_time" = "5 hours ago";
+ "shouts_history_id" = 28792;
+ "shouts_messages" = <null>;
+ "state_iso" = OR;
+ "state_name" = Oregon;
+ status = here;
+ website = "http://shizzeeps.com";
+ zip = 97202;
+ }
+)
View
@@ -123,10 +123,10 @@ - (void) enumerateArray: (NSArray *) a {
int i = 0;
while (anObject = [enumerator nextObject]) {
if ([anObject isKindOfClass:[NSArray class]]) {
- NSLog(@"ITEM #%i IS AN ARRAY: ", i);
+ NSLog(@"ITEM #%i IS AN ARRAY of %i items: ", i, [anObject count]);
[self enumerateArray:anObject];
}else if ([anObject isKindOfClass:[NSDictionary class]]) {
- NSLog(@"ITEM %i IS A DICTIONARY: ", i);
+ NSLog(@"ITEM %i IS A DICTIONARY of %i items: ", i, [anObject count]);
[self enumerateDictionary:anObject];
} else {
NSLog(@"ITEM #%i IS A %@: %@", i, [[anObject class] description], [anObject description]);
View
@@ -24,7 +24,7 @@
NSArray *messages;
NSArray *people;
NSString *peopleList;
-
+ NSDictionary *shouts;
}
@property (nonatomic, retain) NSDictionary * placeDict;
@@ -40,7 +40,7 @@
@property (nonatomic, retain) NSArray * messages;
@property (nonatomic, retain) NSArray * people;
@property (nonatomic, retain) NSString * peopleList;
-
+@property (nonatomic, retain) NSDictionary *shouts;
- (void) initPlace;
View
@@ -24,6 +24,7 @@ @implementation place
@synthesize messages;
@synthesize people;
@synthesize peopleList;
+@synthesize shouts;
- (void) initPlace {
@@ -62,12 +63,64 @@ - (void) initPlace {
}
self.peopleList = names;
- NSArray *shout_messages = [s_r_shouts valueForKey:@"shout_messages"];
- NSArray *theMessages = [shout_messages valueForKey:@"messages"];
- NSLog(@"shouts messages: %@", [shout_messages description]);
- NSLog(@"messages: %@", [theMessages description]);
+ // loop through shouts for this place and make a dictionary of them
+ // dictionary has people names for keys and dictionaries of messages & times for values
+ // e.g. [crunchysue => ['hello' => '1 minute ago'], ['how r u' => '10 minutes ago']]
+ // e.g. [curShouts setObject:shout_msg_dict forKey:@"crunchysue"];
+
+ NSEnumerator *shouts_enumerator = [s_r_shouts objectEnumerator];
+ NSMutableDictionary *curShouts = [NSMutableDictionary dictionaryWithCapacity:10];
+ NSMutableDictionary *curMsgs = [NSMutableDictionary dictionaryWithCapacity:10];
+ NSMutableDictionary *curPerson = [NSMutableDictionary dictionaryWithCapacity:10];
+ NSArray *curPeopleImages = nil;
+ NSArray *curShoutsMessages = nil;
+ NSEnumerator *msg_enumerator = nil;
+ id obj;
+ NSString *curPersonName = nil;
+ NSString *curMsg = nil;
+ NSString *curMsgID = nil;
+ NSString *msgsKey = nil;
+
+ // loop through the shouts from this place
+ while (anObject = [shouts_enumerator nextObject]) {
+ curPersonName = [anObject valueForKey:@"people_name"];
+ curPeopleImages = [anObject valueForKey:@"people_images"];
+ [curPerson setObject:[curPeopleImages valueForKey:@"people_image_16"] forKey:@"people_image_16"];
+
+ curShoutsMessages = [anObject valueForKey:@"shouts_messages"];
+
+ // if there are messages from this person
+ if (![[curShoutsMessages description] isEqualToString: @"<null>"]) {
+ //NSLog(@"%@ shouted %i messages.", curPersonName, [curShoutsMessages count]);
+ msg_enumerator = [curShoutsMessages objectEnumerator];
+ // loop through the messages from this person
+ while (obj = [msg_enumerator nextObject]) {
+ curMsg = [obj valueForKey:@"message"];
+ curMsgID = [obj valueForKey:@"time"];
+ // add this message to the current messages
+ //NSLog(@"%@: %@ said %@", curMsgID, curPersonName, curMsg);
+ [curMsgs setObject:curMsg forKey:curMsgID];
+ }
+ //NSLog(@"Messages from %@:%@", curPersonName,[curMsgs description]);
+ // add the current messages to the person
+ NSDictionary *tmpMsgs = [[NSDictionary alloc] initWithDictionary:curMsgs copyItems:YES];
+ //NSLog(@"Messages being added to %@: %@", curPersonName, [tmpMsgs description]);
+ msgsKey = [NSString stringWithFormat:@"messages_from_%@", curPersonName];
+
+ [curPerson setObject:tmpMsgs forKey:msgsKey];
+ [curMsgs removeAllObjects];
+
+ NSLog(@"\n\n%@: %@",curPersonName, [curPerson description]);
+ }
+ // add the person to the shouts
+ [curShouts setObject:curPerson forKey:curPersonName];
+ }
+
+ self.shouts = curShouts;
+// NSLog(@"\n\n-----------------------\nself.shouts from %@: %@", self.name, [self.shouts description]);
+// NSLog(@"shouts->results->shouts: %@", [s_r_shouts description]);
}
@@ -31,6 +31,7 @@
80C472AA10BDEA390060CE5B /* shizzeeps.m in Sources */ = {isa = PBXBuildFile; fileRef = 80C4729E10BDEA390060CE5B /* shizzeeps.m */; };
80C472AB10BDEA390060CE5B /* shizzow.m in Sources */ = {isa = PBXBuildFile; fileRef = 80C472A010BDEA390060CE5B /* shizzow.m */; };
80C521D810C1FEB20027C4C4 /* _SHIZZEEPS_DATA_EXAMPLE.txt in Resources */ = {isa = PBXBuildFile; fileRef = 80C521D710C1FEB20027C4C4 /* _SHIZZEEPS_DATA_EXAMPLE.txt */; };
+ 80D071CF10C368B70058B8C2 /* _SHIZZEEPS_MORE_DATA.txt in Resources */ = {isa = PBXBuildFile; fileRef = 80D071CE10C368B70058B8C2 /* _SHIZZEEPS_MORE_DATA.txt */; };
80EFDA0510BEEA07005E94AF /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 80EFDA0410BEEA07005E94AF /* Icon.png */; };
/* End PBXBuildFile section */
@@ -78,6 +79,7 @@
80C4729F10BDEA390060CE5B /* shizzow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = shizzow.h; sourceTree = "<group>"; };
80C472A010BDEA390060CE5B /* shizzow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = shizzow.m; sourceTree = "<group>"; };
80C521D710C1FEB20027C4C4 /* _SHIZZEEPS_DATA_EXAMPLE.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = _SHIZZEEPS_DATA_EXAMPLE.txt; sourceTree = "<group>"; };
+ 80D071CE10C368B70058B8C2 /* _SHIZZEEPS_MORE_DATA.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = _SHIZZEEPS_MORE_DATA.txt; sourceTree = "<group>"; };
80EFDA0410BEEA07005E94AF /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* shizzeeps-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "shizzeeps-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -195,6 +197,7 @@
80C4729810BDEA390060CE5B /* NSURLRequest+IgnoreSSL.h */,
80C4729910BDEA390060CE5B /* NSURLRequest+IgnoreSSL.m */,
80C521D710C1FEB20027C4C4 /* _SHIZZEEPS_DATA_EXAMPLE.txt */,
+ 80D071CE10C368B70058B8C2 /* _SHIZZEEPS_MORE_DATA.txt */,
);
name = Data;
sourceTree = "<group>";
@@ -260,6 +263,7 @@
8083F8C710BE012B007481D2 /* Default.png in Resources */,
80EFDA0510BEEA07005E94AF /* Icon.png in Resources */,
80C521D810C1FEB20027C4C4 /* _SHIZZEEPS_DATA_EXAMPLE.txt in Resources */,
+ 80D071CF10C368B70058B8C2 /* _SHIZZEEPS_MORE_DATA.txt in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

0 comments on commit fab1a9d

Please sign in to comment.