Skip to content

Commit

Permalink
chore: extract func for check is tips cell
Browse files Browse the repository at this point in the history
  • Loading branch information
AkaShark committed Feb 24, 2024
1 parent 7b4128d commit f206d7f
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ - (BOOL)isShowTipsView {
return NO;
}

- (BOOL)isTipsCellRow:(NSInteger)row {
return (self.isShowTipsView && row == 2 && self.windowType != EZWindowTypeMini) || (self.isShowTipsView && row == 1);
}

#pragma mark - Public Methods

/// Before starting query text, close all result view.
Expand Down Expand Up @@ -807,7 +811,7 @@ - (nullable NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(null
}

// show tips view
if ((self.isShowTipsView && row == 2 && self.windowType != EZWindowTypeMini) || (self.isShowTipsView && row == 1)) {
if ([self isTipsCellRow:row]) {
EZTableTipsCell *tipsCell = [self.tableView makeViewWithIdentifier:EZTableTipsCellId owner:self];
if (!tipsCell) {
tipsCell = [[EZTableTipsCell alloc] initWithFrame:[self tableViewContentBounds]];
Expand All @@ -832,8 +836,7 @@ - (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row {
height = self.queryModel.queryViewHeight;
} else if (row == 1 && self.windowType != EZWindowTypeMini) {
height = 35;
} else if ((row == 2 && self.isShowTipsView && self.windowType != EZWindowTypeMini) ||
(row == 1 && self.isShowTipsView)) {
} else if ([self isTipsCellRow:row]) {
if (!self.tipsCell) {
height = 100;
} else {
Expand Down

0 comments on commit f206d7f

Please sign in to comment.