Skip to content

Commit 2a7d08c

Browse files
marcosholgadogithub-actions[bot]
authored andcommitted
Release build 4.10.1 [ci release]
1 parent ca62a15 commit 2a7d08c

File tree

2 files changed

+5
-108
lines changed

2 files changed

+5
-108
lines changed

build/android/contentScope.js

Lines changed: 2 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -610,17 +610,6 @@
610610
}
611611
}
612612

613-
async function update$1 (args) {
614-
if (!shouldRun()) {
615-
return
616-
}
617-
if (initArgs === null) {
618-
updates.push(args);
619-
return
620-
}
621-
updateFeaturesInner(args);
622-
}
623-
624613
function alwaysInitExtensionFeatures (args, featureName) {
625614
return args.platform.name === 'extension' && alwaysInitFeatures.has(featureName)
626615
}
@@ -639,15 +628,6 @@
639628
* @category Content Scope Scripts Integrations
640629
*/
641630

642-
const allowedMessages = [
643-
'getClickToLoadState',
644-
'getYouTubeVideoDetails',
645-
'openShareFeedbackPage',
646-
'setYoutubePreviewsEnabled',
647-
'unblockClickToLoadContent',
648-
'updateYouTubeCTLAddedFlag'
649-
];
650-
651631
function initCode () {
652632
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
653633
const processedConfig = processConfig($CONTENT_SCOPE$, $USER_UNPROTECTED_DOMAINS$, $USER_PREFERENCES$);
@@ -659,47 +639,10 @@
659639
platform: processedConfig.platform
660640
});
661641

662-
const messageSecret = processedConfig.messageSecret;
663-
// Receives messages from the platform
664-
const messageCallback = processedConfig.messageCallback;
665-
// Sends messages to the platform
666-
const messageInterface = processedConfig.messageInterface;
667-
668-
const wrappedUpdate = ((providedSecret, ...args) => {
669-
if (providedSecret === messageSecret) {
670-
update$1(...args);
671-
}
672-
}).bind();
673-
674-
Object.defineProperty(window, messageCallback, {
675-
value: wrappedUpdate
676-
});
677-
678-
// @ts-ignore
679-
const sendMessageToAndroid = window[messageInterface].process.bind(window[messageInterface]);
680-
delete window[messageInterface];
681-
682642
init$1(processedConfig);
683643

684-
window.addEventListener('sendMessageProxy' + messageSecret, event => {
685-
event.stopImmediatePropagation();
686-
687-
if (!(event instanceof CustomEvent) || !event?.detail) {
688-
return console.warn('no details in sendMessage proxy', event)
689-
}
690-
691-
const messageType = event.detail?.messageType;
692-
if (!allowedMessages.includes(messageType)) {
693-
return console.warn('Ignoring invalid sendMessage messageType', messageType)
694-
}
695-
696-
const message = {
697-
type: messageType,
698-
options: event.detail?.options
699-
};
700-
const stringifiedArgs = JSON.stringify(message);
701-
sendMessageToAndroid(stringifiedArgs, messageSecret);
702-
});
644+
// Not supported:
645+
// update(message)
703646
}
704647

705648
initCode();

inject/android.js

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,9 @@
22
* @module Android integration
33
* @category Content Scope Scripts Integrations
44
*/
5-
import { load, init, update } from '../src/content-scope-features.js'
5+
import { load, init } from '../src/content-scope-features.js'
66
import { processConfig, isGloballyDisabled } from './../src/utils'
77

8-
const allowedMessages = [
9-
'getClickToLoadState',
10-
'getYouTubeVideoDetails',
11-
'openShareFeedbackPage',
12-
'setYoutubePreviewsEnabled',
13-
'unblockClickToLoadContent',
14-
'updateYouTubeCTLAddedFlag'
15-
]
16-
178
function initCode () {
189
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
1910
const processedConfig = processConfig($CONTENT_SCOPE$, $USER_UNPROTECTED_DOMAINS$, $USER_PREFERENCES$)
@@ -25,47 +16,10 @@ function initCode () {
2516
platform: processedConfig.platform
2617
})
2718

28-
const messageSecret = processedConfig.messageSecret
29-
// Receives messages from the platform
30-
const messageCallback = processedConfig.messageCallback
31-
// Sends messages to the platform
32-
const messageInterface = processedConfig.messageInterface
33-
34-
const wrappedUpdate = ((providedSecret, ...args) => {
35-
if (providedSecret === messageSecret) {
36-
update(...args)
37-
}
38-
}).bind()
39-
40-
Object.defineProperty(window, messageCallback, {
41-
value: wrappedUpdate
42-
})
43-
44-
// @ts-ignore
45-
const sendMessageToAndroid = window[messageInterface].process.bind(window[messageInterface])
46-
delete window[messageInterface]
47-
4819
init(processedConfig)
4920

50-
window.addEventListener('sendMessageProxy' + messageSecret, event => {
51-
event.stopImmediatePropagation()
52-
53-
if (!(event instanceof CustomEvent) || !event?.detail) {
54-
return console.warn('no details in sendMessage proxy', event)
55-
}
56-
57-
const messageType = event.detail?.messageType
58-
if (!allowedMessages.includes(messageType)) {
59-
return console.warn('Ignoring invalid sendMessage messageType', messageType)
60-
}
61-
62-
const message = {
63-
type: messageType,
64-
options: event.detail?.options
65-
}
66-
const stringifiedArgs = JSON.stringify(message)
67-
sendMessageToAndroid(stringifiedArgs, messageSecret)
68-
})
21+
// Not supported:
22+
// update(message)
6923
}
7024

7125
initCode()

0 commit comments

Comments
 (0)