Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2 Object store and packet writer implementation #16

Merged
merged 1 commit into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
72 changes: 72 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
plugins {
id 'com.android.application'
}

android {
compileSdk rootProject.ext.compileSdkVersion

defaultConfig {
applicationId "io.mosip.registration.app"
minSdk rootProject.ext.minSdkVersion
targetSdk rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

packagingOptions {
pickFirst "com/itextpdf/io/font/cmap/*"
exclude "notice.txt"
exclude "license.txt"
exclude "META-INF/license.txt"
pickFirst "readme.txt"
pickFirst "logback.xml"
pickFirst "com/itextpdf/io/font/cmap_info.txt"
exclude "META-INF/web-fragment.xml"
exclude "META-INF/*spring*"
exclude "META-INF/git*"
exclude "git*"
exclude "changelog.txt"
exclude "META-INF/INDEX.LIST"
exclude "META-INF/notice.txt"
exclude "META-INF/DEPENDENCIES"

}
}

configurations {
all {
}
}

dependencies {
implementation 'com.google.dagger:dagger:2.38.1'
implementation 'com.google.dagger:dagger-android-support:2.38.1'
annotationProcessor 'com.google.dagger:dagger-compiler:2.38.1'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.38.1'

implementation 'com.github.amitshekhariitbhu:Fast-Android-Networking:1.0.2'

implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
testImplementation "junit:junit:4.13.2"
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

// added client-manager Android library module as a dependency
implementation project(':keymanager')
implementation project(':packetmanager')
}
21 changes: 21 additions & 0 deletions app/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
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package io.mosip.registration.app;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("io.mosip.registration.app", appContext.getPackageName());
}
}
42 changes: 42 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.mosip.registration.app">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- android:allowBackup="true"-->
<application
android:name=".BaseApplication"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.registration_client">

<activity
android:name=".PosixAdapterDemo"
android:exported="true" />
<activity
android:name=".PacketWriterDemo"
android:exported="true" />
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<service
android:name="io.mosip.registration.clientmanager.service.crypto.LocalClientCryptoServiceImpl"
android:exported="false" />
<service
android:name="io.mosip.registration.clientmanager.service.packet.PosixAdapter"
android:exported="false" />
</application>


</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package io.mosip.registration.app;

import dagger.Module;
import dagger.android.ContributesAndroidInjector;
import io.mosip.registration.app.MainActivity;

@Module
public abstract class ActivityBuildersModule {

@ContributesAndroidInjector
abstract MainActivity contributeMainActivity();
}
30 changes: 30 additions & 0 deletions app/src/main/java/io/mosip/registration/app/AppComponent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package io.mosip.registration.app;

import android.app.Application;

import javax.inject.Singleton;

import dagger.BindsInstance;
import dagger.Component;
import dagger.android.AndroidInjector;
import dagger.android.support.AndroidSupportInjectionModule;

@Singleton
@Component(
modules = {
AndroidSupportInjectionModule.class,
ActivityBuildersModule.class,
AppModule.class,
}
)
public interface AppComponent extends AndroidInjector<BaseApplication> {

@Component.Builder
interface Builder{
@BindsInstance
Builder application(Application application);
Builder appModule(AppModule appModule);
AppComponent build();
}

}
43 changes: 43 additions & 0 deletions app/src/main/java/io/mosip/registration/app/AppModule.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package io.mosip.registration.app;

import android.app.Application;
import android.content.Context;

import androidx.annotation.NonNull;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;

import io.mosip.registration.keymanager.service.LocalClientCryptoServiceImpl;
import io.mosip.registration.keymanager.spi.ClientCryptoManagerService;

@Module
public class AppModule {

Application application;
Context appContext;

public AppModule(Application application) {
this.application = application;
this.appContext = application.getApplicationContext();
}

@Provides
Application providesApplication() {
return application;
}

@Provides
@NonNull
public Context provideApplicationContext() {
return appContext;
}

@Singleton
@Provides
public ClientCryptoManagerService provideClientCryptoManagerService(){
return new LocalClientCryptoServiceImpl(appContext);
}
}
11 changes: 11 additions & 0 deletions app/src/main/java/io/mosip/registration/app/BaseApplication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.mosip.registration.app;

import dagger.android.AndroidInjector;
import dagger.android.DaggerApplication;

public class BaseApplication extends DaggerApplication {
@Override
protected AndroidInjector<? extends DaggerApplication> applicationInjector() {
return DaggerAppComponent.builder().application(this).appModule(new AppModule(this)).build();
}
}
Loading