aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/services/content/ServiceView.js
diff options
context:
space:
mode:
authorLibravatar vantezzen <hello@vantezzen.io>2019-10-27 10:24:23 +0100
committerLibravatar vantezzen <hello@vantezzen.io>2019-10-27 10:24:23 +0100
commitc96bd71d41a6454022cf4ef25365ebbde8a8cd3d (patch)
tree8bb11ffdf097817fa9697d30dc75120d8e1d9716 /src/components/services/content/ServiceView.js
parent#146 Add possible fix for 1.1.1.1 hack (diff)
downloadferdium-app-c96bd71d41a6454022cf4ef25365ebbde8a8cd3d.tar.gz
ferdium-app-c96bd71d41a6454022cf4ef25365ebbde8a8cd3d.tar.zst
ferdium-app-c96bd71d41a6454022cf4ef25365ebbde8a8cd3d.zip
Remove hiberation hack as observer is fixed
Diffstat (limited to 'src/components/services/content/ServiceView.js')
-rw-r--r--src/components/services/content/ServiceView.js30
1 files changed, 6 insertions, 24 deletions
diff --git a/src/components/services/content/ServiceView.js b/src/components/services/content/ServiceView.js
index 49ee24361..1fff5ef7a 100644
--- a/src/components/services/content/ServiceView.js
+++ b/src/components/services/content/ServiceView.js
@@ -42,10 +42,10 @@ export default @inject('stores', 'actions') @observer class ServiceView extends
42 forceRepaint: false, 42 forceRepaint: false,
43 targetUrl: '', 43 targetUrl: '',
44 statusBarVisible: false, 44 statusBarVisible: false,
45 hibernate: false,
46 hibernationTimer: null,
47 }; 45 };
48 46
47 hibernationTimer = null;
48
49 autorunDisposer = null; 49 autorunDisposer = null;
50 50
51 forceRepaintTimeout = null; 51 forceRepaintTimeout = null;
@@ -73,15 +73,12 @@ export default @inject('stores', 'actions') @observer class ServiceView extends
73 // Service is inactive - start hibernation countdown 73 // Service is inactive - start hibernation countdown
74 this.startHibernationTimer(); 74 this.startHibernationTimer();
75 } else { 75 } else {
76 if (this.state.hibernationTimer) { 76 if (this.hibernationTimer) {
77 // Service is active but we have an active hibernation timer: Clear timeout 77 // Service is active but we have an active hibernation timer: Clear timeout
78 clearTimeout(this.state.hibernationTimer); 78 clearTimeout(this.hibernationTimer);
79 } 79 }
80 80
81 // Service is active, wake up service from hibernation 81 // Service is active, wake up service from hibernation
82 this.setState({
83 hibernate: false,
84 });
85 this.props.actions.service.setHibernation({ 82 this.props.actions.service.setHibernation({
86 serviceId: this.props.service.id, 83 serviceId: this.props.service.id,
87 hibernating: false, 84 hibernating: false,
@@ -90,16 +87,6 @@ export default @inject('stores', 'actions') @observer class ServiceView extends
90 }, 87 },
91 ); 88 );
92 89
93 // Store hibernation status to state, otherwise the webview won't get unloaded correctly
94 reaction(
95 () => this.props.service.isHibernating,
96 () => {
97 this.setState({
98 hibernate: this.props.service.isHibernating,
99 });
100 },
101 );
102
103 // Start hibernation counter if we are in background 90 // Start hibernation counter if we are in background
104 if (!this.props.service.isActive && this.props.stores.settings.all.app.hibernate) { 91 if (!this.props.service.isActive && this.props.stores.settings.all.app.hibernate) {
105 this.startHibernationTimer(); 92 this.startHibernationTimer();
@@ -126,18 +113,13 @@ export default @inject('stores', 'actions') @observer class ServiceView extends
126 const timerDuration = (Number(this.props.stores.settings.all.app.hibernationStrategy) || 300) * 1000; 113 const timerDuration = (Number(this.props.stores.settings.all.app.hibernationStrategy) || 300) * 1000;
127 114
128 const hibernationTimer = setTimeout(() => { 115 const hibernationTimer = setTimeout(() => {
129 this.setState({
130 hibernate: true,
131 });
132 this.props.actions.service.setHibernation({ 116 this.props.actions.service.setHibernation({
133 serviceId: this.props.service.id, 117 serviceId: this.props.service.id,
134 hibernating: true, 118 hibernating: true,
135 }); 119 });
136 }, timerDuration); 120 }, timerDuration);
137 121
138 this.setState({ 122 this.hibernationTimer = hibernationTimer;
139 hibernationTimer,
140 });
141 } 123 }
142 124
143 render() { 125 render() {
@@ -208,7 +190,7 @@ export default @inject('stores', 'actions') @observer class ServiceView extends
208 </Fragment> 190 </Fragment>
209 ) : ( 191 ) : (
210 <> 192 <>
211 {!this.state.hibernate ? ( 193 {!service.isHibernating ? (
212 <> 194 <>
213 {(service.recipe.id === CUSTOM_WEBSITE_ID || showServiceNavigationBar) && ( 195 {(service.recipe.id === CUSTOM_WEBSITE_ID || showServiceNavigationBar) && (
214 <WebControlsScreen service={service} /> 196 <WebControlsScreen service={service} />