diff --git a/iPad Viewer/ViewController/MessageViewController/LoggerMessageViewController.m b/iPad Viewer/ViewController/MessageViewController/LoggerMessageViewController.m
index 4af2eda7..1a0ca61e 100644
--- a/iPad Viewer/ViewController/MessageViewController/LoggerMessageViewController.m
+++ b/iPad Viewer/ViewController/MessageViewController/LoggerMessageViewController.m
@@ -46,6 +46,9 @@
@interface LoggerMessageViewController ()
@property (nonatomic, retain) NSFetchedResultsController *messageFetchResultController;
@property (nonatomic, retain) NSDictionary *clientInfo;
+@property NSInteger currentRun;
+@property NSInteger runCount;
+@property uLong currentClientHash;
-(void)readMessages:(NSNotification *)aNotification;
-(void)insertTableViewSection;
-(void)deleteTableViewSection;
@@ -108,6 +111,9 @@ - (void)viewDidLoad
self.toolBar.noiseBlendMode = kCGBlendModeMultiply;
self.toolBar.noiseOpacity = 0.1;
+ self.currentRun = -1;
+ self.runCount = -1;
+
#ifdef TEST_SHOW
[self readMessages:nil];
#endif
@@ -160,30 +166,34 @@ -(void)readMessages:(NSNotification *)aNotification
MTLog(@"userInfo %@",userInfo);
- NSInteger runCount = [[userInfo objectForKey:kClientRunCount] integerValue];
+ self.runCount = [[userInfo objectForKey:kClientRunCount] integerValue];
+ self.currentRun = self.runCount;
self.clientInfo = nil;
self.clientInfo = userInfo;
+ self.currentClientHash = [[userInfo objectForKey:kClientHash] integerValue];
+
#endif
- self.runCountLabel.text = \
- [NSString stringWithFormat:
- NSLocalizedString(@"Run %ld of %ld", nil),runCount+1,runCount+1];
+
+ [self enableRunControls];
+ [self fetchDataForRun:self.currentRun
+ withClientHash:self.currentClientHash];
+}
- self.previousRunButton.hidden = runCount < 0;
- self.nextRunButton.hidden = YES;
+- (void)enableRunControls
+{
+ self.runCountLabel.text = \
+ [NSString stringWithFormat:
+ NSLocalizedString(@"Run %ld of %ld", nil),self.currentRun+1,self.runCount+1];
- [self fetchDataForRun:runCount+1
- notification:aNotification];
+ self.previousRunButton.hidden = self.currentRun <= 0;
+ self.nextRunButton.hidden = self.currentRun >= self.runCount;
}
- (void)fetchDataForRun:(NSInteger)run
- notification:(NSNotification *)aNotification
+ withClientHash:(uLong)clientHash
{
- NSDictionary *userInfo = [aNotification userInfo];
-
- uLong clientHash = [[userInfo objectForKey:kClientHash] integerValue];
-
assert([self.dataManager messageDisplayContext] != nil);
if(_messageFetchResultController != nil)
@@ -277,6 +287,27 @@ -(void)deleteTableViewSection
deleteSections:indexSet
withRowAnimation:UITableViewRowAnimationAutomatic];
}
+//------------------------------------------------------------------------------
+#pragma mark Actions
+//------------------------------------------------------------------------------
+- (IBAction)didPressPreviousButton:(id)sender {
+ if (self.currentRun > 0) {
+ self.currentRun--;
+ [self enableRunControls];
+ [self fetchDataForRun:self.currentRun
+ withClientHash:self.currentClientHash];
+ }
+}
+
+- (IBAction)didPressNextButton:(id)sender {
+ if (self.currentRun < self.runCount) {
+ self.currentRun++;
+ [self enableRunControls];
+ [self fetchDataForRun:self.currentRun
+ withClientHash:self.currentClientHash];
+ }
+}
+
//------------------------------------------------------------------------------
#pragma mark Timer Control
//------------------------------------------------------------------------------
@@ -324,7 +355,8 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- (NSInteger)tableView:(UITableView *)aTableView
numberOfRowsInSection:(NSInteger)aSection
{
- return [[self.messageFetchResultController fetchedObjects] count];
+ NSArray *records = [self.messageFetchResultController fetchedObjects];
+ return [records count];
}
- (UITableViewCell *)tableView:(UITableView *)aTableView
diff --git a/iPad Viewer/ViewController/MessageViewController/LoggerMessageViewController.xib b/iPad Viewer/ViewController/MessageViewController/LoggerMessageViewController.xib
index c766c3b3..118cd483 100644
--- a/iPad Viewer/ViewController/MessageViewController/LoggerMessageViewController.xib
+++ b/iPad Viewer/ViewController/MessageViewController/LoggerMessageViewController.xib
@@ -73,9 +73,9 @@
@@ -125,8 +128,6 @@
-
-
@@ -139,11 +140,14 @@
+
+
+
diff --git a/iPad Viewer/Views & Cells/MessageCell/LoggerMessageCell.m b/iPad Viewer/Views & Cells/MessageCell/LoggerMessageCell.m
index 55fa8661..1cef5894 100644
--- a/iPad Viewer/Views & Cells/MessageCell/LoggerMessageCell.m
+++ b/iPad Viewer/Views & Cells/MessageCell/LoggerMessageCell.m
@@ -300,6 +300,9 @@ -(void)setupForIndexpath:(NSIndexPath *)anIndexPath
NSInteger locTimestamp = 0;
//@@TODO:: timedelta
+
+ if (IS_NULL_STRING(aMessageData.tag)) aMessageData.tag = @" ";
+
NSInteger locTimedelta = locTimestamp + [aMessageData.timestampString length];
NSInteger locThread = locTimedelta;// + [aMessageData.timeDeltaString length];
@@ -345,7 +348,7 @@ -(void)setupForIndexpath:(NSIndexPath *)anIndexPath
CFAttributedStringReplaceString(as, CFRangeMake(locThread, 0), (CFStringRef)aMessageData.threadID);
// Place Tag
- CFAttributedStringReplaceString(as, CFRangeMake(locTag, 0), (CFStringRef)aMessageData.tag);
+ CFAttributedStringReplaceString(as, CFRangeMake(locTag, 0), (CFStringRef)aMessageData.tag);
// Place level
CFAttributedStringReplaceString(as, CFRangeMake(locLevel, 0), (CFStringRef)[aMessageData.level stringValue]);