110 Commits

Author SHA1 Message Date
Mauro 0a77ba6c90 Swift format enforce isEmpty rule (#5843)
* swift format enforce isEmpty rule

* revert scheme

* use trailing closure
2026-07-06 15:39:16 +02: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
Doug fa67713726 Run SwiftFormat. 2026-05-27 17:11:42 +01:00
Mauro Romito 277f0cc5bc Fix for the content not updating after an edit, restore the usage of the content based identifier in the formatted body for components. 2026-05-26 15:54:07 +02:00
Mauro edd7130a97 Fix for overlapping timestamp when last block is not plainText (#5629)
* fix for the overlapping timestamp when the last block is not plain text

* remove id and use offset as iterator in the foearch of the components
2026-05-22 17:56:32 +02:00
Mauro 2462ddea85 Swift 6 migration for NSE (#5608)
* swift 6 support for NSE and concurrency safe implementations for it

* enforcing required Sendable conformance for swift 6 migration in NSE

* use Mutex to access the string builder cache

* use an async stream to update timeline items diffs

* fix for Sendable appHooks
2026-05-21 20:21:57 +02:00
Stefan Ceriu a89b33ee43 Remove more DTCoreText/Foundation references as they are no longer directly imported or used 2026-04-17 10:55:48 +03:00
Stefan Ceriu 37ee5c9c7e Fix a couple of warnings 2026-02-02 10:37:21 +02:00
Doug fa200cfedb Fix inline code being rendered as blocks. (#5017)
* Fix inline code being rendered as blocks.

And make blocks non-greedy as well as only scrolling when needed.

* Rename the bubble layout priorities.

* Add an InlineCode attribute so that the builder also strips links from these too.

* Split up the snapshot tests into individual cases.

This should make it much easier to see *what* has changed when regenerating.
2026-01-28 11:46:13 +00:00
Stefan Ceriu 23062901c0 Update files following swiftformat upgrade 2026-01-27 12:50:57 +02:00
Stefan Ceriu cf79cb9b01 Horizontally scrollable code blocks (#5001)
* Remove attributed string backed codeblock background color

* Add code block support to attributed string componentization

* Render code blocks within their own custom horizontal scroll view within the timeline

* Update preview test snapshots

* Introduce a attributed string component type instead of a 2 different booleans.
2026-01-26 12:39:55 +02:00
Stefan Ceriu 40b655bde6 Fix #4856, fix #4431 - Normalise HTML whitespaces using SwiftSoup's own text()/TextNode.normaliseWhitespace methods 2026-01-22 20:11:45 +02:00
Stefan Ceriu 8f9df47a2c Fix #4913 - Email addresses are detected as URLs 2026-01-12 20:49:31 +02:00
Doug eb0ff83bc5 Silence some warnings. (#4747) 2025-11-14 16:59:54 +00:00
Stefan Ceriu 14f8e9c1df Fixes #4683 - Add support for nested lists 2025-11-12 16:54:35 +02:00
Stefan Ceriu 0515d4495a Fixes #4713, fixes #4648 - Correctly handle span tags and data attributes. 2025-11-07 14:46:01 +02:00
Stefan Ceriu 8a0149b61c Rename the AttributedStringBuilder file name 2025-10-28 09:53:15 +00:00
Stefan Ceriu a4d99279fd Remove the first version of the AttributedString builder
Remvoe test stuf

# Conflicts:
#	ElementX/Sources/Other/HTMLParsing/AttributedStringBuilder.swift
#	ElementX/Sources/Other/HTMLParsing/AttributedStringBuilderV1.swift
#	ElementX/Sources/Other/HTMLParsing/DTHTMLElement+AttributedStringBuilder.swift
2025-10-28 09:53:15 +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
Stefan Ceriu 3d5901f90d Fixes #4529 - Order out of order ordered list ordering order 2025-09-26 10:48:56 +03:00
Stefan Ceriu a1038f0ffe Remove extra new line before list items and useless paragraph style 2025-09-16 17:54:46 +03:00
Stefan Ceriu f33d29b7e9 Add support for HTML img tags (their alts) on the new AttributedStringBuilder 2025-09-16 17:54:46 +03:00
Stefan Ceriu cf9df8a8e1 Reduce code block font point sizes by 10% on the new attributed string builder. 2025-09-16 17:54:46 +03:00
Stefan Ceriu 350abd0ad7 Fix traling new lines appearing in attributed string when sending text separated by 2 new lines. 2025-09-12 18:09:18 +03:00
Stefan Ceriu 81b4fe2a9f Preserve the formatting of parentless text nodes 2025-09-10 14:52:00 +03:00
Stefan Ceriu 92685fbb50 Automatically add insert a new line after headers 2025-09-10 14:52:00 +03:00
Stefan Ceriu e64fb3dc2a Fix the default point size used when applying symbolic traits. 2025-09-09 17:17:40 +01:00
Stefan Ceriu 5aa894c44a Add proper separated blockquotes fixtures and fix the tests. 2025-09-09 17:17:40 +01:00
Stefan Ceriu cd249040cd Mark code blocks with a special attribute and strip away links from them. 2025-09-09 17:17:40 +01:00
Stefan Ceriu 02462fb1a0 Limit H1, H2 to the H3 point size. 2025-09-09 17:17:40 +01:00
Stefan Ceriu a4ead7210a Invalidate caches on both attributed string builders at the same time 2025-09-09 17:17:40 +01:00
Stefan Ceriu 561c98c966 Adapt old AttributedStringBuilder tests to the new version and update the HTML fixtures 2025-09-09 17:17:40 +01:00
Stefan Ceriu 56175ac933 Correctly identify MSC4286 span values. 2025-09-09 17:17:40 +01:00
Stefan Ceriu 6058130c27 Add link attributes as URL values instead of String ones 2025-09-09 17:17:40 +01:00
Stefan Ceriu a1e64145a8 Remove matrix identifier attributes from code blocks 2025-09-09 17:17:40 +01:00
Stefan Ceriu d16f0ac8d0 Extract HTML fixtures out of the FormattedBoxyText previews. 2025-09-09 17:17:40 +01:00
Stefan Ceriu 3ac201ea2c Use the correct key when caching attributed string builder results. 2025-09-09 17:17:40 +01:00
Stefan Ceriu bc55cf4a10 Add support for ordered and unordered lists. 2025-09-09 17:17:40 +01:00
Stefan Ceriu af7a3a24f6 Add an initial version of the V2 AttributedStringBuilder 2025-09-09 17:17:40 +01:00
Stefan Ceriu 754c2f0fed Add a V2 version of the AttributedStringBuilder as a verbatim copy of the original one (for now) 2025-09-09 17:17:40 +01:00
Stefan Ceriu 5738b08a94 Move the initial attributed string builder to its own file 2025-09-09 17:17:40 +01:00
Stefan Ceriu 549a8de6a9 Rename detectPermalinks to addMatrixEntityPermalinkAttributesTo and move code around 2025-09-09 17:17:40 +01:00
Hugh Nimmo-Smith 0f518d3190 Support for experimental MSC4286 to not render external payment details (#4099)
Ref: https://github.com/matrix-org/matrix-spec-proposals/pull/4286
2025-06-03 12:22:14 +01:00
Stefan Ceriu 5af330cf6e Fix various small errors when running in the Swift 6 language mode (#4109)
* Fix various small errors when running in the Swift 6 language mode

* Make the `TargetConfiguration` run on the main actor.

* Fixed a comment

* Add a comment as to why we can't make the whole NSE a main actor.

* Fix the unit tests

* Fix `blankLinesAtStartOfScope` swiftformat error.
2025-05-13 11:43:47 +03:00
Mauro Romito aa35bfc245 added tests
improvement

improved

improvement

fixed
2025-03-17 16:21:09 +01:00
Mauro Romito 516892ed7b phishing alert implementation
we now check when building the string through the `AttributedStringBuilder` if a URL is actually hiding a different link, if so, we create a custom URL that contains both the external and the internal URL to advise the user through an Alert about the risk
2025-03-17 16:21:09 +01:00
Mauro 5f59e867b5 Room mentioning in the composer (#3868)
* refactored the suggestion item structure

to scale with the room pill

* Implemented a way for the rooms

to appear in the suggestions view for the RTE, however I need to add the pills to the composer and the compatibility with the plain text composer

* small code correction

* fix

* fixed a bug where the suggestion wasn't returning

the right suggestion type and the suggestion text properly

* implementation done!

also updated some tests, but we need more of them

* updated toolbar view model tests

* updated tests

* updated preview tests

* renamed the Avatars case for the suggestions
2025-03-06 11:32:37 +01:00
Mauro a2242c63e2 Render Room and Message Pills (#3809)
* added a way to render the room and the message

pills, but is WIP

* permalinks now get converted into pills!

* fixed an issue where room address mentions

were not adding a URL properly but a string

* updated tests

* c

* Revert "c"

This reverts commit 5c80252fa23dba7e4d44f2a07fbf1e9500e37c82.

* updated tests

* more tests

* created APIs to get a specific RoomSummary

given the id or the alias

* small mention builder improvement

* pr suggestions
2025-02-25 13:46:01 +00:00
manuroe 3950cac085 Dual licensing: AGPL + Element Commercial (#3657)
* New LICENSE-COMMERCIAL file

* Apply dual licenses: AGPL + Element Commercial to file headers

* Update README with dual licensing
2025-01-06 11:27:37 +01:00
Doug c264e9e590 Use the UIColors directly instead of wrapping the SwiftUI Colors. (#3324) 2024-09-24 12:24:03 +01:00