@takeoffmedia/react-native-penthera 0.2.32 → 0.2.34

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.
@@ -39,7 +39,7 @@ class PentheraModule(reactContext: ReactApplicationContext) : ReactContextBaseJa
39
39
 
40
40
  @ReactMethod
41
41
  fun initializeSdk(user: String, backplaneUrl: String, publicKey: String, privateKey: String, promise: Promise) {
42
- promise.resolve(offlineVideoEngine?.setup(user, backplaneUrl, publicKey, privateKey, activity!!))
42
+ offlineVideoEngine?.setup(user, backplaneUrl, publicKey, privateKey, activity!!, promise)
43
43
  }
44
44
 
45
45
  @ReactMethod
@@ -35,6 +35,7 @@ import com.bitmovin.player.reactnative.SourceModule
35
35
  import com.bitmovin.player.reactnative.converter.JsonConverter
36
36
  import com.facebook.react.bridge.ReadableMap
37
37
  import com.facebook.react.uimanager.UIManagerModule
38
+ import com.facebook.react.bridge.Promise
38
39
 
39
40
  class OfflineVideoEngine(private val context: ReactApplicationContext) {
40
41
 
@@ -43,6 +44,7 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
43
44
 
44
45
  var asset: IAsset? = null
45
46
  var assetId: String = ""
47
+ private val gson = Gson()
46
48
 
47
49
  private val enginePauseObserver: Observers.IEngineObserver = object : EngineObserver() {
48
50
  override fun engineStatusChanged(status: Int) {
@@ -74,9 +76,9 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
74
76
  backplaneUrl: String,
75
77
  publicKey: String,
76
78
  privateKey: String,
77
- activity: Activity
78
- ): String {
79
- Log.e("MiModulo", "<<<<<<<<<<setup>>>>>>>>>>>>")
79
+ activity: Activity,
80
+ promise: Promise,
81
+ ): Unit {
80
82
  val backplane = getVirtuoso(activity)
81
83
  val status = backplane.backplane?.authenticationStatus
82
84
  if (status == AuthenticationStatus.NOT_AUTHENTICATED) {
@@ -97,14 +99,14 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
97
99
  }
98
100
  }
99
101
  )
100
- return "Penthera initialization successfully"
102
+ return promise.resolve("Penthera initialization successfully")
101
103
  }
102
- return "Penthera init yet"
104
+ return promise.resolve("Penthera initialization failed")
103
105
  }
104
106
 
105
107
 
106
108
  fun downloadAsset(data: String, activity: Activity) {
107
- val item = Gson().fromJson(data, Item::class.java)
109
+ val item = gson.fromJson(data, Item::class.java)
108
110
  assetId = item.assetId
109
111
  val params = MPDAssetBuilder().apply {
110
112
  assetId(item.assetId)
@@ -119,33 +121,37 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
119
121
  virtuoso!!.assetManager.createMPDSegmentedAssetAsync(params)
120
122
  }
121
123
 
122
- fun getDownloads(): String? {
123
- Log.e("MiModulo", "getDownloads")
124
+ fun getDownloads(): String? {
124
125
  val completedList = mutableListOf<MutableMap<String, Any>>()
125
126
  val cursor = virtuoso?.assetManager?.cursor
126
127
  val count = cursor?.count
128
+ if( count == 0){
129
+ cursor.close()
130
+ return gson.toJson(completedList)
131
+ }
127
132
  val columnNames = cursor?.columnNames
128
- while (cursor?.moveToNext() == true) {
129
- val dataMap = mutableMapOf<String, Any>()
130
- for (columnName in columnNames!!) {
131
- val columnIndex = cursor.getColumnIndex(columnName)
132
- if (columnIndex >= 0) {
133
- val value = cursor.getString(columnIndex)
134
- if (value != null) {
135
- dataMap[columnName] = value
136
- dataMap["isCompleted"] = true
137
- dataMap["isPaused"] = false
138
- }
139
- if(columnName == "assetId"){
140
- dataMap["id"] = value
133
+
134
+ while (cursor?.moveToNext() == true && columnNames != null) {
135
+ val dataMap = mutableMapOf<String, Any>()
136
+ for (columnName in columnNames) {
137
+ val columnIndex = cursor.getColumnIndex(columnName)
138
+ if (columnIndex >= 0) {
139
+ val value = cursor.getString(columnIndex)
140
+ if (value != null) {
141
+ dataMap[columnName] = value
142
+ dataMap["isCompleted"] = true
143
+ dataMap["isPaused"] = false
144
+ }
145
+ if (columnName == "assetId") {
146
+ dataMap["id"] = value
147
+ }
141
148
  }
142
149
  }
150
+ completedList.add(dataMap)
143
151
  }
144
- completedList.add(dataMap)
145
- }
146
-
147
- return Gson().toJson(completedList)
152
+ cursor?.close()
148
153
 
154
+ return gson.toJson(completedList)
149
155
  }
150
156
 
151
157
  class AssetParseObserver(activity: Context) : ISegmentedAssetFromParserObserver {
@@ -196,7 +202,7 @@ class OfflineVideoEngine(private val context: ReactApplicationContext) {
196
202
  val keyValueMap = HashMap<String, Any>()
197
203
  keyValueMap["offlineUrl"] = offlineUrl
198
204
  keyValueMap["metadata"] = asset?.metadata.toString()
199
- return Gson().toJson(keyValueMap)
205
+ return gson.toJson(keyValueMap)
200
206
  }
201
207
  }
202
208
  return null
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,8 @@
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>
@@ -0,0 +1,104 @@
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>
@@ -0,0 +1,14 @@
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>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeoffmedia/react-native-penthera",
3
- "version": "0.2.32",
3
+ "version": "0.2.34",
4
4
  "description": "test",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",