mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various Improvements
This commit is contained in:
parent
c7bb82623f
commit
7350bf11d1
@ -7071,6 +7071,8 @@ Sorry for the inconvenience.";
|
|||||||
"Group.Setup.ForwardingDisabled" = "Restrict Forwarding";
|
"Group.Setup.ForwardingDisabled" = "Restrict Forwarding";
|
||||||
"Group.Setup.ForwardingGroupInfo" = "Participants can forward messages from this group and save media files.";
|
"Group.Setup.ForwardingGroupInfo" = "Participants can forward messages from this group and save media files.";
|
||||||
"Group.Setup.ForwardingChannelInfo" = "Participants can forward messages from this channel and save media files.";
|
"Group.Setup.ForwardingChannelInfo" = "Participants can forward messages from this channel and save media files.";
|
||||||
|
"Group.Setup.ForwardingGroupInfoDisabled" = "Participants can't forward messages from this group and save media files.";
|
||||||
|
"Group.Setup.ForwardingChannelInfoDisabled" = "Participants can't forward messages from this channel and save media files.";
|
||||||
|
|
||||||
"AuthSessions.TerminateIfAwayTitle" = "Automatically Terminate Old Sessions";
|
"AuthSessions.TerminateIfAwayTitle" = "Automatically Terminate Old Sessions";
|
||||||
"AuthSessions.TerminateIfAwayFor" = "If Inactive For";
|
"AuthSessions.TerminateIfAwayFor" = "If Inactive For";
|
||||||
|
@ -712,7 +712,7 @@ private func channelVisibilityControllerEntries(presentationData: PresentationDa
|
|||||||
entries.append(.forwardingHeader(presentationData.theme, isGroup ? presentationData.strings.Group_Setup_ForwardingGroupTitle.uppercased() : presentationData.strings.Group_Setup_ForwardingChannelTitle.uppercased()))
|
entries.append(.forwardingHeader(presentationData.theme, isGroup ? presentationData.strings.Group_Setup_ForwardingGroupTitle.uppercased() : presentationData.strings.Group_Setup_ForwardingChannelTitle.uppercased()))
|
||||||
entries.append(.forwardingEnabled(presentationData.theme, presentationData.strings.Group_Setup_ForwardingEnabled, forwardingEnabled))
|
entries.append(.forwardingEnabled(presentationData.theme, presentationData.strings.Group_Setup_ForwardingEnabled, forwardingEnabled))
|
||||||
entries.append(.forwardingDisabled(presentationData.theme, presentationData.strings.Group_Setup_ForwardingDisabled, !forwardingEnabled))
|
entries.append(.forwardingDisabled(presentationData.theme, presentationData.strings.Group_Setup_ForwardingDisabled, !forwardingEnabled))
|
||||||
entries.append(.forwardingInfo(presentationData.theme, isGroup ? presentationData.strings.Group_Setup_ForwardingGroupInfo : presentationData.strings.Group_Setup_ForwardingChannelInfo))
|
entries.append(.forwardingInfo(presentationData.theme, forwardingEnabled ? (isGroup ? presentationData.strings.Group_Setup_ForwardingGroupInfo : presentationData.strings.Group_Setup_ForwardingChannelInfo) : (isGroup ? presentationData.strings.Group_Setup_ForwardingGroupInfoDisabled : presentationData.strings.Group_Setup_ForwardingChannelInfoDisabled)))
|
||||||
|
|
||||||
} else if let peer = view.peers[view.peerId] as? TelegramGroup {
|
} else if let peer = view.peers[view.peerId] as? TelegramGroup {
|
||||||
switch mode {
|
switch mode {
|
||||||
@ -844,7 +844,7 @@ private func channelVisibilityControllerEntries(presentationData: PresentationDa
|
|||||||
entries.append(.forwardingHeader(presentationData.theme, presentationData.strings.Group_Setup_ForwardingGroupTitle.uppercased()))
|
entries.append(.forwardingHeader(presentationData.theme, presentationData.strings.Group_Setup_ForwardingGroupTitle.uppercased()))
|
||||||
entries.append(.forwardingEnabled(presentationData.theme, presentationData.strings.Group_Setup_ForwardingEnabled, forwardingEnabled))
|
entries.append(.forwardingEnabled(presentationData.theme, presentationData.strings.Group_Setup_ForwardingEnabled, forwardingEnabled))
|
||||||
entries.append(.forwardingDisabled(presentationData.theme, presentationData.strings.Group_Setup_ForwardingDisabled, !forwardingEnabled))
|
entries.append(.forwardingDisabled(presentationData.theme, presentationData.strings.Group_Setup_ForwardingDisabled, !forwardingEnabled))
|
||||||
entries.append(.forwardingInfo(presentationData.theme, presentationData.strings.Group_Setup_ForwardingGroupInfo))
|
entries.append(.forwardingInfo(presentationData.theme, forwardingEnabled ? presentationData.strings.Group_Setup_ForwardingGroupInfo : presentationData.strings.Group_Setup_ForwardingGroupInfoDisabled))
|
||||||
}
|
}
|
||||||
|
|
||||||
return entries
|
return entries
|
||||||
|
@ -4806,7 +4806,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
|
|
||||||
let currentAccountPeer = self.context.account.postbox.loadedPeerWithId(self.context.account.peerId)
|
let currentAccountPeer = self.context.account.postbox.loadedPeerWithId(self.context.account.peerId)
|
||||||
|> map { peer in
|
|> map { peer in
|
||||||
return [FoundPeer(peer: peer, subscribers: nil)]
|
return FoundPeer(peer: peer, subscribers: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.sendAsPeersDisposable = (combineLatest(queue: Queue.mainQueue(), currentAccountPeer, self.context.account.postbox.peerView(id: self.chatLocation.peerId), self.context.engine.peers.sendAsAvailablePeers(peerId: self.chatLocation.peerId)))
|
self.sendAsPeersDisposable = (combineLatest(queue: Queue.mainQueue(), currentAccountPeer, self.context.account.postbox.peerView(id: self.chatLocation.peerId), self.context.engine.peers.sendAsAvailablePeers(peerId: self.chatLocation.peerId)))
|
||||||
@ -4817,11 +4817,22 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
var allPeers: [FoundPeer]?
|
var allPeers: [FoundPeer]?
|
||||||
if !peers.isEmpty {
|
if !peers.isEmpty {
|
||||||
if let channel = peerViewMainPeer(peerView) as? TelegramChannel, case .group = channel.info, channel.hasPermission(.canBeAnonymous) {
|
if let channel = peerViewMainPeer(peerView) as? TelegramChannel, case .group = channel.info, channel.hasPermission(.canBeAnonymous) {
|
||||||
allPeers = []
|
allPeers = peers
|
||||||
|
|
||||||
|
var hasAnonymousPeer = false
|
||||||
|
for peer in peers {
|
||||||
|
if peer.peer.id == channel.id {
|
||||||
|
hasAnonymousPeer = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !hasAnonymousPeer {
|
||||||
|
allPeers?.insert(FoundPeer(peer: channel, subscribers: nil), at: 0)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
allPeers = currentAccountPeer
|
allPeers = peers.filter { $0.peer.id != peerViewMainPeer(peerView)?.id }
|
||||||
|
allPeers?.insert(currentAccountPeer, at: 0)
|
||||||
}
|
}
|
||||||
allPeers?.append(contentsOf: peers)
|
|
||||||
}
|
}
|
||||||
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: false, {
|
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: false, {
|
||||||
return $0.updatedSendAsPeers(allPeers)
|
return $0.updatedSendAsPeers(allPeers)
|
||||||
|
@ -428,7 +428,7 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}), content: NativeVideoContent(id: .message(item.message.stableId, telegramFile.fileId), fileReference: .message(message: MessageReference(item.message), media: telegramFile), streamVideo: streamVideo ? .conservative : .none, enableSound: false, fetchAutomatically: false), priority: .embedded, autoplay: true)
|
}), content: NativeVideoContent(id: .message(item.message.stableId, telegramFile.fileId), fileReference: .message(message: MessageReference(item.message), media: telegramFile), streamVideo: streamVideo ? .conservative : .none, enableSound: false, fetchAutomatically: false, captureProtected: item.message.isCopyProtected()), priority: .embedded, autoplay: true)
|
||||||
let previousVideoNode = strongSelf.videoNode
|
let previousVideoNode = strongSelf.videoNode
|
||||||
strongSelf.videoNode = videoNode
|
strongSelf.videoNode = videoNode
|
||||||
strongSelf.insertSubnode(videoNode, belowSubnode: previousVideoNode ?? strongSelf.dateAndStatusNode)
|
strongSelf.insertSubnode(videoNode, belowSubnode: previousVideoNode ?? strongSelf.dateAndStatusNode)
|
||||||
|
@ -892,7 +892,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio
|
|||||||
|
|
||||||
let streamVideo = isMediaStreamable(message: message, media: updatedVideoFile)
|
let streamVideo = isMediaStreamable(message: message, media: updatedVideoFile)
|
||||||
let loopVideo = updatedVideoFile.isAnimated
|
let loopVideo = updatedVideoFile.isAnimated
|
||||||
let videoContent = NativeVideoContent(id: .message(message.stableId, updatedVideoFile.fileId), fileReference: .message(message: MessageReference(message), media: updatedVideoFile), streamVideo: streamVideo ? .conservative : .none, loopVideo: loopVideo, enableSound: false, fetchAutomatically: false, onlyFullSizeThumbnail: (onlyFullSizeVideoThumbnail ?? false), continuePlayingWithoutSoundOnLostAudioSession: isInlinePlayableVideo, placeholderColor: emptyColor)
|
let videoContent = NativeVideoContent(id: .message(message.stableId, updatedVideoFile.fileId), fileReference: .message(message: MessageReference(message), media: updatedVideoFile), streamVideo: streamVideo ? .conservative : .none, loopVideo: loopVideo, enableSound: false, fetchAutomatically: false, onlyFullSizeThumbnail: (onlyFullSizeVideoThumbnail ?? false), continuePlayingWithoutSoundOnLostAudioSession: isInlinePlayableVideo, placeholderColor: emptyColor, captureProtected: message.isCopyProtected())
|
||||||
let videoNode = UniversalVideoNode(postbox: context.account.postbox, audioSession: mediaManager.audioSession, manager: mediaManager.universalVideoManager, decoration: decoration, content: videoContent, priority: .embedded)
|
let videoNode = UniversalVideoNode(postbox: context.account.postbox, audioSession: mediaManager.audioSession, manager: mediaManager.universalVideoManager, decoration: decoration, content: videoContent, priority: .embedded)
|
||||||
videoNode.isUserInteractionEnabled = false
|
videoNode.isUserInteractionEnabled = false
|
||||||
videoNode.ownsContentNodeUpdated = { [weak self] owns in
|
videoNode.ownsContentNodeUpdated = { [weak self] owns in
|
||||||
@ -1567,8 +1567,20 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio
|
|||||||
statusNode.isHidden = true
|
statusNode.isHidden = true
|
||||||
}
|
}
|
||||||
|
|
||||||
let view = self?.view.snapshotContentTree(unhide: true)
|
let view: UIView?
|
||||||
|
if let strongSelf = self, strongSelf.imageNode.captureProtected {
|
||||||
|
let imageView = UIImageView()
|
||||||
|
imageView.contentMode = .scaleToFill
|
||||||
|
imageView.image = strongSelf.imageNode.image
|
||||||
|
imageView.frame = strongSelf.imageNode.frame
|
||||||
|
strongSelf.imageNode.view.superview?.insertSubview(imageView, aboveSubview: strongSelf.imageNode.view)
|
||||||
|
|
||||||
|
view = self?.view.snapshotContentTree(unhide: true)
|
||||||
|
imageView.removeFromSuperview()
|
||||||
|
} else {
|
||||||
|
view = self?.view.snapshotContentTree(unhide: true)
|
||||||
|
}
|
||||||
|
|
||||||
if let badgeNode = self?.badgeNode, let badgeNodeHidden = badgeNodeHidden {
|
if let badgeNode = self?.badgeNode, let badgeNodeHidden = badgeNodeHidden {
|
||||||
badgeNode.isHidden = badgeNodeHidden
|
badgeNode.isHidden = badgeNodeHidden
|
||||||
}
|
}
|
||||||
|
@ -437,7 +437,7 @@ final class PeerInfoAvatarTransformContainerNode: ASDisplayNode {
|
|||||||
|
|
||||||
if let video = videoRepresentations.last, let peerReference = PeerReference(peer) {
|
if let video = videoRepresentations.last, let peerReference = PeerReference(peer) {
|
||||||
let videoFileReference = FileMediaReference.avatarList(peer: peerReference, media: TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: 0), partialReference: nil, resource: video.representation.resource, previewRepresentations: representations.map { $0.representation }, videoThumbnails: [], immediateThumbnailData: immediateThumbnailData, mimeType: "video/mp4", size: nil, attributes: [.Animated, .Video(duration: 0, size: video.representation.dimensions, flags: [])]))
|
let videoFileReference = FileMediaReference.avatarList(peer: peerReference, media: TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: 0), partialReference: nil, resource: video.representation.resource, previewRepresentations: representations.map { $0.representation }, videoThumbnails: [], immediateThumbnailData: immediateThumbnailData, mimeType: "video/mp4", size: nil, attributes: [.Animated, .Video(duration: 0, size: video.representation.dimensions, flags: [])]))
|
||||||
let videoContent = NativeVideoContent(id: .profileVideo(id, nil), fileReference: videoFileReference, streamVideo: isMediaStreamable(resource: video.representation.resource) ? .conservative : .none, loopVideo: true, enableSound: false, fetchAutomatically: true, onlyFullSizeThumbnail: false, useLargeThumbnail: true, autoFetchFullSizeThumbnail: true, startTimestamp: video.representation.startTimestamp, continuePlayingWithoutSoundOnLostAudioSession: false, placeholderColor: .clear)
|
let videoContent = NativeVideoContent(id: .profileVideo(id, nil), fileReference: videoFileReference, streamVideo: isMediaStreamable(resource: video.representation.resource) ? .conservative : .none, loopVideo: true, enableSound: false, fetchAutomatically: true, onlyFullSizeThumbnail: false, useLargeThumbnail: true, autoFetchFullSizeThumbnail: true, startTimestamp: video.representation.startTimestamp, continuePlayingWithoutSoundOnLostAudioSession: false, placeholderColor: .clear, captureProtected: peer.isCopyProtectionEnabled)
|
||||||
if videoContent.id != self.videoContent?.id {
|
if videoContent.id != self.videoContent?.id {
|
||||||
self.videoNode?.removeFromSupernode()
|
self.videoNode?.removeFromSupernode()
|
||||||
|
|
||||||
@ -730,7 +730,7 @@ final class PeerInfoEditingAvatarNode: ASDisplayNode {
|
|||||||
|
|
||||||
if let video = videoRepresentations.last, let peerReference = PeerReference(peer) {
|
if let video = videoRepresentations.last, let peerReference = PeerReference(peer) {
|
||||||
let videoFileReference = FileMediaReference.avatarList(peer: peerReference, media: TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: 0), partialReference: nil, resource: video.representation.resource, previewRepresentations: representations.map { $0.representation }, videoThumbnails: [], immediateThumbnailData: immediateThumbnailData, mimeType: "video/mp4", size: nil, attributes: [.Animated, .Video(duration: 0, size: video.representation.dimensions, flags: [])]))
|
let videoFileReference = FileMediaReference.avatarList(peer: peerReference, media: TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: 0), partialReference: nil, resource: video.representation.resource, previewRepresentations: representations.map { $0.representation }, videoThumbnails: [], immediateThumbnailData: immediateThumbnailData, mimeType: "video/mp4", size: nil, attributes: [.Animated, .Video(duration: 0, size: video.representation.dimensions, flags: [])]))
|
||||||
let videoContent = NativeVideoContent(id: .profileVideo(id, nil), fileReference: videoFileReference, streamVideo: isMediaStreamable(resource: video.representation.resource) ? .conservative : .none, loopVideo: true, enableSound: false, fetchAutomatically: true, onlyFullSizeThumbnail: false, useLargeThumbnail: true, autoFetchFullSizeThumbnail: true, startTimestamp: video.representation.startTimestamp, continuePlayingWithoutSoundOnLostAudioSession: false, placeholderColor: .clear)
|
let videoContent = NativeVideoContent(id: .profileVideo(id, nil), fileReference: videoFileReference, streamVideo: isMediaStreamable(resource: video.representation.resource) ? .conservative : .none, loopVideo: true, enableSound: false, fetchAutomatically: true, onlyFullSizeThumbnail: false, useLargeThumbnail: true, autoFetchFullSizeThumbnail: true, startTimestamp: video.representation.startTimestamp, continuePlayingWithoutSoundOnLostAudioSession: false, placeholderColor: .clear, captureProtected: peer.isCopyProtectionEnabled)
|
||||||
if videoContent.id != self.videoContent?.id {
|
if videoContent.id != self.videoContent?.id {
|
||||||
self.videoNode?.removeFromSupernode()
|
self.videoNode?.removeFromSupernode()
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ final class SharedMediaPlayer {
|
|||||||
if let mediaManager = strongSelf.mediaManager, let item = item as? MessageMediaPlaylistItem {
|
if let mediaManager = strongSelf.mediaManager, let item = item as? MessageMediaPlaylistItem {
|
||||||
switch playbackData.source {
|
switch playbackData.source {
|
||||||
case let .telegramFile(fileReference, _):
|
case let .telegramFile(fileReference, _):
|
||||||
let videoNode = OverlayInstantVideoNode(postbox: strongSelf.account.postbox, audioSession: strongSelf.audioSession, manager: mediaManager.universalVideoManager, content: NativeVideoContent(id: .message(item.message.stableId, fileReference.media.fileId), fileReference: fileReference, enableSound: false, baseRate: rateValue), close: { [weak mediaManager] in
|
let videoNode = OverlayInstantVideoNode(postbox: strongSelf.account.postbox, audioSession: strongSelf.audioSession, manager: mediaManager.universalVideoManager, content: NativeVideoContent(id: .message(item.message.stableId, fileReference.media.fileId), fileReference: fileReference, enableSound: false, baseRate: rateValue, captureProtected: item.message.isCopyProtected()), close: { [weak mediaManager] in
|
||||||
mediaManager?.setPlaylist(nil, type: .voice, control: .playback(.pause))
|
mediaManager?.setPlaylist(nil, type: .voice, control: .playback(.pause))
|
||||||
})
|
})
|
||||||
strongSelf.playbackItem = .instantVideo(videoNode)
|
strongSelf.playbackItem = .instantVideo(videoNode)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user