Add accessibilityIdentifiers to conversation view.

pull/2/head
Matthew Chen 6 years ago
parent 50888b20d2
commit d253c5aa91

@ -136,6 +136,7 @@ const CGFloat kMaxTextViewHeight = 98;
self.inputTextView.backgroundColor = Theme.toolbarBackgroundColor; self.inputTextView.backgroundColor = Theme.toolbarBackgroundColor;
[self.inputTextView setContentHuggingLow]; [self.inputTextView setContentHuggingLow];
[self.inputTextView setCompressionResistanceLow]; [self.inputTextView setCompressionResistanceLow];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _inputTextView);
_textViewHeightConstraint = [self.inputTextView autoSetDimension:ALDimensionHeight toSize:kMinTextViewHeight]; _textViewHeightConstraint = [self.inputTextView autoSetDimension:ALDimensionHeight toSize:kMinTextViewHeight];
@ -152,6 +153,7 @@ const CGFloat kMaxTextViewHeight = 98;
forState:UIControlStateNormal]; forState:UIControlStateNormal];
self.attachmentButton.tintColor = Theme.navbarIconColor; self.attachmentButton.tintColor = Theme.navbarIconColor;
[self.attachmentButton autoSetDimensionsToSize:CGSizeMake(40, kMinTextViewHeight)]; [self.attachmentButton autoSetDimensionsToSize:CGSizeMake(40, kMinTextViewHeight)];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _attachmentButton);
_sendButton = [UIButton buttonWithType:UIButtonTypeCustom]; _sendButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.sendButton setTitle:MessageStrings.sendButton forState:UIControlStateNormal]; [self.sendButton setTitle:MessageStrings.sendButton forState:UIControlStateNormal];
@ -161,6 +163,7 @@ const CGFloat kMaxTextViewHeight = 98;
self.sendButton.contentEdgeInsets = UIEdgeInsetsMake(0, 4, 0, 4); self.sendButton.contentEdgeInsets = UIEdgeInsetsMake(0, 4, 0, 4);
[self.sendButton autoSetDimension:ALDimensionHeight toSize:kMinTextViewHeight]; [self.sendButton autoSetDimension:ALDimensionHeight toSize:kMinTextViewHeight];
[self.sendButton addTarget:self action:@selector(sendButtonPressed) forControlEvents:UIControlEventTouchUpInside]; [self.sendButton addTarget:self action:@selector(sendButtonPressed) forControlEvents:UIControlEventTouchUpInside];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _sendButton);
UIImage *voiceMemoIcon = [UIImage imageNamed:@"voice-memo-button"]; UIImage *voiceMemoIcon = [UIImage imageNamed:@"voice-memo-button"];
OWSAssertDebug(voiceMemoIcon); OWSAssertDebug(voiceMemoIcon);
@ -169,6 +172,7 @@ const CGFloat kMaxTextViewHeight = 98;
forState:UIControlStateNormal]; forState:UIControlStateNormal];
self.voiceMemoButton.imageView.tintColor = Theme.navbarIconColor; self.voiceMemoButton.imageView.tintColor = Theme.navbarIconColor;
[self.voiceMemoButton autoSetDimensionsToSize:CGSizeMake(40, kMinTextViewHeight)]; [self.voiceMemoButton autoSetDimensionsToSize:CGSizeMake(40, kMinTextViewHeight)];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _voiceMemoButton);
// We want to be permissive about the voice message gesture, so we hang // We want to be permissive about the voice message gesture, so we hang
// the long press GR on the button's wrapper, not the button itself. // the long press GR on the button's wrapper, not the button itself.
@ -184,11 +188,13 @@ const CGFloat kMaxTextViewHeight = 98;
self.quotedReplyWrapper.hidden = YES; self.quotedReplyWrapper.hidden = YES;
[self.quotedReplyWrapper setContentHuggingHorizontalLow]; [self.quotedReplyWrapper setContentHuggingHorizontalLow];
[self.quotedReplyWrapper setCompressionResistanceHorizontalLow]; [self.quotedReplyWrapper setCompressionResistanceHorizontalLow];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _quotedReplyWrapper);
_linkPreviewWrapper = [UIView containerView]; _linkPreviewWrapper = [UIView containerView];
self.linkPreviewWrapper.hidden = YES; self.linkPreviewWrapper.hidden = YES;
[self.linkPreviewWrapper setContentHuggingHorizontalLow]; [self.linkPreviewWrapper setContentHuggingHorizontalLow];
[self.linkPreviewWrapper setCompressionResistanceHorizontalLow]; [self.linkPreviewWrapper setCompressionResistanceHorizontalLow];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _linkPreviewWrapper);
// V Stack // V Stack
UIStackView *vStack = [[UIStackView alloc] UIStackView *vStack = [[UIStackView alloc]
@ -346,6 +352,7 @@ const CGFloat kMaxTextViewHeight = 98;
self.quotedReplyWrapper.layoutMargins = UIEdgeInsetsZero; self.quotedReplyWrapper.layoutMargins = UIEdgeInsetsZero;
[self.quotedReplyWrapper addSubview:quotedMessagePreview]; [self.quotedReplyWrapper addSubview:quotedMessagePreview];
[quotedMessagePreview ows_autoPinToSuperviewMargins]; [quotedMessagePreview ows_autoPinToSuperviewMargins];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, quotedMessagePreview);
self.linkPreviewView.hasAsymmetricalRounding = !self.quotedReply; self.linkPreviewView.hasAsymmetricalRounding = !self.quotedReply;
} }
@ -563,6 +570,7 @@ const CGFloat kMaxTextViewHeight = 98;
self.voiceMemoUI.backgroundColor = Theme.toolbarBackgroundColor; self.voiceMemoUI.backgroundColor = Theme.toolbarBackgroundColor;
[self addSubview:self.voiceMemoUI]; [self addSubview:self.voiceMemoUI];
self.voiceMemoUI.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height); self.voiceMemoUI.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height);
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _voiceMemoUI);
self.voiceMemoContentView = [UIView new]; self.voiceMemoContentView = [UIView new];
[self.voiceMemoUI addSubview:self.voiceMemoContentView]; [self.voiceMemoUI addSubview:self.voiceMemoContentView];
@ -572,6 +580,7 @@ const CGFloat kMaxTextViewHeight = 98;
self.recordingLabel.textColor = [UIColor ows_destructiveRedColor]; self.recordingLabel.textColor = [UIColor ows_destructiveRedColor];
self.recordingLabel.font = [UIFont ows_mediumFontWithSize:14.f]; self.recordingLabel.font = [UIFont ows_mediumFontWithSize:14.f];
[self.voiceMemoContentView addSubview:self.recordingLabel]; [self.voiceMemoContentView addSubview:self.recordingLabel];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _recordingLabel);
VoiceMemoLockView *voiceMemoLockView = [VoiceMemoLockView new]; VoiceMemoLockView *voiceMemoLockView = [VoiceMemoLockView new];
self.voiceMemoLockView = voiceMemoLockView; self.voiceMemoLockView = voiceMemoLockView;
@ -773,6 +782,7 @@ const CGFloat kMaxTextViewHeight = 98;
[sendVoiceMemoButton autoVCenterInSuperview]; [sendVoiceMemoButton autoVCenterInSuperview];
[sendVoiceMemoButton setCompressionResistanceHigh]; [sendVoiceMemoButton setCompressionResistanceHigh];
[sendVoiceMemoButton setContentHuggingHigh]; [sendVoiceMemoButton setContentHuggingHigh];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, sendVoiceMemoButton);
UIButton *cancelButton = [[OWSButton alloc] initWithBlock:^{ UIButton *cancelButton = [[OWSButton alloc] initWithBlock:^{
[weakSelf.inputToolbarDelegate voiceMemoGestureDidCancel]; [weakSelf.inputToolbarDelegate voiceMemoGestureDidCancel];
@ -781,6 +791,7 @@ const CGFloat kMaxTextViewHeight = 98;
[cancelButton setTitleColor:UIColor.ows_destructiveRedColor forState:UIControlStateNormal]; [cancelButton setTitleColor:UIColor.ows_destructiveRedColor forState:UIControlStateNormal];
cancelButton.alpha = 0; cancelButton.alpha = 0;
cancelButton.titleLabel.textAlignment = NSTextAlignmentCenter; cancelButton.titleLabel.textAlignment = NSTextAlignmentCenter;
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, cancelButton);
[self.voiceMemoContentView addSubview:cancelButton]; [self.voiceMemoContentView addSubview:cancelButton];
OWSAssert(self.recordingLabel != nil); OWSAssert(self.recordingLabel != nil);

@ -619,10 +619,12 @@ typedef enum : NSUInteger {
[self.collectionView autoPinEdgeToSuperviewSafeArea:ALEdgeTrailing]; [self.collectionView autoPinEdgeToSuperviewSafeArea:ALEdgeTrailing];
[self.collectionView applyScrollViewInsetsFix]; [self.collectionView applyScrollViewInsetsFix];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _collectionView);
_inputToolbar = [[ConversationInputToolbar alloc] initWithConversationStyle:self.conversationStyle]; _inputToolbar = [[ConversationInputToolbar alloc] initWithConversationStyle:self.conversationStyle];
self.inputToolbar.inputToolbarDelegate = self; self.inputToolbar.inputToolbarDelegate = self;
self.inputToolbar.inputTextViewDelegate = self; self.inputToolbar.inputTextViewDelegate = self;
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _inputToolbar);
self.loadMoreHeader = [UILabel new]; self.loadMoreHeader = [UILabel new];
self.loadMoreHeader.text = NSLocalizedString(@"CONVERSATION_VIEW_LOADING_MORE_MESSAGES", self.loadMoreHeader.text = NSLocalizedString(@"CONVERSATION_VIEW_LOADING_MORE_MESSAGES",
@ -634,6 +636,7 @@ typedef enum : NSUInteger {
[self.loadMoreHeader autoPinWidthToWidthOfView:self.view]; [self.loadMoreHeader autoPinWidthToWidthOfView:self.view];
[self.loadMoreHeader autoPinEdgeToSuperviewEdge:ALEdgeTop]; [self.loadMoreHeader autoPinEdgeToSuperviewEdge:ALEdgeTop];
[self.loadMoreHeader autoSetDimension:ALDimensionHeight toSize:kLoadMoreHeaderHeight]; [self.loadMoreHeader autoSetDimension:ALDimensionHeight toSize:kLoadMoreHeaderHeight];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _loadMoreHeader);
[self updateShowLoadMoreHeader]; [self updateShowLoadMoreHeader];
} }
@ -1006,6 +1009,7 @@ typedef enum : NSUInteger {
[closeButton autoPinLeadingToTrailingEdgeOfView:label offset:kBannerHSpacing]; [closeButton autoPinLeadingToTrailingEdgeOfView:label offset:kBannerHSpacing];
[bannerView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:tapSelector]]; [bannerView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:tapSelector]];
bannerView.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"banner_close");
[self.view addSubview:bannerView]; [self.view addSubview:bannerView];
[bannerView autoPinToTopLayoutGuideOfViewController:self withInset:10]; [bannerView autoPinToTopLayoutGuideOfViewController:self withInset:10];
@ -1083,11 +1087,13 @@ typedef enum : NSUInteger {
}]; }];
[actionSheet addAction:verifyAction]; [actionSheet addAction:verifyAction];
UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.dismissButton UIAlertAction *dismissAction =
style:UIAlertActionStyleCancel [UIAlertAction actionWithTitle:CommonStrings.dismissButton
handler:^(UIAlertAction *action) { accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"dismiss")
[weakSelf resetVerificationStateToDefault]; style:UIAlertActionStyleCancel
}]; handler:^(UIAlertAction *action) {
[weakSelf resetVerificationStateToDefault];
}];
[actionSheet addAction:dismissAction]; [actionSheet addAction:dismissAction];
[self dismissKeyBoard]; [self dismissKeyBoard];
@ -1358,6 +1364,7 @@ typedef enum : NSUInteger {
ConversationHeaderView *headerView = ConversationHeaderView *headerView =
[[ConversationHeaderView alloc] initWithThread:self.thread contactsManager:self.contactsManager]; [[ConversationHeaderView alloc] initWithThread:self.thread contactsManager:self.contactsManager];
self.headerView = headerView; self.headerView = headerView;
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, headerView);
headerView.delegate = self; headerView.delegate = self;
self.navigationItem.titleView = headerView; self.navigationItem.titleView = headerView;
@ -1483,7 +1490,9 @@ typedef enum : NSUInteger {
0, 0,
round(image.size.width + imageEdgeInsets.left + imageEdgeInsets.right), round(image.size.width + imageEdgeInsets.left + imageEdgeInsets.right),
round(image.size.height + imageEdgeInsets.top + imageEdgeInsets.bottom)); round(image.size.height + imageEdgeInsets.top + imageEdgeInsets.bottom));
[barButtons addObject:[[UIBarButtonItem alloc] initWithCustomView:callButton]]; [barButtons
addObject:[[UIBarButtonItem alloc] initWithCustomView:callButton
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"call")]];
} }
if (self.disappearingMessagesConfiguration.isEnabled) { if (self.disappearingMessagesConfiguration.isEnabled) {
@ -1502,7 +1511,9 @@ typedef enum : NSUInteger {
timerView.frame = CGRectMake(0, 0, 36, 44); timerView.frame = CGRectMake(0, 0, 36, 44);
} }
[barButtons addObject:[[UIBarButtonItem alloc] initWithCustomView:timerView]]; [barButtons
addObject:[[UIBarButtonItem alloc] initWithCustomView:timerView
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"timer")]];
} }
self.navigationItem.rightBarButtonItems = [barButtons copy]; self.navigationItem.rightBarButtonItems = [barButtons copy];
@ -1804,14 +1815,15 @@ typedef enum : NSUInteger {
[actionSheet addAction:deleteMessageAction]; [actionSheet addAction:deleteMessageAction];
UIAlertAction *resendMessageAction = [UIAlertAction UIAlertAction *resendMessageAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"SEND_AGAIN_BUTTON", @"") actionWithTitle:NSLocalizedString(@"SEND_AGAIN_BUTTON", @"")
style:UIAlertActionStyleDefault accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"send_again")
handler:^(UIAlertAction *action) { style:UIAlertActionStyleDefault
[self.editingDatabaseConnection handler:^(UIAlertAction *action) {
asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) { [self.editingDatabaseConnection
[self.messageSenderJobQueue addMessage:message transaction:transaction]; asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
[self.messageSenderJobQueue addMessage:message transaction:transaction];
}];
}]; }];
}];
[actionSheet addAction:resendMessageAction]; [actionSheet addAction:resendMessageAction];
@ -1851,20 +1863,21 @@ typedef enum : NSUInteger {
[alert addAction:[OWSAlerts cancelAction]]; [alert addAction:[OWSAlerts cancelAction]];
UIAlertAction *resetSessionAction = [UIAlertAction UIAlertAction *resetSessionAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"FINGERPRINT_SHRED_KEYMATERIAL_BUTTON", @"") actionWithTitle:NSLocalizedString(@"FINGERPRINT_SHRED_KEYMATERIAL_BUTTON", @"")
style:UIAlertActionStyleDefault accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"reset_session")
handler:^(UIAlertAction *action) { style:UIAlertActionStyleDefault
if (![self.thread isKindOfClass:[TSContactThread class]]) { handler:^(UIAlertAction *action) {
// Corrupt Message errors only appear in contact threads. if (![self.thread isKindOfClass:[TSContactThread class]]) {
OWSLogError(@"Unexpected request to reset session in group thread. Refusing"); // Corrupt Message errors only appear in contact threads.
return; OWSLogError(@"Unexpected request to reset session in group thread. Refusing");
} return;
TSContactThread *contactThread = (TSContactThread *)self.thread; }
[self.editingDatabaseConnection TSContactThread *contactThread = (TSContactThread *)self.thread;
asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) { [self.editingDatabaseConnection
[self.sessionResetJobQueue addContactThread:contactThread transaction:transaction]; asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
[self.sessionResetJobQueue addContactThread:contactThread transaction:transaction];
}];
}]; }];
}];
[alert addAction:resetSessionAction]; [alert addAction:resetSessionAction];
[self dismissKeyBoard]; [self dismissKeyBoard];
@ -1885,6 +1898,7 @@ typedef enum : NSUInteger {
UIAlertAction *showSafteyNumberAction = UIAlertAction *showSafteyNumberAction =
[UIAlertAction actionWithTitle:NSLocalizedString(@"SHOW_SAFETY_NUMBER_ACTION", @"Action sheet item") [UIAlertAction actionWithTitle:NSLocalizedString(@"SHOW_SAFETY_NUMBER_ACTION", @"Action sheet item")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"show_safety_number")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
OWSLogInfo(@"Remote Key Changed actions: Show fingerprint display"); OWSLogInfo(@"Remote Key Changed actions: Show fingerprint display");
@ -1894,13 +1908,14 @@ typedef enum : NSUInteger {
UIAlertAction *acceptSafetyNumberAction = UIAlertAction *acceptSafetyNumberAction =
[UIAlertAction actionWithTitle:NSLocalizedString(@"ACCEPT_NEW_IDENTITY_ACTION", @"Action sheet item") [UIAlertAction actionWithTitle:NSLocalizedString(@"ACCEPT_NEW_IDENTITY_ACTION", @"Action sheet item")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"accept_safety_number")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
OWSLogInfo(@"Remote Key Changed actions: Accepted new identity key"); OWSLogInfo(@"Remote Key Changed actions: Accepted new identity key");
// DEPRECATED: we're no longer creating these incoming SN error's per message, // DEPRECATED: we're no longer creating these incoming SN error's per message,
// but there will be some legacy ones in the wild, behind which await // but there will be some legacy ones in the wild, behind which await
// as-of-yet-undecrypted messages // as-of-yet-undecrypted messages
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations" #pragma clang diagnostic ignored "-Wdeprecated-declarations"
if ([errorMessage isKindOfClass:[TSInvalidIdentityKeyReceivingErrorMessage class]]) { if ([errorMessage isKindOfClass:[TSInvalidIdentityKeyReceivingErrorMessage class]]) {
@ -1936,6 +1951,7 @@ typedef enum : NSUInteger {
__weak ConversationViewController *weakSelf = self; __weak ConversationViewController *weakSelf = self;
UIAlertAction *callAction = [UIAlertAction actionWithTitle:[CallStrings callBackAlertCallButton] UIAlertAction *callAction = [UIAlertAction actionWithTitle:[CallStrings callBackAlertCallButton]
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"call_back")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
[weakSelf startAudioCall]; [weakSelf startAudioCall];
@ -2207,20 +2223,22 @@ typedef enum : NSUInteger {
[actionSheet addAction:[OWSAlerts cancelAction]]; [actionSheet addAction:[OWSAlerts cancelAction]];
UIAlertAction *blockAction = [UIAlertAction UIAlertAction *blockAction =
actionWithTitle:NSLocalizedString( [UIAlertAction actionWithTitle:NSLocalizedString(@"BLOCK_OFFER_ACTIONSHEET_BLOCK_ACTION",
@"BLOCK_OFFER_ACTIONSHEET_BLOCK_ACTION", @"Action sheet that will block an unknown user.") @"Action sheet that will block an unknown user.")
style:UIAlertActionStyleDestructive accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"block_user")
handler:^(UIAlertAction *action) { style:UIAlertActionStyleDestructive
OWSLogInfo(@"Blocking an unknown user."); handler:^(UIAlertAction *action) {
[self.blockingManager addBlockedPhoneNumber:interaction.recipientId]; OWSLogInfo(@"Blocking an unknown user.");
// Delete the offers. [self.blockingManager addBlockedPhoneNumber:interaction.recipientId];
[self.editingDatabaseConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { // Delete the offers.
contactThread.hasDismissedOffers = YES; [self.editingDatabaseConnection
[contactThread saveWithTransaction:transaction]; readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[interaction removeWithTransaction:transaction]; contactThread.hasDismissedOffers = YES;
}]; [contactThread saveWithTransaction:transaction];
}]; [interaction removeWithTransaction:transaction];
}];
}];
[actionSheet addAction:blockAction]; [actionSheet addAction:blockAction];
[self dismissKeyBoard]; [self dismissKeyBoard];
@ -2566,6 +2584,7 @@ typedef enum : NSUInteger {
[self.view addSubview:self.scrollDownButton]; [self.view addSubview:self.scrollDownButton];
[self.scrollDownButton autoSetDimension:ALDimensionWidth toSize:ConversationScrollButton.buttonSize]; [self.scrollDownButton autoSetDimension:ALDimensionWidth toSize:ConversationScrollButton.buttonSize];
[self.scrollDownButton autoSetDimension:ALDimensionHeight toSize:ConversationScrollButton.buttonSize]; [self.scrollDownButton autoSetDimension:ALDimensionHeight toSize:ConversationScrollButton.buttonSize];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _scrollDownButton);
// The "scroll down" button layout tracks the content inset of the collection view, // The "scroll down" button layout tracks the content inset of the collection view,
// so pin to the edge of the collection view. // so pin to the edge of the collection view.
@ -2584,6 +2603,7 @@ typedef enum : NSUInteger {
[self.scrollUpButton autoPinToTopLayoutGuideOfViewController:self withInset:0]; [self.scrollUpButton autoPinToTopLayoutGuideOfViewController:self withInset:0];
[self.scrollUpButton autoPinEdgeToSuperviewSafeArea:ALEdgeTrailing]; [self.scrollUpButton autoPinEdgeToSuperviewSafeArea:ALEdgeTrailing];
#endif #endif
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _scrollUpButton);
[self updateScrollDownButtonLayout]; [self updateScrollDownButtonLayout];
} }
@ -3409,34 +3429,40 @@ typedef enum : NSUInteger {
[actionSheet addAction:[OWSAlerts cancelAction]]; [actionSheet addAction:[OWSAlerts cancelAction]];
UIAlertAction *takeMediaAction = [UIAlertAction UIAlertAction *takeMediaAction =
actionWithTitle:NSLocalizedString(@"MEDIA_FROM_CAMERA_BUTTON", @"media picker option to take photo or video") [UIAlertAction actionWithTitle:NSLocalizedString(
style:UIAlertActionStyleDefault @"MEDIA_FROM_CAMERA_BUTTON", @"media picker option to take photo or video")
handler:^(UIAlertAction *action) { accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"send_camera")
[self takePictureOrVideo]; style:UIAlertActionStyleDefault
}]; handler:^(UIAlertAction *action) {
[self takePictureOrVideo];
}];
UIImage *takeMediaImage = [UIImage imageNamed:@"actionsheet_camera_black"]; UIImage *takeMediaImage = [UIImage imageNamed:@"actionsheet_camera_black"];
OWSAssertDebug(takeMediaImage); OWSAssertDebug(takeMediaImage);
[takeMediaAction setValue:takeMediaImage forKey:@"image"]; [takeMediaAction setValue:takeMediaImage forKey:@"image"];
[actionSheet addAction:takeMediaAction]; [actionSheet addAction:takeMediaAction];
UIAlertAction *chooseMediaAction = [UIAlertAction UIAlertAction *chooseMediaAction =
actionWithTitle:NSLocalizedString(@"MEDIA_FROM_LIBRARY_BUTTON", @"media picker option to choose from library") [UIAlertAction actionWithTitle:NSLocalizedString(
style:UIAlertActionStyleDefault @"MEDIA_FROM_LIBRARY_BUTTON", @"media picker option to choose from library")
handler:^(UIAlertAction *action) { accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"send_choose_media")
[self chooseFromLibraryAsMedia]; style:UIAlertActionStyleDefault
}]; handler:^(UIAlertAction *action) {
[self chooseFromLibraryAsMedia];
}];
UIImage *chooseMediaImage = [UIImage imageNamed:@"actionsheet_camera_roll_black"]; UIImage *chooseMediaImage = [UIImage imageNamed:@"actionsheet_camera_roll_black"];
OWSAssertDebug(chooseMediaImage); OWSAssertDebug(chooseMediaImage);
[chooseMediaAction setValue:chooseMediaImage forKey:@"image"]; [chooseMediaAction setValue:chooseMediaImage forKey:@"image"];
[actionSheet addAction:chooseMediaAction]; [actionSheet addAction:chooseMediaAction];
UIAlertAction *gifAction = [UIAlertAction UIAlertAction *gifAction =
actionWithTitle:NSLocalizedString(@"SELECT_GIF_BUTTON", @"Label for 'select GIF to attach' action sheet button") [UIAlertAction actionWithTitle:NSLocalizedString(@"SELECT_GIF_BUTTON",
style:UIAlertActionStyleDefault @"Label for 'select GIF to attach' action sheet button")
handler:^(UIAlertAction *action) { accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"send_gif")
[self showGifPicker]; style:UIAlertActionStyleDefault
}]; handler:^(UIAlertAction *action) {
[self showGifPicker];
}];
UIImage *gifImage = [UIImage imageNamed:@"actionsheet_gif_black"]; UIImage *gifImage = [UIImage imageNamed:@"actionsheet_gif_black"];
OWSAssertDebug(gifImage); OWSAssertDebug(gifImage);
[gifAction setValue:gifImage forKey:@"image"]; [gifAction setValue:gifImage forKey:@"image"];
@ -3445,6 +3471,7 @@ typedef enum : NSUInteger {
UIAlertAction *chooseDocumentAction = UIAlertAction *chooseDocumentAction =
[UIAlertAction actionWithTitle:NSLocalizedString(@"MEDIA_FROM_DOCUMENT_PICKER_BUTTON", [UIAlertAction actionWithTitle:NSLocalizedString(@"MEDIA_FROM_DOCUMENT_PICKER_BUTTON",
@"action sheet button title when choosing attachment type") @"action sheet button title when choosing attachment type")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"send_document")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
[self showAttachmentDocumentPickerMenu]; [self showAttachmentDocumentPickerMenu];
@ -3458,6 +3485,7 @@ typedef enum : NSUInteger {
UIAlertAction *chooseContactAction = UIAlertAction *chooseContactAction =
[UIAlertAction actionWithTitle:NSLocalizedString(@"ATTACHMENT_MENU_CONTACT_BUTTON", [UIAlertAction actionWithTitle:NSLocalizedString(@"ATTACHMENT_MENU_CONTACT_BUTTON",
@"attachment menu option to send contact") @"attachment menu option to send contact")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"send_contact")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
[self chooseContactForSending]; [self chooseContactForSending];
@ -4543,6 +4571,10 @@ typedef enum : NSUInteger {
[cell loadForDisplay]; [cell loadForDisplay];
// TODO: Confirm with nancy if this will work.
NSString *cellName = [NSString stringWithFormat:@"interaction.%@", NSUUID.UUID.UUIDString];
cell.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, cellName);
return cell; return cell;
} }

Loading…
Cancel
Save