Notification.cs 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*******************************************************************************
  2. Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
  3. NOTICE:All information contained herein is, and remains the property of
  4. PICO Technology Co., Ltd. The intellectual and technical concepts
  5. contained herein are proprietary to PICO Technology Co., Ltd. and may be
  6. covered by patents, patents in process, and are protected by trade secret or
  7. copyright law. Dissemination of this information or reproduction of this
  8. material is strictly forbidden unless prior written permission is obtained from
  9. PICO Technology Co., Ltd.
  10. *******************************************************************************/
  11. using System;
  12. using Pico.Platform.Models;
  13. using UnityEngine;
  14. namespace Pico.Platform
  15. {
  16. /**
  17. * \ingroup Platform
  18. */
  19. public static class NotificationService
  20. {
  21. /// <summary>
  22. /// Gets a list of all pending room invites for your app. For example, notifications that may have been sent before the user launches your app.
  23. /// </summary>
  24. /// <param name="pageIdx">Defines which page of pending room invites to return. The first page index is `0`.</param>
  25. /// <param name="pageSize">Defines the number of pending room invites returned on each page.</param>
  26. /// <returns>Request information of type `Task`, including the request id, and its response message will contain data of type `RoomInviteNotificationList`.
  27. ///
  28. /// A message of type `MessageType.Notification_GetRoomInvites` will be generated in response.
  29. /// First call `message.IsError()` to check if any error has occurred.
  30. /// If no error has occurred, the message will contain a payload of type `RoomInviteNotificationList`.
  31. /// Extract the payload from the message handle with `message.Data`.</returns>
  32. public static Task<RoomInviteNotificationList> GetRoomInviteNotifications(int pageIdx, int pageSize)
  33. {
  34. if (CoreService.IsInitialized())
  35. {
  36. return new Task<RoomInviteNotificationList>(CLIB.ppf_Notification_GetRoomInvites(pageIdx, pageSize));
  37. }
  38. Debug.LogError(CoreService.NotInitializedError);
  39. return null;
  40. }
  41. /// <summary>
  42. /// Marks a notification as read.
  43. /// </summary>
  44. /// <param name="notificationID">The ID of the notificaiton to mark.</param>
  45. /// <returns>Request information of type `Task`, including the request id, and its response message does not contain data.
  46. /// A message of type `MessageType.Notification_MarkAsRead` will be generated in response. Call `message.IsError()` to check if any error has occurred.
  47. /// </returns>
  48. public static Task MarkAsRead(UInt64 notificationID)
  49. {
  50. if (CoreService.IsInitialized())
  51. {
  52. return new Task(CLIB.ppf_Notification_MarkAsRead(notificationID));
  53. }
  54. Debug.LogError(CoreService.NotInitializedError);
  55. return null;
  56. }
  57. }
  58. }