@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,385 @@
|
|
|
1
|
+
package com.bigcrunch.ads.core
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.content.res.Configuration
|
|
5
|
+
import android.os.Build
|
|
6
|
+
import android.util.DisplayMetrics
|
|
7
|
+
import android.view.WindowManager
|
|
8
|
+
import com.bigcrunch.ads.internal.BCLogger
|
|
9
|
+
import com.squareup.moshi.Json
|
|
10
|
+
import com.squareup.moshi.JsonClass
|
|
11
|
+
import java.util.Locale
|
|
12
|
+
import java.util.TimeZone
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* DeviceContext collects and provides device/app context for analytics
|
|
16
|
+
*
|
|
17
|
+
* Gathers information about:
|
|
18
|
+
* - Device type (phone, tablet)
|
|
19
|
+
* - Operating system and version
|
|
20
|
+
* - App name and version
|
|
21
|
+
* - Screen dimensions
|
|
22
|
+
* - Language and locale
|
|
23
|
+
* - Timezone
|
|
24
|
+
*
|
|
25
|
+
* All values are cached at initialization for consistent reporting.
|
|
26
|
+
*/
|
|
27
|
+
internal class DeviceContext private constructor(context: Context) {
|
|
28
|
+
|
|
29
|
+
companion object {
|
|
30
|
+
private const val TAG = "DeviceContext"
|
|
31
|
+
internal const val SDK_VERSION = "0.5.0"
|
|
32
|
+
|
|
33
|
+
@Volatile
|
|
34
|
+
private var instance: DeviceContext? = null
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Initialize the DeviceContext singleton
|
|
38
|
+
*
|
|
39
|
+
* Must be called once during SDK initialization.
|
|
40
|
+
*
|
|
41
|
+
* @param context Application context
|
|
42
|
+
*/
|
|
43
|
+
fun initialize(context: Context) {
|
|
44
|
+
if (instance == null) {
|
|
45
|
+
synchronized(this) {
|
|
46
|
+
if (instance == null) {
|
|
47
|
+
instance = DeviceContext(context.applicationContext)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Get the DeviceContext instance
|
|
55
|
+
*
|
|
56
|
+
* @return The singleton instance
|
|
57
|
+
* @throws IllegalStateException if not initialized
|
|
58
|
+
*/
|
|
59
|
+
fun getInstance(): DeviceContext {
|
|
60
|
+
return instance ?: throw IllegalStateException(
|
|
61
|
+
"DeviceContext not initialized. Call DeviceContext.initialize() first."
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Reset the singleton instance (for testing only)
|
|
67
|
+
*/
|
|
68
|
+
internal fun resetForTesting() {
|
|
69
|
+
synchronized(this) {
|
|
70
|
+
instance = null
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// MARK: - Device Properties
|
|
76
|
+
|
|
77
|
+
/** Device type: "phone" or "tablet" */
|
|
78
|
+
val deviceType: String
|
|
79
|
+
|
|
80
|
+
/** Device manufacturer (e.g., "Samsung") */
|
|
81
|
+
val deviceManufacturer: String = Build.MANUFACTURER
|
|
82
|
+
|
|
83
|
+
/** Device model (e.g., "SM-G991B") */
|
|
84
|
+
val deviceModel: String = Build.MODEL
|
|
85
|
+
|
|
86
|
+
/** Operating system name (always "Android") */
|
|
87
|
+
val osName: String = "Android"
|
|
88
|
+
|
|
89
|
+
/** Operating system version (e.g., "13") */
|
|
90
|
+
val osVersion: String = Build.VERSION.RELEASE
|
|
91
|
+
|
|
92
|
+
/** Android API level (e.g., 33) */
|
|
93
|
+
val apiLevel: Int = Build.VERSION.SDK_INT
|
|
94
|
+
|
|
95
|
+
/** Screen width in pixels */
|
|
96
|
+
val screenWidth: Int
|
|
97
|
+
|
|
98
|
+
/** Screen height in pixels */
|
|
99
|
+
val screenHeight: Int
|
|
100
|
+
|
|
101
|
+
/** Screen density (e.g., 2.75) */
|
|
102
|
+
val screenDensity: Float
|
|
103
|
+
|
|
104
|
+
// MARK: - App Properties
|
|
105
|
+
|
|
106
|
+
/** App package name (e.g., "com.example.app") */
|
|
107
|
+
val appPackageName: String
|
|
108
|
+
|
|
109
|
+
/** App display name */
|
|
110
|
+
val appName: String
|
|
111
|
+
|
|
112
|
+
/** App version name (e.g., "1.2.3") */
|
|
113
|
+
val appVersion: String
|
|
114
|
+
|
|
115
|
+
/** App version code (e.g., 42) */
|
|
116
|
+
val appVersionCode: Long
|
|
117
|
+
|
|
118
|
+
// MARK: - Locale Properties
|
|
119
|
+
|
|
120
|
+
/** User's preferred language code (e.g., "en") */
|
|
121
|
+
val languageCode: String
|
|
122
|
+
|
|
123
|
+
/** User's country/region code (e.g., "US") */
|
|
124
|
+
val countryCode: String
|
|
125
|
+
|
|
126
|
+
/** User's region/state (e.g., "CA", "NY") - may be empty if not available */
|
|
127
|
+
val region: String
|
|
128
|
+
|
|
129
|
+
/** User's timezone identifier (e.g., "America/New_York") */
|
|
130
|
+
val timezone: String
|
|
131
|
+
|
|
132
|
+
// MARK: - SDK Properties
|
|
133
|
+
|
|
134
|
+
/** SDK version */
|
|
135
|
+
val sdkVersion: String = SDK_VERSION
|
|
136
|
+
|
|
137
|
+
/** SDK platform (always "android") */
|
|
138
|
+
val sdkPlatform: String = "android"
|
|
139
|
+
|
|
140
|
+
init {
|
|
141
|
+
val appContext = context.applicationContext
|
|
142
|
+
|
|
143
|
+
// Device type
|
|
144
|
+
val screenLayout = appContext.resources.configuration.screenLayout
|
|
145
|
+
val screenSize = screenLayout and Configuration.SCREENLAYOUT_SIZE_MASK
|
|
146
|
+
deviceType = if (screenSize >= Configuration.SCREENLAYOUT_SIZE_LARGE) "tablet" else "phone"
|
|
147
|
+
|
|
148
|
+
// Screen dimensions (with fallbacks for test environments)
|
|
149
|
+
val screenMetrics = try {
|
|
150
|
+
val windowManager = appContext.getSystemService(Context.WINDOW_SERVICE) as? WindowManager
|
|
151
|
+
if (windowManager != null) {
|
|
152
|
+
val displayMetrics = DisplayMetrics()
|
|
153
|
+
@Suppress("DEPRECATION")
|
|
154
|
+
windowManager.defaultDisplay.getMetrics(displayMetrics)
|
|
155
|
+
Triple(displayMetrics.widthPixels, displayMetrics.heightPixels, displayMetrics.density)
|
|
156
|
+
} else {
|
|
157
|
+
// Fallback for test/mock environments
|
|
158
|
+
val resources = appContext.resources
|
|
159
|
+
Triple(resources.displayMetrics.widthPixels, resources.displayMetrics.heightPixels, resources.displayMetrics.density)
|
|
160
|
+
}
|
|
161
|
+
} catch (e: Exception) {
|
|
162
|
+
// Fallback for test/mock environments
|
|
163
|
+
BCLogger.w(TAG, "Failed to get screen dimensions, using defaults")
|
|
164
|
+
Triple(0, 0, 1.0f)
|
|
165
|
+
}
|
|
166
|
+
screenWidth = screenMetrics.first
|
|
167
|
+
screenHeight = screenMetrics.second
|
|
168
|
+
screenDensity = screenMetrics.third
|
|
169
|
+
|
|
170
|
+
// App info
|
|
171
|
+
appPackageName = appContext.packageName
|
|
172
|
+
val packageInfo = try {
|
|
173
|
+
appContext.packageManager.getPackageInfo(appPackageName, 0)
|
|
174
|
+
} catch (e: Exception) {
|
|
175
|
+
BCLogger.e(TAG, "Failed to get package info", e)
|
|
176
|
+
null
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
appVersion = packageInfo?.versionName ?: "0.0.0"
|
|
180
|
+
appVersionCode = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
|
181
|
+
packageInfo?.longVersionCode ?: 0L
|
|
182
|
+
} else {
|
|
183
|
+
@Suppress("DEPRECATION")
|
|
184
|
+
(packageInfo?.versionCode ?: 0).toLong()
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// App name from label
|
|
188
|
+
val applicationInfo = try {
|
|
189
|
+
appContext.packageManager.getApplicationInfo(appPackageName, 0)
|
|
190
|
+
} catch (e: Exception) {
|
|
191
|
+
null
|
|
192
|
+
}
|
|
193
|
+
appName = applicationInfo?.let {
|
|
194
|
+
appContext.packageManager.getApplicationLabel(it).toString()
|
|
195
|
+
} ?: "unknown"
|
|
196
|
+
|
|
197
|
+
// Locale info
|
|
198
|
+
val locale = Locale.getDefault()
|
|
199
|
+
languageCode = locale.language
|
|
200
|
+
countryCode = locale.country.ifEmpty { "US" }
|
|
201
|
+
timezone = TimeZone.getDefault().id
|
|
202
|
+
|
|
203
|
+
// Region/state extraction - Android doesn't provide direct access, leave empty for now
|
|
204
|
+
// Could be populated from IP geolocation or user settings in future
|
|
205
|
+
region = ""
|
|
206
|
+
|
|
207
|
+
BCLogger.d(TAG, "Initialized - $deviceType $deviceManufacturer $deviceModel Android $osVersion")
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// MARK: - Convenience Methods
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Get web schema compatible fields (flat structure)
|
|
214
|
+
*
|
|
215
|
+
* @return Map of flattened web schema fields
|
|
216
|
+
*/
|
|
217
|
+
fun getWebSchemaFields(): Map<String, Any> {
|
|
218
|
+
return mapOf(
|
|
219
|
+
"browser" to "BigCrunch Android SDK $sdkVersion",
|
|
220
|
+
"device" to "$deviceManufacturer $deviceModel",
|
|
221
|
+
"os" to fullOSString,
|
|
222
|
+
"country" to countryCode,
|
|
223
|
+
"region" to timezone
|
|
224
|
+
)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Get browser field for web schema (e.g., "BigCrunch Android SDK 1.0.0")
|
|
229
|
+
*/
|
|
230
|
+
fun getBrowserField(): String {
|
|
231
|
+
return "BigCrunch Android SDK $sdkVersion"
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Get mobile-specific device context fields (for optional inclusion)
|
|
236
|
+
*
|
|
237
|
+
* @return Map of mobile-specific context values
|
|
238
|
+
*/
|
|
239
|
+
fun getMobileSpecificFields(): Map<String, Any> {
|
|
240
|
+
return mapOf(
|
|
241
|
+
"device_manufacturer" to deviceManufacturer,
|
|
242
|
+
"device_model" to deviceModel,
|
|
243
|
+
"os_version" to osVersion,
|
|
244
|
+
"api_level" to apiLevel,
|
|
245
|
+
"screen_width" to screenWidth,
|
|
246
|
+
"screen_height" to screenHeight,
|
|
247
|
+
"screen_density" to screenDensity,
|
|
248
|
+
"app_package_name" to appPackageName,
|
|
249
|
+
"app_name" to appName,
|
|
250
|
+
"app_version" to appVersion,
|
|
251
|
+
"app_version_code" to appVersionCode,
|
|
252
|
+
"language_code" to languageCode,
|
|
253
|
+
"timezone" to timezone,
|
|
254
|
+
"sdk_version" to sdkVersion,
|
|
255
|
+
"sdk_platform" to sdkPlatform
|
|
256
|
+
)
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Get a map representation for analytics events (legacy format)
|
|
261
|
+
* DEPRECATED: Use getWebSchemaFields() for new analytics events
|
|
262
|
+
*
|
|
263
|
+
* @return Map of device context values
|
|
264
|
+
*/
|
|
265
|
+
fun toMap(): Map<String, Any> {
|
|
266
|
+
return mapOf(
|
|
267
|
+
"device_type" to deviceType,
|
|
268
|
+
"device_manufacturer" to deviceManufacturer,
|
|
269
|
+
"device_model" to deviceModel,
|
|
270
|
+
"os_name" to osName,
|
|
271
|
+
"os_version" to osVersion,
|
|
272
|
+
"api_level" to apiLevel,
|
|
273
|
+
"screen_width" to screenWidth,
|
|
274
|
+
"screen_height" to screenHeight,
|
|
275
|
+
"screen_density" to screenDensity,
|
|
276
|
+
"app_package_name" to appPackageName,
|
|
277
|
+
"app_name" to appName,
|
|
278
|
+
"app_version" to appVersion,
|
|
279
|
+
"app_version_code" to appVersionCode,
|
|
280
|
+
"language_code" to languageCode,
|
|
281
|
+
"country_code" to countryCode,
|
|
282
|
+
"region" to region,
|
|
283
|
+
"timezone" to timezone,
|
|
284
|
+
"sdk_version" to sdkVersion,
|
|
285
|
+
"sdk_platform" to sdkPlatform
|
|
286
|
+
)
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Get the full OS string (e.g., "Android 13")
|
|
291
|
+
*/
|
|
292
|
+
val fullOSString: String
|
|
293
|
+
get() = "$osName $osVersion"
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Get screen dimensions string (e.g., "1080x1920")
|
|
297
|
+
*/
|
|
298
|
+
val screenDimensionsString: String
|
|
299
|
+
get() = "${screenWidth}x$screenHeight"
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Data class for including device context in analytics events
|
|
304
|
+
*/
|
|
305
|
+
@JsonClass(generateAdapter = true)
|
|
306
|
+
internal data class DeviceContextData(
|
|
307
|
+
@Json(name = "device_type")
|
|
308
|
+
val deviceType: String,
|
|
309
|
+
|
|
310
|
+
@Json(name = "device_manufacturer")
|
|
311
|
+
val deviceManufacturer: String,
|
|
312
|
+
|
|
313
|
+
@Json(name = "device_model")
|
|
314
|
+
val deviceModel: String,
|
|
315
|
+
|
|
316
|
+
@Json(name = "os_name")
|
|
317
|
+
val osName: String,
|
|
318
|
+
|
|
319
|
+
@Json(name = "os_version")
|
|
320
|
+
val osVersion: String,
|
|
321
|
+
|
|
322
|
+
@Json(name = "api_level")
|
|
323
|
+
val apiLevel: Int,
|
|
324
|
+
|
|
325
|
+
@Json(name = "screen_width")
|
|
326
|
+
val screenWidth: Int,
|
|
327
|
+
|
|
328
|
+
@Json(name = "screen_height")
|
|
329
|
+
val screenHeight: Int,
|
|
330
|
+
|
|
331
|
+
@Json(name = "app_package_name")
|
|
332
|
+
val appPackageName: String,
|
|
333
|
+
|
|
334
|
+
@Json(name = "app_name")
|
|
335
|
+
val appName: String,
|
|
336
|
+
|
|
337
|
+
@Json(name = "app_version")
|
|
338
|
+
val appVersion: String,
|
|
339
|
+
|
|
340
|
+
@Json(name = "language_code")
|
|
341
|
+
val languageCode: String,
|
|
342
|
+
|
|
343
|
+
@Json(name = "country_code")
|
|
344
|
+
val countryCode: String,
|
|
345
|
+
|
|
346
|
+
@Json(name = "region")
|
|
347
|
+
val region: String,
|
|
348
|
+
|
|
349
|
+
@Json(name = "timezone")
|
|
350
|
+
val timezone: String,
|
|
351
|
+
|
|
352
|
+
@Json(name = "sdk_version")
|
|
353
|
+
val sdkVersion: String,
|
|
354
|
+
|
|
355
|
+
@Json(name = "sdk_platform")
|
|
356
|
+
val sdkPlatform: String
|
|
357
|
+
) {
|
|
358
|
+
companion object {
|
|
359
|
+
/**
|
|
360
|
+
* Create from the DeviceContext singleton
|
|
361
|
+
*/
|
|
362
|
+
fun fromInstance(): DeviceContextData {
|
|
363
|
+
val ctx = DeviceContext.getInstance()
|
|
364
|
+
return DeviceContextData(
|
|
365
|
+
deviceType = ctx.deviceType,
|
|
366
|
+
deviceManufacturer = ctx.deviceManufacturer,
|
|
367
|
+
deviceModel = ctx.deviceModel,
|
|
368
|
+
osName = ctx.osName,
|
|
369
|
+
osVersion = ctx.osVersion,
|
|
370
|
+
apiLevel = ctx.apiLevel,
|
|
371
|
+
screenWidth = ctx.screenWidth,
|
|
372
|
+
screenHeight = ctx.screenHeight,
|
|
373
|
+
appPackageName = ctx.appPackageName,
|
|
374
|
+
appName = ctx.appName,
|
|
375
|
+
appVersion = ctx.appVersion,
|
|
376
|
+
languageCode = ctx.languageCode,
|
|
377
|
+
countryCode = ctx.countryCode,
|
|
378
|
+
region = ctx.region,
|
|
379
|
+
timezone = ctx.timezone,
|
|
380
|
+
sdkVersion = ctx.sdkVersion,
|
|
381
|
+
sdkPlatform = ctx.sdkPlatform
|
|
382
|
+
)
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
package com.bigcrunch.ads.core
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Internal callback interface for rewarded ad events
|
|
5
|
+
*
|
|
6
|
+
* Used by AdOrchestrator to communicate rewarded ad lifecycle events
|
|
7
|
+
* back to the public BigCrunchRewarded API.
|
|
8
|
+
*/
|
|
9
|
+
internal interface RewardedCallback {
|
|
10
|
+
/**
|
|
11
|
+
* Called when a rewarded ad has been successfully loaded
|
|
12
|
+
*/
|
|
13
|
+
fun onAdLoaded()
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Called when a rewarded ad fails to load
|
|
17
|
+
* @param error Description of the failure
|
|
18
|
+
*/
|
|
19
|
+
fun onAdFailedToLoad(error: String)
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Called when the rewarded ad is shown
|
|
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
|
|
38
|
+
* @param type The type of reward earned
|
|
39
|
+
* @param amount The amount of reward
|
|
40
|
+
*/
|
|
41
|
+
fun onUserEarnedReward(type: String, amount: Int)
|
|
42
|
+
}
|