Skip to content

Commit

Permalink
POC
Browse files Browse the repository at this point in the history
  • Loading branch information
tesliker committed Dec 6, 2018
1 parent 85e22b9 commit be26a9f
Show file tree
Hide file tree
Showing 25 changed files with 10,622 additions and 411 deletions.
537 changes: 292 additions & 245 deletions .idea/workspace.xml

Large diffs are not rendered by default.

27 changes: 18 additions & 9 deletions App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import React from 'react';
import { Platform, StatusBar, StyleSheet, View } from 'react-native';
import { AppLoading, Asset, Font, Icon } from 'expo';
import AppNavigator from './navigation/AppNavigator';
import { Provider } from 'react-redux';

import configureStore from './store';

const store = configureStore()

export default class App extends React.Component {
state = {
Expand All @@ -11,18 +16,22 @@ export default class App extends React.Component {
render() {
if (!this.state.isLoadingComplete && !this.props.skipLoadingScreen) {
return (
<AppLoading
startAsync={this._loadResourcesAsync}
onError={this._handleLoadingError}
onFinish={this._handleFinishLoading}
/>
<Provider store={store}>
<AppLoading
startAsync={this._loadResourcesAsync}
onError={this._handleLoadingError}
onFinish={this._handleFinishLoading}
/>
</Provider>
);
} else {
return (
<View style={styles.container}>
{Platform.OS === 'ios' && <StatusBar barStyle="default" />}
<AppNavigator />
</View>
<Provider store={store}>
<View style={styles.container}>
{Platform.OS === 'ios' && <StatusBar barStyle="default" />}
<AppNavigator />
</View>
</Provider>
);
}
}
Expand Down
8 changes: 8 additions & 0 deletions actions/place.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { ADD_PLACE } from './types';

export const addPlace = placeName => {
return {
type: ADD_PLACE,
payload: placeName
}
}
2 changes: 2 additions & 0 deletions actions/types.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const ADD_PLACE = 'ADD_PLACE'
export const ADD_USER = 'ADD_USER'
8 changes: 8 additions & 0 deletions actions/user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { ADD_USER } from './types';

export const addUser = user => {
return {
type: ADD_USER,
payload: user
}
}
111 changes: 42 additions & 69 deletions components/SettingsOverview.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ import {
Alert,
} from 'react-native';
import SettingsList from 'react-native-settings-list';
import { connect } from 'react-redux';
import { addPlace } from '../actions/place';
import { addUser } from '../actions/user';

export class SettingsOverview extends React.Component {
class SettingsOverview extends React.Component {
constructor(){
super();
this.onValueChange = this.onValueChange.bind(this);
this.componentActive = this.componentActive.bind(this);
this.state = {switchValue: false, loggedIn: false, token: false, user: []};
this.state = {switchValue: false, loggedIn: false, token: false, user: {}, places: '', placeName: ''};
}

componentDidMount(){
Expand All @@ -25,34 +28,27 @@ export class SettingsOverview extends React.Component {
componentActive(){
fetch('http://mukurtucms.kanopi.cloud/services/session/token')
.then((response) => {
//Alert.alert("my json" + responseJson.movies);
/* Alert.alert(
"Get response",
"Movies query-> " +JSON.stringify(response)
)*/
let Token = response._bodyText;
Alert.alert(
"Get response",
JSON.stringify(Token)
)
this.setState({token: Token});
let data = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-Token': 'fjatg8GacpUYxAK01g0OrcTlUrCAnblVaNa3sbECJpc',
'X-CSRF-Token': this.props.user.token,
'Cache-Control': 'no-cache',
'Postman-Token': '04751bd0-9bab-ba1b-b0ac-472d3c4577f9'
'Cookie': this.props.user.session_name + '=' + this.props.user.sessid
}
};

fetch('http://mukurtucms.kanopi.cloud/app/system/connect', data)
.then((response) => {
.then((response) => response.json())
.then((responseJson) => {
//Alert.alert("my json" + responseJson.movies);
Alert.alert(
"Get response",
JSON.stringify(response)
)
console.log('SESS ID: ' + JSON.stringify(responseJson.sessid));
console.log('SESS Name: ' + JSON.stringify(responseJson.session_name));
console.log('Current Status' + JSON.stringify(responseJson));
var session = responseJson.session_name + '=' + responseJson.sessid;
this.props.add(responseJson.session_name + '=' + responseJson.sessid);
/* if (response.user.uid === 0) {
this.setState({loggedIn: false});
} else {
Expand All @@ -70,16 +66,16 @@ export class SettingsOverview extends React.Component {

render() {
const { navigation } = this.props;

console.log('USERR: ' + JSON.stringify(this.props.user.user.uid));
var bgColor = '#DCE3F4';
return (
<View style={{backgroundColor:'#EFEFF4',flex:1}}>
<View style={{backgroundColor:'#EFEFF4',flex:1}}>
<SettingsList borderColor='#c8c7cc' defaultItemSize={50}>
{this.state.loggedIn ?
{parseInt(this.props.user.user.uid) > 0 ?
<SettingsList.Item
title='Log Out'
titleInfo={this.state.user.user.name}
titleInfo={this.props.user.user.name}
titleInfoStyle={styles.titleInfoStyle}
onPress={() =>
this.props.navigation.navigate('Logout')
Expand All @@ -96,55 +92,12 @@ export class SettingsOverview extends React.Component {
/>
}
<SettingsList.Item
hasSwitch={true}
switchState={this.state.switchValue}
switchOnValueChange={this.onValueChange}
hasNavArrow={false}
title='Airplane Mode'
/>
<SettingsList.Item
title='Wi-Fi'
titleInfo='Bill Wi The Science Fi'
titleInfoStyle={styles.titleInfoStyle}
onPress={() => Alert.alert('Route to Wifi Page')}
/>
<SettingsList.Item
title='Blutooth'
titleInfo='Off'
titleInfoStyle={styles.titleInfoStyle}
onPress={() => Alert.alert('Route to Blutooth Page')}
/>
<SettingsList.Item
title='Cellular'
onPress={() => Alert.alert('Route To Cellular Page')}
/>
<SettingsList.Item
title='Personal Hotspot'
titleInfo='Off'
titleInfoStyle={styles.titleInfoStyle}
onPress={() => Alert.alert('Route To Hotspot Page')}
/>
<SettingsList.Header headerStyle={{marginTop:15}}/>
<SettingsList.Item
title='Notifications'
onPress={() => Alert.alert('Route To Notifications Page')}
/>
<SettingsList.Item
title='Control Center'
onPress={() => Alert.alert('Route To Control Center Page')}
/>
<SettingsList.Item
title='Do Not Disturb'
onPress={() => Alert.alert('Route To Do Not Disturb Page')}
title='Help'
onPress={() => this.props.navigation.navigate('Help')}
/>
<SettingsList.Header headerStyle={{marginTop:15}}/>
<SettingsList.Item
title='General'
onPress={() => Alert.alert('Route To General Page')}
/>
<SettingsList.Item
title='Display & Brightness'
onPress={() => Alert.alert('Route To Display Page')}
title='About'
onPress={() => this.props.navigation.navigate('About')}
/>
</SettingsList>
</View>
Expand Down Expand Up @@ -172,4 +125,24 @@ const styles = StyleSheet.create({
fontSize:16,
color: '#8e8e93'
}
});
});

const mapStateToProps = state => {
return {
places: state.places.places,
user: state.user.user
}
}

const mapDispatchToProps = dispatch => {
return {
add: (name) => {
dispatch(addPlace(name))
},
addUserProp: (name) => {
dispatch(addUser(name))
}
}
}

export default connect(mapStateToProps, mapDispatchToProps)(SettingsOverview)
12 changes: 12 additions & 0 deletions endpoints/ArticleForm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default ArticleForm = {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"surname": {
"type": "string"
}
},
"required": ["name", "surname"]
}
30 changes: 30 additions & 0 deletions endpoints/ContentTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
export default ContentTypes = {
'article': {
'label': 'Article',
'description': 'Use articles for time-sensitive content like news, press releases or blog posts.'
},
'page': {
'label': 'Basic page',
'description': 'Use basic pages for your static content, such as an "About us" page.'
},
'collection': {
'label': 'Collection',
'description': 'A collection of digital heritage items.'
},
'community': {
'label': 'Community',
'description': 'Community Groups can be used for content and user assignments, and community content can be made available to members of the group only.'
},
'cultural_protocol': {
'label': 'Cultural Protocol',
'description': 'Cultural Protocols can be assigned to groups and to individual items. Using these protocols allows you to determine how content can be made available to members of the group. Examples of protocols are: "Gender: Male", or "Age: Elder". Read more about this on our wiki.'
},
'digital_heritage': {
'label': 'Digital Heritage',
'description': 'Content & media items: images, movies, audio, documents'
},
'panel': {
'label': 'Panel',
'description': 'A panel layout broken up into rows and columns.'
}
}
46 changes: 46 additions & 0 deletions endpoints/DigitalHeritage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
export default DigitalHeritage = [{
"type": "tab",
"label": "Mukurtu Essentials",
"form": {
"type": "object",
"properties": {
"Title": {
"type": "string"
},
"Summary": {
"type": "string"
},
"Media Assets": {
"type": "string"
},
"Communities and Protocols": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Community": {
"type": "string",
"enum": ["Test Community 1", "Test Community 2"]
},
"Protocol": {
"type": "string",
"enum": ["Test Protocol 1", "Test Protocol 2"]
}
},
"required": ["name", "surname"]
},
},
"General": {
"type": "boolean"
}
},
"required": ["title", "surname"]
},
"options": {
fields: {
"General": {
label: "Categories"
}
}
}
}];
20 changes: 13 additions & 7 deletions navigation/MainTabNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import { createStackNavigator, createBottomTabNavigator } from 'react-navigation

import TabBarIcon from '../components/TabBarIcon';
import HomeScreen from '../screens/HomeScreen';
import LinksScreen from '../screens/LinksScreen';
import CreateContentScreen from '../screens/CreateContentScreen';
import CreateContentFormScreen from '../screens/CreateContentFormScreen';
import SettingsScreen from '../screens/SettingsScreen';
import LoginScreen from '../screens/LoginScreen';
import LogoutScreen from '../screens/LogoutScreen';
import HelpScreen from '../screens/HelpScreen';
import AboutScreen from '../screens/AboutScreen';

const HomeStack = createStackNavigator({
Home: HomeScreen,
Expand All @@ -27,12 +30,13 @@ HomeStack.navigationOptions = {
),
};

const LinksStack = createStackNavigator({
Links: LinksScreen,
const CreateContentStack = createStackNavigator({
Links: CreateContentScreen,
CreateContentForm: CreateContentFormScreen
});

LinksStack.navigationOptions = {
tabBarLabel: 'Links',
CreateContentStack.navigationOptions = {
tabBarLabel: 'Create Content',
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
Expand All @@ -44,7 +48,9 @@ LinksStack.navigationOptions = {
const SettingsStack = createStackNavigator({
Settings: SettingsScreen,
Login: LoginScreen,
Logout: LogoutScreen
Logout: LogoutScreen,
Help: HelpScreen,
About: AboutScreen
});

SettingsStack.navigationOptions = {
Expand All @@ -62,6 +68,6 @@ SettingsStack.navigationOptions = {

export default createBottomTabNavigator({
HomeStack,
LinksStack,
CreateContentStack,
SettingsStack,
});
Loading

0 comments on commit be26a9f

Please sign in to comment.