Skip to content

Instantly share code, notes, and snippets.

@interface FAMainAppJSBridge : NSObject<NSURLDownloadDelegate> {
FAMainApp *app;
FAAddInbox *addInbox;
FAWebPopup *popup;
}
- (id)initWithApp:(FAMainApp *)app;
- (void)sendNotification:(NSString *)title message:(NSString *)message link:(NSString *)link;
- (void)openExternalURL:(NSString *)rawURL;
- (void)downloadFile:(NSString *)name atURL:(NSString *)rawUrl;
+ (BOOL)isSelectorExcludedFromWebScript:(SEL)sel
{
return NO;
}
+ (BOOL)isKeyExcludedFromWebScript:(const char *)name
{
return NO;
}
- (id)init {
self = [super initWithWindowNibName:@"FAMainApp"];
if (self) {
bridge = [[FAMainAppJSBridge alloc] initWithApp:self];
}
return self;
}
frontApp.service('desktop', function () {
this.sendDesktopNotification = $log.wrapException(function (notification) {
$window.osx.sendNotification_message_link_(notification.title, notification.description, notification.link);
});
});
// somewhere else in the app:
desktop.sendNotification(notification);
@lperrin
lperrin / front_contact_api.md
Last active August 29, 2015 14:06
Front Contact API

The Front Contact API makes it possible to programmatically create of update contacts of your company. To use it, you need a login/password that you can retrieve by contacting us at [email protected].

The API is located at https://api.frontapp.com/api/1/contacts and uses a BASIC auth.

At the moment, it only accepts JSON POST requests:

{
  "name": "Bruce Wayne",
 "description": "CEO / Wayne.inc",
@lperrin
lperrin / plugin_api.js
Created December 17, 2014 15:44
Plugin API
var _ = require('underscore');
module.exports = function (ngModule) {
ngModule.service('pluginapi', function ($window, $rootScope, team, conversationsSelection, singleConversation) {
this.publish = function () {
var allowedDomain = $window.__allowEmbed;
if (!allowedDomain)
return;
<div class="plugin">
<h1>Demo Extension</h1>
<button class="assign-self">Take lead</button>
<button class="auto-reply">Auto Reply</button>
<div class="contact-info">
<h2>Contact Info</h2>
<span></span>
</div>
html, * {
box-sizing: border-box;
font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial;
}
.plugin {
float: right;
width: 300px;
height: 700px;
background: #4a4a4a;
window.addEventListener('message', function (e) {
$('.contact-info span').text(e.data.contact.handle);
$('.message-info span').text(e.data.message.blurb);
});
var $front = $('#front')[0].contentWindow;
$('button.assign-self').click(function () {
$front.postMessage({type: 'assign', assignee: 'laurent'}, 'https://app.frontapp.com');
});
$('button.auto-reply').click(function () {
$front.postMessage({
type: 'reply',
body: 'All work and no play makes Jack a dull boy. All work and no play makes Jack a dull boy. All work and no play makes Jack a dull boy. All work and no play makes Jack a dull boy.'