import React from 'react'; import {LaunchServices, SystemStartService} from 'nylas-exports'; import ConfigSchemaItem from './config-schema-item'; class DefaultMailClientItem extends React.Component { constructor() { super(); this.state = {}; this._services = new LaunchServices(); if (this._services.available()) { this._services.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._services.resetURLScheme('mailto'); } else { this.setState({defaultClient: true}); this._services.registerForURLScheme('mailto'); } event.target.blur(); } render() { if (process.platform !== "darwin") return false; return (