Fix haptic on emoji without sounds

This commit is contained in:
Ilya Laktyushin 2021-09-19 01:30:42 +03:00
parent 3a865c3e6a
commit 4838bdc126

View File

@ -1699,8 +1699,10 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
return
}
let emojiSounds = AnimatedEmojiSoundsConfiguration.with(appConfiguration: appConfiguration, account: item.context.account)
var hasSound = false
for (emoji, file) in emojiSounds.sounds {
if emoji.strippedEmoji == textEmoji.strippedEmoji {
hasSound = true
let mediaManager = item.context.sharedContext.mediaManager
let mediaPlayer = MediaPlayer(audioSessionManager: mediaManager.audioSession, postbox: item.context.account.postbox, resourceReference: .standalone(resource: file.resource), streamable: .none, video: false, preferSoftwareDecoding: false, enableSound: true, fetchAutomatically: true, ambient: true)
mediaPlayer.togglePlayPause()
@ -1728,7 +1730,12 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
return
}
}
if !hasSound {
if let haptic = haptic, !haptic.active {
haptic.start(time: 0.0)
}
animationNode?.play()
}
})
}
})