@24jieqi/react-native-brayant-ad 0.1.22 → 0.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,6 +38,8 @@ public class BannerAdView extends RelativeLayout {
38
38
  inflate(context, R.layout.feed_view, this);
39
39
  Utils.setupLayoutHack(this);
40
40
 
41
+ setVisibility(View.INVISIBLE);
42
+
41
43
  RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
42
44
  RelativeLayout.LayoutParams.MATCH_PARENT,
43
45
  mExpectedHeight
@@ -73,7 +75,7 @@ public class BannerAdView extends RelativeLayout {
73
75
  */
74
76
  public void setVisibility(boolean visible) {
75
77
  if (visible) {
76
- super.setVisibility(View.VISIBLE);
78
+ // 触发加载,但暂不显示(等待渲染成功)
77
79
  showAd();
78
80
  } else {
79
81
  super.setVisibility(View.INVISIBLE);
@@ -50,11 +50,11 @@ public class DrawFeedView extends RelativeLayout {
50
50
  reactContext = context;
51
51
  mContext = context;
52
52
 
53
- // 初始化广告渲染组件
54
53
  inflate(mContext, R.layout.draw_video, this);
55
54
  mContainer = findViewById(R.id.tt_video_layout_hxb);
56
55
 
57
- // 这个函数很关键,不然不能触发再次渲染,让 view 在 RN 里渲染成功!!
56
+ setVisibility(View.INVISIBLE);
57
+
58
58
  Utils.setupLayoutHack(this);
59
59
  }
60
60
 
@@ -214,6 +214,7 @@ public class DrawFeedView extends RelativeLayout {
214
214
  public void onRenderSuccess(View view, float width, float height) {
215
215
  Log.d(TAG, "express onRenderSuccess");
216
216
  mContainer.addView(ad.getExpressAdView());
217
+ DrawFeedView.this.setVisibility(View.VISIBLE);
217
218
  onExpressAdLoad();
218
219
  }
219
220
  }
@@ -301,6 +302,8 @@ public class DrawFeedView extends RelativeLayout {
301
302
  View view = ad.getAdView();
302
303
  mContainer.addView(view);
303
304
 
305
+ DrawFeedView.this.setVisibility(View.VISIBLE);
306
+
304
307
  // 广告替换用户头像
305
308
  String headicon = "";
306
309
  if (ad.getIcon() != null && ad.getIcon().getImageUrl() != null) {
@@ -308,7 +311,6 @@ public class DrawFeedView extends RelativeLayout {
308
311
  }
309
312
  onNativeAdLoad(headicon);
310
313
 
311
- // 点击标题,下载按钮+事件
312
314
  initAdViewAndAction(ad, mContainer);
313
315
  }
314
316
  }
@@ -50,6 +50,9 @@ public class FeedAdView extends RelativeLayout {
50
50
  //开始展开
51
51
  inflate(context, R.layout.feed_view, this);
52
52
 
53
+ // 初始隐藏容器,避免白屏闪现
54
+ setVisibility(View.INVISIBLE);
55
+
53
56
  // 这个函数很关键,不然不能触发再次渲染,让 view 在 RN 里渲染成功!!
54
57
  Utils.setupLayoutHack(this);
55
58
  }
@@ -173,18 +176,15 @@ public class FeedAdView extends RelativeLayout {
173
176
 
174
177
  @Override
175
178
  public void onRenderSuccess(View view, float width, float height) {
176
- // 返回view的宽高 单位 dp
177
- // TToast.show(mContext, "渲染成功");
178
- // 在渲染成功回调时展示广告,提升体验
179
179
  RelativeLayout mExpressContainer = findViewById(R.id.feed_container);
180
180
  if (mExpressContainer != null) {
181
181
  mExpressContainer.addView(view);
182
182
  }
183
+ FeedAdView.this.setVisibility(View.VISIBLE);
183
184
  onAdLayout((int) width, (int) height);
184
185
  }
185
186
  }
186
187
  );
187
- // dislike设置
188
188
  bindDislike(ad, true);
189
189
  if (ad.getInteractionType() != TTAdConstant.INTERACTION_TYPE_DOWNLOAD) {
190
190
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@24jieqi/react-native-brayant-ad",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
4
4
  "description": "国内广告联盟sdk封装",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -16,6 +16,15 @@ Pod::Spec.new do |s|
16
16
 
17
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
18
18
 
19
+ # 添加穿山甲广告SDK源
20
+ s.source = {
21
+ :git => "http://gitlab.ztdzx.cn:9005/react-native/react-native-brayant-ad.git",
22
+ :tag => "#{s.version}"
23
+ }
24
+
25
+ # 穿山甲广告SDK依赖 (使用官方CocoaPods源)
26
+ s.dependency "BUAdSDK"
27
+
19
28
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
20
29
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
21
30
  if respond_to?(:install_modules_dependencies, true)