11package com.cashpilot.android.ui.screen
22
33import android.content.Intent
4+ import android.net.Uri
45import android.provider.Settings as AndroidSettings
56import android.text.format.DateUtils
67import androidx.compose.animation.animateColorAsState
78import androidx.compose.foundation.BorderStroke
9+ import androidx.compose.foundation.clickable
810import androidx.compose.foundation.layout.Arrangement
911import androidx.compose.foundation.layout.Column
1012import androidx.compose.foundation.layout.PaddingValues
@@ -377,6 +379,7 @@ private fun PermissionBanner(viewModel: MainViewModel) {
377379
378380@Composable
379381private fun AppCard (info : AppDisplayInfo ) {
382+ val context = LocalContext .current
380383 val borderColor = when (info.state) {
381384 AppState .RUNNING -> RunningGreen
382385 AppState .STOPPED -> StoppedRed
@@ -392,7 +395,30 @@ private fun AppCard(info: AppDisplayInfo) {
392395 Card (
393396 modifier = Modifier
394397 .fillMaxWidth()
395- .alpha(cardAlpha),
398+ .alpha(cardAlpha)
399+ .then(
400+ if (info.state == AppState .NOT_INSTALLED ) {
401+ Modifier .clickable {
402+ val intent = Intent (
403+ Intent .ACTION_VIEW ,
404+ Uri .parse(" market://details?id=${info.app.packageName} " ),
405+ )
406+ try {
407+ context.startActivity(intent)
408+ } catch (_: Exception ) {
409+ // Fall back to browser if Play Store not available
410+ context.startActivity(
411+ Intent (
412+ Intent .ACTION_VIEW ,
413+ Uri .parse(" https://play.google.com/store/apps/details?id=${info.app.packageName} " ),
414+ ),
415+ )
416+ }
417+ }
418+ } else {
419+ Modifier
420+ },
421+ ),
396422 border = if (info.state != AppState .NOT_INSTALLED ) {
397423 BorderStroke (1.5 .dp, borderColor)
398424 } else {
0 commit comments