This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(original_url, branch_base_url) { | |
if (!original_url) { return new Error('Missing original_url'); } | |
if (typeof original_url != 'string') { return new Error('Invalid original_url'); } | |
if (!branch_base_url) { return new Error('Missing branch_base_url, should be similar to https://bnc.lt/abcd/3p?%243p=xx'); } | |
if (typeof branch_base_url != 'string') { return new Error('Invalid branch_base_url'); } | |
return branch_base_url + '&%24original_url=' + encodeURIComponent(original_url); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var crypto = require('crypto'); | |
module.exports = function(original_url, branch_base_url, branch_hmac_secret, three_p_url) { | |
if (!original_url) { return new Error('Missing original_url'); } | |
if (typeof original_url != 'string') { return new Error('Invalid original_url'); } | |
if (!branch_base_url) { return new Error('Missing branch_base_url, should be similar to https://bnc.lt/abcd/3p?%243p=xx'); } | |
if (typeof branch_base_url != 'string') { return new Error('Invalid branch_base_url'); } | |
if (!branch_hmac_secret) { return new Error('Missing branch_hmac_secret'); } | |
if (typeof branch_hmac_secret != 'string') { return new Error('Invalid branch_hmac_secret'); } | |
if (three_p_url && typeof three_p_url != 'string') { return new Error('Invalid three_p_url'); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Get list of previous contacts from NSUserDefaults | |
NSMutableArray *previousContacts = | |
[[[NSUserDefaults standardUserDefaults] objectForKey:@"contacts"] mutableCopy]; | |
if (!previousContacts) previousContacts = [NSMutableArray array]; | |
// 2. Add new contact to list | |
self.url = [[Branch getInstance] getShortURLWithParams:@{@"email": self.emailTextField.text}]; // [see note 2] | |
NSDictionary *newContact = @{ @"name": self.nameTextField.text, | |
@"email": self.emailTextField.text, | |
@"company": self.companyTextField.text, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// At top of ViewController implementation | |
#import <MessageUI/MessageUI.h> | |
#import <MessageUI/MFMailComposeViewController.h> | |
@interface ViewController () <MFMailComposeViewControllerDelegate> | |
@end | |
@implementation ViewController | |
- (void)sendEmail { |