Feature/4976 ignore blocking maintenance

This commit is contained in:
Frank Rotermund
2023-08-22 12:02:43 +00:00
parent abf74c4341
commit 31f70e749f
16 changed files with 213 additions and 66 deletions
+41 -2
View File
@@ -243,7 +243,8 @@ typedef NS_ENUM(NSUInteger, SECURITY)
enum
{
DOWNTIME_WARNING = 0
DOWNTIME_WARNING = 0,
DOWNTIME_IGNORE_BLOCKING
};
enum
@@ -406,9 +407,16 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
{
NSMutableArray<Section*> *tmpSections = [NSMutableArray arrayWithCapacity:SECTION_TAG_DEVELOPER + 1];
if ( [[[ServerDowntimeDefaultService alloc] init] isDowntimePresentable]) {
ServerDowntimeDefaultService* service = [[ServerDowntimeDefaultService alloc] init];
if ( [service isDowntimePresentable]) {
Section *sectionDowntime = [Section sectionWithTag:SECTION_TAG_DOWNTIME_WARNING];
[sectionDowntime addRowWithTag:DOWNTIME_WARNING];
// bwi #4982 special handling for blocking in Beta
if( BWIBuildSettings.shared.ignoreBlockingMaintenance && [service isBlocking] && ![service isManuallyIgnored] ) {
[sectionDowntime addRowWithTag:DOWNTIME_IGNORE_BLOCKING];
}
[tmpSections addObject:sectionDowntime];
}
@@ -3056,6 +3064,8 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
cell = downtimeCell;
} else if (row == DOWNTIME_IGNORE_BLOCKING) {
cell = [self cellForDowntimeIgnore:tableView indexPath:indexPath row:indexPath.row];
}
}
else if (section == SECTION_TAG_OUTDATED_WARNING)
@@ -5318,6 +5328,35 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
return ([[NSLocale componentsFromLocaleIdentifier:[[NSLocale preferredLanguages] firstObject]] objectForKey:@"kCFLocaleLanguageCodeKey"]);
}
- (UITableViewCell*) cellForDowntimeIgnore:(UITableView*)tableView indexPath:(NSIndexPath*)indexPath row:(NSInteger)row {
MXKTableViewCellWithButton *downtimeIgnoreBtnCell = [tableView dequeueReusableCellWithIdentifier:[MXKTableViewCellWithButton defaultReuseIdentifier]];
if (!downtimeIgnoreBtnCell)
{
downtimeIgnoreBtnCell = [[MXKTableViewCellWithButton alloc] init];
}
else
{
downtimeIgnoreBtnCell.mxkButton.titleLabel.text = nil;
}
NSString *btnTitle = [BWIL10n blockingDowntimeAlertIgnoreButton];
[downtimeIgnoreBtnCell.mxkButton setTitle:btnTitle forState:UIControlStateNormal];
[downtimeIgnoreBtnCell.mxkButton setTitle:btnTitle forState:UIControlStateHighlighted];
[downtimeIgnoreBtnCell.mxkButton setTintColor:ThemeService.shared.theme.tintColor];
downtimeIgnoreBtnCell.mxkButton.titleLabel.font = [UIFont systemFontOfSize:17];
[downtimeIgnoreBtnCell.mxkButton removeTarget:self action:nil forControlEvents:UIControlEventTouchUpInside];
[downtimeIgnoreBtnCell.mxkButton addTarget:self action:@selector(ignoreDowntime:) forControlEvents:UIControlEventTouchUpInside];
downtimeIgnoreBtnCell.mxkButton.accessibilityIdentifier = nil;
return downtimeIgnoreBtnCell;
}
- (void) ignoreDowntime:(id)sender {
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"ServerDownTimeBlockingKey"];
[[[ServerDowntimeDefaultService alloc] init] setManuallyIgnored];
}
#pragma mark - ThreadsBetaCoordinatorBridgePresenterDelegate
- (void)threadsBetaCoordinatorBridgePresenterDelegateDidTapEnable:(ThreadsBetaCoordinatorBridgePresenter *)coordinatorBridgePresenter