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 975
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4872 from brave/default-browser
Add whether brave is default browser check
- Loading branch information
Showing
21 changed files
with
288 additions
and
3 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,12 @@ | ||
/* 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 getSetting = require('../../../js/settings').getSetting | ||
const settings = require('../../../js/constants/settings') | ||
|
||
module.exports.shouldDisplayDialog = (state) => { | ||
return !getSetting(settings.IS_DEFAULT_BROWSER) && | ||
!state.get('defaultBrowserCheckComplete') && | ||
getSetting(settings.CHECK_DEFAULT_ON_STARTUP) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* 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 React = require('react') | ||
const ImmutableComponent = require('../../../js/components/immutableComponent') | ||
const Dialog = require('../../../js/components/dialog') | ||
const Button = require('../../../js/components/button') | ||
const SwitchControl = require('../../../js/components/switchControl') | ||
const appActions = require('../../../js/actions/appActions') | ||
const windowActions = require('../../../js/actions/windowActions') | ||
const settings = require('../../../js/constants/settings') | ||
|
||
class CheckDefaultBrowserDialog extends ImmutableComponent { | ||
constructor () { | ||
super() | ||
this.onCheckDefaultOnStartup = this.onCheckDefaultOnStartup.bind(this) | ||
this.onNotNow = this.onNotNow.bind(this) | ||
this.onUseBrave = this.onUseBrave.bind(this) | ||
} | ||
|
||
onCheckDefaultOnStartup (e) { | ||
windowActions.setModalDialogDetail('checkDefaultBrowserDialog', {checkDefaultOnStartup: e.target.value}) | ||
} | ||
onNotNow () { | ||
appActions.defaultBrowserUpdated(false) | ||
appActions.defaultBrowserCheckComplete() | ||
appActions.changeSetting(settings.CHECK_DEFAULT_ON_STARTUP, this.props.checkDefaultOnStartup) | ||
} | ||
onUseBrave () { | ||
appActions.defaultBrowserUpdated(true) | ||
appActions.defaultBrowserCheckComplete() | ||
appActions.changeSetting(settings.CHECK_DEFAULT_ON_STARTUP, this.props.checkDefaultOnStartup) | ||
} | ||
render () { | ||
return <Dialog className='checkDefaultBrowserDialog' > | ||
<div className='checkDefaultBrowser' onClick={(e) => e.stopPropagation()}> | ||
<div className='braveIcon' /> | ||
<div className='makeBraveDefault' data-l10n-id='makeBraveDefault' /> | ||
<SwitchControl className='checkDefaultOnStartup' rightl10nId='checkDefaultOnStartup' | ||
checkedOn={this.props.checkDefaultOnStartup} onClick={this.onCheckDefaultOnStartup} /> | ||
<div className='checkDefaultBrowserButtons'> | ||
<Button l10nId='notNow' className='secondaryAltButton' onClick={this.onNotNow} /> | ||
<Button l10nId='useBrave' className='primaryButton' onClick={this.onUseBrave} /> | ||
</div> | ||
</div> | ||
</Dialog> | ||
} | ||
} | ||
|
||
module.exports = CheckDefaultBrowserDialog |
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
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
Oops, something went wrong.