From 1c6d37b90bbee7dbc5161df74e06fc9064186727 Mon Sep 17 00:00:00 2001 From: TheScarastic Date: Thu, 5 May 2022 12:21:28 +0530 Subject: privacycentralapp: add toast to widget as well --- .../e/privacycentralapp/widget/WidgetCommandReceiver.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/foundation/e/privacycentralapp/widget/WidgetCommandReceiver.kt b/app/src/main/java/foundation/e/privacycentralapp/widget/WidgetCommandReceiver.kt index a4e3079..831c06f 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/widget/WidgetCommandReceiver.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/widget/WidgetCommandReceiver.kt @@ -20,14 +20,22 @@ package foundation.e.privacycentralapp.widget import android.content.BroadcastReceiver import android.content.Context import android.content.Intent +import android.widget.Toast import foundation.e.privacycentralapp.PrivacyCentralApplication +import foundation.e.privacycentralapp.R class WidgetCommandReceiver : BroadcastReceiver() { override fun onReceive(context: Context?, intent: Intent?) { + val privacyCentralApplication = (context?.applicationContext as? PrivacyCentralApplication) when (intent?.action) { ACTION_TOGGLE_PRIVACY -> { - (context?.applicationContext as? PrivacyCentralApplication) - ?.dependencyContainer?.getQuickPrivacyStateUseCase?.toggleReturnIsFirstActivation() + if (privacyCentralApplication?.dependencyContainer?.getQuickPrivacyStateUseCase?.toggleReturnIsFirstActivation() == true) { + Toast.makeText( + context, + context.getString(R.string.dashboard_first_ipscrambling_activation), + Toast.LENGTH_LONG + ).show() + } } else -> {} } -- cgit v1.2.1