1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef CALENDAR_MANAGER_NAPI_H 17 #define CALENDAR_MANAGER_NAPI_H 18 19 #include <vector> 20 21 #include "napi/native_api.h" 22 #include "napi/native_common.h" 23 #include "napi/native_node_api.h" 24 25 #include "calendar_log.h" 26 #include "napi_util.h" 27 #include "napi_queue.h" 28 #include "calendar_napi.h" 29 #include "native_calendar_manager.h" 30 #include "napi_env.h" 31 #include "abs_shared_result_set.h" 32 #include "data_ability_helper.h" 33 #include "data_ability_predicates.h" 34 #include "values_bucket.h" 35 36 #include <ui_content.h> 37 #include "napi_base_context.h" 38 namespace OHOS::CalendarApi { 39 class CalendarManagerNapi { 40 public: 41 struct EditEventContext : public ContextBase { 42 string event; 43 napi_value _jsContext; 44 string caller; 45 int32_t _sessionId; 46 Ace::UIContent *_uiContent = nullptr; 47 napi_value id; 48 }; 49 50 static napi_value New(napi_env env, napi_callback_info info); 51 static napi_value CreateCalendar(napi_env env, napi_callback_info info); 52 static napi_value DeleteCalendar(napi_env env, napi_callback_info info); 53 static napi_value GetCalendar(napi_env env, napi_callback_info info); 54 static napi_value GetAllCalendars(napi_env env, napi_callback_info info); 55 static napi_value EditEvent(napi_env env, napi_callback_info info); 56 static napi_value Init(napi_env env, napi_value exports); 57 private: 58 static napi_value LaunchEditorPage(napi_env env, std::shared_ptr<EditEventContext> ctxt); 59 }; 60 61 napi_value GetCalendarManager(napi_env env, napi_callback_info info); 62 63 } // namespace Calendar::CalendarApi 64 #endif // CALENDAR_MANAGER_NAPI_H 65