@takeoffmedia/react-native-penthera 0.4.9 → 0.5.1

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.
@@ -31,8 +31,6 @@ import org.json.JSONObject
31
31
  import java.io.IOException
32
32
  import java.net.MalformedURLException
33
33
  import java.net.URL
34
- import java.text.SimpleDateFormat
35
- import java.util.Calendar
36
34
  import com.penthera.common.Common
37
35
  import com.penthera.virtuososdk.client.IService
38
36
  import com.takeoffmediareactnativepenthera.EventEmitter
@@ -220,10 +218,8 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
220
218
  dataMap["isCompleted"] = isComplete
221
219
  }
222
220
  if (columnName == "firstPlayTime") {
223
- val eadFormated = dateToString(ead)
224
- val eapFormated = dateToString(eap)
225
221
  (dataMap["data"] as? MutableMap<String, Any> ?: mutableMapOf()).apply {
226
- put("effectiveExpiryDate", if (value == "0") eadFormated else eapFormated);
222
+ put("effectiveExpiryDate", if (value == "0") ead else eap);
227
223
  put("isReproduced", value != "0");
228
224
  }.also { dataMap["data"] = it }
229
225
  }
@@ -256,20 +252,6 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
256
252
  }
257
253
  }
258
254
 
259
- private fun dateToString(seconds: String): String {
260
- val dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
261
- return try {
262
- val secondsLong = seconds.toLong()
263
- Calendar.getInstance().let {
264
- it.add(Calendar.SECOND, secondsLong.toInt())
265
- dateFormat.format(it.time)
266
- }
267
- } catch (e: NumberFormatException) {
268
- // Handle the exception here, for example, return an empty string or throw the exception
269
- ""
270
- }
271
- }
272
-
273
255
  class AssetParseObserver(activity: Context) : ISegmentedAssetFromParserObserver {
274
256
  private val mActivity: Context = activity
275
257
 
@@ -28,7 +28,7 @@ class ServiceStarter : VirtuosoServiceStarter() {
28
28
 
29
29
  // This is a helper class which is used in the demo for creating the notifications
30
30
  //Name notification channel
31
- private val notificationFactory: NotificationFactory = NotificationFactory("Britbox")
31
+ // private val notificationFactory: NotificationFactory = NotificationFactory("Britbox")
32
32
 
33
33
  /**
34
34
  * This method will be called by the framework to request the generation of a notification,
@@ -47,7 +47,7 @@ class ServiceStarter : VirtuosoServiceStarter() {
47
47
  */
48
48
  override fun getForegroundServiceNotification(context: Context?, forIntent: Intent?): Notification {
49
49
 
50
- val notification = notificationFactory.getNotification(context!!, forIntent)
50
+ val notification = ServiceForegroundNotificationProvider().notificationFactory.getNotification(context!!, forIntent)
51
51
  if (notification != null) {
52
52
  currentNotification = notification
53
53
  }
@@ -29,6 +29,8 @@ class ServiceForegroundNotificationProvider : IForegroundNotificationProvider{
29
29
  private var notificationChannel: NotificationChannel? = null
30
30
  private var channelId: String? = null
31
31
  private var currentNotification: Notification? = null
32
+ //Name notification channel
33
+ val notificationFactory: NotificationFactory = NotificationFactory("Britbox")
32
34
 
33
35
 
34
36
  /**
@@ -89,11 +91,11 @@ class ServiceForegroundNotificationProvider : IForegroundNotificationProvider{
89
91
  * @return The notification
90
92
  */
91
93
  override fun getForegroundServiceNotification(context: Context?, file: IAsset?, reasonIntent: Intent?): Notification {
92
- // if (reasonIntent == null) return currentNotification!!
93
- //
94
- // //Name notification channel
95
- // currentNotification = NotificationFactory("Britbox").getNotification(context!!, reasonIntent )
96
- //
94
+ if (reasonIntent == null) return currentNotification!!
95
+
96
+ //Name notification channel
97
+ currentNotification = notificationFactory.getNotification(context!!, reasonIntent )
98
+
97
99
  return currentNotification!!
98
100
  }
99
101
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeoffmedia/react-native-penthera",
3
- "version": "0.4.9",
3
+ "version": "0.5.1",
4
4
  "description": "test",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",