Skip to content

Commit

Permalink
Merge pull request mosip#1485 from tw-mosip/injimob-1456-sprint-29-re…
Browse files Browse the repository at this point in the history
…lease

[INJIMOB-1456] Sprint 29 release handover
  • Loading branch information
swatigoel authored Jun 5, 2024
2 parents 32d3496 + 065d87b commit 3ab9c49
Show file tree
Hide file tree
Showing 186 changed files with 6,426 additions and 2,298 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ CREDENTIAL_REGISTRY_EDIT=true

DEBUG_MODE=false

#Toggle liveness detection
LIVENESS_DETECTION=true

#supported languages( en, fil, ar, hi, kn, ta)
APPLICATION_LANGUAGE=en

Expand Down
24 changes: 15 additions & 9 deletions .github/workflows/internal-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
buildName:
description: 'Build App For'
required: true
default: 'Sprint-x/Collab/release-x.x.x'
default: 'Sprint-x/QA-Inji/Release-x.x.x'
type: string
mimotoBackendServiceUrl:
description: 'Mimoto backend service URL'
Expand Down Expand Up @@ -66,11 +66,6 @@ on:
options:
- orange
- purple
buildDescription:
description: 'What to test'
required: true
default: 'QA-Triple environment'
type: string
allow_env_edit:
description: 'Edit ENV'
required: true
Expand All @@ -79,6 +74,14 @@ on:
options:
- false
- true
liveness_detection:
description: 'Detect Liveness'
required: true
default: 'true'
type: choice
options:
- false
- true

jobs:
set-client-id:
Expand Down Expand Up @@ -106,8 +109,9 @@ jobs:
MIMOTO_HOST: ${{ inputs.mimotoBackendServiceUrl }}
ESIGNET_HOST: ${{ inputs.esignetBackendServiceUrl }}
APPLICATION_THEME: ${{ inputs.theme }}
BUILD_DESCRIPTION: ${{ inputs.buildDescription }}
BUILD_DESCRIPTION: ${{ inputs.buildName }}
ALLOW_ENV_EDIT: ${{ inputs.allow_env_edit }}
LIVENESS_DETECTION: ${{ inputs.liveness_detection }}
APP_FLAVOR: ${{ inputs.injiFlavor }}
SERVICE_LOCATION: '.'
ANDROID_SERVICE_LOCATION: 'android'
Expand All @@ -132,8 +136,9 @@ jobs:
MIMOTO_HOST: ${{ inputs.mimotoBackendServiceUrl }}
ESIGNET_HOST: ${{ inputs.esignetBackendServiceUrl }}
APPLICATION_THEME: ${{ inputs.theme }}
BUILD_DESCRIPTION: ${{ inputs.buildDescription }}
BUILD_DESCRIPTION: ${{ inputs.buildName }}
ALLOW_ENV_EDIT: ${{ inputs.allow_env_edit }}
LIVENESS_DETECTION: ${{ inputs.liveness_detection }}
APP_FLAVOR: ${{ inputs.injiFlavor }}
SERVICE_LOCATION: '.'
ANDROID_SERVICE_LOCATION: 'android'
Expand All @@ -156,8 +161,9 @@ jobs:
MIMOTO_HOST: ${{ inputs.mimotoBackendServiceUrl }}
ESIGNET_HOST: ${{ inputs.esignetBackendServiceUrl }}
APPLICATION_THEME: ${{ inputs.theme }}
TESTFLIGHT_BETA_APP_DESCRIPTION: ${{ inputs.buildDescription }}
TESTFLIGHT_BETA_APP_DESCRIPTION: ${{ inputs.buildName }}
ALLOW_ENV_EDIT: ${{ inputs.allow_env_edit }}
LIVENESS_DETECTION: ${{ inputs.liveness_detection }}
TESTFLIGHT_INTERNAL_TESTERS_GROUP: ${{ inputs.internal-testers }}
APP_FLAVOR: ${{ inputs.injiFlavor }}
SERVICE_LOCATION: '.'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push-triggers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
build-android:
uses: mosip/kattu/.github/workflows/android-build.yml@master
with:
NODE_VERSION: "16.x"
NODE_VERSION: "18.x"
KEYSTORE_ALIAS: androidbuildkey
KEYSTORE_PASSWORD: 'password'
SERVICE_LOCATION: '.'
Expand Down
116 changes: 86 additions & 30 deletions .talismanrc

Large diffs are not rendered by default.

15 changes: 3 additions & 12 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ import {
} from './shared/telemetry/TelemetryUtils';
import {TelemetryConstants} from './shared/telemetry/TelemetryConstants';
import {MessageOverlay} from './components/MessageOverlay';
import SecureKeystore from '@mosip/secure-keystore';
import {NativeModules} from 'react-native';
import {isHardwareKeystoreExists} from './shared/cryptoutil/cryptoUtil';
import i18n from './i18n';
import './shared/flipperConfig';
import * as SplashScreen from 'expo-splash-screen';

SplashScreen.preventAutoHideAsync();

const {RNSecureKeystoreModule} = NativeModules;
// kludge: this is a bad practice but has been done temporarily to surface
// an occurrence of a bug with minimal residual code changes, this should
// be removed once the bug cause is determined & fixed, ref: INJI-222
Expand All @@ -52,13 +50,6 @@ const AppLayoutWrapper: React.FC = () => {
const controller = useApp();
const {t} = useTranslation('WelcomeScreen');

useEffect(() => {
async function hideAppLoading() {
await SplashScreen.hideAsync();
}
hideAppLoading();
}, []);

useEffect(() => {
if (AppState.currentState === 'active') {
appService.send(APP_EVENTS.ACTIVE());
Expand Down Expand Up @@ -127,7 +118,7 @@ const AppInitialization: React.FC = () => {

useEffect(() => {
if (isHardwareKeystoreExists) {
SecureKeystore.updatePopup(
RNSecureKeystoreModule.updatePopup(
t('biometricPopup.title'),
t('biometricPopup.description'),
);
Expand Down
9 changes: 3 additions & 6 deletions __mocks__/jest-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,9 @@ jest.mock('react-native-gesture-handler', () => {
};
});

jest.mock('@mosip/secure-keystore', () => ({
sign: jest.fn(),
encryptData: input => (input ? String(input) : 'mockedString'),
decryptData: input => (input ? String(input) : 'mockedString'),
deviceSupportsHardware: () => true,
}));
jest.mock('@invertase/react-native-apple-authentication', () => {});

jest.mock('react-native-share', () => {});

jest.mock('../machines/store', () => ({
getItem: jest.fn(),
Expand Down
6 changes: 6 additions & 0 deletions __mocks__/react-native.mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ jest.mock('react-native', () => {
SecureKeystore: {
deviceSupportsHardware: jest.fn(),
},
RNSecureKeystoreModule: {
sign: jest.fn(),
encryptData: input => (input ? String(input) : 'mockedString'),
decryptData: input => (input ? String(input) : 'mockedString'),
deviceSupportsHardware: () => true,
},
},
});

Expand Down
39 changes: 24 additions & 15 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ apply plugin: "com.android.application"
apply plugin: "com.facebook.react"
apply plugin: "org.sonarqube"

configurations.all {
resolutionStrategy.force 'androidx.activity:activity-ktx:1.7.1','androidx.activity:activity:1.7.0', 'com.fasterxml.jackson.core:jackson-core:2.14.0'
}

react {
/* Folders */
// The root of your project, i.e. where "package.json" lives. Default is '..'
Expand Down Expand Up @@ -94,9 +98,8 @@ androidGitVersion {
android {
ndkVersion rootProject.ext.ndkVersion
compileSdkVersion rootProject.ext.compileSdkVersion

ext {
APP_NAME= "@string/app_name"
APP_NAME = "@string/app_name"
}

namespace 'io.mosip.residentapp'
Expand All @@ -109,8 +112,8 @@ android {
versionCode 1

manifestPlaceholders = [
APP_NAME: APP_NAME,
appAuthRedirectScheme: 'io.mosip.residentapp.inji'
APP_NAME : APP_NAME,
appAuthRedirectScheme: 'io.mosip.residentapp.inji'
]
}

Expand All @@ -129,7 +132,7 @@ android {
def hasSonarqube = System.properties.containsKey("sonarqube")
def keystore = file('release.keystore').exists() ? file('release.keystore') : file('dummyrelease.keystore')
storeFile file("$keystore")
if (hasSonarqube && !keystore.exists() ) {
if (hasSonarqube && !keystore.exists()) {
exec {
commandLine 'keytool',
'-genkey',
Expand All @@ -147,8 +150,7 @@ android {
storePassword "password"
keyAlias "androidreleasekey"
keyPassword "password"
}
else{
} else {
def keystoreAlias = System.getenv("RELEASE_KEYSTORE_ALIAS")
def keystorePass = System.getenv("RELEASE_KEYSTORE_PASSWORD")
storePassword "$keystorePass"
Expand All @@ -169,7 +171,7 @@ android {
keyPassword "$keystorePass"
v2SigningEnabled true
v1SigningEnabled false
}else {
} else {
android.buildTypes.debug.signingConfig = null
}
}
Expand Down Expand Up @@ -242,14 +244,20 @@ android {
}
}
}

packagingOptions {
pickFirst 'lib/arm64-v8a/liblog.so'
pickFirst 'lib/armeabi-v7a/liblog.so'
pickFirst 'lib/x86/liblog.so'
pickFirst 'lib/x86_64/liblog.so'
}
}

dependencies {

// 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+'
implementation("io.mosip:pixelpass:1.2-SNAPSHOT")
implementation("io.mosip:secure-keystore:1.2-SNAPSHOT")

def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
Expand Down Expand Up @@ -278,13 +286,14 @@ dependencies {
}
compileOnly project(':react-native-android-location-services-dialog-box')
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
implementation "io.mosip:inji-vci-client:1.2-SNAPSHOT"
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'
exclude group: 'com.facebook.flipper'
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
exclude group: 'com.facebook.flipper'
}

if (hermesEnabled.toBoolean()) {
Expand All @@ -299,4 +308,4 @@ apply from: file("../../node_modules/@react-native-community/cli-platform-androi

// https://github.com/oblador/react-native-vector-icons?tab=readme-ov-file#android-setup
apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle")
apply from: "./eas-build.gradle"
apply from: "./eas-build.gradle"
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://exp.host/@anonymous/inji"/>
<activity android:name=".MainActivity" android:exported="true" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|locale|layoutDirection" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:screenOrientation="portrait">
<activity android:name=".MainActivity" android:exported="true" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|locale|layoutDirection" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand Down
31 changes: 31 additions & 0 deletions android/app/src/main/java/io/mosip/residentapp/InjiPackage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package io.mosip.residentapp;

import androidx.annotation.NonNull;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;


public class InjiPackage implements ReactPackage {
@NonNull
@Override
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactApplicationContext) {
List<NativeModule> modules = new ArrayList<>();

modules.add(new InjiVciClientModule(reactApplicationContext));
modules.add(new RNPixelpassModule(reactApplicationContext));
modules.add(new RNSecureKeystoreModule(reactApplicationContext));
return modules;
}

@NonNull
@Override
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactApplicationContext) {
return Collections.emptyList();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package io.mosip.residentapp;

import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;

import io.mosip.vciclient.VCIClient;
import io.mosip.vciclient.constants.CredentialFormat;
import io.mosip.vciclient.credentialResponse.CredentialResponse;
import io.mosip.vciclient.dto.IssuerMetaData;
import io.mosip.vciclient.proof.jwt.JWTProof;


public class InjiVciClientModule extends ReactContextBaseJavaModule {
private VCIClient vciClient;

public InjiVciClientModule(@Nullable ReactApplicationContext reactContext) {
super(reactContext);
}

@ReactMethod
public void init(String appId) {
Log.d("InjiVciClientModule", "Initializing InjiVciClientModule with " + appId);
vciClient = new VCIClient(appId);
}

@NonNull
@Override
public String getName() {
return "InjiVciClient";
}

@ReactMethod
public void requestCredential(ReadableMap issuerMetaData, String jwtProofValue, String accessToken, Promise promise) {
try {
CredentialResponse response = vciClient.requestCredential(new IssuerMetaData(
issuerMetaData.getString("credentialAudience"),
issuerMetaData.getString("credentialEndpoint"),
issuerMetaData.getInt("downloadTimeoutInMilliSeconds"),
convertReadableArrayToStringArray(issuerMetaData.getArray("credentialType")),
CredentialFormat.LDP_VC), new JWTProof(jwtProofValue)
, accessToken);
promise.resolve(response.toJsonString());
} catch (Exception exception) {
promise.reject(exception);
}
}

private String[] convertReadableArrayToStringArray(ReadableArray readableArray) {
String[] stringArray = new String[readableArray.size()];
for (int i = 0; i < readableArray.size(); i++) {
stringArray[i] = readableArray.getString(i);
}
return stringArray;
}
}
Loading

0 comments on commit 3ab9c49

Please sign in to comment.