Skip to content

Commit

Permalink
Merge pull request #1 from Piyush7034/fetch-machine
Browse files Browse the repository at this point in the history
Fetch machine
  • Loading branch information
Piyush7034 authored May 12, 2023
2 parents 0de38b5 + 79c9a49 commit 91a4906
Show file tree
Hide file tree
Showing 1,043 changed files with 587,306 additions and 162 deletions.
15 changes: 10 additions & 5 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 28
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "BASE_URL", rootProject.ext.serverBaseURL)
}

buildTypes {
Expand Down Expand Up @@ -122,8 +124,11 @@ dependencies {
implementation 'org.bouncycastle:bcprov-jdk15on:1.59'
implementation 'com.auth0.android:jwtdecode:2.0.1'

implementation project(':clientmanager')
implementation project(':keymanager')
implementation project(':packetmanager')

implementation files('libs/keymanager-debug.aar')
implementation files('libs/clientmanager-debug.aar')
implementation files('libs/packetmanager-debug.aar')
// implementation files('libs/keymanager-debug.aar')
// implementation files('libs/clientmanager-debug.aar')
// implementation files('libs/packetmanager-debug.aar')
}
Binary file removed android/app/libs/clientmanager-debug.aar
Binary file not shown.
Binary file removed android/app/libs/keymanager-debug.aar
Binary file not shown.
Binary file removed android/app/libs/packetmanager-debug.aar
Binary file not shown.
Binary file removed android/app/libs/scanlibrary-debug.aar
Binary file not shown.
2 changes: 2 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.mosip.registration_client">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:label="registration_client"
android:name="${applicationName}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

public class AboutActivityService {

public void testMachine(ClientCryptoManagerService clientCryptoManagerService, MethodChannel.Result result) {
String data = clientCryptoManagerService.testMachine();
result.success("data: " + data);
}
// public void testMachine(ClientCryptoManagerService clientCryptoManagerService, MethodChannel.Result result) {
// String data = clientCryptoManagerService.testMachine();
// result.success("data: " + data);
// }

public void getMachineDetails(ClientCryptoManagerService clientCryptoManagerService, MethodChannel.Result result) {
Map<String, String> details =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package io.mosip.registration_client;

import android.util.Log;
import android.widget.Toast;

import org.json.JSONObject;

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

public void usernameValidation(String username,
LoginService loginService,
MethodChannel.Result result) {
if(!loginService.isValidUserId(username)) {
responseMap.put("user_response", "User not found!");
responseMap.put("isUserPresent", "false");
object = new JSONObject(responseMap);
result.success(object.toString());
return;
}
responseMap.put("user_response", "User Validated!");
responseMap.put("isUserPresent", "true");
object = new JSONObject(responseMap);
result.success(object.toString());
}

private boolean validateLogin(String username, String password, LoginService loginService) {
if(username == null || username.trim().length() == 0){
Log.e(getClass().getSimpleName(), "username incorrect");
Expand Down Expand Up @@ -69,16 +86,17 @@ public void onResponse(Call call, Response response) {
result.success(object.toString());
return;
} catch (InvalidMachineSpecIDException e) {
error = new ServiceError("", e.getMessage());
error = new ServiceError("MACHINE", "Machine not found!");
Log.e(getClass().getSimpleName(), "Failed to save auth token", e);
} catch (Exception e) {
error = new ServiceError("", e.getMessage());
error = new ServiceError("", "Incorrect Password!");
Log.e(getClass().getSimpleName(), "Failed to save auth token", e);
}
}

Log.e(getClass().getSimpleName(), "Some error occurred! " + error);
login_response = error == null ? "Login Failed! Try Again" : "Error: " + error.getMessage();
login_response = error == null ? "Login Failed! Try Again"
: error.getMessage().equals("Invalid Request") ? "Password Incorrect!"
: error.getMessage();
responseMap.put("isLoggedIn", "false");
responseMap.put("login_response", login_response);
object = new JSONObject(responseMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,15 @@ public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
initializeAppComponent();
break;

case "testMachine":
new AboutActivityService().testMachine(clientCryptoManagerService, result);
break;

case "getMachineDetails":
new AboutActivityService().getMachineDetails(clientCryptoManagerService, result);
break;

case "validateUsername":
String usernameVal = call.argument("username");
new LoginActivityService().usernameValidation(usernameVal, loginService, result);
break;

case "login":
String username = call.argument("username");
String password = call.argument("password");
Expand Down
25 changes: 25 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,46 @@ buildscript {
repositories {
google()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}

dependencies {
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.ibotta:plugin:1.2.0"
//Jacoco Plugin
classpath "org.jacoco:org.jacoco.core:0.8.7"
}
}

plugins {
id "org.sonarqube" version "3.0"
}

allprojects {
repositories {
google()
mavenCentral()
}
}

ext {
compileSdkVersion = 31
buildToolsVersion = "31.0.0"

minSdkVersion = 28
targetSdkVersion = 31

junitVersion = "4.+"

// clientmanager Library Info
clientmanagerLibVersionCode = 1
clientmanagerLibVersionName = "\"1.0.0\""

serverBaseURL = "\"https://api-internal.dev.mosip.net/\""
}


rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
Expand Down
1 change: 1 addition & 0 deletions android/clientmanager/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
145 changes: 145 additions & 0 deletions android/clientmanager/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
plugins {
id 'com.android.library'
id 'com.ibotta.gradle.aop'
id "org.sonarqube"
}

apply from: '../jacoco.gradle'

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
versionCode 1
versionName "1.0"
buildConfigField("String", "CLIENT_VERSION", rootProject.ext.clientmanagerLibVersionName)
buildConfigField("String", "BASE_URL", rootProject.ext.serverBaseURL)
}

buildTypes {
debug {
testCoverageEnabled true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
sourceSets {
main {
assets {
srcDirs 'src\\main\\assets', 'src\\androidTest\\assets'
}
}
}
testOptions {
unitTests {
includeAndroidResources = true
}
}

libraryVariants.every { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.aar')) {
output.outputFile = new File(projectDir, '../app/new_libs/' + outputFile.name)
}
}
}
}

dependencies {
def work_version = "2.7.1"

implementation 'com.google.dagger:dagger:2.41'
implementation 'com.google.dagger:dagger-android-support:2.41'
annotationProcessor 'com.google.dagger:dagger-compiler:2.41'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.41'

compileOnly 'org.projectlombok:lombok:1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24'

implementation 'javax.validation:validation-api:2.0.1.Final'

//AspectJ
implementation 'org.aspectj:aspectjrt:1.9.7'

// https://mvnrepository.com/artifact/io.swagger.core.v3/swagger-annotations
implementation 'io.swagger.core.v3:swagger-annotations:2.1.11'

implementation "androidx.room:room-runtime:2.4.2"
annotationProcessor "androidx.room:room-compiler:2.4.2"

androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'com.squareup.okhttp3:mockwebserver:4.10.0'
androidTestImplementation "org.mockito:mockito-android:4.6.1"
testImplementation "junit:junit:4.13.2"
testImplementation "org.mockito:mockito-core:4.6.1"
testImplementation 'org.mockito:mockito-inline:4.4.0'
testImplementation 'org.robolectric:robolectric:4.8'
testImplementation 'com.squareup.okhttp3:mockwebserver:4.10.0'
testImplementation "org.mockito:mockito-android:4.6.1"


// (Java only)
implementation "androidx.work:work-runtime:$work_version"

// https://mvnrepository.com/artifact/com.squareup.retrofit2/retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'

// JWT decoding library
implementation 'com.auth0.android:jwtdecode:2.0.1'

// https://mvnrepository.com/artifact/commons-io/commons-io
implementation group: 'commons-io', name: 'commons-io', version: '2.11.0'

implementation 'com.fasterxml.jackson.core:jackson-core:2.13.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.2.2'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.2'

implementation 'org.apache.velocity:velocity:1.7'
implementation 'org.mvel:mvel2:2.4.14.Final'

implementation('com.tom-roush:pdfbox-android:2.0.20.0') {
exclude group: 'org.bouncycastle'
}

implementation 'com.github.Tgo1014:JP2ForAndroid:1.0.4'

implementation('io.mosip.biometric.util:biometrics-util:1.2.0') {
exclude group: 'org.springframework.boot'
exclude group: 'com.fasterxml.jackson.core'
exclude group: 'org.projectlombok'
}
// https://mvnrepository.com/artifact/org.slf4j/slf4j-api
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.0-alpha7'

// added packet-manager Android library module as a dependency
implementation project(':packetmanager')
implementation project(':keymanager')
}

sonarqube {
androidVariant 'debug' //PUT REAL TASK NAME HERE

properties {
//PUT REAL PATHS HERE
property "sonar.java.binaries", "build/intermediates/javac/debug"
property "sonar.junit.reportPaths", "build/test-results/testDebugUnitTest"
//property "sonar.jacoco.reportPaths", "build/jacoco/testReleaseUnitTest.exec"
property "sonar.coverage.jacoco.xmlReportPaths", "./build/reports/jacoco/testDebugUnitTestCoverage/testDebugUnitTestCoverage.xml"
property "sonar.tests", ["src/test/java"]
property "sonar.sources", "src/main/java"
}
}
Empty file.
21 changes: 21 additions & 0 deletions android/clientmanager/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Loading

0 comments on commit 91a4906

Please sign in to comment.