Merge pull request #4401 from simonwiedmer/dial_pad_home

Add 'Dial pad' option to plus menu on homescreen
This commit is contained in:
ismailgulek 2021-06-09 13:55:58 +03:00 committed by GitHub
commit 7718258750
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 61 additions and 0 deletions

View file

@ -8,6 +8,7 @@ Changes to be released in next version
* MXRoomSummary: Adapt room summary changes on MatrixSDK (#4360). * MXRoomSummary: Adapt room summary changes on MatrixSDK (#4360).
* EncryptionKeyManager: Create keys for room last message data type. * EncryptionKeyManager: Create keys for room last message data type.
* Integrated FLEX for debug builds. * Integrated FLEX for debug builds.
* Add dial pad for PSTN capable servers to menu on homescreen
🐛 Bugfix 🐛 Bugfix
* RoomDirectCallStatusBubbleCell: Fix crash when entering a DM after a call is hung-up/rejected while being answered (#4403). * RoomDirectCallStatusBubbleCell: Fix crash when entering a DM after a call is hung-up/rejected while being answered (#4403).

View file

@ -72,6 +72,8 @@
@property (nonatomic, strong) SpaceFeatureUnavailablePresenter *spaceFeatureUnavailablePresenter; @property (nonatomic, strong) SpaceFeatureUnavailablePresenter *spaceFeatureUnavailablePresenter;
@property (nonatomic, strong) CustomSizedPresentationController *customSizedPresentationController;
@end @end
@implementation RecentsViewController @implementation RecentsViewController
@ -1796,6 +1798,24 @@
}]]; }]];
if (self.mainSession.callManager.supportsPSTN)
{
[currentAlert addAction:[UIAlertAction
actionWithTitle:NSLocalizedStringFromTable(@"room_open_dialpad", @"Vector", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
if (weakSelf)
{
typeof(self) self = weakSelf;
self->currentAlert = nil;
[self openDialpad];
}
}]];
}
[currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"]
style:UIAlertActionStyleCancel style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action) { handler:^(UIAlertAction * action) {
@ -1815,6 +1835,46 @@
[self presentViewController:currentAlert animated:YES completion:nil]; [self presentViewController:currentAlert animated:YES completion:nil];
} }
- (void)openDialpad
{
DialpadViewController *controller = [DialpadViewController instantiateWithConfiguration:[DialpadConfiguration default]];
controller.delegate = self;
self.customSizedPresentationController = [[CustomSizedPresentationController alloc] initWithPresentedViewController:controller presentingViewController:self];
self.customSizedPresentationController.dismissOnBackgroundTap = NO;
self.customSizedPresentationController.cornerRadius = 16;
controller.transitioningDelegate = self.customSizedPresentationController;
[self presentViewController:controller animated:YES completion:nil];
}
- (void)dialpadViewControllerDidTapCall:(DialpadViewController *)viewController withPhoneNumber:(NSString *)phoneNumber
{
if (self.mainSession.callManager && phoneNumber.length > 0)
{
[self startActivityIndicator];
[viewController dismissViewControllerAnimated:YES completion:^{
MXWeakify(self);
[self.mainSession.callManager placeCallAgainst:phoneNumber withVideo:NO success:^(MXCall * _Nonnull call) {
MXStrongifyAndReturnIfNil(self);
[self stopActivityIndicator];
self.customSizedPresentationController = nil;
// do nothing extra here. UI will be handled automatically by the CallService.
} failure:^(NSError * _Nullable error) {
MXStrongifyAndReturnIfNil(self);
[self stopActivityIndicator];
}];
}];
}
}
- (void)dialpadViewControllerDidTapClose:(DialpadViewController *)viewController
{
[viewController dismissViewControllerAnimated:YES completion:nil];
self.customSizedPresentationController = nil;
}
- (void)createNewRoom - (void)createNewRoom
{ {
// Sanity check // Sanity check