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

Commit

Permalink
Add Pocket toggle switch and button to view about:extensions
Browse files Browse the repository at this point in the history
Fix #5227

Fix #5244

Auditors: @darkdh
  • Loading branch information
bbondy committed Oct 29, 2016
1 parent b9f2853 commit 0d9269c
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 3 deletions.
6 changes: 6 additions & 0 deletions app/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,12 @@ module.exports.init = () => {
disableExtension(extensionIds[passwordManagers.LAST_PASS])
}

if (getSetting(settings.POCKET_ENABLED)) {
registerComponent(config.PocketExtensionId)
} else {
disableExtension(config.PocketExtensionId)
}

if (appStore.getState().getIn(['widevine', 'enabled'])) {
registerComponent(config.widevineComponentId)
}
Expand Down
4 changes: 4 additions & 0 deletions app/extensions/brave/locales/en-US/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ bookmarkToolbar=Always show the bookmarks bar
bookmarkToolbarShowFavicon=Favicons
bookmarkToolbarShowOnlyFavicon=Show only favicon
contentSettings=Content Settings
extensions=Extensions
enablePocket=Enable Pocket
moreExtensionsComingSoon=More extensions coming soon…
viewInstalledExtensions=View Installed Extensions…
useHardwareAcceleration=Use hardware acceleration when available (requires browser restart)
useSmoothScroll=Enable smooth scrolling (requires browser restart)
defaultZoomLevel=Default zoom level
Expand Down
1 change: 1 addition & 0 deletions docs/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ AppStore
'shutdown.clear-cache': boolean, // true to clear cache on shutdown
'shutdown.clear-all-site-cookies': boolean, // true to clear all site cookies on shutdown
'adblock.customRules': string, // custom rules in ABP filter syntax
'extensions.pocket.enabled': boolean, // true if pocket is enabled
}],
dictionary: {
locale: string, // en_US, en, or any other locale string
Expand Down
2 changes: 1 addition & 1 deletion js/about/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ExtensionItem extends ImmutableComponent {
<h3 className='extensionTitle'>{bravifyText(this.props.extension.get('name'))}</h3>
<span className='extensionVersion'>{this.props.extension.get('version')}</span>
{
this.props.extension.get('description') !== '__MSG_appDesc__'
!['__MSG_extDescriptionGoogleChrome__', '__MSG_appDesc__'].includes(this.props.extension.get('description'))
? <div className='extensionDescription'>{bravifyText(this.props.extension.get('description'))}</div>
: null
}
Expand Down
11 changes: 11 additions & 0 deletions js/about/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -1586,6 +1586,17 @@ class AdvancedTab extends ImmutableComponent {
<SettingCheckbox dataL10nId='sendCrashReports' prefKey={settings.SEND_CRASH_REPORTS} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
<SettingCheckbox dataL10nId='sendUsageStatistics' prefKey={settings.SEND_USAGE_STATISTICS} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
</SettingsList>
<div className='sectionTitle' data-l10n-id='extensions' />
<SettingsList>
<SettingCheckbox dataL10nId='enablePocket' prefKey={settings.POCKET_ENABLED} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
<SettingItem>
<Button l10nId='viewInstalledExtensions' className='primaryButton viewExtensionsInfo'
onClick={aboutActions.newFrame.bind(null, {
location: 'about:extensions'
}, true)} />
</SettingItem>
<div data-l10n-id='moreExtensionsComingSoon' className='moreExtensionsComingSoon' />
</SettingsList>
</div>
}
}
Expand Down
3 changes: 2 additions & 1 deletion js/constants/appConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ module.exports = {
'shutdown.clear-all-site-cookies': false,
'shutdown.clear-autocomplete-data': false,
'shutdown.clear-autofill-data': false,
'shutdown.clear-site-settings': false
'shutdown.clear-site-settings': false,
'extensions.pocket.enabled': false
},
defaultFavicon: 'img/empty_favicon.png',
uaExceptionHosts: [
Expand Down
1 change: 1 addition & 0 deletions js/constants/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module.exports = {
},
braveExtensionId: 'mnojpmjdmbbfmejpflffifhffcmidifd',
PDFJSExtensionId: 'jdbefljfgobbmcidnmpjamcbhnbphjnb',
PocketExtensionId: 'niloccemoadcdkdjlinkgdfekeahmflj',
widevineComponentId: 'oimompecagnajdejgnnjijobebaeigek',
coinbaseOrigin: 'https://buy.coinbase.com'
}
3 changes: 2 additions & 1 deletion js/constants/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ const settings = {
LAST_PASS_ENABLED: 'security.passwords.last-pass-enabled',
// > phased out with 0.12.6
SHOW_BOOKMARKS_TOOLBAR_FAVICON: 'bookmarks.toolbar.showFavicon',
SHOW_BOOKMARKS_TOOLBAR_ONLY_FAVICON: 'bookmarks.toolbar.showOnlyFavicon'
SHOW_BOOKMARKS_TOOLBAR_ONLY_FAVICON: 'bookmarks.toolbar.showOnlyFavicon',
POCKET_ENABLED: 'extensions.pocket.enabled'
}

module.exports = settings
6 changes: 6 additions & 0 deletions less/about/preferences.less
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ span.browserButton.primaryButton {
&.importNowButton,
&.setAsDefaultButton,
&.manageAdblockSettings,
&.viewExtensionsInfo,
&.manageAutofillDataButton {
font-size: 0.9em;
margin-top: 20px;
Expand Down Expand Up @@ -1190,3 +1191,8 @@ div.nextPaymentSubmission {
margin-top: 0px;
width: auto;
}

.moreExtensionsComingSoon {
padding-top: 10px;
font-style: italic;
}
20 changes: 20 additions & 0 deletions test/about/extensionsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@ describe('about:extensions', function () {
.waitForVisible('[data-extension-id="jdbefljfgobbmcidnmpjamcbhnbphjnb"]')
})
})
describe('Pocket', 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.POCKET_ENABLED, true)
.tabByIndex(0)
.waitForVisible('[data-extension-id="niloccemoadcdkdjlinkgdfekeahmflj"]')
})
it('Opens up the signup page', function * () {

This comment has been minimized.

Copy link
@darkdh

darkdh Oct 29, 2016

Member

could we make this case as clicking pocket icon and it will open up a signup page?

const pocketURL = 'https://getpocket.com/signup?mode=minimal&src=installed'
yield this.app.client
.tabByIndex(0)
.waitForUrl(pocketURL)
.url(pocketURL)
})
})
describe('1Password', function () {
Brave.beforeAll(this)
before(function * () {
Expand Down

1 comment on commit 0d9269c

@darkdh
Copy link
Member

@darkdh darkdh commented on 0d9269c Oct 29, 2016

Choose a reason for hiding this comment

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

++

Please sign in to comment.