Skip to content

Commit abdff38

Browse files
committed
Rename isEnabled to canHandleMessaging
1 parent d9a8511 commit abdff38

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

content-scope-scripts/content-scope-scripts-impl/src/main/java/com/duckduckgo/contentscopescripts/impl/messaging/ContentScopeScriptsWebMessagingPlugin.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ContentScopeScriptsWebMessagingPlugin @Inject constructor(
4747
override val objectName: String
4848
get() = "contentScopeAdsjs"
4949

50-
override suspend fun isEnabled(): Boolean {
50+
override suspend fun canHandleMessaging(): Boolean {
5151
return webViewCompatContentScopeScripts.isEnabled()
5252
}
5353

js-messaging/js-messaging-api/src/main/java/com/duckduckgo/js/messaging/api/WebMessagingPlugin.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ interface WebMessagingPluginStrategy {
5353
val objectName: String
5454

5555
/**
56-
* Determines whether messaging actions should proceed (i.e. by checking feature flags).
57-
* @return true if messaging is allowed, false otherwise
56+
* Determines whether messaging can be handled (i.e. by checking feature flags).
57+
* @return true if messaging can be handled for this plugin, false otherwise
5858
*/
59-
suspend fun isEnabled(): Boolean
59+
suspend fun canHandleMessaging(): Boolean
6060

6161
/**
6262
* Provides the list of message handlers to process incoming messages.

js-messaging/js-messaging-impl/src/main/java/com/duckduckgo/js/messaging/impl/RealWebMessagingDelegate.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class RealWebMessagingDelegate @Inject constructor(
154154
webView: WebView,
155155
) {
156156
appCoroutineScope.launch {
157-
if (!strategy.isEnabled()) {
157+
if (!strategy.canHandleMessaging()) {
158158
return@launch
159159
}
160160

@@ -180,7 +180,7 @@ class RealWebMessagingDelegate @Inject constructor(
180180
webView: WebView,
181181
) {
182182
appCoroutineScope.launch {
183-
if (!strategy.isEnabled()) return@launch
183+
if (!strategy.canHandleMessaging()) return@launch
184184
runCatching {
185185
return@runCatching webViewCompatWrapper.removeWebMessageListener(webView, strategy.objectName)
186186
}.getOrElse { exception ->
@@ -210,7 +210,7 @@ class RealWebMessagingDelegate @Inject constructor(
210210
override fun postMessage(subscriptionEventData: SubscriptionEventData) {
211211
runCatching {
212212
appCoroutineScope.launch {
213-
if (!strategy.isEnabled()) {
213+
if (!strategy.canHandleMessaging()) {
214214
return@launch
215215
}
216216

0 commit comments

Comments
 (0)