mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-05 23:47:44 +02:00
Remove MXKAlert class use.
UIAlertController is directly used.
This commit is contained in:
@@ -29,11 +29,11 @@
|
||||
{
|
||||
// Display a gradient view above the screen
|
||||
CAGradientLayer* gradientMaskLayer;
|
||||
|
||||
|
||||
/**
|
||||
Current alert (if any).
|
||||
*/
|
||||
MXKAlert *currentAlert;
|
||||
UIAlertController *currentAlert;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -96,7 +96,7 @@
|
||||
|
||||
gradientMaskLayer.bounds = CGRectMake(0, 0, self.callContainerView.frame.size.width, self.callContainerView.frame.size.height + 20);
|
||||
gradientMaskLayer.anchorPoint = CGPointZero;
|
||||
|
||||
|
||||
// Define caller image view size
|
||||
CGSize size = [[UIScreen mainScreen] bounds].size;
|
||||
CGFloat minSize = MIN(size.width, size.height);
|
||||
@@ -127,7 +127,7 @@
|
||||
gradientMaskLayer.bounds = newBounds;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// The caller image view is circular
|
||||
self.callerImageView.layer.cornerRadius = self.callerImageViewWidthConstraint.constant / 2;
|
||||
self.callerImageView.clipsToBounds = YES;
|
||||
@@ -137,10 +137,10 @@
|
||||
{
|
||||
if (currentAlert)
|
||||
{
|
||||
[currentAlert dismiss:NO];
|
||||
[currentAlert dismissViewControllerAnimated:NO completion:nil];
|
||||
currentAlert = nil;
|
||||
}
|
||||
|
||||
|
||||
[super viewWillDisappear:animated];
|
||||
}
|
||||
|
||||
@@ -167,83 +167,91 @@
|
||||
{
|
||||
// There are unknown devices, check what the user wants to do
|
||||
__weak __typeof(self) weakSelf = self;
|
||||
|
||||
|
||||
MXUsersDevicesMap<MXDeviceInfo*> *unknownDevices = error.userInfo[MXEncryptingErrorUnknownDeviceDevicesKey];
|
||||
|
||||
[currentAlert dismiss:NO];
|
||||
currentAlert = [[MXKAlert alloc] initWithTitle:[NSBundle mxk_localizedStringForKey:@"unknown_devices_alert_title"]
|
||||
message:[NSBundle mxk_localizedStringForKey:@"unknown_devices_alert"]
|
||||
style:MXKAlertStyleAlert];
|
||||
|
||||
[currentAlert addActionWithTitle:[NSBundle mxk_localizedStringForKey:@"unknown_devices_verify"] style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) {
|
||||
if (weakSelf)
|
||||
{
|
||||
typeof(self) self = weakSelf;
|
||||
self->currentAlert = nil;
|
||||
|
||||
// Get the UsersDevicesViewController from the storyboard
|
||||
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
|
||||
UsersDevicesViewController *usersDevicesViewController = [storyboard instantiateViewControllerWithIdentifier:@"UsersDevicesViewControllerStoryboardId"];
|
||||
|
||||
[usersDevicesViewController displayUsersDevices:unknownDevices andMatrixSession:self.mainSession onComplete:^(BOOL doneButtonPressed) {
|
||||
|
||||
if (doneButtonPressed)
|
||||
{
|
||||
// Retry the call
|
||||
if (call.isIncoming)
|
||||
{
|
||||
[call answer];
|
||||
}
|
||||
else
|
||||
{
|
||||
[call callWithVideo:call.isVideoCall];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ignore the call
|
||||
[call hangup];
|
||||
}
|
||||
}];
|
||||
|
||||
// Show this screen within a navigation controller
|
||||
UINavigationController *usersDevicesNavigationController = [[UINavigationController alloc] init];
|
||||
[usersDevicesNavigationController pushViewController:usersDevicesViewController animated:NO];
|
||||
|
||||
[self presentViewController:usersDevicesNavigationController animated:YES completion:nil];
|
||||
|
||||
}
|
||||
}];
|
||||
|
||||
[currentAlert addActionWithTitle:[NSBundle mxk_localizedStringForKey:(call.isIncoming ? @"unknown_devices_answer_anyway":@"unknown_devices_call_anyway")]
|
||||
style:MXKAlertActionStyleDefault
|
||||
handler:^(MXKAlert *alert) {
|
||||
if (weakSelf)
|
||||
{
|
||||
typeof(self) self = weakSelf;
|
||||
self->currentAlert = nil;
|
||||
|
||||
// Acknowledge the existence of all devices
|
||||
[self startActivityIndicator];
|
||||
[self.mainSession.crypto setDevicesKnown:unknownDevices complete:^{
|
||||
|
||||
[self stopActivityIndicator];
|
||||
|
||||
// Retry the call
|
||||
if (call.isIncoming)
|
||||
{
|
||||
[call answer];
|
||||
}
|
||||
else
|
||||
{
|
||||
[call callWithVideo:call.isVideoCall];
|
||||
}
|
||||
}];
|
||||
}
|
||||
}];
|
||||
|
||||
currentAlert.mxkAccessibilityIdentifier = @"CallVCUnknownDevicesAlert";
|
||||
[currentAlert showInViewController:self];
|
||||
|
||||
[currentAlert dismissViewControllerAnimated:NO completion:nil];
|
||||
|
||||
currentAlert = [UIAlertController alertControllerWithTitle:[NSBundle mxk_localizedStringForKey:@"unknown_devices_alert_title"]
|
||||
message:[NSBundle mxk_localizedStringForKey:@"unknown_devices_alert"]
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
[currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"unknown_devices_verify"]
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
|
||||
if (weakSelf)
|
||||
{
|
||||
typeof(self) self = weakSelf;
|
||||
self->currentAlert = nil;
|
||||
|
||||
// Get the UsersDevicesViewController from the storyboard
|
||||
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
|
||||
UsersDevicesViewController *usersDevicesViewController = [storyboard instantiateViewControllerWithIdentifier:@"UsersDevicesViewControllerStoryboardId"];
|
||||
|
||||
[usersDevicesViewController displayUsersDevices:unknownDevices andMatrixSession:self.mainSession onComplete:^(BOOL doneButtonPressed) {
|
||||
|
||||
if (doneButtonPressed)
|
||||
{
|
||||
// Retry the call
|
||||
if (call.isIncoming)
|
||||
{
|
||||
[call answer];
|
||||
}
|
||||
else
|
||||
{
|
||||
[call callWithVideo:call.isVideoCall];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ignore the call
|
||||
[call hangup];
|
||||
}
|
||||
}];
|
||||
|
||||
// Show this screen within a navigation controller
|
||||
UINavigationController *usersDevicesNavigationController = [[UINavigationController alloc] init];
|
||||
[usersDevicesNavigationController pushViewController:usersDevicesViewController animated:NO];
|
||||
|
||||
[self presentViewController:usersDevicesNavigationController animated:YES completion:nil];
|
||||
|
||||
}
|
||||
|
||||
}]];
|
||||
|
||||
|
||||
[currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:(call.isIncoming ? @"unknown_devices_answer_anyway":@"unknown_devices_call_anyway")]
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
|
||||
if (weakSelf)
|
||||
{
|
||||
typeof(self) self = weakSelf;
|
||||
self->currentAlert = nil;
|
||||
|
||||
// Acknowledge the existence of all devices
|
||||
[self startActivityIndicator];
|
||||
[self.mainSession.crypto setDevicesKnown:unknownDevices complete:^{
|
||||
|
||||
[self stopActivityIndicator];
|
||||
|
||||
// Retry the call
|
||||
if (call.isIncoming)
|
||||
{
|
||||
[call answer];
|
||||
}
|
||||
else
|
||||
{
|
||||
[call callWithVideo:call.isVideoCall];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
}]];
|
||||
|
||||
[currentAlert mxk_setAccessibilityIdentifier:@"CallVCUnknownDevicesAlert"];
|
||||
[self presentViewController:currentAlert animated:YES completion:nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -357,7 +365,7 @@
|
||||
[[AppDelegate theDelegate] showRoom:self.mxCall.room.state.roomId andEventId:nil withMatrixSession:self.mxCall.room.mxSession];
|
||||
}
|
||||
|
||||
}];
|
||||
}];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user