mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-21 07:02:09 +02:00
Handle missing VoIP better (#323): Do not show expired call invites when resuming the app
This commit is contained in:
+15
-11
@@ -1837,6 +1837,14 @@ NSString *const kAppDelegateDidTapStatusBarNotification = @"kAppDelegateDidTapSt
|
|||||||
[noCallSupportAlert dismiss:NO];
|
[noCallSupportAlert dismiss:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MXCallInviteEventContent *callInviteEventContent = [MXCallInviteEventContent modelFromJSON:event.content];
|
||||||
|
|
||||||
|
// Sanity and invite expiration checks
|
||||||
|
if (!callInviteEventContent || event.age >= callInviteEventContent.lifetime)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MXUser *caller = [mxSession userWithUserId:event.sender];
|
MXUser *caller = [mxSession userWithUserId:event.sender];
|
||||||
NSString *callerDisplayname = caller.displayname;
|
NSString *callerDisplayname = caller.displayname;
|
||||||
if (!callerDisplayname.length)
|
if (!callerDisplayname.length)
|
||||||
@@ -1862,18 +1870,14 @@ NSString *const kAppDelegateDidTapStatusBarNotification = @"kAppDelegateDidTapSt
|
|||||||
[noCallSupportAlert addActionWithTitle:[NSBundle mxk_localizedStringForKey:@"reject_call"] style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) {
|
[noCallSupportAlert addActionWithTitle:[NSBundle mxk_localizedStringForKey:@"reject_call"] style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) {
|
||||||
|
|
||||||
// Reject the call by sending the hangup event
|
// Reject the call by sending the hangup event
|
||||||
MXCallInviteEventContent *callInviteEventContent = [MXCallInviteEventContent modelFromJSON:event.content];
|
NSDictionary *content = @{
|
||||||
if (callInviteEventContent)
|
@"call_id": callInviteEventContent.callId,
|
||||||
{
|
@"version": @(0)
|
||||||
NSDictionary *content = @{
|
};
|
||||||
@"call_id": callInviteEventContent.callId,
|
|
||||||
@"version": @(0)
|
|
||||||
};
|
|
||||||
|
|
||||||
[mxSession.matrixRestClient sendEventToRoom:event.roomId eventType:kMXEventTypeStringCallHangup content:content success:nil failure:^(NSError *error) {
|
[mxSession.matrixRestClient sendEventToRoom:event.roomId eventType:kMXEventTypeStringCallHangup content:content success:nil failure:^(NSError *error) {
|
||||||
NSLog(@"[AppDelegate] enableNoVoIPOnMatrixSession: ERROR: Cannot send m.call.hangup event. Error: %@", error);
|
NSLog(@"[AppDelegate] enableNoVoIPOnMatrixSession: ERROR: Cannot send m.call.hangup event. Error: %@", error);
|
||||||
}];
|
}];
|
||||||
}
|
|
||||||
|
|
||||||
__strong __typeof(weakSelf)strongSelf = weakSelf;
|
__strong __typeof(weakSelf)strongSelf = weakSelf;
|
||||||
strongSelf->noCallSupportAlert = nil;
|
strongSelf->noCallSupportAlert = nil;
|
||||||
|
|||||||
Reference in New Issue
Block a user