@lynxship/expo 0.1.3 → 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.
package/README.md CHANGED
@@ -18,6 +18,11 @@ npx expo prebuild
18
18
  npx pod-install
19
19
  ```
20
20
 
21
+ `@lynxship/expo` uses the `expo-modules-core` implementation supplied by the
22
+ installed Expo SDK. The package keeps it as a development dependency for its
23
+ own native-module build, so installing `@lynxship/expo` does not require a
24
+ second manual native dependency in the application.
25
+
21
26
  When the project uses a static `app.json` or `app.config.json`, the Expo CLI
22
27
  automatically adds `@lynxship/expo` to `expo.plugins` during `npx expo install`.
23
28
  The plugin's defaults are safe for the first build, so no manual config edit
@@ -73,6 +78,10 @@ The endpoint must be HTTPS outside localhost. The public verification key is
73
78
  safe to ship in the application; private signing keys must remain in the
74
79
  LynxShip CLI or CI secret store.
75
80
 
81
+ The Android Expo module reads its native Maven version from this package's
82
+ `package.json`, so publishing a new package version cannot leave the Gradle
83
+ module on an old or missing `versionName`.
84
+
76
85
  `lynxVersion` defaults to `auto`. Android resolves the current Lynx release
77
86
  through Gradle and iOS resolves the current CocoaPods release. Gradle and
78
87
  CocoaPods lockfiles retain the concrete versions selected by the first native
@@ -1,8 +1,23 @@
1
+ import groovy.json.JsonSlurper
2
+
1
3
  plugins {
2
4
  id "com.android.library"
3
5
  id "expo-module-gradle-plugin"
4
6
  }
5
7
 
8
+ def packageJsonFile = file("../package.json")
9
+ if (!packageJsonFile.isFile()) {
10
+ throw new GradleException("@lynxship/expo package.json is missing")
11
+ }
12
+ def packageJson = new JsonSlurper().parseText(packageJsonFile.text)
13
+ def moduleVersion = packageJson.version?.toString()
14
+ if (!moduleVersion) {
15
+ throw new GradleException("@lynxship/expo package.json does not define a version")
16
+ }
17
+
18
+ group = "com.lynxship.expo"
19
+ version = moduleVersion
20
+
6
21
  // `latest.release` is used only when the app does not provide an exact
7
22
  // version. Gradle dependency locking then records the resolved version for
8
23
  // reproducible subsequent builds.
@@ -13,6 +28,8 @@ android {
13
28
  compileSdk 35
14
29
 
15
30
  defaultConfig {
31
+ versionCode 1
32
+ versionName moduleVersion
16
33
  minSdk 24
17
34
  consumerProguardFiles "consumer-rules.pro"
18
35
  }
@@ -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
  }
@@ -1,6 +1,14 @@
1
+ require 'json'
2
+
3
+ package_json_path = File.join(__dir__, 'package.json')
4
+ raise 'LynxShip Expo package.json is missing' unless File.file?(package_json_path)
5
+
6
+ package_version = JSON.parse(File.read(package_json_path))['version']
7
+ raise 'LynxShip Expo package.json does not define a version' unless package_version
8
+
1
9
  Pod::Spec.new do |s|
2
10
  s.name = 'LynxShipExpo'
3
- s.version = '0.1.0'
11
+ s.version = package_version
4
12
  s.summary = 'Expo native LynxView integration for LynxShip.'
5
13
  s.license = { :type => 'MIT' }
6
14
  s.author = { 'LynxShip' => 'opensource@lynxship.dev' }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynxship/expo",
3
- "version": "0.1.3",
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",
@@ -42,10 +42,12 @@
42
42
  "peerDependencies": {
43
43
  "@expo/config-plugins": ">=9",
44
44
  "expo": ">=52",
45
- "expo-modules-core": ">=1",
46
45
  "react": ">=18",
47
46
  "react-native": ">=0.76"
48
47
  },
48
+ "devDependencies": {
49
+ "expo-modules-core": "57.0.13"
50
+ },
49
51
  "dependencies": {
50
52
  "@lynxship/sdk-ios": "0.1.0",
51
53
  "@lynxship/sdk-android": "0.1.0"