From 42172da29272c311c7d8941f427b77641f672c48 Mon Sep 17 00:00:00 2001 From: Vishal Bhat Soori Date: Sat, 21 Mar 2026 16:58:43 +0000 Subject: [PATCH] updated the ui component and reporting to Indian Authorities or USA authorities feature is added --- .../intelligence/ContextualAIAssistant.kt | 2 +- .../intelligence/PredictiveThreatEngine.kt | 2 +- .../feature/alerts/AlertDetailViewModel.kt | 40 +++++++++++++++---- .../feature/alerts/AlertsScreens.kt | 4 +- .../feature/education/EducationScreen.kt | 7 ++-- .../feature/home/EmergencySosScreen.kt | 24 +++++++---- .../feature/home/ScamRecoveryScreen.kt | 21 +++++++--- 7 files changed, 72 insertions(+), 28 deletions(-) diff --git a/core/src/main/kotlin/com/deepfakeshield/core/intelligence/ContextualAIAssistant.kt b/core/src/main/kotlin/com/deepfakeshield/core/intelligence/ContextualAIAssistant.kt index d1c6242..1dd8283 100644 --- a/core/src/main/kotlin/com/deepfakeshield/core/intelligence/ContextualAIAssistant.kt +++ b/core/src/main/kotlin/com/deepfakeshield/core/intelligence/ContextualAIAssistant.kt @@ -216,7 +216,7 @@ class ContextualAIAssistant @Inject constructor() { details = when (threatType) { "SCAM_SMS" -> "Forward to 7726 (SPAM) for your carrier" "PHISHING_URL" -> "Report to Anti-Phishing Working Group (reportphishing@apwg.org)" - "SCAM_CALL" -> "Report to FTC at ReportFraud.ftc.gov" + "SCAM_CALL" -> "Report to local authorities (e.g., FTC or I4C)" else -> "Report to appropriate authorities" } ) diff --git a/core/src/main/kotlin/com/deepfakeshield/core/intelligence/PredictiveThreatEngine.kt b/core/src/main/kotlin/com/deepfakeshield/core/intelligence/PredictiveThreatEngine.kt index a9eb483..840dc08 100644 --- a/core/src/main/kotlin/com/deepfakeshield/core/intelligence/PredictiveThreatEngine.kt +++ b/core/src/main/kotlin/com/deepfakeshield/core/intelligence/PredictiveThreatEngine.kt @@ -406,7 +406,7 @@ class PredictiveThreatEngine @Inject constructor() { "gift_card_scam" -> listOf( "No legitimate company demands gift cards", "Call back using official number", - "Report to FTC" + "Report to local authorities (e.g. FTC/I4C)" ) else -> listOf( "Verify through official channels", diff --git a/feature/alerts/src/main/kotlin/com/deepfakeshield/feature/alerts/AlertDetailViewModel.kt b/feature/alerts/src/main/kotlin/com/deepfakeshield/feature/alerts/AlertDetailViewModel.kt index b544326..8104ad2 100644 --- a/feature/alerts/src/main/kotlin/com/deepfakeshield/feature/alerts/AlertDetailViewModel.kt +++ b/feature/alerts/src/main/kotlin/com/deepfakeshield/feature/alerts/AlertDetailViewModel.kt @@ -9,6 +9,7 @@ import com.deepfakeshield.data.repository.AlertRepository import com.deepfakeshield.data.repository.AuditLogRepository import com.deepfakeshield.data.repository.DomainReputationRepository import com.deepfakeshield.data.repository.PhoneReputationRepository +import com.deepfakeshield.data.preferences.UserPreferences import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.* import kotlinx.coroutines.launch @@ -18,7 +19,10 @@ data class AlertDetailUiState( val alert: AlertEntity? = null, val isLoading: Boolean = true, val error: String? = null, - val blockAndReportSuccess: Boolean = false + val blockAndReportSuccess: Boolean = false, + val reportingAgencyName: String = "FTC", + val reportingAgencyUrl: String = "https://reportfraud.ftc.gov/#/", + val reportingAgencyPhone: String = "1-877-382-4357" ) @HiltViewModel @@ -27,7 +31,8 @@ class AlertDetailViewModel @Inject constructor( private val alertRepository: AlertRepository, private val phoneReputationRepository: PhoneReputationRepository, private val domainReputationRepository: DomainReputationRepository, - private val auditLogRepository: AuditLogRepository + private val auditLogRepository: AuditLogRepository, + private val userPreferences: UserPreferences ) : ViewModel() { private val alertId: Long = savedStateHandle.get("alertId") @@ -39,6 +44,29 @@ class AlertDetailViewModel @Inject constructor( init { loadAlert() + observeCountry() + } + + private fun observeCountry() { + userPreferences.userCountry + .onEach { country -> + _uiState.update { + if (country == "IN") { + it.copy( + reportingAgencyName = "I4C", + reportingAgencyUrl = "https://cybercrime.gov.in/", + reportingAgencyPhone = "1930" + ) + } else { + it.copy( + reportingAgencyName = "FTC", + reportingAgencyUrl = "https://reportfraud.ftc.gov/#/", + reportingAgencyPhone = "1-877-382-4357" + ) + } + } + } + .launchIn(viewModelScope) } private fun loadAlert() { @@ -110,12 +138,10 @@ class AlertDetailViewModel @Inject constructor( } /** - * Creates Intent to open FTC Report Fraud page - user can submit report. + * Creates Intent to open the reporting agency's website. */ - fun createFtcReportIntent(): Intent { - @Suppress("UNUSED_VARIABLE") - val alert = _uiState.value.alert - val url = "https://reportfraud.ftc.gov/#/" + fun createReportIntent(): Intent { + val url = _uiState.value.reportingAgencyUrl return Intent(Intent.ACTION_VIEW).apply { setPackage(null) data = android.net.Uri.parse(url) diff --git a/feature/alerts/src/main/kotlin/com/deepfakeshield/feature/alerts/AlertsScreens.kt b/feature/alerts/src/main/kotlin/com/deepfakeshield/feature/alerts/AlertsScreens.kt index a9f902b..dd6a258 100644 --- a/feature/alerts/src/main/kotlin/com/deepfakeshield/feature/alerts/AlertsScreens.kt +++ b/feature/alerts/src/main/kotlin/com/deepfakeshield/feature/alerts/AlertsScreens.kt @@ -466,7 +466,7 @@ fun AlertDetailScreen( OutlinedButton( onClick = { try { - ctx.startActivity(viewModel.createFtcReportIntent()) + ctx.startActivity(viewModel.createReportIntent()) } catch (_: Exception) { android.widget.Toast.makeText(ctx, "No browser app available", android.widget.Toast.LENGTH_SHORT).show() } @@ -475,7 +475,7 @@ fun AlertDetailScreen( ) { Icon(Icons.Filled.Share, contentDescription = null, Modifier.size(18.dp)) Spacer(Modifier.width(8.dp)) - Text("Report to FTC (reportfraud.ftc.gov)") + Text("Report to ${uiState.reportingAgencyName} (${uiState.reportingAgencyUrl.removePrefix("https://").removeSuffix("/")})") } } if (!alert.isHandled) { diff --git a/feature/education/src/main/kotlin/com/deepfakeshield/feature/education/EducationScreen.kt b/feature/education/src/main/kotlin/com/deepfakeshield/feature/education/EducationScreen.kt index d04f874..3b48c6c 100644 --- a/feature/education/src/main/kotlin/com/deepfakeshield/feature/education/EducationScreen.kt +++ b/feature/education/src/main/kotlin/com/deepfakeshield/feature/education/EducationScreen.kt @@ -55,7 +55,7 @@ fun EducationScreen( } when (selectedTab) { - 0 -> LearnTab() + 0 -> LearnTab(userPreferences) 1 -> QuizTab() 2 -> TipsTab() } @@ -65,7 +65,8 @@ fun EducationScreen( // ===== LEARN TAB ===== @Composable -private fun LearnTab() { +private fun LearnTab(userPreferences: UserPreferences) { + val country by userPreferences.userCountry.collectAsState(initial = "USA") Column( modifier = Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(16.dp), verticalArrangement = Arrangement.spacedBy(16.dp) @@ -110,7 +111,7 @@ private fun LearnTab() { "Contact your bank immediately to freeze accounts", "Change passwords on all affected accounts", "Report to local police and file a complaint", - "Report to FTC at reportfraud.ftc.gov", + if (country == "IN") "Report to I4C at cybercrime.gov.in" else "Report to FTC at reportfraud.ftc.gov", "Monitor your credit for unusual activity", "Don't blame yourself - scammers are professionals" ) diff --git a/feature/home/src/main/kotlin/com/deepfakeshield/feature/home/EmergencySosScreen.kt b/feature/home/src/main/kotlin/com/deepfakeshield/feature/home/EmergencySosScreen.kt index 4ffd58f..46eb147 100644 --- a/feature/home/src/main/kotlin/com/deepfakeshield/feature/home/EmergencySosScreen.kt +++ b/feature/home/src/main/kotlin/com/deepfakeshield/feature/home/EmergencySosScreen.kt @@ -137,21 +137,29 @@ fun EmergencySosScreen(onNavigateBack: () -> Unit, userPreferences: UserPreferen // Quick call buttons Text("Quick Emergency Contacts", fontWeight = FontWeight.Bold, style = MaterialTheme.typography.titleMedium, modifier = Modifier.fillMaxWidth()) + val country by userPreferences.userCountry.collectAsState(initial = "USA") + // Emergency services - QuickCallCard(Icons.Default.LocalHospital, "Emergency Services", "911", Color(0xFFF44336)) { - dialNumber(context, "911") + QuickCallCard(Icons.Default.LocalHospital, "Emergency Services", if (country == "IN") "100 / 112" else "911", Color(0xFFF44336)) { + dialNumber(context, if (country == "IN") "112" else "911") } - QuickCallCard(Icons.Default.LocalPolice, "Police Non-Emergency", "311", Color(0xFF2196F3)) { - dialNumber(context, "311") + QuickCallCard(Icons.Default.LocalPolice, "Police Non-Emergency", if (country == "IN") "100" else "311", Color(0xFF2196F3)) { + dialNumber(context, if (country == "IN") "100" else "311") } - QuickCallCard(Icons.Default.ReportProblem, "FTC Fraud Reporting", "1-877-382-4357", Color(0xFFFF9800)) { - dialNumber(context, "18773824357") + if (country == "IN") { + QuickCallCard(Icons.Default.ReportProblem, "I4C Cybercrime Reporting", "1930", Color(0xFFFF9800)) { + dialNumber(context, "1930") + } + } else { + QuickCallCard(Icons.Default.ReportProblem, "FTC Fraud Reporting", "1-877-382-4357", Color(0xFFFF9800)) { + dialNumber(context, "18773824357") + } } - QuickCallCard(Icons.Default.Psychology, "Identity Theft Hotline", "1-877-438-4338", Color(0xFF9C27B0)) { - dialNumber(context, "18774384338") + QuickCallCard(Icons.Default.Psychology, "Identity Theft Hotline", if (country == "IN") "1930" else "1-877-438-4338", Color(0xFF9C27B0)) { + dialNumber(context, if (country == "IN") "1930" else "18774384338") } // Scam-specific actions diff --git a/feature/home/src/main/kotlin/com/deepfakeshield/feature/home/ScamRecoveryScreen.kt b/feature/home/src/main/kotlin/com/deepfakeshield/feature/home/ScamRecoveryScreen.kt index d07caea..cfd2889 100644 --- a/feature/home/src/main/kotlin/com/deepfakeshield/feature/home/ScamRecoveryScreen.kt +++ b/feature/home/src/main/kotlin/com/deepfakeshield/feature/home/ScamRecoveryScreen.kt @@ -49,21 +49,30 @@ fun ScamRecoveryScreen(onNavigateBack: () -> Unit, userPreferences: UserPreferen "Investment/Crypto Scam" to "Lost money in fake investment scheme" ) - val steps = remember { listOf( + val country by userPreferences.userCountry.collectAsState(initial = "USA") + val steps = remember(country) { listOf( RecoveryStep(1, "Stop All Contact", "Do NOT respond to, call back, or engage further with the scammer. Block their number/email immediately.", Icons.Default.Block, Color(0xFFF44336), - listOf("Block the scammer's number" to "tel:*67", "Report to carrier (T-Mobile)" to "tel:611"), "IMMEDIATE"), + listOf("Block the scammer's number" to "tel:*67", "Report to carrier" to "tel:611"), "IMMEDIATE"), RecoveryStep(2, "Freeze Your Credit", "Contact all 3 credit bureaus to freeze your credit. This prevents scammers from opening accounts in your name.", Icons.Default.CreditCard, Color(0xFF2196F3), - listOf("Equifax Freeze" to "https://www.equifax.com/personal/credit-report-services/credit-freeze/", "Experian Freeze" to "https://www.experian.com/freeze/center.html", "TransUnion Freeze" to "https://www.transunion.com/credit-freeze"), "CRITICAL"), + if (country == "IN") { + listOf("CIBIL Dispute" to "https://www.cibil.com/consumer-dispute-resolution", "Equifax India" to "https://www.equifax.co.in/", "Experian India" to "https://www.experian.in/") + } else { + listOf("Equifax Freeze" to "https://www.equifax.com/personal/credit-report-services/credit-freeze/", "Experian Freeze" to "https://www.experian.com/freeze/center.html", "TransUnion Freeze" to "https://www.transunion.com/credit-freeze") + }, "CRITICAL"), RecoveryStep(3, "Change All Passwords", "Change passwords for any accounts that may be compromised. Start with email and banking.", Icons.Default.Password, Color(0xFF9C27B0), listOf("Google Account" to "https://myaccount.google.com/security", "Apple ID" to "https://appleid.apple.com"), "CRITICAL"), RecoveryStep(4, "Contact Your Bank", "Notify your bank and credit card companies of potential fraud. Request new cards if numbers were shared.", Icons.Default.AccountBalance, Color(0xFF4CAF50), listOf(), "CRITICAL"), - RecoveryStep(5, "Report to Authorities", "File reports with the FTC, FBI IC3, and local police. This creates an official record.", Icons.Default.LocalPolice, Color(0xFF3F51B5), - listOf("FTC ReportFraud.ftc.gov" to "https://reportfraud.ftc.gov/", "FBI IC3" to "https://www.ic3.gov/", "IdentityTheft.gov" to "https://www.identitytheft.gov/"), "IMPORTANT"), + RecoveryStep(5, "Report to Authorities", if (country == "IN") "File reports with I4C, local police, and your bank. This creates an official record." else "File reports with the FTC, FBI IC3, and local police. This creates an official record.", Icons.Default.LocalPolice, Color(0xFF3F51B5), + if (country == "IN") { + listOf("I4C Cybercrime.gov.in" to "https://cybercrime.gov.in/", "National Consumer Helpline" to "https://consumerhelpline.gov.in/") + } else { + listOf("FTC ReportFraud.ftc.gov" to "https://reportfraud.ftc.gov/", "FBI IC3" to "https://www.ic3.gov/", "IdentityTheft.gov" to "https://www.identitytheft.gov/") + }, "IMPORTANT"), RecoveryStep(6, "Enable 2FA Everywhere", "Add two-factor authentication to all important accounts. Use an authenticator app, not SMS.", Icons.Default.PhoneAndroid, Color(0xFFFF9800), listOf("Google Authenticator" to "https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2"), "IMPORTANT"), RecoveryStep(7, "Monitor Your Accounts", "Check bank statements, credit reports, and account activity daily for the next 90 days.", Icons.Default.MonitorHeart, Color(0xFF00BCD4), - listOf("AnnualCreditReport.com" to "https://www.annualcreditreport.com/"), "ONGOING"), + listOf(), "ONGOING"), RecoveryStep(8, "Document Everything", "Save all evidence: screenshots, emails, text messages, phone records, transaction records.", Icons.Default.PhotoCamera, Color(0xFF795548), listOf(), "ONGOING") ) }