fixes (#17363)
This commit is contained in:
parent
6530c99cfa
commit
075b818a8e
5 changed files with 35 additions and 38 deletions
|
@ -1350,13 +1350,15 @@ void App::BuildPrototype(v8::Isolate* isolate,
|
||||||
base::Bind(&Browser::SetAsDefaultProtocolClient, browser))
|
base::Bind(&Browser::SetAsDefaultProtocolClient, browser))
|
||||||
.SetMethod("removeAsDefaultProtocolClient",
|
.SetMethod("removeAsDefaultProtocolClient",
|
||||||
base::Bind(&Browser::RemoveAsDefaultProtocolClient, browser))
|
base::Bind(&Browser::RemoveAsDefaultProtocolClient, browser))
|
||||||
.SetMethod("setBadgeCount", base::Bind(&Browser::SetBadgeCount, browser))
|
.SetMethod("_setBadgeCount", base::Bind(&Browser::SetBadgeCount, browser))
|
||||||
.SetMethod("getBadgeCount", base::Bind(&Browser::GetBadgeCount, browser))
|
.SetMethod("_getBadgeCount", base::Bind(&Browser::GetBadgeCount, browser))
|
||||||
.SetMethod("getLoginItemSettings", &App::GetLoginItemSettings)
|
.SetMethod("getLoginItemSettings", &App::GetLoginItemSettings)
|
||||||
.SetMethod("setLoginItemSettings",
|
.SetMethod("setLoginItemSettings",
|
||||||
base::Bind(&Browser::SetLoginItemSettings, browser))
|
base::Bind(&Browser::SetLoginItemSettings, browser))
|
||||||
.SetMethod("isEmojiPanelSupported",
|
.SetMethod("isEmojiPanelSupported",
|
||||||
base::Bind(&Browser::IsEmojiPanelSupported, browser))
|
base::Bind(&Browser::IsEmojiPanelSupported, browser))
|
||||||
|
.SetProperty("badgeCount", base::Bind(&Browser::GetBadgeCount, browser),
|
||||||
|
base::Bind(&Browser::SetBadgeCount, browser))
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
.SetMethod("hide", base::Bind(&Browser::Hide, browser))
|
.SetMethod("hide", base::Bind(&Browser::Hide, browser))
|
||||||
.SetMethod("show", base::Bind(&Browser::Show, browser))
|
.SetMethod("show", base::Bind(&Browser::Show, browser))
|
||||||
|
|
|
@ -1064,6 +1064,7 @@ gpuDevice:
|
||||||
machineModelName: 'MacBookPro',
|
machineModelName: 'MacBookPro',
|
||||||
machineModelVersion: '11.5' }
|
machineModelVersion: '11.5' }
|
||||||
```
|
```
|
||||||
|
|
||||||
Using `basic` should be preferred if only basic information like `vendorId` or `driverId` is needed.
|
Using `basic` should be preferred if only basic information like `vendorId` or `driverId` is needed.
|
||||||
|
|
||||||
### `app.setBadgeCount(count)` _Linux_ _macOS_
|
### `app.setBadgeCount(count)` _Linux_ _macOS_
|
||||||
|
@ -1080,10 +1081,14 @@ On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
|
||||||
**Note:** Unity launcher requires the existence of a `.desktop` file to work,
|
**Note:** Unity launcher requires the existence of a `.desktop` file to work,
|
||||||
for more information please read [Desktop Environment Integration][unity-requirement].
|
for more information please read [Desktop Environment Integration][unity-requirement].
|
||||||
|
|
||||||
|
**[Deprecated Soon](modernization/property-updates.md)**
|
||||||
|
|
||||||
### `app.getBadgeCount()` _Linux_ _macOS_
|
### `app.getBadgeCount()` _Linux_ _macOS_
|
||||||
|
|
||||||
Returns `Integer` - The current value displayed in the counter badge.
|
Returns `Integer` - The current value displayed in the counter badge.
|
||||||
|
|
||||||
|
**[Deprecated Soon](modernization/property-updates.md)**
|
||||||
|
|
||||||
### `app.isUnityRunning()` _Linux_
|
### `app.isUnityRunning()` _Linux_
|
||||||
|
|
||||||
Returns `Boolean` - Whether the current desktop environment is Unity launcher.
|
Returns `Boolean` - Whether the current desktop environment is Unity launcher.
|
||||||
|
@ -1344,11 +1349,6 @@ Sets the `image` associated with this dock icon.
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
### `app.applicationMenu`
|
|
||||||
|
|
||||||
A `Menu` property that return [`Menu`](menu.md) if one has been set and `null` otherwise.
|
|
||||||
Users can pass a [Menu](menu.md) to set this property.
|
|
||||||
|
|
||||||
### `app.accessibilitySupportEnabled` _macOS_ _Windows_
|
### `app.accessibilitySupportEnabled` _macOS_ _Windows_
|
||||||
|
|
||||||
A `Boolean` property that's `true` if Chrome's accessibility support is enabled, `false` otherwise. This property will be `true` if the use of assistive technologies, such as screen readers, has been detected. Setting this property to `true` manually enables Chrome's accessibility support, allowing developers to expose accessibility switch to users in application settings.
|
A `Boolean` property that's `true` if Chrome's accessibility support is enabled, `false` otherwise. This property will be `true` if the use of assistive technologies, such as screen readers, has been detected. Setting this property to `true` manually enables Chrome's accessibility support, allowing developers to expose accessibility switch to users in application settings.
|
||||||
|
@ -1359,6 +1359,20 @@ This API must be called after the `ready` event is emitted.
|
||||||
|
|
||||||
**Note:** Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
|
**Note:** Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
|
||||||
|
|
||||||
|
### `app.applicationMenu`
|
||||||
|
|
||||||
|
A `Menu` property that return [`Menu`](menu.md) if one has been set and `null` otherwise.
|
||||||
|
Users can pass a [Menu](menu.md) to set this property.
|
||||||
|
|
||||||
|
### `app.badgeCount` _Linux_ _macOS_
|
||||||
|
|
||||||
|
An `Integer` property that returns the badge count for current app. Setting the count to `0` will hide the badge.
|
||||||
|
|
||||||
|
On macOS, setting this with any nonzero integer shows on the dock icon. On Linux, this property only works for Unity launcher.
|
||||||
|
|
||||||
|
**Note:** Unity launcher requires the existence of a `.desktop` file to work,
|
||||||
|
for more information please read [Desktop Environment Integration][unity-requirement].
|
||||||
|
|
||||||
### `app.isPackaged`
|
### `app.isPackaged`
|
||||||
|
|
||||||
A `Boolean` property that returns `true` if the app is packaged, `false` otherwise. For many apps, this property can be used to distinguish development and production environments.
|
A `Boolean` property that returns `true` if the app is packaged, `false` otherwise. For many apps, this property can be used to distinguish development and production environments.
|
||||||
|
|
|
@ -5,7 +5,6 @@ The Electron team is currently undergoing an initiative to convert separate gett
|
||||||
## Candidates
|
## Candidates
|
||||||
|
|
||||||
* `app` module
|
* `app` module
|
||||||
* `badgeCount`
|
|
||||||
* `name`
|
* `name`
|
||||||
* `dock`
|
* `dock`
|
||||||
* `badge`
|
* `badge`
|
||||||
|
@ -58,3 +57,4 @@ The Electron team is currently undergoing an initiative to convert separate gett
|
||||||
* `app` module
|
* `app` module
|
||||||
* `accessibilitySupport`
|
* `accessibilitySupport`
|
||||||
* `applicationMenu`
|
* `applicationMenu`
|
||||||
|
* `badgeCount`
|
||||||
|
|
|
@ -91,6 +91,7 @@ app.getFileIcon = deprecate.promisify(app.getFileIcon)
|
||||||
|
|
||||||
// Property Deprecations
|
// Property Deprecations
|
||||||
deprecate.fnToProperty(app, 'accessibilitySupportEnabled', '_isAccessibilitySupportEnabled', '_setAccessibilitySupportEnabled')
|
deprecate.fnToProperty(app, 'accessibilitySupportEnabled', '_isAccessibilitySupportEnabled', '_setAccessibilitySupportEnabled')
|
||||||
|
deprecate.fnToProperty(app, 'badgeCount', '_getBadgeCount', '_setBadgeCount')
|
||||||
|
|
||||||
// Wrappers for native classes.
|
// Wrappers for native classes.
|
||||||
const { DownloadItem } = process.electronBinding('download_item')
|
const { DownloadItem } = process.electronBinding('download_item')
|
||||||
|
|
|
@ -502,51 +502,31 @@ describe('app module', () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('app.setBadgeCount', () => {
|
describe('app.badgeCount', () => {
|
||||||
const platformIsNotSupported =
|
const platformIsNotSupported =
|
||||||
(process.platform === 'win32') ||
|
(process.platform === 'win32') ||
|
||||||
(process.platform === 'linux' && !app.isUnityRunning())
|
(process.platform === 'linux' && !app.isUnityRunning())
|
||||||
const platformIsSupported = !platformIsNotSupported
|
const platformIsSupported = !platformIsNotSupported
|
||||||
|
|
||||||
const expectedBadgeCount = 42
|
const expectedBadgeCount = 42
|
||||||
let returnValue: boolean | null = null
|
|
||||||
|
|
||||||
beforeEach(() => { returnValue = app.setBadgeCount(expectedBadgeCount) })
|
after(() => { app.badgeCount = 0 })
|
||||||
|
|
||||||
after(() => {
|
|
||||||
// Remove the badge.
|
|
||||||
app.setBadgeCount(0)
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('on supported platform', () => {
|
describe('on supported platform', () => {
|
||||||
before(function () {
|
it('sets a badge count', function () {
|
||||||
if (platformIsNotSupported) {
|
if (platformIsNotSupported) return this.skip()
|
||||||
this.skip()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
it('returns true', () => {
|
app.badgeCount = expectedBadgeCount
|
||||||
expect(returnValue).to.equal(true)
|
expect(app.badgeCount).to.equal(expectedBadgeCount)
|
||||||
})
|
|
||||||
|
|
||||||
it('sets a badge count', () => {
|
|
||||||
expect(app.getBadgeCount()).to.equal(expectedBadgeCount)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('on unsupported platform', () => {
|
describe('on unsupported platform', () => {
|
||||||
before(function () {
|
it('does not set a badge count', function () {
|
||||||
if (platformIsSupported) {
|
if (platformIsSupported) return this.skip()
|
||||||
this.skip()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
it('returns false', () => {
|
app.badgeCount = 9999
|
||||||
expect(returnValue).to.equal(false)
|
expect(app.badgeCount).to.equal(0)
|
||||||
})
|
|
||||||
|
|
||||||
it('does not set a badge count', () => {
|
|
||||||
expect(app.getBadgeCount()).to.equal(0)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue