- Story search UI

- Delete message confirmation
This commit is contained in:
Isaac
2024-06-04 19:18:41 +04:00
parent 6ccc9ed693
commit d7bb7d55b4
46 changed files with 1534 additions and 951 deletions

View File

@@ -64,14 +64,22 @@ func chatMessageDisplaySendMessageOptions(selfController: ChatControllerImpl, no
editMessages = .single([])
}
var currentMessageEffect: ChatSendMessageActionSheetControllerSendParameters.Effect?
if selfController.presentationInterfaceState.interfaceState.editMessage == nil {
if let sendMessageEffect = selfController.presentationInterfaceState.interfaceState.sendMessageEffect {
currentMessageEffect = ChatSendMessageActionSheetControllerSendParameters.Effect(id: sendMessageEffect)
}
}
let _ = (combineLatest(
selfController.context.account.viewTracker.peerView(peerId) |> take(1),
effectItems,
availableMessageEffects,
hasPremium,
editMessages
editMessages,
ChatSendMessageContextScreen.initialData(context: selfController.context, currentMessageEffectId: currentMessageEffect?.id)
)
|> deliverOnMainQueue).startStandalone(next: { [weak selfController] peerView, effectItems, availableMessageEffects, hasPremium, editMessages in
|> deliverOnMainQueue).startStandalone(next: { [weak selfController] peerView, effectItems, availableMessageEffects, hasPremium, editMessages, initialData in
guard let selfController, let peer = peerViewMainPeer(peerView) else {
return
}
@@ -112,6 +120,7 @@ func chatMessageDisplaySendMessageOptions(selfController: ChatControllerImpl, no
}
let controller = makeChatSendMessageActionSheetController(
initialData: initialData,
context: selfController.context,
updatedPresentationData: selfController.updatedPresentationData,
peerId: selfController.presentationInterfaceState.chatLocation.peerId,
@@ -200,6 +209,7 @@ func chatMessageDisplaySendMessageOptions(selfController: ChatControllerImpl, no
}
let controller = makeChatSendMessageActionSheetController(
initialData: initialData,
context: selfController.context,
updatedPresentationData: selfController.updatedPresentationData,
peerId: selfController.presentationInterfaceState.chatLocation.peerId,
@@ -207,6 +217,16 @@ func chatMessageDisplaySendMessageOptions(selfController: ChatControllerImpl, no
isScheduledMessages: false,
mediaPreview: mediaPreview,
mediaCaptionIsAbove: nil,
messageEffect: (currentMessageEffect, { [weak selfController] updatedEffect in
guard let selfController else {
return
}
selfController.updateChatPresentationInterfaceState(transition: .immediate, interactive: true, { presentationInterfaceState in
return presentationInterfaceState.updatedInterfaceState { interfaceState in
return interfaceState.withUpdatedSendMessageEffect(updatedEffect?.id)
}
})
}),
attachment: false,
canSendWhenOnline: sendWhenOnlineAvailable,
forwardMessageIds: selfController.presentationInterfaceState.interfaceState.forwardMessageIds ?? []
@@ -238,7 +258,7 @@ func chatMessageDisplaySendMessageOptions(selfController: ChatControllerImpl, no
return
}
selfController.updateChatPresentationInterfaceState(animated: true, interactive: false, saveInterfaceState: selfController.presentationInterfaceState.subject != .scheduledMessages, {
$0.updatedInterfaceState { $0.withUpdatedReplyMessageSubject(nil).withUpdatedForwardMessageIds(nil).withUpdatedForwardOptionsState(nil).withUpdatedComposeInputState(ChatTextInputState(inputText: NSAttributedString(string: ""))) }
$0.updatedInterfaceState { $0.withUpdatedReplyMessageSubject(nil).withUpdatedSendMessageEffect(nil).withUpdatedForwardMessageIds(nil).withUpdatedForwardOptionsState(nil).withUpdatedComposeInputState(ChatTextInputState(inputText: NSAttributedString(string: ""))) }
})
selfController.openScheduledMessages()
}