Skip to content

Commit

Permalink
- bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
overtake committed Jun 30, 2024
1 parent e9b3e89 commit 8b8762d
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 13 deletions.
4 changes: 3 additions & 1 deletion Telegram-Mac/CoreExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3684,7 +3684,9 @@ func coreMessageMainPeer(_ message: Message) -> Peer? {
func showProtectedCopyAlert(_ message: Message, for window: Window) {
if let peer = message.peers[message.id.peerId] {
let text: String
if peer.isGroup || peer.isSupergroup {
if message.paidContent != nil {
text = strings().contextCopyPaidMediaRestricted
} else if peer.isGroup || peer.isSupergroup {
text = strings().copyRestrictedGroup
} else {
text = strings().copyRestrictedChannel
Expand Down
2 changes: 2 additions & 0 deletions Telegram-Mac/EmojiesController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2004,6 +2004,8 @@ final class EmojiesController : TelegramGenericViewController<AnimatedEmojiesVie
super.viewDidLoad()


onStage.set(true)

genericView.presentation = self.presentation
genericView.packsView.delegate = self

Expand Down
4 changes: 2 additions & 2 deletions Telegram-Mac/GalleryViewer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ class GalleryViewer: NSResponder {
self?.showMessage()
}, itemImage: MenuAnimation.menu_show_message.value))
}
if item.entry.message?.isCopyProtected() == true {
if item.entry.isProtected == true {

} else {
menu.addItem(ContextMenuItem(strings().galleryContextCopyToClipboard, handler: { [weak self] in
Expand Down Expand Up @@ -1388,7 +1388,7 @@ class GalleryViewer: NSResponder {
@objc func copy(_ sender:Any? = nil) -> Void {

if let item = self.pager.selectedItem, !self.pager.copySelectedText() {
if let message = item.entry.message, message.isCopyProtected() {
if let message = item.entry.message, item.entry.isProtected {
showProtectedCopyAlert(message, for: self.window)
} else if !(item is MGalleryExternalVideoItem), item.entry.message?.containsSecretMedia != true {
operationDisposable.set((item.path.get() |> take(1) |> deliverOnMainQueue).start(next: { path in
Expand Down
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>265304</string>
<string>265312</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>
Expand Down
8 changes: 6 additions & 2 deletions Telegram-Mac/MGalleryPhotoItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class MGalleryPhotoItem: MGalleryItem {
let result = combineLatest(signal, self.magnify.get() |> distinctUntilChanged) |> mapToSignal { [weak self] data, magnify -> Signal<Data, NoError> in

let (size, orientation) = data
return chatGalleryPhoto(account: context.account, imageReference: entry.imageReference(media), scale: System.backingScale, secureIdAccessContext: secureIdAccessContext, synchronousLoad: true)
return chatGalleryPhoto(account: context.account, imageReference: entry.imageReference(media), scale: System.backingScale, secureIdAccessContext: secureIdAccessContext, synchronousLoad: true, drawChessboard: false)
|> map { [weak self] transform in

var size = NSMakeSize(ceil(size.width * magnify), ceil(size.height * magnify))
Expand Down Expand Up @@ -192,7 +192,11 @@ class MGalleryPhotoItem: MGalleryItem {
}

override var backgroundColor: NSColor {
return theme.colors.transparentBackground
if self.entry.isProtected {
return .clear
} else {
return theme.colors.transparentBackground
}
}

override func fetch() -> Void {
Expand Down
9 changes: 6 additions & 3 deletions Telegram-Mac/MediaUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ private func chatMessageFileDatas(account: Account, fileReference: FileMediaRefe
}


func chatGalleryPhoto(account: Account, imageReference: ImageMediaReference, toRepresentationSize:NSSize = NSMakeSize(1280, 1280), peer: Peer? = nil, scale:CGFloat, secureIdAccessContext: SecureIdAccessContext? = nil, synchronousLoad: Bool = false) -> Signal<(TransformImageArguments) -> CGImage?, NoError> {
func chatGalleryPhoto(account: Account, imageReference: ImageMediaReference, toRepresentationSize:NSSize = NSMakeSize(1280, 1280), peer: Peer? = nil, scale:CGFloat, secureIdAccessContext: SecureIdAccessContext? = nil, synchronousLoad: Bool = false, drawChessboard: Bool = true) -> Signal<(TransformImageArguments) -> CGImage?, NoError> {
let signal = chatMessagePhotoDatas(postbox: account.postbox, imageReference: imageReference, fullRepresentationSize:toRepresentationSize, synchronousLoad: synchronousLoad, secureIdAccessContext: secureIdAccessContext, peer: peer)

return signal |> map { data in
Expand All @@ -496,8 +496,11 @@ func chatGalleryPhoto(account: Account, imageReference: ImageMediaReference, toR
if data.fullSizeData != nil {
if let imageSource = CGImageSourceCreateWithData(fullSizeData as CFData, options), let image = CGImageSourceCreateThumbnailAtIndex(imageSource, 0, options as CFDictionary) {
return generateImage(image.size, contextGenerator: { (size, ctx) in
ctx.setFillColor(theme.colors.transparentBackground.cgColor)
ctx.fill(NSMakeRect(0, 0, size.width, size.height))
ctx.clear(size.bounds)
if drawChessboard {
ctx.setFillColor(theme.colors.transparentBackground.cgColor)
ctx.fill(NSMakeRect(0, 0, size.width, size.height))
}
ctx.draw(image, in: NSMakeRect(0, 0, size.width, size.height))
})

Expand Down
2 changes: 1 addition & 1 deletion Telegram-Mac/Star_Transaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ private final class HeaderView : GeneralContainableRowView {
current = view
} else {
current = ImageView()
self.addSubview(current)
control.addSubview(current)
self.outgoingView = current
}
switch item.transaction.peer {
Expand Down
4 changes: 3 additions & 1 deletion Telegram-Mac/UserInfoEntries.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1697,12 +1697,14 @@ enum UserInfoEntry: PeerInfoEntry {
arguments.context.bindings.globalSearch(hashtag, arguments.peerId)
})
case let .bio(_, text, peer, viewType):
return TextAndLabelItem(initialSize, stableId:stableId.hashValue, label: strings().peerInfoBio, copyMenuText: strings().textCopyLabelBio, text:text, context: arguments.context, viewType: viewType, detectLinks: true, onlyInApp: !peer.peer.isPremium, openInfo: { peerId, toChat, postId, _ in
return TextAndLabelItem(initialSize, stableId:stableId.hashValue, label: strings().peerInfoBio, copyMenuText: strings().textCopyLabelBio, text:text, context: arguments.context, viewType: viewType, detectLinks: true, onlyInApp: !peer.peer.isPremium, openInfo: { peerId, toChat, postId, _ in
if toChat {
arguments.peerChat(peerId, postId: postId)
} else {
arguments.peerInfo(peerId)
}
}, hashtag: { value in
arguments.context.bindings.globalSearch(value, nil)
})
case let .birthday(_, text, canBirth, viewType):
return TextAndLabelItem(initialSize, stableId:stableId.hashValue, label: strings().peerInfoBirthday, copyMenuText: strings().textCopyLabelBio, text:text, context: arguments.context, viewType: viewType, gift: canBirth ? arguments.giftBirthday : nil)
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>265304</string>
<string>265312</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSMinimumSystemVersion</key>
Expand Down
4 changes: 3 additions & 1 deletion packages/Localization/Sources/Localization/Localizable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7255,6 +7255,8 @@ public final class L10n {
public static var contextAlertCopied: String { return L10n.tr("Localizable", "Context.Alert.Copied") }
/// This link will only work for members of this chat
public static var contextAlertCopyPrivate: String { return L10n.tr("Localizable", "Context.Alert.CopyPrivate") }
/// Sorry, you can't copy paid media
public static var contextCopyPaidMediaRestricted: String { return L10n.tr("Localizable", "Context.CopyPaidMedia.Restricted") }
/// Search
public static var contextMenuSearch: String { return L10n.tr("Localizable", "Context.Menu.Search") }
/// %d
Expand Down Expand Up @@ -9975,7 +9977,7 @@ public final class L10n {
public static func loginNewCodeCodeInfo(_ p1: String) -> String {
return L10n.tr("Localizable", "Login.New.Code.CodeInfo", p1)
}
/// We’ve sent an e-mail with an activation code\non **%@**
/// We’ve sent an e-mail with an activation code\nto %@
public static func loginNewCodeEmail(_ p1: String) -> String {
return L10n.tr("Localizable", "Login.New.Code.Email", p1)
}
Expand Down

0 comments on commit 8b8762d

Please sign in to comment.