Skip to content

Commit

Permalink
Shorten system log class names
Browse files Browse the repository at this point in the history
  • Loading branch information
NSExceptional committed Feb 13, 2020
1 parent 9abd9cc commit 1780968
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// FLEXSystemLogTableViewCell.h
// FLEXSystemLogCell.h
// FLEX
//
// Created by Ryan Olson on 1/25/15.
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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];
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// FLEXSystemLogTableViewController.h
// FLEXSystemLogViewController.h
// FLEX
//
// Created by Ryan Olson on 1/19/15.
Expand All @@ -9,6 +9,6 @@
#import "FLEXTableViewController.h"
#import "FLEXGlobalsEntry.h"

@interface FLEXSystemLogTableViewController : FLEXTableViewController <FLEXGlobalsEntry>
@interface FLEXSystemLogViewController : FLEXTableViewController <FLEXGlobalsEntry>

@end
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
//
// 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<FLEXLogController> logController;
@property (nonatomic, readonly) NSMutableArray<FLEXSystemLogMessage *> *logMessages;
@property (nonatomic, copy) NSArray<FLEXSystemLogMessage *> *filteredLogMessages;

@end

@implementation FLEXSystemLogTableViewController
@implementation FLEXSystemLogViewController

- (id)init {
return [super initWithStyle:UITableViewStylePlain];
Expand All @@ -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...";

Expand Down Expand Up @@ -110,6 +110,7 @@ - (void)showLogSettings {
} showFrom:self];
}


#pragma mark - FLEXGlobalsEntry

+ (NSString *)globalsEntryTitle:(FLEXGlobalsRow)row {
Expand All @@ -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;

Expand All @@ -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 {
Expand All @@ -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<NSString *, id> *bindings) {
NSString *displayedText = [FLEXSystemLogTableViewCell displayedTextForLogMessage:logMessage];
NSString *displayedText = [FLEXSystemLogCell displayedTextForLogMessage:logMessage];
return [displayedText rangeOfString:searchString options:NSCaseInsensitiveSearch].length > 0;
}]];
} thenOnMainQueue:^(NSArray *filteredLogMessages) {
Expand Down

0 comments on commit 1780968

Please sign in to comment.