Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Extension functions for converting URLs to search terms #10480

Merged
merged 1 commit into from Jun 17, 2021

Conversation

grigoryk
Copy link
Contributor

Pull Request checklist

  • Quality: This PR builds and passes detekt/ktlint checks (A pre-push hook is recommended)
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry or does not need one
  • Accessibility: The code in this PR follows accessibility best practices or does not include any user facing features

After merge

  • Milestone: Make sure issues closed by this pull request are added to the milestone of the version currently in development.
  • Breaking Changes: If this is a breaking change, please push a draft PR on Reference Browser to address the breaking issues.

Copy link
Contributor

@csadilek csadilek left a comment

Choose a reason for hiding this comment

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

Two small things below, but looks great to me!

import android.net.Uri

// OpenSearch parameter for search terms.
const val OS_SEARCH_ENGINE_TERMS_PARAM = "{" + "searchTerms" + "}"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: This could just be "{searchTerms}". :)

@grigoryk grigoryk added the 🛬 needs landing PRs that are ready to land label Jun 17, 2021
@grigoryk grigoryk closed this Jun 17, 2021
@grigoryk grigoryk reopened this Jun 17, 2021
@mergify mergify bot merged commit 2d57884 into mozilla-mobile:master Jun 17, 2021
@grigoryk grigoryk deleted the searchHelpers branch June 17, 2021 20:50
return@fallback null
}
return currentEngine?.parseSearchTerms(parsedUrl) ?: fallback()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that this will not work for every search engine. Some (like Wikipedia) do a redirect and the resulting URL will not match the build URL anymore.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🛬 needs landing PRs that are ready to land
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants