2017-09-27 02:33:08 +08:00
|
|
|
import { React, UpdateChannelStore } from 'nylas-exports';
|
|
|
|
import { Notification } from 'nylas-component-kit';
|
2016-10-19 03:39:05 +08:00
|
|
|
|
|
|
|
export default class UnstableChannelNotification extends React.Component {
|
|
|
|
static displayName = 'UnstableChannelNotification';
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
this.state = {
|
|
|
|
isUnstableChannel: UpdateChannelStore.currentIsUnstable(),
|
2017-09-27 02:33:08 +08:00
|
|
|
};
|
2016-10-19 03:39:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
this._unsub = UpdateChannelStore.listen(() => {
|
|
|
|
this.setState({
|
|
|
|
isUnstableChannel: UpdateChannelStore.currentIsUnstable(),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
if (this._unsub) {
|
|
|
|
this._unsub();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_onReportIssue = () => {
|
2017-09-27 02:33:08 +08:00
|
|
|
NylasEnv.windowEventHandler.openLink({ href: 'mailto:support@getmailspring.com' });
|
|
|
|
};
|
2016-10-19 03:39:05 +08:00
|
|
|
|
|
|
|
render() {
|
2016-11-05 07:30:28 +08:00
|
|
|
if (!this.state.isUnstableChannel) {
|
2017-09-27 02:33:08 +08:00
|
|
|
return <span />;
|
2016-10-19 03:39:05 +08:00
|
|
|
}
|
|
|
|
return (
|
|
|
|
<Notification
|
|
|
|
priority="0"
|
2016-11-05 07:30:28 +08:00
|
|
|
displayName={UnstableChannelNotification.displayName}
|
2016-10-19 03:39:05 +08:00
|
|
|
title="You're on a pre-release channel. We'd love your feedback."
|
2017-01-12 09:41:07 +08:00
|
|
|
subtitle="You can switch back to stable from the preferences."
|
2016-10-19 03:39:05 +08:00
|
|
|
icon="volstead-defaultclient.png"
|
2017-09-27 02:33:08 +08:00
|
|
|
actions={[
|
|
|
|
{
|
|
|
|
label: 'Feedback',
|
|
|
|
fn: this._onReportIssue,
|
|
|
|
},
|
|
|
|
]}
|
2016-11-05 07:30:28 +08:00
|
|
|
isDismissable
|
|
|
|
isPermanentlyDismissable
|
2016-10-19 03:39:05 +08:00
|
|
|
/>
|
2017-09-27 02:33:08 +08:00
|
|
|
);
|
2016-10-19 03:39:05 +08:00
|
|
|
}
|
|
|
|
}
|