diff options
author | 2017-11-08 09:56:59 +0100 | |
---|---|---|
committer | 2017-11-08 09:56:59 +0100 | |
commit | 46d70c093c315386ea20b9c6e88af099508fb522 (patch) | |
tree | 9e1148d98476f864903900e819b509dfe12a7f14 /src/components/services/content/ServiceWebview.js | |
parent | fix(App): Prevent app from redirecting when dropping link (diff) | |
parent | feature(Service): Add webview crash handler to display a user friendly message (diff) | |
download | ferdium-app-46d70c093c315386ea20b9c6e88af099508fb522.tar.gz ferdium-app-46d70c093c315386ea20b9c6e88af099508fb522.tar.zst ferdium-app-46d70c093c315386ea20b9c6e88af099508fb522.zip |
feat(Service): Add crash handler to display a user friendly message
(@dannyqiu)
Diffstat (limited to 'src/components/services/content/ServiceWebview.js')
-rw-r--r-- | src/components/services/content/ServiceWebview.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/components/services/content/ServiceWebview.js b/src/components/services/content/ServiceWebview.js index 3ee3155be..cd59e0a8a 100644 --- a/src/components/services/content/ServiceWebview.js +++ b/src/components/services/content/ServiceWebview.js | |||
@@ -7,12 +7,14 @@ import classnames from 'classnames'; | |||
7 | 7 | ||
8 | import ServiceModel from '../../../models/Service'; | 8 | import ServiceModel from '../../../models/Service'; |
9 | import StatusBarTargetUrl from '../../ui/StatusBarTargetUrl'; | 9 | import StatusBarTargetUrl from '../../ui/StatusBarTargetUrl'; |
10 | import WebviewCrashHandler from './WebviewCrashHandler'; | ||
10 | 11 | ||
11 | @observer | 12 | @observer |
12 | export default class ServiceWebview extends Component { | 13 | export default class ServiceWebview extends Component { |
13 | static propTypes = { | 14 | static propTypes = { |
14 | service: PropTypes.instanceOf(ServiceModel).isRequired, | 15 | service: PropTypes.instanceOf(ServiceModel).isRequired, |
15 | setWebviewReference: PropTypes.func.isRequired, | 16 | setWebviewReference: PropTypes.func.isRequired, |
17 | reload: PropTypes.func.isRequired, | ||
16 | }; | 18 | }; |
17 | 19 | ||
18 | static defaultProps = { | 20 | static defaultProps = { |
@@ -53,6 +55,7 @@ export default class ServiceWebview extends Component { | |||
53 | const { | 55 | const { |
54 | service, | 56 | service, |
55 | setWebviewReference, | 57 | setWebviewReference, |
58 | reload, | ||
56 | } = this.props; | 59 | } = this.props; |
57 | 60 | ||
58 | const webviewClasses = classnames({ | 61 | const webviewClasses = classnames({ |
@@ -70,6 +73,13 @@ export default class ServiceWebview extends Component { | |||
70 | 73 | ||
71 | return ( | 74 | return ( |
72 | <div className={webviewClasses}> | 75 | <div className={webviewClasses}> |
76 | {service.hasCrashed && ( | ||
77 | <WebviewCrashHandler | ||
78 | name={service.recipe.name} | ||
79 | webview={service.webview} | ||
80 | reload={reload} | ||
81 | /> | ||
82 | )} | ||
73 | <Webview | 83 | <Webview |
74 | ref={(element) => { this.webview = element; }} | 84 | ref={(element) => { this.webview = element; }} |
75 | 85 | ||