Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for showing the native OS incoming call screen when starting new Element Calls #2862

Merged
merged 2 commits into from
May 24, 2024

Conversation

stefanceriu
Copy link
Member

@stefanceriu stefanceriu commented May 18, 2024

Handle incoming VoIP calls, show the native OS call screen as per https://developer.apple.com/documentation/callkit/sending-end-to-end-encrypted-voip-calls
Defined through matrix-org/matrix-spec-proposals#4075

Fixes #2876

Requires matrix-org/matrix-rust-sdk#3434

The way this works is the following:

  • the NSE receives the notification and decrypts it
  • checks if it's still time relevant (max 10 seconds old) and whether it should ring
  • otherwise it goes on to show it as a normal notification
  • if it should ring then it discards the notification but invokes reportNewIncomingVoIPPushPayload
    so that the main app can handle it
  • the main app picks this up in PKPushRegistry.didReceiveIncomingPushWith and
    CXProvider.reportNewIncomingCall to show the system UI and handle actions on it.

N.B. this flow works properly only when background processing capabilities are enabled

IMG_2432

Copy link

github-actions bot commented May 18, 2024

Warnings
⚠️ Please add a changelog.
⚠️ Some of the commits are missing ticket numbers. Please consider squashing all commits that don't have a tracking number.
⚠️ You seem to have made changes to views. Please consider adding screenshots.

Generated by 🚫 Danger Swift against 364d02e

@@ -143,6 +143,7 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
attributedString.removeAttribute(.foregroundColor, range: .init(location: 0, length: attributedString.length))
}

// swiftlint:disable:next cyclomatic_complexity
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we have a warning there? 🤔

Screenshot 2024-05-22 at 10 40 07

case senderDisplayName
}

let ElementCallServiceNotificationDiscardDelta = 10.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe let's put this into a ElementCallServiceConstants enum as a static let

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would that be better? 🤔

Copy link
Member

@Velin92 Velin92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM just some suggestions

@stefanceriu stefanceriu force-pushed the stefan/voipRinging branch 2 times, most recently from b973e44 to 219728c Compare May 24, 2024 10:11
@stefanceriu stefanceriu force-pushed the stefan/voipRinging branch from 219728c to 364d02e Compare May 24, 2024 11:48
Copy link

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link

codecov bot commented May 24, 2024

Codecov Report

Attention: Patch coverage is 1.69492% with 174 lines in your changes are missing coverage. Please review.

Project coverage is 74.07%. Comparing base (5860317) to head (364d02e).

Files Patch % Lines
...rces/Services/ElementCall/ElementCallService.swift 0.00% 114 Missing ⚠️
...urces/Screens/CallScreen/CallScreenViewModel.swift 0.00% 21 Missing ⚠️
...X/Sources/Screens/CallScreen/View/CallScreen.swift 0.00% 14 Missing ⚠️
ElementX/Sources/Application/AppCoordinator.swift 0.00% 13 Missing ⚠️
.../FlowCoordinators/UserSessionFlowCoordinator.swift 28.57% 5 Missing ⚠️
...ces/Screens/CallScreen/CallScreenCoordinator.swift 0.00% 5 Missing ⚠️
...Services/ElementCall/ElementCallWidgetDriver.swift 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2862      +/-   ##
===========================================
- Coverage    74.34%   74.07%   -0.28%     
===========================================
  Files          578      579       +1     
  Lines        40993    41116     +123     
===========================================
- Hits         30477    30456      -21     
- Misses       10516    10660     +144     
Flag Coverage Δ
unittests 61.77% <1.69%> (-0.18%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stefanceriu stefanceriu merged commit f8d0945 into develop May 24, 2024
9 checks passed
@stefanceriu stefanceriu deleted the stefan/voipRinging branch May 24, 2024 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] Ringing for incoming call
2 participants