Skip to content

Commit 3d53ac7

Browse files
committed
chore (auth): integrate login & faceID & auth0
1 parent 0372b25 commit 3d53ac7

30 files changed

+905
-36
lines changed

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
AUTH0_DOMAIN=your-tenant.auth0.com
2+
AUTH0_CLIENT_ID=your-client-id

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,9 @@ yarn-error.log
7474
!.yarn/sdks
7575
!.yarn/versions
7676

77+
# Environment variables
78+
.env
79+
.env.local
80+
.env.*.local
81+
7782
/plans

App.tsx

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,35 @@
1-
import React from 'react';
2-
import { StatusBar } from 'react-native';
1+
import React, { useEffect } from 'react';
2+
import { ActivityIndicator, StatusBar, View } from 'react-native';
33
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
44

55
import { useIsDarkMode } from 'hooks/preferenceHooks';
66

77
import { AppNavigator } from './src/navigation';
8+
import { useAuthStore } from './src/stores/authStore';
89
import { makeStyles, ThemeProvider } from './src/theme/ThemeContext';
910

1011
import './src/utils/localStorage';
1112

1213
function AppContainer() {
1314
const isDarkMode = useIsDarkMode();
1415
const styles = useStyles();
16+
const { checkAuth, isLoading } = useAuthStore();
17+
18+
useEffect(() => {
19+
// Check authentication state on app launch
20+
checkAuth();
21+
}, [checkAuth]);
1522

1623
return (
1724
<SafeAreaView edges={['top', 'bottom']} style={styles.container}>
1825
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
19-
<AppNavigator />
26+
{isLoading ? (
27+
<View style={styles.loadingContainer}>
28+
<ActivityIndicator size="large" />
29+
</View>
30+
) : (
31+
<AppNavigator />
32+
)}
2033
</SafeAreaView>
2134
);
2235
}
@@ -37,6 +50,12 @@ const useStyles = makeStyles(({ colors }) => ({
3750
backgroundColor: colors.background,
3851
paddingBottom: 0,
3952
},
53+
loadingContainer: {
54+
flex: 1,
55+
justifyContent: 'center',
56+
alignItems: 'center',
57+
backgroundColor: colors.background,
58+
},
4059
}));
4160

4261
export default App;

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Aussie React Native Demo
32

43
Demo mobile app scaffold for Aussie, built with **React Native v0.80.0**. It showcases navigation, theming, global state management, persisted storage, testing, and CI wiring that you can expand into a production-ready app.
@@ -89,19 +88,23 @@ src
8988
## Running Tests
9089

9190
### Unit Tests
91+
9292
Run `yarn test`
9393

94-
||
95-
| -- |
96-
|![Home screen](documents/assets/unit-test.png)|
94+
| |
95+
| ---------------------------------------------- |
96+
| ![Home screen](documents/assets/unit-test.png) |
9797

9898
### E2E Tests
99+
99100
Run Detox end-to-end tests on iOS:
101+
100102
```bash
101103
yarn run detox:test:ios
102104
```
103105

104106
E2E tests cover:
107+
105108
- App launch and basic UI verification
106109
- Tab navigation across all 5 tabs
107110
- Screen content and interactions for all 6 screens

android/app/src/main/AndroidManifest.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
22

33
<uses-permission android:name="android.permission.INTERNET" />
4+
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
5+
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
46

57
<application
68
android:name=".MainApplication"
@@ -21,6 +23,12 @@
2123
<action android:name="android.intent.action.MAIN" />
2224
<category android:name="android.intent.category.LAUNCHER" />
2325
</intent-filter>
26+
<intent-filter>
27+
<action android:name="android.intent.action.VIEW" />
28+
<category android:name="android.intent.category.DEFAULT" />
29+
<category android:name="android.intent.category.BROWSABLE" />
30+
<data android:scheme="aussie" />
31+
</intent-filter>
2432
</activity>
2533
</application>
2634
</manifest>

babel.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,19 @@ module.exports = {
1717
stores: './src/stores',
1818
theme: './src/theme',
1919
api: './src/api',
20+
config: './src/config',
2021
},
2122
},
2223
],
24+
[
25+
'module:react-native-dotenv',
26+
{
27+
moduleName: '@env',
28+
path: '.env',
29+
safe: false,
30+
allowUndefined: true,
31+
},
32+
],
2333
'react-native-worklets/plugin',
2434
],
2535
};

eslint.config.mjs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ export default [
4848
version: 'detect',
4949
},
5050
'import/internal-regex':
51-
'^@(?:api|components|hooks|navigation|screens|stores|theme|types|utils)(/|$)',
51+
'^@(?:api|components|hooks|navigation|screens|stores|theme|types|utils|env)(/|$)',
5252
'import/resolver': {
5353
typescript: {
5454
project: './tsconfig.json',
55+
alwaysTryTypes: true,
5556
},
5657
node: {
5758
extensions: ['.js', '.jsx', '.ts', '.tsx'],
@@ -66,6 +67,12 @@ export default [
6667
...reactHooksPlugin.configs.recommended.rules,
6768
...reactNativePlugin.configs.all.rules,
6869
...importPlugin.configs.recommended.rules,
70+
'import/no-unresolved': [
71+
'error',
72+
{
73+
ignore: ['^@env$'],
74+
},
75+
],
6976
'@typescript-eslint/no-require-imports': [
7077
'error',
7178
{
@@ -95,7 +102,7 @@ export default [
95102
groups: [
96103
['^react', '^@?\\w'],
97104
[
98-
'^(components|hooks|navigation|screens|stores|theme|types|utils|services)(/.*|$)',
105+
'^(components|hooks|navigation|screens|stores|theme|types|utils|services|config)(/.*|$)',
99106
],
100107
[
101108
'^\\.\\.(?!/?$)',

ios/Aussie.xcodeproj/project.pbxproj

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,14 @@
201201
inputFileListPaths = (
202202
"${PODS_ROOT}/Target Support Files/Pods-Aussie/Pods-Aussie-frameworks-${CONFIGURATION}-input-files.xcfilelist",
203203
);
204+
inputPaths = (
205+
);
204206
name = "[CP] Embed Pods Frameworks";
205207
outputFileListPaths = (
206208
"${PODS_ROOT}/Target Support Files/Pods-Aussie/Pods-Aussie-frameworks-${CONFIGURATION}-output-files.xcfilelist",
207209
);
210+
outputPaths = (
211+
);
208212
runOnlyForDeploymentPostprocessing = 0;
209213
shellPath = /bin/sh;
210214
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Aussie/Pods-Aussie-frameworks.sh\"\n";
@@ -240,10 +244,14 @@
240244
inputFileListPaths = (
241245
"${PODS_ROOT}/Target Support Files/Pods-Aussie/Pods-Aussie-resources-${CONFIGURATION}-input-files.xcfilelist",
242246
);
247+
inputPaths = (
248+
);
243249
name = "[CP] Copy Pods Resources";
244250
outputFileListPaths = (
245251
"${PODS_ROOT}/Target Support Files/Pods-Aussie/Pods-Aussie-resources-${CONFIGURATION}-output-files.xcfilelist",
246252
);
253+
outputPaths = (
254+
);
247255
runOnlyForDeploymentPostprocessing = 0;
248256
shellPath = /bin/sh;
249257
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Aussie/Pods-Aussie-resources.sh\"\n";
@@ -388,10 +396,7 @@
388396
"-DFOLLY_CFG_NO_COROUTINES=1",
389397
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
390398
);
391-
OTHER_LDFLAGS = (
392-
"$(inherited)",
393-
" ",
394-
);
399+
OTHER_LDFLAGS = "$(inherited) ";
395400
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
396401
SDKROOT = iphoneos;
397402
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
@@ -460,10 +465,7 @@
460465
"-DFOLLY_CFG_NO_COROUTINES=1",
461466
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
462467
);
463-
OTHER_LDFLAGS = (
464-
"$(inherited)",
465-
" ",
466-
);
468+
OTHER_LDFLAGS = "$(inherited) ";
467469
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
468470
SDKROOT = iphoneos;
469471
USE_HERMES = true;

ios/Aussie/Info.plist

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@
6363
<string>aussie</string>
6464
</array>
6565
</dict>
66+
<dict>
67+
<key>CFBundleURLName</key>
68+
<string>auth0</string>
69+
<key>CFBundleURLSchemes</key>
70+
<array>
71+
<string>$(PRODUCT_BUNDLE_IDENTIFIER).auth0</string>
72+
</array>
73+
</dict>
6674
</array>
75+
<key>NSFaceIDUsageDescription</key>
76+
<string>Use Face ID to securely access your account</string>
6777
</dict>
6878
</plist>

ios/Podfile.lock

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
PODS:
2+
- A0Auth0 (3.2.1):
3+
- Auth0 (= 2.7.2)
4+
- JWTDecode (= 3.1.0)
5+
- React-Core
6+
- SimpleKeychain (= 1.1.0)
7+
- Auth0 (2.7.2):
8+
- JWTDecode (~> 3.1)
9+
- SimpleKeychain (~> 1.1)
210
- boost (1.84.0)
311
- DoubleConversion (1.1.6)
412
- fast_float (8.0.0)
@@ -8,6 +16,7 @@ PODS:
816
- hermes-engine (0.80.0):
917
- hermes-engine/Pre-built (= 0.80.0)
1018
- hermes-engine/Pre-built (0.80.0)
19+
- JWTDecode (3.1.0)
1120
- MMKV (1.3.14):
1221
- MMKVCore (~> 1.3.14)
1322
- MMKVCore (1.3.14)
@@ -1651,6 +1660,8 @@ PODS:
16511660
- React-RCTFBReactNativeSpec
16521661
- ReactCommon/turbomodule/core
16531662
- SocketRocket
1663+
- react-native-biometrics (3.0.1):
1664+
- React-Core
16541665
- react-native-mmkv-storage (12.0.0):
16551666
- boost
16561667
- DoubleConversion
@@ -2246,6 +2257,8 @@ PODS:
22462257
- React-perflogger (= 0.80.0)
22472258
- React-utils (= 0.80.0)
22482259
- SocketRocket
2260+
- RNKeychain (8.2.0):
2261+
- React-Core
22492262
- RNReanimated (4.1.5):
22502263
- boost
22512264
- DoubleConversion
@@ -2517,10 +2530,12 @@ PODS:
25172530
- ReactCommon/turbomodule/core
25182531
- SocketRocket
25192532
- Yoga
2533+
- SimpleKeychain (1.1.0)
25202534
- SocketRocket (0.7.1)
25212535
- Yoga (0.0.0)
25222536

25232537
DEPENDENCIES:
2538+
- A0Auth0 (from `../node_modules/react-native-auth0`)
25242539
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
25252540
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
25262541
- fast_float (from `../node_modules/react-native/third-party-podspecs/fast_float.podspec`)
@@ -2562,6 +2577,7 @@ DEPENDENCIES:
25622577
- React-logger (from `../node_modules/react-native/ReactCommon/logger`)
25632578
- React-Mapbuffer (from `../node_modules/react-native/ReactCommon`)
25642579
- React-microtasksnativemodule (from `../node_modules/react-native/ReactCommon/react/nativemodule/microtasks`)
2580+
- react-native-biometrics (from `../node_modules/react-native-biometrics`)
25652581
- react-native-mmkv-storage (from `../node_modules/react-native-mmkv-storage`)
25662582
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
25672583
- "react-native-vector-icons-ionicons (from `../node_modules/@react-native-vector-icons/ionicons`)"
@@ -2596,6 +2612,7 @@ DEPENDENCIES:
25962612
- ReactAppDependencyProvider (from `build/generated/ios`)
25972613
- ReactCodegen (from `build/generated/ios`)
25982614
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
2615+
- RNKeychain (from `../node_modules/react-native-keychain`)
25992616
- RNReanimated (from `../node_modules/react-native-reanimated`)
26002617
- RNScreens (from `../node_modules/react-native-screens`)
26012618
- RNVectorIcons (from `../node_modules/react-native-vector-icons`)
@@ -2605,11 +2622,16 @@ DEPENDENCIES:
26052622

26062623
SPEC REPOS:
26072624
trunk:
2625+
- Auth0
2626+
- JWTDecode
26082627
- MMKV
26092628
- MMKVCore
2629+
- SimpleKeychain
26102630
- SocketRocket
26112631

26122632
EXTERNAL SOURCES:
2633+
A0Auth0:
2634+
:path: "../node_modules/react-native-auth0"
26132635
boost:
26142636
:podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec"
26152637
DoubleConversion:
@@ -2691,6 +2713,8 @@ EXTERNAL SOURCES:
26912713
:path: "../node_modules/react-native/ReactCommon"
26922714
React-microtasksnativemodule:
26932715
:path: "../node_modules/react-native/ReactCommon/react/nativemodule/microtasks"
2716+
react-native-biometrics:
2717+
:path: "../node_modules/react-native-biometrics"
26942718
react-native-mmkv-storage:
26952719
:path: "../node_modules/react-native-mmkv-storage"
26962720
react-native-safe-area-context:
@@ -2759,6 +2783,8 @@ EXTERNAL SOURCES:
27592783
:path: build/generated/ios
27602784
ReactCommon:
27612785
:path: "../node_modules/react-native/ReactCommon"
2786+
RNKeychain:
2787+
:path: "../node_modules/react-native-keychain"
27622788
RNReanimated:
27632789
:path: "../node_modules/react-native-reanimated"
27642790
RNScreens:
@@ -2771,13 +2797,16 @@ EXTERNAL SOURCES:
27712797
:path: "../node_modules/react-native/ReactCommon/yoga"
27722798

27732799
SPEC CHECKSUMS:
2800+
A0Auth0: 3e5033500f199020186a42c49020ecd508a72b27
2801+
Auth0: 28cb24cb19ebd51f0b07751f16d83b59f4019532
27742802
boost: 7e761d76ca2ce687f7cc98e698152abd03a18f90
27752803
DoubleConversion: cb417026b2400c8f53ae97020b2be961b59470cb
27762804
fast_float: b32c788ed9c6a8c584d114d0047beda9664e7cc6
27772805
FBLazyVector: 778b815a6fb3fa1599f581ffb9a5e85fad313c1d
27782806
fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd
27792807
glog: 5683914934d5b6e4240e497e0f4a3b42d1854183
27802808
hermes-engine: 7068e976238b29e97b3bafd09a994542af7d5c0b
2809+
JWTDecode: 3eaab1e06b6f4dcbdd6716aff09ba4c2104ca8b7
27812810
MMKV: 7b5df6a8bf785c6705cc490c541b9d8a957c4a64
27822811
MMKVCore: 3f40b896e9ab522452df9df3ce983471aa2449ba
27832812
RCT-Folly: 846fda9475e61ec7bcbf8a3fe81edfcaeb090669
@@ -2813,6 +2842,7 @@ SPEC CHECKSUMS:
28132842
React-logger: dce52a571ba0e0149c3f0fcc6866cbc0c8552c5e
28142843
React-Mapbuffer: f5754c33877eaf36e4c76c613b35615a181c85c5
28152844
React-microtasksnativemodule: 23df6374a3ac422d8c2927839bcaeed61fee3dad
2845+
react-native-biometrics: 43ed5b828646a7862dbc7945556446be00798e7d
28162846
react-native-mmkv-storage: 7ac16fe076d9db08283fb6478a46939d4790a409
28172847
react-native-safe-area-context: 01f6d357d42395422eed7c3bfe715614728f2989
28182848
react-native-vector-icons-ionicons: ad07e944a092a5cf71b8b569d8f5ce2bf674c415
@@ -2847,10 +2877,12 @@ SPEC CHECKSUMS:
28472877
ReactAppDependencyProvider: 3267432b637c9b38e86961b287f784ee1b08dde0
28482878
ReactCodegen: 5d41e1df061200130dd326e55cdfdf94b0289c6e
28492879
ReactCommon: b028d09a66e60ebd83ca59d8cc9a1216360db147
2880+
RNKeychain: bbe2f6d5cc008920324acb49ef86ccc03d3b38e4
28502881
RNReanimated: d9b3c88b7a722ce8129ca8c96abd06d822ed315e
28512882
RNScreens: f35bcc83b6e3a871635b1c28728e63c9560f159a
28522883
RNVectorIcons: be4d047a76ad307ffe54732208fb0498fcb8477f
28532884
RNWorklets: 7fb44cd32a491df4a4832cce2f3b0aaaf813956d
2885+
SimpleKeychain: f8707c8e97b38c6a6e687b17732afc9bcef06439
28542886
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
28552887
Yoga: 0c4b7d2aacc910a1f702694fa86be830386f4ceb
28562888

0 commit comments

Comments
 (0)