Chatto
Chatto copied to clipboard
On tap can we zoom the image in chat.
I have done sending images in chat but, I dont know how to make the image fullscreen and zoom the images in chats using Chatto.
You need to implement that logic on the "userDidTapOnBubble", located in the BaseMessageHandler class. You can use any other Pod for image visualization, I use https://github.com/JanGorman/Agrume for this.
Thanks.
Hi Daxito, I am getting error in perform batch updates (self.collectionView.performBatchUpdates) in BaseChatViewController.
Did not have to mess with that for me to work, maybe check with the owner of the repo.
I have changed the value type of uid from "tutorial-i" to "i" thats why it was crashing in perform batch updates. I have fixed this issue.
I have created a zoomViewController to display a photo message's image in a full screen view. The problem is that I have not been able to determine the viewController from which to segue()
or pushViewController()
to the zoomViewController. I have implemented in DemoPhotoMessageHandler.swift:
func userDidTapOnBubble(viewModel: DemoPhotoMessageViewModel) {
let photo = viewModel.photoMessage.image
let zoomedPhotoViewController = ZoomedPhotoViewController()
zoomedPhotoViewController.photo = photo
// What should viewController be?
viewController.pushViewController(zoomedPhotoViewController, animated: true);
// Default code.
self.baseHandler.userDidTapOnBubble(viewModel: viewModel)
}
My photo message chat is based on the example ChattoApp photo message classes.
A previous comment by Daxito recommended implementing the zoom view in the BaseMessageHandler.swift userDidTapOnBubble() method which is called with the same viewModel variable as DemoPhotoMessageHandler.swift userDidTapOnBubble().
In Daxito's comment he also recommended using the Agrume framework for the image visualization. I took a quick look at that and found that it too requires the originating viewController:
private func show(from viewController: UIViewController) {
Any suggestions would be helpful.
I have created a zoomViewController to display a photo message's image in a full screen view. The problem is that I have not been able to determine the viewController from which to segue() or pushViewController() to the zoomViewController.
I was able to solve the problem by defining an AppDelegate chatViewController property, and then used it to pass the photo to chatViewController prepare(for segue:)
:
// Implement zoom of tapped on photo.
func userDidTapOnBubble(viewModel: DemoPhotoMessageViewModel) {
self.baseHandler.userDidTapOnBubble(viewModel: viewModel)
// Do nothing if long tap has begun.
if appDelegate.chatViewController?.disableUserDidTapOnBubble ?? false { return }
// Pass photo to chat view controller prepare(for segue:) so that it
// can be passed on to zoom photo view controller segue.
appDelegate.chatViewController?.tappedOnPhoto = viewModel.photoMessage.image
appDelegate.chatViewController?.performSegue(withIdentifier:"zoom_chat_message_photo", sender:self)
}