This commit is contained in:
Mike Renoir
2023-09-29 23:04:31 +04:00
parent 60df3694a5
commit fd84fe866c
8 changed files with 47 additions and 10 deletions
+18 -4
View File
@@ -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)
}
+8 -1
View File
@@ -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
+1 -1
View File
@@ -35,7 +35,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>252390</string>
<string>252414</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>
+11
View File
@@ -0,0 +1,11 @@
//
// InputDataCloseItem.swift
// Telegram
//
// Created by Mike Renoir on 29.09.2023.
// Copyright © 2023 Telegram. All rights reserved.
//
import Foundation
+4
View File
@@ -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 = "<group>"; };
27C50ADB2AC6F86E00FED2E4 /* premium_gift_6.tgs */ = {isa = PBXFileReference; lastKnownFileType = file; path = premium_gift_6.tgs; sourceTree = "<group>"; };
27C50ADC2AC6F87000FED2E4 /* premium_gift_12.tgs */ = {isa = PBXFileReference; lastKnownFileType = file; path = premium_gift_12.tgs; sourceTree = "<group>"; };
27C50AE82AC7492A00FED2E4 /* InputDataCloseItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputDataCloseItem.swift; sourceTree = "<group>"; };
27C6B65C29DC123500F7E7AC /* share_folder.tgs */ = {isa = PBXFileReference; lastKnownFileType = file; path = share_folder.tgs; sourceTree = "<group>"; };
27CB174B2763257900DD25E0 /* menu_secret_chat.tgs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = menu_secret_chat.tgs; sourceTree = "<group>"; };
27CB174D276325C600DD25E0 /* menu_call.tgs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = menu_call.tgs; sourceTree = "<group>"; };
@@ -4501,6 +4503,7 @@
2763A158261C91B000C12762 /* DatePickerRowItem.swift */,
2751017C29D2BA02004CEFF3 /* TextInputController.swift */,
27303ACC2AC2BD5000433CED /* InputDataTableBasedItem.swift */,
27C50AE82AC7492A00FED2E4 /* InputDataCloseItem.swift */,
);
name = general;
sourceTree = "<group>";
@@ -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 */,
+1 -1
View File
@@ -21,7 +21,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>252390</string>
<string>252414</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSMinimumSystemVersion</key>
+2 -1
View File
@@ -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
+2 -2
View File
@@ -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 {