Skip to content

Commit 94a2465

Browse files
committed
Release 4.3.0
1 parent cb19b50 commit 94a2465

File tree

170 files changed

+6596
-8328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+6596
-8328
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,11 @@ app.*.map.json
4444
/android/app/profile
4545
/android/app/release
4646

47+
GeneratedPluginRegistrant.h
48+
GeneratedPluginRegistrant.m
49+
GeneratedPluginRegistrant.java
50+
GeneratedPluginRegistrant.swift
51+
generated_plugin_registrant.dart
52+
4753
# iOS
4854
Podfile.lock

CHANGELOG.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
## 4.3.0
2+
### Major changes
3+
- Version bumped to 4.3 to align with native SDK versions.
4+
- Completely rewritten Android and iOS platform code for improved performance, stability, and better integration with native SDKs.
5+
- Introduced new `CASMobileAds` class. Deprecated `CAS` and `MediationManager` classes are still available for use but they may be removed in a future release.
6+
- The CAS SDK initialization is now done via a single function `CASMobileAds.initialize(...)` that uses a `Future` to return the new `InitializationStatus` structure.
7+
- The Ad format management has been modernized and streamlined. All ad classes now extend the base AdInstance class and share similar callbacks.
8+
- Introduced `createAndLoad(...)` method for each ad format, accepting all possible configuration options and automatically initiating ad loading. This improvement simplifies and optimizes the creation of ad instances.
9+
- Introduced support for Native Ads using built-in templates or native platform view factories.
10+
- The Banner ad management is now handled via the `CASBanner` class, which can be `createAndLoad()` independently of the widget state and displayed using the new `CASWidget`. Platform view rendering has been optimized by simplifying the widget class.
11+
- The CAS ID only needs to be passed once during initialization if you are using a single ID.
12+
- The `AdContentInfo` structure now provides ad information synchronously, without requiring `await` of `Future`.
13+
- Added the `debugGeography` to override `PrivacyGeography` for `ConsentFlow` to test different consent dialogs.
14+
- The `ConsentFlow.show()` functions now complete `Future<int>` only after the consent form is dismissed and return the resulting consent flow status.
15+
- For detailed information on all new functions, please refer to the updated wiki.
16+
- Removed several functions that were previously deprecated.
17+
### Migration table
18+
Deprecated functions are still supported but no longer recommended.
19+
| Deprecated | Replacement |
20+
| ----------- | ----------- |
21+
| `CAS.buildManager()...` | `CASMobileAds.initialize(...)` |
22+
| `CAS.targetingOptions...` | `CASMobileAds.targetingOptions...` |
23+
| `CAS.settings.setMutedAdSounds()` | `CASMobileAds.setAdSoundsMuted()` |
24+
| `CAS.settings.setDebugMode()` | `CASMobileAds.setDebugLoggingEnabled()` |
25+
| `CAS.settings.setTrialAdFreeInterval()` | `CASMobileAds.setTrialAdFreeInterval()` |
26+
| `CAS.settings.setTaggedAudience()` | `CASMobileAds.initialize(targetAudience:)` |
27+
| `CAS.settings.setTestDeviceId()` | `CASMobileAds.initialize(testDeviceIds:)` |
28+
| `CASInterstitial.create()` | `CASInterstitial.createAndLoad(...)` |
29+
| `CASInterstitial.impressionListener` | `CASInterstitial.onAdImpression` |
30+
| `CASInterstitial.contentCallback` | `CASInterstitial.onAdLoaded` and others |
31+
| `CASAppOpen.create()` | `CASAppOpen.createAndLoad(...)` |
32+
| `CASAppOpen.impressionListener` | `CASAppOpen.onAdImpression` |
33+
| `CASAppOpen.contentCallback` | `CASAppOpen.onAdLoaded` and others |
34+
| `CASRewarded.create()` | `CASRewarded.createAndLoad(...)` |
35+
| `CASRewarded.impressionListener` | `CASRewarded.onAdImpression` |
36+
| `CASRewarded.contentCallback` | `CASRewarded.onAdLoaded` and others |
37+
| `OnRewardEarnedListener` | `CASRewarded.onUserEarnedReward` |
38+
| `BannerWidgetState()...` | `CASBanner.createAndLoad(...)` |
39+
| `BannerWidget(...)` | `CASWidget(ad:)` |
40+
| `AdSize.getAdaptiveBannerInScreen()` | `maxWidth = MediaQuery.of(context).size.width`<br>and `AdSize.getAdaptiveBanner(maxWidth)` |
41+
42+
143
## 0.9.0
244
- Updated CAS [Android](https://github.com/cleveradssolutions/CAS-Android/releases) and [iOS](https://github.com/cleveradssolutions/CAS-iOS/releases) dependencies to 4.3.0
345
- Updated `AdError` codes for compatibility with CAS 4.

README.md

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
1-
# CAS.AI Flutter Plugin
2-
The CAS.AI SDK is mobile advertising featuring refined ad formats and streamlined APIs for access to mobile ad networks and advertising solutions. The SDK enables mobile app developers to maximize their monetization in native mobile apps.
3-
4-
This repository contains the source code for the CAS.AI (CleverAdsSolutions) plugin for Flutter. This plugin enables Flutter developers to easily serve ads on Android and iOS apps without having to write Java or Objective-C code. The plugin provides a Dart interface for ad management that is used in your Flutter project.
5-
1+
# CAS.AI Mobile Ads for Flutter
62
[![Pub Version](https://img.shields.io/pub/v/clever_ads_solutions)](https://pub.dev/packages/clever_ads_solutions/versions)
73
[![App-ads.txt](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/cleveradssolutions/App-ads.txt/master/Shield.json)](https://github.com/cleveradssolutions/App-ads.txt)
4+
![Platform](https://img.shields.io/badge/platform-Android%20%7C%20iOS-blue.svg)
5+
6+
The CAS.AI Mobile Ads SDK (by CleverAdsSolutions) offers advanced mobile advertising capabilities with refined ad formats and streamlined APIs to access multiple ad networks and maximize monetization in mobile apps.
7+
8+
This repository contains the official Flutter plugin for CAS.AI, allowing Flutter developers to easily integrate and monetize their apps using the CAS.AI SDK.
89

910
## Documentation
10-
For instructions on using the plugin, please refer to [this developer guide](https://github.com/cleveradssolutions/CAS-Flutter/wiki).
11+
For setup instructions, usage examples, and API details, refer to the [Developer Guide on our Wiki](https://github.com/cleveradssolutions/CAS-Flutter/wiki).
1112

1213
## Downloads
13-
See [pub.dev](https://pub.dev/packages/clever_ads_solutions/versions) for the latest releases of the plugin.
14+
Visit [pub.dev](https://pub.dev/packages/clever_ads_solutions/versions) to get the latest version of the plugin.
1415

1516
## Sample application
16-
For a sample application demonstrating how to use CAS.AI Flutter plugin see `example` directory.
17+
A full sample application demonstrating CAS.AI Flutter integration is available in the [example/](https://github.com/cleveradssolutions/CAS-Flutter/tree/main/example) directory.
18+
19+
## Feedback & Contributions
20+
Found a bug? Have a feature request or suggestion?
21+
Please open an issue using [GitHub’s Issue Tracker](https://github.com/cleveradssolutions/CAS-Flutter/issues).
22+
23+
## Native SDK Repositories
24+
This Flutter plugin is built on top of the official native CAS.AI SDKs:
25+
- [CAS.AI Android SDK (GitHub)](https://github.com/cleveradssolutions/CAS-Android)
26+
Native Android SDK for Java and Kotlin applications.
27+
- [CAS.AI iOS SDK (GitHub)](https://github.com/cleveradssolutions/CAS-iOS)
28+
Native iOS SDK for Swift and Objective-C applications.
1729

18-
## Suggesting improvements
19-
To file bugs, make feature requests, or to suggest other improvements, please use [GitHub's issue tracker](https://github.com/cleveradssolutions/CAS-Flutter/issues).
30+
Refer to these repositories for follow the latest releases, changelogs, or to report platform-specific issues.

analysis_options.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
include: package:flutter_lints/flutter.yaml
22

3-
# Additional information about this file can be found at
4-
# https://dart.dev/guides/language/analysis-options
3+
analyzer:
4+
exclude: [
5+
]
6+
errors:
7+
omit_local_variable_types: ignore
8+
9+
linter:
10+
rules:
11+
- public_member_api_docs

android/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
group = 'com.cleveradssolutions.plugin.flutter'
2-
version = '0.9.0'
2+
version = '4.3.0'
33

44
buildscript {
5-
ext.kotlin_version = '1.8.22'
5+
ext.kotlin_version = '2.0.21'
66
repositories {
77
google()
88
mavenCentral()
@@ -90,6 +90,6 @@ android {
9090
}
9191

9292
dependencies {
93-
api 'com.cleveradssolutions:cas-sdk:4.3.0'
93+
implementation 'com.cleveradssolutions:cas-sdk:4.3.0'
9494
}
95-
}
95+
}

android/src/main/kotlin/com/cleveradssolutions/plugin/flutter/AdContentInfoMethodHandler.kt

Lines changed: 0 additions & 33 deletions
This file was deleted.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
package com.cleveradssolutions.plugin.flutter
2+
3+
import android.app.Activity
4+
import android.util.Size
5+
import com.cleveradssolutions.sdk.AdContentInfo
6+
import com.cleversolutions.ads.AdError
7+
import io.flutter.plugin.common.MethodChannel
8+
9+
/**
10+
* Maintains reference to ad instances for the CASMobileAdsPlugin.
11+
*
12+
* When an Ad is loaded from Dart, an equivalent ad object is created
13+
* and maintained here to provide access until the ad is disposed.
14+
*/
15+
internal class AdInstanceManager(
16+
private val channel: MethodChannel
17+
) {
18+
var activity: Activity? = null
19+
20+
private val ads = HashMap<Int, FlutterAd>()
21+
22+
fun findAd(adId: Int): FlutterAd? = ads[adId]
23+
24+
fun trackAd(ad: FlutterAd) {
25+
require(ads[ad.adId] == null) {
26+
"Ad for following adId already exists: ${ad.adId}"
27+
}
28+
ads[ad.adId] = ad
29+
}
30+
31+
fun disposeAd(adId: Int) {
32+
ads.remove(adId)?.dispose()
33+
}
34+
35+
fun disposeAllAds() {
36+
for ((_, value) in ads) {
37+
value.dispose()
38+
}
39+
ads.clear()
40+
}
41+
42+
fun onAdLoaded(adId: Int, size: Size?) {
43+
val args = HashMap<String, Any>()
44+
args["adId"] = adId
45+
if (size != null)
46+
args["size"] = size
47+
channel.invokeMethod("onAdLoaded", args)
48+
}
49+
50+
fun onAdFailedToLoad(adId: Int, error: AdError) {
51+
val args = HashMap<String, Any>()
52+
args["adId"] = adId
53+
args["error"] = error
54+
channel.invokeMethod("onAdFailedToLoad", args)
55+
}
56+
57+
fun onAdFailedToShow(adId: Int, error: AdError) {
58+
val args = HashMap<String, Any>()
59+
args["adId"] = adId
60+
args["error"] = error
61+
channel.invokeMethod("onAdFailedToShow", args)
62+
}
63+
64+
fun onAdShowed(adId: Int) {
65+
invokeOnAdEvent("onAdShowed", adId)
66+
}
67+
68+
fun onAdClicked(adId: Int) {
69+
invokeOnAdEvent("onAdClicked", adId)
70+
}
71+
72+
fun onAdImpression(adId: Int, contentInfo: AdContentInfo) {
73+
val args = HashMap<String, Any>()
74+
args["adId"] = adId
75+
args["info"] = contentInfo
76+
channel.invokeMethod("onAdImpression", args)
77+
}
78+
79+
fun onAdDismissed(adId: Int) {
80+
invokeOnAdEvent("onAdDismissed", adId)
81+
}
82+
83+
fun onAdUserEarnedReward(adId: Int) {
84+
invokeOnAdEvent("onAdUserEarnedReward", adId)
85+
}
86+
87+
private fun invokeOnAdEvent(name: String, adId: Int) {
88+
val args = HashMap<String, Any>()
89+
args["adId"] = adId
90+
channel.invokeMethod(name, args)
91+
}
92+
93+
}

android/src/main/kotlin/com/cleveradssolutions/plugin/flutter/AdMethodHandler.kt

Lines changed: 0 additions & 27 deletions
This file was deleted.

android/src/main/kotlin/com/cleveradssolutions/plugin/flutter/CASChannel.kt

Lines changed: 0 additions & 43 deletions
This file was deleted.

android/src/main/kotlin/com/cleveradssolutions/plugin/flutter/CASExtensions.kt

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)