mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-23 18:12:44 +02:00
Merge branch 'callkit' into decrypted_content
This commit is contained in:
@@ -17,13 +17,14 @@
|
||||
|
||||
#import "SettingsViewController.h"
|
||||
|
||||
#import "AppDelegate.h"
|
||||
|
||||
#import "AvatarGenerator.h"
|
||||
|
||||
#import <Photos/Photos.h>
|
||||
#import <MatrixSDK/MXCallKitAdapter.h>
|
||||
#import <MediaPlayer/MediaPlayer.h>
|
||||
#import <MobileCoreServices/MobileCoreServices.h>
|
||||
#import <OLMKit/OLMKit.h>
|
||||
#import <Photos/Photos.h>
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import "AvatarGenerator.h"
|
||||
|
||||
#import "MXKEncryptionKeysExportView.h"
|
||||
#import "BugReportViewController.h"
|
||||
@@ -32,22 +33,20 @@
|
||||
|
||||
#import "CountryPickerViewController.h"
|
||||
#import "LanguagePickerViewController.h"
|
||||
#import "TableViewCellWithPhoneNumberTextField.h"
|
||||
|
||||
#import "NBPhoneNumberUtil.h"
|
||||
#import "RageShakeManager.h"
|
||||
#import "RiotDesignValues.h"
|
||||
#import "TableViewCellWithPhoneNumberTextField.h"
|
||||
|
||||
#import "AvatarGenerator.h"
|
||||
|
||||
#import "OLMKit/OLMKit.h"
|
||||
|
||||
|
||||
NSString* const kSettingsViewControllerPhoneBookCountryCellId = @"kSettingsViewControllerPhoneBookCountryCellId";
|
||||
static NSString* const kSettingsViewControllerPhoneBookCountryCellId = @"kSettingsViewControllerPhoneBookCountryCellId";
|
||||
|
||||
enum
|
||||
{
|
||||
SETTINGS_SECTION_SIGN_OUT_INDEX = 0,
|
||||
SETTINGS_SECTION_USER_SETTINGS_INDEX,
|
||||
SETTINGS_SECTION_NOTIFICATIONS_SETTINGS_INDEX,
|
||||
SETTINGS_SECTION_CALLS_INDEX,
|
||||
SETTINGS_SECTION_USER_INTERFACE_INDEX,
|
||||
SETTINGS_SECTION_IGNORED_USERS_INDEX,
|
||||
SETTINGS_SECTION_CONTACTS_INDEX,
|
||||
@@ -75,6 +74,13 @@ enum
|
||||
NOTIFICATION_SETTINGS_COUNT
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CALLS_ENABLE_CALLKIT_INDEX = 0,
|
||||
CALLS_DESCRIPTION_INDEX,
|
||||
CALLS_COUNT
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
USER_INTERFACE_LANGUAGE_INDEX = 0,
|
||||
@@ -1177,6 +1183,13 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
{
|
||||
count = NOTIFICATION_SETTINGS_COUNT;
|
||||
}
|
||||
else if (section == SETTINGS_SECTION_CALLS_INDEX)
|
||||
{
|
||||
if ([MXCallKitAdapter callKitAvailable])
|
||||
{
|
||||
count = CALLS_COUNT;
|
||||
}
|
||||
}
|
||||
else if (section == SETTINGS_SECTION_USER_INTERFACE_INDEX)
|
||||
{
|
||||
count = USER_INTERFACE_COUNT;
|
||||
@@ -1664,6 +1677,29 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
cell = labelAndSwitchCell;
|
||||
}
|
||||
}
|
||||
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.enabled = YES;
|
||||
[labelAndSwitchCell.mxkSwitch removeTarget:self action:nil forControlEvents:UIControlEventTouchUpInside];
|
||||
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleCallKit:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
cell = labelAndSwitchCell;
|
||||
}
|
||||
else if (row == CALLS_DESCRIPTION_INDEX)
|
||||
{
|
||||
MXKTableViewCell *globalInfoCell = [self getDefaultTableViewCell:tableView];
|
||||
globalInfoCell.textLabel.text = NSLocalizedStringFromTable(@"settings_callkit_info", @"Vector", nil);
|
||||
globalInfoCell.textLabel.numberOfLines = 0;
|
||||
globalInfoCell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
|
||||
cell = globalInfoCell;
|
||||
}
|
||||
}
|
||||
else if (section == SETTINGS_SECTION_USER_INTERFACE_INDEX)
|
||||
{
|
||||
if (row == USER_INTERFACE_LANGUAGE_INDEX)
|
||||
@@ -2044,6 +2080,13 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
{
|
||||
return NSLocalizedStringFromTable(@"settings_notifications_settings", @"Vector", nil);
|
||||
}
|
||||
else if (section == SETTINGS_SECTION_CALLS_INDEX)
|
||||
{
|
||||
if ([MXCallKitAdapter callKitAvailable])
|
||||
{
|
||||
return NSLocalizedStringFromTable(@"settings_calls_settings", @"Vector", nil);
|
||||
}
|
||||
}
|
||||
else if (section == SETTINGS_SECTION_USER_INTERFACE_INDEX)
|
||||
{
|
||||
return NSLocalizedStringFromTable(@"settings_user_interface", @"Vector", nil);
|
||||
@@ -2168,6 +2211,13 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (section == SETTINGS_SECTION_CALLS_INDEX)
|
||||
{
|
||||
if (![MXCallKitAdapter callKitAvailable])
|
||||
{
|
||||
return SECTION_TITLE_PADDING_WHEN_HIDDEN;
|
||||
}
|
||||
}
|
||||
|
||||
return 24;
|
||||
}
|
||||
@@ -2186,6 +2236,13 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (section == SETTINGS_SECTION_CALLS_INDEX)
|
||||
{
|
||||
if (![MXCallKitAdapter callKitAvailable])
|
||||
{
|
||||
return SECTION_TITLE_PADDING_WHEN_HIDDEN;
|
||||
}
|
||||
}
|
||||
|
||||
return 24;
|
||||
}
|
||||
@@ -2575,7 +2632,8 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
- (void)togglePushNotifications:(id)sender
|
||||
{
|
||||
// Check first whether the user allow notification from device settings
|
||||
if ([[MXKAccountManager sharedManager] isAPNSAvailable] == NO)
|
||||
UIUserNotificationType currentUserNotificationTypes = UIApplication.sharedApplication.currentUserNotificationSettings.types;
|
||||
if (currentUserNotificationTypes == UIUserNotificationTypeNone)
|
||||
{
|
||||
[currentAlert dismissViewControllerAnimated:NO completion:nil];
|
||||
|
||||
@@ -2607,13 +2665,37 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
{
|
||||
[self startActivityIndicator];
|
||||
|
||||
MXKAccount* account = [MXKAccountManager sharedManager].activeAccounts.firstObject;
|
||||
MXKAccountManager *accountManager = [MXKAccountManager sharedManager];
|
||||
MXKAccount* account = accountManager.activeAccounts.firstObject;
|
||||
|
||||
// toggle the pushes
|
||||
[account setEnablePushNotifications:!account.pushNotificationServiceIsActive];
|
||||
if (accountManager.apnsDeviceToken)
|
||||
{
|
||||
[account setEnablePushNotifications:!account.pushNotificationServiceIsActive];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Obtain device token when user has just enabled access to notifications from system settings
|
||||
[[AppDelegate theDelegate] registerForRemoteNotificationsWithCompletion:^(NSError * error) {
|
||||
if (error)
|
||||
{
|
||||
[(UISwitch *)sender setOn:NO animated:YES];
|
||||
[self stopActivityIndicator];
|
||||
}
|
||||
else
|
||||
{
|
||||
[account setEnablePushNotifications:YES];
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)toggleCallKit:(id)sender
|
||||
{
|
||||
UISwitch *switchButton = (UISwitch*)sender;
|
||||
[MXKAppSettings standardAppSettings].enableCallKit = switchButton.isOn;
|
||||
}
|
||||
|
||||
- (void)toggleShowDecodedContent:(id)sender
|
||||
{
|
||||
MXKAccount* account = [MXKAccountManager sharedManager].activeAccounts.firstObject;
|
||||
|
||||
Reference in New Issue
Block a user