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