@bigcrunch/react-native-ads 0.10.1 → 0.11.0

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.
@@ -120,17 +120,21 @@ internal class GoogleAdsAdapter(
120
120
  * Resolve a BigCrunch AdSize to a Google AdSize.
121
121
  * For adaptive sizes, calculates the optimal ad size based on screen width.
122
122
  */
123
+ /**
124
+ * Resolve a BigCrunch AdSize to a Google AdSize.
125
+ * A 0x0 size is always treated as adaptive since it is never valid as a fixed size.
126
+ */
123
127
  private fun resolveGoogleAdSize(
124
128
  bcAdSize: com.bigcrunch.ads.models.AdSize
125
129
  ): AdSize {
126
- if (bcAdSize.isAdaptive) {
130
+ if (bcAdSize.isAdaptive || (bcAdSize.width == 0 && bcAdSize.height == 0)) {
127
131
  val widthDp = if (bcAdSize.width > 0) {
128
132
  bcAdSize.width
129
133
  } else {
130
134
  val displayMetrics = context.resources.displayMetrics
131
135
  (displayMetrics.widthPixels / displayMetrics.density).toInt()
132
136
  }
133
- BCLogger.d(TAG, "Resolving adaptive banner with width: ${widthDp}dp")
137
+ BCLogger.d(TAG, "Resolving adaptive banner with width: ${widthDp}dp (isAdaptive=${bcAdSize.isAdaptive}, original=${bcAdSize.width}x${bcAdSize.height})")
134
138
  return AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(context, widthDp)
135
139
  }
136
140
  return AdSize(bcAdSize.width, bcAdSize.height)
@@ -28,7 +28,7 @@ internal class DeviceContext private constructor(context: Context) {
28
28
 
29
29
  companion object {
30
30
  private const val TAG = "DeviceContext"
31
- internal const val SDK_VERSION = "0.10.1"
31
+ internal const val SDK_VERSION = "0.11.0"
32
32
 
33
33
  @Volatile
34
34
  private var instance: DeviceContext? = null
@@ -94,12 +94,13 @@ internal class GoogleAdsAdapter: NSObject {
94
94
 
95
95
  /// Resolve a BigCrunch AdSize to a Google AdSize.
96
96
  /// For adaptive sizes, calculates the optimal ad size based on screen width.
97
+ /// A 0x0 size is always treated as adaptive since it is never valid as a fixed size.
97
98
  private func resolveGoogleAdSize(_ bcAdSize: AdSize) -> GoogleMobileAds.AdSize {
98
- if bcAdSize.isAdaptive {
99
+ if bcAdSize.isAdaptive || (bcAdSize.width == 0 && bcAdSize.height == 0) {
99
100
  let width: CGFloat = bcAdSize.width > 0
100
101
  ? CGFloat(bcAdSize.width)
101
102
  : UIScreen.main.bounds.width
102
- BCLogger.debug("\(GoogleAdsAdapter.TAG): Resolving adaptive banner with width: \(width)pt")
103
+ BCLogger.debug("\(GoogleAdsAdapter.TAG): Resolving adaptive banner with width: \(width)pt (isAdaptive=\(bcAdSize.isAdaptive), original=\(bcAdSize.width)x\(bcAdSize.height))")
103
104
  return GoogleMobileAds.currentOrientationAnchoredAdaptiveBanner(width: width)
104
105
  }
105
106
  return GoogleMobileAds.adSizeFor(cgSize: CGSize(
@@ -74,7 +74,7 @@ internal final class DeviceContext {
74
74
  // MARK: - SDK Properties
75
75
 
76
76
  /// SDK version
77
- static let SDK_VERSION = "0.10.1"
77
+ static let SDK_VERSION = "0.11.0"
78
78
  let sdkVersion: String = SDK_VERSION
79
79
 
80
80
  /// SDK platform (always "ios")
@@ -1,14 +1,19 @@
1
1
  import Foundation
2
+ import os.log
2
3
 
3
4
  /**
4
5
  * Internal logger for BigCrunch Ads SDK
5
6
  *
6
- * All logs are prefixed with "[BCrunch:LEVEL]" for easy filtering.
7
+ * Uses os_log for unified logging, visible in Console.app and terminal
8
+ * without requiring the Xcode debugger to be attached.
9
+ * All logs use the "BCrunch" subsystem for easy filtering.
7
10
  * Logging can be disabled in production by setting isEnabled = false.
8
11
  * Error logs are always shown regardless of isEnabled flag.
9
12
  */
10
13
  internal class BCLogger {
11
14
 
15
+ private static let log = OSLog(subsystem: "com.bigcrunch.ads", category: "BCrunch")
16
+
12
17
  /**
13
18
  * Enable/disable debug logging
14
19
  * Defaults to false for production builds
@@ -20,7 +25,7 @@ internal class BCLogger {
20
25
  */
21
26
  static func verbose(_ message: String) {
22
27
  if isEnabled {
23
- print("[BCrunch:VERBOSE] \(message)")
28
+ os_log("[BCrunch:VERBOSE] %{public}@", log: log, type: .debug, message)
24
29
  }
25
30
  }
26
31
 
@@ -29,7 +34,7 @@ internal class BCLogger {
29
34
  */
30
35
  static func debug(_ message: String) {
31
36
  if isEnabled {
32
- print("[BCrunch:DEBUG] \(message)")
37
+ os_log("[BCrunch:DEBUG] %{public}@", log: log, type: .debug, message)
33
38
  }
34
39
  }
35
40
 
@@ -38,7 +43,7 @@ internal class BCLogger {
38
43
  */
39
44
  static func info(_ message: String) {
40
45
  if isEnabled {
41
- print("[BCrunch:INFO] \(message)")
46
+ os_log("[BCrunch:INFO] %{public}@", log: log, type: .info, message)
42
47
  }
43
48
  }
44
49
 
@@ -47,7 +52,7 @@ internal class BCLogger {
47
52
  */
48
53
  static func warning(_ message: String) {
49
54
  if isEnabled {
50
- print("[BCrunch:WARNING] \(message)")
55
+ os_log("[BCrunch:WARNING] %{public}@", log: log, type: .default, message)
51
56
  }
52
57
  }
53
58
 
@@ -57,6 +62,6 @@ internal class BCLogger {
57
62
  */
58
63
  static func error(_ message: String) {
59
64
  // Always log errors
60
- print("[BCrunch:ERROR] \(message)")
65
+ os_log("[BCrunch:ERROR] %{public}@", log: log, type: .error, message)
61
66
  }
62
67
  }
@@ -257,6 +257,11 @@ class BigCrunchAdsModule: RCTEventEmitter {
257
257
  useTestAds: useTestAds,
258
258
  callback: callbackBridge
259
259
  )
260
+
261
+ if debug {
262
+ BigCrunchAds.setDebugMode(true)
263
+ }
264
+
260
265
  NSLog("[BigCrunchRNBridge] native initialize() returned, waiting for callback...")
261
266
  }
262
267
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigcrunch/react-native-ads",
3
- "version": "0.10.1",
3
+ "version": "0.11.0",
4
4
  "description": "BigCrunch Mobile Ads SDK for React Native - Simplified in-app advertising with S2S demand and Google Ad Manager",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",