diff --git a/.gitignore b/.gitignore
index 83631f70..692b8299 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,6 @@ testbed/hooks
node_modules
testbed/ul_web_hooks/
.installed
+
+/plugin.xml
+src/ios/BranchNPM.h
\ No newline at end of file
diff --git a/gulpfile.js b/gulpfile.js
index 8303c81d..4bf68ceb 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -1,9 +1,21 @@
var gulp = require('gulp');
var fs = require('fs');
+//setup for development use
+gulp.task('setupDev', function(){
+ getDevPluginXML();
+ setIosNpmOrDev('dev');
+})
+
+//setup for npm deployment
+gulp.task('setupNpm', function(){
+ genNpmPluginXML();
+ setIosNpmOrDev('npm');
+});
+
//generate plugin.xml for use as a cordova plugin
//here we explode the contents of the frameworks
-gulp.task('gen-npm-plugin-xml', function(){
+function genNpmPluginXML(){
var xml = fs.readFileSync('plugin.template.xml', 'utf-8');
var files = [];
@@ -17,18 +29,29 @@ gulp.task('gen-npm-plugin-xml', function(){
+ files.join(newLineIndent));
fs.writeFileSync('plugin.xml', xml);
-});
+};
//generate plugin.xml for local development
//here we reference the frameworks instead of all the files directly
-gulp.task('gen-dev-plugin-xml', function(){
+function getDevPluginXML(){
var xml = fs.readFileSync('plugin.template.xml', 'utf-8');
xml = xml.replace('',
'');
fs.writeFileSync('plugin.xml', xml);
-});
+};
+
+function setIosNpmOrDev(npmOrDev){
+ if(npmOrDev === 'npm'){
+ content = '#define BRANCH_NPM true';
+ }else if(npmOrDev === 'dev'){
+ content = '//empty';
+ }else{
+ throw new Error('expected deployed|local, not ' + deployedOrLocal);
+ }
+ fs.writeFileSync('src/ios/BranchNPM.h', content + '\n');
+}
//emit array of cordova file references for all .h/.m files in path
function emitFiles(path){
diff --git a/plugin.template.xml b/plugin.template.xml
index 5165dac0..f415dbde 100644
--- a/plugin.template.xml
+++ b/plugin.template.xml
@@ -1,3 +1,8 @@
+
+
+
+
+
-
-
- branch-cordova-sdk
- Branch SDK Plugin
- Apache 2.0
- cordova,branch
- https://github.com/BranchMetrics/Cordova-Ionic-PhoneGap-Deferred-Deep-Linking-SDK.git
- https://github.com/BranchMetrics/Cordova-Ionic-PhoneGap-Deferred-Deep-Linking-SDK/issues
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $BRANCH_KEY
-
-
-
-
- CFBundleURLName
- io.branch.sdk
- CFBundleURLSchemes
-
- $URI_SCHEME
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/ios/AppDelegate+BranchSdk.m b/src/ios/AppDelegate+BranchSdk.m
index bd0a480e..7e66c75a 100644
--- a/src/ios/AppDelegate+BranchSdk.m
+++ b/src/ios/AppDelegate+BranchSdk.m
@@ -7,7 +7,14 @@
//
#import "AppDelegate.h"
-#import
+
+#import "BranchNPM.h"
+
+#ifdef BRANCH_NPM
+ #import "Branch.h"
+#else
+ #import
+#endif
@interface AppDelegate (BranchSDK)
diff --git a/src/ios/BranchSDK.h b/src/ios/BranchSDK.h
index ba26e108..e9944313 100644
--- a/src/ios/BranchSDK.h
+++ b/src/ios/BranchSDK.h
@@ -5,9 +5,18 @@
// Copyright © 2016 Branch Metrics. All rights reserved.
//
-#import
-#import
-#import
+#import "BranchNPM.h"
+
+#ifdef BRANCH_NPM
+ #import "Branch.h"
+ #import "BranchLinkProperties.h"
+ #import "BranchUniversalObject.h"
+#else
+ #import
+ #import
+ #import
+#endif
+
#import
@interface BranchSDK : CDVPlugin