From fd84fe866cd92d00ce73ae55e2cf66ec4d3fe01f Mon Sep 17 00:00:00 2001 From: Mike Renoir <> Date: Fri, 29 Sep 2023 23:04:31 +0400 Subject: [PATCH] bump --- Telegram-Mac/ChatGiveawayRowItem.swift | 22 ++++++++++++++++++---- Telegram-Mac/GiftLinkModalController.swift | 9 ++++++++- Telegram-Mac/Info.plist | 2 +- Telegram-Mac/InputDataCloseItem.swift | 11 +++++++++++ Telegram.xcodeproj/project.pbxproj | 4 ++++ TelegramShare/Info.plist | 2 +- packages/TGUIKit/Sources/BadgeNode.swift | 3 ++- packages/TGUIKit/Sources/Modal.swift | 4 ++-- 8 files changed, 47 insertions(+), 10 deletions(-) create mode 100644 Telegram-Mac/InputDataCloseItem.swift diff --git a/Telegram-Mac/ChatGiveawayRowItem.swift b/Telegram-Mac/ChatGiveawayRowItem.swift index 00d97336c..fe730200d 100644 --- a/Telegram-Mac/ChatGiveawayRowItem.swift +++ b/Telegram-Mac/ChatGiveawayRowItem.swift @@ -77,9 +77,9 @@ final class ChatGiveawayRowItem : ChatRowItem { winners_attr.detectBoldColorInString(with: .medium(.text)) self.winnerText = .init(winners_attr, alignment: .center, alwaysStaticItems: true) - let under = wpPresentation.activity.lightness > 0.8 ? NSColor(0x000000) : NSColor(0xffffff) + let under = theme.colors.underSelectedColor - badge = .init(.initialize(string: "\(media.quantity)", color: under, font: .medium(.short)), wpPresentation.activity, aroundFill: under) + badge = .init(.initialize(string: "X\(media.quantity)", color: under, font: .avatar(.small)), theme.colors.accent, aroundFill: under, additionSize: NSMakeSize(16, 7)) var channels:[Channel] = [] for peerId in media.channelPeerIds { @@ -107,6 +107,14 @@ final class ChatGiveawayRowItem : ChatRowItem { } } + func howItWorks() { + + let peerNames = channels.map { $0.peer.displayTitle }.joined(separator: ", ") + + let date = stringForFullDate(timestamp: media.untilDate) + alert(for: context.window, info: "The giveaway is sponsored by the admins of **\(peerNames)**, who acquired **\(media.quantity) Telegram Premium** subscriptions for **\(media.months)** months for its followers.\n\nOn **\(date)**, Telegram will automatically select **\(media.quantity)** random subscribers of **\(peerNames)**.") + } + override func makeContentSize(_ width: CGFloat) -> NSSize { @@ -121,7 +129,7 @@ final class ChatGiveawayRowItem : ChatRowItem { height += headerText.layoutSize.height height += 10 height += participantsText.layoutSize.height - height += 10 + height += 5 //channels for channel in channels { @@ -282,6 +290,12 @@ private final class ChatGiveawayRowView: ChatRowView { winnerTextView.userInteractionEnabled = false winnerTextView.isSelectable = false + + action.set(handler: { [weak self] _ in + if let item = self?.item as? ChatGiveawayRowItem { + item.howItWorks() + } + }, for: .Click) } @@ -334,7 +348,7 @@ private final class ChatGiveawayRowView: ChatRowView { badgeView.centerX(y: mediaView.frame.maxY - badgeView.frame.height + 5) headerTextView.centerX(y: mediaView.frame.maxY + 10) participantsTextView.centerX(y: headerTextView.frame.maxY + 10) - channels.centerX(y: participantsTextView.frame.maxY + 10) + channels.centerX(y: participantsTextView.frame.maxY + 5) winnerTextView.centerX(y: channels.frame.maxY + 10) action.frame = NSMakeRect(0, winnerTextView.frame.maxY + 10, contentView.frame.width, 30) } diff --git a/Telegram-Mac/GiftLinkModalController.swift b/Telegram-Mac/GiftLinkModalController.swift index 0d9c9793e..2fc975481 100644 --- a/Telegram-Mac/GiftLinkModalController.swift +++ b/Telegram-Mac/GiftLinkModalController.swift @@ -26,7 +26,7 @@ private final class GiftLinkStarRowItem : GeneralRowItem { } private final class GiftLinkStarRowView : TableRowView { - private let scene: PremiumStarSceneView = PremiumStarSceneView(frame: NSMakeRect(0, 0, 300, 150)) + private let scene: PremiumStarSceneView = PremiumStarSceneView(frame: NSMakeRect(0, 0, 340, 180)) required init(frame frameRect: NSRect) { super.init(frame: frameRect) addSubview(scene) @@ -294,6 +294,13 @@ func GiftLinkModalController(context: AccountContext, info: PremiumGiftCodeInfo) } return .none } + + controller.didLoaded = { controller, _ in + controller.genericView.layer?.masksToBounds = false + controller.tableView.layer?.masksToBounds = false + controller.tableView.documentView?.layer?.masksToBounds = false + controller.tableView.clipView.layer?.masksToBounds = false + } getController = { [weak controller] in diff --git a/Telegram-Mac/Info.plist b/Telegram-Mac/Info.plist index 40419717c..5f45d537d 100644 --- a/Telegram-Mac/Info.plist +++ b/Telegram-Mac/Info.plist @@ -35,7 +35,7 @@ CFBundleVersion - 252390 + 252414 ITSAppUsesNonExemptEncryption LSApplicationCategoryType diff --git a/Telegram-Mac/InputDataCloseItem.swift b/Telegram-Mac/InputDataCloseItem.swift new file mode 100644 index 000000000..c86c76514 --- /dev/null +++ b/Telegram-Mac/InputDataCloseItem.swift @@ -0,0 +1,11 @@ +// +// InputDataCloseItem.swift +// Telegram +// +// Created by Mike Renoir on 29.09.2023. +// Copyright © 2023 Telegram. All rights reserved. +// + +import Foundation + + diff --git a/Telegram.xcodeproj/project.pbxproj b/Telegram.xcodeproj/project.pbxproj index 4ee8df95f..e70568f11 100644 --- a/Telegram.xcodeproj/project.pbxproj +++ b/Telegram.xcodeproj/project.pbxproj @@ -503,6 +503,7 @@ 27C50ADD2AC6F87000FED2E4 /* premium_gift_3.tgs in Resources */ = {isa = PBXBuildFile; fileRef = 27C50ADA2AC6F86D00FED2E4 /* premium_gift_3.tgs */; }; 27C50ADE2AC6F87000FED2E4 /* premium_gift_6.tgs in Resources */ = {isa = PBXBuildFile; fileRef = 27C50ADB2AC6F86E00FED2E4 /* premium_gift_6.tgs */; }; 27C50ADF2AC6F87000FED2E4 /* premium_gift_12.tgs in Resources */ = {isa = PBXBuildFile; fileRef = 27C50ADC2AC6F87000FED2E4 /* premium_gift_12.tgs */; }; + 27C50AE92AC7492A00FED2E4 /* InputDataCloseItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27C50AE82AC7492A00FED2E4 /* InputDataCloseItem.swift */; }; 27C6B65D29DC123500F7E7AC /* share_folder.tgs in Resources */ = {isa = PBXBuildFile; fileRef = 27C6B65C29DC123500F7E7AC /* share_folder.tgs */; }; 27CB174C2763257900DD25E0 /* menu_secret_chat.tgs in Resources */ = {isa = PBXBuildFile; fileRef = 27CB174B2763257900DD25E0 /* menu_secret_chat.tgs */; }; 27CB174E276325C600DD25E0 /* menu_call.tgs in Resources */ = {isa = PBXBuildFile; fileRef = 27CB174D276325C600DD25E0 /* menu_call.tgs */; }; @@ -1957,6 +1958,7 @@ 27C50ADA2AC6F86D00FED2E4 /* premium_gift_3.tgs */ = {isa = PBXFileReference; lastKnownFileType = file; path = premium_gift_3.tgs; sourceTree = ""; }; 27C50ADB2AC6F86E00FED2E4 /* premium_gift_6.tgs */ = {isa = PBXFileReference; lastKnownFileType = file; path = premium_gift_6.tgs; sourceTree = ""; }; 27C50ADC2AC6F87000FED2E4 /* premium_gift_12.tgs */ = {isa = PBXFileReference; lastKnownFileType = file; path = premium_gift_12.tgs; sourceTree = ""; }; + 27C50AE82AC7492A00FED2E4 /* InputDataCloseItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputDataCloseItem.swift; sourceTree = ""; }; 27C6B65C29DC123500F7E7AC /* share_folder.tgs */ = {isa = PBXFileReference; lastKnownFileType = file; path = share_folder.tgs; sourceTree = ""; }; 27CB174B2763257900DD25E0 /* menu_secret_chat.tgs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = menu_secret_chat.tgs; sourceTree = ""; }; 27CB174D276325C600DD25E0 /* menu_call.tgs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = menu_call.tgs; sourceTree = ""; }; @@ -4501,6 +4503,7 @@ 2763A158261C91B000C12762 /* DatePickerRowItem.swift */, 2751017C29D2BA02004CEFF3 /* TextInputController.swift */, 27303ACC2AC2BD5000433CED /* InputDataTableBasedItem.swift */, + 27C50AE82AC7492A00FED2E4 /* InputDataCloseItem.swift */, ); name = general; sourceTree = ""; @@ -7494,6 +7497,7 @@ 27C4089425B081B500372302 /* FireTimerControl.swift in Sources */, C2A315AF1E2E64BE00D89000 /* CalendarController.swift in Sources */, C296AF8A1D8E9F94001DBB59 /* ChatInteractiveContentView.swift in Sources */, + 27C50AE92AC7492A00FED2E4 /* InputDataCloseItem.swift in Sources */, C2271F2B1DB3BEB60045E719 /* GlobalHandlers.swift in Sources */, C224675B1FA8546200F03E27 /* GroupedLayout.swift in Sources */, C230BEBA1EE9AEB80029586C /* ChannelEventLogItem.swift in Sources */, diff --git a/TelegramShare/Info.plist b/TelegramShare/Info.plist index da4f281ad..2ed36cccd 100644 --- a/TelegramShare/Info.plist +++ b/TelegramShare/Info.plist @@ -21,7 +21,7 @@ CFBundleShortVersionString $(MARKETING_VERSION) CFBundleVersion - 252390 + 252414 ITSAppUsesNonExemptEncryption LSMinimumSystemVersion diff --git a/packages/TGUIKit/Sources/BadgeNode.swift b/packages/TGUIKit/Sources/BadgeNode.swift index 5124b80e7..d7935f92f 100644 --- a/packages/TGUIKit/Sources/BadgeNode.swift +++ b/packages/TGUIKit/Sources/BadgeNode.swift @@ -72,7 +72,8 @@ public class BadgeNode: Node { public var additionSize: NSSize = NSMakeSize(8, 7) - public init(_ attributedString:NSAttributedString, _ fillColor:NSColor, aroundFill:NSColor? = nil) { + public init(_ attributedString:NSAttributedString, _ fillColor:NSColor, aroundFill:NSColor? = nil, additionSize: NSSize = NSMakeSize(8, 7)) { + self.additionSize = additionSize textLayout = TextNode.layoutText(maybeNode: nil, attributedString, nil, 1, .middle, NSMakeSize(CGFloat.greatestFiniteMagnitude, CGFloat.greatestFiniteMagnitude), nil, false, .left) self.fillColor = fillColor self.aroundFill = aroundFill diff --git a/packages/TGUIKit/Sources/Modal.swift b/packages/TGUIKit/Sources/Modal.swift index a6b04ec17..94478ce69 100644 --- a/packages/TGUIKit/Sources/Modal.swift +++ b/packages/TGUIKit/Sources/Modal.swift @@ -300,7 +300,7 @@ private final class ModalHeaderView: View { titleView.userInteractionEnabled = false titleView.isSelectable = false - backgroundColor = customTheme().background + backgroundColor = .clear borderColor = customTheme().border border = [.Bottom] @@ -409,7 +409,7 @@ private final class ModalHeaderView: View { background = customTheme().activeBackground borderColor = customTheme().activeBorder case .normal: - background = customTheme().background + background = .clear borderColor = customTheme().border } if animated {