Skip to content

Commit 8f5977f

Browse files
author
Mike Renoir
committed
bugfixes
1 parent 14973f0 commit 8f5977f

File tree

23 files changed

+188
-884
lines changed

23 files changed

+188
-884
lines changed

‎Telegram-Mac.xcworkspace/contents.xcworkspacedata

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Telegram-Mac/ApplicationContext.swift

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import WebKit
23
import UserNotifications
34
import TGUIKit
45
import SwiftSignalKit
@@ -323,6 +324,7 @@ final class AuthorizedApplicationContext: NSObject, SplitViewDelegate {
323324
self.loggedOutDisposable.set(context.account.loggedOut.start(next: { value in
324325
if value {
325326
let _ = logoutFromAccount(id: accountId, accountManager: context.sharedContext.accountManager, alreadyLoggedOutRemotely: false).start()
327+
FastSettings.clear_uuid(context.account.id.int64)
326328
}
327329
}))
328330

‎Telegram-Mac/ChatMessageItem.swift

+17-3
Original file line numberDiff line numberDiff line change
@@ -820,10 +820,24 @@ class ChatMessageItem: ChatRowItem {
820820
header = TextNode.layoutText(.initialize(string: lg.prefixWithDots(15), color: blockColor.main, font: .medium(.text)), nil, 1, .end, NSMakeSize(.greatestFiniteMagnitude, .greatestFiniteMagnitude), nil, false, .left)
821821

822822
let tetriary: NSColor
823+
let dark: Bool
823824
if bubbled {
824-
tetriary = NSColor.black
825+
let isIncoming = message?.isIncoming(context.account, bubbled) ?? false
826+
if isIncoming {
827+
tetriary = blockColor.main
828+
dark = isDark
829+
} else {
830+
if isDark {
831+
tetriary = NSColor.black
832+
dark = isDark
833+
} else {
834+
tetriary = blockColor.main
835+
dark = false
836+
}
837+
}
825838
} else {
826839
tetriary = blockColor.main
840+
dark = isDark
827841
}
828842

829843
string.addAttribute(TextInputAttributes.quote, value: TextViewBlockQuoteData(id: Int(arc4random64()), colors: .init(main: blockColor.main, secondary: nil, tertiary: tetriary), isCode: true, space: 4, header: header), range: range)
@@ -832,9 +846,9 @@ class ChatMessageItem: ChatRowItem {
832846
string.addAttribute(TextInputAttributes.monospace, value: true as NSNumber, range: range)
833847

834848

835-
if let language = language {
849+
if let language = language?.lowercased() {
836850
let code = string.attributedSubstring(from: range).string
837-
let syntaxed = CodeSyntax.syntax(code: code, language: language, theme: .init(dark: bubbled ? true : isDark, textColor: textColor, textFont: .code(fontSize), italicFont: .italicMonospace(fontSize), mediumFont: .semiboldMonospace(fontSize)))
851+
let syntaxed = CodeSyntax.syntax(code: code, language: language, theme: .init(dark: dark, textColor: textColor, textFont: .code(fontSize), italicFont: .italicMonospace(fontSize), mediumFont: .semiboldMonospace(fontSize)))
838852
CodeSyntax.apply(syntaxed, to: string, offset: range.location)
839853
}
840854

‎Telegram-Mac/ChatServiceItem.swift

+8-2
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,6 @@ class ChatServiceItem: ChatRowItem {
451451
}
452452
attributedString.detectBoldColorInString(with: .medium(theme.fontSize))
453453
}
454-
case let .botDomainAccessGranted(domain):
455-
_ = attributedString.append(string: strings().chatServiceBotPermissionAllowed(domain), color: grayTextColor, font: NSFont.normal(theme.fontSize))
456454
case let .botSentSecureValues(types):
457455
let permissions = types.map({$0.rawValue}).joined(separator: ", ")
458456
_ = attributedString.append(string: strings().chatServiceSecureIdAccessGranted(peer.displayTitle, permissions), color: grayTextColor, font: NSFont.normal(theme.fontSize))
@@ -898,6 +896,14 @@ class ChatServiceItem: ChatRowItem {
898896
}
899897
let _ = attributedString.append(string: text, color: grayTextColor, font: NSFont.normal(theme.fontSize))
900898
attributedString.detectBoldColorInString(with: .medium(theme.fontSize))
899+
900+
let messageId: MessageId? = message.replyAttribute?.messageId
901+
902+
if let messageId = messageId {
903+
attributedString.add(link: inAppLink.callback("", { [weak chatInteraction] _ in
904+
chatInteraction?.focusMessageId(nil, .init(messageId: messageId, string: nil), .CenterEmpty)
905+
}), for: attributedString.range, color: grayTextColor)
906+
}
901907
default:
902908
break
903909
}

‎Telegram-Mac/FastSettings.swift

+10
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,16 @@ class FastSettings {
650650
}
651651
}
652652

653+
static func clear_uuid(_ id: Int64) {
654+
#if DEBUG
655+
if #available(macOS 14.0, *) {
656+
if let uuid = FastSettings.getUUID(id) {
657+
WKWebsiteDataStore.remove(forIdentifier: uuid, completionHandler: { _ in
658+
})
659+
}
660+
}
661+
#endif
662+
}
653663
}
654664

655665
fileprivate let TelegramFileMediaBoxPath:String = "TelegramFileMediaBoxPathAttributeKey"

‎Telegram-Mac/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
</dict>
3636
</array>
3737
<key>CFBundleVersion</key>
38-
<string>256491</string>
38+
<string>256563</string>
3939
<key>ITSAppUsesNonExemptEncryption</key>
4040
<false/>
4141
<key>LSApplicationCategoryType</key>

‎Telegram-Mac/LogoutViewController.swift

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import TelegramCore
1212

1313
import Postbox
1414
import SwiftSignalKit
15+
import WebKit
1516

1617
private struct LogoutControllerState : Equatable {
1718

@@ -127,6 +128,9 @@ func LogoutViewController(context: AccountContext, f: @escaping((ViewController)
127128
verifyAlert_button(for: context.window, header: strings().accountConfirmLogout, information: strings().accountConfirmLogoutText, successHandler: { _ in
128129
closeAllModals()
129130
_ = logoutFromAccount(id: context.account.id, accountManager: context.sharedContext.accountManager, alreadyLoggedOutRemotely: false).start()
131+
132+
FastSettings.clear_uuid(context.account.id.int64)
133+
130134
})
131135
})
132136

0 commit comments

Comments
 (0)