Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
Ilya Laktyushin 2023-12-21 18:53:41 +04:00
commit 8b78f34956
8 changed files with 67 additions and 27 deletions

View File

@ -140,6 +140,10 @@ class BuildEnvironmentVersions:
raise Exception('Missing xcode version in {}'.format(configuration_path)) raise Exception('Missing xcode version in {}'.format(configuration_path))
else: else:
self.xcode_version = configuration_dict['xcode'] self.xcode_version = configuration_dict['xcode']
if configuration_dict['macos'] is None:
raise Exception('Missing macos version in {}'.format(configuration_path))
else:
self.macos_version = configuration_dict['macos']
class BuildEnvironment: class BuildEnvironment:
def __init__( def __init__(
@ -179,3 +183,4 @@ class BuildEnvironment:
self.app_version = versions.app_version self.app_version = versions.app_version
self.xcode_version = versions.xcode_version self.xcode_version = versions.xcode_version
self.bazel_version = versions.bazel_version self.bazel_version = versions.bazel_version
self.macos_version = versions.macos_version

View File

@ -9,7 +9,7 @@ import subprocess
import shutil import shutil
import glob import glob
from BuildEnvironment import resolve_executable, call_executable, run_executable_with_output, BuildEnvironment from BuildEnvironment import resolve_executable, call_executable, run_executable_with_output, BuildEnvironmentVersions, BuildEnvironment
from ProjectGeneration import generate from ProjectGeneration import generate
from BazelLocation import locate_bazel from BazelLocation import locate_bazel
from BuildConfiguration import CodesigningSource, GitCodesigningSource, DirectoryCodesigningSource, XcodeManagedCodesigningSource, BuildConfiguration, build_configuration_from_json from BuildConfiguration import CodesigningSource, GitCodesigningSource, DirectoryCodesigningSource, XcodeManagedCodesigningSource, BuildConfiguration, build_configuration_from_json
@ -1059,6 +1059,8 @@ if __name__ == '__main__':
os.makedirs(remote_input_path + '/certs') os.makedirs(remote_input_path + '/certs')
os.makedirs(remote_input_path + '/profiles') os.makedirs(remote_input_path + '/profiles')
versions = BuildEnvironmentVersions(base_path=os.getcwd())
resolve_configuration( resolve_configuration(
base_path=os.getcwd(), base_path=os.getcwd(),
bazel_command_line=None, bazel_command_line=None,
@ -1071,6 +1073,7 @@ if __name__ == '__main__':
RemoteBuild.remote_build( RemoteBuild.remote_build(
darwin_containers_path=args.darwinContainers, darwin_containers_path=args.darwinContainers,
darwin_containers_host=args.darwinContainersHost, darwin_containers_host=args.darwinContainersHost,
macos_version=versions.macos_version,
bazel_cache_host=args.cacheHost, bazel_cache_host=args.cacheHost,
configuration=args.configuration, configuration=args.configuration,
build_input_data_path=remote_input_path build_input_data_path=remote_input_path
@ -1105,18 +1108,24 @@ if __name__ == '__main__':
print('APPSTORE_CONNECT_PASSWORD environment variable is not set') print('APPSTORE_CONNECT_PASSWORD environment variable is not set')
sys.exit(1) sys.exit(1)
versions = BuildEnvironmentVersions(base_path=os.getcwd())
RemoteBuild.remote_deploy_testflight( RemoteBuild.remote_deploy_testflight(
darwin_containers_path=args.darwinContainers, darwin_containers_path=args.darwinContainers,
darwin_containers_host=args.darwinContainersHost, darwin_containers_host=args.darwinContainersHost,
macos_version=versions.macos_version,
ipa_path=args.ipa, ipa_path=args.ipa,
dsyms_path=args.dsyms, dsyms_path=args.dsyms,
username=env['APPSTORE_CONNECT_USERNAME'], username=env['APPSTORE_CONNECT_USERNAME'],
password=env['APPSTORE_CONNECT_PASSWORD'] password=env['APPSTORE_CONNECT_PASSWORD']
) )
elif args.commandName == 'remote-ipa-diff': elif args.commandName == 'remote-ipa-diff':
versions = BuildEnvironmentVersions(base_path=os.getcwd())
RemoteBuild.remote_ipa_diff( RemoteBuild.remote_ipa_diff(
darwin_containers_path=args.darwinContainers, darwin_containers_path=args.darwinContainers,
darwin_containers_host=args.darwinContainersHost, darwin_containers_host=args.darwinContainersHost,
macos_version=versions.macos_version,
ipa1_path=args.ipa1, ipa1_path=args.ipa1,
ipa2_path=args.ipa2 ipa2_path=args.ipa2
) )

View File

@ -55,9 +55,7 @@ def session_ssh(session, command):
return os.system(ssh_command) return os.system(ssh_command)
def remote_build(darwin_containers_path, darwin_containers_host, bazel_cache_host, configuration, build_input_data_path): def remote_build(darwin_containers_path, darwin_containers_host, macos_version, bazel_cache_host, configuration, build_input_data_path):
macos_version = '13.0'
DarwinContainers = import_module_from_file('darwin-containers', darwin_containers_path) DarwinContainers = import_module_from_file('darwin-containers', darwin_containers_path)
base_dir = os.getcwd() base_dir = os.getcwd()
@ -181,9 +179,7 @@ def remote_build(darwin_containers_path, darwin_containers_host, bazel_cache_hos
) )
def remote_deploy_testflight(darwin_containers_path, darwin_containers_host, ipa_path, dsyms_path, username, password): def remote_deploy_testflight(darwin_containers_path, darwin_containers_host, macos_version, ipa_path, dsyms_path, username, password):
macos_version = '13.0'
DarwinContainers = import_module_from_file('darwin-containers', darwin_containers_path) DarwinContainers = import_module_from_file('darwin-containers', darwin_containers_path)
configuration_path = 'versions.json' configuration_path = 'versions.json'
@ -240,9 +236,7 @@ def remote_deploy_testflight(darwin_containers_path, darwin_containers_host, ipa
) )
def remote_ipa_diff(darwin_containers_path, darwin_containers_host, ipa1_path, ipa2_path): def remote_ipa_diff(darwin_containers_path, darwin_containers_host, macos_version, ipa1_path, ipa2_path):
macos_version = '13.0'
DarwinContainers = import_module_from_file('darwin-containers', darwin_containers_path) DarwinContainers = import_module_from_file('darwin-containers', darwin_containers_path)
configuration_path = 'versions.json' configuration_path = 'versions.json'

View File

@ -71,7 +71,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
case redactSensitiveData(PresentationTheme, Bool) case redactSensitiveData(PresentationTheme, Bool)
case keepChatNavigationStack(PresentationTheme, Bool) case keepChatNavigationStack(PresentationTheme, Bool)
case skipReadHistory(PresentationTheme, Bool) case skipReadHistory(PresentationTheme, Bool)
case unidirectionalSwipeToReply(Bool) case dustEffect(Bool)
case callV2(Bool) case callV2(Bool)
case alternativeStoryMedia(Bool) case alternativeStoryMedia(Bool)
case crashOnSlowQueries(PresentationTheme, Bool) case crashOnSlowQueries(PresentationTheme, Bool)
@ -125,7 +125,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
return DebugControllerSection.logging.rawValue return DebugControllerSection.logging.rawValue
case .webViewInspection, .resetWebViewCache: case .webViewInspection, .resetWebViewCache:
return DebugControllerSection.web.rawValue return DebugControllerSection.web.rawValue
case .keepChatNavigationStack, .skipReadHistory, .unidirectionalSwipeToReply, .callV2, .alternativeStoryMedia, .crashOnSlowQueries, .crashOnMemoryPressure: case .keepChatNavigationStack, .skipReadHistory, .dustEffect, .callV2, .alternativeStoryMedia, .crashOnSlowQueries, .crashOnMemoryPressure:
return DebugControllerSection.experiments.rawValue return DebugControllerSection.experiments.rawValue
case .clearTips, .resetNotifications, .crash, .resetData, .resetDatabase, .resetDatabaseAndCache, .resetHoles, .reindexUnread, .resetCacheIndex, .reindexCache, .resetBiometricsData, .optimizeDatabase, .photoPreview, .knockoutWallpaper, .storiesExperiment, .storiesJpegExperiment, .playlistPlayback, .enableQuickReactionSwitch, .voiceConference, .experimentalCompatibility, .enableDebugDataDisplay, .acceleratedStickers, .inlineForums, .localTranscription, .enableReactionOverrides, .restorePurchases: case .clearTips, .resetNotifications, .crash, .resetData, .resetDatabase, .resetDatabaseAndCache, .resetHoles, .reindexUnread, .resetCacheIndex, .reindexCache, .resetBiometricsData, .optimizeDatabase, .photoPreview, .knockoutWallpaper, .storiesExperiment, .storiesJpegExperiment, .playlistPlayback, .enableQuickReactionSwitch, .voiceConference, .experimentalCompatibility, .enableDebugDataDisplay, .acceleratedStickers, .inlineForums, .localTranscription, .enableReactionOverrides, .restorePurchases:
return DebugControllerSection.experiments.rawValue return DebugControllerSection.experiments.rawValue
@ -176,7 +176,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
return 15 return 15
case .skipReadHistory: case .skipReadHistory:
return 16 return 16
case .unidirectionalSwipeToReply: case .dustEffect:
return 17 return 17
case .callV2: case .callV2:
return 18 return 18
@ -943,11 +943,11 @@ private enum DebugControllerEntry: ItemListNodeEntry {
return settings return settings
}).start() }).start()
}) })
case let .unidirectionalSwipeToReply(value): case let .dustEffect(value):
return ItemListSwitchItem(presentationData: presentationData, title: "Legacy swipe to reply", value: value, sectionId: self.section, style: .blocks, updated: { value in return ItemListSwitchItem(presentationData: presentationData, title: "Dust Debug", value: value, sectionId: self.section, style: .blocks, updated: { value in
let _ = updateExperimentalUISettingsInteractively(accountManager: arguments.sharedContext.accountManager, { settings in let _ = updateExperimentalUISettingsInteractively(accountManager: arguments.sharedContext.accountManager, { settings in
var settings = settings var settings = settings
settings.unidirectionalSwipeToReply = value settings.dustEffect = value
return settings return settings
}).start() }).start()
}) })
@ -1425,7 +1425,7 @@ private func debugControllerEntries(sharedContext: SharedAccountContext, present
#if DEBUG #if DEBUG
entries.append(.skipReadHistory(presentationData.theme, experimentalSettings.skipReadHistory)) entries.append(.skipReadHistory(presentationData.theme, experimentalSettings.skipReadHistory))
#endif #endif
entries.append(.unidirectionalSwipeToReply(experimentalSettings.unidirectionalSwipeToReply)) entries.append(.dustEffect(experimentalSettings.dustEffect))
entries.append(.callV2(experimentalSettings.callV2)) entries.append(.callV2(experimentalSettings.callV2))
entries.append(.alternativeStoryMedia(experimentalSettings.alternativeStoryMedia)) entries.append(.alternativeStoryMedia(experimentalSettings.alternativeStoryMedia))
} }

View File

@ -1,5 +1,6 @@
import Foundation import Foundation
import UIKit import UIKit
import Darwin
public protocol SharedDisplayLinkDriverLink: AnyObject { public protocol SharedDisplayLinkDriverLink: AnyObject {
var isPaused: Bool { get set } var isPaused: Bool { get set }
@ -7,6 +8,24 @@ public protocol SharedDisplayLinkDriverLink: AnyObject {
func invalidate() func invalidate()
} }
private let isIpad: Bool = {
var systemInfo = utsname()
uname(&systemInfo)
let modelCode = withUnsafePointer(to: &systemInfo.machine) {
$0.withMemoryRebound(to: CChar.self, capacity: 1) {
ptr in String.init(validatingUTF8: ptr)
}
}
if let modelCode {
if modelCode.lowercased().hasPrefix("ipad") {
return true
}
}
return false
}()
public final class SharedDisplayLinkDriver { public final class SharedDisplayLinkDriver {
public enum FramesPerSecond: Comparable { public enum FramesPerSecond: Comparable {
case fps(Int) case fps(Int)
@ -146,7 +165,7 @@ public final class SharedDisplayLinkDriver {
if #available(iOS 15.0, *) { if #available(iOS 15.0, *) {
let maxFps = Float(UIScreen.main.maximumFramesPerSecond) let maxFps = Float(UIScreen.main.maximumFramesPerSecond)
if maxFps > 61.0 { if maxFps > 61.0 {
let frameRateRange: CAFrameRateRange var frameRateRange: CAFrameRateRange
switch maxFramesPerSecond { switch maxFramesPerSecond {
case let .fps(fps): case let .fps(fps):
if fps > 60 { if fps > 60 {
@ -157,6 +176,11 @@ public final class SharedDisplayLinkDriver {
case .max: case .max:
frameRateRange = CAFrameRateRange(minimum: 30.0, maximum: 120.0, preferred: 120.0) frameRateRange = CAFrameRateRange(minimum: 30.0, maximum: 120.0, preferred: 120.0)
} }
if isIpad {
frameRateRange = CAFrameRateRange(minimum: 30.0, maximum: 120.0, preferred: 120.0)
}
if displayLink.preferredFrameRateRange != frameRateRange { if displayLink.preferredFrameRateRange != frameRateRange {
displayLink.preferredFrameRateRange = frameRateRange displayLink.preferredFrameRateRange = frameRateRange
print("SharedDisplayLinkDriver: switch to \(frameRateRange)") print("SharedDisplayLinkDriver: switch to \(frameRateRange)")

View File

@ -680,6 +680,7 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto
private var toLang: String? private var toLang: String?
private var allowDustEffect: Bool = true private var allowDustEffect: Bool = true
private var allowDustEffectForAllMessages: Bool = true
private var dustEffectLayer: DustEffectLayer? private var dustEffectLayer: DustEffectLayer?
public init(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>), chatLocation: ChatLocation, chatLocationContextHolder: Atomic<ChatLocationContextHolder?>, tagMask: MessageTags?, source: ChatHistoryListSource, subject: ChatControllerSubject?, controllerInteraction: ChatControllerInteraction, selectedMessages: Signal<Set<MessageId>?, NoError>, mode: ChatHistoryListMode = .bubbles, messageTransitionNode: @escaping () -> ChatMessageTransitionNodeImpl?) { public init(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>), chatLocation: ChatLocation, chatLocationContextHolder: Atomic<ChatLocationContextHolder?>, tagMask: MessageTags?, source: ChatHistoryListSource, subject: ChatControllerSubject?, controllerInteraction: ChatControllerInteraction, selectedMessages: Signal<Set<MessageId>?, NoError>, mode: ChatHistoryListMode = .bubbles, messageTransitionNode: @escaping () -> ChatMessageTransitionNodeImpl?) {
@ -706,6 +707,8 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto
} }
} }
self.allowDustEffectForAllMessages = context.sharedContext.immediateExperimentalUISettings.dustEffect
let presentationData = updatedPresentationData.initial let presentationData = updatedPresentationData.initial
self.currentPresentationData = ChatPresentationData(theme: ChatPresentationThemeData(theme: presentationData.theme, wallpaper: presentationData.chatWallpaper), fontSize: presentationData.chatFontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: true, largeEmoji: presentationData.largeEmoji, chatBubbleCorners: presentationData.chatBubbleCorners, animatedEmojiScale: 1.0) self.currentPresentationData = ChatPresentationData(theme: ChatPresentationThemeData(theme: presentationData.theme, wallpaper: presentationData.chatWallpaper), fontSize: presentationData.chatFontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: true, largeEmoji: presentationData.largeEmoji, chatBubbleCorners: presentationData.chatBubbleCorners, animatedEmojiScale: 1.0)
@ -3010,7 +3013,9 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto
expiredMessageStableIds.insert(message.stableId) expiredMessageStableIds.insert(message.stableId)
} }
} else { } else {
//expiredMessageStableIds.insert(message.stableId) if self.allowDustEffectForAllMessages {
expiredMessageStableIds.insert(message.stableId)
}
} }
} }
case let .MessageGroupEntry(_, messages, _): case let .MessageGroupEntry(_, messages, _):
@ -3028,7 +3033,9 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto
expiredMessageStableIds.insert(message.stableId) expiredMessageStableIds.insert(message.stableId)
} }
} else { } else {
//expiredMessageStableIds.insert(message.stableId) if self.allowDustEffectForAllMessages {
expiredMessageStableIds.insert(message.stableId)
}
} }
} }
default: default:

View File

@ -53,7 +53,7 @@ public struct ExperimentalUISettings: Codable, Equatable {
public var storiesExperiment: Bool public var storiesExperiment: Bool
public var storiesJpegExperiment: Bool public var storiesJpegExperiment: Bool
public var crashOnMemoryPressure: Bool public var crashOnMemoryPressure: Bool
public var unidirectionalSwipeToReply: Bool public var dustEffect: Bool
public var callV2: Bool public var callV2: Bool
public var alternativeStoryMedia: Bool public var alternativeStoryMedia: Bool
public var allowWebViewInspection: Bool public var allowWebViewInspection: Bool
@ -88,7 +88,7 @@ public struct ExperimentalUISettings: Codable, Equatable {
storiesExperiment: false, storiesExperiment: false,
storiesJpegExperiment: false, storiesJpegExperiment: false,
crashOnMemoryPressure: false, crashOnMemoryPressure: false,
unidirectionalSwipeToReply: false, dustEffect: false,
callV2: false, callV2: false,
alternativeStoryMedia: false, alternativeStoryMedia: false,
allowWebViewInspection: false allowWebViewInspection: false
@ -124,7 +124,7 @@ public struct ExperimentalUISettings: Codable, Equatable {
storiesExperiment: Bool, storiesExperiment: Bool,
storiesJpegExperiment: Bool, storiesJpegExperiment: Bool,
crashOnMemoryPressure: Bool, crashOnMemoryPressure: Bool,
unidirectionalSwipeToReply: Bool, dustEffect: Bool,
callV2: Bool, callV2: Bool,
alternativeStoryMedia: Bool, alternativeStoryMedia: Bool,
allowWebViewInspection: Bool allowWebViewInspection: Bool
@ -157,7 +157,7 @@ public struct ExperimentalUISettings: Codable, Equatable {
self.storiesExperiment = storiesExperiment self.storiesExperiment = storiesExperiment
self.storiesJpegExperiment = storiesJpegExperiment self.storiesJpegExperiment = storiesJpegExperiment
self.crashOnMemoryPressure = crashOnMemoryPressure self.crashOnMemoryPressure = crashOnMemoryPressure
self.unidirectionalSwipeToReply = unidirectionalSwipeToReply self.dustEffect = dustEffect
self.callV2 = callV2 self.callV2 = callV2
self.alternativeStoryMedia = alternativeStoryMedia self.alternativeStoryMedia = alternativeStoryMedia
self.allowWebViewInspection = allowWebViewInspection self.allowWebViewInspection = allowWebViewInspection
@ -194,7 +194,7 @@ public struct ExperimentalUISettings: Codable, Equatable {
self.storiesExperiment = try container.decodeIfPresent(Bool.self, forKey: "storiesExperiment") ?? false self.storiesExperiment = try container.decodeIfPresent(Bool.self, forKey: "storiesExperiment") ?? false
self.storiesJpegExperiment = try container.decodeIfPresent(Bool.self, forKey: "storiesJpegExperiment") ?? false self.storiesJpegExperiment = try container.decodeIfPresent(Bool.self, forKey: "storiesJpegExperiment") ?? false
self.crashOnMemoryPressure = try container.decodeIfPresent(Bool.self, forKey: "crashOnMemoryPressure") ?? false self.crashOnMemoryPressure = try container.decodeIfPresent(Bool.self, forKey: "crashOnMemoryPressure") ?? false
self.unidirectionalSwipeToReply = try container.decodeIfPresent(Bool.self, forKey: "unidirectionalSwipeToReply") ?? false self.dustEffect = try container.decodeIfPresent(Bool.self, forKey: "dustEffect") ?? false
self.callV2 = try container.decodeIfPresent(Bool.self, forKey: "callV2") ?? false self.callV2 = try container.decodeIfPresent(Bool.self, forKey: "callV2") ?? false
self.alternativeStoryMedia = try container.decodeIfPresent(Bool.self, forKey: "alternativeStoryMedia") ?? false self.alternativeStoryMedia = try container.decodeIfPresent(Bool.self, forKey: "alternativeStoryMedia") ?? false
self.allowWebViewInspection = try container.decodeIfPresent(Bool.self, forKey: "allowWebViewInspection") ?? false self.allowWebViewInspection = try container.decodeIfPresent(Bool.self, forKey: "allowWebViewInspection") ?? false
@ -231,7 +231,7 @@ public struct ExperimentalUISettings: Codable, Equatable {
try container.encode(self.storiesExperiment, forKey: "storiesExperiment") try container.encode(self.storiesExperiment, forKey: "storiesExperiment")
try container.encode(self.storiesJpegExperiment, forKey: "storiesJpegExperiment") try container.encode(self.storiesJpegExperiment, forKey: "storiesJpegExperiment")
try container.encode(self.crashOnMemoryPressure, forKey: "crashOnMemoryPressure") try container.encode(self.crashOnMemoryPressure, forKey: "crashOnMemoryPressure")
try container.encode(self.unidirectionalSwipeToReply, forKey: "unidirectionalSwipeToReply") try container.encode(self.dustEffect, forKey: "dustEffect")
try container.encode(self.callV2, forKey: "callV2") try container.encode(self.callV2, forKey: "callV2")
try container.encode(self.alternativeStoryMedia, forKey: "alternativeStoryMedia") try container.encode(self.alternativeStoryMedia, forKey: "alternativeStoryMedia")
try container.encode(self.allowWebViewInspection, forKey: "allowWebViewInspection") try container.encode(self.allowWebViewInspection, forKey: "allowWebViewInspection")

View File

@ -1,5 +1,6 @@
{ {
"app": "10.4", "app": "10.4",
"bazel": "6.4.0", "bazel": "6.4.0",
"xcode": "15.0" "xcode": "15.0",
"macos": "13.0"
} }