Skip to content

Commit

Permalink
Upgrade everything
Browse files Browse the repository at this point in the history
  • Loading branch information
cheeaun committed Jan 31, 2016
1 parent 78ed9f1 commit 288c666
Show file tree
Hide file tree
Showing 10 changed files with 6,772 additions and 6,488 deletions.
39 changes: 29 additions & 10 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,26 @@
# Some modules have their own node_modules with overlap
.*/node_modules/node-haste/.*

# Ignore react-tools where there are overlaps, but don't ignore anything that
# react-native relies on
.*/node_modules/react-tools/src/React.js
.*/node_modules/react-tools/src/renderers/shared/event/EventPropagators.js
.*/node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderEventPlugin.js
.*/node_modules/react-tools/src/shared/vendor/core/ExecutionEnvironment.js
# Ugh
.*/node_modules/babel.*
.*/node_modules/babylon.*
.*/node_modules/invariant.*

# Ignore react and fbjs where there are overlaps, but don't ignore
# anything that react-native relies on
.*/node_modules/fbjs/lib/Map.js
.*/node_modules/fbjs/lib/Promise.js
.*/node_modules/fbjs/lib/fetch.js
.*/node_modules/fbjs/lib/ExecutionEnvironment.js
.*/node_modules/fbjs/lib/isEmpty.js
.*/node_modules/fbjs/lib/crc32.js
.*/node_modules/fbjs/lib/ErrorUtils.js

# Flow has a built-in definition for the 'react' module which we prefer to use
# over the currently-untyped source
.*/node_modules/react/react.js
.*/node_modules/react/lib/React.js
.*/node_modules/react/lib/ReactDOM.js

# Ignore commoner tests
.*/node_modules/commoner/test/.*
Expand All @@ -22,7 +35,10 @@
.*/react-tools/node_modules/commoner/lib/reader.js

# Ignore jest
.*/react-native/node_modules/jest-cli/.*
.*/node_modules/jest-cli/.*

# Ignore Website
.*/website/.*

[include]

Expand All @@ -34,13 +50,16 @@ module.system=haste

munge_underscores=true

module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
module.name_mapper='^[./a-zA-Z0-9$_-]+\.png$' -> 'RelativeImageStub'

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(1[0-4]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(1[0-4]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-0]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-0]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy

[version]
0.14.0
0.20.1
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ DerivedData
*.xcuserstate
project.xcworkspace

# Android/IJ
#
.idea
.gradle
local.properties

# node.js
#
node_modules/
Expand Down
1 change: 1 addition & 0 deletions .watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Some `npm` modules don't work with React Native so I have to compile them into a
2. `git clone https://github.com/fb55/htmlparser2`
3. `cd htmlparser2`
4. `npm install`
5. `browserify lib/index.js --standalone htmlparser2 > htmlparser2.js`
5. `browserify lib/index.js --standalone htmlparser2 | derequire > htmlparser2.js`
6. Move the generated `htmlparser2.js` file to the `vendor` folder in this repo

### Running on device (iOS)
Expand Down
36 changes: 20 additions & 16 deletions actions/LinkActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,28 @@ var alt = require('../alt');
var CacheStore = require('../components/CacheStore');

class LinkActions {
getLinks(){
var self = this;
CacheStore.get('links').then(function(links){
links = links || [];
self.dispatch(links);
});
getLinks() {
return function(dispatch) {
var self = this;
CacheStore.get('links').then(function(links){
links = links || [];
dispatch(links);
});
};
}

addLink(link){
var self = this;
CacheStore.get('links').then(function(links){
links = links || [];
if (!links.includes(link)){
self.dispatch(link);
links.push(link);
CacheStore.set('links', links.slice(0, 100));
}
});
addLink(link) {
return function(dispatch) {
var self = this;
CacheStore.get('links').then(function(links){
links = links || [];
if (!links.includes(link)){
dispatch(link);
links.push(link);
CacheStore.set('links', links.slice(0, 100));
}
});
};
}
}

Expand Down
106 changes: 55 additions & 51 deletions actions/StoryActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,77 +14,81 @@ var fetchTimeout = function(){

class StoryActions {
updateStories(stories){
this.dispatch(stories);
return stories;
}

fetchStories(){
this.dispatch();
fetchStories() {
var self = this;
var request = function(){
Promise.race([
fetch(API_HOST + 'news'),
fetchTimeout()
])
.then(function(response){
return response.json();
})
.then(function(stories){
if (!stories || !stories.length) throw new Error('Stories payload is empty');
self.actions.updateStories(stories);
CacheStore.set('stories', stories, 10); // 10 minutes
})
.catch(self.actions.storiesFailed);
return function(dispatch) {
dispatch();
var request = function(){
Promise.race([
fetch(API_HOST + 'news'),
fetchTimeout()
])
.then(function(response){
return response.json();
})
.then(function(stories){
if (!stories || !stories.length) throw new Error('Stories payload is empty');
self.updateStories(stories);
CacheStore.set('stories', stories, 10); // 10 minutes
})
.catch(self.storiesFailed);
};
CacheStore.get('stories').then(function(stories){
if (stories){
self.updateStories(stories);
} else {
request();
}
}).catch(request);
};
CacheStore.get('stories').then(function(stories){
if (stories){
self.actions.updateStories(stories);
} else {
request();
}
}).catch(request);
}

fetchStoriesIfExpired(){
CacheStore.isExpired('stories').then(this.actions.fetchStories);
CacheStore.isExpired('stories').then(this.fetchStories);
}

storiesFailed(error){
this.dispatch(error);
return error;
}

updateStory(story){
this.dispatch(story);
return story;
}

fetchStory(id){
this.dispatch(id);
fetchStory(id) {
var self = this;
var request = function(){
Promise.race([
fetch(API_HOST + 'item/' + id),
fetchTimeout()
])
.then(function(response){
return response.json();
})
.then(function(story){
if (!story) throw new Error('Story payload is empty');
self.actions.updateStory(story);
CacheStore.set('story' + id, story, 5); // 5 minutes
})
.catch(self.actions.storyFailed);
return function(dispatch) {
dispatch(id);
var request = function(){
Promise.race([
fetch(API_HOST + 'item/' + id),
fetchTimeout()
])
.then(function(response){
return response.json();
})
.then(function(story){
if (!story) throw new Error('Story payload is empty');
self.updateStory(story);
CacheStore.set('story' + id, story, 5); // 5 minutes
})
.catch(self.storyFailed);
};
CacheStore.get('story-' + id).then(function(story){
if (story){
self.updateStory(story);
} else {
request();
}
}, request);
};
CacheStore.get('story-' + id).then(function(story){
if (story){
self.actions.updateStory(story);
} else {
request();
}
}, request);
}

storyFailed(error){
this.dispatch(error);
return error;
}
}

Expand Down
2 changes: 1 addition & 1 deletion iOS/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
* 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
Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
"start": "node_modules/react-native/packager/packager.sh"
},
"dependencies": {
"alt": "~0.17.3",
"react-native": "~0.11.4",
"react-native-activity-view": "~0.2.6",
"react-native-app-info": "0.0.6",
"react-native-safari-view": "~0.1.2"
"alt": "~0.18.2",
"firebase": "~2.4.0",
"react-native": "~0.19.0",
"react-native-activity-view": "~0.2.8",
"react-native-app-info": "~0.0.6",
"react-native-safari-view": "~0.3.0",
"reactfire": "~0.5.1"
}
}
Loading

0 comments on commit 288c666

Please sign in to comment.