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

Implement support for "may launch url" (single url) #23

Merged
merged 14 commits into from
Apr 26, 2016

Conversation

juankysoriano
Copy link
Contributor

Task Requested

To implement support for the function mayLaunch(url) from ChromeCustomTabs. From Chrome Custom Tabs documentation:

Calling mayLaunchUrl() will make Custom Tabs pre-fetch the main page with the supporting content and pre-render. This will give the maximum speed up to the page loading process, but comes with a network and battery cost.

Solution implemented

Basically to make Connection responsible for implementing the mayLaunch functionality.

In terms of implementation details, when someone does SimpleChromeCustomTabsConnection.mayLaunch(url) then it will delegate to the current active Session, which will invoke the method on the proxied class ChromeCustomTabsSession. If at the time of calling the method there is no active Session then the url will be saved for later, and will be warmed up (flagged as may launch) for when an active Session starts.

Test added [yes], about the new functionality.

Note Also renamed the tests to follow the same naming convention, given_when_then

Screenshots

No UI Changes.

public CustomTabsSession newSession() {
if (hasConnectedClient()) {
return client.newSession();
public void mayLaunch(Uri url) {
Copy link
Contributor

@joetimmins joetimmins Apr 26, 2016

Choose a reason for hiding this comment

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

uri would be a less confusing variable name here IMO, and at 🎱 too

@joetimmins
Copy link
Contributor

Other than a little variable name change it all looks good to me. 👍

* Starts a new session for Chrome Custom Tabs usage. Can be used to warmup particular Urls.
* Tells SimpleChromeCustomTabs that a potential Url might be launched. This will do pre DNS resolution that will speed things up.
* @param uri
* @return WebNavigator with warmed up url
Copy link
Contributor

Choose a reason for hiding this comment

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

You mention that this will return a WebNavigation, but this method in fact returns void

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh lol, you are right thank you!

@juankysoriano
Copy link
Contributor Author

juankysoriano commented Apr 26, 2016

@joetimmins @alexstyl friends, comments addressed

@joetimmins joetimmins merged commit 319185f into master Apr 26, 2016
@joetimmins joetimmins deleted the implement_may_launch_url branch April 26, 2016 17:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants