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

Aliases import #35

Merged
merged 4 commits into from
Aug 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions aliases.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
assets: './src/assets',
components: './src/components',
constants: './src/constants',
hooks: './src/hooks',
navigation: './src/navigation',
providers: './src/providers',
services: './src/services',
theme: './src/theme'
};
37 changes: 37 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const alias = require('./aliases.config.js');

module.exports = {
presets: [
'module:metro-react-native-babel-preset',
Expand All @@ -9,3 +11,38 @@ module.exports = {
}
}
};

module.exports = api => {
api.cache(false);
return {
presets: [
'module:metro-react-native-babel-preset',
'module:react-native-dotenv'
],
env: {
development: {
plugins: [
[
'module-resolver',
{
root: ['./src'],
alias
}
]
]
},
production: {
plugins: [
'transform-remove-console',
[
'module-resolver',
{
root: ['./src'],
alias
}
]
]
}
}
};
};
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {AppRegistry} from 'react-native';
import App from './App';

import App from './src/App';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);
70 changes: 35 additions & 35 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ PODS:
- React-cxxreact (= 0.62.2)
- React-jsi (= 0.62.2)
- React-jsinspector (0.62.2)
- react-native-exposure-notification-service (1.1.15):
- react-native-exposure-notification-service (1.1.16):
- Alamofire (~> 5.2)
- KeychainSwift (~> 19.0)
- React
Expand Down Expand Up @@ -321,7 +321,7 @@ PODS:
DEPENDENCIES:
- Alamofire (~> 5.2)
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- EXConstants (from `../node_modules/expo-constants/ios`)
- EXConstants (from `../node_modules/react-native-unimodules/node_modules/expo-constants/ios`)
- EXCrypto (from `../node_modules/expo-crypto/ios`)
- EXFileSystem (from `../node_modules/expo-file-system/ios`)
- EXFont (from `../node_modules/expo-font/ios`)
Expand Down Expand Up @@ -398,7 +398,7 @@ EXTERNAL SOURCES:
DoubleConversion:
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
EXConstants:
:path: "../node_modules/expo-constants/ios"
:path: "../node_modules/react-native-unimodules/node_modules/expo-constants/ios"
EXCrypto:
:path: "../node_modules/expo-crypto/ios"
EXFileSystem:
Expand Down Expand Up @@ -522,22 +522,22 @@ SPEC CHECKSUMS:
Alamofire: e911732990610fe89af59ac0077f923d72dc3dfd
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2
EXConstants: 5304709b1bea70a4828f48ba4c7fc3ec3b2d9b17
EXCrypto: 867e1d45d513e39ab9d7706232435edb1cf756cd
EXFileSystem: cf4232ba7c62dc49b78c2d36005f97b6fddf0b01
EXFont: e583875d5d37a9e272d1cdba7f383bd576952919
EXHaptics: 013b5065946d4dd7b46ea547b58072d45a206dbd
EXImageLoader: 5ad6896fa1ef2ee814b551873cbf7a7baccc694a
EXLocalization: b5bcfc925ed83123b585d46d3bd54d7b7118f307
EXPermissions: 24b97f734ce9172d245a5be38ad9ccfcb6135964
EXSecureStore: 7a03e21e80ae59bf8e86c55e7a400f60db2da639
EXWebBrowser: 5902f99ac5ac551e5c82ff46f13a337b323aa9ea
EXConstants: 9f18e9ef229706394f41735d9c7f309d479b36c0
EXCrypto: 84a96afc7bb083729d86b934a5e1633d67a3ddc0
EXFileSystem: b82693d78de152efe10a77d4aac781f782e10916
EXFont: 5c464ce400b92f87f907d68093c29946177295bf
EXHaptics: 3e6a4a40d87b230ffe1fafe298393ab6f3b8e10d
EXImageLoader: 5c9d1bf408443ac4d4f44463eaf3b0d03bc70425
EXLocalization: 2c66021723ee3d91b7ce2627cc27979ddd648fe7
EXPermissions: d2cafee9c72578ecc9ca121481e6c4a04a798861
EXSecureStore: b31ab621ceaee41090da9220ddc041a9186e37b5
EXWebBrowser: 6364e9e1ea73f6c3c2e6e3cc0ac17259a260e3a8
FBLazyVector: 4aab18c93cd9546e4bfed752b4084585eca8b245
FBReactNativeSpec: 5465d51ccfeecb7faa12f9ae0024f2044ce4044e
Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51
glog: 1f3da668190260b06b429bb211bfbee5cd790c28
KeychainSwift: a06190cf933ad46b1e0abc3d77d29c06331715c7
Permission-Notifications: 231d0e1db2300b686548587d384ba414e6a93332
Permission-Notifications: 5ecb0f433b585c5621dc30b168772d60ae8574c2
RCTRequired: cec6a34b3ac8a9915c37e7e4ad3aa74726ce4035
RCTTypeSafety: 93006131180074cffa227a1075802c89a49dd4ce
React: 29a8b1a02bd764fb7644ef04019270849b9a7ac3
Expand All @@ -547,9 +547,9 @@ SPEC CHECKSUMS:
React-jsi: b6dc94a6a12ff98e8877287a0b7620d365201161
React-jsiexecutor: 1540d1c01bb493ae3124ed83351b1b6a155db7da
React-jsinspector: 512e560d0e985d0e8c479a54a4e5c147a9c83493
react-native-exposure-notification-service: a3549bb2ef087e96f1c6c1a889004b2b583975f5
react-native-netinfo: a53b00d949b6456913aaf507d9dba90c4008c611
react-native-safe-area-context: 45e98227f3d65b31d384a5d0950aec4bf73a884c
react-native-exposure-notification-service: 5b6b8a5db689c59796c4b24ccf8354a13364c7f2
react-native-netinfo: 7f3f3ed9e8f0e7ab3e7cac00cbfdc6997e25ecaf
react-native-safe-area-context: 7371751a75e1ca7211f17ea0730ffcb264e2f85c
React-RCTActionSheet: f41ea8a811aac770e0cc6e0ad6b270c644ea8b7c
React-RCTAnimation: 49ab98b1c1ff4445148b72a3d61554138565bad0
React-RCTBlob: a332773f0ebc413a0ce85942a55b064471587a71
Expand All @@ -560,29 +560,29 @@ SPEC CHECKSUMS:
React-RCTText: fae545b10cfdb3d247c36c56f61a94cfd6dba41d
React-RCTVibration: 4356114dbcba4ce66991096e51a66e61eda51256
ReactCommon: ed4e11d27609d571e7eee8b65548efc191116eb3
RNCAsyncStorage: d059c3ee71738c39834a627476322a5a8cd5bf36
RNCMaskedView: 5a8ec07677aa885546a0d98da336457e2bea557f
RNCPushNotificationIOS: dc1c0c6aa18a128df123598149f42e848d26a4ac
RNCAsyncStorage: db711e29e5e0500d9bd21aa0c2e397efa45302b1
RNCMaskedView: f5c7d14d6847b7b44853f7acb6284c1da30a3459
RNCPushNotificationIOS: f4a1a20fe1d70bbb1fab6abf86ffec2996012b12
RNGestureHandler: b6b359bb800ae399a9c8b27032bdbf7c18f08a08
RNIOS11DeviceCheck: a4a545fdd08230a17a8ce7608e95038ee23a32aa
RNPermissions: ad71dd4f767ec254f2cd57592fbee02afee75467
RNIOS11DeviceCheck: d525b786c29d2793f8534bd3a321998a7a827a5f
RNPermissions: 1888705aebcc81714efa5dbff94351e4388ae012
RNScreens: 62211832af51e0aebcf6e8c36bcf7dd65592f244
RNSslPinning: bd33a1849ec20d38b4c5cd67e6a52b83da0ab3bc
RNSVG: f6177f8d7c095fada7cfee2e4bb7388ba426064c
SSZipArchive: 62d4947b08730e4cda640473b0066d209ff033c9
UMAppLoader: ee77a072f9e15128f777ccd6d2d00f52ab4387e6
UMBarCodeScannerInterface: 9dc692b87e5f20fe277fa57aa47f45d418c3cc6c
UMCameraInterface: 625878bbf2ba188a8548675e1d1d2e438a653e6d
UMConstantsInterface: 64060cf86587bcd90b1dbd804cceb6d377a308c1
UMCore: eb200e882eadafcd31ead290770835fd648c0945
UMFaceDetectorInterface: d6677d6ddc9ab95a0ca857aa7f8ba76656cc770f
UMFileSystemInterface: c70ea7147198b9807080f3597f26236be49b0165
UMFontInterface: d9d3b27af698c5389ae9e20b99ef56a083f491fb
UMImageLoaderInterface: 14dd2c46c67167491effc9e91250e9510f12709e
UMPermissionsInterface: 5e83a9167c177e4a0f0a3539345983cc749efb3e
UMReactNativeAdapter: 126da3486c1a1f11945b649d557d6c2ebb9407b2
UMSensorsInterface: 48941f70175e2975af1a9386c6d6cb16d8126805
UMTaskManagerInterface: cb890c79c63885504ddc0efd7a7d01481760aca2
UMAppLoader: ae5eaee9f3c8cc847c631a579fed20d217de5913
UMBarCodeScannerInterface: aa3409ab9d108866e55c09ad0292e4a6c08a7775
UMCameraInterface: 9d5da92c521e0af7815afbf77ea19bd0312b4928
UMConstantsInterface: 4a1d3062a89421d3290bbe8f75efabd849935bea
UMCore: cb544737bc72ecfccae9dd476e4d647468b4ebd0
UMFaceDetectorInterface: c6d69c914426fc29f5a2442411a575e887adb823
UMFileSystemInterface: bee6c9ca4f3d70da5f7c9752efc8b3f3a7f47b61
UMFontInterface: 884955c5fd329095e2072d16de9b5bf1bce93005
UMImageLoaderInterface: 3781f05d7e0be1c5b00dd3cc9c390b94d8484300
UMPermissionsInterface: a3c5910e28a5ec31810dbfd1936e4948a4439310
UMReactNativeAdapter: e936c48fd15114cd1d5b06310797198a06f72ca0
UMSensorsInterface: fc92b1f92202166284ca0f95e0acc1daab5d16a8
UMTaskManagerInterface: 4e6c4c34a89512e2225d336154df1cb689226a29
Yoga: 3ebccbdd559724312790e7742142d062476b698e

PODFILE CHECKSUM: fe5332bfe94340e09768442eda194c2d51dd1b1f
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/@types/react-native-easy-markdown.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module 'react-native-easy-markdown';
1 change: 1 addition & 0 deletions src/@types/react-native-google-safetynet.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module 'react-native-google-safetynet';
1 change: 1 addition & 0 deletions src/@types/react-native-ios11-devicecheck.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module 'react-native-ios11-devicecheck';
110 changes: 49 additions & 61 deletions App.tsx → src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import React, {useEffect} from 'react';
import {enableScreens} from 'react-native-screens';
import {
Platform,
StatusBar,
Image,
View,
AppState,
StyleSheet
} from 'react-native';
import {Platform, StatusBar, Image, View, AppState} from 'react-native';
import {NavigationContainer} from '@react-navigation/native';
import {
createStackNavigator,
Expand All @@ -26,53 +19,48 @@ import {useTranslation} from 'react-i18next';
import {Asset} from 'expo-asset';
import * as Font from 'expo-font';

import './services/i18n';
import 'services/i18n';

import {ApplicationProvider, useApplication} from './providers/context';
import {ExposureProvider} from './providers/exposure';
import {PermissionsProvider} from './providers/permissions';
import {ApplicationProvider, useApplication} from 'providers/context';
import {ExposureProvider} from 'providers/exposure';
import {PermissionsProvider} from 'providers/permissions';
import {
SettingsProvider,
SettingsContext,
TraceConfiguration
} from './providers/settings';

import {Base} from './components/templates/base';
import {NavBar} from './components/atoms/navbar';
import {TabBarBottom} from './components/organisms/tab-bar-bottom';

import {Over16} from './components/views/over-16';
import {Under16} from './components/views/under-16';
import {GetStarted} from './components/views/get-started';
import {YourData} from './components/views/your-data';
import {AppUsage} from './components/views/app-usage';
import {ContactTracingInformation} from './components/views/contact-tracing-information';
import {FollowUpCall} from './components/views/follow-up-call';

import {Sorry} from './components/views/sorry';
} from 'providers/settings';

import {Base} from 'components/templates/base';
import {NavBar} from 'components/atoms/navbar';
import {TabBarBottom} from 'components/organisms/tab-bar-bottom';
import {Over16} from 'components/views/over-16';
import {Under16} from 'components/views/under-16';
import {GetStarted} from 'components/views/get-started';
import {YourData} from 'components/views/your-data';
import {AppUsage} from 'components/views/app-usage';
import {ContactTracingInformation} from 'components/views/contact-tracing-information';
import {FollowUpCall} from 'components/views/follow-up-call';
import {Sorry} from 'components/views/sorry';
import {
DataProtectionPolicy,
TermsAndConditions
} from './components/views/data-protection-policy';

import {Dashboard} from './components/views/dashboard';
import {SymptomChecker} from './components/views/symptom-checker';
import {SymptomsHistory} from './components/views/symptoms-history';
import {ContactTracing} from './components/views/contact-tracing';
import {CountyBreakdown} from './components/views/county-breakdown';
import {CloseContact} from './components/views/close-contact';
import {UploadKeys} from './components/views/upload-keys';

import {Settings} from './components/views/settings';
import {ContactTracingSettings} from './components/views/settings/contact-tracing';
import {CheckInSettings} from './components/views/settings/check-in';
import {Metrics} from './components/views/settings/metrics';
import {Leave} from './components/views/settings/leave';
import {Debug} from './components/views/settings/debug';

import {isMountedRef, navigationRef} from './navigation';
import {colors} from './constants/colors';
import {Loading} from './components/views/loading';
} from 'components/views/data-protection-policy';
import {Dashboard} from 'components/views/dashboard';
import {SymptomChecker} from 'components/views/symptom-checker';
import {SymptomsHistory} from 'components/views/symptoms-history';
import {ContactTracing} from 'components/views/contact-tracing';
import {CountyBreakdown} from 'components/views/county-breakdown';
import {CloseContact} from 'components/views/close-contact';
import {UploadKeys} from 'components/views/upload-keys';
import {Settings} from 'components/views/settings';
import {ContactTracingSettings} from 'components/views/settings/contact-tracing';
import {CheckInSettings} from 'components/views/settings/check-in';
import {Metrics} from 'components/views/settings/metrics';
import {Leave} from 'components/views/settings/leave';
import {Debug} from 'components/views/settings/debug';
import {isMountedRef, navigationRef} from 'navigation';
import {colors} from 'theme';
import {Loading} from 'components/views/loading';

enableScreens();

Expand Down Expand Up @@ -354,23 +342,23 @@ export default function App(props: {
async function loadResourcesAndDataAsync() {
try {
const imageAssets = cacheImages([
require('./assets/images/onboard1/image.png'),
require('./assets/images/onboard2/image.png'),
require('./assets/images/onboard3/image.png'),
require('./assets/images/permissions/bluetooth.png'),
require('./assets/images/permissions/notifications.png'),
require('./assets/images/logo/logo.png'),
require('./assets/images/symptoma/image.png'),
require('./assets/images/symptomb/image.png'),
require('./assets/images/symptomc/image.png'),
require('./assets/images/symptomd/image.png')
require('assets/images/onboard1/image.png'),
require('assets/images/onboard2/image.png'),
require('assets/images/onboard3/image.png'),
require('assets/images/permissions/bluetooth.png'),
require('assets/images/permissions/notifications.png'),
require('assets/images/logo/logo.png'),
require('assets/images/symptoma/image.png'),
require('assets/images/symptomb/image.png'),
require('assets/images/symptomc/image.png'),
require('assets/images/symptomd/image.png')
]);

const fonts = await Font.loadAsync({
'lato-black': require('./assets/fonts/lato/Lato-Black.ttf'),
'lato-bold': require('./assets/fonts/lato/Lato-Bold.ttf'),
lato: require('./assets/fonts/lato/Lato-Regular.ttf'),
'lato-thin': require('./assets/fonts/lato/Lato-Thin.ttf')
'lato-black': require('assets/fonts/lato/Lato-Black.ttf'),
'lato-bold': require('assets/fonts/lato/Lato-Bold.ttf'),
lato: require('assets/fonts/lato/Lato-Regular.ttf'),
'lato-thin': require('assets/fonts/lato/Lato-Thin.ttf')
});

await Promise.all([...imageAssets, fonts]);
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import {
Dimensions
} from 'react-native';

import {colors} from '../../constants/colors';
import {text, scale} from '../../theme';
import {text, scale, colors} from 'theme';

interface ButtonProps {
type?: 'default' | 'empty' | 'danger';
Expand Down
5 changes: 2 additions & 3 deletions components/atoms/card.tsx → src/components/atoms/card.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, {ReactNode, FC} from 'react';
import {StyleSheet, TouchableWithoutFeedback, View} from 'react-native';

import {colors} from '../../constants/colors';
import {shadows} from '../../theme';
import {AppIcons} from '../../assets/icons';
import {colors, shadows} from 'theme';
import {AppIcons} from 'assets/icons';

interface CardProps {
type?: 'warning';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ import {
Text,
View,
TouchableWithoutFeedback,
StyleSheet,
Image
StyleSheet
} from 'react-native';

import {DropdownModal} from './modal';
import {colors} from '../../../constants/colors';
import {Spacing} from '../spacing';
import {text} from '../../../theme';
import {AppIcons} from '../../../assets/icons';
import {Spacing} from 'components/atoms/spacing';
import {text, colors} from 'theme';
import {AppIcons} from 'assets/icons';

interface DropdownProps {
label?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ import {
import Modal, {ModalProps} from 'react-native-modal';
import {useSafeArea} from 'react-native-safe-area-context';

import {Spacing} from '../layout';

import {colors} from '../../../constants/colors';
import {text} from '../../../theme';
import Icons, {AppIcons} from '../../../assets/icons';
import {Spacing} from 'components/atoms/layout';
import {colors, text} from 'theme';
import Icons, {AppIcons} from 'assets/icons';

interface DropdownModalProps extends Partial<ModalProps> {
title: string;
Expand Down
Loading