Skip to content

Commit

Permalink
Merge branch 'master' into 'release'
Browse files Browse the repository at this point in the history
Version 0.5.3-beta5

See merge request kirbo/slothy!24
  • Loading branch information
Kirbo committed Feb 6, 2020
2 parents fb532af + a50af3d commit 522eb98
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 58 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Removed `border-bottom` from `:last-child`.
- Uses modified Node-Wifi, for Windows compatibility.
- `allowDowngrade` is always `true`, so if you have enabled pre-releases and want to switch back to latest stable, just disable `Allow pre-releases`, check updates, install and restart the app and you're back in the latest stable version. Also if I have accidentally published a buggy version of the app and want to delete the release (and you have already updated), you would have in-app option to downgrade into latest stable version with ease.
- Disabled Auto Update on Windows and Linux, since it is not working yet.

### Fixed
- Fixed couple of typos in changelog.
- Bug fixes for Node-Wifi, detecting BSSID on Mac.
- A bug on Node-Wifi in Windows.
- Removed unwanted scrolls.

## [0.5.3-beta5] - 2020-02-06
### Changed
- Disabled Auto Update on Windows and Linux, since it is not working yet.

### Fixed
- Removed unwanted scrolls.

## [0.5.3-beta4] - 2020-02-06
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.5.3-beta4",
"version": "0.5.3-beta5",
"name": "slothy",
"description": "Changes your Slack status based on the SSID you're currently connected to.",
"productName": "Slothy",
Expand Down
2 changes: 2 additions & 0 deletions public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const url = require('url');
const ipc = require('electron').ipcMain;
const { autoUpdater, CancellationToken } = require('electron-updater');
const log = require('electron-log');
const os = require('os');

const storage = require('./lib/storage');
const menuTemplate = require('./menuTemplate');
Expand Down Expand Up @@ -404,6 +405,7 @@ ipc
ifCachedSend('configurations', getConfigurations);
ifCachedSend('connections', getConnections);
ifCachedSend('slackInstances', getSlackInstances);
sendIfMainWindow('setOs', () => os.platform());
if (appConfigurations.updates.checkUpdatesOnLaunch) {
autoUpdater.checkForUpdates();
}
Expand Down
2 changes: 2 additions & 0 deletions src/assets/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ const YEAR_NOW = new Date().getFullYear();
const YEAR_END = `${YEAR_NOW > YEAR_STARTED ? ` - ${YEAR_NOW}` : ''}`;
export const COPYRIGHT_YEAR = `${YEAR_STARTED}${YEAR_END}`;
export const COPYRIGHT = `Kirbo © ${COPYRIGHT_YEAR}`;

export const RELEASES_URL = 'https://github.com/kirbo/slothy/releases';
21 changes: 15 additions & 6 deletions src/container/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ import View from '../View';
* @returns {jsx}
*/
const Authorized = () => (
<Styled>
<Layout>
<AppSider />
<View />
</Layout>
</Styled>
<Consumer>
{({ showLoading }) => (
<Styled showLoading={showLoading}>
<Layout>
<AppSider />
<View />
</Layout>
</Styled>
)}
</Consumer>
);

/**
Expand All @@ -37,6 +41,11 @@ const Styled = styled.div`
min-height: 100vh;
overflow: hidden;
${({ showLoading }) => showLoading && `
width: 100vw;
height: 100vh;
`}
& .ant-layout {
min-height: 100vh;
}
Expand Down
69 changes: 46 additions & 23 deletions src/container/App/AppProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import INITIAL_STATE from './InitialState';
import { Provider } from './Context';
import Loading from '../Loading';

import { sortBy } from '../../assets/utils';
import { sortBy, openExternal } from '../../assets/utils';
import { RELEASES_URL } from '../../assets/constants';

const electron = window.require('electron');
const { ipcRenderer } = electron;
Expand Down Expand Up @@ -136,6 +137,11 @@ class AppProvider extends Component {
ssidsLoaded: true,
});
})
.on('setOs', (event, value) => {
setProperty({
os: value,
});
})
.on('scanningConnections', () => {
setProperty({
ssidsLoaded: false,
Expand Down Expand Up @@ -188,6 +194,7 @@ class AppProvider extends Component {
message.loading(data.message);
})
.on('update-notification', (event, data) => {
const { os } = this.state;
let description = `
<div class="version">
<span class="title">Current version</span>
Expand Down Expand Up @@ -227,14 +234,30 @@ class AppProvider extends Component {
duration: 0,
key: 'update-notification',
btn: (
<React.Fragment>
<>
<Button type="default" size="small" onClick={() => notification.close('update-notification')}>
{data.cancel}
</Button>
<Button type="primary" onClick={() => ipcRenderer.send(data.onConfirm)}>
{data.confirm}
</Button>
</React.Fragment>
{
os === 'darwin'
? (
<Button type="primary" onClick={() => ipcRenderer.send(data.onConfirm)}>
{data.confirm}
</Button>
)
: (
<Button
type="primary"
onClick={() => {
openExternal(`${RELEASES_URL}/tag/v${data.updates.version}`);
notification.close('update-notification');
}}
>
Download manually
</Button>
)
}
</>
),
onClose: () => notification.close('update-notification'),
});
Expand All @@ -248,11 +271,11 @@ class AppProvider extends Component {
duration: 0,
key: 'update-progress',
btn: !appConfigurations.updates.autoDownload && (
<React.Fragment>
<>
<Button type="default" size="small" onClick={() => ipcRenderer.send(data.onCancel)}>
{data.cancel}
</Button>
</React.Fragment>
</>
),
onClose: () => notification.close('update-progress'),
});
Expand All @@ -265,14 +288,14 @@ class AppProvider extends Component {
duration: 0,
key: 'update-downloaded',
btn: (
<React.Fragment>
<>
<Button type="default" size="small" onClick={() => notification.close('update-downloaded')}>
{data.cancel}
</Button>
<Button type="primary" size="small" onClick={() => ipcRenderer.send(data.onConfirm)}>
{data.confirm}
</Button>
</React.Fragment>
</>
),
onClose: () => notification.close('update-downloaded'),
});
Expand All @@ -285,14 +308,14 @@ class AppProvider extends Component {
duration: 0,
key: 'update-cancelled',
btn: (
<React.Fragment>
<>
<Button type="default" size="small" onClick={() => notification.close('update-cancelled')}>
{data.cancel}
</Button>
<Button type="primary" size="small" onClick={() => ipcRenderer.send(data.onConfirm)}>
{data.confirm}
</Button>
</React.Fragment>
</>
),
onClose: () => notification.close('update-notification'),
});
Expand Down Expand Up @@ -351,20 +374,20 @@ class AppProvider extends Component {
const { children } = this.props;

return (
<React.Fragment>
<>
{showLoading && (
<Loading
appConfigurationsLoaded={appConfigurationsLoaded}
configurationsLoaded={configurationsLoaded}
slackInstancesLoaded={slackInstancesLoaded}
ssidsLoaded={ssidsLoaded}
hideLoading={hideLoading}
setProperty={setProperty}
connected={connected}
/>
<Loading
appConfigurationsLoaded={appConfigurationsLoaded}
configurationsLoaded={configurationsLoaded}
slackInstancesLoaded={slackInstancesLoaded}
ssidsLoaded={ssidsLoaded}
hideLoading={hideLoading}
setProperty={setProperty}
connected={connected}
/>
)}
<Provider value={this.state}>{children}</Provider>
</React.Fragment>
</>
);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/container/App/InitialState.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const INITIAL_STATE = {
ssids: [],
viewType: type,
wifiEnabled: false,
os: '',
};

export default INITIAL_STATE;
7 changes: 4 additions & 3 deletions src/container/Loading/Loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ class Loading extends Component {
render = () => {
const { hideLoading } = this.props;
return (
<React.Fragment>
<>
<GlobalStyles />
<Styled hideLoading={hideLoading}>
<Layout>
<div className="container">
<Logo withText />
<div className="loading hidden">
Loading, please standby...
Loading, please standby...
</div>
</div>
</Layout>
</Styled>
</React.Fragment>
</>
);
}
}
Expand Down Expand Up @@ -96,6 +96,7 @@ const Styled = styled.div`
justify-content: center;
background: radial-gradient(${COLOR.darkBlue}, ${COLOR.black});
transition: all 0.5s ease;
z-index: 10000;
opacity: ${({ hideLoading }) => (hideLoading ? 0 : 1)};
& div.logo {
Expand Down
52 changes: 28 additions & 24 deletions src/container/View/Configuration/Configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const timerFormatter = value => {
const Configuration = () => (
<Consumer>
{({
appConfigurations, configurations, slackInstances, currentSsids, updateAppConfigurations, saveConfiguration,
os, appConfigurations, configurations, slackInstances, currentSsids, updateAppConfigurations, saveConfiguration,
}) => {
const connectedBssids = currentSsids.map(({ bssid }) => bssid.toUpperCase());
const bssidConfigurations = configurations.filter(({ bssid }) => bssid && connectedBssids.includes(bssid.toUpperCase()));
Expand Down Expand Up @@ -249,29 +249,33 @@ const Configuration = () => (
/>
</ConfigurationSection>

<ConfigurationSection spacer>
<Tooltip placement="right" title={`Opt-in if you want ${packageJson.productName} to automatically download new updates.`}>
<ConfigurationTitle>
Auto download updates <Icon icon="info-circle" />
</ConfigurationTitle>
</Tooltip>
<Switch
checked={appConfigurations.updates.autoDownload}
onChange={updateAppConfiguration('updates', ['autoDownload'])}
/>
</ConfigurationSection>

<ConfigurationSection spacer>
<Tooltip placement="right" title={`Opt-in if you want ${packageJson.productName} to automatically install new (downloaded) updates on application quit.`}>
<ConfigurationTitle>
Install updates automatically on application quit <Icon icon="info-circle" />
</ConfigurationTitle>
</Tooltip>
<Switch
checked={appConfigurations.updates.autoInstallOnAppQuit}
onChange={updateAppConfiguration('updates', ['autoInstallOnAppQuit'])}
/>
</ConfigurationSection>
{os === 'darwin' && (
<>
<ConfigurationSection spacer>
<Tooltip placement="right" title={`Opt-in if you want ${packageJson.productName} to automatically download new updates.`}>
<ConfigurationTitle>
Auto download updates <Icon icon="info-circle" />
</ConfigurationTitle>
</Tooltip>
<Switch
checked={appConfigurations.updates.autoDownload}
onChange={updateAppConfiguration('updates', ['autoDownload'])}
/>
</ConfigurationSection>

<ConfigurationSection spacer>
<Tooltip placement="right" title={`Opt-in if you want ${packageJson.productName} to automatically install new (downloaded) updates on application quit.`}>
<ConfigurationTitle>
Install updates automatically on application quit <Icon icon="info-circle" />
</ConfigurationTitle>
</Tooltip>
<Switch
checked={appConfigurations.updates.autoInstallOnAppQuit}
onChange={updateAppConfiguration('updates', ['autoInstallOnAppQuit'])}
/>
</ConfigurationSection>
</>
)}

<ConfigurationSection spacer>
<Tooltip placement="right" title="Opt-in if you want to get prereleases.">
Expand Down
1 change: 0 additions & 1 deletion src/container/View/Instance/Instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ const Centered = styled.div`
flex: 1 1 100%;
justify-content: center;
margin: ${DIMENSION['1x']} 0;
width: calc(100vw - 200px);
`;
const Image = styled.div`
&.round img {
Expand Down

0 comments on commit 522eb98

Please sign in to comment.