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

Fix #4760 In Terms of Service the website should be displayed as link and should be clickable. #5213

Merged
merged 7 commits into from
Dec 6, 2023

Conversation

Tejas-67
Copy link
Contributor

@Tejas-67 Tejas-67 commented Oct 29, 2023

Explanation

Fix #4760 In Terms of Service the website should be displayed as link and should be clickable
This Solution uses SpannableString to solve the the issue. We get the url from html spannable using regex and then set a span around it to make the link clickable.

Essential Checklist

  • The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • Any changes to scripts/assets files have their rationale included in the PR explanation.
  • The PR follows the style guide.
  • The PR does not contain any unnecessary code changes from Android Studio (reference).
  • The PR is made from a branch that's not called "develop" and is up-to-date with "develop".
  • The PR is assigned to the appropriate reviewers (reference).

For UI-specific PRs only

If your PR includes UI-related changes, then:

  • Add screenshots for portrait/landscape for both a tablet & phone of the before & after UI changes
  • For the screenshots above, include both English and pseudo-localized (RTL) screenshots (see RTL guide)
  • Add a video showing the full UX flow with a screen reader enabled (see accessibility guide)
  • For PRs introducing new UI elements or color changes, both light and dark mode screenshots must be included
  • Add a screenshot demonstrating that you ran affected Espresso tests locally & that they're passing

Demo Video

oppia-.webm

@Tejas-67 Tejas-67 requested a review from a team as a code owner October 29, 2023 05:54
@adhiamboperes adhiamboperes changed the title Fix oppia #4760 In Terms of Service the website should be displayed as link and should be clickable. Fix #4760 In Terms of Service the website should be displayed as link and should be clickable. Oct 31, 2023
Copy link
Collaborator

@adhiamboperes adhiamboperes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Tejas-67!

Please include a video demo of your solution working as expected.

Once you have addressed the comments, please assig this back to me. See wiki section.

Copy link
Collaborator

@adhiamboperes adhiamboperes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Tejas-67, I have added a nit, but nothing blocking. Please fix and reassign.

@oppiabot oppiabot bot added the PR: LGTM label Oct 31, 2023
Copy link

oppiabot bot commented Oct 31, 2023

Hi @Tejas-67, this PR is ready to be merged. Please address any remaining comments prior to merging, and feel free to ask someone to merge your PR once the CI checks pass and you're happy with it. Thanks!

@adhiamboperes
Copy link
Collaborator

Thanks @Tejas-67. Could you please fix the failing tests? See https://github.com/oppia/oppia-android/wiki/Interpreting-CI-Results for finding out which tests are failing.

@Tejas-67
Copy link
Contributor Author

Tejas-67 commented Nov 2, 2023

Hey @adhiamboperes , fixed some lint issues that was causing the tests to fail. Other tests failing because the link to navigate to privacy policy page from terms of service page is not working. A possible fix would be to add another span for the link. Should i go ahead with this fix or raise a issue after this PR is merged?

@adhiamboperes
Copy link
Collaborator

Hey @adhiamboperes , fixed some lint issues that was causing the tests to fail. Other tests failing because the link to navigate to privacy policy page from terms of service page is not working. A possible fix would be to add another span for the link. Should i go ahead with this fix or raise a issue after this PR is merged?

@Tejas-67, all existing tests must pass for the PR to be merged. Can you identify why the links are not working? What has changed?

@Tejas-67
Copy link
Contributor Author

Tejas-67 commented Nov 2, 2023

@adhiamboperes , The links are not working because the text is enclosed in <oppia-noninteractive-policy link="privacy">Privacy Policy and html.fromHtml doesn't recognize this. One fix could be to to wrap the text with another span.

Copy link
Collaborator

@adhiamboperes adhiamboperes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adhiamboperes , The links are not working because the text is enclosed in Privacy Policy and html.fromHtml doesn't recognize this. One fix could be to to wrap the text with another span.

I think this was working before your fix, right? It is worth taking a step back and finding a different solution. Take a look at this class that handles custom html tags. I believe it has a fromHtml() function that is used in the HtmlParser.kt class, which in computeCustomTagHandlers(), parses the policy tag.

@adhiamboperes
Copy link
Collaborator

@Tejas-67, are you still working on this PR?

@Tejas-67
Copy link
Contributor Author

@adhiamboperes Yes, I am working on it.

Copy link

oppiabot bot commented Nov 22, 2023

Hi @Tejas-67, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue.
If you are still working on this PR, please make a follow-up commit within 3 days (and submit it for review, if applicable). Please also let us know if you are stuck so we can help you!

@oppiabot oppiabot bot added stale Corresponds to items that haven't seen a recent update and may be automatically closed. and removed stale Corresponds to items that haven't seen a recent update and may be automatically closed. labels Nov 22, 2023
@Tejas-67
Copy link
Contributor Author

Hey @adhiamboperes , please check the new code.

@Tejas-67
Copy link
Contributor Author

Hey @adhiamboperes, do I need to raise a new PR for this issue?

@Tejas-67 Tejas-67 requested a review from a team as a code owner December 4, 2023 06:32
@Tejas-67 Tejas-67 closed this Dec 4, 2023
@Tejas-67 Tejas-67 reopened this Dec 4, 2023
Copy link
Collaborator

@adhiamboperes adhiamboperes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Tejas-67! (Sorry for the delay in review here).

Based on previous conversation, you do not need to close a PR and open a new one, when undoing unwanted changes, you can simply create new commits after you have changed code back to the way it was, and push to the branch.

(However when working on a different issue, you need to create a new branch from develop).

Our wiki has a good set of instructions that can help. https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR. Please let me know if you have further questions.

Copy link
Collaborator

@adhiamboperes adhiamboperes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, meant to request changes as per my comments.

Tejas-67 added 5 commits December 5, 2023 19:00
- Replace brittle string manipulation with robust regex matching using .toRegex().find()
- Introduce new helper functions for code simplification
@Tejas-67
Copy link
Contributor Author

Tejas-67 commented Dec 5, 2023

@adhiamboperes please check.

Copy link
Collaborator

@adhiamboperes adhiamboperes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Tejas-67!

@adhiamboperes adhiamboperes enabled auto-merge (squash) December 6, 2023 15:39
@oppiabot oppiabot bot added the PR: LGTM label Dec 6, 2023
Copy link

oppiabot bot commented Dec 6, 2023

Hi @Tejas-67, this PR is ready to be merged. Please address any remaining comments prior to merging, and feel free to ask someone to merge your PR once the CI checks pass and you're happy with it. Thanks!

@adhiamboperes adhiamboperes merged commit 0f8eb69 into oppia:develop Dec 6, 2023
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

In Terms of Service the website should be displayed as link and should be clickable
2 participants