Skip to content

Commit

Permalink
Merge pull request #4266 from brave/bsc-remove-welcome-theme
Browse files Browse the repository at this point in the history
Remove left-over "Theme" content from welcome screen
  • Loading branch information
bsclifton authored Dec 20, 2019
2 parents b2fa9ad + 9d4c576 commit c88f0f7
Show file tree
Hide file tree
Showing 13 changed files with 8 additions and 106 deletions.
7 changes: 0 additions & 7 deletions browser/ui/webui/brave_webui_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,6 @@ void CustomizeWebUIHTMLSource(const std::string &name,
{ "chooseSearchEngine", IDS_BRAVE_WELCOME_PAGE_SEARCH_DESC },
{ "selectSearchEngine", IDS_BRAVE_WELCOME_PAGE_SEARCH_SELECT },
{ "privateExperience", IDS_BRAVE_WELCOME_PAGE_PRIVATE_EXPERIENCE_DESC },
{ "findToolbarTheme", IDS_BRAVE_WELCOME_PAGE_THEME_TITLE },
{ "chooseTheme", IDS_BRAVE_WELCOME_PAGE_THEME_DESC },
{ "selectTheme", IDS_BRAVE_WELCOME_PAGE_SELECT_THEME_DESC },
{ "confirmTheme", IDS_BRAVE_WELCOME_PAGE_CONFIRM_THEME_BUTTON },
{ "light", IDS_BRAVE_WELCOME_PAGE_LIGHT_THEME_DESC },
{ "dark", IDS_BRAVE_WELCOME_PAGE_DARK_THEME_DESC },
{ "systemTheme", IDS_BRAVE_WELCOME_PAGE_SYSTEM_THEME_DESC },
{ "skipWelcomeTour", IDS_BRAVE_WELCOME_PAGE_SKIP_BUTTON },
{ "next", IDS_BRAVE_WELCOME_PAGE_NEXT_BUTTON },
{ "done", IDS_BRAVE_WELCOME_PAGE_DONE_BUTTON },
Expand Down
6 changes: 0 additions & 6 deletions components/brave_welcome_ui/actions/welcome_actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,10 @@ export const getSearchEngineProvidersSuccess = (searchProviders: Array<Welcome.S

export const getBrowserProfilesSuccess = (browserProfiles: Array<Welcome.BrowserProfile>) => action(types.IMPORT_BROWSER_PROFILES_SUCCESS, browserProfiles)

export const getBrowserThemesSuccess = (browserThemes: Array<Welcome.BrowserTheme>) => action(types.IMPORT_BROWSER_THEMES_SUCCESS, browserThemes)

export const getSearchEngineProviders = () => welcomeUtils.getSearchEngineProviders()

export const getBrowserProfiles = () => welcomeUtils.getBrowserProfiles()

export const getBrowserThemes = () => welcomeUtils.getBrowserThemes()

export const setTheme = (browserTheme: Welcome.BrowserTheme) => action(types.SET_BROWSER_THEME, browserTheme)

export const recordP3A = (details: any) => action(types.RECORD_P3A, {
details
})
1 change: 0 additions & 1 deletion components/brave_welcome_ui/brave_welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ window.cr.define('brave_welcome', function () {
const actions = bindActionCreators(welcomeActions, store.dispatch.bind(store))
actions.getSearchEngineProviders()
actions.getBrowserProfiles()
actions.getBrowserThemes()
}

function initialize () {
Expand Down
2 changes: 0 additions & 2 deletions components/brave_welcome_ui/constants/welcome_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ export const enum types {
CHANGE_DEFAULT_SEARCH_PROVIDER = '@@welcome/CHANGE_DEFAULT_SEARCH',
IMPORT_DEFAULT_SEARCH_PROVIDERS_SUCCESS = '@@welcome/IMPORT_DEFAULT_SEARCH_PROVIDERS_SUCCESS',
IMPORT_BROWSER_PROFILES_SUCCESS = '@@welcome/IMPORT_BROWSER_PROFILES_SUCCESS',
IMPORT_BROWSER_THEMES_SUCCESS = '@@welcome/IMPORT_BROWSER_THEMES_SUCCESS',
SET_BROWSER_THEME = '@@welcome/SET_BROWSER_THEME',
RECORD_P3A = '@welcome/RECORD_P3A'
}
6 changes: 0 additions & 6 deletions components/brave_welcome_ui/reducers/welcome_reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ const welcomeReducer: Reducer<Welcome.State | undefined> = (state: Welcome.State
const payload = action.payload
const startingState = state
switch (action.type) {
case types.IMPORT_BROWSER_THEMES_SUCCESS:
state = { ...state, browserThemes: payload }
break
case types.SET_BROWSER_THEME:
chrome.braveTheme.setBraveThemeType(payload)
break
case types.IMPORT_BROWSER_DATA_REQUESTED:
chrome.send('importData', [payload])
break
Expand Down
3 changes: 1 addition & 2 deletions components/brave_welcome_ui/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ const keyName = 'welcome-data'

export const defaultState = {
searchProviders: [],
browserProfiles: [],
browserThemes: []
browserProfiles: []
}

const cleanData = (state: Welcome.State) => {
Expand Down
9 changes: 1 addition & 8 deletions components/brave_welcome_ui/stories/page/fakeLocale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ const locale = {
fakeSearchProvider1: 'DuckDuckGo',
fakeSearchProvider2: 'Google (default)',
// fourth screen
chooseYourTheme: 'Choose your color theme',
selectTheme: 'Select a theme',
findToolbarTheme: 'Set the color of your toolbar by selecting the light or dark option from the settings panel.',
themeOption1: 'Light',
themeOption2: 'Dark',
themeOption3: 'System theme (default)',
// fifth screen
// protectYourPrivacy: 'Manage your shields',
// adjustProtectionLevel: 'Protect against privacy-invading ads and trackers while browsing with Brave Shields. Set Shields to "down" if a site doesn’t seem to be working properly.',
// showMeWhere: 'Show Shields',
Expand All @@ -39,7 +32,7 @@ const locale = {
p3aSettings: 'Settings',
p3aLink1: '#',
p3aLink2: '#',
// sixth screen
// fifth screen
enableBraveRewards: 'Enable Brave Rewards',
setupBraveRewards: 'Your attention is valuable. Earn by viewing privacy-respecting ads while you browse, and pay it forward to support content creators you love.',
getStarted: 'Enable Rewards',
Expand Down
17 changes: 1 addition & 16 deletions components/brave_welcome_ui/welcomeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import { Dispatch } from 'redux'
import {
getSearchEngineProvidersSuccess,
getBrowserProfilesSuccess,
getBrowserThemesSuccess
getBrowserProfilesSuccess
} from './actions/welcome_actions'
import { State as ImportBoxState } from './containers/screens/importBox'

Expand Down Expand Up @@ -54,17 +53,3 @@ export const getSourceBrowserProfileIndex = (state: ImportBoxState): number => {

export const isValidBrowserProfiles = (browserProfiles: Array<Welcome.BrowserProfile>) =>
browserProfiles && Array.isArray(browserProfiles) && browserProfiles.length > 0

// Theme box

export const getBrowserThemes = () => {
return (dispatch: Dispatch) => {
new Promise(resolve => chrome.braveTheme.getBraveThemeList(resolve))
.then((response: string) => {
dispatch(getBrowserThemesSuccess(JSON.parse(response)))
})
.catch((error: any) => {
console.error('Could not load browser themes', error)
})
}
}
6 changes: 0 additions & 6 deletions components/definitions/welcome.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ declare namespace Welcome {
welcomeData: State | undefined
}

export interface BrowserTheme {
name: string
index: string
}

export interface BrowserProfile {
autofillFormData: boolean,
cookies: boolean,
Expand Down Expand Up @@ -47,6 +42,5 @@ declare namespace Welcome {
export interface State {
searchProviders: Array<SearchEngineEntry>
browserProfiles: Array<BrowserProfile>
browserThemes: Array<BrowserTheme>
}
}
7 changes: 0 additions & 7 deletions components/resources/brave_components_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,6 @@
<message name="IDS_BRAVE_WELCOME_PAGE_SEARCH_DESC" desc="Explainer text about search engines in Brave">Choose the search engine you would like to use by default when searching the web from the address bar.</message>
<message name="IDS_BRAVE_WELCOME_PAGE_SEARCH_TITLE" desc="Welcome message title for search engines">Set default search engine</message>
<message name="IDS_BRAVE_WELCOME_PAGE_PRIVATE_EXPERIENCE_DESC" desc="Explainer text about a more private search option">For a more private search experience, try DuckDuckGo.</message>
<message name="IDS_BRAVE_WELCOME_PAGE_THEME_TITLE" desc="Welcome message title for theming">Choose your color theme</message>
<message name="IDS_BRAVE_WELCOME_PAGE_THEME_DESC" desc="Explainer text about theming in Brave">Set the color of your toolbar by selecting the light or dark option from the settings panel.</message>
<message name="IDS_BRAVE_WELCOME_PAGE_SELECT_THEME_DESC" desc="Dropdown option text prompting user to select a theme">Select a theme</message>
<message name="IDS_BRAVE_WELCOME_PAGE_CONFIRM_THEME_BUTTON" desc="Button to confirm the theme">Confirm</message>
<message name="IDS_BRAVE_WELCOME_PAGE_SYSTEM_THEME_DESC" desc="Dropdown option text for default system theme ">System theme (default)</message>
<message name="IDS_BRAVE_WELCOME_PAGE_LIGHT_THEME_DESC" desc="Dropdown option text for light theme ">Light</message>
<message name="IDS_BRAVE_WELCOME_PAGE_DARK_THEME_DESC" desc="Dropdown option text for dark theme ">Dark</message>
<message name="IDS_BRAVE_WELCOME_PAGE_SKIP_BUTTON" desc="Button to skip the welcome tour and go to the new tab page">Skip welcome tour</message>
<message name="IDS_BRAVE_WELCOME_PAGE_NEXT_BUTTON" desc="Button to move to the next slide of the welcome tour">Next</message>
<message name="IDS_BRAVE_WELCOME_PAGE_DONE_BUTTON" desc="Button that ends the welcome tour and moves the user to the new tab page">Done</message>
Expand Down
15 changes: 0 additions & 15 deletions components/test/brave_welcome_ui/actions/welcome_actions_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,4 @@ describe('welcome_actions', () => {
payload: mockPayload
})
})

it('getBrowserThemesSuccess', () => {
const mockPayload = []
expect(actions.getBrowserThemesSuccess(mockPayload)).toEqual({
type: types.IMPORT_BROWSER_THEMES_SUCCESS,
payload: mockPayload
})
})

it('setTheme', () => {
expect(actions.setTheme('Dark')).toEqual({
type: types.SET_BROWSER_THEME,
payload: 'Dark'
})
})
})
3 changes: 1 addition & 2 deletions components/test/brave_welcome_ui/components/app_test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ describe('welcomePage component', () => {
expect(mapStateToProps(welcomeInitialState)).toEqual({
welcomeData: {
searchProviders: [],
browserProfiles: [],
browserThemes: []
browserProfiles: []
}
})
})
Expand Down
32 changes: 4 additions & 28 deletions components/test/brave_welcome_ui/reducers/welcome_reducer_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ window.open = jest.fn()
window.close = jest.fn()

describe('welcomeReducer', () => {
describe('Handlle initial state', () => {
describe('Handle initial state', () => {
let spy: jest.SpyInstance
beforeEach(() => {
spy = jest.spyOn(storage, 'load')
Expand All @@ -24,8 +24,7 @@ describe('welcomeReducer', () => {
const assertion = welcomeReducer(undefined, actions.closeTabRequested())
expect(assertion).toEqual({
searchProviders: [],
browserProfiles: [],
browserThemes: []
browserProfiles: []
})
expect(spy).toBeCalled()
expect(spy.mock.calls[0][1]).toBe(undefined)
Expand Down Expand Up @@ -105,33 +104,11 @@ describe('welcomeReducer', () => {
})
})

describe('SET_BROWSER_THEME', () => {
let changeThemeStub: jest.SpyInstance

beforeEach(() => {
changeThemeStub = jest.spyOn(chrome.braveTheme, 'setBraveThemeType')
})

afterEach(() => {
changeThemeStub.mockRestore()
})

it('should call setBraveThemeType with the correct argument', () => {
welcomeReducer(undefined, {
type: types.SET_BROWSER_THEME,
payload: 'Dark'
})
expect(changeThemeStub).toBeCalledTimes(1)
expect(changeThemeStub).toBeCalledWith('Dark')
})
})

describe('IMPORT_DEFAULT_SEARCH_PROVIDERS_SUCCESS', () => {
it('should set default search provider data', () => {
const mockState = {
searchProviders: [],
browserProfiles: [],
browserThemes: []
browserProfiles: []
}
const result = welcomeReducer(mockState, {
type: types.IMPORT_DEFAULT_SEARCH_PROVIDERS_SUCCESS,
Expand All @@ -149,8 +126,7 @@ describe('welcomeReducer', () => {
it('should set import browser profile data', () => {
const mockState = {
searchProviders: [],
browserProfiles: [],
browserThemes: []
browserProfiles: []
}
const result = welcomeReducer(mockState, {
type: types.IMPORT_BROWSER_PROFILES_SUCCESS,
Expand Down

0 comments on commit c88f0f7

Please sign in to comment.