In Snap, link to instructions instead of showing check for default client

This commit is contained in:
Ben Gotow 2017-10-20 00:23:19 -07:00
parent f0c45d7c4e
commit 2cd2d1ccfb
2 changed files with 21 additions and 2 deletions

View file

@ -1,17 +1,21 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { DefaultClientHelper, SystemStartService } from 'mailspring-exports'; import { DefaultClientHelper, SystemStartService } from 'mailspring-exports';
import { shell } from 'electron';
import ConfigSchemaItem from './config-schema-item'; import ConfigSchemaItem from './config-schema-item';
class DefaultMailClientItem extends React.Component { class DefaultMailClientItem extends React.Component {
constructor() { constructor() {
super(); super();
this.state = { defaultClient: false };
this._helper = new DefaultClientHelper(); this._helper = new DefaultClientHelper();
if (this._helper.available()) { if (this._helper.available()) {
this.state = { defaultClient: false };
this._helper.isRegisteredForURLScheme('mailto', registered => { this._helper.isRegisteredForURLScheme('mailto', registered => {
if (this._mounted) this.setState({ defaultClient: registered }); if (this._mounted) this.setState({ defaultClient: registered });
}); });
} else {
this.state = { defaultClient: 'unknown' };
} }
} }
@ -35,6 +39,21 @@ class DefaultMailClientItem extends React.Component {
}; };
render() { render() {
if (this.state.defaultClient === 'unknown') {
return (
<div className="item">
<div
style={{ marginBottom: 12 }}
className="btn btn-small"
onClick={() =>
shell.openExternal('https://foundry376.zendesk.com/hc/en-us/articles/115002281851')}
>
Use Mailspring as default mail client
</div>
</div>
);
}
return ( return (
<div className="item"> <div className="item">
<input <input

View file

@ -92,7 +92,7 @@ class Windows {
class Linux { class Linux {
available() { available() {
return true; return !process.env.SNAP;
} }
isRegisteredForURLScheme(scheme, callback) { isRegisteredForURLScheme(scheme, callback) {