mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
114 lines
3.1 KiB
C
114 lines
3.1 KiB
C
7 years ago
|
//
|
||
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import <Mantle/MTLModel.h>
|
||
|
|
||
|
NS_ASSUME_NONNULL_BEGIN
|
||
|
|
||
|
@class OWSSignalServiceProtosDataMessage;
|
||
|
@class TSAttachment;
|
||
|
@class YapDatabaseReadWriteTransaction;
|
||
|
|
||
7 years ago
|
typedef NS_ENUM(NSUInteger, OWSContactPhoneType) {
|
||
|
OWSContactPhoneType_Home = 1,
|
||
|
OWSContactPhoneType_Mobile,
|
||
|
OWSContactPhoneType_Work,
|
||
|
OWSContactPhoneType_Custom,
|
||
7 years ago
|
};
|
||
|
|
||
7 years ago
|
@interface OWSContactPhoneNumber : MTLModel
|
||
7 years ago
|
|
||
7 years ago
|
@property (nonatomic, readonly) OWSContactPhoneType phoneType;
|
||
|
// Applies in the OWSContactPhoneType_Custom case.
|
||
7 years ago
|
@property (nonatomic, readonly, nullable) NSString *label;
|
||
|
|
||
|
@property (nonatomic, readonly) NSString *phoneNumber;
|
||
|
|
||
7 years ago
|
- (BOOL)isValid;
|
||
|
|
||
7 years ago
|
@end
|
||
|
|
||
|
#pragma mark -
|
||
|
|
||
7 years ago
|
typedef NS_ENUM(NSUInteger, OWSContactEmailType) {
|
||
|
OWSContactEmailType_Home = 1,
|
||
|
OWSContactEmailType_Mobile,
|
||
|
OWSContactEmailType_Work,
|
||
|
OWSContactEmailType_Custom,
|
||
7 years ago
|
};
|
||
|
|
||
7 years ago
|
@interface OWSContactEmail : MTLModel
|
||
7 years ago
|
|
||
7 years ago
|
@property (nonatomic, readonly) OWSContactEmailType emailType;
|
||
|
// Applies in the OWSContactEmailType_Custom case.
|
||
7 years ago
|
@property (nonatomic, readonly, nullable) NSString *label;
|
||
|
|
||
|
@property (nonatomic, readonly) NSString *email;
|
||
|
|
||
7 years ago
|
- (BOOL)isValid;
|
||
|
|
||
7 years ago
|
@end
|
||
|
|
||
|
#pragma mark -
|
||
|
|
||
7 years ago
|
typedef NS_ENUM(NSUInteger, OWSContactAddressType) {
|
||
|
OWSContactAddressType_Home = 1,
|
||
|
OWSContactAddressType_Work,
|
||
|
OWSContactAddressType_Custom,
|
||
7 years ago
|
};
|
||
|
|
||
7 years ago
|
@interface OWSContactAddress : MTLModel
|
||
7 years ago
|
|
||
7 years ago
|
@property (nonatomic, readonly) OWSContactAddressType addressType;
|
||
|
// Applies in the OWSContactAddressType_Custom case.
|
||
7 years ago
|
@property (nonatomic, readonly, nullable) NSString *label;
|
||
|
|
||
|
@property (nonatomic, readonly, nullable) NSString *street;
|
||
|
@property (nonatomic, readonly, nullable) NSString *pobox;
|
||
|
@property (nonatomic, readonly, nullable) NSString *neighborhood;
|
||
|
@property (nonatomic, readonly, nullable) NSString *city;
|
||
|
@property (nonatomic, readonly, nullable) NSString *region;
|
||
|
@property (nonatomic, readonly, nullable) NSString *postcode;
|
||
|
@property (nonatomic, readonly, nullable) NSString *country;
|
||
|
|
||
7 years ago
|
- (BOOL)isValid;
|
||
|
|
||
7 years ago
|
@end
|
||
|
|
||
|
#pragma mark -
|
||
|
|
||
7 years ago
|
@interface OWSContact : MTLModel
|
||
7 years ago
|
|
||
|
@property (nonatomic, readonly, nullable) NSString *givenName;
|
||
|
@property (nonatomic, readonly, nullable) NSString *familyName;
|
||
|
@property (nonatomic, readonly, nullable) NSString *nameSuffix;
|
||
|
@property (nonatomic, readonly, nullable) NSString *namePrefix;
|
||
|
@property (nonatomic, readonly, nullable) NSString *middleName;
|
||
|
|
||
7 years ago
|
@property (nonatomic, readonly, nullable) NSArray<OWSContactPhoneNumber *> *phoneNumbers;
|
||
|
@property (nonatomic, readonly, nullable) NSArray<OWSContactEmail *> *emails;
|
||
|
@property (nonatomic, readonly, nullable) NSArray<OWSContactAddress *> *addresses;
|
||
7 years ago
|
|
||
|
// TODO: This is provisional.
|
||
|
@property (nonatomic, readonly, nullable) TSAttachment *avatar;
|
||
|
// "Profile" avatars should _not_ be saved to device contacts.
|
||
|
@property (nonatomic, readonly) BOOL isProfileAvatar;
|
||
|
|
||
|
- (instancetype)init NS_UNAVAILABLE;
|
||
|
|
||
7 years ago
|
+ (OWSContact *_Nullable)contactForDataMessage:(OWSSignalServiceProtosDataMessage *)dataMessage
|
||
|
transaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||
7 years ago
|
|
||
7 years ago
|
- (BOOL)isValid;
|
||
|
|
||
7 years ago
|
@end
|
||
|
|
||
7 years ago
|
#pragma mark -
|
||
|
|
||
|
@interface OWSContacts : NSObject
|
||
|
|
||
|
@end
|
||
|
|
||
7 years ago
|
NS_ASSUME_NONNULL_END
|