Skip to content

Commit

Permalink
- bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
overtake committed Jul 3, 2024
1 parent 32a454c commit 513d4f2
Show file tree
Hide file tree
Showing 19 changed files with 84 additions and 46 deletions.
6 changes: 4 additions & 2 deletions Telegram-Mac/ChatInputActionsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ class ChatInputActionsView: View {
}, for: .LongMouseDown)


muteChannelMessages.set(handler: { [weak self] _ in
muteChannelMessages.set(handler: { [weak self] control in
if let chatInteraction = self?.chatInteraction {
FastSettings.toggleChannelMessagesMuted(chatInteraction.peerId)
(self?.superview?.superview as? View)?.updateLocalizationAndTheme(theme: theme)
let isMuted = FastSettings.isChannelMessagesMuted(chatInteraction.peerId)
(self?.superview?.superview as? ChatInputView)?.updatePlaceholder()
tooltip(for: control, text: isMuted ? strings().messagesSilentTooltipSilent : strings().messagesSilentTooltip)
}
}, for: .Click)

Expand Down
4 changes: 4 additions & 0 deletions Telegram-Mac/ChatInputView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,10 @@ class ChatInputView: View, Notifable {
self.textView.placeholder = textPlaceholder
}

func updatePlaceholder() {
self.textView.placeholder = textPlaceholder
}

private func updateAccesory(animated: Bool) {
self.accessory.measureSize(self.frame.width - 40.0)
self.inputDidUpdateLayout(animated: animated)
Expand Down
2 changes: 1 addition & 1 deletion Telegram-Mac/ChatServiceItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2423,7 +2423,7 @@ class ChatServiceRowView: TableRowView {
if textLayout.isBigEmoji {
rect = item.rect
} else {
rect = item.rect.insetBy(dx: -2, dy: -2)
rect = item.rect
}
if let item = self.item as? ChatServiceItem, item.isBubbled {
rect = rect.offsetBy(dx: 9, dy: 2)
Expand Down
2 changes: 1 addition & 1 deletion Telegram-Mac/CoreExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4083,7 +4083,7 @@ func concatMessageAttributes(_ attributes: [MessageTextEntity]) -> [MessageTextE

extension TelegramMediaImage {
convenience init(dimension: PixelDimensions, immediateThumbnailData: Data?) {
self.init(imageId: .init(namespace: 0, id: 0), representations: [.init(dimensions: dimension, resource: CloudFileMediaResource(datacenterId: 0, volumeId: 0, localId: 0, secret: 0, size: nil, fileReference: nil), progressiveSizes: [], immediateThumbnailData: immediateThumbnailData)], immediateThumbnailData: immediateThumbnailData, reference: nil, partialReference: nil, flags: [])
self.init(imageId: .init(namespace: 0, id: 0), representations: [.init(dimensions: dimension, resource: LocalBundleResource(name: "", ext: ""), progressiveSizes: [], immediateThumbnailData: immediateThumbnailData)], immediateThumbnailData: immediateThumbnailData, reference: nil, partialReference: nil, flags: [])

}
}
12 changes: 6 additions & 6 deletions Telegram-Mac/DataAndStorageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -459,12 +459,12 @@ private func entries(state: State, data: DataAndStorageData, proxy: ProxySetting
entries.append(.autoplayVideos(sectionId, autoplayMedia.videos, viewType: .lastItem))


#if DEBUG
entries.append(.sectionId(sectionId))
sectionId += 1
entries.append(.sensitiveContent(sectionId, false, viewType: .singleItem))
entries.append(.sensitiveContentInfo(sectionId, viewType: .textBottomItem))
#endif
// #if DEBUG
// entries.append(.sectionId(sectionId))
// sectionId += 1
// entries.append(.sensitiveContent(sectionId, false, viewType: .singleItem))
// entries.append(.sensitiveContentInfo(sectionId, viewType: .textBottomItem))
// #endif

entries.append(.sectionId(sectionId))
sectionId += 1
Expand Down
12 changes: 8 additions & 4 deletions Telegram-Mac/GalleryThumbsControlView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ class GalleryThumbContainer : Control {
addSubview(overlay)
overlay.backgroundColor = .black
layer?.cornerRadius = .cornerRadius

handleScrollEventOnInteractionEnabled = false
}

deinit {
Expand Down Expand Up @@ -164,9 +166,11 @@ class GalleryThumbsControlView: View {

documentView.backgroundColor = .clear

self.layer?.cornerRadius = 4


NotificationCenter.default.addObserver(self, selector: #selector(scrollDidUpdated), name: NSView.boundsDidChangeNotification, object: scrollView.contentView)
NotificationCenter.default.addObserver(self, selector: #selector(scrollDidUpdated), name: NSView.frameDidChangeNotification, object: scrollView)
// NotificationCenter.default.addObserver(self, selector: #selector(scrollDidUpdated), name: NSView.boundsDidChangeNotification, object: scrollView.contentView)
//NotificationCenter.default.addObserver(self, selector: #selector(scrollDidUpdated), name: NSView.frameDidChangeNotification, object: scrollView)

}

Expand Down Expand Up @@ -200,7 +204,6 @@ class GalleryThumbsControlView: View {

previousRange = range

documentView.subviews = range.location == NSNotFound ? [] : items.subarray(with: range).map { $0.view }
}

override func layout() {
Expand Down Expand Up @@ -312,7 +315,8 @@ class GalleryThumbsControlView: View {
scrollView.clipView.scroll(to: NSMakePoint(min(max(items[selectedIndex].frame.midX - frame.width / 2, 0), max(documentView.frame.width - frame.width, 0)), 0), animated: animated && documentView.subviews.count > 0)
}
previousRange = nil
scrollDidUpdated()
documentView.subviews = items.map { $0.view }

}

}
2 changes: 1 addition & 1 deletion Telegram-Mac/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>265406</string>
<string>265458</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>
Expand Down
2 changes: 1 addition & 1 deletion Telegram-Mac/StoryControlsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ final class StoryControlsView : Control {
avatarAndText.scaleOnClick = true

avatarAndText.set(handler: { [weak self] control in
if let groupId = self?.groupId {
if let groupId = self?.story?.peer?.id {
self?.arguments?.openPeerInfo(groupId, control)
}
}, for: .Click)
Expand Down
2 changes: 1 addition & 1 deletion Telegram-Mac/StoryListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ final class StoryListView : Control, Notifable {
if textLayout.isBigEmoji {
rect = item.rect
} else {
rect = item.rect.insetBy(dx: -2, dy: -2)
rect = item.rect
}

let view: InlineStickerItemLayer
Expand Down
1 change: 1 addition & 0 deletions Telegram-Mac/StoryModalController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2305,6 +2305,7 @@ final class StoryModalController : ModalViewController, Notifable {
PeerInfoController.push(navigation: context.bindings.rootNavigation(), context: context, peerId: peerId)
}
self?.close()
closeAllModals(window: context.window)
}

if let view = view, let event = NSApp.currentEvent {
Expand Down
4 changes: 3 additions & 1 deletion Telegram-Mac/VideoRecorderPipeline.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ class VideoRecorderPipeline : NSObject, AVCaptureVideoDataOutputSampleBufferDele
audioDevices.insert(device, at: 0)
}

let videoDevice = videoDevices.first(where: { $0.isConnected && !$0.isSuspended})
let videoDevice = videoDevices.filter({ $0.isConnected && !$0.isSuspended }).first(where: { $0.position == .front || $0.position == .unspecified })

let audioDevice = audioDevices.first(where: { $0.isConnected && !$0.isSuspended})


Expand All @@ -135,6 +136,7 @@ class VideoRecorderPipeline : NSObject, AVCaptureVideoDataOutputSampleBufferDele
}

videoOutput.alwaysDiscardsLateVideoFrames = false
videoOutput

videoOutput.videoSettings = [kCVPixelBufferPixelFormatTypeKey as String: kCVPixelFormatType_32BGRA, kCVPixelBufferIOSurfacePropertiesKey as String: [:], kCVPixelBufferWidthKey as String: 500, kCVPixelBufferHeightKey as String: 500]

Expand Down
2 changes: 1 addition & 1 deletion Telegram-Mac/WPContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ class WPContentView: Control, MultipleSelectable, ModalPreviewRowViewProtocol {
if textLayout.isBigEmoji {
rect = item.rect
} else {
rect = item.rect.insetBy(dx: -2, dy: -2)
rect = item.rect
}

let view: InlineStickerItemLayer
Expand Down
2 changes: 1 addition & 1 deletion Telegram-Mac/WebpageModalController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1682,7 +1682,7 @@ class WebpageModalController: ModalViewController, WKNavigationDelegate, WKUIDel

if self?.isBackButton == true {
items.append(.init(strings().webAppClose, handler: { [weak self] in
self?.closeAnyway()
self?.close()
}, itemImage: MenuAnimation.menu_clear_history.value))
}

Expand Down
Binary file modified Telegram-Mac/en.lproj/Localizable.strings
Binary file not shown.
2 changes: 1 addition & 1 deletion TelegramShare/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>265406</string>
<string>265458</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSMinimumSystemVersion</key>
Expand Down
4 changes: 4 additions & 0 deletions packages/Localization/Sources/Localization/Localizable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10471,6 +10471,10 @@ public final class L10n {
public static var messagesReplyLoadingHeader: String { return L10n.tr("Localizable", "Messages.ReplyLoading.Header") }
/// Loading...
public static var messagesReplyLoadingLoading: String { return L10n.tr("Localizable", "Messages.ReplyLoading.Loading") }
/// subscribers will be notified when you post.
public static var messagesSilentTooltip: String { return L10n.tr("Localizable", "Messages.Silent.Tooltip") }
/// subscribers will receive a silent notification.
public static var messagesSilentTooltipSilent: String { return L10n.tr("Localizable", "Messages.Silent.Tooltip.Silent") }
/// Apply
public static var modalApply: String { return L10n.tr("Localizable", "Modal.Apply") }
/// Cancel
Expand Down
67 changes: 44 additions & 23 deletions packages/TGUIKit/Sources/HorizontalTableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,40 @@ public class HorizontalTableView: TableView {

self.clipView.border = []
self.tableView.border = []

}

public override func updateAfterInitialize(isFlipped: Bool = true, bottomInset: CGFloat = 0, drawBorder: Bool = false) {
super.updateAfterInitialize(isFlipped: isFlipped, bottomInset: bottomInset, drawBorder: drawBorder)

self.hasHorizontalScroller = false
self.horizontalScrollElasticity = .none
}

public override func scrollWheel(with event: NSEvent) {



override open func scrollWheel(with event: NSEvent) {

if let applyExternalScroll = self.applyExternalScroll, applyExternalScroll(event) {
return
}

var scrollPoint = contentView.bounds.origin
let isInverted: Bool = System.isScrollInverted

if event.scrollingDeltaY != 0 {
if isInverted {
scrollPoint.y += -event.scrollingDeltaY
} else {
scrollPoint.y -= event.scrollingDeltaY
}
scrollPoint.y = max(0, min(scrollPoint.y, listHeight - clipView.bounds.height))
clipView.scroll(to: scrollPoint)
window?.scrollWheel(with: event)
return
}

if event.scrollingDeltaX != 0 {
if !isInverted {
scrollPoint.y += -event.scrollingDeltaX
} else {
scrollPoint.y -= event.scrollingDeltaX
}
if event.scrollingDeltaY != 0 || event.scrollingDeltaX != 0 {
super.scrollWheel(with: event)
}

scrollPoint.y = max(0, min(scrollPoint.y, listHeight - clipView.bounds.height))
clipView.scroll(to: scrollPoint)


}

Expand Down Expand Up @@ -99,6 +107,20 @@ public class HorizontalTableView: TableView {


open class HorizontalScrollView : ScrollView {



public override init(frame frameRect: NSRect) {
super.init(frame: frameRect)
self.hasVerticalScroller = false
self.verticalScrollElasticity = .none
}

required public init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}


override open func scrollWheel(with event: NSEvent) {

if let applyExternalScroll = self.applyExternalScroll, applyExternalScroll(event) {
Expand All @@ -113,17 +135,16 @@ open class HorizontalScrollView : ScrollView {
} else {
scrollPoint.x -= event.scrollingDeltaY
}
}
if event.scrollingDeltaX != 0 {
if !isInverted {
scrollPoint.x += -event.scrollingDeltaX
} else {
scrollPoint.x -= event.scrollingDeltaX
}
}
if documentView!.frame.width > frame.width {
scrollPoint.x = min(max(0, floorToScreenPixels(backingScaleFactor, scrollPoint.x)), documentView!.frame.width - frame.width)
clipView.scroll(to: scrollPoint)
window?.scrollWheel(with: event)
return
}

if documentView!.frame.width > frame.width {
if event.scrollingDeltaY != 0 || event.scrollingDeltaX != 0 {
super.scrollWheel(with: event)
}
} else {
superview?.scrollWheel(with: event)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ + (NSDictionary *)videoSettingsForPreset:(TGMediaVideoConversionPreset)preset di

return @
{
AVVideoCodecKey: AVVideoCodecH264,
AVVideoCodecKey: AVVideoCodecTypeH264,
AVVideoCompressionPropertiesKey: codecSettings,
AVVideoWidthKey: @((NSInteger)dimensions.width),
AVVideoHeightKey: @((NSInteger)dimensions.height)
Expand Down
2 changes: 1 addition & 1 deletion packages/TelegramMedia/Sources/LottiePlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ final class RenderAtomic<T> {
}


public let lottieThreadPool: ThreadPool = ThreadPool(threadCount: 1, threadPriority: 1.0)
public let lottieThreadPool: ThreadPool = ThreadPool(threadCount: 2, threadPriority: 1.0)
public let lottieStateQueue = Queue(name: "lottieStateQueue", qos: .utility)


Expand Down

0 comments on commit 513d4f2

Please sign in to comment.