Skip to content
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

[$500] Android - Compose-Code block applied for url, half link is missing, cannot be seen. #30292

Closed
6 tasks
lanitochka17 opened this issue Oct 24, 2023 · 14 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@lanitochka17
Copy link

lanitochka17 commented Oct 24, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 1.3.90-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Launch app
  2. Tap on a report
  3. Enter [https://github.com/Expensify/App/issues/21400#issuecomment-1622190091](New Message go-to button does not take to the new message where the new line marker is. #21400 (comment))
    in compose box
  4. Send the message

Expected Result:

Code block applied for url and that full url link must be visible

Actual Result:

Code block applied for url, half link is missing, cannot be seen

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Android: Native
Bug6249328_1698176628517.link.mp4
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0106e78b3f023dfa6e
  • Upwork Job ID: 1716916531386109952
  • Last Price Increase: 2023-10-31
@lanitochka17 lanitochka17 added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 24, 2023
@melvin-bot melvin-bot bot changed the title Android - Compose-Code block applied for url, half link is missing, cannot be seen. [$500] Android - Compose-Code block applied for url, half link is missing, cannot be seen. Oct 24, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

Job added to Upwork: https://www.upwork.com/jobs/~0106e78b3f023dfa6e

@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

Triggered auto assignment to @bfitzexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 24, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @Ollyws (External)

@ikevin127
Copy link
Contributor

I think this bug has the same root cause as this issue: #4733 (lots of context here about the problem)

@HardikChoudhary24
Copy link
Contributor

HardikChoudhary24 commented Oct 26, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue

  • Android - Compose-Code block applied for url, half link is missing, cannot be seen.

What is the root cause of that problem?

  • The root cause of this issue lies within the WrappedText Component (that is used for native platform to wrap the code block so that the text does not overflow). The problem arises due to:
    /**
    * Breaks the text into matrix
    * for eg: My Name is Rajat
    * [
    * [My,' ',Name,' ',' ',is,' ',Rajat],
    * ]
    *
    * @param {String} text
    * @returns {Array<String[]>}
    */
    function getTextMatrix(text) {
    return _.map(text.split('\n'), (row) => _.without(row.split(CONST.REGEX.SPACE_OR_EMOJI), ''));
    }

here due to row.split(CONST.REGEX.SPACE_OR_EMOJI) we are spliting the row of the matrix based on spaces or emoji.

  • In case of a link there are no spaces so we need to check for other special characters that appear in a link for proper rendering of the code block because if we split the row based on space only then in that case for links which does not contain any space the matrix will look like
[ 
     ["https://github.com/Expensify/App/issues/21400#issuecomment-1622190091"], 
]

and thus this large string overflows the screen because we are rendering it like this 👇

function WrappedText(props) {
if (!_.isString(props.children)) {
return null;
}
const textMatrix = getTextMatrix(props.children);
return (
<>
{_.map(textMatrix, (rowText, rowIndex) => (
<Fragment
// eslint-disable-next-line react/no-array-index-key
key={`${rowText}-${rowIndex}`}
>
{_.map(rowText, (colText, colIndex) => (
// Outer View is important to vertically center the Text
<View
// eslint-disable-next-line react/no-array-index-key
key={`${colText}-${colIndex}`}
style={styles.codeWordWrapper}
>
<View style={[props.wordStyles, colIndex === 0 && styles.codeFirstWordStyle, colIndex === rowText.length - 1 && styles.codeLastWordStyle]}>
<Text style={props.textStyles}>{colText}</Text>
</View>
</View>
))}
</Fragment>
))}
</>
);
}

What changes do you think we should make in order to solve the problem?

  • To address this problem, since in a link there are no spaces we can check for other special characters by changing SPACE_OR_EMOJI

  • Currently it looks like

    App/src/CONST.ts

    Lines 1331 to 1334 in 2d52929

    get SPACE_OR_EMOJI() {
    return new RegExp(`(\\s+|(?:${this.EMOJI.source})+)`, 'gu');
    },

we can modify it into

get SPACE_OR_EMOJI() {
            return new RegExp(`(\\s+|(?:${this.EMOJI.source})+|([^a-zA-Z0-9\s]+)+)`, 'gu');
},
  • Here we are checking for all the special characters that can be entered through the keyboard.
  • This will break the string like
[ 
   ["https", ":" , "/", "/" ,"github", "." ,"com", "/" ,"Expensify", "/" ,"App", "/" ,"issues" ,"/" ,"21400" ,"#" ,"issuecomment" ,"-" ,"1622190091"],
]

which makes the link to render properly.

Result

expensify.mp4

What alternative solutions did you explore? (Optional)

  • We can split the string into individual characters also.

@melvin-bot melvin-bot bot added the Overdue label Oct 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 30, 2023

@Ollyws, @bfitzexpensify Huh... This is 4 days overdue. Who can take care of this?

Copy link

melvin-bot bot commented Oct 31, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@bfitzexpensify
Copy link
Contributor

How does the proposal in #30292 (comment) look @Ollyws?

@melvin-bot melvin-bot bot removed the Overdue label Oct 31, 2023
@HardikChoudhary24
Copy link
Contributor

HardikChoudhary24 commented Nov 2, 2023

Proposal

Updated

@melvin-bot melvin-bot bot added the Overdue label Nov 3, 2023
@bfitzexpensify
Copy link
Contributor

Bump on proposal review when you get a chance @Ollyws - thank you!

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Nov 3, 2023
@Ollyws
Copy link
Contributor

Ollyws commented Nov 6, 2023

Will have a look at this one today.

@melvin-bot melvin-bot bot removed the Overdue label Nov 6, 2023
@Ollyws
Copy link
Contributor

Ollyws commented Nov 6, 2023

Seems to be a dupe of #27913

@bfitzexpensify
Copy link
Contributor

Yep, I think that's a good call. OK, closing this in favour of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

5 participants