Skip to content

Conversation

@BillCarsonFr
Copy link
Member

Pull Request Checklist

Re-edition of #4521 rebased and cherry-picked

UI changes have been tested with:

  • iPhone and iPad simulators in portrait and landscape orientations.
  • Dark mode enabled and disabled.
  • Various sizes of dynamic type.
  • Voiceover enabled.

@BillCarsonFr BillCarsonFr requested a review from a team as a code owner October 23, 2025 07:25
@BillCarsonFr BillCarsonFr requested review from Velin92 and removed request for a team October 23, 2025 07:25
@BillCarsonFr BillCarsonFr changed the title Valere/call/notification lifetime 2 MSC4075 Use expirationTS to define the call ringing window #4521 v2 Oct 23, 2025
@BillCarsonFr BillCarsonFr added the pr-change for updates to an existing feature label Oct 23, 2025
@BillCarsonFr BillCarsonFr force-pushed the valere/call/notification_lifetime_2 branch from 29e86cf to 8d797df Compare October 23, 2025 07:34
private var declineListenerHandle: TaskHandle?

override init() {
init(callProvider: CXProviderProtocol? = nil, timeProvider: TimeProvider? = nil) {
Copy link
Member

@Velin92 Velin92 Oct 27, 2025

Choose a reason for hiding this comment

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

Where is this new init being called? I don't see its usage anywhere outside of the test

Comment on lines +72 to +89
self.timeProvider = timeProvider ?? TimeProvider(clock: ContinuousClock(), now: Date.init)

if let callProvider {
self.callProvider = callProvider
} else {
let configuration = CXProviderConfiguration()
configuration.supportsVideo = true
configuration.includesCallsInRecents = true

if let callKitIcon = UIImage(named: "images/app-logo") {
configuration.iconTemplateImageData = callKitIcon.pngData()
}

// https://stackoverflow.com/a/46077628/730924
configuration.supportedHandleTypes = [.generic]

self.callProvider = CXProvider(configuration: configuration)
}
Copy link
Member

Choose a reason for hiding this comment

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

Okay I see...
However I am not a huge fan of this approach, I would rather have the init() have non optional values but have always concrete values passed inside the init for the protocols.

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.

Let's wrap both the CXProvider and TimeProvider into a single mockable class maybe called ElementCallProviderProtocol and implement concretely what happens in the init right now by default into an ElementCallProvider that implements such protocol.
In the tests we would then use the ElementCallProviderProtocolMock

Thanks to this would not need then to use a TimeProvider struct , that uses that weird now closure and the any Clock, and neither to create a specific protocol for the CXProvider just to mock its behaviour, the wrapping class can take care of all of this.

Comment on lines +17 to +21
// Keep this class testable
struct TimeProvider {
var clock: any Clock<Duration>
var now: () -> Date
}
Copy link
Member

Choose a reason for hiding this comment

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

Not a fan, I think we had a unified class/protocol that can be mocked these could just be simple functions of such class that could be mocked.

@pixlwave pixlwave force-pushed the valere/call/notification_lifetime_2 branch from 8d797df to 4cb6883 Compare November 12, 2025 11:53
Copy link
Member

@pixlwave pixlwave left a comment

Choose a reason for hiding this comment

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

Sorry @BillCarsonFr, you've had 3 separate reviews with different comments on this one. I've rebased and added two small commits onto the end, otherwise it looks good to me.

So we'll merge this and then argue amongst ourselves about whether we want to change anything.

@sonarqubecloud
Copy link

@codecov
Copy link

codecov bot commented Nov 12, 2025

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
890 2 888 0
View the full list of 2 ❄️ flaky test(s)
RoomFlowCoordinatorTests::testThreadedEventRoutes()

Flake rate in main: 37.50% (Passed 30 times, Failed 18 times)

Stack Traces | 0s run time
XCTAssertEqual failed: ("0") is not equal to ("1") (UnitTests/Sources/RoomFlowCoordinatorTests.swift:246)
UserSessionFlowCoordinatorTests::testShareTextRouteWithRoom()

Flake rate in main: 37.25% (Passed 96 times, Failed 57 times)

Stack Traces | 3s run time
XCTAssertTrue failed (UnitTests/Sources/UserSessionFlowCoordinatorTests.swift:161)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@pixlwave pixlwave merged commit cd411b5 into develop Nov 12, 2025
7 of 9 checks passed
@pixlwave pixlwave deleted the valere/call/notification_lifetime_2 branch November 12, 2025 12:59
@pixlwave pixlwave changed the title MSC4075 Use expirationTS to define the call ringing window #4521 v2 MSC4075 Use expirationTS to define the call ringing window Nov 12, 2025
@pixlwave pixlwave changed the title MSC4075 Use expirationTS to define the call ringing window Use expiration timestamp to define the call ringing window Nov 12, 2025
@pixlwave pixlwave changed the title Use expiration timestamp to define the call ringing window Use the call expiration timestamp to define the ringing window Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-change for updates to an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants