mirror of
https://gitee.com/openharmony/msdp_device_status
synced 2025-02-21 08:14:07 +00:00
add interface RegisterThumbnailDraw UnregisterThumbnailDraw
Signed-off-by: mayunteng_1 <mayunteng@huawei.com> Change-Id: Ia588b1f18d807774daeaabedfb050b584f00e1e5
This commit is contained in:
parent
c5061d8678
commit
c46b9f9ca2
@ -194,7 +194,7 @@ napi_value JsDragContext::RegisterThumbnailDraw(napi_env env, napi_callback_info
|
||||
}
|
||||
}
|
||||
if (argc != 3) {
|
||||
FI_HILOGE("");
|
||||
THROWERR_CUSTOM(env, COMMON_PARAMETER_ERROR, "Wrong number of parameters");
|
||||
return nullptr;
|
||||
}
|
||||
JsDragContext *jsDev = JsDragContext::GetInstance(env);
|
||||
|
@ -75,12 +75,14 @@ int32_t DragManagerImpl::RegisterThumbnailDraw(std::function<void(int32_t, int32
|
||||
{
|
||||
CALL_DEBUG_ENTER;
|
||||
auto ret = DeviceStatusClient::GetInstance().RegisterThumbnailDraw();
|
||||
if (ret == RET_OK) {
|
||||
hasRegisterThumbnailDraw_ = true;
|
||||
thumbnailDrawCallback_.startDrag = startDrag;
|
||||
thumbnailDrawCallback_.notice = notice;
|
||||
thumbnailDrawCallback_.endDrag = endDrag;
|
||||
if (ret != RET_OK) {
|
||||
FI_HILOGE("Register thumbnail draw failed");
|
||||
return ret;
|
||||
}
|
||||
hasRegisterThumbnailDraw_ = true;
|
||||
thumbnailDrawCallback_.startDrag = startDrag;
|
||||
thumbnailDrawCallback_.notice = notice;
|
||||
thumbnailDrawCallback_.endDrag = endDrag;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -88,15 +90,18 @@ int32_t DragManagerImpl::UnregisterThumbnailDraw()
|
||||
{
|
||||
CALL_DEBUG_ENTER;
|
||||
if (!hasRegisterThumbnailDraw_) {
|
||||
FI_HILOGE("Have not registered thumbnail draw");
|
||||
return RET_ERR;
|
||||
}
|
||||
auto ret = DeviceStatusClient::GetInstance().UnregisterThumbnailDraw();
|
||||
if (ret == RET_OK) {
|
||||
hasRegisterThumbnailDraw_ = false;
|
||||
thumbnailDrawCallback_.startDrag = nullptr;
|
||||
thumbnailDrawCallback_.notice = nullptr;
|
||||
thumbnailDrawCallback_.endDrag = nullptr;
|
||||
if (ret != RET_OK) {
|
||||
FI_HILOGE("Unregister thumbnail draw failed");
|
||||
return ret;
|
||||
}
|
||||
hasRegisterThumbnailDraw_ = false;
|
||||
thumbnailDrawCallback_.startDrag = nullptr;
|
||||
thumbnailDrawCallback_.notice = nullptr;
|
||||
thumbnailDrawCallback_.endDrag = nullptr;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user