1 /*
2  * Copyright (c) 2021 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 OHOS_ACELITE_DIALOG_MODULE_H
17 #define OHOS_ACELITE_DIALOG_MODULE_H
18 
19 #include "acelite_config.h"
20 #if (FEATURE_MODULE_DIALOG == 1)
21 #include "jsi.h"
22 #include "js_fwk_common.h"
23 #include "non_copyable.h"
24 
25 #include "ui_dialog.h"
26 #include "dialog/js_dialog.h"
27 
28 namespace OHOS {
29 namespace ACELite {
30 /**
31  * @brief: The module of dialog, show dialog in window
32  */
33 class DialogModule final : public MemoryHeap {
34 public:
35     ACE_DISALLOW_COPY_AND_MOVE(DialogModule);
DialogModule()36     DialogModule() {}
~DialogModule()37     ~DialogModule() {}
38     static JSIValue ShowDialog(const JSIValue thisVal, const JSIValue args[], uint8_t argsNum);
39 
40 private:
41     static const char * const TITLE_KEY;
42     static const char * const MSG_KEY;
43     static const char * const BUTTON_KEY;
44     static const char * const SUCCESS_FUNC_KEY;
45     static const char * const CANCEL_FUNC_KEY;
46     static const char * const COMPLETE_FUNC_KEY;
47 };
48 
InitDialogModule(JSIValue exports)49 void InitDialogModule(JSIValue exports)
50 {
51     JSI::SetModuleAPI(exports, "showDialog", DialogModule::ShowDialog);
52 }
53 } // namespace ACELite
54 } // namespace OHOS
55 #endif // FEATURE_MODULE_DIALOG
56 #endif // OHOS_ACELITE_DIALOG_MODULE_H
57