import React from 'react'; import {DefaultClientHelper, SystemStartService} from 'nylas-exports'; import ConfigSchemaItem from './config-schema-item'; class DefaultMailClientItem extends React.Component { constructor() { super(); this.state = {defaultClient: false}; this._helper = new DefaultClientHelper(); if (this._helper.available()) { this._helper.isRegisteredForURLScheme('mailto', (registered) => { if (this._mounted) this.setState({defaultClient: registered}); }); } } componentDidMount() { this._mounted = true; } componentWillUnmount() { this._mounted = false; } toggleDefaultMailClient = (event) => { if (this.state.defaultClient) { this.setState({defaultClient: false}); this._helper.resetURLScheme('mailto'); } else { this.setState({defaultClient: true}); this._helper.registerForURLScheme('mailto'); } event.target.blur(); } render() { return (