stream-chat-swift icon indicating copy to clipboard operation
stream-chat-swift copied to clipboard

Messages are disappeared after pin/unpin message

Open jitendra-simform opened this issue 3 years ago • 8 comments
trafficstars

What did you do?

Pin/Unpin message

What did you expect to happen?

Message should be mark as pin

What happened instead?

Pinned messages are disappeared from message list

GetStream Environment

GetStream Chat version: 4.15 GetStream iOS version: 15.2 Swift version: 5 Xcode version: 13.2 Device: Simulator

https://user-images.githubusercontent.com/97155807/174289797-f091c8cc-a533-40e6-bc65-30235791df8f.mov

Additional context

open func pinMessage(message: ChatMessage, completion: ((Error?) -> Void)? = nil) { guard let cid = dataSource?.channel(for: self)?.cid else { log.error("Channel is not available"); return } let messageController = client.messageController( cid: cid, messageId: message.id ) if message.isPinned { messageController.unpin { error in completion?(error) } } else { messageController.pin(MessagePinning.noExpiration, completion: { [weak self] error in guard let weakSelf = self else { return } DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { weakSelf.sendPinMessage() } }) } }

jitendra-simform avatar Jun 17 '22 11:06 jitendra-simform

Hello @jitendra-simform ,

Can you explain the question a bit more? I've watched the video and I don't see the messages disappearing from the message list?

b-onc avatar Jun 17 '22 11:06 b-onc

Hello @jitendra-simform ,

Can you explain the question a bit more? I've watched the video and I don't see the messages disappearing from the message list?

Sure @b-onc , I have sent message 1 to 10 and mark them as pin , one by one as you can see in video , then sent message 11 to 17 and mark them as pin then click back button

Please check video duration at 0.11 and 1.40

thanks Screenshot 2022-06-17 at 5 59 07 PM Screenshot 2022-06-17 at 6 01 09 PM

jitendra-simform avatar Jun 17 '22 12:06 jitendra-simform

Hello @jitendra-simform ,

Now I've seen the issue in the video, thank you.

I cannot reproduce this issue locally. Can you try the latest develop and let me know?

b-onc avatar Jun 17 '22 13:06 b-onc

Hello @b-onc Still facing same issue in v4.16 - Video attached Steps Pinned message using below function

// 
open func pinMessage(message: ChatMessage) {
        guard let channel = dataSource?.channel(for: self) else {
            return
        }
        let messageController = client.messageController(
            cid: channel.cid,
            messageId: message.id
        )
        messageController.pin(MessagePinning.noExpiration, completion: { [weak self] error in
            guard let weakSelf = self else { return }
            if error != nil {
                debugPrint("==== pin error \(error)")
            } else {

		// On Success  sent text message
                weakSelf.sendPinMessage(message: message)
            }
        })
    }

On Success sent text message using below function

open func sendPinMessage(message: ChatMessage) {
        guard let cid = dataSource?.channel(for: self)?.cid else {
            return
        }
        let channelController = client.channelController(for: cid)
        let text = "Message Pinned"
        channelController.createNewMessage(text: text, extraData: [:])
    }

Please suggest ASAP Thanks

https://user-images.githubusercontent.com/97155807/174745013-e493a0ef-af9f-462a-8556-a05ac048d916.mov

jitendra-simform avatar Jun 21 '22 07:06 jitendra-simform

Hey @jitendra-simform

Can you share the altered Demo project you're using for testing? Or create a patch file with your changes and share it here, so we can test.

b-onc avatar Jun 21 '22 09:06 b-onc

Hey @jitendra-simform

Can you share the altered Demo project you're using for testing? Or create a patch file with your changes and share it

here, so we can test. Hello @b-onc Here is patch file thanks patch.diff.zip

jitendra-simform avatar Jun 21 '22 10:06 jitendra-simform

Hi @jitendra-simform,

thanks for the patch! Ill try to reproduce the reported issue.

bielikb avatar Jun 22 '22 12:06 bielikb

Good news, I was able to reproduce your issue in DM channel.

Im going to investigate this issue a bit and will come back to you soon!

bielikb avatar Jun 22 '22 13:06 bielikb

Hi @jitendra-simform !

The issue will be available in the next 4.21.0 release.

We will let you know once it is published!

Best, Nuno

nuno-vieira avatar Aug 31 '22 16:08 nuno-vieira

Hi!

This issue is now solved in the 4.21.1 release.

Thank you for your patience!

Best, Nuno

nuno-vieira avatar Sep 06 '22 15:09 nuno-vieira