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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/common/state/extensionState.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const extensionState = {

browserActionBackgroundImage: (browserAction, tabId) => {
tabId = tabId ? tabId.toString() : '-1'
let path = browserAction.get('path')
let path = browserAction.getIn(['tabs', tabId, 'path']) || browserAction.get('path')
let basePath = browserAction.get('base_path')
if (path && basePath) {
// Older extensions may provide a string path
Expand Down
6 changes: 6 additions & 0 deletions app/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,12 @@ module.exports.init = () => {
disableExtension(config.vimiumExtensionId)
}

if (getSetting(settings.HONEY_ENABLED)) {
registerComponent(config.honeyExtensionId)
} else {
disableExtension(config.honeyExtensionId)
}

if (appStore.getState().getIn(['widevine', 'enabled'])) {
registerComponent(config.widevineComponentId)
}
Expand Down
Binary file added app/extensions/brave/img/extensions/honey-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions app/extensions/brave/locales/en-US/extensions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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 :)

honeyDesc=Automatically find and apply coupon codes when you shop online!
9 changes: 8 additions & 1 deletion app/renderer/components/navigation/browserAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ class BrowserAction extends React.Component {
const currentWindow = state.get('currentWindow')
const activeFrame = frameStateUtil.getActiveFrame(currentWindow) || Immutable.Map()
const activeTabId = activeFrame.get('tabId') || tabState.TAB_ID_NONE
const browserActions = extensionState.getBrowserActionByTabId(state, ownProps.extensionId, activeTabId)
let browserActions = extensionState.getBrowserActionByTabId(state, ownProps.extensionId, activeTabId)
let tabAction = browserActions.getIn(['tabs', activeTabId.toString()])

if (tabAction) {
tabAction = tabAction.set('title', browserActions.get('title'))
tabAction = tabAction.set('base_path', browserActions.get('base_path'))
browserActions = tabAction
}

const props = {}
// used in renderer
Expand Down
10 changes: 10 additions & 0 deletions app/renderer/lib/extensionsUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const pocket = config.PocketExtensionId
const sync = config.syncExtensionId
const webtorrent = config.torrentExtensionId
const vimium = config.vimiumExtensionId
const honey = config.honeyExtensionId

/**
* Stores dummy data for all known extensions based on vault-updater extension manifest.
Expand Down Expand Up @@ -49,6 +50,12 @@ const dummyData = [
name: 'saveToPocket',
description: 'saveToPocketDesc',
icon: 'img/extensions/pocket-128.png'
},
{
id: honey,
name: 'honey',
description: 'honeyDesc',
icon: 'img/extensions/honey-128.png'
}
// { id: 'vimium' // TBD }
]
Expand Down Expand Up @@ -132,6 +139,9 @@ module.exports.getExtensionKey = (extensionId) => {
case vimium:
extensionSetting = settings.VIMIUM_ENABLED
break
case honey:
extensionSetting = settings.HONEY_ENABLED
break
default:
break
}
Expand Down
1 change: 1 addition & 0 deletions docs/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ AppStore
'bookmarks.toolbar.showOnlyFavicon': boolean, // true if only favicons should be shown on the bookmarks toolbar
'extensions.pocket.enabled': boolean, // true if pocket is enabled
'extensions.vimium.enabled': boolean, // true if vimium is enabled
'extensions.honey.enabled': boolean, // true if Honey is enabled
'general.autohide-menu': boolean, // true if the Windows menu should be autohidden
'general.bookmarks-toolbar-mode': boolean, // true to show bookmakrs toolbar
'general.check-default-on-startup': boolean, // true to check whether brave is default browser on startup
Expand Down
1 change: 1 addition & 0 deletions js/constants/appConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ module.exports = {
'shutdown.clear-site-settings': false,
'extensions.pocket.enabled': false,
'extensions.vimium.enabled': false,
'extensions.honey.enabled': false,
'general.bookmarks-toolbar-mode': null,
'general.is-default-browser': null,
'notification-add-funds-timestamp': null,
Expand Down
1 change: 1 addition & 0 deletions js/constants/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ module.exports = {
PDFJSExtensionId: 'jdbefljfgobbmcidnmpjamcbhnbphjnb',
PocketExtensionId: 'niloccemoadcdkdjlinkgdfekeahmflj',
vimiumExtensionId: 'dbepggeogbaibhgnhhndojpepiihcmeb',
honeyExtensionId: 'bmnlcjabgnpnenekpadlanbbkooimhnj',
widevineComponentId: 'oimompecagnajdejgnnjijobebaeigek',
coinbaseOrigin: 'https://buy.coinbase.com',
newtab: {
Expand Down
3 changes: 2 additions & 1 deletion js/constants/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ const settings = {
SHOW_BOOKMARKS_TOOLBAR_FAVICON: 'bookmarks.toolbar.showFavicon',
SHOW_BOOKMARKS_TOOLBAR_ONLY_FAVICON: 'bookmarks.toolbar.showOnlyFavicon',
POCKET_ENABLED: 'extensions.pocket.enabled',
VIMIUM_ENABLED: 'extensions.vimium.enabled'
VIMIUM_ENABLED: 'extensions.vimium.enabled',
HONEY_ENABLED: 'extensions.honey.enabled'
}

module.exports = settings
13 changes: 13 additions & 0 deletions test/about/extensionsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ describe('about:extensions', function () {
.url(pocketURL)
})
})
describe('Honey', function () {
Brave.beforeAll(this)
before(function * () {
yield setup(this.app.client)
})
it('installs when preference is enabled', function * () {
yield this.app.client
.windowByUrl(Brave.browserWindowUrl)
.changeSetting(settingsConst.HONEY_ENABLED, true)
.tabByIndex(0)
.waitForVisible('[data-extension-id="bmnlcjabgnpnenekpadlanbbkooimhnj"]', extensionDownloadWaitTime)
})
})
describe('Vimium', function () {
Brave.beforeAll(this)
before(function * () {
Expand Down