@takeoffmedia/react-native-penthera 0.2.59 → 0.2.60
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.
|
@@ -22,6 +22,9 @@ class AssetQueueObserver(mOfflineVideo : OfflineVideoEngine, virtuoso: Virtuoso)
|
|
|
22
22
|
override fun engineStartedDownloadingAsset(aAsset: IIdentifier) {
|
|
23
23
|
val updateAsset = aAsset as IAsset
|
|
24
24
|
val assetId = updateAsset.assetId
|
|
25
|
+
if (!mOfflineVideo.assetId.contains(assetId)) {
|
|
26
|
+
mOfflineVideo.assetId.add(assetId)
|
|
27
|
+
}
|
|
25
28
|
lastProgress = -1
|
|
26
29
|
updateItem(aAsset, true)
|
|
27
30
|
EventEmitter.sharedInstance.dispatch("penthera", PentheraEvent.DID_START_DOWNLOADING, assetId, "")
|
|
@@ -66,8 +69,6 @@ class AssetQueueObserver(mOfflineVideo : OfflineVideoEngine, virtuoso: Virtuoso)
|
|
|
66
69
|
// Progress is for catalog item
|
|
67
70
|
if (assetId.isNotEmpty() && assetId in mOfflineVideo.assetId) {
|
|
68
71
|
//update our asset status
|
|
69
|
-
//mActivity.runOnUiThread{ updateItemStatus(updateAsset, forceUpdate) }
|
|
70
|
-
//mOfflineVideo { updateItemStatus(updateAsset, forceUpdate) }
|
|
71
72
|
updateItemStatus(updateAsset, forceUpdate)
|
|
72
73
|
}
|
|
73
74
|
}
|
package/android/src/main/java/com/takeoffmediareactnativepenthera/virtuoso/OfflineVideoEngine.kt
CHANGED
|
@@ -69,36 +69,36 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
fun setup(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
72
|
+
userId: String,
|
|
73
|
+
backplaneUrl: String,
|
|
74
|
+
publicKey: String,
|
|
75
|
+
privateKey: String,
|
|
76
|
+
activity: Activity,
|
|
77
|
+
promise: Promise,
|
|
78
|
+
) {
|
|
79
|
+
val vir = getVirtuoso(activity)
|
|
80
|
+
|
|
81
|
+
val nameDevice = android.os.Build.MODEL
|
|
82
|
+
|
|
83
|
+
vir.startup(
|
|
84
|
+
URL(backplaneUrl),
|
|
85
|
+
userId,
|
|
85
86
|
nameDevice,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
87
|
+
publicKey,
|
|
88
|
+
privateKey,
|
|
89
|
+
object : IPushRegistrationObserver {
|
|
90
|
+
override fun onServiceAvailabilityResponse(
|
|
91
|
+
pushService: Int,
|
|
92
|
+
errorCode: Int
|
|
93
|
+
) {
|
|
94
|
+
//callback for push registration. this will be detailed in subsequent tutorials
|
|
95
|
+
}
|
|
94
96
|
}
|
|
97
|
+
).let {
|
|
98
|
+
promise.resolve("Penthera initialization successfully")
|
|
95
99
|
}
|
|
96
|
-
)
|
|
97
|
-
return promise.resolve("Penthera initialization successfully")
|
|
98
|
-
}
|
|
99
|
-
return promise.resolve("Penthera initialization failed")
|
|
100
|
-
}
|
|
101
100
|
|
|
101
|
+
}
|
|
102
102
|
|
|
103
103
|
fun downloadAsset(newItem: String) {
|
|
104
104
|
val data = JSONObject(newItem)
|