diff --git a/src/components/views/dialogs/BugReportDialog.js b/src/components/views/dialogs/BugReportDialog.js
index badc994b..7a65ac58 100644
--- a/src/components/views/dialogs/BugReportDialog.js
+++ b/src/components/views/dialogs/BugReportDialog.js
@@ -16,7 +16,6 @@ limitations under the License.
import React from 'react';
import sdk from 'matrix-react-sdk';
-import submit_rageshake from '../../../vector/submit-rageshake';
import SdkConfig from 'matrix-react-sdk/lib/SdkConfig';
export default class BugReportDialog extends React.Component {
@@ -27,11 +26,18 @@ export default class BugReportDialog extends React.Component {
busy: false,
err: null,
text: "",
+ progress: null,
};
+ this._unmounted = false;
this._onSubmit = this._onSubmit.bind(this);
this._onCancel = this._onCancel.bind(this);
this._onTextChange = this._onTextChange.bind(this);
this._onSendLogsChange = this._onSendLogsChange.bind(this);
+ this._sendProgressCallback = this._sendProgressCallback.bind(this);
+ }
+
+ componentWillUnmount() {
+ this._unmounted = true;
}
_onCancel(ev) {
@@ -47,15 +53,27 @@ export default class BugReportDialog extends React.Component {
});
return;
}
- this.setState({ busy: true, err: null });
- submit_rageshake(SdkConfig.get().bug_report_endpoint_url, {
- userText: userText,
- sendLogs: sendLogs,
- }).then(() => {
- this.setState({ busy: false });
- this.props.onFinished(false);
- }, (err) => {
- this.setState({ busy: false, err: `Failed: ${err.message}` });
+ this.setState({ busy: true, progress: null, err: null });
+ this._sendProgressCallback("Loading bug report module");
+
+ require(['../../../vector/submit-rageshake'], (s) => {
+ s(SdkConfig.get().bug_report_endpoint_url, {
+ userText: userText,
+ sendLogs: sendLogs,
+ progressCallback: this._sendProgressCallback,
+ }).then(() => {
+ if (!this._unmounted) {
+ this.setState({ busy: false, progress: null });
+ this.props.onFinished(false);
+ }
+ }, (err) => {
+ if (!this._unmounted) {
+ this.setState({
+ busy: false, progress: null,
+ err: `Failed to send report: ${err.message}`,
+ });
+ }
+ });
});
}
@@ -67,6 +85,13 @@ export default class BugReportDialog extends React.Component {
this.setState({ sendLogs: ev.target.checked });
}
+ _sendProgressCallback(progress) {
+ if (this._unmounted) {
+ return;
+ }
+ this.setState({progress: progress});
+ }
+
render() {
const Loader = sdk.getComponent("elements.Spinner");
@@ -77,8 +102,6 @@ export default class BugReportDialog extends React.Component {
;
}
- const okLabel = this.state.busy ?