Add NotificationSettings and Keywords UI and VM

This commit is contained in:
David Langley
2021-08-18 09:33:56 +01:00
parent 0336c80db8
commit c7833d86df
28 changed files with 822 additions and 373 deletions
+30 -16
View File
@@ -1918,7 +1918,7 @@ TableViewSectionsDelegate>
}
else if (row == NOTIFICATION_SETTINGS_MENTION_AND_KEYWORDS_SETTINGS_INDEX)
{
cell.textLabel.text = NSLocalizedStringFromTable(@"settings_meantions_and_keywords", @"Vector", nil);
cell.textLabel.text = NSLocalizedStringFromTable(@"settings_mentions_and_keywords", @"Vector", nil);
}
else if (row == NOTIFICATION_SETTINGS_OTHER_SETTINGS_INDEX)
{
@@ -2744,7 +2744,17 @@ TableViewSectionsDelegate>
}
else if (section == SECTION_TAG_NOTIFICATIONS)
{
[self showNotificationSettings];
switch (row) {
case NOTIFICATION_SETTINGS_DEFAULT_SETTINGS_INDEX:
[self showNotificationSettings:NotificationSettingsScreenDefaultNotificaitons];
break;
case NOTIFICATION_SETTINGS_MENTION_AND_KEYWORDS_SETTINGS_INDEX:
[self showNotificationSettings:NotificationSettingsScreenMentionsAndKeywords];
break;
case NOTIFICATION_SETTINGS_OTHER_SETTINGS_INDEX:
[self showNotificationSettings:NotificationSettingsScreenOther];
break;
}
}
[tableView deselectRowAtIndexPath:indexPath animated:YES];
@@ -4082,28 +4092,32 @@ TableViewSectionsDelegate>
#pragma mark - NotificationSettingsCoordinatorBridgePresenter
- (void)showNotificationSettings
- (void)showNotificationSettings: (NotificationSettingsScreen) screen
{
NotificationSettingsCoordinatorBridgePresenter *notificationSettingsBridgePresenter = [[NotificationSettingsCoordinatorBridgePresenter alloc] initWithSession:self.mainSession];
notificationSettingsBridgePresenter.delegate = self;
MXWeakify(self);
[notificationSettingsBridgePresenter pushFrom:self.navigationController animated:YES popCompletion:^{
MXStrongifyAndReturnIfNil(self);
if (@available(iOS 14.0, *)) {
NotificationSettingsCoordinatorBridgePresenter *notificationSettingsBridgePresenter = [[NotificationSettingsCoordinatorBridgePresenter alloc] initWithSession:self.mainSession];
notificationSettingsBridgePresenter.delegate = self;
self.notificationSettingsBridgePresenter = nil;
}];
self.notificationSettingsBridgePresenter = notificationSettingsBridgePresenter;
MXWeakify(self);
[notificationSettingsBridgePresenter pushFrom:self.navigationController animated:YES screen:screen popCompletion:^{
MXStrongifyAndReturnIfNil(self);
self.notificationSettingsBridgePresenter = nil;
}];
self.notificationSettingsBridgePresenter = notificationSettingsBridgePresenter;
} else {
// Fallback on earlier versions
}
}
#pragma mark - NotificationSettingsCoordinatorBridgePresenterDelegate
- (void)notificationSettingsCoordinatorBridgePresenterDelegateDidComplete:(NotificationSettingsCoordinatorBridgePresenter *)coordinatorBridgePresenter
{
API_AVAILABLE(ios(14.0)){
[self.notificationSettingsBridgePresenter dismissWithAnimated:YES completion:nil];
self.notificationSettingsBridgePresenter = nil;
}