From 1780968f50ca4daa2968d259d1faad1ddc17ccca Mon Sep 17 00:00:00 2001 From: Tanner Bennett Date: Thu, 13 Feb 2020 15:30:00 -0600 Subject: [PATCH] Shorten system log class names --- .../Globals/FLEXGlobalsViewController.m | 4 +-- ...LogTableViewCell.h => FLEXSystemLogCell.h} | 6 ++--- ...LogTableViewCell.m => FLEXSystemLogCell.m} | 11 ++++---- ...roller.h => FLEXSystemLogViewController.h} | 4 +-- ...roller.m => FLEXSystemLogViewController.m} | 26 +++++++++---------- 5 files changed, 26 insertions(+), 25 deletions(-) rename Classes/GlobalStateExplorers/SystemLog/{FLEXSystemLogTableViewCell.h => FLEXSystemLogCell.h} (75%) rename Classes/GlobalStateExplorers/SystemLog/{FLEXSystemLogTableViewCell.m => FLEXSystemLogCell.m} (94%) rename Classes/GlobalStateExplorers/SystemLog/{FLEXSystemLogTableViewController.h => FLEXSystemLogViewController.h} (57%) rename Classes/GlobalStateExplorers/SystemLog/{FLEXSystemLogTableViewController.m => FLEXSystemLogViewController.m} (89%) diff --git a/Classes/GlobalStateExplorers/Globals/FLEXGlobalsViewController.m b/Classes/GlobalStateExplorers/Globals/FLEXGlobalsViewController.m index 69cfed456f..11ad51774d 100644 --- a/Classes/GlobalStateExplorers/Globals/FLEXGlobalsViewController.m +++ b/Classes/GlobalStateExplorers/Globals/FLEXGlobalsViewController.m @@ -18,7 +18,7 @@ #import "FLEXCookiesTableViewController.h" #import "FLEXGlobalsEntry.h" #import "FLEXManager+Private.h" -#import "FLEXSystemLogTableViewController.h" +#import "FLEXSystemLogViewController.h" #import "FLEXNetworkMITMViewController.h" #import "FLEXAddressExplorerCoordinator.h" #import "FLEXGlobalsSection.h" @@ -66,7 +66,7 @@ + (FLEXGlobalsEntry *)globalsEntryForRow:(FLEXGlobalsRow)row { case FLEXGlobalsRowBrowseContainer: return [FLEXFileBrowserTableViewController flex_concreteGlobalsEntry:row]; case FLEXGlobalsRowSystemLog: - return [FLEXSystemLogTableViewController flex_concreteGlobalsEntry:row]; + return [FLEXSystemLogViewController flex_concreteGlobalsEntry:row]; case FLEXGlobalsRowNetworkHistory: return [FLEXNetworkMITMViewController flex_concreteGlobalsEntry:row]; case FLEXGlobalsRowKeyWindow: diff --git a/Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogTableViewCell.h b/Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogCell.h similarity index 75% rename from Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogTableViewCell.h rename to Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogCell.h index c1da32e6d8..4721401d4a 100644 --- a/Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogTableViewCell.h +++ b/Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogCell.h @@ -1,5 +1,5 @@ // -// FLEXSystemLogTableViewCell.h +// FLEXSystemLogCell.h // FLEX // // Created by Ryan Olson on 1/25/15. @@ -10,9 +10,9 @@ @class FLEXSystemLogMessage; -extern NSString *const kFLEXSystemLogTableViewCellIdentifier; +extern NSString *const kFLEXSystemLogCellIdentifier; -@interface FLEXSystemLogTableViewCell : UITableViewCell +@interface FLEXSystemLogCell : UITableViewCell @property (nonatomic) FLEXSystemLogMessage *logMessage; @property (nonatomic, copy) NSString *highlightedText; diff --git a/Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogTableViewCell.m b/Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogCell.m similarity index 94% rename from Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogTableViewCell.m rename to Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogCell.m index df151d7047..00b24360f4 100644 --- a/Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogTableViewCell.m +++ b/Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogCell.m @@ -1,24 +1,24 @@ // -// FLEXSystemLogTableViewCell.m +// FLEXSystemLogCell.m // FLEX // // Created by Ryan Olson on 1/25/15. // Copyright (c) 2015 f. All rights reserved. // -#import "FLEXSystemLogTableViewCell.h" +#import "FLEXSystemLogCell.h" #import "FLEXSystemLogMessage.h" -NSString *const kFLEXSystemLogTableViewCellIdentifier = @"FLEXSystemLogTableViewCellIdentifier"; +NSString *const kFLEXSystemLogCellIdentifier = @"FLEXSystemLogCellIdentifier"; -@interface FLEXSystemLogTableViewCell () +@interface FLEXSystemLogCell () @property (nonatomic) UILabel *logMessageLabel; @property (nonatomic) NSAttributedString *logMessageAttributedText; @end -@implementation FLEXSystemLogTableViewCell +@implementation FLEXSystemLogCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; @@ -64,6 +64,7 @@ - (void)layoutSubviews { self.logMessageLabel.frame = UIEdgeInsetsInsetRect(self.contentView.bounds, kFLEXLogMessageCellInsets); } + #pragma mark - Stateless helpers + (NSAttributedString *)attributedTextForLogMessage:(FLEXSystemLogMessage *)logMessage highlightedText:(NSString *)highlightedText { diff --git a/Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogTableViewController.h b/Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogViewController.h similarity index 57% rename from Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogTableViewController.h rename to Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogViewController.h index 2fde665188..68bb94efcd 100644 --- a/Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogTableViewController.h +++ b/Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogViewController.h @@ -1,5 +1,5 @@ // -// FLEXSystemLogTableViewController.h +// FLEXSystemLogViewController.h // FLEX // // Created by Ryan Olson on 1/19/15. @@ -9,6 +9,6 @@ #import "FLEXTableViewController.h" #import "FLEXGlobalsEntry.h" -@interface FLEXSystemLogTableViewController : FLEXTableViewController +@interface FLEXSystemLogViewController : FLEXTableViewController @end diff --git a/Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogTableViewController.m b/Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogViewController.m similarity index 89% rename from Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogTableViewController.m rename to Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogViewController.m index b792eb8059..93525a1ccc 100644 --- a/Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogTableViewController.m +++ b/Classes/GlobalStateExplorers/SystemLog/FLEXSystemLogViewController.m @@ -1,19 +1,19 @@ // -// FLEXSystemLogTableViewController.m +// FLEXSystemLogViewController.m // FLEX // // Created by Ryan Olson on 1/19/15. // Copyright (c) 2015 f. All rights reserved. // -#import "FLEXSystemLogTableViewController.h" +#import "FLEXSystemLogViewController.h" #import "FLEXUtility.h" #import "FLEXColor.h" #import "FLEXASLLogController.h" #import "FLEXOSLogController.h" -#import "FLEXSystemLogTableViewCell.h" +#import "FLEXSystemLogCell.h" -@interface FLEXSystemLogTableViewController () +@interface FLEXSystemLogViewController () @property (nonatomic, readonly) id logController; @property (nonatomic, readonly) NSMutableArray *logMessages; @@ -21,7 +21,7 @@ @interface FLEXSystemLogTableViewController () @end -@implementation FLEXSystemLogTableViewController +@implementation FLEXSystemLogViewController - (id)init { return [super initWithStyle:UITableViewStylePlain]; @@ -45,7 +45,7 @@ - (void)viewDidLoad { _logController = [FLEXASLLogController withUpdateHandler:logHandler]; } - [self.tableView registerClass:[FLEXSystemLogTableViewCell class] forCellReuseIdentifier:kFLEXSystemLogTableViewCellIdentifier]; + [self.tableView registerClass:[FLEXSystemLogCell class] forCellReuseIdentifier:kFLEXSystemLogCellIdentifier]; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; self.title = @"Loading..."; @@ -110,6 +110,7 @@ - (void)showLogSettings { } showFrom:self]; } + #pragma mark - FLEXGlobalsEntry + (NSString *)globalsEntryTitle:(FLEXGlobalsRow)row { @@ -120,18 +121,15 @@ + (UIViewController *)globalsEntryViewController:(FLEXGlobalsRow)row { return [self new]; } -#pragma mark - Table view data source -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} +#pragma mark - Table view data source - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return self.searchController.isActive ? self.filteredLogMessages.count : self.logMessages.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - FLEXSystemLogTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kFLEXSystemLogTableViewCellIdentifier forIndexPath:indexPath]; + FLEXSystemLogCell *cell = [tableView dequeueReusableCellWithIdentifier:kFLEXSystemLogCellIdentifier forIndexPath:indexPath]; cell.logMessage = [self logMessageAtIndexPath:indexPath]; cell.highlightedText = self.searchText; @@ -146,9 +144,10 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { FLEXSystemLogMessage *logMessage = [self logMessageAtIndexPath:indexPath]; - return [FLEXSystemLogTableViewCell preferredHeightForLogMessage:logMessage inWidth:self.tableView.bounds.size.width]; + return [FLEXSystemLogCell preferredHeightForLogMessage:logMessage inWidth:self.tableView.bounds.size.width]; } + #pragma mark - Copy on long press - (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath { @@ -170,12 +169,13 @@ - (FLEXSystemLogMessage *)logMessageAtIndexPath:(NSIndexPath *)indexPath { return self.searchController.isActive ? self.filteredLogMessages[indexPath.row] : self.logMessages[indexPath.row]; } + #pragma mark - Search bar - (void)updateSearchResults:(NSString *)searchString { [self onBackgroundQueue:^NSArray *{ return [self.logMessages filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(FLEXSystemLogMessage *logMessage, NSDictionary *bindings) { - NSString *displayedText = [FLEXSystemLogTableViewCell displayedTextForLogMessage:logMessage]; + NSString *displayedText = [FLEXSystemLogCell displayedTextForLogMessage:logMessage]; return [displayedText rangeOfString:searchString options:NSCaseInsensitiveSearch].length > 0; }]]; } thenOnMainQueue:^(NSArray *filteredLogMessages) {