NCRoom.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /**
  2. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  3. * SPDX-License-Identifier: GPL-3.0-or-later
  4. */
  5. #import <Foundation/Foundation.h>
  6. #import <Realm/Realm.h>
  7. #import "NCRoomParticipant.h"
  8. #import "NCChatMessage.h"
  9. typedef NS_ENUM(NSInteger, NCRoomType) {
  10. kNCRoomTypeOneToOne = 1,
  11. kNCRoomTypeGroup,
  12. kNCRoomTypePublic,
  13. kNCRoomTypeChangelog,
  14. kNCRoomTypeFormerOneToOne,
  15. kNCRoomTypeNoteToSelf
  16. };
  17. typedef NS_ENUM(NSInteger, NCRoomNotificationLevel) {
  18. kNCRoomNotificationLevelDefault = 0,
  19. kNCRoomNotificationLevelAlways,
  20. kNCRoomNotificationLevelMention,
  21. kNCRoomNotificationLevelNever
  22. };
  23. typedef NS_ENUM(NSInteger, NCRoomReadOnlyState) {
  24. NCRoomReadOnlyStateReadWrite = 0,
  25. NCRoomReadOnlyStateReadOnly
  26. };
  27. typedef NS_ENUM(NSInteger, NCRoomListableScope) {
  28. NCRoomListableScopeParticipantsOnly = 0,
  29. NCRoomListableScopeRegularUsersOnly,
  30. NCRoomListableScopeEveryone
  31. };
  32. typedef NS_ENUM(NSInteger, NCRoomMentionPermissions) {
  33. NCRoomMentionPermissionsEveryone = 0,
  34. NCRoomMentionPermissionsModeratorsOnly
  35. };
  36. typedef NS_ENUM(NSInteger, NCRoomLobbyState) {
  37. NCRoomLobbyStateAllParticipants = 0,
  38. NCRoomLobbyStateModeratorsOnly
  39. };
  40. typedef NS_ENUM(NSInteger, NCRoomSIPState) {
  41. NCRoomSIPStateDisabled = 0,
  42. NCRoomSIPStateEnabled,
  43. NCRoomSIPStateEnabledWithoutPIN
  44. };
  45. typedef NS_OPTIONS(NSInteger, NCPermission) {
  46. NCPermissionDefaultPermissions = 0,
  47. NCPermissionCustomPermissions = 1,
  48. NCPermissionStartCall = 2,
  49. NCPermissionJoinCall = 4,
  50. NCPermissionCanIgnoreLobby = 8,
  51. NCPermissionCanPublishAudio = 16,
  52. NCPermissionCanPublishVideo = 32,
  53. NCPermissionCanPublishScreen = 64,
  54. NCPermissionChat = 128,
  55. };
  56. typedef NS_ENUM(NSInteger, NCMessageExpiration) {
  57. NCMessageExpirationOff = 0,
  58. NCMessageExpiration1Hour = 3600,
  59. NCMessageExpiration8Hours = 28800,
  60. NCMessageExpiration1Day = 86400,
  61. NCMessageExpiration1Week = 604800,
  62. NCMessageExpiration4Weeks = 2419200,
  63. };
  64. typedef NS_ENUM(NSInteger, NCCallRecordingState) {
  65. NCCallRecordingStateStopped = 0,
  66. NCCallRecordingStateVideoRunning = 1,
  67. NCCallRecordingStateAudioRunning = 2,
  68. NCCallRecordingStateVideoStarting = 3,
  69. NCCallRecordingStateAudioStarting = 4,
  70. NCCallRecordingStateFailed = 5
  71. };
  72. extern NSString * const NCRoomObjectTypeFile;
  73. extern NSString * const NCRoomObjectTypeSharePassword;
  74. extern NSString * const NCRoomObjectTypeRoom;
  75. @interface NCRoom : RLMObject
  76. @property (nonatomic, copy) NSString *internalId; // accountId@token
  77. @property (nonatomic, copy) NSString *accountId;
  78. @property (nonatomic, copy) NSString *token;
  79. @property (nonatomic, copy) NSString *name;
  80. @property (nonatomic, copy) NSString *displayName;
  81. @property (nonatomic, copy) NSString *roomDescription;
  82. @property (nonatomic, assign) NCRoomType type;
  83. @property (nonatomic, assign) BOOL hasPassword;
  84. @property (nonatomic, assign) NCParticipantType participantType;
  85. @property (nonatomic, assign) NSInteger attendeeId;
  86. @property (nonatomic, copy) NSString *attendeePin;
  87. @property (nonatomic, assign) NSInteger unreadMessages;
  88. @property (nonatomic, assign) BOOL unreadMention;
  89. @property (nonatomic, assign) BOOL unreadMentionDirect;
  90. @property (nonatomic, strong) RLMArray<RLMString> *participants;
  91. @property (nonatomic, assign) NSInteger lastActivity;
  92. @property (nonatomic, copy, nullable) NSString *lastMessageId;
  93. @property (nonatomic, copy) NSString *lastMessageProxiedJSONString;
  94. @property (nonatomic, assign) BOOL isFavorite;
  95. @property (nonatomic, assign) NCRoomNotificationLevel notificationLevel;
  96. @property (nonatomic, assign) BOOL notificationCalls;
  97. @property (nonatomic, copy) NSString *objectType;
  98. @property (nonatomic, copy) NSString *objectId;
  99. @property (nonatomic, assign) NCRoomReadOnlyState readOnlyState;
  100. @property (nonatomic, assign) NCRoomListableScope listable;
  101. @property (nonatomic, assign) NSInteger messageExpiration;
  102. @property (nonatomic, assign) NCRoomLobbyState lobbyState;
  103. @property (nonatomic, assign) NSInteger lobbyTimer;
  104. @property (nonatomic, assign) NCRoomSIPState sipState;
  105. @property (nonatomic, assign) BOOL canEnableSIP;
  106. @property (nonatomic, assign) NSInteger lastReadMessage;
  107. @property (nonatomic, assign) NSInteger lastCommonReadMessage;
  108. @property (nonatomic, assign) BOOL canStartCall;
  109. @property (nonatomic, assign) BOOL hasCall;
  110. @property (nonatomic, assign) NSInteger lastUpdate;
  111. @property (nonatomic, copy) NSString *pendingMessage;
  112. @property (nonatomic, assign) BOOL canLeaveConversation;
  113. @property (nonatomic, assign) BOOL canDeleteConversation;
  114. @property (nonatomic, copy) NSString *status;
  115. @property (nonatomic, copy) NSString *statusIcon;
  116. @property (nonatomic, copy) NSString *statusMessage;
  117. @property (nonatomic, assign) NSInteger participantFlags;
  118. @property (nonatomic, assign) NSInteger permissions;
  119. @property (nonatomic, assign) NSInteger attendeePermissions;
  120. @property (nonatomic, assign) NSInteger defaultPermissions;
  121. @property (nonatomic, assign) NSInteger callRecording;
  122. @property (nonatomic, assign) NSInteger callStartTime;
  123. @property (nonatomic, copy) NSString *avatarVersion;
  124. @property (nonatomic, assign) BOOL isCustomAvatar;
  125. @property (nonatomic, assign) BOOL recordingConsent;
  126. @property (nonatomic, copy) NSString *remoteServer;
  127. @property (nonatomic, copy) NSString *remoteToken;
  128. @property (nonatomic, copy) NSString *lastReceivedProxyHash;
  129. @property (nonatomic, assign) NSInteger mentionPermissions;
  130. + (instancetype)roomWithDictionary:(NSDictionary *)roomDict;
  131. + (instancetype)roomWithDictionary:(NSDictionary *)roomDict andAccountId:(NSString *)accountId;
  132. + (void)updateRoom:(NCRoom *)managedRoom withRoom:(NCRoom *)room;
  133. @end