DRY out showing the MemberActionSheet in ConversationViewController
This commit is contained in:
parent
86d5999bf7
commit
299e3869a6
@ -183,16 +183,7 @@ extension ConversationViewController {
|
||||
|
||||
if address.isLocalAddress ||
|
||||
Self.contactsManagerImpl.isKnownRegisteredUserWithSneakyTransaction(address: address) {
|
||||
let groupViewHelper: GroupViewHelper? = {
|
||||
guard threadViewModel.isGroupThread else {
|
||||
return nil
|
||||
}
|
||||
let groupViewHelper = GroupViewHelper(threadViewModel: threadViewModel)
|
||||
groupViewHelper.delegate = self
|
||||
return groupViewHelper
|
||||
}()
|
||||
let actionSheet = MemberActionSheet(address: address, groupViewHelper: groupViewHelper)
|
||||
actionSheet.present(from: self)
|
||||
showMemberActionSheet(forAddress: address, withHapticFeedback: false)
|
||||
return
|
||||
}
|
||||
|
||||
@ -356,10 +347,6 @@ extension ConversationViewController {
|
||||
private func didTapOrLongPressMention(_ mention: Mention) {
|
||||
AssertIsOnMainThread()
|
||||
|
||||
ImpactHapticFeedback.impactOccured(style: .light)
|
||||
let groupViewHelper = GroupViewHelper(threadViewModel: threadViewModel)
|
||||
groupViewHelper.delegate = self
|
||||
let actionSheet = MemberActionSheet(address: mention.address, groupViewHelper: groupViewHelper)
|
||||
actionSheet.present(from: self)
|
||||
showMemberActionSheet(forAddress: mention.address, withHapticFeedback: true)
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,11 +123,8 @@ extension ConversationViewController: CVComponentDelegate {
|
||||
owsFailDebug("not an incoming message.")
|
||||
return
|
||||
}
|
||||
let groupViewHelper = GroupViewHelper(threadViewModel: threadViewModel)
|
||||
groupViewHelper.delegate = self
|
||||
let actionSheet = MemberActionSheet(address: incomingMessage.authorAddress,
|
||||
groupViewHelper: groupViewHelper)
|
||||
actionSheet.present(from: self)
|
||||
|
||||
showMemberActionSheet(forAddress: incomingMessage.authorAddress, withHapticFeedback: false)
|
||||
}
|
||||
|
||||
public func cvc_shouldAllowReplyForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool {
|
||||
|
||||
@ -275,6 +275,25 @@ public extension ConversationViewController {
|
||||
|
||||
return Array(viewControllers.prefix(upTo: index + 1))
|
||||
}
|
||||
|
||||
// MARK: - Member Action Sheet
|
||||
|
||||
func showMemberActionSheet(forAddress address: SignalServiceAddress, withHapticFeedback: Bool) {
|
||||
AssertIsOnMainThread()
|
||||
|
||||
if withHapticFeedback {
|
||||
ImpactHapticFeedback.impactOccured(style: .light)
|
||||
}
|
||||
|
||||
var groupViewHelper: GroupViewHelper?
|
||||
if threadViewModel.isGroupThread {
|
||||
groupViewHelper = GroupViewHelper(threadViewModel: threadViewModel)
|
||||
groupViewHelper!.delegate = self
|
||||
}
|
||||
|
||||
let actionSheet = MemberActionSheet(address: address, groupViewHelper: groupViewHelper)
|
||||
actionSheet.present(from: self)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: -
|
||||
|
||||
Loading…
Reference in New Issue
Block a user