@takeoffmedia/react-native-penthera 0.2.51 → 0.2.53

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.
@@ -3,7 +3,6 @@ package com.takeoffmediareactnativepenthera
3
3
  import android.util.Log
4
4
  import com.penthera.common.Common
5
5
  import com.penthera.virtuososdk.client.IAsset
6
- import com.penthera.virtuososdk.client.IAssetManager
7
6
  import com.penthera.virtuososdk.client.IIdentifier
8
7
  import com.penthera.virtuososdk.client.Observers
9
8
  import com.penthera.virtuososdk.client.Virtuoso
@@ -34,16 +33,13 @@ class AssetQueueObserver(mOfflineVideo : OfflineVideoEngine, virtuoso: Virtuoso)
34
33
  val assetId = updateAsset.assetId
35
34
  updateItem(aAsset, true)
36
35
  EventEmitter.sharedInstance.dispatch("penthera", PentheraEvent.DOWNLOAD_COMPLETE, assetId, "")
37
-
36
+ mOfflineVideo.assetId.remove(assetId)
38
37
  }
39
38
 
40
39
  override fun engineEncounteredErrorDownloadingAsset(aAsset: IIdentifier) {
41
40
  var asset = aAsset as IAsset
42
- var limit = asset.assetDownloadLimit
43
- if(limit == -1 || limit == 0){
44
- EventEmitter.sharedInstance.dispatch("penthera", PentheraEvent.ERROR_DOWNLOAD, asset.assetId, PentheraErrors.DOWNLOAD_DENIED_MAX_DEVICE_DOWNLOADS)
45
- }
46
41
  Log.e("MiModulo","<<<<<<<<<<engineEncounteredErrorDownloadingAsset>>>>>>>>>>>>")
42
+ updateItemStatus(asset, false)
47
43
  // The base implementation does nothing. See class documentation.
48
44
  }
49
45
 
@@ -65,7 +61,7 @@ class AssetQueueObserver(mOfflineVideo : OfflineVideoEngine, virtuoso: Virtuoso)
65
61
  val assetId = updateAsset.assetId
66
62
 
67
63
  // Progress is for catalog item
68
- if (assetId.isNotEmpty() && mOfflineVideo.assetId == assetId) {
64
+ if (assetId.isNotEmpty() && assetId in mOfflineVideo.assetId) {
69
65
  //update our asset status
70
66
  //mActivity.runOnUiThread{ updateItemStatus(updateAsset, forceUpdate) }
71
67
  //mOfflineVideo { updateItemStatus(updateAsset, forceUpdate) }
@@ -77,11 +73,11 @@ class AssetQueueObserver(mOfflineVideo : OfflineVideoEngine, virtuoso: Virtuoso)
77
73
  Log.e("MiModulo","<<<<<<<<<<updateItemStatus>>>>>>>>>>>>")
78
74
 
79
75
  asset?.let{
80
- if(mOfflineVideo.assetId == it.assetId){
76
+ if(it.assetId in mOfflineVideo.assetId){
81
77
  mOfflineVideo.asset = asset
82
78
 
83
79
  var progress = (asset.fractionComplete * 100.0).toInt()
84
- EventEmitter.sharedInstance.dispatch("penthera", PentheraEvent.PROGRESS_UPDATED, it.assetId, progress.toString())
80
+
85
81
  if (forceUpdate || progress != lastProgress) {
86
82
  val assetStatus : String
87
83
  val value: String
@@ -93,25 +89,30 @@ class AssetQueueObserver(mOfflineVideo : OfflineVideoEngine, virtuoso: Virtuoso)
93
89
  assetStatus = "Downloading"
94
90
  value = "downloading"
95
91
  }
96
- Common.AssetStatus.DOWNLOAD_DENIED_ASSET -> {
97
- assetStatus = "Queued"
98
- value = ""
92
+ Common.AssetStatus.DOWNLOAD_COMPLETE -> {
93
+ assetStatus = "complete"
94
+ value = "complete"
99
95
  }
100
- Common.AssetStatus.DOWNLOAD_DENIED_MAX_DEVICE_DOWNLOADS -> {
101
- assetStatus = "Queued"
102
- value = PentheraErrors.DOWNLOAD_DENIED_ASSET
96
+ // Max simultaneous downloaded assets across account: 10
97
+ Common.AssetStatus.DOWNLOAD_DENIED_ACCOUNT -> {
98
+ assetStatus = "Error"
99
+ value = PentheraErrors.DOWNLOAD_DENIED_MAX_DEVICE_DOWNLOADS
103
100
  }
101
+ // Max simultaneous copies of an asset across account: 1
104
102
  Common.AssetStatus.DOWNLOAD_DENIED_COPIES -> {
105
- assetStatus = "Queued"
103
+ assetStatus = "Error"
106
104
  value = PentheraErrors.DOWNLOAD_DENIED_COPIES
107
105
  }
108
- Common.AssetStatus.DOWNLOAD_COMPLETE -> {
109
- assetStatus = "complete"
110
- value = "complete"
106
+ //Max simultaneous download-enabled devices per account: 5
107
+ Common.AssetStatus.DOWNLOAD_DENIED_ASSET -> {
108
+ assetStatus = "Error"
109
+ value = PentheraErrors.DOWNLOAD_DENIED_ASSET
111
110
  }
111
+
112
+
112
113
  else -> {
113
114
  if(allowableStorageRemaining == 0L) {
114
- assetStatus = "Queued"
115
+ assetStatus = "Error"
115
116
  value = "Insufficient storage for download"
116
117
  } else {
117
118
  assetStatus = "Queued"
@@ -119,9 +120,11 @@ class AssetQueueObserver(mOfflineVideo : OfflineVideoEngine, virtuoso: Virtuoso)
119
120
  }
120
121
  }
121
122
  }
122
- val hasError = assetStatus !== "Downloading" && assetStatus !== "complete"
123
+ val hasError = assetStatus == "Error"
123
124
  if(hasError){
124
125
  EventEmitter.sharedInstance.dispatch("penthera", PentheraEvent.ERROR_DOWNLOAD, it.assetId, value)
126
+ } else if(assetStatus == "Downloading") {
127
+ EventEmitter.sharedInstance.dispatch("penthera", PentheraEvent.PROGRESS_UPDATED, it.assetId, progress.toString())
125
128
  }
126
129
  }
127
130
  }
@@ -42,7 +42,7 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
42
42
  private lateinit var queueObserver: AssetQueueObserver
43
43
 
44
44
  var asset: IAsset? = null
45
- var assetId: String = ""
45
+ var assetId: MutableList<String> = mutableListOf()
46
46
  private val gson = Gson()
47
47
 
48
48
  private val enginePauseObserver: Observers.IEngineObserver = object : EngineObserver() {
@@ -106,8 +106,8 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
106
106
  fun downloadAsset(newItem: String, activity: Activity) {
107
107
  val data = JSONObject(newItem)
108
108
  val item = data["item"] as JSONObject
109
+ assetId.add(item["id"].toString())
109
110
  val url = data["url"].toString()
110
- assetId = item["id"].toString()
111
111
  val metadata = item.toString()
112
112
  val fileList: MutableList<AncillaryFile> = ArrayList()
113
113
  val static = item["static"] as JSONObject
@@ -147,7 +147,7 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
147
147
  }
148
148
 
149
149
  val params = MPDAssetBuilder().apply {
150
- assetId(assetId)
150
+ assetId(item["id"].toString())
151
151
  manifestUrl(URL(url))
152
152
  assetObserver(AssetParseObserver(context))
153
153
  addToQueue(true)
@@ -259,15 +259,17 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
259
259
  val result = Arguments.createMap()
260
260
 
261
261
  for (i in 0 until assetIds.size()) {
262
- val assetId = assetIds.getString(i)
263
- val asset = assetManager.getByAssetId(assetId)
262
+ val idValue = assetIds.getString(i)
263
+ val asset = assetManager.getByAssetId(idValue)
264
264
  .firstOrNull() as? IAsset
265
265
 
266
266
  if (asset != null) {
267
267
  assetManager.delete(asset)
268
- result.putBoolean(assetId, true)
268
+ result.putBoolean(idValue, true)
269
+ assetId.remove(idValue)
269
270
  } else {
270
- result.putBoolean(assetId, false)
271
+ result.putBoolean(idValue, false)
272
+ assetId.remove(idValue)
271
273
  }
272
274
  }
273
275
 
@@ -1,7 +1,9 @@
1
1
  package com.takeoffmediareactnativepenthera.virtuoso.errors
2
2
 
3
3
  object PentheraErrors {
4
- const val DOWNLOAD_DENIED_ASSET = "The asset has already been downloaded as many times as permitted. To download this asset again, administrative action is required."
5
- const val DOWNLOAD_DENIED_COPIES = "There are already as many downloaded copies of this asset as permitted on this account. To continue downloading, the user must delete a copy of this asset from one of their devices."
6
4
  const val DOWNLOAD_DENIED_MAX_DEVICE_DOWNLOADS = "There are already as many downloads as permitted on this account. To continue downloading, the user must delete downloaded assets from one of their devices."
5
+ const val DOWNLOAD_DENIED_COPIES = "There are already as many downloaded copies of this asset as permitted on this account. To continue downloading, the user must delete a copy of this asset from one of their devices."
6
+ const val DOWNLOAD_DENIED_ASSET = "The asset has already been downloaded as many times as permitted. To download this asset again, administrative action is required."
7
+
8
+
7
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeoffmedia/react-native-penthera",
3
- "version": "0.2.51",
3
+ "version": "0.2.53",
4
4
  "description": "test",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -166,4 +166,4 @@
166
166
  "dependencies": {
167
167
  "zustand": "^4.4.0"
168
168
  }
169
- }
169
+ }
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Workspace
3
- version = "1.0">
4
- <FileRef
5
- location = "self:">
6
- </FileRef>
7
- </Workspace>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>IDEDidComputeMac32BitWarning</key>
6
- <true/>
7
- </dict>
8
- </plist>
@@ -1,104 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Bucket
3
- uuid = "3AE98629-7421-4561-B12C-C06B8B6A3023"
4
- type = "1"
5
- version = "2.0">
6
- <Breakpoints>
7
- <BreakpointProxy
8
- BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
9
- <BreakpointContent
10
- uuid = "A5D166B0-3C57-4F4D-A845-BDB81498DA0F"
11
- shouldBeEnabled = "No"
12
- ignoreCount = "0"
13
- continueAfterRunningActions = "No"
14
- filePath = "Penthera.swift"
15
- startingColumnNumber = "9223372036854775807"
16
- endingColumnNumber = "9223372036854775807"
17
- startingLineNumber = "18"
18
- endingLineNumber = "18"
19
- landmarkName = "Penthera"
20
- landmarkType = "3">
21
- </BreakpointContent>
22
- </BreakpointProxy>
23
- <BreakpointProxy
24
- BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
25
- <BreakpointContent
26
- uuid = "5D7AE47B-D5FC-4468-A75B-C414F3F8A58C"
27
- shouldBeEnabled = "No"
28
- ignoreCount = "0"
29
- continueAfterRunningActions = "No"
30
- filePath = "Penthera.swift"
31
- startingColumnNumber = "9223372036854775807"
32
- endingColumnNumber = "9223372036854775807"
33
- startingLineNumber = "25"
34
- endingLineNumber = "25"
35
- landmarkName = "updateStatusInfo()"
36
- landmarkType = "7">
37
- </BreakpointContent>
38
- </BreakpointProxy>
39
- <BreakpointProxy
40
- BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
41
- <BreakpointContent
42
- uuid = "E3C50B30-46CF-4D56-8C49-C257C70E0ACC"
43
- shouldBeEnabled = "No"
44
- ignoreCount = "0"
45
- continueAfterRunningActions = "No"
46
- filePath = "Penthera.swift"
47
- startingColumnNumber = "9223372036854775807"
48
- endingColumnNumber = "9223372036854775807"
49
- startingLineNumber = "26"
50
- endingLineNumber = "26"
51
- landmarkName = "updateStatusInfo()"
52
- landmarkType = "7">
53
- </BreakpointContent>
54
- </BreakpointProxy>
55
- <BreakpointProxy
56
- BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
57
- <BreakpointContent
58
- uuid = "75EF43BF-56FF-4727-B372-E1A0EBC02C61"
59
- shouldBeEnabled = "Yes"
60
- ignoreCount = "0"
61
- continueAfterRunningActions = "No"
62
- filePath = "Penthera.swift"
63
- startingColumnNumber = "9223372036854775807"
64
- endingColumnNumber = "9223372036854775807"
65
- startingLineNumber = "101"
66
- endingLineNumber = "101"
67
- landmarkName = "initializeSdk(user:backplaneUrl:publicKey:privateKey:resolve:reject:)"
68
- landmarkType = "7">
69
- </BreakpointContent>
70
- </BreakpointProxy>
71
- <BreakpointProxy
72
- BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
73
- <BreakpointContent
74
- uuid = "EF36B51B-4FC2-4989-A791-180E3212EFE3"
75
- shouldBeEnabled = "Yes"
76
- ignoreCount = "0"
77
- continueAfterRunningActions = "No"
78
- filePath = "Penthera.swift"
79
- startingColumnNumber = "9223372036854775807"
80
- endingColumnNumber = "9223372036854775807"
81
- startingLineNumber = "149"
82
- endingLineNumber = "149"
83
- landmarkName = "getDownloadedAsset(assetID:)"
84
- landmarkType = "7">
85
- </BreakpointContent>
86
- </BreakpointProxy>
87
- <BreakpointProxy
88
- BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
89
- <BreakpointContent
90
- uuid = "C467C00E-2428-4D24-843A-E7CDF28CB553"
91
- shouldBeEnabled = "Yes"
92
- ignoreCount = "0"
93
- continueAfterRunningActions = "No"
94
- filePath = "Penthera.swift"
95
- startingColumnNumber = "9223372036854775807"
96
- endingColumnNumber = "9223372036854775807"
97
- startingLineNumber = "148"
98
- endingLineNumber = "148"
99
- landmarkName = "getDownloadedAsset(assetID:)"
100
- landmarkType = "7">
101
- </BreakpointContent>
102
- </BreakpointProxy>
103
- </Breakpoints>
104
- </Bucket>
@@ -1,14 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>SchemeUserState</key>
6
- <dict>
7
- <key>Penthera.xcscheme_^#shared#^_</key>
8
- <dict>
9
- <key>orderHint</key>
10
- <integer>0</integer>
11
- </dict>
12
- </dict>
13
- </dict>
14
- </plist>