Create notification service extension

Signed-off-by: ismailgulek <gulekismail@gmail.com>
This commit is contained in:
ismailgulek
2020-05-22 14:27:30 +03:00
parent ff09e18abf
commit eb2d572e91
12 changed files with 1004 additions and 144 deletions
+41 -40
View File
@@ -87,9 +87,9 @@ enum
enum
{
CALLS_ENABLE_CALLKIT_INDEX = 0,
CALLS_CALLKIT_DESCRIPTION_INDEX,
CALLS_ENABLE_STUN_SERVER_FALLBACK_INDEX,
//CALLS_ENABLE_CALLKIT_INDEX = 0,
//CALLS_CALLKIT_DESCRIPTION_INDEX,
CALLS_ENABLE_STUN_SERVER_FALLBACK_INDEX=0,
CALLS_STUN_SERVER_FALLBACK_DESCRIPTION_INDEX,
CALLS_COUNT
};
@@ -1731,39 +1731,40 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate>
}
else if (section == SETTINGS_SECTION_CALLS_INDEX)
{
if (row == CALLS_ENABLE_CALLKIT_INDEX)
{
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
labelAndSwitchCell.mxkLabel.text = NSLocalizedStringFromTable(@"settings_enable_callkit", @"Vector", nil);
labelAndSwitchCell.mxkSwitch.on = [MXKAppSettings standardAppSettings].isCallKitEnabled;
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
labelAndSwitchCell.mxkSwitch.enabled = YES;
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleCallKit:) forControlEvents:UIControlEventTouchUpInside];
if (![MXCallKitAdapter callKitAvailable])
{
labelAndSwitchCell.mxkSwitch.on = NO;
labelAndSwitchCell.mxkSwitch.enabled = NO;
labelAndSwitchCell.mxkLabel.enabled = NO;
}
cell = labelAndSwitchCell;
}
else if (row == CALLS_CALLKIT_DESCRIPTION_INDEX)
{
MXKTableViewCell *globalInfoCell = [self getDefaultTableViewCell:tableView];
globalInfoCell.textLabel.text = NSLocalizedStringFromTable(@"settings_callkit_info", @"Vector", nil);
globalInfoCell.textLabel.numberOfLines = 0;
globalInfoCell.selectionStyle = UITableViewCellSelectionStyleNone;
if (![MXCallKitAdapter callKitAvailable])
{
globalInfoCell.textLabel.enabled = NO;
}
cell = globalInfoCell;
}
else if (row == CALLS_ENABLE_STUN_SERVER_FALLBACK_INDEX)
// if (row == CALLS_ENABLE_CALLKIT_INDEX)
// {
// MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
// labelAndSwitchCell.mxkLabel.text = NSLocalizedStringFromTable(@"settings_enable_callkit", @"Vector", nil);
// labelAndSwitchCell.mxkSwitch.on = [MXKAppSettings standardAppSettings].isCallKitEnabled;
// labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
// labelAndSwitchCell.mxkSwitch.enabled = YES;
// [labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleCallKit:) forControlEvents:UIControlEventTouchUpInside];
//
// if (![MXCallKitAdapter callKitAvailable])
// {
// labelAndSwitchCell.mxkSwitch.on = NO;
// labelAndSwitchCell.mxkSwitch.enabled = NO;
// labelAndSwitchCell.mxkLabel.enabled = NO;
// }
//
// cell = labelAndSwitchCell;
// }
// else if (row == CALLS_CALLKIT_DESCRIPTION_INDEX)
// {
// MXKTableViewCell *globalInfoCell = [self getDefaultTableViewCell:tableView];
// globalInfoCell.textLabel.text = NSLocalizedStringFromTable(@"settings_callkit_info", @"Vector", nil);
// globalInfoCell.textLabel.numberOfLines = 0;
// globalInfoCell.selectionStyle = UITableViewCellSelectionStyleNone;
//
// if (![MXCallKitAdapter callKitAvailable])
// {
// globalInfoCell.textLabel.enabled = NO;
// }
//
// cell = globalInfoCell;
// }
// else
if (row == CALLS_ENABLE_STUN_SERVER_FALLBACK_INDEX)
{
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
labelAndSwitchCell.mxkLabel.text = NSLocalizedStringFromTable(@"settings_calls_stun_server_fallback_button", @"Vector", nil);
@@ -2848,10 +2849,10 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate>
MXKAccountManager *accountManager = [MXKAccountManager sharedManager];
MXKAccount* account = accountManager.activeAccounts.firstObject;
if (accountManager.pushDeviceToken)
if (accountManager.apnsDeviceToken)
{
[account enablePushKitNotifications:!account.isPushKitNotificationActive success:^{
[account enablePushNotifications:!account.pushNotificationServiceIsActive success:^{
[self stopActivityIndicator];
} failure:^(NSError *error) {
[self stopActivityIndicator];
@@ -2868,7 +2869,7 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate>
}
else
{
[account enablePushKitNotifications:YES success:^{
[account enablePushNotifications:YES success:^{
[self stopActivityIndicator];
} failure:^(NSError *error) {
[self stopActivityIndicator];