mirror of
https://github.com/mudita/mudita-center.git
synced 2026-06-13 19:05:21 -04:00
Co-authored-by: Łukasz Kowalczyk <freelancer.lukasz.kowalczyk@gmail.com> Co-authored-by: Łukasz Kowalczyk <37898730+lkowalczyk87@users.noreply.github.com> Co-authored-by: patrycja-paczkowska <88655668+patrycja-paczkowska@users.noreply.github.com> Co-authored-by: Tomasz Malecki <135224481+tomaszmaleckimudita@users.noreply.github.com> Co-authored-by: Daniel Karski <daniel.karski5q@gmail.com>
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
/**
|
|
* Copyright (c) Mudita sp. z o.o. All rights reserved.
|
|
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
|
|
*/
|
|
|
|
import { IpcEvent } from "Core/core/decorators"
|
|
import { ResultObject } from "Core/core/builder"
|
|
import { DeviceService } from "Core/device/services"
|
|
import { PhoneLockTime } from "Core/device/dto"
|
|
import { IpcDeviceEvent } from "Core/device/constants"
|
|
import { DeviceId } from "Core/device/constants/device-id"
|
|
|
|
export class DeviceController {
|
|
constructor(private deviceService: DeviceService) {}
|
|
|
|
@IpcEvent(IpcDeviceEvent.Unlock)
|
|
public async unlockDevice({
|
|
code,
|
|
deviceId,
|
|
}: {
|
|
code: string
|
|
deviceId?: DeviceId
|
|
}): Promise<ResultObject<boolean>> {
|
|
return this.deviceService.unlock(code, deviceId)
|
|
}
|
|
|
|
@IpcEvent(IpcDeviceEvent.UnlockStatus)
|
|
public async unlockDeviceStatus(
|
|
deviceId?: DeviceId
|
|
): Promise<ResultObject<unknown>> {
|
|
return this.deviceService.unlockStatus(deviceId)
|
|
}
|
|
|
|
@IpcEvent(IpcDeviceEvent.LockTime)
|
|
public async deviceLockTime(
|
|
deviceId?: DeviceId
|
|
): Promise<ResultObject<PhoneLockTime>> {
|
|
return this.deviceService.unlockTime(deviceId)
|
|
}
|
|
}
|