36 lines
1.4 KiB
JavaScript
36 lines
1.4 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const AbstractMethod_1 = require("../core/AbstractMethod");
|
|
const events_1 = require("../events");
|
|
const paramsValidator_1 = require("./common/paramsValidator");
|
|
class WipeDevice extends AbstractMethod_1.AbstractMethod {
|
|
init() {
|
|
this.allowDeviceMode = [events_1.UI.INITIALIZE, events_1.UI.SEEDLESS, events_1.UI.BOOTLOADER];
|
|
this.useDeviceState = false;
|
|
this.requiredPermissions = ['management'];
|
|
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, this.firmwareRange);
|
|
}
|
|
get confirmation() {
|
|
return {
|
|
view: 'device-management',
|
|
customConfirmButton: {
|
|
className: 'wipe',
|
|
label: `Wipe ${this.device.toMessageObject().label}`,
|
|
},
|
|
label: 'Are you sure you want to wipe your device?',
|
|
};
|
|
}
|
|
get info() {
|
|
return 'Wipe device';
|
|
}
|
|
async run() {
|
|
const cmd = this.device.getCommands();
|
|
if (this.device.isBootloader()) {
|
|
this.device.emit(events_1.DEVICE.BUTTON, this.device, { code: 'ButtonRequest_WipeDevice' });
|
|
}
|
|
const response = await cmd.typedCall('WipeDevice', 'Success');
|
|
return response.message;
|
|
}
|
|
}
|
|
exports.default = WipeDevice;
|
|
//# sourceMappingURL=wipeDevice.js.map
|