Skip to content

Commit 220d2e8

Browse files
Revert "Add dnd support for windows"
Can't get this to work. Windows is hard to dev on which makes this frustrating. As there doesn't seem to be a good way to get this to work on linux or macOS, I'll just remove for now. This reverts commit fff6815.
1 parent 6f4dcb0 commit 220d2e8

File tree

9 files changed

+330
-146
lines changed

9 files changed

+330
-146
lines changed

app/main/lib/breaks.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
Settings,
99
SoundType,
1010
} from "../../types/settings";
11-
import { checkDoNotDisturb } from "./dnd";
1211
import { sendIpc } from "./ipc";
1312
import { showNotification } from "./notifications";
1413
import { getSettings } from "./store";
@@ -213,17 +212,10 @@ export function checkIdle(): boolean {
213212

214213
function checkShouldHaveBreak(): boolean {
215214
const settings: Settings = getSettings();
216-
const isInWorkingHours = checkInWorkingHours();
217-
const isIdle = checkIdle();
218-
const isDndOn = checkDoNotDisturb();
215+
const inWorkingHours = checkInWorkingHours();
216+
const idle = checkIdle();
219217

220-
return (
221-
!havingBreak &&
222-
settings.breaksEnabled &&
223-
isInWorkingHours &&
224-
!isIdle &&
225-
!isDndOn
226-
);
218+
return !havingBreak && settings.breaksEnabled && inWorkingHours && !idle;
227219
}
228220

229221
function checkBreak(): void {

app/main/lib/dnd.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

app/main/lib/ipc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ ipcMain.handle(
4646
}
4747
);
4848

49-
ipcMain.handle(IpcChannel.SettingsGet, (): [Settings, NodeJS.Platform] => {
49+
ipcMain.handle(IpcChannel.SettingsGet, (): Settings => {
5050
log.info(IpcChannel.SettingsGet);
51-
return [getSettings(), process.platform];
51+
return getSettings();
5252
});
5353

5454
ipcMain.handle(

app/renderer/components/Break.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ export default function Break() {
251251

252252
React.useEffect(() => {
253253
const init = async () => {
254-
const [allowPostpone, [settings]] = await Promise.all([
254+
const [allowPostpone, settings] = await Promise.all([
255255
ipcRenderer.invokeGetAllowPostpone(),
256-
ipcRenderer.invokeGetSettings() as Promise<[Settings, NodeJS.Platform]>,
256+
ipcRenderer.invokeGetSettings() as Promise<Settings>,
257257
]);
258258

259259
setAllowPostpone(allowPostpone);

app/renderer/components/Settings.tsx

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export default function SettingsEl() {
3232
const [settingsDraft, setSettingsDraft] = React.useState<Settings | null>(
3333
null
3434
);
35-
const [platform, setPlatform] = React.useState<NodeJS.Platform | null>(null);
3635
const [settings, setSettings] = React.useState<Settings | null>(null);
3736
const [darkMode, setDarkMode] = React.useState(initialDarkMode);
3837
const [showAdvancedBreaks, setShowAdvanedBreaks] = React.useState(false);
@@ -49,21 +48,17 @@ export default function SettingsEl() {
4948

5049
React.useEffect(() => {
5150
(async () => {
52-
const [settings, platform] = (await ipcRenderer.invokeGetSettings()) as [
53-
Settings,
54-
NodeJS.Platform
55-
];
51+
const settings = (await ipcRenderer.invokeGetSettings()) as Settings;
5652
setSettingsDraft(settings);
5753
setSettings(settings);
58-
setPlatform(platform);
5954
})();
6055
}, []);
6156

6257
const dirty = React.useMemo(() => {
6358
return JSON.stringify(settingsDraft) !== JSON.stringify(settings);
6459
}, [settings, settingsDraft]);
6560

66-
if (settings === null || settingsDraft === null || platform === null) {
61+
if (settings === null || settingsDraft === null) {
6762
return null;
6863
}
6964

@@ -476,16 +471,6 @@ export default function SettingsEl() {
476471
onChange={handleSwitchChange.bind(null, "autoLaunch")}
477472
/>
478473
</FormGroup>
479-
{platform === "win32" && (
480-
<FormGroup>
481-
<Switch
482-
label="Respect system Do Not Disturb settings"
483-
checked={settingsDraft.respectDnd}
484-
onChange={handleSwitchChange.bind(null, "respectDnd")}
485-
disabled={!settingsDraft.breaksEnabled}
486-
/>
487-
</FormGroup>
488-
)}
489474
</>
490475
}
491476
/>

app/types/settings.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ export interface Settings {
5252
endBreakEnabled: boolean;
5353
skipBreakEnabled: boolean;
5454
postponeBreakEnabled: boolean;
55-
respectDnd: boolean;
5655
}
5756

5857
export const defaultWorkingRange: WorkingHoursRange = {
@@ -111,7 +110,6 @@ export const defaultSettings: Settings = {
111110
endBreakEnabled: true,
112111
skipBreakEnabled: false,
113112
postponeBreakEnabled: true,
114-
respectDnd: true,
115113
};
116114

117115
export interface DayConfig {

0 commit comments

Comments
 (0)