Skip to content

Commit 2cf43f3

Browse files
committed
Merge pull request #5 from taskrabbit/build
Build
2 parents 85932b6 + 8a1c9b2 commit 2cf43f3

File tree

17 files changed

+334
-160
lines changed

17 files changed

+334
-160
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@ Pods
2727
#
2828
node_modules/
2929
npm-debug.log
30+
31+
/testbuild

App/Mixins/AuthHelper.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ var Text = require('../Components/Text');
1313
var Button = require('../Components/Button');
1414
var TextInput = require('../Components/TextInput');
1515

16+
var EnvironmentStore = require('../Stores/EnvironmentStore');
17+
1618
var AuthHelper = {
1719

1820
// parent implements: onAuthButton, getDefaultProps
@@ -111,7 +113,7 @@ var AuthHelper = {
111113
<View style={styles.bottom}>
112114
{this.renderPassword()}
113115
<View style={styles.flex} />
114-
<Text style={[styles.bottomText, styles.version]}>TODO: v1</Text>
116+
<Text style={[styles.bottomText, styles.version]}>Version {EnvironmentStore.get().displayVersion()}</Text>
115117
</View>
116118
</View>
117119
)

App/Models/Environment.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
var assign = require('../Lib/assignDefined');
2+
var jsVersion = require('../jsVersion');
23

34
var Model = function(options) {
45
this.data = {};
@@ -8,7 +9,11 @@ var Model = function(options) {
89
Model.prototype.setAttributes = function(options) {
910
options = (options || {});
1011
assign(this.data, {
11-
name: options.name
12+
name: options.name,
13+
simulator: options.simulator,
14+
buildCode: parseInt(options.buildCode),
15+
version: options.version,
16+
locale: options.locale
1217
});
1318
};
1419

@@ -18,9 +23,27 @@ Model.prototype.getApiHost = function() {
1823
return 'http://localhost:3001';
1924
case 'debug':
2025
return 'http://localhost:3000';
26+
case 'staging':
27+
return 'https://someday.herokuapp.com';
2128
default:
2229
throw("Unknown Environment.getApiHost: " + this.data.name);
2330
}
2431
};
2532

33+
Model.prototype.combinedBuildCode = function() {
34+
var ios = this.data.buildCode * 1000000;
35+
return ios + jsVersion;
36+
};
37+
38+
Model.prototype.displayVersion = function() {
39+
var out = this.data.version;
40+
out += "." + this.data.buildCode;
41+
out += "." + jsVersion;
42+
return out;
43+
};
44+
45+
Model.prototype.getLocale = function() {
46+
return this.data.locale;
47+
};
48+
2649
module.exports = Model;

App/Screens/Settings.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
var React = require('react-native');
22
var {
33
View,
4-
StyleSheet
4+
StyleSheet,
5+
Text
56
} = React;
67

8+
var cssVar = require('../Lib/cssVar');
9+
710
var SimpleList = require('../Components/SimpleList');
811
var AppConstants = require('../Constants/AppConstants');
912

13+
var EnvironmentStore = require('../Stores/EnvironmentStore');
14+
1015
function getListState() {
1116
var list = [];
1217
list.push({
@@ -28,6 +33,9 @@ var Settings = React.createClass({
2833
return (
2934
<View style={styles.container}>
3035
<SimpleList currentRoute={this.props.currentRoute} items={this.state.items} />
36+
<View style={styles.bottom}>
37+
<Text style={styles.bottomText}>Version {EnvironmentStore.get().displayVersion()}</Text>
38+
</View>
3139
</View>
3240
)
3341
}
@@ -36,7 +44,12 @@ var Settings = React.createClass({
3644
var styles = StyleSheet.create({
3745
container: {
3846
flex: 1
39-
}
47+
},
48+
bottomText: {
49+
padding: 10,
50+
color: cssVar('gray20'),
51+
fontSize: 12
52+
},
4053
});
4154

4255
module.exports = Settings;

App/Stores/EnvironmentStore.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ var SingletonStore = assign({}, EventEmitter.prototype, {
3838
Dispatcher.register(function(action) {
3939
switch(action.actionType) {
4040
case AppConstants.APP_LAUNCHED:
41-
EnvironmentManager.get(function(name) {
42-
console.log("Environment: " + name);
43-
setSingleton({name: name});
41+
EnvironmentManager.get(function(attributes) {
42+
console.log("Environment: " + attributes.name);
43+
setSingleton(attributes);
4444
SingletonStore.emitChange();
4545
});
4646
break;

App/jsVersion.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = 2;

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,23 @@ In the `ios` directory
1414
* Install Pods: `pod install`
1515
* Launch: `open Sample.xcworkspace`
1616

17-
#### Server
17+
### Server
1818

1919
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.
2020

2121
In the `server` directory
2222

23-
* Install nvm and iojs-v2.4.0
23+
* Install nvm and node-4.0.0
2424
* Run it: `npm start`
2525

2626
It has sample data in the `models.js` file. For example, there is a user bleonard (password: "sample") that you can log in as.
2727

28+
### Compiling
29+
30+
You can compile and put it on the phone with: `npm run install:staging`
31+
32+
Not that there's a staging server at this point, but it's an example of how to compile things via the command line.
33+
2834
### Android
2935

3036
We'll get there, but we're still working on the iOS version.

ios/Debug.xcconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#include "Pods/Target Support Files/Pods/Pods.debug.xcconfig"
2+
3+
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) kEnvironment="@\"debug\""

ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ DEPENDENCIES:
77
SPEC CHECKSUMS:
88
SimulatorRemoteNotifications: 1610643e0582b2af67bc254b071ace4077e8ef86
99

10-
COCOAPODS: 0.38.2
10+
COCOAPODS: 0.39.0

0 commit comments

Comments
 (0)