Skip to content

Commit

Permalink
* 支持iOS ATT权限获取、开屏广告、插屏广告 、横幅广告、模板广告、模板视频信息流 、全屏视频、 信息流广告、激励视频广告
Browse files Browse the repository at this point in the history
* 调整信息流 QuakerBirdAdFeed -> QuakerBirdAdNative
  • Loading branch information
gstory0404 committed Feb 12, 2023
1 parent de63365 commit 12d99b4
Show file tree
Hide file tree
Showing 521 changed files with 5,726 additions and 200 deletions.
14 changes: 7 additions & 7 deletions .metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file should be version controlled.

version:
revision: b06b8b2710955028a6b562f5aa6fe62941d6febf
revision: 7048ed95a5ad3e43d697e0c397464193991fc230
channel: stable

project_type: plugin
Expand All @@ -13,14 +13,14 @@ project_type: plugin
migration:
platforms:
- platform: root
create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf
base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf
create_revision: 7048ed95a5ad3e43d697e0c397464193991fc230
base_revision: 7048ed95a5ad3e43d697e0c397464193991fc230
- platform: android
create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf
base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf
create_revision: 7048ed95a5ad3e43d697e0c397464193991fc230
base_revision: 7048ed95a5ad3e43d697e0c397464193991fc230
- platform: ios
create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf
base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf
create_revision: 7048ed95a5ad3e43d697e0c397464193991fc230
base_revision: 7048ed95a5ad3e43d697e0c397464193991fc230

# User provided section

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.0.5

* 支持iOS ATT权限获取、开屏广告、插屏广告 、横幅广告、模板广告、模板视频信息流 、全屏视频、 信息流广告、激励视频广告
* 调整信息流 QuakerBirdAdFeed -> QuakerBirdAdNative

## 0.0.4

* fix bug
Expand Down
135 changes: 72 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

## 官方文档
* [Android](https://github.com/gstory0404/quakerbirdad/blob/master/doc/android.pdf)
* [IOS]()
* [IOS](https://github.com/gstory0404/quakerbirdad/blob/master/doc/ios.pages)

## 版本更新

Expand All @@ -34,7 +34,7 @@
### 1、pubspec.yaml

```Dart
quakerbirdad: ^0.0.4
quakerbirdad: ^0.0.5
```

引入
Expand All @@ -46,7 +46,7 @@ import 'package:quakerbirdad/quakerbirdad.dart';
根据[官方文件](https://github.com/gstory0404/quakerbirdad/blob/master/doc/android.pdf)进行权限等配置。

### 3、IOS
暂不支持
根据[官方文件](https://github.com/gstory0404/quakerbirdad/blob/master/doc/ios.pages)进行权限等配置。

### 注意事项

Expand Down Expand Up @@ -74,10 +74,18 @@ QuakerBirdAd.register(
```

### 获取SDK版本
```Dart
```dart
await QuakerBirdAd.getSDKVersion();
```

### 获取权限
目前仅iOS生效,用于ATT权限获取
```dart
QuakerBirdAd.requestPermission().then((value) => {
print("获取权限结果 $value")
});
```

### 开屏广告
```dart
QuakerBirdAdSplash(
Expand Down Expand Up @@ -105,37 +113,6 @@ QuakerBirdAdSplash(
);
```

### 插屏广告
请求广告
```dart
QuakerBirdAd.loadInteractionAd(androidId: "11087", iosId: "11087");
```
监听结果
```dart
FlutterUnionadStream.initAdStream(
rewardCallBack: QuakerBirdAdRewardCallBack(
onShow: () {
print("激励广告显示");
},
onError: (msg) {
print("激励广告失败 $msg");
},
onClick: () {
print("激励广告点击");
},
onDismiss: () {
print("激励广告关闭");
},
onStatus: (type, platform, status, msg) {
print("激励广告状态 类型:$type 平台:$platform 状态:$status 错误消息 (失败时有效):$msg");
},
onReward: (type) {
print("激励广告奖励 $type");
},
),
);
```

### 横幅广告
```dart
QuakerBirdAdBanner(
Expand Down Expand Up @@ -164,6 +141,34 @@ QuakerBirdAdBanner(
);
```

### 信息流广告
```dart
QuakerBirdAdNative(
androidId: "2351",
iosId: "2351",
width: 500,
height: 200,
callBack: QuakerBirdAdNativeCallBack(
onShow: (){
print("信息流广告显示");
},
onError: (msg){
print("信息流广告失败 $msg");
},
onClick: (){
print("信息流广告点击");
},
onDismiss: (){
print("信息流广告关闭");
Navigator.pop(context);
},
onStatus: (type,platform,status,msg){
print("信息流广告状态 类型:$type 平台:$platform 状态:$status 错误消息 (失败时有效):$msg");
}
),
),
```

### 模版广告
```dart
QuakerBirdAdExpress(
Expand Down Expand Up @@ -220,6 +225,38 @@ QuakerBirdAdExpressDraw(
),
```

### 插屏广告
请求广告
```dart
QuakerBirdAd.loadInteractionAd(androidId: "11087", iosId: "11087");
```
监听结果
```dart
FlutterUnionadStream.initAdStream(
rewardCallBack: QuakerBirdAdRewardCallBack(
onShow: () {
print("激励广告显示");
},
onError: (msg) {
print("激励广告失败 $msg");
},
onClick: () {
print("激励广告点击");
},
onDismiss: () {
print("激励广告关闭");
},
onStatus: (type, platform, status, msg) {
print("激励广告状态 类型:$type 平台:$platform 状态:$status 错误消息 (失败时有效):$msg");
},
onReward: (type) {
print("激励广告奖励 $type");
},
),
);
```


### 全屏广告
请求广告
```dart
Expand Down Expand Up @@ -248,34 +285,6 @@ FlutterUnionadStream.initAdStream(
);
```

### 信息流广告
```dart
QuakerBirdAdFeed(
androidId: "2351",
iosId: "2351",
width: 500,
height: 200,
callBack: QuakerBirdAdFeedCallBack(
onShow: (){
print("信息流广告显示");
},
onError: (msg){
print("信息流广告失败 $msg");
},
onClick: (){
print("信息流广告点击");
},
onDismiss: (){
print("信息流广告关闭");
Navigator.pop(context);
},
onStatus: (type,platform,status,msg){
print("信息流广告状态 类型:$type 平台:$platform 状态:$status 错误消息 (失败时有效):$msg");
}
),
),
```

### 激励广告
请求广告
```dart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class QuakerBirdAdConfig {
const val BannerAdView = "com.gstory.quakerbirdad/BannerAdView"

//信息流广告
const val FeedAdView = "com.gstory.quakerbirdad/FeedAdView"
const val NativeAdView = "com.gstory.quakerbirdad/NativeAdView"

//模版信息流广告
const val ExpressAdView = "com.gstory.quakerbirdad/ExpressAdView"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.app.Activity
import com.gstory.quakerbirdad.bannerad.BannerAdViewFactory
import com.gstory.quakerbirdad.expressad.ExpressAdViewFactory
import com.gstory.quakerbirdad.expressad.ExpressDrawAdViewFactory
import com.gstory.quakerbirdad.feedad.FeedAdViewFactory
import com.gstory.quakerbirdad.nativead.NativeAdViewFactory
import com.gstory.quakerbirdad.splashad.SplashAdViewFactory
import io.flutter.embedding.engine.plugins.FlutterPlugin

Expand All @@ -21,7 +21,7 @@ object QuakerBirdViewPlugin {
//注册banner广告
binding.platformViewRegistry.registerViewFactory(QuakerBirdAdConfig.BannerAdView, BannerAdViewFactory(binding.binaryMessenger, activity))
//注册信息流广告
binding.platformViewRegistry.registerViewFactory(QuakerBirdAdConfig.FeedAdView, FeedAdViewFactory(binding.binaryMessenger, activity))
binding.platformViewRegistry.registerViewFactory(QuakerBirdAdConfig.NativeAdView, NativeAdViewFactory(binding.binaryMessenger, activity))
//注册模板信息流广告
binding.platformViewRegistry.registerViewFactory(QuakerBirdAdConfig.ExpressAdView, ExpressAdViewFactory(binding.binaryMessenger, activity))
//注册模板信息流视频广告
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gstory.quakerbirdad.feedad
package com.gstory.quakerbirdad.nativead

import android.app.Activity
import android.content.Context
Expand All @@ -22,7 +22,7 @@ import io.flutter.plugin.platform.PlatformView
* @CreateDate: 2023/2/5 14:11
* @Description: java类作用描述
*/
internal class FeedAdView(
internal class NativeAdView(
var context: Context,
var activity: Activity,
messenger: BinaryMessenger,
Expand All @@ -41,7 +41,7 @@ internal class FeedAdView(
init {
mCodeId = params["androidId"] as String?
mContainer = FrameLayout(activity)
channel = MethodChannel(messenger, QuakerBirdAdConfig.FeedAdView + "_" + id)
channel = MethodChannel(messenger, QuakerBirdAdConfig.NativeAdView + "_" + id)
loadFeedAd()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gstory.quakerbirdad.feedad
package com.gstory.quakerbirdad.nativead

import android.app.Activity
import android.content.Context
Expand All @@ -13,9 +13,9 @@ import io.flutter.plugin.platform.PlatformViewFactory
* @Description: java类作用描述
*/

class FeedAdViewFactory(private val messenger: BinaryMessenger, private val activity: Activity) : PlatformViewFactory(StandardMessageCodec.INSTANCE) {
class NativeAdViewFactory(private val messenger: BinaryMessenger, private val activity: Activity) : PlatformViewFactory(StandardMessageCodec.INSTANCE) {
override fun create(context: Context?, id: Int, args: Any?): PlatformView {
val params = args as Map<String?, Any?>
return FeedAdView(context!!, activity, messenger, id, params)
return NativeAdView(context!!, activity, messenger, id, params)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ object RewardVideoAd {
Log.d(TAG, "激励视频关闭回调")
QuakerBirdAdEvent.sendContent(mutableMapOf(
"adType" to "rewardAd",
"onAdMethod" to "onClose",
"onAdMethod" to "onDismiss",
))
}

Expand Down
Binary file added doc/ios.pages
Binary file not shown.
1 change: 0 additions & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

Expand Down
Loading

0 comments on commit 12d99b4

Please sign in to comment.