Skip to content

Commit 91a4906

Browse files
authored
Merge pull request #1 from Piyush7034/fetch-machine
Fetch machine
2 parents 0de38b5 + 79c9a49 commit 91a4906

File tree

1,043 files changed

+587306
-162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,043 files changed

+587306
-162
lines changed

android/app/build.gradle

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ android {
4141
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
4242
minSdkVersion 28
4343
targetSdkVersion flutter.targetSdkVersion
44-
versionCode flutterVersionCode.toInteger()
45-
versionName flutterVersionName
44+
versionCode 1
45+
versionName "1.0"
46+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
47+
buildConfigField("String", "BASE_URL", rootProject.ext.serverBaseURL)
4648
}
4749

4850
buildTypes {
@@ -122,8 +124,11 @@ dependencies {
122124
implementation 'org.bouncycastle:bcprov-jdk15on:1.59'
123125
implementation 'com.auth0.android:jwtdecode:2.0.1'
124126

127+
implementation project(':clientmanager')
128+
implementation project(':keymanager')
129+
implementation project(':packetmanager')
125130

126-
implementation files('libs/keymanager-debug.aar')
127-
implementation files('libs/clientmanager-debug.aar')
128-
implementation files('libs/packetmanager-debug.aar')
131+
// implementation files('libs/keymanager-debug.aar')
132+
// implementation files('libs/clientmanager-debug.aar')
133+
// implementation files('libs/packetmanager-debug.aar')
129134
}
-612 KB
Binary file not shown.

android/app/libs/keymanager-debug.aar

-75.3 KB
Binary file not shown.
-101 KB
Binary file not shown.
-29.9 MB
Binary file not shown.

android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="io.mosip.registration_client">
3+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
4+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
35
<application
46
android:label="registration_client"
57
android:name="${applicationName}"

android/app/src/main/java/io/mosip/registration_client/AboutActivityService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818

1919
public class AboutActivityService {
2020

21-
public void testMachine(ClientCryptoManagerService clientCryptoManagerService, MethodChannel.Result result) {
22-
String data = clientCryptoManagerService.testMachine();
23-
result.success("data: " + data);
24-
}
21+
// public void testMachine(ClientCryptoManagerService clientCryptoManagerService, MethodChannel.Result result) {
22+
// String data = clientCryptoManagerService.testMachine();
23+
// result.success("data: " + data);
24+
// }
2525

2626
public void getMachineDetails(ClientCryptoManagerService clientCryptoManagerService, MethodChannel.Result result) {
2727
Map<String, String> details =

android/app/src/main/java/io/mosip/registration_client/LoginActivityService.java

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
package io.mosip.registration_client;
88

99
import android.util.Log;
10+
import android.widget.Toast;
1011

1112
import org.json.JSONObject;
1213

@@ -32,6 +33,22 @@ public class LoginActivityService {
3233
Map<String, String> responseMap = new HashMap<>();
3334
JSONObject object;
3435

36+
public void usernameValidation(String username,
37+
LoginService loginService,
38+
MethodChannel.Result result) {
39+
if(!loginService.isValidUserId(username)) {
40+
responseMap.put("user_response", "User not found!");
41+
responseMap.put("isUserPresent", "false");
42+
object = new JSONObject(responseMap);
43+
result.success(object.toString());
44+
return;
45+
}
46+
responseMap.put("user_response", "User Validated!");
47+
responseMap.put("isUserPresent", "true");
48+
object = new JSONObject(responseMap);
49+
result.success(object.toString());
50+
}
51+
3552
private boolean validateLogin(String username, String password, LoginService loginService) {
3653
if(username == null || username.trim().length() == 0){
3754
Log.e(getClass().getSimpleName(), "username incorrect");
@@ -69,16 +86,17 @@ public void onResponse(Call call, Response response) {
6986
result.success(object.toString());
7087
return;
7188
} catch (InvalidMachineSpecIDException e) {
72-
error = new ServiceError("", e.getMessage());
89+
error = new ServiceError("MACHINE", "Machine not found!");
7390
Log.e(getClass().getSimpleName(), "Failed to save auth token", e);
7491
} catch (Exception e) {
75-
error = new ServiceError("", e.getMessage());
92+
error = new ServiceError("", "Incorrect Password!");
7693
Log.e(getClass().getSimpleName(), "Failed to save auth token", e);
7794
}
7895
}
7996

80-
Log.e(getClass().getSimpleName(), "Some error occurred! " + error);
81-
login_response = error == null ? "Login Failed! Try Again" : "Error: " + error.getMessage();
97+
login_response = error == null ? "Login Failed! Try Again"
98+
: error.getMessage().equals("Invalid Request") ? "Password Incorrect!"
99+
: error.getMessage();
82100
responseMap.put("isLoggedIn", "false");
83101
responseMap.put("login_response", login_response);
84102
object = new JSONObject(responseMap);

android/app/src/main/java/io/mosip/registration_client/MainActivity.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,15 @@ public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
8383
initializeAppComponent();
8484
break;
8585

86-
case "testMachine":
87-
new AboutActivityService().testMachine(clientCryptoManagerService, result);
88-
break;
89-
9086
case "getMachineDetails":
9187
new AboutActivityService().getMachineDetails(clientCryptoManagerService, result);
9288
break;
9389

90+
case "validateUsername":
91+
String usernameVal = call.argument("username");
92+
new LoginActivityService().usernameValidation(usernameVal, loginService, result);
93+
break;
94+
9495
case "login":
9596
String username = call.argument("username");
9697
String password = call.argument("password");

android/build.gradle

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,46 @@ buildscript {
33
repositories {
44
google()
55
mavenCentral()
6+
maven { url "https://plugins.gradle.org/m2/" }
67
}
78

89
dependencies {
910
classpath 'com.android.tools.build:gradle:7.2.0'
1011
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12+
classpath "com.ibotta:plugin:1.2.0"
13+
//Jacoco Plugin
14+
classpath "org.jacoco:org.jacoco.core:0.8.7"
1115
}
1216
}
1317

18+
plugins {
19+
id "org.sonarqube" version "3.0"
20+
}
21+
1422
allprojects {
1523
repositories {
1624
google()
1725
mavenCentral()
1826
}
1927
}
2028

29+
ext {
30+
compileSdkVersion = 31
31+
buildToolsVersion = "31.0.0"
32+
33+
minSdkVersion = 28
34+
targetSdkVersion = 31
35+
36+
junitVersion = "4.+"
37+
38+
// clientmanager Library Info
39+
clientmanagerLibVersionCode = 1
40+
clientmanagerLibVersionName = "\"1.0.0\""
41+
42+
serverBaseURL = "\"https://api-internal.dev.mosip.net/\""
43+
}
44+
45+
2146
rootProject.buildDir = '../build'
2247
subprojects {
2348
project.buildDir = "${rootProject.buildDir}/${project.name}"

android/clientmanager/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

android/clientmanager/build.gradle

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
plugins {
2+
id 'com.android.library'
3+
id 'com.ibotta.gradle.aop'
4+
id "org.sonarqube"
5+
}
6+
7+
apply from: '../jacoco.gradle'
8+
9+
android {
10+
compileSdkVersion rootProject.ext.compileSdkVersion
11+
buildToolsVersion rootProject.ext.buildToolsVersion
12+
13+
defaultConfig {
14+
minSdkVersion rootProject.ext.minSdkVersion
15+
targetSdkVersion rootProject.ext.targetSdkVersion
16+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17+
consumerProguardFiles "consumer-rules.pro"
18+
versionCode 1
19+
versionName "1.0"
20+
buildConfigField("String", "CLIENT_VERSION", rootProject.ext.clientmanagerLibVersionName)
21+
buildConfigField("String", "BASE_URL", rootProject.ext.serverBaseURL)
22+
}
23+
24+
buildTypes {
25+
debug {
26+
testCoverageEnabled true
27+
}
28+
release {
29+
minifyEnabled false
30+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
31+
}
32+
}
33+
compileOptions {
34+
sourceCompatibility JavaVersion.VERSION_1_8
35+
targetCompatibility JavaVersion.VERSION_1_8
36+
}
37+
sourceSets {
38+
main {
39+
assets {
40+
srcDirs 'src\\main\\assets', 'src\\androidTest\\assets'
41+
}
42+
}
43+
}
44+
testOptions {
45+
unitTests {
46+
includeAndroidResources = true
47+
}
48+
}
49+
50+
libraryVariants.every { variant ->
51+
variant.outputs.each { output ->
52+
def outputFile = output.outputFile
53+
if (outputFile != null && outputFile.name.endsWith('.aar')) {
54+
output.outputFile = new File(projectDir, '../app/new_libs/' + outputFile.name)
55+
}
56+
}
57+
}
58+
}
59+
60+
dependencies {
61+
def work_version = "2.7.1"
62+
63+
implementation 'com.google.dagger:dagger:2.41'
64+
implementation 'com.google.dagger:dagger-android-support:2.41'
65+
annotationProcessor 'com.google.dagger:dagger-compiler:2.41'
66+
annotationProcessor 'com.google.dagger:dagger-android-processor:2.41'
67+
68+
compileOnly 'org.projectlombok:lombok:1.18.24'
69+
annotationProcessor 'org.projectlombok:lombok:1.18.24'
70+
71+
implementation 'javax.validation:validation-api:2.0.1.Final'
72+
73+
//AspectJ
74+
implementation 'org.aspectj:aspectjrt:1.9.7'
75+
76+
// https://mvnrepository.com/artifact/io.swagger.core.v3/swagger-annotations
77+
implementation 'io.swagger.core.v3:swagger-annotations:2.1.11'
78+
79+
implementation "androidx.room:room-runtime:2.4.2"
80+
annotationProcessor "androidx.room:room-compiler:2.4.2"
81+
82+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
83+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
84+
androidTestImplementation 'com.squareup.okhttp3:mockwebserver:4.10.0'
85+
androidTestImplementation "org.mockito:mockito-android:4.6.1"
86+
testImplementation "junit:junit:4.13.2"
87+
testImplementation "org.mockito:mockito-core:4.6.1"
88+
testImplementation 'org.mockito:mockito-inline:4.4.0'
89+
testImplementation 'org.robolectric:robolectric:4.8'
90+
testImplementation 'com.squareup.okhttp3:mockwebserver:4.10.0'
91+
testImplementation "org.mockito:mockito-android:4.6.1"
92+
93+
94+
// (Java only)
95+
implementation "androidx.work:work-runtime:$work_version"
96+
97+
// https://mvnrepository.com/artifact/com.squareup.retrofit2/retrofit
98+
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
99+
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
100+
101+
// JWT decoding library
102+
implementation 'com.auth0.android:jwtdecode:2.0.1'
103+
104+
// https://mvnrepository.com/artifact/commons-io/commons-io
105+
implementation group: 'commons-io', name: 'commons-io', version: '2.11.0'
106+
107+
implementation 'com.fasterxml.jackson.core:jackson-core:2.13.2'
108+
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.2.2'
109+
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.2'
110+
111+
implementation 'org.apache.velocity:velocity:1.7'
112+
implementation 'org.mvel:mvel2:2.4.14.Final'
113+
114+
implementation('com.tom-roush:pdfbox-android:2.0.20.0') {
115+
exclude group: 'org.bouncycastle'
116+
}
117+
118+
implementation 'com.github.Tgo1014:JP2ForAndroid:1.0.4'
119+
120+
implementation('io.mosip.biometric.util:biometrics-util:1.2.0') {
121+
exclude group: 'org.springframework.boot'
122+
exclude group: 'com.fasterxml.jackson.core'
123+
exclude group: 'org.projectlombok'
124+
}
125+
// https://mvnrepository.com/artifact/org.slf4j/slf4j-api
126+
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.0-alpha7'
127+
128+
// added packet-manager Android library module as a dependency
129+
implementation project(':packetmanager')
130+
implementation project(':keymanager')
131+
}
132+
133+
sonarqube {
134+
androidVariant 'debug' //PUT REAL TASK NAME HERE
135+
136+
properties {
137+
//PUT REAL PATHS HERE
138+
property "sonar.java.binaries", "build/intermediates/javac/debug"
139+
property "sonar.junit.reportPaths", "build/test-results/testDebugUnitTest"
140+
//property "sonar.jacoco.reportPaths", "build/jacoco/testReleaseUnitTest.exec"
141+
property "sonar.coverage.jacoco.xmlReportPaths", "./build/reports/jacoco/testDebugUnitTestCoverage/testDebugUnitTestCoverage.xml"
142+
property "sonar.tests", ["src/test/java"]
143+
property "sonar.sources", "src/main/java"
144+
}
145+
}

android/clientmanager/consumer-rules.pro

Whitespace-only changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile

0 commit comments

Comments
 (0)