@bigcrunch/react-native-ads 0.4.0 → 0.5.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.
- package/README.md +5 -5
- package/android/bigcrunch-ads/com/bigcrunch/ads/BigCrunchAds.kt +434 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/BigCrunchBannerView.kt +484 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/BigCrunchInterstitial.kt +403 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/BigCrunchRewarded.kt +409 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/adapters/GoogleAdsAdapter.kt +592 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/core/AdOrchestrator.kt +623 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/core/AnalyticsClient.kt +719 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/core/BidRequestClient.kt +364 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/core/ConfigManager.kt +301 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/core/DeviceContext.kt +385 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/core/RewardedCallback.kt +42 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/core/SessionManager.kt +330 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/internal/DeviceHelper.kt +60 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/internal/HttpClient.kt +114 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/internal/Logger.kt +71 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/internal/PrivacyStore.kt +125 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/internal/Storage.kt +88 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/listeners/BannerAdListener.kt +55 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/listeners/InterstitialAdListener.kt +55 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/listeners/RewardedAdListener.kt +58 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/models/AdEvent.kt +880 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/models/AppConfig.kt +90 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/models/DeviceData.kt +18 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/models/PlacementConfig.kt +70 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/models/SessionInfo.kt +21 -0
- package/android/build.gradle +22 -10
- package/android/settings.gradle +2 -6
- package/ios/BigCrunchAds/Sources/Adapters/GoogleAdsAdapter.swift +512 -0
- package/ios/BigCrunchAds/Sources/BigCrunchAds.swift +387 -0
- package/ios/BigCrunchAds/Sources/BigCrunchBannerView.swift +448 -0
- package/ios/BigCrunchAds/Sources/BigCrunchInterstitial.swift +412 -0
- package/ios/BigCrunchAds/Sources/BigCrunchRewarded.swift +523 -0
- package/ios/BigCrunchAds/Sources/Core/AdOrchestrator.swift +514 -0
- package/ios/BigCrunchAds/Sources/Core/AnalyticsClient.swift +874 -0
- package/ios/BigCrunchAds/Sources/Core/BidRequestClient.swift +344 -0
- package/ios/BigCrunchAds/Sources/Core/ConfigManager.swift +306 -0
- package/ios/BigCrunchAds/Sources/Core/DeviceContext.swift +284 -0
- package/ios/BigCrunchAds/Sources/Core/SessionManager.swift +392 -0
- package/ios/BigCrunchAds/Sources/Internal/HTTPClient.swift +146 -0
- package/ios/BigCrunchAds/Sources/Internal/Logger.swift +62 -0
- package/ios/BigCrunchAds/Sources/Internal/PrivacyStore.swift +129 -0
- package/ios/BigCrunchAds/Sources/Internal/Storage.swift +73 -0
- package/ios/BigCrunchAds/Sources/Models/AdEvent.swift +784 -0
- package/ios/BigCrunchAds/Sources/Models/AppConfig.swift +100 -0
- package/ios/BigCrunchAds/Sources/Models/DeviceData.swift +68 -0
- package/ios/BigCrunchAds/Sources/Models/PlacementConfig.swift +137 -0
- package/ios/BigCrunchAds/Sources/Models/SessionInfo.swift +48 -0
- package/ios/BigCrunchAdsModule.swift +0 -1
- package/ios/BigCrunchBannerViewManager.swift +0 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -2
- package/package.json +8 -2
- package/react-native-bigcrunch-ads.podspec +0 -1
- package/scripts/inject-version.js +55 -0
- package/src/index.ts +3 -2
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
package com.bigcrunch.ads.internal
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.content.SharedPreferences
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Key-value storage interface for persisting SDK data
|
|
8
|
+
*/
|
|
9
|
+
internal interface KeyValueStore {
|
|
10
|
+
/**
|
|
11
|
+
* Get a string value by key
|
|
12
|
+
*
|
|
13
|
+
* @param key Storage key
|
|
14
|
+
* @param default Default value if key doesn't exist
|
|
15
|
+
* @return Stored value or default
|
|
16
|
+
*/
|
|
17
|
+
fun getString(key: String, default: String? = null): String?
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Store a string value
|
|
21
|
+
*
|
|
22
|
+
* @param key Storage key
|
|
23
|
+
* @param value Value to store
|
|
24
|
+
*/
|
|
25
|
+
fun putString(key: String, value: String)
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Remove a key from storage
|
|
29
|
+
*
|
|
30
|
+
* @param key Storage key to remove
|
|
31
|
+
*/
|
|
32
|
+
fun remove(key: String)
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Clear all stored data
|
|
36
|
+
*/
|
|
37
|
+
fun clear()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* SharedPreferences-based implementation of KeyValueStore
|
|
42
|
+
*
|
|
43
|
+
* Thread-safe implementation using Android's SharedPreferences.
|
|
44
|
+
* All data is stored in a private preferences file.
|
|
45
|
+
*/
|
|
46
|
+
internal class SharedPreferencesStore(context: Context) : KeyValueStore {
|
|
47
|
+
|
|
48
|
+
private val prefs: SharedPreferences = context.getSharedPreferences(
|
|
49
|
+
"bigcrunch_ads_storage",
|
|
50
|
+
Context.MODE_PRIVATE
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
override fun getString(key: String, default: String?): String? {
|
|
54
|
+
return try {
|
|
55
|
+
prefs.getString(key, default)
|
|
56
|
+
} catch (e: Exception) {
|
|
57
|
+
BCLogger.e("Storage", "Failed to get string for key: $key", e)
|
|
58
|
+
default
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
override fun putString(key: String, value: String) {
|
|
63
|
+
try {
|
|
64
|
+
prefs.edit().putString(key, value).apply()
|
|
65
|
+
BCLogger.v("Storage", "Stored value for key: $key")
|
|
66
|
+
} catch (e: Exception) {
|
|
67
|
+
BCLogger.e("Storage", "Failed to store value for key: $key", e)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
override fun remove(key: String) {
|
|
72
|
+
try {
|
|
73
|
+
prefs.edit().remove(key).apply()
|
|
74
|
+
BCLogger.v("Storage", "Removed key: $key")
|
|
75
|
+
} catch (e: Exception) {
|
|
76
|
+
BCLogger.e("Storage", "Failed to remove key: $key", e)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
override fun clear() {
|
|
81
|
+
try {
|
|
82
|
+
prefs.edit().clear().apply()
|
|
83
|
+
BCLogger.d("Storage", "Cleared all stored data")
|
|
84
|
+
} catch (e: Exception) {
|
|
85
|
+
BCLogger.e("Storage", "Failed to clear storage", e)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
package com.bigcrunch.ads.listeners
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Listener interface for banner ad events.
|
|
5
|
+
* Implement this interface to receive callbacks for banner ad lifecycle events.
|
|
6
|
+
*/
|
|
7
|
+
interface BannerAdListener {
|
|
8
|
+
/**
|
|
9
|
+
* Called when a banner ad has been successfully loaded.
|
|
10
|
+
*/
|
|
11
|
+
fun onAdLoaded()
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Called when a banner ad request fails.
|
|
15
|
+
*
|
|
16
|
+
* @param errorCode The error code indicating the type of failure
|
|
17
|
+
* @param errorMessage A human-readable description of the error
|
|
18
|
+
*/
|
|
19
|
+
fun onAdFailedToLoad(errorCode: String, errorMessage: String)
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Called when an impression has been recorded for the banner ad.
|
|
23
|
+
*/
|
|
24
|
+
fun onAdImpression()
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Called when the user clicks on the banner ad.
|
|
28
|
+
*/
|
|
29
|
+
fun onAdClicked()
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Called when the banner ad opens an overlay that covers the screen.
|
|
33
|
+
*/
|
|
34
|
+
fun onAdOpened()
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Called when the banner ad closes the overlay.
|
|
38
|
+
*/
|
|
39
|
+
fun onAdClosed()
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Called when revenue information is available for the banner ad.
|
|
43
|
+
*
|
|
44
|
+
* @param valueMicros The monetary value of the ad in micros (1 micro = 0.000001 of currency)
|
|
45
|
+
* @param currencyCode The ISO 4217 currency code (e.g., "USD")
|
|
46
|
+
* @param adUnitId The ad unit ID that generated the revenue
|
|
47
|
+
* @param precision The precision type of the revenue value (e.g., "ESTIMATED", "PUBLISHER_PROVIDED")
|
|
48
|
+
*/
|
|
49
|
+
fun onAdRevenue(
|
|
50
|
+
valueMicros: Long,
|
|
51
|
+
currencyCode: String,
|
|
52
|
+
adUnitId: String?,
|
|
53
|
+
precision: String?
|
|
54
|
+
)
|
|
55
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
package com.bigcrunch.ads.listeners
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Listener interface for interstitial ad events.
|
|
5
|
+
* Implement this interface to receive callbacks for interstitial ad lifecycle events.
|
|
6
|
+
*/
|
|
7
|
+
interface InterstitialAdListener {
|
|
8
|
+
/**
|
|
9
|
+
* Called when an interstitial ad has been successfully loaded.
|
|
10
|
+
*/
|
|
11
|
+
fun onAdLoaded()
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Called when an interstitial ad request fails.
|
|
15
|
+
*
|
|
16
|
+
* @param errorCode The error code indicating the type of failure
|
|
17
|
+
* @param errorMessage A human-readable description of the error
|
|
18
|
+
*/
|
|
19
|
+
fun onAdFailedToLoad(errorCode: String, errorMessage: String)
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Called when the interstitial ad is displayed.
|
|
23
|
+
*/
|
|
24
|
+
fun onAdShowed()
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Called when the interstitial ad is dismissed.
|
|
28
|
+
*/
|
|
29
|
+
fun onAdDismissed()
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Called when the user clicks on the interstitial ad.
|
|
33
|
+
*/
|
|
34
|
+
fun onAdClicked()
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Called when an impression has been recorded for the interstitial ad.
|
|
38
|
+
*/
|
|
39
|
+
fun onAdImpression()
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Called when revenue information is available for the interstitial ad.
|
|
43
|
+
*
|
|
44
|
+
* @param valueMicros The monetary value of the ad in micros (1 micro = 0.000001 of currency)
|
|
45
|
+
* @param currencyCode The ISO 4217 currency code (e.g., "USD")
|
|
46
|
+
* @param adUnitId The ad unit ID that generated the revenue
|
|
47
|
+
* @param precision The precision type of the revenue value (e.g., "ESTIMATED", "PUBLISHER_PROVIDED")
|
|
48
|
+
*/
|
|
49
|
+
fun onAdRevenue(
|
|
50
|
+
valueMicros: Long,
|
|
51
|
+
currencyCode: String,
|
|
52
|
+
adUnitId: String?,
|
|
53
|
+
precision: String?
|
|
54
|
+
)
|
|
55
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
package com.bigcrunch.ads.listeners
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Listener interface for rewarded ad events.
|
|
5
|
+
* Implement this interface to receive callbacks for rewarded ad lifecycle events.
|
|
6
|
+
*/
|
|
7
|
+
interface RewardedAdListener {
|
|
8
|
+
/**
|
|
9
|
+
* Called when a rewarded ad has been successfully loaded.
|
|
10
|
+
*/
|
|
11
|
+
fun onAdLoaded()
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Called when a rewarded ad request fails.
|
|
15
|
+
*
|
|
16
|
+
* @param errorCode The error code indicating the type of failure
|
|
17
|
+
* @param errorMessage A human-readable description of the error
|
|
18
|
+
*/
|
|
19
|
+
fun onAdFailedToLoad(errorCode: String, errorMessage: String)
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Called when the rewarded ad is displayed.
|
|
23
|
+
*/
|
|
24
|
+
fun onAdShowed()
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Called when the rewarded ad is dismissed.
|
|
28
|
+
*/
|
|
29
|
+
fun onAdDismissed()
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Called when the user clicks on the rewarded ad.
|
|
33
|
+
*/
|
|
34
|
+
fun onAdClicked()
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Called when the user has earned a reward by watching the rewarded ad.
|
|
38
|
+
*
|
|
39
|
+
* @param type The type of reward (e.g., "coins", "points")
|
|
40
|
+
* @param amount The amount of reward earned
|
|
41
|
+
*/
|
|
42
|
+
fun onUserEarnedReward(type: String, amount: Int)
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Called when revenue information is available for the rewarded ad.
|
|
46
|
+
*
|
|
47
|
+
* @param valueMicros The monetary value of the ad in micros (1 micro = 0.000001 of currency)
|
|
48
|
+
* @param currencyCode The ISO 4217 currency code (e.g., "USD")
|
|
49
|
+
* @param adUnitId The ad unit ID that generated the revenue
|
|
50
|
+
* @param precision The precision type of the revenue value (e.g., "ESTIMATED", "PUBLISHER_PROVIDED")
|
|
51
|
+
*/
|
|
52
|
+
fun onAdRevenue(
|
|
53
|
+
valueMicros: Long,
|
|
54
|
+
currencyCode: String,
|
|
55
|
+
adUnitId: String?,
|
|
56
|
+
precision: String?
|
|
57
|
+
)
|
|
58
|
+
}
|