Skip to content

Commit

Permalink
fix: start on login (#1381)
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
  • Loading branch information
hacdias authored Apr 17, 2020
1 parent 8542d45 commit d551ecd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion public/locales/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"takeScreenshotDescription": "Use <0>{key1}</0> + <2>{key2}</2> + <3>{key3}</3> to take screenshots and add them to your repository.",
"downloadHash": "Download hash",
"downloadHashDescription": "Use <0>{key1}</0> + <2>{key2}</2> + <3>{key3}</3> to download the last copied hash or path to your system.",
"launchOnStartup": "Launch on startup",
"launchOnStartup": "Launch on login",
"globalShortcuts": "Global Shortcuts",
"globalShortcutsAre": "IPFS Desktop provides some features that can be globally accessed through keyboard shortcuts. You can enable or disable them here.",
"AnalyticsToggle": {
Expand Down
6 changes: 4 additions & 2 deletions src/bundles/ipfs-desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ if (window.ipfsDesktop) {

selectDesktopSettings: state => state.ipfsDesktop,

selectDesktopPlatform: state => state.ipfsDesktop.platform,

selectDesktopVersion: () => window.ipfsDesktop.version,

selectDesktopCountlyDeviceId: () => window.ipfsDesktop.countlyDeviceId,

selectDesktopCountlyActions: () => window.ipfsDesktop.countlyActions,

doDesktopStartListening: () => async ({ dispatch, store }) => {
window.ipfsDesktop.onConfigChanged(({ config, changed, success }) => {
window.ipfsDesktop.onConfigChanged(({ platform, config, changed, success }) => {
const prevConfig = store.selectDesktopSettings()

if (Object.keys(prevConfig).length === 0) {
Expand Down Expand Up @@ -82,7 +84,7 @@ if (window.ipfsDesktop) {

dispatch({
type: 'DESKTOP_SETTINGS_CHANGED',
payload: config
payload: config ? { ...config, platform } : undefined
})
})
},
Expand Down
8 changes: 4 additions & 4 deletions src/settings/DesktopSettings.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react'
import os from 'os'
import { connect } from 'redux-bundler-react'
import { withTranslation, Trans } from 'react-i18next'
import Box from '../components/box/Box'
Expand Down Expand Up @@ -33,18 +32,18 @@ const CheckboxSetting = ({ children, title, ...props }) => (

const Key = ({ children }) => <span className='monospace br2 bg-snow ph1'>{ children }</span>

export function DesktopSettings ({ t, doDesktopSettingsToggle, desktopSettings }) {
export function DesktopSettings ({ t, doDesktopSettingsToggle, desktopSettings, desktopPlatform }) {
return (
<Box className='mb3 pa4'>
<Title>{t('ipfsDesktop')}</Title>

<CheckboxSetting checked={desktopSettings.autoLaunch || false}
title={t('launchOnStartup')}
disabled={!(['win32', 'darwin', 'linux'].includes(os.platform()) && process.env.NODE_ENV !== 'development')}
disabled={!(['win32', 'darwin', 'linux'].includes(desktopPlatform))}
onChange={() => doDesktopSettingsToggle('autoLaunch')} />
<CheckboxSetting checked={desktopSettings.ipfsOnPath || false}
title={t('ipfsCmdTools')}
disabled={os.platform() === 'win32'}
disabled={desktopPlatform === 'win32'}
onChange={() => doDesktopSettingsToggle('ipfsOnPath')}>
<Trans
i18nKey='ipfsCmdToolsDescription'
Expand Down Expand Up @@ -89,6 +88,7 @@ export const TranslatedDesktopSettings = withTranslation('settings')(DesktopSett

export default connect(
'selectDesktopSettings',
'selectDesktopPlatform',
'doDesktopSettingsToggle',
TranslatedDesktopSettings
)

0 comments on commit d551ecd

Please sign in to comment.