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

Adds support for Honey #8120

Merged
merged 1 commit into from
May 23, 2017
Merged

Adds support for Honey #8120

merged 1 commit into from
May 23, 2017

Conversation

jonathansampson
Copy link
Collaborator

@jonathansampson jonathansampson commented Apr 7, 2017

Test Plan (NOTE: requires Muon > 2.57.8)

  1. Open Preferences > Advanced
  2. Enable the Honey extension
  3. Note that Honey extension is enabled

Automated test plan

npm run test -- --grep="Honey installs when preference is enabled"

Description

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).

Fixes #8118
Fixes #8500
Fixes #8501
Fixes #8502

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

Changes look great! Will hold off on merging until the new Muon build is released and also our store is updated (via Heroku)

},
honey: {
extensionName: 'Honey'
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Awesome use of this 😄

Copy link
Collaborator Author

@jonathansampson jonathansampson Apr 7, 2017

Choose a reason for hiding this comment

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

@bsclifton Looking at this a second time, should we instead go with something like this?

['Pocket', 'Honey'].reduce( (curr, key) => {
    return ( curr[ key.toLowerCase() ] = { extensionName: key } ), curr
}, {})

Copy link
Member

Choose a reason for hiding this comment

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

@jonathansampson while that is pretty awesome (I love reduce!), I think the above is more readable

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

Muon 2.57.9 has been released so I gave this a try (after blowing away node_modules and redoing npm install).

The extension for me is always being grayed out. It's not clickable. Possibly related, I am seeing these errors logged (from standard out, ex: when launching Brave via the command line)

[24868:775:0410/000140.848449:ERROR:extension_function_dispatcher.cc(613)] Unknown Extension API - cookies.getAll

I can relaunch Brave (with Honey still enabled) and it doesn't make a difference
screen shot 2017-04-10 at 12 06 12 am

@jonathansampson
Copy link
Collaborator Author

@bsclifton I'll investigate. Thanks!

@bridiver
Copy link
Collaborator

any update on this?

@jonathansampson
Copy link
Collaborator Author

jonathansampson commented Apr 12, 2017

@bridiver Out of the house at the moment, but will check in about an hour. Failure to light-up may be on account of setIcon not accepting data-uri (#6197).

@jonathansampson
Copy link
Collaborator Author

Looks like #6262 is needed.

@jonathansampson
Copy link
Collaborator Author

jonathansampson commented Apr 27, 2017

@bsclifton I've identified and fixed the problem of icons not changing. This PR now resolves #8500, #8501, and #8502.

The one remaining issue is captured by #6262, which @kevinlawler is presently working to deliver.

@jonathansampson jonathansampson added this to the 0.15.1 milestone Apr 27, 2017
Copy link
Contributor

@cezaraugusto cezaraugusto left a comment

Choose a reason for hiding this comment

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

pls also add image to app/extensions/brave/img/extensions and to the dummy data inside extensionUtil.js, and also update locale with the same pattern as others, so it could be visible for users while not installed.

I recall you asked me to but didn't include as it wasn't merged yet. I can do that btw if you prefer

@jonathansampson
Copy link
Collaborator Author

@cezaraugusto Done, I believe :)

let tabAction = browserAction.getIn(['tabs', activeTabId.toString()])
if (tabAction) {
tabAction = tabAction.set('title', browserAction.get('title'))
tabAction = tabAction.set('base_path', browserAction.get('base_path'))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@bridiver The tab-specific action object lacks a title and base_path. I'm plucking them off of the more general browser action object. Is this the right way to resolve their absence, or should we be adding them when the object is passing through Muon?

@@ -29,3 +29,4 @@ torrent= Torrent Viewer
torrentDesc=Uses WebTorrent to display torrents directly in the browser. Supports torrent files and magnet links.
vimium= Vimium
vimiumDesc=
honeyDesc=Automatically find and apply coupon codes when you shop online!
Copy link
Contributor

@cezaraugusto cezaraugusto May 1, 2017

Choose a reason for hiding this comment

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

you need a name here as well, like honey=Honey. If the extension has a different name like pocket (which shows as "Save to Pocket"), you'll need to use the same first letter for the variable as well, otherwise, we can't sort by name in extensions table. (just fyi, I don't think this applies here).

otherwise everything ok inside extensionsTab ++

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@bsclifton honey=Honey was originally suggested here. @cezaraugusto, please see the discussion here regarding this change.

@jonathansampson
Copy link
Collaborator Author

jonathansampson commented May 1, 2017

@cezaraugusto That string should be taken care of now.
@bsclifton The icon issue should also be resolved too.

@bsclifton
Copy link
Member

Great, thanks @jonathansampson 😄 will review soon

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

Getting a crash when starting ☹️

I made sure to destroy node_modules and redo npm install. I rebased the PR locally also, just to make sure. Muon version is 2.58.8.

The error which I'm seeing logged to console over and over is:
[48704:775:0501/154112.639790:ERROR:extension_function_dispatcher.cc(585)] Unknown Extension API - cookies.getAll

Brave just exits and does not present the "report an error" dialog. I don't see an associated crash report in stats.brave.com either

@@ -29,3 +29,5 @@ torrent= Torrent Viewer
torrentDesc=Uses WebTorrent to display torrents directly in the browser. Supports torrent files and magnet links.
vimium= Vimium
vimiumDesc=
honey=Honey
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is needed, but it doesn't hurt anything... Since the extension is a product name, it shouldn't be translated. But... using Japanese as an example... I could see writing this word using Katakana more helpful to the user. cc: @luixxiul

Copy link
Contributor

@kevinlawler kevinlawler May 1, 2017

Choose a reason for hiding this comment

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

@bsclifton The in-progress fix for cookies.getAll is here:

https://github.com/brave/muon/compare/chrome-cookies-getall

This should either suppress that error outright or should be able to be modified in some way to do so. I think it is waiting on further testing.

I'm on Slack if anyone with an interest in this wants to discuss.

Copy link
Contributor

Choose a reason for hiding this comment

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

it shouldn't be translated. But... using Japanese as an example... I could see writing this word using Katakana more helpful to the user. cc: @luixxiul

Still in Japan people do not call "Pocket" as ポケット. I remember the issue happened on Chinese l10n before. / CC: @alexwykoff

For me, we could safely hardcode the name of every extention/product developed in English, as FF/Chrome do. People do not translate Gmail right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@kevinlawler We should probably open up a PR to merge your cookies.getAll stub into Muon. Thoughts? cc @bsclifton

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the convo happening regarding extensions name is my fault. I actually created that for extensions such as LastPass where the name is LastPass: Free Password Manager -- which includes product name + tagline. If that's desirable to have the name as-is I +1 on hardcoding names. Sorry for confusion :)

@bbondy bbondy modified the milestones: 0.15.2, 0.15.3 May 2, 2017
@jonathansampson
Copy link
Collaborator Author

@bsclifton @bbondy Conflicts resolved.

Copy link
Contributor

@luixxiul luixxiul left a comment

Choose a reason for hiding this comment

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

The test plan works.

@luixxiul
Copy link
Contributor

screenshot 2017-05-19 13 26 23

IMO the badge needs more contrast to read the count easily. How about changing it into black like this (unless the green is the theme color)?

screenshot 2017-05-19 13 28 15

CC @bradleyrichter for his insight on that.

@jonathansampson
Copy link
Collaborator Author

@luixxiul The colors are chosen by the extension author, not by the browser.

@jonathansampson jonathansampson dismissed bsclifton’s stale review May 19, 2017 17:46

Issues have been corrected.

@bsclifton
Copy link
Member

@jonathansampson even with a fresh session, I'm always seeing the badge as grayed out (I also tried restarting after enabling it). However, it works great
honey

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

Looking into the Muon dev tools, I inspected the image and it's actually gray in the extension itself:
file:///Users/clifton/Library/Application%20Support/brave-development/Extensions/bmnlcjabgnpnenekpadlanbbkooimhnj/9.7.7/icons/default-19.png
file:///Users/clifton/Library/Application%20Support/brave-development/Extensions/bmnlcjabgnpnenekpadlanbbkooimhnj/9.7.7/icons/default-38.png

Since the functionality itself works, I think we're good 😄 👍

@bsclifton
Copy link
Member

@jonathansampson I'll leave the PR open (see above comments). If that is OK default behavior, this is ready for you to merge! I wouldn't be surprised if it's gray until you login (I didn't test logging in- only the behavior which didn't work before).

@bsclifton
Copy link
Member

Found out what I was missing! You have to be visiting a site which has deals in order for the icon to light up. This is expected behavior that I was not aware of. Looks great! 😄

@bsclifton bsclifton merged commit fb844bb into master May 23, 2017
@bsclifton bsclifton deleted the ext_honey branch May 23, 2017 19:06
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.

7 participants