Feature/1801 ruhezeit einstellungsmenu

This commit is contained in:
Arnfried Griesert
2022-06-02 03:41:21 +00:00
parent 810124110b
commit c20966c2ab
26 changed files with 770 additions and 566 deletions
+20 -32
View File
@@ -121,13 +121,13 @@ typedef NS_ENUM(NSUInteger, LINKS_SHOW_URL_PREVIEWS)
typedef NS_ENUM(NSUInteger, NOTIFICATION_SETTINGS)
{
NOTIFICATION_SETTINGS_ENABLE_PUSH_INDEX = 0,
NOTIFICATION_SETTINGS_ENABLE_REST_TIME,
NOTIFICATION_SETTINGS_SYSTEM_SETTINGS,
NOTIFICATION_SETTINGS_SHOW_DECODED_CONTENT,
NOTIFICATION_SETTINGS_PIN_MISSED_NOTIFICATIONS_INDEX,
NOTIFICATION_SETTINGS_PIN_UNREAD_INDEX,
NOTIFICATION_SETTINGS_DEFAULT_SETTINGS_INDEX,
NOTIFICATION_SETTINGS_MENTION_AND_KEYWORDS_SETTINGS_INDEX,
NOTIFICATION_SETTINGS_NOTIFICATION_TIMES_INDEX,
NOTIFICATION_SETTINGS_OTHER_SETTINGS_INDEX,
};
@@ -491,11 +491,6 @@ ThreadsBetaCoordinatorBridgePresenterDelegate>
Section *sectionNotificationSettings = [Section sectionWithTag:SECTION_TAG_NOTIFICATIONS];
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_ENABLE_PUSH_INDEX];
if (BuildSettings.featureWorkTime)
{
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_ENABLE_REST_TIME];
}
if (RiotSettings.shared.settingsScreenShowSystemSettingsOption) {
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_SYSTEM_SETTINGS];
}
@@ -521,6 +516,9 @@ ThreadsBetaCoordinatorBridgePresenterDelegate>
if (RiotSettings.shared.settingsNotificationsShowMentions) {
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_MENTION_AND_KEYWORDS_SETTINGS_INDEX];
}
if (BwiBuildSettings.bwiNotificationTimes) {
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_NOTIFICATION_TIMES_INDEX];
}
if (RiotSettings.shared.settingsNotificationsShowAdvanced) {
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_OTHER_SETTINGS_INDEX];
}
@@ -2245,10 +2243,6 @@ ThreadsBetaCoordinatorBridgePresenterDelegate>
cell = labelAndSwitchCell;
}
else if (row == NOTIFICATION_SETTINGS_ENABLE_REST_TIME)
{
cell = [self cellForWorkTime:tableView indexPath:indexPath];
}
else if (row == NOTIFICATION_SETTINGS_SYSTEM_SETTINGS)
{
cell = [tableView dequeueReusableCellWithIdentifier:kSettingsViewControllerPhoneBookCountryCellId];
@@ -2302,7 +2296,7 @@ ThreadsBetaCoordinatorBridgePresenterDelegate>
cell = labelAndSwitchCell;
}
else if (row == NOTIFICATION_SETTINGS_DEFAULT_SETTINGS_INDEX || row == NOTIFICATION_SETTINGS_MENTION_AND_KEYWORDS_SETTINGS_INDEX || row == NOTIFICATION_SETTINGS_OTHER_SETTINGS_INDEX)
else if (row == NOTIFICATION_SETTINGS_DEFAULT_SETTINGS_INDEX || row == NOTIFICATION_SETTINGS_MENTION_AND_KEYWORDS_SETTINGS_INDEX || row == NOTIFICATION_SETTINGS_OTHER_SETTINGS_INDEX || row == NOTIFICATION_SETTINGS_NOTIFICATION_TIMES_INDEX)
{
cell = [self getDefaultTableViewCell:tableView];
if (row == NOTIFICATION_SETTINGS_DEFAULT_SETTINGS_INDEX)
@@ -2313,6 +2307,10 @@ ThreadsBetaCoordinatorBridgePresenterDelegate>
{
cell.textLabel.text = [VectorL10n settingsMentionsAndKeywords];
}
else if (row == NOTIFICATION_SETTINGS_NOTIFICATION_TIMES_INDEX)
{
cell.textLabel.text = [VectorL10n settingsEnableNotificationTimes];
}
else if (row == NOTIFICATION_SETTINGS_OTHER_SETTINGS_INDEX)
{
cell.textLabel.text = [VectorL10n settingsOther];
@@ -3264,6 +3262,9 @@ ThreadsBetaCoordinatorBridgePresenterDelegate>
case NOTIFICATION_SETTINGS_MENTION_AND_KEYWORDS_SETTINGS_INDEX:
[self showNotificationSettings:NotificationSettingsScreenMentionsAndKeywords];
break;
case NOTIFICATION_SETTINGS_NOTIFICATION_TIMES_INDEX:
[self showNotificationTimesSettings];
break;
case NOTIFICATION_SETTINGS_OTHER_SETTINGS_INDEX:
[self showNotificationSettings:NotificationSettingsScreenOther];
break;
@@ -4356,7 +4357,6 @@ ThreadsBetaCoordinatorBridgePresenterDelegate>
RiotSettings.shared.showNSFWPublicRooms = sender.isOn;
}
- (void)showDeveloperSettings
{
if (@available(iOS 14.0, *)) {
@@ -4365,6 +4365,14 @@ ThreadsBetaCoordinatorBridgePresenterDelegate>
}
}
- (void)showNotificationTimesSettings
{
if (@available(iOS 14.0, *)) {
UIViewController *notificationTimesViewController = [NotificationTimesViewController makeViewControllerWithSession:self.mainSession];
[self pushViewController:notificationTimesViewController];
}
}
- (void)toggleEnableRoomMessageBubbles:(UISwitch *)sender
{
RiotSettings.shared.roomScreenEnableMessageBubbles = sender.isOn;
@@ -5334,26 +5342,6 @@ ThreadsBetaCoordinatorBridgePresenterDelegate>
#pragma mark - bwi Messenger Additions
- (UITableViewCell*) cellForWorkTime:(UITableView*)tableView indexPath:(NSIndexPath*)indexPath {
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
WorkTimeService *service = [WorkTimeService workTimeService:self.mainSession.myUser.userId];
labelAndSwitchCell.mxkLabel.text = NSLocalizedStringFromTable(@"settings_enable_rest_time", @"Vector", nil);
labelAndSwitchCell.mxkSwitch.on = [service isWorkTimeGlobalyEnabled];
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
labelAndSwitchCell.mxkSwitch.enabled = YES;
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleRestService:) forControlEvents:UIControlEventTouchUpInside];
return labelAndSwitchCell;
}
- (void)toggleRestService:(UISwitch*)theSwitch
{
WorkTimeService *service = [WorkTimeService workTimeService:self.mainSession.myUser.userId];
[service enableWorkTime:theSwitch.isOn];
}
- (UITableViewCell*) cellForPersonalNotes:(UITableView*)tableView indexPath:(NSIndexPath*)indexPath {
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];