Skip to content

Commit

Permalink
half way done with cam
Browse files Browse the repository at this point in the history
  • Loading branch information
garvsl committed Oct 21, 2023
1 parent dec6545 commit 1d36152
Show file tree
Hide file tree
Showing 43 changed files with 2,564 additions and 2,413 deletions.
6 changes: 3 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ android {

compileSdkVersion rootProject.ext.compileSdkVersion

namespace "com.fitgoat"
namespace 'com.fitGoat'
defaultConfig {
applicationId "com.fitgoat"
applicationId 'com.fitGoat'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
versionName "1.0.0"

buildConfigField("boolean", "REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS", (findProperty("reactNative.unstable_useRuntimeSchedulerAlways") ?: true).toString())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
* directory of this source tree.
*/
package com.fitgoat;
package com.fitGoat;

import android.content.Context;
import com.facebook.flipper.android.AndroidFlipperClient;
Expand Down
34 changes: 19 additions & 15 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.INTERNET"/>
<!-- OPTIONAL PERMISSIONS, REMOVE WHATEVER YOU DO NOT NEED -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<!-- These require runtime permissions on M -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- END OPTIONAL PERMISSIONS -->

<queries>
<!-- Support checking for http(s) links via the Linking API -->
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="https"/>
</intent>
</queries>

<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" android:theme="@style/AppTheme">
<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="YOUR-APP-URL-HERE"/>
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="YOUR-APP-SDK-VERSION-HERE"/>
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:allowBackup="true" android:theme="@style/AppTheme">
<meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/>
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="49.0.0"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
<activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="fitGoat"/>
<data android:scheme="com.fitGoat"/>
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false"/>
</application>
</manifest>
</manifest>
2 changes: 1 addition & 1 deletion android/app/src/main/java/com/fitgoat/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fitgoat;
package com.fitGoat;

import android.os.Build;
import android.os.Bundle;
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/java/com/fitgoat/MainApplication.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fitgoat;
package com.fitGoat;

import android.app.Application;
import android.content.res.Configuration;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion android/app/src/main/res/drawable/splashscreen.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splashscreen_background"/>
</layer-list>
Binary file not shown.
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
1 change: 1 addition & 0 deletions android/app/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<resources/>
6 changes: 4 additions & 2 deletions android/app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<resources>
<color name="splashscreen_background">#FFFFFF</color>
<color name="splashscreen_background">#ffffff</color>
<color name="iconBackground">#FFFFFF</color>
<color name="colorPrimary">#023c69</color>
<color name="colorPrimaryDark">#ffffff</color>
</resources>
6 changes: 4 additions & 2 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<resources>
<string name="app_name">fitGoat</string>
</resources>
<string name="app_name">fitGoat</string>
<string name="expo_splash_screen_resize_mode" translatable="false">contain</string>
<string name="expo_splash_screen_status_bar_translucent" translatable="false">false</string>
</resources>
6 changes: 4 additions & 2 deletions android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:textColor">@android:color/black</item>
<item name="android:editTextStyle">@style/ResetEditText</item>
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
</style>
<style name="ResetEditText" parent="@android:style/Widget.EditText">
<item name="android:padding">0dp</item>
Expand All @@ -12,4 +14,4 @@
<style name="Theme.App.SplashScreen" parent="AppTheme">
<item name="android:windowBackground">@drawable/splashscreen</item>
</style>
</resources>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
* directory of this source tree.
*/
package com.fitgoat;
package com.fitGoat;

import android.content.Context;
import com.facebook.react.ReactInstanceManager;
Expand Down
4 changes: 4 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ allprojects {
maven { url 'https://www.jitpack.io' }
}
}
// @generated begin expo-camera-import - expo prebuild (DO NOT MODIFY) sync-f244f4f3d8bf7229102e8f992b525b8602c74770
def expoCameraMavenPath = new File(["node", "--print", "require.resolve('expo-camera/package.json')"].execute(null, rootDir).text.trim(), "../android/maven")
allprojects { repositories { maven { url(expoCameraMavenPath) } } }
// @generated end expo-camera-import
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
},
"android": {
"package": "com.fitGoat"
}
},
}
}
1 change: 0 additions & 1 deletion app/tabs/tab0.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export default function Tab1() {
>
{commonFoods &&
commonFoods.map((food, index) => {
console.log(food, index);
return (
<CardDemo
key={index}
Expand Down
109 changes: 86 additions & 23 deletions app/tabs/tab1.tsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,100 @@
import { H5, Tabs, Text } from "tamagui";
import React, { useEffect, useState } from "react";
import { Button, StyleSheet } from "react-native";
import { Ionicons } from "@expo/vector-icons";
import { Video } from "expo-av";
import { Camera } from "expo-camera";
import { Circle, H5, Tabs, Text } from "tamagui";

import { MyStack } from "../../components/MyStack";

export default function Tab1() {
const [hasAudioPermission, setHasAudioPermission] = useState(null);
const [hasCameraPermission, setHasCameraPermission] = useState(null);
const [camera, setCamera] = useState(null);
const [record, setRecord] = useState(null);
const [type, setType] = useState(Camera.Constants.Type.back);
const video = React.useRef(null);
const [status, setStatus] = React.useState({});

useEffect(() => {
(async () => {
const cameraStatus = await Camera.requestPermissionsAsync();
setHasCameraPermission(cameraStatus.status === "granted");
const audioStatus = await Camera.requestMicrophonePermissionsAsync();
setHasAudioPermission(audioStatus.status === "granted");
})();
}, []);

const takeVideo = async () => {
if (camera) {
const data = await camera.recordAsync({
VideoQuality: ["2160p"],
maxDuration: 10,
maxFileSize: 200,
mute: false,
videoBitrate: 5000000
});
setRecord(data.uri);
console.log(data.uri);
}
};
const stopVideo = async () => {
camera.stopRecording();
};

if (hasCameraPermission === null || hasAudioPermission === null) {
return <Text>Waiting for permissions</Text>;
}
if (hasCameraPermission === false || hasAudioPermission === false) {
return <Text>No access to camera</Text>;
}

return (
<MyStack>
<Tabs
defaultValue="tab1"
orientation="horizontal"
alignItems="center"
justifyContent="flex-end"
flexDirection="column"
width="100%"
width="110%"
left={"-5%"}
height={"110%"}
marginTop={"$-5"}
>
<Tabs.List>
<Tabs.Tab value="tab1">
<Text>SubTab 1</Text>
</Tabs.Tab>
<Tabs.Tab value="tab2">
<Text>SubTab 2</Text>
</Tabs.Tab>
<Tabs.Tab value="tab3">
<Text>SubTab 3</Text>
</Tabs.Tab>
</Tabs.List>

<Tabs.Content value="tab1">
<H5>SubTab 1 Content</H5>
</Tabs.Content>
<Tabs.Content value="tab2">
<H5>SubTab 2 Content</H5>
</Tabs.Content>
<Tabs.Content value="tab3">
<H5>SubTab 3 Content</H5>
</Tabs.Content>
<Video
ref={video}
source={{
uri: record
}}
useNativeControls
resizeMode="contain"
isLooping
onPlaybackStatusUpdate={(status) => setStatus(() => status)}
/>
<Camera
ref={(ref) => setCamera(ref)}
type={type}
ratio={"4:3"}
/>
<Button
title="Flip Video"
onPress={() => {
setType(
type === Camera.Constants.Type.back
? Camera.Constants.Type.front
: Camera.Constants.Type.back
);
}}
></Button>
<Button
title="Take video"
onPress={() => takeVideo()}
/>
<Button
title="Stop Video"
onPress={() => stopVideo()}
/>
</Tabs>
</MyStack>
);
Expand Down
Binary file removed bun.lockb
Binary file not shown.
21 changes: 13 additions & 8 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ PODS:
- DoubleConversion (1.1.6)
- EXApplication (5.3.1):
- ExpoModulesCore
- EXAV (13.6.0):
- ExpoModulesCore
- ReactCommon/turbomodule/core
- EXCamera (13.4.4):
- ExpoModulesCore
- EXConstants (14.4.2):
- ExpoModulesCore
- EXFileSystem (15.4.4):
Expand Down Expand Up @@ -502,17 +507,15 @@ PODS:
- SocketRocket (0.6.1)
- SPAlert (4.2.0)
- SPIndicator (1.6.4)
- VisionCamera (3.5.1):
- React
- React-callinvoker
- React-Core
- Yoga (1.14.0)

DEPENDENCIES:
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
- Burnt (from `../node_modules/burnt/ios`)
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- EXApplication (from `../node_modules/expo-application/ios`)
- EXAV (from `../node_modules/expo-av/ios`)
- EXCamera (from `../node_modules/expo-camera/ios`)
- EXConstants (from `../node_modules/expo-constants/ios`)
- EXFileSystem (from `../node_modules/expo-file-system/ios`)
- EXFont (from `../node_modules/expo-font/ios`)
Expand Down Expand Up @@ -566,7 +569,6 @@ DEPENDENCIES:
- RNReanimated (from `../node_modules/react-native-reanimated`)
- RNScreens (from `../node_modules/react-native-screens`)
- RNSVG (from `../node_modules/react-native-svg`)
- VisionCamera (from `../node_modules/react-native-vision-camera`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)

SPEC REPOS:
Expand All @@ -586,6 +588,10 @@ EXTERNAL SOURCES:
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
EXApplication:
:path: "../node_modules/expo-application/ios"
EXAV:
:path: "../node_modules/expo-av/ios"
EXCamera:
:path: "../node_modules/expo-camera/ios"
EXConstants:
:path: "../node_modules/expo-constants/ios"
EXFileSystem:
Expand Down Expand Up @@ -689,8 +695,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-screens"
RNSVG:
:path: "../node_modules/react-native-svg"
VisionCamera:
:path: "../node_modules/react-native-vision-camera"
Yoga:
:path: "../node_modules/react-native/ReactCommon/yoga"

Expand All @@ -699,6 +703,8 @@ SPEC CHECKSUMS:
Burnt: 8b232817df0d3efd78797702a0a541cc5a8eebe5
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
EXApplication: 042aa2e3f05258a16962ea1a9914bf288db9c9a1
EXAV: 523cd6969ca53b3b2762f18fb5450b76f84df44f
EXCamera: 6e6e79bf01a2b8190268d93297d8e79a843d5ede
EXConstants: ce5bbea779da8031ac818c36bea41b10e14d04e1
EXFileSystem: 2b826a3bf1071a4b80a8457e97124783d1ac860e
EXFont: 738c44c390953ebcbab075a4848bfbef025fd9ee
Expand Down Expand Up @@ -755,7 +761,6 @@ SPEC CHECKSUMS:
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
SPAlert: 735da1f16a887e294719217572ce1f936d8c8782
SPIndicator: 93e0a4fb23de51294ac48e874c0f081a5e293e4f
VisionCamera: 8236090a11d42da555d38c3f334633cfc7457516
Yoga: 3efc43e0d48686ce2e8c60f99d4e6bd349aff981

PODFILE CHECKSUM: 17c624a0536e5a6630ecf330ac560c387aced73a
Expand Down
Loading

0 comments on commit 1d36152

Please sign in to comment.