aboutsummaryrefslogtreecommitdiffstats
path: root/src/models/Service.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/models/Service.js')
-rw-r--r--src/models/Service.js21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/models/Service.js b/src/models/Service.js
index 397950787..162dcea65 100644
--- a/src/models/Service.js
+++ b/src/models/Service.js
@@ -37,8 +37,6 @@ export default class Service {
37 37
38 @observable isMuted = false; 38 @observable isMuted = false;
39 39
40 @observable isHibernating = false;
41
42 @observable team = ''; 40 @observable team = '';
43 41
44 @observable customUrl = ''; 42 @observable customUrl = '';
@@ -77,7 +75,7 @@ export default class Service {
77 75
78 @observable isHibernationEnabled = false; 76 @observable isHibernationEnabled = false;
79 77
80 @observable isHibernating = false; 78 @observable isHibernationRequested = false;
81 79
82 @observable lastUsed = Date.now(); // timestamp 80 @observable lastUsed = Date.now(); // timestamp
83 81
@@ -145,14 +143,11 @@ export default class Service {
145 this.recipe = recipe; 143 this.recipe = recipe;
146 144
147 // Check if "Hibernate on Startup" is enabled and hibernate all services except active one 145 // Check if "Hibernate on Startup" is enabled and hibernate all services except active one
148 const { 146 const { hibernateOnStartup } = window.ferdi.stores.settings.app;
149 hibernate,
150 hibernateOnStartup,
151 } = window.ferdi.stores.settings.app;
152 // The service store is probably not loaded yet so we need to use localStorage data to get active service 147 // The service store is probably not loaded yet so we need to use localStorage data to get active service
153 const isActive = window.localStorage.service && JSON.parse(window.localStorage.service).activeService === this.id; 148 const isActive = window.localStorage.service && JSON.parse(window.localStorage.service).activeService === this.id;
154 if (hibernate && hibernateOnStartup && !isActive) { 149 if (hibernateOnStartup && !isActive) {
155 this.isHibernating = true; 150 this.isHibernationRequested = true;
156 } 151 }
157 152
158 autorun(() => { 153 autorun(() => {
@@ -185,6 +180,14 @@ export default class Service {
185 return this.recipe.id === todosStore.todoRecipeId; 180 return this.recipe.id === todosStore.todoRecipeId;
186 } 181 }
187 182
183 @computed get canHibernate() {
184 return this.isHibernationEnabled;
185 }
186
187 @computed get isHibernating() {
188 return this.canHibernate && this.isHibernationRequested;
189 }
190
188 get webview() { 191 get webview() {
189 if (this.isTodosService) { 192 if (this.isTodosService) {
190 return todosStore.webview; 193 return todosStore.webview;