Skip to content

Commit

Permalink
new way to react
Browse files Browse the repository at this point in the history
  • Loading branch information
overtake committed Jan 14, 2022
1 parent d115da8 commit e056960
Show file tree
Hide file tree
Showing 102 changed files with 185 additions and 2,300 deletions.
8 changes: 6 additions & 2 deletions Telegram-Mac/ChatLayoutUtils.swift
Expand Up @@ -44,7 +44,9 @@ class ChatLayoutUtils: NSObject {
return NSMakeSize(width, 40)
}
}
if file.isAnimatedSticker && !webpIsFile {
if file.isWebm {
size = NSMakeSize(240, 240)
} else if file.isAnimatedSticker && !webpIsFile {
let dimensions = file.dimensions?.size
size = NSMakeSize(240, 240)
if file.isEmojiAnimatedSticker {
Expand Down Expand Up @@ -122,7 +124,9 @@ class ChatLayoutUtils: NSObject {
if media is TelegramMediaImage {
return ChatInteractiveContentView.self
} else if let file = media as? TelegramMediaFile {
if file.mimeType == "image/webp" && !packs && !webpIsFile {
if file.isWebm {
return ChatGIFContentView.self
} else if file.mimeType == "image/webp" && !packs && !webpIsFile {
return MediaAnimatedStickerView.self
} else if file.isStaticSticker && !webpIsFile {
return ChatStickerContentView.self
Expand Down
5 changes: 0 additions & 5 deletions Telegram-Mac/ChatReactionsView.swift
Expand Up @@ -14,7 +14,6 @@ import MergeLists
import Reactions
import AppKit
import SwiftSignalKit
import CAPortal

final class ChatReactionsLayout {

Expand Down Expand Up @@ -740,10 +739,6 @@ final class ChatReactionsView : View {

transition.updateFrame(view: self.imageView, frame: CGRect(origin: NSMakePoint(presentation.insetOuter, (size.height - presentation.reactionSize.height) / 2), size: presentation.reactionSize))

if let effetView = effetView {
let viewSize = NSMakeSize(presentation.reactionSize.width * 2, presentation.reactionSize.height * 2)
// transition.updateFrame(view: effetView, frame: CGRect(origin: NSMakePoint(presentation.insetOuter, (size.height - viewSize.height) / 2), size: viewSize))
}

if let textView = textView, let text = reaction.text {
let center = focus(text.size)
Expand Down
7 changes: 6 additions & 1 deletion Telegram-Mac/ChatRowItem.swift
Expand Up @@ -983,6 +983,9 @@ class ChatRowItem: TableRowItem {
if file.isStaticSticker {
return false
}
if file.isWebm {
return false
}
if file.isAnimatedSticker {
return false
}
Expand Down Expand Up @@ -2025,7 +2028,9 @@ class ChatRowItem: TableRowItem {
return ChatServiceItem(initialSize, interaction, interaction.context, entry, downloadSettings, theme: theme)
}
} else if let file = message.media[0] as? TelegramMediaFile {
if file.isInstantVideo {
if file.isWebm {
return ChatGIFMediaItem(initialSize, interaction, interaction.context,entry, downloadSettings, theme: theme)
} else if file.isInstantVideo {
return ChatVideoMessageItem(initialSize, interaction, interaction.context,entry, downloadSettings, theme: theme)
} else if file.isVideo && !file.isAnimated {
return ChatMediaItem(initialSize, interaction, interaction.context, entry, downloadSettings, theme: theme)
Expand Down
8 changes: 8 additions & 0 deletions Telegram-Mac/CoreExtension.swift
Expand Up @@ -1173,6 +1173,14 @@ extension Media {
}
return false
}

var isWebm: Bool {
if let media = self as? TelegramMediaFile {
return media.mimeType == "video/webm"
}
return false
}

var isVideoFile:Bool {
if let media = self as? TelegramMediaFile {
return media.mimeType.hasPrefix("video/mp4") || media.mimeType.hasPrefix("video/mov") || media.mimeType.hasPrefix("video/avi")
Expand Down
2 changes: 1 addition & 1 deletion Telegram-Mac/Info.plist
Expand Up @@ -35,7 +35,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>226398</string>
<string>226421</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.social-networking</string>
<key>LSFileQuarantineEnabled</key>
Expand Down
2 changes: 1 addition & 1 deletion Telegram-Mac/MediaPlayerFramePreview.swift
Expand Up @@ -78,7 +78,7 @@ private final class MediaPlayerFramePreviewImpl {
strongSelf.framePipe.putNext(.waitingForData)
case let .image(image):
if let image = image {
strongSelf.framePipe.putNext(.image(image))
strongSelf.framePipe.putNext(.image(image._cgImage!))
}
strongSelf.currentFrameTimestamp = nil
if let nextFrameTimestamp = strongSelf.nextFrameTimestamp {
Expand Down
2 changes: 1 addition & 1 deletion Telegram-Mac/SoftwareVideoLayerFrameManager.swift
Expand Up @@ -97,7 +97,7 @@ final class SoftwareVideoLayerFrameManager {

self.dataDisposable.set((firstReady |> deliverOn(applyQueue)).start(next: { [weak self] path in
if let strongSelf = self {
let _ = strongSelf.source.swap(SoftwareVideoSource(path: path))
let _ = strongSelf.source.swap(SoftwareVideoSource(path: path, hintVP9: true))
}
}))
}
Expand Down
265 changes: 0 additions & 265 deletions Telegram-Mac/SoftwareVideoSource.swift

This file was deleted.

0 comments on commit e056960

Please sign in to comment.