mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-17 16:51:10 +00:00
Various UI fixes
This commit is contained in:
parent
a9119e69bb
commit
e1aa23e714
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
_dimensions = CGSizeMake(width, height);
|
_dimensions = CGSizeMake(width, height);
|
||||||
|
|
||||||
if ((_frameRate > 60) || _animation->duration() > 4.5) {
|
if ((_frameRate > 60) || _animation->duration() > 7.0) {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,12 +82,14 @@ private final class AnimatedStickerFrame {
|
|||||||
let type: AnimationRendererFrameType
|
let type: AnimationRendererFrameType
|
||||||
let width: Int
|
let width: Int
|
||||||
let height: Int
|
let height: Int
|
||||||
|
let isLastFrame: Bool
|
||||||
|
|
||||||
init(data: Data, type: AnimationRendererFrameType, width: Int, height: Int) {
|
init(data: Data, type: AnimationRendererFrameType, width: Int, height: Int, isLastFrame: Bool) {
|
||||||
self.data = data
|
self.data = data
|
||||||
self.type = type
|
self.type = type
|
||||||
self.width = width
|
self.width = width
|
||||||
self.height = height
|
self.height = height
|
||||||
|
self.isLastFrame = isLastFrame
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,6 +164,7 @@ private final class AnimatedStickerCachedFrameSource: AnimatedStickerFrameSource
|
|||||||
|
|
||||||
func takeFrame() -> AnimatedStickerFrame {
|
func takeFrame() -> AnimatedStickerFrame {
|
||||||
var frameData: Data?
|
var frameData: Data?
|
||||||
|
var isLastFrame = false
|
||||||
|
|
||||||
let dataLength = self.data.count
|
let dataLength = self.data.count
|
||||||
let decodeBufferLength = self.decodeBuffer.count
|
let decodeBufferLength = self.decodeBuffer.count
|
||||||
@ -192,6 +195,7 @@ private final class AnimatedStickerCachedFrameSource: AnimatedStickerFrameSource
|
|||||||
|
|
||||||
self.offset += Int(frameLength)
|
self.offset += Int(frameLength)
|
||||||
if self.offset == dataLength {
|
if self.offset == dataLength {
|
||||||
|
isLastFrame = true
|
||||||
self.offset = self.initialOffset
|
self.offset = self.initialOffset
|
||||||
self.frameBuffer.withUnsafeMutableBytes { (bytes: UnsafeMutablePointer<UInt8>) -> Void in
|
self.frameBuffer.withUnsafeMutableBytes { (bytes: UnsafeMutablePointer<UInt8>) -> Void in
|
||||||
memset(bytes, 0, frameBufferLength)
|
memset(bytes, 0, frameBufferLength)
|
||||||
@ -199,7 +203,7 @@ private final class AnimatedStickerCachedFrameSource: AnimatedStickerFrameSource
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return AnimatedStickerFrame(data: frameData!, type: .yuva, width: self.width, height: self.height)
|
return AnimatedStickerFrame(data: frameData!, type: .yuva, width: self.width, height: self.height, isLastFrame: isLastFrame)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +247,7 @@ private final class AnimatedStickerDirectFrameSource: AnimatedStickerFrameSource
|
|||||||
memset(bytes, 0, self.width * self.height * 4)
|
memset(bytes, 0, self.width * self.height * 4)
|
||||||
self.animation.renderFrame(with: Int32(frameIndex), into: bytes, width: Int32(self.width), height: Int32(self.height))
|
self.animation.renderFrame(with: Int32(frameIndex), into: bytes, width: Int32(self.width), height: Int32(self.height))
|
||||||
}
|
}
|
||||||
return AnimatedStickerFrame(data: frameData, type: .argb, width: self.width, height: self.height)
|
return AnimatedStickerFrame(data: frameData, type: .argb, width: self.width, height: self.height, isLastFrame: frameIndex == self.frameCount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -434,6 +438,10 @@ final class AnimatedStickerNode: ASDisplayNode {
|
|||||||
strongSelf.started()
|
strongSelf.started()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
if case .once = strongSelf.playbackMode, frame.isLastFrame {
|
||||||
|
strongSelf.stop()
|
||||||
|
strongSelf.isPlaying = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
frameQueue.with { frameQueue in
|
frameQueue.with { frameQueue in
|
||||||
|
@ -892,7 +892,7 @@ public func channelAdminController(context: AccountContext, peerId: PeerId, admi
|
|||||||
return current
|
return current
|
||||||
}
|
}
|
||||||
|
|
||||||
if let updateRank = updateRank, updateRank.count > rankMaxLength {
|
if let updateRank = updateRank, updateRank.count > rankMaxLength || updateRank.containsEmoji {
|
||||||
errorImpl?()
|
errorImpl?()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -928,6 +928,10 @@ public func channelAdminController(context: AccountContext, peerId: PeerId, admi
|
|||||||
}
|
}
|
||||||
|
|
||||||
let effectiveRank = updateRank ?? currentRank
|
let effectiveRank = updateRank ?? currentRank
|
||||||
|
if effectiveRank?.containsEmoji ?? false {
|
||||||
|
errorImpl?()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if let updateFlags = updateFlags {
|
if let updateFlags = updateFlags {
|
||||||
updateState { current in
|
updateState { current in
|
||||||
@ -961,7 +965,7 @@ public func channelAdminController(context: AccountContext, peerId: PeerId, admi
|
|||||||
return current
|
return current
|
||||||
}
|
}
|
||||||
|
|
||||||
if let updateRank = updateRank, updateRank.count > rankMaxLength {
|
if let updateRank = updateRank, updateRank.count > rankMaxLength || updateRank.containsEmoji {
|
||||||
errorImpl?()
|
errorImpl?()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1014,7 +1018,7 @@ public func channelAdminController(context: AccountContext, peerId: PeerId, admi
|
|||||||
return current
|
return current
|
||||||
}
|
}
|
||||||
|
|
||||||
if let updateRank = updateRank, updateRank.count > rankMaxLength {
|
if let updateRank = updateRank, updateRank.count > rankMaxLength || updateRank.containsEmoji {
|
||||||
errorImpl?()
|
errorImpl?()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -153,11 +153,11 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let isPlaying = self.visibilityStatus && item.controllerInteraction.stickerSettings.loopAnimatedStickers
|
let isPlaying = self.visibilityStatus
|
||||||
if self.isPlaying != isPlaying {
|
if self.isPlaying != isPlaying {
|
||||||
self.isPlaying = isPlaying
|
self.isPlaying = isPlaying
|
||||||
self.animationNode.visibility = isPlaying
|
self.animationNode.visibility = isPlaying
|
||||||
if let item = self.item, isPlaying, !self.didSetUpAnimationNode {
|
if self.isPlaying && !self.didSetUpAnimationNode {
|
||||||
self.didSetUpAnimationNode = true
|
self.didSetUpAnimationNode = true
|
||||||
var telegramFile: TelegramMediaFile?
|
var telegramFile: TelegramMediaFile?
|
||||||
for media in item.message.media {
|
for media in item.message.media {
|
||||||
@ -168,9 +168,17 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let telegramFile = telegramFile {
|
if let telegramFile = telegramFile {
|
||||||
self.animationNode.setup(account: item.context.account, resource: telegramFile.resource, width: 384, height: 384, mode: .cached)
|
var playbackMode: AnimatedStickerPlaybackMode = .loop
|
||||||
|
if !item.controllerInteraction.stickerSettings.loopAnimatedStickers {
|
||||||
|
playbackMode = .once
|
||||||
|
}
|
||||||
|
self.animationNode.setup(account: item.context.account, resource: telegramFile.resource, width: 384, height: 384, playbackMode: playbackMode, mode: .cached)
|
||||||
} else if let emojiResource = self.emojiResource {
|
} else if let emojiResource = self.emojiResource {
|
||||||
self.animationNode.setup(account: item.context.account, resource: emojiResource, width: 384, height: 384, mode: .cached)
|
var playbackMode: AnimatedStickerPlaybackMode = .loop
|
||||||
|
if item.context.sharedContext.immediateExperimentalUISettings.playAnimatedEmojiOnce {
|
||||||
|
playbackMode = .once
|
||||||
|
}
|
||||||
|
self.animationNode.setup(account: item.context.account, resource: emojiResource, width: 384, height: 384, playbackMode: playbackMode, mode: .cached)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import UIKit
|
import UIKit
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
|
import SwiftSignalKit
|
||||||
import Display
|
import Display
|
||||||
import Postbox
|
import Postbox
|
||||||
import TelegramCore
|
import TelegramCore
|
||||||
@ -44,7 +45,6 @@ private final class ActionSheetItemNode: ASDisplayNode {
|
|||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
self.addSubnode(self.separatorNode)
|
|
||||||
self.addSubnode(self.highlightedBackgroundNode)
|
self.addSubnode(self.highlightedBackgroundNode)
|
||||||
self.addSubnode(self.titleNode)
|
self.addSubnode(self.titleNode)
|
||||||
self.addSubnode(self.iconNode)
|
self.addSubnode(self.iconNode)
|
||||||
@ -389,6 +389,15 @@ final class ChatSendMessageActionSheetControllerNode: ViewControllerTracingNode,
|
|||||||
completedEffect = true
|
completedEffect = true
|
||||||
intermediateCompletion()
|
intermediateCompletion()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Queue.mainQueue().after(0.7) {
|
||||||
|
completedAlpha = true
|
||||||
|
completedButton = true
|
||||||
|
completedBubble = true
|
||||||
|
completedEffect = true
|
||||||
|
intermediateCompletion()
|
||||||
|
}
|
||||||
|
|
||||||
self.dimNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false)
|
self.dimNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false)
|
||||||
self.contentContainerNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { _ in })
|
self.contentContainerNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { _ in })
|
||||||
|
|
||||||
|
@ -3,5 +3,4 @@ import Foundation
|
|||||||
public struct GlobalExperimentalSettings {
|
public struct GlobalExperimentalSettings {
|
||||||
public static var isAppStoreBuild: Bool = false
|
public static var isAppStoreBuild: Bool = false
|
||||||
public static var enableFeed: Bool = false
|
public static var enableFeed: Bool = false
|
||||||
public static var animatedStickers: Bool = false
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user