diff --git a/.expo-shared/assets.json b/.expo-shared/assets.json new file mode 100755 index 0000000..17ad228 --- /dev/null +++ b/.expo-shared/assets.json @@ -0,0 +1,4 @@ +{ + "f9155ac790fd02fadcdeca367b02581c04a353aa6d5aa84409a59f6804c87acd": true, + "89ed26367cdb9b771858e026f2eb95bfdb90e5ae943e716575327ec325f39c44": true +} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..a25907f --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +node_modules/**/* +.expo/* +npm-debug.* +*.jks +*.p8 +*.p12 +*.key +*.mobileprovision +*.orig.* +web-build/ +web-report/ + +# macOS +.DS_Store + +# more stuff +*.bash + diff --git a/App.js b/App.js new file mode 100755 index 0000000..e199bde --- /dev/null +++ b/App.js @@ -0,0 +1,28 @@ +// Nav stuff + +import { createAppContainer } from 'react-navigation'; +import { createStackNavigator } from 'react-navigation-stack'; + +// Screens one per file to keep things clean + +import HomeScreen from './src/screens/HomeScreen'; +import AboutScreen from './src/screens/AboutScreen'; +import SettingsScreen from './src/screens/SettingsScreen'; +import FilesScreen from './src/screens/FilesScreen'; + +// Clean up of code before I fix the last little issue with it + + +const AppNavigator = createStackNavigator( + { + Home: HomeScreen, + About: AboutScreen, + Files: FilesScreen, + Settings: SettingsScreen, + }, + { + initialRouteName: 'Home', + } +); + +export default createAppContainer(AppNavigator); \ No newline at end of file diff --git a/app.json b/app.json new file mode 100755 index 0000000..bbaec8d --- /dev/null +++ b/app.json @@ -0,0 +1,32 @@ +{ + "expo": { + "name": "csrv", + "slug": "csrv", + "privacy": "public", + "sdkVersion": "36.0.0", + "platforms": [ + "android" + ], + "version": "1.2.0", + "orientation": "portrait", + "icon": "./assets/icon.png", + "splash": { + "image": "./assets/splash.png", + "resizeMode": "contain", + "backgroundColor": "#ffffff" + }, + "updates": { + "fallbackToCacheTimeout": 0 + }, + "assetBundlePatterns": [ + "**/*" + ], + "ios": { + "supportsTablet": true + }, + "android": { + "package": "com.rpicsrv.csrv", + "versionCode": 2 + } + } +} diff --git a/assets/icon.png b/assets/icon.png new file mode 100755 index 0000000..7f5e01c Binary files /dev/null and b/assets/icon.png differ diff --git a/assets/splash.png b/assets/splash.png new file mode 100755 index 0000000..4f9ade6 Binary files /dev/null and b/assets/splash.png differ diff --git a/babel.config.js b/babel.config.js new file mode 100755 index 0000000..2900afe --- /dev/null +++ b/babel.config.js @@ -0,0 +1,6 @@ +module.exports = function(api) { + api.cache(true); + return { + presets: ['babel-preset-expo'], + }; +}; diff --git a/package.json b/package.json new file mode 100755 index 0000000..e59a184 --- /dev/null +++ b/package.json @@ -0,0 +1,31 @@ +{ + "main": "node_modules/expo/AppEntry.js", + "scripts": { + "start": "expo start", + "android": "expo start --android", + "ios": "expo start --ios", + "web": "expo start --web", + "eject": "expo eject" + }, + "dependencies": { + "@react-native-community/masked-view": "0.1.5", + "axios": "^0.19.2", + "expo": "~36.0.0", + "react": "~16.9.0", + "react-dom": "~16.9.0", + "react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz", + "react-native-elements": "^1.2.7", + "react-native-gesture-handler": "^1.5.3", + "react-native-reanimated": "~1.4.0", + "react-native-safe-area-context": "0.6.0", + "react-native-screens": "2.0.0-alpha.12", + "react-native-web": "~0.11.7", + "react-navigation": "^4.0.10", + "react-navigation-stack": "^2.0.16" + }, + "devDependencies": { + "@babel/core": "^7.0.0", + "babel-preset-expo": "~8.0.0" + }, + "private": true +} diff --git a/src/screens/AboutScreen.js b/src/screens/AboutScreen.js new file mode 100644 index 0000000..056fd82 --- /dev/null +++ b/src/screens/AboutScreen.js @@ -0,0 +1,28 @@ +import React from 'react'; +import { + View, + Text, + } from 'react-native'; + +class AboutScreen extends React.Component { + static navigationOptions = ({ navigation }) => { + return { + title: navigation.getParam('otherParam', 'About'), + headerStyle: { + backgroundColor: '#3333ff', + }, + headerTintColor: '#fff', + }; + }; + + render() { + return ( + + About Screen{"\n"}{"\n"} + RPI Media Center Control v 1.0 beta + + ); + } + } + + export default AboutScreen; \ No newline at end of file diff --git a/src/screens/FilesScreen.js b/src/screens/FilesScreen.js new file mode 100644 index 0000000..911ce9e --- /dev/null +++ b/src/screens/FilesScreen.js @@ -0,0 +1,74 @@ +import React from 'react'; +import axios from 'axios'; + +import { + View, + Text, + FlatList, // Solves the problem with the 5 movie limit in the app + } from 'react-native'; + + // these imports make headers and buttons look better + import { + Header, + Button, + } from 'react-native-elements'; + +function play(name) { + // Play handler + axios.get('http://192.168.1.158:8080/play/'+name) + .then(res => { + // Still don't care about response + }) + + } + +class FilesScreen extends React.Component { + + constructor(props){ + super(props); + this.state ={ data: []}; + } + static navigationOptions = ({ navigation }) => { + return { + title: navigation.getParam('otherParam', 'File Selection'), + headerStyle: { + backgroundColor: '#3333ff', + }, + headerTintColor: '#fff', + }; + }; + + componentDidMount() { + axios.get('http://192.168.1.158:8080/list/') + .then(res => { + this.setState({ + data: res.data.data, + }) + }) + + } + + + + render() { + let movies = this.state.data + + return ( + + + Pick a movie + movies} + data={movies} + renderItem={({ item }) => { + return