@lynxship/expo 0.1.5 → 0.1.6

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.
@@ -1,5 +1,6 @@
1
1
  package com.lynxship.expo
2
2
 
3
+ import android.app.Application
3
4
  import android.content.Context
4
5
  import android.content.SharedPreferences
5
6
  import android.os.Bundle
@@ -19,7 +20,7 @@ import com.lynx.tasm.provider.AbsTemplateProvider
19
20
  import com.lynx.tasm.service.LynxServiceCenter
20
21
  import com.lynxship.sdk.android.LynxShipOtaClient
21
22
  import expo.modules.kotlin.AppContext
22
- import expo.modules.kotlin.events.EventDispatcher
23
+ import expo.modules.kotlin.viewevent.EventDispatcher
23
24
  import expo.modules.kotlin.views.ExpoView
24
25
  import java.io.ByteArrayOutputStream
25
26
  import java.io.File
@@ -62,7 +63,7 @@ class LynxShipExpoView(context: Context, appContext: AppContext) : ExpoView(cont
62
63
  } catch (error: IOException) {
63
64
  onError(mapOf("message" to (error.message ?: "Could not record Lynx launch"), "recoverable" to true))
64
65
  }
65
- onReady(mapOf("bundle" to bundleName, "sequence" to (otaClient?.activeSequence ?: 0)))
66
+ onReady(mapOf("bundle" to bundleName, "sequence" to (otaClient?.activeSequence() ?: 0)))
66
67
  }
67
68
  })
68
69
  addView(lynxView, LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT))
@@ -98,7 +99,7 @@ class LynxShipExpoView(context: Context, appContext: AppContext) : ExpoView(cont
98
99
  try {
99
100
  otaClient.activateCandidate()
100
101
  post {
101
- onUpdate(mapOf("sequence" to otaClient.activeSequence))
102
+ onUpdate(mapOf("sequence" to otaClient.activeSequence()))
102
103
  if (reloadOnUpdate) render()
103
104
  }
104
105
  } catch (error: Exception) {
@@ -168,6 +169,8 @@ class LynxShipExpoView(context: Context, appContext: AppContext) : ExpoView(cont
168
169
  synchronized(LynxShipExpoView::class.java) {
169
170
  if (!initialized) {
170
171
  val applicationContext = context.applicationContext
172
+ val application = applicationContext as? Application
173
+ ?: throw IllegalStateException("LynxShip requires an Android Application context")
171
174
  // Lynx's official Android integration requires these services
172
175
  // before a LynxView is created. Expo does not give this package
173
176
  // an application subclass, so initialize them once at the
@@ -184,7 +187,7 @@ class LynxShipExpoView(context: Context, appContext: AppContext) : ExpoView(cont
184
187
  LynxServiceCenter.inst().registerService(LynxImageService.getInstance())
185
188
  LynxServiceCenter.inst().registerService(LynxLogService)
186
189
  LynxServiceCenter.inst().registerService(LynxHttpService)
187
- LynxEnv.inst().init(applicationContext, null, null, null)
190
+ LynxEnv.inst().init(application, null, null, null)
188
191
  initialized = true
189
192
  }
190
193
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynxship/expo",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Expo native LynxView with LynxShip OTA delivery and cache support.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -49,8 +49,8 @@
49
49
  "expo-modules-core": "57.0.13"
50
50
  },
51
51
  "dependencies": {
52
- "@lynxship/sdk-android": "0.1.0",
53
- "@lynxship/sdk-ios": "0.1.0"
52
+ "@lynxship/sdk-ios": "0.1.0",
53
+ "@lynxship/sdk-android": "0.1.0"
54
54
  },
55
55
  "scripts": {
56
56
  "build": "tsc -b tsconfig.json",