@takeoffmedia/react-native-penthera 0.6.1 → 0.7.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.
@@ -81,9 +81,9 @@ dependencies {
81
81
  implementation "com.facebook.react:react-native:+"
82
82
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
83
83
  //penthera
84
- implementation 'com.penthera:cnc-android-sdk:5.4.4'
84
+ implementation 'com.penthera:cnc-android-sdk:5.4.5'
85
85
  implementation 'com.google.code.gson:gson:2.10.1'
86
- implementation 'com.penthera:cnc-android-bitmovin-support:5.4.3'
86
+ implementation 'com.penthera:cnc-android-bitmovin-support:5.4.5'
87
87
 
88
88
  implementation 'com.bitmovin.player:player:3.38.2'
89
89
  implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
@@ -257,9 +257,46 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
257
257
 
258
258
  @SuppressLint("ShowToast")
259
259
  override fun complete(asset: ISegmentedAsset?, error: Int, addedToQueue: Boolean) {
260
+ if (!addedToQueue) {
261
+ if (asset == null) {
262
+ EventEmitter.sharedInstance.dispatch(
263
+ "penthera",
264
+ PentheraEvent.ERROR_DOWNLOAD,
265
+ "unknown_mediaId",
266
+ "Asset is null"
267
+ )
268
+ return
269
+ }
270
+ val body: String
271
+ val status = asset.downloadStatus
272
+ body = when (status) {
273
+ // Max simultaneous downloaded assets across account: 10
274
+ Common.AssetStatus.DOWNLOAD_DENIED_ACCOUNT -> {
275
+ PentheraErrors.DOWNLOAD_DENIED_MAX_DEVICE_DOWNLOADS
276
+ }
277
+ // Max simultaneous copies of an asset across account: 1
278
+ Common.AssetStatus.DOWNLOAD_DENIED_COPIES -> {
279
+ PentheraErrors.DOWNLOAD_DENIED_COPIES
280
+ }
281
+ // Max simultaneous download-enabled devices per account: 5
282
+ Common.AssetStatus.DOWNLOAD_DENIED_ASSET -> {
283
+ PentheraErrors.DOWNLOAD_DENIED_ASSET
284
+ }
285
+ else -> {
286
+ error.toString()
287
+ }
288
+ }
289
+ val metadata = JSONObject((asset as VirtuosoSegmentedFile).metadata)
290
+ val mediaId = if (metadata.has("mediaId")) metadata["mediaId"] as String else asset.assetId
291
+ EventEmitter.sharedInstance.dispatch(
292
+ "penthera",
293
+ PentheraEvent.ERROR_DOWNLOAD,
294
+ mediaId,
295
+ body
296
+ )
297
+ }
260
298
  }
261
- }
262
-
299
+ }
263
300
  fun deleteMany(assetIds: ReadableArray, promise: Promise) {
264
301
  val assetManager = virtuoso.assetManager
265
302
  val result = Arguments.createMap()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeoffmedia/react-native-penthera",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "description": "test",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -89,7 +89,6 @@
89
89
  "engines": {
90
90
  "node": ">= 16.0.0"
91
91
  },
92
- "packageManager": "^yarn@1.22.15",
93
92
  "jest": {
94
93
  "preset": "react-native",
95
94
  "modulePathIgnorePatterns": [
@@ -166,4 +165,4 @@
166
165
  "dependencies": {
167
166
  "zustand": "^4.4.0"
168
167
  }
169
- }
168
+ }