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 #ifndef BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_JS_NAPI_INCLUDE_COMMON_H 16 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_JS_NAPI_INCLUDE_COMMON_H 17 18 #include "ans_log_wrapper.h" 19 #include "napi/native_api.h" 20 #include "napi/native_node_api.h" 21 #include "notification_button_option.h" 22 #include "notification_helper.h" 23 #include "notification_local_live_view_button.h" 24 #include "notification_progress.h" 25 #include "notification_time.h" 26 #include "ans_convert_enum.h" 27 28 namespace OHOS { 29 namespace NotificationNapi { 30 using namespace OHOS::Notification; 31 32 constexpr int32_t STR_MAX_SIZE = 204; 33 constexpr int32_t LONG_STR_MAX_SIZE = 1028; 34 constexpr uint8_t OPERATION_MAX_TYPE = 3; 35 constexpr int32_t LONG_LONG_STR_MAX_SIZE = 25600; 36 constexpr int8_t NO_ERROR = 0; 37 constexpr int8_t ERROR = -1; 38 constexpr uint8_t PARAM0 = 0; 39 constexpr uint8_t PARAM1 = 1; 40 constexpr uint8_t PARAM2 = 2; 41 constexpr uint8_t PARAM3 = 3; 42 constexpr uint8_t PARAM4 = 4; 43 44 enum class SemanticActionButton { 45 NONE_ACTION_BUTTON, 46 REPLY_ACTION_BUTTON, 47 READ_ACTION_BUTTON, 48 UNREAD_ACTION_BUTTON, 49 DELETE_ACTION_BUTTON, 50 ARCHIVE_ACTION_BUTTON, 51 MUTE_ACTION_BUTTON, 52 UNMUTE_ACTION_BUTTON, 53 THUMBS_UP_ACTION_BUTTON, 54 THUMBS_DOWN_ACTION_BUTTON, 55 CALL_ACTION_BUTTON 56 }; 57 58 enum class InputsSource { 59 FREE_FORM_INPUT, 60 OPTION 61 }; 62 63 enum class DisturbMode { 64 ALLOW_UNKNOWN, 65 ALLOW_ALL, 66 ALLOW_PRIORITY, 67 ALLOW_NONE, 68 ALLOW_ALARMS 69 }; 70 71 enum class InputEditType { 72 EDIT_AUTO, 73 EDIT_DISABLED, 74 EDIT_ENABLED 75 }; 76 77 78 enum class NotificationFlagStatus { 79 TYPE_NONE, 80 TYPE_OPEN, 81 TYPE_CLOSE 82 }; 83 84 struct NotificationSubscribeInfo { 85 std::vector<std::string> bundleNames; 86 int32_t userId = 0; 87 bool hasSubscribeInfo = false; 88 std::string deviceType; 89 }; 90 91 struct CallbackPromiseInfo { 92 napi_ref callback = nullptr; 93 napi_deferred deferred = nullptr; 94 bool isCallback = false; 95 int32_t errorCode = 0; 96 }; 97 98 class Common { 99 Common(); 100 101 ~Common(); 102 103 public: 104 /** 105 * @brief Gets a napi value that is used to represent specified bool value 106 * 107 * @param env Indicates the environment that the API is invoked under 108 * @param isValue Indicates a bool value 109 * @return Returns a napi value that is used to represent specified bool value 110 */ 111 static napi_value NapiGetBoolean(napi_env env, const bool &isValue); 112 113 /** 114 * @brief Gets the napi value that is used to represent the null object 115 * 116 * @param env Indicates the environment that the API is invoked under 117 * @return Returns the napi value that is used to represent the null object 118 */ 119 static napi_value NapiGetNull(napi_env env); 120 121 /** 122 * @brief Gets the napi value that is used to represent the undefined object 123 * 124 * @param env Indicates the environment that the API is invoked under 125 * @return Returns the napi value that is used to represent the undefined object 126 */ 127 static napi_value NapiGetUndefined(napi_env env); 128 129 /** 130 * @brief Gets a napi value with specified error code for callback 131 * 132 * @param env Indicates the environment that the API is invoked under 133 * @param errCode Indicates specified err code 134 * @return Returns a napi value with specified error code for callback 135 */ 136 static napi_value GetCallbackErrorValue(napi_env env, int32_t errCode); 137 138 /** 139 * @brief Pads the CallbackPromiseInfo struct 140 * 141 * @param env Indicates the environment that the API is invoked under 142 * @param callback Indicates a napi_ref for callback 143 * @param info Indicates the CallbackPromiseInfo struct to be padded 144 * @param promise Indicates the promise to be created when the callback is null 145 */ 146 static void PaddingCallbackPromiseInfo( 147 const napi_env &env, const napi_ref &callback, CallbackPromiseInfo &info, napi_value &promise); 148 149 /** 150 * @brief Gets the returned result by the CallbackPromiseInfo struct 151 * 152 * @param env Indicates the environment that the API is invoked under 153 * @param info Indicates the CallbackPromiseInfo struct 154 * @param result Indicates the returned result 155 */ 156 static void ReturnCallbackPromise(const napi_env &env, const CallbackPromiseInfo &info, const napi_value &result); 157 158 /** 159 * @brief Calls the callback with the result and error code 160 * 161 * @param env Indicates the environment that the API is invoked under 162 * @param callbackIn Indicates the callback to be called 163 * @param errCode Indicates the error code returned by the callback 164 * @param result Indicates the result returned by the callback 165 */ 166 static void SetCallback(const napi_env &env, 167 const napi_ref &callbackIn, const int32_t &errorCode, const napi_value &result, bool newType); 168 169 /** 170 * @brief Calls the callback with the result 171 * 172 * @param env Indicates the environment that the API is invoked under 173 * @param callbackIn Indicates the callback to be called 174 * @param result Indicates the result returned by the callback 175 */ 176 static void SetCallback( 177 const napi_env &env, const napi_ref &callbackIn, const napi_value &result); 178 179 /** 180 * @brief Calls the callback with the result 181 * 182 * @param env Indicates the environment that the API is invoked under 183 * @param callbackIn Indicates the callback to be called 184 * @param result Indicates the result returned by the callback 185 */ 186 static void SetCallbackArg2( 187 const napi_env &env, const napi_ref &callbackIn, const napi_value &result0, const napi_value &result1); 188 189 /** 190 * @brief Processes the promise with the result and error code 191 * 192 * @param env Indicates the environment that the API is invoked under 193 * @param deferred Indicates the deferred object whose associated promise to resolve 194 * @param errorCode Indicates the error code returned by the callback 195 * @param result Indicates the result returned by the callback 196 */ 197 static void SetPromise(const napi_env &env, 198 const napi_deferred &deferred, const int32_t &errorCode, const napi_value &result, bool newType); 199 200 /** 201 * @brief Gets the returned result by the callback when an error occurs 202 * 203 * @param env Indicates the environment that the API is invoked under 204 * @param callback Indicates a napi_ref for callback 205 * @return Returns the null object 206 */ 207 static napi_value JSParaError(const napi_env &env, const napi_ref &callback); 208 209 /** 210 * @brief Parses a single parameter for callback 211 * 212 * @param env Indicates the environment that the API is invoked under 213 * @param info Indicates the callback info passed into the callback function 214 * @param callback Indicates the napi_ref for the callback parameter 215 * @return Returns the null object if success, returns the null value otherwise 216 */ 217 static napi_value ParseParaOnlyCallback(const napi_env &env, const napi_callback_info &info, napi_ref &callback); 218 219 /** 220 * @brief Sets a js object by specified Notification object 221 * 222 * @param env Indicates the environment that the API is invoked under 223 * @param notification Indicates a Notification object to be converted 224 * @param result Indicates a js object to be set 225 * @return Returns the null object if success, returns the null value otherwise 226 */ 227 static napi_value SetNotification( 228 const napi_env &env, const OHOS::Notification::Notification *notification, napi_value &result); 229 230 /** 231 * @brief Sets a js object by specified NotificationRequest object 232 * 233 * @param env Indicates the environment that the API is invoked under 234 * @param request Indicates a NotificationRequest object to be converted 235 * @param result Indicates a js object to be set 236 * @return Returns the null object if success, returns the null value otherwise 237 */ 238 static napi_value SetNotificationRequest( 239 const napi_env &env, const OHOS::Notification::NotificationRequest *request, napi_value &result); 240 241 /** 242 * @brief Sets a js object by the string obejcts of specified NotificationRequest object 243 * 244 * @param env Indicates the environment that the API is invoked under 245 * @param request Indicates a NotificationRequest object to be converted 246 * @param result Indicates a js object to be set 247 * @return Returns the null object if success, returns the null value otherwise 248 */ 249 static napi_value SetNotificationRequestByString( 250 const napi_env &env, const OHOS::Notification::NotificationRequest *request, napi_value &result); 251 252 /** 253 * @brief Sets a js object by the number obejcts of specified NotificationRequest object 254 * 255 * @param env Indicates the environment that the API is invoked under 256 * @param request Indicates a NotificationRequest object to be converted 257 * @param result Indicates a js object to be set 258 * @return Returns the null object if success, returns the null value otherwise 259 */ 260 static napi_value SetNotificationRequestByNumber( 261 const napi_env &env, const OHOS::Notification::NotificationRequest *request, napi_value &result); 262 263 /** 264 * @brief Sets a js object by the bool obejcts of specified NotificationRequest object 265 * 266 * @param env Indicates the environment that the API is invoked under 267 * @param request Indicates a NotificationRequest object to be converted 268 * @param result Indicates a js object to be set 269 * @return Returns the null object if success, returns the null value otherwise 270 */ 271 static napi_value SetNotificationRequestByBool( 272 const napi_env &env, const OHOS::Notification::NotificationRequest *request, napi_value &result); 273 274 /** 275 * @brief Sets a js object by the WantAgent obejct of specified NotificationRequest object 276 * 277 * @param env Indicates the environment that the API is invoked under 278 * @param request Indicates a NotificationRequest object to be converted 279 * @param result Indicates a js object to be set 280 * @return Returns the null object if success, returns the null value otherwise 281 */ 282 static napi_value SetNotificationRequestByWantAgent( 283 const napi_env &env, const OHOS::Notification::NotificationRequest *request, napi_value &result); 284 285 /** 286 * @brief Sets a js object by the PixelMap obejct of specified NotificationRequest object 287 * 288 * @param env Indicates the environment that the API is invoked under 289 * @param request Indicates a NotificationRequest object to be converted 290 * @param result Indicates a js object to be set 291 * @return Returns the null object if success, returns the null value otherwise 292 */ 293 static napi_value SetNotificationRequestByPixelMap( 294 const napi_env &env, const OHOS::Notification::NotificationRequest *request, napi_value &result); 295 296 /** 297 * @brief Sets a js object by the custom obejcts of specified NotificationRequest object 298 * 299 * @param env Indicates the environment that the API is invoked under 300 * @param request Indicates a NotificationRequest object to be converted 301 * @param result Indicates a js object to be set 302 * @return Returns the null object if success, returns the null value otherwise 303 */ 304 static napi_value SetNotificationRequestByCustom( 305 const napi_env &env, const OHOS::Notification::NotificationRequest *request, napi_value &result); 306 307 /** 308 * @brief Sets a js object by the Distributed Options object of specified Notification object 309 * 310 * @param env Indicates the environment that the API is invoked under 311 * @param notification Indicates a Notification object to be converted 312 * @param result Indicates a js object to be set 313 * @return Returns the null object if success, returns the null value otherwise 314 */ 315 static napi_value SetNotificationByDistributedOptions( 316 const napi_env &env, const OHOS::Notification::Notification *notification, napi_value &result); 317 318 /** 319 * @brief Sets a js object by specified NotificationSortingMap object 320 * 321 * @param env Indicates the environment that the API is invoked under 322 * @param sortingMap Indicates a NotificationSortingMap object to be converted 323 * @param result Indicates a js object to be set 324 * @return Returns the null object if success, returns the null value otherwise 325 */ 326 static napi_value SetNotificationSortingMap( 327 const napi_env &env, const std::shared_ptr<NotificationSortingMap> &sortingMap, napi_value &result); 328 329 /** 330 * @brief Sets a js object by specified NotificationSorting object 331 * 332 * @param env Indicates the environment that the API is invoked under 333 * @param sorting Indicates a NotificationSorting object to be converted 334 * @param result Indicates a js object to be set 335 * @return Returns the null object if success, returns the null value otherwise 336 */ 337 static napi_value SetNotificationSorting( 338 const napi_env &env, const NotificationSorting &sorting, napi_value &result); 339 340 /** 341 * @brief Sets a js object by specified NotificationSlot object 342 * 343 * @param env Indicates the environment that the API is invoked under 344 * @param slot Indicates a NotificationSlot object to be converted 345 * @param result Indicates a js object to be set 346 * @return Returns the null object if success, returns the null value otherwise 347 */ 348 static napi_value SetNotificationSlot(const napi_env &env, const NotificationSlot &slot, napi_value &result); 349 350 /** 351 * @brief Sets a js object by specified NotificationContent object 352 * 353 * @param env Indicates the environment that the API is invoked under 354 * @param content Indicates a NotificationContent object to be converted 355 * @param result Indicates a js object to be set 356 * @return Returns the null object if success, returns the null value otherwise 357 */ 358 static napi_value SetNotificationContent( 359 const napi_env &env, const std::shared_ptr<NotificationContent> &content, napi_value &result); 360 361 /** 362 * @brief Sets a js object by the object of specified type in specified NotificationContent object 363 * 364 * @param env Indicates the environment that the API is invoked under 365 * @param type Indicates the content type 366 * @param content Indicates a NotificationContent object to be converted 367 * @param result Indicates a js object to be set 368 * @return Returns the null object if success, returns the null value otherwise 369 */ 370 static napi_value SetNotificationContentDetailed(const napi_env &env, const ContentType &type, 371 const std::shared_ptr<NotificationContent> &content, napi_value &result); 372 373 /** 374 * @brief Sets a js NotificationBasicContent object by specified NotificationBasicContent object 375 * 376 * @param env Indicates the environment that the API is invoked under 377 * @param basicContent Indicates a NotificationBasicContent object to be converted 378 * @param result Indicates a js object to be set 379 * @return Returns the null object if success, returns the null value otherwise 380 */ 381 static napi_value SetNotificationBasicContent( 382 const napi_env &env, const NotificationBasicContent *basicContent, napi_value &result); 383 384 /** 385 * @brief Sets a js NotificationLongTextContent object by specified NotificationBasicContent object 386 * 387 * @param env Indicates the environment that the API is invoked under 388 * @param basicContent Indicates a NotificationBasicContent object to be converted 389 * @param result Indicates a js object to be set 390 * @return Returns the null object if success, returns the null value otherwise 391 */ 392 static napi_value SetNotificationLongTextContent( 393 const napi_env &env, NotificationBasicContent *basicContent, napi_value &result); 394 395 /** 396 * @brief Sets a js NotificationPictureContent object by specified NotificationBasicContent object 397 * 398 * @param env Indicates the environment that the API is invoked under 399 * @param basicContent Indicates a NotificationBasicContent object to be converted 400 * @param result Indicates a js object to be set 401 * @return Returns the null object if success, returns the null value otherwise 402 */ 403 static napi_value SetNotificationPictureContent( 404 const napi_env &env, NotificationBasicContent *basicContent, napi_value &result); 405 406 /** 407 * @brief Sets a js NotificationConversationalContent object by specified NotificationBasicContent object 408 * 409 * @param env Indicates the environment that the API is invoked under 410 * @param basicContent Indicates a NotificationBasicContent object to be converted 411 * @param result Indicates a js object to be set 412 * @return Returns the null object if success, returns the null value otherwise 413 */ 414 static napi_value SetNotificationConversationalContent(const napi_env &env, 415 NotificationBasicContent *basicContent, napi_value &result); 416 417 /** 418 * @brief Sets a js NotificationMultiLineContent object by specified NotificationBasicContent object 419 * 420 * @param env Indicates the environment that the API is invoked under 421 * @param basicContent Indicates a NotificationBasicContent object to be converted 422 * @param result Indicates a js object to be set 423 * @return Returns the null object if success, returns the null value otherwise 424 */ 425 static napi_value SetNotificationMultiLineContent( 426 const napi_env &env, NotificationBasicContent *basicContent, napi_value &result); 427 428 /** 429 * @brief Sets a js NotificationLocalLiveViewContent object by specified NotificationBasicContent object 430 * 431 * @param env Indicates the environment that the API is invoked under 432 * @param basicContent Indicates a NotificationBasicContent object to be converted 433 * @param result Indicates a js object to be set 434 * @return Returns the null object if success, returns the null value otherwise 435 */ 436 static napi_value SetNotificationLocalLiveViewContent( 437 const napi_env &env, NotificationBasicContent *basicContent, napi_value &result); 438 439 /** 440 * @brief Sets a js object by specified NotificationCapsule object 441 * 442 * @param env Indicates the environment that the API is invoked under 443 * @param capsule Indicates a NotificationCapsule object to be converted 444 * @param result Indicates a js object to be set 445 * @return Returns the null object if success, returns the null value otherwise 446 */ 447 static napi_value SetCapsule(const napi_env &env, const NotificationCapsule &capsule, napi_value &result); 448 449 /** 450 * @brief Sets a js object by specified NotificationLocalLiveViewButton object 451 * 452 * @param env Indicates the environment that the API is invoked under 453 * @param capsule Indicates a NotificationLocalLiveViewButton object to be converted 454 * @param result Indicates a js object to be set 455 * @return Returns the null object if success, returns the null value otherwise 456 */ 457 static napi_value SetButton(const napi_env &env, const NotificationLocalLiveViewButton &button, napi_value &result); 458 459 /** 460 * @brief Sets a js object by specified NotificationProgress object 461 * 462 * @param env Indicates the environment that the API is invoked under 463 * @param capsule Indicates a NotificationProgress object to be converted 464 * @param result Indicates a js object to be set 465 * @return Returns the null object if success, returns the null value otherwise 466 */ 467 static napi_value SetProgress(const napi_env &env, const NotificationProgress &progress, napi_value &result); 468 469 /** 470 * @brief Sets a js object by specified NotificationTime object 471 * 472 * @param env Indicates the environment that the API is invoked under 473 * @param time Indicates a NotificationTime object to be converted 474 * @param isInitialTimeExist Indicates is initialTime exists 475 * @param result Indicates a js object to be set 476 * @return Returns the null object if success, returns the null value otherwise 477 */ 478 static napi_value SetTime(const napi_env &env, const NotificationTime &time, 479 napi_value &result, bool isInitialTimeExist); 480 481 /** 482 * @brief Sets a js NotificationLiveViewContent object by specified NotificationBasicContent object 483 * 484 * @param env Indicates the environment that the API is invoked under 485 * @param basicContent Indicates a NotificationBasicContent object to be converted 486 * @param result Indicates a js object to be set 487 * @return Returns the null object if success, returns the null value otherwise 488 */ 489 static napi_value SetNotificationLiveViewContent( 490 const napi_env &env, NotificationBasicContent *basicContent, napi_value &result); 491 492 /** 493 * @brief Sets a js liveview picturemap object by specified liveview picturemap 494 * 495 * @param env Indicates the environment that the API is invoked under 496 * @param pictureMap Indicates a picturemap object to be converted 497 * @return Returns the null object if success, returns the null value otherwise 498 */ 499 static napi_value SetLiveViewPictureInfo( 500 const napi_env &env, const std::map<std::string, std::vector<std::shared_ptr<Media::PixelMap>>> &pictureMap); 501 502 /** 503 * @brief Sets a js object by specified MessageUser object 504 * 505 * @param env Indicates the environment that the API is invoked under 506 * @param messageUser Indicates a MessageUser object to be converted 507 * @param result Indicates a js object to be set 508 * @return Returns the null object if success, returns the null value otherwise 509 */ 510 static napi_value SetMessageUser(const napi_env &env, const MessageUser &messageUser, napi_value &result); 511 512 /** 513 * @brief Sets a js object by specified NotificationConversationalContent object 514 * 515 * @param env Indicates the environment that the API is invoked under 516 * @param conversationalContent Indicates a NotificationConversationalContent object to be converted 517 * @param arr Indicates a js object to be set 518 * @return Returns the null object if success, returns the null value otherwise 519 */ 520 static napi_value SetConversationalMessages(const napi_env &env, 521 const OHOS::Notification::NotificationConversationalContent *conversationalContent, napi_value &arr); 522 523 /** 524 * @brief Sets a js object by specified NotificationConversationalMessage object 525 * 526 * @param env Indicates the environment that the API is invoked under 527 * @param conversationalMessage Indicates a NotificationConversationalMessage object to be converted 528 * @param result Indicates a js object to be set 529 * @return Returns the null object if success, returns the null value otherwise 530 */ 531 static napi_value SetConversationalMessage(const napi_env &env, 532 const std::shared_ptr<NotificationConversationalMessage> &conversationalMessage, napi_value &result); 533 534 /** 535 * @brief Sets a js object by specified NotificationActionButton object 536 * 537 * @param env Indicates the environment that the API is invoked under 538 * @param actionButton Indicates a NotificationActionButton object to be converted 539 * @param result Indicates a js object to be set 540 * @return Returns the null object if success, returns the null value otherwise 541 */ 542 static napi_value SetNotificationActionButton( 543 const napi_env &env, const std::shared_ptr<NotificationActionButton> &actionButton, napi_value &result); 544 545 /** 546 * @brief Sets a js object by the extra objects of specified NotificationActionButton object 547 * 548 * @param env Indicates the environment that the API is invoked under 549 * @param actionButton Indicates a NotificationActionButton object to be converted 550 * @param result Indicates a js object to be set 551 * @return Returns the null object if success, returns the null value otherwise 552 */ 553 static napi_value SetNotificationActionButtonByExtras( 554 const napi_env &env, const std::shared_ptr<NotificationActionButton> &actionButton, napi_value &result); 555 556 /** 557 * @brief Sets a js object by specified NotificationUserInput object 558 * 559 * @param env Indicates the environment that the API is invoked under 560 * @param userInput Indicates a NotificationUserInput object to be converted 561 * @param result Indicates a js object to be set 562 * @return Returns the null object if success, returns the null value otherwise 563 */ 564 static napi_value SetNotificationActionButtonByUserInput( 565 const napi_env &env, const std::shared_ptr<NotificationUserInput> &userInput, napi_value &result); 566 567 /** 568 * @brief Sets a js object by specified NotificationDoNotDisturbDate object 569 * 570 * @param env Indicates the environment that the API is invoked under 571 * @param date Indicates a NotificationDoNotDisturbDate object to be converted 572 * @param result Indicates a js object to be set 573 * @return Returns the null object if success, returns the null value otherwise 574 */ 575 static napi_value SetDoNotDisturbDate( 576 const napi_env &env, const NotificationDoNotDisturbDate &date, napi_value &result); 577 578 /** 579 * @brief Sets a js object by specified EnabledNotificationCallbackData object 580 * 581 * @param env Indicates the environment that the API is invoked under 582 * @param date Indicates a EnabledNotificationCallbackData object to be converted 583 * @param result Indicates a js object to be set 584 * @return Returns the null object if success, returns the null value otherwise 585 */ 586 static napi_value SetEnabledNotificationCallbackData(const napi_env &env, 587 const EnabledNotificationCallbackData &data, napi_value &result); 588 589 /** 590 * @brief Gets a NotificationSubscribeInfo object from specified js object 591 * 592 * @param env Indicates the environment that the API is invoked under 593 * @param value Indicates a js object to be converted 594 * @param result Indicates a NotificationSubscribeInfo object from specified js object 595 * @return Returns the null object if success, returns the null value otherwise 596 */ 597 static napi_value GetNotificationSubscriberInfo( 598 const napi_env &env, const napi_value &value, NotificationSubscribeInfo &result); 599 600 /** 601 * @brief Gets a NotificationRequest object from specified js object 602 * 603 * @param env Indicates the environment that the API is invoked under 604 * @param value Indicates a js object to be converted 605 * @param result Indicates a NotificationRequest object from specified js object 606 * @return Returns the null object if success, returns the null value otherwise 607 */ 608 static napi_value GetNotificationRequest( 609 const napi_env &env, const napi_value &value, NotificationRequest &request); 610 611 /** 612 * @brief Gets a NotificationRequest object by number type from specified js object 613 * 614 * @param env Indicates the environment that the API is invoked under 615 * @param value Indicates a js object to be converted 616 * @param request Indicates a NotificationRequest object from specified js object 617 * @return Returns the null object if success, returns the null value otherwise 618 */ 619 static napi_value GetNotificationRequestByNumber( 620 const napi_env &env, const napi_value &value, NotificationRequest &request); 621 622 /** 623 * @brief Gets a NotificationRequest object by string type from specified js object 624 * 625 * @param env Indicates the environment that the API is invoked under 626 * @param value Indicates a js object to be converted 627 * @param request Indicates a NotificationRequest object from specified js object 628 * @return Returns the null object if success, returns the null value otherwise 629 */ 630 static napi_value GetNotificationRequestByString( 631 const napi_env &env, const napi_value &value, NotificationRequest &request); 632 633 /** 634 * @brief Gets a NotificationRequest object by bool type from specified js object 635 * 636 * @param env Indicates the environment that the API is invoked under 637 * @param value Indicates a js object to be converted 638 * @param request Indicates a NotificationRequest object from specified js object 639 * @return Returns the null object if success, returns the null value otherwise 640 */ 641 static napi_value GetNotificationRequestByBool( 642 const napi_env &env, const napi_value &value, NotificationRequest &request); 643 644 /** 645 * @brief Gets a NotificationRequest object by custom type from specified js object 646 * 647 * @param env Indicates the environment that the API is invoked under 648 * @param value Indicates a js object to be converted 649 * @param request Indicates a NotificationRequest object from specified js object 650 * @return Returns the null object if success, returns the null value otherwise 651 */ 652 static napi_value GetNotificationRequestByCustom( 653 const napi_env &env, const napi_value &value, NotificationRequest &request); 654 655 /** 656 * @brief Gets the id of NotificationRequest object from specified js object 657 * 658 * @param env Indicates the environment that the API is invoked under 659 * @param value Indicates a js object to be converted 660 * @param request Indicates a NotificationRequest object from specified js object 661 * @return Returns the null object if success, returns the null value otherwise 662 */ 663 static napi_value GetNotificationId(const napi_env &env, const napi_value &value, NotificationRequest &request); 664 665 /** 666 * @brief Gets the slot type of NotificationRequest object from specified js object 667 * 668 * @param env Indicates the environment that the API is invoked under 669 * @param value Indicates a js object to be converted 670 * @param request Indicates a NotificationRequest object from specified js object 671 * @return Returns the null object if success, returns the null value otherwise 672 */ 673 static napi_value GetNotificationSlotType( 674 const napi_env &env, const napi_value &value, NotificationRequest &request); 675 676 /** 677 * @brief Gets the isOngoing flag of NotificationRequest object from specified js object 678 * 679 * @param env Indicates the environment that the API is invoked under 680 * @param value Indicates a js object to be converted 681 * @param request Indicates a NotificationRequest object from specified js object 682 * @return Returns the null object if success, returns the null value otherwise 683 */ 684 static napi_value GetNotificationIsOngoing( 685 const napi_env &env, const napi_value &value, NotificationRequest &request); 686 687 /** 688 * @brief Gets the isUnremovable flag of NotificationRequest object from specified js object 689 * 690 * @param env Indicates the environment that the API is invoked under 691 * @param value Indicates a js object to be converted 692 * @param request Indicates a NotificationRequest object from specified js object 693 * @return Returns the null object if success, returns the null value otherwise 694 */ 695 static napi_value GetNotificationIsUnremovable( 696 const napi_env &env, const napi_value &value, NotificationRequest &request); 697 698 /** 699 * @brief Gets the delivery time of NotificationRequest object from specified js object 700 * 701 * @param env Indicates the environment that the API is invoked under 702 * @param value Indicates a js object to be converted 703 * @param request Indicates a NotificationRequest object from specified js object 704 * @return Returns the null object if success, returns the null value otherwise 705 */ 706 static napi_value GetNotificationDeliveryTime( 707 const napi_env &env, const napi_value &value, NotificationRequest &request); 708 709 /** 710 * @brief Gets the tapDismissed flag of NotificationRequest object from specified js object 711 * 712 * @param env Indicates the environment that the API is invoked under 713 * @param value Indicates a js object to be converted 714 * @param request Indicates a NotificationRequest object from specified js object 715 * @return Returns the null object if success, returns the null value otherwise 716 */ 717 static napi_value GetNotificationtapDismissed( 718 const napi_env &env, const napi_value &value, NotificationRequest &request); 719 720 /** 721 * @brief Gets the extra information of NotificationRequest object from specified js object 722 * 723 * @param env Indicates the environment that the API is invoked under 724 * @param value Indicates a js object to be converted 725 * @param request Indicates a NotificationRequest object from specified js object 726 * @return Returns the null object if success, returns the null value otherwise 727 */ 728 static napi_value GetNotificationExtraInfo( 729 const napi_env &env, const napi_value &value, NotificationRequest &request); 730 731 /** 732 * @brief Gets the group name of NotificationRequest object from specified js object 733 * 734 * @param env Indicates the environment that the API is invoked under 735 * @param value Indicates a js object to be converted 736 * @param request Indicates a NotificationRequest object from specified js object 737 * @return Returns the null object if success, returns the null value otherwise 738 */ 739 static napi_value GetNotificationGroupName( 740 const napi_env &env, const napi_value &value, NotificationRequest &request); 741 742 /** 743 * @brief Gets the removal WantAgent object of NotificationRequest object from specified js object 744 * 745 * @param env Indicates the environment that the API is invoked under 746 * @param value Indicates a js object to be converted 747 * @param request Indicates a NotificationRequest object from specified js object 748 * @return Returns the null object if success, returns the null value otherwise 749 */ 750 static napi_value GetNotificationRemovalWantAgent( 751 const napi_env &env, const napi_value &value, NotificationRequest &request); 752 753 /** 754 * @brief Gets the max screen WantAgent object of NotificationRequest object from specified js object 755 * 756 * @param env Indicates the environment that the API is invoked under 757 * @param value Indicates a js object to be converted 758 * @param request Indicates a NotificationRequest object from specified js object 759 * @return Returns the null object if success, returns the null value otherwise 760 */ 761 static napi_value GetNotificationMaxScreenWantAgent( 762 const napi_env &env, const napi_value &value, NotificationRequest &request); 763 764 /** 765 * @brief Gets the auto deleted time of NotificationRequest object from specified js object 766 * 767 * @param env Indicates the environment that the API is invoked under 768 * @param value Indicates a js object to be converted 769 * @param request Indicates a NotificationRequest object from specified js object 770 * @return Returns the null object if success, returns the null value otherwise 771 */ 772 static napi_value GetNotificationAutoDeletedTime( 773 const napi_env &env, const napi_value &value, NotificationRequest &request); 774 775 /** 776 * @brief Gets the classification of NotificationRequest object from specified js object 777 * 778 * @param env Indicates the environment that the API is invoked under 779 * @param value Indicates a js object to be converted 780 * @param request Indicates a NotificationRequest object from specified js object 781 * @return Returns the null object if success, returns the null value otherwise 782 */ 783 static napi_value GetNotificationClassification( 784 const napi_env &env, const napi_value &value, NotificationRequest &request); 785 786 /** 787 * @brief Gets the appMessageId of NotificationRequest object from specified js object 788 * 789 * @param env Indicates the environment that the API is invoked under 790 * @param value Indicates a js object to be converted 791 * @param request Indicates a NotificationRequest object from specified js object 792 * @return Returns the null object if success, returns the null value otherwise 793 */ 794 static napi_value GetNotificationAppMessageId( 795 const napi_env &env, const napi_value &value, NotificationRequest &request); 796 797 /** 798 * @brief Gets the sound of NotificationRequest object from specified js object 799 * 800 * @param env Indicates the environment that the API is invoked under 801 * @param value Indicates a js object to be converted 802 * @param request Indicates a NotificationRequest object from specified js object 803 * @return Returns the null object if success, returns the null value otherwise 804 */ 805 static napi_value GetNotificationSound( 806 const napi_env &env, const napi_value &value, NotificationRequest &request); 807 808 /** 809 * @brief Gets the color of NotificationRequest object from specified js object 810 * 811 * @param env Indicates the environment that the API is invoked under 812 * @param value Indicates a js object to be converted 813 * @param request Indicates a NotificationRequest object from specified js object 814 * @return Returns the null object if success, returns the null value otherwise 815 */ 816 static napi_value GetNotificationColor(const napi_env &env, const napi_value &value, NotificationRequest &request); 817 818 /** 819 * @brief Gets the colorEnabled flag of NotificationRequest object from specified js object 820 * 821 * @param env Indicates the environment that the API is invoked under 822 * @param value Indicates a js object to be converted 823 * @param request Indicates a NotificationRequest object from specified js object 824 * @return Returns the null object if success, returns the null value otherwise 825 */ 826 static napi_value GetNotificationColorEnabled( 827 const napi_env &env, const napi_value &value, NotificationRequest &request); 828 829 /** 830 * @brief Gets the isAlertOnce flag of NotificationRequest object from specified js object 831 * 832 * @param env Indicates the environment that the API is invoked under 833 * @param value Indicates a js object to be converted 834 * @param request Indicates a NotificationRequest object from specified js object 835 * @return Returns the null object if success, returns the null value otherwise 836 */ 837 static napi_value GetNotificationIsAlertOnce( 838 const napi_env &env, const napi_value &value, NotificationRequest &request); 839 840 /** 841 * @brief Gets the isStopwatch flag of NotificationRequest object from specified js object 842 * 843 * @param env Indicates the environment that the API is invoked under 844 * @param value Indicates a js object to be converted 845 * @param request Indicates a NotificationRequest object from specified js object 846 * @return Returns the null object if success, returns the null value otherwise 847 */ 848 static napi_value GetNotificationIsStopwatch( 849 const napi_env &env, const napi_value &value, NotificationRequest &request); 850 851 /** 852 * @brief Gets the isCountDown flag of NotificationRequest object from specified js object 853 * 854 * @param env Indicates the environment that the API is invoked under 855 * @param value Indicates a js object to be converted 856 * @param request Indicates a NotificationRequest object from specified js object 857 * @return Returns the null object if success, returns the null value otherwise 858 */ 859 static napi_value GetNotificationIsCountDown( 860 const napi_env &env, const napi_value &value, NotificationRequest &request); 861 862 /** 863 * @brief Gets the status bar text of NotificationRequest object from specified js object 864 * 865 * @param env Indicates the environment that the API is invoked under 866 * @param value Indicates a js object to be converted 867 * @param request Indicates a NotificationRequest object from specified js object 868 * @return Returns the null object if success, returns the null value otherwise 869 */ 870 static napi_value GetNotificationStatusBarText( 871 const napi_env &env, const napi_value &value, NotificationRequest &request); 872 873 /** 874 * @brief Gets the label of NotificationRequest object from specified js object 875 * 876 * @param env Indicates the environment that the API is invoked under 877 * @param value Indicates a js object to be converted 878 * @param request Indicates a NotificationRequest object from specified js object 879 * @return Returns the null object if success, returns the null value otherwise 880 */ 881 static napi_value GetNotificationLabel(const napi_env &env, const napi_value &value, NotificationRequest &request); 882 883 /** 884 * @brief Gets the badge icon style of NotificationRequest object from specified js object 885 * 886 * @param env Indicates the environment that the API is invoked under 887 * @param value Indicates a js object to be converted 888 * @param request Indicates a NotificationRequest object from specified js object 889 * @return Returns the null object if success, returns the null value otherwise 890 */ 891 static napi_value GetNotificationBadgeIconStyle( 892 const napi_env &env, const napi_value &value, NotificationRequest &request); 893 894 /** 895 * @brief Gets the showDeliveryTime flag of NotificationRequest object from specified js object 896 * 897 * @param env Indicates the environment that the API is invoked under 898 * @param value Indicates a js object to be converted 899 * @param request Indicates a NotificationRequest object from specified js object 900 * @return Returns the null object if success, returns the null value otherwise 901 */ 902 static napi_value GetNotificationShowDeliveryTime( 903 const napi_env &env, const napi_value &value, NotificationRequest &request); 904 905 906 static napi_value GetNotificationIsRemoveAllowed( 907 const napi_env &env, const napi_value &value, NotificationRequest &request); 908 909 /** 910 * @brief Gets the content of NotificationRequest object from specified js object 911 * 912 * @param env Indicates the environment that the API is invoked under 913 * @param value Indicates a js object to be converted 914 * @param request Indicates a NotificationRequest object from specified js object 915 * @return Returns the null object if success, returns the null value otherwise 916 */ 917 static napi_value GetNotificationContent( 918 const napi_env &env, const napi_value &value, NotificationRequest &request); 919 920 /** 921 * @brief Gets the WantAgent object of NotificationRequest object from specified js object 922 * 923 * @param env Indicates the environment that the API is invoked under 924 * @param value Indicates a js object to be converted 925 * @param request Indicates a NotificationRequest object from specified js object 926 * @return Returns the null object if success, returns the null value otherwise 927 */ 928 static napi_value GetNotificationWantAgent( 929 const napi_env &env, const napi_value &value, NotificationRequest &request); 930 931 /** 932 * @brief Gets a NotificationSlot object from specified js object 933 * 934 * @param env Indicates the environment that the API is invoked under 935 * @param value Indicates a js object to be converted 936 * @param slot Indicates a NotificationSlot object from specified js object 937 * @return Returns the null object if success, returns the null value otherwise 938 */ 939 static napi_value GetNotificationSlot( 940 const napi_env &env, const napi_value &value, NotificationSlot &slot); 941 942 /** 943 * @brief Gets the string objects of NotificationSlot object from specified js object 944 * 945 * @param env Indicates the environment that the API is invoked under 946 * @param value Indicates a js object to be converted 947 * @param slot Indicates a NotificationSlot object from specified js object 948 * @return Returns the null object if success, returns the null value otherwise 949 */ 950 static napi_value GetNotificationSlotByString( 951 const napi_env &env, const napi_value &value, NotificationSlot &slot); 952 953 /** 954 * @brief Gets the bool objects of NotificationSlot object from specified js object 955 * 956 * @param env Indicates the environment that the API is invoked under 957 * @param value Indicates a js object to be converted 958 * @param slot Indicates a NotificationSlot object from specified js object 959 * @return Returns the null object if success, returns the null value otherwise 960 */ 961 static napi_value GetNotificationSlotByBool( 962 const napi_env &env, const napi_value &value, NotificationSlot &slot); 963 964 /** 965 * @brief Gets the number objects of NotificationSlot object from specified js object 966 * 967 * @param env Indicates the environment that the API is invoked under 968 * @param value Indicates a js object to be converted 969 * @param slot Indicates a NotificationSlot object from specified js object 970 * @return Returns the null object if success, returns the null value otherwise 971 */ 972 static napi_value GetNotificationSlotByNumber( 973 const napi_env &env, const napi_value &value, NotificationSlot &slot); 974 975 /** 976 * @brief Gets the vibration of NotificationSlot object from specified js object 977 * 978 * @param env Indicates the environment that the API is invoked under 979 * @param value Indicates a js object to be converted 980 * @param slot Indicates a NotificationSlot object from specified js object 981 * @return Returns the null object if success, returns the null value otherwise 982 */ 983 static napi_value GetNotificationSlotByVibration( 984 const napi_env &env, const napi_value &value, NotificationSlot &slot); 985 986 /** 987 * @brief Gets the action buttons of NotificationRequest object from specified js object 988 * 989 * @param env Indicates the environment that the API is invoked under 990 * @param value Indicates a js object to be converted 991 * @param request Indicates a NotificationRequest object from specified js object 992 * @return Returns the null object if success, returns the null value otherwise 993 */ 994 static napi_value GetNotificationActionButtons( 995 const napi_env &env, const napi_value &value, NotificationRequest &request); 996 997 /** 998 * @brief Gets a NotificationActionButton object from specified js object 999 * 1000 * @param env Indicates the environment that the API is invoked under 1001 * @param actionButton Indicates a js object to be converted 1002 * @param pActionButton Indicates a NotificationActionButton object from specified js object 1003 * @return Returns the null object if success, returns the null value otherwise 1004 */ 1005 static napi_value GetNotificationActionButtonsDetailed( 1006 const napi_env &env, const napi_value &actionButton, std::shared_ptr<NotificationActionButton> &pActionButton); 1007 1008 /** 1009 * @brief Gets the basic information of NotificationActionButton object from specified js object 1010 * 1011 * @param env Indicates the environment that the API is invoked under 1012 * @param actionButton Indicates a js object to be converted 1013 * @param pActionButton Indicates a NotificationActionButton object from specified js object 1014 * @return Returns the null object if success, returns the null value otherwise 1015 */ 1016 static napi_value GetNotificationActionButtonsDetailedBasicInfo( 1017 const napi_env &env, const napi_value &actionButton, std::shared_ptr<NotificationActionButton> &pActionButton); 1018 1019 /** 1020 * @brief Gets the extras of NotificationActionButton object from specified js object 1021 * 1022 * @param env Indicates the environment that the API is invoked under 1023 * @param actionButton Indicates a js object to be converted 1024 * @param pActionButton Indicates a NotificationActionButton object from specified js object 1025 * @return Returns the null object if success, returns the null value otherwise 1026 */ 1027 static napi_value GetNotificationActionButtonsDetailedByExtras( 1028 const napi_env &env, const napi_value &actionButton, std::shared_ptr<NotificationActionButton> &pActionButton); 1029 1030 /** 1031 * @brief Gets the user input of NotificationActionButton object from specified js object 1032 * 1033 * @param env Indicates the environment that the API is invoked under 1034 * @param actionButton Indicates a js object to be converted 1035 * @param pActionButton Indicates a NotificationActionButton object from specified js object 1036 * @return Returns the null object if success, returns the null value otherwise 1037 */ 1038 static napi_value GetNotificationUserInput( 1039 const napi_env &env, const napi_value &actionButton, std::shared_ptr<NotificationActionButton> &pActionButton); 1040 1041 /** 1042 * @brief Gets the input key of NotificationUserInput object from specified js object 1043 * 1044 * @param env Indicates the environment that the API is invoked under 1045 * @param userInputResult Indicates a js object to be converted 1046 * @param userInput Indicates a NotificationUserInput object from specified js object 1047 * @return Returns the null object if success, returns the null value otherwise 1048 */ 1049 static napi_value GetNotificationUserInputByInputKey( 1050 const napi_env &env, const napi_value &userInputResult, std::shared_ptr<NotificationUserInput> &userInput); 1051 1052 /** 1053 * @brief Gets the tag of NotificationUserInput object from specified js object 1054 * 1055 * @param env Indicates the environment that the API is invoked under 1056 * @param userInputResult Indicates a js object to be converted 1057 * @param userInput Indicates a NotificationUserInput object from specified js object 1058 * @return Returns the null object if success, returns the null value otherwise 1059 */ 1060 static napi_value GetNotificationUserInputByTag( 1061 const napi_env &env, const napi_value &userInputResult, std::shared_ptr<NotificationUserInput> &userInput); 1062 1063 /** 1064 * @brief Gets the options of NotificationUserInput object from specified js object 1065 * 1066 * @param env Indicates the environment that the API is invoked under 1067 * @param userInputResult Indicates a js object to be converted 1068 * @param userInput Indicates a NotificationUserInput object from specified js object 1069 * @return Returns the null object if success, returns the null value otherwise 1070 */ 1071 static napi_value GetNotificationUserInputByOptions( 1072 const napi_env &env, const napi_value &userInputResult, std::shared_ptr<NotificationUserInput> &userInput); 1073 1074 /** 1075 * @brief Gets the permit mime types of NotificationUserInput object from specified js object 1076 * 1077 * @param env Indicates the environment that the API is invoked under 1078 * @param userInputResult Indicates a js object to be converted 1079 * @param userInput Indicates a NotificationUserInput object from specified js object 1080 * @return Returns the null object if success, returns the null value otherwise 1081 */ 1082 static napi_value GetNotificationUserInputByPermitMimeTypes( 1083 const napi_env &env, const napi_value &userInputResult, std::shared_ptr<NotificationUserInput> &userInput); 1084 1085 /** 1086 * @brief Gets the permit free from input of NotificationUserInput object from specified js object 1087 * 1088 * @param env Indicates the environment that the API is invoked under 1089 * @param userInputResult Indicates a js object to be converted 1090 * @param userInput Indicates a NotificationUserInput object from specified js object 1091 * @return Returns the null object if success, returns the null value otherwise 1092 */ 1093 static napi_value GetNotificationUserInputByPermitFreeFormInput( 1094 const napi_env &env, const napi_value &userInputResult, std::shared_ptr<NotificationUserInput> &userInput); 1095 1096 /** 1097 * @brief Gets the edit type of NotificationUserInput object from specified js object 1098 * 1099 * @param env Indicates the environment that the API is invoked under 1100 * @param userInputResult Indicates a js object to be converted 1101 * @param userInput Indicates a NotificationUserInput object from specified js object 1102 * @return Returns the null object if success, returns the null value otherwise 1103 */ 1104 static napi_value GetNotificationUserInputByEditType( 1105 const napi_env &env, const napi_value &userInputResult, std::shared_ptr<NotificationUserInput> &userInput); 1106 1107 /** 1108 * @brief Gets the additional data of NotificationUserInput object from specified js object 1109 * 1110 * @param env Indicates the environment that the API is invoked under 1111 * @param userInputResult Indicates a js object to be converted 1112 * @param userInput Indicates a NotificationUserInput object from specified js object 1113 * @return Returns the null object if success, returns the null value otherwise 1114 */ 1115 static napi_value GetNotificationUserInputByAdditionalData( 1116 const napi_env &env, const napi_value &userInputResult, std::shared_ptr<NotificationUserInput> &userInput); 1117 1118 /** 1119 * @brief Gets the small icon of NotificationRequest object from specified js object 1120 * 1121 * @param env Indicates the environment that the API is invoked under 1122 * @param value Indicates a js object to be converted 1123 * @param request Indicates a NotificationRequest object from specified js object 1124 * @return Returns the null object if success, returns the null value otherwise 1125 */ 1126 static napi_value GetNotificationSmallIcon( 1127 const napi_env &env, const napi_value &value, NotificationRequest &request); 1128 1129 /** 1130 * @brief Gets the large icon of NotificationRequest object from specified js object 1131 * 1132 * @param env Indicates the environment that the API is invoked under 1133 * @param value Indicates a js object to be converted 1134 * @param request Indicates a NotificationRequest object from specified js object 1135 * @return Returns the null object if success, returns the null value otherwise 1136 */ 1137 static napi_value GetNotificationLargeIcon( 1138 const napi_env &env, const napi_value &value, NotificationRequest &request); 1139 1140 /** 1141 * @brief Gets the overlay icon of NotificationRequest object from specified js object 1142 * 1143 * @param env Indicates the environment that the API is invoked under 1144 * @param value Indicates a js object to be converted 1145 * @param request Indicates a NotificationRequest object from specified js object 1146 * @return Returns the null object if success, returns the null value otherwise 1147 */ 1148 static napi_value GetNotificationOverlayIcon( 1149 const napi_env &env, const napi_value &value, NotificationRequest &request); 1150 1151 /** 1152 * @brief Gets the distributed options of NotificationRequest object from specified js object 1153 * 1154 * @param env Indicates the environment that the API is invoked under 1155 * @param value Indicates a js object to be converted 1156 * @param request Indicates a NotificationRequest object from specified js object 1157 * @return Returns the null object if success, returns the null value otherwise 1158 */ 1159 static napi_value GetNotificationRequestDistributedOptions( 1160 const napi_env &env, const napi_value &value, NotificationRequest &request); 1161 1162 /** 1163 * @brief Gets the isDistributed flag of NotificationRequest object from specified js object 1164 * 1165 * @param env Indicates the environment that the API is invoked under 1166 * @param value Indicates a js object to be converted 1167 * @param request Indicates a NotificationRequest object from specified js object 1168 * @return Returns the null object if success, returns the null value otherwise 1169 */ 1170 static napi_value GetNotificationIsDistributed( 1171 const napi_env &env, const napi_value &value, NotificationRequest &request); 1172 1173 /** 1174 * @brief Gets the devices that support display of NotificationRequest object from specified js object 1175 * 1176 * @param env Indicates the environment that the API is invoked under 1177 * @param value Indicates a js object to be converted 1178 * @param request Indicates a NotificationRequest object from specified js object 1179 * @return Returns the null object if success, returns the null value otherwise 1180 */ 1181 static napi_value GetNotificationSupportDisplayDevices( 1182 const napi_env &env, const napi_value &value, NotificationRequest &request); 1183 1184 /** 1185 * @brief Gets the devices that support operation of NotificationRequest object from specified js object 1186 * 1187 * @param env Indicates the environment that the API is invoked under 1188 * @param value Indicates a js object to be converted 1189 * @param request Indicates a NotificationRequest object from specified js object 1190 * @return Returns the null object if success, returns the null value otherwise 1191 */ 1192 static napi_value GetNotificationSupportOperateDevices( 1193 const napi_env &env, const napi_value &value, NotificationRequest &request); 1194 1195 /** 1196 * @brief Gets a content type of notification from specified js object 1197 * 1198 * @param env Indicates the environment that the API is invoked under 1199 * @param value Indicates a js object to be converted 1200 * @param type Indicates a the content type of notification from specified js object 1201 * @return Returns the null object if success, returns the null value otherwise 1202 */ 1203 static napi_value GetNotificationContentType(const napi_env &env, const napi_value &result, int32_t &type); 1204 1205 /** 1206 * @brief Gets a basic content of NotificationRequest object from specified js object 1207 * 1208 * @param env Indicates the environment that the API is invoked under 1209 * @param value Indicates a js object to be converted 1210 * @param request Indicates a NotificationRequest object from specified js object 1211 * @return Returns the null object if success, returns the null value otherwise 1212 */ 1213 static napi_value GetNotificationBasicContent( 1214 const napi_env &env, const napi_value &result, NotificationRequest &request); 1215 1216 /** 1217 * @brief Gets a NotificationBasicContent object from specified js object 1218 * 1219 * @param env Indicates the environment that the API is invoked under 1220 * @param contentResult Indicates a js object to be converted 1221 * @param basicContent Indicates a NotificationBasicContent object from specified js object 1222 * @return Returns the null object if success, returns the null value otherwise 1223 */ 1224 static napi_value GetNotificationBasicContentDetailed( 1225 const napi_env &env, const napi_value &contentResult, std::shared_ptr<NotificationBasicContent> basicContent); 1226 1227 /** 1228 * @brief Gets a long-text content of NotificationRequest object from specified js object 1229 * 1230 * @param env Indicates the environment that the API is invoked under 1231 * @param value Indicates a js object to be converted 1232 * @param request Indicates a NotificationRequest object from specified js object 1233 * @return Returns the null object if success, returns the null value otherwise 1234 */ 1235 static napi_value GetNotificationLongTextContent( 1236 const napi_env &env, const napi_value &result, NotificationRequest &request); 1237 1238 /** 1239 * @brief Gets a NotificationLongTextContent object from specified js object 1240 * 1241 * @param env Indicates the environment that the API is invoked under 1242 * @param contentResult Indicates a js object to be converted 1243 * @param longContent Indicates a NotificationLongTextContent object from specified js object 1244 * @return Returns the null object if success, returns the null value otherwise 1245 */ 1246 static napi_value GetNotificationLongTextContentDetailed( 1247 const napi_env &env, const napi_value &contentResult, 1248 std::shared_ptr<OHOS::Notification::NotificationLongTextContent> &longContent); 1249 1250 /** 1251 * @brief Gets a picture content of NotificationRequest object from specified js object 1252 * 1253 * @param env Indicates the environment that the API is invoked under 1254 * @param result Indicates a js object to be converted 1255 * @param request Indicates a NotificationRequest object from specified js object 1256 * @return Returns the null object if success, returns the null value otherwise 1257 */ 1258 static napi_value GetNotificationPictureContent( 1259 const napi_env &env, const napi_value &result, NotificationRequest &request); 1260 1261 /** 1262 * @brief Gets a NotificationPictureContent object from specified js object 1263 * 1264 * @param env Indicates the environment that the API is invoked under 1265 * @param contentResult Indicates a js object to be converted 1266 * @param pictureContent Indicates a NotificationPictureContent object from specified js object 1267 * @return Returns the null object if success, returns the null value otherwise 1268 */ 1269 static napi_value GetNotificationPictureContentDetailed( 1270 const napi_env &env, const napi_value &contentResult, 1271 std::shared_ptr<OHOS::Notification::NotificationPictureContent> &pictureContent); 1272 1273 /** 1274 * @brief Gets a NotificationLocalLiveViewContent object from specified js object 1275 * 1276 * @param env Indicates the environment that the API is invoked under 1277 * @param result Indicates a js object to be converted 1278 * @param request Indicates a NotificationLocalLiveViewContent object from specified js object 1279 * @return Returns the null object if success, returns the null value otherwise 1280 */ 1281 static napi_value GetNotificationLocalLiveViewContent( 1282 const napi_env &env, const napi_value &result, NotificationRequest &request); 1283 1284 /** 1285 * @brief Gets a capsule of NotificationLocalLiveViewContent object from specified js object 1286 * 1287 * @param env Indicates the environment that the API is invoked under 1288 * @param contentResult Indicates a js object to be converted 1289 * @param content Indicates a capsule object from specified js object 1290 * @return Returns the null object if success, returns the null value otherwise 1291 */ 1292 static napi_value GetNotificationLocalLiveViewCapsule( 1293 const napi_env &env, const napi_value &contentResult, 1294 std::shared_ptr<OHOS::Notification::NotificationLocalLiveViewContent> content); 1295 1296 /** 1297 * @brief Gets a button of NotificationLocalLiveViewContent object from specified js object 1298 * 1299 * @param env Indicates the environment that the API is invoked under 1300 * @param contentResult Indicates a js object to be converted 1301 * @param content Indicates a button object from specified js object 1302 * @return Returns the null object if success, returns the null value otherwise 1303 */ 1304 static napi_value GetNotificationLocalLiveViewButton( 1305 const napi_env &env, const napi_value &contentResult, 1306 std::shared_ptr<OHOS::Notification::NotificationLocalLiveViewContent> content); 1307 1308 /** 1309 * @brief Gets a time of NotificationLocalLiveViewContent object from specified js object 1310 * 1311 * @param env Indicates the environment that the API is invoked under 1312 * @param contentResult Indicates a js object to be converted 1313 * @param content Indicates a time object from specified js object 1314 * @return Returns the null object if success, returns the null value otherwise 1315 */ 1316 static napi_value GetNotificationLocalLiveViewTime( 1317 const napi_env &env, const napi_value &contentResult, 1318 std::shared_ptr<OHOS::Notification::NotificationLocalLiveViewContent> content); 1319 1320 /** 1321 * @brief Gets a progress of NotificationLocalLiveViewContent object from specified js object 1322 * 1323 * @param env Indicates the environment that the API is invoked under 1324 * @param contentResult Indicates a js object to be converted 1325 * @param content Indicates a progress object from specified js object 1326 * @return Returns the null object if success, returns the null value otherwise 1327 */ 1328 static napi_value GetNotificationLocalLiveViewProgress( 1329 const napi_env &env, const napi_value &contentResult, 1330 std::shared_ptr<OHOS::Notification::NotificationLocalLiveViewContent> content); 1331 1332 /** 1333 * @brief Gets a NotificationLocalLiveViewContent object from specified js object 1334 * 1335 * @param env Indicates the environment that the API is invoked under 1336 * @param contentResult Indicates a js object to be converted 1337 * @param content Indicates a NotificationLocalLiveViewContent object from specified js object 1338 * @return Returns the null object if success, returns the null value otherwise 1339 */ 1340 static napi_value GetNotificationLocalLiveViewContentDetailed( 1341 const napi_env &env, const napi_value &contentResult, 1342 std::shared_ptr<OHOS::Notification::NotificationLocalLiveViewContent> content); 1343 1344 /** 1345 * @brief Gets a conversational content of NotificationRequest object from specified js object 1346 * 1347 * @param env Indicates the environment that the API is invoked under 1348 * @param result Indicates a js object to be converted 1349 * @param request Indicates a NotificationRequest object from specified js object 1350 * @return Returns the null object if success, returns the null value otherwise 1351 */ 1352 static napi_value GetNotificationConversationalContent( 1353 const napi_env &env, const napi_value &result, NotificationRequest &request); 1354 1355 /** 1356 * @brief Gets the user of NotificationConversationalContent object from specified js object 1357 * 1358 * @param env Indicates the environment that the API is invoked under 1359 * @param contentResult Indicates a js object to be converted 1360 * @param user Indicates a MessageUser object from specified js object 1361 * @return Returns the null object if success, returns the null value otherwise 1362 */ 1363 static napi_value GetNotificationConversationalContentByUser( 1364 const napi_env &env, const napi_value &contentResult, MessageUser &user); 1365 1366 /** 1367 * @brief Gets the title of NotificationConversationalContent object from specified js object 1368 * 1369 * @param env Indicates the environment that the API is invoked under 1370 * @param contentResult Indicates a js object to be converted 1371 * @param conversationalContent Indicates a NotificationConversationalContent object from specified js object 1372 * @return Returns the null object if success, returns the null value otherwise 1373 */ 1374 static napi_value GetNotificationConversationalContentTitle( 1375 const napi_env &env, const napi_value &contentResult, 1376 std::shared_ptr<OHOS::Notification::NotificationConversationalContent> &conversationalContent); 1377 1378 /** 1379 * @brief Gets the group of NotificationConversationalContent object from specified js object 1380 * 1381 * @param env Indicates the environment that the API is invoked under 1382 * @param contentResult Indicates a js object to be converted 1383 * @param conversationalContent Indicates a NotificationConversationalContent object from specified js object 1384 * @return Returns the null object if success, returns the null value otherwise 1385 */ 1386 static napi_value GetNotificationConversationalContentGroup( 1387 const napi_env &env, const napi_value &contentResult, 1388 std::shared_ptr<OHOS::Notification::NotificationConversationalContent> &conversationalContent); 1389 1390 /** 1391 * @brief Gets the messages of NotificationConversationalContent object from specified js object 1392 * 1393 * @param env Indicates the environment that the API is invoked under 1394 * @param contentResult Indicates a js object to be converted 1395 * @param conversationalContent Indicates a NotificationConversationalContent object from specified js object 1396 * @return Returns the null object if success, returns the null value otherwise 1397 */ 1398 static napi_value GetNotificationConversationalContentMessages( 1399 const napi_env &env, const napi_value &contentResult, 1400 std::shared_ptr<OHOS::Notification::NotificationConversationalContent> &conversationalContent); 1401 1402 /** 1403 * @brief Gets a NotificationConversationalMessage object from specified js object 1404 * 1405 * @param env Indicates the environment that the API is invoked under 1406 * @param conversationalMessage Indicates a js object to be converted 1407 * @param message Indicates a NotificationConversationalMessage object from specified js object 1408 * @return Returns the null object if success, returns the null value otherwise 1409 */ 1410 static napi_value GetConversationalMessage( 1411 const napi_env &env, const napi_value &conversationalMessage, 1412 std::shared_ptr<NotificationConversationalMessage> &message); 1413 1414 /** 1415 * @brief Gets the basic information of NotificationConversationalMessage object from specified js object 1416 * 1417 * @param env Indicates the environment that the API is invoked under 1418 * @param conversationalMessage Indicates a js object to be converted 1419 * @param message Indicates a NotificationConversationalMessage object from specified js object 1420 * @return Returns the null object if success, returns the null value otherwise 1421 */ 1422 static napi_value GetConversationalMessageBasicInfo( 1423 const napi_env &env, const napi_value &conversationalMessage, 1424 std::shared_ptr<NotificationConversationalMessage> &message); 1425 1426 /** 1427 * @brief Gets the other information of NotificationConversationalMessage object from specified js object 1428 * 1429 * @param env Indicates the environment that the API is invoked under 1430 * @param conversationalMessage Indicates a js object to be converted 1431 * @param message Indicates a NotificationConversationalMessage object from specified js object 1432 * @return Returns the null object if success, returns the null value otherwise 1433 */ 1434 static napi_value GetConversationalMessageOtherInfo( 1435 const napi_env &env, const napi_value &conversationalMessage, 1436 std::shared_ptr<NotificationConversationalMessage> &message); 1437 1438 /** 1439 * @brief Gets a MessageUser object from specified js object 1440 * 1441 * @param env Indicates the environment that the API is invoked under 1442 * @param result Indicates a js object to be converted 1443 * @param messageUser Indicates a MessageUser object from specified js object 1444 * @return Returns the null object if success, returns the null value otherwise 1445 */ 1446 static napi_value GetMessageUser(const napi_env &env, const napi_value &result, MessageUser &messageUser); 1447 1448 /** 1449 * @brief Gets a MessageUser object from specified js object 1450 * 1451 * @param env Indicates the environment that the API is invoked under 1452 * @param result Indicates a js object to be converted 1453 * @param messageUser Indicates a MessageUser object from specified js object 1454 * @return Returns the null object if success, returns the null value otherwise 1455 */ 1456 static napi_value GetMessageUserByString(const napi_env &env, const napi_value &result, MessageUser &messageUser); 1457 1458 /** 1459 * @brief Gets the bool objects of MessageUser object from specified js object 1460 * 1461 * @param env Indicates the environment that the API is invoked under 1462 * @param result Indicates a js object to be converted 1463 * @param messageUser Indicates a MessageUser object from specified js object 1464 * @return Returns the null object if success, returns the null value otherwise 1465 */ 1466 static napi_value GetMessageUserByBool(const napi_env &env, const napi_value &result, MessageUser &messageUser); 1467 1468 /** 1469 * @brief Gets the custom objects of MessageUser object from specified js object 1470 * 1471 * @param env Indicates the environment that the API is invoked under 1472 * @param result Indicates a js object to be converted 1473 * @param messageUser Indicates a MessageUser object from specified js object 1474 * @return Returns the null object if success, returns the null value otherwise 1475 */ 1476 static napi_value GetMessageUserByCustom(const napi_env &env, const napi_value &result, MessageUser &messageUser); 1477 1478 /** 1479 * @brief Gets the multi-line content of NotificationRequest object from specified js object 1480 * 1481 * @param env Indicates the environment that the API is invoked under 1482 * @param result Indicates a js object to be converted 1483 * @param request Indicates a NotificationRequest object from specified js object 1484 * @return Returns the null object if success, returns the null value otherwise 1485 */ 1486 static napi_value GetNotificationMultiLineContent( 1487 const napi_env &env, const napi_value &result, NotificationRequest &request); 1488 1489 /** 1490 * @brief Gets the lines of NotificationMultiLineContent object from specified js object 1491 * 1492 * @param env Indicates the environment that the API is invoked under 1493 * @param result Indicates a js object to be converted 1494 * @param multiLineContent Indicates a NotificationMultiLineContent object from specified js object 1495 * @return Returns the null object if success, returns the null value otherwise 1496 */ 1497 static napi_value GetNotificationMultiLineContentLines(const napi_env &env, const napi_value &result, 1498 std::shared_ptr<OHOS::Notification::NotificationMultiLineContent> &multiLineContent); 1499 1500 /** 1501 * @brief Gets the liveView content of NotificationRequest object from specified js object 1502 * 1503 * @param env Indicates the environment that the API is invoked under 1504 * @param result Indicates a js object to be converted 1505 * @param request Indicates a NotificationRequest object from specified js object 1506 * @return Returns the null object if success, returns the null value otherwise 1507 */ 1508 static napi_value GetNotificationLiveViewContent( 1509 const napi_env &env, const napi_value &result, NotificationRequest &request); 1510 1511 /** 1512 * @brief Gets a NotificationLiveViewContent object from specified js object 1513 * 1514 * @param env Indicates the environment that the API is invoked under 1515 * @param contentResult Indicates a js object to be converted 1516 * @param liveViewContent Indicates a NotificationMultiLineContent object from specified js object 1517 * @return Returns the null object if success, returns the null value otherwise 1518 */ 1519 static napi_value GetNotificationLiveViewContentDetailed(const napi_env &env, const napi_value &contentResult, 1520 std::shared_ptr<NotificationLiveViewContent> &liveViewContent); 1521 1522 /** 1523 * @brief Gets a GetLiveViewPictures from specified js object 1524 * 1525 * @param env Indicates the environment that the API is invoked under 1526 * @param picturesObj Indicates a js object to be converted 1527 * @param pictures Indicates pictures object from specified js object 1528 * @return Returns the null object if success, returns the null value otherwise 1529 */ 1530 static napi_value GetLiveViewPictures(const napi_env &env, const napi_value &picturesObj, 1531 std::vector<std::shared_ptr<Media::PixelMap>> &pictures); 1532 1533 /** 1534 * @brief Gets a GetLiveViewPictures from specified js object 1535 * 1536 * @param env Indicates the environment that the API is invoked under 1537 * @param pictureMapObj Indicates a js object to be converted 1538 * @param pictureMap Indicates picturemap from specified js object 1539 * @return Returns the null object if success, returns the null value otherwise 1540 */ 1541 static napi_value GetLiveViewPictureInfo(const napi_env &env, const napi_value &pictureMapObj, 1542 std::map<std::string, std::vector<std::shared_ptr<Media::PixelMap>>> &pictureMap); 1543 1544 /** 1545 * @brief Gets a NotificationBundleOption object from specified js object 1546 * 1547 * @param env Indicates the environment that the API is invoked under 1548 * @param value Indicates a js object to be converted 1549 * @param option Indicates a NotificationBundleOption object from specified js object 1550 * @return Returns the null object if success, returns the null value otherwise 1551 */ 1552 static napi_value GetBundleOption(const napi_env &env, const napi_value &value, NotificationBundleOption &option); 1553 1554 /** 1555 * @brief Gets a NotificationButtonOption object from specified js object 1556 * 1557 * @param env Indicates the environment that the API is invoked under 1558 * @param value Indicates a js object to be converted 1559 * @param option Indicates a NotificationButtonOption object from specified js object 1560 * @return Returns the null object if success, returns the null value otherwise 1561 */ 1562 static napi_value GetButtonOption(const napi_env &env, const napi_value &value, NotificationButtonOption &option); 1563 1564 static napi_value GetHashCodes(const napi_env &env, const napi_value &value, std::vector<std::string> &hashCodes); 1565 1566 /** 1567 * @brief Gets a NotificationKey object from specified js object 1568 * 1569 * @param env Indicates the environment that the API is invoked under 1570 * @param value Indicates a js object to be converted 1571 * @param key Indicates a NotificationKey object from specified js object 1572 * @return Returns the null object if success, returns the null value otherwise 1573 */ 1574 static napi_value GetNotificationKey(const napi_env &env, const napi_value &value, NotificationKey &key); 1575 1576 /** 1577 * @brief Creates a js object from specified WantAgent object 1578 * 1579 * @param env Indicates the environment that the API is invoked under 1580 * @param agent Indicates specified WantAgent object 1581 * @return Returns a js object from specified WantAgent object 1582 */ 1583 static napi_value CreateWantAgentByJS(const napi_env &env, 1584 const std::shared_ptr<AbilityRuntime::WantAgent::WantAgent> &agent); 1585 1586 /** 1587 * @brief Gets the template of NotificationRequest object from specified js object 1588 * 1589 * @param env Indicates the environment that the API is invoked under 1590 * @param value Indicates a js object to be converted 1591 * @param request Indicates a NotificationRequest object from specified js object 1592 * @return Returns the null object if success, returns the null value otherwise 1593 */ 1594 static napi_value GetNotificationTemplate( 1595 const napi_env &env, const napi_value &value, NotificationRequest &request); 1596 1597 /** 1598 * @brief Gets a NotificationTemplate object from specified js object 1599 * 1600 * @param env Indicates the environment that the API is invoked under 1601 * @param value Indicates a js object to be converted 1602 * @param templ Indicates a NotificationTemplate object from specified js object 1603 * @return Returns the null object if success, returns the null value otherwise 1604 */ 1605 static napi_value GetNotificationTemplateInfo(const napi_env &env, const napi_value &value, 1606 std::shared_ptr<NotificationTemplate> &templ); 1607 1608 /** 1609 * @brief Sets a js object by specified NotificationTemplate object 1610 * 1611 * @param env Indicates the environment that the API is invoked under 1612 * @param templ Indicates a NotificationTemplate object to be converted 1613 * @param result Indicates a js object to be set 1614 * @return Returns the null object if success, returns the null value otherwise 1615 */ 1616 static napi_value SetNotificationTemplateInfo( 1617 const napi_env &env, const std::shared_ptr<NotificationTemplate> &templ, napi_value &result); 1618 1619 /** 1620 * @brief Sets a js object by specified NotificationBundleOption object. 1621 * 1622 * @param env Indicates the environment that the API is invoked under. 1623 * @param NotificationBundleOption Indicates a NotificationBundleOption object to be converted. 1624 * @param result Indicates a js object to be set. 1625 * @return Returns the null object if success, returns the null value otherwise. 1626 */ 1627 static napi_value SetNotificationEnableStatus( 1628 const napi_env &env, const NotificationBundleOption &bundleOption, napi_value &result); 1629 1630 /** 1631 * @brief Sets a js object by specified NotificationFlags object 1632 * 1633 * @param env Indicates the environment that the API is invoked under 1634 * @param flags Indicates a NotificationFlags object to be converted 1635 * @param result Indicates a js object to be set 1636 * @return Returns the null object if success, returns the null value otherwise 1637 */ 1638 static napi_value SetNotificationFlags( 1639 const napi_env &env, const std::shared_ptr<NotificationFlags> &flags, napi_value &result); 1640 1641 /** 1642 * @brief Sets a js object by specified NotificationUnifiedGroupInfo object 1643 * 1644 * @param env Indicates the environment that the API is invoked under 1645 * @param flags Indicates a NotificationUnifiedGroupInfo object to be converted 1646 * @param result Indicates a js object to be set 1647 * @return Returns the null object if success, returns the null value otherwise 1648 */ 1649 static napi_value SetNotificationUnifiedGroupInfo( 1650 const napi_env &env, const std::shared_ptr<NotificationUnifiedGroupInfo> &info, napi_value &result); 1651 1652 /** 1653 * @brief Gets the number of badge of NotificationRequest object from specified js object 1654 * 1655 * @param env Indicates the environment that the API is invoked under 1656 * @param value Indicates a js object to be converted 1657 * @param request Indicates a NotificationRequest object from specified js object 1658 * @return Returns the null object if success, returns the null value otherwise 1659 */ 1660 static napi_value GetNotificationBadgeNumber( 1661 const napi_env &env, const napi_value &value, NotificationRequest &request); 1662 1663 /** 1664 * @brief Gets a NotificationUnifiedGroupInfo object from specified js object 1665 * 1666 * @param env Indicates the environment that the API is invoked under 1667 * @param value Indicates a js object to be converted 1668 * @param templ Indicates a NotificationUnifiedGroupInfo object from specified js object 1669 * @return Returns the null object if success, returns the null value otherwise 1670 */ 1671 static napi_value GetNotificationUnifiedGroupInfo( 1672 const napi_env &env, const napi_value &value, NotificationRequest &request); 1673 1674 /** 1675 * @brief Gets the notification control flags of NotificationRequest object from specified js object. 1676 * 1677 * @param env Indicates the environment that the API is invoked under 1678 * @param value Indicates a js object to be converted 1679 * @param request Indicates a NotificationRequest object from specified js object 1680 * @return Returns the null object if success, returns the null value otherwise 1681 */ 1682 static napi_value GetNotificationControlFlags( 1683 const napi_env &env, const napi_value &value, NotificationRequest &request); 1684 1685 /** 1686 * @brief Create a napi value with specified error object for callback 1687 * 1688 * @param env Indicates the environment that the API is invoked under 1689 * @param errCode Indicates specified err code 1690 * @return Returns a napi value with specified error object for callback 1691 */ 1692 static napi_value CreateErrorValue(napi_env env, int32_t errCode, bool newType); 1693 1694 /** 1695 * @brief Create a napi value with specified error object for callback 1696 * 1697 * @param env Indicates the environment that the API is invoked under 1698 * @param errCode Indicates specified err code 1699 * @param msg Indicates specified msg 1700 * @return Returns a napi value with specified error object for callback 1701 */ 1702 static napi_value CreateErrorValue(napi_env env, int32_t errCode, std::string &msg); 1703 1704 /** 1705 * @brief Sets a js object by specified BadgeNumberCallbackData object 1706 * 1707 * @param env Indicates the environment that the API is invoked under 1708 * @param date Indicates a BadgeNumberCallbackData object to be converted 1709 * @param result Indicates a js object to be set 1710 * @return Returns the null object if success, returns the null value otherwise 1711 */ 1712 static napi_value SetBadgeCallbackData(const napi_env &env, 1713 const BadgeNumberCallbackData &data, napi_value &result); 1714 1715 /** 1716 * @brief Gets the notificationBundleOption of NotificationRequest object from specified js object 1717 * 1718 * @param env Indicates the environment that the API is invoked under 1719 * @param value Indicates a js object to be converted 1720 * @param request Indicates a NotificationRequest object from specified js object 1721 * @return Returns the null object if success, returns the null value otherwise 1722 */ 1723 static napi_value GetNotificationBundleOption( 1724 const napi_env &env, const napi_value &value, NotificationRequest &request); 1725 /** 1726 * @brief Sets a js object by specified NotificationDoNotDisturbProfile object 1727 * 1728 * @param env Indicates the environment that the API is invoked under 1729 * @param date Indicates a NotificationDoNotDisturbProfile object to be converted 1730 * @param result Indicates a js object to be set 1731 * @return Returns the null object if success, returns the null value otherwise 1732 */ 1733 static napi_value SetDoNotDisturbProfile( 1734 const napi_env &env, const NotificationDoNotDisturbProfile &data, napi_value &result); 1735 1736 static napi_value SetBundleOption( 1737 const napi_env &env, const NotificationBundleOption &bundleInfo, napi_value &result); 1738 static bool IsValidRemoveReason(int32_t reasonType); 1739 static void NapiThrow(napi_env env, int32_t errCode); 1740 static void NapiThrow(napi_env env, int32_t errCode, std::string &msg); 1741 static int32_t ErrorToExternal(uint32_t errCode); 1742 static void CreateReturnValue(const napi_env &env, const CallbackPromiseInfo &info, const napi_value &result); 1743 static napi_value GetLockScreenPicture( 1744 const napi_env &env, const napi_value &contentResult, std::shared_ptr<NotificationBasicContent> basicContent); 1745 static napi_value SetLockScreenPicture( 1746 const napi_env &env, const NotificationBasicContent *basicContent, napi_value &result); 1747 static napi_value SetAgentBundle(const napi_env &env, 1748 const std::shared_ptr<NotificationBundleOption> &agentBundle, napi_value &result); 1749 static napi_value GetResourceObject(napi_env env, std::shared_ptr<ResourceManager::Resource> &resource, 1750 napi_value &value); 1751 static napi_value SetResourceObject(napi_env env, std::shared_ptr<ResourceManager::Resource> &resource, 1752 napi_value &value); 1753 static napi_value SetObjectStringProperty(const napi_env &env, napi_value& object, const std::string& key, 1754 const std::string& value); 1755 static napi_value SetObjectUint32Property(const napi_env &env, napi_value& object, const std::string& key, 1756 uint32_t value); 1757 private: 1758 static const int32_t ARGS_ONE = 1; 1759 static const int32_t ARGS_TWO = 2; 1760 static const int32_t ONLY_CALLBACK_MAX_PARA = 1; 1761 static const int32_t ONLY_CALLBACK_MIN_PARA = 0; 1762 static std::set<std::shared_ptr<AbilityRuntime::WantAgent::WantAgent>> wantAgent_; 1763 static std::mutex mutex_; 1764 static const char *GetPropertyNameByContentType(ContentType type); 1765 }; 1766 } // namespace NotificationNapi 1767 } // namespace OHOS 1768 1769 #endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_FRAMEWORKS_JS_NAPI_INCLUDE_COMMON_H 1770