Initial commit
This commit is contained in:
60
modules/credentials/build.gradle.kts
Normal file
60
modules/credentials/build.gradle.kts
Normal file
@@ -0,0 +1,60 @@
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("kotlin-kapt")
|
||||
id("dagger.hilt.android.plugin")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.smoa.modules.credentials"
|
||||
compileSdk = AppConfig.compileSdk
|
||||
|
||||
defaultConfig {
|
||||
minSdk = AppConfig.minSdk
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "17"
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
compose = true
|
||||
}
|
||||
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion = "1.5.4"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":core:common"))
|
||||
implementation(project(":core:auth"))
|
||||
implementation(project(":core:security"))
|
||||
implementation(project(":core:barcode"))
|
||||
|
||||
implementation(platform(Dependencies.composeBom))
|
||||
implementation(Dependencies.composeUi)
|
||||
implementation(Dependencies.composeUiGraphics)
|
||||
implementation(Dependencies.composeMaterial3)
|
||||
implementation(Dependencies.androidxCoreKtx)
|
||||
implementation(Dependencies.androidxLifecycleRuntimeKtx)
|
||||
|
||||
implementation(Dependencies.hiltAndroid)
|
||||
kapt(Dependencies.hiltAndroidCompiler)
|
||||
|
||||
implementation(Dependencies.roomRuntime)
|
||||
implementation(Dependencies.roomKtx)
|
||||
kapt(Dependencies.roomCompiler)
|
||||
|
||||
// Barcode generation
|
||||
implementation(Dependencies.zxingCore)
|
||||
|
||||
implementation(Dependencies.coroutinesCore)
|
||||
implementation(Dependencies.coroutinesAndroid)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.smoa.modules.credentials
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* Credentials module - Secure presentation of government-issued credentials.
|
||||
*/
|
||||
@Composable
|
||||
fun CredentialsModule(
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
Column(
|
||||
modifier = modifier
|
||||
.fillMaxSize()
|
||||
.padding(16.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "Issued Credentials",
|
||||
style = MaterialTheme.typography.headlineMedium
|
||||
)
|
||||
Text(
|
||||
text = "Barcode generation and credential display functionality available",
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
modifier = Modifier.padding(top = 8.dp)
|
||||
)
|
||||
// Credential display UI with barcode integration will be implemented here
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.smoa.modules.credentials
|
||||
|
||||
import com.smoa.core.barcode.BarcodeEncoder
|
||||
import com.smoa.core.barcode.formats.AAMVACredential
|
||||
import com.smoa.core.barcode.formats.ICAO9303Credential
|
||||
import com.smoa.core.barcode.formats.MILSTD129Credential
|
||||
import com.smoa.core.common.Result
|
||||
import com.google.zxing.common.BitMatrix
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
/**
|
||||
* Repository for credentials management with barcode generation.
|
||||
*/
|
||||
@Singleton
|
||||
class CredentialsRepository @Inject constructor(
|
||||
private val barcodeEncoder: BarcodeEncoder
|
||||
) {
|
||||
|
||||
/**
|
||||
* Generate AAMVA credential barcode.
|
||||
*/
|
||||
suspend fun generateAAMVABarcode(credential: AAMVACredential): Result<BitMatrix> {
|
||||
return barcodeEncoder.encodeAAMVA(credential)
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate ICAO 9303 credential barcode.
|
||||
*/
|
||||
suspend fun generateICAO9303Barcode(credential: ICAO9303Credential): Result<BitMatrix> {
|
||||
return barcodeEncoder.encodeICAO9303(credential)
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate MIL-STD-129 credential barcode.
|
||||
*/
|
||||
suspend fun generateMILSTD129Barcode(credential: MILSTD129Credential): Result<BitMatrix> {
|
||||
return barcodeEncoder.encodeMILSTD129(credential)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.smoa.modules.credentials.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.smoa.core.barcode.ui.BarcodeDisplay
|
||||
import com.google.zxing.common.BitMatrix
|
||||
|
||||
/**
|
||||
* Display credential with PDF417 barcode.
|
||||
*/
|
||||
@Composable
|
||||
fun BarcodeCredentialDisplay(
|
||||
bitMatrix: BitMatrix,
|
||||
credentialTitle: String,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
Column(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.padding(16.dp)
|
||||
) {
|
||||
Text(
|
||||
text = credentialTitle,
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
modifier = Modifier.padding(bottom = 16.dp)
|
||||
)
|
||||
|
||||
BarcodeDisplay(
|
||||
bitMatrix = bitMatrix,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user