Skip to content

Build #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ Pods
#
node_modules/
npm-debug.log

/testbuild
4 changes: 3 additions & 1 deletion App/Mixins/AuthHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -111,7 +113,7 @@ var AuthHelper = {
<View style={styles.bottom}>
{this.renderPassword()}
<View style={styles.flex} />
<Text style={[styles.bottomText, styles.version]}>TODO: v1</Text>
<Text style={[styles.bottomText, styles.version]}>Version {EnvironmentStore.get().displayVersion()}</Text>
</View>
</View>
)
Expand Down
25 changes: 24 additions & 1 deletion App/Models/Environment.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var assign = require('../Lib/assignDefined');
var jsVersion = require('../jsVersion');

var Model = function(options) {
this.data = {};
Expand All @@ -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
});
};

Expand All @@ -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;
17 changes: 15 additions & 2 deletions App/Screens/Settings.js
Original file line number Diff line number Diff line change
@@ -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({
Expand All @@ -28,6 +33,9 @@ var Settings = React.createClass({
return (
<View style={styles.container}>
<SimpleList currentRoute={this.props.currentRoute} items={this.state.items} />
<View style={styles.bottom}>
<Text style={styles.bottomText}>Version {EnvironmentStore.get().displayVersion()}</Text>
</View>
</View>
)
}
Expand All @@ -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;
6 changes: 3 additions & 3 deletions App/Stores/EnvironmentStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions App/jsVersion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 2;
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions ios/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "Pods/Target Support Files/Pods/Pods.debug.xcconfig"

GCC_PREPROCESSOR_DEFINITIONS = $(inherited) kEnvironment="@\"debug\""
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ DEPENDENCIES:
SPEC CHECKSUMS:
SimulatorRemoteNotifications: 1610643e0582b2af67bc254b071ace4077e8ef86

COCOAPODS: 0.38.2
COCOAPODS: 0.39.0
Loading