Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7bfcbf2f authored by Abhishek Aggarwal's avatar Abhishek Aggarwal
Browse files

Merge branch '5312-main-widget_toast' into 'main'

privacycentralapp: add toast to widget as well

See merge request e/privacy-central/privacycentralapp!53
parents 7b8cbd55 1c6d37b9
Loading
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -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 -> {}
        }