Skip to content

Commit

Permalink
Merge branch 'release' into appstore
Browse files Browse the repository at this point in the history
# Conflicts:
#	Telegram-Mac/Info.plist
#	Telegram-Mac/PeerMediaGroupPeersController.swift
#	TelegramShare/Info.plist
  • Loading branch information
overtake committed Jun 22, 2024
2 parents 518d905 + 4e76448 commit 9c1a8ff
Show file tree
Hide file tree
Showing 101 changed files with 4,683 additions and 1,509 deletions.
4 changes: 2 additions & 2 deletions Telegram-Mac/AccountContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,8 @@ final class AccountContext {
self.networkStatusManager = NetworkStatusManager(account: account, window: window, sharedContext: sharedContext)
self.reactions = Reactions(engine)
self.dockControl = DockControl(engine, accountManager: sharedContext.accountManager)
self.starsContext = engine.payments.peerStarsContext(peerId: account.peerId)
#endif
self.starsContext = engine.payments.peerStarsContext()
#endif


giftStickersValues.set(engine.stickers.loadedStickerPack(reference: .premiumGifts, forceActualized: false)
Expand Down
1 change: 1 addition & 0 deletions Telegram-Mac/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ class AppDelegate: NSResponder, NSApplicationDelegate, NSUserNotificationCenterD

launchInterface()


}


Expand Down
2 changes: 2 additions & 0 deletions Telegram-Mac/Appearance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2483,6 +2483,8 @@ private func generateIcons(from palette: ColorPalette, bubbled: Bool) -> Telegra
peerInfoPermissions: { NSImage(named: "Icon_ChatPermissions")!.precomposed(flipVertical: true) },
peerInfoBanned: { NSImage(named: "Icon_ChatBanned")!.precomposed(flipVertical: true) },
peerInfoMembers: { NSImage(named: "Icon_ChatMembers")!.precomposed(flipVertical: true) },
peerInfoStarsBalance: { NSImage(resource: .iconPeerInfoStarsBalance).precomposed(flipVertical: true) },
peerInfoBotUsername: { NSImage(resource: .iconPeerInfoBotUsername).precomposed(flipVertical: true) },
chatUndoAction: { NSImage(named: "Icon_ChatUndoAction")!.precomposed(NSColor(0x29ACFF)) },
appUpdate: { NSImage(named: "Icon_AppUpdate")!.precomposed() },
inlineVideoSoundOff: { NSImage(named: "Icon_InlineVideoSoundOff")!.precomposed() },
Expand Down
8 changes: 6 additions & 2 deletions Telegram-Mac/ApplicationContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -534,11 +534,15 @@ final class AuthorizedApplicationContext: NSObject, SplitViewDelegate {

#if DEBUG
self.context.window.set(handler: { _ -> KeyHandlerResult in
// showModal(with: Star_Transaction(context: context, peer: .init(context.myPeer!), transaction: StarsContext.State.Transaction.init(id: "kqwjeflklqwkejflqwkejflqkwejflqkwejf", count: 1000, date: Int32(Date().timeIntervalSince1970), peer: StarsContext.State.Transaction.Peer.appStore)), for: context.window)

//showModal(with: StoryFoundListController(context: context, source: .hashtag("#telegram"), presentation: theme), for: context.window)



// showModal(with: Star_TransactionScreen(context: context, peer: .init(context.myPeer!), transaction: StarsContext.State.Transaction.init(id: "kqwjeflklqwkejflqwkejflqkwejflqkwejf", count: 1000, date: Int32(Date().timeIntervalSince1970), peer: StarsContext.State.Transaction.Peer.appStore)), for: context.window)
// showModal(with: FactCheckController(context: context), for: context.window)
// showModal(with: Star_PurschaseInApp(context: context, peerId: context.peerId), for: context.window)

context.bindings.rootNavigation().push(HashtagSearchController(context, hashtag: "#test", peerId: context.peerId))

return .invoked
}, with: self, for: .T, priority: .supreme, modifierFlags: [.command])
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"filename" : "bot_24 (1).png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "bot_24@2x (1).png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"filename" : "stars_balance_24.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"filename" : "star_20.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions Telegram-Mac/Assets.xcassets/menu_paid.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"filename" : "menu_paid.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Telegram-Mac/ChannelInfoEntries.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ enum ChannelInfoSection : Int {
case media = 9
}

func channelInfoEntries(view: PeerView, arguments:PeerInfoArguments, mediaTabsData: PeerMediaTabsData, inviteLinksCount: Int32, joinRequestsCount: Int32, availableReactions: AvailableReactions?, stories: PeerExpiringStoryListContext.State?) -> [PeerInfoEntry] {
func channelInfoEntries(view: PeerView, arguments:PeerInfoArguments, mediaTabsData: PeerMediaTabsData, inviteLinksCount: Int32, joinRequestsCount: Int32, availableReactions: AvailableReactions?, stories: PeerExpiringStoryListContext.State?, revenueState: StarsRevenueStatsContextState?) -> [PeerInfoEntry] {

let arguments = arguments as! ChannelInfoArguments
var state:ChannelInfoState {
Expand Down
11 changes: 11 additions & 0 deletions Telegram-Mac/ChannelStatsSegmentController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ private final class CenterView : TitledBarView {
segment.add(segment: .init(title: strings().statsMonetization, handler: { [weak self] in
self?.select?(2)
}))
//
// segment.add(segment: .init(title: strings().statsStars, handler: { [weak self] in
// self?.select?(3)
// }))
}


Expand Down Expand Up @@ -63,6 +67,7 @@ final class ChannelStatsSegmentController : SectionViewController {
private let stats: ViewController
private let boosts: ViewController
private let monetization: ViewController?
private let stars: ViewController?
private let context: AccountContext
private let peerId: PeerId
init(_ context: AccountContext, peerId: PeerId, isChannel: Bool, monetization: Bool = false) {
Expand All @@ -72,12 +77,15 @@ final class ChannelStatsSegmentController : SectionViewController {
self.stats = ChannelStatsViewController(context, peerId: peerId)
if monetization {
self.monetization = FragmentMonetizationController(context: context, peerId: peerId)
self.stars = nil//FragmentStarMonetizationController(context: context, peerId: peerId, revenueContext: nil)
} else {
self.monetization = nil
self.stars = nil
}
} else {
self.stats = GroupStatsViewController(context, peerId: peerId)
self.monetization = nil
self.stars = nil
}
self.boosts = ChannelBoostStatsController(context: context, peerId: peerId)

Expand All @@ -88,6 +96,9 @@ final class ChannelStatsSegmentController : SectionViewController {
if let monetization = self.monetization {
items.append(SectionControllerItem(title: { "" }, controller: monetization))
}
if let stars = self.stars {
items.append(SectionControllerItem(title: { "" }, controller: stars))
}
super.init(sections: items, selected: 0, hasHeaderView: false, hasBar: true)

}
Expand Down
4 changes: 2 additions & 2 deletions Telegram-Mac/ChannelStatsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,8 @@ private func statsEntries(_ state: ChannelStatsContextState, uiState: UIStatsSta
}
if let stories = stories {
for story in stories.items {
if let interactions = interactions?[.story(peerId: peer.id, id: story.id)] {
posts.append(.story(story, .init(peer), interactions))
if let interactions = interactions?[.story(peerId: peer.id, id: story.storyItem.id)] {
posts.append(.story(story.storyItem, .init(peer), interactions))
}
}
}
Expand Down
71 changes: 54 additions & 17 deletions Telegram-Mac/ChatController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ private func calculateAdjustedPoint(for point: CGPoint,
floatingPhotosView: NSView,
tableView: TableView) -> CGPoint? {
// Ensure both views have superviews and that tableView has a documentView
guard let tableViewDocumentView = tableView.documentView else {
guard let floatingPhotosSuperview = floatingPhotosView.superview,
let tableViewDocumentView = tableView.documentView else {
return nil // Return nil if the conditions are not met
}

Expand Down Expand Up @@ -1146,7 +1147,7 @@ class ChatControllerView : View, ChatInputDelegate {
mentions.frame = mentionsRect
mentions.layer?.animateAlpha(from: 0, to: 1, duration: 0.2)
addSubview(mentions, positioned: .below, relativeTo: inputView)
}
}
}
self.mentions?.updateCount(mentionsCount)
} else {
Expand Down Expand Up @@ -1334,7 +1335,7 @@ fileprivate func prepareEntries(from fromView:ChatHistoryView?, to toView:ChatHi
let firstTransition = Queue.mainQueue().isCurrent()
let cancelled = Atomic(value: false)

let prevIsLoading = fromView?.originalView == nil || fromView?.originalView?.isLoading == true
let prevIsLoading = fromView?.originalView == nil || fromView?.originalView?.isLoading == true

if firstTransition, let state = scrollToItem, prevIsLoading {

Expand Down Expand Up @@ -1599,7 +1600,7 @@ private func maxIncomingMessageIndexForEntries(_ entries: [ChatHistoryEntry], in
enum ChatHistoryViewTransitionReason {
case Initial(fadeIn: Bool)
case InteractiveChanges
case HoleReload
case HoleReload
case Reload
}

Expand Down Expand Up @@ -1741,7 +1742,7 @@ private final class ChatAdData {
flags: initialMessage.flags,
tags: initialMessage.tags,
globalTags: initialMessage.globalTags,
localTags: initialMessage.localTags,
localTags: initialMessage.localTags,
customTags: initialMessage.customTags,
forwardInfo: initialMessage.forwardInfo,
author: initialMessage.author,
Expand Down Expand Up @@ -2758,7 +2759,7 @@ class ChatController: EditableViewController<ChatControllerView>, Notifable, Tab

enum WallpaperResult : Equatable {
case result(Wallpaper?)
case loading
case loading
}


Expand Down Expand Up @@ -3920,7 +3921,7 @@ class ChatController: EditableViewController<ChatControllerView>, Notifable, Tab
}

chatInteraction.sendLocation = { [weak self] coordinate, venue in
let media = TelegramMediaMap(latitude: coordinate.latitude, longitude: coordinate.longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: venue, liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil)
let media = TelegramMediaMap(latitude: coordinate.latitude, longitude: coordinate.longitude, heading: nil, accuracyRadius: nil, venue: venue, liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil)
self?.chatInteraction.sendMedias([media], ChatTextInputState(), false, nil, false, nil, false, nil, false)
}

Expand Down Expand Up @@ -4471,7 +4472,7 @@ class ChatController: EditableViewController<ChatControllerView>, Notifable, Tab
default:
return .fail(.generic)
}
}
}
}), for: context.window)
case .authSessionTooFresh:
errorText = strings().botTransferOwnerErrorText
Expand Down Expand Up @@ -4704,11 +4705,12 @@ class ChatController: EditableViewController<ChatControllerView>, Notifable, Tab
let requestCount = strongSelf.requestCount
let scroll = state
.swap(to: ChatHistoryEntryId.message(message)).text(string: focusTarget.string)
.focus(action: { [weak strongSelf] _ in
.focus(action: { [weak strongSelf] view in
if let strongSelf {
let content: ChatHistoryLocation = .Scroll(index: .message(toIndex), anchorIndex: .message(toIndex), sourceIndex: .message(fromIndex), scrollPosition: .none(nil), count: requestCount, animated: state.animated)
strongSelf.setLocation(.init(content: content, tag: strongSelf.locationValue?.tag, id: strongSelf.nextHistoryLocationId))
}
state.action?(view)
})
let content: ChatHistoryLocation = .Scroll(index: .message(toIndex), anchorIndex: .message(toIndex), sourceIndex: .message(fromIndex), scrollPosition: scroll, count: requestCount, animated: state.animated)
let id = strongSelf.takeNextHistoryLocationId()
Expand Down Expand Up @@ -4827,7 +4829,7 @@ class ChatController: EditableViewController<ChatControllerView>, Notifable, Tab
current.mediaRevealed.insert(message.id)
return current
}
//
//
// #if DEBUG
// verifyAlert(for: context.window, header: strings().chatSensitiveContent, information: strings().chatSensitiveContentConfirm, ok: strings().chatSensitiveContentConfirmOk, option: strings().chatSensitiveContentConfirmThird, successHandler: { result in
// self?.updateState { current in
Expand All @@ -4837,7 +4839,7 @@ class ChatController: EditableViewController<ChatControllerView>, Notifable, Tab
// }
// })
// #else
//
//
// #endif


Expand Down Expand Up @@ -5304,7 +5306,7 @@ class ChatController: EditableViewController<ChatControllerView>, Notifable, Tab
}
if activeCall != currentActiveCall {
currentActiveCall = activeCall
}
}
if let activeCall = currentActiveCall {
let join:(PeerId, Date?, Bool)->Void = { joinAs, _, _ in
_ = showModalProgress(signal: requestOrJoinGroupCall(context: context, peerId: peerId, joinAs: joinAs, initialCall: activeCall, initialInfo: groupCall?.data?.info, joinHash: joinHash), for: context.window).start(next: { result in
Expand Down Expand Up @@ -5520,10 +5522,45 @@ class ChatController: EditableViewController<ChatControllerView>, Notifable, Tab
})
}), forKey: key)
}


}

chatInteraction.openPhoneNumberContextMenu = { [weak self] phoneNumber in
let point = context.window.mouseLocationOutsideOfEventStream
let view = context.window.contentView?.hitTest(point)


if let view, let event = NSApp.currentEvent {

let signal = context.engine.peers.resolvePeerByPhone(phone: phoneNumber) |> deliverOnMainQueue

_ = signal.startStandalone(next: { [weak view] peer in

if let view = view {
let menu = ContextMenu()

menu.addItem(ContextMenuItem(strings().contextCopyToClipboard, handler: {
copyToClipboard(phoneNumber)
showModalText(for: context.window, text: strings().shareLinkCopied)
}, itemImage: MenuAnimation.menu_copy.value))

menu.addItem(ContextSeparatorItem())

let item: ContextMenuItem
if let peer {
item = ReactionPeerMenu(title: peer._asPeer().displayTitle, handler: { [weak self] in
self?.chatInteraction.openInfo(peer.id, true, nil, nil)
}, peer: peer._asPeer(), context: context, reaction: nil, message: nil)
} else {
item = ContextMenuItem(strings().chatContextPhoneNotTelegram)
item.isEnabled = false
}
menu.addItem(item)

AppMenu.show(menu: menu, event: event, for: view)
}
})


}
}

chatInteraction.updatePinned = { [weak self] pinnedId, dismiss, silent, forThisPeerOnlyIfPossible in
Expand Down Expand Up @@ -7499,7 +7536,7 @@ class ChatController: EditableViewController<ChatControllerView>, Notifable, Tab
back.addSubview(editButton)

self.editButton = editButton
//
//
let doneButton = TextButton()
// doneButton.disableActions()
doneButton.set(font: .medium(.text), for: .Normal)
Expand Down Expand Up @@ -9172,7 +9209,7 @@ class ChatController: EditableViewController<ChatControllerView>, Notifable, Tab

if asMedia {
items.append(asMediaItem)
}
}

}

Expand Down
Loading

0 comments on commit 9c1a8ff

Please sign in to comment.