Add thread-sharing plugin

Summary:
Add thread-sharing plugin:

- Add popover to enable sharing
- Register custom nylas:// protocol to open a thread via protocol is thread exists

Test Plan: Manual

Reviewers: jackie, bengotow

Reviewed By: jackie, bengotow

Subscribers: jackie, halla

Differential Revision: https://phab.nylas.com/D3265
This commit is contained in:
Juan Tejada 2016-09-14 00:03:59 -07:00
parent 0d67a593b4
commit 677a83b8f5
8 changed files with 19 additions and 6 deletions

1
.gitignore vendored
View file

@ -36,3 +36,4 @@ internal_packages/composer-scheduler
internal_packages/link-tracking internal_packages/link-tracking
internal_packages/open-tracking internal_packages/open-tracking
internal_packages/send-later internal_packages/send-later
internal_packages/thread-sharing

View file

@ -45,10 +45,10 @@
<dict> <dict>
<key>CFBundleURLSchemes</key> <key>CFBundleURLSchemes</key>
<array> <array>
<string>edgehill</string> <string>nylas</string>
</array> </array>
<key>CFBundleURLName</key> <key>CFBundleURLName</key>
<string>Nylas Shared Session Protocol</string> <string>Nylas Protocol</string>
</dict> </dict>
<dict> <dict>
<key>CFBundleURLSchemes</key> <key>CFBundleURLSchemes</key>

View file

@ -2,7 +2,7 @@
ExtensionRegistry, ExtensionRegistry,
WorkspaceStore} = require 'nylas-exports' WorkspaceStore} = require 'nylas-exports'
MessageList = require "./message-list" MessageList = require("./message-list")
MessageListHiddenMessagesToggle = require('./message-list-hidden-messages-toggle').default MessageListHiddenMessagesToggle = require('./message-list-hidden-messages-toggle').default
SidebarPluginContainer = require "./sidebar-plugin-container" SidebarPluginContainer = require "./sidebar-plugin-container"

0
internal_packages/message-list/lib/message-list.cjsx Executable file → Normal file
View file

View file

@ -9,6 +9,7 @@ import PerformanceMonitor from './performance-monitor'
import NylasProtocolHandler from './nylas-protocol-handler'; import NylasProtocolHandler from './nylas-protocol-handler';
import PackageMigrationManager from './package-migration-manager'; import PackageMigrationManager from './package-migration-manager';
import ConfigPersistenceManager from './config-persistence-manager'; import ConfigPersistenceManager from './config-persistence-manager';
import LaunchServices from '../launch-services';
import {BrowserWindow, Menu, app, ipcMain, dialog} from 'electron'; import {BrowserWindow, Menu, app, ipcMain, dialog} from 'electron';
@ -70,6 +71,13 @@ export default class Application extends EventEmitter {
this.setupJavaScriptArguments(); this.setupJavaScriptArguments();
this.handleEvents(); this.handleEvents();
this.handleLaunchOptions(options); this.handleLaunchOptions(options);
if (process.platform === 'linux') {
const services = new LaunchServices();
services.registerForURLScheme('nylas');
} else {
app.setAsDefaultProtocolClient('nylas')
}
} }
getMainWindow() { getMainWindow() {
@ -671,6 +679,9 @@ export default class Application extends EventEmitter {
if (protocol === 'mailto:') { if (protocol === 'mailto:') {
const main = this.windowManager.get(WindowManager.MAIN_WINDOW); const main = this.windowManager.get(WindowManager.MAIN_WINDOW);
if (main) { main.sendMessage('mailto', urlToOpen) } if (main) { main.sendMessage('mailto', urlToOpen) }
} else if (protocol === 'nylas:') {
const main = this.windowManager.get(WindowManager.MAIN_WINDOW);
if (main) { main.sendMessage('openExternalThread', urlToOpen) }
} else { } else {
console.log(`Ignoring unknown URL type: ${urlToOpen}`); console.log(`Ignoring unknown URL type: ${urlToOpen}`);
} }

View file

@ -84,7 +84,7 @@ const parseCommandLine = (argv) => {
// On Windows and Linux, mailto and file opens are passed as the last argv // On Windows and Linux, mailto and file opens are passed as the last argv
if (argv.length > 1 && !argv.join(' ').includes('--squirrel')) { if (argv.length > 1 && !argv.join(' ').includes('--squirrel')) {
const lastArg = argv[argv.length - 1]; const lastArg = argv[argv.length - 1];
if (lastArg.startsWith('mailto:')) { if (lastArg.startsWith('mailto:') || lastArg.startsWith('nylas:')) {
urlsToOpen.push(lastArg); urlsToOpen.push(lastArg);
} else if ((lastArg[0] !== '-') && (/[\/|\\]/.test(lastArg))) { } else if ((lastArg[0] !== '-') && (/[\/|\\]/.test(lastArg))) {
pathsToOpen.push(lastArg); pathsToOpen.push(lastArg);

View file

@ -9,7 +9,7 @@ import React from 'react';
*/ */
const Switch = (props) => { const Switch = (props) => {
let classnames = "slide-switch"; let classnames = `${props.className} slide-switch`;
if (props.checked) { if (props.checked) {
classnames += " active"; classnames += " active";
} }
@ -24,6 +24,7 @@ const Switch = (props) => {
Switch.propTypes = { Switch.propTypes = {
checked: React.PropTypes.bool, checked: React.PropTypes.bool,
onChange: React.PropTypes.func.isRequired, onChange: React.PropTypes.func.isRequired,
className: React.PropTypes.string,
}; };
export default Switch; export default Switch;

@ -1 +1 @@
Subproject commit b47405f99f77fe3149ddb55453013ab1058031a8 Subproject commit 008319a8290e5eeaffbf763ba0f596195eec51d4