-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.js
More file actions
130 lines (130 loc) · 6.72 KB
/
plugin.js
File metadata and controls
130 lines (130 loc) · 6.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
* Copyright 2025 CleverAdsSolutions LTD, CAS.AI
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const SDK = globalThis.SDK;
////////////////////////////////////////////
// The plugin ID is how Construct identifies different kinds of plugins.
// *** NEVER CHANGE THE PLUGIN ID! ***
// If you change the plugin ID after releasing the plugin, Construct will think it is an entirely different
// plugin and assume it is incompatible with the old one, and YOU WILL BREAK ALL EXISTING PROJECTS USING THE PLUGIN.
// Only the plugin name is displayed in the editor, so to rename your plugin change the name but NOT the ID.
// If you want to completely replace a plugin, make it deprecated (it will be hidden but old projects keep working),
// and create an entirely new plugin with a different plugin ID.
const PLUGIN_ID = "CASAI_MobileAds";
////////////////////////////////////////////
const PLUGIN_CATEGORY = "monetisation";
const CORDOVA_VERSION = "4.6.6";
const PLUGIN_CLASS = (SDK.Plugins.CASAI_MobileAds = class CASMobileAds extends SDK.IPluginBase {
constructor() {
super(PLUGIN_ID);
SDK.Lang.PushContext("plugins." + PLUGIN_ID.toLowerCase());
this._info.SetName(globalThis.lang(".name"));
this._info.SetDescription(globalThis.lang(".description"));
this._info.SetCategory(PLUGIN_CATEGORY);
this._info.SetAuthor("Clever Ads Solutions LTD");
this._info.SetHelpUrl(globalThis.lang(".help-url"));
this._info.SetIsSingleGlobal(true);
this._info.SetRuntimeModuleMainScript("c3runtime/main.js");
SDK.Lang.PushContext(".properties");
const casIdIOSProp = new SDK.PluginProperty("text", "ios-cas-id", "demo");
const solutionsIOSProp = new SDK.PluginProperty("text", "ios-solutions", "-");
const adaptersIOSProp = new SDK.PluginProperty("longtext", "ios-adapters", "-");
const userTrackingUsageIOSProm = new SDK.PluginProperty("longtext", "ios-tracking-usage", "Your data will remain confidential and will only be used to provide you a better and personalised ad experience");
const solutionsAndroidProp = new SDK.PluginProperty("text", "android-solutions", "-");
const adaptersAndroidProp = new SDK.PluginProperty("longtext", "android-adapters", "-");
const useAdIdAndroidProp = new SDK.PluginProperty("text", "android-use-ad-id", "true");
// Aray must have same order as enum InitParameter in c3runtime/instance.ts
this._info.SetProperties([
new SDK.PluginProperty("group", "integration-ios"),
casIdIOSProp,
solutionsIOSProp,
adaptersIOSProp,
new SDK.PluginProperty("link", "ios-adapters-link", {
linkCallback: () => window.open("https://github.com/cleveradssolutions/CAS-iOS/tree/master/Adapters#casai-mediation-adapters")
}),
userTrackingUsageIOSProm,
new SDK.PluginProperty("group", "integration-android"),
solutionsAndroidProp,
adaptersAndroidProp,
new SDK.PluginProperty("link", "android-adapters-link", {
linkCallback: () => window.open("https://github.com/cleveradssolutions/CAS-Android/tree/master/Adapters#casai-mediation-adapters")
}),
useAdIdAndroidProp,
new SDK.PluginProperty("group", "app-info"),
new SDK.PluginProperty("combo", "target-audience", {
initialValue: "unknown",
items: ["unknown", "children", "not-children"],
}),
new SDK.PluginProperty("longtext", "app-keywords"),
new SDK.PluginProperty("text", "app-content-url"),
new SDK.PluginProperty("longtext", "mediation-extras"),
new SDK.PluginProperty("group", "automation"),
new SDK.PluginProperty("check", "auto-show-consent-form", true),
new SDK.PluginProperty("check", "auto-load-banner", false),
new SDK.PluginProperty("integer", "auto-refresh-banner", {
initialValue: 30,
minValue: 0,
maxValue: 180,
}),
new SDK.PluginProperty("check", "auto-load-mrec", false),
new SDK.PluginProperty("integer", "auto-refresh-mrec", {
initialValue: 30,
minValue: 0,
maxValue: 180,
}),
new SDK.PluginProperty("check", "auto-load-appopen", false),
new SDK.PluginProperty("check", "auto-show-appopen", false),
new SDK.PluginProperty("check", "auto-load-inter", false),
new SDK.PluginProperty("check", "auto-show-inter", false),
new SDK.PluginProperty("integer", "min-interval-inter", {
initialValue: 0,
minValue: 0,
maxValue: 360,
}),
new SDK.PluginProperty("check", "auto-load-reward", false),
new SDK.PluginProperty("check", "collect-location", true),
new SDK.PluginProperty("integer", "trial-ad-free-interval", {
initialValue: 0,
minValue: 0,
}),
new SDK.PluginProperty("group", "development"),
new SDK.PluginProperty("check", "force-test-ads", false),
new SDK.PluginProperty("longtext", "test-device-ids"),
new SDK.PluginProperty("check", "debug-logging", false),
new SDK.PluginProperty("combo", "debug-geography", {
initialValue: "eea",
items: ["unknown", "eea", "us", "other"],
}),
]);
this._info.AddCordovaPluginReference({
id: "cordova-plugin-casai",
version: CORDOVA_VERSION,
plugin: this,
variables: [
["IOS_CAS_ID", casIdIOSProp],
["IOS_CAS_SOLUTIONS", solutionsIOSProp],
["IOS_CAS_ADAPTERS", adaptersIOSProp],
["IOS_USER_TRACKING_USAGE", userTrackingUsageIOSProm],
["ANDROID_CAS_SOLUTIONS", solutionsAndroidProp],
["ANDROID_CAS_ADAPTERS", adaptersAndroidProp],
["ANDROID_USE_AD_ID", useAdIdAndroidProp],
],
});
SDK.Lang.PopContext(); // .properties
SDK.Lang.PopContext();
}
});
PLUGIN_CLASS.Register(PLUGIN_ID, PLUGIN_CLASS);
export {};