|
1 | 1 | import { DefaultQuickActions, DefaultSettings, IsDebug, Permission, QuickAction, Settings } from '@/data/Constants'; |
2 | 2 | import { PlainPage } from '@/model/Page'; |
3 | 3 | import PreferencesService from '@/service/PreferencesService'; |
4 | | -import { app, safeStorage, session } from 'electron'; |
| 4 | +import { app, Rectangle, safeStorage, session } from 'electron'; |
5 | 5 | import Store from 'electron-store'; |
6 | 6 |
|
7 | | -/** |
8 | | - * Bounds interface for window dimensions |
9 | | - */ |
10 | | -interface Bounds { |
11 | | - width: number; |
12 | | - height: number; |
13 | | - x?: number; |
14 | | - y?: number; |
15 | | -} |
16 | | - |
17 | 7 | type AllPermissions = Record<string, SessionPermissions>; |
18 | 8 | type SessionPermissions = Record<string, UrlPermissions>; |
19 | 9 | type UrlPermissions = Record<string, PermissionStatus>; |
@@ -97,30 +87,34 @@ class Vault { |
97 | 87 | * Storage class - manages application data persistence |
98 | 88 | */ |
99 | 89 | class Storage { |
100 | | - static getSharedBounds(): Bounds { |
| 90 | + static getSharedBounds(): Rectangle { |
101 | 91 | return Vault.get('SharedBounds', { |
102 | 92 | width: Storage.getSettings(Settings.DEFAULT_WIDTH), |
103 | 93 | height: Storage.getSettings(Settings.DEFAULT_HEIGHT), |
104 | | - } as Bounds)!; |
| 94 | + x: 0, |
| 95 | + y: 0, |
| 96 | + })!; |
105 | 97 | } |
106 | 98 |
|
107 | 99 | static getSharedSize(): { width: number; height: number } { |
108 | 100 | const bounds = Storage.getSharedBounds(); |
109 | 101 | return { width: bounds.width, height: bounds.height }; |
110 | 102 | } |
111 | 103 |
|
112 | | - static setSharedBounds(value: Bounds): void { |
| 104 | + static setSharedBounds(value: Rectangle): void { |
113 | 105 | Vault.set('SharedBounds', value); |
114 | 106 | } |
115 | 107 |
|
116 | | - static getWindowBounds(id: string | number): Bounds { |
| 108 | + static getWindowBounds(id: string | number): Rectangle { |
117 | 109 | return Vault.get(`WindowBounds.${id}`, { |
118 | 110 | width: Storage.getSettings(Settings.DEFAULT_WIDTH), |
119 | 111 | height: Storage.getSettings(Settings.DEFAULT_HEIGHT), |
120 | | - } as Bounds)!; |
| 112 | + x: 0, |
| 113 | + y: 0, |
| 114 | + })!; |
121 | 115 | } |
122 | 116 |
|
123 | | - static setWindowBounds(id: string | number, value: Bounds): void { |
| 117 | + static setWindowBounds(id: string | number, value: Rectangle): void { |
124 | 118 | Vault.set(`WindowBounds.${id}`, value); |
125 | 119 | } |
126 | 120 |
|
@@ -150,11 +144,13 @@ class Storage { |
150 | 144 | Storage.setPages(pages); |
151 | 145 | } |
152 | 146 |
|
153 | | - static getDefaultSize(): Bounds { |
| 147 | + static getDefaultSize(): Rectangle { |
154 | 148 | return { |
155 | 149 | width: Storage.getSettings(Settings.DEFAULT_WIDTH), |
156 | 150 | height: Storage.getSettings(Settings.DEFAULT_HEIGHT), |
157 | | - } as Bounds; |
| 151 | + x: 0, |
| 152 | + y: 0, |
| 153 | + }; |
158 | 154 | } |
159 | 155 |
|
160 | 156 | static getPermissions( |
|
0 commit comments