Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: start on login #1381

Merged
merged 1 commit into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
)