Commit e54682f

mo khan <mo@mokhan.ca>
2016-12-22 18:55:49
remove dead code.
1 parent 8db8cbe
app/actions/actionTypes.js
@@ -1,4 +0,0 @@
-export const INCREMENT = 'INCREMENT';
-export const DECREMENT = 'DECREMENT';
-export const RECEIVED_MOVIES = 'RECEIVED_MOVIES';
-export const LOGGED_IN = 'LOGGED_IN';
app/actions/counterActions.js
@@ -1,9 +0,0 @@
-import * as types from './actionTypes';
-
-export function increment() {
-  return { type: types.INCREMENT };
-}
-
-export function decrement() {
-  return { type: types.DECREMENT };
-}
app/actions/movieActions.js
@@ -1,17 +0,0 @@
-import * as types from './actionTypes';
-import Api from '../infrastructure/api';
-
-export function fetchMovies() {
-  return dispatch => {
-    var url = 'https://facebook.github.io/react-native/movies.json'
-    new Api(url).get((json) => dispatch(receiveMovies(json)));
-  };
-}
-
-export function receiveMovies(json) {
-  return {
-    type: types.RECEIVED_MOVIES,
-    movies: json.movies.map((item) => item.title),
-    receivedAt: Date.now()
-  }
-}
app/actions/strongActions.js
@@ -1,22 +0,0 @@
-import * as types from './actionTypes';
-import Api from '../infrastructure/api';
-
-export function login(username, password) {
-  return dispatch => {
-    console.log(`dispatching login: ${username} ${password}`)
-    let body = { username: username, password: password };
-    new Api('/sessions').post(body, (json) => {
-      dispatch(logged_in(username, json))
-    });
-  };
-}
-
-export function logged_in(username, json) {
-  console.log('LOGGED_IN');
-  console.dir(json);
-  return {
-    type: types.LOGGED_IN,
-    username: username,
-    authentication_token: json.authentication_token,
-  }
-}
app/components/counter.js
@@ -1,23 +0,0 @@
-import React, { Component } from 'react';
-import { View, Text, TouchableOpacity } from 'react-native';
-
-export default class Counter extends Component {
-  render() {
-    const { counter, increment, decrement, fetchMovies } = this.props;
-    let moviesCount = this.props.movies.movies.length;
-    return (
-      <View style={{flex: 1, alignItems: 'center', justifyContent: 'center' }}>
-        <Text>{counter}</Text>
-        <TouchableOpacity onPress={increment}>
-          <Text>up</Text>
-        </TouchableOpacity>
-        <TouchableOpacity onPress={decrement}>
-          <Text>down</Text>
-        </TouchableOpacity>
-        <TouchableOpacity onPress={fetchMovies}>
-          <Text>Async {moviesCount}</Text>
-        </TouchableOpacity>
-      </View>
-    );
-  }
-}
app/components/movie.js
@@ -1,10 +0,0 @@
-import React, { Component } from 'react';
-import { View, Text } from 'react-native';
-
-export default class Movie extends Component {
-  render() {
-    return (
-      <Text style={{flex: 1}}>{this.props.name}</Text>
-    )
-  }
-}
app/components/movies.js
@@ -1,54 +0,0 @@
-import React, { Component } from 'react';
-import { AppRegistry, Text, ListView, View, Image, TextInput, TouchableHighlight } from 'react-native';
-import Api from '../infrastructure/api'
-import Movie from './movie'
-
-export default class Movies extends Component {
-  constructor(props) {
-    super(props)
-    this.ds = new ListView.DataSource({ rowHasChanged: (row, other) => row['title'] != other['title'] });
-    this.state = {
-      dataSource: this.mapAll([]),
-      showText: true,
-      text: 'WAT?',
-    };
-  }
-
-  componentDidMount() {
-    var that = this;
-    var url = 'https://facebook.github.io/react-native/movies.json'
-    new Api(url).get((json) => {
-      that.setState({ dataSource: that.mapAll(json.movies) });
-    });
-    //setInterval(() => {
-      //that.setState({ showText: !that.state.showText });
-    //}, 1000);
-  }
-
-  render() {
-    let pic = { uri: 'https://upload.wikimedia.org/wikipedia/commons/d/de/Bananavarieties.jpg' };
-    let display = this.state.showText ? this.props.text : ' ';
-
-    return (
-      <View style={{flex: 1, alignItems: 'center'}}>
-        <Image source={pic} style={{width: 193, height: 110}} />
-        <Text>{display}</Text>
-        <TouchableHighlight onPress={this.onBack.bind(this)}>
-          <Text>Back</Text>
-        </TouchableHighlight>
-        <ListView
-          dataSource={this.state.dataSource}
-          renderRow={(row) => <Movie name={row} />}
-          />
-      </View>
-    );
-  }
-
-  mapAll(movies) {
-    return this.ds.cloneWithRows(movies.map((item) => item.title));
-  }
-
-  onBack() {
-    this.props.navigator.pop();
-  }
-}
app/containers/app.js
@@ -1,21 +0,0 @@
-import React, { Component } from 'react';
-import { createStore, applyMiddleware, combineReducers } from 'redux';
-import { Provider } from 'react-redux';
-import thunk from 'redux-thunk';
-import * as reducers from '../reducers';
-import AwesomeApp from './awesome-app'
-import logger from 'redux-logger';
-
-const createStoreWithMiddleware = applyMiddleware(thunk, logger())(createStore);
-const reducer = combineReducers(reducers);
-const store = createStoreWithMiddleware(reducer);
-
-export default class App extends Component {
-  render() {
-    return (
-      <Provider store={store}>
-        <AwesomeApp />
-      </Provider>
-    );
-  }
-}
app/containers/awesome-app.js
@@ -1,31 +0,0 @@
-import React, { Component } from 'react';
-import { View } from 'react-native';
-import { bindActionCreators } from 'redux';
-import Counter from '../components/counter';
-import * as counterActions from '../actions/counterActions';
-import * as movieActions from '../actions/movieActions';
-import * as strongActions from '../actions/strongActions';
-import { connect } from 'react-redux';
-import LoginScreen from '../screens/login-screen'
-
-class AwesomeApp extends Component {
-  render(){
-    const { state, actions } = this.props;
-    return (
-      <View>
-        <Counter counter={state.counter.count} movies={state.movies} {...actions} {...this.props.movieActions} />
-        <LoginScreen {...this.props.strongActions}/>
-      </View>
-    );
-  }
-}
-
-export default connect(state => ({
-    state: state
-  }),
-  (dispatch) => ({
-    actions: bindActionCreators(counterActions, dispatch),
-    movieActions: bindActionCreators(movieActions, dispatch),
-    strongActions: bindActionCreators(strongActions, dispatch),
-  })
-)(AwesomeApp);
app/reducers/__tests__/counter_spec.js
@@ -1,15 +0,0 @@
-import counter from '../counter';
-
-describe('counter', () => {
-  let subject = counter;
-
-  it('increments the counter', () => {
-    result = subject(undefined, {type: 'INCREMENT'})
-    expect(result.count).toBe(1);
-  });
-
-  it("decrements the counter", () => {
-    result = subject(undefined, {type: 'DECREMENT'})
-    expect(result.count).toBe(-1);
-  });
-});
app/reducers/__tests__/stronglifters_spec.js
@@ -1,25 +0,0 @@
-import stronglifters from '../stronglifters';
-
-describe('stronglifters', () => {
-  let subject = stronglifters;
-
-  describe("LOGGED_IN", () => {
-    let username = 'mokha';
-    let authentication_token = 'token';
-    let result = null;
-
-    beforeEach(() => {
-      event = { type: 'LOGGED_IN', username, authentication_token };
-      result = subject(undefined, event);
-    });
-
-    it("returns the username", () => {
-      expect(result.authentication_token).toEqual(authentication_token)
-    });
-
-
-    it ("returns the authentication token", function() {
-      expect(result.username).toEqual(username)
-    });
-  });
-});
app/reducers/counter.js
@@ -1,22 +0,0 @@
-import * as types from '../actions/actionTypes';
-
-const initialState = {
-  count: 0
-};
-
-export default function counter(state = initialState, action = {}) {
-  switch(action.type) {
-    case types.INCREMENT:
-      return {
-        ...state,
-        count: state.count + 1
-      };
-    case types.DECREMENT:
-      return {
-        ...state,
-        count: state.count - 1
-      };
-    default:
-      return state;
-  }
-}
app/reducers/index.js
@@ -1,9 +0,0 @@
-import counter from './counter'
-import movies from './movies'
-import stronglifters from './stronglifters'
-
-export {
-  counter,
-  movies,
-  stronglifters
-};
app/reducers/movies.js
@@ -1,17 +0,0 @@
-import * as types from '../actions/actionTypes';
-
-const initialState = {
-  movies: []
-};
-
-export default function movies(state = initialState, action = {}) {
-  switch(action.type) {
-    case types.RECEIVED_MOVIES:
-      return {
-        ...state,
-        movies: action.movies,
-      };
-    default:
-      return state;
-  }
-}
app/reducers/stronglifters.js
@@ -1,19 +0,0 @@
-import * as types from '../actions/actionTypes';
-
-const initialState = {
-  username: '',
-  authentication_token: '',
-};
-
-export default function stronglifters(state = initialState, action = {}) {
-  switch(action.type) {
-    case types.LOGGED_IN:
-      return {
-        ...state,
-        username: action.username,
-        authentication_token: action.authentication_token,
-      };
-    default:
-      return state;
-  }
-}
index.android.js
@@ -1,7 +1,5 @@
 import React, { Component } from 'react';
-import { AppRegistry } from 'react-native';
-import App from './app/containers/app'
+import { AppRegistry, StyleSheet } from 'react-native';
 import ApplicationShell from './app/components/application-shell'
 
 AppRegistry.registerComponent('AwesomeProject', () => ApplicationShell);
-//AppRegistry.registerComponent('AwesomeProject', () => App);
movies.json
@@ -1,11 +0,0 @@
-{
-  "title": "The Basics - Networking",
-  "description": "Your app fetched this from a remote endpoint!",
-  "movies": [
-    { "title": "Star Wars", "releaseYear": "1977"},
-    { "title": "Back to the Future", "releaseYear": "1985"},
-    { "title": "The Matrix", "releaseYear": "1999"},
-    { "title": "Inception", "releaseYear": "2010"},
-    { "title": "Interstellar", "releaseYear": "2014"}
-  ]
-}