@takeoffmedia/react-native-penthera 0.4.1 → 0.4.2

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.
@@ -20,6 +20,14 @@ class Penthera: RCTEventEmitter, VirtuosoDownloadEngineNotificationsDelegate {
20
20
  var assetError: String = ""
21
21
  var vcHttpServer: VirtuosoClientHTTPServer? = nil
22
22
 
23
+ func getAssetId(asset: VirtuosoAsset) -> String {
24
+ if let mediaId = asset.userInfo?["mediaId"] as? String {
25
+ return mediaId
26
+ } else {
27
+ return asset.assetID
28
+ }
29
+ }
30
+
23
31
  func updateStatusInfo() {
24
32
  DispatchQueue.global().async {
25
33
  let used = VirtuosoAsset.storageUsed()/1024/1024
@@ -38,7 +46,7 @@ class Penthera: RCTEventEmitter, VirtuosoDownloadEngineNotificationsDelegate {
38
46
  }
39
47
 
40
48
  if let currentAsset = self.currentAset {
41
- let assetId = currentAsset.assetID != "" ? currentAsset.assetID : currentAsset.userInfo?["mediaId"] as! String
49
+ let assetId = getAssetId(asset: currentAsset)
42
50
  if allowableStorageRemaining <= 0 {
43
51
  EventEmitter.sharedInstance.dispatch(
44
52
  name: "penthera",
@@ -166,14 +174,6 @@ class Penthera: RCTEventEmitter, VirtuosoDownloadEngineNotificationsDelegate {
166
174
  return asset
167
175
  }
168
176
 
169
- func getAssetId(asset: VirtuosoAsset) -> String {
170
- if let mediaId = asset.userInfo?["mediaId"] as? String {
171
- return mediaId
172
- } else {
173
- return asset.assetID
174
- }
175
- }
176
-
177
177
  public func downloadEngineDidStartDownloadingAsset(_ asset: VirtuosoAsset) {
178
178
  self.currentAset = asset
179
179
  self.assetError = ""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeoffmedia/react-native-penthera",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "test",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",