@ban-dal/os-bridge 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ko.md +252 -0
- package/README.md +154 -21
- package/index.d.ts +98 -0
- package/index.js +59 -52
- package/package.json +6 -6
package/README.ko.md
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# @ban-dal/os-bridge
|
|
2
|
+
|
|
3
|
+
napi-rs 기반의 Node.js 및 Electron용 타입 지원 네이티브 OS API입니다.
|
|
4
|
+
|
|
5
|
+
[EN](README.md) | 한국어
|
|
6
|
+
|
|
7
|
+
## 설치
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @ban-dal/os-bridge
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add @ban-dal/os-bridge
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
yarn add @ban-dal/os-bridge
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Runtime
|
|
22
|
+
|
|
23
|
+
이 패키지는 Node.js, Electron 메인 프로세스 또는 신뢰할 수 있는 preload 스크립트에서 사용하세요.
|
|
24
|
+
|
|
25
|
+
| 플랫폼 | 패키지 | 상태 |
|
|
26
|
+
| --------------- | ----------------------------------- | ------------------------ |
|
|
27
|
+
| macOS arm64 | `@ban-dal/os-bridge-darwin-arm64` | 지원 |
|
|
28
|
+
| macOS x64 | `@ban-dal/os-bridge-darwin-x64` | 지원 |
|
|
29
|
+
| Windows x64 | `@ban-dal/os-bridge-win32-x64-msvc` | 지원 |
|
|
30
|
+
| Linux x64 glibc | `@ban-dal/os-bridge-linux-x64-gnu` | 현재 API에서는 폴백 전용 |
|
|
31
|
+
|
|
32
|
+
플랫폼 패키지는 선택적 의존성입니다. 항상 `@ban-dal/os-bridge`에서 import하세요.
|
|
33
|
+
|
|
34
|
+
## 기능 요약
|
|
35
|
+
|
|
36
|
+
| 기능 | API | macOS | Windows | Linux |
|
|
37
|
+
| ------------------------- | ------------------------------------ | ----- | ------------- | ------------- |
|
|
38
|
+
| 알림 권한 상태 | `getNotificationPermissionStatus` | 지원 | 지원 | `unsupported` |
|
|
39
|
+
| macOS 알림 권한 요청 | `requestMacNotificationPermission` | 지원 | 상태 확인만 | `unsupported` |
|
|
40
|
+
| 알림 방해 수준 | `getNotificationInterruptionLevel` | 지원 | 지원 | `unsupported` |
|
|
41
|
+
| macOS 집중 모드 상태 접근 | `requestMacFocusStatusAuthorization` | 지원 | `unsupported` | `unsupported` |
|
|
42
|
+
| 알림 기능 요약 | `getNotificationCapability` | 지원 | 지원 | `unsupported` |
|
|
43
|
+
|
|
44
|
+
## 사용 방법
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import { getNotificationCapability, type NotificationCapability } from '@ban-dal/os-bridge'
|
|
48
|
+
|
|
49
|
+
const capability: NotificationCapability = getNotificationCapability()
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 기능
|
|
53
|
+
|
|
54
|
+
### getNotificationPermissionStatus
|
|
55
|
+
|
|
56
|
+
`macOS` `Windows`
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
function getNotificationPermissionStatus(options?: NotificationDiagnosticsOptions): NotificationPermissionStatus
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
type NotificationPermissionStatus = 'granted' | 'denied' | 'not-determined' | 'limited' | 'unsupported' | 'unknown'
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
| 플랫폼 | 동작 |
|
|
67
|
+
| ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
68
|
+
| macOS | 앱 번들 밖에서 호출하면 `unknown`을 반환합니다. |
|
|
69
|
+
| Windows | 앱 사용자 모델 ID로 알림 권한을 조회합니다.<br>앱별 거부 상태가 없으면 Windows는 기본적으로 허용 상태로 봅니다.<br>앱 ID가 없거나 비어 있으면 `unknown`을 반환합니다. |
|
|
70
|
+
| Linux | `unsupported`를 반환합니다. |
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import { getNotificationPermissionStatus } from '@ban-dal/os-bridge'
|
|
74
|
+
|
|
75
|
+
const status = getNotificationPermissionStatus({ appUserModelId: 'com.example.my-app' })
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Windows Electron 앱에서는 `app.setAppUserModelId(...)`에 사용한 것과 같은 앱 사용자 모델 ID를 전달하세요.
|
|
79
|
+
|
|
80
|
+
`getPermissionStatus(appUserModelId?)`는 저수준 호환 별칭으로 계속 사용할 수 있습니다.
|
|
81
|
+
|
|
82
|
+
### requestMacNotificationPermission
|
|
83
|
+
|
|
84
|
+
`macOS` `Windows 상태 확인만`
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
function requestMacNotificationPermission(options?: NotificationDiagnosticsOptions): NotificationPermissionStatus
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
macOS에서 알림 권한을 요청하고, 요청 결과의 권한 상태를 반환합니다.
|
|
91
|
+
|
|
92
|
+
Windows는 앱 알림 권한을 요청하는 OS API를 제공하지 않습니다. 기본 알림 상태도 허용이므로, Windows 진단에는 `getNotificationPermissionStatus` 또는 `getNotificationCapability`를 사용하세요.
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
import { requestMacNotificationPermission } from '@ban-dal/os-bridge'
|
|
96
|
+
|
|
97
|
+
const status = requestMacNotificationPermission()
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### getNotificationInterruptionLevel
|
|
101
|
+
|
|
102
|
+
`macOS` `Windows`
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
function getNotificationInterruptionLevel(): NotificationInterruptionLevel
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
type NotificationInterruptionLevel = 'normal' | 'limited' | 'unsupported' | 'unknown'
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
type NotificationDiagnosticsOptions = {
|
|
114
|
+
appUserModelId?: string
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
OS가 현재 일반 알림 전달 상태인지, 제한된 알림 전달 상태인지 반환합니다.
|
|
119
|
+
`limited`는 진단용 컨텍스트일 뿐입니다. 이 앱의 알림이 반드시 차단된다는 뜻은 아닙니다.
|
|
120
|
+
|
|
121
|
+
#### macOS
|
|
122
|
+
|
|
123
|
+
macOS에서는 다음 조건이 필요합니다.
|
|
124
|
+
|
|
125
|
+
1. Apple Developer > Identifiers > 해당 App ID에 Communication Notifications가 활성화되어 있어야 합니다.
|
|
126
|
+
2. ad-hoc이 아닌, 해당 계정을 사용한 Code Sign이 이뤄진 번들된 앱이어야 합니다.
|
|
127
|
+
3. 시스템 설정 > 개인정보 보호 및 보안 > 집중 모드에서 앱을 활성화해야 합니다. 이는 `requestMacFocusStatusAuthorization()` 함수로 사용자에게 요청 Alert을 띄울 수 있습니다.
|
|
128
|
+
|
|
129
|
+
macOS가 집중 모드 또는 방해금지 모드여도 현재 집중 모드의 허용된 앱에 이 앱이 포함되어 있으면 `normal`로 응답됩니다.
|
|
130
|
+
|
|
131
|
+
#### Windows
|
|
132
|
+
|
|
133
|
+
Windows에서는 `ToastNotificationManager.GetDefault().NotificationMode()`에서 방해 수준을 읽습니다.
|
|
134
|
+
|
|
135
|
+
- `Unrestricted`는 `normal`을 반환합니다.
|
|
136
|
+
- `PriorityOnly`와 `AlarmsOnly`는 `limited`를 반환합니다.
|
|
137
|
+
|
|
138
|
+
Windows는 이 앱이 사용자의 우선순위 앱 목록에 포함되어 있는지 노출하지 않습니다. 따라서 `limited`는 시스템이 알림을 제한하고 있다는 뜻이지, 이 앱이 반드시 차단된다는 뜻은 아닙니다.
|
|
139
|
+
|
|
140
|
+
### requestMacFocusStatusAuthorization
|
|
141
|
+
|
|
142
|
+
`macOS`
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
function requestMacFocusStatusAuthorization(): NotificationInterruptionLevel
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
이 앱과 집중 모드 상태를 공유하도록 권한을 요청하고, 요청 후 현재 방해 수준을 반환합니다.
|
|
149
|
+
|
|
150
|
+
OS가 이미 요청을 처리했다면 시스템이 다시 알림 창을 표시하지 않을 수 있습니다.
|
|
151
|
+
|
|
152
|
+
### getNotificationCapability
|
|
153
|
+
|
|
154
|
+
`macOS` `Windows`
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
function getNotificationCapability(options?: NotificationDiagnosticsOptions): NotificationCapability
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
type NotificationCapability = {
|
|
162
|
+
canNotify: boolean
|
|
163
|
+
permission: NotificationPermissionStatus
|
|
164
|
+
interruptionLevel: NotificationInterruptionLevel
|
|
165
|
+
reasons: NotificationUnavailableReason[]
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
type NotificationUnavailableReason =
|
|
169
|
+
| 'permission-denied'
|
|
170
|
+
| 'permission-not-determined'
|
|
171
|
+
| 'missing-app-user-model-id'
|
|
172
|
+
| 'invalid-app-user-model-id'
|
|
173
|
+
| 'unsupported-platform'
|
|
174
|
+
| 'unknown'
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
`canNotify`는 플랫폼 지원 여부, 알림 권한, 플랫폼별 요구 사항을 바탕으로 결정됩니다.
|
|
178
|
+
예를 들어 Windows에서는 유효한 앱 사용자 모델 ID도 필요합니다.
|
|
179
|
+
|
|
180
|
+
방해 수준은 진단용 컨텍스트로 반환됩니다. 확정적인 알림 차단 사유로 취급되지는 않습니다.
|
|
181
|
+
|
|
182
|
+
#### Electron
|
|
183
|
+
|
|
184
|
+
```ts
|
|
185
|
+
// main.ts
|
|
186
|
+
import { app, ipcMain } from 'electron'
|
|
187
|
+
import { getNotificationCapability } from '@ban-dal/os-bridge'
|
|
188
|
+
|
|
189
|
+
const appUserModelId = 'com.example.my-app'
|
|
190
|
+
|
|
191
|
+
if (process.platform === 'win32') {
|
|
192
|
+
app.setAppUserModelId(appUserModelId)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
ipcMain.handle('notification:getCapability', () => {
|
|
196
|
+
return getNotificationCapability({ appUserModelId })
|
|
197
|
+
})
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
// preload.ts
|
|
202
|
+
import { contextBridge, ipcRenderer } from 'electron'
|
|
203
|
+
import type { NotificationCapability } from '@ban-dal/os-bridge'
|
|
204
|
+
|
|
205
|
+
contextBridge.exposeInMainWorld('osBridge', {
|
|
206
|
+
getNotificationCapability: (): Promise<NotificationCapability> => {
|
|
207
|
+
return ipcRenderer.invoke('notification:getCapability')
|
|
208
|
+
},
|
|
209
|
+
})
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
```ts
|
|
213
|
+
// renderer.ts
|
|
214
|
+
const capability = await window.osBridge.getNotificationCapability()
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## 기능 문서 추가하기
|
|
218
|
+
|
|
219
|
+
- `Feature Index`에 행 하나를 추가하세요.
|
|
220
|
+
- `Features` 아래에 `### 기능 이름` 섹션 하나를 추가하세요.
|
|
221
|
+
- 시그니처, export된 타입, 플랫폼 참고 사항을 포함하고, Electron 예제는 필요할 때만 추가하세요.
|
|
222
|
+
|
|
223
|
+
## 개발
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
pnpm install
|
|
227
|
+
pnpm build
|
|
228
|
+
pnpm test
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### 수동 Electron Probe
|
|
232
|
+
|
|
233
|
+
현재 OS 알림 및 집중 모드 상태와 이 패키지의 진단 결과를 실제로 비교해야 할 때는 `electron-probe/`를 사용하세요.
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
pnpm build
|
|
237
|
+
cd electron-probe
|
|
238
|
+
cp .env.example .env
|
|
239
|
+
pnpm install
|
|
240
|
+
pnpm dev
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
macOS 앱 번들 테스트:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
cd electron-probe
|
|
247
|
+
pnpm pack:mac
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
probe는 macOS 집중 모드 상태 접근을 요청할 수 있습니다. 패키징된 앱에는 `NSFocusStatusUsageDescription`이 포함됩니다.
|
|
251
|
+
|
|
252
|
+
macOS probe 패키지는 수동 테스트를 위해 로컬에서 ad-hoc 서명됩니다.
|
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Typed native OS APIs for Node.js and Electron, powered by napi-rs.
|
|
4
4
|
|
|
5
|
+
EN | [한국어](README.ko.md)
|
|
6
|
+
|
|
5
7
|
## Install
|
|
6
8
|
|
|
7
9
|
```bash
|
|
@@ -31,50 +33,158 @@ Platform packages are optional dependencies. Always import from `@ban-dal/os-bri
|
|
|
31
33
|
|
|
32
34
|
## Feature Index
|
|
33
35
|
|
|
34
|
-
| Feature
|
|
35
|
-
|
|
|
36
|
-
| Notification permission status
|
|
36
|
+
| Feature | API | macOS | Windows | Linux |
|
|
37
|
+
| ------------------------------- | ------------------------------------ | --------- | ------------- | ------------- |
|
|
38
|
+
| Notification permission status | `getNotificationPermissionStatus` | Supported | Supported | `unsupported` |
|
|
39
|
+
| macOS notification permission | `requestMacNotificationPermission` | Supported | Status only | `unsupported` |
|
|
40
|
+
| Notification interruption level | `getNotificationInterruptionLevel` | Supported | Supported | `unsupported` |
|
|
41
|
+
| macOS Focus Status access | `requestMacFocusStatusAuthorization` | Supported | `unsupported` | `unsupported` |
|
|
42
|
+
| Notification capability summary | `getNotificationCapability` | Supported | Supported | `unsupported` |
|
|
37
43
|
|
|
38
44
|
## Usage
|
|
39
45
|
|
|
40
46
|
```ts
|
|
41
|
-
import {
|
|
47
|
+
import { getNotificationCapability, type NotificationCapability } from '@ban-dal/os-bridge'
|
|
42
48
|
|
|
43
|
-
const
|
|
49
|
+
const capability: NotificationCapability = getNotificationCapability()
|
|
44
50
|
```
|
|
45
51
|
|
|
46
52
|
## Features
|
|
47
53
|
|
|
48
|
-
###
|
|
54
|
+
### getNotificationPermissionStatus
|
|
55
|
+
|
|
56
|
+
`macOS` `Windows`
|
|
49
57
|
|
|
50
58
|
```ts
|
|
51
|
-
function
|
|
59
|
+
function getNotificationPermissionStatus(options?: NotificationDiagnosticsOptions): NotificationPermissionStatus
|
|
52
60
|
```
|
|
53
61
|
|
|
54
62
|
```ts
|
|
55
63
|
type NotificationPermissionStatus = 'granted' | 'denied' | 'not-determined' | 'limited' | 'unsupported' | 'unknown'
|
|
56
64
|
```
|
|
57
65
|
|
|
58
|
-
| Platform | Behavior
|
|
59
|
-
| -------- |
|
|
60
|
-
| macOS | Returns `unknown` when called outside an app bundle.
|
|
61
|
-
| Windows | Looks up notification permission by app user model id
|
|
62
|
-
| Linux | Returns `unsupported`.
|
|
66
|
+
| Platform | Behavior |
|
|
67
|
+
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
68
|
+
| macOS | Returns `unknown` when called outside an app bundle. |
|
|
69
|
+
| Windows | Looks up notification permission by app user model id.<br>Windows defaults to allowed when no app-specific deny state exists.<br>Returns `unknown` if the app id is missing or empty. |
|
|
70
|
+
| Linux | Returns `unsupported`. |
|
|
63
71
|
|
|
64
72
|
```ts
|
|
65
|
-
import {
|
|
73
|
+
import { getNotificationPermissionStatus } from '@ban-dal/os-bridge'
|
|
66
74
|
|
|
67
|
-
const status =
|
|
75
|
+
const status = getNotificationPermissionStatus({ appUserModelId: 'com.example.my-app' })
|
|
68
76
|
```
|
|
69
77
|
|
|
70
78
|
For Windows Electron apps, pass the same app user model id used with `app.setAppUserModelId(...)`.
|
|
71
79
|
|
|
80
|
+
`getPermissionStatus(appUserModelId?)` remains available as the low-level compatibility alias.
|
|
81
|
+
|
|
82
|
+
### requestMacNotificationPermission
|
|
83
|
+
|
|
84
|
+
`macOS` `Windows status only`
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
function requestMacNotificationPermission(options?: NotificationDiagnosticsOptions): NotificationPermissionStatus
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Requests notification authorization on macOS and returns the resulting permission status.
|
|
91
|
+
|
|
92
|
+
Windows does not provide an OS API for requesting app notification permission. Its default notification state is allowed, so use `getNotificationPermissionStatus` or `getNotificationCapability` for Windows diagnostics.
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
import { requestMacNotificationPermission } from '@ban-dal/os-bridge'
|
|
96
|
+
|
|
97
|
+
const status = requestMacNotificationPermission()
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### getNotificationInterruptionLevel
|
|
101
|
+
|
|
102
|
+
`macOS` `Windows`
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
function getNotificationInterruptionLevel(): NotificationInterruptionLevel
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
type NotificationInterruptionLevel = 'normal' | 'limited' | 'unsupported' | 'unknown'
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
type NotificationDiagnosticsOptions = {
|
|
114
|
+
appUserModelId?: string
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Returns whether the OS is currently in a normal or limited notification-delivery context.
|
|
119
|
+
`limited` is diagnostic context only. It does not prove that this app's notifications will be suppressed.
|
|
120
|
+
|
|
121
|
+
#### macOS
|
|
122
|
+
|
|
123
|
+
On macOS, the following conditions are required:
|
|
124
|
+
|
|
125
|
+
1. Communication Notifications enabled for the App ID in Apple Developer > Identifiers.
|
|
126
|
+
2. A bundled app code-signed with that account, not ad-hoc signing.
|
|
127
|
+
3. The app enabled in System Settings > Privacy & Security > Focus. You can prompt the user for this with `requestMacFocusStatusAuthorization()`.
|
|
128
|
+
|
|
129
|
+
Even when Focus or Do Not Disturb is enabled, the result is `normal` if the app is included in the allowed apps for the current Focus.
|
|
130
|
+
|
|
131
|
+
#### Windows
|
|
132
|
+
|
|
133
|
+
On Windows, the interruption level comes from `ToastNotificationManager.GetDefault().NotificationMode()`.
|
|
134
|
+
|
|
135
|
+
- `Unrestricted` returns `normal`.
|
|
136
|
+
- `PriorityOnly` and `AlarmsOnly` return `limited`.
|
|
137
|
+
|
|
138
|
+
Windows does not expose whether this app is included in the user's priority app list. Therefore, `limited` means the system is limiting notifications, not that this app is definitely blocked.
|
|
139
|
+
|
|
140
|
+
### requestMacFocusStatusAuthorization
|
|
141
|
+
|
|
142
|
+
`macOS`
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
function requestMacFocusStatusAuthorization(): NotificationInterruptionLevel
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Requests permission to share Focus Status with this app, then returns the current interruption level.
|
|
149
|
+
|
|
150
|
+
If the request has already been handled by the OS, the system may not show another alert.
|
|
151
|
+
|
|
152
|
+
### getNotificationCapability
|
|
153
|
+
|
|
154
|
+
`macOS` `Windows`
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
function getNotificationCapability(options?: NotificationDiagnosticsOptions): NotificationCapability
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
type NotificationCapability = {
|
|
162
|
+
canNotify: boolean
|
|
163
|
+
permission: NotificationPermissionStatus
|
|
164
|
+
interruptionLevel: NotificationInterruptionLevel
|
|
165
|
+
reasons: NotificationUnavailableReason[]
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
type NotificationUnavailableReason =
|
|
169
|
+
| 'permission-denied'
|
|
170
|
+
| 'permission-not-determined'
|
|
171
|
+
| 'missing-app-user-model-id'
|
|
172
|
+
| 'invalid-app-user-model-id'
|
|
173
|
+
| 'unsupported-platform'
|
|
174
|
+
| 'unknown'
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
`canNotify` is based on platform support, notification permission, and platform-specific requirements.
|
|
178
|
+
For example, Windows also needs a valid app user model id.
|
|
179
|
+
|
|
180
|
+
The interruption level is returned as diagnostic context. It is not treated as a definitive notification-blocking reason.
|
|
181
|
+
|
|
72
182
|
#### Electron
|
|
73
183
|
|
|
74
184
|
```ts
|
|
75
185
|
// main.ts
|
|
76
186
|
import { app, ipcMain } from 'electron'
|
|
77
|
-
import {
|
|
187
|
+
import { getNotificationCapability } from '@ban-dal/os-bridge'
|
|
78
188
|
|
|
79
189
|
const appUserModelId = 'com.example.my-app'
|
|
80
190
|
|
|
@@ -82,26 +192,26 @@ if (process.platform === 'win32') {
|
|
|
82
192
|
app.setAppUserModelId(appUserModelId)
|
|
83
193
|
}
|
|
84
194
|
|
|
85
|
-
ipcMain.handle('notification:
|
|
86
|
-
return
|
|
195
|
+
ipcMain.handle('notification:getCapability', () => {
|
|
196
|
+
return getNotificationCapability({ appUserModelId })
|
|
87
197
|
})
|
|
88
198
|
```
|
|
89
199
|
|
|
90
200
|
```ts
|
|
91
201
|
// preload.ts
|
|
92
202
|
import { contextBridge, ipcRenderer } from 'electron'
|
|
93
|
-
import type {
|
|
203
|
+
import type { NotificationCapability } from '@ban-dal/os-bridge'
|
|
94
204
|
|
|
95
205
|
contextBridge.exposeInMainWorld('osBridge', {
|
|
96
|
-
|
|
97
|
-
return ipcRenderer.invoke('notification:
|
|
206
|
+
getNotificationCapability: (): Promise<NotificationCapability> => {
|
|
207
|
+
return ipcRenderer.invoke('notification:getCapability')
|
|
98
208
|
},
|
|
99
209
|
})
|
|
100
210
|
```
|
|
101
211
|
|
|
102
212
|
```ts
|
|
103
213
|
// renderer.ts
|
|
104
|
-
const
|
|
214
|
+
const capability = await window.osBridge.getNotificationCapability()
|
|
105
215
|
```
|
|
106
216
|
|
|
107
217
|
## Adding Feature Documentation
|
|
@@ -117,3 +227,26 @@ pnpm install
|
|
|
117
227
|
pnpm build
|
|
118
228
|
pnpm test
|
|
119
229
|
```
|
|
230
|
+
|
|
231
|
+
### Manual Electron Probe
|
|
232
|
+
|
|
233
|
+
Use `electron-probe/` when you need to physically compare this package's diagnostics with the current OS notification and Focus state.
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
pnpm build
|
|
237
|
+
cd electron-probe
|
|
238
|
+
cp .env.example .env
|
|
239
|
+
pnpm install
|
|
240
|
+
pnpm dev
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
For macOS app-bundle testing:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
cd electron-probe
|
|
247
|
+
pnpm pack:mac
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
The probe can request macOS Focus Status access. It includes `NSFocusStatusUsageDescription` in the packaged app.
|
|
251
|
+
|
|
252
|
+
The macOS probe package is ad-hoc signed locally for manual testing.
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,79 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Returns the current notification capability.
|
|
5
|
+
*
|
|
6
|
+
* `ko`: 현재 알림 사용 가능 여부와 사유를 반환합니다.
|
|
7
|
+
*
|
|
8
|
+
* @param options
|
|
9
|
+
*/
|
|
10
|
+
export declare function getNotificationCapability(
|
|
11
|
+
options?: NotificationDiagnosticsOptions | undefined | null,
|
|
12
|
+
): NotificationCapability
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Returns the current notification interruption level.
|
|
16
|
+
*
|
|
17
|
+
* `ko`: 현재 알림 전달 제한 상태를 반환합니다.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getNotificationInterruptionLevel(): NotificationInterruptionLevel
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Returns the notification permission status.
|
|
23
|
+
*
|
|
24
|
+
* `ko`: 현재 알림 권한 상태를 반환합니다.
|
|
25
|
+
*
|
|
26
|
+
* @param options
|
|
27
|
+
*/
|
|
28
|
+
export declare function getNotificationPermissionStatus(
|
|
29
|
+
options?: NotificationDiagnosticsOptions | undefined | null,
|
|
30
|
+
): NotificationPermissionStatus
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Returns the notification permission status.
|
|
34
|
+
*
|
|
35
|
+
* `ko`: 현재 알림 권한 상태를 반환합니다.
|
|
36
|
+
*
|
|
37
|
+
* @param appUserModelId Windows App User Model ID used to look up per-app notification settings.
|
|
38
|
+
*
|
|
39
|
+
* `ko`: appUserModelId 알림 설정 조회에 사용할 Windows App User Model ID입니다.
|
|
40
|
+
*/
|
|
3
41
|
export declare function getPermissionStatus(appUserModelId?: string | undefined | null): NotificationPermissionStatus
|
|
4
42
|
|
|
43
|
+
export interface NotificationCapability {
|
|
44
|
+
/**
|
|
45
|
+
* Whether notifications can be sent.
|
|
46
|
+
*
|
|
47
|
+
* `ko`: 알림을 보낼 수 있는지 여부
|
|
48
|
+
*/
|
|
49
|
+
canNotify: boolean
|
|
50
|
+
/**
|
|
51
|
+
* Current notification permission status.
|
|
52
|
+
*
|
|
53
|
+
* `ko`: 현재 알림 권한 상태
|
|
54
|
+
*/
|
|
55
|
+
permission: NotificationPermissionStatus
|
|
56
|
+
/**
|
|
57
|
+
* Current notification interruption level.
|
|
58
|
+
*
|
|
59
|
+
* `ko`: 현재 알림 전달 제한 상태
|
|
60
|
+
*/
|
|
61
|
+
interruptionLevel: NotificationInterruptionLevel
|
|
62
|
+
/**
|
|
63
|
+
* Reasons notifications are unavailable.
|
|
64
|
+
*
|
|
65
|
+
* `ko`: 알림을 사용할 수 없는 사유
|
|
66
|
+
*/
|
|
67
|
+
reasons: Array<NotificationUnavailableReason>
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface NotificationDiagnosticsOptions {
|
|
71
|
+
/** Windows App User Model ID. */
|
|
72
|
+
appUserModelId?: string
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export type NotificationInterruptionLevel = 'normal' | 'limited' | 'unsupported' | 'unknown'
|
|
76
|
+
|
|
5
77
|
export type NotificationPermissionStatus =
|
|
6
78
|
| 'granted'
|
|
7
79
|
| 'denied'
|
|
@@ -9,3 +81,29 @@ export type NotificationPermissionStatus =
|
|
|
9
81
|
| 'limited'
|
|
10
82
|
| 'unsupported'
|
|
11
83
|
| 'unknown'
|
|
84
|
+
|
|
85
|
+
export type NotificationUnavailableReason =
|
|
86
|
+
| 'permission-denied'
|
|
87
|
+
| 'permission-not-determined'
|
|
88
|
+
| 'missing-app-user-model-id'
|
|
89
|
+
| 'invalid-app-user-model-id'
|
|
90
|
+
| 'unsupported-platform'
|
|
91
|
+
| 'unknown'
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Requests macOS Focus Status authorization.
|
|
95
|
+
*
|
|
96
|
+
* `ko`: macOS 집중 모드 상태 접근 권한을 요청합니다.
|
|
97
|
+
*/
|
|
98
|
+
export declare function requestMacFocusStatusAuthorization(): NotificationInterruptionLevel
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Requests macOS notification authorization.
|
|
102
|
+
*
|
|
103
|
+
* `ko`: macOS 알림 권한을 요청하고 결과 상태를 반환합니다.
|
|
104
|
+
*
|
|
105
|
+
* @param options
|
|
106
|
+
*/
|
|
107
|
+
export declare function requestMacNotificationPermission(
|
|
108
|
+
options?: NotificationDiagnosticsOptions | undefined | null,
|
|
109
|
+
): NotificationPermissionStatus
|
package/index.js
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('@ban-dal/os-bridge-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('@ban-dal/os-bridge-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '1.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
80
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('@ban-dal/os-bridge-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('@ban-dal/os-bridge-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '1.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
96
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('@ban-dal/os-bridge-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('@ban-dal/os-bridge-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '1.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
117
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('@ban-dal/os-bridge-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('@ban-dal/os-bridge-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '1.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
133
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('@ban-dal/os-bridge-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('@ban-dal/os-bridge-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '1.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
150
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('@ban-dal/os-bridge-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('@ban-dal/os-bridge-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '1.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
166
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('@ban-dal/os-bridge-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('@ban-dal/os-bridge-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '1.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
185
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('@ban-dal/os-bridge-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('@ban-dal/os-bridge-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '1.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
201
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('@ban-dal/os-bridge-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('@ban-dal/os-bridge-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '1.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
217
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('@ban-dal/os-bridge-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('@ban-dal/os-bridge-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '1.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
237
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('@ban-dal/os-bridge-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('@ban-dal/os-bridge-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '1.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
253
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('@ban-dal/os-bridge-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '1.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
274
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('@ban-dal/os-bridge-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '1.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
290
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('@ban-dal/os-bridge-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '1.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
308
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('@ban-dal/os-bridge-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '1.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
324
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('@ban-dal/os-bridge-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '1.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
342
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('@ban-dal/os-bridge-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '1.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
358
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('@ban-dal/os-bridge-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '1.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
376
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('@ban-dal/os-bridge-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '1.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
392
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('@ban-dal/os-bridge-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '1.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
410
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('@ban-dal/os-bridge-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '1.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
426
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('@ban-dal/os-bridge-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '1.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
443
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('@ban-dal/os-bridge-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('@ban-dal/os-bridge-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '1.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
459
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('@ban-dal/os-bridge-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('@ban-dal/os-bridge-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '1.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
479
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('@ban-dal/os-bridge-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('@ban-dal/os-bridge-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '1.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
495
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('@ban-dal/os-bridge-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('@ban-dal/os-bridge-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '1.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
511
|
+
if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
|
@@ -576,5 +576,12 @@ if (!nativeBinding) {
|
|
|
576
576
|
}
|
|
577
577
|
|
|
578
578
|
module.exports = nativeBinding
|
|
579
|
+
module.exports.getNotificationCapability = nativeBinding.getNotificationCapability
|
|
580
|
+
module.exports.getNotificationInterruptionLevel = nativeBinding.getNotificationInterruptionLevel
|
|
581
|
+
module.exports.getNotificationPermissionStatus = nativeBinding.getNotificationPermissionStatus
|
|
579
582
|
module.exports.getPermissionStatus = nativeBinding.getPermissionStatus
|
|
583
|
+
module.exports.NotificationInterruptionLevel = nativeBinding.NotificationInterruptionLevel
|
|
580
584
|
module.exports.NotificationPermissionStatus = nativeBinding.NotificationPermissionStatus
|
|
585
|
+
module.exports.NotificationUnavailableReason = nativeBinding.NotificationUnavailableReason
|
|
586
|
+
module.exports.requestMacFocusStatusAuthorization = nativeBinding.requestMacFocusStatusAuthorization
|
|
587
|
+
module.exports.requestMacNotificationPermission = nativeBinding.requestMacNotificationPermission
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ban-dal/os-bridge",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Native OS capability bridge for Node.js and Electron.
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"description": "Native OS capability bridge for Node.js and Electron. Diagnose notification capability on macOS and Windows.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"index.js"
|
|
48
48
|
],
|
|
49
49
|
"optionalDependencies": {
|
|
50
|
-
"@ban-dal/os-bridge-darwin-arm64": "1.
|
|
51
|
-
"@ban-dal/os-bridge-darwin-x64": "1.
|
|
52
|
-
"@ban-dal/os-bridge-linux-x64-gnu": "1.
|
|
53
|
-
"@ban-dal/os-bridge-win32-x64-msvc": "1.
|
|
50
|
+
"@ban-dal/os-bridge-darwin-arm64": "1.1.1",
|
|
51
|
+
"@ban-dal/os-bridge-darwin-x64": "1.1.1",
|
|
52
|
+
"@ban-dal/os-bridge-linux-x64-gnu": "1.1.1",
|
|
53
|
+
"@ban-dal/os-bridge-win32-x64-msvc": "1.1.1"
|
|
54
54
|
},
|
|
55
55
|
"napi": {
|
|
56
56
|
"binaryName": "os-bridge",
|