Bug Fix: Screen when placing a voip call can be incredibly ugly

#597
This commit is contained in:
giomfo
2016-09-09 15:11:12 +02:00
parent 45f52d3422
commit d79b414ef3
15 changed files with 99 additions and 50 deletions
+13 -2
View File
@@ -110,6 +110,11 @@
gradientMaskLayer.bounds = CGRectMake(0, 0, self.callContainerView.frame.size.width, self.callContainerView.frame.size.height + 20);
gradientMaskLayer.anchorPoint = CGPointZero;
// Define caller image view size
CGSize size = [[UIScreen mainScreen] bounds].size;
CGFloat minSize = MIN(size.width, size.height);
self.callerImageViewWidthConstraint.constant = minSize / 2;
// CAConstraint is not supported on IOS.
// it seems only being supported on Mac OS.
@@ -136,6 +141,10 @@
gradientMaskLayer.bounds = newBounds;
}
}
// The caller image view is circular
self.callerImageView.layer.cornerRadius = self.callerImageViewWidthConstraint.constant / 2;
self.callerImageView.clipsToBounds = YES;
}
- (void)dealloc
@@ -156,14 +165,16 @@
- (UIImage*)picturePlaceholder
{
CGFloat fontSize = floor(self.callerImageViewWidthConstraint.constant * 0.7);
if (self.peer)
{
// Use the vector style placeholder
return [AvatarGenerator generateRoomMemberAvatar:self.peer.userId displayName:self.peer.displayname];
return [AvatarGenerator generateAvatarForMatrixItem:self.peer.userId withDisplayName:self.peer.displayname size:self.callerImageViewWidthConstraint.constant andFontSize:fontSize];
}
else if (self.mxCall.room)
{
return [AvatarGenerator generateRoomAvatar:self.mxCall.room.roomId andDisplayName:self.mxCall.room.state.displayname];
return [AvatarGenerator generateAvatarForMatrixItem:self.mxCall.room.roomId withDisplayName:self.mxCall.room.vectorDisplayname size:self.callerImageViewWidthConstraint.constant andFontSize:fontSize];
}
return [UIImage imageNamed:@"placeholder"];