From 1a9a5016fed2a524758b471b16364841cbebb8f0 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 6 Jul 2018 15:31:38 -0400 Subject: [PATCH 1/3] Tweak calls. --- Signal.xcodeproj/project.pbxproj | 6 + .../phone-down.imageset/Contents.json | 23 ++ .../phone-down.imageset/phonedown-20@1x.png | Bin 0 -> 381 bytes .../phone-down.imageset/phonedown-20@2x.png | Bin 0 -> 719 bytes .../phone-down.imageset/phonedown-20@3x.png | Bin 0 -> 1031 bytes .../phone-up.imageset/Contents.json | 23 ++ .../phone-up.imageset/phoneup-20@1x.png | Bin 0 -> 402 bytes .../phone-up.imageset/phoneup-20@2x.png | Bin 0 -> 748 bytes .../phone-up.imageset/phoneup-20@3x.png | Bin 0 -> 1117 bytes .../Cells/ConversationViewCell.h | 5 + .../ConversationView/Cells/OWSBubbleView.h | 2 - .../Cells/OWSCallMessageCell.h | 17 + .../Cells/OWSCallMessageCell.m | 386 ++++++++++++++++++ .../ConversationViewController.m | 15 +- .../ConversationView/ConversationViewItem.m | 9 +- .../ViewControllers/DebugUI/DebugUIMessages.m | 8 +- Signal/src/call/CallService.swift | 6 +- .../translations/en.lproj/Localizable.strings | 9 + SignalMessaging/categories/UIView+OWS.h | 1 + SignalMessaging/categories/UIView+OWS.m | 8 + SignalMessaging/utils/ConversationStyle.swift | 18 + SignalServiceKit/src/Messages/TSCall.h | 6 +- SignalServiceKit/src/Messages/TSCall.m | 22 +- 23 files changed, 548 insertions(+), 16 deletions(-) create mode 100644 Signal/Images.xcassets/phone-down.imageset/Contents.json create mode 100644 Signal/Images.xcassets/phone-down.imageset/phonedown-20@1x.png create mode 100644 Signal/Images.xcassets/phone-down.imageset/phonedown-20@2x.png create mode 100644 Signal/Images.xcassets/phone-down.imageset/phonedown-20@3x.png create mode 100644 Signal/Images.xcassets/phone-up.imageset/Contents.json create mode 100644 Signal/Images.xcassets/phone-up.imageset/phoneup-20@1x.png create mode 100644 Signal/Images.xcassets/phone-up.imageset/phoneup-20@2x.png create mode 100644 Signal/Images.xcassets/phone-up.imageset/phoneup-20@3x.png create mode 100644 Signal/src/ViewControllers/ConversationView/Cells/OWSCallMessageCell.h create mode 100644 Signal/src/ViewControllers/ConversationView/Cells/OWSCallMessageCell.m diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 06abc7c47..3378c94a0 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -43,6 +43,7 @@ 340FC8D0205BF2FA007AEB0F /* OWSBackupIO.m in Sources */ = {isa = PBXBuildFile; fileRef = 340FC8CE205BF2FA007AEB0F /* OWSBackupIO.m */; }; 341F2C0F1F2B8AE700D07D6B /* DebugUIMisc.m in Sources */ = {isa = PBXBuildFile; fileRef = 341F2C0E1F2B8AE700D07D6B /* DebugUIMisc.m */; }; 34277A5E20751BDC006049F2 /* OWSQuotedMessageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 34277A5C20751BDC006049F2 /* OWSQuotedMessageView.m */; }; + 3427C64020EFD43E00EEC730 /* OWSCallMessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3427C63E20EFD43D00EEC730 /* OWSCallMessageCell.m */; }; 3430FE181F7751D4000EC51B /* GiphyAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3430FE171F7751D4000EC51B /* GiphyAPI.swift */; }; 34330A5A1E7875FB00DF2FB9 /* fontawesome-webfont.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 34330A591E7875FB00DF2FB9 /* fontawesome-webfont.ttf */; }; 34330A5C1E787A9800DF2FB9 /* dripicons-v2.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 34330A5B1E787A9800DF2FB9 /* dripicons-v2.ttf */; }; @@ -640,6 +641,8 @@ 341F2C0E1F2B8AE700D07D6B /* DebugUIMisc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DebugUIMisc.m; sourceTree = ""; }; 34277A5C20751BDC006049F2 /* OWSQuotedMessageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSQuotedMessageView.m; sourceTree = ""; }; 34277A5D20751BDC006049F2 /* OWSQuotedMessageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSQuotedMessageView.h; sourceTree = ""; }; + 3427C63E20EFD43D00EEC730 /* OWSCallMessageCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSCallMessageCell.m; sourceTree = ""; }; + 3427C63F20EFD43E00EEC730 /* OWSCallMessageCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSCallMessageCell.h; sourceTree = ""; }; 3430FE171F7751D4000EC51B /* GiphyAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GiphyAPI.swift; sourceTree = ""; }; 34330A591E7875FB00DF2FB9 /* fontawesome-webfont.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "fontawesome-webfont.ttf"; sourceTree = ""; }; 34330A5B1E787A9800DF2FB9 /* dripicons-v2.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "dripicons-v2.ttf"; sourceTree = ""; }; @@ -1753,6 +1756,8 @@ 34DBF006206C3CB200025978 /* OWSBubbleShapeView.m */, 34DBF002206BD5A500025978 /* OWSBubbleView.h */, 34DBF001206BD5A500025978 /* OWSBubbleView.m */, + 3427C63F20EFD43E00EEC730 /* OWSCallMessageCell.h */, + 3427C63E20EFD43D00EEC730 /* OWSCallMessageCell.m */, 34D1F09A1F867BFC0066283D /* OWSContactOffersCell.h */, 34D1F09B1F867BFC0066283D /* OWSContactOffersCell.m */, 3403B95C20EA9527001A1F44 /* OWSContactShareButtonsView.h */, @@ -3200,6 +3205,7 @@ 34DBF007206C3CB200025978 /* OWSBubbleShapeView.m in Sources */, 34D1F0BA1F8800D90066283D /* OWSAudioMessageView.m in Sources */, 34D8C02B1ED3685800188D7C /* DebugUIContacts.m in Sources */, + 3427C64020EFD43E00EEC730 /* OWSCallMessageCell.m in Sources */, 45C9DEB81DF4E35A0065CA84 /* WebRTCCallMessageHandler.swift in Sources */, 34D1F0501F7D45A60066283D /* GifPickerCell.swift in Sources */, 34D99C931F2937CC00D284D6 /* OWSAnalytics.swift in Sources */, diff --git a/Signal/Images.xcassets/phone-down.imageset/Contents.json b/Signal/Images.xcassets/phone-down.imageset/Contents.json new file mode 100644 index 000000000..9f4a311e4 --- /dev/null +++ b/Signal/Images.xcassets/phone-down.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "phonedown-20@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "phonedown-20@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "phonedown-20@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Signal/Images.xcassets/phone-down.imageset/phonedown-20@1x.png b/Signal/Images.xcassets/phone-down.imageset/phonedown-20@1x.png new file mode 100644 index 0000000000000000000000000000000000000000..fb2b5a1b70d585733f11f4642bfe14aa01b2923c GIT binary patch literal 381 zcmV-@0fPRCP)Px$H%UZ6R5%fxls#%fK@i7dKrq3^GHPLNAc6$3j71LMA*{VXK5CC(n}A9RLBU)h zT1X19wXrdfHcdW$18-pRvisck27c@~GyC7&w>#!e(p!-!HxV_)GF-q8nh=mhNQA^zT_CStD+v3FuUcyi=)u?4w5 zCdYK`Y(%^iRh}`fKt;arr*IAb?2d>Q>i9rR7P405huru8E^Wg4a+~oBxVHsq{rJ-u zBM{$Nu%U&~FwjVhiPaSV6hX%qG1VZ>L9Mg{+EQCfePpza(DCB0BU4itsG0 z;3*So36r)7Id5u1MvrMn=>YGe^{SEh@CZsfWwJH1?9SA8_U5q_q!aScfObTS@eSl} bKDGS<(JqE=DtkJ~00000NkvXXu0mjf??j`R literal 0 HcmV?d00001 diff --git a/Signal/Images.xcassets/phone-down.imageset/phonedown-20@2x.png b/Signal/Images.xcassets/phone-down.imageset/phonedown-20@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..8d69dc0cbf57a9fd197444e9e2f7b9db2f16f5d1 GIT binary patch literal 719 zcmV;=0xPx%iAh93R9Fecn7eBhK@`P}NnxWT!N0&H3WZTeg}5pW0-aC%r`q;ILyv)@407YcjwiyE598i zmdR)uZ7HM>iu=_1jKe^l~|K$7E;tO#ruB3l_z2y$JNR`On5P`R57e)K9uRDrgk2$S{TDt;8e*e3-vDF4^csES zTD~kR#3f&FjyB8MdOL>@UygG$y06l$>xZy>b3XpI+LW|z%k&1HsE@iWWkv7=r8`<~ z{ZxuXF&vs!mTLq)j3G`HqqWu@t=78M)&r@M#qiA32)q_Unkq&|!@A9YHmLIZFLr^f zt*^7{c?rLAmy%Ve4%Jnn+;(kPPi9p|vb6w#61)R0f-I(W*BvEmeWYoHyGfvnoLJLN zyHS%s-7>}6Vr*bY+$_%4SK8|Lo;Y=|QB#8c$PBlL`yCk@6t;qQ>&RH1b%w~YqtOV) ztPT%|(B)h%(p5gp2+tVr^S(kG&-Z6T*P<(dS#6Rr~Ew(C@u-E?6+4s`9Ro6R4< z6{fnbBO0Gt$Wd#$**pQJ!DFCXrd43NE5R?B{RLzh^qUksibVhb002ovPDHLkV1imG BQyKsO literal 0 HcmV?d00001 diff --git a/Signal/Images.xcassets/phone-down.imageset/phonedown-20@3x.png b/Signal/Images.xcassets/phone-down.imageset/phonedown-20@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..badca9731ab6730e3fc03df12ab04b2c843ba203 GIT binary patch literal 1031 zcmV+i1o-=jP)Px&!AV3xRA>d=o6Bp}Kp4fX@A|-nC@Q`-wFp9mf+D(5=(6BK#UfQi!HRZew_>q> zf!d8C3I$(9P*)0WL|m!h!q-MEYN1-`LQn*?R(}T?2q8@}nVEYhesIW5GV{$j^U8da z+=gk@vqeyDPGAY=3lo^m`9p9Nd;pcPCYW}C8(;+dHN-R02W>N9*A522FfbLEmc9i) z!C5Pe&VW&nM%w1u@le#xg2*B8(u2r&1zoGR;JFa!2AWLb#C-j(+oYuyJpn$~NNBtQ zS5jt8Z9ApC25}O#{M}J2waX~zN*#qpmD*nm!JQQHH2|>^?e%%wNCB4u5gN7dID8fW z=e8b?FF;gKNXNDrj^*yg-(67i8L^;_A(w)WQRrnbr(ogrNcP)Rp?x?Csq0R~Wz1Hv zLa+;t#A;H}MEA&%zckTW@L1V-a;G^qxi*21L7*5{rr7p9F!50|t$Jc zpm6RxC@Lf`og%OvpdMMu6mI1el6C(l`Fp|ajM6pZtM#+|53*@z=?yK8sn5_U#Y#v@T=86=a zmgW?BCBW3Q9DEMaeCnE$ZktA`?Aln}|45ocgKKL^I|L%pPP=UykNvU2qC$%tH92X_ zyD+u%K5!5$2i{EaY?%;GExXGbE02z^;=4#|Cew6zJQ;Z|l3>UQOn zP7>BqEZI%-&b6p8dCmq?H;phc-AdJryfGLBhD5qapVykn`;{EGsuzvjkA{M^0?P^n zxE-z?hFY@qvd$++?_{A~uPS+EC|Hq6WvvzFS*@A8r%kbSl~oJzvxb5%R#~jxyniti z{DAa}t17zPP;At_-;r-a6-5t}6fEK2z|N|P9<~rH(Rw_ctcvI+OR-V+)^QMMJ1A&V z>>4L+`&;i~SB0!ttzs)Ong0zw=Z7kK#Dic}z~0aV>(zteS6`cAK?W3?5S;9eF3z=; zstv%POfB5(iP25`TECuj&CRFabFRs{@aIeL6UaSwLD01i30~^jDgOFB_;lt{iv$;w zROCbBHptmoHKrEUr}HjNpFwDb4%R-wENUIwV~~%cWX;>W;7(SM-a`d%KVX<7UiN%* z@MGTe{<0Sxou$U(DS?!_7BCBL@DLT7_I;S002ovPDHLkV1h8y B?GgY0 literal 0 HcmV?d00001 diff --git a/Signal/Images.xcassets/phone-up.imageset/Contents.json b/Signal/Images.xcassets/phone-up.imageset/Contents.json new file mode 100644 index 000000000..80c9d1362 --- /dev/null +++ b/Signal/Images.xcassets/phone-up.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "phoneup-20@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "phoneup-20@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "phoneup-20@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Signal/Images.xcassets/phone-up.imageset/phoneup-20@1x.png b/Signal/Images.xcassets/phone-up.imageset/phoneup-20@1x.png new file mode 100644 index 0000000000000000000000000000000000000000..cf8e87311b0288547f417202b06421909d0e1951 GIT binary patch literal 402 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 jc+N-HexMWhH)#C +#import +#import +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface OWSCallMessageCell () + +@property (nonatomic, nullable) TSInteraction *interaction; + +@property (nonatomic) OWSBubbleView *bubbleView; +@property (nonatomic) UIImageView *imageView; +@property (nonatomic) UIView *circleView; +@property (nonatomic) UILabel *titleLabel; +@property (nonatomic) OWSMessageFooterView *footerView; +@property (nonatomic) UIStackView *hStackView; +@property (nonatomic) UIStackView *vStackView; +@property (nonatomic) NSMutableArray *layoutConstraints; + +@end + +#pragma mark - + +@implementation OWSCallMessageCell + +// `[UIView init]` invokes `[self initWithFrame:...]`. +- (instancetype)initWithFrame:(CGRect)frame +{ + if (self = [super initWithFrame:frame]) { + [self commontInit]; + } + + return self; +} + +- (void)commontInit +{ + OWSAssert(!self.imageView); + + self.layoutMargins = UIEdgeInsetsZero; + self.contentView.layoutMargins = UIEdgeInsetsZero; + + self.layoutConstraints = [NSMutableArray new]; + + self.bubbleView = [OWSBubbleView new]; + self.bubbleView.userInteractionEnabled = NO; + [self.contentView addSubview:self.bubbleView]; + [self.bubbleView autoPinEdgeToSuperviewEdge:ALEdgeTop]; + [self.bubbleView autoPinEdgeToSuperviewEdge:ALEdgeBottom]; + + self.imageView = [UIImageView new]; + [self.imageView setContentHuggingHigh]; + + self.circleView = [UIView new]; + self.circleView.backgroundColor = [UIColor whiteColor]; + self.circleView.layer.cornerRadius = self.circleSize * 0.5f; + [self.circleView addSubview:self.imageView]; + [self.imageView autoCenterInSuperview]; + [self.circleView autoSetDimension:ALDimensionWidth toSize:self.circleSize]; + [self.circleView autoSetDimension:ALDimensionHeight toSize:self.circleSize]; + [self.circleView setContentHuggingHigh]; + + self.titleLabel = [UILabel new]; + self.titleLabel.numberOfLines = 0; + self.titleLabel.lineBreakMode = NSLineBreakByWordWrapping; + [self.titleLabel setContentHuggingLow]; + + self.hStackView = [[UIStackView alloc] initWithArrangedSubviews:@[ + self.circleView, + self.titleLabel, + ]]; + self.hStackView.axis = UILayoutConstraintAxisHorizontal; + self.hStackView.spacing = self.hSpacing; + self.hStackView.alignment = UIStackViewAlignmentCenter; + + self.footerView = [OWSMessageFooterView new]; + + self.vStackView = [[UIStackView alloc] initWithArrangedSubviews:@[ + self.hStackView, + self.footerView, + ]]; + self.vStackView.axis = UILayoutConstraintAxisVertical; + self.vStackView.spacing = self.vSpacing; + self.vStackView.userInteractionEnabled = NO; + [self.bubbleView addSubview:self.vStackView]; + [self.vStackView autoPinToSuperviewEdges]; + + UITapGestureRecognizer *tap = + [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)]; + [self addGestureRecognizer:tap]; + + UILongPressGestureRecognizer *longPress = + [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPressGesture:)]; + [self addGestureRecognizer:longPress]; +} + +- (void)configureFonts +{ + // Update cell to reflect changes in dynamic text. + self.titleLabel.font = UIFont.ows_dynamicTypeSubheadlineFont; +} + ++ (NSString *)cellReuseIdentifier +{ + return NSStringFromClass([self class]); +} + +- (void)loadForDisplayWithTransaction:(YapDatabaseReadTransaction *)transaction +{ + OWSAssert(self.conversationStyle); + OWSAssert(self.viewItem); + OWSAssert([self.viewItem.interaction isKindOfClass:[TSCall class]]); + + TSCall *call = (TSCall *)self.viewItem.interaction; + + self.bubbleView.bubbleColor = [self bubbleColorForCall:call]; + + UIImage *icon = [self iconForCall:call]; + self.imageView.image = [icon imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + self.imageView.tintColor = [self iconColorForCall:call]; + self.titleLabel.textColor = [self textColorForCall:call]; + [self applyTitleForCall:call label:self.titleLabel]; + + if (self.hasFooter) { + [self.footerView configureWithConversationViewItem:self.viewItem isOverlayingMedia:NO]; + self.footerView.hidden = NO; + } else { + self.footerView.hidden = YES; + } + + if (call.isIncoming) { + [self.layoutConstraints addObjectsFromArray:@[ + [self.bubbleView autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:self.conversationStyle.gutterLeading], + [self.bubbleView autoPinEdgeToSuperviewEdge:ALEdgeTrailing + withInset:self.conversationStyle.gutterTrailing + relation:NSLayoutRelationGreaterThanOrEqual], + ]]; + } else { + [self.layoutConstraints addObjectsFromArray:@[ + [self.bubbleView autoPinEdgeToSuperviewEdge:ALEdgeLeading + withInset:self.conversationStyle.gutterLeading + relation:NSLayoutRelationGreaterThanOrEqual], + [self.bubbleView autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:self.conversationStyle.gutterTrailing], + ]]; + } + + CGSize cellSize = [self cellSizeWithTransaction:transaction]; + [self.layoutConstraints addObjectsFromArray:@[ + [self.bubbleView autoSetDimension:ALDimensionWidth toSize:cellSize.width], + [self.bubbleView autoSetDimension:ALDimensionHeight toSize:cellSize.height], + ]]; + + self.vStackView.layoutMarginsRelativeArrangement = YES; + self.vStackView.layoutMargins = UIEdgeInsetsMake(self.conversationStyle.textInsetTop, + self.conversationStyle.textInsetHorizontal, + self.conversationStyle.textInsetBottom, + self.conversationStyle.textInsetHorizontal); +} + +- (BOOL)hasFooter +{ + return !self.viewItem.shouldHideFooter; +} + +- (CGFloat)circleSize +{ + return 48.f; +} + +- (UIColor *)textColorForCall:(TSCall *)call +{ + return [self.conversationStyle bubbleTextColorWithCall:call]; +} + +- (UIColor *)bubbleColorForCall:(TSCall *)call +{ + return [self.conversationStyle bubbleColorWithCall:call]; +} + +- (UIColor *)iconColorForCall:(TSCall *)call +{ + switch (call.callType) { + case RPRecentCallTypeIncoming: + case RPRecentCallTypeOutgoing: + case RPRecentCallTypeIncomingIncomplete: + case RPRecentCallTypeOutgoingIncomplete: + return [UIColor ows_greenColor]; + case RPRecentCallTypeIncomingMissed: + case RPRecentCallTypeIncomingMissedBecauseOfChangedIdentity: + case RPRecentCallTypeIncomingDeclined: + return [UIColor ows_redColor]; + } +} + +- (UIImage *)iconForCall:(TSCall *)call +{ + UIImage *result = nil; + switch (call.callType) { + case RPRecentCallTypeIncoming: + case RPRecentCallTypeOutgoing: + case RPRecentCallTypeIncomingIncomplete: + case RPRecentCallTypeOutgoingIncomplete: + result = [UIImage imageNamed:@"phone-up"]; + break; + case RPRecentCallTypeIncomingMissed: + case RPRecentCallTypeIncomingMissedBecauseOfChangedIdentity: + case RPRecentCallTypeIncomingDeclined: + result = [UIImage imageNamed:@"phone-down"]; + break; + } + OWSAssert(result); + return result; +} + +- (void)applyTitleForCall:(TSCall *)call label:(UILabel *)label +{ + OWSAssert(call); + OWSAssert(label); + + [self configureFonts]; + + label.text = [self titleForCall:call]; +} + +- (NSString *)titleForCall:(TSCall *)call +{ + // We don't actually use the `transaction` but other sibling classes do. + switch (call.callType) { + case RPRecentCallTypeIncoming: + case RPRecentCallTypeOutgoing: + case RPRecentCallTypeOutgoingIncomplete: + case RPRecentCallTypeIncomingIncomplete: + return NSLocalizedString(@"CALL_DEFAULT_STATUS", + @"Message recorded in conversation history when local user is making or has completed a call."); + case RPRecentCallTypeIncomingMissed: + case RPRecentCallTypeIncomingMissedBecauseOfChangedIdentity: + return NSLocalizedString( + @"CALL_MISSED", @"Message recorded in conversation history when local user missed a call."); + case RPRecentCallTypeIncomingDeclined: + return NSLocalizedString( + @"CALL_DECLINED", @"Message recorded in conversation history when local user declined a call."); + } +} + +- (CGFloat)hSpacing +{ + return 8.f; +} + +- (CGFloat)vSpacing +{ + return 6.f; +} + +- (CGSize)titleSize +{ + OWSAssert(self.conversationStyle); + OWSAssert(self.viewItem); + + CGFloat maxTitleWidth = (CGFloat)ceil(self.conversationStyle.maxMessageWidth + - (self.circleSize + self.hSpacing + self.conversationStyle.textInsetHorizontal * 2)); + DDLogVerbose(@"%@ maxTitleWidth %f", self.logTag, maxTitleWidth); + return [self.titleLabel sizeThatFits:CGSizeMake(maxTitleWidth, CGFLOAT_MAX)]; +} + +- (CGSize)cellSizeWithTransaction:(YapDatabaseReadTransaction *)transaction +{ + OWSAssert(self.conversationStyle); + OWSAssert(self.viewItem); + OWSAssert([self.viewItem.interaction isKindOfClass:[TSCall class]]); + + TSCall *call = (TSCall *)self.viewItem.interaction; + + [self applyTitleForCall:call label:self.titleLabel]; + CGSize titleSize = [self titleSize]; + + CGSize hStackSize = titleSize; + hStackSize.width += (self.hSpacing + self.circleSize); + hStackSize.height = MAX(hStackSize.height, self.circleSize); + + CGSize vStackSize = hStackSize; + if (self.hasFooter) { + CGSize footerSize = [self.footerView measureWithConversationViewItem:self.viewItem]; + vStackSize.height += (self.vSpacing + footerSize.height); + vStackSize.width = MAX(vStackSize.width, footerSize.width); + } + + CGSize result = CGSizeCeil(CGSizeMake( + MIN(self.conversationStyle.viewWidth, vStackSize.width + self.conversationStyle.textInsetHorizontal * 2), + vStackSize.height + self.conversationStyle.textInsetTop + self.conversationStyle.textInsetBottom)); + return result; +} + +#pragma mark - UIMenuController + +- (void)showMenuController +{ + OWSAssertIsOnMainThread(); + + DDLogDebug(@"%@ long pressed call cell: %@", self.logTag, self.viewItem.interaction.debugDescription); + + [self becomeFirstResponder]; + + if ([UIMenuController sharedMenuController].isMenuVisible) { + [[UIMenuController sharedMenuController] setMenuVisible:NO animated:NO]; + } + + UIMenuController *menuController = [UIMenuController sharedMenuController]; + menuController.menuItems = @[]; + UIView *fromView = self.titleLabel; + CGRect targetRect = [fromView.superview convertRect:fromView.frame toView:self]; + [menuController setTargetRect:targetRect inView:self]; + [menuController setMenuVisible:YES animated:YES]; +} + +- (BOOL)canPerformAction:(SEL)action withSender:(nullable id)sender +{ + return action == @selector(delete:); +} + +- (void) delete:(nullable id)sender +{ + DDLogInfo(@"%@ chose delete", self.logTag); + + TSInteraction *interaction = self.viewItem.interaction; + OWSAssert(interaction); + + [interaction remove]; +} + +- (BOOL)canBecomeFirstResponder +{ + return YES; +} + +- (void)prepareForReuse +{ + [NSLayoutConstraint deactivateConstraints:self.layoutConstraints]; + [self.layoutConstraints removeAllObjects]; + + [self.footerView prepareForReuse]; +} + +#pragma mark - Gesture recognizers + +- (void)handleTapGesture:(UITapGestureRecognizer *)sender +{ + OWSAssert(self.delegate); + OWSAssert([self.viewItem.interaction isKindOfClass:[TSCall class]]); + + if (sender.state == UIGestureRecognizerStateRecognized) { + TSCall *call = (TSCall *)self.viewItem.interaction; + [self.delegate didTapCall:call]; + } +} + +- (void)handleLongPressGesture:(UILongPressGestureRecognizer *)longPress +{ + OWSAssert(self.delegate); + + TSInteraction *interaction = self.viewItem.interaction; + OWSAssert(interaction); + + if (longPress.state == UIGestureRecognizerStateBegan) { + [self showMenuController]; + } +} + +@end + +NS_ASSUME_NONNULL_END diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index a4ddb7b0c..b97b1daec 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -20,6 +20,7 @@ #import "NSAttributedString+OWS.h" #import "NewGroupViewController.h" #import "OWSAudioPlayer.h" +#import "OWSCallMessageCell.h" #import "OWSContactOffersCell.h" #import "OWSConversationSettingsViewController.h" #import "OWSConversationSettingsViewDelegate.h" @@ -606,6 +607,8 @@ typedef enum : NSUInteger { { [self.collectionView registerClass:[OWSSystemMessageCell class] forCellWithReuseIdentifier:[OWSSystemMessageCell cellReuseIdentifier]]; + [self.collectionView registerClass:[OWSCallMessageCell class] + forCellWithReuseIdentifier:[OWSCallMessageCell cellReuseIdentifier]]; [self.collectionView registerClass:[OWSUnreadIndicatorCell class] forCellWithReuseIdentifier:[OWSUnreadIndicatorCell cellReuseIdentifier]]; [self.collectionView registerClass:[OWSContactOffersCell class] @@ -2483,6 +2486,16 @@ typedef enum : NSUInteger { [self.inputToolbar beginEditingTextMessage]; } +#pragma mark - Calls + +- (void)didTapCall:(TSCall *)call +{ + OWSAssertIsOnMainThread(); + OWSAssert([call isKindOfClass:[TSCall class]]); + + [self handleCallTap:call]; +} + #pragma mark - System Messages - (void)didTapSystemMessageWithInteraction:(TSInteraction *)interaction @@ -2494,8 +2507,6 @@ typedef enum : NSUInteger { [self handleErrorMessageTap:(TSErrorMessage *)interaction]; } else if ([interaction isKindOfClass:[TSInfoMessage class]]) { [self handleInfoMessageTap:(TSInfoMessage *)interaction]; - } else if ([interaction isKindOfClass:[TSCall class]]) { - [self handleCallTap:(TSCall *)interaction]; } else { OWSFail(@"Tap for system messages of unknown type: %@", [interaction class]); } diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m index 810a4ea49..1bbc5c5d1 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m @@ -4,6 +4,7 @@ #import "ConversationViewItem.h" #import "OWSAudioMessageView.h" +#import "OWSCallMessageCell.h" #import "OWSContactOffersCell.h" #import "OWSMessageCell.h" #import "OWSSystemMessageCell.h" @@ -230,9 +231,11 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType) break; case OWSInteractionType_Error: case OWSInteractionType_Info: - case OWSInteractionType_Call: measurementCell = [OWSSystemMessageCell new]; break; + case OWSInteractionType_Call: + measurementCell = [OWSCallMessageCell new]; + break; case OWSInteractionType_UnreadIndicator: measurementCell = [OWSUnreadIndicatorCell new]; break; @@ -292,9 +295,11 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType) forIndexPath:indexPath]; case OWSInteractionType_Error: case OWSInteractionType_Info: - case OWSInteractionType_Call: return [collectionView dequeueReusableCellWithReuseIdentifier:[OWSSystemMessageCell cellReuseIdentifier] forIndexPath:indexPath]; + case OWSInteractionType_Call: + return [collectionView dequeueReusableCellWithReuseIdentifier:[OWSCallMessageCell cellReuseIdentifier] + forIndexPath:indexPath]; case OWSInteractionType_UnreadIndicator: return [collectionView dequeueReusableCellWithReuseIdentifier:[OWSUnreadIndicatorCell cellReuseIdentifier] forIndexPath:indexPath]; diff --git a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m index b62ccfc4a..dbea7315f 100644 --- a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m +++ b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m @@ -3411,11 +3411,11 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac inThread:contactThread]]; [result addObject:[[TSCall alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp] withCallNumber:@"+19174054215" - callType:RPRecentCallTypeMissed + callType:RPRecentCallTypeIncomingMissed inThread:contactThread]]; [result addObject:[[TSCall alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp] withCallNumber:@"+19174054215" - callType:RPRecentCallTypeMissedBecauseOfChangedIdentity + callType:RPRecentCallTypeIncomingMissedBecauseOfChangedIdentity inThread:contactThread]]; [result addObject:[[TSCall alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp] withCallNumber:@"+19174054215" @@ -3425,6 +3425,10 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac withCallNumber:@"+19174054215" callType:RPRecentCallTypeIncomingIncomplete inThread:contactThread]]; + [result addObject:[[TSCall alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp] + withCallNumber:@"+19174054215" + callType:RPRecentCallTypeIncomingDeclined + inThread:contactThread]]; } { diff --git a/Signal/src/call/CallService.swift b/Signal/src/call/CallService.swift index 481a2db15..a14218903 100644 --- a/Signal/src/call/CallService.swift +++ b/Signal/src/call/CallService.swift @@ -515,12 +515,12 @@ private class SignalCallData: NSObject { // Insert missed call record if let callRecord = call.callRecord { if callRecord.callType == RPRecentCallTypeIncoming { - callRecord.updateCallType(RPRecentCallTypeMissed) + callRecord.updateCallType(RPRecentCallTypeIncomingMissed) } } else { call.callRecord = TSCall(timestamp: NSDate.ows_millisecondTimeStamp(), withCallNumber: call.thread.contactIdentifier(), - callType: RPRecentCallTypeMissed, + callType: RPRecentCallTypeIncomingMissed, in: call.thread) } @@ -602,7 +602,7 @@ private class SignalCallData: NSObject { let callRecord = TSCall(timestamp: NSDate.ows_millisecondTimeStamp(), withCallNumber: thread.contactIdentifier(), - callType: RPRecentCallTypeMissedBecauseOfChangedIdentity, + callType: RPRecentCallTypeIncomingMissedBecauseOfChangedIdentity, in: thread) assert(newCall.callRecord == nil) newCall.callRecord = callRecord diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 1e6b7624e..055a0c775 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -290,9 +290,18 @@ /* Alert title when calling and permissions for microphone are missing */ "CALL_AUDIO_PERMISSION_TITLE" = "Microphone Access Required"; +/* Message recorded in conversation history when local user declined a call. */ +"CALL_DECLINED" = "Call Declined"; + +/* Message recorded in conversation history when local user is making or has completed a call. */ +"CALL_DEFAULT_STATUS" = "Contact Called"; + /* Accessibility label for placing call button */ "CALL_LABEL" = "Call"; +/* Message recorded in conversation history when local user missed a call. */ +"CALL_MISSED" = "Missed Call"; + /* Call setup status label after outgoing call times out */ "CALL_SCREEN_STATUS_NO_ANSWER" = "No Answer."; diff --git a/SignalMessaging/categories/UIView+OWS.h b/SignalMessaging/categories/UIView+OWS.h index cd9a9b79f..ec19d591d 100644 --- a/SignalMessaging/categories/UIView+OWS.h +++ b/SignalMessaging/categories/UIView+OWS.h @@ -33,6 +33,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value); - (NSLayoutConstraint *)autoHCenterInSuperview; - (NSLayoutConstraint *)autoVCenterInSuperview; +- (void)autoPinEdgesToEdgesOfView:(UIView *)view; - (void)autoPinWidthToWidthOfView:(UIView *)view; - (void)autoPinHeightToHeightOfView:(UIView *)view; diff --git a/SignalMessaging/categories/UIView+OWS.m b/SignalMessaging/categories/UIView+OWS.m index 5fa542ce9..f09375bdc 100644 --- a/SignalMessaging/categories/UIView+OWS.m +++ b/SignalMessaging/categories/UIView+OWS.m @@ -111,6 +111,14 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value) return [self autoAlignAxis:ALAxisHorizontal toSameAxisOfView:self.superview]; } +- (void)autoPinEdgesToEdgesOfView:(UIView *)view +{ + OWSAssert(view); + + [self autoPinWidthToWidthOfView:view]; + [self autoPinHeightToHeightOfView:view]; +} + - (void)autoPinWidthToWidthOfView:(UIView *)view { OWSAssert(view); diff --git a/SignalMessaging/utils/ConversationStyle.swift b/SignalMessaging/utils/ConversationStyle.swift index 03d69ba32..25fc91c9e 100644 --- a/SignalMessaging/utils/ConversationStyle.swift +++ b/SignalMessaging/utils/ConversationStyle.swift @@ -169,6 +169,15 @@ public class ConversationStyle: NSObject { } } + @objc + public func bubbleColor(call: TSCall) -> UIColor { + if call.isIncoming { + return primaryColor + } else { + return self.bubbleColorOutgoingSent + } + } + @objc public static var bubbleTextColorIncoming = UIColor.ows_white @@ -190,4 +199,13 @@ public class ConversationStyle: NSObject { return UIColor.ows_materialBlue } } + + @objc + public func bubbleTextColor(call: TSCall) -> UIColor { + if call.isIncoming { + return ConversationStyle.bubbleTextColorIncoming + } else { + return UIColor.ows_black + } + } } diff --git a/SignalServiceKit/src/Messages/TSCall.h b/SignalServiceKit/src/Messages/TSCall.h index fdca7d4d1..76915e7e9 100644 --- a/SignalServiceKit/src/Messages/TSCall.h +++ b/SignalServiceKit/src/Messages/TSCall.h @@ -12,11 +12,11 @@ NS_ASSUME_NONNULL_BEGIN typedef enum { RPRecentCallTypeIncoming = 1, RPRecentCallTypeOutgoing, - RPRecentCallTypeMissed, + RPRecentCallTypeIncomingMissed, // These call types are used until the call connects. RPRecentCallTypeOutgoingIncomplete, RPRecentCallTypeIncomingIncomplete, - RPRecentCallTypeMissedBecauseOfChangedIdentity, + RPRecentCallTypeIncomingMissedBecauseOfChangedIdentity, RPRecentCallTypeIncomingDeclined } RPRecentCallType; @@ -24,6 +24,8 @@ typedef enum { @property (nonatomic, readonly) RPRecentCallType callType; +@property (nonatomic, readonly) BOOL isIncoming; + - (instancetype)initInteractionWithTimestamp:(uint64_t)timestamp inThread:(TSThread *)thread NS_UNAVAILABLE; - (instancetype)initWithTimestamp:(uint64_t)timestamp diff --git a/SignalServiceKit/src/Messages/TSCall.m b/SignalServiceKit/src/Messages/TSCall.m index 20d805c09..db45d0c56 100644 --- a/SignalServiceKit/src/Messages/TSCall.m +++ b/SignalServiceKit/src/Messages/TSCall.m @@ -36,7 +36,8 @@ NSUInteger TSCallCurrentSchemaVersion = 1; _callSchemaVersion = TSCallCurrentSchemaVersion; _callType = callType; - if (_callType == RPRecentCallTypeMissed || _callType == RPRecentCallTypeMissedBecauseOfChangedIdentity) { + if (_callType == RPRecentCallTypeIncomingMissed + || _callType == RPRecentCallTypeIncomingMissedBecauseOfChangedIdentity) { _read = NO; } else { _read = YES; @@ -75,13 +76,13 @@ NSUInteger TSCallCurrentSchemaVersion = 1; return NSLocalizedString(@"INCOMING_CALL", @""); case RPRecentCallTypeOutgoing: return NSLocalizedString(@"OUTGOING_CALL", @""); - case RPRecentCallTypeMissed: + case RPRecentCallTypeIncomingMissed: return NSLocalizedString(@"MISSED_CALL", @""); case RPRecentCallTypeOutgoingIncomplete: return NSLocalizedString(@"OUTGOING_INCOMPLETE_CALL", @""); case RPRecentCallTypeIncomingIncomplete: return NSLocalizedString(@"INCOMING_INCOMPLETE_CALL", @""); - case RPRecentCallTypeMissedBecauseOfChangedIdentity: + case RPRecentCallTypeIncomingMissedBecauseOfChangedIdentity: return NSLocalizedString(@"INFO_MESSAGE_MISSED_CALL_DUE_TO_CHANGED_IDENITY", @"info message text shown in conversation view"); case RPRecentCallTypeIncomingDeclined: return NSLocalizedString(@"INCOMING_DECLINED_CALL", @@ -141,6 +142,21 @@ NSUInteger TSCallCurrentSchemaVersion = 1; }]; } +- (BOOL)isIncoming +{ + switch (self.callType) { + case RPRecentCallTypeIncoming: + case RPRecentCallTypeIncomingMissed: + case RPRecentCallTypeIncomingIncomplete: + case RPRecentCallTypeIncomingMissedBecauseOfChangedIdentity: + case RPRecentCallTypeIncomingDeclined: + return YES; + case RPRecentCallTypeOutgoing: + case RPRecentCallTypeOutgoingIncomplete: + return NO; + } +} + @end NS_ASSUME_NONNULL_END From b26231e43667c206853fac0eefa6e3950aef59b0 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 6 Jul 2018 15:32:15 -0400 Subject: [PATCH 2/3] Tweak calls. --- .../ConversationView/Cells/OWSSystemMessageCell.m | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSSystemMessageCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSSystemMessageCell.m index 014d07120..4be079f3e 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSSystemMessageCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSSystemMessageCell.m @@ -11,7 +11,6 @@ #import #import #import -#import #import #import @@ -183,8 +182,6 @@ NS_ASSUME_NONNULL_BEGIN } break; } - } else if ([interaction isKindOfClass:[TSCall class]]) { - result = [UIImage imageNamed:@"system_message_call"]; } else { OWSFail(@"Unknown interaction type: %@", [interaction class]); return nil; @@ -234,9 +231,6 @@ NS_ASSUME_NONNULL_BEGIN } else { label.text = [infoMessage previewTextWithTransaction:transaction]; } - } else if ([interaction isKindOfClass:[TSCall class]]) { - TSCall *call = (TSCall *)interaction; - label.text = [call previewTextWithTransaction:transaction]; } else { OWSFail(@"Unknown interaction type: %@", [interaction class]); label.text = nil; From 57c79fd797cc84f9472f77f11ff570fdd0ed0b33 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Mon, 9 Jul 2018 11:08:22 -0400 Subject: [PATCH 3/3] Respond to CR. --- .../ConversationView/Cells/OWSCallMessageCell.m | 5 +---- SignalMessaging/categories/UIView+OWS.h | 1 - SignalMessaging/categories/UIView+OWS.m | 8 -------- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSCallMessageCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSCallMessageCell.m index 398cad59b..be2b5d587 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSCallMessageCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSCallMessageCell.m @@ -160,10 +160,7 @@ NS_ASSUME_NONNULL_BEGIN } CGSize cellSize = [self cellSizeWithTransaction:transaction]; - [self.layoutConstraints addObjectsFromArray:@[ - [self.bubbleView autoSetDimension:ALDimensionWidth toSize:cellSize.width], - [self.bubbleView autoSetDimension:ALDimensionHeight toSize:cellSize.height], - ]]; + [self.layoutConstraints addObjectsFromArray:[self.bubbleView autoSetDimensionsToSize:cellSize]]; self.vStackView.layoutMarginsRelativeArrangement = YES; self.vStackView.layoutMargins = UIEdgeInsetsMake(self.conversationStyle.textInsetTop, diff --git a/SignalMessaging/categories/UIView+OWS.h b/SignalMessaging/categories/UIView+OWS.h index ec19d591d..cd9a9b79f 100644 --- a/SignalMessaging/categories/UIView+OWS.h +++ b/SignalMessaging/categories/UIView+OWS.h @@ -33,7 +33,6 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value); - (NSLayoutConstraint *)autoHCenterInSuperview; - (NSLayoutConstraint *)autoVCenterInSuperview; -- (void)autoPinEdgesToEdgesOfView:(UIView *)view; - (void)autoPinWidthToWidthOfView:(UIView *)view; - (void)autoPinHeightToHeightOfView:(UIView *)view; diff --git a/SignalMessaging/categories/UIView+OWS.m b/SignalMessaging/categories/UIView+OWS.m index f09375bdc..5fa542ce9 100644 --- a/SignalMessaging/categories/UIView+OWS.m +++ b/SignalMessaging/categories/UIView+OWS.m @@ -111,14 +111,6 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value) return [self autoAlignAxis:ALAxisHorizontal toSameAxisOfView:self.superview]; } -- (void)autoPinEdgesToEdgesOfView:(UIView *)view -{ - OWSAssert(view); - - [self autoPinWidthToWidthOfView:view]; - [self autoPinHeightToHeightOfView:view]; -} - - (void)autoPinWidthToWidthOfView:(UIView *)view { OWSAssert(view);