mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Adjust FPS on iPad
This commit is contained in:
parent
14fe674dfe
commit
2e666c5c2b
@ -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))
|
||||||
}
|
}
|
||||||
|
@ -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)")
|
||||||
|
@ -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:
|
||||||
|
@ -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")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user