Contact.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. // _____ _
  2. // |_ _| |_ _ _ ___ ___ _ __ __ _
  3. // | | | ' \| '_/ -_) -_) ' \/ _` |_
  4. // |_| |_||_|_| \___\___|_|_|_\__,_(_)
  5. //
  6. // Threema iOS Client
  7. // Copyright (c) 2012-2020 Threema GmbH
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU Affero General Public License, version 3,
  11. // as published by the Free Software Foundation.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU Affero General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Affero General Public License
  19. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. #import <Foundation/Foundation.h>
  21. #import <CoreData/CoreData.h>
  22. @class BaseMessage, Conversation, ImageData;
  23. @interface Contact : NSManagedObject
  24. enum {
  25. kVerificationLevelUnverified = 0,
  26. kVerificationLevelServerVerified,
  27. kVerificationLevelFullyVerified,
  28. kVerificationLevelWorkVerified, // Legacy value, do not use anymore except for migration. Use workContact instead
  29. kVerificationLevelWorkFullyVerified // Legacy value, do not use anymore except for migration. Use workContact instead
  30. };
  31. enum {
  32. kStateActive = 0,
  33. kStateInactive = 1,
  34. kStateInvalid = 2
  35. };
  36. @property (nonatomic, retain) NSNumber * abRecordId;
  37. @property (nonatomic, retain) NSNumber * featureLevel;
  38. @property (nonatomic, retain) NSString * firstName;
  39. @property (nonatomic, retain) NSString * identity;
  40. @property (nonatomic, retain) NSData * imageData;
  41. @property (nonatomic, retain) NSString * lastName;
  42. @property (nonatomic, retain) NSData * publicKey;
  43. @property (nonatomic, retain) NSString * publicNickname;
  44. @property (nonatomic, retain) NSNumber * sortIndex;
  45. @property (nonatomic, retain) NSString * sortInitial;
  46. @property (nonatomic, retain) NSNumber * verificationLevel;
  47. @property (nonatomic, retain) NSString * verifiedEmail;
  48. @property (nonatomic, retain) NSString * verifiedMobileNo;
  49. @property (nonatomic, retain) NSNumber * state;
  50. @property (nonatomic, retain) NSSet *conversations;
  51. @property (nonatomic, retain) NSSet *groupConversations;
  52. @property (nonatomic, retain) NSSet *messages;
  53. @property (nonatomic, retain) ImageData *contactImage;
  54. @property (nonatomic) BOOL profilePictureSended;
  55. @property (nonatomic, retain) NSDate *profilePictureUpload;
  56. @property (nonatomic, retain) NSString *cnContactId;
  57. // This only means it's a verified contact from the admin (in the same work package)
  58. // To check if this contact is a work ID, use the workidentities list in usersettings
  59. // bad naming because of the history...
  60. @property (nonatomic, retain) NSNumber * workContact;
  61. @property (nonatomic, retain) NSNumber * hidden;
  62. @property (readonly) NSString* displayName;
  63. @property (readonly) NSString *mentionName;
  64. - (void)updateSortInitial;
  65. - (BOOL)isActive;
  66. - (BOOL)isValid;
  67. - (BOOL)isGatewayId;
  68. - (BOOL)isEchoEcho;
  69. - (BOOL)isProfilePictureSended;
  70. - (BOOL)isProfilePictureSet;
  71. - (void)setFeatureMask:(NSNumber *)featureMask;
  72. - (NSNumber *)featureMask;
  73. - (BOOL)isWorkContact;
  74. - (UIImage*)verificationLevelImageSmall;
  75. - (UIImage*)verificationLevelImage;
  76. - (UIImage*)verificationLevelImageBig;
  77. /// Localized string of verification level usable for accessibility
  78. - (NSString*)verificationLevelAccessibilityLabel;
  79. - (BOOL)isVideoCallAvailable;
  80. @end
  81. @interface Contact (CoreDataGeneratedAccessors)
  82. - (void)addConversationsObject:(Conversation *)value;
  83. - (void)removeConversationsObject:(Conversation *)value;
  84. - (void)addConversations:(NSSet *)values;
  85. - (void)removeConversations:(NSSet *)values;
  86. - (void)addGroupConversationsObject:(Conversation *)value;
  87. - (void)removeGroupConversationsObject:(Conversation *)value;
  88. - (void)addGroupConversations:(NSSet *)values;
  89. - (void)removeGroupConversations:(NSSet *)values;
  90. - (void)addMessagesObject:(BaseMessage *)value;
  91. - (void)removeMessagesObject:(BaseMessage *)value;
  92. - (void)addMessages:(NSSet *)values;
  93. - (void)removeMessages:(NSSet *)values;
  94. @end