-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ios.js
63 lines (49 loc) · 1.76 KB
/
index.ios.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import React, { Component } from 'react';
import { AppRegistry, Alert } from 'react-native';
import { Provider } from 'react-redux';
import createSagaMiddleware from 'redux-saga';
import { createStore, applyMiddleware } from 'redux';
import mainSaga from './app/sagas/sagas';
import appReducers from './app/reducers';
import AuthenticateContainer from './app/containers/AuthenticateContainer';
// import PushNotificationService from './app/lib/PushNotifications';
/**
* Saga middleware
*/
/**
* Application store
*/
const sagaMiddleware = createSagaMiddleware();
const store = createStore(appReducers, applyMiddleware(sagaMiddleware));
// Run saga
sagaMiddleware.run(mainSaga);
export default class App extends Component {
constructor(props) {
super(props);
if (props.isEmbedded === true) {
console.disableYellowBox = true
}
store.dispatch({ type: 'IS_EMBEDDED_APP', isEmbedded: props.isEmbedded});
}
componentWillMount() {
// Dispatching directly to store (not via action creators) since we have no
// action creators set up at this stage. Corresponding action is: setAppVersion()
// TODO: need to fix this after logout->login as well.
store.dispatch({ type: 'SET_APP_VERSION_REQUESTED', version: this.props.version });
}
onPushNotificationRegister(token) {
store.dispatch({ type: 'SET_APNS_TOKEN_REQUESTED', registerToken: token.token,});
// this.setState({ registerToken: token.token, gcmRegistered: true });
}
onPushNotification(notif) {
store.dispatch({ type: 'SET_NOTIFICATION_RECEIVED_REQUESTED', notificationData: notif.data});
}
render() {
return (
<Provider store={store}>
<AuthenticateContainer />
</Provider>
);
}
}
AppRegistry.registerComponent('App', () => App);