Skip to content

Adding eraseAppSettings to UpgradeOptions TypeScript type #545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class UpdateOptions : Record {
@Field val estimatedSwapTime: Int = 0
@Field val upgradeFileType: Int = 0
@Field val upgradeMode: Int? = null
@Field val eraseAppSettings: Boolean? = false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can you make sure this is passed through into FirmwareUpgradeManager?

}

class BootloaderInfo : Record {
Expand Down
1 change: 1 addition & 0 deletions react-native-mcu-manager/ios/DeviceUpgrade.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class DeviceUpgrade {
self.dfuManager = FirmwareUpgradeManager(transport: self.bleTransport!, delegate: self)
let config = FirmwareUpgradeConfiguration(
estimatedSwapTime: self.options.estimatedSwapTime,
eraseAppSettings: self.options.eraseAppSettings,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will pass ts argument to the iOS FirmwareUpgradeConfiguration constructor

upgradeMode: self.getMode()
)

Expand Down
1 change: 1 addition & 0 deletions react-native-mcu-manager/ios/UpdateOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ struct UpdateOptions: Record {
@Field var estimatedSwapTime: TimeInterval = 0
@Field var upgradeFileType: Int = 0
@Field var upgradeMode: Int?
@Field var eraseAppSettings: Bool = false
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We not passed, it will be false

}
5 changes: 5 additions & 0 deletions react-native-mcu-manager/src/Upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ export interface UpgradeOptions {
* @see UpgradeMode
*/
upgradeMode?: UpgradeMode;

/**
* If true, erase application settings during upgrade (if supported by firmware). Defaults to false.
*/
eraseAppSettings?: boolean;
}

export type FirmwareUpgradeState =
Expand Down
Loading