diff options
author | Guillaume Jacquart <guillaume.jacquart@hoodbrains.com> | 2023-09-12 06:17:39 +0000 |
---|---|---|
committer | Guillaume Jacquart <guillaume.jacquart@hoodbrains.com> | 2023-09-12 06:17:39 +0000 |
commit | 53f4a9ce311d612d43fa770cf7e8f8e98fbb43a0 (patch) | |
tree | 59c58e58cfef0e370f39bd9c150e36c6dfcb50c0 /app/src/main/java/foundation/e/advancedprivacy/widget | |
parent | 1a77e3924bc78eabca7b859ef62be30bbf2476ad (diff) | |
download | advanced-privacy-53f4a9ce311d612d43fa770cf7e8f8e98fbb43a0.tar.gz |
2: organise module with clean archi, use Koin for injection.
Diffstat (limited to 'app/src/main/java/foundation/e/advancedprivacy/widget')
-rw-r--r-- | app/src/main/java/foundation/e/advancedprivacy/widget/WidgetCommandReceiver.kt | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/app/src/main/java/foundation/e/advancedprivacy/widget/WidgetCommandReceiver.kt b/app/src/main/java/foundation/e/advancedprivacy/widget/WidgetCommandReceiver.kt index 9021125..917cbda 100644 --- a/app/src/main/java/foundation/e/advancedprivacy/widget/WidgetCommandReceiver.kt +++ b/app/src/main/java/foundation/e/advancedprivacy/widget/WidgetCommandReceiver.kt @@ -20,11 +20,12 @@ package foundation.e.advancedprivacy.widget import android.content.BroadcastReceiver import android.content.Context import android.content.Intent -import foundation.e.advancedprivacy.AdvancedPrivacyApplication +import foundation.e.advancedprivacy.domain.usecases.GetQuickPrivacyStateUseCase +import org.koin.java.KoinJavaComponent.get class WidgetCommandReceiver : BroadcastReceiver() { override fun onReceive(context: Context?, intent: Intent?) { - val getQuickPrivacyStateUseCase = (context?.applicationContext as? AdvancedPrivacyApplication)?.dependencyContainer?.getQuickPrivacyStateUseCase + val getQuickPrivacyStateUseCase = get<GetQuickPrivacyStateUseCase>(GetQuickPrivacyStateUseCase::class.java) val featureEnabled = intent?.extras?.let { bundle -> if (bundle.containsKey(PARAM_FEATURE_ENABLED)) @@ -32,9 +33,9 @@ class WidgetCommandReceiver : BroadcastReceiver() { else null } when (intent?.action) { - ACTION_TOGGLE_TRACKERS -> getQuickPrivacyStateUseCase?.toggleTrackers(featureEnabled) - ACTION_TOGGLE_LOCATION -> getQuickPrivacyStateUseCase?.toggleLocation(featureEnabled) - ACTION_TOGGLE_IPSCRAMBLING -> getQuickPrivacyStateUseCase?.toggleIpScrambling(featureEnabled) + ACTION_TOGGLE_TRACKERS -> getQuickPrivacyStateUseCase.toggleTrackers(featureEnabled) + ACTION_TOGGLE_LOCATION -> getQuickPrivacyStateUseCase.toggleLocation(featureEnabled) + ACTION_TOGGLE_IPSCRAMBLING -> getQuickPrivacyStateUseCase.toggleIpScrambling(featureEnabled) else -> {} } } |