Home telegram - peer input activity
Post
Cancel

telegram - peer input activity

uploadActivityTypeForMessage

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
private func uploadActivityTypeForMessage(_ message: Message) -> PeerInputActivity? {
    guard message.forwardInfo == nil else {
        return nil
    }
    for media in message.media {
        if let _ = media as? UChatMediaImage {
            return .uploadingPhoto(progress: 0)
        } else if let file = media as? UChatMediaFile {
            if file.isInstantVideo {
                return .uploadingInstantVideo(progress: 0)
            } else if file.isVideo && !file.isAnimated {
                return .uploadingVideo(progress: 0)
            } else if !file.isSticker && !file.isVoice && !file.isAnimated {
                return .uploadingFile(progress: 0)
            }
        }
    }
    return nil
}
This post is licensed under CC BY 4.0 by the author.