Quellcode durchsuchen

Update the transaction detail table view controller when properties on its transaction are updated.

Ryan Olson vor 11 Jahren
Ursprung
Commit
67a91b5283
1 geänderte Dateien mit 13 neuen und 1 gelöschten Zeilen
  1. 13 1
      Classes/Network/FLEXNetworkTransactionDetailTableViewController.m

+ 13 - 1
Classes/Network/FLEXNetworkTransactionDetailTableViewController.m

@@ -50,7 +50,11 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
 - (instancetype)initWithStyle:(UITableViewStyle)style
 {
     // Force grouped style
-    return [super initWithStyle:UITableViewStyleGrouped];
+    self = [super initWithStyle:UITableViewStyleGrouped];
+    if (self) {
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleTransactionUpdatedNotification:) name:kFLEXNetworkRecorderTransactionUpdatedNotification object:nil];
+    }
+    return self;
 }
 
 - (void)viewDidLoad
@@ -101,6 +105,14 @@ typedef UIViewController *(^FLEXNetworkDetailRowSelectionFuture)(void);
     self.sections = sections;
 }
 
+- (void)handleTransactionUpdatedNotification:(NSNotification *)notification
+{
+    FLEXNetworkTransaction *transaction = [[notification userInfo] objectForKey:kFLEXNetworkRecorderUserInfoTransactionKey];
+    if (transaction == self.transaction) {
+        [self rebuildTableSections];
+    }
+}
+
 #pragma mark - Table view data source
 
 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView