Skip to content

Commit

Permalink
Merge pull request #31 from idpass/main
Browse files Browse the repository at this point in the history
Contributing branch "main" from fork "idpass/main"
  • Loading branch information
kneckinator authored Jun 8, 2022
2 parents 1c8f5ca + 9bdb2aa commit f3356ec
Show file tree
Hide file tree
Showing 190 changed files with 18,954 additions and 15,767 deletions.
42 changes: 42 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"env": {
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:sonarjs/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["react", "@typescript-eslint", "sonarjs"],
"settings": {
"react": {
"version": "detect"
}
},
"ignorePatterns": [
"node_modules",
"android",
"ios",
"assets",
"scripts",
"lib",
"*.typegen.ts"
],
"root": true,
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
{ "ignoreRestSiblings": true }
]
}
}
8 changes: 1 addition & 7 deletions .github/workflows/android-custom-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ jobs:
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
path: ~/.npm

- name: Cache local maven repository
uses: actions/cache@v2
with:
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
path: ~/.m2

- name: Cache local gradle repository
uses: actions/cache@v2
with:
Expand All @@ -45,7 +39,7 @@ jobs:
- name: Build App Newlogic Release
run: |
cd android
[ ! -z "$FIREBASE_SECRET" ] && gpg -o app/google-services.json --batch --passphrase="$FIREBASE_SECRET" -d app/google-services.json.gpg || echo "FIREBASE_SECRET not defined"
if [ ! -z "$FIREBASE_SECRET" ] && [ -f app/google-services.json.gpg ];then rm -f app/google-services.json;gpg -o app/google-services.json --batch --passphrase="$FIREBASE_SECRET" -d app/google-services.json.gpg;fi
./gradlew :app:assembleNewlogicRelease
env:
BACKEND_SERVICE_URL: ${{ github.event.inputs.backendServiceUrl }}
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ jobs:
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
path: ~/.npm

- name: Cache local maven repository
uses: actions/cache@v2
with:
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
path: ~/.m2

- name: Cache local gradle repository
uses: actions/cache@v2
with:
Expand All @@ -43,7 +37,7 @@ jobs:
- name: Build App Newlogic Release
run: |
cd android
[ ! -z "$FIREBASE_SECRET" ] && gpg -o app/google-services.json --batch --passphrase="$FIREBASE_SECRET" -d app/google-services.json.gpg || echo "FIREBASE_SECRET not defined"
if [ ! -z "$FIREBASE_SECRET" ] && [ -f app/google-services.json.gpg ];then rm -f app/google-services.json;gpg -o app/google-services.json --batch --passphrase="$FIREBASE_SECRET" -d app/google-services.json.gpg;fi
./gradlew :app:assembleNewlogicRelease
env:
BACKEND_SERVICE_URL: https://qa-triple-rc2.mosip.net/residentmobileapp
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ web-build/
*.aab
android/app/debug/output-metadata.json
android/app/release/output-metadata.json
google-services.json

# OSX
#
Expand Down Expand Up @@ -78,4 +77,5 @@ dist/
# @end expo-cli

.vscode/
temp/
temp/
.eslintcache
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false
}
}
4 changes: 3 additions & 1 deletion App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import { GlobalContext } from './shared/GlobalContext';
import { useSelector } from '@xstate/react';
import { selectIsReady } from './machines/app';

const AppInitialization: React.FC = (props) => {
import './i18n';

const AppInitialization: React.FC = () => {
const { appService } = useContext(GlobalContext);
const hasFontsLoaded = useFont();
const isReady = useSelector(appService, selectIsReady);
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# inji

MOSIP citizen app.

## Dependencies
Expand All @@ -10,8 +11,8 @@ Be sure to have the following build tools installed before proceeding:
- [Expo](https://docs.expo.dev/get-started/installation/)
- [Android SDK](https://developer.android.com/)


## Generate keystore for APK signing

```shell
keytool \
-genkey -v \
Expand All @@ -31,10 +32,10 @@ keytool \
```shell
# Install all dependencies
npm install
# run dev client
npm start
# run Inji directly to connected emulator or device (Default)
# run Inji Newlogic directly to connected emulator or device (Default)
npm run android:newlogic
# run Inji Mosip directly to connected emulator or device
npm run android:mosip
# run Inji Philippines directly to connected emulator or device
npm run android:ph
```
Expand All @@ -48,6 +49,7 @@ The app is available in this repository's `frontend/android` directory. Open thi
More info here: [Build your app using Android Studio](https://developer.android.com/studio/run)

## Build via command line

You need Android SDK CLI to build APK.

```shell
Expand All @@ -69,6 +71,9 @@ npm run build:android:ph

# Build for Newlogic test
npm run build:android:newlogic

# Build for MOSIP test
npm run build:android:mosip
```

More info here: [Build your app from the command line](https://developer.android.com/studio/build/building-cmdline)
Expand All @@ -81,4 +86,5 @@ One can clone the repo and run the build via github actions as shown below.


## Credits

Credits listed [here](/Credits.md)
20 changes: 14 additions & 6 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ android {
ext {
APP_NAME_RELEASE = "@string/app_name"
APP_NAME_PH = "@string/app_name_ph"
APP_NAME_MOSIP = "@string/app_name_mosip"
APP_NAME_NEWLOGIC = "@string/app_name_newlogic"
}

Expand Down Expand Up @@ -207,22 +208,29 @@ android {
}
}

flavorDimensions "mosip"
flavorDimensions "inji"

productFlavors {
ph {
versionName defaultConfig.versionName + "-ph"
mosip {
versionName defaultConfig.versionName + "-mosip"
manifestPlaceholders = [
APP_NAME: APP_NAME_PH
APP_NAME: APP_NAME_MOSIP
]
dimension "mosip"
dimension "inji"
}
newlogic {
versionName defaultConfig.versionName + "-newlogic"
manifestPlaceholders = [
APP_NAME: APP_NAME_NEWLOGIC
]
dimension "mosip"
dimension "inji"
}
ph {
versionName defaultConfig.versionName + "-ph"
manifestPlaceholders = [
APP_NAME: APP_NAME_PH
]
dimension "inji"
}
}

Expand Down
39 changes: 39 additions & 0 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"project_info": {
"project_number": "259470317171",
"project_id": "mosip-resident-app",
"storage_bucket": "mosip-resident-app.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "",
"android_client_info": {
"package_name": "io.mosip.residentapp"
}
},
"oauth_client": [
{
"client_id": "",
"client_type": 3
}
],
"api_key": [
{
"current_key": ""
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
4 changes: 3 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<queries>
<intent>
<action android:name="android.intent.action.VIEW"/>
Expand All @@ -28,7 +30,7 @@
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://exp.host/@nlpaolo/mosip-resident-app"/>
<activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustPan" android:theme="@style/Theme.App.SplashScreen" android:screenOrientation="portrait">
<activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustPan" android:theme="@style/Theme.App.SplashScreen" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.facebook.react.bridge.JSIModulePackage;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
import com.swmansion.reanimated.ReanimatedJSIModulePackage;

import java.lang.reflect.InvocationTargetException;
import java.util.List;
Expand All @@ -48,11 +47,6 @@ protected List<ReactPackage> getPackages() {
protected String getJSMainModuleName() {
return "index";
}

@Override
protected JSIModulePackage getJSIModulePackage() {
return new ReanimatedJSIModulePackage();
}
});

@Override
Expand Down
3 changes: 2 additions & 1 deletion android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<resources>
<string name="app_name">MOSIP Resident App</string>
<string name="app_name_ph">MOSIP Resident App - PH</string>
<string name="app_name_mosip">MOSIP Resident App - Mosip/Inji</string>
<string name="app_name_newlogic">MOSIP Resident App - Newlogic</string>
<string name="app_name_ph">MOSIP Resident App - PH</string>
<string name="expo_splash_screen_resize_mode" translatable="false">contain</string>
<string name="expo_splash_screen_status_bar_translucent" translatable="false">false</string>
</resources>
5 changes: 2 additions & 3 deletions app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ export default {
backgroundColor: '#FFFFFF',
},
},
web: {
favicon: './assets/favicon.png',
},
extra: {
backendServiceUrl: process.env.BACKEND_SERVICE_URL,
},
platforms: ['android', 'ios'],
privacy: 'hidden',
};
Binary file removed assets/favicon.png
Binary file not shown.
17 changes: 14 additions & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
module.exports = function(api) {
module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: [
['babel-plugin-inline-import', {
extensions: ['.md']
}]
]
}],
[
'module-resolver',
{
alias: {
'isomorphic-webcrypto': 'isomorphic-webcrypto/src/react-native',
'fast-text-encoding': 'fast-text-encoding/text',
'jsonld': '@digitalcredentials/jsonld',
'jsonld-signatures': '@digitalcredentials/jsonld-signatures',
},
},
],
],
};
};
6 changes: 6 additions & 0 deletions components/DeviceInfoList.strings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"requestedBy": "Requested by",
"sentBy": "Sent by",
"deviceRefNumber": "Device reference number",
"name": "Name"
}
9 changes: 6 additions & 3 deletions components/DeviceInfoList.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { TextItem } from './ui/TextItem';

export const DeviceInfoList: React.FC<DeviceInfoProps> = (props) => {
const { t } = useTranslation('DeviceInfoList');

return (
<React.Fragment>
<TextItem
divider
label={props.of === 'receiver' ? 'Requested by' : 'Sent by'}
label={props.of === 'receiver' ? t('requestedBy') : t('sentBy')}
text={props.deviceInfo.deviceName}
/>
<TextItem divider label="Name" text={props.deviceInfo.name} />
<TextItem divider label={t('name')} text={props.deviceInfo.name} />
<TextItem
divider
label="Device reference number"
label={t('deviceRefNumber')}
text={props.deviceInfo.deviceId}
/>
</React.Fragment>
Expand Down
Loading

0 comments on commit f3356ec

Please sign in to comment.