Browse Source

Initial Linux support

reviewable/pr226/r1
Albert Huang 6 years ago
parent
commit
a0b659ab5c
  1. 1
      src/inject/linux/index.js
  2. 40
      src/inject/linux/silent_Notification.js
  3. 4
      src/main/utils/PlaybackAPI.js
  4. 4
      src/main/utils/Settings.js

1
src/inject/linux/index.js

@ -0,0 +1 @@
import './silent_Notification';

40
src/inject/linux/silent_Notification.js

@ -0,0 +1,40 @@
window._Notification = window.Notification;
class SilentNotification {
constructor(title, options) {
const opts = options;
opts.silent = true;
this._notification = new window._Notification(title, opts);
this.title = this._notification.title;
this.dir = this._notification.dir;
this.lang = this._notification.lang;
this.body = this._notification.body;
this.tag = this._notification.tag;
this.icon = this._notification.icon;
this.data = this._notification.data;
this.requireInteraction = false;
this.silent = true;
Object.defineProperty(this, 'onclick', {
get: () => { return this._notification.onclick; },
set: (fn) => { this._notification.onclick = fn; },
configurable: true,
enumerable: true,
});
Object.defineProperty(this, 'onerror', {
get: () => { return this._notification.onerror; },
set: (fn) => { this._notification.onerror = fn; },
configurable: true,
enumerable: true,
});
}
close() {
this._notification.close();
}
}
SilentNotification.permission = 'granted';
window.Notification = SilentNotification;

4
src/main/utils/PlaybackAPI.js

@ -1,12 +1,14 @@
import fs from 'fs';
import mkdirp from 'mkdirp';
var os = require('os');
const environment = process.env;
class PlaybackAPI {
constructor() {
const DIR = (environment.APPDATA ||
(process.platform === 'darwin' ? environment.HOME + '/Library/Preferences' : '/var/local')) +
(process.platform === 'darwin' ? environment.HOME + '/Library/Preferences' : os.homedir())) +
'/GPMDP_STORE';
this.PATH = `${DIR}/playback.json`;

4
src/main/utils/Settings.js

@ -2,12 +2,14 @@ import fs from 'fs';
import mkdirp from 'mkdirp';
import initalSettings from './initialSettings';
var os = require('os');
const environment = process.env;
class Settings {
constructor(jsonPrefix, wipeOldData) {
const DIR = (environment.APPDATA ||
(process.platform === 'darwin' ? environment.HOME + '/Library/Preferences' : '/var/local')) +
(process.platform === 'darwin' ? environment.HOME + '/Library/Preferences' : os.homedir())) +
'/GPMDP_STORE';
this.PATH = `${DIR}/${(jsonPrefix || '')}.settings.json`;
this.data = initalSettings;

Loading…
Cancel
Save