-
Notifications
You must be signed in to change notification settings - Fork 10
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
#2414 Show links to remote images #2422
Conversation
@sosnovsky Could you check current implementation if it's implemented correctly? |
Implementation looks correct, but I noticed a small bug - some characters are rendered in wrong encoding: it's message from github about your comment, in original message there is in original message there is a space: And another issue is that previous thread replies are not hidden with 3-dots button, it causes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found another issue:
- send plain unencrypted message from Gmail web
- try to reply to it from FlowCrypt iOS app
- compose screen will show html code of original message, not plain text
Also in unencrypted threads disappeared >
symbols for previous replies (I'll send comparison screenshots to your email)
Thank you. Nice catch 👍 . |
For this one do we have to display
|
let's show |
OK |
@sosnovsky, wrestling with HTML because we need to pluck out img tags from an HTML string and turn them into links. I’m hitting a snag with parsing quotes, though. Here are a couple of solutions I'm considering:
What do you think? Got any slicker ideas? flowcrypt-ios/FlowCrypt/Functionality/Mail Provider/Message Provider/ProcessedMessage.swift Line 116 in c8f7464
flowcrypt-ios/FlowCrypt/Functionality/Mail Provider/Message Provider/ProcessedMessage.swift Line 128 in c8f7464
|
I've checked and found that in the Android version, the app sanitizes the HTML and directly displays it in the EmailWebView, rather than using plain text, which contrasts with how things are handled in the iOS app. In iOS app, we're trying to parse out the main content and quotes from the HTML to differentiate primary content from quoted messages, with the latter being accessible via a '3 dots' button. (As you know parsing main content and quote from plain text is already done in iOS. but as we want to display img links, we need to use html content.) As of now, this parsing feature isn't present in the Android app. (FYI this happens with unencrypted messages which is regular Gmail message) Do correct me if I've gotten anything wrong. cc: @DenBond7 |
What if we'll additionally sanitize flowcrypt-ios/FlowCrypt/Controllers/Threads/ThreadDetailsViewController+TapActions.swift Line 212 in dae6c8e
|
Sorry @sosnovsky . |
What if we'll just use regex to extract quote content from |
Yep. It is same as my 1st suggested solution.
|
Oops, missed it 👍
I think it should be ok, as we won't make any complex transformations - just parse |
@sosnovsky Fixed above issues. Please check again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works better now, but still there are issues with rendering quote content in some threads, as parsing html and removing tags sometimes leads to broken rendering (your assumption about issues with incorrect contents display was correct)
Some possible solutions:
- use plain text message body for quote content and html message body for message content
- add separate action
show html version
in 3-dots message menu - try to render html content like it's currently implemented on Android - I haven't noticed issues with rendering quotes content there
What do you think about mentioned solutions?
What issues do you have while rendering quote content? Also here are my thoughts for your solutions
|
Initially I noticed only quoted content issues, for example when using But then I found that it affects also main content of messages too, as
Original issue reported by user was that he wasn't able to approve security requests because image with link wasn't loaded in FlowCrypt app. Separate
Yeah, that's why it's difficult to choose which solution will be the best one, all of them have pros and cons :) So if we'll be able to separate quoted content from html body - it should give us the best result. |
Sorry but which one do you mean?
|
This one - |
You mean just display html content in WebView after sanitizing html? (Without |
Seems like it applies only to opening such HTML in browser, where injection can fetch some data. While WKWebView is isolated web view, which just renders provided HTML so it shouldn't leak any user data. It's also possible to completely disable JS in WKWebView - https://developer.apple.com/documentation/webkit/wkwebpagepreferences/3552422-allowscontentjavascript, so no malicious code will be executed. |
Sounds good. Thank you |
@sosnovsky As you can see, Core unit test fails because of
flowcrypt-ios/Core/source/test.ts Line 1086 in b907686
flowcrypt-ios/Core/source/test.ts Line 1088 in b907686
|
appium/tests/specs/mock/inbox/CheckRemoteImageRendering.spec.ts
Outdated
Show resolved
Hide resolved
No, let's leave these checks - it seems |
@sosnovsky Ready for review. Please check. Thank you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job 👏 I like how messages look with these updates, but some improvements still needed:
- change font to iOS system font, it can be done by adding
<style>
tag after<meta name="viewport" ...
line:
<meta name="viewport" ... >
<style>* { font-family: -apple-system, "Helvetica Neue", sans-serif; }</style>
- support for dark mode (as currently messages always have white background) can be added in
<style>
tag too:
:root { color-scheme: light dark; supported-color-schemes: light dark; }
And then we can set background in dark mode to be the same as app background using
@media (prefers-color-scheme: dark) {
:root {
background-color: OUR_IOS_DARK_BACKGROUND;
color: white;
}
}
- web view has additional side paddings (around 8px, I think), let's remove it so web view text will be the same width as text in encrypted message. Maybe it's can be done through CSS too (like
html, body { padding: 0 !important; margin: 0 !important; }
) or by increasing width of web view.
Sounds good 👍
Oops. Missed it. Thank you for your notice
OKay
|
@sosnovsky It looks great with your suggestions. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done, just a couple small fixes left and then let's work on hiding/showing quote text in another PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, just noticed that issue from earlier reviews is still present (#2422 (review)):
- send non-encrypted message from Gmail web interface
- open it in iOS app
- tap
reply
button - on compose screen there will be html code
Let's use plain text body on compose screen, as we don't support creating of html messages yet.
Oops!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now, well done 👍
This PR implemented feature to show links to remote images
close #2414 // if this PR closes an issue
Tests (delete all except exactly one):
To be filled by reviewers
I have reviewed that this PR... (tick whichever items you personally focused on during this review):