Commit Graph

75 Commits

Author SHA1 Message Date
Doug
97048b750a 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
04053ae69b Update files following swiftformat upgrade 2026-01-27 12:50:57 +02:00
Stefan Ceriu
11af2bb0ca 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
0ede9fffa0 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
ed126bf2b7 Fix #4913 - Email addresses are detected as URLs 2026-01-12 20:49:31 +02:00
Doug
15720558ef Silence some warnings. (#4747) 2025-11-14 16:59:54 +00:00
Stefan Ceriu
2f9275a0ef Fixes #4683 - Add support for nested lists 2025-11-12 16:54:35 +02:00
Stefan Ceriu
d9c885c48c Fixes #4713, fixes #4648 - Correctly handle span tags and data attributes. 2025-11-07 14:46:01 +02:00
Stefan Ceriu
4448dc94a6 Rename the AttributedStringBuilder file name 2025-10-28 09:53:15 +00:00
Stefan Ceriu
ec15d06154 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
6160c44d67 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
9bbff69c69 Mark code blocks with a special attribute and strip away links from them. 2025-09-09 17:17:40 +01:00
Stefan Ceriu
dead40d2c4 Invalidate caches on both attributed string builders at the same time 2025-09-09 17:17:40 +01:00
Stefan Ceriu
23a5d50067 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
bd60a50a7e Move the initial attributed string builder to its own file 2025-09-09 17:17:40 +01:00
Stefan Ceriu
e8cecd448d Rename detectPermalinks to addMatrixEntityPermalinkAttributesTo and move code around 2025-09-09 17:17:40 +01:00
Mauro Romito
81031b12a7 added tests
improvement

improved

improvement

fixed
2025-03-17 16:21:09 +01:00
Mauro Romito
4843bf0f01 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
3d856ce205 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
431828828d 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
c29f4cc9b4 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
bb1686f501 Use the UIColors directly instead of wrapping the SwiftUI Colors. (#3324) 2024-09-24 12:24:03 +01:00
Stefan Ceriu
89eae00479 Switch license to AGPL (#3237)
* Switch license file to AGPL

* Update file copyright headers

* Update the default project file header
2024-09-06 16:34:30 +03:00
Stefan Ceriu
1456c57da0 Ignore punctuation characters at the end of detected links
- fixes permalink handling when that's the case
- prevents deep linking loops between nightly and the main app
2024-06-19 16:10:31 +03:00
Stefan Ceriu
70bf5d0e8d Add support for showing the native OS incoming call screen when starting new Element Calls 2024-05-24 15:32:56 +03:00
Doug
87679329d8 Support tapping Matrix URIs in messages. (#2828) 2024-05-10 15:22:22 +01:00
Stefan Ceriu
62e1ec0464 Prevent links from showing up in color within code blocks, simplify foreground color stripping 2024-05-10 14:07:43 +03:00
Stefan Ceriu
4e670d1502 Reorder AttributedStringBuilder methods based on the order they're called in. 2024-05-09 18:48:51 +03:00
Stefan Ceriu
3bab870e5b Fixes #2807 - Stop inserting string attributes to code blocks. 2024-05-09 18:48:51 +03:00
Stefan Ceriu
addd5827ea Plain composer suggestions and pills (#2751)
* Move ComposerToolbar files to withing the RoomScreen folder (as it's not a screen on its own)

* Switch the plain composer to NSAttributedStrings

* Enable suggestions on the plain composer

* Introduce a new `MatrixUserDisplayName` attributed string attributed and use it for mention building

* Implement mention pill rendering and sending on the plain message composer

* Fix plain composer snapshot tests

* Fix broken formatting options layout

* Add clarifying comment.
2024-05-03 10:06:16 +01:00
Doug
e90fcd4b4e Permalink Tweaks 2 (#2766)
* Missing changelog.

* Parse bare room aliases as permalinks.

Update the SDK.

* Fix tapping the same permalink twice.

Add a test.

Don't clear the focussed item when reaching the bottom of the timeline.

* Make sure sending a message returns to live.
2024-04-29 17:32:16 +01:00
Stefan Ceriu
8be236883d Adop the new SDK permalink detector and user builder 2024-04-12 18:04:41 +03:00
Stefan Ceriu
21c3ab12c7 Fix localization bundle and attributed string builder crashes on unsynchronised access to their internal caches 2024-02-15 12:20:37 +02:00
Mauro
47e419a6a6 Fixed the link color and improved link dection in code blocks (#2466) 2024-02-14 17:45:23 +01:00
Mauro
84b0f967e8 Removing Dead Code part 1 (#2234) 2023-12-13 09:51:57 +01:00
Mauro
3ebe757583 Fix for line breaks (#2224) 2023-12-11 15:43:31 +00:00
Stefan Ceriu
b372714d73 Fixes #2117 - Disable underlining for links defined in the html body:
- https://github.com/Cocoanetics/DTCoreText/issues/898
2023-11-20 13:46:40 +02:00
Mauro
36cf0a0442 Converting detected plain text mentions into permalinks (#1963)
* it works but a test fail because URL(string) fails

* done!

* let
2023-10-27 09:31:01 +02:00
Mauro
8754cee368 Replies now display mentions with @displayname (#1957)
* reply with mentions

* fixed a bug and wrote a test for it

* error message
2023-10-25 18:39:18 +02:00
Mauro
8497768979 Render pills in RTE (#1874)
* for now this can only work locally

* works

* added a test

* updated RTE

* revert package

* pr suggestion

* reverting package versions

* better naming
2023-10-11 16:40:52 +02:00
Mauro
bceebff6cb Handle tap on user mentions (#1850)
* user mention routing implemented

* more tests

* better naming

* fixed a test
2023-10-03 10:11:05 +02:00
Mauro
981a51e61b Fixed a bug that prevented the mentions to be shown as plain text in the room list cell (#1835)
* fix a bug that made the room list not render mentions as plain text

* better naming
2023-09-29 14:49:20 +00:00
Mauro
38e824d74d @room pill (#1834)
* all users mention pill + red higlight for own mentions

* more tests

* changelog

* removed useless if let
2023-09-29 15:40:31 +02:00
Mauro
4c5e6cfd19 Pill View (#1797)
* provider can now check the current session

* More testable code

* created the test condition

* it works but not always not sure why, need to dig deeper

* sadly we need to use textkit 1 to solve this issue

* removed developer option screen test

* this experimental solution kinda works but I need a way to pill recomputation is weird

* format

* display improvement

* better and faster solution

* pilished the code

* better coloring

* swift format

* just need to solve the caching issue

* fix caching issue

* tests done!

* changelog

* pr comments addressed

* all pr comments addressed

* docs

* line lenght

* updated tests and fixed a parsing permalink issue

* MentionBuilder

* pr comments

* swiftformat

* code blocks should not have links

* Update ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift

Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>

* Update ElementX/Sources/Services/Client/ClientProxy.swift

Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>

* Update UnitTests/Sources/AttributedStringBuilderTests.swift

Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>

* Update ElementX/Sources/UITests/UITestsAppCoordinator.swift

Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>

* Update ElementX/Sources/Other/Pills/PillAttachmentViewProvider.swift

Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>

* Update ElementX/Sources/Other/Pills/MentionBuilder.swift

Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>

* pr comments

* swiftformat

---------

Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>
2023-09-27 17:27:07 +00:00
Alfonso Grillo
8f948032ee Composer and RTE polish (#1719)
* Move link button

* Always show indent buttons

* Fix code blocks and quote block styles

* Fix code blocks and quotes style

* Update composer attachment icon

* Fix send message icon

* Fix composer border

* Fix rte border

* Update RTE button assets

* Update close rte icon

* Refactor RTE and composer layout

* more padding fixes

* Update compound

* Update WysiwygComposer to 2.11.0

* Fix ui tests

* Fix composer bottom padding

* Update snapshot tests
2023-09-18 14:11:22 +00:00
Stefan Ceriu
3922be6900 Add default schemes for detected links that don't have any 2023-09-07 14:56:39 +03:00
Mauro
eabdd2c3f2 MessageText component (#1521)
* MessageText component

* swiftformat

* fix swift format being a bit crazy

* link tapping support

* new test + fix for font + dynamic support

* fix for blockquote issue.

* code improvement

* small code improvement and fixed tests not working due to weird swiftformat behaviour

* fix boost emoji

* updated swiftformat

* better testing

* UI tests updated

* fixing the issue with the cache overriding the size category changes

* whitespaces

* appropriate color + better info plist parsing

* cleaned the code and fixed links

* tapping link fixes

* list bug fix

* ui tests regenerated
2023-08-22 10:14:23 +00:00
Stefan Ceriu
92cd50ed76 Fixes #1418 - Preserve new lines when parsing html strings 2023-08-08 17:37:11 +03:00
Stefan Ceriu
87d880ac88 Fixes #1270 - Parse the latest room message instead of directly using the body. Add an app wide attributed string caching layer. 2023-08-08 17:02:37 +03:00
Doug
2048de9d18 Use generated UIColors everywhere. (#1405)
- Fix destructive buttons in the menu.
2023-07-26 11:21:34 +01:00