diff --git a/CHANGELOG.md b/CHANGELOG.md index b64e407..73923f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,15 @@ +## v3.0.0 +* 🚀🚀🚀 借助 [FlutterGromore Pro版](https://flutterads.github.io/site/) 可以帮你大幅提升广告收益,发挥出最大的用户价值 🏆 +* [🏆 Pro版](https://flutterads.github.io/site/) 额外支持【信息流、激励视频、测试助手、实时收益、】 +* 适配 Flutter 新版本 +* 升级 Android&iOS SDK 版本 + ## v2.1.0 -* 🚀🚀🚀 借助 [flutter_gromore_pro](https://github.com/FlutterAds/flutter_gromore_ads/tree/pro) 可以帮你大幅提升广告收益,发挥出最大的用户价值 🏆 * 升级 iOS SDK 到 `v5.6.0.9` * 升级 Android SDK 到 `v5.6.1.6` ## 2.0.0 -* 增加信息流广告支持 +* 增加新广告支持 ## 1.3.2 * 增加 Banner 广告支持 ## 1.3.1 diff --git a/ads/fgm_gdt b/ads/fgm_gdt deleted file mode 160000 index a97016c..0000000 --- a/ads/fgm_gdt +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a97016cc7a0eadd8cdacf26812501a71b3f5f747 diff --git a/android/src/main/java/com/zero/flutter_gromore_ads/PluginDelegate.java b/android/src/main/java/com/zero/flutter_gromore_ads/PluginDelegate.java index 316a29b..9407735 100644 --- a/android/src/main/java/com/zero/flutter_gromore_ads/PluginDelegate.java +++ b/android/src/main/java/com/zero/flutter_gromore_ads/PluginDelegate.java @@ -150,7 +150,6 @@ public void requestPermissionIfNecessary(MethodCall call, MethodChannel.Result r */ public void initAd(MethodCall call, final MethodChannel.Result result) { String appId = call.argument("appId"); - String config = call.argument("config"); int limitPersonalAds = call.argument("limitPersonalAds"); // 构建基础配置 @@ -159,29 +158,10 @@ public void initAd(MethodCall call, final MethodChannel.Result result) { .useMediation(true) .debug(BuildConfig.DEBUG) .supportMultiProcess(false); - // 离线配置 - JSONObject localConfigJson = null; - if (!TextUtils.isEmpty(config)) { - String localConfigStr = FileUtils.getJson(config, activity); - try { - localConfigJson = new JSONObject(localConfigStr); - } catch (JSONException e) { - e.printStackTrace(); - } - } // 构建配置 - TTAdConfig gmPangleOption; - if (localConfigJson != null) { - gmPangleOption = configBuilder - .customController(getTTCustomController(limitPersonalAds == 0)) - .setMediationConfig(new MediationConfig.Builder() - .setCustomLocalConfig(localConfigJson) - .build()).build(); - } else { - gmPangleOption = configBuilder - .customController(getTTCustomController(limitPersonalAds == 0)) - .build(); - } + TTAdConfig gmPangleOption = configBuilder + .customController(getTTCustomController(limitPersonalAds == 0)) + .build(); // 初始化 SDK TTAdSdk.init(activity.getApplicationContext(),gmPangleOption); TTAdSdk.start(new TTAdSdk.Callback() { diff --git a/android/src/main/java/com/zero/flutter_gromore_ads/load/FeedAdLoad.java b/android/src/main/java/com/zero/flutter_gromore_ads/load/FeedAdLoad.java deleted file mode 100644 index a02cf76..0000000 --- a/android/src/main/java/com/zero/flutter_gromore_ads/load/FeedAdLoad.java +++ /dev/null @@ -1,92 +0,0 @@ -//package com.zero.flutter_gromore_ads.load; -// -//import android.app.Activity; -//import android.util.Log; -// -//import androidx.annotation.NonNull; -// -//import com.bytedance.msdk.api.AdError; -//import com.bytedance.msdk.api.v2.GMAdConstant; -//import com.bytedance.msdk.api.v2.ad.nativeAd.GMNativeAd; -//import com.bytedance.msdk.api.v2.ad.nativeAd.GMNativeAdLoadCallback; -//import com.bytedance.msdk.api.v2.ad.nativeAd.GMUnifiedNativeAd; -//import com.bytedance.msdk.api.v2.slot.GMAdOptionUtil; -//import com.bytedance.msdk.api.v2.slot.GMAdSlotNative; -//import com.zero.flutter_gromore_ads.event.AdEventAction; -//import com.zero.flutter_gromore_ads.page.BaseAdPage; -//import com.zero.flutter_gromore_ads.utils.UIUtils; -// -//import java.util.ArrayList; -//import java.util.List; -// -//import io.flutter.plugin.common.MethodCall; -//import io.flutter.plugin.common.MethodChannel; -// -///** -// * 信息流加载对象 -// */ -//public class FeedAdLoad extends BaseAdPage implements GMNativeAdLoadCallback { -// private final String TAG = FeedAdLoad.class.getSimpleName(); -// GMUnifiedNativeAd ad; -// private MethodChannel.Result result; -// -// /** -// * 加载信息流广告列表 -// * @param call -// * @param result -// */ -// public void loadFeedAdList(Activity activity, @NonNull MethodCall call, @NonNull MethodChannel.Result result) { -// this.result=result; -// showAd(activity,call); -// } -// -// @Override -// public void loadAd(@NonNull MethodCall call) { -// // 获取请求模板广告素材的尺寸 -// int expressViewWidth = call.argument("width"); -// int expressViewHeight = call.argument("height"); -// int count = call.argument("count"); -// // 如果为空则创建 -//// if (ad == null) { -//// -//// } -// // 原生广告 -// ad = new GMUnifiedNativeAd(activity, posId); -// // 广告配置 -// GMAdSlotNative adSlot = new GMAdSlotNative.Builder() -// .setAdStyleType(GMAdConstant.TYPE_EXPRESS_AD)//必传,表示请求的模板广告还是原生广告,AdSlot.TYPE_EXPRESS_AD:模板广告 ; AdSlot.TYPE_NATIVE_AD:原生广告 -// // 备注 -// // 1:如果是信息流自渲染广告,设置广告图片期望的图片宽高 ,不能为0 -// // 2:如果是信息流模板广告,宽度设置为希望的宽度,高度设置为0(0为高度选择自适应参数) -// .setImageAdSize((int) UIUtils.getScreenWidthDp(activity), 0)// 必选参数 单位dp ,详情见上面备注解释 -// .setAdCount(count)//请求广告数量为1到3条 -// .build(); -// ad.loadAd(adSlot,this); -// } -// -// @Override -// public void onAdLoaded(@NonNull List list) { -// List adResultList=new ArrayList<>(); -// Log.i(TAG, "onNativeExpressAdLoad onAdLoaded"); -// if (list.isEmpty()) { -// this.result.success(adResultList); -// return; -// } -// Log.i(TAG, "onNativeExpressAdLoad onAdLoaded :"+list.size()); -// for (GMNativeAd adItem : list) { -// int key=adItem.hashCode(); -// adResultList.add(key); -// FeedAdManager.getInstance().putAd(key,adItem); -// } -// // 添加广告事件 -// sendEvent(AdEventAction.onAdLoaded); -// this.result.success(adResultList); -// } -// -// @Override -// public void onAdLoadedFail(@NonNull AdError adError) { -// Log.e(TAG, "onError code:" + adError.code + " msg:" + adError.message); -// sendErrorEvent(adError.code, adError.message); -// this.result.error(""+adError.code, adError.message,adError.message); -// } -//} diff --git a/android/src/main/java/com/zero/flutter_gromore_ads/load/FeedAdManager.java b/android/src/main/java/com/zero/flutter_gromore_ads/load/FeedAdManager.java deleted file mode 100644 index ef6fb02..0000000 --- a/android/src/main/java/com/zero/flutter_gromore_ads/load/FeedAdManager.java +++ /dev/null @@ -1,57 +0,0 @@ -//package com.zero.flutter_gromore_ads.load; -// -//import com.bytedance.msdk.api.v2.ad.nativeAd.GMNativeAd; -// -//import java.util.HashMap; -//import java.util.Map; -// -///** -// * 信息流广告管理 -// */ -//public class FeedAdManager { -// private final String TAG = FeedAdManager.class.getSimpleName(); -// // 信息流广告管理类对象 -// private static FeedAdManager _instance; -// -// public static synchronized FeedAdManager getInstance() { -// if (_instance == null) { -// synchronized (FeedAdManager.class) { -// _instance = new FeedAdManager(); -// } -// } -// return _instance; -// } -// -// // 信息流广告列表 -// private final Map feedAdList = new HashMap(); -// -// /** -// * 添加广告渲染对象 -// * -// * @param key 广告缓存id -// * @param ad 广告渲染对象 -// */ -// public void putAd(int key, GMNativeAd ad) { -// feedAdList.put(key, ad); -// } -// -// /** -// * 获取广告渲染对象 -// * -// * @param key 广告缓存id -// * @return 广告渲染对象 -// */ -// public GMNativeAd getAd(int key) { -// return feedAdList.get(key); -// } -// -// /** -// * 删除广告渲染对象 -// * -// * @param key 广告缓存id -// * @return 广告渲染对象 -// */ -// public GMNativeAd removeAd(int key) { -// return feedAdList.remove(key); -// } -//} diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist index 9625e10..7c56964 100644 --- a/example/ios/Flutter/AppFrameworkInfo.plist +++ b/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 11.0 + 12.0 diff --git a/example/ios/Podfile b/example/ios/Podfile index 81a49f2..6b8aad7 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '11.0' +# platform :ios, '12.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index e1f0928..26670da 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -365,7 +365,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -450,7 +450,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -499,7 +499,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/ios/Classes/FlutterGromoreAdsPlugin.h b/ios/Classes/FlutterGromoreAdsPlugin.h index edcf8b0..df66683 100644 --- a/ios/Classes/FlutterGromoreAdsPlugin.h +++ b/ios/Classes/FlutterGromoreAdsPlugin.h @@ -1,8 +1,6 @@ #import #import "FGMSplashPage.h" #import "FGMInterstitialPage.h" -#import "FGMFeedAdLoad.h" -#import "FGMFeedAdManager.h" @interface FlutterGromoreAdsPlugin : NSObject @property (strong,nonatomic) FlutterEventSink eventSink;// 事件 diff --git a/ios/Classes/Load/FGMFeedAdLoad.h b/ios/Classes/Load/FGMFeedAdLoad.h deleted file mode 100644 index a5aae25..0000000 --- a/ios/Classes/Load/FGMFeedAdLoad.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// FeedAdLoad.h -// flutter_pangle_ads -// -// Created by zero on 2021/11/29. -// - -#import -#import "FGMBasePage.h" - -@interface FGMFeedAdLoad : FGMBasePage -@property (strong,nonatomic,nonnull) FlutterResult result; -@property (strong,nonatomic,nullable) BUNativeAdsManager *adManager; -// 加载信息流广告列表 --(void) loadFeedAdList:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult) result eventSink:(nonnull FlutterEventSink )events; -@end diff --git a/ios/Classes/Load/FGMFeedAdLoad.m b/ios/Classes/Load/FGMFeedAdLoad.m deleted file mode 100644 index cb84632..0000000 --- a/ios/Classes/Load/FGMFeedAdLoad.m +++ /dev/null @@ -1,81 +0,0 @@ -// -// FeedAdLoad.m -// flutter_pangle_ads -// -// Created by zero on 2021/11/29. -// - -#import "FGMFeedAdLoad.h" -#import "FGMFeedAdManager.h" -#import "FlutterGromoreAdsPlugin.h" - -@implementation FGMFeedAdLoad - -- (void)loadFeedAdList:(FlutterMethodCall *)call result:(FlutterResult)result eventSink:(FlutterEventSink)events{ - self.result=result; - // 这里复用整个加载流程 - [self showAd:call eventSink:events]; -} - -// 加载广告 -- (void)loadAd:(FlutterMethodCall *)call{ - int width = [call.arguments[@"width"] intValue]; - int height = [call.arguments[@"height"] intValue]; - int count = [call.arguments[@"count"] intValue]; - // 配置广告加载 - if(!self.adManager){ -// ABUNativeAdSlot slot=[[ABUNativeAdSlot alloc] ini]; - BUAdSlot* slot=[[BUAdSlot alloc] init]; - slot.ID = self.posId; - slot.AdType = BUAdSlotAdTypeFeed; - slot.position = BUAdSlotPositionMiddle; - slot.imgSize = [BUSize sizeBy:BUProposalSize_Banner600_400]; - self.adManager= [[BUNativeAdsManager alloc] initWithSlot:slot]; - } - self.adManager.adSize=CGSizeMake(width, height); -// self.adManager.rootViewController=self.rootController; -// self.adManager.startMutedIfCan= YES; - self.adManager.delegate=self; - // 加载广告 - [self.adManager loadAdDataWithCount:count]; -} - -#pragma mark ABUNativeAdsManagerDelegate - -- (void)nativeAdsManager:(BUNativeAdsManager *)adsManager didFailWithError:(NSError *)error{ - NSLog(@"%s",__FUNCTION__); - // 发送广告错误事件 - [self sendErrorEvent:error]; -} - -- (void)nativeAdsManagerSuccessToLoad:(BUNativeAdsManager *)adsManager nativeAds:(NSArray *)views{ - NSLog(@"%s",__FUNCTION__); - if (views.count) { - // 广告列表,用于返回 Flutter 层 - NSMutableArray *adList= [[NSMutableArray alloc] init]; - [views enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { - // 通过hash 来标识不同的原生广告 View - NSNumber *key=[NSNumber numberWithInteger:[obj hash]]; - NSLog(@"FeedAdLoad idx:%lu obj:%p hash:%@",(unsigned long)[obj hash],obj,key); - // 添加到返回列表中 - [adList addObject:key]; - // 添加到缓存广告列表中 - [FGMFeedAdManager.share putAd:key value:obj]; - }]; - // 返回广告列表 - self.result(adList); - } - // 发送广告事件 - [self sendEventAction:onAdLoaded]; -} - -// 发送消息 -// 这里发送消息到信息流View,主要是适配信息流 View 的尺寸 -//- (void) postNotificationMsg:(BUNativeExpressAdView *) adView userInfo:(NSDictionary *) userInfo{ -// NSLog(@"%s",__FUNCTION__); -// NSNumber *key=[NSNumber numberWithInteger:[adView hash]]; -// NSString *name=[NSString stringWithFormat:@"%@/%@", kAdFeedViewId, key.stringValue]; -// [[NSNotificationCenter defaultCenter] postNotificationName:name object:adView userInfo:userInfo]; -//} - -@end diff --git a/ios/Classes/Load/FGMFeedAdManager.h b/ios/Classes/Load/FGMFeedAdManager.h deleted file mode 100644 index 60915b4..0000000 --- a/ios/Classes/Load/FGMFeedAdManager.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// FeedAdManager.h -// flutter_pangle_ads -// -// Created by zero on 2021/11/29. -// - -#import -#import "FGMGroMore.h" - -@interface FGMFeedAdManager : NSObject -+ (instancetype) share; -// 加入到缓存中 -- (void) putAd:(NSNumber*) key value:(BUNativeExpressAdView*) value; -// 从缓存中获取 -- (BUNativeExpressAdView*) getAd:(NSNumber*) key; -// 从缓存中删除 -- (void) removeAd:(NSNumber*) key; - -@end diff --git a/ios/Classes/Load/FGMFeedAdManager.m b/ios/Classes/Load/FGMFeedAdManager.m deleted file mode 100644 index d4d79e9..0000000 --- a/ios/Classes/Load/FGMFeedAdManager.m +++ /dev/null @@ -1,39 +0,0 @@ -// -// FeedAdManager.m -// flutter_pangle_ads -// -// Created by zero on 2021/11/29. -// - -#import "FGMFeedAdManager.h" - -@implementation FGMFeedAdManager - -static FGMFeedAdManager *manager; -NSMutableDictionary *adList;// 已加载信息流广告列表 - - -+ (instancetype)share{ - static dispatch_once_t once_token; - dispatch_once(&once_token, ^{ - adList= [[NSMutableDictionary alloc]init]; - manager=[[FGMFeedAdManager alloc] init]; - }); - return manager; -} - -- (void)putAd:(NSNumber*)key value:(id)value{ - [adList setObject:value forKey:key]; -} - -- (id)getAd:(NSNumber*)key{ - return adList[key]; -} - -- (void)removeAd:(NSNumber*)key{ - [adList removeObjectForKey:key]; -} - - - -@end diff --git a/ios/Classes/Page/FGMNativeViewFactory.m b/ios/Classes/Page/FGMNativeViewFactory.m index 0376866..912b98c 100644 --- a/ios/Classes/Page/FGMNativeViewFactory.m +++ b/ios/Classes/Page/FGMNativeViewFactory.m @@ -7,7 +7,6 @@ #import "FGMNativeViewFactory.h" #import "FGMAdBannerView.h" -//#import "FGMAdFeedView.h" @implementation FGMNativeViewFactory diff --git a/ios/flutter_gromore_ads.podspec b/ios/flutter_gromore_ads.podspec index 7809c8c..09ba7e4 100644 --- a/ios/flutter_gromore_ads.podspec +++ b/ios/flutter_gromore_ads.podspec @@ -4,7 +4,7 @@ # Pod::Spec.new do |s| s.name = 'flutter_gromore_ads' - s.version = '2.1.0' + s.version = '3.0.0' s.summary = '一款优质的 Flutter 广告插件(GroMore、穿山甲)' s.description = <<-DESC FlutterAds 致力于构建优质的 Flutter 广告插件 diff --git a/pubspec.yaml b/pubspec.yaml index 063330c..706728e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_gromore_ads description: 一款优质的 Flutter 广告插件(Gromore、穿山甲) -version: 2.1.0 +version: 3.0.0 homepage: https://github.com/FlutterAds/flutter_gromore_ads repository: https://github.com/FlutterAds/flutter_gromore_ads issue_tracker: https://github.com/FlutterAds/flutter_gromore_ads/issues