Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
Release 6.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nzcovidtracer-dev committed Jul 29, 2021
1 parent a00dd66 commit ee2df0d
Show file tree
Hide file tree
Showing 484 changed files with 9,788 additions and 1,528 deletions.
29 changes: 22 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ PrivateDbEncryptionKeyService="unite-app-react-native-private-db-key"
# The url for the NZ COVID Tracer web app
WebAppBaseUrl=

# Domain of the api, used to construct ApiBaseUrl and ExposureEventsBaseUrl with subdomains "api" and "exposure-events"
ApiDomain=

# Optional, the base url for the app api endpoints
ApiBaseUrl=

Expand Down Expand Up @@ -61,9 +58,6 @@ CognitoIdentityPoolId=
# Cognito User pool Region.
CognitoUserPoolRegion=

# Pinpoint Region - When not specified the default value will be CognitoUserPoolRegion
PinpointRegion=

# Version of the App - which is displayed at the footer of the My Data page.
APP_VERSION=5.0
APPCENTER_BUILD_ID=1
Expand All @@ -74,4 +68,25 @@ ENFServerUrl=
# Google's SafetynetKey for Device Attestation API
SafetynetKey=

ENFCheckInterval=
ENFCheckInterval=

# URL for COVID statistics
CovidStatsUrl=

# Set "1" to list modules to support inline requires
DevLogModules=

# Asset host whitelist, comma separated, * for wild card, for e.g. https://foo.com,https://bar.com. Defaults to *
AssetWhitelist=

# Set "1" to hide all logs
HideLogs=

# URL for resources
ResourcesUrl=

# How long the success banner on Save New Location screen is shown in ms (5000 by default)
SuccessBannerDuration=

# Public key for easter egg validation
EasterEggPublicKey=
35 changes: 26 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ You can download the app for:
2. XCode / Android Studio
3. cocoapods
4. `prettier` extension (latest version) installed on code editor (preferably VSCode)
5. Javac version 1.8 (check by javac -version)

### Env variables
This project uses [react-native-config](https://github.com/luggit/react-native-config)
Expand All @@ -37,20 +38,36 @@ Generate 64 [random bytes](https://www.random.org/cgi-bin/randbyte?nbytes=64&for
Go to [Binary to Base64](https://cryptii.com/pipes/binary-to-base64), choose Hexadecimal format and convert it to text
Go to `.env` file, configure `DbEncryptionKey` with the key

### Pre-build
Keep the below changes in your local dev only. Do not push it in the branch.
- Create a .env file in the root directory and insert the correct variables as shown in the example env file.
- Insert the correct serects in the scripts/inject-secrets bash file.
- `sh scripts/inject-secrets.sh .`
- yarn install
- cd ios
- bundle exec pod install
- cd ../

### Run the app
```
yarn
cd ios
bundle exec pod install
cd ../
yarn ios
yarn install
yarn ios --scheme 'UniteAppRN-ENF'
```

### E2E tests
### Known issues
- If you have linking issues for Xcode 12 and above, please fix them by the file reference workaround.
- Ensure that the versions match.
* `javac -version` --> 1.8 (important).
* `node -v` --> currently @ 14.16.1.
- Cannot find default.realm on running Jest
- Delete default.realm.lock file from root and try again.
- Snapshot testing failing as it cannot match.
- Update the snapshot tests by running `yarn test -u`

### E2E tests
End to end tests are implemented with [cavy](https://github.com/pixielabs/cavy)

Start the app for e.g. `yarn ios`, and make sure both the app and the bundler are running
Start the test server `yarn e2e:dev`
Tests should now be running at every reload
Start the app for e.g. `yarn ios`, and make sure both the app and the bundler are running
Start the test server `yarn e2e:dev`
Tests should now be running at every reload
See tests under `./specs`
30 changes: 30 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

<application
android:name=".MainApplication"
Expand All @@ -14,9 +16,32 @@
android:extractNativeLibs="true"
android:theme="@style/AppTheme"
android:networkSecurityConfig="@xml/network_security_config">
<meta-data android:name="com.dieam.reactnativepushnotification.notification_foreground"
android:value="false"/>
<meta-data android:name="com.dieam.reactnativepushnotification.notification_color"
android:resource="@color/supernova"/>
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@mipmap/ic_launcher" />

<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationActions" />
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
</intent-filter>
</receiver>

<service
android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>

<activity
android:name=".MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
Expand All @@ -28,6 +53,11 @@
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="https"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
Expand Down
1 change: 0 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ allprojects {

google()
mavenCentral()
maven { url 'https://www.jitpack.io' }
flatDir {
dirs "$rootProject.projectDir/libs"
}
Expand Down
1 change: 1 addition & 0 deletions appcenter-pre-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

yarn inject:secrets
yarn setenv
yarn remove:nfc
8 changes: 8 additions & 0 deletions ios/UniteAppRN/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,12 @@ - (BOOL)application:(UIApplication *)application
{
return [RCTLinkingManager application:application openURL:url options:options];
}

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler
{
return [RCTLinkingManager application:application
continueUserActivity:userActivity
restorationHandler:restorationHandler];
}
@end
5 changes: 3 additions & 2 deletions ios/UniteAppRN/Entitlements.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.exposure-notification</key>
<true/>
<key>com.apple.developer.associated-domains</key>
<array>
<string>webcredentials:tracing.covid19.govt.nz</string>
<string>applinks:tracing.covid19.govt.nz</string>
</array>
<key>com.apple.developer.exposure-notification</key>
<true/>
</dict>
</plist>
1 change: 1 addition & 0 deletions ios/UniteAppRN/Entitlements_DEV.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<key>com.apple.developer.associated-domains</key>
<array>
<string>webcredentials:develop--tracing-app-c03c63136ec0-bb2f4f2091bb.netlify.app</string>
<string>applinks:develop--tracing-app-c03c63136ec0-bb2f4f2091bb.netlify.app</string>
</array>
</dict>
</plist>
1 change: 1 addition & 0 deletions ios/UniteAppRN/Entitlements_DEVOPS.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<key>com.apple.developer.associated-domains</key>
<array>
<string>webcredentials:devops--tracing-app-c03c63136ec0-bb2f4f2091bb.netlify.app</string>
<string>applinks:devops--tracing-app-c03c63136ec0-bb2f4f2091bb.netlify.app</string>
</array>
</dict>
</plist>
13 changes: 5 additions & 8 deletions ios/UniteAppRN/Entitlements_ENF_Debug.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.associated-domains</key>
<array>
<string>webcredentials:develop--tracing-app-c03c63136ec0-bb2f4f2091bb.netlify.app</string>
<string>applinks:develop--tracing-app-c03c63136ec0-bb2f4f2091bb.netlify.app</string>
</array>
<key>com.apple.developer.exposure-notification</key>
<true/>
<key>com.apple.developer.exposure-notification-logging</key>
<true/>
<key>com.apple.developer.exposure-notification-test</key>
<true/>
<!--
<key>com.apple.developer.exposure-notification-test-skip-file-verification</key>
<true/>
-->
<key>com.apple.developer.associated-domains</key>
<array>
<string>webcredentials:develop--tracing-app-c03c63136ec0-bb2f4f2091bb.netlify.app</string>
</array>
</dict>
</plist>
9 changes: 5 additions & 4 deletions ios/UniteAppRN/Entitlements_ENF_Release.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.exposure-notification</key>
<true/>
<key>com.apple.developer.exposure-notification-test</key>
<true/>
<key>com.apple.developer.associated-domains</key>
<array>
<string>webcredentials:develop--tracing-app-c03c63136ec0-bb2f4f2091bb.netlify.app</string>
<string>applinks:develop--tracing-app-c03c63136ec0-bb2f4f2091bb.netlify.app</string>
</array>
<key>com.apple.developer.exposure-notification</key>
<true/>
<key>com.apple.developer.exposure-notification-test</key>
<true/>
</dict>
</plist>
1 change: 1 addition & 0 deletions ios/UniteAppRN/Entitlements_TEST.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<key>com.apple.developer.associated-domains</key>
<array>
<string>webcredentials:test--tracing-app-c03c63136ec0-bb2f4f2091bb.netlify.app</string>
<string>applinks:test--tracing-app-c03c63136ec0-bb2f4f2091bb.netlify.app</string>
</array>
</dict>
</plist>
5 changes: 3 additions & 2 deletions ios/UniteAppRN/Entitlements_UAT.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.exposure-notification</key>
<true/>
<key>com.apple.developer.associated-domains</key>
<array>
<string>webcredentials:uat--tracing-app-c03c63136ec0-bb2f4f2091bb.netlify.app</string>
<string>applinks:uat--tracing-app-c03c63136ec0-bb2f4f2091bb.netlify.app</string>
</array>
<key>com.apple.developer.exposure-notification</key>
<true/>
</dict>
</plist>
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"version": "0.0.1",
"private": true,
"scripts": {
"postinstall": "node scripts/add-certs.js",
"postinstall": "node scripts/add-certs.js && node scripts/remove-jcenter.js",
"android": "react-native run-android --variant=envEnfDebug",
"ios": "react-native run-ios",
"reset": "npm run start --reset-cache",
"start": "react-native start",
"test": "yarn fix:test:realm && jest --runInBand",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
Expand All @@ -18,6 +19,7 @@
"fix:test:realm": "rm -f default.realm && ./scripts/fixRealmTests/script.sh",
"adb:reverse": "adb reverse tcp:8081 tcp:8081 && adb reverse tcp:9090 tcp:9090",
"inject:secrets": "./scripts/inject-secrets.sh",
"remove:nfc": "./scripts/remove-nfc.sh",
"min:images": "npx ts-node ./scripts/min-images.ts",
"license": "./scripts/extract-direct-dependencies.sh"
},
Expand All @@ -32,7 +34,7 @@
"@react-native-community/push-notification-ios": "^1.5.0",
"@react-native-firebase/app": "^9.0.0",
"@react-native-firebase/messaging": "^8.0.1",
"@react-navigation/bottom-tabs": "^5.8.0",
"@react-navigation/bottom-tabs": "^5.11.2",
"@react-navigation/native": "^5.7.3",
"@react-navigation/stack": "^5.9.0",
"@reduxjs/toolkit": "^1.4.0",
Expand All @@ -46,7 +48,7 @@
"i18next": "^19.7.0",
"js-base64": "^3.5.2",
"libphonenumber-js": "^1.8.4",
"lodash": "^4.17.20",
"lodash": "^4.17.21",
"moment": "^2.28.0",
"path": "^0.12.7",
"pupa": "^2.0.1",
Expand Down Expand Up @@ -133,6 +135,7 @@
"reactotron-react-native": "^5.0.0",
"reactotron-redux": "^3.1.3",
"redux-saga-test-plan": "^4.0.0-rc.3",
"replace-in-file": "^6.2.0",
"typescript": "^3.8.3"
},
"jest": {
Expand Down
2 changes: 1 addition & 1 deletion packager/modulePaths.js
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,7 @@ module.exports = [
"src/features/scan/views/TutorialNavigator.tsx",
"src/features/scan/views/TutorialScreen.tsx",
"src/features/scan/views/VisitRecordedScreen.tsx",
"src/features/scan/views/helpers.ts",
"src/features/scan/helpers.ts",
"src/features/verification/api/ReduxTokenStore.ts",
"src/features/verification/api/api.ts",
"src/features/verification/api/authClient.ts",
Expand Down
49 changes: 49 additions & 0 deletions scripts/remove-jcenter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const isAndroid = Boolean(process.env.APPCENTER_ANDROID_VARIANT);
if (!isAndroid) {
console.log("Not running in AppCenter Android, aborting script");
process.exit(0);
}

const replace = require("replace-in-file");
const path = "../**/node_modules/**/android/build.gradle";
const optionA = {
files: path,
from: /jcenter/g,
to: "mavenCentral",
};

const optionB = {
files: path,
from: /implementation \'com\.facebook\.react\:react-native\:\+\'/g,
to:
"implementation 'com.facebook.fbjni:fbjni-java-only:0.0.4'\n implementation('com.facebook.react:react-native:+') {\n exclude group: 'com.facebook.fbjni', module: 'fbjni-java-only'\n exclude group: 'com.facebook.yoga', module: 'proguard-annotations'\n }",
};

const optionC = {
files: path,
from: /implementation \"com\.facebook\.react\:react-native\:\+\"/g,
to:
"implementation 'com.facebook.fbjni:fbjni-java-only:0.0.4'\n implementation('com.facebook.react:react-native:+') {\n exclude group: 'com.facebook.fbjni', module: 'fbjni-java-only'\n exclude group: 'com.facebook.yoga', module: 'proguard-annotations'\n }",
};

replace(optionA)
.then((results) => {
// console.log('Replacement results:', results);
replace(optionB)
.then((resultsB) => {
// console.log('Replacement resultsB:', resultsB);
replace(optionC)
.then((resultsC) => {
// console.log('Replacement resultsC:', resultsC);
})
.catch((error) => {
console.error("Error occurred:", error);
});
})
.catch((error) => {
console.error("Error occurred:", error);
});
})
.catch((error) => {
console.error("Error occurred:", error);
});
Loading

0 comments on commit ee2df0d

Please sign in to comment.