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

Commit 8085f63

Browse files
Adds support for Honey, and resolves a couple bugs
1 parent c708af7 commit 8085f63

File tree

11 files changed

+45
-3
lines changed

11 files changed

+45
-3
lines changed

app/common/state/extensionState.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const extensionState = {
7676

7777
browserActionBackgroundImage: (browserAction, tabId) => {
7878
tabId = tabId ? tabId.toString() : '-1'
79-
let path = browserAction.get('path')
79+
let path = browserAction.getIn(['tabs', tabId, 'path']) || browserAction.get('path')
8080
let basePath = browserAction.get('base_path')
8181
if (path && basePath) {
8282
// Older extensions may provide a string path

app/extensions.js

+6
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,12 @@ module.exports.init = () => {
519519
disableExtension(config.vimiumExtensionId)
520520
}
521521

522+
if (getSetting(settings.HONEY_ENABLED)) {
523+
registerComponent(config.honeyExtensionId)
524+
} else {
525+
disableExtension(config.honeyExtensionId)
526+
}
527+
522528
if (appStore.getState().getIn(['widevine', 'enabled'])) {
523529
registerComponent(config.widevineComponentId)
524530
}
Loading

app/extensions/brave/locales/en-US/extensions.properties

+2
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ torrent= Torrent Viewer
2929
torrentDesc=Uses WebTorrent to display torrents directly in the browser. Supports torrent files and magnet links.
3030
vimium= Vimium
3131
vimiumDesc=
32+
honey=Honey
33+
honeyDesc=Automatically find and apply coupon codes when you shop online!

app/renderer/components/navigation/browserAction.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,14 @@ class BrowserAction extends React.Component {
5555
const currentWindow = state.get('currentWindow')
5656
const activeFrame = frameStateUtil.getActiveFrame(currentWindow) || Immutable.Map()
5757
const activeTabId = activeFrame.get('tabId') || tabState.TAB_ID_NONE
58-
const browserActions = extensionState.getBrowserActionByTabId(state, ownProps.extensionId, activeTabId)
58+
let browserActions = extensionState.getBrowserActionByTabId(state, ownProps.extensionId, activeTabId)
59+
let tabAction = browserActions.getIn(['tabs', activeTabId.toString()])
60+
61+
if (tabAction) {
62+
tabAction = tabAction.set('title', browserActions.get('title'))
63+
tabAction = tabAction.set('base_path', browserActions.get('base_path'))
64+
browserActions = tabAction
65+
}
5966

6067
const props = {}
6168
// used in renderer

app/renderer/lib/extensionsUtil.js

+10
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const pocket = config.PocketExtensionId
1818
const sync = config.syncExtensionId
1919
const webtorrent = config.torrentExtensionId
2020
const vimium = config.vimiumExtensionId
21+
const honey = config.honeyExtensionId
2122

2223
/**
2324
* Stores dummy data for all known extensions based on vault-updater extension manifest.
@@ -49,6 +50,12 @@ const dummyData = [
4950
name: 'saveToPocket',
5051
description: 'saveToPocketDesc',
5152
icon: 'img/extensions/pocket-128.png'
53+
},
54+
{
55+
id: honey,
56+
name: 'honey',
57+
description: 'honeyDesc',
58+
icon: 'img/extensions/honey-128.png'
5259
}
5360
// { id: 'vimium' // TBD }
5461
]
@@ -132,6 +139,9 @@ module.exports.getExtensionKey = (extensionId) => {
132139
case vimium:
133140
extensionSetting = settings.VIMIUM_ENABLED
134141
break
142+
case honey:
143+
extensionSetting = settings.HONEY_ENABLED
144+
break
135145
default:
136146
break
137147
}

docs/state.md

+1
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ AppStore
172172
'bookmarks.toolbar.showOnlyFavicon': boolean, // true if only favicons should be shown on the bookmarks toolbar
173173
'extensions.pocket.enabled': boolean, // true if pocket is enabled
174174
'extensions.vimium.enabled': boolean, // true if vimium is enabled
175+
'extensions.honey.enabled': boolean, // true if Honey is enabled
175176
'general.autohide-menu': boolean, // true if the Windows menu should be autohidden
176177
'general.bookmarks-toolbar-mode': boolean, // true to show bookmakrs toolbar
177178
'general.check-default-on-startup': boolean, // true to check whether brave is default browser on startup

js/constants/appConfig.js

+1
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ module.exports = {
203203
'shutdown.clear-site-settings': false,
204204
'extensions.pocket.enabled': false,
205205
'extensions.vimium.enabled': false,
206+
'extensions.honey.enabled': false,
206207
'general.bookmarks-toolbar-mode': null,
207208
'general.is-default-browser': null,
208209
'notification-add-funds-timestamp': null,

js/constants/config.js

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ module.exports = {
5050
PDFJSExtensionId: 'jdbefljfgobbmcidnmpjamcbhnbphjnb',
5151
PocketExtensionId: 'niloccemoadcdkdjlinkgdfekeahmflj',
5252
vimiumExtensionId: 'dbepggeogbaibhgnhhndojpepiihcmeb',
53+
honeyExtensionId: 'bmnlcjabgnpnenekpadlanbbkooimhnj',
5354
widevineComponentId: 'oimompecagnajdejgnnjijobebaeigek',
5455
coinbaseOrigin: 'https://buy.coinbase.com',
5556
newtab: {

js/constants/settings.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ const settings = {
9696
SHOW_BOOKMARKS_TOOLBAR_FAVICON: 'bookmarks.toolbar.showFavicon',
9797
SHOW_BOOKMARKS_TOOLBAR_ONLY_FAVICON: 'bookmarks.toolbar.showOnlyFavicon',
9898
POCKET_ENABLED: 'extensions.pocket.enabled',
99-
VIMIUM_ENABLED: 'extensions.vimium.enabled'
99+
VIMIUM_ENABLED: 'extensions.vimium.enabled',
100+
HONEY_ENABLED: 'extensions.honey.enabled'
100101
}
101102

102103
module.exports = settings

test/about/extensionsTest.js

+13
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ describe('about:extensions', function () {
4949
.url(pocketURL)
5050
})
5151
})
52+
describe('Honey', function () {
53+
Brave.beforeAll(this)
54+
before(function * () {
55+
yield setup(this.app.client)
56+
})
57+
it('installs when preference is enabled', function * () {
58+
yield this.app.client
59+
.windowByUrl(Brave.browserWindowUrl)
60+
.changeSetting(settingsConst.HONEY_ENABLED, true)
61+
.tabByIndex(0)
62+
.waitForVisible('[data-extension-id="bmnlcjabgnpnenekpadlanbbkooimhnj"]', extensionDownloadWaitTime)
63+
})
64+
})
5265
describe('Vimium', function () {
5366
Brave.beforeAll(this)
5467
before(function * () {

0 commit comments

Comments
 (0)