Commit Graph

169 Commits

Author SHA1 Message Date
Jared L cff46137b9 Report user presence on app lifecycle transitions (#5838)
* Report user presence on app lifecycle transitions

Adds a PresenceReporter driven by the app lifecycle handlers and the sharePresence setting: online when foreground-active and sharing, unavailable when backgrounded and sharing, offline when not sharing. Sends are immediate, deduped, and serialized latest-wins. Background app refresh and the NSE seed the process presence to offline so their sync requests carry no presence side effect. Presence rides on the SDK's process-global state, so every sync path is covered without touching sync lifecycle.

Signed-off-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Add presence reporter tests

Pins the presence reporter invariants: the never-online sweep with sharing off, an immediate online send on foreground-active, dedupe of repeated states, latest-wins ordering of serialized sends, and the NSE offline seed.

Signed-off-by: Jared L <48422312+lhjt@users.noreply.github.com>

* wip: address review comments

Signed-off-by: Jared L <48422312+lhjt@users.noreply.github.com>

* refactor: remove obsolete presence heartbeat

Remove the shared activity snapshot, heartbeat refresh, and notification-extension freshness policy while retaining the session-scoped presence service and its serialized lifecycle reporting. Restore the NSE's intermediate one-time offline seed so the cleanup remains buildable ahead of the final sync-presence correction.

Signed-off-by: Jared L <48422312+lhjt@users.noreply.github.com>

* fix: make notification extension presence-neutral

Configure the built NSE client with offline sync presence without sending an immediate presence update. Keep notification setup non-fatal when presence configuration fails and remove the temporary production test seam.

Signed-off-by: Jared L <48422312+lhjt@users.noreply.github.com>

* chore: restore application lifecycle logging

Restore the pre-existing foreground lifecycle diagnostics that were removed during the presence refactor. Keep presence reporting session-scoped and clarify that background refresh configures the client's sync presence without an immediate update.

Signed-off-by: Jared L <48422312+lhjt@users.noreply.github.com>

---------

Signed-off-by: Jared L <48422312+lhjt@users.noreply.github.com>
2026-07-22 15:23:36 +01:00
Doug a6466e80e0 Update the SDK and use RoomHero.status and subscribeToOwnProfile. (#5905)
* Update the SDK and hook up the status from Room Heroes.

Also start requesting profiles via sss when the feature flag is enabled.

* Add support for subscribing to your own profile.
2026-07-22 12:18:02 +01:00
Mauro 9093631f8b Periphery cleanup (#5893) 2026-07-20 11:16:11 +02:00
Doug 85f28d017d Update the SDK and handle API breaks. (#5871)
* Update the SDK and handle API breaks.

* Rename sdkUserThing to rustUserThing for consistency.

* Add user status ClientProxy methods.

* Rename UserStatus.UserSet to UserStatus.Raw.
2026-07-14 16:35:37 +01:00
Stefan Ceriu 5851100f07 Expose a global search service from the client
Wrap the SDK's SearchService in a SearchServiceProxy that publishes typed
message results and paginates on demand, expose it on the ClientProxy, and
enable the search index store on the session. Also opens up the timeline item
factory's message content builder so the proxy can reuse it.
2026-07-03 13:39:45 +03:00
Mauro 5ea4b46604 Content Scanner Service (#5826)
* implemented the content scanner service with caching and a way to use in the state store context

* fix swiftformat comment enforcing

* pr suggestions
2026-07-02 17:12:39 +02:00
Doug ace05b97d0 Combine the user's own display name/avatar into a single profile.
This is in preparation for adding the user status fields into the profile.
2026-07-02 13:09:34 +01:00
Doug b8860baf49 Rename SearchUsersResultsProxy to SearchUsersResults. It also proxies nothing. 2026-07-02 13:09:34 +01:00
Doug 3ef66cdd05 Rename UserProfileProxy to UserProfile. It's a pure struct and proxies nothing.
Also remove the redundant `userID` property given `id` already exists (for Identifiable conformance).
2026-07-02 13:09:34 +01:00
Stefan Ceriu 0bd32d24fd Switch to a custom HomeserverReachability instead of different publishers 2026-06-24 20:49:49 +03:00
Stefan Ceriu 3ccaa04554 Don't show the server unreachable banner while the client is suspended
homeserverReachabilityPublisher now reports unreachable while suspended so media loading parks instead of failing against a closed store. The reachability banner was keyed off the same publisher, so pausing the client would surface a spurious "Server unreachable" message.

Expose a separate homeserverConnectivityPublisher derived from the sync service state alone (it stays reachable while suspended) and key the banner off that, keeping the suspend-aware publisher for gating work that needs an open store.
2026-06-24 20:49:49 +03:00
Mauro a520d94760 Swift 6 Migration (#5733)
* Enable Swift 6.2 with default main actor isolation for the app target

Turn on SWIFT_VERSION 6.2, SWIFT_APPROACHABLE_CONCURRENCY and SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor for the ElementX target, matching the NSE and Share Extension (which already use 6.2 without the main actor default).

# Conflicts:
#	ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

* Update the code generation templates for Swift 6

Emit nonisolated/@unchecked Sendable mocks and nonisolated string enums, and mark async mock methods @concurrent so they keep suspending like the real implementations (otherwise intermediate states are unobservable in tests). Includes the regenerated mocks and strings.

# Conflicts:
#	ElementX/Sources/Mocks/Generated/GeneratedMocks.swift

* Make the data layer and services nonisolated and Sendable

Annotate the value-type models, Rust SDK proxy wrappers, timeline item graph, settings, logging and NSE-shared types as nonisolated, and conform the service protocols to Sendable so their existentials can cross isolation boundaries. These types run off the main actor and no longer inherit the target's default main actor isolation.

* Adopt the new isolation across call sites, mocks and signatures

Update call sites, closure signatures and mock configuration helpers to match the nonisolated/Sendable data layer, including the main actor isolated mock inits and the @Sendable filter on recentlyVisitedRooms.

^ Conflicts:
^	ElementX/Sources/Services/SecureBackup/SecureBackupController.swift

* Remove redundant @MainActor annotations

With the app target defaulting to main actor isolation, the explicit @MainActor on view models, coordinators, views and their protocols is no longer required.

* Fix concurrency hotspots surfaced by the migration

Resolve the room summary main-thread deadlock by moving diff processing onto AsyncStreams, add the SDKListener.onMainActor FIFO bridge for SDK callbacks, hop KVO/timer/UIKit callbacks to the main actor via assumeIsolated, add isolated deinits, and apply the few justified nonisolated(unsafe) escapes for queue-confined Apple APIs.

* Fix the unit tests for Swift 6 concurrency

Hop the waitForConfirmation body onto the caller's actor (Swift Testing runs confirmation closures off-actor), and adjust the affected suites and async signatures.

* offload diffs on concurrent threads instead of main actor

* make room info protocols sendable

* use a task group for fetching data so that everything runs concurrently in the TextRoomTimelineView when getting the preview.

* use the generic onMainActor implementation, which already makes a stream and send the continuation on the main actor.

* small pr comments issues being addressed

* update enterprise

* Update StaticCode to 1.1.0 and specify the required Swift isolation.

* fix ElementCallServiceTests

* update enterprise

* re-generate mocks

* update enterprise

* enterprise new code conformed to swift 6

---------

Co-authored-by: Doug <douglase@element.io>
2026-06-18 17:55:31 +02:00
Stefan Ceriu 02b114d40b Make ClientProxy.pauseServices async and drop its completion block
`pauseServices` took a completion block only because it was historically
called from `deinit`, which can't await (the SE-0371 note). `deinit` now
stops the sync itself, so the sole remaining caller is the AppCoordinator,
which can await instead.

Make `pauseServices` async and update the AppCoordinator background-task
and lifecycle call sites to await it, calling the OS-facing completions
(endBackgroundTask / setTaskCompleted) afterwards. This also removes the
`MainActor.assumeIsolated` workaround — awaiting a @MainActor method hops
onto the main actor cleanly — and fixes a latent bug where a nil `self` in
the background app refresh expiration handler would skip setTaskCompleted.
2026-06-17 15:17:06 +03:00
Stefan Ceriu 713af64fc6 Switch the clientProxy's start/stop sync semantics to service pausing and resuming to better match underlying behaviors 2026-06-05 14:54:36 +03:00
Stefan Ceriu e4a7322250 Expose the async nature of the ClientProxy startSync method 2026-06-05 14:54:36 +03:00
Doug fa67713726 Run SwiftFormat. 2026-05-27 17:11:42 +01:00
Mauro 6c0aaa7a58 Invite the DM recipient to a new room (#5588)
* handle the details to invite users flow.

* implemented the room creation in the invite screen, and its dismissal + navigaton to the newly created room

* updated preview and unit tests

* pr suggestions
2026-05-18 10:08:07 +02:00
Stefan Ceriu f70182d09a Add a developer option button for marking every single room as read (#5582)
This will use an underlying SDK method and send a private read receipt plus a fully read marker in every single room the user is part of. It will most likely be a long operation that will get rate limited so the task is set to run detached for as long as it takes.
2026-05-13 19:46:52 +03:00
Mauro 76f744b9c4 Live Location Sharing - handle server echoes (#5514)
* Track active live location sessions by ID instead of timeout.

# Conflicts:
#	ElementX/Sources/Services/Location/LiveLocationManager.swift

* implemented a system to promote starting session to active sesessions to send locations at the right time, and a system to remove a local session if it's handled by an external device.

* pr suggestions

---------

Co-authored-by: Doug <douglase@element.io>
2026-04-30 13:18:36 +00:00
Doug eef4a2497a Add support for homeserver capabilities to disable the UserDetailsEditScreen UI. (#5421)
Add support for homeserver capabilities to disable editing your user profile.

Also updates editable avatar size/formatting to match the latest Figma at the same time.
2026-04-17 11:52:46 +01:00
Stefan Ceriu 23062901c0 Update files following swiftformat upgrade 2026-01-27 12:50:57 +02:00
Mauro Romito 7d47a290ee pr suggestion rename isPrivate to isVisibilityPrivate 2026-01-22 16:40:25 +01:00
Mauro Romito 204fa5b0ca started implementing the logic behind the access type and the creation parameters 2026-01-22 16:40:25 +01:00
Doug cde9714a83 Implement the SpaceAddRoomsScreen. (#4951)
* Update proxies ready for adding rooms to a space.

- ClientProxy.recentlyVisitedRooms to take a filter and to return room proxies.
- Expose SpaceServiceProxy.addChildToSpace.

* Implement the SpaceAddRoomsScreen.

* Fix the designs of the selected carousels.

Add more snapshot tests for inviting users.

* Fix for screen using wrong avatar size.
2026-01-14 12:07:57 +00:00
Mauro 4cfedefcca Create room redesign and refactor (#4942) 2026-01-12 17:49:31 +00:00
Doug 7cb472a4f7 Add tests for linking a new device. (#4934)
* Replace GrantLoginWithQrCodeHandlerSDKMock with LinkNewDeviceServiceMock.

Add tests for all initial states on the QRCodeLoginScreen.

* Add tests for linking both mobile and desktop devices.

* Add UI tests for linking a new device.

* Don't show the Link Desktop Computer button when running on macOS.

This mirrors the decision to hide the Sign In With QR Code button on the start screen.
2026-01-09 13:10:14 +00:00
Stefan Ceriu 53a20f2a89 Display the store sizes under the developer options menu 2025-12-19 11:12:36 +02:00
Stefan Ceriu 8a1d0fe8b1 Perform client store optimizations when migrating versions. 2025-12-19 11:12:36 +02:00
Doug 93dfc84a57 Add a service and flow coordinator for the LinkNewDevice feature. (#4859)
* Add a LinkNewDeviceService that exposes the SDK's grant QR code login methods.

* Add a flow coordinator for linking a new device.

Changes the presentation too.
2025-12-15 14:44:26 +00:00
Doug 4ea1aaecdd Add a Link New Device screen (behind a feature flag). (#4811) 2025-12-11 11:45:23 +00:00
Doug f2607affd2 Adopt the new latest event API. (#4779) 2025-11-25 11:52:48 +00:00
Doug 51a9d8b56b Only offer to verify if a cross-signed device is available and improve the UX whilst waiting. (#4710)
* Only offer to verify if a cross-signed device is available

* Wait until we know which verification options are available before showing them.

---------

Co-authored-by: Hubert Chathi <hubertc@matrix.org>
2025-11-07 12:10:12 +00:00
Mauro f7dd9cdcf8 Update copyright holding and dates (#4640)
* Update copyright holding and dates

* compound IDE Macros updated

* update copyright

* update copyrights done

* update templates and README
2025-10-21 14:34:56 +02:00
Doug c2ac60f1e6 Add support for joining rooms from a space. (#4501)
* Add support for joining rooms from a space.

Doesn't yet handle the Join button 🤔

* Handle the join button for both rooms and spaces.

Also refactor more instances of spaceRoom to spaceRoomProxy.
2025-09-11 16:41:19 +01:00
Doug 19189bec06 Add a migration to expire sync sessions so that m.space.* state is up to date. (#4482) 2025-09-09 15:35:32 +01:00
Doug 2f2e6f6226 Revert weak media provider (#4483)
* Revert "Address the real lifetime issue of the SDK's `Client` by making `Context.mediaProvider` weak. (#4466)"

This reverts commit c794144ef1.

* Better docs.
2025-09-08 17:48:58 +01:00
Doug 90504d89c8 Use the SDK's offline detection everywhere (except for restarting the sync loop). (#4472)
* Use the SDK's offline state to drive the offline indicator.

* Only use network reachability for restarting the sync loop, use the homeserver reachability for requests.

* Add a separate indicator to distinguish when the server is unreachable but the device is online.
2025-09-08 12:18:02 +00:00
Doug c794144ef1 Address the real lifetime issue of the SDK's Client by making Context.mediaProvider weak. (#4466)
This reverts commit 927aea4bfe.
2025-09-05 17:18:14 +00:00
Doug 927aea4bfe Workaround: Hold a weak reference to the SDK's Client in MediaLoader so it can be released when clearing the cache. 2025-09-03 17:39:16 +01:00
Doug d119964d50 Space flow improvements. (#4430)
* Space flow improvements

- Use a state machine to select a space.
- Add a SpaceFlowCoordinator for recursively presenting subspaces.
- Get the spaceRoomListProxy when tapping on the space so we can indicate failures.
- Fix the total room count in SpaceListScreen.

* Refactor spaceRoom → spaceRoomProxy.

* Add a UI test for the Spaces flow.
2025-08-22 15:49:47 +01:00
Doug 4d365e3fd7 Remove unnecessary slidingSyncVersion calls.
It's all native now :D
2025-07-30 14:42:59 +01:00
Doug 5762e1c537 Stop showing the sliding sync proxy alert to any remaining users.
The session will simply fail to restore and the restoration token deleted.
2025-07-30 14:42:59 +01:00
Doug 75bc26d20b Use the maxUploadSize in the media upload screen. (#4359)
* Fix a bug where some files sizes were sent as 0.

* Make FileManger.sizeForItem(at:) a UInt.

The docs specifically say that FileAttributeKey.size returns an unsigned long long so I have no idea why we were returning a Double here…

* Add the maxMediaUploadSize property on ClientProxy.

* Use the maxUploadSize to set a target video size and to show a file too big error.

* Refactor media upload parameter order.
2025-07-29 12:18:53 +01:00
Stefan Ceriu bd49500fa1 Fix various new SDK breaking changes. 2025-07-24 14:55:34 +03:00
Doug f655fbc28b Show an alert when entering an account provider that requires Element Pro. (#4326) 2025-07-17 12:41:26 +00:00
Doug 5b3e045e3c Expose isLiveKitRTCSupported on the ClientProxy. (#4238) 2025-06-23 11:21:36 +01:00
Mauro Romito ec2a30c492 show alert when trying to accept invalid invites 2025-06-20 10:07:58 +02:00
Mauro aef91b5bc9 Handle media previews and invite avatars through the account data (#4142)
* added account data media display policy handling to NSE

* pr suggestions

* update compound

* code improvement
2025-05-28 19:51:34 +02:00
Mauro Romito 0f53ad6724 updated SDK and improved report flow
the report flow is now based on the matrix version and the new one will only be used if the SDK checks if the server supports it.
2025-04-30 11:41:19 +02:00
Doug 1557054753 Simplify authentication logic
matrix.org now supports MAS so we don't need the web registration helper anymore.
2025-04-11 11:22:39 +01:00