From 8a167f77d538e72bc837f8c5d1274567e01b5ca9 Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Fri, 28 Aug 2020 23:40:55 -0400 Subject: [PATCH] Gets a basic running app going. Refactors everything into Typescript and organizes files. --- .expo-shared/assets.json | 4 + .gitignore | 5 +- .watchmanconfig | 1 - App.js | 46 - App.tsx | 76 + README.md | 1 - android/app/BUCK | 55 - android/app/build.gradle | 224 - android/app/build_defs.bzl | 19 - android/app/debug.keystore | Bin 2257 -> 0 bytes android/app/proguard-rules.pro | 10 - android/app/src/debug/AndroidManifest.xml | 7 - .../ReactNativeFlipper.java | 69 - android/app/src/main/AndroidManifest.xml | 43 - .../virginia/covid19/kiosk/MainActivity.java | 41 - .../covid19/kiosk/MainApplication.java | 120 - .../kiosk/generated/BasePackageList.java | 24 - .../src/main/res/drawable/splashscreen.xml | 7 - .../main/res/drawable/splashscreen_image.png | Bin 9306 -> 0 bytes .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 3056 -> 0 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 5024 -> 0 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 2096 -> 0 bytes .../res/mipmap-mdpi/ic_launcher_round.png | Bin 2858 -> 0 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 4569 -> 0 bytes .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 7098 -> 0 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 6464 -> 0 bytes .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 10676 -> 0 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 9250 -> 0 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 15523 -> 0 bytes android/app/src/main/res/values/colors.xml | 5 - android/app/src/main/res/values/strings.xml | 3 - android/app/src/main/res/values/styles.xml | 11 - android/build.gradle | 38 - android/gradle.properties | 29 - android/gradle/wrapper/gradle-wrapper.jar | Bin 53639 -> 0 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 - android/gradlew | 188 - android/gradlew.bat | 100 - android/settings.gradle | 9 - app.json | 21 +- components/Common.tsx | 10 + components/Print.tsx | 32 + components/Scan.tsx | 20 + components/Styles.tsx | 30 + index.js | 8 - ios/Podfile | 92 - .../project.pbxproj | 466 - .../contents.xcworkspacedata | 7 - .../xcshareddata/IDEWorkspaceChecks.plist | 8 - .../basicbarcodescannerusage.xcscheme | 88 - ios/basicbarcodescannerusage/AppDelegate.h | 10 - ios/basicbarcodescannerusage/AppDelegate.m | 99 - .../Base.lproj/LaunchScreen.xib | 42 - .../AppIcon.appiconset/App-Icon-20x20@1x.png | Bin 331 -> 0 bytes .../AppIcon.appiconset/App-Icon-20x20@2x.png | Bin 627 -> 0 bytes .../AppIcon.appiconset/App-Icon-20x20@3x.png | Bin 1208 -> 0 bytes .../AppIcon.appiconset/App-Icon-29x29@1x.png | Bin 430 -> 0 bytes .../AppIcon.appiconset/App-Icon-29x29@2x.png | Bin 1231 -> 0 bytes .../AppIcon.appiconset/App-Icon-29x29@3x.png | Bin 1472 -> 0 bytes .../AppIcon.appiconset/App-Icon-40x40@1x.png | Bin 627 -> 0 bytes .../AppIcon.appiconset/App-Icon-40x40@2x.png | Bin 1346 -> 0 bytes .../AppIcon.appiconset/App-Icon-40x40@3x.png | Bin 2085 -> 0 bytes .../AppIcon.appiconset/App-Icon-60x60@2x.png | Bin 2085 -> 0 bytes .../AppIcon.appiconset/App-Icon-60x60@3x.png | Bin 2958 -> 0 bytes .../AppIcon.appiconset/App-Icon-76x76@1x.png | Bin 1366 -> 0 bytes .../AppIcon.appiconset/App-Icon-76x76@2x.png | Bin 2675 -> 0 bytes .../App-Icon-83.5x83.5@2x.png | Bin 2825 -> 0 bytes .../AppIcon.appiconset/Contents.json | 122 - .../AppIcon.appiconset/ItunesArtwork@2x.png | Bin 24699 -> 0 bytes .../Images.xcassets/Contents.json | 6 - .../SplashScreen.imageset/Contents.json | 21 - .../SplashScreen.imageset/splashscreen.png | Bin 9306 -> 0 bytes .../Contents.json | 21 - .../background.png | Bin 80 -> 0 bytes ios/basicbarcodescannerusage/Info.plist | 69 - .../SplashScreen.storyboard | 91 - .../Supporting/Expo.plist | 16 - .../kiosk.entitlements | 5 - ios/basicbarcodescannerusage/main.m | 10 - metro.config.js | 6 - models/BarcodeScannerAppState.tsx | 9 + models/ElementProps.tsx | 28 + package-lock.json | 8181 +---------------- package.json | 53 +- tsconfig.json | 12 + 85 files changed, 376 insertions(+), 10347 deletions(-) create mode 100644 .expo-shared/assets.json delete mode 100644 .watchmanconfig delete mode 100644 App.js create mode 100644 App.tsx delete mode 100644 README.md delete mode 100644 android/app/BUCK delete mode 100644 android/app/build.gradle delete mode 100644 android/app/build_defs.bzl delete mode 100644 android/app/debug.keystore delete mode 100644 android/app/proguard-rules.pro delete mode 100644 android/app/src/debug/AndroidManifest.xml delete mode 100644 android/app/src/debug/java/com/basicbarcodescannerusage/ReactNativeFlipper.java delete mode 100644 android/app/src/main/AndroidManifest.xml delete mode 100644 android/app/src/main/java/edu/virginia/covid19/kiosk/MainActivity.java delete mode 100644 android/app/src/main/java/edu/virginia/covid19/kiosk/MainApplication.java delete mode 100644 android/app/src/main/java/edu/virginia/covid19/kiosk/generated/BasePackageList.java delete mode 100644 android/app/src/main/res/drawable/splashscreen.xml delete mode 100644 android/app/src/main/res/drawable/splashscreen_image.png delete mode 100644 android/app/src/main/res/mipmap-hdpi/ic_launcher.png delete mode 100644 android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png delete mode 100644 android/app/src/main/res/mipmap-mdpi/ic_launcher.png delete mode 100644 android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png delete mode 100644 android/app/src/main/res/mipmap-xhdpi/ic_launcher.png delete mode 100644 android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png delete mode 100644 android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png delete mode 100644 android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png delete mode 100644 android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png delete mode 100644 android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png delete mode 100644 android/app/src/main/res/values/colors.xml delete mode 100644 android/app/src/main/res/values/strings.xml delete mode 100644 android/app/src/main/res/values/styles.xml delete mode 100644 android/build.gradle delete mode 100644 android/gradle.properties delete mode 100644 android/gradle/wrapper/gradle-wrapper.jar delete mode 100644 android/gradle/wrapper/gradle-wrapper.properties delete mode 100755 android/gradlew delete mode 100644 android/gradlew.bat delete mode 100644 android/settings.gradle create mode 100644 components/Common.tsx create mode 100644 components/Print.tsx create mode 100644 components/Scan.tsx create mode 100644 components/Styles.tsx delete mode 100644 index.js delete mode 100644 ios/Podfile delete mode 100644 ios/basicbarcodescannerusage.xcodeproj/project.pbxproj delete mode 100644 ios/basicbarcodescannerusage.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 ios/basicbarcodescannerusage.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 ios/basicbarcodescannerusage.xcodeproj/xcshareddata/xcschemes/basicbarcodescannerusage.xcscheme delete mode 100644 ios/basicbarcodescannerusage/AppDelegate.h delete mode 100644 ios/basicbarcodescannerusage/AppDelegate.m delete mode 100644 ios/basicbarcodescannerusage/Base.lproj/LaunchScreen.xib delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/AppIcon.appiconset/App-Icon-20x20@1x.png delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/AppIcon.appiconset/App-Icon-20x20@2x.png delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/AppIcon.appiconset/App-Icon-20x20@3x.png delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/AppIcon.appiconset/App-Icon-29x29@1x.png delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/AppIcon.appiconset/App-Icon-29x29@2x.png delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/AppIcon.appiconset/App-Icon-29x29@3x.png delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/AppIcon.appiconset/App-Icon-40x40@1x.png delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/AppIcon.appiconset/App-Icon-40x40@2x.png delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/AppIcon.appiconset/App-Icon-40x40@3x.png delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/AppIcon.appiconset/App-Icon-60x60@2x.png delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/AppIcon.appiconset/App-Icon-60x60@3x.png delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/AppIcon.appiconset/App-Icon-76x76@1x.png delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/AppIcon.appiconset/App-Icon-76x76@2x.png delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/AppIcon.appiconset/App-Icon-83.5x83.5@2x.png delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/Contents.json delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/SplashScreen.imageset/Contents.json delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/SplashScreen.imageset/splashscreen.png delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/SplashScreenBackground.imageset/Contents.json delete mode 100644 ios/basicbarcodescannerusage/Images.xcassets/SplashScreenBackground.imageset/background.png delete mode 100644 ios/basicbarcodescannerusage/Info.plist delete mode 100644 ios/basicbarcodescannerusage/SplashScreen.storyboard delete mode 100644 ios/basicbarcodescannerusage/Supporting/Expo.plist delete mode 100644 ios/basicbarcodescannerusage/kiosk.entitlements delete mode 100644 ios/basicbarcodescannerusage/main.m delete mode 100644 metro.config.js create mode 100644 models/BarcodeScannerAppState.tsx create mode 100644 models/ElementProps.tsx create mode 100644 tsconfig.json diff --git a/.expo-shared/assets.json b/.expo-shared/assets.json new file mode 100644 index 0000000..1e6decf --- /dev/null +++ b/.expo-shared/assets.json @@ -0,0 +1,4 @@ +{ + "12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true, + "40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true +} diff --git a/.gitignore b/.gitignore index 1bef217..ccc54b6 100644 --- a/.gitignore +++ b/.gitignore @@ -395,4 +395,7 @@ Temporary Items # Ignore all local history of files .history -# End of https://www.toptal.com/developers/gitignore/api/reactnative,visualstudiocode,pycharm+all \ No newline at end of file +# End of https://www.toptal.com/developers/gitignore/api/reactnative,visualstudiocode,pycharm+all + +.expo +.expo-shared diff --git a/.watchmanconfig b/.watchmanconfig deleted file mode 100644 index 0967ef4..0000000 --- a/.watchmanconfig +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/App.js b/App.js deleted file mode 100644 index 07adf85..0000000 --- a/App.js +++ /dev/null @@ -1,46 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { Text, View, StyleSheet, Button } from 'react-native'; -import { BarCodeScanner } from 'expo-barcode-scanner'; - -export default function App() { - const [hasPermission, setHasPermission] = useState(null); - const [scanned, setScanned] = useState(false); - - useEffect(() => { - (async () => { - const { status } = await BarCodeScanner.requestPermissionsAsync(); - setHasPermission(status === 'granted'); - })(); - }, []); - - const handleBarCodeScanned = ({ type, data }) => { - setScanned(true); - const timeInt = new Date().getTime(); - const locationStr = '4321'; - const newData = `${data}-${timeInt}-${locationStr}`; - alert(`Bar code with type ${type} and data ${data} has been scanned! Data to print on new bar code: ${newData}`); - }; - - if (hasPermission === null) { - return Requesting for camera permission; - } - if (hasPermission === false) { - return No access to camera; - } - - return ( - - - - {scanned &&