diff --git a/.gitignore b/.gitignore
index 9c6f3e6d..4495f747 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,3 +27,5 @@ Pods
#
node_modules/
npm-debug.log
+
+/testbuild
\ No newline at end of file
diff --git a/App/Mixins/AuthHelper.js b/App/Mixins/AuthHelper.js
index 04d3e04f..059bc0b5 100644
--- a/App/Mixins/AuthHelper.js
+++ b/App/Mixins/AuthHelper.js
@@ -13,6 +13,8 @@ var Text = require('../Components/Text');
var Button = require('../Components/Button');
var TextInput = require('../Components/TextInput');
+var EnvironmentStore = require('../Stores/EnvironmentStore');
+
var AuthHelper = {
// parent implements: onAuthButton, getDefaultProps
@@ -111,7 +113,7 @@ var AuthHelper = {
{this.renderPassword()}
- TODO: v1
+ Version {EnvironmentStore.get().displayVersion()}
)
diff --git a/App/Models/Environment.js b/App/Models/Environment.js
index e3846466..05021c01 100644
--- a/App/Models/Environment.js
+++ b/App/Models/Environment.js
@@ -1,4 +1,5 @@
var assign = require('../Lib/assignDefined');
+var jsVersion = require('../jsVersion');
var Model = function(options) {
this.data = {};
@@ -8,7 +9,11 @@ var Model = function(options) {
Model.prototype.setAttributes = function(options) {
options = (options || {});
assign(this.data, {
- name: options.name
+ name: options.name,
+ simulator: options.simulator,
+ buildCode: parseInt(options.buildCode),
+ version: options.version,
+ locale: options.locale
});
};
@@ -18,9 +23,27 @@ Model.prototype.getApiHost = function() {
return 'http://localhost:3001';
case 'debug':
return 'http://localhost:3000';
+ case 'staging':
+ return 'https://someday.herokuapp.com';
default:
throw("Unknown Environment.getApiHost: " + this.data.name);
}
};
+Model.prototype.combinedBuildCode = function() {
+ var ios = this.data.buildCode * 1000000;
+ return ios + jsVersion;
+};
+
+Model.prototype.displayVersion = function() {
+ var out = this.data.version;
+ out += "." + this.data.buildCode;
+ out += "." + jsVersion;
+ return out;
+};
+
+Model.prototype.getLocale = function() {
+ return this.data.locale;
+};
+
module.exports = Model;
diff --git a/App/Screens/Settings.js b/App/Screens/Settings.js
index 5b79b03e..d5fce26f 100644
--- a/App/Screens/Settings.js
+++ b/App/Screens/Settings.js
@@ -1,12 +1,17 @@
var React = require('react-native');
var {
View,
- StyleSheet
+ StyleSheet,
+ Text
} = React;
+var cssVar = require('../Lib/cssVar');
+
var SimpleList = require('../Components/SimpleList');
var AppConstants = require('../Constants/AppConstants');
+var EnvironmentStore = require('../Stores/EnvironmentStore');
+
function getListState() {
var list = [];
list.push({
@@ -28,6 +33,9 @@ var Settings = React.createClass({
return (
+
+ Version {EnvironmentStore.get().displayVersion()}
+
)
}
@@ -36,7 +44,12 @@ var Settings = React.createClass({
var styles = StyleSheet.create({
container: {
flex: 1
- }
+ },
+ bottomText: {
+ padding: 10,
+ color: cssVar('gray20'),
+ fontSize: 12
+ },
});
module.exports = Settings;
diff --git a/App/Stores/EnvironmentStore.js b/App/Stores/EnvironmentStore.js
index 12fbca34..07b3ca01 100644
--- a/App/Stores/EnvironmentStore.js
+++ b/App/Stores/EnvironmentStore.js
@@ -38,9 +38,9 @@ var SingletonStore = assign({}, EventEmitter.prototype, {
Dispatcher.register(function(action) {
switch(action.actionType) {
case AppConstants.APP_LAUNCHED:
- EnvironmentManager.get(function(name) {
- console.log("Environment: " + name);
- setSingleton({name: name});
+ EnvironmentManager.get(function(attributes) {
+ console.log("Environment: " + attributes.name);
+ setSingleton(attributes);
SingletonStore.emitChange();
});
break;
diff --git a/App/jsVersion.js b/App/jsVersion.js
new file mode 100644
index 00000000..4bbffde1
--- /dev/null
+++ b/App/jsVersion.js
@@ -0,0 +1 @@
+module.exports = 2;
diff --git a/README.md b/README.md
index 4db923ee..680619db 100644
--- a/README.md
+++ b/README.md
@@ -12,17 +12,23 @@ In the `ios` directory
* Install Pods: `pod install`
* Launch: `open Sample.xcworkspace`
-#### Server
+### Server
There is a server that the app hits for data. The data is only stored in memory, but it should produce a more realistic environment.
In the `server` directory
-* Install nvm and iojs-v2.4.0
+* Install nvm and node-4.0.0
* Run it: `npm start`
It has sample data in the `models.js` file. For example, there is a user bleonard (password: "sample") that you can log in as.
+### Compiling
+
+You can compile and put it on the phone with: `npm run install:staging`
+
+Not that there's a staging server at this point, but it's an example of how to compile things via the command line.
+
### Android
We'll get there, but we're still working on the iOS version.
diff --git a/ios/Debug.xcconfig b/ios/Debug.xcconfig
new file mode 100644
index 00000000..55aaceb3
--- /dev/null
+++ b/ios/Debug.xcconfig
@@ -0,0 +1,3 @@
+#include "Pods/Target Support Files/Pods/Pods.debug.xcconfig"
+
+GCC_PREPROCESSOR_DEFINITIONS = $(inherited) kEnvironment="@\"debug\""
\ No newline at end of file
diff --git a/ios/Podfile.lock b/ios/Podfile.lock
index c31eb0b9..690bef4f 100644
--- a/ios/Podfile.lock
+++ b/ios/Podfile.lock
@@ -7,4 +7,4 @@ DEPENDENCIES:
SPEC CHECKSUMS:
SimulatorRemoteNotifications: 1610643e0582b2af67bc254b071ace4077e8ef86
-COCOAPODS: 0.38.2
+COCOAPODS: 0.39.0
diff --git a/ios/Sample.xcodeproj/project.pbxproj b/ios/Sample.xcodeproj/project.pbxproj
index 98dfb76f..893d35e9 100644
--- a/ios/Sample.xcodeproj/project.pbxproj
+++ b/ios/Sample.xcodeproj/project.pbxproj
@@ -13,7 +13,6 @@
00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; };
00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; };
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
- 00E356F31AD99517003FC87E /* SampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* SampleTests.m */; };
133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; };
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; };
@@ -65,13 +64,6 @@
remoteGlobalIDString = 832C81801AAF6DEF007FA2F7;
remoteInfo = RCTVibration;
};
- 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
- proxyType = 1;
- remoteGlobalIDString = 13B07F861A680F5B00A75B9A;
- remoteInfo = Sample;
- };
139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
@@ -130,7 +122,6 @@
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; };
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = ""; };
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = ""; };
- 00E356EE1AD99517003FC87E /* SampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
00E356F21AD99517003FC87E /* SampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SampleTests.m; sourceTree = ""; };
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; };
@@ -148,19 +139,14 @@
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; };
A565388F7CDBDB0548B5DC8D /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
D339AEE11BAA808800CFA651 /* RNKeyboardEvents.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNKeyboardEvents.xcodeproj; path = "../node_modules/react-native-keyboardevents/RNKeyboardEvents.xcodeproj"; sourceTree = ""; };
+ D36DCD9F1BD4A92600B3EB2F /* Staging.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Staging.xcconfig; sourceTree = ""; };
+ D36DCDA01BD4A92600B3EB2F /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; };
D374ADB51BA929B900453203 /* RNKeychain.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNKeychain.xcodeproj; path = "../node_modules/react-native-keychain/RNKeychain.xcodeproj"; sourceTree = ""; };
D374ADD21BA9336E00453203 /* EnvironmentManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EnvironmentManager.m; path = Sample/EnvironmentManager.m; sourceTree = ""; };
F8DE0F0169FA03E7C6B1C51E /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
- 00E356EB1AD99517003FC87E /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -335,6 +321,7 @@
83CBB9F61A601CBA00E9B192 = {
isa = PBXGroup;
children = (
+ D36DCD921BD4A91C00B3EB2F /* Config */,
13B07FAE1A68108700A75B9A /* Sample */,
832341AE1AAA6A7D00B99B32 /* Libraries */,
00E356EF1AD99517003FC87E /* SampleTests */,
@@ -350,7 +337,6 @@
isa = PBXGroup;
children = (
13B07F961A680F5B00A75B9A /* Sample.app */,
- 00E356EE1AD99517003FC87E /* SampleTests.xctest */,
);
name = Products;
sourceTree = "";
@@ -363,6 +349,15 @@
name = Products;
sourceTree = "";
};
+ D36DCD921BD4A91C00B3EB2F /* Config */ = {
+ isa = PBXGroup;
+ children = (
+ D36DCD9F1BD4A92600B3EB2F /* Staging.xcconfig */,
+ D36DCDA01BD4A92600B3EB2F /* Debug.xcconfig */,
+ );
+ name = Config;
+ sourceTree = "";
+ };
D374ADB61BA929B900453203 /* Products */ = {
isa = PBXGroup;
children = (
@@ -374,24 +369,6 @@
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
- 00E356ED1AD99517003FC87E /* SampleTests */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "SampleTests" */;
- buildPhases = (
- 00E356EA1AD99517003FC87E /* Sources */,
- 00E356EB1AD99517003FC87E /* Frameworks */,
- 00E356EC1AD99517003FC87E /* Resources */,
- );
- buildRules = (
- );
- dependencies = (
- 00E356F51AD99517003FC87E /* PBXTargetDependency */,
- );
- name = SampleTests;
- productName = SampleTests;
- productReference = 00E356EE1AD99517003FC87E /* SampleTests.xctest */;
- productType = "com.apple.product-type.bundle.unit-test";
- };
13B07F861A680F5B00A75B9A /* Sample */ = {
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Sample" */;
@@ -401,6 +378,8 @@
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
DF35A678DD70FEB3ABFDEA69 /* Copy Pods Resources */,
+ D32D268A1BD4AFC8007753B2 /* ShellScript */,
+ B91827D077A8C198AC93F32E /* Embed Pods Frameworks */,
);
buildRules = (
);
@@ -419,12 +398,6 @@
attributes = {
LastUpgradeCheck = 0610;
ORGANIZATIONNAME = Facebook;
- TargetAttributes = {
- 00E356ED1AD99517003FC87E = {
- CreatedOnToolsVersion = 6.2;
- TestTargetID = 13B07F861A680F5B00A75B9A;
- };
- };
};
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Sample" */;
compatibilityVersion = "Xcode 3.2";
@@ -490,7 +463,6 @@
projectRoot = "";
targets = (
13B07F861A680F5B00A75B9A /* Sample */,
- 00E356ED1AD99517003FC87E /* SampleTests */,
);
};
/* End PBXProject section */
@@ -583,13 +555,6 @@
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
- 00E356EC1AD99517003FC87E /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
13B07F8E1A680F5B00A75B9A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@@ -603,6 +568,21 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
+ B91827D077A8C198AC93F32E /* Embed Pods Frameworks */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Embed Pods Frameworks";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n";
+ showEnvVarsInLog = 0;
+ };
C1D93FBDA4027FB5459323A3 /* Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -618,6 +598,19 @@
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
+ D32D268A1BD4AFC8007753B2 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "if [ \"${PLATFORM_NAME}\" != \"iphonesimulator\" ]; then\n source ~/.nvm/nvm.sh\n cd ${PROJECT_DIR}/.. && react-native bundle --minify\nfi";
+ };
DF35A678DD70FEB3ABFDEA69 /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -636,14 +629,6 @@
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
- 00E356EA1AD99517003FC87E /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 00E356F31AD99517003FC87E /* SampleTests.m in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
13B07F871A680F5B00A75B9A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -656,14 +641,6 @@
};
/* End PBXSourcesBuildPhase section */
-/* Begin PBXTargetDependency section */
- 00E356F51AD99517003FC87E /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- target = 13B07F861A680F5B00A75B9A /* Sample */;
- targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */;
- };
-/* End PBXTargetDependency section */
-
/* Begin PBXVariantGroup section */
13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = {
isa = PBXVariantGroup;
@@ -677,46 +654,9 @@
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
- 00E356F61AD99517003FC87E /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- BUNDLE_LOADER = "$(TEST_HOST)";
- FRAMEWORK_SEARCH_PATHS = (
- "$(SDKROOT)/Developer/Library/Frameworks",
- "$(inherited)",
- );
- GCC_PREPROCESSOR_DEFINITIONS = (
- "DEBUG=1",
- "$(inherited)",
- );
- INFOPLIST_FILE = SampleTests/Info.plist;
- IPHONEOS_DEPLOYMENT_TARGET = 8.2;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
- PRODUCT_NAME = "$(TARGET_NAME)";
- TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Sample.app/Sample";
- };
- name = Debug;
- };
- 00E356F71AD99517003FC87E /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- BUNDLE_LOADER = "$(TEST_HOST)";
- COPY_PHASE_STRIP = NO;
- FRAMEWORK_SEARCH_PATHS = (
- "$(SDKROOT)/Developer/Library/Frameworks",
- "$(inherited)",
- );
- INFOPLIST_FILE = SampleTests/Info.plist;
- IPHONEOS_DEPLOYMENT_TARGET = 8.2;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
- PRODUCT_NAME = "$(TARGET_NAME)";
- TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Sample.app/Sample";
- };
- name = Release;
- };
13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = F8DE0F0169FA03E7C6B1C51E /* Pods.debug.xcconfig */;
+ baseConfigurationReference = D36DCDA01BD4A92600B3EB2F /* Debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
HEADER_SEARCH_PATHS = (
@@ -734,26 +674,6 @@
};
name = Debug;
};
- 13B07F951A680F5B00A75B9A /* Release */ = {
- isa = XCBuildConfiguration;
- baseConfigurationReference = 5514946EFAE3635A0EDC2A3B /* Pods.release.xcconfig */;
- buildSettings = {
- ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
- HEADER_SEARCH_PATHS = (
- "$(inherited)",
- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
- "$(SRCROOT)/../node_modules/react-native/React/**",
- );
- INFOPLIST_FILE = Sample/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
- OTHER_LDFLAGS = (
- "$(inherited)",
- "-ObjC",
- );
- PRODUCT_NAME = Sample;
- };
- name = Release;
- };
83CBBA201A601CBA00E9B192 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -800,7 +720,7 @@
};
name = Debug;
};
- 83CBBA211A601CBA00E9B192 /* Release */ = {
+ D36DCDA31BD4A96300B3EB2F /* Staging */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
@@ -838,37 +758,48 @@
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
- name = Release;
+ name = Staging;
+ };
+ D36DCDA41BD4A96300B3EB2F /* Staging */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = D36DCD9F1BD4A92600B3EB2F /* Staging.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ HEADER_SEARCH_PATHS = (
+ "$(inherited)",
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
+ "$(SRCROOT)/../node_modules/react-native/React/**",
+ );
+ INFOPLIST_FILE = Sample/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ OTHER_LDFLAGS = (
+ "$(inherited)",
+ "-ObjC",
+ );
+ PRODUCT_NAME = Sample;
+ };
+ name = Staging;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
- 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "SampleTests" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 00E356F61AD99517003FC87E /* Debug */,
- 00E356F71AD99517003FC87E /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Sample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
13B07F941A680F5B00A75B9A /* Debug */,
- 13B07F951A680F5B00A75B9A /* Release */,
+ D36DCDA41BD4A96300B3EB2F /* Staging */,
);
defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
+ defaultConfigurationName = Debug;
};
83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Sample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
83CBBA201A601CBA00E9B192 /* Debug */,
- 83CBBA211A601CBA00E9B192 /* Release */,
+ D36DCDA31BD4A96300B3EB2F /* Staging */,
);
defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
+ defaultConfigurationName = Debug;
};
/* End XCConfigurationList section */
};
diff --git a/ios/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme b/ios/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme
index cf9555bf..04558566 100644
--- a/ios/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme
+++ b/ios/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme
@@ -37,10 +37,10 @@
+ shouldUseLaunchSchemeArgsEnv = "YES">
@@ -62,15 +62,18 @@
ReferencedContainer = "container:Sample.xcodeproj">
+
+
@@ -86,10 +89,10 @@
diff --git a/ios/Sample/AppDelegate.m b/ios/Sample/AppDelegate.m
index 74719f5f..2d2aa425 100644
--- a/ios/Sample/AppDelegate.m
+++ b/ios/Sample/AppDelegate.m
@@ -30,8 +30,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
* `inet` value under `en0:`) and make sure your computer and iOS device are
* on the same Wi-Fi network.
*/
-
- jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"];
+
+// jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios"];
/**
* OPTION 2
@@ -45,11 +45,22 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
+
+#ifdef TEST_ENVIRONMENT
+ jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios"];
+#else
+ #if TARGET_IPHONE_SIMULATOR
+ jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios"];
+ #else
+ jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
+ #endif
+#endif
+
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"Sample"
initialProperties:nil
launchOptions:launchOptions];
-
+
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [[UIViewController alloc] init];
rootViewController.view = rootView;
diff --git a/ios/Sample/EnvironmentManager.m b/ios/Sample/EnvironmentManager.m
index 37e64d6e..3a2d7770 100644
--- a/ios/Sample/EnvironmentManager.m
+++ b/ios/Sample/EnvironmentManager.m
@@ -16,8 +16,14 @@ @implementation EnvironmentManager
RCT_EXPORT_METHOD(get:(RCTResponseSenderBlock)callback)
{
- //TODO: NSString * envName = kEnvironment;
- NSString * envName = @"debug";
+ NSString *locale = [[NSLocale currentLocale] localeIdentifier];
+ locale = [locale stringByReplacingOccurrencesOfString:@"_" withString:@"-"];
+
+ NSNumber * simulator = @NO;
+ NSString * version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
+ NSString * buildCode = [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];
+
+ NSString * envName = kEnvironment;
NSDictionary *passed = [[NSProcessInfo processInfo] environment];
NSString *override = [passed valueForKey:@"SAMPLE_ENV"];
if (override) {
@@ -26,7 +32,22 @@ @implementation EnvironmentManager
#ifdef TEST_ENVIRONMENT
envName = @"test";
#endif
- callback(@[envName]);
+#ifdef STAGING_ENVIRONMENT
+ envName = @"staging";
+#endif
+
+
+#if TARGET_IPHONE_SIMULATOR
+ simulator = @YES;
+#endif
+
+ callback(@[ @{
+ @"name": envName,
+ @"buildCode": buildCode,
+ @"simulator": simulator,
+ @"version": version,
+ @"locale": locale
+ }]);
}
@end
diff --git a/ios/Staging.xcconfig b/ios/Staging.xcconfig
new file mode 100644
index 00000000..da24e2f6
--- /dev/null
+++ b/ios/Staging.xcconfig
@@ -0,0 +1,3 @@
+#include "Pods/Target Support Files/Pods/Pods.staging.xcconfig"
+
+GCC_PREPROCESSOR_DEFINITIONS = $(inherited) kEnvironment="@\"staging\""
\ No newline at end of file
diff --git a/package.json b/package.json
index 28776bab..a8eea8e8 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,10 @@
"version": "0.0.1",
"private": true,
"scripts": {
- "start": "node_modules/react-native/packager/packager.sh"
+ "start": "node_modules/react-native/packager/packager.sh",
+ "compile:test": "TARGET=test node tasks/compile.js",
+ "compile:staging": "TARGET=staging node tasks/compile.js",
+ "install:staging": "PHONE=true TARGET=staging node tasks/compile.js"
},
"dependencies": {
"events": "^1.0.2",
@@ -11,11 +14,14 @@
"invariant": "^2.1.0",
"keymirror": "^0.1.1",
"object-assign": "^4.0.1",
- "react-native": "^0.11.0",
+ "react-native": "^0.12.0",
"react-native-keyboardevents": "^0.4.5",
"react-native-keychain": "^0.2.5",
"react-native-refreshable-listview": "^1.3.0",
"react-timer-mixin": "^0.13.3",
"superagent": "^1.4.0"
+ },
+ "devDependencies": {
+ "ios-deploy": "^1.7.0"
}
}
diff --git a/tasks/compile.js b/tasks/compile.js
new file mode 100644
index 00000000..4cc5d1ea
--- /dev/null
+++ b/tasks/compile.js
@@ -0,0 +1,11 @@
+var Compiler = require("./compiler");
+
+var compiler = new Compiler('ios', process.env.TARGET, console);
+compiler.cleanDirectory();
+compiler.build();
+compiler.zip();
+
+if (process.env.PHONE) {
+ compiler.phoneInstall();
+}
+
diff --git a/tasks/compiler.js b/tasks/compiler.js
new file mode 100644
index 00000000..39c313df
--- /dev/null
+++ b/tasks/compiler.js
@@ -0,0 +1,138 @@
+var child_process = require("child_process");
+var path = require("path")
+
+var Compiler = function(platform, environment, console) {
+ this.platform = platform;
+ this.environment = environment;
+ this.console = console;
+
+ this.calculateDirectories();
+};
+
+Compiler.prototype.log = function(toLog) {
+ //this.console.log.writeln(toLog);
+ this.console.log(toLog);
+};
+
+Compiler.prototype.run = function(toRun) {
+ this.log('------------------')
+ this.log(toRun);
+ this.log('->')
+ var out = child_process.execSync(toRun);
+ this.log('' + out);
+ this.log('------------------')
+ return out;
+};
+
+Compiler.prototype.calculateDirectories = function() {
+ this.rootDirectory = process.cwd();
+ this.platformDirectory = this.rootDirectory + '/' + this.platform;
+ this.appDirectory = this.rootDirectory + '/testbuild/' + this.environment + '_' + this.platform;
+ this.buildDirectory = this.appDirectory + '/build';
+
+ switch(this.environment) {
+ case 'test':
+ this.configuration = "Debug";
+ this.iosSdk = "iphonesimulator";
+ break;
+ case 'staging':
+ this.configuration = "Staging";
+ this.iosSdk = "iphoneos";
+ break;
+ default:
+ throw("UNKNOWN ENVIRONMENT: " + this.environment);
+ }
+
+ this.compiledApp = this.buildDirectory;
+
+ if (this.platform === 'android') {
+ // TODO
+ }
+ else {
+ this.compiledApp += '/' + this.configuration + '-' + this.iosSdk + '/Sample.app';
+ }
+
+ this.zippedApp = this.appDirectory;
+ if (this.platform === 'android') {
+ this.zippedApp += '/sample_android.apk';
+ }
+ else {
+ this.zippedApp += '/sample_ios.zip';
+ }
+};
+
+Compiler.prototype.cleanDirectory = function() {
+ this.log('cleaning: ' + this.appDirectory);
+ this.run('rm -rf ' + this.appDirectory);
+};
+
+Compiler.prototype.buildJavascript = function() {
+ var pwd = this.rootDirectory;
+ var to_run = 'cd ' + pwd;
+ to_run += " && react-native bundle --minify"
+ this.run(to_run);
+};
+
+Compiler.prototype.buildIos = function() {
+ var env, scheme, config, sdk;
+ switch(this.environment) {
+ case 'test':
+ env = "TEST_ENVIRONMENT=1";
+ scheme = "Sample Test";
+ break;
+ case 'staging':
+ env = "STAGING_ENVIRONMENT=1";
+ scheme = "Sample Staging";
+ break;
+ default:
+ throw("UNKNOWN ENVIRONMENT: " + this.environment);
+ }
+
+ var to_run = 'xcodebuild';
+ to_run += " GCC_PREPROCESSOR_DEFINITIONS='$GCC_PREPROCESSOR_DEFINITIONS " + env + "'"
+ to_run += " -workspace " + this.platformDirectory + "/Sample.xcworkspace";
+ to_run += " -scheme \"" + scheme + "\"";
+ to_run += " -sdk " + this.iosSdk;
+ to_run += " -configuration " + this.configuration;
+ to_run += " OBJROOT=" + this.buildDirectory;
+ to_run += " SYMROOT=" + this.buildDirectory;
+ to_run += " ONLY_ACTIVE_ARCH=NO";
+ to_run += " | xcpretty -c && exit ${PIPESTATUS[0]}";
+ this.run(to_run)
+};
+
+Compiler.prototype.build = function() {
+ this.run('mkdir -p ' + this.buildDirectory);
+
+ if (this.environment !== 'test') {
+ this.buildJavascript();
+ }
+ this.buildIos();
+};
+
+Compiler.prototype.zipIos = function() {
+ var parent_dir = path.dirname(this.compiledApp);
+ var pwd = this.rootDirectory;
+ var to_run = "cd " + parent_dir;
+ to_run += " && zip -r " + this.zippedApp + " " + this.compiledApp;
+ to_run += " && cd " + pwd;
+ this.run(to_run);
+};
+
+Compiler.prototype.zip = function() {
+ this.zipIos();
+};
+
+Compiler.prototype.phoneInstall = function() {
+ // ios-deploy testbuild/staging_ios/build/Staging-iphoneos/Sample.app
+ var to_run = "ios-deploy";
+ //to_run += " --justlaunch";
+ //to_run += " --debug";
+ to_run += " --bundle \"" + this.compiledApp + "\"";
+
+ this.run(to_run);
+};
+
+// TODO: copySauce
+
+module.exports = Compiler;