diff options
author | 2019-10-09 09:48:41 +0200 | |
---|---|---|
committer | 2019-10-09 09:48:41 +0200 | |
commit | da9e8a3d5b11efcc8eeee325c0ac7eb7840f75af (patch) | |
tree | a189f4566c6380b86aeb04b9307aea23fc6e14d7 /src/components/services | |
parent | Update zh-HANT.json (diff) | |
parent | Update CHANGELOG.md (diff) | |
download | ferdium-app-da9e8a3d5b11efcc8eeee325c0ac7eb7840f75af.tar.gz ferdium-app-da9e8a3d5b11efcc8eeee325c0ac7eb7840f75af.tar.zst ferdium-app-da9e8a3d5b11efcc8eeee325c0ac7eb7840f75af.zip |
Merge branch 'master' of https://github.com/meetfranz/franz into franz-5.4.0
Diffstat (limited to 'src/components/services')
-rw-r--r-- | src/components/services/content/ServiceView.js | 16 | ||||
-rw-r--r-- | src/components/services/content/ServiceWebview.js | 14 | ||||
-rw-r--r-- | src/components/services/content/Services.js | 12 |
3 files changed, 34 insertions, 8 deletions
diff --git a/src/components/services/content/ServiceView.js b/src/components/services/content/ServiceView.js index f6686548d..273653ea2 100644 --- a/src/components/services/content/ServiceView.js +++ b/src/components/services/content/ServiceView.js | |||
@@ -13,6 +13,7 @@ import ServiceDisabled from './ServiceDisabled'; | |||
13 | import ServiceWebview from './ServiceWebview'; | 13 | import ServiceWebview from './ServiceWebview'; |
14 | import SettingsStore from '../../../stores/SettingsStore'; | 14 | import SettingsStore from '../../../stores/SettingsStore'; |
15 | import WebControlsScreen from '../../../features/webControls/containers/WebControlsScreen'; | 15 | import WebControlsScreen from '../../../features/webControls/containers/WebControlsScreen'; |
16 | import { CUSTOM_WEBSITE_ID } from '../../../features/webControls/constants'; | ||
16 | 17 | ||
17 | export default @observer @inject('stores') class ServiceView extends Component { | 18 | export default @observer @inject('stores') class ServiceView extends Component { |
18 | static propTypes = { | 19 | static propTypes = { |
@@ -183,11 +184,16 @@ export default @observer @inject('stores') class ServiceView extends Component { | |||
183 | <WebControlsScreen service={service} /> | 184 | <WebControlsScreen service={service} /> |
184 | )} | 185 | )} |
185 | {!this.state.hibernate ? ( | 186 | {!this.state.hibernate ? ( |
186 | <ServiceWebview | 187 | <> |
187 | service={service} | 188 | {service.recipe.id === CUSTOM_WEBSITE_ID && ( |
188 | setWebviewReference={setWebviewReference} | 189 | <WebControlsScreen service={service} /> |
189 | detachService={detachService} | 190 | )} |
190 | /> | 191 | <ServiceWebview |
192 | service={service} | ||
193 | setWebviewReference={setWebviewReference} | ||
194 | detachService={detachService} | ||
195 | /> | ||
196 | </> | ||
191 | ) : ( | 197 | ) : ( |
192 | <div> | 198 | <div> |
193 | <span role="img" aria-label="Sleeping Emoji">😴</span> | 199 | <span role="img" aria-label="Sleeping Emoji">😴</span> |
diff --git a/src/components/services/content/ServiceWebview.js b/src/components/services/content/ServiceWebview.js index 03d6d5bcc..e6ebb6afb 100644 --- a/src/components/services/content/ServiceWebview.js +++ b/src/components/services/content/ServiceWebview.js | |||
@@ -38,6 +38,13 @@ class ServiceWebview extends Component { | |||
38 | detachService({ service }); | 38 | detachService({ service }); |
39 | } | 39 | } |
40 | 40 | ||
41 | refocusWebview = () => { | ||
42 | const { webview } = this; | ||
43 | if (!webview) return; | ||
44 | webview.view.blur(); | ||
45 | webview.view.focus(); | ||
46 | }; | ||
47 | |||
41 | render() { | 48 | render() { |
42 | const { | 49 | const { |
43 | service, | 50 | service, |
@@ -46,7 +53,12 @@ class ServiceWebview extends Component { | |||
46 | 53 | ||
47 | return ( | 54 | return ( |
48 | <ElectronWebView | 55 | <ElectronWebView |
49 | ref={(webview) => { this.webview = webview; }} | 56 | ref={(webview) => { |
57 | this.webview = webview; | ||
58 | if (webview && webview.view) { | ||
59 | webview.view.addEventListener('did-stop-loading', this.refocusWebview); | ||
60 | } | ||
61 | }} | ||
50 | autosize | 62 | autosize |
51 | src={service.url} | 63 | src={service.url} |
52 | preload="./webview/recipe.js" | 64 | preload="./webview/recipe.js" |
diff --git a/src/components/services/content/Services.js b/src/components/services/content/Services.js index 1afbaabc4..edff29ae8 100644 --- a/src/components/services/content/Services.js +++ b/src/components/services/content/Services.js | |||
@@ -64,16 +64,24 @@ export default @observer @injectSheet(styles) class Services extends Component { | |||
64 | 64 | ||
65 | state = { | 65 | state = { |
66 | showConfetti: true, | 66 | showConfetti: true, |
67 | } | 67 | }; |
68 | |||
69 | _confettiTimeout = null; | ||
68 | 70 | ||
69 | componentDidMount() { | 71 | componentDidMount() { |
70 | window.setTimeout(() => { | 72 | this._confettiTimeout = window.setTimeout(() => { |
71 | this.setState({ | 73 | this.setState({ |
72 | showConfetti: false, | 74 | showConfetti: false, |
73 | }); | 75 | }); |
74 | }, ms('8s')); | 76 | }, ms('8s')); |
75 | } | 77 | } |
76 | 78 | ||
79 | componentWillUnmount() { | ||
80 | if (this._confettiTimeout) { | ||
81 | clearTimeout(this._confettiTimeout); | ||
82 | } | ||
83 | } | ||
84 | |||
77 | render() { | 85 | render() { |
78 | const { | 86 | const { |
79 | services, | 87 | services, |