diff --git a/.bundle/config b/.bundle/config new file mode 100644 index 0000000000..d137d242ed --- /dev/null +++ b/.bundle/config @@ -0,0 +1,2 @@ +BUNDLE_PATH: "vendor/bundle" +BUNDLE_FORCE_RUBY_PLATFORM: 1 \ No newline at end of file diff --git a/.env b/.env index 826fc4c9e4..3c462bb674 100644 --- a/.env +++ b/.env @@ -1,3 +1,19 @@ -MIMOTO_HOST=https://api.qa4.mosip.net/residentmobileapp +# after making changes to the env file, ensure to start the bundler (or the project) with a --reset-cache +# eg . npm build android:newlogic --reset-cache + #MIMOTO_HOST=http://mock.mimoto.newlogic.dev -GOOGLE_NEARBY_MESSAGES_API_KEY= \ No newline at end of file +MIMOTO_HOST=https://api.qa-inji.mosip.net + +ESIGNET_HOST=https://api.qa-inji.mosip.net + +OBSRV_HOST = https://dataset-api.obsrv.mosip.net + +#Application Theme can be ( orange | purple ) +APPLICATION_THEME=orange + +#environment can be changed if it is toggled +CREDENTIAL_REGISTRY_EDIT=true +DEBUG_MODE=false + +#supported languages( en, fil, ar, hi, kn, ta) +APPLICATION_LANGUAGE=en diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000000..187894b6af --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,4 @@ +module.exports = { + root: true, + extends: '@react-native', +}; diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index a9d4c52ce3..36dfa14eb2 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,10 +1,10 @@ --- - name: Bug report about: Create a report to help us improve title: '' labels: bug, triage -assignees: +assignees: +--- **Describe the bug** A clear and concise description of what the bug is. @@ -20,18 +20,33 @@ Steps to reproduce the behavior: **Expected behavior** A clear and concise description of what you expected to happen. +**Actual behavior** +A clear and concise description of what factually occurred. + **Screenshots** -If applicable, add screenshots to help explain your problem. +If applicable, add screenshots to help explain your problem. + +**Add the screenshot of the profile page with commit id** **Smartphone (please complete the following information):** -- Device: [e.g. iPhone6] -- OS: [e.g. iOS8.1] +- Wallet Device: [e.g. iPhone6] + - Phone make/model: [e.g. :Vivo Y73] + - OS: [e.g. iOS8.1] + - BLE version : [e.g. 4.2] + +- Verifier Device: [e.g. iPhone6] + - Phone make/model: [e.g. :Vivo Y73] + - OS: [e.g. iOS8.1] + - BLE version : [e.g. 4.2] + - Inji app version: [e.g 0.3.0] - Mimoto version: [e.g 1.2.x] - MOSIP Version: [e.g. 1.2.1] -- Mimoto server: [e.g. https://.....com] -- MOSIP server: [e.g. https://...mosip.com] + +**Where does the issue occur: Wallet/Verifier?** + +**Logs of wallet and verifier:** **Additional context** Add any other context about the problem here. diff --git a/.github/keys/mosipgpgkey_pub.gpg b/.github/keys/mosipgpgkey_pub.gpg new file mode 100644 index 0000000000..4bdb1a947b Binary files /dev/null and b/.github/keys/mosipgpgkey_pub.gpg differ diff --git a/.github/keys/mosipgpgkey_sec.gpg b/.github/keys/mosipgpgkey_sec.gpg new file mode 100644 index 0000000000..97de55678f Binary files /dev/null and b/.github/keys/mosipgpgkey_sec.gpg differ diff --git a/.github/workflows/android-custom-build.yml b/.github/workflows/android-custom-build.yml index 8e6ca984d4..cd5df3e256 100644 --- a/.github/workflows/android-custom-build.yml +++ b/.github/workflows/android-custom-build.yml @@ -1,55 +1,56 @@ -name: ID PASS - MOSIP Resident Application Custom build - -env: - backendServiceDefaultUrl: https://api-internal.qa4.mosip.net/residentmobileapp +name: Android Custom Build +run-name: ${{ inputs.buildName }} on: workflow_dispatch: inputs: - backendServiceUrl: - description: 'Backend service URL' + buildName: + description: 'Run name' + required: true + default: 'Edit this name' + type: string + mimotoBackendServiceUrl: + description: 'Mimoto backend service URL' + required: true + default: 'https://api.sandbox.mosip.net' + type: string + esignetBackendServiceUrl: + description: 'Esignet backend service URL' required: true - default: 'https://api-internal.qa4.mosip.net/residentmobileapp' + default: 'https://api.sandbox.mosip.net' type: string + allow_env_edit: + description: 'Edit ENV' + required: true + default: 'true' + type: choice + options: + - false + - true + theme: + description: 'Application Theme' + required: true + default: 'orange' + type: choice + options: + - orange + - purple jobs: build-android: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3.1.0 - - # Cache stuff for faster build - - name: Cache local npm repository - uses: actions/cache@v3.0.11 - with: - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - path: ~/.npm - - - name: Cache local gradle repository - uses: actions/cache@v3.0.11 - with: - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - path: | - ~/.gradle/caches - ~/.gradle/wrapper - - - name: Install npm dependencies - run: | - npm install - - name: Create .env.local file - run: | - echo "${{ secrets.ENV_FILE }}" > .env.local > android/local.properties - - name: Build App Newlogic Release - run: | - cd android - 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: - MIMOTO_HOST: ${{ github.event.inputs.backendServiceUrl }} - FIREBASE_SECRET: ${{ secrets.FIREBASE_SECRET }} - - name: Upload Artifact - uses: actions/upload-artifact@v3.1.1 - with: - name: apk-output - path: android/app/build/outputs/apk/newlogic/release/ - retention-days: 10 + uses: mosip/kattu/.github/workflows/android-build.yml@master + with: + NODE_VERSION: "16.x" + MIMOTO_HOST: ${{ inputs.mimotoBackendServiceUrl }} + ESIGNET_HOST: ${{ inputs.esignetBackendServiceUrl }} + APPLICATION_THEME: ${{ inputs.theme }} + ALLOW_ENV_EDIT: ${{ inputs.allow_env_edit }} + KEYSTORE_ALIAS: androidbuildkey + KEYSTORE_PASSWORD: 'password' + SERVICE_LOCATION: '.' + ANDROID_SERVICE_LOCATION: 'android' + BUILD_SCRIPT_LOCATION: 'scripts' + SCRIPT_NAME: './android-build.sh' + UPLOAD_TO_ACTIONS: 'true' + ANDROID_ARTIFACT_NAME: ${{ inputs.buildName }} + ANDROID_ARTIFACT_PATH: "android/app/build/outputs/apk/residentapp/release/Inji_universal.apk" \ No newline at end of file diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml deleted file mode 100644 index 931e9d3a81..0000000000 --- a/.github/workflows/android.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: ID PASS - MOSIP Resident Application - -on: - push: - branches: - - main - - develop - tags: - - '*' - pull_request: - branches: - - '*' -jobs: - build-android: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3.1.0 - - # Cache stuff for faster build - - name: Cache local npm repository - uses: actions/cache@v3.0.11 - with: - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - path: ~/.npm - - - name: Cache local gradle repository - uses: actions/cache@v3.0.11 - with: - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - path: | - ~/.gradle/caches - ~/.gradle/wrapper - - - name: Install npm dependencies - run: | - npm ci - - name: Create .env.local file - run: | - echo "${{ secrets.ENV_FILE }}" > .env.local > android/local.properties - - name: Build App Newlogic Release - run: | - cd android - 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: - FIREBASE_SECRET: ${{ secrets.FIREBASE_SECRET }} - - name: Upload Artifact - uses: actions/upload-artifact@v3.1.1 - with: - name: output - path: android/app/build/outputs/apk/newlogic/release/ - retention-days: 1 diff --git a/.github/workflows/clear_artifacts.yml b/.github/workflows/clear_artifacts.yml index 32bc5fb3e0..8329cdd3e2 100644 --- a/.github/workflows/clear_artifacts.yml +++ b/.github/workflows/clear_artifacts.yml @@ -1,12 +1,10 @@ -name: 'Delete old artifacts' +name: "Delete old artifacts" on: workflow_dispatch: jobs: delete-artifacts: - runs-on: ubuntu-latest - steps: - - uses: kolpav/purge-artifacts-action@v1 - with: - token: ${{ secrets.ACTION_PAT }} - expire-in: 2days # Setting this to 0 will delete all artifacts \ No newline at end of file + uses: mosip/kattu/.github/workflows/clear-artifacts.yml@master + secrets: + ACCESS_TOKEN: ${{ secrets.ACTION_PAT }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} \ No newline at end of file diff --git a/.github/workflows/internal-build.yml b/.github/workflows/internal-build.yml new file mode 100644 index 0000000000..ae38aa380b --- /dev/null +++ b/.github/workflows/internal-build.yml @@ -0,0 +1,166 @@ +name: Internal Build [Android & IOS] +run-name: ${{ inputs.buildname }} + +on: + workflow_dispatch: + inputs: + release: + description: 'Internal/Beta' + required: true + default: 'internal' + type: choice + options: + - internal + - beta + buildFor: + description: 'Build' + required: true + default: 'Both[Android and IOS]' + type: choice + options: + - Both[Android and IOS] + - Android + - IOS + buildName: + description: 'Build App For' + required: true + default: 'Sprint-x/Collab/release-x.x.x' + type: string + mimotoBackendServiceUrl: + description: 'Mimoto backend service URL' + required: true + default: 'https://api.sandbox.mosip.net' + type: string + esignetBackendServiceUrl: + description: 'Esignet backend service URL' + required: true + default: 'https://api.sandbox.mosip.net' + type: string + injiFlavor: + description: 'Select Inji flavor' + required: true + default: 'Inji' + type: choice + options: + - residentapp + - inji + - collab + - synergy + - mec + internal-testers: + description: 'Internal Testers Group' + required: true + default: 'QA-Triple' + type: choice + options: + - Dev-testing + - MEC + - QA + - MOSIP-Collab + - MOSIP-Dev-testing + theme: + description: 'Application Theme' + required: true + default: 'orange' + type: choice + options: + - orange + - purple + buildDescription: + description: 'What to test' + required: true + default: 'QA-Triple environment' + type: string + allow_env_edit: + description: 'Edit ENV' + required: true + default: 'true' + type: choice + options: + - false + - true + +jobs: + build-android: + if: ${{ inputs.buildFor == 'Both[Android and IOS]' || inputs.buildFor == 'Android'}} + uses: mosip/kattu/.github/workflows/android-publish.yml@master + with: + RELEASE: ${{ inputs.release }} + NODE_VERSION: '18.x' + RELEASE_KEYSTORE_ALIAS: androidreleasekey + MIMOTO_HOST: ${{ inputs.mimotoBackendServiceUrl }} + ESIGNET_HOST: ${{ inputs.esignetBackendServiceUrl }} + APPLICATION_THEME: ${{ inputs.theme }} + BUILD_DESCRIPTION: ${{ inputs.buildDescription }} + ALLOW_ENV_EDIT: ${{ inputs.allow_env_edit }} + APP_FLAVOR: ${{ inputs.injiFlavor }} + SERVICE_LOCATION: '.' + ANDROID_SERVICE_LOCATION: 'android' + BUILD_SCRIPT_LOCATION: 'scripts' + SCRIPT_NAME: "./${{ inputs.release }}.sh" + ANDROID_ARTIFACT_NAME: ${{ inputs.buildname }} + ANDROID_ARTIFACT_PATH: "android/app/build/outputs/apk/${{ inputs.injiFlavor }}/release/Inji_universal.apk" + secrets: + ANDROID_KEYSTORE_FILE: ${{ secrets.INJI_ANDROID_RELEASE_KEYSTORE }} + RELEASE_KEYSTORE_PASSWORD: '${{ secrets.INJI_ANDROID_RELEASE_STOREPASS }}' + INJI_ANDROID_PLAY_STORE_CONFIG_JSON: ${{ secrets.INJI_ANDROID_PLAY_STORE_CONFIG_JSON }} + SLACK_WEBHOOK_URL: '${{ secrets.SLACK_WEBHOOK }}' + + build-android-beta: + if: ${{ inputs.release == 'beta' && (inputs.buildFor == 'Both[Android and IOS]' || inputs.buildFor == 'Android') }} + uses: mosip/kattu/.github/workflows/android-publish.yml@master + with: + RELEASE: ${{ inputs.release }} + NODE_VERSION: '18.x' + RELEASE_KEYSTORE_ALIAS: androidreleasekey + MIMOTO_HOST: ${{ inputs.mimotoBackendServiceUrl }} + ESIGNET_HOST: ${{ inputs.esignetBackendServiceUrl }} + APPLICATION_THEME: ${{ inputs.theme }} + BUILD_DESCRIPTION: ${{ inputs.buildDescription }} + ALLOW_ENV_EDIT: ${{ inputs.allow_env_edit }} + APP_FLAVOR: ${{ inputs.injiFlavor }} + SERVICE_LOCATION: '.' + ANDROID_SERVICE_LOCATION: 'android' + BUILD_SCRIPT_LOCATION: 'scripts' + SCRIPT_NAME: "./${{ inputs.release }}.sh" + ANDROID_ARTIFACT_NAME: ${{ inputs.buildname }} + ANDROID_ARTIFACT_PATH: "android/app/build/outputs/apk/${{ inputs.injiFlavor }}/release/Inji_universal.apk" + secrets: + ANDROID_KEYSTORE_FILE: ${{ secrets.INJI_ANDROID_RELEASE_KEYSTORE }} + RELEASE_KEYSTORE_PASSWORD: '${{ secrets.INJI_ANDROID_RELEASE_STOREPASS }}' + INJI_ANDROID_PLAY_STORE_CONFIG_JSON: ${{ secrets.INJI_ANDROID_PLAY_STORE_CONFIG_JSON }} + SLACK_WEBHOOK_URL: '${{ secrets.SLACK_WEBHOOK }}' + + build-ios: + if: ${{ inputs.buildFor == 'Both[Android and IOS]' || inputs.buildFor == 'IOS'}} + uses: mosip/kattu/.github/workflows/ios-publish.yml@master + with: + NODE_VERSION: '18.x' + MIMOTO_HOST: ${{ inputs.mimotoBackendServiceUrl }} + ESIGNET_HOST: ${{ inputs.esignetBackendServiceUrl }} + APPLICATION_THEME: ${{ inputs.theme }} + TESTFLIGHT_BETA_APP_DESCRIPTION: ${{ inputs.buildDescription }} + ALLOW_ENV_EDIT: ${{ inputs.allow_env_edit }} + TESTFLIGHT_INTERNAL_TESTERS_GROUP: ${{ inputs.internal-testers }} + APP_FLAVOR: ${{ inputs.injiFlavor }} + SERVICE_LOCATION: '.' + IOS_SERVICE_LOCATION: 'ios' + SCRIPT_NAME: "fastlane beta" + IOS_ARTIFACT_NAME: "Inji" + IOS_ARTIFACT_PATH: "ios/fastlane/Inji_app_file/Products/Applications/" + secrets: + APP_STORE_CONNECT_TEAM_ID: '${{ secrets.APP_STORE_CONNECT_TEAM_ID }}' + DEVELOPER_APP_ID: '${{ secrets.IOS_INJI_DEVELOPER_APP_ID }}' + INJI_IOS_DEVELOPER_APP_IDENTIFIER: '${{ secrets.INJI_IOS_DEVELOPER_APP_IDENTIFIER }}' + INJI_IOS_DEVELOPER_PORTAL_TEAM_ID: '${{ secrets.INJI_IOS_DEVELOPER_PORTAL_TEAM_ID }}' + INJI_IOS_FASTLANE_APPLE_ID: '${{ secrets.INJI_IOS_FASTLANE_APPLE_ID }}' + INJI_IOS_FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: '${{ secrets.INJI_IOS_FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }}' + GIT_AUTHORIZATION: '${{ secrets.GIT_AUTHORIZATION }}' + INJI_IOS_PROVISIONING_PROFILE_SPECIFIER: '${{ secrets.INJI_IOS_PROVISIONING_PROFILE_SPECIFIER }}' + INJI_IOS_TEMP_KEYCHAIN_PASSWORD: '${{ secrets.INJI_IOS_TEMP_KEYCHAIN_PASSWORD }}' + INJI_IOS_TEMP_KEYCHAIN_USER: '${{ secrets.INJI_IOS_TEMP_KEYCHAIN_USER }}' + APPLE_KEY_ID: '${{ secrets.APPLE_KEY_ID }}' + APPLE_ISSUER_ID: '${{ secrets.APPLE_ISSUER_ID }}' + APPLE_KEY_CONTENT: '${{ secrets.APPLE_KEY_CONTENT }}' + MATCH_PASSWORD: '${{ secrets.INJI_IOS_MATCH_PASSWORD }}' + SLACK_WEBHOOK_URL: '${{ secrets.SLACK_WEBHOOK }}' \ No newline at end of file diff --git a/.github/workflows/push-triggers.yml b/.github/workflows/push-triggers.yml new file mode 100644 index 0000000000..d1a8fe46f4 --- /dev/null +++ b/.github/workflows/push-triggers.yml @@ -0,0 +1,39 @@ +name: Push-Triggers + +on: + push: + branches: + - main + - develop + - qa-develop + - 'release-**' + release: + types: [published] + pull_request: + types: [opened, reopened, synchronize] + branches: + - main + - develop + - qa-develop + - 'release-**' + +jobs: + build-android: + uses: mosip/kattu/.github/workflows/android-build.yml@master + with: + NODE_VERSION: "16.x" + KEYSTORE_ALIAS: androidbuildkey + KEYSTORE_PASSWORD: 'password' + SERVICE_LOCATION: '.' + ANDROID_SERVICE_LOCATION: 'android' + BUILD_SCRIPT_LOCATION: 'scripts' + SCRIPT_NAME: './android-build.sh' + UPLOAD_TO_ACTIONS: 'false' + + build-ios: + uses: mosip/kattu/.github/workflows/ios-build.yml@master + with: + NODE_VERSION: "18.x" + SERVICE_LOCATION: '.' + IOS_SERVICE_LOCATION: 'ios' + SCRIPT_NAME: "fastlane ios_app_build" \ No newline at end of file diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml deleted file mode 100644 index 1e539daf0f..0000000000 --- a/.github/workflows/sonar.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: SonarQube checks -on: - push: - branches: - - develop -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3.1.0 - with: - fetch-depth: 0 - - name: Install npm dependencies - run: | - npm ci - - uses: sonarsource/sonarqube-scan-action@master - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - # If you wish to fail your job when the Quality Gate is red, uncomment the - # following lines. This would typically be used to fail a deployment. - # - uses: sonarsource/sonarqube-quality-gate-action@master - # timeout-minutes: 5 - # env: - # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml deleted file mode 100644 index c216c4b235..0000000000 --- a/.github/workflows/tag.yaml +++ /dev/null @@ -1,43 +0,0 @@ -name: Tagging of repos - -env: - tag: v1.2.3 - -on: - workflow_dispatch: - inputs: - tag: - description: 'Tag to be published' - required: true - default: 'v1.2.3' - type: string - body: - description: 'Release body message' - required: true - default: 'Changes in this Release' - type: string - pre-release: - description: 'Pre-release? True/False' - required: true - default: False - type: string - -jobs: - build: - name: Create Release - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3.1.0 - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: ${{ github.event.inputs.tag }} - release_name: ${{ github.event.inputs.tag }} - body: | - ${{ github.event.inputs.body }} - draft: false - prerelease: ${{fromJSON(github.event.inputs.pre-release)}} diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml new file mode 100644 index 0000000000..41cc2a13a6 --- /dev/null +++ b/.github/workflows/tag.yml @@ -0,0 +1,35 @@ +name: Tagging of repos + +on: + workflow_dispatch: + inputs: + TAG: + description: "Tag to be published" + required: true + type: string + BODY: + description: "Release body message" + required: true + default: "Changes in this Release" + type: string + PRE_RELEASE: + description: "Pre-release? True/False" + required: true + default: False + type: string + DRAFT: + description: "Draft? True/False" + required: false + default: False + type: string + +jobs: + tag-branch: + uses: mosip/kattu/.github/workflows/tag.yml@master + with: + TAG: ${{ inputs.TAG }} + BODY: ${{ inputs.BODY }} + PRE_RELEASE: ${{ inputs.PRE_RELEASE }} + DRAFT: ${{ inputs.DRAFT }} + secrets: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} \ No newline at end of file diff --git a/.github/workflows/ui-automation.yml b/.github/workflows/ui-automation.yml new file mode 100644 index 0000000000..c3cd2b9154 --- /dev/null +++ b/.github/workflows/ui-automation.yml @@ -0,0 +1,190 @@ +name: UI - Automation +run-name: ${{ inputs.runName }} + +on: + workflow_dispatch: + inputs: + runName: + description: 'Run name' + required: true + default: 'Device-pool/Test-name/Env' + type: string + buildFor: + description: 'Build' + required: true + default: 'Both[Android and IOS]' + type: choice + options: + - Both[Android and IOS] + - Android + - IOS + testType: + description: 'Sanity/Regression' + required: true + default: 'sanity' + type: choice + options: + - sanity + - regression + backendServiceUrl: + description: 'Mimoto and Esignet backend service URL' + required: true + default: 'https://api.sandbox.mosip.net' + type: string + +jobs: + android-ui-automation: + if: ${{ github.event.inputs.buildFor == 'Both[Android and IOS]' || github.event.inputs.buildFor == 'Android'}} + name: Trigger android run + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3.1.0 + - uses: actions/setup-node@v3 + with: + node-version: '18.x' + + - name: Cache npm dependencies + uses: actions/cache@v3.3.1 + with: + path: '~/.npm' + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- + + - name: Install npm dependencies + run: | + npm ci + + - name: Generate Android keystore + run: | + echo "$ANDROID_KEYSTORE_FILE" > release.keystore.b64 + base64 -d -i release.keystore.b64 > android/app/release.keystore + env: + ANDROID_KEYSTORE_FILE: ${{ secrets.INJI_ANDROID_RELEASE_KEYSTORE }} + + - name: Create Android Build + run: | + npx jetify + cd android + ./gradlew :app:assembleResidentappRelease + env: + MIMOTO_HOST: ${{ github.event.inputs.backendServiceUrl }} + ESIGNET_HOST: ${{ github.event.inputs.backendServiceUrl }} + APPLICATION_THEME: 'orange' + CREDENTIAL_REGISTRY_EDIT: 'false' + RELEASE_KEYSTORE_ALIAS: 'androidreleasekey' + RELEASE_KEYSTORE_PASSWORD: "${{ secrets.INJI_ANDROID_RELEASE_STOREPASS }}" + + - name: Configure AWS CLI + run: | + aws configure set aws_access_key_id ${{ secrets.AWS_DEVICE_FARM_ACCESS_KEY }} + aws configure set aws_secret_access_key ${{ secrets.AWS_DEVICE_FARM_SECRET_KEY }} + aws configure set region us-west-2 + + - name: Android - Automation + id: android-run + run: | + cd injitest/scripts/ui_automation + RUN_ARN=$(./automation_trigger.sh "Android" "$RUN_NAME" "$TEST_TYPE") + echo "The Run ARN is $RUN_ARN" + env: + RUN_NAME: ${{ github.event.inputs.runName }} + TEST_TYPE: ${{ github.event.inputs.testType }} + + # - name: Artifacts download + # id: artifact-download + # run: | + # cd injitest/scripts/ui_automation + # ./download_artifacts.sh "${{ steps.android-run.outputs.run_arn }}" "Android" + + # - name: Upload Artifact to Actions + # uses: actions/upload-artifact@v3.1.1 + # with: + # name: Automation Artifacts + # path: injitest/scripts/ui_automation/artifacts/ + # retention-days: 5 + + # - name: Update slack channel + # if: always() + # uses: 8398a7/action-slack@v3 + # with: + # status: ${{ job.status }} + # fields: repo,message,author,commit,workflow,job + # env: + # SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_INJI_TEAM }} + + ios-ui-automation: + if: ${{ github.event.inputs.buildFor == 'Both[Android and IOS]' || github.event.inputs.buildFor == 'IOS'}} + name: Trigger ios run + runs-on: macos-13 + + steps: + - uses: actions/checkout@v3.1.0 + - uses: actions/setup-node@v3 + with: + node-version: '18.x' + + - name: Cache npm dependencies + uses: actions/cache@v3.3.1 + with: + path: '~/.npm' + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- + + - name: Install npm dependencies + run: | + npm ci + + - name: Create iOS Build + run: | + cd ios + pod install && pod install + fastlane ios_ui_automation_build + env: + MIMOTO_HOST: ${{ github.event.inputs.backendServiceUrl }} + ESIGNET_HOST: ${{ github.event.inputs.backendServiceUrl }} + APPLICATION_THEME: 'orange' + APP_FLAVOR: 'residentapp' + CREDENTIAL_REGISTRY_EDIT: 'false' + INJI_IOS_TEMP_KEYCHAIN_PASSWORD: '${{ secrets.INJI_IOS_TEMP_KEYCHAIN_PASSWORD }}' + INJI_IOS_TEMP_KEYCHAIN_USER: '${{ secrets.INJI_IOS_TEMP_KEYCHAIN_USER }}' + GIT_AUTHORIZATION: '${{ secrets.GIT_AUTHORIZATION }}' + + - name: Configure AWS CLI + run: | + aws configure set aws_access_key_id ${{ secrets.AWS_DEVICE_FARM_ACCESS_KEY }} + aws configure set aws_secret_access_key ${{ secrets.AWS_DEVICE_FARM_SECRET_KEY }} + aws configure set region us-west-2 + + - name: IOS - Automation + run: | + cd injitest/scripts/ui_automation + RUN_ARN=$(./automation_trigger.sh "IOS" "$RUN_NAME" "$TEST_TYPE") + echo "The Run ARN is $RUN_ARN" + env: + RUN_NAME: ${{ github.event.inputs.runName }} + TEST_TYPE: ${{ github.event.inputs.testType }} + + # - name: Artifacts download + # id: artifact-download + # run: | + # cd injitest/scripts/ui_automation + # ./download_artifacts.sh "${{ steps.android-run.outputs.run_arn }}" "Android" + + # - name: Upload Artifact to Actions + # uses: actions/upload-artifact@v3.1.1 + # with: + # name: Automation Artifacts + # path: injitest/scripts/ui_automation/artifacts/ + # retention-days: 5 + + # - name: Update slack channel + # if: always() + # uses: 8398a7/action-slack@v3 + # with: + # status: ${{ job.status }} + # fields: repo,message,author,commit,workflow,job + # env: + # SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_INJI_TEAM }} diff --git a/.gitignore b/.gitignore index 9427ae3013..8daf666cf4 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ DerivedData *.ipa *.xcuserstate project.xcworkspace +ios/.xcode.env.local # Android/IntelliJ # @@ -50,6 +51,10 @@ build/ local.properties *.iml *.hprof +*.hprof +.cxx/ +*.keystore +!debug.keystore # node.js # @@ -57,18 +62,34 @@ node_modules/ npm-debug.log yarn-error.log + + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/ +**/fastlane/report.xml +**/fastlane/Preview.html +**/fastlane/screenshots +**/fastlane/test_output + # BUCK buck-out/ \.buckd/ -*.keystore -!debug.keystore # Bundle artifacts *.jsbundle -# CocoaPods -ios/Pods/ +# Ruby / CocoaPods +/ios/Pods/ +/vendor/bundle/ +# Temporary files created by Metro to check the health of the file watcher +.metro-health-check* +# testing +/coverage +c # OS X temporary files that should never be committed .DS_Store src/components/.DS_Store @@ -90,4 +111,14 @@ dist/ .vscode/ temp/ .eslintcache -.env.local \ No newline at end of file +.env.local + +.yalc/ +yalc.lock + +android/app/debug.keystore + +# Expo +.expo +dist/ +web-build/ \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit index 36af219892..4a58cd2f2c 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -2,3 +2,4 @@ . "$(dirname "$0")/_/husky.sh" npx lint-staged +.git/hooks/bin/talisman ${DEBUG_OPTS} --githook pre-commit \ No newline at end of file diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000000..2b540746a7 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,7 @@ +module.exports = { + arrowParens: 'avoid', + bracketSameLine: true, + bracketSpacing: false, + singleQuote: true, + trailingComma: 'all', +}; diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index 3c8528fa00..0000000000 --- a/.prettierrc.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "arrowParens": "always", - "bracketSpacing": true, - "bracketSameLine": true, - "jsxSingleQuote": false, - "quoteProps": "consistent", - "printWidth": 80, - "semi": true, - "singleQuote": true, - "tabWidth": 2, - "trailingComma": "es5", - "useTabs": false -} diff --git a/.talismanrc b/.talismanrc new file mode 100644 index 0000000000..a773bf479f --- /dev/null +++ b/.talismanrc @@ -0,0 +1,61 @@ +fileignoreconfig: +- filename: ios/fastlane/Fastfile + checksum: 10e70e4121e610c54871efa3820c409a4b7cc41bc89a0b5f6f0a9334c1fffddd +- filename: package.json + checksum: e0b34f1a1efbdf07b40a3e9e9ecd8884dd7d6835f45c57850e30988d2c6371a2 +- filename: package-lock.json + checksum: 85f8d3a110f0a713e1b213c850ff1ceb071a36ad57050bf5a18918cf8814123c +- filename: components/PasscodeVerify.tsx + checksum: 14654c0f038979fcd0d260170a45894a072f81e0767ca9a0e66935d33b5cc703 +- filename: i18n.ts + checksum: 75dd5536038ba198aa7b12eb6d2c2e7042c9ce292e5a0d5c90883ae5b2312b1e +- filename: screens/BiometricScreenController.ts + checksum: b3d0184fb894f4a9ffa1a4d277d2975495dbc47771593895bf1999deabafeb94 +- filename: screens/Home/MyVcs/IdInputModal.tsx + checksum: ec48ebeaf46b8fbc756f19ef8ffe8901ce0528aef164f3c7ffdeec36fb53ffc6 +- filename: components/Passcode.tsx + checksum: db4a18001be8c63bf7ffb389359861401fa1d22261b10ad729a76fd431c019a7 +- filename: screens/PasscodeScreen.tsx + checksum: 0cc5b91350e491a058ee8a1878a496c16b65f14969e989bdb1c354f6e9b8c03c +- filename: locales/spa.json + checksum: 981103ff872d6f54610468c7ead65873d9294a11092649b105c552f770f0214b +- filename: screens/AuthScreen.tsx + checksum: 2c1183b2ad8ec27adf8f389a2511805493f229fdda674064e2579d2032119d1c +- filename: screens/BiometricScreen.tsx + checksum: 7a730731aaa7540eec9d05d73de277a665dc06425666280842e0f9ba6e5b8514 +- filename: screens/AuthScreenController.ts + checksum: 18af825821bc95e1056050623b804a5a8e7435b9e3383916a5d63024eeba9553 +- filename: screens/WelcomeScreenController.ts + checksum: 71917c8c543a4a5b7ab61df259b785d233a80718123b0c8edf6ec81e1b3a81e0 +- filename: shared/telemetry/TelemetryUtils.js + checksum: 9a61cd59a3718adf1f14faf3024fec66a3295ef373878a878a28e5cb1287afaa +- filename: ios/Podfile.lock + checksum: cc123c3e1f04d41b394ceb16843b15c08bac3ba619ae853ff322717739761a85 +- filename: ios/Podfile.lock + checksum: cc123c3e1f04d41b394ceb16843b15c08bac3ba619ae853ff322717739761a85 +- filename: screens/Home/IntroSlidersScreen.tsx + checksum: 72ef913857448ef05763e52e32356faa2d1f3de8130a1c638d1897f44823031f +- filename: shared/commonUtil.ts + checksum: b9ff87d627c74ba1cf2f1d0bfab6c11192573c45a4c581c3beadb3c612bfe1ab +- filename: screens/Home/MyVcs/GetIdInputModal.tsx + checksum: 5c736ed79a372d0ffa7c02eb33d0dc06edbbb08d120978ff287f5f06cd6c7746 +- filename: shared/openId4VCI/Utils.ts + checksum: 2bd39d84099d700e5bddeebe87dfb3b0e3075edc0a4d06ce48b428b0a85e238f +- filename: machines/issuersMachine.ts + checksum: b925df13236145867fc7a1a2a703faca854e8c937dac9451008399e3937592fb +- filename: machines/issuersMachine.typegen.ts + checksum: f5e2c89f9029b1e590173e37b2cf6586d5229ecb7d4dfd4c5f050f9416d3c1cd +- filename: machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.ts + checksum: eec77ca61540327ff7cab3489ebdfd47aa373fd20b3ff87a6c322cd48d35fe8f +- filename: machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.typegen.ts + checksum: f1f504bd8c14496ee71f8eb7f40d54411cc05be03347d644dcc2cca187a20678 +- filename: machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.ts + checksum: 237a2640b7db70770d65da67c79f2929581e32f1162517e50b8d37e409f3387d +- filename: shared/cryptoutil/cryptoUtil.ts + checksum: b785ff3f01ab9530119072c4d38195048bfeee6155c54ea7dd031559acb722f3 +- filename: package.json + checksum: 1a9d02d94424c1266503d58038cae2318ab71261ab50cf930c5f98e07c0f3ccd +- filename: machines/store.typegen.ts + checksum: 6d22bc5c77398316b943c512c208ce0846a9fff674c1ccac79e07f21962acd5f +- filename: machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.typegen.ts + checksum: 10889302ca05646a283386be1bbe7a5fb510c02bb62a308ee45f3c2a872ae64e diff --git a/.watchmanconfig b/.watchmanconfig new file mode 100644 index 0000000000..a091263670 --- /dev/null +++ b/.watchmanconfig @@ -0,0 +1,5 @@ +{ + "ignore_dirs": [], + "fsevents_latency": 0.5, + "fsevents_try_resync": true +} diff --git a/App.tsx b/App.tsx index 6b94c86ead..d4aeaba87b 100644 --- a/App.tsx +++ b/App.tsx @@ -1,20 +1,109 @@ -import React, { useContext } from 'react'; +import React, {useContext, useEffect} from 'react'; import AppLoading from 'expo-app-loading'; -import { AppLayout } from './screens/AppLayout'; -import { useFont } from './shared/hooks/useFont'; -import { GlobalContextProvider } from './components/GlobalContextProvider'; -import { GlobalContext } from './shared/GlobalContext'; -import { useSelector } from '@xstate/react'; -import { selectIsReady } from './machines/app'; +import {AppLayout} from './screens/AppLayout'; +import {useFont} from './shared/hooks/useFont'; +import {GlobalContextProvider} from './components/GlobalContextProvider'; +import {GlobalContext} from './shared/GlobalContext'; +import {useSelector} from '@xstate/react'; +import {useTranslation} from 'react-i18next'; +import { + selectIsDecryptError, + selectIsKeyInvalidateError, + selectIsReadError, + selectIsReady, +} from './machines/app'; +import {DualMessageOverlay} from './components/DualMessageOverlay'; +import {useApp} from './screens/AppController'; +import {Alert} from 'react-native'; +import {configureTelemetry} from './shared/telemetry/TelemetryUtils'; +import {MessageOverlay} from './components/MessageOverlay'; +import SecureKeystore from 'react-native-secure-keystore'; +import {isHardwareKeystoreExists} from './shared/cryptoutil/cryptoUtil'; +import i18n from './i18n'; +import './shared/flipperConfig'; -import './i18n'; +// kludge: this is a bad practice but has been done temporarily to surface +// an occurance of a bug with minimal residual code changes, this should +// be removed once the bug cause is determined & fixed, ref: INJI-222 +const DecryptErrorAlert = (controller, t) => { + const heading = t('errors.decryptionFailed'); + const desc = t('errors.decryptionFailed'); + const ignoreBtnTxt = t('ignore'); + Alert.alert(heading, desc, [ + { + text: ignoreBtnTxt, + onPress: () => controller.ignoreDecrypt(), + style: 'cancel', + }, + ]); +}; + +const AppLayoutWrapper: React.FC = () => { + const {appService} = useContext(GlobalContext); + const isDecryptError = useSelector(appService, selectIsDecryptError); + const controller = useApp(); + const {t} = useTranslation('WelcomeScreen'); + if (isDecryptError) { + DecryptErrorAlert(controller, t); + } + configureTelemetry(); + return ; +}; + +const AppLoadingWrapper: React.FC = () => { + const {appService} = useContext(GlobalContext); + const isReadError = useSelector(appService, selectIsReadError); + const isKeyInvalidateError = useSelector( + appService, + selectIsKeyInvalidateError, + ); + const controller = useApp(); + const {t} = useTranslation('WelcomeScreen'); + return ( + <> + + + + {isReadError ? ( + + ) : null} + + ); +}; const AppInitialization: React.FC = () => { - const { appService } = useContext(GlobalContext); - const hasFontsLoaded = useFont(); + const {appService} = useContext(GlobalContext); const isReady = useSelector(appService, selectIsReady); + const hasFontsLoaded = useFont(); + const {t} = useTranslation('common'); + + useEffect(() => { + if (isHardwareKeystoreExists) { + SecureKeystore.updatePopup( + t('biometricPopup.title'), + t('biometricPopup.description'), + ); + } + }, [i18n.language]); - return isReady && hasFontsLoaded ? : ; + return isReady && hasFontsLoaded ? ( + + ) : ( + + ); }; export default function App() { diff --git a/AppMetaData.md b/AppMetaData.md new file mode 100644 index 0000000000..63a9751af2 --- /dev/null +++ b/AppMetaData.md @@ -0,0 +1 @@ +Inji is a mobile app that can be used as a digital wallet to store credentials. It also allows verification of identity in both offline and online modes, at any place and time. diff --git a/LICENSE b/LICENSE index a612ad9813..ba08bd62e0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,373 +1,21 @@ -Mozilla Public License Version 2.0 -================================== - -1. Definitions --------------- - -1.1. "Contributor" - means each individual or legal entity that creates, contributes to - the creation of, or owns Covered Software. - -1.2. "Contributor Version" - means the combination of the Contributions of others (if any) used - by a Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - means Source Code Form to which the initial Contributor has attached - the notice in Exhibit A, the Executable Form of such Source Code - Form, and Modifications of such Source Code Form, in each case - including portions thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - (a) that the initial Contributor has attached the notice described - in Exhibit B to the Covered Software; or - - (b) that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the - terms of a Secondary License. - -1.6. "Executable Form" - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - means a work that combines Covered Software with other material, in - a separate file or files, that is not Covered Software. - -1.8. "License" - means this document. - -1.9. "Licensable" - means having the right to grant, to the maximum extent possible, - whether at the time of the initial grant or subsequently, any and - all of the rights conveyed by this License. - -1.10. "Modifications" - means any of the following: - - (a) any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered - Software; or - - (b) any new file in Source Code Form that contains any Covered - Software. - -1.11. "Patent Claims" of a Contributor - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the - License, by the making, using, selling, offering for sale, having - made, import, or transfer of either its Contributions or its - Contributor Version. - -1.12. "Secondary License" - means either the GNU General Public License, Version 2.0, the GNU - Lesser General Public License, Version 2.1, the GNU Affero General - Public License, Version 3.0, or any later versions of those - licenses. - -1.13. "Source Code Form" - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants and Conditions --------------------------------- - -2.1. Grants - -Each Contributor hereby grants You a world-wide, royalty-free, -non-exclusive license: - -(a) under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - -(b) under Patent Claims of such Contributor to make, use, sell, offer - for sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - -The licenses granted in Section 2.1 with respect to any Contribution -become effective for each Contribution on the date the Contributor first -distributes such Contribution. - -2.3. Limitations on Grant Scope - -The licenses granted in this Section 2 are the only rights granted under -this License. No additional rights or licenses will be implied from the -distribution or licensing of Covered Software under this License. -Notwithstanding Section 2.1(b) above, no patent license is granted by a -Contributor: - -(a) for any code that a Contributor has removed from Covered Software; - or - -(b) for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - -(c) under Patent Claims infringed by Covered Software in the absence of - its Contributions. - -This License does not grant any rights in the trademarks, service marks, -or logos of any Contributor (except as may be necessary to comply with -the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - -No Contributor makes additional grants as a result of Your choice to -distribute the Covered Software under a subsequent version of this -License (see Section 10.2) or under the terms of a Secondary License (if -permitted under the terms of Section 3.3). - -2.5. Representation - -Each Contributor represents that the Contributor believes its -Contributions are its original creation(s) or it has sufficient rights -to grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - -This License is not intended to limit any rights You have under -applicable copyright doctrines of fair use, fair dealing, or other -equivalents. - -2.7. Conditions - -Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted -in Section 2.1. - -3. Responsibilities -------------------- - -3.1. Distribution of Source Form - -All distribution of Covered Software in Source Code Form, including any -Modifications that You create or to which You contribute, must be under -the terms of this License. You must inform recipients that the Source -Code Form of the Covered Software is governed by the terms of this -License, and how they can obtain a copy of this License. You may not -attempt to alter or restrict the recipients' rights in the Source Code -Form. - -3.2. Distribution of Executable Form - -If You distribute Covered Software in Executable Form then: - -(a) such Covered Software must also be made available in Source Code - Form, as described in Section 3.1, and You must inform recipients of - the Executable Form how they can obtain a copy of such Source Code - Form by reasonable means in a timely manner, at a charge no more - than the cost of distribution to the recipient; and - -(b) You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter - the recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - -You may create and distribute a Larger Work under terms of Your choice, -provided that You also comply with the requirements of this License for -the Covered Software. If the Larger Work is a combination of Covered -Software with a work governed by one or more Secondary Licenses, and the -Covered Software is not Incompatible With Secondary Licenses, this -License permits You to additionally distribute such Covered Software -under the terms of such Secondary License(s), so that the recipient of -the Larger Work may, at their option, further distribute the Covered -Software under the terms of either this License or such Secondary -License(s). - -3.4. Notices - -You may not remove or alter the substance of any license notices -(including copyright notices, patent notices, disclaimers of warranty, -or limitations of liability) contained within the Source Code Form of -the Covered Software, except that You may alter any license notices to -the extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - -You may choose to offer, and to charge a fee for, warranty, support, -indemnity or liability obligations to one or more recipients of Covered -Software. However, You may do so only on Your own behalf, and not on -behalf of any Contributor. You must make it absolutely clear that any -such warranty, support, indemnity, or liability obligation is offered by -You alone, and You hereby agree to indemnify every Contributor for any -liability incurred by such Contributor as a result of warranty, support, -indemnity or liability terms You offer. You may include additional -disclaimers of warranty and limitations of liability specific to any -jurisdiction. - -4. Inability to Comply Due to Statute or Regulation ---------------------------------------------------- - -If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Software due to -statute, judicial order, or regulation then You must: (a) comply with -the terms of this License to the maximum extent possible; and (b) -describe the limitations and the code they affect. Such description must -be placed in a text file included with all distributions of the Covered -Software under this License. Except to the extent prohibited by statute -or regulation, such description must be sufficiently detailed for a -recipient of ordinary skill to be able to understand it. - -5. Termination --------------- - -5.1. The rights granted under this License will terminate automatically -if You fail to comply with any of its terms. However, if You become -compliant, then the rights granted under this License from a particular -Contributor are reinstated (a) provisionally, unless and until such -Contributor explicitly and finally terminates Your grants, and (b) on an -ongoing basis, if such Contributor fails to notify You of the -non-compliance by some reasonable means prior to 60 days after You have -come back into compliance. Moreover, Your grants from a particular -Contributor are reinstated on an ongoing basis if such Contributor -notifies You of the non-compliance by some reasonable means, this is the -first time You have received notice of non-compliance with this License -from such Contributor, and You become compliant prior to 30 days after -Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent -infringement claim (excluding declaratory judgment actions, -counter-claims, and cross-claims) alleging that a Contributor Version -directly or indirectly infringes any patent, then the rights granted to -You by any and all Contributors for the Covered Software under Section -2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all -end user license agreements (excluding distributors and resellers) which -have been validly granted by You or Your distributors under this License -prior to termination shall survive termination. - -************************************************************************ -* * -* 6. Disclaimer of Warranty * -* ------------------------- * -* * -* Covered Software is provided under this License on an "as is" * -* basis, without warranty of any kind, either expressed, implied, or * -* statutory, including, without limitation, warranties that the * -* Covered Software is free of defects, merchantable, fit for a * -* particular purpose or non-infringing. The entire risk as to the * -* quality and performance of the Covered Software is with You. * -* Should any Covered Software prove defective in any respect, You * -* (not any Contributor) assume the cost of any necessary servicing, * -* repair, or correction. This disclaimer of warranty constitutes an * -* essential part of this License. No use of any Covered Software is * -* authorized under this License except under this disclaimer. * -* * -************************************************************************ - -************************************************************************ -* * -* 7. Limitation of Liability * -* -------------------------- * -* * -* Under no circumstances and under no legal theory, whether tort * -* (including negligence), contract, or otherwise, shall any * -* Contributor, or anyone who distributes Covered Software as * -* permitted above, be liable to You for any direct, indirect, * -* special, incidental, or consequential damages of any character * -* including, without limitation, damages for lost profits, loss of * -* goodwill, work stoppage, computer failure or malfunction, or any * -* and all other commercial damages or losses, even if such party * -* shall have been informed of the possibility of such damages. This * -* limitation of liability shall not apply to liability for death or * -* personal injury resulting from such party's negligence to the * -* extent applicable law prohibits such limitation. Some * -* jurisdictions do not allow the exclusion or limitation of * -* incidental or consequential damages, so this exclusion and * -* limitation may not apply to You. * -* * -************************************************************************ - -8. Litigation -------------- - -Any litigation relating to this License may be brought only in the -courts of a jurisdiction where the defendant maintains its principal -place of business and such litigation shall be governed by laws of that -jurisdiction, without reference to its conflict-of-law provisions. -Nothing in this Section shall prevent a party's ability to bring -cross-claims or counter-claims. - -9. Miscellaneous ----------------- - -This License represents the complete agreement concerning the subject -matter hereof. If any provision of this License is held to be -unenforceable, such provision shall be reformed only to the extent -necessary to make it enforceable. Any law or regulation which provides -that the language of a contract shall be construed against the drafter -shall not be used to construe this License against a Contributor. - -10. Versions of the License ---------------------------- - -10.1. New Versions - -Mozilla Foundation is the license steward. Except as provided in Section -10.3, no one other than the license steward has the right to modify or -publish new versions of this License. Each version will be given a -distinguishing version number. - -10.2. Effect of New Versions - -You may distribute the Covered Software under the terms of the version -of the License under which You originally received the Covered Software, -or under the terms of any subsequent version published by the license -steward. - -10.3. Modified Versions - -If you create software not governed by this License, and you want to -create a new license for such software, you may create and use a -modified version of this License if you rename the license and remove -any references to the name of the license steward (except to note that -such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary -Licenses - -If You choose to distribute Source Code Form that is Incompatible With -Secondary Licenses under the terms of this version of the License, the -notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice -------------------------------------------- - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular -file, then You may include the notice in a location (such as a LICENSE -file in a relevant directory) where a recipient would be likely to look -for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice ---------------------------------------------------------- - - This Source Code Form is "Incompatible With Secondary Licenses", as - defined by the Mozilla Public License, v. 2.0. +MIT License + +Copyright (c) 2022 Modular Open Source Identity Platform + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 6593015a00..3fb04f542c 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Be sure to have the following build tools installed before proceeding: ## Generate keystore for APK signing ```shell + # Generate and use Debug keystore for development and testing purposes keytool \ -genkey -v \ -storetype PKCS12 \ @@ -23,6 +24,21 @@ keytool \ -validity 10000 \ -storepass 'android' \ -keypass 'android' \ + -alias androiddebugkey \ + -keystore android/app/debug.keystore \ + -dname "CN=io.mosip.residentapp,OU=,O=,L=,S=,C=US" +``` + +```shell + # Generate and use Release keystore for Publishing to Play store + keytool \ + -genkey -v \ + -storetype PKCS12 \ + -keyalg RSA \ + -keysize 2048 \ + -validity 10000 \ + -storepass '' \ + -keypass '' \ -alias androidreleasekey \ -keystore android/app/release.keystore \ -dname "CN=io.mosip.residentapp,OU=,O=,L=,S=,C=US" @@ -36,15 +52,10 @@ Create a `.env.local` file using `.env` as your template: ``` MIMOTO_HOST= -GOOGLE_NEARBY_MESSAGES_API_KEY= ``` And `android/local.properties`: -``` -GOOGLE_NEARBY_MESSAGES_API_KEY= -``` - More info here: [Setup Google Nearby Messages in React](https://github.com/mrousavy/react-native-google-nearby-messages#usage) ### Android @@ -93,15 +104,19 @@ You need Android SDK CLI to build APK. # 1. Install dependencies npm install -# Setup the environment variable for keystore -export RELEASE_KEYSTORE=release.keystore +# 2. Setup the environment variables for the keystore + +# Debug keystore +export DEBUG_KEYSTORE_ALIAS=androiddebugkey +export DEBUG_KEYSTORE_PASSWORD=android + +# Release keystore export RELEASE_KEYSTORE_ALIAS=androidreleasekey -export RELEASE_KEYSTORE_PASSWORD=android +export RELEASE_KEYSTORE_PASSWORD= + # https://hostname/residentmobileapp is the Mimoto service url export BACKEND_SERVICE_URL=https://hostname/residentmobileapp -# Use DEBUG_KEYSTORE, DEBUG_KEYSTORE_ALIAS, DEBUG_KEYSTORE_PASSWORD for debug build - # Use one of following command to build the flavor you need. # Build for Mosip Philippines test npm run build:android:ph @@ -143,6 +158,38 @@ More info here: - [React Native - Publishing to the App Store](https://reactnative.dev/docs/publishing-to-app-store) - [Apple Developer - Distributing Your App for Beta Testing and Releases](https://developer.apple.com/documentation/xcode/distributing-your-app-for-beta-testing-and-releases) +## View the complete DB : + +1. Connect your phone to the laptop and open Android Studio. +2. On the bottom right vertical tab you will find a `Device File Explorer` button. Click on it and select you phone. +3. Navigate to `data -> data -> io.mosip.residentapp ->databases`. You will find a file named `RKStorage` in it. Download it. +4. Download [DB Browser for SQLite](https://sqlitebrowser.org/dl/) . +5. Open the file in this application. Click on `Browse Data` button and select `catalystLocalStorage` table. Now you should be able to view the entire DB of Inji. + ## Credits Credits listed [here](/Credits.md) + +## Congratulations! :tada: + +You've successfully run and modified your React Native App. :partying_face: + +### Now what? + +- If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps). +- If you're curious to learn more about React Native, check out the [Introduction to React Native](https://reactnative.dev/docs/getting-started). + +# Troubleshooting + +If you can't get this to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page. + +# Learn More + +To learn more about React Native, take a look at the following resources: + +- [React Native Website](https://reactnative.dev) - learn more about React Native. +- [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment. +- [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**. +- [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts. +- [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native. + diff --git a/android/.project b/android/.project index 03a28c1378..69649cfb26 100644 --- a/android/.project +++ b/android/.project @@ -1,6 +1,6 @@ - MOSIP Resident App + Inji Project android created by Buildship. diff --git a/android/.settings/org.eclipse.buildship.core.prefs b/android/.settings/org.eclipse.buildship.core.prefs deleted file mode 100644 index 267336a273..0000000000 --- a/android/.settings/org.eclipse.buildship.core.prefs +++ /dev/null @@ -1,13 +0,0 @@ -arguments= -auto.sync=false -build.scans.enabled=false -connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) -connection.project.dir= -eclipse.preferences.version=1 -gradle.user.home= -java.home=C\:/Program Files/OpenJDK/openjdk-11.0.12_7 -jvm.arguments= -offline.mode=false -override.workspace.settings=true -show.console.view=true -show.executions.view=true diff --git a/android/Gemfile b/android/Gemfile new file mode 100644 index 0000000000..cdd3a6b349 --- /dev/null +++ b/android/Gemfile @@ -0,0 +1,6 @@ +source "https://rubygems.org" + +gem "fastlane" + +plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') +eval_gemfile(plugins_path) if File.exist?(plugins_path) diff --git a/android/Gemfile.lock b/android/Gemfile.lock new file mode 100644 index 0000000000..8e33dcaeaf --- /dev/null +++ b/android/Gemfile.lock @@ -0,0 +1,220 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.6) + rexml + addressable (2.8.4) + public_suffix (>= 2.0.2, < 6.0) + artifactory (3.0.15) + atomos (0.1.3) + aws-eventstream (1.2.0) + aws-partitions (1.765.0) + aws-sdk-core (3.172.0) + aws-eventstream (~> 1, >= 1.0.2) + aws-partitions (~> 1, >= 1.651.0) + aws-sigv4 (~> 1.5) + jmespath (~> 1, >= 1.6.1) + aws-sdk-kms (1.64.0) + aws-sdk-core (~> 3, >= 3.165.0) + aws-sigv4 (~> 1.1) + aws-sdk-s3 (1.122.0) + aws-sdk-core (~> 3, >= 3.165.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.4) + aws-sigv4 (1.5.2) + aws-eventstream (~> 1, >= 1.0.2) + babosa (1.0.4) + claide (1.1.0) + colored (1.2) + colored2 (3.1.2) + commander (4.6.0) + highline (~> 2.0.0) + declarative (0.0.20) + digest-crc (0.6.4) + rake (>= 12.0.0, < 14.0.0) + domain_name (0.5.20190701) + unf (>= 0.0.5, < 1.0.0) + dotenv (2.8.1) + emoji_regex (3.2.3) + excon (0.99.0) + faraday (1.10.3) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) + ruby2_keywords (>= 0.0.4) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) + http-cookie (~> 1.0.0) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-multipart (1.0.4) + multipart-post (~> 2) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday-retry (1.0.3) + faraday_middleware (1.2.0) + faraday (~> 1.0) + fastimage (2.2.6) + fastlane (2.212.2) + CFPropertyList (>= 2.3, < 4.0.0) + addressable (>= 2.8, < 3.0.0) + artifactory (~> 3.0) + aws-sdk-s3 (~> 1.0) + babosa (>= 1.0.3, < 2.0.0) + bundler (>= 1.12.0, < 3.0.0) + colored + commander (~> 4.6) + dotenv (>= 2.1.1, < 3.0.0) + emoji_regex (>= 0.1, < 4.0) + excon (>= 0.71.0, < 1.0.0) + faraday (~> 1.0) + faraday-cookie_jar (~> 0.0.6) + faraday_middleware (~> 1.0) + fastimage (>= 2.1.0, < 3.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-apis-androidpublisher_v3 (~> 0.3) + google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-storage (~> 1.31) + highline (~> 2.0) + json (< 3.0.0) + jwt (>= 2.1.0, < 3) + mini_magick (>= 4.9.4, < 5.0.0) + multipart-post (~> 2.0.0) + naturally (~> 2.2) + optparse (~> 0.1.1) + plist (>= 3.1.0, < 4.0.0) + rubyzip (>= 2.0.0, < 3.0.0) + security (= 0.1.3) + simctl (~> 1.6.3) + terminal-notifier (>= 2.0.0, < 3.0.0) + terminal-table (>= 1.4.5, < 2.0.0) + tty-screen (>= 0.6.3, < 1.0.0) + tty-spinner (>= 0.8.0, < 1.0.0) + word_wrap (~> 1.0.0) + xcodeproj (>= 1.13.0, < 2.0.0) + xcpretty (~> 0.3.0) + xcpretty-travis-formatter (>= 0.0.3) + fastlane-plugin-increment_version_code (0.4.3) + gh_inspector (1.1.3) + google-apis-androidpublisher_v3 (0.42.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-core (0.11.0) + addressable (~> 2.5, >= 2.5.1) + googleauth (>= 0.16.2, < 2.a) + httpclient (>= 2.8.1, < 3.a) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.a) + rexml + webrick + google-apis-iamcredentials_v1 (0.17.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-playcustomapp_v1 (0.13.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-storage_v1 (0.19.0) + google-apis-core (>= 0.9.0, < 2.a) + google-cloud-core (1.6.0) + google-cloud-env (~> 1.0) + google-cloud-errors (~> 1.0) + google-cloud-env (1.6.0) + faraday (>= 0.17.3, < 3.0) + google-cloud-errors (1.3.1) + google-cloud-storage (1.44.0) + addressable (~> 2.8) + digest-crc (~> 0.4) + google-apis-iamcredentials_v1 (~> 0.1) + google-apis-storage_v1 (~> 0.19.0) + google-cloud-core (~> 1.6) + googleauth (>= 0.16.2, < 2.a) + mini_mime (~> 1.0) + googleauth (1.5.2) + faraday (>= 0.17.3, < 3.a) + jwt (>= 1.4, < 3.0) + memoist (~> 0.16) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (>= 0.16, < 2.a) + highline (2.0.3) + http-cookie (1.0.5) + domain_name (~> 0.5) + httpclient (2.8.3) + jmespath (1.6.2) + json (2.6.3) + jwt (2.7.0) + memoist (0.16.2) + mini_magick (4.12.0) + mini_mime (1.1.2) + multi_json (1.15.0) + multipart-post (2.0.0) + nanaimo (0.3.0) + naturally (2.2.1) + optparse (0.1.1) + os (1.1.4) + plist (3.7.0) + public_suffix (5.0.1) + rake (13.0.6) + representable (3.2.0) + declarative (< 0.1.0) + trailblazer-option (>= 0.1.1, < 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) + rexml (3.2.5) + rouge (2.0.7) + ruby2_keywords (0.0.5) + rubyzip (2.3.2) + security (0.1.3) + signet (0.17.0) + addressable (~> 2.8) + faraday (>= 0.17.5, < 3.a) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + simctl (1.6.10) + CFPropertyList + naturally + terminal-notifier (2.0.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + trailblazer-option (0.1.2) + tty-cursor (0.7.1) + tty-screen (0.8.1) + tty-spinner (0.9.3) + tty-cursor (~> 0.7) + uber (0.1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.8.2) + unicode-display_width (1.8.0) + webrick (1.8.1) + word_wrap (1.0.0) + xcodeproj (1.22.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.0) + rexml (~> 3.2.4) + xcpretty (0.3.0) + rouge (~> 2.0.7) + xcpretty-travis-formatter (1.0.1) + xcpretty (~> 0.2, >= 0.0.7) + +PLATFORMS + arm64-darwin-21 + +DEPENDENCIES + fastlane + fastlane-plugin-increment_version_code + +BUNDLED WITH + 2.4.10 diff --git a/android/app/BUCK b/android/app/BUCK deleted file mode 100644 index b4ce6f6aae..0000000000 --- a/android/app/BUCK +++ /dev/null @@ -1,55 +0,0 @@ -# To learn about Buck see [Docs](https://buckbuild.com/). -# To run your application with Buck: -# - install Buck -# - `npm start` - to start the packager -# - `cd android` -# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` -# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck -# - `buck install -r android/app` - compile, install and run application -# - -load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") - -lib_deps = [] - -create_aar_targets(glob(["libs/*.aar"])) - -create_jar_targets(glob(["libs/*.jar"])) - -android_library( - name = "all-libs", - exported_deps = lib_deps, -) - -android_library( - name = "app-code", - srcs = glob([ - "src/main/java/**/*.java", - ]), - deps = [ - ":all-libs", - ":build_config", - ":res", - ], -) - -android_build_config( - name = "build_config", - package = "io.mosip.residentapp", -) - -android_resource( - name = "res", - package = "io.mosip.residentapp", - res = "src/main/res", -) - -android_binary( - name = "app", - keystore = "//android/keystores:debug", - manifest = "src/main/AndroidManifest.xml", - package_type = "debug", - deps = [ - ":app-code", - ], -) diff --git a/android/app/build.gradle b/android/app/build.gradle index 1bac4f79ef..1cfe9006b3 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -1,186 +1,132 @@ -plugins { +plugins { id 'com.gladed.androidgitversion' version '0.4.14' } apply plugin: "com.android.application" -apply plugin: 'com.google.gms.google-services' -apply plugin: 'com.google.firebase.crashlytics' -import com.android.build.OutputFile - -/** - * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets - * and bundleReleaseJsAndAssets). - * These basically call `react-native bundle` with the correct arguments during the Android build - * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the - * bundle directly from the development server. Below you can see all the possible configurations - * and their defaults. If you decide to add a configuration block, make sure to add it before the - * `apply from: "../../node_modules/react-native/react.gradle"` line. - * - * project.ext.react = [ - * // the name of the generated asset file containing your JS bundle - * bundleAssetName: "index.android.bundle", - * - * // the entry file for bundle generation. If none specified and - * // "index.android.js" exists, it will be used. Otherwise "index.js" is - * // default. Can be overridden with ENTRY_FILE environment variable. - * entryFile: "index.android.js", - * - * // https://reactnative.dev/docs/performance#enable-the-ram-format - * bundleCommand: "ram-bundle", - * - * // whether to bundle JS and assets in debug mode - * bundleInDebug: false, - * - * // whether to bundle JS and assets in release mode - * bundleInRelease: true, - * - * // whether to bundle JS and assets in another build variant (if configured). - * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants - * // The configuration property can be in the following formats - * // 'bundleIn${productFlavor}${buildType}' - * // 'bundleIn${buildType}' - * // bundleInFreeDebug: true, - * // bundleInPaidRelease: true, - * // bundleInBeta: true, - * - * // whether to disable dev mode in custom build variants (by default only disabled in release) - * // for example: to disable dev mode in the staging build type (if configured) - * devDisabledInStaging: true, - * // The configuration property can be in the following formats - * // 'devDisabledIn${productFlavor}${buildType}' - * // 'devDisabledIn${buildType}' - * - * // the root of your project, i.e. where "package.json" lives - * root: "../../", - * - * // where to put the JS bundle asset in debug mode - * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", - * - * // where to put the JS bundle asset in release mode - * jsBundleDirRelease: "$buildDir/intermediates/assets/release", - * - * // where to put drawable resources / React Native assets, e.g. the ones you use via - * // require('./image.png')), in debug mode - * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", - * - * // where to put drawable resources / React Native assets, e.g. the ones you use via - * // require('./image.png')), in release mode - * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", - * - * // by default the gradle tasks are skipped if none of the JS files or assets change; this means - * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to - * // date; if you have any other folders that you want to ignore for performance reasons (gradle - * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ - * // for example, you might want to remove it from here. - * inputExcludes: ["android/**", "ios/**"], - * - * // override which node gets called and with what additional arguments - * nodeExecutableAndArgs: ["node"], - * - * // supply additional arguments to the packager - * extraPackagerArgs: [] - * ] - */ +apply plugin: "com.facebook.react" -project.ext.react = [ - enableHermes: (findProperty('expo.jsEngine') ?: "jsc") == "hermes", - bundleInDebug: true, - bundleInRelease: true, - devDisabledInRelease: true, - cliPath: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/cli.js", - hermesCommand: new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/%OS-BIN%/hermesc", - composeSourceMapsPath: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/scripts/compose-source-maps.js", -] +import com.android.build.OutputFile -apply from: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../react.gradle") +react { + /* Folders */ + // The root of your project, i.e. where "package.json" lives. Default is '..' + // root = file("../") + // The folder where the react-native NPM package is. Default is ../node_modules/react-native + // reactNativeDir = file("../node_modules/react-native") + // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen + // codegenDir = file("../node_modules/@react-native/codegen") + // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js + // cliFile = file("../node_modules/react-native/cli.js") + /* Variants */ + // The list of variants to that are debuggable. For those we're going to + // skip the bundling of the JS bundle and the assets. By default is just 'debug'. + // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. + // debuggableVariants = ["liteDebug", "prodDebug"] + /* Bundling */ + // A list containing the node command and its flags. Default is just 'node'. + // nodeExecutableAndArgs = ["node"] + // + // The command to run when bundling. By default is 'bundle' + // bundleCommand = "ram-bundle" + // + // The path to the CLI configuration file. Default is empty. + // bundleConfig = file(../rn-cli.config.js) + // + // The name of the generated asset file containing your JS bundle + // bundleAssetName = "MyApplication.android.bundle" + // + // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' + // entryFile = file("../js/MyApplication.android.js") + // + // A list of extra flags to pass to the 'bundle' commands. + // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle + // extraPackagerArgs = [] + /* Hermes Commands */ + // The hermes compiler command to run. By default it is 'hermesc' + // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" + // + // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" + // hermesFlags = ["-O", "-output-source-map"] +} /** - * Set this to true to create two separate APKs instead of one: - * - An APK that only works on ARM devices - * - An APK that only works on x86 devices - * The advantage is the size of the APK is reduced by about 4MB. - * Upload all the APKs to the Play Store and people will download - * the correct one based on the CPU architecture of their device. + * Set this to true to create four separate APKs instead of one, + * one for each native architecture. This is useful if you don't + * use App Bundles (https://developer.android.com/guide/app-bundle/) + * and want to have separate APKs to upload to the Play Store. */ -def enableSeparateBuildPerCPUArchitecture = false +def enableSeparateBuildPerCPUArchitecture = true /** - * Run Proguard to shrink the Java bytecode in release builds. + * Set this to true to Run Proguard on Release builds to minify the Java bytecode. */ def enableProguardInReleaseBuilds = false /** - * The preferred build flavor of JavaScriptCore. + * The preferred build flavor of JavaScriptCore (JSC) * * For example, to use the international variant, you can use: * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` * * The international variant includes ICU i18n library and necessary data * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that - * give correct results when using with locales other than en-US. Note that + * give correct results when using with locales other than en-US. Note that * this variant is about 6MiB larger per architecture than default. */ def jscFlavor = 'org.webkit:android-jsc:+' /** - * Whether to enable the Hermes VM. - * - * This should be set on project.ext.react and mirrored here. If it is not set - * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode - * and the benefits of using Hermes will therefore be sharply reduced. + * Private function to get the list of Native Architectures you want to build. + * This reads the value from reactNativeArchitectures in your gradle.properties + * file and works together with the --active-arch-only flag of react-native run-android. */ -def enableHermes = project.ext.react.get("enableHermes", false); +def reactNativeArchitectures() { + def value = project.getProperties().get("reactNativeArchitectures") + return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] +} androidGitVersion { - baseCode 1 + baseCode 0 + codeFormat 'MXXNXXPXX' + format '%tag_%%commit_%%branch%' } android { + ndkVersion rootProject.ext.ndkVersion compileSdkVersion rootProject.ext.compileSdkVersion 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" + APP_NAME= "@string/app_name" } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } + namespace 'io.mosip.residentapp' defaultConfig { applicationId 'io.mosip.residentapp' minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - // Update versionName and/or versionCode via git tag - // More info here: - // https://github.com/gladed/gradle-android-git-version#3-use-a-git-tag-to-specify-your-version-number-see-semantic-versioning versionName androidGitVersion.name() - versionCode androidGitVersion.code() - - Properties properties = new Properties() - properties.load(project.rootProject.file('local.properties').newDataInputStream()) + versionCode 1 manifestPlaceholders = [ - APP_NAME: APP_NAME_RELEASE, - GOOGLE_NEARBY_MESSAGES_API_KEY: "${properties.getProperty('GOOGLE_NEARBY_MESSAGES_API_KEY')}" + APP_NAME: APP_NAME, + appAuthRedirectScheme: 'io.mosip.residentapp.inji' ] } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture - universalApk false // If true, also generate a universal APK + universalApk true // If true, also generate a universal APK include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } } + signingConfigs { release { - def keystore = System.getenv("RELEASE_KEYSTORE") ?: "debug.keystore" - def keystoreAlias = System.getenv("RELEASE_KEYSTORE_ALIAS") ?: "androiddebugkey" - def keystorePass = System.getenv("RELEASE_KEYSTORE_PASSWORD") ?: "android" + def keystore = file('release.keystore') + def keystoreAlias = System.getenv("RELEASE_KEYSTORE_ALIAS") + def keystorePass = System.getenv("RELEASE_KEYSTORE_PASSWORD") storeFile file("$keystore") storePassword "$keystorePass" keyAlias "$keystoreAlias" @@ -189,9 +135,9 @@ android { v1SigningEnabled false } debug { - def keystore = System.getenv("DEBUG_KEYSTORE") ?: "debug.keystore" - def keystoreAlias = System.getenv("DEBUG_KEYSTORE_ALIAS") ?: "androiddebugkey" - def keystorePass = System.getenv("DEBUG_KEYSTORE_PASSWORD") ?: "android" + def keystore = file('debug.keystore') + def keystoreAlias = System.getenv("DEBUG_KEYSTORE_ALIAS") + def keystorePass = System.getenv("DEBUG_KEYSTORE_PASSWORD") storeFile file("$keystore") storePassword "$keystorePass" keyAlias "$keystoreAlias" @@ -205,6 +151,10 @@ android { signingConfig signingConfigs.debug } release { + lintOptions { + checkReleaseBuilds false + abortOnError false + } // Caution! In production, you need to generate your own keystore file. // see https://reactnative.dev/docs/signed-apk-android. signingConfig signingConfigs.release @@ -216,41 +166,52 @@ android { flavorDimensions "inji" productFlavors { - mosip { - versionName defaultConfig.versionName + "-mosip" - manifestPlaceholders = [ - APP_NAME: APP_NAME_MOSIP - ] + residentapp { + versionName defaultConfig.versionName + dimension "inji" + resValue "string", "app_name", "Inji" + } + inji { + applicationId "io.mosip.inji.wallet" + versionName defaultConfig.versionName + dimension "inji" + resValue "string", "app_name", "Inji Wallet" + } + collab { + applicationId "io.mosip.inji.collab" + versionName defaultConfig.versionName dimension "inji" + resValue "string", "app_name", "Inji Wallet Collab" } - newlogic { - versionName defaultConfig.versionName + "-newlogic" - manifestPlaceholders = [ - APP_NAME: APP_NAME_NEWLOGIC - ] + synergy { + applicationId "io.mosip.inji.synergy" + versionName defaultConfig.versionName dimension "inji" + resValue "string", "app_name", "Inji Wallet Synergy" } - ph { - versionName defaultConfig.versionName + "-ph" - manifestPlaceholders = [ - APP_NAME: APP_NAME_PH - ] + mec { + applicationId "io.mosip.inji.mec" + versionName defaultConfig.versionName dimension "inji" + resValue "string", "app_name", "Inji Wallet Mec" } } android.applicationVariants.all { variant -> - variant.outputs.all { + variant.outputs.all { output -> def datetime = new Date().format('yyyyMMdd_HHmm') - outputFileName = "${defaultConfig.applicationId}-${variant.versionName}_${datetime}.apk" + def architecture = output.getFilter(com.android.build.OutputFile.ABI) ?: "universal" + outputFileName = "Inji_${architecture}.apk" } } } dependencies { - implementation fileTree(dir: "libs", include: ["*.jar"]) - //noinspection GradleDynamicVersion - implementation "com.facebook.react:react-native:+"// From node_modules + + // The version of react-native is set by the React Native Gradle Plugin + implementation("com.facebook.react:react-android") + + implementation 'com.facebook.soloader:soloader:0.10.1+' def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true"; def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true"; @@ -261,6 +222,7 @@ dependencies { if (isGifEnabled || isWebpEnabled) { implementation 'com.facebook.fresco:fresco:2.0.0' implementation 'com.facebook.fresco:imagepipeline-okhttp3:2.0.0' + implementation 'com.squareup.okhttp3:okhttp-urlconnection:4.4.1' } if (isGifEnabled) { @@ -278,9 +240,7 @@ dependencies { } implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" - debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { - exclude group:'com.facebook.fbjni' - } + debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { exclude group:'com.facebook.flipper' exclude group:'com.squareup.okhttp3', module:'okhttp' @@ -289,34 +249,13 @@ dependencies { exclude group:'com.facebook.flipper' } - if (enableHermes) { - debugImplementation files(new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute(null, rootDir).text.trim(), "../android/hermes-debug.aar")) - releaseImplementation files(new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute(null, rootDir).text.trim(), "../android/hermes-release.aar")) + if (hermesEnabled.toBoolean()) { + implementation("com.facebook.react:hermes-android") } else { implementation jscFlavor } - // Firebase - implementation 'com.google.firebase:firebase-crashlytics:17.3.1' - implementation 'com.google.firebase:firebase-analytics:18.0.2' implementation 'com.jakewharton.timber:timber:4.7.1' } -// Run this once to be able to run the application with BUCK -// puts all compile dependencies into folder libs for BUCK to use -task copyDownloadableDepsToLibs(type: Copy) { - from configurations.compile - into 'libs' -} - -apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle"); -applyNativeModulesAppBuildGradle(project) -apply from: "./eas-build.gradle" - -try { - def servicesJSON = file('google-services.json') - if (servicesJSON.text) { - apply plugin: 'com.google.gms.google-services' - } -} catch(Exception e) { - logger.warn("google-services.json not found, google-services plugin not applied. Push Notifications won't work") -} +apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) +apply from: "./eas-build.gradle" \ No newline at end of file diff --git a/android/app/build_defs.bzl b/android/app/build_defs.bzl deleted file mode 100644 index fff270f8d1..0000000000 --- a/android/app/build_defs.bzl +++ /dev/null @@ -1,19 +0,0 @@ -"""Helper definitions to glob .aar and .jar targets""" - -def create_aar_targets(aarfiles): - for aarfile in aarfiles: - name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] - lib_deps.append(":" + name) - android_prebuilt_aar( - name = name, - aar = aarfile, - ) - -def create_jar_targets(jarfiles): - for jarfile in jarfiles: - name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] - lib_deps.append(":" + name) - prebuilt_jar( - name = name, - binary_jar = jarfile, - ) diff --git a/android/app/debug.keystore b/android/app/debug.keystore deleted file mode 100644 index 364e105ed3..0000000000 Binary files a/android/app/debug.keystore and /dev/null differ diff --git a/android/app/google-services.json b/android/app/google-services.json deleted file mode 100644 index 3d2bb016da..0000000000 --- a/android/app/google-services.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "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" -} \ No newline at end of file diff --git a/android/app/google-services.json.gpg b/android/app/google-services.json.gpg deleted file mode 100644 index 6303fa5765..0000000000 Binary files a/android/app/google-services.json.gpg and /dev/null differ diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index 50a047e612..06b6486cc0 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -2,6 +2,18 @@ xmlns:tools="http://schemas.android.com/tools"> + + + + + + + + + + > + + - diff --git a/android/app/src/debug/java/io/mosip/residentapp/ReactNativeFlipper.java b/android/app/src/debug/java/io/mosip/residentapp/ReactNativeFlipper.java index ef368bd9d2..f4263ee7e6 100644 --- a/android/app/src/debug/java/io/mosip/residentapp/ReactNativeFlipper.java +++ b/android/app/src/debug/java/io/mosip/residentapp/ReactNativeFlipper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * *

This source code is licensed under the MIT license found in the LICENSE file in the root * directory of this source tree. @@ -17,22 +17,27 @@ import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; -import com.facebook.flipper.plugins.react.ReactFlipperPlugin; import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; +import com.facebook.react.ReactInstanceEventListener; import com.facebook.react.ReactInstanceManager; import com.facebook.react.bridge.ReactContext; import com.facebook.react.modules.network.NetworkingModule; import okhttp3.OkHttpClient; +/** + * Class responsible of loading Flipper inside your React Native application. This is the debug + * flavor of it. Here you can add your own plugins and customize the Flipper setup. + */ public class ReactNativeFlipper { public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { if (FlipperUtils.shouldEnableFlipper(context)) { final FlipperClient client = AndroidFlipperClient.getInstance(context); + client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); - client.addPlugin(new ReactFlipperPlugin()); client.addPlugin(new DatabasesFlipperPlugin(context)); client.addPlugin(new SharedPreferencesFlipperPlugin(context)); client.addPlugin(CrashReporterPlugin.getInstance()); + NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); NetworkingModule.setCustomClientBuilder( new NetworkingModule.CustomClientBuilder() { @@ -43,12 +48,13 @@ public void apply(OkHttpClient.Builder builder) { }); client.addPlugin(networkFlipperPlugin); client.start(); + // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized // Hence we run if after all native modules have been initialized ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); if (reactContext == null) { reactInstanceManager.addReactInstanceEventListener( - new ReactInstanceManager.ReactInstanceEventListener() { + new ReactInstanceEventListener() { @Override public void onReactContextInitialized(ReactContext reactContext) { reactInstanceManager.removeReactInstanceEventListener(this); diff --git a/android/app/src/debug/res/xml/network_security_config.xml b/android/app/src/debug/res/xml/network_security_config.xml new file mode 100644 index 0000000000..c1a02d62c0 --- /dev/null +++ b/android/app/src/debug/res/xml/network_security_config.xml @@ -0,0 +1,9 @@ + + + + + localhost + 10.0.2.2 + 10.0.3.2 + + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 775353eac5..4e96975dca 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,48 +1,47 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - - - + + + + + + + - - + + - - - - + + + + - + \ No newline at end of file diff --git a/android/app/src/main/java/io/mosip/residentapp/MainActivity.java b/android/app/src/main/java/io/mosip/residentapp/MainActivity.java index ef1e17f8af..35b6474a2a 100644 --- a/android/app/src/main/java/io/mosip/residentapp/MainActivity.java +++ b/android/app/src/main/java/io/mosip/residentapp/MainActivity.java @@ -1,4 +1,5 @@ package io.mosip.residentapp; +import expo.modules.ReactActivityDelegateWrapper; import android.Manifest; import android.content.Context; @@ -9,11 +10,12 @@ import androidx.annotation.CallSuper; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; -import androidx.core.content.ContextCompat; import com.facebook.react.ReactActivity; import com.facebook.react.ReactActivityDelegate; import com.facebook.react.ReactRootView; -import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView; +import com.facebook.react.ReactActivityDelegate; +import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; +import com.facebook.react.defaults.DefaultReactActivityDelegate; import expo.modules.ReactActivityDelegateWrapper; /** @@ -29,9 +31,7 @@ public class MainActivity extends ReactActivity { Manifest.permission.BLUETOOTH_ADMIN, Manifest.permission.ACCESS_WIFI_STATE, Manifest.permission.CHANGE_WIFI_STATE, - Manifest.permission.CHANGE_WIFI_MULTICAST_STATE, - Manifest.permission.ACCESS_COARSE_LOCATION, - Manifest.permission.ACCESS_FINE_LOCATION, + Manifest.permission.CHANGE_WIFI_MULTICAST_STATE }; private static final int REQUEST_CODE_REQUIRED_PERMISSIONS = 1; @@ -82,7 +82,7 @@ protected void onStart() { */ private static boolean hasPermissions(Context context, String... permissions) { for (String permission : permissions) { - if (ContextCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) { + if (context.checkCallingOrSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) { return false; } } @@ -112,16 +112,19 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis recreate(); } + /** + * Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link + * DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React + * (aka React 18) with two boolean flags. + */ @Override protected ReactActivityDelegate createReactActivityDelegate() { - return new ReactActivityDelegateWrapper( - this, - new ReactActivityDelegate(this, getMainComponentName()) { - @Override - protected ReactRootView createRootView() { - return new RNGestureHandlerEnabledRootView(MainActivity.this); - } - } - ); + return new ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED, new DefaultReactActivityDelegate( this, + getMainComponentName(), + // If you opted-in for the New Architecture, we enable the Fabric Renderer. + DefaultNewArchitectureEntryPoint.getFabricEnabled(), // fabricEnabled + // If you opted-in for the New Architecture, we enable Concurrent React (i.e. React 18). + DefaultNewArchitectureEntryPoint.getConcurrentReactEnabled() // concurrentRootEnabled + )); } } diff --git a/android/app/src/main/java/io/mosip/residentapp/MainActivity.java.bak b/android/app/src/main/java/io/mosip/residentapp/MainActivity.java.bak deleted file mode 100644 index 329fdf4c21..0000000000 --- a/android/app/src/main/java/io/mosip/residentapp/MainActivity.java.bak +++ /dev/null @@ -1,42 +0,0 @@ -package io.mosip.residentapp; - -import android.os.Bundle; - -import com.facebook.react.ReactActivity; -import com.facebook.react.ReactActivityDelegate; -import com.facebook.react.ReactRootView; -import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView; - -import expo.modules.ReactActivityDelegateWrapper; - -public class MainActivity extends ReactActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - // Set the theme to AppTheme BEFORE onCreate to support - // coloring the background, status bar, and navigation bar. - // This is required for expo-splash-screen. - setTheme(R.style.AppTheme); - super.onCreate(null); - } - - /** - * Returns the name of the main component registered from JavaScript. - * This is used to schedule rendering of the component. - */ - @Override - protected String getMainComponentName() { - return "main"; - } - - @Override - protected ReactActivityDelegate createReactActivityDelegate() { - return new ReactActivityDelegateWrapper( - this, - new ReactActivityDelegate(this, getMainComponentName()) { - @Override - protected ReactRootView createRootView() { - return new RNGestureHandlerEnabledRootView(MainActivity.this); - } - }); - } -} diff --git a/android/app/src/main/java/io/mosip/residentapp/MainApplication.java b/android/app/src/main/java/io/mosip/residentapp/MainApplication.java index 80c0d4bf5c..0271f4666d 100644 --- a/android/app/src/main/java/io/mosip/residentapp/MainApplication.java +++ b/android/app/src/main/java/io/mosip/residentapp/MainApplication.java @@ -1,4 +1,6 @@ package io.mosip.residentapp; +import expo.modules.ApplicationLifecycleDispatcher; +import expo.modules.ReactNativeHostWrapper; import android.app.Application; import android.content.Context; @@ -12,23 +14,20 @@ import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; +import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; +import com.facebook.react.defaults.DefaultReactNativeHost; import com.facebook.soloader.SoLoader; -import expo.modules.ApplicationLifecycleDispatcher; -import expo.modules.ReactNativeHostWrapper; import timber.log.Timber; import com.facebook.react.bridge.JSIModulePackage; -import com.google.firebase.analytics.FirebaseAnalytics; -import com.google.firebase.crashlytics.FirebaseCrashlytics; import java.lang.reflect.InvocationTargetException; import java.util.List; public class MainApplication extends Application implements ReactApplication { - private final ReactNativeHost mReactNativeHost = new ReactNativeHostWrapper( - this, - new ReactNativeHost(this) { + private final ReactNativeHost mReactNativeHost = + new ReactNativeHostWrapper(this, new DefaultReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; @@ -47,6 +46,14 @@ protected List getPackages() { protected String getJSMainModuleName() { return "index"; } + @Override + protected boolean isNewArchEnabled() { + return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED; + } + @Override + protected Boolean isHermesEnabled() { + return BuildConfig.IS_HERMES_ENABLED; + } }); @Override @@ -59,73 +66,21 @@ public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); - initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); - ApplicationLifecycleDispatcher.onApplicationCreate(this); + if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { + // If you opted-in for the New Architecture, we load the native entry point for this app. + DefaultNewArchitectureEntryPoint.load(); + } + ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); if (BuildConfig.DEBUG) { Timber.plant(new Timber.DebugTree()); } - // Setup Firebase - FirebaseAnalytics.getInstance(this); - Timber.plant(new CrashReportingTree()); + ApplicationLifecycleDispatcher.onApplicationCreate(this); } @Override - public void onConfigurationChanged(@NonNull Configuration newConfig) { + public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig); } - - /** - * Loads Flipper in React Native templates. Call this in the onCreate method with something like - * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); - * - * @param context - * @param reactInstanceManager - */ - private static void initializeFlipper( - Context context, ReactInstanceManager reactInstanceManager) { - if (BuildConfig.DEBUG) { - try { - /* - We use reflection here to pick up the class that initializes Flipper, - since Flipper library is not available in release mode - */ - Class aClass = Class.forName("io.mosip.residentapp.ReactNativeFlipper"); - aClass - .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) - .invoke(null, context, reactInstanceManager); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (InvocationTargetException e) { - e.printStackTrace(); - } - } - } - /** - * A tree which logs important information for crash reporting. - */ - private static class CrashReportingTree extends Timber.Tree { - FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance(); - @Override - protected void log(int priority, String tag, @NonNull String message, Throwable t) { - if (priority == Log.VERBOSE || priority == Log.DEBUG) { - return; - } - - crashlytics.setCustomKey("priority", priority); - crashlytics.setCustomKey("tag", tag); - crashlytics.log(message); - - if (t != null) { - if (priority == Log.ERROR) { - crashlytics.recordException(t); - } - } - } - } } diff --git a/android/app/src/main/res/drawable-hdpi/splashscreen_image.png b/android/app/src/main/res/drawable-hdpi/splashscreen_image.png index 7855a1f24f..74f09d47a0 100644 Binary files a/android/app/src/main/res/drawable-hdpi/splashscreen_image.png and b/android/app/src/main/res/drawable-hdpi/splashscreen_image.png differ diff --git a/android/app/src/main/res/drawable-mdpi/splashscreen_image.png b/android/app/src/main/res/drawable-mdpi/splashscreen_image.png index 7855a1f24f..b3c779cd8d 100644 Binary files a/android/app/src/main/res/drawable-mdpi/splashscreen_image.png and b/android/app/src/main/res/drawable-mdpi/splashscreen_image.png differ diff --git a/android/app/src/main/res/drawable-xhdpi/splashscreen_image.png b/android/app/src/main/res/drawable-xhdpi/splashscreen_image.png index 7855a1f24f..f0bc985d4e 100644 Binary files a/android/app/src/main/res/drawable-xhdpi/splashscreen_image.png and b/android/app/src/main/res/drawable-xhdpi/splashscreen_image.png differ diff --git a/android/app/src/main/res/drawable-xxhdpi/splashscreen_image.png b/android/app/src/main/res/drawable-xxhdpi/splashscreen_image.png index 7855a1f24f..8b9628b1e4 100644 Binary files a/android/app/src/main/res/drawable-xxhdpi/splashscreen_image.png and b/android/app/src/main/res/drawable-xxhdpi/splashscreen_image.png differ diff --git a/android/app/src/main/res/drawable-xxxhdpi/splashscreen_image.png b/android/app/src/main/res/drawable-xxxhdpi/splashscreen_image.png index 7855a1f24f..11c2705725 100644 Binary files a/android/app/src/main/res/drawable-xxxhdpi/splashscreen_image.png and b/android/app/src/main/res/drawable-xxxhdpi/splashscreen_image.png differ diff --git a/android/app/src/main/res/drawable/mosip_logo.png b/android/app/src/main/res/drawable/mosip_logo.png deleted file mode 100644 index c761d380dc..0000000000 Binary files a/android/app/src/main/res/drawable/mosip_logo.png and /dev/null differ diff --git a/android/app/src/main/res/drawable/splash_image.png b/android/app/src/main/res/drawable/splash_image.png new file mode 100644 index 0000000000..ce339f7dab Binary files /dev/null and b/android/app/src/main/res/drawable/splash_image.png differ diff --git a/android/app/src/main/res/drawable/splashscreen.xml b/android/app/src/main/res/drawable/splashscreen.xml index 70fc5faf47..341aa5379f 100644 --- a/android/app/src/main/res/drawable/splashscreen.xml +++ b/android/app/src/main/res/drawable/splashscreen.xml @@ -1,5 +1,11 @@ - - \ No newline at end of file + + + + + + diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml index 00b86e2f82..b833571586 100644 --- a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml index 00b86e2f82..b833571586 100644 --- a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png index bdb1022a81..fe1b117497 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png index 0baedc4b34..d2f6a79734 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_mosip.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher_mosip.png index 8fcc1dfcd1..d2f6a79734 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher_mosip.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher_mosip.png differ diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png index d699dce763..667f363148 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png index 20ab661b74..064fce091f 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png index 4ac95aa57d..a63d82ce88 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_mosip.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher_mosip.png index d6694772d1..a63d82ce88 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher_mosip.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher_mosip.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png index f667950c57..a832cd3f9f 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 95cfd92ba3..3bf9087161 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png index 4932bbad77..e3d82442d9 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_mosip.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_mosip.png index 763e641bbc..e3d82442d9 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_mosip.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_mosip.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png index f17fb26b13..e0575f130f 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index 2852d710f7..554bf6abce 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png index 5435db1342..0eeac74405 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_mosip.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_mosip.png index b6d6d55ec3..0eeac74405 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_mosip.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_mosip.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png index dd3eca94ea..dff3acfa6d 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index 9f64b814bc..54c78b2fe2 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png index 8e2fea97b4..aaa5b2cf58 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_mosip.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_mosip.png index b98b0328cb..aaa5b2cf58 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_mosip.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_mosip.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png index c85fb66f0b..796f0d29d9 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/android/app/src/main/res/values-night/colors.xml b/android/app/src/main/res/values-night/colors.xml index 9dc2f904b3..3c05de5be8 100644 --- a/android/app/src/main/res/values-night/colors.xml +++ b/android/app/src/main/res/values-night/colors.xml @@ -1,2 +1 @@ - \ No newline at end of file diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml index 85f04e2e5c..c9ee8c6308 100644 --- a/android/app/src/main/res/values/colors.xml +++ b/android/app/src/main/res/values/colors.xml @@ -1,7 +1,7 @@ - - #ffffff + #FFFFFF #FFFFFF #023c69 #ffffff + #ffffff \ No newline at end of file diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index 4bf7115061..d961af5b44 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -1,9 +1,5 @@ - - MOSIP Resident App - MOSIP Resident App - Mosip/Inji - MOSIP Resident App - Newlogic - MOSIP Resident App - PH - contain + cover false + undefined \ No newline at end of file diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index bef78ada36..b0cbdbeb18 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -1,4 +1,3 @@ -