Skip to content

Commit 564ec8f

Browse files
authored
Merge pull request #545 from BMR11/Add-support-for-eraseAppSettings-from-TypeScript
Adding eraseAppSettings to UpgradeOptions TypeScript type
2 parents 0875025 + 8c40a30 commit 564ec8f

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class UpdateOptions : Record {
2828
@Field val estimatedSwapTime: Int = 0
2929
@Field val upgradeFileType: Int = 0
3030
@Field val upgradeMode: Int? = null
31+
@Field val eraseAppSettings: Boolean? = false
3132
}
3233

3334
class BootloaderInfo : Record {

react-native-mcu-manager/ios/DeviceUpgrade.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ class DeviceUpgrade {
114114
self.dfuManager = FirmwareUpgradeManager(transport: self.bleTransport!, delegate: self)
115115
let config = FirmwareUpgradeConfiguration(
116116
estimatedSwapTime: self.options.estimatedSwapTime,
117+
eraseAppSettings: self.options.eraseAppSettings,
117118
upgradeMode: self.getMode()
118119
)
119120

react-native-mcu-manager/ios/UpdateOptions.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ struct UpdateOptions: Record {
44
@Field var estimatedSwapTime: TimeInterval = 0
55
@Field var upgradeFileType: Int = 0
66
@Field var upgradeMode: Int?
7+
@Field var eraseAppSettings: Bool = false
78
}

react-native-mcu-manager/src/Upgrade.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ export interface UpgradeOptions {
5757
* @see UpgradeMode
5858
*/
5959
upgradeMode?: UpgradeMode;
60+
61+
/**
62+
* If true, erase application settings during upgrade (if supported by firmware). Defaults to false.
63+
*/
64+
eraseAppSettings?: boolean;
6065
}
6166

6267
export type FirmwareUpgradeState =

0 commit comments

Comments
 (0)