176fd607bSopenharmony_ci/* 276fd607bSopenharmony_ci * Copyright (C) 2023 Huawei Device Co., Ltd. 376fd607bSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 476fd607bSopenharmony_ci * you may not use this file except in compliance with the License. 576fd607bSopenharmony_ci * You may obtain a copy of the License at 676fd607bSopenharmony_ci * 776fd607bSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 876fd607bSopenharmony_ci * 976fd607bSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1076fd607bSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1176fd607bSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1276fd607bSopenharmony_ci * See the License for the specific language governing permissions and 1376fd607bSopenharmony_ci * limitations under the License. 1476fd607bSopenharmony_ci */ 1576fd607bSopenharmony_ci#ifndef INTERFACES_KITS_JS_MEDIALIBRARY_INCLUDE_DELETE_CALLBACK_H 1676fd607bSopenharmony_ci#define INTERFACES_KITS_JS_MEDIALIBRARY_INCLUDE_DELETE_CALLBACK_H 1776fd607bSopenharmony_ci 1876fd607bSopenharmony_ci#include <js_native_api.h> 1976fd607bSopenharmony_ci#include <string> 2076fd607bSopenharmony_ci#include <uv.h> 2176fd607bSopenharmony_ci#include <napi/native_api.h> 2276fd607bSopenharmony_ci#include <node_api.h> 2376fd607bSopenharmony_ci 2476fd607bSopenharmony_ci#include "want.h" 2576fd607bSopenharmony_ci#ifdef HAS_ACE_ENGINE_PART 2676fd607bSopenharmony_ci#include "ui_content.h" 2776fd607bSopenharmony_ci#endif 2876fd607bSopenharmony_ci#include "medialibrary_client_errno.h" 2976fd607bSopenharmony_ci 3076fd607bSopenharmony_cinamespace OHOS { 3176fd607bSopenharmony_cinamespace Media { 3276fd607bSopenharmony_ciconst std::string DELETE_UI_PACKAGE_NAME = "com.ohos.photos"; 3376fd607bSopenharmony_ciconst std::string DELETE_UI_EXT_ABILITY_NAME = "DeleteUIExtensionAbility"; 3476fd607bSopenharmony_ciconst std::string DELETE_UI_EXTENSION_TYPE = "ability.want.params.uiExtensionType"; 3576fd607bSopenharmony_ciconst std::string DELETE_UI_REQUEST_TYPE = "sysDialog/common"; 3676fd607bSopenharmony_ciconst std::string DELETE_UI_APPNAME = "appName"; 3776fd607bSopenharmony_ciconst std::string DELETE_UI_URIS = "uris"; 3876fd607bSopenharmony_ciconst std::string RESULT = "result"; 3976fd607bSopenharmony_ciconst int32_t DELETE_CODE_SUCCESS = 0; 4076fd607bSopenharmony_ciconst int32_t DEFAULT_SESSION_ID = 0; 4176fd607bSopenharmony_ci 4276fd607bSopenharmony_ciclass DeleteCallback { 4376fd607bSopenharmony_cipublic: 4476fd607bSopenharmony_ci#ifdef HAS_ACE_ENGINE_PART 4576fd607bSopenharmony_ci explicit DeleteCallback(napi_env env, Ace::UIContent *uiContent); 4676fd607bSopenharmony_ci#else 4776fd607bSopenharmony_ci explicit DeleteCallback(napi_env env); 4876fd607bSopenharmony_ci#endif 4976fd607bSopenharmony_ci void OnRelease(int32_t releaseCode); 5076fd607bSopenharmony_ci void OnResult(int32_t resultCode, const OHOS::AAFwk::Want &result); 5176fd607bSopenharmony_ci void OnReceive(const OHOS::AAFwk::WantParams &request); 5276fd607bSopenharmony_ci void OnError(int32_t code, const std::string &name, const std::string &message); 5376fd607bSopenharmony_ci void SetSessionId(int32_t sessionId); 5476fd607bSopenharmony_ci void SetUris(std::vector<std::string> uris); 5576fd607bSopenharmony_ci void SetFunc(napi_value func); 5676fd607bSopenharmony_ci 5776fd607bSopenharmony_ciprivate: 5876fd607bSopenharmony_ci int32_t sessionId_ = DEFAULT_SESSION_ID; 5976fd607bSopenharmony_ci int32_t resultCode_ = JS_ERR_PERMISSION_DENIED; 6076fd607bSopenharmony_ci std::vector<std::string> uris_; 6176fd607bSopenharmony_ci napi_env env_ = nullptr; 6276fd607bSopenharmony_ci napi_ref callbackRef = nullptr; 6376fd607bSopenharmony_ci#ifdef HAS_ACE_ENGINE_PART 6476fd607bSopenharmony_ci Ace::UIContent *uiContent = nullptr; 6576fd607bSopenharmony_ci#endif 6676fd607bSopenharmony_ci void SendMessageBack(); 6776fd607bSopenharmony_ci void CloseModalUIExtension(); 6876fd607bSopenharmony_ci}; 6976fd607bSopenharmony_ci} 7076fd607bSopenharmony_ci} 7176fd607bSopenharmony_ci#endif 72