Chatto icon indicating copy to clipboard operation
Chatto copied to clipboard

On tap can we zoom the image in chat.

Open suvarnajayanth opened this issue 6 years ago • 7 comments

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.

suvarnajayanth avatar Aug 13 '18 10:08 suvarnajayanth

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.

Daxito avatar Aug 13 '18 19:08 Daxito

Thanks.

suvarnajayanth avatar Aug 14 '18 05:08 suvarnajayanth

Hi Daxito, I am getting error in perform batch updates (self.collectionView.performBatchUpdates) in BaseChatViewController.

suvarnajayanth avatar Aug 17 '18 04:08 suvarnajayanth

Did not have to mess with that for me to work, maybe check with the owner of the repo.

Daxito avatar Aug 17 '18 20:08 Daxito

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.

suvarnajayanth avatar Aug 20 '18 12:08 suvarnajayanth

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.

101airborne avatar Aug 16 '19 00:08 101airborne

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)
    }

101airborne avatar Aug 23 '19 15:08 101airborne