-
-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- update polling logic - update access of model data (polling, dispatch, cache item) - update settings data paths - refactor dispatch mixin and icon download - add setBadgeLabel to NwjsService - rewrite and modernize most tests
- Loading branch information
1 parent
490633d
commit ef8f337
Showing
16 changed files
with
1,198 additions
and
1,151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,30 @@ | ||
import { get, observer } from "@ember/object"; | ||
import { observer } from "@ember/object"; | ||
import { and } from "@ember/object/computed"; | ||
import { default as Evented, on } from "@ember/object/evented"; | ||
import Mixin from "@ember/object/mixin"; | ||
import { inject as service } from "@ember/service"; | ||
import nwWindow from "nwjs/Window"; | ||
|
||
|
||
export default Mixin.create( Evented, { | ||
/** @type {NwjsService} */ | ||
nwjs: service(), | ||
/** @type {SettingsService} */ | ||
settings: service(), | ||
|
||
// will be overridden by NotificationService | ||
running: false, | ||
|
||
_badgeEnabled: and( "running", "settings.notification.badgelabel" ), | ||
_badgeEnabled: and( "running", "settings.content.notification.badgelabel" ), | ||
|
||
_badgeEnabledObserver: observer( "_badgeEnabled", function() { | ||
if ( !get( this, "_badgeEnabled" ) ) { | ||
this.badgeSetLabel( "" ); | ||
if ( !this._badgeEnabled ) { | ||
this.nwjs.setBadgeLabel( "" ); | ||
} | ||
}), | ||
|
||
_badgeStreamsAllListener: on( "streams-all", function( streams ) { | ||
if ( streams && get( this, "_badgeEnabled" ) ) { | ||
const length = get( streams, "length" ); | ||
this.badgeSetLabel( String( length ) ); | ||
if ( streams && this._badgeEnabled ) { | ||
this.nwjs.setBadgeLabel( `${streams.length}` ); | ||
} | ||
}), | ||
|
||
badgeSetLabel( label ) { | ||
// update badge label or remove it | ||
nwWindow.setBadgeLabel( label ); | ||
} | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.