diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/IconBox.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/IconBox.kt index 30c643617..b6d35f999 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/IconBox.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/IconBox.kt @@ -17,6 +17,7 @@ import androidx.compose.material3.OutlinedIconButton import androidx.compose.material3.Surface import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -28,6 +29,7 @@ fun IconBox( icon: ImageVector, onClick: () -> Unit, modifier: Modifier = Modifier, + tint: Color? = null, ) { OutlinedIconButton( onClick = onClick, @@ -35,10 +37,18 @@ fun IconBox( shape = RoundedCornerShape(12.dp), border = BorderStroke(2.dp, MaterialTheme.colorScheme.onSurface.copy(alpha = 0.1f)), ) { - Icon( - imageVector = icon, - contentDescription = icon.name, - ) + if (tint != null) { + Icon( + imageVector = icon, + contentDescription = icon.name, + tint = tint, + ) + } else { + Icon( + imageVector = icon, + contentDescription = icon.name, + ) + } } } diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/MifosScaffold.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/MifosScaffold.kt index 1dff9c437..f1826e291 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/MifosScaffold.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/MifosScaffold.kt @@ -23,6 +23,8 @@ fun MifosScaffold( backPress: () -> Unit, modifier: Modifier = Modifier, topBarTitle: Int? = null, + titleColor: Color? = MaterialTheme.colorScheme.onSurface, + iconTint: Color? = null, floatingActionButtonContent: FloatingActionButtonContent? = null, snackbarHost: @Composable () -> Unit = {}, scaffoldContent: @Composable (PaddingValues) -> Unit = {}, @@ -35,6 +37,8 @@ fun MifosScaffold( topBarTitle = topBarTitle, backPress = backPress, actions = actions, + titleColor = titleColor, + iconTint = iconTint, ) } }, diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/MifosTopBar.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/MifosTopBar.kt index ce4b00068..d85d0ae47 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/MifosTopBar.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/MifosTopBar.kt @@ -28,18 +28,22 @@ fun MifosTopBar( backPress: () -> Unit, modifier: Modifier = Modifier, actions: @Composable RowScope.() -> Unit = {}, + titleColor: Color? = null, + iconTint: Color? = null, ) { CenterAlignedTopAppBar( title = { Text( text = stringResource(id = topBarTitle), style = MaterialTheme.typography.titleMedium, + color = titleColor ?: MaterialTheme.colorScheme.onSurface, ) }, navigationIcon = { IconBox( icon = MifosIcons.ArrowBack2, onClick = backPress, + tint = iconTint, ) }, colors = TopAppBarDefaults.centerAlignedTopAppBarColors( diff --git a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/GenerateQr.kt b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/GenerateQr.kt index 30457707a..bec299b65 100644 --- a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/GenerateQr.kt +++ b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/GenerateQr.kt @@ -9,35 +9,42 @@ */ package org.mifospay.feature.request.money +import android.content.Context import android.graphics.Bitmap -import com.google.zxing.BarcodeFormat -import com.google.zxing.MultiFormatWriter +import android.graphics.Canvas +import android.graphics.Color +import android.graphics.Paint +import android.graphics.Rect +import android.graphics.RectF +import androidx.core.content.ContextCompat +import com.google.zxing.EncodeHintType import com.google.zxing.WriterException -import com.google.zxing.common.BitMatrix -import org.mifospay.common.Constants +import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel +import com.google.zxing.qrcode.encoder.ByteMatrix +import com.google.zxing.qrcode.encoder.Encoder +import com.google.zxing.qrcode.encoder.QRCode import org.mifospay.core.data.base.UseCase import java.util.Base64 +import java.util.EnumMap -/** - * Created by naman on 8/7/17. - */ -class GenerateQr : - UseCase() { +// Taken reference from this article +// https://ihareshvaghela.medium.com/generating-dotted-qr-codes-in-android-using-zxing-library-b02e824c895c + +class GenerateQr(private val context: Context) : UseCase< + GenerateQr.RequestValues, + GenerateQr + .ResponseValue?, + >() { override fun executeUseCase(requestValues: RequestValues) { try { - val bitmap = encodeAsBitmap(makeUpiString(requestValues.data)) - if (bitmap != null) { - useCaseCallback.onSuccess(ResponseValue(bitmap)) - } else { - useCaseCallback.onError(Constants.ERROR_OCCURRED) - } + val bitmap = encodeAsBitmap(makeUpiString(requestValues.data), getLogoBitmap()) + useCaseCallback.onSuccess(ResponseValue(bitmap)) } catch (e: WriterException) { - useCaseCallback.onError(Constants.FAILED_TO_WRITE_DATA_TO_QR) + useCaseCallback.onError("Failed to write data to QR") } } private fun makeUpiString(requestQrData: RequestQrData): String { - // Initial payment string val requestPaymentString = "upi://pay" + "?pa=${requestQrData.vpaId}" + "&am=${requestQrData.amount}" + @@ -45,50 +52,233 @@ class GenerateQr : "&cu=${requestQrData.currency}" + "&mode=02" + "&s=000000" - - // Convert the payment string to bytes and encode to Base64 val sign = Base64.getEncoder().encodeToString(requestPaymentString.toByteArray(Charsets.UTF_8)) + return "$requestPaymentString&sign=$sign" + } + + @Throws(WriterException::class) + private fun encodeAsBitmap(str: String, logo: Bitmap?): Bitmap { + val encodingHints: MutableMap = + EnumMap(com.google.zxing.EncodeHintType::class.java) + encodingHints[EncodeHintType.CHARACTER_SET] = "UTF-8" + val code: QRCode = Encoder.encode(str, ErrorCorrectionLevel.H, encodingHints) + return renderQRImage(code, logo) + } + + // Function to render QR code + private fun renderQRImage(code: QRCode, logo: Bitmap?): Bitmap { + val bitmap = Bitmap.createBitmap(WIDTH, HEIGHT, Bitmap.Config.ARGB_8888) + val canvas = Canvas(bitmap) + val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply { + style = Paint.Style.FILL + color = BLUE + } + + val input = code.matrix + val inputWidth = input.width + val inputHeight = input.height + val qrWidth = inputWidth + (QUIET_ZONE * 2) + val qrHeight = inputHeight + (QUIET_ZONE * 2) + val outputWidth = WIDTH.coerceAtLeast(qrWidth) + val outputHeight = HEIGHT.coerceAtLeast(qrHeight) + val multiple = (outputWidth / qrWidth).coerceAtMost(outputHeight / qrHeight) + val leftPadding = (outputWidth - (inputWidth * multiple)) / 2 + val topPadding = (outputHeight - (inputHeight * multiple)) / 2 + + drawQrCodeDots( + input, + canvas, + paint, + leftPadding, + topPadding, + inputWidth, + inputHeight, + multiple, + ) - val signedRequestPayment = requestPaymentString + - "&sign=$sign" + val circleDiameter = multiple * FINDER_PATTERN_SIZE + drawFinderPatternSquareStyle(canvas, paint, leftPadding, topPadding, circleDiameter) + drawFinderPatternSquareStyle( + canvas, + paint, + leftPadding + (inputWidth - FINDER_PATTERN_SIZE) * multiple, + topPadding, + circleDiameter, + ) + drawFinderPatternSquareStyle( + canvas, + paint, + leftPadding, + topPadding + (inputHeight - FINDER_PATTERN_SIZE) * multiple, + circleDiameter, + ) + + logo?.let { + drawLogo(canvas, bitmap, it) + } - // Convert the final URI to string - return signedRequestPayment + return bitmap } - @Throws(WriterException::class) - private fun encodeAsBitmap(str: String): Bitmap? { - val result: BitMatrix = try { - MultiFormatWriter().encode( - str, - BarcodeFormat.QR_CODE, - WIDTH, - WIDTH, - null, + private fun drawQrCodeDots( + input: ByteMatrix, + canvas: Canvas, + paint: Paint, + leftPadding: Int, + topPadding: Int, + inputWidth: Int, + inputHeight: Int, + multiple: Int, + ) { + val circleSize = (multiple * CIRCLE_SCALE_DOWN_FACTOR).toInt() + for (inputY in 0 until inputHeight) { + var outputY = topPadding + outputY += multiple * inputY + for (inputX in 0 until inputWidth) { + var outputX = leftPadding + outputX += multiple * inputX + if (input.get(inputX, inputY).toInt() == 1 && + !isFinderPattern(inputX, inputY, inputWidth, inputHeight) + ) { + canvas.drawCircle( + (outputX + multiple / 2).toFloat(), + (outputY + multiple / 2).toFloat(), + circleSize.toFloat() / 2f, + paint, + ) + } + } + } + } + + private fun isFinderPattern( + inputX: Int, + inputY: Int, + inputWidth: Int, + inputHeight: Int, + ): Boolean { + return ( + inputX <= FINDER_PATTERN_SIZE && inputY <= FINDER_PATTERN_SIZE || + inputX >= inputWidth - FINDER_PATTERN_SIZE && inputY <= FINDER_PATTERN_SIZE || + inputX <= FINDER_PATTERN_SIZE && inputY >= inputHeight - FINDER_PATTERN_SIZE ) - } catch (iae: IllegalArgumentException) { - return null + } + + private fun drawLogo(canvas: Canvas, bitmap: Bitmap, logo: Bitmap) { + val logoSize = (WIDTH * 0.11).toInt() + val centerX = (bitmap.width - logoSize) / 2 + val centerY = (bitmap.height - logoSize) / 2 + val backgroundRadius = (logoSize * 0.75).toFloat() + + val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply { + style = Paint.Style.FILL + color = ELLIPSE_COLOR } - val w = result.width - val h = result.height - val pixels = IntArray(w * h) - for (y in 0 until h) { - val offset = y * w - for (x in 0 until w) { - pixels[offset + x] = if (result[x, y]) BLACK else WHITE - } + + // Draw logo background + canvas.drawCircle( + (centerX + logoSize / 2).toFloat(), + (centerY + logoSize / 2).toFloat(), + backgroundRadius + 10f, + paint, + ) + + paint.color = Color.WHITE + canvas.drawCircle( + (centerX + logoSize / 2).toFloat(), + (centerY + logoSize / 2).toFloat(), + backgroundRadius + 6f, + paint, + ) + + // Draw the logo + val logoRect = Rect(0, 0, logo.width, logo.height) + val destRect = Rect(centerX, centerY, centerX + logoSize, centerY + logoSize) + canvas.drawBitmap(logo, logoRect, destRect, null) + } + + // Function to draw a finder pattern + private fun drawFinderPatternSquareStyle( + canvas: Canvas, + paint: Paint, + x: Int, + y: Int, + squareDiameter: Int, + ) { + val outerRadius = squareDiameter * 0.25f + val middleRadius = squareDiameter * 0.15f + val innerRadius = squareDiameter * 0.1f + val middleSquareScale = 0.7f + val innerSquareScale = 0.45f + + paint.color = PATTERN_COLOR + canvas.drawRoundRect( + RectF( + x.toFloat(), + y.toFloat(), + (x + squareDiameter).toFloat(), + (y + squareDiameter).toFloat(), + ), + outerRadius, + outerRadius, + paint, + ) + + val middleSquareSize = squareDiameter * middleSquareScale + val middleSquareOffset = (squareDiameter - middleSquareSize) / 2 + paint.color = Color.WHITE + canvas.drawRoundRect( + RectF( + (x + middleSquareOffset), + (y + middleSquareOffset), + (x + middleSquareOffset + middleSquareSize), + (y + middleSquareOffset + middleSquareSize), + ), + middleRadius, + middleRadius, + paint, + ) + + val innerSquareSize = squareDiameter * innerSquareScale + val innerSquareOffset = (squareDiameter - innerSquareSize) / 2 + paint.color = PATTERN_COLOR + canvas.drawRoundRect( + RectF( + (x + innerSquareOffset), + (y + innerSquareOffset), + (x + innerSquareOffset + innerSquareSize), + (y + innerSquareOffset + innerSquareSize), + ), + innerRadius, + innerRadius, + paint, + ) + } + + // Function to get logo in the center of QR code + private fun getLogoBitmap(): Bitmap? { + val drawable = ContextCompat.getDrawable(context, R.drawable.logo) + return drawable?.let { + val bitmap = + Bitmap.createBitmap(it.intrinsicWidth, it.intrinsicHeight, Bitmap.Config.ARGB_8888) + val canvas = Canvas(bitmap) + it.setBounds(0, 0, canvas.width, canvas.height) + it.draw(canvas) + bitmap } - val bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888) - bitmap.setPixels(pixels, 0, WIDTH, 0, 0, w, h) - return bitmap } - class RequestValues(val data: RequestQrData) : UseCase.RequestValues - class ResponseValue(val bitmap: Bitmap) : UseCase.ResponseValue + data class RequestValues(val data: RequestQrData) : UseCase.RequestValues + data class ResponseValue(val bitmap: Bitmap) : UseCase.ResponseValue companion object { - private const val WHITE = -0x1 - private const val BLACK = -0x1000000 - private const val WIDTH = 500 + private const val BLUE = 0xFF0673BA.toInt() // dots color + private const val PATTERN_COLOR = 0xFF6e6e6e.toInt() // corner square color + private const val ELLIPSE_COLOR = 0xFFe9e9e9.toInt() // logo background ellipse color + private const val WIDTH = 500 // width of QR code + private const val HEIGHT = 500 // height of QR code + private const val FINDER_PATTERN_SIZE = 13 // pattern size (in this case corner squares) + private const val CIRCLE_SCALE_DOWN_FACTOR = 1f // size of dots in qr code + private const val QUIET_ZONE = 5 // spacing from all sides for QR code } } diff --git a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/ShowQrContent.kt b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/ShowQrContent.kt index ed0dc99ff..a3089c135 100644 --- a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/ShowQrContent.kt +++ b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/ShowQrContent.kt @@ -10,94 +10,110 @@ package org.mifospay.feature.request.money import android.graphics.Bitmap +import androidx.compose.foundation.BorderStroke +import androidx.compose.foundation.background +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.width -import androidx.compose.material3.HorizontalDivider +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import coil.compose.AsyncImage import org.mifospay.core.designsystem.component.MifosButton -import java.util.Locale - +import org.mifospay.core.designsystem.component.MifosOutlinedButton +import org.mifospay.core.designsystem.theme.MifosBlue @Composable internal fun ShowQrContent( qrDataBitmap: Bitmap, - qrDataString: String, showAmountDialog: () -> Unit, modifier: Modifier = Modifier, - amount: String? = null, + onShare: () -> Unit, ) { - Column( - modifier = modifier.fillMaxWidth(), - horizontalAlignment = Alignment.CenterHorizontally, + Box( + modifier = modifier + .fillMaxSize() + .background( + MifosBlue, + ) + .padding(25.dp), ) { - AsyncImage( - model = qrDataBitmap, - contentDescription = null, - modifier = Modifier - .padding(20.dp) - .weight(1f), - ) - - Spacer(modifier = Modifier.height(12.dp)) - - MifosButton( - modifier = Modifier - .width(150.dp), - onClick = { showAmountDialog() }, - ) { - Text(text = stringResource(id = R.string.feature_request_money_set_amount)) - } - - Spacer(modifier = Modifier.height(12.dp)) - - HorizontalDivider() - Column( modifier = Modifier - .fillMaxWidth() - .padding(20.dp), - horizontalAlignment = Alignment.Start, + .fillMaxSize(), + verticalArrangement = Arrangement.SpaceBetween, + horizontalAlignment = Alignment.CenterHorizontally, ) { - Text( - text = stringResource(id = R.string.feature_request_money_qr_code_details), - style = MaterialTheme.typography.titleSmall.copy(fontWeight = FontWeight.Bold), - ) - - Spacer(modifier = Modifier.height(8.dp)) - - Text( - text = when (amount) { - null -> String.format( - Locale.getDefault(), - format = "%s: %s", - stringResource(R.string.feature_request_money_vpa), - qrDataString, + Spacer(modifier = Modifier.weight(1f)) + Column( + modifier = Modifier + .clip(RoundedCornerShape(21.dp)) + .background(Color.White) + .border( + BorderStroke(2.dp, MaterialTheme.colorScheme.primary), + RoundedCornerShape(21.dp), ) - - else -> String.format( - Locale.getDefault(), - format = "%s: %s\n%s: %s", - stringResource(R.string.feature_request_money_vpa), - qrDataString, - stringResource( - R.string.feature_request_money_amount, - ), - amount, + .padding(vertical = 15.dp), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Text( + text = stringResource(id = R.string.feature_request_money_title), + color = MifosBlue, + style = MaterialTheme.typography.titleLarge, + fontWeight = FontWeight.SemiBold, + ) + AsyncImage( + model = qrDataBitmap, + contentDescription = null, + modifier = Modifier.size(335.dp, 300.dp), + ) + } + Spacer(modifier = Modifier.weight(1f)) + Column( + verticalArrangement = Arrangement.spacedBy(15.dp), + ) { + MifosButton( + modifier = Modifier + .fillMaxWidth() + .height(55.dp), + onClick = { showAmountDialog() }, + color = Color.White, + ) { + Text( + text = stringResource(id = R.string.feature_request_money_set_amount), + color = MifosBlue, ) - }, - style = MaterialTheme.typography.bodyMedium, - ) + } + MifosOutlinedButton( + modifier = Modifier + .fillMaxWidth() + .height(55.dp), + onClick = { onShare() }, + border = BorderStroke( + 1.dp, + Color.White.copy(alpha = 0.3f), + ), + ) { + Text( + text = stringResource(id = R.string.feature_request_money_share), + color = Color.White, + ) + } + } } } } diff --git a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/ShowQrScreenRoute.kt b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/ShowQrScreenRoute.kt index 4c539cfcc..f43a0902e 100644 --- a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/ShowQrScreenRoute.kt +++ b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/ShowQrScreenRoute.kt @@ -15,12 +15,12 @@ import android.content.Intent import android.content.Intent.createChooser import android.graphics.Bitmap import android.net.Uri +import android.util.Log import android.view.WindowManager import androidx.annotation.VisibleForTesting +import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.padding -import androidx.compose.material3.Icon -import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect @@ -29,6 +29,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview @@ -40,6 +41,7 @@ import org.koin.androidx.compose.koinViewModel import org.mifospay.core.designsystem.component.MfLoadingWheel import org.mifospay.core.designsystem.component.MifosScaffold import org.mifospay.core.designsystem.icon.MifosIcons +import org.mifospay.core.designsystem.theme.MifosBlue import org.mifospay.core.ui.EmptyContentScreen import org.mifospay.feature.request.money.util.ImageUtils @@ -50,13 +52,11 @@ internal fun ShowQrScreenRoute( viewModel: ShowQrViewModel = koinViewModel(), ) { val uiState by viewModel.showQrUiState.collectAsStateWithLifecycle() - val vpaId by viewModel.vpaId.collectAsStateWithLifecycle() UpdateBrightness() ShowQrScreen( uiState = uiState, - vpaId = vpaId, backPress = backPress, generateQR = viewModel::generateQr, modifier = modifier, @@ -67,7 +67,6 @@ internal fun ShowQrScreenRoute( @VisibleForTesting internal fun ShowQrScreen( uiState: ShowQrUiState, - vpaId: String, backPress: () -> Unit, generateQR: (RequestQrData) -> Unit, modifier: Modifier = Modifier, @@ -81,6 +80,8 @@ internal fun ShowQrScreen( MifosScaffold( topBarTitle = R.string.feature_request_money_request, backPress = backPress, + titleColor = Color.White, + iconTint = Color.White, scaffoldContent = { paddingValues -> Box(modifier = Modifier.padding(paddingValues)) { when (uiState) { @@ -103,10 +104,15 @@ internal fun ShowQrScreen( } else { qrBitmap = uiState.qrDataBitmap ShowQrContent( - qrDataString = vpaId, - amount = amount, qrDataBitmap = uiState.qrDataBitmap, showAmountDialog = { amountDialogState = true }, + onShare = { + qrBitmap?.let { + Log.d("yesyesyes", it.toString()) + val uri = ImageUtils.saveImage(context = context, bitmap = it) + shareQr(context, uri = uri) + } + }, ) } } @@ -123,17 +129,7 @@ internal fun ShowQrScreen( } } }, - actions = { - IconButton( - onClick = { - qrBitmap?.let { - val uri = ImageUtils.saveImage(context = context, bitmap = it) - shareQr(context, uri = uri) - } - }, - ) { Icon(MifosIcons.Share, null) } - }, - modifier = modifier, + modifier = modifier.background(MifosBlue), ) if (amountDialogState) { @@ -209,7 +205,6 @@ private fun ShowQrScreenPreview( ) { ShowQrScreen( uiState = uiState, - vpaId = "", backPress = {}, generateQR = {}, ) diff --git a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/di/RequestMoneyModule.kt b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/di/RequestMoneyModule.kt index fe0f86e83..d4ce71ecc 100644 --- a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/di/RequestMoneyModule.kt +++ b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/di/RequestMoneyModule.kt @@ -9,6 +9,7 @@ */ package org.mifospay.feature.request.money.di +import org.koin.android.ext.koin.androidContext import org.koin.core.module.dsl.viewModel import org.koin.dsl.module import org.mifospay.feature.request.money.GenerateQr @@ -16,7 +17,7 @@ import org.mifospay.feature.request.money.ShowQrViewModel val RequestMoneyModule = module { single { - GenerateQr() + GenerateQr(context = androidContext()) } viewModel { diff --git a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/util/ImageUtils.kt b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/util/ImageUtils.kt index 4bbff94d8..f014b0b6d 100644 --- a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/util/ImageUtils.kt +++ b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/util/ImageUtils.kt @@ -14,7 +14,6 @@ import android.graphics.Bitmap import android.net.Uri import android.util.Log import androidx.core.content.FileProvider -import org.mifospay.feature.request.money.BuildConfig import java.io.File import java.io.FileOutputStream import java.io.IOException @@ -32,7 +31,7 @@ object ImageUtils { stream.close() uri = FileProvider.getUriForFile( context, - BuildConfig.LIBRARY_PACKAGE_NAME + ".provider", file, + context.packageName + ".provider", file, ) } catch (e: IOException) { Log.d("Error", e.message.toString()) diff --git a/feature/request-money/src/main/res/drawable/logo.png b/feature/request-money/src/main/res/drawable/logo.png new file mode 100644 index 000000000..b8b006ca3 Binary files /dev/null and b/feature/request-money/src/main/res/drawable/logo.png differ diff --git a/feature/request-money/src/main/res/values/strings.xml b/feature/request-money/src/main/res/values/strings.xml index fc016a955..d14588a7c 100644 --- a/feature/request-money/src/main/res/values/strings.xml +++ b/feature/request-money/src/main/res/values/strings.xml @@ -12,6 +12,8 @@ Please enter a valid amount Enter Currency Set Amount + Mifos Pay + Share Set Currency Cancel Confirm diff --git a/mifospay/src/test/java/org/mifospay/KoinModulesCheck.kt b/mifospay/src/test/java/org/mifospay/KoinModulesCheck.kt index ea8102b25..0c69be164 100644 --- a/mifospay/src/test/java/org/mifospay/KoinModulesCheck.kt +++ b/mifospay/src/test/java/org/mifospay/KoinModulesCheck.kt @@ -48,6 +48,7 @@ class KoinModulesCheck : AutoCloseKoinTest() { SelfServiceApiManager::class, KtorAuthenticationService::class, SavedStateHandle::class, + Context::class, ), ) koinModules.coreDataStoreModules.verify(