mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-30 16:22:39 +00:00
-> increase the contact row height to 50 (to match to the members list cell).
The thumbnail size is also the same so it should avoid downloading thumbnails if they are already cached -> renamed some fieds -> fix some refresh issues
This commit is contained in:
parent
c99134351a
commit
64d37212dd
10 changed files with 121 additions and 83 deletions
|
@ -1360,27 +1360,27 @@
|
||||||
<scene sceneID="bcI-aR-NZT">
|
<scene sceneID="bcI-aR-NZT">
|
||||||
<objects>
|
<objects>
|
||||||
<tableViewController id="cpU-dg-M33" userLabel="Contacts" customClass="ContactsViewController" sceneMemberID="viewController">
|
<tableViewController id="cpU-dg-M33" userLabel="Contacts" customClass="ContactsViewController" sceneMemberID="viewController">
|
||||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="jgs-c1-w97">
|
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="50" sectionHeaderHeight="22" sectionFooterHeight="22" id="jgs-c1-w97">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
<prototypes>
|
<prototypes>
|
||||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="ContactCell" id="Qu4-km-MZA" customClass="ContactTableCell">
|
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="ContactCell" rowHeight="50" id="Qu4-km-MZA" customClass="ContactTableCell">
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Qu4-km-MZA" id="uEH-gd-MNN">
|
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Qu4-km-MZA" id="uEH-gd-MNN">
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="B4B-GZ-atv" customClass="CustomImageView">
|
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="B4B-GZ-atv" customClass="CustomImageView">
|
||||||
<rect key="frame" x="12" y="3" width="38" height="38"/>
|
<rect key="frame" x="12" y="5" width="40" height="40"/>
|
||||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||||
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="height" constant="38" id="F3r-c8-zTQ"/>
|
<constraint firstAttribute="height" constant="40" id="F3r-c8-zTQ"/>
|
||||||
<constraint firstAttribute="width" constant="38" id="ewx-39-TQ9"/>
|
<constraint firstAttribute="width" constant="40" id="ewx-39-TQ9"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</view>
|
</view>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nzg-dr-os0">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nzg-dr-os0">
|
||||||
<rect key="frame" x="62" y="8" width="510" height="30"/>
|
<rect key="frame" x="64" y="8" width="508" height="30"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="height" constant="30" id="92u-Am-XY3"/>
|
<constraint firstAttribute="height" constant="30" id="92u-Am-XY3"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
@ -1389,7 +1389,7 @@
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="matrixUser.png" translatesAutoresizingMaskIntoConstraints="NO" id="fJ6-gD-7yP">
|
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="matrixUser.png" translatesAutoresizingMaskIntoConstraints="NO" id="fJ6-gD-7yP">
|
||||||
<rect key="frame" x="576" y="14" width="16" height="16"/>
|
<rect key="frame" x="576" y="17" width="16" height="16"/>
|
||||||
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="16" id="RkA-cA-qCQ"/>
|
<constraint firstAttribute="width" constant="16" id="RkA-cA-qCQ"/>
|
||||||
|
@ -1408,9 +1408,9 @@
|
||||||
</constraints>
|
</constraints>
|
||||||
</tableViewCellContentView>
|
</tableViewCellContentView>
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="contactDisplayName" destination="nzg-dr-os0" id="2Ce-Xv-mPM"/>
|
<outlet property="contactDisplayNameLabel" destination="nzg-dr-os0" id="K2D-4d-5Tb"/>
|
||||||
<outlet property="matrixUserIconView" destination="fJ6-gD-7yP" id="hBT-VO-KJD"/>
|
<outlet property="matrixUserIconView" destination="fJ6-gD-7yP" id="hBT-VO-KJD"/>
|
||||||
<outlet property="thumbnail" destination="B4B-GZ-atv" id="jDt-mM-3TL"/>
|
<outlet property="thumbnailView" destination="B4B-GZ-atv" id="jwY-xh-asO"/>
|
||||||
</connections>
|
</connections>
|
||||||
</tableViewCell>
|
</tableViewCell>
|
||||||
</prototypes>
|
</prototypes>
|
||||||
|
|
|
@ -44,7 +44,14 @@ extern NSString *const kConsoleContactThumbnailUpdateNotification;
|
||||||
|
|
||||||
- (id)initWithABRecord:(ABRecordRef)record;
|
- (id)initWithABRecord:(ABRecordRef)record;
|
||||||
|
|
||||||
|
// return thumbnail with a prefered size
|
||||||
|
// if the thumbnail is already loaded, this method returns this one
|
||||||
|
// if the thumbnail must trigger a server request, the expected size will be size
|
||||||
|
// self.thumbnail triggered a request with a 256 X 256 pixels
|
||||||
|
- (UIImage*)thumbnailWithPreferedSize:(CGSize)size;
|
||||||
|
|
||||||
// check if there is any matrix identifier updates
|
// check if there is any matrix identifier updates
|
||||||
- (void)checkMatrixIdentifiers;
|
- (void)checkMatrixIdentifiers;
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
|
@ -76,11 +76,7 @@ NSString *const kConsoleContactThumbnailUpdateNotification = @"kConsoleContactTh
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsolePhoneNumber* pn = [[ConsolePhoneNumber alloc] init];
|
[pns addObject:[[ConsolePhoneNumber alloc] initWithTextNumber:phoneVal andType:lbl within:self.contactID]];
|
||||||
pn.type = lbl;
|
|
||||||
pn.textNumber = phoneVal;
|
|
||||||
|
|
||||||
[pns addObject:pn];
|
|
||||||
|
|
||||||
if (lblRef) {
|
if (lblRef) {
|
||||||
CFRelease(lblRef);
|
CFRelease(lblRef);
|
||||||
|
@ -131,8 +127,7 @@ NSString *const kConsoleContactThumbnailUpdateNotification = @"kConsoleContactTh
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleEmail* email = [[ConsoleEmail alloc] initWithEmailAddress:emailVal andType:lbl within:self.contactID];
|
[emails addObject: [[ConsoleEmail alloc] initWithEmailAddress:emailVal andType:lbl within:self.contactID]];
|
||||||
[emails addObject: email];
|
|
||||||
|
|
||||||
if (lblRef) {
|
if (lblRef) {
|
||||||
CFRelease(lblRef);
|
CFRelease(lblRef);
|
||||||
|
@ -185,7 +180,11 @@ NSString *const kConsoleContactThumbnailUpdateNotification = @"kConsoleContactTh
|
||||||
return identifiers;
|
return identifiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIImage*)thumbnail {
|
// return thumbnail with a prefered size
|
||||||
|
// if the thumbnail is already loaded, this method returns this one
|
||||||
|
// if the thumbnail must trigger a server request, the expected size will be size
|
||||||
|
// self.thumbnail triggered a request with a 256 X 256 pixels
|
||||||
|
- (UIImage*)thumbnailWithPreferedSize:(CGSize)size {
|
||||||
// already found a matrix thumbnail
|
// already found a matrix thumbnail
|
||||||
if (matrixThumbnail) {
|
if (matrixThumbnail) {
|
||||||
return matrixThumbnail;
|
return matrixThumbnail;
|
||||||
|
@ -211,7 +210,7 @@ NSString *const kConsoleContactThumbnailUpdateNotification = @"kConsoleContactTh
|
||||||
// try to load the first email one
|
// try to load the first email one
|
||||||
if (firstEmail) {
|
if (firstEmail) {
|
||||||
// should be retrieved by the cell info
|
// should be retrieved by the cell info
|
||||||
[firstEmail loadAvatarWithSize:CGSizeMake(80, 80)];
|
[firstEmail loadAvatarWithSize:size];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,6 +218,10 @@ NSString *const kConsoleContactThumbnailUpdateNotification = @"kConsoleContactTh
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (UIImage*)thumbnail {
|
||||||
|
return [self thumbnailWithPreferedSize:CGSizeMake(256, 256)];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)checkMatrixIdentifiers {
|
- (void)checkMatrixIdentifiers {
|
||||||
for(ConsoleEmail* email in self.emailAddresses) {
|
for(ConsoleEmail* email in self.emailAddresses) {
|
||||||
[email getMatrixID];
|
[email getMatrixID];
|
||||||
|
|
|
@ -16,17 +16,17 @@
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
@interface ConsoleEmail : NSObject {
|
@interface ConsoleEmail : NSObject
|
||||||
BOOL pendingMatrixIDRequest;
|
|
||||||
BOOL gotMatrixID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@property (nonatomic, readwrite) NSString *type;
|
// email info
|
||||||
@property (nonatomic, readwrite) NSString *emailAddress;
|
@property (nonatomic, readonly) NSString *type;
|
||||||
@property (nonatomic, readwrite) NSString *contactID;
|
@property (nonatomic, readonly) NSString *emailAddress;
|
||||||
@property (nonatomic, readwrite) NSString *matrixUserID;
|
// contact ID where the email has been found
|
||||||
@property (nonatomic, readwrite) NSString *avatarURL;
|
@property (nonatomic, readonly) NSString *contactID;
|
||||||
@property (nonatomic, readwrite) UIImage *avatarImage;
|
// linked matrix account
|
||||||
|
@property (nonatomic, readonly) NSString *matrixUserID;
|
||||||
|
@property (nonatomic, readonly) NSString *avatarURL;
|
||||||
|
@property (nonatomic, readonly) UIImage *avatarImage;
|
||||||
|
|
||||||
- (id)initWithEmailAddress:(NSString*)anEmailAddress andType:(NSString*)aType within:(NSString*)aContactID;
|
- (id)initWithEmailAddress:(NSString*)anEmailAddress andType:(NSString*)aType within:(NSString*)aContactID;
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,20 @@
|
||||||
|
|
||||||
#import "MediaManager.h"
|
#import "MediaManager.h"
|
||||||
|
|
||||||
|
@interface ConsoleEmail() {
|
||||||
|
BOOL pendingMatrixIDRequest;
|
||||||
|
BOOL gotMatrixID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@property (nonatomic, readwrite) NSString *type;
|
||||||
|
@property (nonatomic, readwrite) NSString *emailAddress;
|
||||||
|
@property (nonatomic, readwrite) NSString *contactID;
|
||||||
|
@property (nonatomic, readwrite) NSString *matrixUserID;
|
||||||
|
@property (nonatomic, readwrite) NSString *avatarURL;
|
||||||
|
@property (nonatomic, readwrite) UIImage *avatarImage;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation ConsoleEmail
|
@implementation ConsoleEmail
|
||||||
@synthesize type, emailAddress, contactID, matrixUserID, avatarImage, avatarURL;
|
@synthesize type, emailAddress, contactID, matrixUserID, avatarImage, avatarURL;
|
||||||
|
|
||||||
|
@ -131,10 +145,10 @@
|
||||||
|
|
||||||
if (mxHandler.mxRestClient) {
|
if (mxHandler.mxRestClient) {
|
||||||
[mxHandler.mxRestClient avatarUrlForUser:self.matrixUserID
|
[mxHandler.mxRestClient avatarUrlForUser:self.matrixUserID
|
||||||
success:^(NSString *avatarUrl) {
|
success:^(NSString *avatarUrl) {
|
||||||
self.avatarURL = [mxHandler thumbnailURLForContent:avatarUrl inViewSize:avatarSize withMethod:MXThumbnailingMethodCrop];
|
self.avatarURL = [mxHandler thumbnailURLForContent:avatarUrl inViewSize:avatarSize withMethod:MXThumbnailingMethodCrop];
|
||||||
[self downloadAvatarImage];
|
[self downloadAvatarImage];
|
||||||
}
|
}
|
||||||
failure:^(NSError *error) {
|
failure:^(NSError *error) {
|
||||||
//
|
//
|
||||||
}];
|
}];
|
||||||
|
|
|
@ -17,9 +17,12 @@
|
||||||
|
|
||||||
@interface ConsolePhoneNumber : NSObject
|
@interface ConsolePhoneNumber : NSObject
|
||||||
|
|
||||||
@property (nonatomic, readwrite) NSString *type;
|
// phonenumber info
|
||||||
@property (nonatomic, readwrite) NSString *textNumber;
|
@property (nonatomic, readonly) NSString *type;
|
||||||
@property (nonatomic, readwrite) NSString *contactID;
|
@property (nonatomic, readonly) NSString *textNumber;
|
||||||
|
// contact ID where the phonenumber has been found
|
||||||
|
@property (nonatomic, readonly) NSString *contactID;
|
||||||
|
|
||||||
- (id)initWithTextNumber:(NSString*)textNumber andType:(NSString*)aType within:(NSString*)aContactID;
|
- (id)initWithTextNumber:(NSString*)textNumber andType:(NSString*)aType within:(NSString*)aContactID;
|
||||||
|
|
||||||
@end
|
@end
|
|
@ -16,6 +16,12 @@
|
||||||
|
|
||||||
#import "ConsolePhoneNumber.h"
|
#import "ConsolePhoneNumber.h"
|
||||||
|
|
||||||
|
@interface ConsolePhoneNumber()
|
||||||
|
@property (nonatomic, readwrite) NSString *type;
|
||||||
|
@property (nonatomic, readwrite) NSString *textNumber;
|
||||||
|
@property (nonatomic, readwrite) NSString *contactID;
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation ConsolePhoneNumber
|
@implementation ConsolePhoneNumber
|
||||||
@synthesize type, textNumber, contactID;
|
@synthesize type, textNumber, contactID;
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
|
|
||||||
@interface ContactTableCell : UITableViewCell
|
@interface ContactTableCell : UITableViewCell
|
||||||
|
|
||||||
@property (strong, nonatomic) IBOutlet CustomImageView *thumbnail;
|
@property (strong, nonatomic) IBOutlet CustomImageView *thumbnailView;
|
||||||
@property (strong, nonatomic) IBOutlet UILabel *contactDisplayName;
|
@property (strong, nonatomic) IBOutlet UILabel *contactDisplayNameLabel;
|
||||||
@property (strong, nonatomic) IBOutlet UIImageView *matrixUserIconView;
|
@property (strong, nonatomic) IBOutlet UIImageView *matrixUserIconView;
|
||||||
|
|
||||||
// reference to the linked message
|
// reference to the linked message
|
||||||
|
|
|
@ -52,11 +52,10 @@
|
||||||
[mxHandler.mxSession removeListener:membersListener];
|
[mxHandler.mxSession removeListener:membersListener];
|
||||||
membersListener = nil;
|
membersListener = nil;
|
||||||
}
|
}
|
||||||
self.thumbnail.layer.borderWidth = 0;
|
self.thumbnailView.layer.borderWidth = 0;
|
||||||
|
|
||||||
// add contact update info
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onMatrixIdUpdate:) name:kConsoleContactMatrixIdentifierUpdateNotification object:nil];
|
|
||||||
|
|
||||||
|
// be warned when the matrix ID and the thumbnail is updated
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onMatrixIdUpdate:) name:kConsoleContactMatrixIdentifierUpdateNotification object:nil];
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onThumbnailUpdate:) name:kConsoleContactThumbnailUpdateNotification object:nil];
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onThumbnailUpdate:) name:kConsoleContactThumbnailUpdateNotification object:nil];
|
||||||
|
|
||||||
// Register a listener for events that concern room members
|
// Register a listener for events that concern room members
|
||||||
|
@ -82,7 +81,10 @@
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self refreshUserPresence];
|
// init the contact info
|
||||||
|
self.contactDisplayNameLabel.text = _contact.displayName;
|
||||||
|
[self refreshContactThumbnail];
|
||||||
|
[self manageMatrixIcon];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)refreshUserPresence {
|
- (void)refreshUserPresence {
|
||||||
|
@ -100,51 +102,62 @@
|
||||||
// check if already known as a Matrix user
|
// check if already known as a Matrix user
|
||||||
MXUser* mxUser = [mxHandler.mxSession userWithUserId:matrixUserID];
|
MXUser* mxUser = [mxHandler.mxSession userWithUserId:matrixUserID];
|
||||||
|
|
||||||
// unknown user
|
// check if the mxUser is known
|
||||||
if (!mxUser) {
|
// if it is not known, the presence cannot be retrieved
|
||||||
// request his presence
|
if (mxUser) {
|
||||||
[mxHandler.mxRestClient presence:matrixUserID
|
[self refreshPresenceUserRing:mxUser.presence];
|
||||||
success:^(MXPresenceResponse *presence) {
|
// we know that this user is a matrix one
|
||||||
[self refreshPresenceUserRing:presence.presenceStatus];
|
self.matrixUserIconView.hidden = NO;
|
||||||
}
|
|
||||||
failure:^ (NSError *error) {
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
} else {
|
|
||||||
[self refreshPresenceUserRing:mxUser.presence];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)refreshContactThumbnail {
|
||||||
|
self.thumbnailView.image = [self.contact thumbnailWithPreferedSize:self.thumbnailView.frame.size];
|
||||||
|
|
||||||
|
if (!self.thumbnailView.image) {
|
||||||
|
self.thumbnailView.image = [UIImage imageNamed:@"default-profile"];
|
||||||
|
}
|
||||||
|
|
||||||
|
// display the thumbnail in a circle
|
||||||
|
if (self.thumbnailView.layer.cornerRadius != self.thumbnailView.frame.size.width / 2) {
|
||||||
|
self.thumbnailView.layer.cornerRadius = self.thumbnailView.frame.size.width / 2;
|
||||||
|
self.thumbnailView.clipsToBounds = YES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void)refreshPresenceUserRing:(MXPresence)presenceStatus {
|
- (void)refreshPresenceUserRing:(MXPresence)presenceStatus {
|
||||||
UIColor* ringColor = [[MatrixHandler sharedHandler] getPresenceRingColor:presenceStatus];
|
UIColor* ringColor = [[MatrixHandler sharedHandler] getPresenceRingColor:presenceStatus];
|
||||||
|
|
||||||
// if the thumbnail is defined
|
// if the thumbnail is defined
|
||||||
if (ringColor) {
|
if (ringColor) {
|
||||||
self.thumbnail.layer.borderWidth = 2;
|
self.thumbnailView.layer.borderWidth = 2;
|
||||||
self.thumbnail.layer.borderColor = ringColor.CGColor;
|
self.thumbnailView.layer.borderColor = ringColor.CGColor;
|
||||||
} else {
|
} else {
|
||||||
// remove the border
|
// remove the border
|
||||||
// else it draws black border
|
// else it draws black border
|
||||||
self.thumbnail.layer.borderWidth = 0;
|
self.thumbnailView.layer.borderWidth = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)manageMatrixIcon {
|
||||||
|
self.matrixUserIconView.hidden = (0 == _contact.matrixIdentifiers.count);
|
||||||
|
|
||||||
|
// try to update the thumbnail with the matrix thumbnail
|
||||||
|
if (_contact.matrixIdentifiers) {
|
||||||
|
[self refreshContactThumbnail];
|
||||||
|
}
|
||||||
|
|
||||||
|
[self refreshUserPresence];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)onMatrixIdUpdate:(NSNotification *)notif {
|
- (void)onMatrixIdUpdate:(NSNotification *)notif {
|
||||||
// sanity check
|
// sanity check
|
||||||
if ([notif.object isKindOfClass:[NSString class]]) {
|
if ([notif.object isKindOfClass:[NSString class]]) {
|
||||||
NSString* matrixID = notif.object;
|
NSString* matrixID = notif.object;
|
||||||
|
|
||||||
if ([matrixID isEqualToString:self.contact.contactID]) {
|
if ([matrixID isEqualToString:self.contact.contactID]) {
|
||||||
self.matrixUserIconView.hidden = (0 == _contact.matrixIdentifiers.count);
|
[self manageMatrixIcon];
|
||||||
|
|
||||||
// try to update the thumbnail with the matrix thumbnail
|
|
||||||
if (_contact.matrixIdentifiers) {
|
|
||||||
self.matrixUserIconView.image = self.contact.thumbnail;
|
|
||||||
}
|
|
||||||
|
|
||||||
[self refreshUserPresence];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,7 +168,8 @@
|
||||||
NSString* matrixID = notif.object;
|
NSString* matrixID = notif.object;
|
||||||
|
|
||||||
if ([matrixID isEqualToString:self.contact.contactID]) {
|
if ([matrixID isEqualToString:self.contact.contactID]) {
|
||||||
self.thumbnail.image = self.contact.thumbnail;
|
[self refreshContactThumbnail];
|
||||||
|
self.matrixUserIconView.hidden = (0 == _contact.matrixIdentifiers.count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,10 @@
|
||||||
return [[sectionedContacts.sectionedContacts objectAtIndex:section] count];
|
return [[sectionedContacts.sectionedContacts objectAtIndex:section] count];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
|
return 50;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *)tableView:(UITableView *)aTableView titleForHeaderInSection:(NSInteger)section {
|
- (NSString *)tableView:(UITableView *)aTableView titleForHeaderInSection:(NSInteger)section {
|
||||||
if (sectionedContacts.sectionTitles.count <= section) {
|
if (sectionedContacts.sectionTitles.count <= section) {
|
||||||
return nil;
|
return nil;
|
||||||
|
@ -124,19 +128,6 @@
|
||||||
|
|
||||||
cell.contact = contact;
|
cell.contact = contact;
|
||||||
|
|
||||||
// set the thumbnail
|
|
||||||
if (contact.thumbnail) {
|
|
||||||
cell.thumbnail.image = contact.thumbnail;
|
|
||||||
} else {
|
|
||||||
cell.thumbnail.image = [UIImage imageNamed:@"default-profile"];
|
|
||||||
}
|
|
||||||
|
|
||||||
cell.thumbnail.layer.cornerRadius = cell.thumbnail.frame.size.width / 2;
|
|
||||||
cell.thumbnail.clipsToBounds = YES;
|
|
||||||
|
|
||||||
// and the displayname
|
|
||||||
cell.contactDisplayName.text = contact.displayName;
|
|
||||||
|
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue