Skip to content

Commit 88da443

Browse files
authored
Merge branch 'main' into refactor/remove-legacy-account-structures
2 parents 067e8a8 + d2a048f commit 88da443

28 files changed

+1176
-684
lines changed

config/webpack.config.renderer.base.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ const configuration: webpack.Configuration = {
4040
},
4141

4242
plugins: [
43-
// Development Keys - See README.md
43+
// Development Keys - See CONTRIBUTING.md
4444
new webpack.EnvironmentPlugin({
45-
OAUTH_CLIENT_ID: '3fef4433a29c6ad8f22c',
46-
OAUTH_CLIENT_SECRET: '9670de733096c15322183ff17ed0fc8704050379',
45+
OAUTH_CLIENT_ID: 'Ov23liQIkFs5ehQLNzHF',
46+
OAUTH_CLIENT_SECRET: '404b80632292e18419dbd2a6ed25976856e95255',
4747
}),
4848

4949
// Extract CSS into a separate file

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@
8080
"package.json"
8181
],
8282
"electronLanguages": ["en"],
83+
"protocols": [
84+
{
85+
"name": "Gitify",
86+
"schemes": ["gitify"]
87+
}
88+
],
8389
"mac": {
8490
"category": "public.app-category.developer-tools",
8591
"icon": "assets/images/app-icon.icns",

src/main/main.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ const browserWindowOpts = {
1919
minHeight: 400,
2020
resizable: false,
2121
skipTaskbar: true, // Hide the app from the Windows taskbar
22+
// TODO ideally we would disable this as use a preload script with a context bridge
2223
webPreferences: {
23-
enableRemoteModule: true,
2424
nodeIntegration: true,
2525
contextIsolation: false,
2626
},
@@ -37,11 +37,14 @@ const mb = menubar({
3737
const menuBuilder = new MenuBuilder(mb);
3838
const contextMenu = menuBuilder.buildMenu();
3939

40-
/**
41-
* Electron Auto Updater only supports macOS and Windows
42-
* https://github.com/electron/update-electron-app
43-
*/
40+
// Register your app as the handler for a custom protocol
41+
app.setAsDefaultProtocolClient('gitify');
42+
4443
if (isMacOS() || isWindows()) {
44+
/**
45+
* Electron Auto Updater only supports macOS and Windows
46+
* https://github.com/electron/update-electron-app
47+
*/
4548
const updater = new Updater(mb, menuBuilder);
4649
updater.initialize();
4750
}
@@ -54,13 +57,6 @@ app.whenReady().then(async () => {
5457
mb.on('ready', () => {
5558
mb.app.setAppUserModelId(APPLICATION.ID);
5659

57-
/**
58-
* TODO: Remove @electron/remote use - see #650
59-
* GitHub OAuth 2 Login Flows - Enable Remote Browser Window Launch
60-
*/
61-
require('@electron/remote/main').initialize();
62-
require('@electron/remote/main').enable(mb.window.webContents);
63-
6460
// Tray configuration
6561
mb.tray.setToolTip(APPLICATION.NAME);
6662
mb.tray.setIgnoreDoubleClickEvents(true);
@@ -172,3 +168,9 @@ app.whenReady().then(async () => {
172168
app.setLoginItemSettings(settings);
173169
});
174170
});
171+
172+
// Handle gitify:// custom protocol URL events for OAuth 2.0 callback
173+
app.on('open-url', (event, url) => {
174+
event.preventDefault();
175+
mb.window.webContents.send(namespacedEvent('auth-callback'), url);
176+
});

src/renderer/__mocks__/state-mocks.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@ export const mockToken = 'token-123-456' as Token;
7979
const mockAppearanceSettings: AppearanceSettingsState = {
8080
theme: Theme.SYSTEM,
8181
zoomPercentage: 100,
82-
detailedNotifications: true,
83-
showPills: true,
84-
showNumber: true,
8582
showAccountHeader: false,
8683
wrapNotificationTitle: false,
8784
};
8885

8986
const mockNotificationSettings: NotificationSettingsState = {
9087
groupBy: GroupBy.REPOSITORY,
9188
fetchAllNotifications: true,
89+
detailedNotifications: true,
90+
showPills: true,
91+
showNumber: true,
9292
participating: false,
9393
markAsDoneOnOpen: false,
9494
markAsDoneOnUnsubscribe: false,

src/renderer/components/AllRead.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { type FC, useContext, useMemo } from 'react';
22

33
import { AppContext } from '../context/App';
44
import { Constants } from '../utils/constants';
5-
import { hasFiltersSet } from '../utils/filters';
5+
import { hasAnyFiltersSet } from '../utils/filters';
66
import { EmojiSplash } from './layout/EmojiSplash';
77

88
interface IAllRead {
@@ -12,7 +12,7 @@ interface IAllRead {
1212
export const AllRead: FC<IAllRead> = ({ fullHeight = true }: IAllRead) => {
1313
const { settings } = useContext(AppContext);
1414

15-
const hasFilters = hasFiltersSet(settings);
15+
const hasFilters = hasAnyFiltersSet(settings);
1616

1717
const emoji = useMemo(
1818
() =>

src/renderer/components/Sidebar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { APPLICATION } from '../../shared/constants';
1616
import { AppContext } from '../context/App';
1717
import { quitApp } from '../utils/comms';
1818
import { Constants } from '../utils/constants';
19-
import { hasFiltersSet } from '../utils/filters';
19+
import { hasAnyFiltersSet } from '../utils/filters';
2020
import {
2121
openGitHubIssues,
2222
openGitHubNotifications,
@@ -114,7 +114,7 @@ export const Sidebar: FC = () => {
114114
description="Filter notifications"
115115
unsafeDisableTooltip={false}
116116
size="small"
117-
variant={hasFiltersSet(settings) ? 'primary' : 'invisible'}
117+
variant={hasAnyFiltersSet(settings) ? 'primary' : 'invisible'}
118118
tooltipDirection="e"
119119
onClick={() => toggleFilters()}
120120
data-testid="sidebar-filter-notifications"

src/renderer/components/fields/Checkbox.test.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,19 @@ describe('renderer/components/fields/Checkbox.tsx', () => {
3030
);
3131
expect(tree).toMatchSnapshot();
3232
});
33+
34+
it('should render - positive counter unselected', () => {
35+
const tree = render(<Checkbox {...props} counter={5} checked={false} />);
36+
expect(tree).toMatchSnapshot();
37+
});
38+
39+
it('should render - positive counter selected', () => {
40+
const tree = render(<Checkbox {...props} counter={5} checked={true} />);
41+
expect(tree).toMatchSnapshot();
42+
});
43+
44+
it('should render - zero counter', () => {
45+
const tree = render(<Checkbox {...props} counter={0} />);
46+
expect(tree).toMatchSnapshot();
47+
});
3348
});

src/renderer/components/fields/Checkbox.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import type { FC, ReactNode } from 'react';
22

3-
import { Stack } from '@primer/react';
3+
import { CounterLabel, Stack } from '@primer/react';
44

55
import { cn } from '../../utils/cn';
66
import { Tooltip } from './Tooltip';
77

88
export interface ICheckbox {
99
name: string;
1010
label: string;
11+
counter?: number;
1112
tooltip?: ReactNode | string;
1213
checked: boolean;
1314
disabled?: boolean;
@@ -19,6 +20,8 @@ export const Checkbox: FC<ICheckbox> = ({
1920
visible = true,
2021
...props
2122
}: ICheckbox) => {
23+
const counter = props.counter > 0 ? props.counter : undefined;
24+
2225
return (
2326
visible && (
2427
<Stack
@@ -46,9 +49,16 @@ export const Checkbox: FC<ICheckbox> = ({
4649
>
4750
{props.label}
4851
</label>
52+
4953
{props.tooltip && (
5054
<Tooltip name={`tooltip-${props.name}`} tooltip={props.tooltip} />
5155
)}
56+
57+
{counter && (
58+
<CounterLabel scheme={props.checked ? 'primary' : 'secondary'}>
59+
{counter}
60+
</CounterLabel>
61+
)}
5262
</Stack>
5363
)
5464
);

src/renderer/components/fields/Tooltip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const Tooltip: FC<ITooltip> = (props: ITooltip) => {
1919
onMouseLeave={() => setShowTooltip(false)}
2020
data-testid={`tooltip-${props.name}`}
2121
>
22-
<QuestionIcon className="ml-1 text-gitify-tooltip-icon" />
22+
<QuestionIcon className="text-gitify-tooltip-icon" />
2323
{showTooltip && (
2424
<Box className="absolute left-[-80px] z-10 w-60 rounded-sm border border-gray-300 p-2 shadow-sm bg-gitify-tooltip-popout">
2525
<Box className="text-left text-xs text-gitify-font">

0 commit comments

Comments
 (0)