mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Refactoring
This commit is contained in:
parent
f675add6f9
commit
2d66131682
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/TelegramAudio:TelegramAudio",
|
"//submodules/TelegramAudio:TelegramAudio",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
|
@ -536,7 +536,7 @@ public enum CreateGroupMode {
|
|||||||
case locatedGroup(latitude: Double, longitude: Double, address: String?)
|
case locatedGroup(latitude: Double, longitude: Double, address: String?)
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol AppLockContext: class {
|
public protocol AppLockContext: AnyObject {
|
||||||
var invalidAttempts: Signal<AccessChallengeAttempts?, NoError> { get }
|
var invalidAttempts: Signal<AccessChallengeAttempts?, NoError> { get }
|
||||||
var autolockDeadline: Signal<Int32?, NoError> { get }
|
var autolockDeadline: Signal<Int32?, NoError> { get }
|
||||||
|
|
||||||
@ -545,10 +545,10 @@ public protocol AppLockContext: class {
|
|||||||
func failedUnlockAttempt()
|
func failedUnlockAttempt()
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol RecentSessionsController: class {
|
public protocol RecentSessionsController: AnyObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol SharedAccountContext: class {
|
public protocol SharedAccountContext: AnyObject {
|
||||||
var sharedContainerPath: String { get }
|
var sharedContainerPath: String { get }
|
||||||
var basePath: String { get }
|
var basePath: String { get }
|
||||||
var mainWindow: Window1? { get }
|
var mainWindow: Window1? { get }
|
||||||
@ -703,16 +703,16 @@ public final class TonContext {
|
|||||||
public protocol ComposeController: ViewController {
|
public protocol ComposeController: ViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol ChatLocationContextHolder: class {
|
public protocol ChatLocationContextHolder: AnyObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol AccountGroupCallContext: class {
|
public protocol AccountGroupCallContext: AnyObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol AccountGroupCallContextCache: class {
|
public protocol AccountGroupCallContextCache: AnyObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol AccountContext: class {
|
public protocol AccountContext: AnyObject {
|
||||||
var sharedContext: SharedAccountContext { get }
|
var sharedContext: SharedAccountContext { get }
|
||||||
var account: Account { get }
|
var account: Account { get }
|
||||||
var engine: TelegramEngine { get }
|
var engine: TelegramEngine { get }
|
||||||
|
@ -6,7 +6,7 @@ import SwiftSignalKit
|
|||||||
|
|
||||||
public typealias DeviceContactStableId = String
|
public typealias DeviceContactStableId = String
|
||||||
|
|
||||||
public protocol DeviceContactDataManager: class {
|
public protocol DeviceContactDataManager: AnyObject {
|
||||||
func personNameDisplayOrder() -> Signal<PresentationPersonNameOrder, NoError>
|
func personNameDisplayOrder() -> Signal<PresentationPersonNameOrder, NoError>
|
||||||
func basicData() -> Signal<[DeviceContactStableId: DeviceContactBasicData], NoError>
|
func basicData() -> Signal<[DeviceContactStableId: DeviceContactBasicData], NoError>
|
||||||
func basicDataForNormalizedPhoneNumber(_ normalizedNumber: DeviceContactNormalizedPhoneNumber) -> Signal<[(DeviceContactStableId, DeviceContactBasicData)], NoError>
|
func basicDataForNormalizedPhoneNumber(_ normalizedNumber: DeviceContactNormalizedPhoneNumber) -> Signal<[(DeviceContactStableId, DeviceContactBasicData)], NoError>
|
||||||
|
@ -4,7 +4,7 @@ import Postbox
|
|||||||
import TelegramUIPreferences
|
import TelegramUIPreferences
|
||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
|
|
||||||
public protocol DownloadedMediaStoreManager: class {
|
public protocol DownloadedMediaStoreManager: AnyObject {
|
||||||
func store(_ media: AnyMediaReference, timestamp: Int32, peerType: MediaAutoDownloadPeerType)
|
func store(_ media: AnyMediaReference, timestamp: Int32, peerType: MediaAutoDownloadPeerType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@ public func isMediaStreamable(message: Message, media: TelegramMediaFile) -> Boo
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
for attribute in media.attributes {
|
for attribute in media.attributes {
|
||||||
if case let .Video(video) = attribute {
|
if case let .Video(_, _, flags) = attribute {
|
||||||
if video.flags.contains(.supportsStreaming) {
|
if flags.contains(.supportsStreaming) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
@ -41,8 +41,8 @@ public func isMediaStreamable(media: TelegramMediaFile) -> Bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
for attribute in media.attributes {
|
for attribute in media.attributes {
|
||||||
if case let .Video(video) = attribute {
|
if case let .Video(_, _, flags) = attribute {
|
||||||
if video.flags.contains(.supportsStreaming) {
|
if flags.contains(.supportsStreaming) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
@ -132,7 +132,7 @@ public enum MediaManagerPlayerType {
|
|||||||
case file
|
case file
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol MediaManager: class {
|
public protocol MediaManager: AnyObject {
|
||||||
var audioSession: ManagedAudioSession { get }
|
var audioSession: ManagedAudioSession { get }
|
||||||
var galleryHiddenMediaManager: GalleryHiddenMediaManager { get }
|
var galleryHiddenMediaManager: GalleryHiddenMediaManager { get }
|
||||||
var universalVideoManager: UniversalVideoManager { get }
|
var universalVideoManager: UniversalVideoManager { get }
|
||||||
@ -177,11 +177,11 @@ public enum GalleryHiddenMediaId: Hashable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol GalleryHiddenMediaTarget: class {
|
public protocol GalleryHiddenMediaTarget: AnyObject {
|
||||||
func getTransitionInfo(messageId: MessageId, media: Media) -> ((UIView) -> Void, ASDisplayNode, () -> (UIView?, UIView?))?
|
func getTransitionInfo(messageId: MessageId, media: Media) -> ((UIView) -> Void, ASDisplayNode, () -> (UIView?, UIView?))?
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol GalleryHiddenMediaManager: class {
|
public protocol GalleryHiddenMediaManager: AnyObject {
|
||||||
func hiddenIds() -> Signal<Set<GalleryHiddenMediaId>, NoError>
|
func hiddenIds() -> Signal<Set<GalleryHiddenMediaId>, NoError>
|
||||||
func addSource(_ signal: Signal<GalleryHiddenMediaId?, NoError>) -> Int
|
func addSource(_ signal: Signal<GalleryHiddenMediaId?, NoError>) -> Int
|
||||||
func removeSource(_ index: Int)
|
func removeSource(_ index: Int)
|
||||||
@ -190,7 +190,7 @@ public protocol GalleryHiddenMediaManager: class {
|
|||||||
func findTarget(messageId: MessageId, media: Media) -> ((UIView) -> Void, ASDisplayNode, () -> (UIView?, UIView?))?
|
func findTarget(messageId: MessageId, media: Media) -> ((UIView) -> Void, ASDisplayNode, () -> (UIView?, UIView?))?
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol UniversalVideoManager: class {
|
public protocol UniversalVideoManager: AnyObject {
|
||||||
func attachUniversalVideoContent(content: UniversalVideoContent, priority: UniversalVideoPriority, create: () -> UniversalVideoContentNode & ASDisplayNode, update: @escaping (((UniversalVideoContentNode & ASDisplayNode), Bool)?) -> Void) -> (AnyHashable, Int32)
|
func attachUniversalVideoContent(content: UniversalVideoContent, priority: UniversalVideoPriority, create: () -> UniversalVideoContentNode & ASDisplayNode, update: @escaping (((UniversalVideoContentNode & ASDisplayNode), Bool)?) -> Void) -> (AnyHashable, Int32)
|
||||||
func detachUniversalVideoContent(id: AnyHashable, index: Int32)
|
func detachUniversalVideoContent(id: AnyHashable, index: Int32)
|
||||||
func withUniversalVideoContent(id: AnyHashable, _ f: ((UniversalVideoContentNode & ASDisplayNode)?) -> Void)
|
func withUniversalVideoContent(id: AnyHashable, _ f: ((UniversalVideoContentNode & ASDisplayNode)?) -> Void)
|
||||||
@ -218,7 +218,7 @@ public struct RecordedAudioData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol ManagedAudioRecorder: class {
|
public protocol ManagedAudioRecorder: AnyObject {
|
||||||
var beginWithTone: Bool { get }
|
var beginWithTone: Bool { get }
|
||||||
var micLevel: Signal<Float, NoError> { get }
|
var micLevel: Signal<Float, NoError> { get }
|
||||||
var recordingState: Signal<AudioRecordingState, NoError> { get }
|
var recordingState: Signal<AudioRecordingState, NoError> { get }
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public protocol OverlayAudioPlayerController: class {
|
public protocol OverlayAudioPlayerController: AnyObject {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ public final class OverlayMediaControllerEmbeddingItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol OverlayMediaController: class {
|
public protocol OverlayMediaController: AnyObject {
|
||||||
var updatePossibleEmbeddingItem: ((OverlayMediaControllerEmbeddingItem?) -> Void)? { get set }
|
var updatePossibleEmbeddingItem: ((OverlayMediaControllerEmbeddingItem?) -> Void)? { get set }
|
||||||
var embedPossibleEmbeddingItem: ((OverlayMediaControllerEmbeddingItem) -> Bool)? { get set }
|
var embedPossibleEmbeddingItem: ((OverlayMediaControllerEmbeddingItem) -> Bool)? { get set }
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ public final class PresentationCallVideoView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol PresentationCall: class {
|
public protocol PresentationCall: AnyObject {
|
||||||
var context: AccountContext { get }
|
var context: AccountContext { get }
|
||||||
var isIntegratedWithCallKit: Bool { get }
|
var isIntegratedWithCallKit: Bool { get }
|
||||||
var internalId: CallSessionInternalId { get }
|
var internalId: CallSessionInternalId { get }
|
||||||
@ -391,7 +391,7 @@ public extension GroupCallParticipantsContext.Participant {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol PresentationGroupCall: class {
|
public protocol PresentationGroupCall: AnyObject {
|
||||||
var account: Account { get }
|
var account: Account { get }
|
||||||
var accountContext: AccountContext { get }
|
var accountContext: AccountContext { get }
|
||||||
var internalId: CallSessionInternalId { get }
|
var internalId: CallSessionInternalId { get }
|
||||||
|
@ -156,7 +156,7 @@ public protocol SharedMediaPlaylistLocation {
|
|||||||
func isEqual(to: SharedMediaPlaylistLocation) -> Bool
|
func isEqual(to: SharedMediaPlaylistLocation) -> Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol SharedMediaPlaylist: class {
|
public protocol SharedMediaPlaylist: AnyObject {
|
||||||
var id: SharedMediaPlaylistId { get }
|
var id: SharedMediaPlaylistId { get }
|
||||||
var location: SharedMediaPlaylistLocation { get }
|
var location: SharedMediaPlaylistLocation { get }
|
||||||
var state: Signal<SharedMediaPlaylistState, NoError> { get }
|
var state: Signal<SharedMediaPlaylistState, NoError> { get }
|
||||||
|
@ -3,5 +3,5 @@ import SwiftSignalKit
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
|
||||||
public protocol ThemeUpdateManager: class {
|
public protocol ThemeUpdateManager: AnyObject {
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import Display
|
|||||||
import TelegramAudio
|
import TelegramAudio
|
||||||
import UniversalMediaPlayer
|
import UniversalMediaPlayer
|
||||||
|
|
||||||
public protocol UniversalVideoContentNode: class {
|
public protocol UniversalVideoContentNode: AnyObject {
|
||||||
var ready: Signal<Void, NoError> { get }
|
var ready: Signal<Void, NoError> { get }
|
||||||
var status: Signal<MediaPlayerStatus, NoError> { get }
|
var status: Signal<MediaPlayerStatus, NoError> { get }
|
||||||
var bufferingStatus: Signal<(IndexSet, Int)?, NoError> { get }
|
var bufferingStatus: Signal<(IndexSet, Int)?, NoError> { get }
|
||||||
@ -47,7 +47,7 @@ public extension UniversalVideoContent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol UniversalVideoDecoration: class {
|
public protocol UniversalVideoDecoration: AnyObject {
|
||||||
var backgroundNode: ASDisplayNode? { get }
|
var backgroundNode: ASDisplayNode? { get }
|
||||||
var contentContainerNode: ASDisplayNode { get }
|
var contentContainerNode: ASDisplayNode { get }
|
||||||
var foregroundNode: ASDisplayNode? { get }
|
var foregroundNode: ASDisplayNode? { get }
|
||||||
|
@ -18,7 +18,7 @@ public enum WallpaperUploadManagerStatus {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol WallpaperUploadManager: class {
|
public protocol WallpaperUploadManager: AnyObject {
|
||||||
func stateSignal() -> Signal<WallpaperUploadManagerStatus, NoError>
|
func stateSignal() -> Signal<WallpaperUploadManagerStatus, NoError>
|
||||||
func presentationDataUpdated(_ presentationData: PresentationData)
|
func presentationDataUpdated(_ presentationData: PresentationData)
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ public struct WatchRunningTasks: Equatable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol WatchManager: class {
|
public protocol WatchManager: AnyObject {
|
||||||
var watchAppInstalled: Signal<Bool, NoError> { get }
|
var watchAppInstalled: Signal<Bool, NoError> { get }
|
||||||
var navigateToMessageRequested: Signal<MessageId, NoError> { get }
|
var navigateToMessageRequested: Signal<MessageId, NoError> { get }
|
||||||
var runningTasks: Signal<WatchRunningTasks?, NoError> { get }
|
var runningTasks: Signal<WatchRunningTasks?, NoError> { get }
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/Postbox:Postbox",
|
"//submodules/Postbox:Postbox",
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/TelegramCore:TelegramCore",
|
"//submodules/TelegramCore:TelegramCore",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
],
|
],
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
|
@ -88,7 +88,7 @@ public final class AnimatedStickerFrame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol AnimatedStickerFrameSource: class {
|
public protocol AnimatedStickerFrameSource: AnyObject {
|
||||||
var frameRate: Int { get }
|
var frameRate: Int { get }
|
||||||
var frameCount: Int { get }
|
var frameCount: Int { get }
|
||||||
var frameIndex: Int { get }
|
var frameIndex: Int { get }
|
||||||
@ -139,7 +139,10 @@ public final class AnimatedStickerCachedFrameSource: AnimatedStickerFrameSource
|
|||||||
var frameRate = 0
|
var frameRate = 0
|
||||||
var frameCount = 0
|
var frameCount = 0
|
||||||
|
|
||||||
if !self.data.withUnsafeBytes({ (bytes: UnsafePointer<UInt8>) -> Bool in
|
if !self.data.withUnsafeBytes({ buffer -> Bool in
|
||||||
|
guard let bytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
var frameRateValue: Int32 = 0
|
var frameRateValue: Int32 = 0
|
||||||
var frameCountValue: Int32 = 0
|
var frameCountValue: Int32 = 0
|
||||||
var widthValue: Int32 = 0
|
var widthValue: Int32 = 0
|
||||||
@ -180,7 +183,10 @@ public final class AnimatedStickerCachedFrameSource: AnimatedStickerFrameSource
|
|||||||
self.decodeBuffer = Data(count: self.bytesPerRow * height)
|
self.decodeBuffer = Data(count: self.bytesPerRow * height)
|
||||||
self.frameBuffer = Data(count: self.bytesPerRow * height)
|
self.frameBuffer = Data(count: self.bytesPerRow * height)
|
||||||
let frameBufferLength = self.frameBuffer.count
|
let frameBufferLength = self.frameBuffer.count
|
||||||
self.frameBuffer.withUnsafeMutableBytes { (bytes: UnsafeMutablePointer<UInt8>) -> Void in
|
self.frameBuffer.withUnsafeMutableBytes { buffer -> Void in
|
||||||
|
guard let bytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
memset(bytes, 0, frameBufferLength)
|
memset(bytes, 0, frameBufferLength)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,12 +205,19 @@ public final class AnimatedStickerCachedFrameSource: AnimatedStickerFrameSource
|
|||||||
|
|
||||||
let frameIndex = self.frameIndex
|
let frameIndex = self.frameIndex
|
||||||
|
|
||||||
self.data.withUnsafeBytes { (bytes: UnsafePointer<UInt8>) -> Void in
|
self.data.withUnsafeBytes { buffer -> Void in
|
||||||
|
guard let bytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if self.offset + 4 > dataLength {
|
if self.offset + 4 > dataLength {
|
||||||
if self.dataComplete {
|
if self.dataComplete {
|
||||||
self.frameIndex = 0
|
self.frameIndex = 0
|
||||||
self.offset = self.initialOffset
|
self.offset = self.initialOffset
|
||||||
self.frameBuffer.withUnsafeMutableBytes { (bytes: UnsafeMutablePointer<UInt8>) -> Void in
|
self.frameBuffer.withUnsafeMutableBytes { buffer -> Void in
|
||||||
|
guard let bytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
memset(bytes, 0, frameBufferLength)
|
memset(bytes, 0, frameBufferLength)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -221,9 +234,21 @@ public final class AnimatedStickerCachedFrameSource: AnimatedStickerFrameSource
|
|||||||
self.offset += 4
|
self.offset += 4
|
||||||
|
|
||||||
if draw {
|
if draw {
|
||||||
self.scratchBuffer.withUnsafeMutableBytes { (scratchBytes: UnsafeMutablePointer<UInt8>) -> Void in
|
self.scratchBuffer.withUnsafeMutableBytes { scratchBuffer -> Void in
|
||||||
self.decodeBuffer.withUnsafeMutableBytes { (decodeBytes: UnsafeMutablePointer<UInt8>) -> Void in
|
guard let scratchBytes = scratchBuffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||||
self.frameBuffer.withUnsafeMutableBytes { (frameBytes: UnsafeMutablePointer<UInt8>) -> Void in
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
self.decodeBuffer.withUnsafeMutableBytes { decodeBuffer -> Void in
|
||||||
|
guard let decodeBytes = decodeBuffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
self.frameBuffer.withUnsafeMutableBytes { frameBuffer -> Void in
|
||||||
|
guard let frameBytes = frameBuffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
compression_decode_buffer(decodeBytes, decodeBufferLength, bytes.advanced(by: self.offset), Int(frameLength), UnsafeMutableRawPointer(scratchBytes), COMPRESSION_LZFSE)
|
compression_decode_buffer(decodeBytes, decodeBufferLength, bytes.advanced(by: self.offset), Int(frameLength), UnsafeMutableRawPointer(scratchBytes), COMPRESSION_LZFSE)
|
||||||
|
|
||||||
var lhs = UnsafeMutableRawPointer(frameBytes).assumingMemoryBound(to: UInt64.self)
|
var lhs = UnsafeMutableRawPointer(frameBytes).assumingMemoryBound(to: UInt64.self)
|
||||||
@ -253,7 +278,10 @@ public final class AnimatedStickerCachedFrameSource: AnimatedStickerFrameSource
|
|||||||
isLastFrame = true
|
isLastFrame = true
|
||||||
self.frameIndex = 0
|
self.frameIndex = 0
|
||||||
self.offset = self.initialOffset
|
self.offset = self.initialOffset
|
||||||
self.frameBuffer.withUnsafeMutableBytes { (bytes: UnsafeMutablePointer<UInt8>) -> Void in
|
self.frameBuffer.withUnsafeMutableBytes { buffer -> Void in
|
||||||
|
guard let bytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
memset(bytes, 0, frameBufferLength)
|
memset(bytes, 0, frameBufferLength)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -351,7 +379,10 @@ private final class ManagedFileImpl {
|
|||||||
assert(queue.isCurrent())
|
assert(queue.isCurrent())
|
||||||
}
|
}
|
||||||
var result = Data(count: count)
|
var result = Data(count: count)
|
||||||
result.withUnsafeMutableBytes { (bytes: UnsafeMutablePointer<Int8>) -> Void in
|
result.withUnsafeMutableBytes { buffer -> Void in
|
||||||
|
guard let bytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
let readCount = self.read(bytes, count)
|
let readCount = self.read(bytes, count)
|
||||||
assert(readCount == count)
|
assert(readCount == count)
|
||||||
}
|
}
|
||||||
@ -399,7 +430,7 @@ private func compressFrame(width: Int, height: Int, rgbData: Data) -> Data? {
|
|||||||
assert(yuvaPixelsPerAlphaRow % 2 == 0)
|
assert(yuvaPixelsPerAlphaRow % 2 == 0)
|
||||||
|
|
||||||
let yuvaLength = Int(width) * Int(height) * 2 + yuvaPixelsPerAlphaRow * Int(height) / 2
|
let yuvaLength = Int(width) * Int(height) * 2 + yuvaPixelsPerAlphaRow * Int(height) / 2
|
||||||
var yuvaFrameData = malloc(yuvaLength)!
|
let yuvaFrameData = malloc(yuvaLength)!
|
||||||
defer {
|
defer {
|
||||||
free(yuvaFrameData)
|
free(yuvaFrameData)
|
||||||
}
|
}
|
||||||
@ -422,7 +453,10 @@ private func compressFrame(width: Int, height: Int, rgbData: Data) -> Data? {
|
|||||||
|
|
||||||
var maybeResultSize: Int?
|
var maybeResultSize: Int?
|
||||||
|
|
||||||
compressedFrameData.withUnsafeMutableBytes { (bytes: UnsafeMutablePointer<UInt8>) -> Void in
|
compressedFrameData.withUnsafeMutableBytes { buffer -> Void in
|
||||||
|
guard let bytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
let length = compression_encode_buffer(bytes, compressedFrameDataLength, yuvaFrameData.assumingMemoryBound(to: UInt8.self), yuvaLength, scratchData, COMPRESSION_LZFSE)
|
let length = compression_encode_buffer(bytes, compressedFrameDataLength, yuvaFrameData.assumingMemoryBound(to: UInt8.self), yuvaLength, scratchData, COMPRESSION_LZFSE)
|
||||||
maybeResultSize = length
|
maybeResultSize = length
|
||||||
}
|
}
|
||||||
@ -579,9 +613,21 @@ private final class AnimatedStickerDirectFrameSourceCache {
|
|||||||
|
|
||||||
let decodeBufferLength = self.decodeBuffer.count
|
let decodeBufferLength = self.decodeBuffer.count
|
||||||
|
|
||||||
compressedData.withUnsafeBytes { (bytes: UnsafePointer<UInt8>) -> Void in
|
compressedData.withUnsafeBytes { buffer -> Void in
|
||||||
self.scratchBuffer.withUnsafeMutableBytes { (scratchBytes: UnsafeMutablePointer<UInt8>) -> Void in
|
guard let bytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||||
self.decodeBuffer.withUnsafeMutableBytes { (decodeBytes: UnsafeMutablePointer<UInt8>) -> Void in
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
self.scratchBuffer.withUnsafeMutableBytes { scratchBuffer -> Void in
|
||||||
|
guard let scratchBytes = scratchBuffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
self.decodeBuffer.withUnsafeMutableBytes { decodeBuffer -> Void in
|
||||||
|
guard let decodeBytes = decodeBuffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
let resultLength = compression_decode_buffer(decodeBytes, decodeBufferLength, bytes, length, UnsafeMutableRawPointer(scratchBytes), COMPRESSION_LZFSE)
|
let resultLength = compression_decode_buffer(decodeBytes, decodeBufferLength, bytes, length, UnsafeMutableRawPointer(scratchBytes), COMPRESSION_LZFSE)
|
||||||
|
|
||||||
frameData = Data(bytes: decodeBytes, count: resultLength)
|
frameData = Data(bytes: decodeBytes, count: resultLength)
|
||||||
@ -644,7 +690,11 @@ private final class AnimatedStickerDirectFrameSource: AnimatedStickerFrameSource
|
|||||||
return AnimatedStickerFrame(data: yuvData, type: .yuva, width: self.width, height: self.height, bytesPerRow: 0, index: frameIndex, isLastFrame: frameIndex == self.frameCount - 1, totalFrames: self.frameCount)
|
return AnimatedStickerFrame(data: yuvData, type: .yuva, width: self.width, height: self.height, bytesPerRow: 0, index: frameIndex, isLastFrame: frameIndex == self.frameCount - 1, totalFrames: self.frameCount)
|
||||||
} else {
|
} else {
|
||||||
var frameData = Data(count: self.bytesPerRow * self.height)
|
var frameData = Data(count: self.bytesPerRow * self.height)
|
||||||
frameData.withUnsafeMutableBytes { (bytes: UnsafeMutablePointer<UInt8>) -> Void in
|
frameData.withUnsafeMutableBytes { buffer -> Void in
|
||||||
|
guard let bytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
memset(bytes, 0, self.bytesPerRow * self.height)
|
memset(bytes, 0, self.bytesPerRow * self.height)
|
||||||
self.animation.renderFrame(with: Int32(frameIndex), into: bytes, width: Int32(self.width), height: Int32(self.height), bytesPerRow: Int32(self.bytesPerRow))
|
self.animation.renderFrame(with: Int32(frameIndex), into: bytes, width: Int32(self.width), height: Int32(self.height), bytesPerRow: Int32(self.bytesPerRow))
|
||||||
}
|
}
|
||||||
@ -853,7 +903,7 @@ public final class AnimatedStickerNode: ASDisplayNode {
|
|||||||
strongSelf.isSetUpForPlayback = false
|
strongSelf.isSetUpForPlayback = false
|
||||||
strongSelf.isPlaying = true
|
strongSelf.isPlaying = true
|
||||||
}
|
}
|
||||||
var fromIndex = strongSelf.playFromIndex
|
let fromIndex = strongSelf.playFromIndex
|
||||||
strongSelf.playFromIndex = nil
|
strongSelf.playFromIndex = nil
|
||||||
strongSelf.play(fromIndex: fromIndex)
|
strongSelf.play(fromIndex: fromIndex)
|
||||||
} else if strongSelf.canDisplayFirstFrame {
|
} else if strongSelf.canDisplayFirstFrame {
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
"//submodules/rlottie:RLottieBinding",
|
"//submodules/rlottie:RLottieBinding",
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
|
@ -150,7 +150,7 @@ public final class AppLockContextImpl: AppLockContext {
|
|||||||
strongSelf.autolockTimeout.set(nil)
|
strongSelf.autolockTimeout.set(nil)
|
||||||
strongSelf.autolockReportTimeout.set(nil)
|
strongSelf.autolockReportTimeout.set(nil)
|
||||||
} else {
|
} else {
|
||||||
if let autolockTimeout = passcodeSettings.autolockTimeout, !appInForeground {
|
if let _ = passcodeSettings.autolockTimeout, !appInForeground {
|
||||||
shouldDisplayCoveringView = true
|
shouldDisplayCoveringView = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ public final class AppLockContextImpl: AppLockContext {
|
|||||||
}
|
}
|
||||||
passcodeController.ensureInputFocused()
|
passcodeController.ensureInputFocused()
|
||||||
} else {
|
} else {
|
||||||
let passcodeController = PasscodeEntryController(applicationBindings: strongSelf.applicationBindings, accountManager: strongSelf.accountManager, appLockContext: strongSelf, presentationData: presentationData, presentationDataSignal: strongSelf.presentationDataSignal, statusBarHost: window?.statusBarHost, challengeData: accessChallengeData.data, biometrics: biometrics, arguments: PasscodeEntryControllerPresentationArguments(animated: !becameActiveRecently, lockIconInitialFrame: { [weak self] in
|
let passcodeController = PasscodeEntryController(applicationBindings: strongSelf.applicationBindings, accountManager: strongSelf.accountManager, appLockContext: strongSelf, presentationData: presentationData, presentationDataSignal: strongSelf.presentationDataSignal, statusBarHost: window?.statusBarHost, challengeData: accessChallengeData.data, biometrics: biometrics, arguments: PasscodeEntryControllerPresentationArguments(animated: !becameActiveRecently, lockIconInitialFrame: {
|
||||||
if let lockViewFrame = lockIconInitialFrame() {
|
if let lockViewFrame = lockIconInitialFrame() {
|
||||||
return lockViewFrame
|
return lockViewFrame
|
||||||
} else {
|
} else {
|
||||||
@ -203,7 +203,7 @@ public final class AppLockContextImpl: AppLockContext {
|
|||||||
passcodeController.isOpaqueWhenInOverlay = true
|
passcodeController.isOpaqueWhenInOverlay = true
|
||||||
strongSelf.passcodeController = passcodeController
|
strongSelf.passcodeController = passcodeController
|
||||||
if let rootViewController = strongSelf.rootController {
|
if let rootViewController = strongSelf.rootController {
|
||||||
if let presentedViewController = rootViewController.presentedViewController as? UIActivityViewController {
|
if let _ = rootViewController.presentedViewController as? UIActivityViewController {
|
||||||
} else {
|
} else {
|
||||||
rootViewController.dismiss(animated: false, completion: nil)
|
rootViewController.dismiss(animated: false, completion: nil)
|
||||||
}
|
}
|
||||||
@ -227,14 +227,14 @@ public final class AppLockContextImpl: AppLockContext {
|
|||||||
window.coveringView = coveringView
|
window.coveringView = coveringView
|
||||||
|
|
||||||
if let rootViewController = strongSelf.rootController {
|
if let rootViewController = strongSelf.rootController {
|
||||||
if let presentedViewController = rootViewController.presentedViewController as? UIActivityViewController {
|
if let _ = rootViewController.presentedViewController as? UIActivityViewController {
|
||||||
} else {
|
} else {
|
||||||
rootViewController.dismiss(animated: false, completion: nil)
|
rootViewController.dismiss(animated: false, completion: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if let coveringView = strongSelf.coveringView {
|
if let _ = strongSelf.coveringView {
|
||||||
strongSelf.coveringView = nil
|
strongSelf.coveringView = nil
|
||||||
strongSelf.window?.coveringView = nil
|
strongSelf.window?.coveringView = nil
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
|
@ -151,14 +151,14 @@ private final class ArchivedStickersNoticeAlertContentNode: AlertContentNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func dequeueTransition() {
|
private func dequeueTransition() {
|
||||||
guard let layout = self.validLayout, let transition = self.enqueuedTransitions.first else {
|
guard let _ = self.validLayout, let transition = self.enqueuedTransitions.first else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.enqueuedTransitions.remove(at: 0)
|
self.enqueuedTransitions.remove(at: 0)
|
||||||
|
|
||||||
var options = ListViewDeleteAndInsertOptions()
|
let options = ListViewDeleteAndInsertOptions()
|
||||||
|
|
||||||
self.listView.transaction(deleteIndices: transition.deletions, insertIndicesAndItems: transition.insertions, updateIndicesAndItems: transition.updates, options: options, updateSizeAndInsets: nil, updateOpaqueState: nil, completion: { [weak self] _ in
|
self.listView.transaction(deleteIndices: transition.deletions, insertIndicesAndItems: transition.insertions, updateIndicesAndItems: transition.updates, options: options, updateSizeAndInsets: nil, updateOpaqueState: nil, completion: { _ in
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,14 +302,14 @@ public func archivedStickerPacksNoticeController(context: AccountContext, archiv
|
|||||||
})])
|
})])
|
||||||
|
|
||||||
let controller = AlertController(theme: AlertControllerTheme(presentationData: presentationData), contentNode: contentNode)
|
let controller = AlertController(theme: AlertControllerTheme(presentationData: presentationData), contentNode: contentNode)
|
||||||
let presentationDataDisposable = context.sharedContext.presentationData.start(next: { [weak controller, weak contentNode] presentationData in
|
let presentationDataDisposable = context.sharedContext.presentationData.start(next: { [weak controller] presentationData in
|
||||||
controller?.theme = AlertControllerTheme(presentationData: presentationData)
|
controller?.theme = AlertControllerTheme(presentationData: presentationData)
|
||||||
})
|
})
|
||||||
controller.dismissed = {
|
controller.dismissed = {
|
||||||
presentationDataDisposable.dispose()
|
presentationDataDisposable.dispose()
|
||||||
disposable.dispose()
|
disposable.dispose()
|
||||||
}
|
}
|
||||||
dismissImpl = { [weak controller, weak contentNode] in
|
dismissImpl = { [weak controller] in
|
||||||
controller?.dismissAnimated()
|
controller?.dismissAnimated()
|
||||||
}
|
}
|
||||||
return controller
|
return controller
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/TelegramCore:TelegramCore",
|
"//submodules/TelegramCore:TelegramCore",
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
|
@ -253,12 +253,10 @@ private final class AuthDataTransferSplashScreenNode: ViewControllerTracingNode
|
|||||||
let animationFitSize = CGSize(width: min(500.0, layout.size.width - sideInset + 20.0), height: 500.0)
|
let animationFitSize = CGSize(width: min(500.0, layout.size.width - sideInset + 20.0), height: 500.0)
|
||||||
let animationSize = self.animationNode?.preferredSize()?.fitted(animationFitSize) ?? animationFitSize
|
let animationSize = self.animationNode?.preferredSize()?.fitted(animationFitSize) ?? animationFitSize
|
||||||
let iconSize: CGSize = animationSize
|
let iconSize: CGSize = animationSize
|
||||||
var iconOffset = CGPoint()
|
let iconOffset = CGPoint()
|
||||||
|
|
||||||
let titleSize = self.titleNode.updateLayout(CGSize(width: layout.size.width - sideInset * 2.0, height: layout.size.height))
|
let titleSize = self.titleNode.updateLayout(CGSize(width: layout.size.width - sideInset * 2.0, height: layout.size.height))
|
||||||
|
|
||||||
let hasRTL = self.badgeTextNodes.first?.cachedLayout?.hasRTL ?? false
|
|
||||||
|
|
||||||
var badgeTextSizes: [CGSize] = []
|
var badgeTextSizes: [CGSize] = []
|
||||||
var textSizes: [CGSize] = []
|
var textSizes: [CGSize] = []
|
||||||
var textContentHeight: CGFloat = 0.0
|
var textContentHeight: CGFloat = 0.0
|
||||||
@ -290,9 +288,9 @@ private final class AuthDataTransferSplashScreenNode: ViewControllerTracingNode
|
|||||||
|
|
||||||
let buttonFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - buttonWidth) / 2.0), y: layout.size.height - bottomInset - buttonHeight), size: CGSize(width: buttonWidth, height: buttonHeight))
|
let buttonFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - buttonWidth) / 2.0), y: layout.size.height - bottomInset - buttonHeight), size: CGSize(width: buttonWidth, height: buttonHeight))
|
||||||
transition.updateFrame(node: self.buttonNode, frame: buttonFrame)
|
transition.updateFrame(node: self.buttonNode, frame: buttonFrame)
|
||||||
self.buttonNode.updateLayout(width: buttonFrame.width, transition: transition)
|
let _ = self.buttonNode.updateLayout(width: buttonFrame.width, transition: transition)
|
||||||
|
|
||||||
var maxContentVerticalOrigin = buttonFrame.minY - 12.0 - contentHeight
|
let maxContentVerticalOrigin = buttonFrame.minY - 12.0 - contentHeight
|
||||||
|
|
||||||
contentVerticalOrigin = min(contentVerticalOrigin, maxContentVerticalOrigin)
|
contentVerticalOrigin = min(contentVerticalOrigin, maxContentVerticalOrigin)
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ private func generateFrameImage() -> UIImage? {
|
|||||||
context.setLineWidth(4.0)
|
context.setLineWidth(4.0)
|
||||||
context.setLineCap(.round)
|
context.setLineCap(.round)
|
||||||
|
|
||||||
var path = CGMutablePath();
|
let path = CGMutablePath()
|
||||||
path.move(to: CGPoint(x: 2.0, y: 2.0 + 26.0))
|
path.move(to: CGPoint(x: 2.0, y: 2.0 + 26.0))
|
||||||
path.addArc(tangent1End: CGPoint(x: 2.0, y: 2.0), tangent2End: CGPoint(x: 2.0 + 26.0, y: 2.0), radius: 6.0)
|
path.addArc(tangent1End: CGPoint(x: 2.0, y: 2.0), tangent2End: CGPoint(x: 2.0 + 26.0, y: 2.0), radius: 6.0)
|
||||||
path.addLine(to: CGPoint(x: 2.0 + 26.0, y: 2.0))
|
path.addLine(to: CGPoint(x: 2.0 + 26.0, y: 2.0))
|
||||||
@ -412,8 +412,8 @@ private final class AuthTransferScanScreenNode: ViewControllerTracingNode, UIScr
|
|||||||
let dimAlpha: CGFloat
|
let dimAlpha: CGFloat
|
||||||
let dimRect: CGRect
|
let dimRect: CGRect
|
||||||
let controlsAlpha: CGFloat
|
let controlsAlpha: CGFloat
|
||||||
var centerDimAlpha: CGFloat = 0.0
|
let centerDimAlpha: CGFloat = 0.0
|
||||||
var frameAlpha: CGFloat = 1.0
|
let frameAlpha: CGFloat = 1.0
|
||||||
if let focusedRect = self.focusedRect {
|
if let focusedRect = self.focusedRect {
|
||||||
controlsAlpha = 0.0
|
controlsAlpha = 0.0
|
||||||
dimAlpha = 1.0
|
dimAlpha = 1.0
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
"//submodules/TelegramCore:TelegramCore",
|
"//submodules/TelegramCore:TelegramCore",
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
|
@ -60,8 +60,7 @@ public func peerAvatarImageData(account: Account, peerReference: PeerReference?,
|
|||||||
subscriber.putNext(nil)
|
subscriber.putNext(nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, error: { error in
|
}, error: { _ in
|
||||||
subscriber.putError(error)
|
|
||||||
}, completed: {
|
}, completed: {
|
||||||
subscriber.putCompletion()
|
subscriber.putCompletion()
|
||||||
})
|
})
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/TelegramCore:TelegramCore",
|
"//submodules/TelegramCore:TelegramCore",
|
||||||
|
@ -55,7 +55,7 @@ final class BotCheckoutActionButton: HighlightableButtonNode {
|
|||||||
let previousState = self.state
|
let previousState = self.state
|
||||||
self.state = state
|
self.state = state
|
||||||
|
|
||||||
if let (absoluteRect, containerSize) = self.validLayout, let previousState = previousState {
|
if let (absoluteRect, containerSize) = self.validLayout, let _ = previousState {
|
||||||
self.updateLayout(absoluteRect: absoluteRect, containerSize: containerSize, transition: .immediate)
|
self.updateLayout(absoluteRect: absoluteRect, containerSize: containerSize, transition: .immediate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,6 @@ final class BotCheckoutPaymentMethodSheetController: ActionSheetController {
|
|||||||
|
|
||||||
init(context: AccountContext, currentMethod: BotCheckoutPaymentMethod?, methods: [BotCheckoutPaymentMethod], applyValue: @escaping (BotCheckoutPaymentMethod) -> Void, newCard: @escaping () -> Void) {
|
init(context: AccountContext, currentMethod: BotCheckoutPaymentMethod?, methods: [BotCheckoutPaymentMethod], applyValue: @escaping (BotCheckoutPaymentMethod) -> Void, newCard: @escaping () -> Void) {
|
||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
let theme = presentationData.theme
|
|
||||||
let strings = presentationData.strings
|
let strings = presentationData.strings
|
||||||
|
|
||||||
super.init(theme: ActionSheetControllerTheme(presentationData: presentationData))
|
super.init(theme: ActionSheetControllerTheme(presentationData: presentationData))
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
|
@ -321,7 +321,7 @@ final class CallListControllerNode: ASDisplayNode {
|
|||||||
}, openInfo: { [weak self] peerId, messages in
|
}, openInfo: { [weak self] peerId, messages in
|
||||||
self?.openInfo(peerId, messages)
|
self?.openInfo(peerId, messages)
|
||||||
}, delete: { [weak self] messageIds in
|
}, delete: { [weak self] messageIds in
|
||||||
guard let strongSelf = self, let peerId = messageIds.first?.peerId else {
|
guard let peerId = messageIds.first?.peerId else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let _ = (context.engine.data.get(
|
let _ = (context.engine.data.get(
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
],
|
],
|
||||||
visibility = [
|
visibility = [
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
|
@ -6,11 +6,13 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
"//submodules/Postbox:Postbox",
|
|
||||||
"//submodules/TelegramCore:TelegramCore",
|
"//submodules/TelegramCore:TelegramCore",
|
||||||
"//submodules/TextFormat:TextFormat",
|
"//submodules/TextFormat:TextFormat",
|
||||||
"//submodules/AccountContext:AccountContext",
|
"//submodules/AccountContext:AccountContext",
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import UIKit
|
import UIKit
|
||||||
import Postbox
|
|
||||||
import TelegramCore
|
import TelegramCore
|
||||||
import TextFormat
|
import TextFormat
|
||||||
import AccountContext
|
import AccountContext
|
||||||
@ -12,13 +11,13 @@ public enum ChatTextInputMediaRecordingButtonMode: Int32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public struct ChatInterfaceSelectionState: Codable, Equatable {
|
public struct ChatInterfaceSelectionState: Codable, Equatable {
|
||||||
public let selectedIds: Set<MessageId>
|
public let selectedIds: Set<EngineMessage.Id>
|
||||||
|
|
||||||
public static func ==(lhs: ChatInterfaceSelectionState, rhs: ChatInterfaceSelectionState) -> Bool {
|
public static func ==(lhs: ChatInterfaceSelectionState, rhs: ChatInterfaceSelectionState) -> Bool {
|
||||||
return lhs.selectedIds == rhs.selectedIds
|
return lhs.selectedIds == rhs.selectedIds
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(selectedIds: Set<MessageId>) {
|
public init(selectedIds: Set<EngineMessage.Id>) {
|
||||||
self.selectedIds = selectedIds
|
self.selectedIds = selectedIds
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ public struct ChatInterfaceSelectionState: Codable, Equatable {
|
|||||||
let container = try decoder.container(keyedBy: StringCodingKey.self)
|
let container = try decoder.container(keyedBy: StringCodingKey.self)
|
||||||
|
|
||||||
if let data = try? container.decodeIfPresent(Data.self, forKey: "i") {
|
if let data = try? container.decodeIfPresent(Data.self, forKey: "i") {
|
||||||
self.selectedIds = Set(MessageId.decodeArrayFromBuffer(ReadBuffer(data: data)))
|
self.selectedIds = Set(EngineMessage.Id.decodeArrayFromData(data))
|
||||||
} else {
|
} else {
|
||||||
self.selectedIds = Set()
|
self.selectedIds = Set()
|
||||||
}
|
}
|
||||||
@ -35,20 +34,19 @@ public struct ChatInterfaceSelectionState: Codable, Equatable {
|
|||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: StringCodingKey.self)
|
var container = encoder.container(keyedBy: StringCodingKey.self)
|
||||||
|
|
||||||
let buffer = WriteBuffer()
|
let data = EngineMessage.Id.encodeArrayToData(Array(selectedIds))
|
||||||
MessageId.encodeArrayToBuffer(Array(selectedIds), buffer: buffer)
|
|
||||||
|
|
||||||
try container.encode(buffer.makeData(), forKey: "i")
|
try container.encode(data, forKey: "i")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct ChatEditMessageState: Codable, Equatable {
|
public struct ChatEditMessageState: Codable, Equatable {
|
||||||
public let messageId: MessageId
|
public let messageId: EngineMessage.Id
|
||||||
public let inputState: ChatTextInputState
|
public let inputState: ChatTextInputState
|
||||||
public let disableUrlPreview: String?
|
public let disableUrlPreview: String?
|
||||||
public let inputTextMaxLength: Int32?
|
public let inputTextMaxLength: Int32?
|
||||||
|
|
||||||
public init(messageId: MessageId, inputState: ChatTextInputState, disableUrlPreview: String?, inputTextMaxLength: Int32?) {
|
public init(messageId: EngineMessage.Id, inputState: ChatTextInputState, disableUrlPreview: String?, inputTextMaxLength: Int32?) {
|
||||||
self.messageId = messageId
|
self.messageId = messageId
|
||||||
self.inputState = inputState
|
self.inputState = inputState
|
||||||
self.disableUrlPreview = disableUrlPreview
|
self.disableUrlPreview = disableUrlPreview
|
||||||
@ -58,8 +56,8 @@ public struct ChatEditMessageState: Codable, Equatable {
|
|||||||
public init(from decoder: Decoder) throws {
|
public init(from decoder: Decoder) throws {
|
||||||
let container = try decoder.container(keyedBy: StringCodingKey.self)
|
let container = try decoder.container(keyedBy: StringCodingKey.self)
|
||||||
|
|
||||||
self.messageId = MessageId(
|
self.messageId = EngineMessage.Id(
|
||||||
peerId: PeerId((try? container.decode(Int64.self, forKey: "mp")) ?? 0),
|
peerId: EnginePeer.Id((try? container.decode(Int64.self, forKey: "mp")) ?? 0),
|
||||||
namespace: (try? container.decode(Int32.self, forKey: "mn")) ?? 0,
|
namespace: (try? container.decode(Int32.self, forKey: "mn")) ?? 0,
|
||||||
id: (try? container.decode(Int32.self, forKey: "mi")) ?? 0
|
id: (try? container.decode(Int32.self, forKey: "mi")) ?? 0
|
||||||
)
|
)
|
||||||
@ -102,10 +100,10 @@ public struct ChatEditMessageState: Codable, Equatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public struct ChatInterfaceMessageActionsState: Codable, Equatable {
|
public struct ChatInterfaceMessageActionsState: Codable, Equatable {
|
||||||
public var closedButtonKeyboardMessageId: MessageId?
|
public var closedButtonKeyboardMessageId: EngineMessage.Id?
|
||||||
public var dismissedButtonKeyboardMessageId: MessageId?
|
public var dismissedButtonKeyboardMessageId: EngineMessage.Id?
|
||||||
public var processedSetupReplyMessageId: MessageId?
|
public var processedSetupReplyMessageId: EngineMessage.Id?
|
||||||
public var closedPinnedMessageId: MessageId?
|
public var closedPinnedMessageId: EngineMessage.Id?
|
||||||
public var closedPeerSpecificPackSetup: Bool = false
|
public var closedPeerSpecificPackSetup: Bool = false
|
||||||
public var dismissedAddContactPhoneNumber: String?
|
public var dismissedAddContactPhoneNumber: String?
|
||||||
|
|
||||||
@ -122,7 +120,7 @@ public struct ChatInterfaceMessageActionsState: Codable, Equatable {
|
|||||||
self.dismissedAddContactPhoneNumber = nil
|
self.dismissedAddContactPhoneNumber = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(closedButtonKeyboardMessageId: MessageId?, dismissedButtonKeyboardMessageId: MessageId?, processedSetupReplyMessageId: MessageId?, closedPinnedMessageId: MessageId?, closedPeerSpecificPackSetup: Bool, dismissedAddContactPhoneNumber: String?) {
|
public init(closedButtonKeyboardMessageId: EngineMessage.Id?, dismissedButtonKeyboardMessageId: EngineMessage.Id?, processedSetupReplyMessageId: EngineMessage.Id?, closedPinnedMessageId: EngineMessage.Id?, closedPeerSpecificPackSetup: Bool, dismissedAddContactPhoneNumber: String?) {
|
||||||
self.closedButtonKeyboardMessageId = closedButtonKeyboardMessageId
|
self.closedButtonKeyboardMessageId = closedButtonKeyboardMessageId
|
||||||
self.dismissedButtonKeyboardMessageId = dismissedButtonKeyboardMessageId
|
self.dismissedButtonKeyboardMessageId = dismissedButtonKeyboardMessageId
|
||||||
self.processedSetupReplyMessageId = processedSetupReplyMessageId
|
self.processedSetupReplyMessageId = processedSetupReplyMessageId
|
||||||
@ -135,25 +133,25 @@ public struct ChatInterfaceMessageActionsState: Codable, Equatable {
|
|||||||
let container = try decoder.container(keyedBy: StringCodingKey.self)
|
let container = try decoder.container(keyedBy: StringCodingKey.self)
|
||||||
|
|
||||||
if let closedMessageIdPeerId = try? container.decodeIfPresent(Int64.self, forKey: "cb.p"), let closedMessageIdNamespace = try? container.decodeIfPresent(Int32.self, forKey: "cb.n"), let closedMessageIdId = try? container.decodeIfPresent(Int32.self, forKey: "cb.i") {
|
if let closedMessageIdPeerId = try? container.decodeIfPresent(Int64.self, forKey: "cb.p"), let closedMessageIdNamespace = try? container.decodeIfPresent(Int32.self, forKey: "cb.n"), let closedMessageIdId = try? container.decodeIfPresent(Int32.self, forKey: "cb.i") {
|
||||||
self.closedButtonKeyboardMessageId = MessageId(peerId: PeerId(closedMessageIdPeerId), namespace: closedMessageIdNamespace, id: closedMessageIdId)
|
self.closedButtonKeyboardMessageId = EngineMessage.Id(peerId: EnginePeer.Id(closedMessageIdPeerId), namespace: closedMessageIdNamespace, id: closedMessageIdId)
|
||||||
} else {
|
} else {
|
||||||
self.closedButtonKeyboardMessageId = nil
|
self.closedButtonKeyboardMessageId = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if let messageIdPeerId = try? container.decodeIfPresent(Int64.self, forKey: "dismissedbuttons.p"), let messageIdNamespace = try? container.decodeIfPresent(Int32.self, forKey: "dismissedbuttons.n"), let messageIdId = try? container.decodeIfPresent(Int32.self, forKey: "dismissedbuttons.i") {
|
if let messageIdPeerId = try? container.decodeIfPresent(Int64.self, forKey: "dismissedbuttons.p"), let messageIdNamespace = try? container.decodeIfPresent(Int32.self, forKey: "dismissedbuttons.n"), let messageIdId = try? container.decodeIfPresent(Int32.self, forKey: "dismissedbuttons.i") {
|
||||||
self.dismissedButtonKeyboardMessageId = MessageId(peerId: PeerId(messageIdPeerId), namespace: messageIdNamespace, id: messageIdId)
|
self.dismissedButtonKeyboardMessageId = EngineMessage.Id(peerId: EnginePeer.Id(messageIdPeerId), namespace: messageIdNamespace, id: messageIdId)
|
||||||
} else {
|
} else {
|
||||||
self.dismissedButtonKeyboardMessageId = nil
|
self.dismissedButtonKeyboardMessageId = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if let processedMessageIdPeerId = try? container.decodeIfPresent(Int64.self, forKey: "pb.p"), let processedMessageIdNamespace = try? container.decodeIfPresent(Int32.self, forKey: "pb.n"), let processedMessageIdId = try? container.decodeIfPresent(Int32.self, forKey: "pb.i") {
|
if let processedMessageIdPeerId = try? container.decodeIfPresent(Int64.self, forKey: "pb.p"), let processedMessageIdNamespace = try? container.decodeIfPresent(Int32.self, forKey: "pb.n"), let processedMessageIdId = try? container.decodeIfPresent(Int32.self, forKey: "pb.i") {
|
||||||
self.processedSetupReplyMessageId = MessageId(peerId: PeerId(processedMessageIdPeerId), namespace: processedMessageIdNamespace, id: processedMessageIdId)
|
self.processedSetupReplyMessageId = EngineMessage.Id(peerId: EnginePeer.Id(processedMessageIdPeerId), namespace: processedMessageIdNamespace, id: processedMessageIdId)
|
||||||
} else {
|
} else {
|
||||||
self.processedSetupReplyMessageId = nil
|
self.processedSetupReplyMessageId = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if let closedPinnedMessageIdPeerId = try? container.decodeIfPresent(Int64.self, forKey: "cp.p"), let closedPinnedMessageIdNamespace = try? container.decodeIfPresent(Int32.self, forKey: "cp.n"), let closedPinnedMessageIdId = try? container.decodeIfPresent(Int32.self, forKey: "cp.i") {
|
if let closedPinnedMessageIdPeerId = try? container.decodeIfPresent(Int64.self, forKey: "cp.p"), let closedPinnedMessageIdNamespace = try? container.decodeIfPresent(Int32.self, forKey: "cp.n"), let closedPinnedMessageIdId = try? container.decodeIfPresent(Int32.self, forKey: "cp.i") {
|
||||||
self.closedPinnedMessageId = MessageId(peerId: PeerId(closedPinnedMessageIdPeerId), namespace: closedPinnedMessageIdNamespace, id: closedPinnedMessageIdId)
|
self.closedPinnedMessageId = EngineMessage.Id(peerId: EnginePeer.Id(closedPinnedMessageIdPeerId), namespace: closedPinnedMessageIdNamespace, id: closedPinnedMessageIdId)
|
||||||
} else {
|
} else {
|
||||||
self.closedPinnedMessageId = nil
|
self.closedPinnedMessageId = nil
|
||||||
}
|
}
|
||||||
@ -217,10 +215,10 @@ public struct ChatInterfaceMessageActionsState: Codable, Equatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public struct ChatInterfaceHistoryScrollState: Codable, Equatable {
|
public struct ChatInterfaceHistoryScrollState: Codable, Equatable {
|
||||||
public let messageIndex: MessageIndex
|
public let messageIndex: EngineMessage.Index
|
||||||
public let relativeOffset: Double
|
public let relativeOffset: Double
|
||||||
|
|
||||||
public init(messageIndex: MessageIndex, relativeOffset: Double) {
|
public init(messageIndex: EngineMessage.Index, relativeOffset: Double) {
|
||||||
self.messageIndex = messageIndex
|
self.messageIndex = messageIndex
|
||||||
self.relativeOffset = relativeOffset
|
self.relativeOffset = relativeOffset
|
||||||
}
|
}
|
||||||
@ -228,9 +226,9 @@ public struct ChatInterfaceHistoryScrollState: Codable, Equatable {
|
|||||||
public init(from decoder: Decoder) throws {
|
public init(from decoder: Decoder) throws {
|
||||||
let container = try decoder.container(keyedBy: StringCodingKey.self)
|
let container = try decoder.container(keyedBy: StringCodingKey.self)
|
||||||
|
|
||||||
self.messageIndex = MessageIndex(
|
self.messageIndex = EngineMessage.Index(
|
||||||
id: MessageId(
|
id: EngineMessage.Id(
|
||||||
peerId: PeerId((try? container.decode(Int64.self, forKey: "m.p")) ?? 0),
|
peerId: EnginePeer.Id((try? container.decode(Int64.self, forKey: "m.p")) ?? 0),
|
||||||
namespace: (try? container.decode(Int32.self, forKey: "m.n")) ?? 0,
|
namespace: (try? container.decode(Int32.self, forKey: "m.n")) ?? 0,
|
||||||
id: (try? container.decode(Int32.self, forKey: "m.i")) ?? 0
|
id: (try? container.decode(Int32.self, forKey: "m.i")) ?? 0
|
||||||
),
|
),
|
||||||
@ -264,8 +262,8 @@ public final class ChatInterfaceState: Codable, Equatable {
|
|||||||
public let timestamp: Int32
|
public let timestamp: Int32
|
||||||
public let composeInputState: ChatTextInputState
|
public let composeInputState: ChatTextInputState
|
||||||
public let composeDisableUrlPreview: String?
|
public let composeDisableUrlPreview: String?
|
||||||
public let replyMessageId: MessageId?
|
public let replyMessageId: EngineMessage.Id?
|
||||||
public let forwardMessageIds: [MessageId]?
|
public let forwardMessageIds: [EngineMessage.Id]?
|
||||||
public let editMessage: ChatEditMessageState?
|
public let editMessage: ChatEditMessageState?
|
||||||
public let selectionState: ChatInterfaceSelectionState?
|
public let selectionState: ChatInterfaceSelectionState?
|
||||||
public let messageActionsState: ChatInterfaceMessageActionsState
|
public let messageActionsState: ChatInterfaceMessageActionsState
|
||||||
@ -290,7 +288,7 @@ public final class ChatInterfaceState: Codable, Equatable {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
public var historyScrollMessageIndex: MessageIndex? {
|
public var historyScrollMessageIndex: EngineMessage.Index? {
|
||||||
return self.historyScrollState?.messageIndex
|
return self.historyScrollState?.messageIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,7 +315,7 @@ public final class ChatInterfaceState: Codable, Equatable {
|
|||||||
self.inputLanguage = nil
|
self.inputLanguage = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(timestamp: Int32, composeInputState: ChatTextInputState, composeDisableUrlPreview: String?, replyMessageId: MessageId?, forwardMessageIds: [MessageId]?, editMessage: ChatEditMessageState?, selectionState: ChatInterfaceSelectionState?, messageActionsState: ChatInterfaceMessageActionsState, historyScrollState: ChatInterfaceHistoryScrollState?, mediaRecordingMode: ChatTextInputMediaRecordingButtonMode, silentPosting: Bool, inputLanguage: String?) {
|
public init(timestamp: Int32, composeInputState: ChatTextInputState, composeDisableUrlPreview: String?, replyMessageId: EngineMessage.Id?, forwardMessageIds: [EngineMessage.Id]?, editMessage: ChatEditMessageState?, selectionState: ChatInterfaceSelectionState?, messageActionsState: ChatInterfaceMessageActionsState, historyScrollState: ChatInterfaceHistoryScrollState?, mediaRecordingMode: ChatTextInputMediaRecordingButtonMode, silentPosting: Bool, inputLanguage: String?) {
|
||||||
self.timestamp = timestamp
|
self.timestamp = timestamp
|
||||||
self.composeInputState = composeInputState
|
self.composeInputState = composeInputState
|
||||||
self.composeDisableUrlPreview = composeDisableUrlPreview
|
self.composeDisableUrlPreview = composeDisableUrlPreview
|
||||||
@ -350,12 +348,12 @@ public final class ChatInterfaceState: Codable, Equatable {
|
|||||||
let replyMessageIdNamespace: Int32? = try? container.decodeIfPresent(Int32.self, forKey: "r.n")
|
let replyMessageIdNamespace: Int32? = try? container.decodeIfPresent(Int32.self, forKey: "r.n")
|
||||||
let replyMessageIdId: Int32? = try? container.decodeIfPresent(Int32.self, forKey: "r.i")
|
let replyMessageIdId: Int32? = try? container.decodeIfPresent(Int32.self, forKey: "r.i")
|
||||||
if let replyMessageIdPeerId = replyMessageIdPeerId, let replyMessageIdNamespace = replyMessageIdNamespace, let replyMessageIdId = replyMessageIdId {
|
if let replyMessageIdPeerId = replyMessageIdPeerId, let replyMessageIdNamespace = replyMessageIdNamespace, let replyMessageIdId = replyMessageIdId {
|
||||||
self.replyMessageId = MessageId(peerId: PeerId(replyMessageIdPeerId), namespace: replyMessageIdNamespace, id: replyMessageIdId)
|
self.replyMessageId = EngineMessage.Id(peerId: EnginePeer.Id(replyMessageIdPeerId), namespace: replyMessageIdNamespace, id: replyMessageIdId)
|
||||||
} else {
|
} else {
|
||||||
self.replyMessageId = nil
|
self.replyMessageId = nil
|
||||||
}
|
}
|
||||||
if let forwardMessageIdsData = try? container.decodeIfPresent(Data.self, forKey: "fm") {
|
if let forwardMessageIdsData = try? container.decodeIfPresent(Data.self, forKey: "fm") {
|
||||||
self.forwardMessageIds = MessageId.decodeArrayFromBuffer(ReadBuffer(data: forwardMessageIdsData))
|
self.forwardMessageIds = EngineMessage.Id.decodeArrayFromData(forwardMessageIdsData)
|
||||||
} else {
|
} else {
|
||||||
self.forwardMessageIds = nil
|
self.forwardMessageIds = nil
|
||||||
}
|
}
|
||||||
@ -404,9 +402,7 @@ public final class ChatInterfaceState: Codable, Equatable {
|
|||||||
try container.encodeNil(forKey: "r.i")
|
try container.encodeNil(forKey: "r.i")
|
||||||
}
|
}
|
||||||
if let forwardMessageIds = self.forwardMessageIds {
|
if let forwardMessageIds = self.forwardMessageIds {
|
||||||
let buffer = WriteBuffer()
|
try container.encode(EngineMessage.Id.encodeArrayToData(forwardMessageIds), forKey: "fm")
|
||||||
MessageId.encodeArrayToBuffer(forwardMessageIds, buffer: buffer)
|
|
||||||
try container.encode(buffer.makeData(), forKey: "fm")
|
|
||||||
} else {
|
} else {
|
||||||
try container.encodeNil(forKey: "fm")
|
try container.encodeNil(forKey: "fm")
|
||||||
}
|
}
|
||||||
@ -490,16 +486,16 @@ public final class ChatInterfaceState: Codable, Equatable {
|
|||||||
return ChatInterfaceState(timestamp: self.timestamp, composeInputState: updatedComposeInputState, composeDisableUrlPreview: self.composeDisableUrlPreview, replyMessageId: self.replyMessageId, forwardMessageIds: self.forwardMessageIds, editMessage: updatedEditMessage, selectionState: self.selectionState, messageActionsState: self.messageActionsState, historyScrollState: self.historyScrollState, mediaRecordingMode: self.mediaRecordingMode, silentPosting: self.silentPosting, inputLanguage: self.inputLanguage)
|
return ChatInterfaceState(timestamp: self.timestamp, composeInputState: updatedComposeInputState, composeDisableUrlPreview: self.composeDisableUrlPreview, replyMessageId: self.replyMessageId, forwardMessageIds: self.forwardMessageIds, editMessage: updatedEditMessage, selectionState: self.selectionState, messageActionsState: self.messageActionsState, historyScrollState: self.historyScrollState, mediaRecordingMode: self.mediaRecordingMode, silentPosting: self.silentPosting, inputLanguage: self.inputLanguage)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func withUpdatedReplyMessageId(_ replyMessageId: MessageId?) -> ChatInterfaceState {
|
public func withUpdatedReplyMessageId(_ replyMessageId: EngineMessage.Id?) -> ChatInterfaceState {
|
||||||
return ChatInterfaceState(timestamp: self.timestamp, composeInputState: self.composeInputState, composeDisableUrlPreview: self.composeDisableUrlPreview, replyMessageId: replyMessageId, forwardMessageIds: self.forwardMessageIds, editMessage: self.editMessage, selectionState: self.selectionState, messageActionsState: self.messageActionsState, historyScrollState: self.historyScrollState, mediaRecordingMode: self.mediaRecordingMode, silentPosting: self.silentPosting, inputLanguage: self.inputLanguage)
|
return ChatInterfaceState(timestamp: self.timestamp, composeInputState: self.composeInputState, composeDisableUrlPreview: self.composeDisableUrlPreview, replyMessageId: replyMessageId, forwardMessageIds: self.forwardMessageIds, editMessage: self.editMessage, selectionState: self.selectionState, messageActionsState: self.messageActionsState, historyScrollState: self.historyScrollState, mediaRecordingMode: self.mediaRecordingMode, silentPosting: self.silentPosting, inputLanguage: self.inputLanguage)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func withUpdatedForwardMessageIds(_ forwardMessageIds: [MessageId]?) -> ChatInterfaceState {
|
public func withUpdatedForwardMessageIds(_ forwardMessageIds: [EngineMessage.Id]?) -> ChatInterfaceState {
|
||||||
return ChatInterfaceState(timestamp: self.timestamp, composeInputState: self.composeInputState, composeDisableUrlPreview: self.composeDisableUrlPreview, replyMessageId: self.replyMessageId, forwardMessageIds: forwardMessageIds, editMessage: self.editMessage, selectionState: self.selectionState, messageActionsState: self.messageActionsState, historyScrollState: self.historyScrollState, mediaRecordingMode: self.mediaRecordingMode, silentPosting: self.silentPosting, inputLanguage: self.inputLanguage)
|
return ChatInterfaceState(timestamp: self.timestamp, composeInputState: self.composeInputState, composeDisableUrlPreview: self.composeDisableUrlPreview, replyMessageId: self.replyMessageId, forwardMessageIds: forwardMessageIds, editMessage: self.editMessage, selectionState: self.selectionState, messageActionsState: self.messageActionsState, historyScrollState: self.historyScrollState, mediaRecordingMode: self.mediaRecordingMode, silentPosting: self.silentPosting, inputLanguage: self.inputLanguage)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func withUpdatedSelectedMessages(_ messageIds: [MessageId]) -> ChatInterfaceState {
|
public func withUpdatedSelectedMessages(_ messageIds: [EngineMessage.Id]) -> ChatInterfaceState {
|
||||||
var selectedIds = Set<MessageId>()
|
var selectedIds = Set<EngineMessage.Id>()
|
||||||
if let selectionState = self.selectionState {
|
if let selectionState = self.selectionState {
|
||||||
selectedIds.formUnion(selectionState.selectedIds)
|
selectedIds.formUnion(selectionState.selectedIds)
|
||||||
}
|
}
|
||||||
@ -509,8 +505,8 @@ public final class ChatInterfaceState: Codable, Equatable {
|
|||||||
return ChatInterfaceState(timestamp: self.timestamp, composeInputState: self.composeInputState, composeDisableUrlPreview: self.composeDisableUrlPreview, replyMessageId: self.replyMessageId, forwardMessageIds: self.forwardMessageIds, editMessage: self.editMessage, selectionState: ChatInterfaceSelectionState(selectedIds: selectedIds), messageActionsState: self.messageActionsState, historyScrollState: self.historyScrollState, mediaRecordingMode: self.mediaRecordingMode, silentPosting: self.silentPosting, inputLanguage: self.inputLanguage)
|
return ChatInterfaceState(timestamp: self.timestamp, composeInputState: self.composeInputState, composeDisableUrlPreview: self.composeDisableUrlPreview, replyMessageId: self.replyMessageId, forwardMessageIds: self.forwardMessageIds, editMessage: self.editMessage, selectionState: ChatInterfaceSelectionState(selectedIds: selectedIds), messageActionsState: self.messageActionsState, historyScrollState: self.historyScrollState, mediaRecordingMode: self.mediaRecordingMode, silentPosting: self.silentPosting, inputLanguage: self.inputLanguage)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func withToggledSelectedMessages(_ messageIds: [MessageId], value: Bool) -> ChatInterfaceState {
|
public func withToggledSelectedMessages(_ messageIds: [EngineMessage.Id], value: Bool) -> ChatInterfaceState {
|
||||||
var selectedIds = Set<MessageId>()
|
var selectedIds = Set<EngineMessage.Id>()
|
||||||
if let selectionState = self.selectionState {
|
if let selectionState = self.selectionState {
|
||||||
selectedIds.formUnion(selectionState.selectedIds)
|
selectedIds.formUnion(selectionState.selectedIds)
|
||||||
}
|
}
|
||||||
@ -560,20 +556,20 @@ public final class ChatInterfaceState: Codable, Equatable {
|
|||||||
guard let opaqueData = state.opaqueData else {
|
guard let opaqueData = state.opaqueData else {
|
||||||
return ChatInterfaceState().withUpdatedSynchronizeableInputState(state.synchronizeableInputState)
|
return ChatInterfaceState().withUpdatedSynchronizeableInputState(state.synchronizeableInputState)
|
||||||
}
|
}
|
||||||
guard var decodedState = try? AdaptedPostboxDecoder().decode(ChatInterfaceState.self, from: opaqueData) else {
|
guard var decodedState = try? EngineDecoder.decode(ChatInterfaceState.self, from: opaqueData) else {
|
||||||
return ChatInterfaceState().withUpdatedSynchronizeableInputState(state.synchronizeableInputState)
|
return ChatInterfaceState().withUpdatedSynchronizeableInputState(state.synchronizeableInputState)
|
||||||
}
|
}
|
||||||
decodedState = decodedState.withUpdatedSynchronizeableInputState(state.synchronizeableInputState)
|
decodedState = decodedState.withUpdatedSynchronizeableInputState(state.synchronizeableInputState)
|
||||||
return decodedState
|
return decodedState
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func update(engine: TelegramEngine, peerId: PeerId, threadId: Int64?, _ f: @escaping (ChatInterfaceState) -> ChatInterfaceState) -> Signal<Never, NoError> {
|
public static func update(engine: TelegramEngine, peerId: EnginePeer.Id, threadId: Int64?, _ f: @escaping (ChatInterfaceState) -> ChatInterfaceState) -> Signal<Never, NoError> {
|
||||||
return engine.peers.getOpaqueChatInterfaceState(peerId: peerId, threadId: threadId)
|
return engine.peers.getOpaqueChatInterfaceState(peerId: peerId, threadId: threadId)
|
||||||
|> mapToSignal { previousOpaqueState -> Signal<Never, NoError> in
|
|> mapToSignal { previousOpaqueState -> Signal<Never, NoError> in
|
||||||
let previousState = previousOpaqueState.flatMap(ChatInterfaceState.parse)
|
let previousState = previousOpaqueState.flatMap(ChatInterfaceState.parse)
|
||||||
let updatedState = f(previousState ?? ChatInterfaceState())
|
let updatedState = f(previousState ?? ChatInterfaceState())
|
||||||
|
|
||||||
let updatedOpaqueData = try? AdaptedPostboxEncoder().encode(updatedState)
|
let updatedOpaqueData = try? EngineEncoder.encode(updatedState)
|
||||||
|
|
||||||
return engine.peers.setOpaqueChatInterfaceState(
|
return engine.peers.setOpaqueChatInterfaceState(
|
||||||
peerId: peerId,
|
peerId: peerId,
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
"//submodules/TelegramPresentationData:TelegramPresentationData",
|
"//submodules/TelegramPresentationData:TelegramPresentationData",
|
||||||
|
@ -6,11 +6,13 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
"//submodules/Postbox:Postbox",
|
|
||||||
"//submodules/TelegramPresentationData:TelegramPresentationData",
|
"//submodules/TelegramPresentationData:TelegramPresentationData",
|
||||||
"//submodules/SearchBarNode:SearchBarNode",
|
"//submodules/SearchBarNode:SearchBarNode",
|
||||||
],
|
],
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import UIKit
|
import UIKit
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import Postbox
|
|
||||||
import Display
|
import Display
|
||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
@ -6,11 +6,13 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
"//submodules/Postbox:Postbox",
|
|
||||||
"//submodules/TelegramCore:TelegramCore",
|
"//submodules/TelegramCore:TelegramCore",
|
||||||
"//submodules/ListSectionHeaderNode:ListSectionHeaderNode",
|
"//submodules/ListSectionHeaderNode:ListSectionHeaderNode",
|
||||||
"//submodules/HorizontalPeerItem:HorizontalPeerItem",
|
"//submodules/HorizontalPeerItem:HorizontalPeerItem",
|
||||||
|
@ -3,7 +3,6 @@ import UIKit
|
|||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import Display
|
import Display
|
||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
import Postbox
|
|
||||||
import TelegramCore
|
import TelegramCore
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
import MergeLists
|
import MergeLists
|
||||||
@ -32,13 +31,13 @@ private func calculateItemCustomWidth(width: CGFloat) -> CGFloat {
|
|||||||
|
|
||||||
private struct ChatListSearchRecentPeersEntry: Comparable, Identifiable {
|
private struct ChatListSearchRecentPeersEntry: Comparable, Identifiable {
|
||||||
let index: Int
|
let index: Int
|
||||||
let peer: Peer
|
let peer: EnginePeer
|
||||||
let presence: PeerPresence?
|
let presence: EnginePeer.Presence?
|
||||||
let unreadBadge: (Int32, Bool)?
|
let unreadBadge: (Int32, Bool)?
|
||||||
let theme: PresentationTheme
|
let theme: PresentationTheme
|
||||||
let strings: PresentationStrings
|
let strings: PresentationStrings
|
||||||
let itemCustomWidth: CGFloat?
|
let itemCustomWidth: CGFloat?
|
||||||
var stableId: PeerId {
|
var stableId: EnginePeer.Id {
|
||||||
return self.peer.id
|
return self.peer.id
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,14 +48,10 @@ private struct ChatListSearchRecentPeersEntry: Comparable, Identifiable {
|
|||||||
if lhs.itemCustomWidth != rhs.itemCustomWidth {
|
if lhs.itemCustomWidth != rhs.itemCustomWidth {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if !lhs.peer.isEqual(rhs.peer) {
|
if lhs.peer != rhs.peer {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if let lhsPresence = lhs.presence, let rhsPresence = rhs.presence {
|
if lhs.presence != rhs.presence {
|
||||||
if !lhsPresence.isEqual(to: rhsPresence) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
} else if (lhs.presence != nil) != (rhs.presence != nil) {
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if lhs.unreadBadge?.0 != rhs.unreadBadge?.0 {
|
if lhs.unreadBadge?.0 != rhs.unreadBadge?.0 {
|
||||||
@ -78,7 +73,7 @@ private struct ChatListSearchRecentPeersEntry: Comparable, Identifiable {
|
|||||||
return lhs.index < rhs.index
|
return lhs.index < rhs.index
|
||||||
}
|
}
|
||||||
|
|
||||||
func item(context: AccountContext, mode: HorizontalPeerItemMode, peerSelected: @escaping (Peer) -> Void, peerContextAction: @escaping (Peer, ASDisplayNode, ContextGesture?) -> Void, isPeerSelected: @escaping (PeerId) -> Bool) -> ListViewItem {
|
func item(context: AccountContext, mode: HorizontalPeerItemMode, peerSelected: @escaping (EnginePeer) -> Void, peerContextAction: @escaping (EnginePeer, ASDisplayNode, ContextGesture?) -> Void, isPeerSelected: @escaping (EnginePeer.Id) -> Bool) -> ListViewItem {
|
||||||
return HorizontalPeerItem(theme: self.theme, strings: self.strings, mode: mode, context: context, peer: self.peer, presence: self.presence, unreadBadge: self.unreadBadge, action: peerSelected, contextAction: { peer, node, gesture in
|
return HorizontalPeerItem(theme: self.theme, strings: self.strings, mode: mode, context: context, peer: self.peer, presence: self.presence, unreadBadge: self.unreadBadge, action: peerSelected, contextAction: { peer, node, gesture in
|
||||||
peerContextAction(peer, node, gesture)
|
peerContextAction(peer, node, gesture)
|
||||||
}, isPeerSelected: isPeerSelected, customWidth: self.itemCustomWidth)
|
}, isPeerSelected: isPeerSelected, customWidth: self.itemCustomWidth)
|
||||||
@ -93,7 +88,7 @@ private struct ChatListSearchRecentNodeTransition {
|
|||||||
let animated: Bool
|
let animated: Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
private func preparedRecentPeersTransition(context: AccountContext, mode: HorizontalPeerItemMode, peerSelected: @escaping (Peer) -> Void, peerContextAction: @escaping (Peer, ASDisplayNode, ContextGesture?) -> Void, isPeerSelected: @escaping (PeerId) -> Bool, share: Bool = false, from fromEntries: [ChatListSearchRecentPeersEntry], to toEntries: [ChatListSearchRecentPeersEntry], firstTime: Bool, animated: Bool) -> ChatListSearchRecentNodeTransition {
|
private func preparedRecentPeersTransition(context: AccountContext, mode: HorizontalPeerItemMode, peerSelected: @escaping (EnginePeer) -> Void, peerContextAction: @escaping (EnginePeer, ASDisplayNode, ContextGesture?) -> Void, isPeerSelected: @escaping (EnginePeer.Id) -> Bool, share: Bool = false, from fromEntries: [ChatListSearchRecentPeersEntry], to toEntries: [ChatListSearchRecentPeersEntry], firstTime: Bool, animated: Bool) -> ChatListSearchRecentNodeTransition {
|
||||||
let (deleteIndices, indicesAndItems, updateIndices) = mergeListsStableWithUpdates(leftList: fromEntries, rightList: toEntries)
|
let (deleteIndices, indicesAndItems, updateIndices) = mergeListsStableWithUpdates(leftList: fromEntries, rightList: toEntries)
|
||||||
|
|
||||||
let deletions = deleteIndices.map { ListViewDeleteItem(index: $0, directionHint: nil) }
|
let deletions = deleteIndices.map { ListViewDeleteItem(index: $0, directionHint: nil) }
|
||||||
@ -111,9 +106,9 @@ public final class ChatListSearchRecentPeersNode: ASDisplayNode {
|
|||||||
private let listView: ListView
|
private let listView: ListView
|
||||||
private let share: Bool
|
private let share: Bool
|
||||||
|
|
||||||
private let peerSelected: (Peer) -> Void
|
private let peerSelected: (EnginePeer) -> Void
|
||||||
private let peerContextAction: (Peer, ASDisplayNode, ContextGesture?) -> Void
|
private let peerContextAction: (EnginePeer, ASDisplayNode, ContextGesture?) -> Void
|
||||||
private let isPeerSelected: (PeerId) -> Bool
|
private let isPeerSelected: (EnginePeer.Id) -> Bool
|
||||||
|
|
||||||
private let disposable = MetaDisposable()
|
private let disposable = MetaDisposable()
|
||||||
private let itemCustomWidthValuePromise: ValuePromise<CGFloat?> = ValuePromise(nil, ignoreRepeated: true)
|
private let itemCustomWidthValuePromise: ValuePromise<CGFloat?> = ValuePromise(nil, ignoreRepeated: true)
|
||||||
@ -127,7 +122,7 @@ public final class ChatListSearchRecentPeersNode: ASDisplayNode {
|
|||||||
return self.ready.get()
|
return self.ready.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(context: AccountContext, theme: PresentationTheme, mode: HorizontalPeerItemMode, strings: PresentationStrings, peerSelected: @escaping (Peer) -> Void, peerContextAction: @escaping (Peer, ASDisplayNode, ContextGesture?) -> Void, isPeerSelected: @escaping (PeerId) -> Bool, share: Bool = false) {
|
public init(context: AccountContext, theme: PresentationTheme, mode: HorizontalPeerItemMode, strings: PresentationStrings, peerSelected: @escaping (EnginePeer) -> Void, peerContextAction: @escaping (EnginePeer, ASDisplayNode, ContextGesture?) -> Void, isPeerSelected: @escaping (EnginePeer.Id) -> Bool, share: Bool = false) {
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
self.strings = strings
|
self.strings = strings
|
||||||
self.themeAndStringsPromise = Promise((self.theme, self.strings))
|
self.themeAndStringsPromise = Promise((self.theme, self.strings))
|
||||||
@ -149,7 +144,7 @@ public final class ChatListSearchRecentPeersNode: ASDisplayNode {
|
|||||||
|
|
||||||
let peersDisposable = DisposableSet()
|
let peersDisposable = DisposableSet()
|
||||||
|
|
||||||
let recent: Signal<([Peer], [PeerId: (Int32, Bool)], [PeerId : PeerPresence]), NoError> = context.engine.peers.recentPeers()
|
let recent: Signal<([EnginePeer], [EnginePeer.Id: (Int32, Bool)], [EnginePeer.Id : EnginePeer.Presence]), NoError> = context.engine.peers.recentPeers()
|
||||||
|> filter { value -> Bool in
|
|> filter { value -> Bool in
|
||||||
switch value {
|
switch value {
|
||||||
case .disabled:
|
case .disabled:
|
||||||
@ -163,14 +158,21 @@ public final class ChatListSearchRecentPeersNode: ASDisplayNode {
|
|||||||
case .disabled:
|
case .disabled:
|
||||||
return .single(([], [:], [:]))
|
return .single(([], [:], [:]))
|
||||||
case let .peers(peers):
|
case let .peers(peers):
|
||||||
return combineLatest(queue: .mainQueue(), peers.filter { !$0.isDeleted }.map {context.account.postbox.peerView(id: $0.id)}) |> mapToSignal { peerViews -> Signal<([Peer], [PeerId: (Int32, Bool)], [PeerId: PeerPresence]), NoError> in
|
return combineLatest(queue: .mainQueue(),
|
||||||
|
peers.filter {
|
||||||
|
!$0.isDeleted
|
||||||
|
}.map {
|
||||||
|
context.account.postbox.peerView(id: $0.id)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|> mapToSignal { peerViews -> Signal<([EnginePeer], [EnginePeer.Id: (Int32, Bool)], [EnginePeer.Id: EnginePeer.Presence]), NoError> in
|
||||||
return context.account.postbox.unreadMessageCountsView(items: peerViews.map {
|
return context.account.postbox.unreadMessageCountsView(items: peerViews.map {
|
||||||
.peer($0.peerId)
|
.peer($0.peerId)
|
||||||
})
|
})
|
||||||
|> map { values in
|
|> map { values in
|
||||||
var peers: [Peer] = []
|
var peers: [EnginePeer] = []
|
||||||
var unread: [PeerId: (Int32, Bool)] = [:]
|
var unread: [EnginePeer.Id: (Int32, Bool)] = [:]
|
||||||
var presences: [PeerId: PeerPresence] = [:]
|
var presences: [EnginePeer.Id: EnginePeer.Presence] = [:]
|
||||||
for peerView in peerViews {
|
for peerView in peerViews {
|
||||||
if let peer = peerViewMainPeer(peerView) {
|
if let peer = peerViewMainPeer(peerView) {
|
||||||
var isMuted: Bool = false
|
var isMuted: Bool = false
|
||||||
@ -189,10 +191,10 @@ public final class ChatListSearchRecentPeersNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let presence = peerView.peerPresences[peer.id] {
|
if let presence = peerView.peerPresences[peer.id] {
|
||||||
presences[peer.id] = presence
|
presences[peer.id] = EnginePeer.Presence(presence)
|
||||||
}
|
}
|
||||||
|
|
||||||
peers.append(peer)
|
peers.append(EnginePeer(peer))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (peers, unread, presences)
|
return (peers, unread, presences)
|
||||||
@ -286,7 +288,7 @@ public final class ChatListSearchRecentPeersNode: ASDisplayNode {
|
|||||||
self.itemCustomWidthValuePromise.set(itemCustomWidth)
|
self.itemCustomWidthValuePromise.set(itemCustomWidth)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func viewAndPeerAtPoint(_ point: CGPoint) -> (UIView, PeerId)? {
|
public func viewAndPeerAtPoint(_ point: CGPoint) -> (UIView, EnginePeer.Id)? {
|
||||||
let adjustedPoint = self.view.convert(point, to: self.listView.view)
|
let adjustedPoint = self.view.convert(point, to: self.listView.view)
|
||||||
var selectedItemNode: ASDisplayNode?
|
var selectedItemNode: ASDisplayNode?
|
||||||
self.listView.forEachItemNode { itemNode in
|
self.listView.forEachItemNode { itemNode in
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
|
@ -272,7 +272,7 @@ func chatContextMenuItems(context: AccountContext, peerId: PeerId, promoInfo: Ch
|
|||||||
}
|
}
|
||||||
|
|
||||||
let archiveEnabled = !isSavedMessages && peerId != PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(777000)) && peerId == context.account.peerId
|
let archiveEnabled = !isSavedMessages && peerId != PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(777000)) && peerId == context.account.peerId
|
||||||
if let (group, index) = groupAndIndex {
|
if let (group, _) = groupAndIndex {
|
||||||
if archiveEnabled {
|
if archiveEnabled {
|
||||||
let isArchived = group == Namespaces.PeerGroup.archive
|
let isArchived = group == Namespaces.PeerGroup.archive
|
||||||
items.append(.action(ContextMenuActionItem(text: isArchived ? strings.ChatList_Context_Unarchive : strings.ChatList_Context_Archive, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: isArchived ? "Chat/Context Menu/Unarchive" : "Chat/Context Menu/Archive"), color: theme.contextMenu.primaryColor) }, action: { _, f in
|
items.append(.action(ContextMenuActionItem(text: isArchived ? strings.ChatList_Context_Unarchive : strings.ChatList_Context_Archive, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: isArchived ? "Chat/Context Menu/Unarchive" : "Chat/Context Menu/Archive"), color: theme.contextMenu.primaryColor) }, action: { _, f in
|
||||||
@ -361,14 +361,15 @@ func chatContextMenuItems(context: AccountContext, peerId: PeerId, promoInfo: Ch
|
|||||||
|
|
||||||
joinChannelDisposable.set((createSignal
|
joinChannelDisposable.set((createSignal
|
||||||
|> deliverOnMainQueue).start(next: { _ in
|
|> deliverOnMainQueue).start(next: { _ in
|
||||||
if let navigationController = (chatListController?.navigationController as? NavigationController) {
|
|
||||||
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peerId)))
|
|
||||||
}
|
|
||||||
}, error: { _ in
|
}, error: { _ in
|
||||||
if let chatListController = chatListController {
|
if let chatListController = chatListController {
|
||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
chatListController.present(textAlertController(context: context, title: nil, text: presentationData.strings.Login_UnknownError, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
chatListController.present(textAlertController(context: context, title: nil, text: presentationData.strings.Login_UnknownError, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
||||||
}
|
}
|
||||||
|
}, completed: {
|
||||||
|
if let navigationController = (chatListController?.navigationController as? NavigationController) {
|
||||||
|
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peerId)))
|
||||||
|
}
|
||||||
}))
|
}))
|
||||||
f(.default)
|
f(.default)
|
||||||
})))
|
})))
|
||||||
|
@ -836,10 +836,10 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch item.content {
|
switch item.content {
|
||||||
case let .groupReference(groupReference):
|
case let .groupReference(groupId, _, _, _, _):
|
||||||
let chatListController = ChatListControllerImpl(context: strongSelf.context, groupId: groupReference.groupId, controlsHistoryPreload: false, hideNetworkActivityStatus: true, previewing: true, enableDebugActions: false)
|
let chatListController = ChatListControllerImpl(context: strongSelf.context, groupId: groupId, controlsHistoryPreload: false, hideNetworkActivityStatus: true, previewing: true, enableDebugActions: false)
|
||||||
chatListController.navigationPresentation = .master
|
chatListController.navigationPresentation = .master
|
||||||
let contextController = ContextController(account: strongSelf.context.account, presentationData: strongSelf.presentationData, source: .controller(ContextControllerContentSourceImpl(controller: chatListController, sourceNode: node, navigationController: strongSelf.navigationController as? NavigationController)), items: archiveContextMenuItems(context: strongSelf.context, groupId: groupReference.groupId, chatListController: strongSelf), reactionItems: [], gesture: gesture)
|
let contextController = ContextController(account: strongSelf.context.account, presentationData: strongSelf.presentationData, source: .controller(ContextControllerContentSourceImpl(controller: chatListController, sourceNode: node, navigationController: strongSelf.navigationController as? NavigationController)), items: archiveContextMenuItems(context: strongSelf.context, groupId: groupId, chatListController: strongSelf), reactionItems: [], gesture: gesture)
|
||||||
strongSelf.presentInGlobalOverlay(contextController)
|
strongSelf.presentInGlobalOverlay(contextController)
|
||||||
case let .peer(_, peer, _, _, _, _, _, _, promoInfo, _, _, _):
|
case let .peer(_, peer, _, _, _, _, _, _, promoInfo, _, _, _):
|
||||||
let chatController = strongSelf.context.sharedContext.makeChatController(context: strongSelf.context, chatLocation: .peer(peer.peerId), subject: nil, botStart: nil, mode: .standard(previewing: true))
|
let chatController = strongSelf.context.sharedContext.makeChatController(context: strongSelf.context, chatLocation: .peer(peer.peerId), subject: nil, botStart: nil, mode: .standard(previewing: true))
|
||||||
@ -1481,8 +1481,8 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
switch entry {
|
switch entry {
|
||||||
case .all:
|
case .all:
|
||||||
return nil
|
return nil
|
||||||
case let .filter(filter):
|
case let .filter(id, _, _):
|
||||||
return filter.id
|
return id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1996,7 +1996,6 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if value == .commit {
|
if value == .commit {
|
||||||
let context = strongSelf.context
|
|
||||||
let presentationData = strongSelf.presentationData
|
let presentationData = strongSelf.presentationData
|
||||||
let progressSignal = Signal<Never, NoError> { subscriber in
|
let progressSignal = Signal<Never, NoError> { subscriber in
|
||||||
let controller = OverlayStatusController(theme: presentationData.theme, type: .loading(cancelled: nil))
|
let controller = OverlayStatusController(theme: presentationData.theme, type: .loading(cancelled: nil))
|
||||||
|
@ -1165,10 +1165,7 @@ final class ChatListControllerNode: ASDisplayNode {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var filter: ChatListNodePeersFilter = []
|
let filter: ChatListNodePeersFilter = []
|
||||||
if false, case .group = self.groupId {
|
|
||||||
filter.insert(.excludeRecent)
|
|
||||||
}
|
|
||||||
|
|
||||||
let contentNode = ChatListSearchContainerNode(context: self.context, filter: filter, groupId: self.groupId, displaySearchFilters: displaySearchFilters, initialFilter: initialFilter, openPeer: { [weak self] peer, _, dismissSearch in
|
let contentNode = ChatListSearchContainerNode(context: self.context, filter: filter, groupId: self.groupId, displaySearchFilters: displaySearchFilters, initialFilter: initialFilter, openPeer: { [weak self] peer, _, dismissSearch in
|
||||||
self?.requestOpenPeerFromSearch?(peer, dismissSearch)
|
self?.requestOpenPeerFromSearch?(peer, dismissSearch)
|
||||||
|
@ -157,7 +157,6 @@ class ChatListFilterPresetCategoryItemNode: ItemListRevealOptionsItemNode, ItemL
|
|||||||
|
|
||||||
func asyncLayout() -> (_ item: ChatListFilterPresetCategoryItem, _ params: ListViewItemLayoutParams, _ neighbors: ItemListNeighbors, _ headerAtTop: Bool) -> (ListViewItemNodeLayout, (Bool, Bool) -> Void) {
|
func asyncLayout() -> (_ item: ChatListFilterPresetCategoryItem, _ params: ListViewItemLayoutParams, _ neighbors: ItemListNeighbors, _ headerAtTop: Bool) -> (ListViewItemNodeLayout, (Bool, Bool) -> Void) {
|
||||||
let makeTitleLayout = TextNode.asyncLayout(self.titleNode)
|
let makeTitleLayout = TextNode.asyncLayout(self.titleNode)
|
||||||
let editableControlLayout = ItemListEditableControlNode.asyncLayout(self.editableControlNode)
|
|
||||||
|
|
||||||
let currentItem = self.item
|
let currentItem = self.item
|
||||||
|
|
||||||
@ -193,16 +192,10 @@ class ChatListFilterPresetCategoryItemNode: ItemListRevealOptionsItemNode, ItemL
|
|||||||
avatarSize = 40.0
|
avatarSize = 40.0
|
||||||
leftInset = 65.0 + params.leftInset
|
leftInset = 65.0 + params.leftInset
|
||||||
|
|
||||||
var editableControlSizeAndApply: (CGFloat, (CGFloat) -> ItemListEditableControlNode)?
|
let editableControlSizeAndApply: (CGFloat, (CGFloat) -> ItemListEditableControlNode)? = nil
|
||||||
|
|
||||||
let editingOffset: CGFloat
|
let editingOffset: CGFloat
|
||||||
if false {
|
editingOffset = 0.0
|
||||||
let sizeAndApply = editableControlLayout(item.presentationData.theme, false)
|
|
||||||
editableControlSizeAndApply = sizeAndApply
|
|
||||||
editingOffset = sizeAndApply.0
|
|
||||||
} else {
|
|
||||||
editingOffset = 0.0
|
|
||||||
}
|
|
||||||
|
|
||||||
let (titleLayout, titleApply) = makeTitleLayout(TextNodeLayoutArguments(attributedString: titleAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - 12.0 - editingOffset - rightInset, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
let (titleLayout, titleApply) = makeTitleLayout(TextNodeLayoutArguments(attributedString: titleAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - 12.0 - editingOffset - rightInset, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||||
|
|
||||||
|
@ -260,8 +260,8 @@ private enum ChatListFilterPresetEntry: ItemListNodeEntry {
|
|||||||
return .index(3)
|
return .index(3)
|
||||||
case .addIncludePeer:
|
case .addIncludePeer:
|
||||||
return .index(4)
|
return .index(4)
|
||||||
case let .includeCategory(includeCategory):
|
case let .includeCategory(_, category, _, _):
|
||||||
return .includeCategory(includeCategory.category)
|
return .includeCategory(category)
|
||||||
case .includeExpand:
|
case .includeExpand:
|
||||||
return .index(5)
|
return .index(5)
|
||||||
case .includePeerInfo:
|
case .includePeerInfo:
|
||||||
@ -270,16 +270,16 @@ private enum ChatListFilterPresetEntry: ItemListNodeEntry {
|
|||||||
return .index(7)
|
return .index(7)
|
||||||
case .addExcludePeer:
|
case .addExcludePeer:
|
||||||
return .index(8)
|
return .index(8)
|
||||||
case let .excludeCategory(excludeCategory):
|
case let .excludeCategory(_, category, _, _):
|
||||||
return .excludeCategory(excludeCategory.category)
|
return .excludeCategory(category)
|
||||||
case .excludeExpand:
|
case .excludeExpand:
|
||||||
return .index(9)
|
return .index(9)
|
||||||
case .excludePeerInfo:
|
case .excludePeerInfo:
|
||||||
return .index(10)
|
return .index(10)
|
||||||
case let .includePeer(peer):
|
case let .includePeer(_, peer, _):
|
||||||
return .peer(peer.peer.peerId)
|
return .peer(peer.peerId)
|
||||||
case let .excludePeer(peer):
|
case let .excludePeer(_, peer, _):
|
||||||
return .peer(peer.peer.peerId)
|
return .peer(peer.peerId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,10 +295,10 @@ private enum ChatListFilterPresetEntry: ItemListNodeEntry {
|
|||||||
return .includeIndex(0)
|
return .includeIndex(0)
|
||||||
case .addIncludePeer:
|
case .addIncludePeer:
|
||||||
return .includeIndex(1)
|
return .includeIndex(1)
|
||||||
case let .includeCategory(includeCategory):
|
case let .includeCategory(index, _, _, _):
|
||||||
return .includeIndex(2 + includeCategory.index)
|
return .includeIndex(2 + index)
|
||||||
case let .includePeer(includePeer):
|
case let .includePeer(index, _, _):
|
||||||
return .includeIndex(200 + includePeer.index)
|
return .includeIndex(200 + index)
|
||||||
case .includeExpand:
|
case .includeExpand:
|
||||||
return .includeIndex(999)
|
return .includeIndex(999)
|
||||||
case .includePeerInfo:
|
case .includePeerInfo:
|
||||||
@ -307,10 +307,10 @@ private enum ChatListFilterPresetEntry: ItemListNodeEntry {
|
|||||||
return .excludeIndex(0)
|
return .excludeIndex(0)
|
||||||
case .addExcludePeer:
|
case .addExcludePeer:
|
||||||
return .excludeIndex(1)
|
return .excludeIndex(1)
|
||||||
case let .excludeCategory(excludeCategory):
|
case let .excludeCategory(index, _, _, _):
|
||||||
return .excludeIndex(2 + excludeCategory.index)
|
return .excludeIndex(2 + index)
|
||||||
case let .excludePeer(excludePeer):
|
case let .excludePeer(index, _, _):
|
||||||
return .excludeIndex(200 + excludePeer.index)
|
return .excludeIndex(200 + index)
|
||||||
case .excludeExpand:
|
case .excludeExpand:
|
||||||
return .excludeIndex(999)
|
return .excludeIndex(999)
|
||||||
case .excludePeerInfo:
|
case .excludePeerInfo:
|
||||||
|
@ -94,16 +94,16 @@ private enum ChatListFilterPresetListEntry: ItemListNodeEntry {
|
|||||||
return 0
|
return 0
|
||||||
case .listHeader:
|
case .listHeader:
|
||||||
return 100
|
return 100
|
||||||
case let .preset(preset):
|
case let .preset(index, _, _, _, _, _, _):
|
||||||
return 101 + preset.index.value
|
return 101 + index.value
|
||||||
case .addItem:
|
case .addItem:
|
||||||
return 1000
|
return 1000
|
||||||
case .listFooter:
|
case .listFooter:
|
||||||
return 1001
|
return 1001
|
||||||
case .suggestedListHeader:
|
case .suggestedListHeader:
|
||||||
return 1002
|
return 1002
|
||||||
case let .suggestedPreset(suggestedPreset):
|
case let .suggestedPreset(index, _, _, _):
|
||||||
return 1003 + suggestedPreset.index.value
|
return 1003 + index.value
|
||||||
case .suggestedAddCustom:
|
case .suggestedAddCustom:
|
||||||
return 2000
|
return 2000
|
||||||
}
|
}
|
||||||
@ -115,14 +115,14 @@ private enum ChatListFilterPresetListEntry: ItemListNodeEntry {
|
|||||||
return .screenHeader
|
return .screenHeader
|
||||||
case .suggestedListHeader:
|
case .suggestedListHeader:
|
||||||
return .suggestedListHeader
|
return .suggestedListHeader
|
||||||
case let .suggestedPreset(suggestedPreset):
|
case let .suggestedPreset(_, _, _, preset):
|
||||||
return .suggestedPreset(suggestedPreset.preset)
|
return .suggestedPreset(preset)
|
||||||
case .suggestedAddCustom:
|
case .suggestedAddCustom:
|
||||||
return .suggestedAddCustom
|
return .suggestedAddCustom
|
||||||
case .listHeader:
|
case .listHeader:
|
||||||
return .listHeader
|
return .listHeader
|
||||||
case let .preset(preset):
|
case let .preset(_, _, _, preset, _, _, _):
|
||||||
return .preset(preset.preset.id)
|
return .preset(preset.id)
|
||||||
case .addItem:
|
case .addItem:
|
||||||
return .addItem
|
return .addItem
|
||||||
case .listFooter:
|
case .listFooter:
|
||||||
@ -297,8 +297,6 @@ public func chatListFilterPresetListController(context: AccountContext, mode: Ch
|
|||||||
presentControllerImpl?(actionSheet)
|
presentControllerImpl?(actionSheet)
|
||||||
})
|
})
|
||||||
|
|
||||||
let chatCountCache = Atomic<[ChatListFilterData: Int]>(value: [:])
|
|
||||||
|
|
||||||
let filtersWithCountsSignal = context.engine.peers.updatedChatListFilters()
|
let filtersWithCountsSignal = context.engine.peers.updatedChatListFilters()
|
||||||
|> distinctUntilChanged
|
|> distinctUntilChanged
|
||||||
|> mapToSignal { filters -> Signal<[(ChatListFilter, Int)], NoError> in
|
|> mapToSignal { filters -> Signal<[(ChatListFilter, Int)], NoError> in
|
||||||
@ -430,7 +428,7 @@ public func chatListFilterPresetListController(context: AccountContext, mode: Ch
|
|||||||
}
|
}
|
||||||
controller.setReorderEntry({ (fromIndex: Int, toIndex: Int, entries: [ChatListFilterPresetListEntry]) -> Signal<Bool, NoError> in
|
controller.setReorderEntry({ (fromIndex: Int, toIndex: Int, entries: [ChatListFilterPresetListEntry]) -> Signal<Bool, NoError> in
|
||||||
let fromEntry = entries[fromIndex]
|
let fromEntry = entries[fromIndex]
|
||||||
guard case let .preset(fromFilter) = fromEntry else {
|
guard case let .preset(_, _, _, fromPreset, _, _, _) = fromEntry else {
|
||||||
return .single(false)
|
return .single(false)
|
||||||
}
|
}
|
||||||
var referenceFilter: ChatListFilter?
|
var referenceFilter: ChatListFilter?
|
||||||
@ -438,8 +436,8 @@ public func chatListFilterPresetListController(context: AccountContext, mode: Ch
|
|||||||
var afterAll = false
|
var afterAll = false
|
||||||
if toIndex < entries.count {
|
if toIndex < entries.count {
|
||||||
switch entries[toIndex] {
|
switch entries[toIndex] {
|
||||||
case let .preset(toFilter):
|
case let .preset(_, _, _, preset, _, _, _):
|
||||||
referenceFilter = toFilter.preset
|
referenceFilter = preset
|
||||||
default:
|
default:
|
||||||
if entries[toIndex] < fromEntry {
|
if entries[toIndex] < fromEntry {
|
||||||
beforeAll = true
|
beforeAll = true
|
||||||
@ -459,7 +457,7 @@ public func chatListFilterPresetListController(context: AccountContext, mode: Ch
|
|||||||
var filters = filtersWithAppliedOrder(filters: filtersWithCountsValue, order: updatedFilterOrderValue).map { $0.0 }
|
var filters = filtersWithAppliedOrder(filters: filtersWithCountsValue, order: updatedFilterOrderValue).map { $0.0 }
|
||||||
let initialOrder = filters.map { $0.id }
|
let initialOrder = filters.map { $0.id }
|
||||||
|
|
||||||
if let index = filters.firstIndex(where: { $0.id == fromFilter.preset.id }) {
|
if let index = filters.firstIndex(where: { $0.id == fromPreset.id }) {
|
||||||
filters.remove(at: index)
|
filters.remove(at: index)
|
||||||
}
|
}
|
||||||
if let referenceFilter = referenceFilter {
|
if let referenceFilter = referenceFilter {
|
||||||
@ -467,21 +465,21 @@ public func chatListFilterPresetListController(context: AccountContext, mode: Ch
|
|||||||
for i in 0 ..< filters.count {
|
for i in 0 ..< filters.count {
|
||||||
if filters[i].id == referenceFilter.id {
|
if filters[i].id == referenceFilter.id {
|
||||||
if fromIndex < toIndex {
|
if fromIndex < toIndex {
|
||||||
filters.insert(fromFilter.preset, at: i + 1)
|
filters.insert(fromPreset, at: i + 1)
|
||||||
} else {
|
} else {
|
||||||
filters.insert(fromFilter.preset, at: i)
|
filters.insert(fromPreset, at: i)
|
||||||
}
|
}
|
||||||
inserted = true
|
inserted = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !inserted {
|
if !inserted {
|
||||||
filters.append(fromFilter.preset)
|
filters.append(fromPreset)
|
||||||
}
|
}
|
||||||
} else if beforeAll {
|
} else if beforeAll {
|
||||||
filters.insert(fromFilter.preset, at: 0)
|
filters.insert(fromPreset, at: 0)
|
||||||
} else if afterAll {
|
} else if afterAll {
|
||||||
filters.append(fromFilter.preset)
|
filters.append(fromPreset)
|
||||||
}
|
}
|
||||||
|
|
||||||
let updatedOrder = filters.map { $0.id }
|
let updatedOrder = filters.map { $0.id }
|
||||||
|
@ -146,7 +146,7 @@ private final class ItemNode: ASDisplayNode {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if isExtracted, let theme = strongSelf.theme {
|
if isExtracted {
|
||||||
strongSelf.extractedBackgroundNode.image = generateStretchableFilledCircleImage(diameter: 32.0, color: strongSelf.isSelected ? UIColor(rgb: 0xbbbbbb) : UIColor(rgb: 0xf1f1f1))
|
strongSelf.extractedBackgroundNode.image = generateStretchableFilledCircleImage(diameter: 32.0, color: strongSelf.isSelected ? UIColor(rgb: 0xbbbbbb) : UIColor(rgb: 0xf1f1f1))
|
||||||
}
|
}
|
||||||
transition.updateAlpha(node: strongSelf.extractedBackgroundNode, alpha: isExtracted ? 1.0 : 0.0, completion: { _ in
|
transition.updateAlpha(node: strongSelf.extractedBackgroundNode, alpha: isExtracted ? 1.0 : 0.0, completion: { _ in
|
||||||
@ -652,8 +652,8 @@ final class ChatListFilterTabInlineContainerNode: ASDisplayNode {
|
|||||||
strongSelf.scrollNode.view.panGestureRecognizer.isEnabled = true
|
strongSelf.scrollNode.view.panGestureRecognizer.isEnabled = true
|
||||||
strongSelf.scrollNode.view.setContentOffset(strongSelf.scrollNode.view.contentOffset, animated: false)
|
strongSelf.scrollNode.view.setContentOffset(strongSelf.scrollNode.view.contentOffset, animated: false)
|
||||||
switch filter {
|
switch filter {
|
||||||
case let .filter(filter):
|
case let .filter(id, _, _):
|
||||||
strongSelf.contextGesture?(filter.id, sourceNode, gesture)
|
strongSelf.contextGesture?(id, sourceNode, gesture)
|
||||||
default:
|
default:
|
||||||
strongSelf.contextGesture?(nil, sourceNode, gesture)
|
strongSelf.contextGesture?(nil, sourceNode, gesture)
|
||||||
}
|
}
|
||||||
@ -666,11 +666,11 @@ final class ChatListFilterTabInlineContainerNode: ASDisplayNode {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
switch filter {
|
switch filter {
|
||||||
case let .filter(filter):
|
case let .filter(id, _, _):
|
||||||
strongSelf.scrollNode.view.panGestureRecognizer.isEnabled = false
|
strongSelf.scrollNode.view.panGestureRecognizer.isEnabled = false
|
||||||
strongSelf.scrollNode.view.panGestureRecognizer.isEnabled = true
|
strongSelf.scrollNode.view.panGestureRecognizer.isEnabled = true
|
||||||
strongSelf.scrollNode.view.setContentOffset(strongSelf.scrollNode.view.contentOffset, animated: false)
|
strongSelf.scrollNode.view.setContentOffset(strongSelf.scrollNode.view.contentOffset, animated: false)
|
||||||
strongSelf.contextGesture?(filter.id, sourceNode, gesture)
|
strongSelf.contextGesture?(id, sourceNode, gesture)
|
||||||
default:
|
default:
|
||||||
strongSelf.contextGesture?(nil, sourceNode, gesture)
|
strongSelf.contextGesture?(nil, sourceNode, gesture)
|
||||||
}
|
}
|
||||||
@ -685,9 +685,9 @@ final class ChatListFilterTabInlineContainerNode: ASDisplayNode {
|
|||||||
unreadCount = count
|
unreadCount = count
|
||||||
unreadHasUnmuted = true
|
unreadHasUnmuted = true
|
||||||
isNoFilter = true
|
isNoFilter = true
|
||||||
case let .filter(filter):
|
case let .filter(_, _, unread):
|
||||||
unreadCount = filter.unread.value
|
unreadCount = unread.value
|
||||||
unreadHasUnmuted = filter.unread.hasUnmuted
|
unreadHasUnmuted = unread.hasUnmuted
|
||||||
}
|
}
|
||||||
if !wasAdded && (itemNodePair.regular.unreadCount != 0) != (unreadCount != 0) {
|
if !wasAdded && (itemNodePair.regular.unreadCount != 0) != (unreadCount != 0) {
|
||||||
badgeAnimations[filter.id] = (unreadCount != 0) ? .in : .out
|
badgeAnimations[filter.id] = (unreadCount != 0) ? .in : .out
|
||||||
@ -830,9 +830,7 @@ final class ChatListFilterTabInlineContainerNode: ASDisplayNode {
|
|||||||
transition.updateFrame(node: self.itemsBackgroundTintNode, frame: backgroundFrame)
|
transition.updateFrame(node: self.itemsBackgroundTintNode, frame: backgroundFrame)
|
||||||
|
|
||||||
self.scrollNode.view.contentSize = CGSize(width: itemsBackgroundRightX + 8.0, height: size.height)
|
self.scrollNode.view.contentSize = CGSize(width: itemsBackgroundRightX + 8.0, height: size.height)
|
||||||
|
|
||||||
var previousFrame: CGRect?
|
|
||||||
var nextFrame: CGRect?
|
|
||||||
var selectedFrame: CGRect?
|
var selectedFrame: CGRect?
|
||||||
if let selectedFilter = selectedFilter, let currentIndex = reorderedFilters.firstIndex(where: { $0.id == selectedFilter }) {
|
if let selectedFilter = selectedFilter, let currentIndex = reorderedFilters.firstIndex(where: { $0.id == selectedFilter }) {
|
||||||
func interpolateFrame(from fromValue: CGRect, to toValue: CGRect, t: CGFloat) -> CGRect {
|
func interpolateFrame(from fromValue: CGRect, to toValue: CGRect, t: CGFloat) -> CGRect {
|
||||||
|
@ -122,9 +122,9 @@ class ChatListRecentPeersListItemNode: ListViewItemNode {
|
|||||||
peersNode.updateThemeAndStrings(theme: item.theme, strings: item.strings)
|
peersNode.updateThemeAndStrings(theme: item.theme, strings: item.strings)
|
||||||
} else {
|
} else {
|
||||||
peersNode = ChatListSearchRecentPeersNode(context: item.context, theme: item.theme, mode: .list, strings: item.strings, peerSelected: { peer in
|
peersNode = ChatListSearchRecentPeersNode(context: item.context, theme: item.theme, mode: .list, strings: item.strings, peerSelected: { peer in
|
||||||
self?.item?.peerSelected(peer)
|
self?.item?.peerSelected(peer._asPeer())
|
||||||
}, peerContextAction: { peer, node, gesture in
|
}, peerContextAction: { peer, node, gesture in
|
||||||
self?.item?.peerContextAction(peer, node, gesture)
|
self?.item?.peerContextAction(peer._asPeer(), node, gesture)
|
||||||
}, isPeerSelected: { _ in
|
}, isPeerSelected: { _ in
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
@ -827,14 +827,11 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
|
|||||||
if let strongSelf = self, !actions.options.isEmpty {
|
if let strongSelf = self, !actions.options.isEmpty {
|
||||||
let actionSheet = ActionSheetController(presentationData: strongSelf.presentationData)
|
let actionSheet = ActionSheetController(presentationData: strongSelf.presentationData)
|
||||||
var items: [ActionSheetItem] = []
|
var items: [ActionSheetItem] = []
|
||||||
var personalPeerName: String?
|
let personalPeerName: String? = nil
|
||||||
var isChannel = false
|
|
||||||
|
|
||||||
if actions.options.contains(.deleteGlobally) {
|
if actions.options.contains(.deleteGlobally) {
|
||||||
let globalTitle: String
|
let globalTitle: String
|
||||||
if isChannel {
|
if let personalPeerName = personalPeerName {
|
||||||
globalTitle = strongSelf.presentationData.strings.Conversation_DeleteMessagesForMe
|
|
||||||
} else if let personalPeerName = personalPeerName {
|
|
||||||
globalTitle = strongSelf.presentationData.strings.Conversation_DeleteMessagesFor(personalPeerName).string
|
globalTitle = strongSelf.presentationData.strings.Conversation_DeleteMessagesFor(personalPeerName).string
|
||||||
} else {
|
} else {
|
||||||
globalTitle = strongSelf.presentationData.strings.Conversation_DeleteMessagesForEveryone
|
globalTitle = strongSelf.presentationData.strings.Conversation_DeleteMessagesForEveryone
|
||||||
@ -854,14 +851,7 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
if actions.options.contains(.deleteLocally) {
|
if actions.options.contains(.deleteLocally) {
|
||||||
var localOptionText = strongSelf.presentationData.strings.Conversation_DeleteMessagesForMe
|
let localOptionText = strongSelf.presentationData.strings.Conversation_DeleteMessagesForMe
|
||||||
// if strongSelf.context.account.peerId == strongSelf.peerId {
|
|
||||||
// if messageIds.count == 1 {
|
|
||||||
// localOptionText = strongSelf.presentationData.strings.Conversation_Moderate_Delete
|
|
||||||
// } else {
|
|
||||||
// localOptionText = strongSelf.presentationData.strings.Conversation_DeleteManyMessages
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
items.append(ActionSheetButtonItem(title: localOptionText, color: .destructive, action: { [weak actionSheet] in
|
items.append(ActionSheetButtonItem(title: localOptionText, color: .destructive, action: { [weak actionSheet] in
|
||||||
actionSheet?.dismissAnimated()
|
actionSheet?.dismissAnimated()
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
|
@ -676,12 +676,12 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
if peerValue.peerId.namespace == Namespaces.Peer.SecretChat {
|
if peerValue.peerId.namespace == Namespaces.Peer.SecretChat {
|
||||||
enablePreview = false
|
enablePreview = false
|
||||||
}
|
}
|
||||||
case let .groupReference(groupReference):
|
case let .groupReference(_, _, _, _, hiddenByDefault):
|
||||||
if let previousItem = previousItem, case let .groupReference(previousGroupReference) = previousItem.content, groupReference.hiddenByDefault != previousGroupReference.hiddenByDefault {
|
if let previousItem = previousItem, case let .groupReference(_, _, _, _, previousHiddenByDefault) = previousItem.content, hiddenByDefault != previousHiddenByDefault {
|
||||||
UIView.transition(with: self.avatarNode.view, duration: 0.3, options: [.transitionCrossDissolve], animations: {
|
UIView.transition(with: self.avatarNode.view, duration: 0.3, options: [.transitionCrossDissolve], animations: {
|
||||||
}, completion: nil)
|
}, completion: nil)
|
||||||
}
|
}
|
||||||
self.avatarNode.setPeer(context: item.context, theme: item.presentationData.theme, peer: peer.flatMap(EnginePeer.init), overrideImage: .archivedChatsIcon(hiddenByDefault: groupReference.hiddenByDefault), emptyColor: item.presentationData.theme.list.mediaPlaceholderColor, synchronousLoad: synchronousLoads)
|
self.avatarNode.setPeer(context: item.context, theme: item.presentationData.theme, peer: peer.flatMap(EnginePeer.init), overrideImage: .archivedChatsIcon(hiddenByDefault: hiddenByDefault), emptyColor: item.presentationData.theme.list.mediaPlaceholderColor, synchronousLoad: synchronousLoads)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let peer = peer {
|
if let peer = peer {
|
||||||
@ -825,7 +825,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
var groupHiddenByDefault = false
|
var groupHiddenByDefault = false
|
||||||
|
|
||||||
switch item.content {
|
switch item.content {
|
||||||
case let .peer(messagesValue, peerValue, combinedReadStateValue, isRemovedFromTotalUnreadCountValue, peerPresenceValue, summaryInfoValue, embeddedStateValue, inputActivitiesValue, promoInfoValue, ignoreUnreadBadge, displayAsMessageValue, hasFailedMessagesValue):
|
case let .peer(messagesValue, peerValue, combinedReadStateValue, isRemovedFromTotalUnreadCountValue, peerPresenceValue, summaryInfoValue, embeddedStateValue, inputActivitiesValue, promoInfoValue, ignoreUnreadBadge, displayAsMessageValue, _):
|
||||||
messages = messagesValue
|
messages = messagesValue
|
||||||
contentPeer = .chat(peerValue)
|
contentPeer = .chat(peerValue)
|
||||||
combinedReadState = combinedReadStateValue
|
combinedReadState = combinedReadStateValue
|
||||||
@ -1280,7 +1280,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var isMuted = isRemovedFromTotalUnreadCount
|
let isMuted = isRemovedFromTotalUnreadCount
|
||||||
if isMuted {
|
if isMuted {
|
||||||
currentMutedIconImage = PresentationResourcesChatList.mutedIcon(item.presentationData.theme)
|
currentMutedIconImage = PresentationResourcesChatList.mutedIcon(item.presentationData.theme)
|
||||||
}
|
}
|
||||||
@ -1351,7 +1351,6 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
|
|
||||||
let layoutOffset: CGFloat = 0.0
|
let layoutOffset: CGFloat = 0.0
|
||||||
|
|
||||||
let rawContentOriginX = 2.0
|
|
||||||
let rawContentWidth = params.width - leftInset - params.rightInset - 10.0 - editingOffset
|
let rawContentWidth = params.width - leftInset - params.rightInset - 10.0 - editingOffset
|
||||||
|
|
||||||
let (dateLayout, dateApply) = dateLayout(TextNodeLayoutArguments(attributedString: dateAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: rawContentWidth, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
let (dateLayout, dateApply) = dateLayout(TextNodeLayoutArguments(attributedString: dateAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: rawContentWidth, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||||
@ -1417,7 +1416,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
if !displayAsMessage {
|
if !displayAsMessage {
|
||||||
if let peer = renderedPeer.chatMainPeer as? TelegramUser, let presence = presence as? TelegramUserPresence, !isServicePeer(peer) && !peer.flags.contains(.isSupport) && peer.id != item.context.account.peerId {
|
if let peer = renderedPeer.chatMainPeer as? TelegramUser, let presence = presence as? TelegramUserPresence, !isServicePeer(peer) && !peer.flags.contains(.isSupport) && peer.id != item.context.account.peerId {
|
||||||
let updatedPresence = TelegramUserPresence(status: presence.status, lastActivity: 0)
|
let updatedPresence = TelegramUserPresence(status: presence.status, lastActivity: 0)
|
||||||
let relativeStatus = relativeUserPresenceStatus(updatedPresence, relativeTo: timestamp)
|
let relativeStatus = relativeUserPresenceStatus(EnginePeer.Presence(updatedPresence), relativeTo: timestamp)
|
||||||
if case .online = relativeStatus {
|
if case .online = relativeStatus {
|
||||||
online = true
|
online = true
|
||||||
}
|
}
|
||||||
@ -1825,7 +1824,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let separatorInset: CGFloat
|
let separatorInset: CGFloat
|
||||||
if case let .groupReference(groupReference) = item.content, groupReference.hiddenByDefault {
|
if case let .groupReference(_, _, _, _, hiddenByDefault) = item.content, hiddenByDefault {
|
||||||
separatorInset = 0.0
|
separatorInset = 0.0
|
||||||
} else if (!nextIsPinned && item.index.pinningIndex != nil) || last {
|
} else if (!nextIsPinned && item.index.pinningIndex != nil) || last {
|
||||||
separatorInset = 0.0
|
separatorInset = 0.0
|
||||||
@ -1840,7 +1839,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
if item.selected {
|
if item.selected {
|
||||||
backgroundColor = theme.itemSelectedBackgroundColor
|
backgroundColor = theme.itemSelectedBackgroundColor
|
||||||
} else if item.index.pinningIndex != nil {
|
} else if item.index.pinningIndex != nil {
|
||||||
if case let .groupReference(groupReference) = item.content, groupReference.hiddenByDefault {
|
if case let .groupReference(_, _, _, _, hiddenByDefault) = item.content, hiddenByDefault {
|
||||||
backgroundColor = theme.itemBackgroundColor
|
backgroundColor = theme.itemBackgroundColor
|
||||||
} else {
|
} else {
|
||||||
backgroundColor = theme.pinnedItemBackgroundColor
|
backgroundColor = theme.pinnedItemBackgroundColor
|
||||||
|
@ -964,8 +964,8 @@ public final class ChatListNode: ListView {
|
|||||||
if index.messageIndex.id.peerId == removingPeerId {
|
if index.messageIndex.id.peerId == removingPeerId {
|
||||||
didIncludeRemovingPeerId = true
|
didIncludeRemovingPeerId = true
|
||||||
}
|
}
|
||||||
} else if case let .GroupReferenceEntry(entry) = entry {
|
} else if case let .GroupReferenceEntry(_, _, _, _, _, _, _, _, hiddenByDefault) = entry {
|
||||||
didIncludeHiddenByDefaultArchive = entry.hiddenByDefault
|
didIncludeHiddenByDefaultArchive = hiddenByDefault
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -973,16 +973,16 @@ public final class ChatListNode: ListView {
|
|||||||
var doesIncludeArchive = false
|
var doesIncludeArchive = false
|
||||||
var doesIncludeHiddenByDefaultArchive = false
|
var doesIncludeHiddenByDefaultArchive = false
|
||||||
for entry in processedView.filteredEntries {
|
for entry in processedView.filteredEntries {
|
||||||
if case let .PeerEntry(peerEntry) = entry {
|
if case let .PeerEntry(index, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) = entry {
|
||||||
if peerEntry.index.pinningIndex != nil {
|
if index.pinningIndex != nil {
|
||||||
updatedPinnedChats.append(peerEntry.index.messageIndex.id.peerId)
|
updatedPinnedChats.append(index.messageIndex.id.peerId)
|
||||||
}
|
}
|
||||||
if peerEntry.index.messageIndex.id.peerId == removingPeerId {
|
if index.messageIndex.id.peerId == removingPeerId {
|
||||||
doesIncludeRemovingPeerId = true
|
doesIncludeRemovingPeerId = true
|
||||||
}
|
}
|
||||||
} else if case let .GroupReferenceEntry(entry) = entry {
|
} else if case let .GroupReferenceEntry(_, _, _, _, _, _, _, _, hiddenByDefault) = entry {
|
||||||
doesIncludeArchive = true
|
doesIncludeArchive = true
|
||||||
doesIncludeHiddenByDefaultArchive = entry.hiddenByDefault
|
doesIncludeHiddenByDefaultArchive = hiddenByDefault
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if previousPinnedChats != updatedPinnedChats {
|
if previousPinnedChats != updatedPinnedChats {
|
||||||
@ -1343,8 +1343,8 @@ public final class ChatListNode: ListView {
|
|||||||
var isHiddenArchiveVisible = false
|
var isHiddenArchiveVisible = false
|
||||||
strongSelf.forEachItemNode({ itemNode in
|
strongSelf.forEachItemNode({ itemNode in
|
||||||
if let itemNode = itemNode as? ChatListItemNode, let item = itemNode.item {
|
if let itemNode = itemNode as? ChatListItemNode, let item = itemNode.item {
|
||||||
if case let .groupReference(groupReference) = item.content {
|
if case let .groupReference(_, _, _, _, hiddenByDefault) = item.content {
|
||||||
if groupReference.hiddenByDefault {
|
if hiddenByDefault {
|
||||||
isHiddenArchiveVisible = true
|
isHiddenArchiveVisible = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1599,8 +1599,8 @@ public final class ChatListNode: ListView {
|
|||||||
for item in transition.insertItems {
|
for item in transition.insertItems {
|
||||||
if let item = item.item as? ChatListItem {
|
if let item = item.item as? ChatListItem {
|
||||||
switch item.content {
|
switch item.content {
|
||||||
case let .peer(peer):
|
case let .peer(_, peer, _, _, _, _, _, _, _, _, _, _):
|
||||||
insertedPeerIds.append(peer.peer.peerId)
|
insertedPeerIds.append(peer.peerId)
|
||||||
case .groupReference:
|
case .groupReference:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -64,8 +64,8 @@ enum ChatListNodeEntry: Comparable, Identifiable {
|
|||||||
return .index(index)
|
return .index(index)
|
||||||
case .ArchiveIntro:
|
case .ArchiveIntro:
|
||||||
return .index(ChatListIndex.absoluteUpperBound.successor)
|
return .index(ChatListIndex.absoluteUpperBound.successor)
|
||||||
case let .AdditionalCategory(additionalCategory):
|
case let .AdditionalCategory(index, _, _, _, _, _, _):
|
||||||
return .additionalCategory(additionalCategory.index)
|
return .additionalCategory(index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,8 +81,8 @@ enum ChatListNodeEntry: Comparable, Identifiable {
|
|||||||
return .GroupId(groupId)
|
return .GroupId(groupId)
|
||||||
case .ArchiveIntro:
|
case .ArchiveIntro:
|
||||||
return .ArchiveIntro
|
return .ArchiveIntro
|
||||||
case let .AdditionalCategory(additionalCategory):
|
case let .AdditionalCategory(_, id, _, _, _, _, _):
|
||||||
return .additionalCategory(additionalCategory.id)
|
return .additionalCategory(id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,12 +12,12 @@ enum ChatListNodeLocation: Equatable {
|
|||||||
|
|
||||||
var filter: ChatListFilter? {
|
var filter: ChatListFilter? {
|
||||||
switch self {
|
switch self {
|
||||||
case let .initial(initial):
|
case let .initial(_, filter):
|
||||||
return initial.filter
|
return filter
|
||||||
case let .navigation(navigation):
|
case let .navigation(_, filter):
|
||||||
return navigation.filter
|
return filter
|
||||||
case let .scroll(scroll):
|
case let .scroll(_, _, _, _, filter):
|
||||||
return scroll.filter
|
return filter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/Postbox:Postbox",
|
"//submodules/Postbox:Postbox",
|
||||||
|
@ -14,15 +14,15 @@ private func fetchRawData(prefix: String) -> Signal<Data, FetchError> {
|
|||||||
return Signal { subscriber in
|
return Signal { subscriber in
|
||||||
#if targetEnvironment(simulator)
|
#if targetEnvironment(simulator)
|
||||||
return EmptyDisposable
|
return EmptyDisposable
|
||||||
#endif
|
#else
|
||||||
|
|
||||||
let container = CKContainer.default()
|
let container = CKContainer.default()
|
||||||
let publicDatabase = container.database(with: .public)
|
let publicDatabase = container.database(with: .public)
|
||||||
let recordId = CKRecord.ID(recordName: "emergency-datacenter-\(prefix)")
|
let recordId = CKRecord.ID(recordName: "emergency-datacenter-\(prefix)")
|
||||||
publicDatabase.fetch(withRecordID: recordId, completionHandler: { record, error in
|
publicDatabase.fetch(withRecordID: recordId, completionHandler: { record, error in
|
||||||
if let error = error {
|
if let error = error {
|
||||||
print("publicDatabase.fetch error: \(error)")
|
print("publicDatabase.fetch error: \(error)")
|
||||||
if let error = error as? NSError, error.domain == CKError.errorDomain, error.code == 1 {
|
let nsError = error as NSError
|
||||||
|
if nsError.domain == CKError.errorDomain, nsError.code == 1 {
|
||||||
subscriber.putError(.networkUnavailable)
|
subscriber.putError(.networkUnavailable)
|
||||||
} else {
|
} else {
|
||||||
subscriber.putError(.generic)
|
subscriber.putError(.generic)
|
||||||
@ -46,8 +46,8 @@ private func fetchRawData(prefix: String) -> Signal<Data, FetchError> {
|
|||||||
})
|
})
|
||||||
|
|
||||||
return ActionDisposable {
|
return ActionDisposable {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Source/**/*.swift",
|
"Source/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
],
|
],
|
||||||
visibility = [
|
visibility = [
|
||||||
|
@ -80,7 +80,7 @@ public final class RootHostView<EnvironmentType: Equatable>: UIViewController {
|
|||||||
self.environment._isUpdated = false
|
self.environment._isUpdated = false
|
||||||
|
|
||||||
transition.setFrame(view: self.componentView, frame: CGRect(origin: CGPoint(), size: size))
|
transition.setFrame(view: self.componentView, frame: CGRect(origin: CGPoint(), size: size))
|
||||||
self.componentView.update(
|
let _ = self.componentView.update(
|
||||||
transition: transition,
|
transition: transition,
|
||||||
component: self.content,
|
component: self.content,
|
||||||
environment: {
|
environment: {
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
@ -17,6 +20,7 @@ swift_library(
|
|||||||
"//submodules/AlertUI:AlertUI",
|
"//submodules/AlertUI:AlertUI",
|
||||||
"//submodules/PresentationDataUtils:PresentationDataUtils",
|
"//submodules/PresentationDataUtils:PresentationDataUtils",
|
||||||
"//submodules/TextFormat:TextFormat",
|
"//submodules/TextFormat:TextFormat",
|
||||||
|
"//submodules/ObjCRuntimeUtils:ObjCRuntimeUtils",
|
||||||
],
|
],
|
||||||
visibility = [
|
visibility = [
|
||||||
"//visibility:public",
|
"//visibility:public",
|
||||||
|
@ -260,8 +260,8 @@ private enum CreatePollEntry: ItemListNodeEntry {
|
|||||||
switch self {
|
switch self {
|
||||||
case .text:
|
case .text:
|
||||||
return CreatePollEntryTag.text
|
return CreatePollEntryTag.text
|
||||||
case let .option(option):
|
case let .option(id, _, _, _, _, _, _, _, _):
|
||||||
return CreatePollEntryTag.option(option.id)
|
return CreatePollEntryTag.option(id)
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -276,8 +276,8 @@ private enum CreatePollEntry: ItemListNodeEntry {
|
|||||||
return .text
|
return .text
|
||||||
case .optionsHeader:
|
case .optionsHeader:
|
||||||
return .optionsHeader
|
return .optionsHeader
|
||||||
case let .option(option):
|
case let .option(id, _, _, _, _, _, _, _, _):
|
||||||
return .option(option.id)
|
return .option(id)
|
||||||
case .optionsInfo:
|
case .optionsInfo:
|
||||||
return .optionsInfo
|
return .optionsInfo
|
||||||
case .anonymousVotes:
|
case .anonymousVotes:
|
||||||
@ -305,7 +305,7 @@ private enum CreatePollEntry: ItemListNodeEntry {
|
|||||||
return 1
|
return 1
|
||||||
case .optionsHeader:
|
case .optionsHeader:
|
||||||
return 2
|
return 2
|
||||||
case let .option(option):
|
case .option:
|
||||||
return 3
|
return 3
|
||||||
case .optionsInfo:
|
case .optionsInfo:
|
||||||
return 1001
|
return 1001
|
||||||
@ -328,10 +328,10 @@ private enum CreatePollEntry: ItemListNodeEntry {
|
|||||||
|
|
||||||
static func <(lhs: CreatePollEntry, rhs: CreatePollEntry) -> Bool {
|
static func <(lhs: CreatePollEntry, rhs: CreatePollEntry) -> Bool {
|
||||||
switch lhs {
|
switch lhs {
|
||||||
case let .option(lhsOption):
|
case let .option(_, lhsOrdering, _, _, _, _, _, _, _):
|
||||||
switch rhs {
|
switch rhs {
|
||||||
case let .option(rhsOption):
|
case let .option(_, rhsOrdering, _, _, _, _, _, _, _):
|
||||||
return lhsOption.ordering < rhsOption.ordering
|
return lhsOrdering < rhsOrdering
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -992,17 +992,16 @@ public func createPollController(context: AccountContext, peer: Peer, isQuiz: Bo
|
|||||||
}
|
}
|
||||||
controller.setReorderEntry({ (fromIndex: Int, toIndex: Int, entries: [CreatePollEntry]) -> Signal<Bool, NoError> in
|
controller.setReorderEntry({ (fromIndex: Int, toIndex: Int, entries: [CreatePollEntry]) -> Signal<Bool, NoError> in
|
||||||
let fromEntry = entries[fromIndex]
|
let fromEntry = entries[fromIndex]
|
||||||
guard case let .option(option) = fromEntry else {
|
guard case let .option(id, _, _, _, _, _, _, _, _) = fromEntry else {
|
||||||
return .single(false)
|
return .single(false)
|
||||||
}
|
}
|
||||||
let id = option.id
|
|
||||||
var referenceId: Int?
|
var referenceId: Int?
|
||||||
var beforeAll = false
|
var beforeAll = false
|
||||||
var afterAll = false
|
var afterAll = false
|
||||||
if toIndex < entries.count {
|
if toIndex < entries.count {
|
||||||
switch entries[toIndex] {
|
switch entries[toIndex] {
|
||||||
case let .option(toOption):
|
case let .option(toId, _, _, _, _, _, _, _, _):
|
||||||
referenceId = toOption.id
|
referenceId = toId
|
||||||
default:
|
default:
|
||||||
if entries[toIndex] < fromEntry {
|
if entries[toIndex] < fromEntry {
|
||||||
beforeAll = true
|
beforeAll = true
|
||||||
|
@ -6,6 +6,7 @@ import SwiftSignalKit
|
|||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
import ItemListUI
|
import ItemListUI
|
||||||
import TextFormat
|
import TextFormat
|
||||||
|
import ObjCRuntimeUtils
|
||||||
|
|
||||||
public enum CreatePollTextInputItemTextLimitMode {
|
public enum CreatePollTextInputItemTextLimitMode {
|
||||||
case characters
|
case characters
|
||||||
@ -292,7 +293,7 @@ public class CreatePollTextInputItemNode: ListViewItemNode, ASEditableTextNodeDe
|
|||||||
let textLength: Int
|
let textLength: Int
|
||||||
switch maxLength.mode {
|
switch maxLength.mode {
|
||||||
case .characters:
|
case .characters:
|
||||||
textLength = item.text.string.count ?? 0
|
textLength = item.text.string.count
|
||||||
case .bytes:
|
case .bytes:
|
||||||
textLength = item.text.string.data(using: .utf8, allowLossyConversion: true)?.count ?? 0
|
textLength = item.text.string.data(using: .utf8, allowLossyConversion: true)?.count ?? 0
|
||||||
}
|
}
|
||||||
@ -511,7 +512,7 @@ public class CreatePollTextInputItemNode: ListViewItemNode, ASEditableTextNodeDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func editableTextNodeTarget(forAction action: Selector) -> ASEditableTextNodeTargetForAction? {
|
public func editableTextNodeTarget(forAction action: Selector) -> ASEditableTextNodeTargetForAction? {
|
||||||
if action == Selector(("_showTextStyleOptions:")) {
|
if action == makeSelectorFromString("_showTextStyleOptions:") {
|
||||||
if case .general = self.inputMenu.state {
|
if case .general = self.inputMenu.state {
|
||||||
if self.textNode.attributedText == nil || self.textNode.attributedText!.length == 0 || self.textNode.selectedRange.length == 0 {
|
if self.textNode.attributedText == nil || self.textNode.attributedText!.length == 0 || self.textNode.selectedRange.length == 0 {
|
||||||
return ASEditableTextNodeTargetForAction(target: nil)
|
return ASEditableTextNodeTargetForAction(target: nil)
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
|
@ -87,7 +87,6 @@ public final class ConfettiView: UIView {
|
|||||||
let velocityYRange = Float(3.0) ..< Float(5.0)
|
let velocityYRange = Float(3.0) ..< Float(5.0)
|
||||||
let angularVelocityRange = Float(1.0) ..< Float(6.0)
|
let angularVelocityRange = Float(1.0) ..< Float(6.0)
|
||||||
let sizeVariation = Float(0.8) ..< Float(1.6)
|
let sizeVariation = Float(0.8) ..< Float(1.6)
|
||||||
let topDelayRange = Float(0.0) ..< Float(0.0)
|
|
||||||
|
|
||||||
for i in 0 ..< 70 {
|
for i in 0 ..< 70 {
|
||||||
let (image, size) = images[i % imageCount]
|
let (image, size) = images[i % imageCount]
|
||||||
@ -99,9 +98,6 @@ public final class ConfettiView: UIView {
|
|||||||
|
|
||||||
let sideMassRange: Range<Float> = 110.0 ..< 120.0
|
let sideMassRange: Range<Float> = 110.0 ..< 120.0
|
||||||
let sideOriginYBase: Float = Float(frame.size.height * 9.0 / 10.0)
|
let sideOriginYBase: Float = Float(frame.size.height * 9.0 / 10.0)
|
||||||
let sideOriginYVariation: Float = Float(frame.size.height / 12.0)
|
|
||||||
let sideOriginYRange = Float(sideOriginYBase - sideOriginYVariation) ..< Float(sideOriginYBase + sideOriginYVariation)
|
|
||||||
let sideOriginXRange = Float(0.0) ..< Float(100.0)
|
|
||||||
let sideOriginVelocityValueRange = Float(1.1) ..< Float(1.3)
|
let sideOriginVelocityValueRange = Float(1.1) ..< Float(1.3)
|
||||||
let sideOriginVelocityValueScaling: Float = 2400.0 * Float(frame.height) / 896.0
|
let sideOriginVelocityValueScaling: Float = 2400.0 * Float(frame.height) / 896.0
|
||||||
let sideOriginVelocityBase: Float = Float.pi / 2.0 + atanf(Float(CGFloat(sideOriginYBase) / (frame.size.width * 0.8)))
|
let sideOriginVelocityBase: Float = Float.pi / 2.0 + atanf(Float(CGFloat(sideOriginYBase) / (frame.size.width * 0.8)))
|
||||||
@ -152,11 +148,7 @@ public final class ConfettiView: UIView {
|
|||||||
self.slowdownStartTimestamps[0] = 0.33
|
self.slowdownStartTimestamps[0] = 0.33
|
||||||
|
|
||||||
var haveParticlesAboveGround = false
|
var haveParticlesAboveGround = false
|
||||||
let minPositionY: CGFloat = 0.0
|
|
||||||
let maxPositionY = self.bounds.height + 30.0
|
let maxPositionY = self.bounds.height + 30.0
|
||||||
let minDampingX: CGFloat = 40.0
|
|
||||||
let maxDampingX: CGFloat = self.bounds.width - 40.0
|
|
||||||
let centerX: CGFloat = self.bounds.width / 2.0
|
|
||||||
let dt: Float = 1.0 * 1.0 / 60.0
|
let dt: Float = 1.0 * 1.0 / 60.0
|
||||||
|
|
||||||
let typeDelays: [Float] = [0.0, 0.01, 0.08]
|
let typeDelays: [Float] = [0.0, 0.01, 0.08]
|
||||||
@ -220,7 +212,7 @@ public final class ConfettiView: UIView {
|
|||||||
var typesWithPositiveVelocity: [Bool] = [false, false, false]
|
var typesWithPositiveVelocity: [Bool] = [false, false, false]
|
||||||
|
|
||||||
for particle in self.particles {
|
for particle in self.particles {
|
||||||
let (localDt, damping_) = dtAndDamping[particle.type]
|
let (localDt, _) = dtAndDamping[particle.type]
|
||||||
if localDt.isZero {
|
if localDt.isZero {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
|
@ -1258,8 +1258,8 @@ public final class ContactListNode: ASDisplayNode {
|
|||||||
var peers: [(Peer, Int32)] = []
|
var peers: [(Peer, Int32)] = []
|
||||||
for entry in view.entries {
|
for entry in view.entries {
|
||||||
switch entry {
|
switch entry {
|
||||||
case let .MessageEntry(messageEntry):
|
case let .MessageEntry(_, _, _, _, _, renderedPeer, _, _, _, _):
|
||||||
if let peer = messageEntry.5.peer {
|
if let peer = renderedPeer.peer {
|
||||||
if peer is TelegramGroup {
|
if peer is TelegramGroup {
|
||||||
peers.append((peer, 0))
|
peers.append((peer, 0))
|
||||||
} else if let channel = peer as? TelegramChannel, case .group = channel.info {
|
} else if let channel = peer as? TelegramChannel, case .group = channel.info {
|
||||||
|
@ -48,7 +48,7 @@ private enum InviteContactsEntry: Comparable, Identifiable {
|
|||||||
|
|
||||||
func item(context: AccountContext, presentationData: PresentationData, interaction: InviteContactsInteraction) -> ListViewItem {
|
func item(context: AccountContext, presentationData: PresentationData, interaction: InviteContactsInteraction) -> ListViewItem {
|
||||||
switch self {
|
switch self {
|
||||||
case let .option(_, option, theme, _):
|
case let .option(_, option, _, _):
|
||||||
return ContactListActionItem(presentationData: ItemListPresentationData(presentationData), title: option.title, icon: option.icon, header: nil, action: option.action)
|
return ContactListActionItem(presentationData: ItemListPresentationData(presentationData), title: option.title, icon: option.icon, header: nil, action: option.action)
|
||||||
case let .peer(_, id, contact, count, selection, theme, strings, nameSortOrder, nameDisplayOrder):
|
case let .peer(_, id, contact, count, selection, theme, strings, nameSortOrder, nameDisplayOrder):
|
||||||
let status: ContactsPeerItemStatus
|
let status: ContactsPeerItemStatus
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
|
@ -1010,10 +1010,8 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
|
|||||||
var completedEffect = false
|
var completedEffect = false
|
||||||
var completedContentNode = false
|
var completedContentNode = false
|
||||||
var completedActionsNode = false
|
var completedActionsNode = false
|
||||||
var targetNode: ASDisplayNode?
|
|
||||||
|
|
||||||
if let transitionInfo = transitionInfo, let (sourceNode, sourceNodeRect) = transitionInfo.sourceNode() {
|
if let transitionInfo = transitionInfo, let (sourceNode, sourceNodeRect) = transitionInfo.sourceNode() {
|
||||||
targetNode = sourceNode
|
|
||||||
let projectedFrame = convertFrame(sourceNodeRect, from: sourceNode.view, to: self.view)
|
let projectedFrame = convertFrame(sourceNodeRect, from: sourceNode.view, to: self.view)
|
||||||
self.originalProjectedContentViewFrame = (projectedFrame, projectedFrame)
|
self.originalProjectedContentViewFrame = (projectedFrame, projectedFrame)
|
||||||
|
|
||||||
@ -1090,18 +1088,10 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
|
|||||||
animateOutToItem = false
|
animateOutToItem = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if animateOutToItem, let targetNode = targetNode, let originalProjectedContentViewFrame = self.originalProjectedContentViewFrame {
|
if animateOutToItem, let originalProjectedContentViewFrame = self.originalProjectedContentViewFrame {
|
||||||
let actionsSideInset: CGFloat = (validLayout?.safeInsets.left ?? 0.0) + 11.0
|
|
||||||
|
|
||||||
let localSourceFrame = self.view.convert(CGRect(origin: CGPoint(x: originalProjectedContentViewFrame.1.minX, y: originalProjectedContentViewFrame.1.minY), size: CGSize(width: originalProjectedContentViewFrame.1.width, height: originalProjectedContentViewFrame.1.height)), to: self.scrollNode.view)
|
let localSourceFrame = self.view.convert(CGRect(origin: CGPoint(x: originalProjectedContentViewFrame.1.minX, y: originalProjectedContentViewFrame.1.minY), size: CGSize(width: originalProjectedContentViewFrame.1.width, height: originalProjectedContentViewFrame.1.height)), to: self.scrollNode.view)
|
||||||
|
|
||||||
if let snapshotView = targetNode.view.snapshotContentTree(unhide: true, keepTransform: true), false {
|
|
||||||
self.view.addSubview(snapshotView)
|
|
||||||
snapshotView.layer.animatePosition(from: CGPoint(x: self.contentContainerNode.frame.midX, y: self.contentContainerNode.frame.minY + localSourceFrame.height / 2.0), to: localSourceFrame.center, duration: transitionDuration * animationDurationFactor, timingFunction: transitionCurve.timingFunction, removeOnCompletion: false)
|
|
||||||
snapshotView.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2 * animationDurationFactor, removeOnCompletion: false, completion: { _ in
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
self.actionsContainerNode.layer.animatePosition(from: CGPoint(), to: CGPoint(x: localSourceFrame.center.x - self.actionsContainerNode.position.x, y: localSourceFrame.center.y - self.actionsContainerNode.position.y), duration: transitionDuration * animationDurationFactor, timingFunction: transitionCurve.timingFunction, removeOnCompletion: false, additive: true)
|
self.actionsContainerNode.layer.animatePosition(from: CGPoint(), to: CGPoint(x: localSourceFrame.center.x - self.actionsContainerNode.position.x, y: localSourceFrame.center.y - self.actionsContainerNode.position.y), duration: transitionDuration * animationDurationFactor, timingFunction: transitionCurve.timingFunction, removeOnCompletion: false, additive: true)
|
||||||
let contentContainerOffset = CGPoint(x: localSourceFrame.center.x - self.contentContainerNode.frame.center.x, y: localSourceFrame.center.y - self.contentContainerNode.frame.center.y)
|
let contentContainerOffset = CGPoint(x: localSourceFrame.center.x - self.contentContainerNode.frame.center.x, y: localSourceFrame.center.y - self.contentContainerNode.frame.center.y)
|
||||||
self.contentContainerNode.layer.animatePosition(from: CGPoint(), to: contentContainerOffset, duration: transitionDuration * animationDurationFactor, timingFunction: transitionCurve.timingFunction, removeOnCompletion: false, additive: true, completion: { [weak self] _ in
|
self.contentContainerNode.layer.animatePosition(from: CGPoint(), to: contentContainerOffset, duration: transitionDuration * animationDurationFactor, timingFunction: transitionCurve.timingFunction, removeOnCompletion: false, additive: true, completion: { [weak self] _ in
|
||||||
@ -1724,7 +1714,7 @@ public final class ContextControllerReferenceViewInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol ContextReferenceContentSource: class {
|
public protocol ContextReferenceContentSource: AnyObject {
|
||||||
func transitionInfo() -> ContextControllerReferenceViewInfo?
|
func transitionInfo() -> ContextControllerReferenceViewInfo?
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1750,7 +1740,7 @@ public final class ContextControllerPutBackViewInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol ContextExtractedContentSource: class {
|
public protocol ContextExtractedContentSource: AnyObject {
|
||||||
var centerVertically: Bool { get }
|
var centerVertically: Bool { get }
|
||||||
var keepInPlace: Bool { get }
|
var keepInPlace: Bool { get }
|
||||||
var ignoreContentTouches: Bool { get }
|
var ignoreContentTouches: Bool { get }
|
||||||
@ -1781,7 +1771,7 @@ public final class ContextControllerTakeControllerInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol ContextControllerContentSource: class {
|
public protocol ContextControllerContentSource: AnyObject {
|
||||||
var controller: ViewController { get }
|
var controller: ViewController { get }
|
||||||
var navigationController: NavigationController? { get }
|
var navigationController: NavigationController? { get }
|
||||||
var passthroughTouches: Bool { get }
|
var passthroughTouches: Bool { get }
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
|
@ -4,7 +4,7 @@ import Display
|
|||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import AudioToolbox
|
import AudioToolbox
|
||||||
|
|
||||||
@objc public protocol PickerViewDelegate: class {
|
@objc public protocol PickerViewDelegate: AnyObject {
|
||||||
func pickerViewHeightForRows(_ pickerView: TapeNode) -> CGFloat
|
func pickerViewHeightForRows(_ pickerView: TapeNode) -> CGFloat
|
||||||
@objc optional func pickerView(_ pickerView: TapeNode, didSelectRow row: Int)
|
@objc optional func pickerView(_ pickerView: TapeNode, didSelectRow row: Int)
|
||||||
@objc optional func pickerView(_ pickerView: TapeNode, didTapRow row: Int)
|
@objc optional func pickerView(_ pickerView: TapeNode, didTapRow row: Int)
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
|
@ -75,11 +75,11 @@ private enum DebugAccountsControllerEntry: ItemListNodeEntry {
|
|||||||
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
|
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
|
||||||
let arguments = arguments as! DebugAccountsControllerArguments
|
let arguments = arguments as! DebugAccountsControllerArguments
|
||||||
switch self {
|
switch self {
|
||||||
case let .record(theme, record, current):
|
case let .record(_, record, current):
|
||||||
return ItemListCheckboxItem(presentationData: presentationData, title: "\(UInt64(bitPattern: record.id.int64))", style: .left, checked: current, zeroSeparatorInsets: false, sectionId: self.section, action: {
|
return ItemListCheckboxItem(presentationData: presentationData, title: "\(UInt64(bitPattern: record.id.int64))", style: .left, checked: current, zeroSeparatorInsets: false, sectionId: self.section, action: {
|
||||||
arguments.switchAccount(record.id)
|
arguments.switchAccount(record.id)
|
||||||
})
|
})
|
||||||
case let .loginNewAccount(theme):
|
case .loginNewAccount:
|
||||||
return ItemListActionItem(presentationData: presentationData, title: "Login to another account", kind: .generic, alignment: .natural, sectionId: self.section, style: .blocks, action: {
|
return ItemListActionItem(presentationData: presentationData, title: "Login to another account", kind: .generic, alignment: .natural, sectionId: self.section, style: .blocks, action: {
|
||||||
arguments.loginNewAccount()
|
arguments.loginNewAccount()
|
||||||
})
|
})
|
||||||
|
@ -617,7 +617,6 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||||||
let databasePath = context.account.basePath + "/postbox/db"
|
let databasePath = context.account.basePath + "/postbox/db"
|
||||||
let _ = try? FileManager.default.removeItem(atPath: databasePath)
|
let _ = try? FileManager.default.removeItem(atPath: databasePath)
|
||||||
exit(0)
|
exit(0)
|
||||||
preconditionFailure()
|
|
||||||
}),
|
}),
|
||||||
]), ActionSheetItemGroup(items: [
|
]), ActionSheetItemGroup(items: [
|
||||||
ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, color: .accent, font: .bold, action: { [weak actionSheet] in
|
ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, color: .accent, font: .bold, action: { [weak actionSheet] in
|
||||||
@ -640,7 +639,6 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||||||
let databasePath = context.account.basePath + "/postbox"
|
let databasePath = context.account.basePath + "/postbox"
|
||||||
let _ = try? FileManager.default.removeItem(atPath: databasePath)
|
let _ = try? FileManager.default.removeItem(atPath: databasePath)
|
||||||
exit(0)
|
exit(0)
|
||||||
preconditionFailure()
|
|
||||||
}),
|
}),
|
||||||
]), ActionSheetItemGroup(items: [
|
]), ActionSheetItemGroup(items: [
|
||||||
ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, color: .accent, font: .bold, action: { [weak actionSheet] in
|
ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, color: .accent, font: .bold, action: { [weak actionSheet] in
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/TelegramCore:TelegramCore",
|
"//submodules/TelegramCore:TelegramCore",
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
],
|
],
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
visibility = [
|
visibility = [
|
||||||
"//visibility:public",
|
"//visibility:public",
|
||||||
],
|
],
|
||||||
|
@ -6,6 +6,9 @@ swift_library(
|
|||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Source/**/*.swift",
|
"Source/**/*.swift",
|
||||||
]),
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/ObjCRuntimeUtils:ObjCRuntimeUtils",
|
"//submodules/ObjCRuntimeUtils:ObjCRuntimeUtils",
|
||||||
"//submodules/UIKitRuntimeUtils:UIKitRuntimeUtils",
|
"//submodules/UIKitRuntimeUtils:UIKitRuntimeUtils",
|
||||||
|
@ -2,11 +2,11 @@ import UIKit
|
|||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
|
|
||||||
public protocol PresentableController: class {
|
public protocol PresentableController: AnyObject {
|
||||||
func viewDidAppear(completion: @escaping () -> Void)
|
func viewDidAppear(completion: @escaping () -> Void)
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol ContainableController: class {
|
public protocol ContainableController: AnyObject {
|
||||||
var view: UIView! { get }
|
var view: UIView! { get }
|
||||||
var displayNode: ASDisplayNode { get }
|
var displayNode: ASDisplayNode { get }
|
||||||
var isViewLoaded: Bool { get }
|
var isViewLoaded: Bool { get }
|
||||||
|
@ -799,8 +799,6 @@ public extension ContainedViewLayoutTransition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func animateTransformScale(node: ASDisplayNode, from fromScale: CGPoint, completion: ((Bool) -> Void)? = nil) {
|
func animateTransformScale(node: ASDisplayNode, from fromScale: CGPoint, completion: ((Bool) -> Void)? = nil) {
|
||||||
let t = node.layer.transform
|
|
||||||
|
|
||||||
switch self {
|
switch self {
|
||||||
case .immediate:
|
case .immediate:
|
||||||
if let completion = completion {
|
if let completion = completion {
|
||||||
|
@ -553,7 +553,6 @@ public class DrawingContext {
|
|||||||
}
|
}
|
||||||
if self.hasGeneratedImage {
|
if self.hasGeneratedImage {
|
||||||
preconditionFailure()
|
preconditionFailure()
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
self.hasGeneratedImage = true
|
self.hasGeneratedImage = true
|
||||||
|
|
||||||
|
@ -2661,24 +2661,6 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !offset.isZero {
|
|
||||||
let scrollToItemTransition: ContainedViewLayoutTransition
|
|
||||||
if !scrollToItem.animated {
|
|
||||||
scrollToItemTransition = .immediate
|
|
||||||
} else {
|
|
||||||
switch scrollToItem.curve {
|
|
||||||
case let .Spring(duration):
|
|
||||||
scrollToItemTransition = .animated(duration: duration, curve: .spring)
|
|
||||||
case let .Default(duration):
|
|
||||||
scrollToItemTransition = .animated(duration: duration ?? 0.3, curve: .easeInOut)
|
|
||||||
case let .Custom(duration, cp1x, cp1y, cp2x, cp2y):
|
|
||||||
scrollToItemTransition = .animated(duration: duration, curve: .custom(cp1x, cp1y, cp2x, cp2y))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//self.didScrollWithOffset?(-offset, scrollToItemTransition, nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
for itemNode in self.itemNodes {
|
for itemNode in self.itemNodes {
|
||||||
var frame = itemNode.frame
|
var frame = itemNode.frame
|
||||||
frame.origin.y += offset
|
frame.origin.y += offset
|
||||||
@ -2750,24 +2732,6 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
|
|||||||
self.ensureTopInsetForOverlayHighlightedItems = updateSizeAndInsets.ensureTopInsetForOverlayHighlightedItems
|
self.ensureTopInsetForOverlayHighlightedItems = updateSizeAndInsets.ensureTopInsetForOverlayHighlightedItems
|
||||||
self.visibleSize = updateSizeAndInsets.size
|
self.visibleSize = updateSizeAndInsets.size
|
||||||
|
|
||||||
let updateSizeAndInsetsTransition: ContainedViewLayoutTransition
|
|
||||||
if updateSizeAndInsets.duration.isZero {
|
|
||||||
updateSizeAndInsetsTransition = .immediate
|
|
||||||
} else {
|
|
||||||
switch updateSizeAndInsets.curve {
|
|
||||||
case let .Spring(duration):
|
|
||||||
updateSizeAndInsetsTransition = .animated(duration: duration, curve: .spring)
|
|
||||||
case let .Default(duration):
|
|
||||||
updateSizeAndInsetsTransition = .animated(duration: duration ?? 0.3, curve: .easeInOut)
|
|
||||||
case let .Custom(duration, cp1x, cp1y, cp2x, cp2y):
|
|
||||||
updateSizeAndInsetsTransition = .animated(duration: duration, curve: .custom(cp1x, cp1y, cp2x, cp2y))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !offsetFix.isZero {
|
|
||||||
//self.didScrollWithOffset?(-offsetFix, updateSizeAndInsetsTransition, nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
for itemNode in self.itemNodes {
|
for itemNode in self.itemNodes {
|
||||||
itemNode.updateFrame(itemNode.frame.offsetBy(dx: 0.0, dy: offsetFix), within: self.visibleSize)
|
itemNode.updateFrame(itemNode.frame.offsetBy(dx: 0.0, dy: offsetFix), within: self.visibleSize)
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user