From 035002ceedf78d5ec73eabc0df7f06139939b967 Mon Sep 17 00:00:00 2001 From: Amine El Mouafik <412895+kytwb@users.noreply.github.com> Date: Mon, 8 Feb 2021 10:34:45 +0100 Subject: Synchronize with Franz 5.6.0 (#1033) Co-authored-by: FranzBot Co-authored-by: vantezzen Co-authored-by: Makazzz Co-authored-by: Stefan Malzner Co-authored-by: Amine Mouafik --- src/models/Recipe.js | 4 ++++ src/models/Service.js | 31 +++++++++++++++++++++++++------ 2 files changed, 29 insertions(+), 6 deletions(-) (limited to 'src/models') diff --git a/src/models/Recipe.js b/src/models/Recipe.js index dcb998a19..a20eeb087 100644 --- a/src/models/Recipe.js +++ b/src/models/Recipe.js @@ -40,6 +40,8 @@ export default class Recipe { autoHibernate = false; + partition = ''; + constructor(data) { if (!data) { throw Error('Recipe config not valid'); @@ -82,6 +84,8 @@ export default class Recipe { this.autoHibernate = data.config.autoHibernate || this.autoHibernate; + this.partition = data.config.partition || this.partition; + this.message = data.config.message || this.message; } diff --git a/src/models/Service.js b/src/models/Service.js index 4b5e8592d..ef1276619 100644 --- a/src/models/Service.js +++ b/src/models/Service.js @@ -4,8 +4,9 @@ import normalizeUrl from 'normalize-url'; import path from 'path'; import userAgent from '../helpers/userAgent-helpers'; +import { TODOS_RECIPE_ID, todosStore } from '../features/todos'; -const debug = require('debug')('Ferdi:Service'); +const debug = require('debug')('Franz:Service'); export const RESTRICTION_TYPES = { SERVICE_LIMIT: 0, @@ -17,7 +18,7 @@ export default class Service { recipe = ''; - webview = null; + _webview = null; timer = null; @@ -77,13 +78,15 @@ export default class Service { @observable restrictionType = null; - @observable disableHibernation = false; + @observable isHibernationEnabled = false; + + @observable isHibernating = false; @observable lastUsed = Date.now(); // timestamp - @observable lastPoll = null; + @observable lastPoll = Date.now(); - @observable lastPollAnswer = null; + @observable lastPollAnswer = Date.now(); @observable lostRecipeConnection = false; @@ -136,7 +139,7 @@ export default class Service { this.spellcheckerLanguage = data.spellcheckerLanguage !== undefined ? data.spellcheckerLanguage : this.spellcheckerLanguage; - this.disableHibernation = data.disableHibernation !== undefined ? data.disableHibernation : this.disableHibernation; + this.isHibernationEnabled = data.isHibernationEnabled !== undefined ? data.isHibernationEnabled : this.isHibernationEnabled; this.recipe = recipe; @@ -177,6 +180,18 @@ export default class Service { }; } + get webview() { + if (this.recipe.id === TODOS_RECIPE_ID) { + return todosStore.webview; + } + + return this._webview; + } + + set webview(webview) { + this._webview = webview; + } + @computed get url() { if (this.recipe.hasCustomUrl && this.customUrl) { let url; @@ -225,6 +240,10 @@ export default class Service { return ua; } + @computed get partition() { + return this.recipe.partition || `persist:service-${this.id}`; + } + initializeWebViewEvents({ handleIPCMessage, openWindow, stores }) { const webContents = remote.webContents.fromId(this.webview.getWebContentsId()); -- cgit v1.2.3-54-g00ecf