@takeoffmedia/react-native-penthera 0.4.7 → 0.4.9

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.
@@ -11,24 +11,10 @@
11
11
  android:supportsRtl="true"
12
12
  android:theme="@style/AppTheme">
13
13
 
14
- <!-- The below two meta data values will be provided by penthera. Add these to the manifest
15
- rather than the code -->
16
- <meta-data
17
- android:name="PENTHERA_PUBLIC_KEY"
18
- android:value="${pentheraPublicKey}"
19
- />
20
- <meta-data
21
- android:name="PENTHERA_SERVER_URL"
22
- android:value="${pentheraServerUrl}"
23
- />
24
-
25
- <meta-data android:name="com.penthera.virtuososdk.notification.provider.impl"
26
- android:value="com.takeoffmediareactnativepenthera.virtuoso.notification.ServiceForegroundNotificationProvider" />
14
+ <meta-data android:name="com.penthera.virtuososdk.notification.provider.impl" android:value="com.takeoffmediareactnativepenthera.virtuoso.notification.ServiceForegroundNotificationProvider" />
27
15
 
28
16
  <!-- Meta Data to configure license manager for DRM -->
29
- <meta-data tools:replace="android:value"
30
- android:name="com.penthera.virtuososdk.license.manager.impl"
31
- android:value="com.takeoffmediareactnativepenthera.virtuoso.DemoLicenseManager" />
17
+ <meta-data tools:replace="android:value" android:name="com.penthera.virtuososdk.license.manager.impl" android:value="com.takeoffmediareactnativepenthera.virtuoso.DemoLicenseManager"/>
32
18
 
33
19
  <!-- Service Starter -->
34
20
  <receiver android:name=".virtuoso.ServiceStarter"
@@ -37,14 +23,14 @@
37
23
  android:label="SDKDemoKotlin Service Starter"
38
24
  android:directBootAware="true">
39
25
  <intent-filter>
40
- <action android:name="android.intent.action.BOOT_COMPLETED" />
41
- <action android:name="android.intent.action.QUICKBOOT_POWERON" />
42
- <action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
26
+ <action android:name="android.intent.action.BOOT_COMPLETED"/>
27
+ <action android:name="android.intent.action.QUICKBOOT_POWERON"/>
28
+ <action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
43
29
  <action android:name="android.intent.action.PACKAGE_REMOVED" />
44
- <data android:scheme="package" />
30
+ <data android:scheme="package"/>
45
31
  </intent-filter>
46
32
  <intent-filter>
47
- <action android:name="android.intent.action.BOOT_COMPLETED" />
33
+ <action android:name="android.intent.action.BOOT_COMPLETED"/>
48
34
  <category android:name="android.intent.category.DEFAULT" />
49
35
  </intent-filter>
50
36
 
@@ -58,7 +44,7 @@
58
44
  <provider
59
45
  android:name="com.takeoffmediareactnativepenthera.virtuoso.PentheraContentProvider"
60
46
  android:authorities="${applicationId}.virtuoso.provider"
61
- android:process=":vservice" />
47
+ android:process=":vservice"/>
62
48
 
63
49
  </application>
64
50
 
@@ -206,10 +206,7 @@ class NotificationFactory(private val applicationName: String) {
206
206
  PAUSED_NOTIFICATION -> title += "paused downloads."
207
207
 
208
208
  //RESTART_NOTIFICATION -> title += "is starting up..."
209
- RESTART_NOTIFICATION -> {
210
- title = ""
211
- Log.d(TAG_DEV, "RESTART_NOTIFICATION")
212
- }
209
+ RESTART_NOTIFICATION -> Log.d(TAG_DEV, "RESTART_NOTIFICATION")
213
210
 
214
211
  FAILED_NOTIFICATION -> title += " asset could not be queued"
215
212
  }
@@ -240,22 +237,17 @@ class NotificationFactory(private val applicationName: String) {
240
237
 
241
238
  }
242
239
 
243
- val launchNotification = NotificationCompat.Builder(context, channelId())
244
- .setSmallIcon(R.drawable.small_logo)
245
- .setContentTitle(title)
246
- .setContentIntent(pendingIntent)
247
- .setColor(ContextCompat.getColor(getApplicationContext(), R.color.primary))
248
- .setContentText(contentText)
249
- .apply {
250
- if (progress >= 0) {
251
- setProgress(100, progress, false)
252
- }
253
- setWhen(System.currentTimeMillis())
254
- setOngoing(true)
255
- }
256
- .build()
257
-
258
- return launchNotification
240
+ return compatNotificationBuilder!!.apply {
241
+ setSmallIcon(R.drawable.small_logo)
242
+ setContentTitle(title)
243
+ setContentIntent(pendingIntent)
244
+ // The color of notification. This requires Android 21 or higher.
245
+ color = ContextCompat.getColor(getApplicationContext(), R.color.primary)
246
+ setContentText(contentText)
247
+ if(progress >= 0)setProgress(100, progress, false)
248
+ setWhen(System.currentTimeMillis())
249
+ setOngoing(true)
250
+ }.build()
259
251
 
260
252
  }
261
253
 
@@ -47,6 +47,7 @@ class ServiceForegroundNotificationProvider : IForegroundNotificationProvider{
47
47
  * @return true if the notification should be updated, false otherwise.
48
48
  */
49
49
  override fun shouldUpdateForegroundServiceNotificationOnIntent(context: Context?, reasonIntent: Intent?): Boolean {
50
+
50
51
  if(context != null) {
51
52
  reasonIntent?.let {
52
53
  val action = it.action
@@ -72,13 +73,9 @@ class ServiceForegroundNotificationProvider : IForegroundNotificationProvider{
72
73
  return
73
74
  }
74
75
  val manager = context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
75
- val titleNotification = notification?.extras?.getString("android.title")
76
- if(!titleNotification?.isEmpty()!!){
77
- notificationChannel = manager.getNotificationChannel(channelId)
78
- this.channelId = channelId
79
- currentNotification = notification
80
- }else {
81
- }
76
+ notificationChannel = manager.getNotificationChannel(channelId)
77
+ this.channelId = channelId
78
+ currentNotification = notification
82
79
  } else {
83
80
  currentNotification = notification
84
81
  }
@@ -92,11 +89,11 @@ class ServiceForegroundNotificationProvider : IForegroundNotificationProvider{
92
89
  * @return The notification
93
90
  */
94
91
  override fun getForegroundServiceNotification(context: Context?, file: IAsset?, reasonIntent: Intent?): Notification {
95
- if (reasonIntent == null) return currentNotification!!
96
-
97
- //Name notification channel
98
- currentNotification = NotificationFactory("Britbox").getNotification(context!!, reasonIntent )
99
-
92
+ // if (reasonIntent == null) return currentNotification!!
93
+ //
94
+ // //Name notification channel
95
+ // currentNotification = NotificationFactory("Britbox").getNotification(context!!, reasonIntent )
96
+ //
100
97
  return currentNotification!!
101
98
  }
102
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeoffmedia/react-native-penthera",
3
- "version": "0.4.7",
3
+ "version": "0.4.9",
4
4
  "description": "test",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",