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
2 parents c550b2c + 513d4f2 commit 3a1ce35
Show file tree
Hide file tree
Showing 23 changed files with 99 additions and 55 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/ChatListRowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ private final class TopicNameAndTextView : View {


var rect: NSRect
rect = item.rect.insetBy(dx: -2, dy: -2)
rect = item.rect.insetBy(dx: 1, dy: 1)

if textLayout.hasBlock {
rect = rect.offsetBy(dx: 6, dy: 1)
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
6 changes: 5 additions & 1 deletion Telegram-Mac/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1849,7 +1849,11 @@ func copyToClipboard(_ input: ChatTextInputState) -> Void {

extension LAPolicy {
static var applicationPolicy: LAPolicy {
return .deviceOwnerAuthentication
if #available(macOS 10.15, *) {
return .deviceOwnerAuthenticationWithBiometricsOrWatch
} else {
return .deviceOwnerAuthentication
}
}
}

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>265501</string>
<string>265458</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>
Expand Down
8 changes: 5 additions & 3 deletions Telegram-Mac/PasscodeLockController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private class TouchIdContainerView : View {
button.autohighlight = false
button.style = ControlStyle(font: .medium(.title), foregroundColor: theme.colors.underSelectedColor, backgroundColor: theme.colors.accent, highlightColor: theme.colors.accent)
button.set(font: .medium(.title), for: .Normal)
button.set(color: .white, for: .Normal)
button.set(color: theme.colors.underSelectedColor, for: .Normal)

button.set(text: strings().passcodeUseTouchId, for: .Normal)
button.set(image: theme.icons.passcodeTouchId, for: .Normal)
Expand Down Expand Up @@ -407,18 +407,20 @@ class PasscodeLockController: ModalViewController {
}
}

private var touchIdCalled = false

override func windowDidBecomeKey() {
super.windowDidBecomeKey()

if NSApp.isActive, useTouchId {
if NSApp.isActive, useTouchId, !touchIdCalled {
callTouchId()
touchIdCalled = true
}
}

override func windowDidResignKey() {
super.windowDidResignKey()
if !NSApp.isActive, useTouchId {
invalidateTouchId()
}
}

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.
8 changes: 4 additions & 4 deletions Telegram.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8393,7 +8393,7 @@
"$(PROJECT_DIR)/core-xprojects/webrtc/build/webrtc",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 10.15;
MARKETING_VERSION = 10.15.1;
ONLY_ACTIVE_ARCH = NO;
OTHER_CODE_SIGN_FLAGS = "";
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -8445,7 +8445,7 @@
"$(PROJECT_DIR)/core-xprojects/openssl/build/openssl/lib",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 10.15;
MARKETING_VERSION = 10.15.1;
ONLY_ACTIVE_ARCH = YES;
OTHER_CODE_SIGN_FLAGS = "";
OTHER_LDFLAGS = "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/macosx/libswiftAppKit.dylib";
Expand Down Expand Up @@ -8493,7 +8493,7 @@
"$(PROJECT_DIR)/core-xprojects/openssl/build/openssl/lib",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 10.15;
MARKETING_VERSION = 10.15.1;
ONLY_ACTIVE_ARCH = NO;
OTHER_CODE_SIGN_FLAGS = "";
OTHER_LDFLAGS = "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/macosx/libswiftAppKit.dylib";
Expand Down Expand Up @@ -8612,7 +8612,7 @@
"$(PROJECT_DIR)/core-xprojects/webrtc/build/webrtc",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 10.15;
MARKETING_VERSION = 10.15.1;
ONLY_ACTIVE_ARCH = YES;
OTHER_CODE_SIGN_FLAGS = "";
OTHER_LDFLAGS = (
Expand Down
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>265501</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
Loading

0 comments on commit 3a1ce35

Please sign in to comment.