Skip to content

Commit 9b951af

Browse files
authored
Merge pull request #53 from ClinicianFOCUS/dev
2 parents 180844c + df492b2 commit 9b951af

13 files changed

+312
-108
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ expo-env.d.ts
2121
.aider*
2222
build*
2323
android/
24+
ios/

README.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,19 @@ This is an [Expo](https://expo.dev) project created with [`create-expo-app`](htt
2828

2929
### For Android
3030

31-
1. Build APK (For Development Only)
31+
1. Start Project
3232

3333
```bash
34-
eas build --profile development --platform android --local
34+
npm run android
3535
```
3636

37-
Here, `development` is the name of the profile in eas.json file. Adding `--local` flag will build apk locally.
38-
39-
Note: Will need to rebuild if any natvie code changes are made (Like new package installed).
37+
This will create a development build and start the application in emulator and connected android device.
4038

41-
2. Start Project
39+
2. If you made any changes to `app.json` that impacts the native project, modified native code or configuration or install a library from npm, you need to run prebuild command.
4240
```bash
43-
npm run android
41+
npx expo prebuild --clean
4442
```
45-
This will start the application in emulator and connected android device.
43+
And create a new development build following step 1.
4644

4745
### For iOS (TODO)
4846

app/(tabs)/home.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import CustomModal from '@/components/CustomModal';
99
import LoginInfo from '@/components/info/loginInfo';
1010
import HomeInfo from '@/components/info/homeInfo';
1111
import FetchTokenInfo from '@/components/info/fetchTokenInfo';
12+
import { SecureKeyStore } from '@/services/SecureKeyStore';
13+
import { CustomKeyType } from '@/types/types';
14+
import { Redirect } from 'expo-router';
1215

1316
const App = () => {
1417
// Get authentication state from AuthManager store
@@ -30,6 +33,9 @@ const App = () => {
3033

3134
// Show if user credentials are not provided
3235
if (!hasUserCredentials) {
36+
if (!SecureKeyStore.getKey(CustomKeyType.O19_BASE_URL)) {
37+
return <Redirect href="/setting" />;
38+
}
3339
return (
3440
<View style={styles.container}>
3541
<Login />

app/(tabs)/setting.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ const SettingPage = () => {
6666
placeholder="Enter Base Url"
6767
style={styles.input}
6868
/>
69+
<View>
70+
<Text style={styles.paragraph}>
71+
Note: Base URL required before proceeding to Login
72+
</Text>
73+
<Text style={styles.paragraph}>Valid URL: https://example.com</Text>
74+
<Text style={styles.paragraph}>Invalid URL: https://example.com/</Text>
75+
</View>
6976
<Button title="Save" onPress={handleSave} />
7077
<CustomModal title="Setting Information">
7178
<SettingInfo />
@@ -91,6 +98,11 @@ const styles = StyleSheet.create({
9198
display: 'flex',
9299
gap: 10,
93100
},
101+
paragraph: {
102+
color: '#666',
103+
lineHeight: 22,
104+
fontSize: 12,
105+
},
94106
});
95107

96108
export default SettingPage;

app/_layout.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default function RootLayout() {
2626
options={{ headerTitle: 'Patient Detail' }}
2727
/>
2828

29-
<Stack.Screen name="callback" options={{ headerTitle: 'Callback' }} />
29+
<Stack.Screen name="callback" options={{ headerShown: false }} />
3030
</Stack>
3131
);
3232
}

app/index.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useAuthManagerStore } from '@/store/useAuthManagerStore';
55
import { SecureKeyStore } from '@/services/SecureKeyStore';
66
import { CustomKeyType } from '@/types/types';
77
import TermsAndConditions from './termsAndCondition';
8+
import WelcomeScreen from './welcome';
89

910
/**
1011
* The main application component.
@@ -21,6 +22,7 @@ const App = () => {
2122
const { isAuthenticated, routeToReturn } = useAuthManagerStore();
2223

2324
const [hasAcceptedTerms, setHasAcceptedTerms] = useState<boolean>(false);
25+
const [showTerms, setShowTerms] = useState<boolean>(false);
2426

2527
// Check if the user has accepted the terms and conditions
2628
useEffect(() => {
@@ -31,10 +33,14 @@ const App = () => {
3133
// If the user is not authenticated, show the AppLocked component
3234
if (!isAuthenticated) return <AppLocked />;
3335

34-
// If the user has not accepted the terms and conditions, show the TermsAndConditions component
35-
if (!hasAcceptedTerms)
36+
// Clicking on the "Next" button in the Welcome Screen will show the TermsAndConditions component
37+
if (!hasAcceptedTerms && showTerms)
3638
return <TermsAndConditions setHasAcceptedTerms={setHasAcceptedTerms} />;
3739

40+
// If the user has not accepted the terms and conditions, show Welcome Screen followed by TermsAndConditions component
41+
if (!hasAcceptedTerms)
42+
return <WelcomeScreen onNext={() => setShowTerms(true)} />;
43+
3844
return <Redirect href={routeToReturn ? (routeToReturn as any) : '/home'} />;
3945
};
4046

app/patient-detail/[id]/appointment.tsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ const PatientAppointment = () => {
100100
Appointment History
101101
</Text>
102102
<View>
103-
<TouchableOpacity onPress={fetchData}>
104-
<Ionicons name="refresh" size={36} color="black" />
103+
<TouchableOpacity style={styles.refreshButton} onPress={fetchData}>
104+
<Ionicons name="refresh" size={24} color="white" />
105105
</TouchableOpacity>
106106
</View>
107107
</View>
@@ -172,6 +172,11 @@ const styles = StyleSheet.create({
172172
table: {
173173
maxHeight: '42%',
174174
},
175+
refreshButton: {
176+
backgroundColor: '#007bff',
177+
padding: 8,
178+
borderRadius: 8,
179+
},
175180
});
176181

177182
export default PatientAppointment;

app/welcome.tsx

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
import React from 'react';
2+
import { SafeAreaView, Text, StyleSheet, View, Button } from 'react-native';
3+
4+
interface WelcomeScreenProps {
5+
onNext: () => void;
6+
}
7+
8+
/**
9+
* WelcomeScreen component displays a welcome message and an overview of the Open-O-Connect app's features.
10+
*
11+
* @component
12+
* @param {WelcomeScreenProps} props - The props for the WelcomeScreen component.
13+
* @param {function} props.onNext - Callback function to be called when the "Next" button is pressed.
14+
*
15+
* @returns {JSX.Element} The rendered WelcomeScreen component.
16+
*
17+
* @example
18+
* <WelcomeScreen onNext={handleNext} />
19+
*
20+
* @remarks
21+
* This screen provides an introduction to the app and lists the main features available to the user.
22+
* It also includes a note about the info button available on each screen for additional help.
23+
*/
24+
const WelcomeScreen: React.FC<WelcomeScreenProps> = ({ onNext }) => {
25+
return (
26+
<SafeAreaView style={styles.container}>
27+
<Text style={styles.title}>Welcome to Open-O-Connect</Text>
28+
<Text style={styles.description}>
29+
Open-O-Connect is a mobile app that integrates with O19, making it
30+
easier for users to access O19's functions on their cell phones. Our
31+
current features include:
32+
</Text>
33+
<View style={styles.featuresList}>
34+
<Text style={styles.feature}>1. View today's appointments</Text>
35+
<Text style={styles.feature}>
36+
2. Access patient information and their appointment history
37+
</Text>
38+
<Text style={styles.feature}>
39+
3. Upload pictures to patient demographics
40+
</Text>
41+
</View>
42+
<Text style={styles.note}>
43+
On each screen, there is an info button in the top right corner. Use
44+
this button to get information about the current screen's functionality.
45+
</Text>
46+
<View style={styles.buttonContainer}>
47+
<Button title="Next" onPress={onNext} />
48+
</View>
49+
</SafeAreaView>
50+
);
51+
};
52+
53+
const styles = StyleSheet.create({
54+
container: {
55+
flex: 1,
56+
justifyContent: 'center',
57+
alignItems: 'center',
58+
padding: 30,
59+
backgroundColor: '#f5f5f5',
60+
},
61+
title: {
62+
fontSize: 26,
63+
fontWeight: 'bold',
64+
marginBottom: 20,
65+
color: '#333',
66+
},
67+
subtitle: {
68+
fontSize: 16,
69+
color: '#6c757d',
70+
marginBottom: 20,
71+
},
72+
description: {
73+
fontSize: 16,
74+
color: '#333',
75+
marginBottom: 20,
76+
lineHeight: 22,
77+
},
78+
featuresList: {
79+
alignItems: 'flex-start',
80+
marginBottom: 20,
81+
},
82+
feature: {
83+
fontSize: 16,
84+
color: '#333',
85+
marginBottom: 10,
86+
},
87+
note: {
88+
fontSize: 14,
89+
color: '#6c757d',
90+
marginBottom: 20,
91+
lineHeight: 20,
92+
},
93+
buttonContainer: {
94+
width: '100%',
95+
paddingHorizontal: 40,
96+
},
97+
});
98+
99+
export default WelcomeScreen;

0 commit comments

Comments
 (0)