Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ios dev eanyakpor #76

Open
wants to merge 116 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
0edb882
these files were imported when running the npx expo run:ios command n…
eanyakpor Sep 26, 2023
b0aa4be
fully integrated AppleHealthKit into the app/test
eanyakpor Sep 26, 2023
8e1fe11
Merge branch 'main' into ios-dev-eanyakpor
eanyakpor Oct 11, 2023
2f9596e
ios native code to work with react native code
eanyakpor Oct 18, 2023
6e87eda
Merge remote-tracking branch 'origin/main' into ios-dev-eanyakpor
eanyakpor Oct 18, 2023
65ac66b
Trying to fill Activity Rings data
eanyakpor Nov 8, 2023
ed4b288
fill Activity Rings data
eanyakpor Nov 9, 2023
c2aade9
added viewheartdata
nirvanafan205 Nov 17, 2023
d938014
added file
nirvanafan205 Nov 17, 2023
0e1d099
temporary fix for HeartRateData screen
Persian-of-Interest Nov 17, 2023
4d3c044
added screens
nirvanafan205 Nov 21, 2023
b35fee1
fixed merge
nirvanafan205 Nov 21, 2023
66883b8
Merge branch 'main' into heart_sleep_data
qtdinh Nov 21, 2023
b82c45f
Merge branch 'main' into heart_sleep_data
qtdinh Nov 21, 2023
54b9d2d
Styling tweaks and DailyMetrics component
qtdinh Nov 21, 2023
14aeeb5
Add DataButton component
qtdinh Nov 22, 2023
7c0a859
Fix Sleep Data screen styling
qtdinh Nov 22, 2023
9fa0611
Fix Heart Rate Data Screen styling
qtdinh Nov 22, 2023
1b515c2
Previous screen indication on header
qtdinh Nov 22, 2023
d4fee6c
Add DateToolbar component
qtdinh Nov 22, 2023
1f96a7b
Able to get resting Heart Rate Data + date/times. Got sleep data. Wal…
eanyakpor Nov 22, 2023
157f15b
Some refactoring
qtdinh Nov 22, 2023
a74c6b4
Heart Rate Recovery mockup
qtdinh Nov 22, 2023
cc649dc
Store User Metrics Data in LocalStorage
j33l Nov 22, 2023
937037b
Merge branch 'main' of github.com:CSU-Northridge-ARCS-Dev/smart-cloth…
j33l Nov 22, 2023
cef3191
Minor changes to Heart Rate Recovery
qtdinh Nov 23, 2023
f2cfafb
Add prototype for sleep data graph
qtdinh Nov 26, 2023
2487e0a
IOS Native Code to get move data for the Activity Ring, all sleep & h…
eanyakpor Nov 28, 2023
9883033
in app.js rmv call to ios exclusive functions
eanyakpor Nov 28, 2023
47ed249
Change curve of graph
qtdinh Nov 29, 2023
86a54f8
throw error needed to pass test case, rmv utils.
eanyakpor Dec 3, 2023
8267930
Now using Toast messages to display Firebase auth errors
j33l Sep 17, 2023
814e36f
Created basic UserData input fields and connected them with FireStore DB
j33l Sep 17, 2023
1bfa45d
Created DataCollectModel and now using that to collect data right aft…
j33l Oct 1, 2023
c2949cc
some commit
qtdinh Oct 5, 2023
324fd41
Moved UserMetricsData modal component in Home screen from signup scre…
j33l Oct 8, 2023
227aca6
completed user metrics data modal with remaining validations and meas…
j33l Oct 8, 2023
da9e9fd
leftover merge
qtdinh Oct 8, 2023
d87ce75
merged with Metrics-Data Branch, error fix, removed duplicate code, u…
j33l Oct 10, 2023
312430b
Display sports
qtdinh Oct 10, 2023
4b5a453
added sleep import header to js file
eanyakpor Dec 9, 2023
29bbf26
set uuid to true
eanyakpor Dec 9, 2023
85becad
set uuid to null for no merge conflicts
eanyakpor Dec 9, 2023
8d5d428
Merge branch 'main' into ios-dev-eanyakpor
eanyakpor Dec 9, 2023
c0030fb
Merge pull request #75 from CSU-Northridge-ARCS-Dev/jeel-firebase-auth
akul43 Dec 11, 2023
addd939
Merge pull request #77 from CSU-Northridge-ARCS-Dev/heart_sleep_data
akul43 Dec 11, 2023
444d924
Add query data function and parse heart rate
qtdinh Feb 14, 2024
09a35f6
Remove pop-up messages, refine helper texts
qtdinh Feb 14, 2024
d8ef295
ToS in Settings
qtdinh Feb 15, 2024
d07d597
Resolve default value with SVG component
qtdinh Feb 21, 2024
75f57ca
Date range redux
qtdinh Feb 22, 2024
4084dc5
DatePicker and DateRangePicker
qtdinh Feb 27, 2024
fd7f565
Attempt on sleep date
qtdinh Feb 27, 2024
31985ba
Sleep data prototype
qtdinh Feb 27, 2024
2415fa1
Workaround... for now
qtdinh Feb 27, 2024
dbb2d18
Fetch DOB data
qtdinh Feb 29, 2024
c06848a
merge
qtdinh Feb 29, 2024
c740ed0
Transfer code from old laptop
Vaiterius Mar 3, 2024
756bf62
Merge pull request #85 from Vaiterius/ios-dev-eanyakpor
qtdinh Mar 3, 2024
9c94b12
Make button to send sleep data to firebase
Vaiterius Mar 4, 2024
4e42ed9
Merge pull request #86 from Vaiterius/ios-dev-eanyakpor
qtdinh Mar 4, 2024
5602af0
Sleep data graph
qtdinh Mar 4, 2024
1d80c42
Merge branch 'leftover-dev' of https://github.com/CSU-Northridge-ARCS…
qtdinh Mar 4, 2024
6c03863
Add date selection for Sleep Data
qtdinh Mar 10, 2024
6c9245a
Format x-labels
qtdinh Mar 10, 2024
c470c48
Fix change password modal bugs
qtdinh Mar 10, 2024
825dc3c
Fetch DOB data (fr this time)
qtdinh Mar 10, 2024
464894c
Update dependencies and return animation to rings
qtdinh Mar 10, 2024
e4efc09
Added database items, sleep & heart, to firebase.
eanyakpor Dec 19, 2023
bb42556
fixing rebase
eanyakpor Mar 11, 2024
7a44d60
able to read all types in swift and ignore to write types
eanyakpor Mar 10, 2024
44002cd
full migration from objc to swift
eanyakpor Mar 11, 2024
b147c1b
.DS_Store banished!
eanyakpor Mar 11, 2024
8d73382
fixed dupe import statement
eanyakpor Mar 11, 2024
563c0d9
Merge pull request #92 from CSU-Northridge-ARCS-Dev/leftover-dev
cfiguer055 Mar 12, 2024
cd0d0bd
these files were imported when running the npx expo run:ios command n…
eanyakpor Sep 26, 2023
4351a3d
fully integrated AppleHealthKit into the app/test
eanyakpor Sep 26, 2023
e7fd7d3
ios native code to work with react native code
eanyakpor Oct 18, 2023
133e5a1
Trying to fill Activity Rings data
eanyakpor Nov 8, 2023
33ad35c
fill Activity Rings data
eanyakpor Nov 9, 2023
48a494e
Able to get resting Heart Rate Data + date/times. Got sleep data. Wal…
eanyakpor Nov 22, 2023
2db2226
IOS Native Code to get move data for the Activity Ring, all sleep & h…
eanyakpor Nov 28, 2023
eccbafd
in app.js rmv call to ios exclusive functions
eanyakpor Nov 28, 2023
d44daef
throw error needed to pass test case, rmv utils.
eanyakpor Dec 3, 2023
0b3c16a
Now using Toast messages to display Firebase auth errors
j33l Sep 17, 2023
dbaf361
Created basic UserData input fields and connected them with FireStore DB
j33l Sep 17, 2023
09439fd
Created DataCollectModel and now using that to collect data right aft…
j33l Oct 1, 2023
8e3bf02
some commit
qtdinh Oct 5, 2023
add863c
Moved UserMetricsData modal component in Home screen from signup scre…
j33l Oct 8, 2023
292c62e
completed user metrics data modal with remaining validations and meas…
j33l Oct 8, 2023
86b5e84
leftover merge
qtdinh Oct 8, 2023
b34b24a
merged with Metrics-Data Branch, error fix, removed duplicate code, u…
j33l Oct 10, 2023
4d393a3
Display sports
qtdinh Oct 10, 2023
f99fc5e
added sleep import header to js file
eanyakpor Dec 9, 2023
939e4ac
set uuid to true
eanyakpor Dec 9, 2023
cecc842
set uuid to null for no merge conflicts
eanyakpor Dec 9, 2023
46f5b33
Transfer code from old laptop
Vaiterius Mar 3, 2024
c6eea47
Make button to send sleep data to firebase
Vaiterius Mar 4, 2024
61d6653
Added database items, sleep & heart, to firebase.
eanyakpor Dec 19, 2023
6c28592
fixing rebase
eanyakpor Mar 11, 2024
fd9beec
able to read all types in swift and ignore to write types
eanyakpor Mar 10, 2024
cd65311
full migration from objc to swift
eanyakpor Mar 11, 2024
c3963be
.DS_Store banished!
eanyakpor Mar 11, 2024
562e278
fixed dupe import statement
eanyakpor Mar 11, 2024
8dfb8a5
removed unnecsary file
eanyakpor Mar 12, 2024
b5bc6a7
commit message needed for rebase
eanyakpor Mar 12, 2024
8eb76d8
files that need to be commited
eanyakpor Mar 12, 2024
4e42a3d
Create the read activity rings functions in Controller and HK utils
Vaiterius Mar 12, 2024
1ca8aa5
Merge branch 'CSU-Northridge-ARCS-Dev:ios-dev-eanyakpor' into ios-dev…
Vaiterius Mar 12, 2024
52b5d3c
Merge pull request #93 from Vaiterius/ios-dev-eanyakpor
qtdinh Mar 12, 2024
a8203b1
Fix merge conflicts and dependency issues
Vaiterius Mar 18, 2024
57ecb00
Merge pull request #97 from Vaiterius/ios-dev-gerard
qtdinh Mar 18, 2024
8520700
Fetch activity ring values and plug into rings
Vaiterius Mar 18, 2024
e08ac1f
Tweak redux state to include current and goal values for charts
Vaiterius Mar 19, 2024
f72e5bd
Fix initial rendering of activity rings data
Vaiterius Mar 19, 2024
95be00b
Merge pull request #98 from Vaiterius/ios-dev-gerard
qtdinh Mar 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions SmartClothingApp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ npm-debug.*
*.mobileprovision
*.orig.*
web-build/
.idea
android/

# macOS
.DS_Store

# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*
.DS_Store
160 changes: 125 additions & 35 deletions SmartClothingApp/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useEffect, useState } from "react";
import { SafeAreaView } from "react-native";
import { Text, StyleSheet} from 'react-native'
import { PaperProvider } from "react-native-paper";
import { NavigationContainer } from "@react-navigation/native";
import { Provider as StoreProvider } from "react-redux";
Expand All @@ -10,13 +11,28 @@ import { AppTheme } from "./src/constants/themes";
import configureStore from "./src/store";
import { AppToast } from "./src/components";
import { auth } from "./firebaseConfig.js";
import { getUID } from "./src/utils/localStorage.js";

import { getUID, getMetrics } from "./src/utils/localStorage.js";

import {
startLoadUserData,
updateUserMetricsData,
} from "./src/actions/userActions.js";
import SplashScreen from "react-native-splash-screen";
import { findHealthData } from './src/utils/AppleHealthKit/AppleHealthKitUtils';
import { requestHealthKitAuthorization } from './src/utils/AppleHealthKit/AppleHealthKitUtils';
import { readHeartRateData } from './src/utils/AppleHealthKit/AppleHealthKitUtils';
import { getRestingHeartRateData } from "./src/utils/AppleHealthKit/AppleHealthKitUtils";
import { getHeartRateVariabilityData } from "./src/utils/AppleHealthKit/AppleHealthKitUtils";
import { getSleepData } from "./src/utils/AppleHealthKit/AppleHealthKitUtils";
import { getActivityRingsData } from "./src/utils/AppleHealthKit/AppleHealthKitUtils";


const store = configureStore();

export default function App() {
const [isLoading, setLoading] = useState(true);
//const [heartRateDataArr, setHeartRateDataArr] = useState([])

// useEffect(() => {
// if (Platform.OS === "android") {
Expand Down Expand Up @@ -44,32 +60,52 @@ export default function App() {
};
checkUID();

// Check if there's a stored user Matrics Data in local storage
const checkMetrics = async () => {
try {
const storedMetrics = await getMetrics();
// console.log("Checking stored metrics");
if (storedMetrics) {
// If there's a token, try to refresh the user's session
// console.log("Stored metrics found");
// console.log("Stored metrics is -->", storedMetrics);
//Set the user metrics data in the Redux store
store.dispatch(updateUserMetricsData(storedMetrics));
} else {
// console.log("No stored metrics");
//get the user metrics data from the database
store.dispatch(startLoadUserData());
}
} catch (error) {
console.error("Error checking stored metrics:", error);
}
};
checkMetrics();

// Loading fonts
const loadFont = async () => {
const res = await useAppFonts();
setLoading(false);
};
loadFont();

console.log("from App.js: Auth.currentUser is -->", auth.currentUser);


// // Check if there's a stored token on app launch
// const checkToken = async () => {
// try {
// const storedToken = await AsyncStorage.getItem("userToken");
// if (storedToken) {
// // If there's a token, try to refresh the user's session
// const credential = auth.GoogleAuthProvider.credential(storedToken);
// const refreshedUser = await auth().signInWithCredential(credential);
// setUser(refreshedUser);
// }
// } catch (error) {
// console.error("Error checking token:", error);
// }
// };

// checkToken();

// try {
// const storedToken = await AsyncStorage.getItem("userToken");
// if (storedToken) {
// // If there's a token, try to refresh the user's session
// const credential = auth.GoogleAuthProvider.credential(storedToken);
// const refreshedUser = await auth().signInWithCredential(credential);
// setUser(refreshedUser);
// }
// } catch (error) {
// console.error("Error checking token:", error);
// }
// };
// checkToken();
// Listen for changes in authentication state
// const unsubscribe = auth().onAuthStateChanged((newUser) => {
// if (newUser) {
Expand All @@ -80,22 +116,76 @@ export default function App() {
// });

// return () => unsubscribe();

// check if AppleHealthKit is Avaliable for use in the app
findHealthData()
.catch(error => {
console.error(error);
});

requestHealthKitAuthorization()
.catch(error => {
console.error(error)
});

readHeartRateData()
.catch(error => {
console.error(error)
});

getHeartRateVariabilityData()
.catch(error => {
console.error(error);
});

// these methods don't crash the app
getRestingHeartRateData()
.catch(error => {
console.error(error);
});

getSleepData()
.catch(error => {
console.error(error);
});

getActivityRingsData()
.catch(error => {
console.error(error);
})

}, []);

return (
<>
{!isLoading && (
<SafeAreaView style={{ flex: 1 }}>
<StoreProvider store={store}>
<PaperProvider theme={AppTheme}>
<NavigationContainer>
<AppRouter />
</NavigationContainer>
<AppToast />
</PaperProvider>
</StoreProvider>
</SafeAreaView>
)}
</>
);
return (
<>
{!isLoading && (
<SafeAreaView style={{ flex: 1 }}>
<StoreProvider store={store}>
<PaperProvider theme={AppTheme}>
<NavigationContainer>
<AppRouter />
</NavigationContainer>
<AppToast />
</PaperProvider>
</StoreProvider>
</SafeAreaView>
)}
</>
);
}

// const styles = StyleSheet.create({
// title: {
// marginTop: 50
// },
// container: {
// flex: 1,
// justifyContent: 'center',
// alignItems: 'center',
// },
// text: {
// textAlign: 'center',
// fontSize: 16, // You can adjust the font size as needed
// // Add more styles if necessary
// },
// });
18 changes: 14 additions & 4 deletions SmartClothingApp/app.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"expo": {
"name": "SmartClothingApp",
"slug": "SmartClothingApp",
"slug": "smart-clothing-app",
"version": "1.0.0",
// "owner": "arcs", // it was causing "ApiV2Error: Entity Not Authorized." expo app error, so temporarily removed it
"owner": "vaiterius",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
Expand All @@ -18,7 +18,11 @@
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.arcs.smartclothingapp"
"bundleIdentifier": "com.arcs.smartclothingapp",
"infoPlist": {
"NSHealthShareUsageDescription": "This app needs access to your health data to track fitness activities.",
"NSHealthUpdateUsageDescription": "This app needs access to your health data to track fitness activities."
}
},
"android": {
"package": "com.arcs.smartclothingapp",
Expand All @@ -28,7 +32,13 @@
}
},
"web": {
"favicon": "./assets/favicon.png"
"favicon": "./assets/favicon.png",
"bundler": "metro"
},
"extra": {
"eas": {
"projectId": "c600d87d-0964-4d97-a260-af18bb27c115"
}
}
}
}
18 changes: 18 additions & 0 deletions SmartClothingApp/eas.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"cli": {
"version": ">= 5.3.0"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal"
},
"production": {}
},
"submit": {
"production": {}
}
}
8 changes: 8 additions & 0 deletions SmartClothingApp/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { registerRootComponent } from 'expo';

import App from './App';

// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in Expo Go or in a native build,
// the environment is set up appropriately
registerRootComponent(App);
30 changes: 30 additions & 0 deletions SmartClothingApp/ios/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
.xcode.env.local

# Bundle artifacts
*.jsbundle

# CocoaPods
/Pods/
11 changes: 11 additions & 0 deletions SmartClothingApp/ios/.xcode.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This `.xcode.env` file is versioned and is used to source the environment
# used when running script phases inside Xcode.
# To customize your local environment, you can create an `.xcode.env.local`
# file that is not versioned.

# NODE_BINARY variable contains the PATH to the node executable.
#
# Customize the NODE_BINARY variable here.
# For example, to use nvm with brew, add the following line
# . "$(brew --prefix nvm)/nvm.sh" --no-use
export NODE_BINARY=$(command -v node)
34 changes: 34 additions & 0 deletions SmartClothingApp/ios/Controller.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// Controller.m
// SmartClothingApp
//
// Created by Emi Jr Anyakpor on 3/3/24.
//

#import <Foundation/Foundation.h>
#import "React/RCTBridgeModule.h"

@interface RCT_EXTERN_MODULE(Controller, NSObject)

// Exports our requestAuthorization method in the class
RCT_EXTERN_METHOD(requestAuthorization:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)

// Exports our findHealthData method in the class
RCT_EXTERN_METHOD(findHealthData:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)

// Exports our readHeartRateData method in the class
RCT_EXTERN_METHOD(readHeartRateData:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)

// Exports our readHeartRateVariabilityData method in the class
RCT_EXTERN_METHOD(readHeartRateVariabilityData:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)

// Exports our method in the class
RCT_EXTERN_METHOD(readRestingHeartRateData:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)

// Exports our sleepData method in the class
RCT_EXTERN_METHOD(readSleepData:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)

// Exports our activity rings method
RCT_EXTERN_METHOD(readActivityRingsData:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)

@end
Loading