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