Skip to content

Commit 6c6ade7

Browse files
renovate-botCraigNewlands
authored andcommitted
fix(deps): update expo monorepo
1 parent 71a810f commit 6c6ade7

File tree

16 files changed

+2134
-3616
lines changed

16 files changed

+2134
-3616
lines changed

example/.assets/images/pd.png

43 KB
Loading

example/app.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ const config: ExpoConfig = {
77
version: "1.0.0",
88
orientation: "portrait",
99
assetBundlePatterns: ["**/*"],
10+
splash: {
11+
image: ".assets/images/pd.png",
12+
backgroundColor: "#FFFFFF",
13+
},
1014
ios: {
1115
supportsTablet: true,
1216
bundleIdentifier: "uk.co.playerdata.reactnativemcumanager.example",

example/package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@
1212
},
1313
"dependencies": {
1414
"@playerdata/react-native-mcu-manager": "workspace:*",
15-
"expo": "51.0.38",
16-
"expo-document-picker": "^12.0.2",
17-
"expo-splash-screen": "0.27.6",
18-
"expo-status-bar": "1.12.1",
15+
"expo": "52.0.14",
16+
"expo-document-picker": "13.0.1",
17+
"expo-splash-screen": "0.29.13",
1918
"lodash": "4.17.21",
2019
"react": "18.3.1",
21-
"react-native": "0.74.5",
20+
"react-native": "0.76.3",
2221
"react-native-ble-plx": "3.2.1",
2322
"react-native-toast-message": "2.2.1"
2423
},

example/src/App.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import 'react-native-get-random-values';
2-
31
import { UpgradeMode } from '@playerdata/react-native-mcu-manager';
42

53
import React, { useState } from 'react';

example/src/useFirmwareUpdate.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,16 @@ const useFirmwareUpdate = (
1515
return () => null;
1616
}
1717

18-
const upgrade = new Upgrade(bleId, updateFileUri, {
19-
estimatedSwapTime: 60,
20-
upgradeMode,
21-
});
18+
const upgrade = new Upgrade(
19+
bleId,
20+
updateFileUri,
21+
{
22+
estimatedSwapTime: 60,
23+
upgradeMode,
24+
},
25+
setProgress,
26+
setState
27+
);
2228

2329
upgradeRef.current = upgrade;
2430

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,16 @@
2121
"devDependencies": {
2222
"@commitlint/config-conventional": "19.6.0",
2323
"@react-native-community/eslint-config": "3.2.0",
24+
"@typescript-eslint/eslint-plugin": "^7.18.0",
25+
"@typescript-eslint/parser": "^7.18.0",
2426
"commitlint": "19.6.0",
2527
"eslint-config-prettier": "9.1.0",
2628
"eslint-plugin-prettier": "5.2.1",
2729
"husky": "9.1.7",
28-
"prettier": "3.4.2",
30+
"prettier": "3.3.3",
2931
"semantic-release": "24.2.0"
32+
},
33+
"resolutions": {
34+
"expo": ">52.0.0"
3035
}
3136
}

pnpm-lock.yaml

Lines changed: 2011 additions & 3500 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

react-native-mcu-manager/android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ if (useManagedAndroidSdkVersions) {
2424
}
2525

2626
project.android {
27-
compileSdkVersion safeExtGet("compileSdkVersion", 34)
27+
compileSdkVersion safeExtGet("compileSdkVersion", 35)
2828
defaultConfig {
29-
minSdkVersion safeExtGet("minSdkVersion", 21)
30-
targetSdkVersion safeExtGet("targetSdkVersion", 34)
29+
minSdkVersion safeExtGet("minSdkVersion", 24)
30+
targetSdkVersion safeExtGet("targetSdkVersion", 35)
3131
}
3232
}
3333
}

react-native-mcu-manager/android/src/main/java/uk/co/playerdata/reactnativemcumanager/DeviceUpgrade.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ class DeviceUpgrade(
3030
private val context: Context,
3131
private val updateFileUri: Uri,
3232
private val updateOptions: UpdateOptions,
33-
private val manager: ReactNativeMcuManagerModule
33+
private val progressCallback: (Int) -> Unit,
34+
private val stateCallback: (String) -> Unit
3435
) : FirmwareUpgradeCallback<FirmwareUpgradeManager.State> {
3536
private val TAG = "DeviceUpdate"
3637
private var lastNotification = -1
@@ -128,8 +129,7 @@ class DeviceUpgrade(
128129
prevState: FirmwareUpgradeManager.State,
129130
newState: FirmwareUpgradeManager.State
130131
) {
131-
val stateMap: Map<String, Any?> = mapOf("id" to id, "state" to newState.name)
132-
manager.upgradeStateCB(stateMap)
132+
stateCallback(newState.name)
133133
}
134134

135135
override fun onUpgradeCompleted() {
@@ -155,8 +155,7 @@ class DeviceUpgrade(
155155
val progressPercent = bytesSent * 100 / imageSize
156156
if (progressPercent != lastNotification) {
157157
lastNotification = progressPercent
158-
val progressMap: Map<String, Any?> = mapOf("id" to id, "progress" to progressPercent)
159-
manager.updateProgressCB(progressMap)
158+
progressCallback(progressPercent)
160159
}
161160
}
162161
}

react-native-mcu-manager/android/src/main/java/uk/co/playerdata/reactnativemcumanager/ReactNativeMcuManagerModule.kt

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.net.Uri
66
import android.util.Log
77
import expo.modules.kotlin.Promise
88
import expo.modules.kotlin.exception.CodedException
9+
import expo.modules.kotlin.jni.JavaScriptFunction
910
import expo.modules.kotlin.modules.Module
1011
import expo.modules.kotlin.modules.ModuleDefinition
1112
import expo.modules.kotlin.records.Field
@@ -17,16 +18,12 @@ import io.runtime.mcumgr.managers.ImageManager
1718
private const val MODULE_NAME = "ReactNativeMcuManager"
1819
private val TAG = "McuManagerModule"
1920

20-
private const val UPGRADE_STATE_EVENTS = "upgradeStateChanged"
21-
private const val UPLOAD_PROGRESS_EVENTS = "uploadProgress"
22-
2321
class UpdateOptions : Record {
2422
@Field val estimatedSwapTime: Int = 0
2523
@Field val upgradeMode: Int? = null
2624
}
2725

2826
class ReactNativeMcuManagerModule : Module() {
29-
3027
private val bluetoothAdapter: BluetoothAdapter? = BluetoothAdapter.getDefaultAdapter()
3128
private val upgrades: MutableMap<String, DeviceUpgrade> = mutableMapOf()
3229
private val context
@@ -35,9 +32,6 @@ class ReactNativeMcuManagerModule : Module() {
3532
override fun definition() = ModuleDefinition {
3633
Name(MODULE_NAME)
3734

38-
// Defines event names that the module can send to JavaScript.
39-
Events(UPGRADE_STATE_EVENTS, UPLOAD_PROGRESS_EVENTS)
40-
4135
AsyncFunction("eraseImage") { macAddress: String?, promise: Promise ->
4236
if (this@ReactNativeMcuManagerModule.bluetoothAdapter == null) {
4337
throw Exception("No bluetooth adapter")
@@ -62,7 +56,9 @@ class ReactNativeMcuManagerModule : Module() {
6256
id: String,
6357
macAddress: String?,
6458
updateFileUriString: String?,
65-
updateOptions: UpdateOptions ->
59+
updateOptions: UpdateOptions,
60+
progressCallback: JavaScriptFunction<Unit>,
61+
stateCallback: JavaScriptFunction<Unit> ->
6662
if (this@ReactNativeMcuManagerModule.bluetoothAdapter == null) {
6763
throw Exception("No bluetooth adapter")
6864
}
@@ -74,15 +70,23 @@ class ReactNativeMcuManagerModule : Module() {
7470
val device: BluetoothDevice = bluetoothAdapter.getRemoteDevice(macAddress)
7571
val updateFileUri = Uri.parse(updateFileUriString)
7672

77-
val upgrade =
78-
DeviceUpgrade(
79-
id,
80-
device,
81-
context,
82-
updateFileUri,
83-
updateOptions,
84-
this@ReactNativeMcuManagerModule
85-
)
73+
val upgrade = DeviceUpgrade(
74+
id,
75+
device,
76+
context,
77+
updateFileUri,
78+
updateOptions,
79+
{ progress ->
80+
appContext.executeOnJavaScriptThread {
81+
progressCallback(id, progress)
82+
}
83+
},
84+
{ state ->
85+
appContext.executeOnJavaScriptThread {
86+
stateCallback(id, state)
87+
}
88+
}
89+
)
8690
this@ReactNativeMcuManagerModule.upgrades[id] = upgrade
8791
}
8892

@@ -120,12 +124,4 @@ class ReactNativeMcuManagerModule : Module() {
120124
upgrades.remove(id)
121125
}
122126
}
123-
124-
fun updateProgressCB(progress: Map<String, Any?>) {
125-
sendEvent(UPLOAD_PROGRESS_EVENTS, progress)
126-
}
127-
128-
fun upgradeStateCB(state: Map<String, Any?>) {
129-
sendEvent(UPGRADE_STATE_EVENTS, state)
130-
}
131127
}

0 commit comments

Comments
 (0)