summaryrefslogtreecommitdiffhomepage
path: root/app/lib
diff options
context:
space:
mode:
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/tray-icon-manager.js62
1 files changed, 0 insertions, 62 deletions
diff --git a/app/lib/tray-icon-manager.js b/app/lib/tray-icon-manager.js
deleted file mode 100644
index 915bd2c8b8..0000000000
--- a/app/lib/tray-icon-manager.js
+++ /dev/null
@@ -1,62 +0,0 @@
-// @flow
-import path from 'path';
-import KeyframeAnimation from './keyframe-animation';
-
-import type { Tray } from 'electron';
-
-export type TrayIconType = 'unsecured' | 'securing' | 'secured';
-
-export default class TrayIconManager {
- _animation: ?KeyframeAnimation;
- _iconType: TrayIconType;
-
- constructor(tray: Tray, initialType: TrayIconType) {
- const animation = this._createAnimation();
- animation.onFrame = (img) => tray.setImage(img);
- animation.reverse = this._isReverseAnimation(initialType);
- animation.play({ advanceTo: 'end' });
-
- this._animation = animation;
- this._iconType = initialType;
- }
-
- destroy() {
- if (this._animation) {
- this._animation.stop();
- this._animation = null;
- }
- }
-
- _createAnimation(): KeyframeAnimation {
- const basePath = path.join(path.resolve(__dirname, '..'), 'assets/images/menubar icons');
- const filePath = path.join(basePath, 'lock-{}.png');
- const animation = KeyframeAnimation.fromFilePattern(filePath, [1, 10]);
- animation.speed = 100;
- return animation;
- }
-
- _isReverseAnimation(type: TrayIconType): boolean {
- return type === 'unsecured';
- }
-
- get iconType(): TrayIconType {
- return this._iconType;
- }
-
- set iconType(type: TrayIconType) {
- if (this._iconType === type || !this._animation) {
- return;
- }
-
- const animation = this._animation;
- if (type === 'secured') {
- animation.reverse = true;
- animation.play({ beginFromCurrentState: true, startFrame: 8, endFrame: 9 });
- } else {
- animation.reverse = this._isReverseAnimation(type);
- animation.play({ beginFromCurrentState: true });
- }
-
- this._iconType = type;
- }
-}