0.3.0 design: owner decisions Q1-Q7; CUSTOM banner size, native template fonts, banner demo ids
- Per-ad impression listeners plus a capped (100) queue flushed on the first impressionData listener.
- Android adaptive width unit is dp (SDK bytecode).
- Adaptive banners without a fixed width are recreated on safe-area width changes.
- BannerSize gains CUSTOM with customSize { width, height }.
- NativeAdTemplateStyle gains titleFont / bodyFont / callToActionFont ({ family, size }).
- LEVELPLAY_DEMO gains the banner ad unit ids of Unity's sample apps.
- Capacitor 7 targeted for 0.3.0 (verified in a later phase).
This commit is contained in:
parent
7a187f5dd1
commit
e31f019a7c
14 changed files with 388 additions and 56 deletions
58
README.md
58
README.md
|
|
@ -1836,13 +1836,24 @@ A rectangle in CSS px, relative to the top-left corner of the WebView viewport (
|
||||||
|
|
||||||
Options for `createBanner()`.
|
Options for `createBanner()`.
|
||||||
|
|
||||||
| Prop | Type | Description | Default | Since |
|
| Prop | Type | Description | Default | Since |
|
||||||
| ------------------- | ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | ----- |
|
| ------------------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | ----- |
|
||||||
| **`bannerId`** | <code>string</code> | Plugin-side id of this banner, used by every other banner method and in banner events. Lets one ad unit back several banners. Defaults to `adUnitId`. | | 0.3.0 |
|
| **`bannerId`** | <code>string</code> | Plugin-side id of this banner, used by every other banner method and in banner events. Lets one ad unit back several banners. Defaults to `adUnitId`. | | 0.3.0 |
|
||||||
| **`size`** | <code><a href="#bannersize">BannerSize</a></code> | Size preset. | <code>'ADAPTIVE'</code> | 0.3.0 |
|
| **`size`** | <code><a href="#bannersize">BannerSize</a></code> | Size preset. | <code>'ADAPTIVE'</code> | 0.3.0 |
|
||||||
| **`adaptiveWidth`** | <code>number</code> | `ADAPTIVE` only: width in CSS px to compute the adaptive size for. Defaults to the width of the WebView's safe area. | | 0.3.0 |
|
| **`customSize`** | <code><a href="#bannercustomsize">BannerCustomSize</a></code> | `CUSTOM` only: the banner size. When `customSize` is set and `size` is omitted, `size` defaults to `CUSTOM`. | | 0.3.0 |
|
||||||
| **`placementName`** | <code>string</code> | Placement name (reporting only for banners). Applied through the banner config before the first load. | | 0.3.0 |
|
| **`adaptiveWidth`** | <code>number</code> | `ADAPTIVE` only: width in CSS px to compute the adaptive size for. Defaults to the width of the WebView's safe area; in that case the plugin recreates and reloads the banner automatically when that width changes (rotation, split screen, window resize), keeping its id, layout and visibility. A fixed `adaptiveWidth` is never recreated. | | 0.3.0 |
|
||||||
| **`bidFloor`** | <code>number</code> | Bid floor in USD (`LevelPlayBannerAdView.Config.Builder.setBidFloor` / `LPMBannerAdViewConfigBuilder set(bidFloor:)`). | | 0.3.0 |
|
| **`placementName`** | <code>string</code> | Placement name (reporting only for banners). Applied through the banner config before the first load. | | 0.3.0 |
|
||||||
|
| **`bidFloor`** | <code>number</code> | Bid floor in USD (`LevelPlayBannerAdView.Config.Builder.setBidFloor` / `LPMBannerAdViewConfigBuilder set(bidFloor:)`). | | 0.3.0 |
|
||||||
|
|
||||||
|
|
||||||
|
#### BannerCustomSize
|
||||||
|
|
||||||
|
Width and height of a `CUSTOM` banner, in CSS px (dp on Android, points on iOS).
|
||||||
|
|
||||||
|
| Prop | Type | Description | Since |
|
||||||
|
| ------------ | ------------------- | ------------------------------------ | ----- |
|
||||||
|
| **`width`** | <code>number</code> | Width in CSS px (positive integer). | 0.3.0 |
|
||||||
|
| **`height`** | <code>number</code> | Height in CSS px (positive integer). | 0.3.0 |
|
||||||
|
|
||||||
|
|
||||||
#### BannerIdOptions
|
#### BannerIdOptions
|
||||||
|
|
@ -1874,14 +1885,27 @@ Options for `loadNativeAd()`.
|
||||||
|
|
||||||
Optional styling of a native ad template. Colours are CSS hex strings (`#RRGGBB` or `#RRGGBBAA`).
|
Optional styling of a native ad template. Colours are CSS hex strings (`#RRGGBB` or `#RRGGBBAA`).
|
||||||
|
|
||||||
| Prop | Type | Description | Default | Since |
|
| Prop | Type | Description | Default | Since |
|
||||||
| --------------------------------- | ------------------- | ---------------------------------------- | -------------- | ----- |
|
| --------------------------------- | ----------------------------------------------------- | ---------------------------------------- | -------------- | ----- |
|
||||||
| **`backgroundColor`** | <code>string</code> | Template background. | | 0.3.0 |
|
| **`backgroundColor`** | <code>string</code> | Template background. | | 0.3.0 |
|
||||||
| **`titleColor`** | <code>string</code> | Title text colour. | | 0.3.0 |
|
| **`titleColor`** | <code>string</code> | Title text colour. | | 0.3.0 |
|
||||||
| **`bodyColor`** | <code>string</code> | Body and advertiser text colour. | | 0.3.0 |
|
| **`bodyColor`** | <code>string</code> | Body and advertiser text colour. | | 0.3.0 |
|
||||||
| **`callToActionBackgroundColor`** | <code>string</code> | Call-to-action button background. | | 0.3.0 |
|
| **`callToActionBackgroundColor`** | <code>string</code> | Call-to-action button background. | | 0.3.0 |
|
||||||
| **`callToActionTextColor`** | <code>string</code> | Call-to-action button text colour. | | 0.3.0 |
|
| **`callToActionTextColor`** | <code>string</code> | Call-to-action button text colour. | | 0.3.0 |
|
||||||
| **`cornerRadius`** | <code>number</code> | Corner radius of the template in CSS px. | <code>0</code> | 0.3.0 |
|
| **`cornerRadius`** | <code>number</code> | Corner radius of the template in CSS px. | <code>0</code> | 0.3.0 |
|
||||||
|
| **`titleFont`** | <code><a href="#nativeadfont">NativeAdFont</a></code> | Title font. | | 0.3.0 |
|
||||||
|
| **`bodyFont`** | <code><a href="#nativeadfont">NativeAdFont</a></code> | Body and advertiser font. | | 0.3.0 |
|
||||||
|
| **`callToActionFont`** | <code><a href="#nativeadfont">NativeAdFont</a></code> | Call-to-action button font. | | 0.3.0 |
|
||||||
|
|
||||||
|
|
||||||
|
#### NativeAdFont
|
||||||
|
|
||||||
|
A font of a native ad template text. Omitted fields keep the template default (system font).
|
||||||
|
|
||||||
|
| Prop | Type | Description | Since |
|
||||||
|
| ------------ | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
||||||
|
| **`family`** | <code>string</code> | Font family. Either a system family name (Android: `sans-serif`, `sans-serif-medium`, `serif`, `monospace` ...; iOS: a `UIFont` family or PostScript name such as `Avenir Next` or `Menlo-Bold`), or the path of a `.ttf` / `.otf` file inside the app's web assets, relative to the web root (for example `fonts/Inter-Bold.ttf`, the same file the page loads with `@font-face`). Unknown families fall back to the system font. | 0.3.0 |
|
||||||
|
| **`size`** | <code>number</code> | Font size in CSS px (dp / pt; not scaled by the system font size setting, like text in the WebView). | 0.3.0 |
|
||||||
|
|
||||||
|
|
||||||
#### NativeAdRectOptions
|
#### NativeAdRectOptions
|
||||||
|
|
@ -2070,8 +2094,10 @@ Banner size presets, named after the SDK constants (`LevelPlayAdSize.BANNER` / `
|
||||||
- `ADAPTIVE`: `LevelPlayAdSize.createAdaptiveAdSize(context, width)` / `LPMAdSize.createAdaptiveAdSize(withWidth:)`;
|
- `ADAPTIVE`: `LevelPlayAdSize.createAdaptiveAdSize(context, width)` / `LPMAdSize.createAdaptiveAdSize(withWidth:)`;
|
||||||
the SDK picks the height (and BANNER or LEADERBOARD as fallback) for the given width. Requires a finished
|
the SDK picks the height (and BANNER or LEADERBOARD as fallback) for the given width. Requires a finished
|
||||||
`initialize()`.
|
`initialize()`.
|
||||||
|
- `CUSTOM`: `LevelPlayAdSize.createCustomSize(width, height)` / `LPMAdSize.customSizeWithWidth:height:` with
|
||||||
|
`customSize`. Few networks fill custom sizes; prefer a preset or `ADAPTIVE`.
|
||||||
|
|
||||||
<code>'BANNER' | 'LARGE' | 'MEDIUM_RECTANGLE' | 'LEADERBOARD' | 'ADAPTIVE'</code>
|
<code>'BANNER' | 'LARGE' | 'MEDIUM_RECTANGLE' | 'LEADERBOARD' | 'ADAPTIVE' | 'CUSTOM'</code>
|
||||||
|
|
||||||
</docgen-api>
|
</docgen-api>
|
||||||
|
|
||||||
|
|
|
||||||
140
dist/docs.json
vendored
140
dist/docs.json
vendored
|
|
@ -2533,6 +2533,20 @@
|
||||||
],
|
],
|
||||||
"type": "BannerSize"
|
"type": "BannerSize"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "customSize",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"text": "0.3.0",
|
||||||
|
"name": "since"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"docs": "`CUSTOM` only: the banner size. When `customSize` is set and `size` is omitted, `size` defaults to `CUSTOM`.",
|
||||||
|
"complexTypes": [
|
||||||
|
"BannerCustomSize"
|
||||||
|
],
|
||||||
|
"type": "BannerCustomSize"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "adaptiveWidth",
|
"name": "adaptiveWidth",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -2541,7 +2555,7 @@
|
||||||
"name": "since"
|
"name": "since"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"docs": "`ADAPTIVE` only: width in CSS px to compute the adaptive size for. Defaults to the width of the WebView's safe\narea.",
|
"docs": "`ADAPTIVE` only: width in CSS px to compute the adaptive size for. Defaults to the width of the WebView's safe\narea; in that case the plugin recreates and reloads the banner automatically when that width changes (rotation,\nsplit screen, window resize), keeping its id, layout and visibility. A fixed `adaptiveWidth` is never recreated.",
|
||||||
"complexTypes": [],
|
"complexTypes": [],
|
||||||
"type": "number | undefined"
|
"type": "number | undefined"
|
||||||
},
|
},
|
||||||
|
|
@ -2571,6 +2585,44 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "BannerCustomSize",
|
||||||
|
"slug": "bannercustomsize",
|
||||||
|
"docs": "Width and height of a `CUSTOM` banner, in CSS px (dp on Android, points on iOS).",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"text": "0.3.0",
|
||||||
|
"name": "since"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"methods": [],
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "width",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"text": "0.3.0",
|
||||||
|
"name": "since"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"docs": "Width in CSS px (positive integer).",
|
||||||
|
"complexTypes": [],
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "height",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"text": "0.3.0",
|
||||||
|
"name": "since"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"docs": "Height in CSS px (positive integer).",
|
||||||
|
"complexTypes": [],
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "BannerIdOptions",
|
"name": "BannerIdOptions",
|
||||||
"slug": "banneridoptions",
|
"slug": "banneridoptions",
|
||||||
|
|
@ -2755,6 +2807,86 @@
|
||||||
"docs": "Corner radius of the template in CSS px.",
|
"docs": "Corner radius of the template in CSS px.",
|
||||||
"complexTypes": [],
|
"complexTypes": [],
|
||||||
"type": "number | undefined"
|
"type": "number | undefined"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "titleFont",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"text": "0.3.0",
|
||||||
|
"name": "since"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"docs": "Title font.",
|
||||||
|
"complexTypes": [
|
||||||
|
"NativeAdFont"
|
||||||
|
],
|
||||||
|
"type": "NativeAdFont"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "bodyFont",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"text": "0.3.0",
|
||||||
|
"name": "since"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"docs": "Body and advertiser font.",
|
||||||
|
"complexTypes": [
|
||||||
|
"NativeAdFont"
|
||||||
|
],
|
||||||
|
"type": "NativeAdFont"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "callToActionFont",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"text": "0.3.0",
|
||||||
|
"name": "since"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"docs": "Call-to-action button font.",
|
||||||
|
"complexTypes": [
|
||||||
|
"NativeAdFont"
|
||||||
|
],
|
||||||
|
"type": "NativeAdFont"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "NativeAdFont",
|
||||||
|
"slug": "nativeadfont",
|
||||||
|
"docs": "A font of a native ad template text. Omitted fields keep the template default (system font).",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"text": "0.3.0",
|
||||||
|
"name": "since"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"methods": [],
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "family",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"text": "0.3.0",
|
||||||
|
"name": "since"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"docs": "Font family. Either a system family name (Android: `sans-serif`, `sans-serif-medium`, `serif`, `monospace` ...;\niOS: a `UIFont` family or PostScript name such as `Avenir Next` or `Menlo-Bold`), or the path of a `.ttf` / `.otf`\nfile inside the app's web assets, relative to the web root (for example `fonts/Inter-Bold.ttf`, the same file the\npage loads with `@font-face`). Unknown families fall back to the system font.",
|
||||||
|
"complexTypes": [],
|
||||||
|
"type": "string | undefined"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "size",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"text": "0.3.0",
|
||||||
|
"name": "since"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"docs": "Font size in CSS px (dp / pt; not scaled by the system font size setting, like text in the WebView).",
|
||||||
|
"complexTypes": [],
|
||||||
|
"type": "number | undefined"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
@ -3539,7 +3671,7 @@
|
||||||
{
|
{
|
||||||
"name": "BannerSize",
|
"name": "BannerSize",
|
||||||
"slug": "bannersize",
|
"slug": "bannersize",
|
||||||
"docs": "Banner size presets, named after the SDK constants (`LevelPlayAdSize.BANNER` / `LPMAdSize.bannerSize()` ...).\n\n- `BANNER`: 320 x 50\n- `LARGE`: 320 x 90\n- `MEDIUM_RECTANGLE`: 300 x 250\n- `LEADERBOARD`: 728 x 90 (tablets)\n- `ADAPTIVE`: `LevelPlayAdSize.createAdaptiveAdSize(context, width)` / `LPMAdSize.createAdaptiveAdSize(withWidth:)`;\n the SDK picks the height (and BANNER or LEADERBOARD as fallback) for the given width. Requires a finished\n `initialize()`.",
|
"docs": "Banner size presets, named after the SDK constants (`LevelPlayAdSize.BANNER` / `LPMAdSize.bannerSize()` ...).\n\n- `BANNER`: 320 x 50\n- `LARGE`: 320 x 90\n- `MEDIUM_RECTANGLE`: 300 x 250\n- `LEADERBOARD`: 728 x 90 (tablets)\n- `ADAPTIVE`: `LevelPlayAdSize.createAdaptiveAdSize(context, width)` / `LPMAdSize.createAdaptiveAdSize(withWidth:)`;\n the SDK picks the height (and BANNER or LEADERBOARD as fallback) for the given width. Requires a finished\n `initialize()`.\n- `CUSTOM`: `LevelPlayAdSize.createCustomSize(width, height)` / `LPMAdSize.customSizeWithWidth:height:` with\n `customSize`. Few networks fill custom sizes; prefer a preset or `ADAPTIVE`.",
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
"text": "'BANNER'",
|
"text": "'BANNER'",
|
||||||
|
|
@ -3560,6 +3692,10 @@
|
||||||
{
|
{
|
||||||
"text": "'ADAPTIVE'",
|
"text": "'ADAPTIVE'",
|
||||||
"complexTypes": []
|
"complexTypes": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "'CUSTOM'",
|
||||||
|
"complexTypes": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
72
dist/esm/definitions.d.ts
vendored
72
dist/esm/definitions.d.ts
vendored
|
|
@ -539,10 +539,31 @@ export interface Rect {
|
||||||
* - `ADAPTIVE`: `LevelPlayAdSize.createAdaptiveAdSize(context, width)` / `LPMAdSize.createAdaptiveAdSize(withWidth:)`;
|
* - `ADAPTIVE`: `LevelPlayAdSize.createAdaptiveAdSize(context, width)` / `LPMAdSize.createAdaptiveAdSize(withWidth:)`;
|
||||||
* the SDK picks the height (and BANNER or LEADERBOARD as fallback) for the given width. Requires a finished
|
* the SDK picks the height (and BANNER or LEADERBOARD as fallback) for the given width. Requires a finished
|
||||||
* `initialize()`.
|
* `initialize()`.
|
||||||
|
* - `CUSTOM`: `LevelPlayAdSize.createCustomSize(width, height)` / `LPMAdSize.customSizeWithWidth:height:` with
|
||||||
|
* `customSize`. Few networks fill custom sizes; prefer a preset or `ADAPTIVE`.
|
||||||
*
|
*
|
||||||
* @since 0.3.0
|
* @since 0.3.0
|
||||||
*/
|
*/
|
||||||
export type BannerSize = 'BANNER' | 'LARGE' | 'MEDIUM_RECTANGLE' | 'LEADERBOARD' | 'ADAPTIVE';
|
export type BannerSize = 'BANNER' | 'LARGE' | 'MEDIUM_RECTANGLE' | 'LEADERBOARD' | 'ADAPTIVE' | 'CUSTOM';
|
||||||
|
/**
|
||||||
|
* Width and height of a `CUSTOM` banner, in CSS px (dp on Android, points on iOS).
|
||||||
|
*
|
||||||
|
* @since 0.3.0
|
||||||
|
*/
|
||||||
|
export interface BannerCustomSize {
|
||||||
|
/**
|
||||||
|
* Width in CSS px (positive integer).
|
||||||
|
*
|
||||||
|
* @since 0.3.0
|
||||||
|
*/
|
||||||
|
width: number;
|
||||||
|
/**
|
||||||
|
* Height in CSS px (positive integer).
|
||||||
|
*
|
||||||
|
* @since 0.3.0
|
||||||
|
*/
|
||||||
|
height: number;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Vertical anchor of a banner inside the WebView's safe area. Banners are always horizontally centred; use
|
* Vertical anchor of a banner inside the WebView's safe area. Banners are always horizontally centred; use
|
||||||
* `offsetX` to move them sideways.
|
* `offsetX` to move them sideways.
|
||||||
|
|
@ -619,9 +640,16 @@ export interface CreateBannerOptions extends AdUnitOptions, BannerLayoutOptions
|
||||||
* @since 0.3.0
|
* @since 0.3.0
|
||||||
*/
|
*/
|
||||||
size?: BannerSize;
|
size?: BannerSize;
|
||||||
|
/**
|
||||||
|
* `CUSTOM` only: the banner size. When `customSize` is set and `size` is omitted, `size` defaults to `CUSTOM`.
|
||||||
|
*
|
||||||
|
* @since 0.3.0
|
||||||
|
*/
|
||||||
|
customSize?: BannerCustomSize;
|
||||||
/**
|
/**
|
||||||
* `ADAPTIVE` only: width in CSS px to compute the adaptive size for. Defaults to the width of the WebView's safe
|
* `ADAPTIVE` only: width in CSS px to compute the adaptive size for. Defaults to the width of the WebView's safe
|
||||||
* area.
|
* area; in that case the plugin recreates and reloads the banner automatically when that width changes (rotation,
|
||||||
|
* split screen, window resize), keeping its id, layout and visibility. A fixed `adaptiveWidth` is never recreated.
|
||||||
*
|
*
|
||||||
* @since 0.3.0
|
* @since 0.3.0
|
||||||
*/
|
*/
|
||||||
|
|
@ -776,6 +804,46 @@ export interface NativeAdTemplateStyle {
|
||||||
* @since 0.3.0
|
* @since 0.3.0
|
||||||
*/
|
*/
|
||||||
cornerRadius?: number;
|
cornerRadius?: number;
|
||||||
|
/**
|
||||||
|
* Title font.
|
||||||
|
*
|
||||||
|
* @since 0.3.0
|
||||||
|
*/
|
||||||
|
titleFont?: NativeAdFont;
|
||||||
|
/**
|
||||||
|
* Body and advertiser font.
|
||||||
|
*
|
||||||
|
* @since 0.3.0
|
||||||
|
*/
|
||||||
|
bodyFont?: NativeAdFont;
|
||||||
|
/**
|
||||||
|
* Call-to-action button font.
|
||||||
|
*
|
||||||
|
* @since 0.3.0
|
||||||
|
*/
|
||||||
|
callToActionFont?: NativeAdFont;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* A font of a native ad template text. Omitted fields keep the template default (system font).
|
||||||
|
*
|
||||||
|
* @since 0.3.0
|
||||||
|
*/
|
||||||
|
export interface NativeAdFont {
|
||||||
|
/**
|
||||||
|
* Font family. Either a system family name (Android: `sans-serif`, `sans-serif-medium`, `serif`, `monospace` ...;
|
||||||
|
* iOS: a `UIFont` family or PostScript name such as `Avenir Next` or `Menlo-Bold`), or the path of a `.ttf` / `.otf`
|
||||||
|
* file inside the app's web assets, relative to the web root (for example `fonts/Inter-Bold.ttf`, the same file the
|
||||||
|
* page loads with `@font-face`). Unknown families fall back to the system font.
|
||||||
|
*
|
||||||
|
* @since 0.3.0
|
||||||
|
*/
|
||||||
|
family?: string;
|
||||||
|
/**
|
||||||
|
* Font size in CSS px (dp / pt; not scaled by the system font size setting, like text in the WebView).
|
||||||
|
*
|
||||||
|
* @since 0.3.0
|
||||||
|
*/
|
||||||
|
size?: number;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Identifies one native ad slot.
|
* Identifies one native ad slot.
|
||||||
|
|
|
||||||
2
dist/esm/definitions.js.map
vendored
2
dist/esm/definitions.js.map
vendored
File diff suppressed because one or more lines are too long
3
dist/esm/demo.d.ts
vendored
3
dist/esm/demo.d.ts
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
* Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps
|
* Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps
|
||||||
* (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and
|
* (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and
|
||||||
* `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.
|
* `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.
|
||||||
|
* The sample apps have no native ad placement; native ads load with the default placement of the app key.
|
||||||
* Replace them with your own ids from the LevelPlay dashboard before release.
|
* Replace them with your own ids from the LevelPlay dashboard before release.
|
||||||
*/
|
*/
|
||||||
export declare const LEVELPLAY_DEMO: {
|
export declare const LEVELPLAY_DEMO: {
|
||||||
|
|
@ -9,10 +10,12 @@ export declare const LEVELPLAY_DEMO: {
|
||||||
readonly appKey: "25b63cf85";
|
readonly appKey: "25b63cf85";
|
||||||
readonly rewarded: "syz3d8ekts22q0or";
|
readonly rewarded: "syz3d8ekts22q0or";
|
||||||
readonly interstitial: "h3xw38h9214adgxo";
|
readonly interstitial: "h3xw38h9214adgxo";
|
||||||
|
readonly banner: "4fpetq4lhe5lsw3e";
|
||||||
};
|
};
|
||||||
readonly ios: {
|
readonly ios: {
|
||||||
readonly appKey: "8545d445";
|
readonly appKey: "8545d445";
|
||||||
readonly rewarded: "qwouvdrkuwivay5q";
|
readonly rewarded: "qwouvdrkuwivay5q";
|
||||||
readonly interstitial: "wmgt0712uuux8ju4";
|
readonly interstitial: "wmgt0712uuux8ju4";
|
||||||
|
readonly banner: "iep3rxsyp9na3rw8";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
3
dist/esm/demo.js
vendored
3
dist/esm/demo.js
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
* Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps
|
* Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps
|
||||||
* (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and
|
* (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and
|
||||||
* `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.
|
* `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.
|
||||||
|
* The sample apps have no native ad placement; native ads load with the default placement of the app key.
|
||||||
* Replace them with your own ids from the LevelPlay dashboard before release.
|
* Replace them with your own ids from the LevelPlay dashboard before release.
|
||||||
*/
|
*/
|
||||||
export const LEVELPLAY_DEMO = {
|
export const LEVELPLAY_DEMO = {
|
||||||
|
|
@ -9,11 +10,13 @@ export const LEVELPLAY_DEMO = {
|
||||||
appKey: '25b63cf85',
|
appKey: '25b63cf85',
|
||||||
rewarded: 'syz3d8ekts22q0or',
|
rewarded: 'syz3d8ekts22q0or',
|
||||||
interstitial: 'h3xw38h9214adgxo',
|
interstitial: 'h3xw38h9214adgxo',
|
||||||
|
banner: '4fpetq4lhe5lsw3e',
|
||||||
},
|
},
|
||||||
ios: {
|
ios: {
|
||||||
appKey: '8545d445',
|
appKey: '8545d445',
|
||||||
rewarded: 'qwouvdrkuwivay5q',
|
rewarded: 'qwouvdrkuwivay5q',
|
||||||
interstitial: 'wmgt0712uuux8ju4',
|
interstitial: 'wmgt0712uuux8ju4',
|
||||||
|
banner: 'iep3rxsyp9na3rw8',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
//# sourceMappingURL=demo.js.map
|
//# sourceMappingURL=demo.js.map
|
||||||
2
dist/esm/demo.js.map
vendored
2
dist/esm/demo.js.map
vendored
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"demo.js","sourceRoot":"","sources":["../../src/demo.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE;QACP,MAAM,EAAE,WAAW;QACnB,QAAQ,EAAE,kBAAkB;QAC5B,YAAY,EAAE,kBAAkB;KACjC;IACD,GAAG,EAAE;QACH,MAAM,EAAE,UAAU;QAClB,QAAQ,EAAE,kBAAkB;QAC5B,YAAY,EAAE,kBAAkB;KACjC;CACO,CAAC","sourcesContent":["/**\n * Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps\n * (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and\n * `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.\n * Replace them with your own ids from the LevelPlay dashboard before release.\n */\nexport const LEVELPLAY_DEMO = {\n android: {\n appKey: '25b63cf85',\n rewarded: 'syz3d8ekts22q0or',\n interstitial: 'h3xw38h9214adgxo',\n },\n ios: {\n appKey: '8545d445',\n rewarded: 'qwouvdrkuwivay5q',\n interstitial: 'wmgt0712uuux8ju4',\n },\n} as const;\n"]}
|
{"version":3,"file":"demo.js","sourceRoot":"","sources":["../../src/demo.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE;QACP,MAAM,EAAE,WAAW;QACnB,QAAQ,EAAE,kBAAkB;QAC5B,YAAY,EAAE,kBAAkB;QAChC,MAAM,EAAE,kBAAkB;KAC3B;IACD,GAAG,EAAE;QACH,MAAM,EAAE,UAAU;QAClB,QAAQ,EAAE,kBAAkB;QAC5B,YAAY,EAAE,kBAAkB;QAChC,MAAM,EAAE,kBAAkB;KAC3B;CACO,CAAC","sourcesContent":["/**\n * Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps\n * (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and\n * `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.\n * The sample apps have no native ad placement; native ads load with the default placement of the app key.\n * Replace them with your own ids from the LevelPlay dashboard before release.\n */\nexport const LEVELPLAY_DEMO = {\n android: {\n appKey: '25b63cf85',\n rewarded: 'syz3d8ekts22q0or',\n interstitial: 'h3xw38h9214adgxo',\n banner: '4fpetq4lhe5lsw3e',\n },\n ios: {\n appKey: '8545d445',\n rewarded: 'qwouvdrkuwivay5q',\n interstitial: 'wmgt0712uuux8ju4',\n banner: 'iep3rxsyp9na3rw8',\n },\n} as const;\n"]}
|
||||||
3
dist/plugin.cjs.js
vendored
3
dist/plugin.cjs.js
vendored
|
|
@ -6,6 +6,7 @@ var core = require('@capacitor/core');
|
||||||
* Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps
|
* Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps
|
||||||
* (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and
|
* (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and
|
||||||
* `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.
|
* `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.
|
||||||
|
* The sample apps have no native ad placement; native ads load with the default placement of the app key.
|
||||||
* Replace them with your own ids from the LevelPlay dashboard before release.
|
* Replace them with your own ids from the LevelPlay dashboard before release.
|
||||||
*/
|
*/
|
||||||
const LEVELPLAY_DEMO = {
|
const LEVELPLAY_DEMO = {
|
||||||
|
|
@ -13,11 +14,13 @@ const LEVELPLAY_DEMO = {
|
||||||
appKey: '25b63cf85',
|
appKey: '25b63cf85',
|
||||||
rewarded: 'syz3d8ekts22q0or',
|
rewarded: 'syz3d8ekts22q0or',
|
||||||
interstitial: 'h3xw38h9214adgxo',
|
interstitial: 'h3xw38h9214adgxo',
|
||||||
|
banner: '4fpetq4lhe5lsw3e',
|
||||||
},
|
},
|
||||||
ios: {
|
ios: {
|
||||||
appKey: '8545d445',
|
appKey: '8545d445',
|
||||||
rewarded: 'qwouvdrkuwivay5q',
|
rewarded: 'qwouvdrkuwivay5q',
|
||||||
interstitial: 'wmgt0712uuux8ju4',
|
interstitial: 'wmgt0712uuux8ju4',
|
||||||
|
banner: 'iep3rxsyp9na3rw8',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
2
dist/plugin.cjs.js.map
vendored
2
dist/plugin.cjs.js.map
vendored
File diff suppressed because one or more lines are too long
3
dist/plugin.js
vendored
3
dist/plugin.js
vendored
|
|
@ -5,6 +5,7 @@ var capacitorLevelPlay = (function (exports, core) {
|
||||||
* Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps
|
* Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps
|
||||||
* (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and
|
* (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and
|
||||||
* `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.
|
* `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.
|
||||||
|
* The sample apps have no native ad placement; native ads load with the default placement of the app key.
|
||||||
* Replace them with your own ids from the LevelPlay dashboard before release.
|
* Replace them with your own ids from the LevelPlay dashboard before release.
|
||||||
*/
|
*/
|
||||||
const LEVELPLAY_DEMO = {
|
const LEVELPLAY_DEMO = {
|
||||||
|
|
@ -12,11 +13,13 @@ var capacitorLevelPlay = (function (exports, core) {
|
||||||
appKey: '25b63cf85',
|
appKey: '25b63cf85',
|
||||||
rewarded: 'syz3d8ekts22q0or',
|
rewarded: 'syz3d8ekts22q0or',
|
||||||
interstitial: 'h3xw38h9214adgxo',
|
interstitial: 'h3xw38h9214adgxo',
|
||||||
|
banner: '4fpetq4lhe5lsw3e',
|
||||||
},
|
},
|
||||||
ios: {
|
ios: {
|
||||||
appKey: '8545d445',
|
appKey: '8545d445',
|
||||||
rewarded: 'qwouvdrkuwivay5q',
|
rewarded: 'qwouvdrkuwivay5q',
|
||||||
interstitial: 'wmgt0712uuux8ju4',
|
interstitial: 'wmgt0712uuux8ju4',
|
||||||
|
banner: 'iep3rxsyp9na3rw8',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
2
dist/plugin.js.map
vendored
2
dist/plugin.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -1,7 +1,8 @@
|
||||||
# capacitor-levelplay 0.3.0 · API design
|
# capacitor-levelplay 0.3.0 · API design
|
||||||
|
|
||||||
Status: phase 1 (API design). `src/definitions.ts` and `src/web.ts` carry the new API; Android and iOS bridges are
|
Status: phase 2. `src/definitions.ts` and `src/web.ts` carry the new API; the Android bridge implements all of it
|
||||||
not implemented yet. Until they are, calling a new method on a device rejects with Capacitor's `UNIMPLEMENTED`.
|
(phase 2). The iOS bridge is not implemented yet (phase 3); until it is, calling a new method on iOS rejects with
|
||||||
|
Capacitor's `UNIMPLEMENTED`. The owner's answers to the open questions are recorded in §14.
|
||||||
|
|
||||||
Scope (owner approved): banners, native ads (template overlay), impression-level revenue, `adInfoChanged`, placement
|
Scope (owner approved): banners, native ads (template overlay), impression-level revenue, `adInfoChanged`, placement
|
||||||
capping and reward lookup, segments, dynamic user id, full backwards compatibility with 0.2.x, and a Capacitor 7
|
capping and reward lookup, segments, dynamic user id, full backwards compatibility with 0.2.x, and a Capacitor 7
|
||||||
|
|
@ -53,8 +54,8 @@ change.
|
||||||
### 3.1 TS API
|
### 3.1 TS API
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
createBanner({ adUnitId, bannerId?, size?: 'BANNER'|'LARGE'|'MEDIUM_RECTANGLE'|'LEADERBOARD'|'ADAPTIVE',
|
createBanner({ adUnitId, bannerId?, size?: 'BANNER'|'LARGE'|'MEDIUM_RECTANGLE'|'LEADERBOARD'|'ADAPTIVE'|'CUSTOM',
|
||||||
adaptiveWidth?, placementName?, bidFloor?, position?: 'top'|'bottom'|'center',
|
customSize?: { width, height }, adaptiveWidth?, placementName?, bidFloor?, position?: 'top'|'bottom'|'center',
|
||||||
offsetX?, offsetY?, respectSafeArea? }): Promise<BannerResult>
|
offsetX?, offsetY?, respectSafeArea? }): Promise<BannerResult>
|
||||||
loadBanner({ bannerId }): Promise<void>
|
loadBanner({ bannerId }): Promise<void>
|
||||||
showBanner({ bannerId }): Promise<BannerResult>
|
showBanner({ bannerId }): Promise<BannerResult>
|
||||||
|
|
@ -64,7 +65,7 @@ destroyBanner({ bannerId }): Promise<void>
|
||||||
// BannerResult = { bannerId, adSize: { width, height, description?, isAdaptive? }, frame: Rect, visible }
|
// BannerResult = { bannerId, adSize: { width, height, description?, isAdaptive? }, frame: Rect, visible }
|
||||||
```
|
```
|
||||||
|
|
||||||
Defaults: `bannerId = adUnitId`, `size = 'ADAPTIVE'`, `position = 'bottom'`, offsets 0, `respectSafeArea = true`.
|
Defaults: `bannerId = adUnitId`, `size = 'ADAPTIVE'` (`'CUSTOM'` when only `customSize` is given), `position = 'bottom'`, offsets 0, `respectSafeArea = true`.
|
||||||
Several banners can exist at once, keyed by `bannerId` (one ad unit may back several banners).
|
Several banners can exist at once, keyed by `bannerId` (one ad unit may back several banners).
|
||||||
|
|
||||||
Typical flow: `createBanner` → `loadBanner` → `showBanner` (immediately, or on `bannerLoaded`) → `hideBanner` during
|
Typical flow: `createBanner` → `loadBanner` → `showBanner` (immediately, or on `bannerLoaded`) → `hideBanner` during
|
||||||
|
|
@ -81,6 +82,7 @@ gameplay → `showBanner` → `destroyBanner` when leaving the screen.
|
||||||
| `MEDIUM_RECTANGLE` | `LevelPlayAdSize.MEDIUM_RECTANGLE` | `LPMAdSize.mediumRectangleSize()` |
|
| `MEDIUM_RECTANGLE` | `LevelPlayAdSize.MEDIUM_RECTANGLE` | `LPMAdSize.mediumRectangleSize()` |
|
||||||
| `LEADERBOARD` | `LevelPlayAdSize.LEADERBOARD` | `LPMAdSize.leaderBoardSize()` |
|
| `LEADERBOARD` | `LevelPlayAdSize.LEADERBOARD` | `LPMAdSize.leaderBoardSize()` |
|
||||||
| `ADAPTIVE` | `LevelPlayAdSize.createAdaptiveAdSize(Context, Integer width)` | `LPMAdSize.createAdaptiveAdSize(withWidth: CGFloat)` (nullable: `nil` before init) |
|
| `ADAPTIVE` | `LevelPlayAdSize.createAdaptiveAdSize(Context, Integer width)` | `LPMAdSize.createAdaptiveAdSize(withWidth: CGFloat)` (nullable: `nil` before init) |
|
||||||
|
| `CUSTOM` (Q5) | `LevelPlayAdSize.createCustomSize(int width, int height)` (dp) | `LPMAdSize.customSizeWithWidth:height:` |
|
||||||
| size readout | `getWidth()`, `getHeight()`, `getDescription()`, `isAdaptive()` | `width`, `height`, `sizeDescription`, `isAdaptive` |
|
| size readout | `getWidth()`, `getHeight()`, `getDescription()`, `isAdaptive()` | `width`, `height`, `sizeDescription`, `isAdaptive` |
|
||||||
| listener | `setBannerListener(LevelPlayBannerAdViewListener)` | `setDelegate(LPMBannerAdViewDelegate)` |
|
| listener | `setBannerListener(LevelPlayBannerAdViewListener)` | `setDelegate(LPMBannerAdViewDelegate)` |
|
||||||
| impression data | `setImpressionDataListener(LevelPlayImpressionDataListener)` | `setImpressionDataDelegate:` |
|
| impression data | `setImpressionDataListener(LevelPlayImpressionDataListener)` | `setImpressionDataDelegate:` |
|
||||||
|
|
@ -93,8 +95,10 @@ refresh interval is set on the dashboard, and that a resumed banner completes th
|
||||||
`IronSourceError.ERROR_BN_RELOAD_SKIP_INVISIBLE` shows the SDK itself skips refreshes of invisible banners; pausing
|
`IronSourceError.ERROR_BN_RELOAD_SKIP_INVISIBLE` shows the SDK itself skips refreshes of invisible banners; pausing
|
||||||
explicitly makes that deterministic on both platforms.
|
explicitly makes that deterministic on both platforms.
|
||||||
|
|
||||||
Adaptive width units: the plugin passes CSS px. On Android 1 CSS px = 1 dp in a Capacitor WebView at default zoom;
|
Adaptive width units: the plugin passes CSS px. On Android 1 CSS px = 1 dp in a Capacitor WebView at default zoom,
|
||||||
the `Integer` width is treated as dp (to be confirmed in the phase-2 test; see §14 Q3). On iOS 1 CSS px = 1 pt.
|
and the `Integer` width **is dp** (§14 Q3): in the bytecode, `createAdaptiveAdSize` (`com.ironsource.g1.a`) compares
|
||||||
|
the width with the preset widths (320 / 728) and, for a `null` or negative width, falls back to
|
||||||
|
`DisplayMetrics.widthPixels / density` rounded (`com.ironsource.e5`), i.e. the screen width in dp. On iOS 1 CSS px = 1 pt.
|
||||||
Both factories need a finished init (iOS returns `nil` before init, documented in LPMAdSize.h), so `createBanner`
|
Both factories need a finished init (iOS returns `nil` before init, documented in LPMAdSize.h), so `createBanner`
|
||||||
rejects `NOT_INITIALIZED` before `initialize()` resolved. Unity's docs also say to create banners only after init
|
rejects `NOT_INITIALIZED` before `initialize()` resolved. Unity's docs also say to create banners only after init
|
||||||
succeeded.
|
succeeded.
|
||||||
|
|
@ -167,8 +171,12 @@ destroyNativeAd({ nativeAdId }): Promise<void>
|
||||||
```
|
```
|
||||||
|
|
||||||
`style`: `backgroundColor`, `titleColor`, `bodyColor`, `callToActionBackgroundColor`, `callToActionTextColor`
|
`style`: `backgroundColor`, `titleColor`, `bodyColor`, `callToActionBackgroundColor`, `callToActionTextColor`
|
||||||
(`#RRGGBB[AA]`), `cornerRadius` (CSS px). Text uses the system font; the CTA is a native button so the SDK can
|
(`#RRGGBB[AA]`), `cornerRadius` (CSS px), and (Q6) `titleFont`, `bodyFont`, `callToActionFont` as
|
||||||
register it.
|
`{ family?, size? }`: a system family name or a `.ttf` / `.otf` path inside the web assets (Android
|
||||||
|
`Typeface.createFromAsset(assets, "public/" + path)`, iOS `CTFontManagerRegisterFontsForURL` on the file in the
|
||||||
|
app's `public` folder), size in CSS px (dp / pt, not scaled by the system font size). Defaults are the system font.
|
||||||
|
The CTA is a native button so the SDK can register it. Android builds the templates in code (no XML resources), so
|
||||||
|
every style value applies without inflating.
|
||||||
|
|
||||||
Flow: `loadNativeAd` → `nativeAdLoaded` → measure a placeholder element (`getBoundingClientRect()`) →
|
Flow: `loadNativeAd` → `nativeAdLoaded` → measure a placeholder element (`getBoundingClientRect()`) →
|
||||||
`showNativeAd({ rect })` → on layout change `setNativeAdRect` → `destroyNativeAd`, or `loadNativeAd` again for a new
|
`showNativeAd({ rect })` → on layout change `setNativeAdRect` → `destroyNativeAd`, or `loadNativeAd` again for a new
|
||||||
|
|
@ -220,14 +228,16 @@ sends it anyway it shows up in `allData`.
|
||||||
- `addImpressionLevelRevenueListener(listener, subscriberId)` is for approved third-party SDKs only (needs a
|
- `addImpressionLevelRevenueListener(listener, subscriberId)` is for approved third-party SDKs only (needs a
|
||||||
subscriber id from Unity), not for apps.
|
subscriber id from Unity), not for apps.
|
||||||
|
|
||||||
Design (recommended, see Q1): the plugin attaches its own impression listener to **every** rewarded, interstitial
|
Design (decided, Q1): the plugin attaches its own impression listener to **every** rewarded, interstitial
|
||||||
and banner object it creates (the holders already exist per ad unit). The JS side can add the listener at any time,
|
and banner object it creates (the holders already exist per ad unit). The JS side can add the listener at any time,
|
||||||
including before `initialize()`, because events go through `notifyListeners`; nothing can be emitted before the
|
including before `initialize()`. Native ads have no per-ad listener, so on `onAdImpression` / `didRecordImpression:` the plugin
|
||||||
first ad object exists. Native ads have no per-ad listener, so on `onAdImpression` / `didRecordImpression:` the plugin
|
|
||||||
emits an `impressionData` built from the native `AdInfo` (`adFormat: 'nativead'`, no ad unit / placement /
|
emits an `impressionData` built from the native `AdInfo` (`adFormat: 'nativead'`, no ad unit / placement /
|
||||||
creative fields). This avoids deprecated APIs and still covers every format.
|
creative fields). This avoids deprecated APIs and still covers every format.
|
||||||
|
|
||||||
Events are sent with `retainUntilConsumed = false` (as today). Q2 asks whether to retain.
|
Queue (decided, Q2): while no JS `impressionData` listener exists, impressions are kept in a plugin-owned FIFO
|
||||||
|
queue capped at 100 (the oldest is dropped beyond that) and flushed, in order, when the first `impressionData`
|
||||||
|
listener is added (Android overrides `Plugin.addListener`; Capacitor's own `retainUntilConsumed` is not used because
|
||||||
|
its queue is unbounded). With a listener present they are sent directly.
|
||||||
|
|
||||||
## 6. Overlay positioning (banners and native ads)
|
## 6. Overlay positioning (banners and native ads)
|
||||||
|
|
||||||
|
|
@ -277,8 +287,11 @@ y = top: safe.y + offsetY
|
||||||
```
|
```
|
||||||
|
|
||||||
Recomputed on every host layout pass (rotation, split screen, multi-window, keyboard resizing the WebView, foldables).
|
Recomputed on every host layout pass (rotation, split screen, multi-window, keyboard resizing the WebView, foldables).
|
||||||
Adaptive banners keep the size they were created with; after a rotation the app may destroy and recreate them with a
|
Adaptive banners (decided, Q4): when the banner was created without `adaptiveWidth` and the safe-area width changes
|
||||||
new width (Q4).
|
(rotation, split screen, window resize), the plugin destroys the banner view and creates a new one with
|
||||||
|
`createAdaptiveAdSize(newWidth)` after the layout settled (debounced 250 ms), keeping `bannerId`, layout, visibility
|
||||||
|
and placement, and calls `loadAd()` again if the old view had been loaded. The new creative arrives as a normal
|
||||||
|
`bannerLoaded` with the new `frame`. A fixed `adaptiveWidth` and the presets are never recreated.
|
||||||
|
|
||||||
### 6.5 WebView scroll and z-order
|
### 6.5 WebView scroll and z-order
|
||||||
|
|
||||||
|
|
@ -428,19 +441,23 @@ iOS 15 / 18 / 26, phone and tablet, portrait and landscape:
|
||||||
10. Capacitor 7: a fresh Cap 7 app (SPM and CocoaPods; Android with `adjustMarginsForEdgeToEdge: 'auto'`) after the
|
10. Capacitor 7: a fresh Cap 7 app (SPM and CocoaPods; Android with `adjustMarginsForEdgeToEdge: 'auto'`) after the
|
||||||
§12 changes.
|
§12 changes.
|
||||||
|
|
||||||
## 14. Open questions for the owner
|
## 14. Owner decisions (were open questions)
|
||||||
|
|
||||||
- **Q1 Impression data source.** Recommended: per-ad listeners (non-deprecated) + native impressions synthesised from
|
- **Q1 Impression data source. Decided:** per-ad listeners (`setImpressionDataListener` /
|
||||||
native `AdInfo`. Alternative: the deprecated global `LevelPlay.addImpressionDataListener` /
|
`setImpressionDataDelegate:` on every rewarded, interstitial and banner object the plugin creates) plus native ad
|
||||||
`addImpressionDataDelegate:` (one registration, true SDK impression data for native too, but deprecated and may
|
impressions synthesised from the native `AdInfo` (`adFormat: 'nativead'`). The deprecated global listener is not
|
||||||
vanish in 9.x/10). Both at once would duplicate events.
|
used.
|
||||||
- **Q2 Retain impressions?** Send `impressionData` with `retainUntilConsumed = true` so impressions fired before a
|
- **Q2 Retain impressions. Decided:** yes, with a plugin-owned queue capped at 100 impressions (oldest dropped),
|
||||||
listener exists are queued? Risk: unbounded queue if the app never listens. Default proposed: no.
|
flushed in order on the first `addListener('impressionData')`. See §5.2.
|
||||||
- **Q3 Android adaptive width unit.** `LevelPlayAdSize.createAdaptiveAdSize(Context, Integer)` does not document the
|
- **Q3 Android adaptive width unit. Decided / verified:** dp, from the SDK bytecode (§3.2); checked on the emulator in phase 2.
|
||||||
unit; plan treats it as dp and verifies on device.
|
CSS px are passed through unchanged.
|
||||||
- **Q4 Adaptive banners and rotation.** Auto-recreate adaptive banners on width change (simpler for apps, costs a
|
- **Q4 Adaptive banners and rotation. Decided:** automatic. Adaptive banners without a fixed `adaptiveWidth` are
|
||||||
reload) or leave it to the app (proposed)?
|
recreated and reloaded on a safe-area width change, keeping position, offsets, visibility and id. See §6.4.
|
||||||
- **Q5 Custom banner sizes.** Both SDKs have custom sizes (`LevelPlayAdSize.createCustomSize`,
|
- **Q5 Custom banner sizes. Decided:** supported in addition to the presets: `size: 'CUSTOM'` with
|
||||||
`LPMAdSize.customSizeWithWidth:height:`); left out of 0.3.0 because few networks fill them. Add?
|
`customSize: { width, height }` (CSS px).
|
||||||
- **Q6 Native template styling depth.** Colours + corner radius only (proposed), or fonts / sizes too?
|
- **Q6 Native template styling. Decided:** colours (background, title, body, CTA background and text), corner radius,
|
||||||
- **Q7 Capacitor 7.** Ship the §12 changes in 0.3.0 or a later 0.3.x after a Cap 7 app test?
|
and font family + size for title, body and CTA (`titleFont`, `bodyFont`, `callToActionFont`). See §4.2.
|
||||||
|
- **Q7 Capacitor 7. Decided:** targeted for 0.3.0. Phase 7 verifies a Cap 7 app and applies the §12 package changes;
|
||||||
|
until then the native code only uses APIs present in both Capacitor 7 and 8 (Android: `Plugin.addListener`,
|
||||||
|
`notifyListeners`, `hasListeners`, `handleOnDestroy`, `handleOnConfigurationChanged`, `bridge.getWebView()`, all
|
||||||
|
identical in 7.6.9 and 8.5.3).
|
||||||
|
|
|
||||||
|
|
@ -567,10 +567,32 @@ export interface Rect {
|
||||||
* - `ADAPTIVE`: `LevelPlayAdSize.createAdaptiveAdSize(context, width)` / `LPMAdSize.createAdaptiveAdSize(withWidth:)`;
|
* - `ADAPTIVE`: `LevelPlayAdSize.createAdaptiveAdSize(context, width)` / `LPMAdSize.createAdaptiveAdSize(withWidth:)`;
|
||||||
* the SDK picks the height (and BANNER or LEADERBOARD as fallback) for the given width. Requires a finished
|
* the SDK picks the height (and BANNER or LEADERBOARD as fallback) for the given width. Requires a finished
|
||||||
* `initialize()`.
|
* `initialize()`.
|
||||||
|
* - `CUSTOM`: `LevelPlayAdSize.createCustomSize(width, height)` / `LPMAdSize.customSizeWithWidth:height:` with
|
||||||
|
* `customSize`. Few networks fill custom sizes; prefer a preset or `ADAPTIVE`.
|
||||||
*
|
*
|
||||||
* @since 0.3.0
|
* @since 0.3.0
|
||||||
*/
|
*/
|
||||||
export type BannerSize = 'BANNER' | 'LARGE' | 'MEDIUM_RECTANGLE' | 'LEADERBOARD' | 'ADAPTIVE';
|
export type BannerSize = 'BANNER' | 'LARGE' | 'MEDIUM_RECTANGLE' | 'LEADERBOARD' | 'ADAPTIVE' | 'CUSTOM';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Width and height of a `CUSTOM` banner, in CSS px (dp on Android, points on iOS).
|
||||||
|
*
|
||||||
|
* @since 0.3.0
|
||||||
|
*/
|
||||||
|
export interface BannerCustomSize {
|
||||||
|
/**
|
||||||
|
* Width in CSS px (positive integer).
|
||||||
|
*
|
||||||
|
* @since 0.3.0
|
||||||
|
*/
|
||||||
|
width: number;
|
||||||
|
/**
|
||||||
|
* Height in CSS px (positive integer).
|
||||||
|
*
|
||||||
|
* @since 0.3.0
|
||||||
|
*/
|
||||||
|
height: number;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vertical anchor of a banner inside the WebView's safe area. Banners are always horizontally centred; use
|
* Vertical anchor of a banner inside the WebView's safe area. Banners are always horizontally centred; use
|
||||||
|
|
@ -651,9 +673,16 @@ export interface CreateBannerOptions extends AdUnitOptions, BannerLayoutOptions
|
||||||
* @since 0.3.0
|
* @since 0.3.0
|
||||||
*/
|
*/
|
||||||
size?: BannerSize;
|
size?: BannerSize;
|
||||||
|
/**
|
||||||
|
* `CUSTOM` only: the banner size. When `customSize` is set and `size` is omitted, `size` defaults to `CUSTOM`.
|
||||||
|
*
|
||||||
|
* @since 0.3.0
|
||||||
|
*/
|
||||||
|
customSize?: BannerCustomSize;
|
||||||
/**
|
/**
|
||||||
* `ADAPTIVE` only: width in CSS px to compute the adaptive size for. Defaults to the width of the WebView's safe
|
* `ADAPTIVE` only: width in CSS px to compute the adaptive size for. Defaults to the width of the WebView's safe
|
||||||
* area.
|
* area; in that case the plugin recreates and reloads the banner automatically when that width changes (rotation,
|
||||||
|
* split screen, window resize), keeping its id, layout and visibility. A fixed `adaptiveWidth` is never recreated.
|
||||||
*
|
*
|
||||||
* @since 0.3.0
|
* @since 0.3.0
|
||||||
*/
|
*/
|
||||||
|
|
@ -815,6 +844,47 @@ export interface NativeAdTemplateStyle {
|
||||||
* @since 0.3.0
|
* @since 0.3.0
|
||||||
*/
|
*/
|
||||||
cornerRadius?: number;
|
cornerRadius?: number;
|
||||||
|
/**
|
||||||
|
* Title font.
|
||||||
|
*
|
||||||
|
* @since 0.3.0
|
||||||
|
*/
|
||||||
|
titleFont?: NativeAdFont;
|
||||||
|
/**
|
||||||
|
* Body and advertiser font.
|
||||||
|
*
|
||||||
|
* @since 0.3.0
|
||||||
|
*/
|
||||||
|
bodyFont?: NativeAdFont;
|
||||||
|
/**
|
||||||
|
* Call-to-action button font.
|
||||||
|
*
|
||||||
|
* @since 0.3.0
|
||||||
|
*/
|
||||||
|
callToActionFont?: NativeAdFont;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A font of a native ad template text. Omitted fields keep the template default (system font).
|
||||||
|
*
|
||||||
|
* @since 0.3.0
|
||||||
|
*/
|
||||||
|
export interface NativeAdFont {
|
||||||
|
/**
|
||||||
|
* Font family. Either a system family name (Android: `sans-serif`, `sans-serif-medium`, `serif`, `monospace` ...;
|
||||||
|
* iOS: a `UIFont` family or PostScript name such as `Avenir Next` or `Menlo-Bold`), or the path of a `.ttf` / `.otf`
|
||||||
|
* file inside the app's web assets, relative to the web root (for example `fonts/Inter-Bold.ttf`, the same file the
|
||||||
|
* page loads with `@font-face`). Unknown families fall back to the system font.
|
||||||
|
*
|
||||||
|
* @since 0.3.0
|
||||||
|
*/
|
||||||
|
family?: string;
|
||||||
|
/**
|
||||||
|
* Font size in CSS px (dp / pt; not scaled by the system font size setting, like text in the WebView).
|
||||||
|
*
|
||||||
|
* @since 0.3.0
|
||||||
|
*/
|
||||||
|
size?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
* Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps
|
* Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps
|
||||||
* (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and
|
* (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and
|
||||||
* `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.
|
* `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.
|
||||||
|
* The sample apps have no native ad placement; native ads load with the default placement of the app key.
|
||||||
* Replace them with your own ids from the LevelPlay dashboard before release.
|
* Replace them with your own ids from the LevelPlay dashboard before release.
|
||||||
*/
|
*/
|
||||||
export const LEVELPLAY_DEMO = {
|
export const LEVELPLAY_DEMO = {
|
||||||
|
|
@ -9,10 +10,12 @@ export const LEVELPLAY_DEMO = {
|
||||||
appKey: '25b63cf85',
|
appKey: '25b63cf85',
|
||||||
rewarded: 'syz3d8ekts22q0or',
|
rewarded: 'syz3d8ekts22q0or',
|
||||||
interstitial: 'h3xw38h9214adgxo',
|
interstitial: 'h3xw38h9214adgxo',
|
||||||
|
banner: '4fpetq4lhe5lsw3e',
|
||||||
},
|
},
|
||||||
ios: {
|
ios: {
|
||||||
appKey: '8545d445',
|
appKey: '8545d445',
|
||||||
rewarded: 'qwouvdrkuwivay5q',
|
rewarded: 'qwouvdrkuwivay5q',
|
||||||
interstitial: 'wmgt0712uuux8ju4',
|
interstitial: 'wmgt0712uuux8ju4',
|
||||||
|
banner: 'iep3rxsyp9na3rw8',
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue