@takeoffmedia/react-native-penthera 0.2.48 → 0.2.49

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.
@@ -5,9 +5,7 @@ import android.app.Activity
5
5
  import android.content.Context
6
6
  import android.util.Log
7
7
  import android.widget.Toast
8
- import com.bitmovin.player.api.ui.StyleConfig
9
8
  import com.bitmovin.player.reactnative.PlayerModule
10
- import com.bitmovin.player.reactnative.extensions.setProperty
11
9
 
12
10
  import com.facebook.react.bridge.ReactApplicationContext
13
11
  import com.google.gson.Gson
@@ -31,7 +29,9 @@ import com.facebook.react.bridge.Promise
31
29
  import com.facebook.react.bridge.ReadableArray
32
30
  import com.penthera.virtuososdk.client.AncillaryFile
33
31
  import org.json.JSONObject
34
- import java.util.Arrays
32
+ import java.text.SimpleDateFormat
33
+ import java.util.Calendar
34
+ import java.util.TimeZone
35
35
 
36
36
  class OfflineVideoEngine(private val context: ReactApplicationContext) {
37
37
 
@@ -154,6 +154,8 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
154
154
  while (cursor?.moveToNext() == true && columnNames != null) {
155
155
  val assetManager = virtuoso.assetManager
156
156
  val dataMap = mutableMapOf<String, Any>()
157
+ var eap = ""
158
+ var ead = ""
157
159
  for (columnName in columnNames) {
158
160
  val columnIndex = cursor.getColumnIndex(columnName)
159
161
  if (columnIndex >= 0) {
@@ -180,6 +182,20 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
180
182
  put("estimatedSize", value)
181
183
  }
182
184
  }
185
+ if (columnName == "ead") {
186
+ ead = value
187
+ }
188
+ if (columnName == "eap") {
189
+ eap = value
190
+ }
191
+ if (columnName == "firstPlayTime") {
192
+ var eadFormated = dateToString(ead)
193
+ var eapFormated = dateToString(eap)
194
+ dataMap["data"] = (dataMap["data"] as? MutableMap<String, Any> ?: mutableMapOf()).apply {
195
+ put("effectiveExpiryDate", if (value == "0") eadFormated else eapFormated)
196
+ }
197
+ }
198
+
183
199
  }
184
200
  }
185
201
  dataMap["isCompleted"] = dataMap["currentSize"] == dataMap["expectedSize"]
@@ -191,21 +207,30 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
191
207
  return gson.toJson(completedList)
192
208
  }
193
209
 
210
+ private fun dateToString(seconds: String): String {
211
+ val secondsLong = seconds.toLong()
212
+ val calendar = Calendar.getInstance()
213
+ calendar.add(Calendar.SECOND, secondsLong.toInt())
214
+
215
+ val dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
216
+ return dateFormat.format(calendar.time)
217
+ }
218
+
194
219
  class AssetParseObserver(activity: Context) : ISegmentedAssetFromParserObserver {
195
220
  private val mActivity: Context = activity
196
221
 
197
222
  @SuppressLint("ShowToast")
198
223
  override fun complete(asset: ISegmentedAsset?, error: Int, addedToQueue: Boolean) {
199
-
200
- if (asset != null) {
201
- Toast.makeText(
202
- mActivity,
203
- "Asset parsed and " + if (addedToQueue) "added" else "not added" + "to download queue",
204
- Toast.LENGTH_LONG
205
- ).show()
206
- } else {
207
- Toast.makeText(mActivity, "Error $error while parsing asset", Toast.LENGTH_LONG).show()
208
- }
224
+ // Show a process when the asset to parsed and added to queue
225
+ // if (asset != null) {
226
+ // Toast.makeText(
227
+ // mActivity,
228
+ // "Asset parsed and " + if (addedToQueue) "added" else "not added" + "to download queue",
229
+ // Toast.LENGTH_LONG
230
+ // ).show()
231
+ // } else {
232
+ // Toast.makeText(mActivity, "Error $error while parsing asset", Toast.LENGTH_LONG).show()
233
+ // }
209
234
  }
210
235
  }
211
236
 
@@ -251,7 +276,6 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
251
276
 
252
277
  fun updateUI() {}
253
278
 
254
-
255
279
  fun loadBitmovinSourceManager(assetId: String, nativeId: String): Boolean {
256
280
  virtuoso.assetManager?.getByAssetId(assetId)?.firstOrNull()?.let { asset ->
257
281
  val sourceManager = BitmovinSourceManager(context, asset as ISegmentedAsset)
@@ -259,7 +283,6 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
259
283
  val playerModule = context.getNativeModule(PlayerModule::class.java)
260
284
  if (playerModule != null && sourceItem != null) {
261
285
  val player = playerModule.getPlayer(nativeId)
262
-
263
286
  if (player != null) {
264
287
  player.load(sourceItem)
265
288
  return true
@@ -27,7 +27,8 @@ class ServiceStarter : VirtuosoServiceStarter() {
27
27
  }
28
28
 
29
29
  // This is a helper class which is used in the demo for creating the notifications
30
- private val notificationFactory: NotificationFactory = NotificationFactory("PentheraExample")
30
+ //Name notification channel
31
+ private val notificationFactory: NotificationFactory = NotificationFactory("Britbox")
31
32
 
32
33
  /**
33
34
  * This method will be called by the framework to request the generation of a notification,
@@ -62,4 +63,4 @@ class ServiceStarter : VirtuosoServiceStarter() {
62
63
  return ServiceForegroundNotificationProvider::class.java
63
64
  }
64
65
 
65
- }
66
+ }
@@ -91,8 +91,9 @@ class ServiceForegroundNotificationProvider : IForegroundNotificationProvider{
91
91
  override fun getForegroundServiceNotification(context: Context?, file: IAsset?, reasonIntent: Intent?): Notification {
92
92
  if (reasonIntent == null) return currentNotification!!
93
93
 
94
- currentNotification = NotificationFactory("PentheraExample").getNotification(context!!, reasonIntent )
94
+ //Name notification channel
95
+ currentNotification = NotificationFactory("Britbox").getNotification(context!!, reasonIntent )
95
96
 
96
97
  return currentNotification!!
97
98
  }
98
- }
99
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeoffmedia/react-native-penthera",
3
- "version": "0.2.48",
3
+ "version": "0.2.49",
4
4
  "description": "test",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -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>