This repository has been archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 973
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Show home button now disables itself when home page is cleared (null/empty) - Removed appearance settings; moved to under "My home page is" per the mockup on #2108 - Bookmarks toolbar switches were changed into a single drop down Unit tests are in place and working + I've manually at least two of the scenarios outlined in the attached steps Fixes #2108 Fixes #3008 Fixes #2111 Possibly fixes #3544 Auditors: @BrendanEich - you had previously reviewed the settings code; LMK how the changes in `./js/settings.js` look @bbondy - small changes EXCEPT the new config value for BTB. This only had two touchpoints (main.js, contextMenus.js) versus the password manager changes Tweaks made per review w/ Brad. Includes: - reducing space between label and field in preferences - the lone toggle switch was pulled over to the left - import button is moved up - import button area is no longer a separate grouping Upgrade test plan: 1. Install a previous version of Brave (0.12.4 or older); ENABLE favicons and ENABLE show only favicons 2. Upgrade to this version (0.12.5?). Confirm it consolidates preference to "Favicons only" in preferences drop down 3. Install a previous version of Brave (0.12.4 or older); ENABLE favicons but DISABLE show only favicons 4. Upgrade to this version (0.12.5?). Confirm it consolidates preference to "Text and Favicons" in preferences drop down 5. Install a previous version of Brave (0.12.4 or older); DISABLE favicons and DISABLE show only favicons 6. Upgrade to this version (0.12.5?). Confirm it consolidates preference to "Text only" in preferences drop down 7. Uninstall Brave completely; move session file out of the way Regular test plan: ** consolidation of bookmarks toolbar settings** 1. Install a clean version of Brave (0.12.5?) 2. Launch preferences, confirm preference defaults to "Text only" 3. Confirm no favicons show (only text): - at the root level of the bookmarks toolbar - when expanding a folder inside the bookmarks toolbar 4. Repeat step 2/3 for the other two settings. NOTE: show only favicon does not apply to items inside bookmark folders ** bookmark toolbar enable/disable change ** 5. Go to preferences and toggle "Always show the bookmarks toolbar" 6. If disabled, notice how drop down is now disabled too (not allowing you to change) 7. When enabled, notice how drop down is re-enabled ** disabling of show home button ** 8. Set your home page to brave.com and enable "show home button" 9. Erase out the value in home page and confirm "show home button" is: - is turned off - disabled completely (not clickable) 10. Type a non-whitespace character or characters into home page box 11. Confirm the "show home button" is clickable again ** overall general settings tab ** 12. Ensure screen matches corresponding parts of mockup shown in #2108 13. Ensure screen matches corresponding parts of mockup shown in #2111
- Loading branch information
Showing
10 changed files
with
200 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
const settings = { | ||
TEXT_ONLY: 'textOnly', | ||
TEXT_AND_FAVICONS: 'textAndFavicons', | ||
FAVICONS_ONLY: 'faviconsOnly' | ||
} | ||
|
||
module.exports = settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,24 +6,45 @@ const appConfig = require('./constants/appConfig') | |
const Immutable = require('immutable') | ||
const settings = require('./constants/settings') | ||
const {passwordManagers, defaultPasswordManager, extensionIds, displayNames} = require('./constants/passwordManagers') | ||
const bookmarksToolbarMode = require('../app/common/constants/bookmarksToolbarMode') | ||
|
||
// Retrofit the new single setting; we don't want to erase values set by the user. | ||
const passwordManagerDefault = (settingKey, settingsCollection) => { | ||
const onePasswordEnabled = resolveValue(settings.ONE_PASSWORD_ENABLED, settingsCollection) === true | ||
if (onePasswordEnabled) { return passwordManagers.ONE_PASSWORD } | ||
if (onePasswordEnabled) return passwordManagers.ONE_PASSWORD | ||
|
||
const dashlaneEnabled = resolveValue(settings.DASHLANE_ENABLED, settingsCollection) === true | ||
if (dashlaneEnabled) { return passwordManagers.DASHLANE } | ||
if (dashlaneEnabled) return passwordManagers.DASHLANE | ||
|
||
const lastPassEnabled = resolveValue(settings.LAST_PASS_ENABLED, settingsCollection) === true | ||
if (lastPassEnabled) { return passwordManagers.LAST_PASS } | ||
if (lastPassEnabled) return passwordManagers.LAST_PASS | ||
|
||
const disabled = resolveValue(settings.PASSWORD_MANAGER_ENABLED, settingsCollection) === false | ||
if (disabled) { return passwordManagers.UNMANAGED } | ||
if (disabled) return passwordManagers.UNMANAGED | ||
|
||
return defaultPasswordManager | ||
} | ||
|
||
const bookmarksBarDefault = (settingKey, settingsCollection) => { | ||
const faviconsOnly = resolveValue(settings.SHOW_BOOKMARKS_TOOLBAR_ONLY_FAVICON, settingsCollection) === true | ||
if (faviconsOnly) return bookmarksToolbarMode.FAVICONS_ONLY | ||
|
||
const favicons = resolveValue(settings.SHOW_BOOKMARKS_TOOLBAR_FAVICON, settingsCollection) === true | ||
if (favicons) return bookmarksToolbarMode.TEXT_AND_FAVICONS | ||
|
||
return bookmarksToolbarMode.TEXT_ONLY | ||
} | ||
|
||
// Retrofit a new setting based on old values; we don't want to lose existing user settings. | ||
const getDefaultSetting = (settingKey, settingsCollection) => { | ||
switch (settingKey) { | ||
case settings.ACTIVE_PASSWORD_MANAGER: | ||
return passwordManagerDefault(settingKey, settingsCollection) | ||
case settings.BOOKMARKS_TOOLBAR_MODE: | ||
return bookmarksBarDefault(settingKey, settingsCollection) | ||
} | ||
return undefined | ||
} | ||
|
||
const resolveValue = (settingKey, settingsCollection) => { | ||
const appSettings = (process.type === 'browser' | ||
? require('./stores/appStore').getState().get('settings') | ||
|
@@ -38,13 +59,9 @@ const resolveValue = (settingKey, settingsCollection) => { | |
} | ||
|
||
module.exports.getSetting = (settingKey, settingsCollection) => { | ||
if (settingKey === settings.ACTIVE_PASSWORD_MANAGER) { | ||
const currentValue = resolveValue(settingKey, settingsCollection) | ||
return !currentValue | ||
? passwordManagerDefault(settingKey, settingsCollection) | ||
: currentValue | ||
} | ||
return resolveValue(settingKey, settingsCollection) | ||
const setting = resolveValue(settingKey, settingsCollection) | ||
if (setting) return setting | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
bsclifton
Author
Member
|
||
return getDefaultSetting(settingKey, settingsCollection) | ||
} | ||
|
||
module.exports.getActivePasswordManager = (settingsCollection) => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
@darkdh found this first, but wouldn't this make anything that had a false value explicitly use the default value instead?