diff --git a/Telegram-iOS.xcworkspace/contents.xcworkspacedata b/Telegram-iOS.xcworkspace/contents.xcworkspacedata index 52c215445a..08888c0f5b 100644 --- a/Telegram-iOS.xcworkspace/contents.xcworkspacedata +++ b/Telegram-iOS.xcworkspace/contents.xcworkspacedata @@ -4,12 +4,24 @@ + + + + + + + + - - - - - - - - - - - - + location = "group:submodules/LiveLocationManager/LiveLocationManager_Xcode.xcodeproj"> + + + + + + + + + + + + + + + + + + + + @@ -105,13 +128,18 @@ + + + + + + - - - - diff --git a/submodules/AccountContext/AccountContext_Xcode.xcodeproj/project.pbxproj b/submodules/AccountContext/AccountContext_Xcode.xcodeproj/project.pbxproj index 9d03df44be..8de3624517 100644 --- a/submodules/AccountContext/AccountContext_Xcode.xcodeproj/project.pbxproj +++ b/submodules/AccountContext/AccountContext_Xcode.xcodeproj/project.pbxproj @@ -8,6 +8,30 @@ /* Begin PBXBuildFile section */ D06018E722F36A3F00796784 /* TelegramPresentationData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D06018E622F36A3F00796784 /* TelegramPresentationData.framework */; }; + D0879A4622F651D400C4D6B3 /* LiveLocationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879A4522F651D400C4D6B3 /* LiveLocationManager.swift */; }; + D0879A4A22F6584B00C4D6B3 /* SharedMediaPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879A4922F6584B00C4D6B3 /* SharedMediaPlayer.swift */; }; + D0879A4C22F65A7A00C4D6B3 /* UniversalMediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A4B22F65A7A00C4D6B3 /* UniversalMediaPlayer.framework */; }; + D0879A4E22F65B2A00C4D6B3 /* MediaManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879A4D22F65B2A00C4D6B3 /* MediaManager.swift */; }; + D0879A5022F65D4D00C4D6B3 /* ChatHistroyLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879A4F22F65D4D00C4D6B3 /* ChatHistroyLocation.swift */; }; + D0879AA222F6FEC800C4D6B3 /* OverlayAudioPlayerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879AA122F6FEC800C4D6B3 /* OverlayAudioPlayerController.swift */; }; + D0879B1922F70C7400C4D6B3 /* OpenChatMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879B1822F70C7400C4D6B3 /* OpenChatMessage.swift */; }; + D0879B1B22F70CF400C4D6B3 /* ChatController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879B1A22F70CF400C4D6B3 /* ChatController.swift */; }; + D0879B1D22F7112E00C4D6B3 /* GalleryController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879B1C22F7112E00C4D6B3 /* GalleryController.swift */; }; + D0879B2922F77C8300C4D6B3 /* FetchManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879B2822F77C8300C4D6B3 /* FetchManager.swift */; }; + D0879B2B22F795CC00C4D6B3 /* DeviceLocationManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B2A22F795CC00C4D6B3 /* DeviceLocationManager.framework */; }; + D0879B5322F7974800C4D6B3 /* TemporaryCachedPeerDataManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B5222F7974800C4D6B3 /* TemporaryCachedPeerDataManager.framework */; }; + D0879B5D22F7A2BE00C4D6B3 /* AsyncDisplayKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B5C22F7A2BE00C4D6B3 /* AsyncDisplayKit.framework */; }; + D0879B5F22F7A37100C4D6B3 /* TelegramAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B5E22F7A37100C4D6B3 /* TelegramAudio.framework */; }; + D0879B6122F7A7A600C4D6B3 /* UniversalVideoNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879B6022F7A7A600C4D6B3 /* UniversalVideoNode.swift */; }; + D0879B6322F7A97F00C4D6B3 /* OverlayMediaItemNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879B6222F7A97F00C4D6B3 /* OverlayMediaItemNode.swift */; }; + D0879B6522F7AC8700C4D6B3 /* OverlayMediaManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879B6422F7AC8700C4D6B3 /* OverlayMediaManager.swift */; }; + D0879B6722F7AE6400C4D6B3 /* PresentationCallManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879B6622F7AE6400C4D6B3 /* PresentationCallManager.swift */; }; + D0879B6922F7AF2A00C4D6B3 /* DeviceContactDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879B6822F7AF2A00C4D6B3 /* DeviceContactDataManager.swift */; }; + D0879B6B22F7B04400C4D6B3 /* DeviceContactData.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879B6A22F7B04400C4D6B3 /* DeviceContactData.swift */; }; + D0879B6D22F7B05300C4D6B3 /* Contacts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B6C22F7B05200C4D6B3 /* Contacts.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + D0879B6F22F83F6600C4D6B3 /* DownloadedMediaStoreManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879B6E22F83F6600C4D6B3 /* DownloadedMediaStoreManager.swift */; }; + D0879B7122F8425B00C4D6B3 /* WallpaperUploadManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879B7022F8425B00C4D6B3 /* WallpaperUploadManager.swift */; }; + D0879B7322F842FF00C4D6B3 /* WatchManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879B7222F842FF00C4D6B3 /* WatchManager.swift */; }; D0D3285422F329A900D07EE2 /* AccountContext.h in Headers */ = {isa = PBXBuildFile; fileRef = D0D3285222F329A900D07EE2 /* AccountContext.h */; settings = {ATTRIBUTES = (Public, ); }; }; D0D3285F22F335B000D07EE2 /* AccountContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0D3285E22F335B000D07EE2 /* AccountContext.swift */; }; D0D3289D22F3461700D07EE2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0D3289C22F3461700D07EE2 /* Foundation.framework */; }; @@ -19,6 +43,30 @@ /* Begin PBXFileReference section */ D06018E422F36A3900796784 /* DeviceAccess.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = DeviceAccess.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D06018E622F36A3F00796784 /* TelegramPresentationData.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramPresentationData.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879A4522F651D400C4D6B3 /* LiveLocationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiveLocationManager.swift; sourceTree = ""; }; + D0879A4922F6584B00C4D6B3 /* SharedMediaPlayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharedMediaPlayer.swift; sourceTree = ""; }; + D0879A4B22F65A7A00C4D6B3 /* UniversalMediaPlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = UniversalMediaPlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879A4D22F65B2A00C4D6B3 /* MediaManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaManager.swift; sourceTree = ""; }; + D0879A4F22F65D4D00C4D6B3 /* ChatHistroyLocation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatHistroyLocation.swift; sourceTree = ""; }; + D0879AA122F6FEC800C4D6B3 /* OverlayAudioPlayerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OverlayAudioPlayerController.swift; sourceTree = ""; }; + D0879B1822F70C7400C4D6B3 /* OpenChatMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenChatMessage.swift; sourceTree = ""; }; + D0879B1A22F70CF400C4D6B3 /* ChatController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatController.swift; sourceTree = ""; }; + D0879B1C22F7112E00C4D6B3 /* GalleryController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GalleryController.swift; sourceTree = ""; }; + D0879B2822F77C8300C4D6B3 /* FetchManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FetchManager.swift; sourceTree = ""; }; + D0879B2A22F795CC00C4D6B3 /* DeviceLocationManager.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = DeviceLocationManager.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B5222F7974800C4D6B3 /* TemporaryCachedPeerDataManager.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TemporaryCachedPeerDataManager.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B5C22F7A2BE00C4D6B3 /* AsyncDisplayKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = AsyncDisplayKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B5E22F7A37100C4D6B3 /* TelegramAudio.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramAudio.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B6022F7A7A600C4D6B3 /* UniversalVideoNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UniversalVideoNode.swift; sourceTree = ""; }; + D0879B6222F7A97F00C4D6B3 /* OverlayMediaItemNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OverlayMediaItemNode.swift; sourceTree = ""; }; + D0879B6422F7AC8700C4D6B3 /* OverlayMediaManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OverlayMediaManager.swift; sourceTree = ""; }; + D0879B6622F7AE6400C4D6B3 /* PresentationCallManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PresentationCallManager.swift; sourceTree = ""; }; + D0879B6822F7AF2A00C4D6B3 /* DeviceContactDataManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceContactDataManager.swift; sourceTree = ""; }; + D0879B6A22F7B04400C4D6B3 /* DeviceContactData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeviceContactData.swift; sourceTree = ""; }; + D0879B6C22F7B05200C4D6B3 /* Contacts.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Contacts.framework; path = System/Library/Frameworks/Contacts.framework; sourceTree = SDKROOT; }; + D0879B6E22F83F6600C4D6B3 /* DownloadedMediaStoreManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownloadedMediaStoreManager.swift; sourceTree = ""; }; + D0879B7022F8425B00C4D6B3 /* WallpaperUploadManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WallpaperUploadManager.swift; sourceTree = ""; }; + D0879B7222F842FF00C4D6B3 /* WatchManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchManager.swift; sourceTree = ""; }; D0D3284F22F329A900D07EE2 /* AccountContext.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AccountContext.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D0D3285222F329A900D07EE2 /* AccountContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AccountContext.h; sourceTree = ""; }; D0D3285322F329A900D07EE2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -34,6 +82,12 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + D0879B6D22F7B05300C4D6B3 /* Contacts.framework in Frameworks */, + D0879B5F22F7A37100C4D6B3 /* TelegramAudio.framework in Frameworks */, + D0879B5D22F7A2BE00C4D6B3 /* AsyncDisplayKit.framework in Frameworks */, + D0879B5322F7974800C4D6B3 /* TemporaryCachedPeerDataManager.framework in Frameworks */, + D0879B2B22F795CC00C4D6B3 /* DeviceLocationManager.framework in Frameworks */, + D0879A4C22F65A7A00C4D6B3 /* UniversalMediaPlayer.framework in Frameworks */, D06018E722F36A3F00796784 /* TelegramPresentationData.framework in Frameworks */, D0D328A322F3462800D07EE2 /* SwiftSignalKit.framework in Frameworks */, D0D328A122F3462400D07EE2 /* Postbox.framework in Frameworks */, @@ -68,6 +122,24 @@ children = ( D0D3285222F329A900D07EE2 /* AccountContext.h */, D0D3285E22F335B000D07EE2 /* AccountContext.swift */, + D0879A4522F651D400C4D6B3 /* LiveLocationManager.swift */, + D0879A4922F6584B00C4D6B3 /* SharedMediaPlayer.swift */, + D0879A4D22F65B2A00C4D6B3 /* MediaManager.swift */, + D0879B6422F7AC8700C4D6B3 /* OverlayMediaManager.swift */, + D0879B6022F7A7A600C4D6B3 /* UniversalVideoNode.swift */, + D0879B6222F7A97F00C4D6B3 /* OverlayMediaItemNode.swift */, + D0879A4F22F65D4D00C4D6B3 /* ChatHistroyLocation.swift */, + D0879AA122F6FEC800C4D6B3 /* OverlayAudioPlayerController.swift */, + D0879B1822F70C7400C4D6B3 /* OpenChatMessage.swift */, + D0879B1A22F70CF400C4D6B3 /* ChatController.swift */, + D0879B1C22F7112E00C4D6B3 /* GalleryController.swift */, + D0879B2822F77C8300C4D6B3 /* FetchManager.swift */, + D0879B6622F7AE6400C4D6B3 /* PresentationCallManager.swift */, + D0879B6822F7AF2A00C4D6B3 /* DeviceContactDataManager.swift */, + D0879B6A22F7B04400C4D6B3 /* DeviceContactData.swift */, + D0879B6E22F83F6600C4D6B3 /* DownloadedMediaStoreManager.swift */, + D0879B7022F8425B00C4D6B3 /* WallpaperUploadManager.swift */, + D0879B7222F842FF00C4D6B3 /* WatchManager.swift */, ); path = Sources; sourceTree = ""; @@ -75,6 +147,12 @@ D0D3289B22F3461700D07EE2 /* Frameworks */ = { isa = PBXGroup; children = ( + D0879B6C22F7B05200C4D6B3 /* Contacts.framework */, + D0879B5E22F7A37100C4D6B3 /* TelegramAudio.framework */, + D0879B5C22F7A2BE00C4D6B3 /* AsyncDisplayKit.framework */, + D0879B5222F7974800C4D6B3 /* TemporaryCachedPeerDataManager.framework */, + D0879B2A22F795CC00C4D6B3 /* DeviceLocationManager.framework */, + D0879A4B22F65A7A00C4D6B3 /* UniversalMediaPlayer.framework */, D06018E622F36A3F00796784 /* TelegramPresentationData.framework */, D06018E422F36A3900796784 /* DeviceAccess.framework */, D0D328A222F3462800D07EE2 /* SwiftSignalKit.framework */, @@ -165,6 +243,24 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + D0879B6122F7A7A600C4D6B3 /* UniversalVideoNode.swift in Sources */, + D0879A4E22F65B2A00C4D6B3 /* MediaManager.swift in Sources */, + D0879A4A22F6584B00C4D6B3 /* SharedMediaPlayer.swift in Sources */, + D0879B7122F8425B00C4D6B3 /* WallpaperUploadManager.swift in Sources */, + D0879B6722F7AE6400C4D6B3 /* PresentationCallManager.swift in Sources */, + D0879B2922F77C8300C4D6B3 /* FetchManager.swift in Sources */, + D0879B6522F7AC8700C4D6B3 /* OverlayMediaManager.swift in Sources */, + D0879B7322F842FF00C4D6B3 /* WatchManager.swift in Sources */, + D0879B6F22F83F6600C4D6B3 /* DownloadedMediaStoreManager.swift in Sources */, + D0879B6922F7AF2A00C4D6B3 /* DeviceContactDataManager.swift in Sources */, + D0879B6322F7A97F00C4D6B3 /* OverlayMediaItemNode.swift in Sources */, + D0879B6B22F7B04400C4D6B3 /* DeviceContactData.swift in Sources */, + D0879B1922F70C7400C4D6B3 /* OpenChatMessage.swift in Sources */, + D0879B1D22F7112E00C4D6B3 /* GalleryController.swift in Sources */, + D0879B1B22F70CF400C4D6B3 /* ChatController.swift in Sources */, + D0879A5022F65D4D00C4D6B3 /* ChatHistroyLocation.swift in Sources */, + D0879A4622F651D400C4D6B3 /* LiveLocationManager.swift in Sources */, + D0879AA222F6FEC800C4D6B3 /* OverlayAudioPlayerController.swift in Sources */, D0D3285F22F335B000D07EE2 /* AccountContext.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/submodules/AccountContext/Sources/AccountContext.swift b/submodules/AccountContext/Sources/AccountContext.swift index 23d33f4f83..6f286e6a2e 100644 --- a/submodules/AccountContext/Sources/AccountContext.swift +++ b/submodules/AccountContext/Sources/AccountContext.swift @@ -5,6 +5,8 @@ import TelegramPresentationData import TelegramUIPreferences import SwiftSignalKit import Display +import DeviceLocationManager +import TemporaryCachedPeerDataManager public final class TelegramApplicationOpenUrlCompletion { public let completion: (Bool) -> Void @@ -85,26 +87,83 @@ public enum TextLinkItem { case hashtag(String?, String) } +public final class AccountWithInfo: Equatable { + public let account: Account + public let peer: Peer + + public init(account: Account, peer: Peer) { + self.account = account + self.peer = peer + } + + public static func ==(lhs: AccountWithInfo, rhs: AccountWithInfo) -> Bool { + if lhs.account !== rhs.account { + return false + } + if !arePeersEqual(lhs.peer, rhs.peer) { + return false + } + return true + } +} + public protocol SharedAccountContext: class { + var basePath: String { get } + var mainWindow: Window1? { get } var accountManager: AccountManager { get } + var currentPresentationData: Atomic { get } var presentationData: Signal { get } + + var currentAutomaticMediaDownloadSettings: Atomic { get } + var automaticMediaDownloadSettings: Signal { get } + var immediateExperimentalUISettings: ExperimentalUISettings { get } + var currentInAppNotificationSettings: Atomic { get } + var currentMediaInputSettings: Atomic { get } + var applicationBindings: TelegramApplicationBindings { get } + var mediaManager: MediaManager { get } + var locationManager: DeviceLocationManager? { get } + var callManager: PresentationCallManager? { get } + var contactDataManager: DeviceContactDataManager? { get } + + var activeAccounts: Signal<(primary: Account?, accounts: [(AccountRecordId, Account, Int32)], currentAuth: UnauthorizedAccount?), NoError> { get } + var activeAccountsWithInfo: Signal<(primary: AccountRecordId?, accounts: [AccountWithInfo]), NoError> { get } + + var presentGlobalController: (ViewController, Any?) -> Void { get } + + func makeTempAccountContext(account: Account) -> AccountContext + + func updateNotificationTokensRegistration() + func setAccountUserInterfaceInUse(_ id: AccountRecordId) -> Disposable func handleTextLinkAction(context: AccountContext, peerId: PeerId?, navigateDisposable: MetaDisposable, controller: ViewController, action: TextLinkItemActionType, itemLink: TextLinkItem) + func navigateToChat(accountId: AccountRecordId, peerId: PeerId, messageId: MessageId?) + func openChatMessage(_ params: OpenChatMessageParams) -> Bool + func messageFromPreloadedChatHistoryViewForLocation(id: MessageId, location: ChatHistoryLocationInput, account: Account, chatLocation: ChatLocation, tagMask: MessageTags?) -> Signal<(MessageIndex?, Bool), NoError> + func makeOverlayAudioPlayerController(context: AccountContext, peerId: PeerId, type: MediaManagerPlayerType, initialMessageId: MessageId, initialOrder: MusicPlaybackSettingsOrder, parentNavigationController: NavigationController?) -> ViewController & OverlayAudioPlayerController + + func navigateToCurrentCall() + var hasOngoingCall: ValuePromise { get } + var immediateHasOngoingCall: Bool { get } + + func switchToAccount(id: AccountRecordId, fromSettingsController settingsController: ViewController?, withChatListController chatListController: ViewController?) + func beginNewAuth(testingEnvironment: Bool) } public protocol AccountContext: class { - var genericSharedContext: SharedAccountContext { get } + var sharedContext: SharedAccountContext { get } var account: Account { get } -} - -public final class TempAccountContext: AccountContext { - public let genericSharedContext: SharedAccountContext - public let account: Account - init(genericSharedContext: SharedAccountContext, account: Account) { - self.genericSharedContext = genericSharedContext - self.account = account - } + var liveLocationManager: LiveLocationManager? { get } + var fetchManager: FetchManager { get } + var downloadedMediaStoreManager: DownloadedMediaStoreManager { get } + var peerChannelMemberCategoriesContextsManager: PeerChannelMemberCategoriesContextsManager { get } + var wallpaperUploadManager: WallpaperUploadManager? { get } + var watchManager: WatchManager? { get } + + var currentLimitsConfiguration: Atomic { get } + + func storeSecureIdPassword(password: String) + func getStoredSecureIdPassword() -> String? } diff --git a/submodules/AccountContext/Sources/ChatController.swift b/submodules/AccountContext/Sources/ChatController.swift new file mode 100644 index 0000000000..b9d594709e --- /dev/null +++ b/submodules/AccountContext/Sources/ChatController.swift @@ -0,0 +1,234 @@ +import Foundation +import Postbox +import TextFormat + +public enum ChatControllerInitialBotStartBehavior { + case interactive + case automatic(returnToPeerId: PeerId) +} + +public struct ChatControllerInitialBotStart { + public let payload: String + public let behavior: ChatControllerInitialBotStartBehavior + + public init(payload: String, behavior: ChatControllerInitialBotStartBehavior) { + self.payload = payload + self.behavior = behavior + } +} + +public enum ChatControllerInteractionNavigateToPeer { + case `default` + case chat(textInputState: ChatTextInputState?, messageId: MessageId?) + case info + case withBotStartPayload(ChatControllerInitialBotStart) +} + +public struct ChatTextInputState: PostboxCoding, Equatable { + public let inputText: NSAttributedString + public let selectionRange: Range + + public static func ==(lhs: ChatTextInputState, rhs: ChatTextInputState) -> Bool { + return lhs.inputText.isEqual(to: rhs.inputText) && lhs.selectionRange == rhs.selectionRange + } + + public init() { + self.inputText = NSAttributedString() + self.selectionRange = 0 ..< 0 + } + + public init(inputText: NSAttributedString, selectionRange: Range) { + self.inputText = inputText + self.selectionRange = selectionRange + } + + public init(inputText: NSAttributedString) { + self.inputText = inputText + let length = inputText.length + self.selectionRange = length ..< length + } + + public init(decoder: PostboxDecoder) { + self.inputText = ((decoder.decodeObjectForKey("at", decoder: { ChatTextInputStateText(decoder: $0) }) as? ChatTextInputStateText) ?? ChatTextInputStateText()).attributedText() + self.selectionRange = Int(decoder.decodeInt32ForKey("as0", orElse: 0)) ..< Int(decoder.decodeInt32ForKey("as1", orElse: 0)) + } + + public func encode(_ encoder: PostboxEncoder) { + encoder.encodeObject(ChatTextInputStateText(attributedText: self.inputText), forKey: "at") + + encoder.encodeInt32(Int32(self.selectionRange.lowerBound), forKey: "as0") + encoder.encodeInt32(Int32(self.selectionRange.upperBound), forKey: "as1") + } +} + +public enum ChatTextInputStateTextAttributeType: PostboxCoding, Equatable { + case bold + case italic + case monospace + case textMention(PeerId) + case textUrl(String) + + public init(decoder: PostboxDecoder) { + switch decoder.decodeInt32ForKey("t", orElse: 0) { + case 0: + self = .bold + case 1: + self = .italic + case 2: + self = .monospace + case 3: + self = .textMention(PeerId(decoder.decodeInt64ForKey("peerId", orElse: 0))) + case 4: + self = .textUrl(decoder.decodeStringForKey("url", orElse: "")) + default: + assertionFailure() + self = .bold + } + } + + public func encode(_ encoder: PostboxEncoder) { + switch self { + case .bold: + encoder.encodeInt32(0, forKey: "t") + case .italic: + encoder.encodeInt32(1, forKey: "t") + case .monospace: + encoder.encodeInt32(2, forKey: "t") + case let .textMention(id): + encoder.encodeInt32(3, forKey: "t") + encoder.encodeInt64(id.toInt64(), forKey: "peerId") + case let .textUrl(url): + encoder.encodeInt32(4, forKey: "t") + encoder.encodeString(url, forKey: "url") + } + } + + public static func ==(lhs: ChatTextInputStateTextAttributeType, rhs: ChatTextInputStateTextAttributeType) -> Bool { + switch lhs { + case .bold: + if case .bold = rhs { + return true + } else { + return false + } + case .italic: + if case .italic = rhs { + return true + } else { + return false + } + case .monospace: + if case .monospace = rhs { + return true + } else { + return false + } + case let .textMention(id): + if case .textMention(id) = rhs { + return true + } else { + return false + } + case let .textUrl(url): + if case .textUrl(url) = rhs { + return true + } else { + return false + } + } + } +} + +public struct ChatTextInputStateTextAttribute: PostboxCoding, Equatable { + public let type: ChatTextInputStateTextAttributeType + public let range: Range + + public init(type: ChatTextInputStateTextAttributeType, range: Range) { + self.type = type + self.range = range + } + + public init(decoder: PostboxDecoder) { + self.type = decoder.decodeObjectForKey("type", decoder: { ChatTextInputStateTextAttributeType(decoder: $0) }) as! ChatTextInputStateTextAttributeType + self.range = Int(decoder.decodeInt32ForKey("range0", orElse: 0)) ..< Int(decoder.decodeInt32ForKey("range1", orElse: 0)) + } + + public func encode(_ encoder: PostboxEncoder) { + encoder.encodeObject(self.type, forKey: "type") + encoder.encodeInt32(Int32(self.range.lowerBound), forKey: "range0") + encoder.encodeInt32(Int32(self.range.upperBound), forKey: "range1") + } + + public static func ==(lhs: ChatTextInputStateTextAttribute, rhs: ChatTextInputStateTextAttribute) -> Bool { + return lhs.type == rhs.type && lhs.range == rhs.range + } +} + +public struct ChatTextInputStateText: PostboxCoding, Equatable { + public let text: String + public let attributes: [ChatTextInputStateTextAttribute] + + public init() { + self.text = "" + self.attributes = [] + } + + public init(text: String, attributes: [ChatTextInputStateTextAttribute]) { + self.text = text + self.attributes = attributes + } + + public init(attributedText: NSAttributedString) { + self.text = attributedText.string + var parsedAttributes: [ChatTextInputStateTextAttribute] = [] + attributedText.enumerateAttributes(in: NSRange(location: 0, length: attributedText.length), options: [], using: { attributes, range, _ in + for (key, value) in attributes { + if key == ChatTextInputAttributes.bold { + parsedAttributes.append(ChatTextInputStateTextAttribute(type: .bold, range: range.location ..< (range.location + range.length))) + } else if key == ChatTextInputAttributes.italic { + parsedAttributes.append(ChatTextInputStateTextAttribute(type: .italic, range: range.location ..< (range.location + range.length))) + } else if key == ChatTextInputAttributes.monospace { + parsedAttributes.append(ChatTextInputStateTextAttribute(type: .monospace, range: range.location ..< (range.location + range.length))) + } else if key == ChatTextInputAttributes.textMention, let value = value as? ChatTextInputTextMentionAttribute { + parsedAttributes.append(ChatTextInputStateTextAttribute(type: .textMention(value.peerId), range: range.location ..< (range.location + range.length))) + } else if key == ChatTextInputAttributes.textUrl, let value = value as? ChatTextInputTextUrlAttribute { + parsedAttributes.append(ChatTextInputStateTextAttribute(type: .textUrl(value.url), range: range.location ..< (range.location + range.length))) + } + } + }) + self.attributes = parsedAttributes + } + + public init(decoder: PostboxDecoder) { + self.text = decoder.decodeStringForKey("text", orElse: "") + self.attributes = decoder.decodeObjectArrayWithDecoderForKey("attributes") + } + + public func encode(_ encoder: PostboxEncoder) { + encoder.encodeString(self.text, forKey: "text") + encoder.encodeObjectArray(self.attributes, forKey: "attributes") + } + + static public func ==(lhs: ChatTextInputStateText, rhs: ChatTextInputStateText) -> Bool { + return lhs.text == rhs.text && lhs.attributes == rhs.attributes + } + + public func attributedText() -> NSAttributedString { + let result = NSMutableAttributedString(string: self.text) + for attribute in self.attributes { + switch attribute.type { + case .bold: + result.addAttribute(ChatTextInputAttributes.bold, value: true as NSNumber, range: NSRange(location: attribute.range.lowerBound, length: attribute.range.count)) + case .italic: + result.addAttribute(ChatTextInputAttributes.italic, value: true as NSNumber, range: NSRange(location: attribute.range.lowerBound, length: attribute.range.count)) + case .monospace: + result.addAttribute(ChatTextInputAttributes.monospace, value: true as NSNumber, range: NSRange(location: attribute.range.lowerBound, length: attribute.range.count)) + case let .textMention(id): + result.addAttribute(ChatTextInputAttributes.textMention, value: ChatTextInputTextMentionAttribute(peerId: id), range: NSRange(location: attribute.range.lowerBound, length: attribute.range.count)) + case let .textUrl(url): + result.addAttribute(ChatTextInputAttributes.textUrl, value: ChatTextInputTextUrlAttribute(url: url), range: NSRange(location: attribute.range.lowerBound, length: attribute.range.count)) + } + } + return result + } +} diff --git a/submodules/AccountContext/Sources/ChatHistroyLocation.swift b/submodules/AccountContext/Sources/ChatHistroyLocation.swift new file mode 100644 index 0000000000..5541df6c25 --- /dev/null +++ b/submodules/AccountContext/Sources/ChatHistroyLocation.swift @@ -0,0 +1,25 @@ +import Foundation +import Postbox +import Display + +public enum ChatHistoryInitialSearchLocation: Equatable { + case index(MessageIndex) + case id(MessageId) +} + +public enum ChatHistoryLocation: Equatable { + case Initial(count: Int) + case InitialSearch(location: ChatHistoryInitialSearchLocation, count: Int) + case Navigation(index: MessageHistoryAnchorIndex, anchorIndex: MessageHistoryAnchorIndex, count: Int) + case Scroll(index: MessageHistoryAnchorIndex, anchorIndex: MessageHistoryAnchorIndex, sourceIndex: MessageHistoryAnchorIndex, scrollPosition: ListViewScrollPosition, animated: Bool) +} + +public struct ChatHistoryLocationInput: Equatable { + public let content: ChatHistoryLocation + public let id: Int32 + + public init(content: ChatHistoryLocation, id: Int32) { + self.content = content + self.id = id + } +} diff --git a/submodules/TelegramUI/TelegramUI/DeviceContactData.swift b/submodules/AccountContext/Sources/DeviceContactData.swift similarity index 92% rename from submodules/TelegramUI/TelegramUI/DeviceContactData.swift rename to submodules/AccountContext/Sources/DeviceContactData.swift index 09fd35ca80..974dc6dde7 100644 --- a/submodules/TelegramUI/TelegramUI/DeviceContactData.swift +++ b/submodules/AccountContext/Sources/DeviceContactData.swift @@ -107,16 +107,14 @@ public final class DeviceContactAddressData: Equatable, Hashable { return true } - public var hashValue: Int { - var result = 0 - result = result &* 31 &+ self.label.hashValue - result = result &* 31 &+ self.street1.hashValue - result = result &* 31 &+ self.street2.hashValue - result = result &* 31 &+ self.state.hashValue - result = result &* 31 &+ self.city.hashValue - result = result &* 31 &+ self.country.hashValue - result = result &* 31 &+ self.postcode.hashValue - return result + public func hash(into hasher: inout Hasher) { + hasher.combine(self.label) + hasher.combine(self.street1) + hasher.combine(self.street2) + hasher.combine(self.state) + hasher.combine(self.city) + hasher.combine(self.country) + hasher.combine(self.postcode) } } @@ -149,13 +147,11 @@ public final class DeviceContactSocialProfileData: Equatable, Hashable { return true } - public var hashValue: Int { - var result = 0 - result = result &* 31 &+ self.label.hashValue - result = result &* 31 &+ self.service.hashValue - result = result &* 31 &+ self.username.hashValue - result = result &* 31 &+ self.url.hashValue - return result + public func hash(into hasher: inout Hasher) { + hasher.combine(self.label) + hasher.combine(self.service) + hasher.combine(self.username) + hasher.combine(self.url) } } @@ -183,12 +179,10 @@ public final class DeviceContactInstantMessagingProfileData: Equatable, Hashable return true } - public var hashValue: Int { - var result = 0 - result = result &* 31 &+ self.label.hashValue - result = result &* 31 &+ self.service.hashValue - result = result &* 31 &+ self.username.hashValue - return result + public func hash(into hasher: inout Hasher) { + hasher.combine(self.label) + hasher.combine(self.service) + hasher.combine(self.username) } } @@ -201,7 +195,7 @@ public extension DeviceContactUrlData { } } -func parseAppSpecificContactReference(_ value: String) -> PeerId? { +public func parseAppSpecificContactReference(_ value: String) -> PeerId? { if !value.hasPrefix(phonebookUsernamePrefix) { return nil } @@ -241,7 +235,7 @@ public final class DeviceContactBasicDataWithReference: Equatable { public let stableId: DeviceContactStableId public let basicData: DeviceContactBasicData - init(stableId: DeviceContactStableId, basicData: DeviceContactBasicData) { + public init(stableId: DeviceContactStableId, basicData: DeviceContactBasicData) { self.stableId = stableId self.basicData = basicData } @@ -328,7 +322,7 @@ public final class DeviceContactExtendedData: Equatable { } public extension DeviceContactExtendedData { - public convenience init?(vcard: Data) { + convenience init?(vcard: Data) { if #available(iOSApplicationExtension 9.0, iOS 9.0, *) { guard let contact = (try? CNContactVCardSerialization.contacts(with: vcard))?.first else { return nil @@ -377,7 +371,7 @@ public extension DeviceContactExtendedData { return contact } - public func serializedVCard() -> String? { + func serializedVCard() -> String? { if #available(iOSApplicationExtension 9.0, iOS 9.0, *) { guard let data = try? CNContactVCardSerialization.data(with: [self.asMutableCNContact()]) else { return nil @@ -428,7 +422,7 @@ public extension DeviceContactExtendedData { self.init(basicData: basicData, middleName: contact.middleName, prefix: contact.namePrefix, suffix: contact.nameSuffix, organization: contact.organizationName, jobTitle: contact.jobTitle, department: contact.departmentName, emailAddresses: emailAddresses, urls: urls, addresses: addresses, birthdayDate: birthdayDate, socialProfiles: socialProfiles, instantMessagingProfiles: instantMessagingProfiles) } - public var isPrimitive: Bool { + var isPrimitive: Bool { if self.basicData.phoneNumbers.count > 1 { return false } @@ -463,7 +457,7 @@ public extension DeviceContactExtendedData { } } -extension DeviceContactExtendedData { +public extension DeviceContactExtendedData { convenience init?(peer: Peer) { guard let user = peer as? TelegramUser else { return nil diff --git a/submodules/AccountContext/Sources/DeviceContactDataManager.swift b/submodules/AccountContext/Sources/DeviceContactDataManager.swift new file mode 100644 index 0000000000..10db927b98 --- /dev/null +++ b/submodules/AccountContext/Sources/DeviceContactDataManager.swift @@ -0,0 +1,21 @@ +import Foundation +import Postbox +import TelegramCore +import TelegramUIPreferences +import SwiftSignalKit + +public typealias DeviceContactStableId = String + +public protocol DeviceContactDataManager: class { + func personNameDisplayOrder() -> Signal + func basicData() -> Signal<[DeviceContactStableId: DeviceContactBasicData], NoError> + func basicDataForNormalizedPhoneNumber(_ normalizedNumber: DeviceContactNormalizedPhoneNumber) -> Signal<[(DeviceContactStableId, DeviceContactBasicData)], NoError> + func extendedData(stableId: DeviceContactStableId) -> Signal + func importable() -> Signal<[DeviceContactNormalizedPhoneNumber: ImportableDeviceContactData], NoError> + func appSpecificReferences() -> Signal<[PeerId: DeviceContactBasicDataWithReference], NoError> + func search(query: String) -> Signal<[DeviceContactStableId: (DeviceContactBasicData, PeerId?)], NoError> + func appendContactData(_ contactData: DeviceContactExtendedData, to stableId: DeviceContactStableId) -> Signal + func appendPhoneNumber(_ phoneNumber: DeviceContactPhoneNumberData, to stableId: DeviceContactStableId) -> Signal + func createContactWithData(_ contactData: DeviceContactExtendedData) -> Signal<(DeviceContactStableId, DeviceContactExtendedData)?, NoError> + func deleteContactWithAppSpecificReference(peerId: PeerId) -> Signal +} diff --git a/submodules/AccountContext/Sources/DownloadedMediaStoreManager.swift b/submodules/AccountContext/Sources/DownloadedMediaStoreManager.swift new file mode 100644 index 0000000000..05653f8d6d --- /dev/null +++ b/submodules/AccountContext/Sources/DownloadedMediaStoreManager.swift @@ -0,0 +1,21 @@ +import Foundation +import TelegramCore +import Postbox +import TelegramUIPreferences +import SwiftSignalKit + +public protocol DownloadedMediaStoreManager: class { + func store(_ media: AnyMediaReference, timestamp: Int32, peerType: MediaAutoDownloadPeerType) +} + +public func storeDownloadedMedia(storeManager: DownloadedMediaStoreManager?, media: AnyMediaReference, peerType: MediaAutoDownloadPeerType) -> Signal { + guard case let .message(message, _) = media, let timestamp = message.timestamp, let incoming = message.isIncoming, incoming, let secret = message.isSecret, !secret else { + return .complete() + } + + return Signal { [weak storeManager] subscriber in + storeManager?.store(media, timestamp: timestamp, peerType: peerType) + subscriber.putCompletion() + return EmptyDisposable + } +} diff --git a/submodules/AccountContext/Sources/FetchManager.swift b/submodules/AccountContext/Sources/FetchManager.swift new file mode 100644 index 0000000000..054348169d --- /dev/null +++ b/submodules/AccountContext/Sources/FetchManager.swift @@ -0,0 +1,157 @@ +import Foundation +import Postbox +import TelegramCore +import SwiftSignalKit +import TelegramUIPreferences + +public enum FetchManagerCategory: Int32 { + case image + case file + case voice + case animation +} + +public enum FetchManagerLocationKey: Comparable, Hashable { + case messageId(MessageId) + case free + + public static func <(lhs: FetchManagerLocationKey, rhs: FetchManagerLocationKey) -> Bool { + switch lhs { + case let .messageId(lhsId): + if case let .messageId(rhsId) = rhs { + return lhsId < rhsId + } else { + return true + } + case .free: + if case .free = rhs { + return false + } else { + return false + } + } + } +} + +public struct FetchManagerPriorityKey: Comparable { + public let locationKey: FetchManagerLocationKey + public let hasElevatedPriority: Bool + public let userInitiatedPriority: Int32? + public let topReference: FetchManagerPriority? + + public init(locationKey: FetchManagerLocationKey, hasElevatedPriority: Bool, userInitiatedPriority: Int32?, topReference: FetchManagerPriority?) { + self.locationKey = locationKey + self.hasElevatedPriority = hasElevatedPriority + self.userInitiatedPriority = userInitiatedPriority + self.topReference = topReference + } + + public static func <(lhs: FetchManagerPriorityKey, rhs: FetchManagerPriorityKey) -> Bool { + if let lhsUserInitiatedPriority = lhs.userInitiatedPriority, let rhsUserInitiatedPriority = rhs.userInitiatedPriority { + if lhsUserInitiatedPriority != rhsUserInitiatedPriority { + if lhsUserInitiatedPriority > rhsUserInitiatedPriority { + return false + } else { + return true + } + } + } else if (lhs.userInitiatedPriority != nil) != (rhs.userInitiatedPriority != nil) { + if lhs.userInitiatedPriority != nil { + return true + } else { + return false + } + } + + if lhs.hasElevatedPriority != rhs.hasElevatedPriority { + if lhs.hasElevatedPriority { + return true + } else { + return false + } + } + + if lhs.topReference != rhs.topReference { + if let lhsTopReference = lhs.topReference, let rhsTopReference = rhs.topReference { + return lhsTopReference < rhsTopReference + } else if lhs.topReference != nil { + return true + } else { + return false + } + } + + return lhs.locationKey < rhs.locationKey + } +} + +public enum FetchManagerLocation: Hashable { + case chat(PeerId) +} + +public enum FetchManagerForegroundDirection { + case toEarlier + case toLater +} + +public enum FetchManagerPriority: Comparable { + case userInitiated + case foregroundPrefetch(direction: FetchManagerForegroundDirection, localOrder: MessageIndex) + case backgroundPrefetch(locationOrder: HistoryPreloadIndex, localOrder: MessageIndex) + + public static func <(lhs: FetchManagerPriority, rhs: FetchManagerPriority) -> Bool { + switch lhs { + case .userInitiated: + switch rhs { + case .userInitiated: + return false + case .foregroundPrefetch: + return true + case .backgroundPrefetch: + return true + } + case let .foregroundPrefetch(lhsDirection, lhsLocalOrder): + switch rhs { + case .userInitiated: + return false + case let .foregroundPrefetch(rhsDirection, rhsLocalOrder): + if lhsDirection == rhsDirection { + switch lhsDirection { + case .toEarlier: + return lhsLocalOrder > rhsLocalOrder + case .toLater: + return lhsLocalOrder < rhsLocalOrder + } + } else { + if lhsDirection == .toEarlier { + return true + } else { + return false + } + } + case .backgroundPrefetch: + return true + } + case let .backgroundPrefetch(lhsLocationOrder, lhsLocalOrder): + switch rhs { + case .userInitiated: + return false + case .foregroundPrefetch: + return false + case let .backgroundPrefetch(rhsLocationOrder, rhsLocalOrder): + if lhsLocationOrder != rhsLocationOrder { + return lhsLocationOrder < rhsLocationOrder + } + return lhsLocalOrder > rhsLocalOrder + } + } + } +} + +public let FetchCompleteRange = IndexSet(integersIn: 0 ..< Int(Int32.max) as Range) + +public protocol FetchManager { + func interactivelyFetched(category: FetchManagerCategory, location: FetchManagerLocation, locationKey: FetchManagerLocationKey, mediaReference: AnyMediaReference?, resourceReference: MediaResourceReference, ranges: IndexSet, statsCategory: MediaResourceStatsCategory, elevatedPriority: Bool, userInitiated: Bool, priority: FetchManagerPriority, storeToDownloadsPeerType: MediaAutoDownloadPeerType?) -> Signal + func cancelInteractiveFetches(category: FetchManagerCategory, location: FetchManagerLocation, locationKey: FetchManagerLocationKey, resource: MediaResource) + func fetchStatus(category: FetchManagerCategory, location: FetchManagerLocation, locationKey: FetchManagerLocationKey, resource: MediaResource) -> Signal +} diff --git a/submodules/AccountContext/Sources/GalleryController.swift b/submodules/AccountContext/Sources/GalleryController.swift new file mode 100644 index 0000000000..8a8012b878 --- /dev/null +++ b/submodules/AccountContext/Sources/GalleryController.swift @@ -0,0 +1,22 @@ +import Foundation +import Postbox + +public final class GalleryControllerActionInteraction { + public let openUrl: (String, Bool) -> Void + public let openUrlIn: (String) -> Void + public let openPeerMention: (String) -> Void + public let openPeer: (PeerId) -> Void + public let openHashtag: (String?, String) -> Void + public let openBotCommand: (String) -> Void + public let addContact: (String) -> Void + + public init(openUrl: @escaping (String, Bool) -> Void, openUrlIn: @escaping (String) -> Void, openPeerMention: @escaping (String) -> Void, openPeer: @escaping (PeerId) -> Void, openHashtag: @escaping (String?, String) -> Void, openBotCommand: @escaping (String) -> Void, addContact: @escaping (String) -> Void) { + self.openUrl = openUrl + self.openUrlIn = openUrlIn + self.openPeerMention = openPeerMention + self.openPeer = openPeer + self.openHashtag = openHashtag + self.openBotCommand = openBotCommand + self.addContact = addContact + } +} diff --git a/submodules/AccountContext/Sources/LiveLocationManager.swift b/submodules/AccountContext/Sources/LiveLocationManager.swift new file mode 100644 index 0000000000..e43ba071f0 --- /dev/null +++ b/submodules/AccountContext/Sources/LiveLocationManager.swift @@ -0,0 +1,18 @@ +import Foundation +import TelegramCore +import Postbox +import SwiftSignalKit + +public protocol LiveLocationSummaryManager { + func broadcastingToMessages() -> Signal<[MessageId: Message], NoError> + func peersBroadcastingTo(peerId: PeerId) -> Signal<[(Peer, Message)]?, NoError> +} + +public protocol LiveLocationManager { + var summaryManager: LiveLocationSummaryManager { get } + var isPolling: Signal { get } + + func cancelLiveLocation(peerId: PeerId) + func pollOnce() + func internalMessageForPeerId(_ peerId: PeerId) -> MessageId? +} diff --git a/submodules/AccountContext/Sources/MediaManager.swift b/submodules/AccountContext/Sources/MediaManager.swift new file mode 100644 index 0000000000..38ef6c68ef --- /dev/null +++ b/submodules/AccountContext/Sources/MediaManager.swift @@ -0,0 +1,107 @@ +import Foundation +import Postbox +import TelegramCore +import SwiftSignalKit +import UIKit +import AsyncDisplayKit +import TelegramAudio +import UniversalMediaPlayer + +public enum MediaManagerPlayerType { + case voice + case music +} + +public protocol MediaManager: class { + var audioSession: ManagedAudioSession { get } + var galleryHiddenMediaManager: GalleryHiddenMediaManager { get } + var universalVideoManager: UniversalVideoManager { get } + var overlayMediaManager: OverlayMediaManager { get } + + var globalMediaPlayerState: Signal<(Account, SharedMediaPlayerItemPlaybackStateOrLoading, MediaManagerPlayerType)?, NoError> { get } + var musicMediaPlayerState: Signal<(Account, SharedMediaPlayerItemPlaybackStateOrLoading)?, NoError> { get } + var activeGlobalMediaPlayerAccountId: Signal<(AccountRecordId, Bool)?, NoError> { get } + + func setPlaylist(_ playlist: (Account, SharedMediaPlaylist)?, type: MediaManagerPlayerType, control: SharedMediaPlayerControlAction) + func playlistControl(_ control: SharedMediaPlayerControlAction, type: MediaManagerPlayerType?) + + func filteredPlaylistState(accountId: AccountRecordId, playlistId: SharedMediaPlaylistId, itemId: SharedMediaPlaylistItemId, type: MediaManagerPlayerType) -> Signal + + func setOverlayVideoNode(_ node: OverlayMediaItemNode?) + + func audioRecorder(beginWithTone: Bool, applicationBindings: TelegramApplicationBindings, beganWithTone: @escaping (Bool) -> Void) -> Signal +} + +public enum GalleryHiddenMediaId: Hashable { + case chat(AccountRecordId, MessageId, Media) + + public static func ==(lhs: GalleryHiddenMediaId, rhs: GalleryHiddenMediaId) -> Bool { + switch lhs { + case let .chat(lhsAccountId ,lhsMessageId, lhsMedia): + if case let .chat(rhsAccountId, rhsMessageId, rhsMedia) = rhs, lhsAccountId == rhsAccountId, lhsMessageId == rhsMessageId, lhsMedia.isEqual(to: rhsMedia) { + return true + } else { + return false + } + } + } + + public func hash(into hasher: inout Hasher) { + switch self { + case let .chat(accountId, messageId, _): + hasher.combine(accountId) + hasher.combine(messageId) + } + } +} + +public protocol GalleryHiddenMediaTarget: class { + func getTransitionInfo(messageId: MessageId, media: Media) -> ((UIView) -> Void, ASDisplayNode, () -> (UIView?, UIView?))? +} + +public protocol GalleryHiddenMediaManager: class { + func hiddenIds() -> Signal, NoError> + func addSource(_ signal: Signal) -> Int + func removeSource(_ index: Int) + func addTarget(_ target: GalleryHiddenMediaTarget) + func removeTarget(_ target: GalleryHiddenMediaTarget) + func findTarget(messageId: MessageId, media: Media) -> ((UIView) -> Void, ASDisplayNode, () -> (UIView?, UIView?))? +} + +public protocol UniversalVideoManager: class { + func attachUniversalVideoContent(content: UniversalVideoContent, priority: UniversalVideoPriority, create: () -> UniversalVideoContentNode & ASDisplayNode, update: @escaping (((UniversalVideoContentNode & ASDisplayNode), Bool)?) -> Void) -> (AnyHashable, Int32) + func detachUniversalVideoContent(id: AnyHashable, index: Int32) + func withUniversalVideoContent(id: AnyHashable, _ f: ((UniversalVideoContentNode & ASDisplayNode)?) -> Void) + func addPlaybackCompleted(id: AnyHashable, _ f: @escaping () -> Void) -> Int + func removePlaybackCompleted(id: AnyHashable, index: Int) + func statusSignal(content: UniversalVideoContent) -> Signal + func bufferingStatusSignal(content: UniversalVideoContent) -> Signal<(IndexSet, Int)?, NoError> +} + +public enum AudioRecordingState: Equatable { + case paused(duration: Double) + case recording(duration: Double, durationMediaTimestamp: Double) + case stopped +} + +public struct RecordedAudioData { + public let compressedData: Data + public let duration: Double + public let waveform: Data? + + public init(compressedData: Data, duration: Double, waveform: Data?) { + self.compressedData = compressedData + self.duration = duration + self.waveform = waveform + } +} + +public protocol ManagedAudioRecorder: class { + var beginWithTone: Bool { get } + var micLevel: Signal { get } + var recordingState: Signal { get } + + func start() + func stop() + func takenRecordedData() -> Signal +} diff --git a/submodules/AccountContext/Sources/OpenChatMessage.swift b/submodules/AccountContext/Sources/OpenChatMessage.swift new file mode 100644 index 0000000000..4f617ca118 --- /dev/null +++ b/submodules/AccountContext/Sources/OpenChatMessage.swift @@ -0,0 +1,79 @@ +import Foundation +import UIKit +import Postbox +import TelegramCore +import SwiftSignalKit +import Display + +public enum ChatControllerInteractionOpenMessageMode { + case `default` + case stream + case automaticPlayback + case landscape + case timecode(Double) + case link +} + +public final class OpenChatMessageParams { + public let context: AccountContext + public let message: Message + public let standalone: Bool + public let reverseMessageGalleryOrder: Bool + public let mode: ChatControllerInteractionOpenMessageMode + public let navigationController: NavigationController? + public let modal: Bool + public let dismissInput: () -> Void + public let present: (ViewController, Any?) -> Void + public let transitionNode: (MessageId, Media) -> (ASDisplayNode, () -> (UIView?, UIView?))? + public let addToTransitionSurface: (UIView) -> Void + public let openUrl: (String) -> Void + public let openPeer: (Peer, ChatControllerInteractionNavigateToPeer) -> Void + public let callPeer: (PeerId) -> Void + public let enqueueMessage: (EnqueueMessage) -> Void + public let sendSticker: ((FileMediaReference, ASDisplayNode, CGRect) -> Bool)? + public let setupTemporaryHiddenMedia: (Signal, Int, Media) -> Void + public let chatAvatarHiddenMedia: (Signal, Media) -> Void + public let actionInteraction: GalleryControllerActionInteraction? + + public init( + context: AccountContext, + message: Message, + standalone: Bool, + reverseMessageGalleryOrder: Bool, + mode: ChatControllerInteractionOpenMessageMode = .default, + navigationController: NavigationController?, + modal: Bool = false, + dismissInput: @escaping () -> Void, + present: @escaping (ViewController, Any?) -> Void, + transitionNode: @escaping (MessageId, Media) -> (ASDisplayNode, () -> (UIView?, UIView?))?, + addToTransitionSurface: @escaping (UIView) -> Void, + openUrl: @escaping (String) -> Void, + openPeer: @escaping (Peer, ChatControllerInteractionNavigateToPeer) -> Void, + callPeer: @escaping (PeerId) -> Void, + enqueueMessage: @escaping (EnqueueMessage) -> Void, + sendSticker: ((FileMediaReference, ASDisplayNode, CGRect) -> Bool)?, + setupTemporaryHiddenMedia: @escaping (Signal, Int, Media) -> Void, + chatAvatarHiddenMedia: @escaping (Signal, Media) -> Void, + actionInteraction: GalleryControllerActionInteraction? = nil + ) { + self.context = context + self.message = message + self.standalone = standalone + self.reverseMessageGalleryOrder = reverseMessageGalleryOrder + self.mode = mode + self.navigationController = navigationController + self.modal = modal + self.dismissInput = dismissInput + self.present = present + self.transitionNode = transitionNode + self.addToTransitionSurface = addToTransitionSurface + self.openUrl = openUrl + self.openPeer = openPeer + self.callPeer = callPeer + self.enqueueMessage = enqueueMessage + self.sendSticker = sendSticker + self.setupTemporaryHiddenMedia = setupTemporaryHiddenMedia + self.chatAvatarHiddenMedia = chatAvatarHiddenMedia + self.actionInteraction = actionInteraction + } +} diff --git a/submodules/AccountContext/Sources/OverlayAudioPlayerController.swift b/submodules/AccountContext/Sources/OverlayAudioPlayerController.swift new file mode 100644 index 0000000000..a3257e0740 --- /dev/null +++ b/submodules/AccountContext/Sources/OverlayAudioPlayerController.swift @@ -0,0 +1,5 @@ +import Foundation + +public protocol OverlayAudioPlayerController: class { + +} diff --git a/submodules/AccountContext/Sources/OverlayMediaItemNode.swift b/submodules/AccountContext/Sources/OverlayMediaItemNode.swift new file mode 100644 index 0000000000..4913f5301b --- /dev/null +++ b/submodules/AccountContext/Sources/OverlayMediaItemNode.swift @@ -0,0 +1,61 @@ +import Foundation +import UIKit +import AsyncDisplayKit + +public struct OverlayMediaItemNodeGroup: Hashable, RawRepresentable { + public var rawValue: Int32 + + public init(rawValue: Int32) { + self.rawValue = rawValue + } +} + +public enum OverlayMediaItemMinimizationEdge { + case left + case right +} + +open class OverlayMediaItemNode: ASDisplayNode { + open var hasAttachedContextUpdated: ((Bool) -> Void)? + open var hasAttachedContext: Bool = false + + open var unminimize: (() -> Void)? + + open var group: OverlayMediaItemNodeGroup? { + return nil + } + + open var tempExtendedTopInset: Bool { + return false + } + + open var isMinimizeable: Bool { + return false + } + + open var customTransition: Bool = false + + open func setShouldAcquireContext(_ value: Bool) { + } + + open func preferredSizeForOverlayDisplay() -> CGSize { + return CGSize(width: 50.0, height: 50.0) + } + + open func updateLayout(_ size: CGSize) { + } + + open func dismiss() { + } + + open func updateMinimizedEdge(_ edge: OverlayMediaItemMinimizationEdge?, adjusting: Bool) { + } + + open func performCustomTransitionIn() -> Bool { + return false + } + + open func performCustomTransitionOut() -> Bool { + return false + } +} diff --git a/submodules/AccountContext/Sources/OverlayMediaManager.swift b/submodules/AccountContext/Sources/OverlayMediaManager.swift new file mode 100644 index 0000000000..15edac8a7d --- /dev/null +++ b/submodules/AccountContext/Sources/OverlayMediaManager.swift @@ -0,0 +1,19 @@ +import Foundation +import Display + +public protocol OverlayMediaController: class { + var hasNodes: Bool { get } + func addNode(_ node: OverlayMediaItemNode, customTransition: Bool) + func removeNode(_ node: OverlayMediaItemNode, customTransition: Bool) +} + +public final class OverlayMediaManager { + public var controller: (OverlayMediaController & ViewController)? + + public init() { + } + + public func attachOverlayMediaController(_ controller: OverlayMediaController & ViewController) { + self.controller = controller + } +} diff --git a/submodules/AccountContext/Sources/PresentationCallManager.swift b/submodules/AccountContext/Sources/PresentationCallManager.swift new file mode 100644 index 0000000000..e90cbcf31c --- /dev/null +++ b/submodules/AccountContext/Sources/PresentationCallManager.swift @@ -0,0 +1,52 @@ +import Foundation +import Postbox +import TelegramCore +import SwiftSignalKit +import TelegramAudio + +public enum RequestCallResult { + case requested + case alreadyInProgress(PeerId) +} + +public enum PresentationCallState: Equatable { + case waiting + case ringing + case requesting(Bool) + case connecting(Data?) + case active(Double, Int32?, Data) + case terminating + case terminated(CallId?, CallSessionTerminationReason?, Bool) +} + +public protocol PresentationCall: class { + var account: Account { get } + var isIntegratedWithCallKit: Bool { get } + var internalId: CallSessionInternalId { get } + var peerId: PeerId { get } + var isOutgoing: Bool { get } + var peer: Peer? { get } + + var state: Signal { get } + + var isMuted: Signal { get } + + var audioOutputState: Signal<([AudioSessionOutput], AudioSessionOutput?), NoError> { get } + + var canBeRemoved: Signal { get } + + func answer() + func hangUp() -> Signal + func rejectBusy() + + func toggleIsMuted() + func setIsMuted(_ value: Bool) + func setCurrentAudioOutput(_ output: AudioSessionOutput) + func debugInfo() -> Signal<(String, String), NoError> +} + +public protocol PresentationCallManager: class { + var currentCallSignal: Signal { get } + + func requestCall(account: Account, peerId: PeerId, endCurrentIfAny: Bool) -> RequestCallResult +} diff --git a/submodules/AccountContext/Sources/SharedMediaPlayer.swift b/submodules/AccountContext/Sources/SharedMediaPlayer.swift new file mode 100644 index 0000000000..1f3bd04142 --- /dev/null +++ b/submodules/AccountContext/Sources/SharedMediaPlayer.swift @@ -0,0 +1,311 @@ +import Foundation +import TelegramCore +import Postbox +import TelegramUIPreferences +import SwiftSignalKit +import UniversalMediaPlayer + +public enum SharedMediaPlaybackDataType { + case music + case voice + case instantVideo +} + +public enum SharedMediaPlaybackDataSource: Equatable { + case telegramFile(FileMediaReference) + + public static func ==(lhs: SharedMediaPlaybackDataSource, rhs: SharedMediaPlaybackDataSource) -> Bool { + switch lhs { + case let .telegramFile(lhsFileReference): + if case let .telegramFile(rhsFileReference) = rhs { + if !lhsFileReference.media.isEqual(to: rhsFileReference.media) { + return false + } + return true + } else { + return false + } + } + } +} + +public struct SharedMediaPlaybackData: Equatable { + public let type: SharedMediaPlaybackDataType + public let source: SharedMediaPlaybackDataSource + + public init(type: SharedMediaPlaybackDataType, source: SharedMediaPlaybackDataSource) { + self.type = type + self.source = source + } + + public static func ==(lhs: SharedMediaPlaybackData, rhs: SharedMediaPlaybackData) -> Bool { + return lhs.type == rhs.type && lhs.source == rhs.source + } +} + +public struct SharedMediaPlaybackAlbumArt: Equatable { + public let thumbnailResource: TelegramMediaResource + public let fullSizeResource: TelegramMediaResource + + public init(thumbnailResource: TelegramMediaResource, fullSizeResource: TelegramMediaResource) { + self.thumbnailResource = thumbnailResource + self.fullSizeResource = fullSizeResource + } + + public static func ==(lhs: SharedMediaPlaybackAlbumArt, rhs: SharedMediaPlaybackAlbumArt) -> Bool { + if !lhs.thumbnailResource.isEqual(to: rhs.thumbnailResource) { + return false + } + + if !lhs.fullSizeResource.isEqual(to: rhs.fullSizeResource) { + return false + } + + return true + } +} + +public enum SharedMediaPlaybackDisplayData: Equatable { + case music(title: String?, performer: String?, albumArt: SharedMediaPlaybackAlbumArt?) + case voice(author: Peer?, peer: Peer?) + case instantVideo(author: Peer?, peer: Peer?, timestamp: Int32) + + public static func ==(lhs: SharedMediaPlaybackDisplayData, rhs: SharedMediaPlaybackDisplayData) -> Bool { + switch lhs { + case let .music(lhsTitle, lhsPerformer, lhsAlbumArt): + if case let .music(rhsTitle, rhsPerformer, rhsAlbumArt) = rhs, lhsTitle == rhsTitle, lhsPerformer == rhsPerformer, lhsAlbumArt == rhsAlbumArt { + return true + } else { + return false + } + case let .voice(lhsAuthor, lhsPeer): + if case let .voice(rhsAuthor, rhsPeer) = rhs, arePeersEqual(lhsAuthor, rhsAuthor), arePeersEqual(lhsPeer, rhsPeer) { + return true + } else { + return false + } + case let .instantVideo(lhsAuthor, lhsPeer, lhsTimestamp): + if case let .instantVideo(rhsAuthor, rhsPeer, rhsTimestamp) = rhs, arePeersEqual(lhsAuthor, rhsAuthor), arePeersEqual(lhsPeer, rhsPeer), lhsTimestamp == rhsTimestamp { + return true + } else { + return false + } + } + } +} + +public protocol SharedMediaPlaylistItem { + var stableId: AnyHashable { get } + var id: SharedMediaPlaylistItemId { get } + var playbackData: SharedMediaPlaybackData? { get } + var displayData: SharedMediaPlaybackDisplayData? { get } +} + +public func arePlaylistItemsEqual(_ lhs: SharedMediaPlaylistItem?, _ rhs: SharedMediaPlaylistItem?) -> Bool { + if lhs?.stableId != rhs?.stableId { + return false + } + if lhs?.playbackData != rhs?.playbackData { + return false + } + if lhs?.displayData != rhs?.displayData { + return false + } + return true +} + +public protocol SharedMediaPlaylistId { + func isEqual(to: SharedMediaPlaylistId) -> Bool +} + +public protocol SharedMediaPlaylistItemId { + func isEqual(to: SharedMediaPlaylistItemId) -> Bool +} + +public func areSharedMediaPlaylistItemIdsEqual(_ lhs: SharedMediaPlaylistItemId?, _ rhs: SharedMediaPlaylistItemId?) -> Bool { + if let lhs = lhs, let rhs = rhs { + return lhs.isEqual(to: rhs) + } else if (lhs != nil) != (rhs != nil) { + return false + } else { + return true + } +} + +public struct PeerMessagesMediaPlaylistItemId: SharedMediaPlaylistItemId { + public let messageId: MessageId + + public init(messageId: MessageId) { + self.messageId = messageId + } + + public func isEqual(to: SharedMediaPlaylistItemId) -> Bool { + if let to = to as? PeerMessagesMediaPlaylistItemId { + if self.messageId != to.messageId { + return false + } + return true + } + return false + } +} + +public protocol SharedMediaPlaylistLocation { + func isEqual(to: SharedMediaPlaylistLocation) -> Bool +} + +public protocol SharedMediaPlaylist: class { + var id: SharedMediaPlaylistId { get } + var location: SharedMediaPlaylistLocation { get } + var state: Signal { get } + var looping: MusicPlaybackSettingsLooping { get } + var currentItemDisappeared: (() -> Void)? { get set } + + func control(_ action: SharedMediaPlaylistControlAction) + func setOrder(_ order: MusicPlaybackSettingsOrder) + func setLooping(_ looping: MusicPlaybackSettingsLooping) + + func onItemPlaybackStarted(_ item: SharedMediaPlaylistItem) +} + +public enum SharedMediaPlayerPlaybackControlAction { + case play + case pause + case togglePlayPause +} + +public enum SharedMediaPlayerControlAction { + case next + case previous + case playback(SharedMediaPlayerPlaybackControlAction) + case seek(Double) + case setOrder(MusicPlaybackSettingsOrder) + case setLooping(MusicPlaybackSettingsLooping) + case setBaseRate(AudioPlaybackRate) +} + +public enum SharedMediaPlaylistControlAction { + case next + case previous +} + +public final class SharedMediaPlaylistState: Equatable { + public let loading: Bool + public let playedToEnd: Bool + public let item: SharedMediaPlaylistItem? + public let nextItem: SharedMediaPlaylistItem? + public let previousItem: SharedMediaPlaylistItem? + public let order: MusicPlaybackSettingsOrder + public let looping: MusicPlaybackSettingsLooping + + public init(loading: Bool, playedToEnd: Bool, item: SharedMediaPlaylistItem?, nextItem: SharedMediaPlaylistItem?, previousItem: SharedMediaPlaylistItem?, order: MusicPlaybackSettingsOrder, looping: MusicPlaybackSettingsLooping) { + self.loading = loading + self.playedToEnd = playedToEnd + self.item = item + self.nextItem = nextItem + self.previousItem = previousItem + self.order = order + self.looping = looping + } + + public static func ==(lhs: SharedMediaPlaylistState, rhs: SharedMediaPlaylistState) -> Bool { + if lhs.loading != rhs.loading { + return false + } + if !arePlaylistItemsEqual(lhs.item, rhs.item) { + return false + } + if !arePlaylistItemsEqual(lhs.nextItem, rhs.nextItem) { + return false + } + if !arePlaylistItemsEqual(lhs.previousItem, rhs.previousItem) { + return false + } + if lhs.order != rhs.order { + return false + } + if lhs.looping != rhs.looping { + return false + } + return true + } +} + +public final class SharedMediaPlayerItemPlaybackState: Equatable { + public let playlistId: SharedMediaPlaylistId + public let playlistLocation: SharedMediaPlaylistLocation + public let item: SharedMediaPlaylistItem + public let previousItem: SharedMediaPlaylistItem? + public let nextItem: SharedMediaPlaylistItem? + public let status: MediaPlayerStatus + public let order: MusicPlaybackSettingsOrder + public let looping: MusicPlaybackSettingsLooping + public let playerIndex: Int32 + + public init(playlistId: SharedMediaPlaylistId, playlistLocation: SharedMediaPlaylistLocation, item: SharedMediaPlaylistItem, previousItem: SharedMediaPlaylistItem?, nextItem: SharedMediaPlaylistItem?, status: MediaPlayerStatus, order: MusicPlaybackSettingsOrder, looping: MusicPlaybackSettingsLooping, playerIndex: Int32) { + self.playlistId = playlistId + self.playlistLocation = playlistLocation + self.item = item + self.previousItem = previousItem + self.nextItem = nextItem + self.status = status + self.order = order + self.looping = looping + self.playerIndex = playerIndex + } + + public static func ==(lhs: SharedMediaPlayerItemPlaybackState, rhs: SharedMediaPlayerItemPlaybackState) -> Bool { + if !lhs.playlistId.isEqual(to: rhs.playlistId) { + return false + } + if !arePlaylistItemsEqual(lhs.item, rhs.item) { + return false + } + if !arePlaylistItemsEqual(lhs.previousItem, rhs.previousItem) { + return false + } + if !arePlaylistItemsEqual(lhs.nextItem, rhs.nextItem) { + return false + } + if lhs.status != rhs.status { + return false + } + if lhs.playerIndex != rhs.playerIndex { + return false + } + if lhs.order != rhs.order { + return false + } + if lhs.looping != rhs.looping { + return false + } + return true + } +} + +public enum SharedMediaPlayerState: Equatable { + case loading + case item(SharedMediaPlayerItemPlaybackState) + + public static func ==(lhs: SharedMediaPlayerState, rhs: SharedMediaPlayerState) -> Bool { + switch lhs { + case .loading: + if case .loading = rhs { + return true + } else { + return false + } + case let .item(item): + if case .item(item) = rhs { + return true + } else { + return false + } + } + } +} + +public enum SharedMediaPlayerItemPlaybackStateOrLoading: Equatable { + case state(SharedMediaPlayerItemPlaybackState) + case loading +} diff --git a/submodules/TelegramUI/TelegramUI/UniversalVideoNode.swift b/submodules/AccountContext/Sources/UniversalVideoNode.swift similarity index 83% rename from submodules/TelegramUI/TelegramUI/UniversalVideoNode.swift rename to submodules/AccountContext/Sources/UniversalVideoNode.swift index a6113d3b22..686fcc711e 100644 --- a/submodules/TelegramUI/TelegramUI/UniversalVideoNode.swift +++ b/submodules/AccountContext/Sources/UniversalVideoNode.swift @@ -8,7 +8,7 @@ import Display import TelegramAudio import UniversalMediaPlayer -protocol UniversalVideoContentNode: class { +public protocol UniversalVideoContentNode: class { var ready: Signal { get } var status: Signal { get } var bufferingStatus: Signal<(IndexSet, Int)?, NoError> { get } @@ -30,7 +30,7 @@ protocol UniversalVideoContentNode: class { func fetchControl(_ control: UniversalVideoNodeFetchControl) } -protocol UniversalVideoContent { +public protocol UniversalVideoContent { var id: AnyHashable { get } var dimensions: CGSize { get } var duration: Int32 { get } @@ -40,13 +40,13 @@ protocol UniversalVideoContent { func isEqual(to other: UniversalVideoContent) -> Bool } -extension UniversalVideoContent { +public extension UniversalVideoContent { func isEqual(to other: UniversalVideoContent) -> Bool { return false } } -protocol UniversalVideoDecoration: class { +public protocol UniversalVideoDecoration: class { var backgroundNode: ASDisplayNode? { get } var contentContainerNode: ASDisplayNode { get } var foregroundNode: ASDisplayNode? { get } @@ -59,33 +59,29 @@ protocol UniversalVideoDecoration: class { func tap() } -enum UniversalVideoPriority: Int32, Comparable { +public enum UniversalVideoPriority: Int32, Comparable { case secondaryOverlay = 0 case embedded = 1 case gallery = 2 case overlay = 3 - static func <(lhs: UniversalVideoPriority, rhs: UniversalVideoPriority) -> Bool { + public static func <(lhs: UniversalVideoPriority, rhs: UniversalVideoPriority) -> Bool { return lhs.rawValue < rhs.rawValue } - - static func ==(lhs: UniversalVideoPriority, rhs: UniversalVideoPriority) -> Bool { - return lhs.rawValue == rhs.rawValue - } } -enum UniversalVideoNodeFetchControl { +public enum UniversalVideoNodeFetchControl { case fetch case cancel } -final class UniversalVideoNode: ASDisplayNode { +public final class UniversalVideoNode: ASDisplayNode { private let postbox: Postbox private let audioSession: ManagedAudioSession - private let manager: UniversalVideoContentManager + private let manager: UniversalVideoManager private let content: UniversalVideoContent private let priority: UniversalVideoPriority - let decoration: UniversalVideoDecoration + public let decoration: UniversalVideoDecoration private let autoplay: Bool private let snapshotContentWhenGone: Bool @@ -95,27 +91,27 @@ final class UniversalVideoNode: ASDisplayNode { private var playbackCompletedIndex: Int? private var contentRequestIndex: (AnyHashable, Int32)? - var playbackCompleted: (() -> Void)? + public var playbackCompleted: (() -> Void)? - private(set) var ownsContentNode: Bool = false - var ownsContentNodeUpdated: ((Bool) -> Void)? + public private(set) var ownsContentNode: Bool = false + public var ownsContentNodeUpdated: ((Bool) -> Void)? private let _status = Promise() - var status: Signal { + public var status: Signal { return self._status.get() } private let _bufferingStatus = Promise<(IndexSet, Int)?>() - var bufferingStatus: Signal<(IndexSet, Int)?, NoError> { + public var bufferingStatus: Signal<(IndexSet, Int)?, NoError> { return self._bufferingStatus.get() } private let _ready = Promise() - var ready: Signal { + public var ready: Signal { return self._ready.get() } - var canAttachContent: Bool = false { + public var canAttachContent: Bool = false { didSet { if self.canAttachContent != oldValue { if self.canAttachContent { @@ -142,11 +138,11 @@ final class UniversalVideoNode: ASDisplayNode { } } - var hasAttachedContext: Bool { + public var hasAttachedContext: Bool { return self.contentNode != nil } - init(postbox: Postbox, audioSession: ManagedAudioSession, manager: UniversalVideoContentManager, decoration: UniversalVideoDecoration, content: UniversalVideoContent, priority: UniversalVideoPriority, autoplay: Bool = false, snapshotContentWhenGone: Bool = false) { + public init(postbox: Postbox, audioSession: ManagedAudioSession, manager: UniversalVideoManager, decoration: UniversalVideoDecoration, content: UniversalVideoContent, priority: UniversalVideoPriority, autoplay: Bool = false, snapshotContentWhenGone: Bool = false) { self.postbox = postbox self.audioSession = audioSession self.manager = manager @@ -178,7 +174,7 @@ final class UniversalVideoNode: ASDisplayNode { } } - override func didLoad() { + override public func didLoad() { super.didLoad() self.view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.tapGesture(_:)))) @@ -230,11 +226,11 @@ final class UniversalVideoNode: ASDisplayNode { } } - func updateLayout(size: CGSize, transition: ContainedViewLayoutTransition) { + public func updateLayout(size: CGSize, transition: ContainedViewLayoutTransition) { self.decoration.updateLayout(size: size, transition: transition) } - func play() { + public func play() { self.manager.withUniversalVideoContent(id: self.content.id, { contentNode in if let contentNode = contentNode { contentNode.play() @@ -242,7 +238,7 @@ final class UniversalVideoNode: ASDisplayNode { }) } - func pause() { + public func pause() { self.manager.withUniversalVideoContent(id: self.content.id, { contentNode in if let contentNode = contentNode { contentNode.pause() @@ -250,7 +246,7 @@ final class UniversalVideoNode: ASDisplayNode { }) } - func togglePlayPause() { + public func togglePlayPause() { self.manager.withUniversalVideoContent(id: self.content.id, { contentNode in if let contentNode = contentNode { contentNode.togglePlayPause() @@ -258,7 +254,7 @@ final class UniversalVideoNode: ASDisplayNode { }) } - func setSoundEnabled(_ value: Bool) { + public func setSoundEnabled(_ value: Bool) { self.manager.withUniversalVideoContent(id: self.content.id, { contentNode in if let contentNode = contentNode { contentNode.setSoundEnabled(value) @@ -266,7 +262,7 @@ final class UniversalVideoNode: ASDisplayNode { }) } - func seek(_ timestamp: Double) { + public func seek(_ timestamp: Double) { self.manager.withUniversalVideoContent(id: self.content.id, { contentNode in if let contentNode = contentNode { contentNode.seek(timestamp) @@ -274,7 +270,7 @@ final class UniversalVideoNode: ASDisplayNode { }) } - func playOnceWithSound(playAndRecord: Bool, seek: MediaPlayerSeek = .start, actionAtEnd: MediaPlayerPlayOnceWithSoundActionAtEnd = .loopDisablingSound) { + public func playOnceWithSound(playAndRecord: Bool, seek: MediaPlayerSeek = .start, actionAtEnd: MediaPlayerPlayOnceWithSoundActionAtEnd = .loopDisablingSound) { self.manager.withUniversalVideoContent(id: self.content.id, { contentNode in if let contentNode = contentNode { contentNode.playOnceWithSound(playAndRecord: playAndRecord, seek: seek, actionAtEnd: actionAtEnd) @@ -282,7 +278,7 @@ final class UniversalVideoNode: ASDisplayNode { }) } - func setContinuePlayingWithoutSoundOnLostAudioSession(_ value: Bool) { + public func setContinuePlayingWithoutSoundOnLostAudioSession(_ value: Bool) { self.manager.withUniversalVideoContent(id: self.content.id, { contentNode in if let contentNode = contentNode { contentNode.setContinuePlayingWithoutSoundOnLostAudioSession(value) @@ -290,7 +286,7 @@ final class UniversalVideoNode: ASDisplayNode { }) } - func setForceAudioToSpeaker(_ forceAudioToSpeaker: Bool) { + public func setForceAudioToSpeaker(_ forceAudioToSpeaker: Bool) { self.manager.withUniversalVideoContent(id: self.content.id, { contentNode in if let contentNode = contentNode { contentNode.setForceAudioToSpeaker(forceAudioToSpeaker) @@ -298,7 +294,7 @@ final class UniversalVideoNode: ASDisplayNode { }) } - func setBaseRate(_ baseRate: Double) { + public func setBaseRate(_ baseRate: Double) { self.manager.withUniversalVideoContent(id: self.content.id, { contentNode in if let contentNode = contentNode { contentNode.setBaseRate(baseRate) @@ -306,7 +302,7 @@ final class UniversalVideoNode: ASDisplayNode { }) } - func continuePlayingWithoutSound(actionAtEnd: MediaPlayerPlayOnceWithSoundActionAtEnd = .loopDisablingSound) { + public func continuePlayingWithoutSound(actionAtEnd: MediaPlayerPlayOnceWithSoundActionAtEnd = .loopDisablingSound) { self.manager.withUniversalVideoContent(id: self.content.id, { contentNode in if let contentNode = contentNode { contentNode.continuePlayingWithoutSound(actionAtEnd: actionAtEnd) @@ -314,7 +310,7 @@ final class UniversalVideoNode: ASDisplayNode { }) } - func fetchControl(_ control: UniversalVideoNodeFetchControl) { + public func fetchControl(_ control: UniversalVideoNodeFetchControl) { self.manager.withUniversalVideoContent(id: self.content.id, { contentNode in if let contentNode = contentNode { contentNode.fetchControl(control) @@ -322,7 +318,7 @@ final class UniversalVideoNode: ASDisplayNode { }) } - @objc func tapGesture(_ recognizer: UITapGestureRecognizer) { + @objc private func tapGesture(_ recognizer: UITapGestureRecognizer) { if case .ended = recognizer.state { self.decoration.tap() } diff --git a/submodules/AccountContext/Sources/WallpaperUploadManager.swift b/submodules/AccountContext/Sources/WallpaperUploadManager.swift new file mode 100644 index 0000000000..5c3a67f351 --- /dev/null +++ b/submodules/AccountContext/Sources/WallpaperUploadManager.swift @@ -0,0 +1,24 @@ +import Foundation +import SwiftSignalKit +import TelegramCore +import TelegramPresentationData + +public enum WallpaperUploadManagerStatus { + case none + case uploading(TelegramWallpaper, Float) + case uploaded(TelegramWallpaper, TelegramWallpaper) + + public var wallpaper: TelegramWallpaper? { + switch self { + case let .uploading(wallpaper, _), let .uploaded(wallpaper, _): + return wallpaper + default: + return nil + } + } +} + +public protocol WallpaperUploadManager: class { + func stateSignal() -> Signal + func presentationDataUpdated(_ presentationData: PresentationData) +} diff --git a/submodules/AccountContext/Sources/WatchManager.swift b/submodules/AccountContext/Sources/WatchManager.swift new file mode 100644 index 0000000000..b7574c28f8 --- /dev/null +++ b/submodules/AccountContext/Sources/WatchManager.swift @@ -0,0 +1,23 @@ +import Foundation +import SwiftSignalKit +import Postbox + +public struct WatchRunningTasks: Equatable { + public let running: Bool + public let version: Int32 + + public init(running: Bool, version: Int32) { + self.running = running + self.version = version + } + + public static func ==(lhs: WatchRunningTasks, rhs: WatchRunningTasks) -> Bool { + return lhs.running == rhs.running && lhs.version == rhs.version + } +} + +public protocol WatchManager: class { + var watchAppInstalled: Signal { get } + var navigateToMessageRequested: Signal { get } + var runningTasks: Signal { get } +} diff --git a/submodules/AnimationUI/Sources/FrameworkBundle.swift b/submodules/AnimationUI/Sources/FrameworkBundle.swift index 0ff8e5a0cc..2d6a4df5c4 100644 --- a/submodules/AnimationUI/Sources/FrameworkBundle.swift +++ b/submodules/AnimationUI/Sources/FrameworkBundle.swift @@ -1,5 +1,4 @@ import Foundation -import UIKit private class FrameworkBundleClass: NSObject { } diff --git a/submodules/AvatarNode/AvatarNode_Xcode.xcodeproj/project.pbxproj b/submodules/AvatarNode/AvatarNode_Xcode.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..ecbd956d77 --- /dev/null +++ b/submodules/AvatarNode/AvatarNode_Xcode.xcodeproj/project.pbxproj @@ -0,0 +1,571 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + D0879AF722F7079F00C4D6B3 /* AvatarNode.h in Headers */ = {isa = PBXBuildFile; fileRef = D0879AF522F7079F00C4D6B3 /* AvatarNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D0879B0222F7087800C4D6B3 /* AvatarNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879B0122F7087800C4D6B3 /* AvatarNode.swift */; }; + D0879B0522F7087F00C4D6B3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B0422F7087F00C4D6B3 /* Foundation.framework */; }; + D0879B0722F7088400C4D6B3 /* Postbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B0622F7088400C4D6B3 /* Postbox.framework */; }; + D0879B0922F7088700C4D6B3 /* TelegramCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B0822F7088700C4D6B3 /* TelegramCore.framework */; }; + D0879B0B22F7088B00C4D6B3 /* AsyncDisplayKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B0A22F7088B00C4D6B3 /* AsyncDisplayKit.framework */; }; + D0879B0D22F7088F00C4D6B3 /* Display.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B0C22F7088F00C4D6B3 /* Display.framework */; }; + D0879B0F22F7089400C4D6B3 /* TelegramPresentationData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B0E22F7089400C4D6B3 /* TelegramPresentationData.framework */; }; + D0879B1522F70BAF00C4D6B3 /* PeerAvatar.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879B1422F70BAF00C4D6B3 /* PeerAvatar.swift */; }; + D0879B1722F70BFB00C4D6B3 /* FrameworkBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879B1622F70BFB00C4D6B3 /* FrameworkBundle.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + D0879AF222F7079F00C4D6B3 /* AvatarNode.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AvatarNode.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879AF522F7079F00C4D6B3 /* AvatarNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AvatarNode.h; sourceTree = ""; }; + D0879AF622F7079F00C4D6B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D0879B0122F7087800C4D6B3 /* AvatarNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AvatarNode.swift; sourceTree = ""; }; + D0879B0422F7087F00C4D6B3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + D0879B0622F7088400C4D6B3 /* Postbox.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Postbox.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B0822F7088700C4D6B3 /* TelegramCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B0A22F7088B00C4D6B3 /* AsyncDisplayKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = AsyncDisplayKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B0C22F7088F00C4D6B3 /* Display.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Display.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B0E22F7089400C4D6B3 /* TelegramPresentationData.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramPresentationData.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B1422F70BAF00C4D6B3 /* PeerAvatar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PeerAvatar.swift; sourceTree = ""; }; + D0879B1622F70BFB00C4D6B3 /* FrameworkBundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FrameworkBundle.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + D0879AEF22F7079F00C4D6B3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879B0F22F7089400C4D6B3 /* TelegramPresentationData.framework in Frameworks */, + D0879B0D22F7088F00C4D6B3 /* Display.framework in Frameworks */, + D0879B0B22F7088B00C4D6B3 /* AsyncDisplayKit.framework in Frameworks */, + D0879B0922F7088700C4D6B3 /* TelegramCore.framework in Frameworks */, + D0879B0722F7088400C4D6B3 /* Postbox.framework in Frameworks */, + D0879B0522F7087F00C4D6B3 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + D0879AE822F7079F00C4D6B3 = { + isa = PBXGroup; + children = ( + D0879AF622F7079F00C4D6B3 /* Info.plist */, + D0879AF422F7079F00C4D6B3 /* Sources */, + D0879AF322F7079F00C4D6B3 /* Products */, + D0879B0322F7087F00C4D6B3 /* Frameworks */, + ); + sourceTree = ""; + }; + D0879AF322F7079F00C4D6B3 /* Products */ = { + isa = PBXGroup; + children = ( + D0879AF222F7079F00C4D6B3 /* AvatarNode.framework */, + ); + name = Products; + sourceTree = ""; + }; + D0879AF422F7079F00C4D6B3 /* Sources */ = { + isa = PBXGroup; + children = ( + D0879B1422F70BAF00C4D6B3 /* PeerAvatar.swift */, + D0879B0122F7087800C4D6B3 /* AvatarNode.swift */, + D0879B1622F70BFB00C4D6B3 /* FrameworkBundle.swift */, + D0879AF522F7079F00C4D6B3 /* AvatarNode.h */, + ); + path = Sources; + sourceTree = ""; + }; + D0879B0322F7087F00C4D6B3 /* Frameworks */ = { + isa = PBXGroup; + children = ( + D0879B0E22F7089400C4D6B3 /* TelegramPresentationData.framework */, + D0879B0C22F7088F00C4D6B3 /* Display.framework */, + D0879B0A22F7088B00C4D6B3 /* AsyncDisplayKit.framework */, + D0879B0822F7088700C4D6B3 /* TelegramCore.framework */, + D0879B0622F7088400C4D6B3 /* Postbox.framework */, + D0879B0422F7087F00C4D6B3 /* Foundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + D0879AED22F7079F00C4D6B3 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879AF722F7079F00C4D6B3 /* AvatarNode.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + D0879AF122F7079F00C4D6B3 /* AvatarNode */ = { + isa = PBXNativeTarget; + buildConfigurationList = D0879AFA22F7079F00C4D6B3 /* Build configuration list for PBXNativeTarget "AvatarNode" */; + buildPhases = ( + D0879AED22F7079F00C4D6B3 /* Headers */, + D0879AEE22F7079F00C4D6B3 /* Sources */, + D0879AEF22F7079F00C4D6B3 /* Frameworks */, + D0879AF022F7079F00C4D6B3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = AvatarNode; + productName = AvatarNode; + productReference = D0879AF222F7079F00C4D6B3 /* AvatarNode.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + D0879AE922F7079F00C4D6B3 /* Project object */ = { + isa = PBXProject; + attributes = { + DefaultBuildSystemTypeForWorkspace = Latest; + LastUpgradeCheck = 1030; + ORGANIZATIONNAME = "Telegram Messenger LLP"; + TargetAttributes = { + D0879AF122F7079F00C4D6B3 = { + CreatedOnToolsVersion = 10.3; + LastSwiftMigration = 1030; + }; + }; + }; + buildConfigurationList = D0879AEC22F7079F00C4D6B3 /* Build configuration list for PBXProject "AvatarNode_Xcode" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = D0879AE822F7079F00C4D6B3; + productRefGroup = D0879AF322F7079F00C4D6B3 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + D0879AF122F7079F00C4D6B3 /* AvatarNode */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + D0879AF022F7079F00C4D6B3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + D0879AEE22F7079F00C4D6B3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879B1522F70BAF00C4D6B3 /* PeerAvatar.swift in Sources */, + D0879B0222F7087800C4D6B3 /* AvatarNode.swift in Sources */, + D0879B1722F70BFB00C4D6B3 /* FrameworkBundle.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + D0879AF822F7079F00C4D6B3 /* DebugAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = DebugAppStoreLLC; + }; + D0879AF922F7079F00C4D6B3 /* ReleaseAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = ReleaseAppStoreLLC; + }; + D0879AFB22F7079F00C4D6B3 /* DebugAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.AvatarNode; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = DebugAppStoreLLC; + }; + D0879AFC22F7079F00C4D6B3 /* ReleaseAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.AvatarNode; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = ReleaseAppStoreLLC; + }; + D0879AFD22F707BB00C4D6B3 /* DebugHockeyapp */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = DebugHockeyapp; + }; + D0879AFE22F707BB00C4D6B3 /* DebugHockeyapp */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.AvatarNode; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = DebugHockeyapp; + }; + D0879AFF22F707C700C4D6B3 /* ReleaseHockeyappInternal */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = ReleaseHockeyappInternal; + }; + D0879B0022F707C700C4D6B3 /* ReleaseHockeyappInternal */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.AvatarNode; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = ReleaseHockeyappInternal; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + D0879AEC22F7079F00C4D6B3 /* Build configuration list for PBXProject "AvatarNode_Xcode" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D0879AF822F7079F00C4D6B3 /* DebugAppStoreLLC */, + D0879AFD22F707BB00C4D6B3 /* DebugHockeyapp */, + D0879AF922F7079F00C4D6B3 /* ReleaseAppStoreLLC */, + D0879AFF22F707C700C4D6B3 /* ReleaseHockeyappInternal */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ReleaseAppStoreLLC; + }; + D0879AFA22F7079F00C4D6B3 /* Build configuration list for PBXNativeTarget "AvatarNode" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D0879AFB22F7079F00C4D6B3 /* DebugAppStoreLLC */, + D0879AFE22F707BB00C4D6B3 /* DebugHockeyapp */, + D0879AFC22F7079F00C4D6B3 /* ReleaseAppStoreLLC */, + D0879B0022F707C700C4D6B3 /* ReleaseHockeyappInternal */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ReleaseAppStoreLLC; + }; +/* End XCConfigurationList section */ + }; + rootObject = D0879AE922F7079F00C4D6B3 /* Project object */; +} diff --git a/submodules/AvatarNode/Info.plist b/submodules/AvatarNode/Info.plist new file mode 100644 index 0000000000..e1fe4cfb7b --- /dev/null +++ b/submodules/AvatarNode/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + + diff --git a/submodules/AvatarNode/Sources/AvatarNode.h b/submodules/AvatarNode/Sources/AvatarNode.h new file mode 100644 index 0000000000..999cedcf3d --- /dev/null +++ b/submodules/AvatarNode/Sources/AvatarNode.h @@ -0,0 +1,19 @@ +// +// AvatarNode.h +// AvatarNode +// +// Created by Peter on 8/4/19. +// Copyright © 2019 Telegram Messenger LLP. All rights reserved. +// + +#import + +//! Project version number for AvatarNode. +FOUNDATION_EXPORT double AvatarNodeVersionNumber; + +//! Project version string for AvatarNode. +FOUNDATION_EXPORT const unsigned char AvatarNodeVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/submodules/TelegramUI/TelegramUI/AvatarNode.swift b/submodules/AvatarNode/Sources/AvatarNode.swift similarity index 99% rename from submodules/TelegramUI/TelegramUI/AvatarNode.swift rename to submodules/AvatarNode/Sources/AvatarNode.swift index 69200b7cd5..ce9632d16f 100644 --- a/submodules/TelegramUI/TelegramUI/AvatarNode.swift +++ b/submodules/AvatarNode/Sources/AvatarNode.swift @@ -160,7 +160,7 @@ public final class AvatarEditOverlayNode: ASDisplayNode { } public final class AvatarNode: ASDisplayNode { - var font: UIFont { + public var font: UIFont { didSet { if oldValue !== font { if let parameters = self.parameters { @@ -176,10 +176,10 @@ public final class AvatarNode: ASDisplayNode { private var parameters: AvatarNodeParameters? private var theme: PresentationTheme? private var overrideImage: AvatarNodeImageOverride? - let imageNode: ImageNode + public let imageNode: ImageNode private var animationBackgroundNode: ImageNode? private var animationNode: AnimationNode? - var editOverlayNode: AvatarEditOverlayNode? + public var editOverlayNode: AvatarEditOverlayNode? private let imageReadyDisposable = MetaDisposable() private var state: AvatarNodeState = .empty @@ -540,7 +540,7 @@ public final class AvatarNode: ASDisplayNode { } } -func drawPeerAvatarLetters(context: CGContext, size: CGSize, font: UIFont, letters: [String], accountPeerId: PeerId, peerId: PeerId) { +public func drawPeerAvatarLetters(context: CGContext, size: CGSize, font: UIFont, letters: [String], accountPeerId: PeerId, peerId: PeerId) { context.beginPath() context.addEllipse(in: CGRect(x: 0.0, y: 0.0, width: size.width, height: size.height)) diff --git a/submodules/AvatarNode/Sources/FrameworkBundle.swift b/submodules/AvatarNode/Sources/FrameworkBundle.swift new file mode 100644 index 0000000000..8ca13d7d92 --- /dev/null +++ b/submodules/AvatarNode/Sources/FrameworkBundle.swift @@ -0,0 +1,13 @@ +import Foundation +import UIKit + +private class FrameworkBundleClass: NSObject { +} + +let frameworkBundle: Bundle = Bundle(for: FrameworkBundleClass.self) + +extension UIImage { + convenience init?(bundleImageName: String) { + self.init(named: bundleImageName, in: frameworkBundle, compatibleWith: nil) + } +} diff --git a/submodules/TelegramUI/TelegramUI/PeerAvatar.swift b/submodules/AvatarNode/Sources/PeerAvatar.swift similarity index 94% rename from submodules/TelegramUI/TelegramUI/PeerAvatar.swift rename to submodules/AvatarNode/Sources/PeerAvatar.swift index 53f5581b2b..1e74de1103 100644 --- a/submodules/TelegramUI/TelegramUI/PeerAvatar.swift +++ b/submodules/AvatarNode/Sources/PeerAvatar.swift @@ -63,7 +63,7 @@ public func peerAvatarImageData(account: Account, peer: Peer, authorOfMessage: M } } -func peerAvatarImage(account: Account, peer: Peer, authorOfMessage: MessageReference?, representation: TelegramMediaImageRepresentation?, displayDimensions: CGSize = CGSize(width: 60.0, height: 60.0), emptyColor: UIColor? = nil, synchronousLoad: Bool = false) -> Signal? { +public func peerAvatarImage(account: Account, peer: Peer, authorOfMessage: MessageReference?, representation: TelegramMediaImageRepresentation?, displayDimensions: CGSize = CGSize(width: 60.0, height: 60.0), emptyColor: UIColor? = nil, synchronousLoad: Bool = false) -> Signal? { if let imageData = peerAvatarImageData(account: account, peer: peer, authorOfMessage: authorOfMessage, representation: representation, synchronousLoad: synchronousLoad) { return imageData |> mapToSignal { data -> Signal in diff --git a/submodules/DeviceLocationManager/DeviceLocationManager_Xcode.xcodeproj/project.pbxproj b/submodules/DeviceLocationManager/DeviceLocationManager_Xcode.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..45d54e8af4 --- /dev/null +++ b/submodules/DeviceLocationManager/DeviceLocationManager_Xcode.xcodeproj/project.pbxproj @@ -0,0 +1,557 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + D0879A0022F64CA900C4D6B3 /* DeviceLocationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = D08799FE22F64CA900C4D6B3 /* DeviceLocationManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D0879A0B22F64DDD00C4D6B3 /* DeviceLocationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879A0A22F64DDD00C4D6B3 /* DeviceLocationManager.swift */; }; + D0879A1022F64E5800C4D6B3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A0F22F64E5800C4D6B3 /* Foundation.framework */; }; + D0879A1222F64E5B00C4D6B3 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A1122F64E5B00C4D6B3 /* CoreLocation.framework */; }; + D0879A1422F64E8D00C4D6B3 /* SwiftSignalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A1322F64E8D00C4D6B3 /* SwiftSignalKit.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + D08799FB22F64CA900C4D6B3 /* DeviceLocationManager.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DeviceLocationManager.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D08799FE22F64CA900C4D6B3 /* DeviceLocationManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeviceLocationManager.h; sourceTree = ""; }; + D08799FF22F64CA900C4D6B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D0879A0A22F64DDD00C4D6B3 /* DeviceLocationManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeviceLocationManager.swift; sourceTree = ""; }; + D0879A0F22F64E5800C4D6B3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + D0879A1122F64E5B00C4D6B3 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; + D0879A1322F64E8D00C4D6B3 /* SwiftSignalKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SwiftSignalKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879A1522F64EA200C4D6B3 /* TelegramCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + D08799F822F64CA900C4D6B3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879A1222F64E5B00C4D6B3 /* CoreLocation.framework in Frameworks */, + D0879A1422F64E8D00C4D6B3 /* SwiftSignalKit.framework in Frameworks */, + D0879A1022F64E5800C4D6B3 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + D08799F122F64CA900C4D6B3 = { + isa = PBXGroup; + children = ( + D08799FF22F64CA900C4D6B3 /* Info.plist */, + D08799FD22F64CA900C4D6B3 /* Sources */, + D08799FC22F64CA900C4D6B3 /* Products */, + D0879A0E22F64E5700C4D6B3 /* Frameworks */, + ); + sourceTree = ""; + }; + D08799FC22F64CA900C4D6B3 /* Products */ = { + isa = PBXGroup; + children = ( + D08799FB22F64CA900C4D6B3 /* DeviceLocationManager.framework */, + ); + name = Products; + sourceTree = ""; + }; + D08799FD22F64CA900C4D6B3 /* Sources */ = { + isa = PBXGroup; + children = ( + D0879A0A22F64DDD00C4D6B3 /* DeviceLocationManager.swift */, + D08799FE22F64CA900C4D6B3 /* DeviceLocationManager.h */, + ); + path = Sources; + sourceTree = ""; + }; + D0879A0E22F64E5700C4D6B3 /* Frameworks */ = { + isa = PBXGroup; + children = ( + D0879A1522F64EA200C4D6B3 /* TelegramCore.framework */, + D0879A1322F64E8D00C4D6B3 /* SwiftSignalKit.framework */, + D0879A1122F64E5B00C4D6B3 /* CoreLocation.framework */, + D0879A0F22F64E5800C4D6B3 /* Foundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + D08799F622F64CA900C4D6B3 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879A0022F64CA900C4D6B3 /* DeviceLocationManager.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + D08799FA22F64CA900C4D6B3 /* DeviceLocationManager */ = { + isa = PBXNativeTarget; + buildConfigurationList = D0879A0322F64CA900C4D6B3 /* Build configuration list for PBXNativeTarget "DeviceLocationManager" */; + buildPhases = ( + D08799F622F64CA900C4D6B3 /* Headers */, + D08799F722F64CA900C4D6B3 /* Sources */, + D08799F822F64CA900C4D6B3 /* Frameworks */, + D08799F922F64CA900C4D6B3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = DeviceLocationManager; + productName = DeviceLocationManager; + productReference = D08799FB22F64CA900C4D6B3 /* DeviceLocationManager.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + D08799F222F64CA900C4D6B3 /* Project object */ = { + isa = PBXProject; + attributes = { + DefaultBuildSystemTypeForWorkspace = Latest; + LastUpgradeCheck = 1030; + ORGANIZATIONNAME = "Telegram Messenger LLP"; + TargetAttributes = { + D08799FA22F64CA900C4D6B3 = { + CreatedOnToolsVersion = 10.3; + LastSwiftMigration = 1030; + }; + }; + }; + buildConfigurationList = D08799F522F64CA900C4D6B3 /* Build configuration list for PBXProject "DeviceLocationManager_Xcode" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = D08799F122F64CA900C4D6B3; + productRefGroup = D08799FC22F64CA900C4D6B3 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + D08799FA22F64CA900C4D6B3 /* DeviceLocationManager */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + D08799F922F64CA900C4D6B3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + D08799F722F64CA900C4D6B3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879A0B22F64DDD00C4D6B3 /* DeviceLocationManager.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + D0879A0122F64CA900C4D6B3 /* DebugAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = DebugAppStoreLLC; + }; + D0879A0222F64CA900C4D6B3 /* ReleaseAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = ReleaseAppStoreLLC; + }; + D0879A0422F64CA900C4D6B3 /* DebugAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.DeviceLocationManager; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = DebugAppStoreLLC; + }; + D0879A0522F64CA900C4D6B3 /* ReleaseAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.DeviceLocationManager; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = ReleaseAppStoreLLC; + }; + D0879A0622F64DA200C4D6B3 /* DebugHockeyapp */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = DebugHockeyapp; + }; + D0879A0722F64DA200C4D6B3 /* DebugHockeyapp */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.DeviceLocationManager; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = DebugHockeyapp; + }; + D0879A0822F64DAE00C4D6B3 /* ReleaseHockeyappInternal */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = ReleaseHockeyappInternal; + }; + D0879A0922F64DAE00C4D6B3 /* ReleaseHockeyappInternal */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.DeviceLocationManager; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = ReleaseHockeyappInternal; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + D08799F522F64CA900C4D6B3 /* Build configuration list for PBXProject "DeviceLocationManager_Xcode" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D0879A0122F64CA900C4D6B3 /* DebugAppStoreLLC */, + D0879A0622F64DA200C4D6B3 /* DebugHockeyapp */, + D0879A0222F64CA900C4D6B3 /* ReleaseAppStoreLLC */, + D0879A0822F64DAE00C4D6B3 /* ReleaseHockeyappInternal */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ReleaseAppStoreLLC; + }; + D0879A0322F64CA900C4D6B3 /* Build configuration list for PBXNativeTarget "DeviceLocationManager" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D0879A0422F64CA900C4D6B3 /* DebugAppStoreLLC */, + D0879A0722F64DA200C4D6B3 /* DebugHockeyapp */, + D0879A0522F64CA900C4D6B3 /* ReleaseAppStoreLLC */, + D0879A0922F64DAE00C4D6B3 /* ReleaseHockeyappInternal */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ReleaseAppStoreLLC; + }; +/* End XCConfigurationList section */ + }; + rootObject = D08799F222F64CA900C4D6B3 /* Project object */; +} diff --git a/submodules/DeviceLocationManager/Info.plist b/submodules/DeviceLocationManager/Info.plist new file mode 100644 index 0000000000..e1fe4cfb7b --- /dev/null +++ b/submodules/DeviceLocationManager/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + + diff --git a/submodules/DeviceLocationManager/Sources/DeviceLocationManager.h b/submodules/DeviceLocationManager/Sources/DeviceLocationManager.h new file mode 100644 index 0000000000..56286ed2cf --- /dev/null +++ b/submodules/DeviceLocationManager/Sources/DeviceLocationManager.h @@ -0,0 +1,19 @@ +// +// DeviceLocationManager.h +// DeviceLocationManager +// +// Created by Peter on 8/4/19. +// Copyright © 2019 Telegram Messenger LLP. All rights reserved. +// + +#import + +//! Project version number for DeviceLocationManager. +FOUNDATION_EXPORT double DeviceLocationManagerVersionNumber; + +//! Project version string for DeviceLocationManager. +FOUNDATION_EXPORT const unsigned char DeviceLocationManagerVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/submodules/TelegramUI/TelegramUI/DeviceLocationManager.swift b/submodules/DeviceLocationManager/Sources/DeviceLocationManager.swift similarity index 78% rename from submodules/TelegramUI/TelegramUI/DeviceLocationManager.swift rename to submodules/DeviceLocationManager/Sources/DeviceLocationManager.swift index 4099490a9f..b4b052d256 100644 --- a/submodules/TelegramUI/TelegramUI/DeviceLocationManager.swift +++ b/submodules/DeviceLocationManager/Sources/DeviceLocationManager.swift @@ -1,9 +1,8 @@ import Foundation import CoreLocation import SwiftSignalKit -import TelegramCore -enum DeviceLocationMode: Int32 { +public enum DeviceLocationMode: Int32 { case precise = 0 } @@ -29,8 +28,9 @@ private func getTopMode(subscribers: [DeviceLocationSubscriber]) -> DeviceLocati return mode } -final class DeviceLocationManager: NSObject, CLLocationManagerDelegate { +public final class DeviceLocationManager: NSObject { private let queue: Queue + private let log: ((String) -> Void)? private let manager: CLLocationManager private var requestedAuthorization = false @@ -41,10 +41,11 @@ final class DeviceLocationManager: NSObject, CLLocationManagerDelegate { private var currentLocation: CLLocationCoordinate2D? - init(queue: Queue) { + public init(queue: Queue, log: ((String) -> Void)? = nil) { assert(queue.isCurrent()) self.queue = queue + self.log = log self.manager = CLLocationManager() super.init() @@ -59,7 +60,7 @@ final class DeviceLocationManager: NSObject, CLLocationManagerDelegate { self.manager.pausesLocationUpdatesAutomatically = false } - func push(mode: DeviceLocationMode, updated: @escaping (CLLocationCoordinate2D) -> Void) -> Disposable { + public func push(mode: DeviceLocationMode, updated: @escaping (CLLocationCoordinate2D) -> Void) -> Disposable { assert(self.queue.isCurrent()) let id = self.nextSubscriberId @@ -99,7 +100,7 @@ final class DeviceLocationManager: NSObject, CLLocationManagerDelegate { if topMode != previousTopMode { self.currentTopMode = topMode if let topMode = topMode { - Logger.shared.log("DeviceLocation", "setting mode \(topMode)") + self.log?("setting mode \(topMode)") if previousTopMode == nil { if !self.requestedAuthorization { self.requestedAuthorization = true @@ -110,12 +111,14 @@ final class DeviceLocationManager: NSObject, CLLocationManagerDelegate { } else { self.currentLocation = nil self.manager.stopUpdatingLocation() - Logger.shared.log("DeviceLocation", "stopped") + self.log?("stopped") } } } - - func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { +} + +extension DeviceLocationManager: CLLocationManagerDelegate { + public func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { assert(self.queue.isCurrent()) if let location = locations.first { @@ -129,13 +132,16 @@ final class DeviceLocationManager: NSObject, CLLocationManagerDelegate { } } -func currentLocationManagerCoordinate(manager: DeviceLocationManager, timeout timeoutValue: Double) -> Signal { - return (Signal { subscriber in - let disposable = manager.push(mode: .precise, updated: { coordinate in - subscriber.putNext(coordinate) - subscriber.putCompletion() - }) - return disposable - } |> runOn(Queue.mainQueue())) +public func currentLocationManagerCoordinate(manager: DeviceLocationManager, timeout timeoutValue: Double) -> Signal { + return ( + Signal { subscriber in + let disposable = manager.push(mode: .precise, updated: { coordinate in + subscriber.putNext(coordinate) + subscriber.putCompletion() + }) + return disposable + } + |> runOn(Queue.mainQueue()) + ) |> timeout(timeoutValue, queue: Queue.mainQueue(), alternate: .single(nil)) } diff --git a/submodules/Display/Display/Accessibility.swift b/submodules/Display/Display/Accessibility.swift index cdda8f2de8..5127c84ca3 100644 --- a/submodules/Display/Display/Accessibility.swift +++ b/submodules/Display/Display/Accessibility.swift @@ -1,6 +1,7 @@ import Foundation import UIKit import AsyncDisplayKit +import SwiftSignalKit public func addAccessibilityChildren(of node: ASDisplayNode, container: Any, to list: inout [Any]) { if node.isAccessibilityElement { @@ -19,3 +20,43 @@ public func addAccessibilityChildren(of node: ASDisplayNode, container: Any, to } } +public func smartInvertColorsEnabled() -> Bool { + if #available(iOSApplicationExtension 11.0, iOS 11.0, *), UIAccessibility.isInvertColorsEnabled { + return true + } else { + return false + } +} + +public func reduceMotionEnabled() -> Signal { + return Signal { subscriber in + subscriber.putNext(UIAccessibility.isReduceMotionEnabled) + + let observer = NotificationCenter.default.addObserver(forName: UIAccessibility.reduceMotionStatusDidChangeNotification, object: nil, queue: .main, using: { _ in + subscriber.putNext(UIAccessibility.isReduceMotionEnabled) + }) + + return ActionDisposable { + Queue.mainQueue().async { + NotificationCenter.default.removeObserver(observer) + } + } + } |> runOn(Queue.mainQueue()) +} + +func boldTextEnabled() -> Signal { + return Signal { subscriber in + subscriber.putNext(UIAccessibility.isBoldTextEnabled) + + let observer = NotificationCenter.default.addObserver(forName: UIAccessibility.boldTextStatusDidChangeNotification, object: nil, queue: .main, using: { _ in + subscriber.putNext(UIAccessibility.isBoldTextEnabled) + }) + + return ActionDisposable { + Queue.mainQueue().async { + NotificationCenter.default.removeObserver(observer) + } + } + } + |> runOn(Queue.mainQueue()) +} diff --git a/submodules/ItemListUI/Sources/ItemListController.swift b/submodules/ItemListUI/Sources/ItemListController.swift index ec1af48c4c..20edf03b49 100644 --- a/submodules/ItemListUI/Sources/ItemListController.swift +++ b/submodules/ItemListUI/Sources/ItemListController.swift @@ -212,7 +212,7 @@ open class ItemListController: ViewController, KeyShor public var didDisappear: ((Bool) -> Void)? convenience public init(context: AccountContext, state: Signal<(ItemListControllerState, (ItemListNodeState, Entry.ItemGenerationArguments)), NoError>, tabBarItem: Signal? = nil) { - self.init(sharedContext: context.genericSharedContext, state: state, tabBarItem: tabBarItem) + self.init(sharedContext: context.sharedContext, state: state, tabBarItem: tabBarItem) } convenience public init(sharedContext: SharedAccountContext, state: Signal<(ItemListControllerState, (ItemListNodeState, Entry.ItemGenerationArguments)), NoError>, tabBarItem: Signal? = nil) { diff --git a/submodules/LiveLocationManager/Info.plist b/submodules/LiveLocationManager/Info.plist new file mode 100644 index 0000000000..e1fe4cfb7b --- /dev/null +++ b/submodules/LiveLocationManager/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + + diff --git a/submodules/LiveLocationManager/LiveLocationManager_Xcode.xcodeproj/project.pbxproj b/submodules/LiveLocationManager/LiveLocationManager_Xcode.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..a355886f74 --- /dev/null +++ b/submodules/LiveLocationManager/LiveLocationManager_Xcode.xcodeproj/project.pbxproj @@ -0,0 +1,571 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + D0879A2822F64F6E00C4D6B3 /* LiveLocationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = D0879A2622F64F6E00C4D6B3 /* LiveLocationManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D0879A3422F64FED00C4D6B3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A3322F64FED00C4D6B3 /* Foundation.framework */; }; + D0879A3622F64FF800C4D6B3 /* Postbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A3522F64FF800C4D6B3 /* Postbox.framework */; }; + D0879A3822F64FFD00C4D6B3 /* TelegramCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A3722F64FFD00C4D6B3 /* TelegramCore.framework */; }; + D0879A3A22F6500900C4D6B3 /* SwiftSignalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A3922F6500900C4D6B3 /* SwiftSignalKit.framework */; }; + D0879A3C22F6500F00C4D6B3 /* DeviceLocationManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A3B22F6500F00C4D6B3 /* DeviceLocationManager.framework */; }; + D0879A3F22F6502600C4D6B3 /* LiveLocationSummaryManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879A3D22F6502500C4D6B3 /* LiveLocationSummaryManager.swift */; }; + D0879A4022F6502600C4D6B3 /* LiveLocationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879A3E22F6502600C4D6B3 /* LiveLocationManager.swift */; }; + D0879A4422F6504800C4D6B3 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A4322F6504800C4D6B3 /* CoreLocation.framework */; }; + D0879A4822F6533900C4D6B3 /* AccountContext.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A4722F6533900C4D6B3 /* AccountContext.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + D0879A2322F64F6E00C4D6B3 /* LiveLocationManager.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = LiveLocationManager.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879A2622F64F6E00C4D6B3 /* LiveLocationManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LiveLocationManager.h; sourceTree = ""; }; + D0879A2722F64F6E00C4D6B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D0879A3322F64FED00C4D6B3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + D0879A3522F64FF800C4D6B3 /* Postbox.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Postbox.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879A3722F64FFD00C4D6B3 /* TelegramCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879A3922F6500900C4D6B3 /* SwiftSignalKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SwiftSignalKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879A3B22F6500F00C4D6B3 /* DeviceLocationManager.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = DeviceLocationManager.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879A3D22F6502500C4D6B3 /* LiveLocationSummaryManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LiveLocationSummaryManager.swift; sourceTree = ""; }; + D0879A3E22F6502600C4D6B3 /* LiveLocationManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LiveLocationManager.swift; sourceTree = ""; }; + D0879A4322F6504800C4D6B3 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; + D0879A4722F6533900C4D6B3 /* AccountContext.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = AccountContext.framework; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + D0879A2022F64F6E00C4D6B3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879A4822F6533900C4D6B3 /* AccountContext.framework in Frameworks */, + D0879A4422F6504800C4D6B3 /* CoreLocation.framework in Frameworks */, + D0879A3C22F6500F00C4D6B3 /* DeviceLocationManager.framework in Frameworks */, + D0879A3A22F6500900C4D6B3 /* SwiftSignalKit.framework in Frameworks */, + D0879A3822F64FFD00C4D6B3 /* TelegramCore.framework in Frameworks */, + D0879A3622F64FF800C4D6B3 /* Postbox.framework in Frameworks */, + D0879A3422F64FED00C4D6B3 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + D0879A1922F64F6E00C4D6B3 = { + isa = PBXGroup; + children = ( + D0879A2722F64F6E00C4D6B3 /* Info.plist */, + D0879A2522F64F6E00C4D6B3 /* Sources */, + D0879A2422F64F6E00C4D6B3 /* Products */, + D0879A3222F64FED00C4D6B3 /* Frameworks */, + ); + sourceTree = ""; + }; + D0879A2422F64F6E00C4D6B3 /* Products */ = { + isa = PBXGroup; + children = ( + D0879A2322F64F6E00C4D6B3 /* LiveLocationManager.framework */, + ); + name = Products; + sourceTree = ""; + }; + D0879A2522F64F6E00C4D6B3 /* Sources */ = { + isa = PBXGroup; + children = ( + D0879A3E22F6502600C4D6B3 /* LiveLocationManager.swift */, + D0879A3D22F6502500C4D6B3 /* LiveLocationSummaryManager.swift */, + D0879A2622F64F6E00C4D6B3 /* LiveLocationManager.h */, + ); + path = Sources; + sourceTree = ""; + }; + D0879A3222F64FED00C4D6B3 /* Frameworks */ = { + isa = PBXGroup; + children = ( + D0879A4722F6533900C4D6B3 /* AccountContext.framework */, + D0879A4322F6504800C4D6B3 /* CoreLocation.framework */, + D0879A3B22F6500F00C4D6B3 /* DeviceLocationManager.framework */, + D0879A3922F6500900C4D6B3 /* SwiftSignalKit.framework */, + D0879A3722F64FFD00C4D6B3 /* TelegramCore.framework */, + D0879A3522F64FF800C4D6B3 /* Postbox.framework */, + D0879A3322F64FED00C4D6B3 /* Foundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + D0879A1E22F64F6E00C4D6B3 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879A2822F64F6E00C4D6B3 /* LiveLocationManager.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + D0879A2222F64F6E00C4D6B3 /* LiveLocationManager */ = { + isa = PBXNativeTarget; + buildConfigurationList = D0879A2B22F64F6E00C4D6B3 /* Build configuration list for PBXNativeTarget "LiveLocationManager" */; + buildPhases = ( + D0879A1E22F64F6E00C4D6B3 /* Headers */, + D0879A1F22F64F6E00C4D6B3 /* Sources */, + D0879A2022F64F6E00C4D6B3 /* Frameworks */, + D0879A2122F64F6E00C4D6B3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = LiveLocationManager; + productName = LiveLocationManager; + productReference = D0879A2322F64F6E00C4D6B3 /* LiveLocationManager.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + D0879A1A22F64F6E00C4D6B3 /* Project object */ = { + isa = PBXProject; + attributes = { + DefaultBuildSystemTypeForWorkspace = Latest; + LastUpgradeCheck = 1030; + ORGANIZATIONNAME = "Telegram Messenger LLP"; + TargetAttributes = { + D0879A2222F64F6E00C4D6B3 = { + CreatedOnToolsVersion = 10.3; + LastSwiftMigration = 1030; + }; + }; + }; + buildConfigurationList = D0879A1D22F64F6E00C4D6B3 /* Build configuration list for PBXProject "LiveLocationManager_Xcode" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = D0879A1922F64F6E00C4D6B3; + productRefGroup = D0879A2422F64F6E00C4D6B3 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + D0879A2222F64F6E00C4D6B3 /* LiveLocationManager */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + D0879A2122F64F6E00C4D6B3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + D0879A1F22F64F6E00C4D6B3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879A4022F6502600C4D6B3 /* LiveLocationManager.swift in Sources */, + D0879A3F22F6502600C4D6B3 /* LiveLocationSummaryManager.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + D0879A2922F64F6E00C4D6B3 /* DebugAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = DebugAppStoreLLC; + }; + D0879A2A22F64F6E00C4D6B3 /* ReleaseAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = ReleaseAppStoreLLC; + }; + D0879A2C22F64F6E00C4D6B3 /* DebugAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.LiveLocationManager; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = DebugAppStoreLLC; + }; + D0879A2D22F64F6E00C4D6B3 /* ReleaseAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.LiveLocationManager; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = ReleaseAppStoreLLC; + }; + D0879A2E22F64F9A00C4D6B3 /* DebugHockeyapp */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = DebugHockeyapp; + }; + D0879A2F22F64F9A00C4D6B3 /* DebugHockeyapp */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.LiveLocationManager; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = DebugHockeyapp; + }; + D0879A3022F64FA700C4D6B3 /* ReleaseHockeyappInternal */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = ReleaseHockeyappInternal; + }; + D0879A3122F64FA700C4D6B3 /* ReleaseHockeyappInternal */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.LiveLocationManager; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = ReleaseHockeyappInternal; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + D0879A1D22F64F6E00C4D6B3 /* Build configuration list for PBXProject "LiveLocationManager_Xcode" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D0879A2922F64F6E00C4D6B3 /* DebugAppStoreLLC */, + D0879A2E22F64F9A00C4D6B3 /* DebugHockeyapp */, + D0879A2A22F64F6E00C4D6B3 /* ReleaseAppStoreLLC */, + D0879A3022F64FA700C4D6B3 /* ReleaseHockeyappInternal */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ReleaseAppStoreLLC; + }; + D0879A2B22F64F6E00C4D6B3 /* Build configuration list for PBXNativeTarget "LiveLocationManager" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D0879A2C22F64F6E00C4D6B3 /* DebugAppStoreLLC */, + D0879A2F22F64F9A00C4D6B3 /* DebugHockeyapp */, + D0879A2D22F64F6E00C4D6B3 /* ReleaseAppStoreLLC */, + D0879A3122F64FA700C4D6B3 /* ReleaseHockeyappInternal */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ReleaseAppStoreLLC; + }; +/* End XCConfigurationList section */ + }; + rootObject = D0879A1A22F64F6E00C4D6B3 /* Project object */; +} diff --git a/submodules/LiveLocationManager/Sources/LiveLocationManager.h b/submodules/LiveLocationManager/Sources/LiveLocationManager.h new file mode 100644 index 0000000000..e679dc36ad --- /dev/null +++ b/submodules/LiveLocationManager/Sources/LiveLocationManager.h @@ -0,0 +1,19 @@ +// +// LiveLocationManager.h +// LiveLocationManager +// +// Created by Peter on 8/4/19. +// Copyright © 2019 Telegram Messenger LLP. All rights reserved. +// + +#import + +//! Project version number for LiveLocationManager. +FOUNDATION_EXPORT double LiveLocationManagerVersionNumber; + +//! Project version string for LiveLocationManager. +FOUNDATION_EXPORT const unsigned char LiveLocationManagerVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/submodules/TelegramUI/TelegramUI/LiveLocationManager.swift b/submodules/LiveLocationManager/Sources/LiveLocationManager.swift similarity index 93% rename from submodules/TelegramUI/TelegramUI/LiveLocationManager.swift rename to submodules/LiveLocationManager/Sources/LiveLocationManager.swift index 51fbc71b86..d63f359847 100644 --- a/submodules/TelegramUI/TelegramUI/LiveLocationManager.swift +++ b/submodules/LiveLocationManager/Sources/LiveLocationManager.swift @@ -3,8 +3,10 @@ import TelegramCore import Postbox import SwiftSignalKit import CoreLocation +import DeviceLocationManager +import AccountContext -public final class LiveLocationManager { +public final class LiveLocationManagerImpl: LiveLocationManager { private let queue = Queue.mainQueue() private let postbox: Postbox @@ -12,7 +14,10 @@ public final class LiveLocationManager { private let stateManager: AccountStateManager private let locationManager: DeviceLocationManager - let summaryManager: LiveLocationSummaryManager + private let summaryManagerImpl: LiveLocationSummaryManagerImpl + public var summaryManager: LiveLocationSummaryManager { + return self.summaryManagerImpl + } private var requiredLocationTypeDisposable: Disposable? private let hasActiveMessagesToBroadcast = ValuePromise(false, ignoreRepeated: true) @@ -37,13 +42,13 @@ public final class LiveLocationManager { private var invalidationTimer: (SwiftSignalKit.Timer, Int32)? - init(postbox: Postbox, network: Network, accountPeerId: PeerId, viewTracker: AccountViewTracker, stateManager: AccountStateManager, locationManager: DeviceLocationManager, inForeground: Signal) { + public init(postbox: Postbox, network: Network, accountPeerId: PeerId, viewTracker: AccountViewTracker, stateManager: AccountStateManager, locationManager: DeviceLocationManager, inForeground: Signal) { self.postbox = postbox self.network = network self.stateManager = stateManager self.locationManager = locationManager - self.summaryManager = LiveLocationSummaryManager(queue: self.queue, postbox: postbox, accountPeerId: accountPeerId, viewTracker: viewTracker) + self.summaryManagerImpl = LiveLocationSummaryManagerImpl(queue: self.queue, postbox: postbox, accountPeerId: accountPeerId, viewTracker: viewTracker) let viewKey: PostboxViewKey = .localMessageTag(.OutgoingLiveLocation) self.messagesDisposable = (postbox.combinedView(keys: [viewKey]) @@ -130,7 +135,7 @@ public final class LiveLocationManager { let validBroadcastToMessageIds = Set(broadcastToMessageIds.keys) if self.broadcastToMessageIds != broadcastToMessageIds { - self.summaryManager.update(messageIds: validBroadcastToMessageIds) + self.summaryManagerImpl.update(messageIds: validBroadcastToMessageIds) } let wasEmpty = self.broadcastToMessageIds.isEmpty @@ -225,7 +230,7 @@ public final class LiveLocationManager { } } - func cancelLiveLocation(peerId: PeerId) { + public func cancelLiveLocation(peerId: PeerId) { assert(self.queue.isCurrent()) let ids = self.broadcastToMessageIds.keys.filter({ $0.peerId == peerId }) @@ -257,7 +262,7 @@ public final class LiveLocationManager { } } - func internalMessageForPeerId(_ peerId: PeerId) -> MessageId? { + public func internalMessageForPeerId(_ peerId: PeerId) -> MessageId? { for id in self.broadcastToMessageIds.keys { if id.peerId == peerId { return id diff --git a/submodules/TelegramUI/TelegramUI/LiveLocationSummaryManager.swift b/submodules/LiveLocationManager/Sources/LiveLocationSummaryManager.swift similarity index 96% rename from submodules/TelegramUI/TelegramUI/LiveLocationSummaryManager.swift rename to submodules/LiveLocationManager/Sources/LiveLocationSummaryManager.swift index 7b4c33a703..0918406d93 100644 --- a/submodules/TelegramUI/TelegramUI/LiveLocationSummaryManager.swift +++ b/submodules/LiveLocationManager/Sources/LiveLocationSummaryManager.swift @@ -2,6 +2,7 @@ import Foundation import Postbox import TelegramCore import SwiftSignalKit +import AccountContext private final class LiveLocationSummaryContext { private let queue: Queue @@ -183,7 +184,7 @@ private final class LiveLocationPeerSummaryContext { } } -final class LiveLocationSummaryManager { +public final class LiveLocationSummaryManagerImpl: LiveLocationSummaryManager { private let queue: Queue private let postbox: Postbox private let accountPeerId: PeerId @@ -226,11 +227,11 @@ final class LiveLocationSummaryManager { self.globalContext.messageIds = messageIds } - func broadcastingToMessages() -> Signal<[MessageId: Message], NoError> { + public func broadcastingToMessages() -> Signal<[MessageId: Message], NoError> { return self.globalContext.subscribe() } - func peersBroadcastingTo(peerId: PeerId) -> Signal<[(Peer, Message)]?, NoError> { + public func peersBroadcastingTo(peerId: PeerId) -> Signal<[(Peer, Message)]?, NoError> { let queue = self.queue return Signal { [weak self] subscriber in let disposable = MetaDisposable() diff --git a/submodules/LiveLocationTimerNode/Info.plist b/submodules/LiveLocationTimerNode/Info.plist new file mode 100644 index 0000000000..e1fe4cfb7b --- /dev/null +++ b/submodules/LiveLocationTimerNode/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + + diff --git a/submodules/LiveLocationTimerNode/LiveLocationTimerNode_Xcode.xcodeproj/project.pbxproj b/submodules/LiveLocationTimerNode/LiveLocationTimerNode_Xcode.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..3192c861ff --- /dev/null +++ b/submodules/LiveLocationTimerNode/LiveLocationTimerNode_Xcode.xcodeproj/project.pbxproj @@ -0,0 +1,559 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + D0879A8822F6F91000C4D6B3 /* LiveLocationTimerNode.h in Headers */ = {isa = PBXBuildFile; fileRef = D0879A8622F6F91000C4D6B3 /* LiveLocationTimerNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D0879A9322F6FA2300C4D6B3 /* ChatMessageLiveLocationTimerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879A9222F6FA2300C4D6B3 /* ChatMessageLiveLocationTimerNode.swift */; }; + D0879A9622F6FA8600C4D6B3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A9522F6FA8600C4D6B3 /* Foundation.framework */; }; + D0879A9822F6FA8900C4D6B3 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A9722F6FA8900C4D6B3 /* UIKit.framework */; }; + D0879A9A22F6FA9300C4D6B3 /* AsyncDisplayKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A9922F6FA9300C4D6B3 /* AsyncDisplayKit.framework */; }; + D0879A9C22F6FA9800C4D6B3 /* Display.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A9B22F6FA9800C4D6B3 /* Display.framework */; }; + D0879A9E22F6FA9E00C4D6B3 /* TelegramPresentationData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A9D22F6FA9E00C4D6B3 /* TelegramPresentationData.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + D0879A8322F6F91000C4D6B3 /* LiveLocationTimerNode.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = LiveLocationTimerNode.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879A8622F6F91000C4D6B3 /* LiveLocationTimerNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LiveLocationTimerNode.h; sourceTree = ""; }; + D0879A8722F6F91000C4D6B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D0879A9222F6FA2300C4D6B3 /* ChatMessageLiveLocationTimerNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatMessageLiveLocationTimerNode.swift; sourceTree = ""; }; + D0879A9522F6FA8600C4D6B3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + D0879A9722F6FA8900C4D6B3 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + D0879A9922F6FA9300C4D6B3 /* AsyncDisplayKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = AsyncDisplayKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879A9B22F6FA9800C4D6B3 /* Display.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Display.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879A9D22F6FA9E00C4D6B3 /* TelegramPresentationData.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramPresentationData.framework; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + D0879A8022F6F91000C4D6B3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879A9E22F6FA9E00C4D6B3 /* TelegramPresentationData.framework in Frameworks */, + D0879A9C22F6FA9800C4D6B3 /* Display.framework in Frameworks */, + D0879A9A22F6FA9300C4D6B3 /* AsyncDisplayKit.framework in Frameworks */, + D0879A9822F6FA8900C4D6B3 /* UIKit.framework in Frameworks */, + D0879A9622F6FA8600C4D6B3 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + D0879A7922F6F91000C4D6B3 = { + isa = PBXGroup; + children = ( + D0879A8722F6F91000C4D6B3 /* Info.plist */, + D0879A8522F6F91000C4D6B3 /* Sources */, + D0879A8422F6F91000C4D6B3 /* Products */, + D0879A9422F6FA8600C4D6B3 /* Frameworks */, + ); + sourceTree = ""; + }; + D0879A8422F6F91000C4D6B3 /* Products */ = { + isa = PBXGroup; + children = ( + D0879A8322F6F91000C4D6B3 /* LiveLocationTimerNode.framework */, + ); + name = Products; + sourceTree = ""; + }; + D0879A8522F6F91000C4D6B3 /* Sources */ = { + isa = PBXGroup; + children = ( + D0879A9222F6FA2300C4D6B3 /* ChatMessageLiveLocationTimerNode.swift */, + D0879A8622F6F91000C4D6B3 /* LiveLocationTimerNode.h */, + ); + path = Sources; + sourceTree = ""; + }; + D0879A9422F6FA8600C4D6B3 /* Frameworks */ = { + isa = PBXGroup; + children = ( + D0879A9D22F6FA9E00C4D6B3 /* TelegramPresentationData.framework */, + D0879A9B22F6FA9800C4D6B3 /* Display.framework */, + D0879A9922F6FA9300C4D6B3 /* AsyncDisplayKit.framework */, + D0879A9722F6FA8900C4D6B3 /* UIKit.framework */, + D0879A9522F6FA8600C4D6B3 /* Foundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + D0879A7E22F6F91000C4D6B3 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879A8822F6F91000C4D6B3 /* LiveLocationTimerNode.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + D0879A8222F6F91000C4D6B3 /* LiveLocationTimerNode */ = { + isa = PBXNativeTarget; + buildConfigurationList = D0879A8B22F6F91000C4D6B3 /* Build configuration list for PBXNativeTarget "LiveLocationTimerNode" */; + buildPhases = ( + D0879A7E22F6F91000C4D6B3 /* Headers */, + D0879A7F22F6F91000C4D6B3 /* Sources */, + D0879A8022F6F91000C4D6B3 /* Frameworks */, + D0879A8122F6F91000C4D6B3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = LiveLocationTimerNode; + productName = LiveLocationTimerNode; + productReference = D0879A8322F6F91000C4D6B3 /* LiveLocationTimerNode.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + D0879A7A22F6F91000C4D6B3 /* Project object */ = { + isa = PBXProject; + attributes = { + DefaultBuildSystemTypeForWorkspace = Latest; + LastUpgradeCheck = 1030; + ORGANIZATIONNAME = "Telegram Messenger LLP"; + TargetAttributes = { + D0879A8222F6F91000C4D6B3 = { + CreatedOnToolsVersion = 10.3; + LastSwiftMigration = 1030; + }; + }; + }; + buildConfigurationList = D0879A7D22F6F91000C4D6B3 /* Build configuration list for PBXProject "LiveLocationTimerNode_Xcode" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = D0879A7922F6F91000C4D6B3; + productRefGroup = D0879A8422F6F91000C4D6B3 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + D0879A8222F6F91000C4D6B3 /* LiveLocationTimerNode */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + D0879A8122F6F91000C4D6B3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + D0879A7F22F6F91000C4D6B3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879A9322F6FA2300C4D6B3 /* ChatMessageLiveLocationTimerNode.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + D0879A8922F6F91000C4D6B3 /* DebugAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = DebugAppStoreLLC; + }; + D0879A8A22F6F91000C4D6B3 /* ReleaseAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = ReleaseAppStoreLLC; + }; + D0879A8C22F6F91000C4D6B3 /* DebugAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.LiveLocationTimerNode; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = DebugAppStoreLLC; + }; + D0879A8D22F6F91000C4D6B3 /* ReleaseAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.LiveLocationTimerNode; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = ReleaseAppStoreLLC; + }; + D0879A8E22F6F92E00C4D6B3 /* DebugHockeyapp */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = DebugHockeyapp; + }; + D0879A8F22F6F92E00C4D6B3 /* DebugHockeyapp */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.LiveLocationTimerNode; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = DebugHockeyapp; + }; + D0879A9022F6F93B00C4D6B3 /* ReleaseHockeyappInternal */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = ReleaseHockeyappInternal; + }; + D0879A9122F6F93B00C4D6B3 /* ReleaseHockeyappInternal */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.LiveLocationTimerNode; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = ReleaseHockeyappInternal; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + D0879A7D22F6F91000C4D6B3 /* Build configuration list for PBXProject "LiveLocationTimerNode_Xcode" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D0879A8922F6F91000C4D6B3 /* DebugAppStoreLLC */, + D0879A8E22F6F92E00C4D6B3 /* DebugHockeyapp */, + D0879A8A22F6F91000C4D6B3 /* ReleaseAppStoreLLC */, + D0879A9022F6F93B00C4D6B3 /* ReleaseHockeyappInternal */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ReleaseAppStoreLLC; + }; + D0879A8B22F6F91000C4D6B3 /* Build configuration list for PBXNativeTarget "LiveLocationTimerNode" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D0879A8C22F6F91000C4D6B3 /* DebugAppStoreLLC */, + D0879A8F22F6F92E00C4D6B3 /* DebugHockeyapp */, + D0879A8D22F6F91000C4D6B3 /* ReleaseAppStoreLLC */, + D0879A9122F6F93B00C4D6B3 /* ReleaseHockeyappInternal */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ReleaseAppStoreLLC; + }; +/* End XCConfigurationList section */ + }; + rootObject = D0879A7A22F6F91000C4D6B3 /* Project object */; +} diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageLiveLocationTimerNode.swift b/submodules/LiveLocationTimerNode/Sources/ChatMessageLiveLocationTimerNode.swift similarity index 98% rename from submodules/TelegramUI/TelegramUI/ChatMessageLiveLocationTimerNode.swift rename to submodules/LiveLocationTimerNode/Sources/ChatMessageLiveLocationTimerNode.swift index f710ba497a..eb11af5b82 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageLiveLocationTimerNode.swift +++ b/submodules/LiveLocationTimerNode/Sources/ChatMessageLiveLocationTimerNode.swift @@ -37,11 +37,11 @@ private final class RadialTimeoutNodeTimer: NSObject { } } -final class ChatMessageLiveLocationTimerNode: ASDisplayNode { +public final class ChatMessageLiveLocationTimerNode: ASDisplayNode { private var timeoutAndColors: (UIColor, UIColor, UIColor, Double, Double, PresentationStrings)? private var animationTimer: Timer? - override init() { + override public init() { super.init() self.isOpaque = false diff --git a/submodules/LiveLocationTimerNode/Sources/LiveLocationTimerNode.h b/submodules/LiveLocationTimerNode/Sources/LiveLocationTimerNode.h new file mode 100644 index 0000000000..278ea3e891 --- /dev/null +++ b/submodules/LiveLocationTimerNode/Sources/LiveLocationTimerNode.h @@ -0,0 +1,19 @@ +// +// LiveLocationTimerNode.h +// LiveLocationTimerNode +// +// Created by Peter on 8/4/19. +// Copyright © 2019 Telegram Messenger LLP. All rights reserved. +// + +#import + +//! Project version number for LiveLocationTimerNode. +FOUNDATION_EXPORT double LiveLocationTimerNodeVersionNumber; + +//! Project version string for LiveLocationTimerNode. +FOUNDATION_EXPORT const unsigned char LiveLocationTimerNodeVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/submodules/OverlayStatusController/Info.plist b/submodules/OverlayStatusController/Info.plist new file mode 100644 index 0000000000..e1fe4cfb7b --- /dev/null +++ b/submodules/OverlayStatusController/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + + diff --git a/submodules/OverlayStatusController/OverlayStatusController_Xcode.xcodeproj/project.pbxproj b/submodules/OverlayStatusController/OverlayStatusController_Xcode.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..62e14acc52 --- /dev/null +++ b/submodules/OverlayStatusController/OverlayStatusController_Xcode.xcodeproj/project.pbxproj @@ -0,0 +1,559 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + D0879A6022F6F71D00C4D6B3 /* OverlayStatusController.h in Headers */ = {isa = PBXBuildFile; fileRef = D0879A5E22F6F71D00C4D6B3 /* OverlayStatusController.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D0879A6B22F6F80500C4D6B3 /* OverlayStatusController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879A6A22F6F80400C4D6B3 /* OverlayStatusController.swift */; }; + D0879A6E22F6F80F00C4D6B3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A6D22F6F80E00C4D6B3 /* Foundation.framework */; }; + D0879A7022F6F81200C4D6B3 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A6F22F6F81200C4D6B3 /* UIKit.framework */; }; + D0879A7222F6F82400C4D6B3 /* TelegramPresentationData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A7122F6F82400C4D6B3 /* TelegramPresentationData.framework */; }; + D0879A7422F6F82A00C4D6B3 /* LegacyComponents.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A7322F6F82A00C4D6B3 /* LegacyComponents.framework */; }; + D0879A7622F6F83D00C4D6B3 /* Display.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A7522F6F83D00C4D6B3 /* Display.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + D0879A5B22F6F71D00C4D6B3 /* OverlayStatusController.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OverlayStatusController.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879A5E22F6F71D00C4D6B3 /* OverlayStatusController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OverlayStatusController.h; sourceTree = ""; }; + D0879A5F22F6F71D00C4D6B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D0879A6A22F6F80400C4D6B3 /* OverlayStatusController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OverlayStatusController.swift; sourceTree = ""; }; + D0879A6D22F6F80E00C4D6B3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + D0879A6F22F6F81200C4D6B3 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + D0879A7122F6F82400C4D6B3 /* TelegramPresentationData.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramPresentationData.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879A7322F6F82A00C4D6B3 /* LegacyComponents.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = LegacyComponents.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879A7522F6F83D00C4D6B3 /* Display.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Display.framework; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + D0879A5822F6F71D00C4D6B3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879A7622F6F83D00C4D6B3 /* Display.framework in Frameworks */, + D0879A7422F6F82A00C4D6B3 /* LegacyComponents.framework in Frameworks */, + D0879A7222F6F82400C4D6B3 /* TelegramPresentationData.framework in Frameworks */, + D0879A7022F6F81200C4D6B3 /* UIKit.framework in Frameworks */, + D0879A6E22F6F80F00C4D6B3 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + D0879A5122F6F71D00C4D6B3 = { + isa = PBXGroup; + children = ( + D0879A5F22F6F71D00C4D6B3 /* Info.plist */, + D0879A5D22F6F71D00C4D6B3 /* Sources */, + D0879A5C22F6F71D00C4D6B3 /* Products */, + D0879A6C22F6F80E00C4D6B3 /* Frameworks */, + ); + sourceTree = ""; + }; + D0879A5C22F6F71D00C4D6B3 /* Products */ = { + isa = PBXGroup; + children = ( + D0879A5B22F6F71D00C4D6B3 /* OverlayStatusController.framework */, + ); + name = Products; + sourceTree = ""; + }; + D0879A5D22F6F71D00C4D6B3 /* Sources */ = { + isa = PBXGroup; + children = ( + D0879A6A22F6F80400C4D6B3 /* OverlayStatusController.swift */, + D0879A5E22F6F71D00C4D6B3 /* OverlayStatusController.h */, + ); + path = Sources; + sourceTree = ""; + }; + D0879A6C22F6F80E00C4D6B3 /* Frameworks */ = { + isa = PBXGroup; + children = ( + D0879A7522F6F83D00C4D6B3 /* Display.framework */, + D0879A7322F6F82A00C4D6B3 /* LegacyComponents.framework */, + D0879A7122F6F82400C4D6B3 /* TelegramPresentationData.framework */, + D0879A6F22F6F81200C4D6B3 /* UIKit.framework */, + D0879A6D22F6F80E00C4D6B3 /* Foundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + D0879A5622F6F71D00C4D6B3 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879A6022F6F71D00C4D6B3 /* OverlayStatusController.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + D0879A5A22F6F71D00C4D6B3 /* OverlayStatusController */ = { + isa = PBXNativeTarget; + buildConfigurationList = D0879A6322F6F71D00C4D6B3 /* Build configuration list for PBXNativeTarget "OverlayStatusController" */; + buildPhases = ( + D0879A5622F6F71D00C4D6B3 /* Headers */, + D0879A5722F6F71D00C4D6B3 /* Sources */, + D0879A5822F6F71D00C4D6B3 /* Frameworks */, + D0879A5922F6F71D00C4D6B3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = OverlayStatusController; + productName = OverlayStatusController; + productReference = D0879A5B22F6F71D00C4D6B3 /* OverlayStatusController.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + D0879A5222F6F71D00C4D6B3 /* Project object */ = { + isa = PBXProject; + attributes = { + DefaultBuildSystemTypeForWorkspace = Latest; + LastUpgradeCheck = 1030; + ORGANIZATIONNAME = "Telegram Messenger LLP"; + TargetAttributes = { + D0879A5A22F6F71D00C4D6B3 = { + CreatedOnToolsVersion = 10.3; + LastSwiftMigration = 1030; + }; + }; + }; + buildConfigurationList = D0879A5522F6F71D00C4D6B3 /* Build configuration list for PBXProject "OverlayStatusController_Xcode" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = D0879A5122F6F71D00C4D6B3; + productRefGroup = D0879A5C22F6F71D00C4D6B3 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + D0879A5A22F6F71D00C4D6B3 /* OverlayStatusController */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + D0879A5922F6F71D00C4D6B3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + D0879A5722F6F71D00C4D6B3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879A6B22F6F80500C4D6B3 /* OverlayStatusController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + D0879A6122F6F71D00C4D6B3 /* DebugAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = DebugAppStoreLLC; + }; + D0879A6222F6F71D00C4D6B3 /* ReleaseAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = ReleaseAppStoreLLC; + }; + D0879A6422F6F71D00C4D6B3 /* DebugAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.OverlayStatusController; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = DebugAppStoreLLC; + }; + D0879A6522F6F71D00C4D6B3 /* ReleaseAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.OverlayStatusController; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = ReleaseAppStoreLLC; + }; + D0879A6622F6F7A400C4D6B3 /* DebugHockeyapp */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = DebugHockeyapp; + }; + D0879A6722F6F7A400C4D6B3 /* DebugHockeyapp */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.OverlayStatusController; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = DebugHockeyapp; + }; + D0879A6822F6F7AF00C4D6B3 /* ReleaseHockeyappInternal */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = ReleaseHockeyappInternal; + }; + D0879A6922F6F7AF00C4D6B3 /* ReleaseHockeyappInternal */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.OverlayStatusController; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = ReleaseHockeyappInternal; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + D0879A5522F6F71D00C4D6B3 /* Build configuration list for PBXProject "OverlayStatusController_Xcode" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D0879A6122F6F71D00C4D6B3 /* DebugAppStoreLLC */, + D0879A6622F6F7A400C4D6B3 /* DebugHockeyapp */, + D0879A6222F6F71D00C4D6B3 /* ReleaseAppStoreLLC */, + D0879A6822F6F7AF00C4D6B3 /* ReleaseHockeyappInternal */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ReleaseAppStoreLLC; + }; + D0879A6322F6F71D00C4D6B3 /* Build configuration list for PBXNativeTarget "OverlayStatusController" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D0879A6422F6F71D00C4D6B3 /* DebugAppStoreLLC */, + D0879A6722F6F7A400C4D6B3 /* DebugHockeyapp */, + D0879A6522F6F71D00C4D6B3 /* ReleaseAppStoreLLC */, + D0879A6922F6F7AF00C4D6B3 /* ReleaseHockeyappInternal */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ReleaseAppStoreLLC; + }; +/* End XCConfigurationList section */ + }; + rootObject = D0879A5222F6F71D00C4D6B3 /* Project object */; +} diff --git a/submodules/OverlayStatusController/Sources/OverlayStatusController.h b/submodules/OverlayStatusController/Sources/OverlayStatusController.h new file mode 100644 index 0000000000..6662916b18 --- /dev/null +++ b/submodules/OverlayStatusController/Sources/OverlayStatusController.h @@ -0,0 +1,19 @@ +// +// OverlayStatusController.h +// OverlayStatusController +// +// Created by Peter on 8/4/19. +// Copyright © 2019 Telegram Messenger LLP. All rights reserved. +// + +#import + +//! Project version number for OverlayStatusController. +FOUNDATION_EXPORT double OverlayStatusControllerVersionNumber; + +//! Project version string for OverlayStatusController. +FOUNDATION_EXPORT const unsigned char OverlayStatusControllerVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/submodules/TelegramUI/TelegramUI/OverlayStatusController.swift b/submodules/OverlayStatusController/Sources/OverlayStatusController.swift similarity index 93% rename from submodules/TelegramUI/TelegramUI/OverlayStatusController.swift rename to submodules/OverlayStatusController/Sources/OverlayStatusController.swift index 172ac6a3fe..79cbc52e35 100644 --- a/submodules/TelegramUI/TelegramUI/OverlayStatusController.swift +++ b/submodules/OverlayStatusController/Sources/OverlayStatusController.swift @@ -4,7 +4,7 @@ import Display import TelegramPresentationData import LegacyComponents -enum OverlayStatusControllerType { +public enum OverlayStatusControllerType { case loading(cancelled: (() -> Void)?) case success case shieldSuccess(String, Bool) @@ -129,7 +129,7 @@ private final class OverlayStatusControllerNode: ViewControllerTracingNode { } } -final class OverlayStatusController: ViewController { +public final class OverlayStatusController: ViewController { private let theme: PresentationTheme private let strings: PresentationStrings private let type: OverlayStatusControllerType @@ -140,7 +140,7 @@ final class OverlayStatusController: ViewController { return self.displayNode as! OverlayStatusControllerNode } - init(theme: PresentationTheme, strings: PresentationStrings, type: OverlayStatusControllerType) { + public init(theme: PresentationTheme, strings: PresentationStrings, type: OverlayStatusControllerType) { self.theme = theme self.strings = strings self.type = type @@ -154,7 +154,7 @@ final class OverlayStatusController: ViewController { fatalError("init(coder:) has not been implemented") } - override func loadDisplayNode() { + override public func loadDisplayNode() { self.displayNode = OverlayStatusControllerNode(theme: self.theme, strings: self.strings, type: self.type, dismissed: { [weak self] in self?.presentingViewController?.dismiss(animated: false, completion: nil) }) @@ -162,13 +162,13 @@ final class OverlayStatusController: ViewController { self.displayNodeDidLoad() } - override func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) { + override public func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) { super.containerLayoutUpdated(layout, transition: transition) self.controllerNode.containerLayoutUpdated(layout, transition: transition) } - override func viewDidAppear(_ animated: Bool) { + override public func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) if !self.animatedDidAppear { @@ -177,7 +177,7 @@ final class OverlayStatusController: ViewController { } } - func dismiss() { + public func dismiss() { self.controllerNode.dismiss() } } diff --git a/submodules/TelegramBaseController/Info.plist b/submodules/TelegramBaseController/Info.plist new file mode 100644 index 0000000000..e1fe4cfb7b --- /dev/null +++ b/submodules/TelegramBaseController/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + + diff --git a/submodules/TelegramUI/TelegramUI/LocationBroadcastActionSheetItem.swift b/submodules/TelegramBaseController/Sources/LocationBroadcastActionSheetItem.swift similarity index 94% rename from submodules/TelegramUI/TelegramUI/LocationBroadcastActionSheetItem.swift rename to submodules/TelegramBaseController/Sources/LocationBroadcastActionSheetItem.swift index f528d012e1..5d46787ba2 100644 --- a/submodules/TelegramUI/TelegramUI/LocationBroadcastActionSheetItem.swift +++ b/submodules/TelegramBaseController/Sources/LocationBroadcastActionSheetItem.swift @@ -5,9 +5,12 @@ import Display import TelegramCore import Postbox import TelegramPresentationData +import AccountContext +import LiveLocationTimerNode +import AvatarNode public class LocationBroadcastActionSheetItem: ActionSheetItem { - public let context: AccountContextImpl + public let context: AccountContext public let peer: Peer public let title: String public let beginTimestamp: Double @@ -15,7 +18,7 @@ public class LocationBroadcastActionSheetItem: ActionSheetItem { public let strings: PresentationStrings public let action: () -> Void - public init(context: AccountContextImpl, peer: Peer, title: String, beginTimestamp: Double, timeout: Double, strings: PresentationStrings, action: @escaping () -> Void) { + public init(context: AccountContext, peer: Peer, title: String, beginTimestamp: Double, timeout: Double, strings: PresentationStrings, action: @escaping () -> Void) { self.context = context self.peer = peer self.title = title diff --git a/submodules/TelegramUI/TelegramUI/LocationBroadcastNavigationAccessoryPanel.swift b/submodules/TelegramBaseController/Sources/LocationBroadcastNavigationAccessoryPanel.swift similarity index 100% rename from submodules/TelegramUI/TelegramUI/LocationBroadcastNavigationAccessoryPanel.swift rename to submodules/TelegramBaseController/Sources/LocationBroadcastNavigationAccessoryPanel.swift diff --git a/submodules/TelegramUI/TelegramUI/LocationBroadcastPanelWavesNode.swift b/submodules/TelegramBaseController/Sources/LocationBroadcastPanelWavesNode.swift similarity index 100% rename from submodules/TelegramUI/TelegramUI/LocationBroadcastPanelWavesNode.swift rename to submodules/TelegramBaseController/Sources/LocationBroadcastPanelWavesNode.swift diff --git a/submodules/TelegramUI/TelegramUI/MediaNavigationAccessoryContainerNode.swift b/submodules/TelegramBaseController/Sources/MediaNavigationAccessoryContainerNode.swift similarity index 97% rename from submodules/TelegramUI/TelegramUI/MediaNavigationAccessoryContainerNode.swift rename to submodules/TelegramBaseController/Sources/MediaNavigationAccessoryContainerNode.swift index dfa047e50b..1afdbc34b3 100644 --- a/submodules/TelegramUI/TelegramUI/MediaNavigationAccessoryContainerNode.swift +++ b/submodules/TelegramBaseController/Sources/MediaNavigationAccessoryContainerNode.swift @@ -4,6 +4,7 @@ import AsyncDisplayKit import Display import TelegramCore import TelegramPresentationData +import AccountContext final class MediaNavigationAccessoryContainerNode: ASDisplayNode, UIGestureRecognizerDelegate { let backgroundNode: ASDisplayNode @@ -13,7 +14,7 @@ final class MediaNavigationAccessoryContainerNode: ASDisplayNode, UIGestureRecog private var presentationData: PresentationData - init(context: AccountContextImpl) { + init(context: AccountContext) { self.presentationData = context.sharedContext.currentPresentationData.with { $0 } self.backgroundNode = ASDisplayNode() diff --git a/submodules/TelegramUI/TelegramUI/MediaNavigationAccessoryHeaderNode.swift b/submodules/TelegramBaseController/Sources/MediaNavigationAccessoryHeaderNode.swift similarity index 99% rename from submodules/TelegramUI/TelegramUI/MediaNavigationAccessoryHeaderNode.swift rename to submodules/TelegramBaseController/Sources/MediaNavigationAccessoryHeaderNode.swift index 9251ad8115..00f3e3faca 100644 --- a/submodules/TelegramUI/TelegramUI/MediaNavigationAccessoryHeaderNode.swift +++ b/submodules/TelegramBaseController/Sources/MediaNavigationAccessoryHeaderNode.swift @@ -7,6 +7,8 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import UniversalMediaPlayer +import AccountContext +import TelegramStringFormatting private let titleFont = Font.regular(12.0) private let subtitleFont = Font.regular(10.0) diff --git a/submodules/TelegramUI/TelegramUI/MediaNavigationAccessoryPanel.swift b/submodules/TelegramBaseController/Sources/MediaNavigationAccessoryPanel.swift similarity index 98% rename from submodules/TelegramUI/TelegramUI/MediaNavigationAccessoryPanel.swift rename to submodules/TelegramBaseController/Sources/MediaNavigationAccessoryPanel.swift index e136c18632..07c6a01c08 100644 --- a/submodules/TelegramUI/TelegramUI/MediaNavigationAccessoryPanel.swift +++ b/submodules/TelegramBaseController/Sources/MediaNavigationAccessoryPanel.swift @@ -3,6 +3,7 @@ import UIKit import Display import AsyncDisplayKit import TelegramCore +import AccountContext final class MediaNavigationAccessoryPanel: ASDisplayNode { let containerNode: MediaNavigationAccessoryContainerNode @@ -14,7 +15,7 @@ final class MediaNavigationAccessoryPanel: ASDisplayNode { var playPrevious: (() -> Void)? var playNext: (() -> Void)? - init(context: AccountContextImpl) { + init(context: AccountContext) { self.containerNode = MediaNavigationAccessoryContainerNode(context: context) super.init() diff --git a/submodules/TelegramBaseController/Sources/TelegramBaseController.h b/submodules/TelegramBaseController/Sources/TelegramBaseController.h new file mode 100644 index 0000000000..cc52b070ec --- /dev/null +++ b/submodules/TelegramBaseController/Sources/TelegramBaseController.h @@ -0,0 +1,19 @@ +// +// TelegramBaseController.h +// TelegramBaseController +// +// Created by Peter on 8/3/19. +// Copyright © 2019 Telegram Messenger LLP. All rights reserved. +// + +#import + +//! Project version number for TelegramBaseController. +FOUNDATION_EXPORT double TelegramBaseControllerVersionNumber; + +//! Project version string for TelegramBaseController. +FOUNDATION_EXPORT const unsigned char TelegramBaseControllerVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/submodules/TelegramUI/TelegramUI/TelegramController.swift b/submodules/TelegramBaseController/Sources/TelegramBaseController.swift similarity index 91% rename from submodules/TelegramUI/TelegramUI/TelegramController.swift rename to submodules/TelegramBaseController/Sources/TelegramBaseController.swift index c76842d72c..cd66aa00b9 100644 --- a/submodules/TelegramUI/TelegramUI/TelegramController.swift +++ b/submodules/TelegramBaseController/Sources/TelegramBaseController.swift @@ -8,23 +8,25 @@ import Postbox import TelegramPresentationData import TelegramUIPreferences import UniversalMediaPlayer +import AccountContext +import OverlayStatusController -enum MediaAccessoryPanelVisibility { +public enum MediaAccessoryPanelVisibility { case none case specific(size: ContainerViewLayoutSizeClass) case always } -enum LocationBroadcastPanelSource { +public enum LocationBroadcastPanelSource { case none case summary case peer(PeerId) } -private func presentLiveLocationController(context: AccountContextImpl, peerId: PeerId, controller: ViewController) { +private func presentLiveLocationController(context: AccountContext, peerId: PeerId, controller: ViewController) { let presentImpl: (Message?) -> Void = { [weak controller] message in if let message = message, let strongController = controller { - let _ = openChatMessage(context: context, message: message, standalone: false, reverseMessageGalleryOrder: false, navigationController: strongController.navigationController as? NavigationController, modal: true, dismissInput: { + let _ = context.sharedContext.openChatMessage(OpenChatMessageParams(context: context, message: message, standalone: false, reverseMessageGalleryOrder: false, navigationController: strongController.navigationController as? NavigationController, modal: true, dismissInput: { controller?.view.endEditing(true) }, present: { c, a in controller?.present(c, in: .window(.root), with: a, blockInteraction: true) @@ -35,7 +37,10 @@ private func presentLiveLocationController(context: AccountContextImpl, peerId: }, openPeer: { peer, navigation in }, callPeer: { _ in }, enqueueMessage: { _ in - }, sendSticker: nil, setupTemporaryHiddenMedia: { _, _, _ in }, chatAvatarHiddenMedia: { _, _ in}) + }, sendSticker: nil, + setupTemporaryHiddenMedia: { _, _, _ in + }, chatAvatarHiddenMedia: { _, _ in + })) } } if let id = context.liveLocationManager?.internalMessageForPeerId(peerId) { @@ -51,19 +56,19 @@ private func presentLiveLocationController(context: AccountContextImpl, peerId: } } -public class TelegramController: ViewController, KeyShortcutResponder { - private let context: AccountContextImpl +open class TelegramBaseController: ViewController, KeyShortcutResponder { + private let context: AccountContext - let mediaAccessoryPanelVisibility: MediaAccessoryPanelVisibility - let locationBroadcastPanelSource: LocationBroadcastPanelSource + public let mediaAccessoryPanelVisibility: MediaAccessoryPanelVisibility + public let locationBroadcastPanelSource: LocationBroadcastPanelSource private var mediaStatusDisposable: Disposable? private var locationBroadcastDisposable: Disposable? - private(set) var playlistStateAndType: (SharedMediaPlaylistItem, SharedMediaPlaylistItem?, SharedMediaPlaylistItem?, MusicPlaybackSettingsOrder, MediaManagerPlayerType, Account)? + public private(set) var playlistStateAndType: (SharedMediaPlaylistItem, SharedMediaPlaylistItem?, SharedMediaPlaylistItem?, MusicPlaybackSettingsOrder, MediaManagerPlayerType, Account)? - var tempVoicePlaylistEnded: (() -> Void)? - var tempVoicePlaylistItemChanged: ((SharedMediaPlaylistItem?, SharedMediaPlaylistItem?) -> Void)? + public var tempVoicePlaylistEnded: (() -> Void)? + public var tempVoicePlaylistItemChanged: ((SharedMediaPlaylistItem?, SharedMediaPlaylistItem?) -> Void)? private var mediaAccessoryPanel: (MediaNavigationAccessoryPanel, MediaManagerPlayerType)? @@ -78,15 +83,15 @@ public class TelegramController: ViewController, KeyShortcutResponder { private var presentationDataDisposable: Disposable? private var playlistPreloadDisposable: Disposable? - override public var navigationHeight: CGFloat { + override open var navigationHeight: CGFloat { return super.navigationHeight + self.additionalHeight } - override public var navigationInsetHeight: CGFloat { + override open var navigationInsetHeight: CGFloat { return super.navigationInsetHeight + self.additionalHeight } - override public var visualNavigationInsetHeight: CGFloat { + override open var visualNavigationInsetHeight: CGFloat { return super.visualNavigationInsetHeight + self.additionalHeight } @@ -101,11 +106,11 @@ public class TelegramController: ViewController, KeyShortcutResponder { return height } - public var primaryNavigationHeight: CGFloat { + open var primaryNavigationHeight: CGFloat { return super.navigationHeight } - init(context: AccountContextImpl, navigationBarPresentationData: NavigationBarPresentationData?, mediaAccessoryPanelVisibility: MediaAccessoryPanelVisibility, locationBroadcastPanelSource: LocationBroadcastPanelSource) { + public init(context: AccountContext, navigationBarPresentationData: NavigationBarPresentationData?, mediaAccessoryPanelVisibility: MediaAccessoryPanelVisibility, locationBroadcastPanelSource: LocationBroadcastPanelSource) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } self.mediaAccessoryPanelVisibility = mediaAccessoryPanelVisibility @@ -267,7 +272,7 @@ public class TelegramController: ViewController, KeyShortcutResponder { fatalError("init(coder:) has not been implemented") } - public override func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) { + override open func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) { super.containerLayoutUpdated(layout, transition: transition) var navigationHeight = super.navigationHeight @@ -499,7 +504,7 @@ public class TelegramController: ViewController, KeyShortcutResponder { mediaAccessoryPanel.containerNode.headerNode.displayScrubber = type != .voice mediaAccessoryPanel.close = { [weak self] in if let strongSelf = self, let (_, _, _, _, type, _) = strongSelf.playlistStateAndType { - strongSelf.context.sharedContext.mediaManager.setPlaylist(nil, type: type) + strongSelf.context.sharedContext.mediaManager.setPlaylist(nil, type: type, control: SharedMediaPlayerControlAction.playback(.pause)) } } mediaAccessoryPanel.toggleRate = { @@ -550,24 +555,7 @@ public class TelegramController: ViewController, KeyShortcutResponder { } if let id = state.id as? PeerMessagesMediaPlaylistItemId { if type == .music { - let historyView = preloadedChatHistoryViewForLocation(ChatHistoryLocationInput(content: .InitialSearch(location: .id(id.messageId), count: 60), id: 0), account: account, chatLocation: .peer(id.messageId.peerId), fixedCombinedReadStates: nil, tagMask: MessageTags.music, additionalData: []) - let signal = historyView - |> mapToSignal { historyView -> Signal<(MessageIndex?, Bool), NoError> in - switch historyView { - case .Loading: - return .single((nil, true)) - case let .HistoryView(view, _, _, _, _, _, _): - for entry in view.entries { - if entry.message.id == id.messageId { - return .single((entry.message.index, false)) - } - } - return .single((nil, false)) - } - } - |> take(until: { index in - return SignalTakeAction(passthrough: true, complete: !index.1) - }) + let signal = strongSelf.context.sharedContext.messageFromPreloadedChatHistoryViewForLocation(id: id.messageId, location: ChatHistoryLocationInput(content: .InitialSearch(location: .id(id.messageId), count: 60), id: 0), account: account, chatLocation: .peer(id.messageId.peerId), tagMask: MessageTags.music) var cancelImpl: (() -> Void)? let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 } @@ -598,7 +586,13 @@ public class TelegramController: ViewController, KeyShortcutResponder { return } if let _ = index.0 { - let controller = OverlayPlayerController(context: account.id == strongSelf.context.account.id ? strongSelf.context : AccountContextImpl(sharedContext: strongSelf.context.sharedContext, account: account, limitsConfiguration: .defaultValue), peerId: id.messageId.peerId, type: type, initialMessageId: id.messageId, initialOrder: order, parentNavigationController: strongSelf.navigationController as? NavigationController) + let controllerContext: AccountContext + if account.id == strongSelf.context.account.id { + controllerContext = strongSelf.context + } else { + controllerContext = strongSelf.context.sharedContext.makeTempAccountContext(account: account) + } + let controller = strongSelf.context.sharedContext.makeOverlayAudioPlayerController(context: controllerContext, peerId: id.messageId.peerId, type: type, initialMessageId: id.messageId, initialOrder: order, parentNavigationController: strongSelf.navigationController as? NavigationController) strongSelf.displayNode.view.window?.endEditing(true) strongSelf.present(controller, in: .window(.root)) } else if index.1 { @@ -657,7 +651,7 @@ public class TelegramController: ViewController, KeyShortcutResponder { } } - public var keyShortcuts: [KeyShortcut] { + open var keyShortcuts: [KeyShortcut] { return [KeyShortcut(input: UIKeyCommand.inputEscape, action: { [weak self] in if !(self?.navigationController?.topViewController is TabBarController) { _ = self?.navigationBar?.executeBack() diff --git a/submodules/TelegramBaseController/TelegramBaseController_Xcode.xcodeproj/project.pbxproj b/submodules/TelegramBaseController/TelegramBaseController_Xcode.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..dbce9c6f72 --- /dev/null +++ b/submodules/TelegramBaseController/TelegramBaseController_Xcode.xcodeproj/project.pbxproj @@ -0,0 +1,609 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + D08799DB22F648D100C4D6B3 /* MediaNavigationAccessoryHeaderNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08799D422F648D000C4D6B3 /* MediaNavigationAccessoryHeaderNode.swift */; }; + D08799DC22F648D100C4D6B3 /* LocationBroadcastNavigationAccessoryPanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08799D522F648D100C4D6B3 /* LocationBroadcastNavigationAccessoryPanel.swift */; }; + D08799DD22F648D100C4D6B3 /* TelegramBaseController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08799D622F648D100C4D6B3 /* TelegramBaseController.swift */; }; + D08799DE22F648D100C4D6B3 /* MediaNavigationAccessoryContainerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08799D722F648D100C4D6B3 /* MediaNavigationAccessoryContainerNode.swift */; }; + D08799DF22F648D100C4D6B3 /* LocationBroadcastPanelWavesNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08799D822F648D100C4D6B3 /* LocationBroadcastPanelWavesNode.swift */; }; + D08799E022F648D100C4D6B3 /* LocationBroadcastActionSheetItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08799D922F648D100C4D6B3 /* LocationBroadcastActionSheetItem.swift */; }; + D08799E122F648D100C4D6B3 /* MediaNavigationAccessoryPanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08799DA22F648D100C4D6B3 /* MediaNavigationAccessoryPanel.swift */; }; + D08799E422F6490D00C4D6B3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D08799E322F6490D00C4D6B3 /* Foundation.framework */; }; + D08799E622F6491200C4D6B3 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D08799E522F6491200C4D6B3 /* UIKit.framework */; }; + D08799E822F6496B00C4D6B3 /* AccountContext.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D08799E722F6496B00C4D6B3 /* AccountContext.framework */; }; + D08799EA22F6497000C4D6B3 /* Postbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D08799E922F6497000C4D6B3 /* Postbox.framework */; }; + D08799EC22F6499000C4D6B3 /* TelegramCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D08799EB22F6499000C4D6B3 /* TelegramCore.framework */; }; + D08799EE22F6499800C4D6B3 /* SwiftSignalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D08799ED22F6499800C4D6B3 /* SwiftSignalKit.framework */; }; + D0879A4222F6503C00C4D6B3 /* LiveLocationManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A4122F6503C00C4D6B3 /* LiveLocationManager.framework */; }; + D0879A7822F6F84A00C4D6B3 /* OverlayStatusController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A7722F6F84A00C4D6B3 /* OverlayStatusController.framework */; }; + D0879AA022F6FAAF00C4D6B3 /* LiveLocationTimerNode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A9F22F6FAAF00C4D6B3 /* LiveLocationTimerNode.framework */; }; + D0879AC822F7061100C4D6B3 /* TelegramStringFormatting.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879AC722F7061100C4D6B3 /* TelegramStringFormatting.framework */; }; + D0879B1122F708A600C4D6B3 /* AvatarNode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B1022F708A600C4D6B3 /* AvatarNode.framework */; }; + D0FBC81522F61F8F00DB1A7A /* TelegramBaseController.h in Headers */ = {isa = PBXBuildFile; fileRef = D0FBC81322F61F8F00DB1A7A /* TelegramBaseController.h */; settings = {ATTRIBUTES = (Public, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + D08799D422F648D000C4D6B3 /* MediaNavigationAccessoryHeaderNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaNavigationAccessoryHeaderNode.swift; sourceTree = ""; }; + D08799D522F648D100C4D6B3 /* LocationBroadcastNavigationAccessoryPanel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocationBroadcastNavigationAccessoryPanel.swift; sourceTree = ""; }; + D08799D622F648D100C4D6B3 /* TelegramBaseController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TelegramBaseController.swift; sourceTree = ""; }; + D08799D722F648D100C4D6B3 /* MediaNavigationAccessoryContainerNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaNavigationAccessoryContainerNode.swift; sourceTree = ""; }; + D08799D822F648D100C4D6B3 /* LocationBroadcastPanelWavesNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocationBroadcastPanelWavesNode.swift; sourceTree = ""; }; + D08799D922F648D100C4D6B3 /* LocationBroadcastActionSheetItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocationBroadcastActionSheetItem.swift; sourceTree = ""; }; + D08799DA22F648D100C4D6B3 /* MediaNavigationAccessoryPanel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaNavigationAccessoryPanel.swift; sourceTree = ""; }; + D08799E322F6490D00C4D6B3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + D08799E522F6491200C4D6B3 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + D08799E722F6496B00C4D6B3 /* AccountContext.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = AccountContext.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D08799E922F6497000C4D6B3 /* Postbox.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Postbox.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D08799EB22F6499000C4D6B3 /* TelegramCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D08799ED22F6499800C4D6B3 /* SwiftSignalKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SwiftSignalKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879A1722F64EE700C4D6B3 /* DeviceLocationManager.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = DeviceLocationManager.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879A4122F6503C00C4D6B3 /* LiveLocationManager.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = LiveLocationManager.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879A7722F6F84A00C4D6B3 /* OverlayStatusController.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = OverlayStatusController.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879A9F22F6FAAF00C4D6B3 /* LiveLocationTimerNode.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = LiveLocationTimerNode.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879AC722F7061100C4D6B3 /* TelegramStringFormatting.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramStringFormatting.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B1022F708A600C4D6B3 /* AvatarNode.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = AvatarNode.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0FBC81022F61F8F00DB1A7A /* TelegramBaseController.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TelegramBaseController.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0FBC81322F61F8F00DB1A7A /* TelegramBaseController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TelegramBaseController.h; sourceTree = ""; }; + D0FBC81422F61F8F00DB1A7A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + D0FBC80D22F61F8F00DB1A7A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879B1122F708A600C4D6B3 /* AvatarNode.framework in Frameworks */, + D0879AC822F7061100C4D6B3 /* TelegramStringFormatting.framework in Frameworks */, + D0879AA022F6FAAF00C4D6B3 /* LiveLocationTimerNode.framework in Frameworks */, + D0879A7822F6F84A00C4D6B3 /* OverlayStatusController.framework in Frameworks */, + D0879A4222F6503C00C4D6B3 /* LiveLocationManager.framework in Frameworks */, + D08799EE22F6499800C4D6B3 /* SwiftSignalKit.framework in Frameworks */, + D08799EC22F6499000C4D6B3 /* TelegramCore.framework in Frameworks */, + D08799EA22F6497000C4D6B3 /* Postbox.framework in Frameworks */, + D08799E822F6496B00C4D6B3 /* AccountContext.framework in Frameworks */, + D08799E622F6491200C4D6B3 /* UIKit.framework in Frameworks */, + D08799E422F6490D00C4D6B3 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + D08799E222F6490D00C4D6B3 /* Frameworks */ = { + isa = PBXGroup; + children = ( + D0879B1022F708A600C4D6B3 /* AvatarNode.framework */, + D0879AC722F7061100C4D6B3 /* TelegramStringFormatting.framework */, + D0879A9F22F6FAAF00C4D6B3 /* LiveLocationTimerNode.framework */, + D0879A7722F6F84A00C4D6B3 /* OverlayStatusController.framework */, + D0879A4122F6503C00C4D6B3 /* LiveLocationManager.framework */, + D0879A1722F64EE700C4D6B3 /* DeviceLocationManager.framework */, + D08799ED22F6499800C4D6B3 /* SwiftSignalKit.framework */, + D08799EB22F6499000C4D6B3 /* TelegramCore.framework */, + D08799E922F6497000C4D6B3 /* Postbox.framework */, + D08799E722F6496B00C4D6B3 /* AccountContext.framework */, + D08799E522F6491200C4D6B3 /* UIKit.framework */, + D08799E322F6490D00C4D6B3 /* Foundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + D0FBC80622F61F8F00DB1A7A = { + isa = PBXGroup; + children = ( + D0FBC81422F61F8F00DB1A7A /* Info.plist */, + D0FBC81222F61F8F00DB1A7A /* Sources */, + D0FBC81122F61F8F00DB1A7A /* Products */, + D08799E222F6490D00C4D6B3 /* Frameworks */, + ); + sourceTree = ""; + }; + D0FBC81122F61F8F00DB1A7A /* Products */ = { + isa = PBXGroup; + children = ( + D0FBC81022F61F8F00DB1A7A /* TelegramBaseController.framework */, + ); + name = Products; + sourceTree = ""; + }; + D0FBC81222F61F8F00DB1A7A /* Sources */ = { + isa = PBXGroup; + children = ( + D08799D922F648D100C4D6B3 /* LocationBroadcastActionSheetItem.swift */, + D08799D522F648D100C4D6B3 /* LocationBroadcastNavigationAccessoryPanel.swift */, + D08799D822F648D100C4D6B3 /* LocationBroadcastPanelWavesNode.swift */, + D08799D722F648D100C4D6B3 /* MediaNavigationAccessoryContainerNode.swift */, + D08799D422F648D000C4D6B3 /* MediaNavigationAccessoryHeaderNode.swift */, + D08799DA22F648D100C4D6B3 /* MediaNavigationAccessoryPanel.swift */, + D08799D622F648D100C4D6B3 /* TelegramBaseController.swift */, + D0FBC81322F61F8F00DB1A7A /* TelegramBaseController.h */, + ); + path = Sources; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + D0FBC80B22F61F8F00DB1A7A /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D0FBC81522F61F8F00DB1A7A /* TelegramBaseController.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + D0FBC80F22F61F8F00DB1A7A /* TelegramBaseController */ = { + isa = PBXNativeTarget; + buildConfigurationList = D0FBC81822F61F8F00DB1A7A /* Build configuration list for PBXNativeTarget "TelegramBaseController" */; + buildPhases = ( + D0FBC80B22F61F8F00DB1A7A /* Headers */, + D0FBC80C22F61F8F00DB1A7A /* Sources */, + D0FBC80D22F61F8F00DB1A7A /* Frameworks */, + D0FBC80E22F61F8F00DB1A7A /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = TelegramBaseController; + productName = TelegramBaseController; + productReference = D0FBC81022F61F8F00DB1A7A /* TelegramBaseController.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + D0FBC80722F61F8F00DB1A7A /* Project object */ = { + isa = PBXProject; + attributes = { + DefaultBuildSystemTypeForWorkspace = Latest; + LastUpgradeCheck = 1030; + ORGANIZATIONNAME = "Telegram Messenger LLP"; + TargetAttributes = { + D0FBC80F22F61F8F00DB1A7A = { + CreatedOnToolsVersion = 10.3; + LastSwiftMigration = 1030; + }; + }; + }; + buildConfigurationList = D0FBC80A22F61F8F00DB1A7A /* Build configuration list for PBXProject "TelegramBaseController_Xcode" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = D0FBC80622F61F8F00DB1A7A; + productRefGroup = D0FBC81122F61F8F00DB1A7A /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + D0FBC80F22F61F8F00DB1A7A /* TelegramBaseController */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + D0FBC80E22F61F8F00DB1A7A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + D0FBC80C22F61F8F00DB1A7A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D08799E122F648D100C4D6B3 /* MediaNavigationAccessoryPanel.swift in Sources */, + D08799DF22F648D100C4D6B3 /* LocationBroadcastPanelWavesNode.swift in Sources */, + D08799DD22F648D100C4D6B3 /* TelegramBaseController.swift in Sources */, + D08799DC22F648D100C4D6B3 /* LocationBroadcastNavigationAccessoryPanel.swift in Sources */, + D08799E022F648D100C4D6B3 /* LocationBroadcastActionSheetItem.swift in Sources */, + D08799DB22F648D100C4D6B3 /* MediaNavigationAccessoryHeaderNode.swift in Sources */, + D08799DE22F648D100C4D6B3 /* MediaNavigationAccessoryContainerNode.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + D0FBC81622F61F8F00DB1A7A /* DebugAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = DebugAppStoreLLC; + }; + D0FBC81722F61F8F00DB1A7A /* ReleaseAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = ReleaseAppStoreLLC; + }; + D0FBC81922F61F8F00DB1A7A /* DebugAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TelegramBaseController; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = DebugAppStoreLLC; + }; + D0FBC81A22F61F8F00DB1A7A /* ReleaseAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TelegramBaseController; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = ReleaseAppStoreLLC; + }; + D0FBC81B22F61FCB00DB1A7A /* ReleaseHockeyappInternal */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = ReleaseHockeyappInternal; + }; + D0FBC81C22F61FCB00DB1A7A /* ReleaseHockeyappInternal */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TelegramBaseController; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = ReleaseHockeyappInternal; + }; + D0FBC81D22F61FCE00DB1A7A /* DebugHockeyapp */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = DebugHockeyapp; + }; + D0FBC81E22F61FCE00DB1A7A /* DebugHockeyapp */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TelegramBaseController; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = DebugHockeyapp; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + D0FBC80A22F61F8F00DB1A7A /* Build configuration list for PBXProject "TelegramBaseController_Xcode" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D0FBC81622F61F8F00DB1A7A /* DebugAppStoreLLC */, + D0FBC81D22F61FCE00DB1A7A /* DebugHockeyapp */, + D0FBC81722F61F8F00DB1A7A /* ReleaseAppStoreLLC */, + D0FBC81B22F61FCB00DB1A7A /* ReleaseHockeyappInternal */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ReleaseAppStoreLLC; + }; + D0FBC81822F61F8F00DB1A7A /* Build configuration list for PBXNativeTarget "TelegramBaseController" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D0FBC81922F61F8F00DB1A7A /* DebugAppStoreLLC */, + D0FBC81E22F61FCE00DB1A7A /* DebugHockeyapp */, + D0FBC81A22F61F8F00DB1A7A /* ReleaseAppStoreLLC */, + D0FBC81C22F61FCB00DB1A7A /* ReleaseHockeyappInternal */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ReleaseAppStoreLLC; + }; +/* End XCConfigurationList section */ + }; + rootObject = D0FBC80722F61F8F00DB1A7A /* Project object */; +} diff --git a/submodules/TelegramCallsUI/Sources/PresentationCall.swift b/submodules/TelegramCallsUI/Sources/PresentationCall.swift index d2da2030b7..e2dc012cf2 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationCall.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationCall.swift @@ -10,16 +10,7 @@ import TelegramUIPreferences import TelegramPresentationData import DeviceAccess import UniversalMediaPlayer - -public enum PresentationCallState: Equatable { - case waiting - case ringing - case requesting(Bool) - case connecting(Data?) - case active(Double, Int32?, Data) - case terminating - case terminated(CallId?, CallSessionTerminationReason?, Bool) -} +import AccountContext private final class PresentationCallToneRenderer { let queue: Queue @@ -159,7 +150,7 @@ private final class PresentationCallToneRenderer { } } -public final class PresentationCall { +public final class PresentationCallImpl: PresentationCall { public let account: Account private let audioSession: ManagedAudioSession private let callSessionManager: CallSessionManager @@ -208,7 +199,7 @@ public final class PresentationCall { private let canBeRemovedPromise = Promise(false) private var didSetCanBeRemoved = false - var canBeRemoved: Signal { + public var canBeRemoved: Signal { return self.canBeRemovedPromise.get() } diff --git a/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift b/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift index e9e19294e1..0834ce2425 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift @@ -3,12 +3,12 @@ import Postbox import TelegramCore import SwiftSignalKit import Display - import DeviceAccess import TelegramPresentationData import TelegramAudio import TelegramVoip import TelegramUIPreferences +import AccountContext private func callKitIntegrationIfEnabled(_ integration: CallKitIntegration?, settings: VoiceCallSettings?) -> CallKitIntegration? { let enabled = settings?.enableSystemIntegration ?? true @@ -32,19 +32,14 @@ private enum CurrentCall { } } -public enum RequestCallResult { - case requested - case alreadyInProgress(PeerId) -} - -public final class PresentationCallManager { +public final class PresentationCallManagerImpl: PresentationCallManager { private let getDeviceAccessData: () -> (presentationData: PresentationData, present: (ViewController, Any?) -> Void, openSettings: () -> Void) private let accountManager: AccountManager private let audioSession: ManagedAudioSession private let callKitIntegration: CallKitIntegration? - private var currentCall: PresentationCall? + private var currentCall: PresentationCallImpl? private var currentCallDisposable = MetaDisposable() private let removeCurrentCallDisposable = MetaDisposable() @@ -240,7 +235,7 @@ public final class PresentationCallManager { let derivedState = preferences.values[ApplicationSpecificPreferencesKeys.voipDerivedState] as? VoipDerivedState ?? .default let autodownloadSettings = sharedData.entries[SharedDataKeys.autodownloadSettings] as? AutodownloadSettings ?? .defaultSettings - let call = PresentationCall(account: firstState.0, audioSession: strongSelf.audioSession, callSessionManager: firstState.0.callSessionManager, callKitIntegration: enableCallKit ? callKitIntegrationIfEnabled(strongSelf.callKitIntegration, settings: strongSelf.callSettings) : nil, serializedData: configuration.serializedData, dataSaving: effectiveDataSaving(for: strongSelf.callSettings, autodownloadSettings: autodownloadSettings), derivedState: derivedState, getDeviceAccessData: strongSelf.getDeviceAccessData, internalId: firstState.2.id, peerId: firstState.2.peerId, isOutgoing: false, peer: firstState.1, proxyServer: strongSelf.proxyServer, currentNetworkType: firstState.4, updatedNetworkType: firstState.0.networkType) + let call = PresentationCallImpl(account: firstState.0, audioSession: strongSelf.audioSession, callSessionManager: firstState.0.callSessionManager, callKitIntegration: enableCallKit ? callKitIntegrationIfEnabled(strongSelf.callKitIntegration, settings: strongSelf.callSettings) : nil, serializedData: configuration.serializedData, dataSaving: effectiveDataSaving(for: strongSelf.callSettings, autodownloadSettings: autodownloadSettings), derivedState: derivedState, getDeviceAccessData: strongSelf.getDeviceAccessData, internalId: firstState.2.id, peerId: firstState.2.peerId, isOutgoing: false, peer: firstState.1, proxyServer: strongSelf.proxyServer, currentNetworkType: firstState.4, updatedNetworkType: firstState.0.networkType) strongSelf.currentCall = call strongSelf.currentCallPromise.set(.single(call)) strongSelf.hasActiveCallsPromise.set(true) @@ -370,7 +365,7 @@ public final class PresentationCallManager { let derivedState = preferences.values[ApplicationSpecificPreferencesKeys.voipDerivedState] as? VoipDerivedState ?? .default let autodownloadSettings = sharedData.entries[SharedDataKeys.autodownloadSettings] as? AutodownloadSettings ?? .defaultSettings - let call = PresentationCall(account: account, audioSession: strongSelf.audioSession, callSessionManager: account.callSessionManager, callKitIntegration: callKitIntegrationIfEnabled(strongSelf.callKitIntegration, settings: strongSelf.callSettings), serializedData: configuration.serializedData, dataSaving: effectiveDataSaving(for: strongSelf.callSettings, autodownloadSettings: autodownloadSettings), derivedState: derivedState, getDeviceAccessData: strongSelf.getDeviceAccessData, internalId: internalId, peerId: peerId, isOutgoing: true, peer: nil, proxyServer: strongSelf.proxyServer, currentNetworkType: currentNetworkType, updatedNetworkType: account.networkType) + let call = PresentationCallImpl(account: account, audioSession: strongSelf.audioSession, callSessionManager: account.callSessionManager, callKitIntegration: callKitIntegrationIfEnabled(strongSelf.callKitIntegration, settings: strongSelf.callSettings), serializedData: configuration.serializedData, dataSaving: effectiveDataSaving(for: strongSelf.callSettings, autodownloadSettings: autodownloadSettings), derivedState: derivedState, getDeviceAccessData: strongSelf.getDeviceAccessData, internalId: internalId, peerId: peerId, isOutgoing: true, peer: nil, proxyServer: strongSelf.proxyServer, currentNetworkType: currentNetworkType, updatedNetworkType: account.networkType) strongSelf.currentCall = call strongSelf.currentCallPromise.set(.single(call)) strongSelf.hasActiveCallsPromise.set(true) diff --git a/submodules/TelegramStringFormatting/Info.plist b/submodules/TelegramStringFormatting/Info.plist new file mode 100644 index 0000000000..e1fe4cfb7b --- /dev/null +++ b/submodules/TelegramStringFormatting/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + + diff --git a/submodules/TelegramStringFormatting/Sources/DateFormat.swift b/submodules/TelegramStringFormatting/Sources/DateFormat.swift new file mode 100644 index 0000000000..2dd50a37ab --- /dev/null +++ b/submodules/TelegramStringFormatting/Sources/DateFormat.swift @@ -0,0 +1,111 @@ +import Foundation +import TelegramPresentationData +import TelegramUIPreferences + +public func stringForShortTimestamp(hours: Int32, minutes: Int32, dateTimeFormat: PresentationDateTimeFormat) -> String { + switch dateTimeFormat.timeFormat { + case .regular: + let hourString: String + if hours == 0 { + hourString = "12" + } else if hours > 12 { + hourString = "\(hours - 12)" + } else { + hourString = "\(hours)" + } + + let periodString: String + if hours >= 12 { + periodString = "PM" + } else { + periodString = "AM" + } + if minutes >= 10 { + return "\(hourString):\(minutes) \(periodString)" + } else { + return "\(hourString):0\(minutes) \(periodString)" + } + case .military: + return String(format: "%02d:%02d", arguments: [Int(hours), Int(minutes)]) + } +} + +public func stringForMessageTimestamp(timestamp: Int32, dateTimeFormat: PresentationDateTimeFormat, local: Bool = true) -> String { + var t = Int(timestamp) + var timeinfo = tm() + if local { + localtime_r(&t, &timeinfo) + } else { + gmtime_r(&t, &timeinfo) + } + + return stringForShortTimestamp(hours: timeinfo.tm_hour, minutes: timeinfo.tm_min, dateTimeFormat: dateTimeFormat) +} + +public func stringForFullDate(timestamp: Int32, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat) -> String { + var t: time_t = Int(timestamp) + var timeinfo = tm() + localtime_r(&t, &timeinfo); + + switch timeinfo.tm_mon + 1 { + case 1: + return strings.Time_PreciseDate_m1("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 + case 2: + return strings.Time_PreciseDate_m2("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 + case 3: + return strings.Time_PreciseDate_m3("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 + case 4: + return strings.Time_PreciseDate_m4("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 + case 5: + return strings.Time_PreciseDate_m5("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 + case 6: + return strings.Time_PreciseDate_m6("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 + case 7: + return strings.Time_PreciseDate_m7("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 + case 8: + return strings.Time_PreciseDate_m8("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 + case 9: + return strings.Time_PreciseDate_m9("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 + case 10: + return strings.Time_PreciseDate_m10("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 + case 11: + return strings.Time_PreciseDate_m11("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 + case 12: + return strings.Time_PreciseDate_m12("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 + default: + return "" + } +} + +public func stringForDate(timestamp: Int32, strings: PresentationStrings) -> String { + let formatter = DateFormatter() + formatter.timeStyle = .none + formatter.dateStyle = .medium + formatter.timeZone = TimeZone(secondsFromGMT: 0) + formatter.locale = localeWithStrings(strings) + return formatter.string(from: Date(timeIntervalSince1970: Double(timestamp))) +} + +public func stringForDateWithoutYear(date: Date, strings: PresentationStrings) -> String { + let formatter = DateFormatter() + formatter.timeStyle = .none + formatter.timeZone = TimeZone(secondsFromGMT: 0) + formatter.locale = localeWithStrings(strings) + formatter.setLocalizedDateFormatFromTemplate("MMMMd") + return formatter.string(from: date) +} + +public func roundDateToDays(_ timestamp: Int32) -> Int32 { + var calendar = Calendar(identifier: .gregorian) + calendar.timeZone = TimeZone(secondsFromGMT: 0)! + var components = calendar.dateComponents(Set([.era, .year, .month, .day]), from: Date(timeIntervalSince1970: Double(timestamp))) + components.hour = 0 + components.minute = 0 + components.second = 0 + + guard let date = calendar.date(from: components) else { + assertionFailure() + return timestamp + } + return Int32(date.timeIntervalSince1970) +} diff --git a/submodules/TelegramUI/TelegramUI/Locale.swift b/submodules/TelegramStringFormatting/Sources/Locale.swift similarity index 76% rename from submodules/TelegramUI/TelegramUI/Locale.swift rename to submodules/TelegramStringFormatting/Sources/Locale.swift index c8d6425612..468bd87bfc 100644 --- a/submodules/TelegramUI/TelegramUI/Locale.swift +++ b/submodules/TelegramStringFormatting/Sources/Locale.swift @@ -10,9 +10,9 @@ private let systemLocaleRegionSuffix: String = { } }() -let usEnglishLocale = Locale(identifier: "en_US") +public let usEnglishLocale = Locale(identifier: "en_US") -func localeWithStrings(_ strings: PresentationStrings) -> Locale { +public func localeWithStrings(_ strings: PresentationStrings) -> Locale { let languageCode = strings.baseLanguageCode let code = languageCode + systemLocaleRegionSuffix return Locale(identifier: code) diff --git a/submodules/TelegramStringFormatting/Sources/PresenceStrings.swift b/submodules/TelegramStringFormatting/Sources/PresenceStrings.swift new file mode 100644 index 0000000000..5a3b88568c --- /dev/null +++ b/submodules/TelegramStringFormatting/Sources/PresenceStrings.swift @@ -0,0 +1,404 @@ +import Foundation +import Postbox +import TelegramCore +import TelegramPresentationData + +public func stringForTimestamp(day: Int32, month: Int32, year: Int32, dateTimeFormat: PresentationDateTimeFormat) -> String { + let separator = dateTimeFormat.dateSeparator + switch dateTimeFormat.dateFormat { + case .monthFirst: + return String(format: "%d%@%d%@%02d", month, separator, day, separator, year - 100) + case .dayFirst: + return String(format: "%d%@%02d%@%02d", day, separator, month, separator, year - 100) + } +} + +public func stringForTimestamp(day: Int32, month: Int32, dateTimeFormat: PresentationDateTimeFormat) -> String { + let separator = dateTimeFormat.dateSeparator + switch dateTimeFormat.dateFormat { + case .monthFirst: + return String(format: "%d%@%d", month, separator, day) + case .dayFirst: + return String(format: "%d%@%02d", day, separator, month) + } +} + +public func shortStringForDayOfWeek(strings: PresentationStrings, day: Int32) -> String { + switch day { + case 0: + return strings.Weekday_ShortSunday + case 1: + return strings.Weekday_ShortMonday + case 2: + return strings.Weekday_ShortTuesday + case 3: + return strings.Weekday_ShortWednesday + case 4: + return strings.Weekday_ShortThursday + case 5: + return strings.Weekday_ShortFriday + case 6: + return strings.Weekday_ShortSaturday + default: + return "" + } +} + +public func stringForMonth(strings: PresentationStrings, month: Int32) -> String { + switch month { + case 0: + return strings.Month_GenJanuary + case 1: + return strings.Month_GenFebruary + case 2: + return strings.Month_GenMarch + case 3: + return strings.Month_GenApril + case 4: + return strings.Month_GenMay + case 5: + return strings.Month_GenJune + case 6: + return strings.Month_GenJuly + case 7: + return strings.Month_GenAugust + case 8: + return strings.Month_GenSeptember + case 9: + return strings.Month_GenOctober + case 10: + return strings.Month_GenNovember + case 11: + return strings.Month_GenDecember + default: + return "" + } +} + +public func stringForMonth(strings: PresentationStrings, month: Int32, ofYear year: Int32) -> String { + let yearString = "\(1900 + year)" + switch month { + case 0: + return strings.Time_MonthOfYear_m1(yearString).0 + case 1: + return strings.Time_MonthOfYear_m2(yearString).0 + case 2: + return strings.Time_MonthOfYear_m3(yearString).0 + case 3: + return strings.Time_MonthOfYear_m4(yearString).0 + case 4: + return strings.Time_MonthOfYear_m5(yearString).0 + case 5: + return strings.Time_MonthOfYear_m6(yearString).0 + case 6: + return strings.Time_MonthOfYear_m7(yearString).0 + case 7: + return strings.Time_MonthOfYear_m8(yearString).0 + case 8: + return strings.Time_MonthOfYear_m9(yearString).0 + case 9: + return strings.Time_MonthOfYear_m10(yearString).0 + case 10: + return strings.Time_MonthOfYear_m11(yearString).0 + default: + return strings.Time_MonthOfYear_m12(yearString).0 + } +} + +public enum RelativeTimestampFormatDay { + case today + case yesterday +} + +public func stringForUserPresence(strings: PresentationStrings, day: RelativeTimestampFormatDay, dateTimeFormat: PresentationDateTimeFormat, hours: Int32, minutes: Int32) -> String { + let dayString: String + switch day { + case .today: + dayString = strings.LastSeen_AtDate(strings.Time_TodayAt(stringForShortTimestamp(hours: hours, minutes: minutes, dateTimeFormat: dateTimeFormat)).0).0 + case .yesterday: + dayString = strings.LastSeen_YesterdayAt(stringForShortTimestamp(hours: hours, minutes: minutes, dateTimeFormat: dateTimeFormat)).0 + } + return dayString +} + +private func humanReadableStringForTimestamp(strings: PresentationStrings, day: RelativeTimestampFormatDay, dateTimeFormat: PresentationDateTimeFormat, hours: Int32, minutes: Int32) -> String { + let dayString: String + switch day { + case .today: + dayString = strings.Time_TodayAt(stringForShortTimestamp(hours: hours, minutes: minutes, dateTimeFormat: dateTimeFormat)).0 + case .yesterday: + dayString = strings.Time_YesterdayAt(stringForShortTimestamp(hours: hours, minutes: minutes, dateTimeFormat: dateTimeFormat)).0 + } + return dayString +} + +public func humanReadableStringForTimestamp(strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, timestamp: Int32) -> String { + var t: time_t = time_t(timestamp) + var timeinfo: tm = tm() + localtime_r(&t, &timeinfo) + + let timestampNow = Int32(CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970) + var now: time_t = time_t(timestampNow) + var timeinfoNow: tm = tm() + localtime_r(&now, &timeinfoNow) + + if timeinfo.tm_year != timeinfoNow.tm_year { + return "\(stringForTimestamp(day: timeinfo.tm_mday, month: timeinfo.tm_mon + 1, year: timeinfo.tm_year, dateTimeFormat: dateTimeFormat))" + } + + let dayDifference = timeinfo.tm_yday - timeinfoNow.tm_yday + if dayDifference == 0 || dayDifference == -1 { + let day: RelativeTimestampFormatDay + if dayDifference == 0 { + day = .today + } else { + day = .yesterday + } + return humanReadableStringForTimestamp(strings: strings, day: day, dateTimeFormat: dateTimeFormat, hours: timeinfo.tm_hour, minutes: timeinfo.tm_min) + } else { + return "\(stringForTimestamp(day: timeinfo.tm_mday, month: timeinfo.tm_mon + 1, year: timeinfo.tm_year, dateTimeFormat: dateTimeFormat))" + } +} + +public enum RelativeUserPresenceLastSeen { + case justNow + case minutesAgo(Int32) + case hoursAgo(Int32) + case todayAt(hours: Int32, minutes: Int32) + case yesterdayAt(hours: Int32, minutes: Int32) + case thisYear(month: Int32, day: Int32) + case atDate(year: Int32, month: Int32) +} + +public enum RelativeUserPresenceStatus { + case offline + case online(at: Int32) + case lastSeen(at: Int32) + case recently + case lastWeek + case lastMonth +} + +public func relativeUserPresenceStatus(_ presence: TelegramUserPresence, relativeTo timestamp: Int32) -> RelativeUserPresenceStatus { + switch presence.status { + case .none: + return .offline + case let .present(statusTimestamp): + if statusTimestamp >= timestamp { + return .online(at: statusTimestamp) + } else { + return .lastSeen(at: statusTimestamp) + } + case .recently: + let activeUntil = presence.lastActivity + 30 + if activeUntil >= timestamp { + return .online(at: activeUntil) + } else { + return .recently + } + case .lastWeek: + return .lastWeek + case .lastMonth: + return .lastMonth + } +} + +public func stringForRelativeTimestamp(strings: PresentationStrings, relativeTimestamp: Int32, relativeTo timestamp: Int32, dateTimeFormat: PresentationDateTimeFormat) -> String { + var t: time_t = time_t(relativeTimestamp) + var timeinfo: tm = tm() + localtime_r(&t, &timeinfo) + + var now: time_t = time_t(timestamp) + var timeinfoNow: tm = tm() + localtime_r(&now, &timeinfoNow) + + if timeinfo.tm_year != timeinfoNow.tm_year { + return stringForTimestamp(day: timeinfo.tm_mday, month: timeinfo.tm_mon + 1, year: timeinfo.tm_year, dateTimeFormat: dateTimeFormat) + } + + let dayDifference = timeinfo.tm_yday - timeinfoNow.tm_yday + if dayDifference > -7 { + if dayDifference == 0 { + return stringForShortTimestamp(hours: timeinfo.tm_hour, minutes: timeinfo.tm_min, dateTimeFormat: dateTimeFormat) + } else { + return shortStringForDayOfWeek(strings: strings, day: timeinfo.tm_wday) + } + } else { + return stringForTimestamp(day: timeinfo.tm_mday, month: timeinfo.tm_mon + 1, dateTimeFormat: dateTimeFormat) + } +} + +public func stringForRelativeLiveLocationTimestamp(strings: PresentationStrings, relativeTimestamp: Int32, relativeTo timestamp: Int32, dateTimeFormat: PresentationDateTimeFormat) -> String { + let difference = timestamp - relativeTimestamp + if difference < 60 { + return strings.LiveLocationUpdated_JustNow + } else if difference < 60 * 60 { + let minutes = difference / 60 + return strings.LiveLocationUpdated_MinutesAgo(minutes) + } else { + var t: time_t = time_t(relativeTimestamp) + var timeinfo: tm = tm() + localtime_r(&t, &timeinfo) + + var now: time_t = time_t(timestamp) + var timeinfoNow: tm = tm() + localtime_r(&now, &timeinfoNow) + + let dayDifference = timeinfo.tm_yday - timeinfoNow.tm_yday + + let hours = timeinfo.tm_hour + let minutes = timeinfo.tm_min + + if dayDifference == 0 { + return strings.LiveLocationUpdated_TodayAt(stringForShortTimestamp(hours: hours, minutes: minutes, dateTimeFormat: dateTimeFormat)).0 + } else { + return stringForFullDate(timestamp: relativeTimestamp, strings: strings, dateTimeFormat: dateTimeFormat) + } + } +} + +public func stringForRelativeSymbolicTimestamp(strings: PresentationStrings, relativeTimestamp: Int32, relativeTo timestamp: Int32, dateTimeFormat: PresentationDateTimeFormat) -> String { + var t: time_t = time_t(relativeTimestamp) + var timeinfo: tm = tm() + localtime_r(&t, &timeinfo) + + var now: time_t = time_t(timestamp) + var timeinfoNow: tm = tm() + localtime_r(&now, &timeinfoNow) + + let dayDifference = timeinfo.tm_yday - timeinfoNow.tm_yday + + let hours = timeinfo.tm_hour + let minutes = timeinfo.tm_min + + if dayDifference == 0 { + return strings.Time_TodayAt(stringForShortTimestamp(hours: hours, minutes: minutes, dateTimeFormat: dateTimeFormat)).0 + } else { + return stringForFullDate(timestamp: relativeTimestamp, strings: strings, dateTimeFormat: dateTimeFormat) + } +} + +public func stringForRelativeLiveLocationUpdateTimestamp(strings: PresentationStrings, relativeTimestamp: Int32, relativeTo timestamp: Int32, dateTimeFormat: PresentationDateTimeFormat) -> String { + var t: time_t = time_t(relativeTimestamp) + var timeinfo: tm = tm() + localtime_r(&t, &timeinfo) + + var now: time_t = time_t(timestamp) + var timeinfoNow: tm = tm() + localtime_r(&now, &timeinfoNow) + + if timeinfo.tm_year != timeinfoNow.tm_year { + return stringForTimestamp(day: timeinfo.tm_mday, month: timeinfo.tm_mon + 1, year: timeinfo.tm_year, dateTimeFormat: dateTimeFormat) + } + + let dayDifference = timeinfo.tm_yday - timeinfoNow.tm_yday + if dayDifference > -7 { + if dayDifference == 0 { + return stringForShortTimestamp(hours: timeinfo.tm_hour, minutes: timeinfo.tm_min, dateTimeFormat: dateTimeFormat) + } else { + return shortStringForDayOfWeek(strings: strings, day: timeinfo.tm_wday) + } + } else { + return stringForTimestamp(day: timeinfo.tm_mday, month: timeinfo.tm_mon + 1, dateTimeFormat: dateTimeFormat) + } +} + +public func stringAndActivityForUserPresence(strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, presence: TelegramUserPresence, relativeTo timestamp: Int32, expanded: Bool = false) -> (String, Bool) { + switch presence.status { + case .none: + return (strings.LastSeen_Offline, false) + case let .present(statusTimestamp): + if statusTimestamp >= timestamp { + return (strings.Presence_online, true) + } else { + let difference = timestamp - statusTimestamp + if difference < 60 { + return (strings.LastSeen_JustNow, false) + } else if difference < 60 * 60 && !expanded { + let minutes = difference / 60 + return (strings.LastSeen_MinutesAgo(minutes), false) + } else { + var t: time_t = time_t(statusTimestamp) + var timeinfo: tm = tm() + localtime_r(&t, &timeinfo) + + var now: time_t = time_t(timestamp) + var timeinfoNow: tm = tm() + localtime_r(&now, &timeinfoNow) + + if timeinfo.tm_year != timeinfoNow.tm_year { + return (strings.LastSeen_AtDate(stringForTimestamp(day: timeinfo.tm_mday, month: timeinfo.tm_mon + 1, year: timeinfo.tm_year, dateTimeFormat: dateTimeFormat)).0, false) + } + + let dayDifference = timeinfo.tm_yday - timeinfoNow.tm_yday + if dayDifference == 0 || dayDifference == -1 { + let day: RelativeTimestampFormatDay + if dayDifference == 0 { + if expanded { + day = .today + } else { + let minutes = difference / (60 * 60) + return (strings.LastSeen_HoursAgo(minutes), false) + } + } else { + day = .yesterday + } + return (stringForUserPresence(strings: strings, day: day, dateTimeFormat: dateTimeFormat, hours: timeinfo.tm_hour, minutes: timeinfo.tm_min), false) + } else { + return (strings.LastSeen_AtDate(stringForTimestamp(day: timeinfo.tm_mday, month: timeinfo.tm_mon + 1, year: timeinfo.tm_year, dateTimeFormat: dateTimeFormat)).0, false) + } + } + } + case .recently: + let activeUntil = presence.lastActivity + 30 + if activeUntil >= timestamp { + return (strings.Presence_online, true) + } else { + return (strings.LastSeen_Lately, false) + } + case .lastWeek: + return (strings.LastSeen_WithinAWeek, false) + case .lastMonth: + return (strings.LastSeen_WithinAMonth, false) + } +} + +public func userPresenceStringRefreshTimeout(_ presence: TelegramUserPresence, relativeTo timestamp: Int32) -> Double { + switch presence.status { + case let .present(statusTimestamp): + if statusTimestamp >= timestamp { + return Double(statusTimestamp - timestamp) + } else { + let difference = timestamp - statusTimestamp + if difference < 30 { + return Double((30 - difference) + 1) + } else if difference < 60 * 60 { + return Double((difference % 60) + 1) + } else { + return Double.infinity + } + } + case .recently: + let activeUntil = presence.lastActivity + 30 + if activeUntil >= timestamp { + return Double(activeUntil - timestamp + 1) + } else { + return Double.infinity + } + case .none, .lastWeek, .lastMonth: + return Double.infinity + } +} + + +public func stringForRemainingMuteInterval(strings: PresentationStrings, muteInterval value: Int32) -> String { + let timestamp = Int32(CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970) + let value = max(1 * 60, value - timestamp) + if value <= 1 * 60 * 60 { + return strings.MuteExpires_Minutes(Int32(round(Float(value) / 60))) + } else if value <= 24 * 60 * 60 { + return strings.MuteExpires_Hours(Int32(round(Float(value) / (60 * 60)))) + } else { + return strings.MuteExpires_Days(Int32(round(Float(value) / (24 * 60 * 60)))) + } +} diff --git a/submodules/TelegramStringFormatting/Sources/TelegramStringFormatting.h b/submodules/TelegramStringFormatting/Sources/TelegramStringFormatting.h new file mode 100644 index 0000000000..aed00e9d38 --- /dev/null +++ b/submodules/TelegramStringFormatting/Sources/TelegramStringFormatting.h @@ -0,0 +1,19 @@ +// +// TelegramStringFormatting.h +// TelegramStringFormatting +// +// Created by Peter on 8/4/19. +// Copyright © 2019 Telegram Messenger LLP. All rights reserved. +// + +#import + +//! Project version number for TelegramStringFormatting. +FOUNDATION_EXPORT double TelegramStringFormattingVersionNumber; + +//! Project version string for TelegramStringFormatting. +FOUNDATION_EXPORT const unsigned char TelegramStringFormattingVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/submodules/TelegramStringFormatting/TelegramStringFormatting_Xcode.xcodeproj/project.pbxproj b/submodules/TelegramStringFormatting/TelegramStringFormatting_Xcode.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..ba37255c56 --- /dev/null +++ b/submodules/TelegramStringFormatting/TelegramStringFormatting_Xcode.xcodeproj/project.pbxproj @@ -0,0 +1,567 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + D0879AB222F7021000C4D6B3 /* TelegramStringFormatting.h in Headers */ = {isa = PBXBuildFile; fileRef = D0879AB022F7021000C4D6B3 /* TelegramStringFormatting.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D0879ABD22F705AE00C4D6B3 /* PresenceStrings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879ABC22F705AE00C4D6B3 /* PresenceStrings.swift */; }; + D0879AC022F705B800C4D6B3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879ABF22F705B800C4D6B3 /* Foundation.framework */; }; + D0879AC222F705BB00C4D6B3 /* Postbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879AC122F705BB00C4D6B3 /* Postbox.framework */; }; + D0879AC422F705BE00C4D6B3 /* TelegramCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879AC322F705BE00C4D6B3 /* TelegramCore.framework */; }; + D0879AC622F705C300C4D6B3 /* TelegramPresentationData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879AC522F705C300C4D6B3 /* TelegramPresentationData.framework */; }; + D0879ACA22F7063300C4D6B3 /* DateFormat.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879AC922F7063300C4D6B3 /* DateFormat.swift */; }; + D0879ACC22F7064000C4D6B3 /* TelegramUIPreferences.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879ACB22F7064000C4D6B3 /* TelegramUIPreferences.framework */; }; + D0879ACE22F7069200C4D6B3 /* Locale.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879ACD22F7069200C4D6B3 /* Locale.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + D0879AAD22F7021000C4D6B3 /* TelegramStringFormatting.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TelegramStringFormatting.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879AB022F7021000C4D6B3 /* TelegramStringFormatting.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TelegramStringFormatting.h; sourceTree = ""; }; + D0879AB122F7021000C4D6B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D0879ABC22F705AE00C4D6B3 /* PresenceStrings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PresenceStrings.swift; sourceTree = ""; }; + D0879ABF22F705B800C4D6B3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + D0879AC122F705BB00C4D6B3 /* Postbox.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Postbox.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879AC322F705BE00C4D6B3 /* TelegramCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879AC522F705C300C4D6B3 /* TelegramPresentationData.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramPresentationData.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879AC922F7063300C4D6B3 /* DateFormat.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DateFormat.swift; sourceTree = ""; }; + D0879ACB22F7064000C4D6B3 /* TelegramUIPreferences.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramUIPreferences.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879ACD22F7069200C4D6B3 /* Locale.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Locale.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + D0879AAA22F7021000C4D6B3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879ACC22F7064000C4D6B3 /* TelegramUIPreferences.framework in Frameworks */, + D0879AC622F705C300C4D6B3 /* TelegramPresentationData.framework in Frameworks */, + D0879AC422F705BE00C4D6B3 /* TelegramCore.framework in Frameworks */, + D0879AC222F705BB00C4D6B3 /* Postbox.framework in Frameworks */, + D0879AC022F705B800C4D6B3 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + D0879AA322F7021000C4D6B3 = { + isa = PBXGroup; + children = ( + D0879AB122F7021000C4D6B3 /* Info.plist */, + D0879AAF22F7021000C4D6B3 /* Sources */, + D0879AAE22F7021000C4D6B3 /* Products */, + D0879ABE22F705B700C4D6B3 /* Frameworks */, + ); + sourceTree = ""; + }; + D0879AAE22F7021000C4D6B3 /* Products */ = { + isa = PBXGroup; + children = ( + D0879AAD22F7021000C4D6B3 /* TelegramStringFormatting.framework */, + ); + name = Products; + sourceTree = ""; + }; + D0879AAF22F7021000C4D6B3 /* Sources */ = { + isa = PBXGroup; + children = ( + D0879ACD22F7069200C4D6B3 /* Locale.swift */, + D0879AC922F7063300C4D6B3 /* DateFormat.swift */, + D0879ABC22F705AE00C4D6B3 /* PresenceStrings.swift */, + D0879AB022F7021000C4D6B3 /* TelegramStringFormatting.h */, + ); + path = Sources; + sourceTree = ""; + }; + D0879ABE22F705B700C4D6B3 /* Frameworks */ = { + isa = PBXGroup; + children = ( + D0879ACB22F7064000C4D6B3 /* TelegramUIPreferences.framework */, + D0879AC522F705C300C4D6B3 /* TelegramPresentationData.framework */, + D0879AC322F705BE00C4D6B3 /* TelegramCore.framework */, + D0879AC122F705BB00C4D6B3 /* Postbox.framework */, + D0879ABF22F705B800C4D6B3 /* Foundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + D0879AA822F7021000C4D6B3 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879AB222F7021000C4D6B3 /* TelegramStringFormatting.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + D0879AAC22F7021000C4D6B3 /* TelegramStringFormatting */ = { + isa = PBXNativeTarget; + buildConfigurationList = D0879AB522F7021000C4D6B3 /* Build configuration list for PBXNativeTarget "TelegramStringFormatting" */; + buildPhases = ( + D0879AA822F7021000C4D6B3 /* Headers */, + D0879AA922F7021000C4D6B3 /* Sources */, + D0879AAA22F7021000C4D6B3 /* Frameworks */, + D0879AAB22F7021000C4D6B3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = TelegramStringFormatting; + productName = TelegramStringFormatting; + productReference = D0879AAD22F7021000C4D6B3 /* TelegramStringFormatting.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + D0879AA422F7021000C4D6B3 /* Project object */ = { + isa = PBXProject; + attributes = { + DefaultBuildSystemTypeForWorkspace = Latest; + LastUpgradeCheck = 1030; + ORGANIZATIONNAME = "Telegram Messenger LLP"; + TargetAttributes = { + D0879AAC22F7021000C4D6B3 = { + CreatedOnToolsVersion = 10.3; + LastSwiftMigration = 1030; + }; + }; + }; + buildConfigurationList = D0879AA722F7021000C4D6B3 /* Build configuration list for PBXProject "TelegramStringFormatting_Xcode" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = D0879AA322F7021000C4D6B3; + productRefGroup = D0879AAE22F7021000C4D6B3 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + D0879AAC22F7021000C4D6B3 /* TelegramStringFormatting */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + D0879AAB22F7021000C4D6B3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + D0879AA922F7021000C4D6B3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879ACA22F7063300C4D6B3 /* DateFormat.swift in Sources */, + D0879ABD22F705AE00C4D6B3 /* PresenceStrings.swift in Sources */, + D0879ACE22F7069200C4D6B3 /* Locale.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + D0879AB322F7021000C4D6B3 /* DebugAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = DebugAppStoreLLC; + }; + D0879AB422F7021000C4D6B3 /* ReleaseAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = ReleaseAppStoreLLC; + }; + D0879AB622F7021000C4D6B3 /* DebugAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TelegramStringFormatting; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = DebugAppStoreLLC; + }; + D0879AB722F7021000C4D6B3 /* ReleaseAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TelegramStringFormatting; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = ReleaseAppStoreLLC; + }; + D0879AB822F7023200C4D6B3 /* DebugHockeyapp */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = DebugHockeyapp; + }; + D0879AB922F7023200C4D6B3 /* DebugHockeyapp */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TelegramStringFormatting; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = DebugHockeyapp; + }; + D0879ABA22F7023D00C4D6B3 /* ReleaseHockeyappInternal */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = ReleaseHockeyappInternal; + }; + D0879ABB22F7023D00C4D6B3 /* ReleaseHockeyappInternal */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TelegramStringFormatting; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = ReleaseHockeyappInternal; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + D0879AA722F7021000C4D6B3 /* Build configuration list for PBXProject "TelegramStringFormatting_Xcode" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D0879AB322F7021000C4D6B3 /* DebugAppStoreLLC */, + D0879AB822F7023200C4D6B3 /* DebugHockeyapp */, + D0879AB422F7021000C4D6B3 /* ReleaseAppStoreLLC */, + D0879ABA22F7023D00C4D6B3 /* ReleaseHockeyappInternal */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ReleaseAppStoreLLC; + }; + D0879AB522F7021000C4D6B3 /* Build configuration list for PBXNativeTarget "TelegramStringFormatting" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D0879AB622F7021000C4D6B3 /* DebugAppStoreLLC */, + D0879AB922F7023200C4D6B3 /* DebugHockeyapp */, + D0879AB722F7021000C4D6B3 /* ReleaseAppStoreLLC */, + D0879ABB22F7023D00C4D6B3 /* ReleaseHockeyappInternal */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ReleaseAppStoreLLC; + }; +/* End XCConfigurationList section */ + }; + rootObject = D0879AA422F7021000C4D6B3 /* Project object */; +} diff --git a/submodules/TelegramUI/TelegramUI/Accessibility.swift b/submodules/TelegramUI/TelegramUI/Accessibility.swift deleted file mode 100644 index 7422ccb13e..0000000000 --- a/submodules/TelegramUI/TelegramUI/Accessibility.swift +++ /dev/null @@ -1,53 +0,0 @@ -import SwiftSignalKit -import UIKit - -func smartInvertColorsEnabled() -> Bool { - if #available(iOSApplicationExtension 11.0, iOS 11.0, *), UIAccessibility.isInvertColorsEnabled { - return true - } else { - return false - } -} - -func reduceMotionEnabled() -> Signal { - return Signal { subscriber in - subscriber.putNext(UIAccessibility.isReduceMotionEnabled) - - let observer = NotificationCenter.default.addObserver(forName: UIAccessibility.reduceMotionStatusDidChangeNotification, object: nil, queue: .main, using: { _ in - subscriber.putNext(UIAccessibility.isReduceMotionEnabled) - }) - - return ActionDisposable { - Queue.mainQueue().async { - NotificationCenter.default.removeObserver(observer) - } - } - } |> runOn(Queue.mainQueue()) -} - -func boldTextEnabled() -> Signal { - return Signal { subscriber in - subscriber.putNext(UIAccessibility.isBoldTextEnabled) - - let observer = NotificationCenter.default.addObserver(forName: UIAccessibility.boldTextStatusDidChangeNotification, object: nil, queue: .main, using: { _ in - subscriber.putNext(UIAccessibility.isBoldTextEnabled) - }) - - return ActionDisposable { - Queue.mainQueue().async { - NotificationCenter.default.removeObserver(observer) - } - } - } |> runOn(Queue.mainQueue()) -} - -private func checkButtonShapes() -> Bool { - let button = UIButton() - button.setTitle("title", for: .normal) - - if let attributes = button.titleLabel?.attributedText?.attributes(at: 0, effectiveRange: nil), let _ = attributes[NSAttributedString.Key.underlineStyle] { - return true - } else { - return false - } -} diff --git a/submodules/TelegramUI/TelegramUI/AccountContext.swift b/submodules/TelegramUI/TelegramUI/AccountContext.swift index 3dfb00eada..d219e4832f 100644 --- a/submodules/TelegramUI/TelegramUI/AccountContext.swift +++ b/submodules/TelegramUI/TelegramUI/AccountContext.swift @@ -7,6 +7,8 @@ import Display import DeviceAccess import TelegramPresentationData import AccountContext +import LiveLocationManager +import TemporaryCachedPeerDataManager private final class DeviceSpecificContactImportContext { let disposable = MetaDisposable() @@ -94,9 +96,9 @@ private final class DeviceSpecificContactImportContexts { } public final class AccountContextImpl: AccountContext { - public let sharedContext: SharedAccountContextImpl - public var genericSharedContext: SharedAccountContext { - return self.sharedContext + public let sharedContextImpl: SharedAccountContextImpl + public var sharedContext: SharedAccountContext { + return self.sharedContextImpl } public let account: Account @@ -105,12 +107,12 @@ public final class AccountContextImpl: AccountContext { public var keyShortcutsController: KeyShortcutsController? - let downloadedMediaStoreManager: DownloadedMediaStoreManager + public let downloadedMediaStoreManager: DownloadedMediaStoreManager public let liveLocationManager: LiveLocationManager? - let wallpaperUploadManager: WallpaperUploadManager? + public let wallpaperUploadManager: WallpaperUploadManager? - let peerChannelMemberCategoriesContextsManager = PeerChannelMemberCategoriesContextsManager() + public let peerChannelMemberCategoriesContextsManager = PeerChannelMemberCategoriesContextsManager() public let currentLimitsConfiguration: Atomic private let _limitsConfiguration = Promise() @@ -127,20 +129,20 @@ public final class AccountContextImpl: AccountContext { private var managedAppSpecificContactsDisposable: Disposable? public init(sharedContext: SharedAccountContextImpl, account: Account, limitsConfiguration: LimitsConfiguration) { - self.sharedContext = sharedContext + self.sharedContextImpl = sharedContext self.account = account - self.downloadedMediaStoreManager = DownloadedMediaStoreManager(postbox: account.postbox, accountManager: sharedContext.accountManager) + self.downloadedMediaStoreManager = DownloadedMediaStoreManagerImpl(postbox: account.postbox, accountManager: sharedContext.accountManager) - if let locationManager = self.sharedContext.locationManager { - self.liveLocationManager = LiveLocationManager(postbox: account.postbox, network: account.network, accountPeerId: account.peerId, viewTracker: account.viewTracker, stateManager: account.stateManager, locationManager: locationManager, inForeground: self.sharedContext.applicationBindings.applicationInForeground) + if let locationManager = self.sharedContextImpl.locationManager { + self.liveLocationManager = LiveLocationManagerImpl(postbox: account.postbox, network: account.network, accountPeerId: account.peerId, viewTracker: account.viewTracker, stateManager: account.stateManager, locationManager: locationManager, inForeground: sharedContext.applicationBindings.applicationInForeground) } else { self.liveLocationManager = nil } - self.fetchManager = FetchManager(postbox: account.postbox, storeManager: self.downloadedMediaStoreManager) + self.fetchManager = FetchManagerImpl(postbox: account.postbox, storeManager: self.downloadedMediaStoreManager) if sharedContext.applicationBindings.isMainApp { - self.prefetchManager = PrefetchManager(sharedContext: sharedContext, account: account, fetchManager: fetchManager) - self.wallpaperUploadManager = WallpaperUploadManager(sharedContext: sharedContext, account: account, presentationData: sharedContext.presentationData) + self.prefetchManager = PrefetchManager(sharedContext: sharedContext, account: account, fetchManager: self.fetchManager) + self.wallpaperUploadManager = WallpaperUploadManagerImpl(sharedContext: sharedContext, account: account, presentationData: sharedContext.presentationData) } else { self.prefetchManager = nil self.wallpaperUploadManager = nil diff --git a/submodules/TelegramUI/TelegramUI/AccountUtils.swift b/submodules/TelegramUI/TelegramUI/AccountUtils.swift index 613e280f19..dea14726ec 100644 --- a/submodules/TelegramUI/TelegramUI/AccountUtils.swift +++ b/submodules/TelegramUI/TelegramUI/AccountUtils.swift @@ -3,8 +3,9 @@ import SwiftSignalKit import Postbox import TelegramCore import TelegramUIPreferences +import AccountContext -func activeAccountsAndPeers(context: AccountContextImpl) -> Signal<((Account, Peer)?, [(Account, Peer, Int32)]), NoError> { +func activeAccountsAndPeers(context: AccountContext) -> Signal<((Account, Peer)?, [(Account, Peer, Int32)]), NoError> { let sharedContext = context.sharedContext return context.sharedContext.activeAccounts |> mapToSignal { primary, activeAccounts, _ -> Signal<((Account, Peer)?, [(Account, Peer, Int32)]), NoError> in diff --git a/submodules/TelegramUI/TelegramUI/ActionSheetPeerItem.swift b/submodules/TelegramUI/TelegramUI/ActionSheetPeerItem.swift index c5a7138f12..0804fdd2c8 100644 --- a/submodules/TelegramUI/TelegramUI/ActionSheetPeerItem.swift +++ b/submodules/TelegramUI/TelegramUI/ActionSheetPeerItem.swift @@ -5,6 +5,7 @@ import Display import TelegramCore import Postbox import TelegramPresentationData +import AvatarNode public class ActionSheetPeerItem: ActionSheetItem { public let account: Account diff --git a/submodules/TelegramUI/TelegramUI/AppDelegate.swift b/submodules/TelegramUI/TelegramUI/AppDelegate.swift index f1259e2f48..a49b99e764 100644 --- a/submodules/TelegramUI/TelegramUI/AppDelegate.swift +++ b/submodules/TelegramUI/TelegramUI/AppDelegate.swift @@ -16,6 +16,7 @@ import TelegramVoip import BuildConfig import DeviceCheck import AccountContext +import OverlayStatusController private let handleVoipNotifications = false @@ -114,7 +115,7 @@ private class ApplicationStatusBarHost: StatusBarHost { } var handleVolumeControl: Signal { - return MediaManager.globalAudioSession.isPlaybackActive() + return MediaManagerImpl.globalAudioSession.isPlaybackActive() } } @@ -139,13 +140,13 @@ final class SharedApplicationContext { let sharedContext: SharedAccountContextImpl let notificationManager: SharedNotificationManager let wakeupManager: SharedWakeupManager - let overlayMediaController: OverlayMediaController + let overlayMediaController: ViewController & OverlayMediaController init(sharedContext: SharedAccountContextImpl, notificationManager: SharedNotificationManager, wakeupManager: SharedWakeupManager) { self.sharedContext = sharedContext self.notificationManager = notificationManager self.wakeupManager = wakeupManager - self.overlayMediaController = OverlayMediaController() + self.overlayMediaController = OverlayMediaControllerImpl() } } @@ -348,7 +349,7 @@ final class SharedApplicationContext { let apiId: Int32 = buildConfig.apiId let languagesCategory = "ios" - let networkArguments = NetworkInitializationArguments(apiId: apiId, languagesCategory: languagesCategory, appVersion: appVersion, voipMaxLayer: PresentationCallManager.voipMaxLayer, appData: self.deviceToken.get() |> map { token in + let networkArguments = NetworkInitializationArguments(apiId: apiId, languagesCategory: languagesCategory, appVersion: appVersion, voipMaxLayer: PresentationCallManagerImpl.voipMaxLayer, appData: self.deviceToken.get() |> map { token in return buildConfig.bundleData(withAppToken: token) }) @@ -435,7 +436,7 @@ final class SharedApplicationContext { self.window?.makeKeyAndVisible() - self.hasActiveAudioSession.set(MediaManager.globalAudioSession.isActive()) + self.hasActiveAudioSession.set(MediaManagerImpl.globalAudioSession.isActive()) initializeAccountManagement() diff --git a/submodules/TelegramUI/TelegramUI/ApplicationContext.swift b/submodules/TelegramUI/TelegramUI/ApplicationContext.swift index 294e15961c..993633800c 100644 --- a/submodules/TelegramUI/TelegramUI/ApplicationContext.swift +++ b/submodules/TelegramUI/TelegramUI/ApplicationContext.swift @@ -9,6 +9,7 @@ import Display import LegacyComponents import DeviceAccess import TelegramUpdateUI +import AccountContext func isAccessLocked(data: PostboxAccessChallengeData, at timestamp: Int32) -> Bool { if data.isLockable, let autolockDeadline = data.autolockDeadline, autolockDeadline <= timestamp { @@ -760,7 +761,7 @@ final class AuthorizedApplicationContext { return } - let watchManager = WatchManager(arguments: arguments) + let watchManager = WatchManagerImpl(arguments: arguments) strongSelf.context.watchManager = watchManager strongSelf.watchNavigateToMessageDisposable.set((strongSelf.context.sharedContext.applicationBindings.applicationInForeground |> mapToSignal({ applicationInForeground -> Signal<(Bool, MessageId), NoError> in diff --git a/submodules/TelegramUI/TelegramUI/ArchivedStickerPacksController.swift b/submodules/TelegramUI/TelegramUI/ArchivedStickerPacksController.swift index f5a5650b82..4cb56f3f09 100644 --- a/submodules/TelegramUI/TelegramUI/ArchivedStickerPacksController.swift +++ b/submodules/TelegramUI/TelegramUI/ArchivedStickerPacksController.swift @@ -7,6 +7,8 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import OverlayStatusController +import AccountContext public enum ArchivedStickerPacksControllerMode { case stickers @@ -233,7 +235,7 @@ private func archivedStickerPacksControllerEntries(presentationData: Presentatio return entries } -public func archivedStickerPacksController(context: AccountContextImpl, mode: ArchivedStickerPacksControllerMode, archived: [ArchivedStickerPackItem]?, updatedPacks: @escaping ([ArchivedStickerPackItem]?) -> Void) -> ViewController { +public func archivedStickerPacksController(context: AccountContext, mode: ArchivedStickerPacksControllerMode, archived: [ArchivedStickerPackItem]?, updatedPacks: @escaping ([ArchivedStickerPackItem]?) -> Void) -> ViewController { let statePromise = ValuePromise(ArchivedStickerPacksControllerState(), ignoreRepeated: true) let stateValue = Atomic(value: ArchivedStickerPacksControllerState()) let updateState: ((ArchivedStickerPacksControllerState) -> ArchivedStickerPacksControllerState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/AuthorizationSequenceController.swift b/submodules/TelegramUI/TelegramUI/AuthorizationSequenceController.swift index c5063240d6..3506a140e5 100644 --- a/submodules/TelegramUI/TelegramUI/AuthorizationSequenceController.swift +++ b/submodules/TelegramUI/TelegramUI/AuthorizationSequenceController.swift @@ -14,6 +14,7 @@ import MessageUI import CoreTelephony import TelegramPresentationData import TextFormat +import AccountContext private enum InnerState: Equatable { case state(UnauthorizedAccountStateContents) @@ -25,7 +26,7 @@ public final class AuthorizationSequenceController: NavigationController, MFMail return NavigationBarTheme(buttonColor: theme.rootController.navigationBar.buttonColor, disabledButtonColor: theme.rootController.navigationBar.disabledButtonColor, primaryTextColor: theme.rootController.navigationBar.primaryTextColor, backgroundColor: .clear, separatorColor: .clear, badgeBackgroundColor: theme.rootController.navigationBar.badgeBackgroundColor, badgeStrokeColor: theme.rootController.navigationBar.badgeStrokeColor, badgeTextColor: theme.rootController.navigationBar.badgeTextColor) } - private let sharedContext: SharedAccountContextImpl + private let sharedContext: SharedAccountContext private var account: UnauthorizedAccount private let otherAccountPhoneNumbers: ((String, AccountRecordId, Bool)?, [(String, AccountRecordId, Bool)]) private let apiId: Int32 @@ -45,7 +46,7 @@ public final class AuthorizationSequenceController: NavigationController, MFMail } private var didSetReady = false - public init(sharedContext: SharedAccountContextImpl, account: UnauthorizedAccount, otherAccountPhoneNumbers: ((String, AccountRecordId, Bool)?, [(String, AccountRecordId, Bool)]), strings: PresentationStrings, theme: PresentationTheme, openUrl: @escaping (String) -> Void, apiId: Int32, apiHash: String) { + public init(sharedContext: SharedAccountContext, account: UnauthorizedAccount, otherAccountPhoneNumbers: ((String, AccountRecordId, Bool)?, [(String, AccountRecordId, Bool)]), strings: PresentationStrings, theme: PresentationTheme, openUrl: @escaping (String) -> Void, apiId: Int32, apiHash: String) { self.sharedContext = sharedContext self.account = account self.otherAccountPhoneNumbers = otherAccountPhoneNumbers diff --git a/submodules/TelegramUI/TelegramUI/AuthorizationSequenceCountrySelectionController.swift b/submodules/TelegramUI/TelegramUI/AuthorizationSequenceCountrySelectionController.swift index d96cb7fb2a..f431dbb9eb 100644 --- a/submodules/TelegramUI/TelegramUI/AuthorizationSequenceCountrySelectionController.swift +++ b/submodules/TelegramUI/TelegramUI/AuthorizationSequenceCountrySelectionController.swift @@ -3,6 +3,7 @@ import UIKit import Display import AsyncDisplayKit import TelegramPresentationData +import TelegramStringFormatting private func loadCountryCodes() -> [(String, Int)] { guard let filePath = frameworkBundle.path(forResource: "PhoneCountries", ofType: "txt") else { diff --git a/submodules/TelegramUI/TelegramUI/AuthorizationSequenceCountrySelectionControllerNode.swift b/submodules/TelegramUI/TelegramUI/AuthorizationSequenceCountrySelectionControllerNode.swift index 4d3668640d..4f005b50a3 100644 --- a/submodules/TelegramUI/TelegramUI/AuthorizationSequenceCountrySelectionControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/AuthorizationSequenceCountrySelectionControllerNode.swift @@ -4,6 +4,7 @@ import AsyncDisplayKit import Display import TelegramCore import TelegramPresentationData +import TelegramStringFormatting private func loadCountryCodes() -> [(String, Int)] { guard let filePath = frameworkBundle.path(forResource: "PhoneCountries", ofType: "txt") else { diff --git a/submodules/TelegramUI/TelegramUI/AuthorizationSequencePhoneEntryController.swift b/submodules/TelegramUI/TelegramUI/AuthorizationSequencePhoneEntryController.swift index dad88ef035..8e6223034e 100644 --- a/submodules/TelegramUI/TelegramUI/AuthorizationSequencePhoneEntryController.swift +++ b/submodules/TelegramUI/TelegramUI/AuthorizationSequencePhoneEntryController.swift @@ -7,13 +7,14 @@ import TelegramCore import Postbox import TelegramPresentationData import ProgressNavigationButtonNode +import AccountContext final class AuthorizationSequencePhoneEntryController: ViewController { private var controllerNode: AuthorizationSequencePhoneEntryControllerNode { return self.displayNode as! AuthorizationSequencePhoneEntryControllerNode } - private let sharedContext: SharedAccountContextImpl + private let sharedContext: SharedAccountContext private let isTestingEnvironment: Bool private let otherAccountPhoneNumbers: ((String, AccountRecordId, Bool)?, [(String, AccountRecordId, Bool)]) private let network: Network @@ -42,7 +43,7 @@ final class AuthorizationSequencePhoneEntryController: ViewController { private let hapticFeedback = HapticFeedback() - init(sharedContext: SharedAccountContextImpl, isTestingEnvironment: Bool, otherAccountPhoneNumbers: ((String, AccountRecordId, Bool)?, [(String, AccountRecordId, Bool)]), network: Network, strings: PresentationStrings, theme: PresentationTheme, openUrl: @escaping (String) -> Void, back: @escaping () -> Void) { + init(sharedContext: SharedAccountContext, isTestingEnvironment: Bool, otherAccountPhoneNumbers: ((String, AccountRecordId, Bool)?, [(String, AccountRecordId, Bool)]), network: Network, strings: PresentationStrings, theme: PresentationTheme, openUrl: @escaping (String) -> Void, back: @escaping () -> Void) { self.sharedContext = sharedContext self.isTestingEnvironment = isTestingEnvironment self.otherAccountPhoneNumbers = otherAccountPhoneNumbers @@ -156,7 +157,7 @@ final class AuthorizationSequencePhoneEntryController: ViewController { var actions: [TextAlertAction] = [] if let (current, _, _) = self.otherAccountPhoneNumbers.0, logInNumber != formatPhoneNumber(current) { actions.append(TextAlertAction(type: .genericAction, title: self.strings.Login_PhoneNumberAlreadyAuthorizedSwitch, action: { [weak self] in - self?.sharedContext.switchToAccount(id: id) + self?.sharedContext.switchToAccount(id: id, fromSettingsController: nil, withChatListController: nil) self?.back() })) } diff --git a/submodules/TelegramUI/TelegramUI/AutodownloadConnectionTypeController.swift b/submodules/TelegramUI/TelegramUI/AutodownloadConnectionTypeController.swift index f7c1ae8200..55de889ed6 100644 --- a/submodules/TelegramUI/TelegramUI/AutodownloadConnectionTypeController.swift +++ b/submodules/TelegramUI/TelegramUI/AutodownloadConnectionTypeController.swift @@ -7,6 +7,7 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext enum AutomaticDownloadConnectionType { case cellular @@ -273,7 +274,7 @@ private func autodownloadMediaConnectionTypeControllerEntries(presentationData: return entries } -func autodownloadMediaConnectionTypeController(context: AccountContextImpl, connectionType: AutomaticDownloadConnectionType) -> ViewController { +func autodownloadMediaConnectionTypeController(context: AccountContext, connectionType: AutomaticDownloadConnectionType) -> ViewController { var pushControllerImpl: ((ViewController) -> Void)? var presentControllerImpl: ((ViewController) -> Void)? diff --git a/submodules/TelegramUI/TelegramUI/AutodownloadMediaCategoryController.swift b/submodules/TelegramUI/TelegramUI/AutodownloadMediaCategoryController.swift index 40cc885d70..bc7d4d64fe 100644 --- a/submodules/TelegramUI/TelegramUI/AutodownloadMediaCategoryController.swift +++ b/submodules/TelegramUI/TelegramUI/AutodownloadMediaCategoryController.swift @@ -7,6 +7,7 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext public func autodownloadDataSizeString(_ size: Int64, decimalSeparator: String = ".") -> String { if size >= 1024 * 1024 * 1024 { @@ -285,7 +286,7 @@ private func autodownloadMediaCategoryControllerEntries(presentationData: Presen return entries } -func autodownloadMediaCategoryController(context: AccountContextImpl, connectionType: AutomaticDownloadConnectionType, category: AutomaticDownloadCategory) -> ViewController { +func autodownloadMediaCategoryController(context: AccountContext, connectionType: AutomaticDownloadConnectionType, category: AutomaticDownloadCategory) -> ViewController { let arguments = AutodownloadMediaCategoryControllerArguments(togglePeer: { type in let _ = updateMediaDownloadSettingsInteractively(accountManager: context.sharedContext.accountManager, { settings in var settings = settings diff --git a/submodules/TelegramUI/TelegramUI/AvatarGalleryController.swift b/submodules/TelegramUI/TelegramUI/AvatarGalleryController.swift index c402dc5f39..d12ead6ad1 100644 --- a/submodules/TelegramUI/TelegramUI/AvatarGalleryController.swift +++ b/submodules/TelegramUI/TelegramUI/AvatarGalleryController.swift @@ -7,6 +7,7 @@ import SwiftSignalKit import AsyncDisplayKit import TelegramCore import TelegramPresentationData +import AccountContext public struct ImageRepresentationWithReference: Equatable { public let representation: TelegramMediaImageRepresentation @@ -104,7 +105,7 @@ class AvatarGalleryController: ViewController { return self.displayNode as! GalleryControllerNode } - private let context: AccountContextImpl + private let context: AccountContext private let peer: Peer private var presentationData: PresentationData @@ -135,7 +136,7 @@ class AvatarGalleryController: ViewController { private let replaceRootController: (ViewController, ValuePromise?) -> Void - init(context: AccountContextImpl, peer: Peer, remoteEntries: Promise<[AvatarGalleryEntry]>? = nil, replaceRootController: @escaping (ViewController, ValuePromise?) -> Void, synchronousLoad: Bool = false) { + init(context: AccountContext, peer: Peer, remoteEntries: Promise<[AvatarGalleryEntry]>? = nil, replaceRootController: @escaping (ViewController, ValuePromise?) -> Void, synchronousLoad: Bool = false) { self.context = context self.peer = peer self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/AvatarGalleryItemFooterContentNode.swift b/submodules/TelegramUI/TelegramUI/AvatarGalleryItemFooterContentNode.swift index 655bcd9c45..aaec2f506b 100644 --- a/submodules/TelegramUI/TelegramUI/AvatarGalleryItemFooterContentNode.swift +++ b/submodules/TelegramUI/TelegramUI/AvatarGalleryItemFooterContentNode.swift @@ -8,6 +8,8 @@ import SwiftSignalKit import Photos import TelegramPresentationData import TelegramUIPreferences +import TelegramStringFormatting +import AccountContext private let deleteImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Accessory Panels/MessageSelectionThrash"), color: .white) private let actionImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Accessory Panels/MessageSelectionAction"), color: .white) @@ -16,7 +18,7 @@ private let nameFont = Font.medium(15.0) private let dateFont = Font.regular(14.0) final class AvatarGalleryItemFooterContentNode: GalleryFooterContentNode { - private let context: AccountContextImpl + private let context: AccountContext private var strings: PresentationStrings private var dateTimeFormat: PresentationDateTimeFormat @@ -36,7 +38,7 @@ final class AvatarGalleryItemFooterContentNode: GalleryFooterContentNode { var share: ((GalleryControllerInteraction) -> Void)? - init(context: AccountContextImpl, presentationData: PresentationData) { + init(context: AccountContext, presentationData: PresentationData) { self.context = context self.strings = presentationData.strings self.dateTimeFormat = presentationData.dateTimeFormat diff --git a/submodules/TelegramUI/TelegramUI/BlockedPeersController.swift b/submodules/TelegramUI/TelegramUI/BlockedPeersController.swift index 927817e1c1..9fe2aaff7b 100644 --- a/submodules/TelegramUI/TelegramUI/BlockedPeersController.swift +++ b/submodules/TelegramUI/TelegramUI/BlockedPeersController.swift @@ -7,6 +7,7 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext private final class BlockedPeersControllerArguments { let account: Account @@ -194,7 +195,7 @@ private func blockedPeersControllerEntries(presentationData: PresentationData, s return entries } -public func blockedPeersController(context: AccountContextImpl, blockedPeersContext: BlockedPeersContext) -> ViewController { +public func blockedPeersController(context: AccountContext, blockedPeersContext: BlockedPeersContext) -> ViewController { let statePromise = ValuePromise(BlockedPeersControllerState(), ignoreRepeated: true) let stateValue = Atomic(value: BlockedPeersControllerState()) let updateState: ((BlockedPeersControllerState) -> BlockedPeersControllerState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/BotCheckoutController.swift b/submodules/TelegramUI/TelegramUI/BotCheckoutController.swift index 345b4adb7b..50f8b42615 100644 --- a/submodules/TelegramUI/TelegramUI/BotCheckoutController.swift +++ b/submodules/TelegramUI/TelegramUI/BotCheckoutController.swift @@ -6,6 +6,7 @@ import TelegramCore import SwiftSignalKit import Postbox import TelegramPresentationData +import AccountContext final class BotCheckoutController: ViewController { private var controllerNode: BotCheckoutControllerNode { @@ -17,7 +18,7 @@ final class BotCheckoutController: ViewController { return self._ready } - private let context: AccountContextImpl + private let context: AccountContext private let invoice: TelegramMediaInvoice private let messageId: MessageId @@ -25,7 +26,7 @@ final class BotCheckoutController: ViewController { private var didPlayPresentationAnimation = false - init(context: AccountContextImpl, invoice: TelegramMediaInvoice, messageId: MessageId) { + init(context: AccountContext, invoice: TelegramMediaInvoice, messageId: MessageId) { self.context = context self.invoice = invoice self.messageId = messageId diff --git a/submodules/TelegramUI/TelegramUI/BotCheckoutControllerNode.swift b/submodules/TelegramUI/TelegramUI/BotCheckoutControllerNode.swift index 6e28feae0b..60cca6f17d 100644 --- a/submodules/TelegramUI/TelegramUI/BotCheckoutControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/BotCheckoutControllerNode.swift @@ -9,6 +9,7 @@ import PassKit import TelegramPresentationData import TelegramUIPrivateModule import ItemListUI +import AccountContext final class BotCheckoutControllerArguments { fileprivate let account: Account @@ -361,7 +362,7 @@ private func availablePaymentMethods(form: BotPaymentForm, current: BotCheckoutP } final class BotCheckoutControllerNode: ItemListControllerNode, PKPaymentAuthorizationViewControllerDelegate { - private let context: AccountContextImpl + private let context: AccountContext private let messageId: MessageId private let present: (ViewController, Any?) -> Void private let dismissAnimated: () -> Void @@ -388,7 +389,7 @@ final class BotCheckoutControllerNode: ItemListControllerNode, private var applePayAuthrorizationCompletion: ((PKPaymentAuthorizationStatus) -> Void)? private var applePayController: PKPaymentAuthorizationViewController? - init(controller: ItemListController?, navigationBar: NavigationBar, updateNavigationOffset: @escaping (CGFloat) -> Void, context: AccountContextImpl, invoice: TelegramMediaInvoice, messageId: MessageId, present: @escaping (ViewController, Any?) -> Void, dismissAnimated: @escaping () -> Void) { + init(controller: ItemListController?, navigationBar: NavigationBar, updateNavigationOffset: @escaping (CGFloat) -> Void, context: AccountContext, invoice: TelegramMediaInvoice, messageId: MessageId, present: @escaping (ViewController, Any?) -> Void, dismissAnimated: @escaping () -> Void) { self.context = context self.messageId = messageId self.present = present diff --git a/submodules/TelegramUI/TelegramUI/BotCheckoutInfoController.swift b/submodules/TelegramUI/TelegramUI/BotCheckoutInfoController.swift index 2a42f55bbf..052b6c3003 100644 --- a/submodules/TelegramUI/TelegramUI/BotCheckoutInfoController.swift +++ b/submodules/TelegramUI/TelegramUI/BotCheckoutInfoController.swift @@ -6,6 +6,7 @@ import TelegramCore import Postbox import TelegramPresentationData import ProgressNavigationButtonNode +import AccountContext enum BotCheckoutInfoControllerAddressFocus { case street1 @@ -27,7 +28,7 @@ final class BotCheckoutInfoController: ViewController { return super.displayNode as! BotCheckoutInfoControllerNode } - private let context: AccountContextImpl + private let context: AccountContext private let invoice: BotPaymentInvoice private let messageId: MessageId private let initialFormInfo: BotPaymentRequestedInfo @@ -42,7 +43,7 @@ final class BotCheckoutInfoController: ViewController { private var doneItem: UIBarButtonItem? private var activityItem: UIBarButtonItem? - public init(context: AccountContextImpl, invoice: BotPaymentInvoice, messageId: MessageId, initialFormInfo: BotPaymentRequestedInfo, focus: BotCheckoutInfoControllerFocus, formInfoUpdated: @escaping (BotPaymentRequestedInfo, BotPaymentValidatedFormInfo) -> Void) { + public init(context: AccountContext, invoice: BotPaymentInvoice, messageId: MessageId, initialFormInfo: BotPaymentRequestedInfo, focus: BotCheckoutInfoControllerFocus, formInfoUpdated: @escaping (BotPaymentRequestedInfo, BotPaymentValidatedFormInfo) -> Void) { self.context = context self.invoice = invoice self.messageId = messageId diff --git a/submodules/TelegramUI/TelegramUI/BotCheckoutInfoControllerNode.swift b/submodules/TelegramUI/TelegramUI/BotCheckoutInfoControllerNode.swift index d0c1628f1d..ed7cfd870b 100644 --- a/submodules/TelegramUI/TelegramUI/BotCheckoutInfoControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/BotCheckoutInfoControllerNode.swift @@ -6,6 +6,7 @@ import TelegramCore import Postbox import SwiftSignalKit import TelegramPresentationData +import AccountContext private final class BotCheckoutInfoAddressItems { let address1: BotPaymentFieldItemNode @@ -90,7 +91,7 @@ enum BotCheckoutInfoControllerStatus { } final class BotCheckoutInfoControllerNode: ViewControllerTracingNode, UIScrollViewDelegate { - private let context: AccountContextImpl + private let context: AccountContext private let invoice: BotPaymentInvoice private let messageId: MessageId private var focus: BotCheckoutInfoControllerFocus? @@ -120,7 +121,7 @@ final class BotCheckoutInfoControllerNode: ViewControllerTracingNode, UIScrollVi private let verifyDisposable = MetaDisposable() private var isVerifying = false - init(context: AccountContextImpl, invoice: BotPaymentInvoice, messageId: MessageId, formInfo: BotPaymentRequestedInfo, focus: BotCheckoutInfoControllerFocus, theme: PresentationTheme, strings: PresentationStrings, dismiss: @escaping () -> Void, openCountrySelection: @escaping () -> Void, updateStatus: @escaping (BotCheckoutInfoControllerStatus) -> Void, formInfoUpdated: @escaping (BotPaymentRequestedInfo, BotPaymentValidatedFormInfo) -> Void, present: @escaping (ViewController, Any?) -> Void) { + init(context: AccountContext, invoice: BotPaymentInvoice, messageId: MessageId, formInfo: BotPaymentRequestedInfo, focus: BotCheckoutInfoControllerFocus, theme: PresentationTheme, strings: PresentationStrings, dismiss: @escaping () -> Void, openCountrySelection: @escaping () -> Void, updateStatus: @escaping (BotCheckoutInfoControllerStatus) -> Void, formInfoUpdated: @escaping (BotPaymentRequestedInfo, BotPaymentValidatedFormInfo) -> Void, present: @escaping (ViewController, Any?) -> Void) { self.context = context self.invoice = invoice self.messageId = messageId diff --git a/submodules/TelegramUI/TelegramUI/BotCheckoutNativeCardEntryController.swift b/submodules/TelegramUI/TelegramUI/BotCheckoutNativeCardEntryController.swift index 218df20192..0208ce461b 100644 --- a/submodules/TelegramUI/TelegramUI/BotCheckoutNativeCardEntryController.swift +++ b/submodules/TelegramUI/TelegramUI/BotCheckoutNativeCardEntryController.swift @@ -7,6 +7,7 @@ import TelegramCore import Postbox import TelegramPresentationData import ProgressNavigationButtonNode +import AccountContext enum BotCheckoutNativeCardEntryStatus { case notReady @@ -31,7 +32,7 @@ final class BotCheckoutNativeCardEntryController: ViewController { return super.displayNode as! BotCheckoutNativeCardEntryControllerNode } - private let context: AccountContextImpl + private let context: AccountContext private let additionalFields: BotCheckoutNativeCardEntryAdditionalFields private let publishableKey: String private let completion: (BotCheckoutPaymentMethod) -> Void @@ -43,7 +44,7 @@ final class BotCheckoutNativeCardEntryController: ViewController { private var doneItem: UIBarButtonItem? private var activityItem: UIBarButtonItem? - public init(context: AccountContextImpl, additionalFields: BotCheckoutNativeCardEntryAdditionalFields, publishableKey: String, completion: @escaping (BotCheckoutPaymentMethod) -> Void) { + public init(context: AccountContext, additionalFields: BotCheckoutNativeCardEntryAdditionalFields, publishableKey: String, completion: @escaping (BotCheckoutPaymentMethod) -> Void) { self.context = context self.additionalFields = additionalFields self.publishableKey = publishableKey diff --git a/submodules/TelegramUI/TelegramUI/BotCheckoutPasswordEntryController.swift b/submodules/TelegramUI/TelegramUI/BotCheckoutPasswordEntryController.swift index 8216e30f74..044183124f 100644 --- a/submodules/TelegramUI/TelegramUI/BotCheckoutPasswordEntryController.swift +++ b/submodules/TelegramUI/TelegramUI/BotCheckoutPasswordEntryController.swift @@ -5,6 +5,7 @@ import Display import TelegramCore import SwiftSignalKit import TelegramPresentationData +import AccountContext private struct BotCheckoutPasswordAlertAction { public let title: String @@ -68,7 +69,7 @@ private final class BotCheckoutPasswordAlertActionNode: HighlightableButtonNode } private final class BotCheckoutPasswordAlertContentNode: AlertContentNode { - private let context: AccountContextImpl + private let context: AccountContext private let period: Int32 private let requiresBiometrics: Bool private let completion: (TemporaryTwoStepPasswordToken) -> Void @@ -92,7 +93,7 @@ private final class BotCheckoutPasswordAlertContentNode: AlertContentNode { private let hapticFeedback = HapticFeedback() - init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings, cardTitle: String, period: Int32, requiresBiometrics: Bool, cancel: @escaping () -> Void, completion: @escaping (TemporaryTwoStepPasswordToken) -> Void) { + init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, cardTitle: String, period: Int32, requiresBiometrics: Bool, cancel: @escaping () -> Void, completion: @escaping (TemporaryTwoStepPasswordToken) -> Void) { self.context = context self.period = period self.requiresBiometrics = requiresBiometrics @@ -297,7 +298,7 @@ private final class BotCheckoutPasswordAlertContentNode: AlertContentNode { } } -func botCheckoutPasswordEntryController(context: AccountContextImpl, strings: PresentationStrings, cartTitle: String, period: Int32, requiresBiometrics: Bool, completion: @escaping (TemporaryTwoStepPasswordToken) -> Void) -> AlertController { +func botCheckoutPasswordEntryController(context: AccountContext, strings: PresentationStrings, cartTitle: String, period: Int32, requiresBiometrics: Bool, completion: @escaping (TemporaryTwoStepPasswordToken) -> Void) -> AlertController { var dismissImpl: (() -> Void)? let presentationData = context.sharedContext.currentPresentationData.with { $0 } let controller = AlertController(theme: AlertControllerTheme(presentationTheme: presentationData.theme), contentNode: BotCheckoutPasswordAlertContentNode(context: context, theme: presentationData.theme, strings: strings, cardTitle: cartTitle, period: period, requiresBiometrics: requiresBiometrics, cancel: { diff --git a/submodules/TelegramUI/TelegramUI/BotCheckoutPaymentMethodSheet.swift b/submodules/TelegramUI/TelegramUI/BotCheckoutPaymentMethodSheet.swift index 6d6e01be03..630da03eb4 100644 --- a/submodules/TelegramUI/TelegramUI/BotCheckoutPaymentMethodSheet.swift +++ b/submodules/TelegramUI/TelegramUI/BotCheckoutPaymentMethodSheet.swift @@ -4,6 +4,7 @@ import Display import AsyncDisplayKit import SwiftSignalKit import TelegramCore +import AccountContext struct BotCheckoutPaymentWebToken: Equatable { let title: String @@ -34,7 +35,7 @@ enum BotCheckoutPaymentMethod: Equatable { final class BotCheckoutPaymentMethodSheetController: ActionSheetController { private var presentationDisposable: Disposable? - init(context: AccountContextImpl, 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 theme = presentationData.theme let strings = presentationData.strings diff --git a/submodules/TelegramUI/TelegramUI/BotCheckoutPaymentShippingOptionSheetController.swift b/submodules/TelegramUI/TelegramUI/BotCheckoutPaymentShippingOptionSheetController.swift index e2e6f32163..181b4fe09e 100644 --- a/submodules/TelegramUI/TelegramUI/BotCheckoutPaymentShippingOptionSheetController.swift +++ b/submodules/TelegramUI/TelegramUI/BotCheckoutPaymentShippingOptionSheetController.swift @@ -4,11 +4,12 @@ import Display import AsyncDisplayKit import SwiftSignalKit import TelegramCore +import AccountContext final class BotCheckoutPaymentShippingOptionSheetController: ActionSheetController { private var presentationDisposable: Disposable? - init(context: AccountContextImpl, currency: String, options: [BotPaymentShippingOption], currentId: String?, applyValue: @escaping (String) -> Void) { + init(context: AccountContext, currency: String, options: [BotPaymentShippingOption], currentId: String?, applyValue: @escaping (String) -> Void) { let presentationData = context.sharedContext.currentPresentationData.with { $0 } let theme = presentationData.theme let strings = presentationData.strings diff --git a/submodules/TelegramUI/TelegramUI/BotCheckoutWebInteractionController.swift b/submodules/TelegramUI/TelegramUI/BotCheckoutWebInteractionController.swift index 42e572a60c..42c385472c 100644 --- a/submodules/TelegramUI/TelegramUI/BotCheckoutWebInteractionController.swift +++ b/submodules/TelegramUI/TelegramUI/BotCheckoutWebInteractionController.swift @@ -6,6 +6,7 @@ import TelegramCore import SwiftSignalKit import Postbox import TelegramPresentationData +import AccountContext enum BotCheckoutWebInteractionControllerIntent { case addPaymentMethod((BotCheckoutPaymentWebToken) -> Void) @@ -17,7 +18,7 @@ final class BotCheckoutWebInteractionController: ViewController { return self.displayNode as! BotCheckoutWebInteractionControllerNode } - private let context: AccountContextImpl + private let context: AccountContext private let url: String private let intent: BotCheckoutWebInteractionControllerIntent @@ -25,7 +26,7 @@ final class BotCheckoutWebInteractionController: ViewController { private var didPlayPresentationAnimation = false - init(context: AccountContextImpl, url: String, intent: BotCheckoutWebInteractionControllerIntent) { + init(context: AccountContext, url: String, intent: BotCheckoutWebInteractionControllerIntent) { self.context = context self.url = url self.intent = intent diff --git a/submodules/TelegramUI/TelegramUI/BotReceiptController.swift b/submodules/TelegramUI/TelegramUI/BotReceiptController.swift index 426c3467b3..280fe38a74 100644 --- a/submodules/TelegramUI/TelegramUI/BotReceiptController.swift +++ b/submodules/TelegramUI/TelegramUI/BotReceiptController.swift @@ -6,6 +6,7 @@ import TelegramCore import SwiftSignalKit import Postbox import TelegramPresentationData +import AccountContext final class BotReceiptController: ViewController { private var controllerNode: BotReceiptControllerNode { @@ -17,7 +18,7 @@ final class BotReceiptController: ViewController { return self._ready } - private let context: AccountContextImpl + private let context: AccountContext private let invoice: TelegramMediaInvoice private let messageId: MessageId @@ -25,7 +26,7 @@ final class BotReceiptController: ViewController { private var didPlayPresentationAnimation = false - init(context: AccountContextImpl, invoice: TelegramMediaInvoice, messageId: MessageId) { + init(context: AccountContext, invoice: TelegramMediaInvoice, messageId: MessageId) { self.context = context self.invoice = invoice self.messageId = messageId diff --git a/submodules/TelegramUI/TelegramUI/BotReceiptControllerNode.swift b/submodules/TelegramUI/TelegramUI/BotReceiptControllerNode.swift index fe7626f7bb..ecc293a882 100644 --- a/submodules/TelegramUI/TelegramUI/BotReceiptControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/BotReceiptControllerNode.swift @@ -7,6 +7,7 @@ import TelegramCore import SwiftSignalKit import TelegramPresentationData import ItemListUI +import AccountContext final class BotReceiptControllerArguments { fileprivate let account: Account @@ -252,7 +253,7 @@ private func availablePaymentMethods(current: BotCheckoutPaymentMethod?) -> [Bot } final class BotReceiptControllerNode: ItemListControllerNode { - private let context: AccountContextImpl + private let context: AccountContext private let dismissAnimated: () -> Void private var presentationData: PresentationData @@ -262,7 +263,7 @@ final class BotReceiptControllerNode: ItemListControllerNode { private let actionButton: BotCheckoutActionButton - init(controller: ItemListController?, navigationBar: NavigationBar, updateNavigationOffset: @escaping (CGFloat) -> Void, context: AccountContextImpl, invoice: TelegramMediaInvoice, messageId: MessageId, dismissAnimated: @escaping () -> Void) { + init(controller: ItemListController?, navigationBar: NavigationBar, updateNavigationOffset: @escaping (CGFloat) -> Void, context: AccountContext, invoice: TelegramMediaInvoice, messageId: MessageId, dismissAnimated: @escaping () -> Void) { self.context = context self.dismissAnimated = dismissAnimated diff --git a/submodules/TelegramUI/TelegramUI/CachedFaqInstantPage.swift b/submodules/TelegramUI/TelegramUI/CachedFaqInstantPage.swift index 0fba30a5d1..ad01642d21 100644 --- a/submodules/TelegramUI/TelegramUI/CachedFaqInstantPage.swift +++ b/submodules/TelegramUI/TelegramUI/CachedFaqInstantPage.swift @@ -2,6 +2,7 @@ import Foundation import SwiftSignalKit import Postbox import TelegramCore +import AccountContext private func extractAnchor(string: String) -> (String, String?) { var anchorValue: String? @@ -23,7 +24,7 @@ private func extractAnchor(string: String) -> (String, String?) { private let refreshTimeout: Int32 = 60 * 60 * 12 -func cachedFaqInstantPage(context: AccountContextImpl) -> Signal { +func cachedFaqInstantPage(context: AccountContext) -> Signal { var faqUrl = context.sharedContext.currentPresentationData.with { $0 }.strings.Settings_FAQ_URL if faqUrl == "Settings.FAQ_URL" || faqUrl.isEmpty { faqUrl = "https://telegram.org/faq#general-questions" @@ -66,7 +67,7 @@ func cachedFaqInstantPage(context: AccountContextImpl) -> Signal Signal<[SettingsSearchableItem], NoError> { +func faqSearchableItems(context: AccountContext) -> Signal<[SettingsSearchableItem], NoError> { let strings = context.sharedContext.currentPresentationData.with { $0 }.strings return cachedFaqInstantPage(context: context) |> map { resolvedUrl -> [SettingsSearchableItem] in diff --git a/submodules/TelegramUI/TelegramUI/CallController.swift b/submodules/TelegramUI/TelegramUI/CallController.swift index 82c8e80598..0adb4cfad5 100644 --- a/submodules/TelegramUI/TelegramUI/CallController.swift +++ b/submodules/TelegramUI/TelegramUI/CallController.swift @@ -10,6 +10,7 @@ import TelegramUIPreferences import TelegramVoip import TelegramCallsUI import TelegramAudio +import AccountContext public final class CallController: ViewController { private var controllerNode: CallControllerNode { @@ -21,7 +22,7 @@ public final class CallController: ViewController { return self._ready } - private let sharedContext: SharedAccountContextImpl + private let sharedContext: SharedAccountContext private let account: Account public let call: PresentationCall @@ -41,7 +42,7 @@ public final class CallController: ViewController { private var audioOutputStateDisposable: Disposable? private var audioOutputState: ([AudioSessionOutput], AudioSessionOutput?)? - public init(sharedContext: SharedAccountContextImpl, account: Account, call: PresentationCall) { + public init(sharedContext: SharedAccountContext, account: Account, call: PresentationCall) { self.sharedContext = sharedContext self.account = account self.call = call diff --git a/submodules/TelegramUI/TelegramUI/CallControllerNode.swift b/submodules/TelegramUI/TelegramUI/CallControllerNode.swift index e80718588a..a8026659dc 100644 --- a/submodules/TelegramUI/TelegramUI/CallControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/CallControllerNode.swift @@ -10,9 +10,10 @@ import TelegramUIPrivateModule import TelegramPresentationData import TelegramUIPreferences import TelegramAudio +import AccountContext final class CallControllerNode: ASDisplayNode { - private let sharedContext: SharedAccountContextImpl + private let sharedContext: SharedAccountContext private let account: Account private let statusBar: StatusBar @@ -60,7 +61,7 @@ final class CallControllerNode: ASDisplayNode { var callEnded: ((Bool) -> Void)? var dismissedInteractively: (() -> Void)? - init(sharedContext: SharedAccountContextImpl, account: Account, presentationData: PresentationData, statusBar: StatusBar, debugInfo: Signal<(String, String), NoError>, shouldStayHiddenUntilConnection: Bool = false) { + init(sharedContext: SharedAccountContext, account: Account, presentationData: PresentationData, statusBar: StatusBar, debugInfo: Signal<(String, String), NoError>, shouldStayHiddenUntilConnection: Bool = false) { self.sharedContext = sharedContext self.account = account self.presentationData = presentationData diff --git a/submodules/TelegramUI/TelegramUI/CallFeedbackController.swift b/submodules/TelegramUI/TelegramUI/CallFeedbackController.swift index fba56e67a6..e877128d18 100644 --- a/submodules/TelegramUI/TelegramUI/CallFeedbackController.swift +++ b/submodules/TelegramUI/TelegramUI/CallFeedbackController.swift @@ -6,6 +6,8 @@ import Postbox import TelegramCore import TelegramPresentationData import ItemListUI +import OverlayStatusController +import AccountContext private enum CallFeedbackReason: Int32, CaseIterable { case echo @@ -207,7 +209,7 @@ private func callFeedbackControllerEntries(theme: PresentationTheme, strings: Pr return entries } -public func callFeedbackController(sharedContext: SharedAccountContextImpl, account: Account, callId: CallId, rating: Int, userInitiated: Bool) -> ViewController { +public func callFeedbackController(sharedContext: SharedAccountContext, account: Account, callId: CallId, rating: Int, userInitiated: Bool) -> ViewController { let initialState = CallFeedbackState() let statePromise = ValuePromise(initialState, ignoreRepeated: true) let stateValue = Atomic(value: initialState) diff --git a/submodules/TelegramUI/TelegramUI/CallListCallItem.swift b/submodules/TelegramUI/TelegramUI/CallListCallItem.swift index ac8eb76f41..af0bf0d125 100644 --- a/submodules/TelegramUI/TelegramUI/CallListCallItem.swift +++ b/submodules/TelegramUI/TelegramUI/CallListCallItem.swift @@ -7,6 +7,8 @@ import SwiftSignalKit import TelegramCore import TelegramPresentationData import ItemListUI +import AvatarNode +import TelegramStringFormatting private let titleFont = Font.regular(17.0) private let statusFont = Font.regular(14.0) diff --git a/submodules/TelegramUI/TelegramUI/CallListController.swift b/submodules/TelegramUI/TelegramUI/CallListController.swift index 5bff7fc8c5..01e949c1bb 100644 --- a/submodules/TelegramUI/TelegramUI/CallListController.swift +++ b/submodules/TelegramUI/TelegramUI/CallListController.swift @@ -7,6 +7,7 @@ import TelegramCore import SwiftSignalKit import TelegramPresentationData import ItemListUI +import AccountContext public enum CallListControllerMode { case tab @@ -23,7 +24,7 @@ public final class CallListController: ViewController { return self._ready } - private let context: AccountContextImpl + private let context: AccountContext private let mode: CallListControllerMode private var presentationData: PresentationData @@ -38,7 +39,7 @@ public final class CallListController: ViewController { private let createActionDisposable = MetaDisposable() - public init(context: AccountContextImpl, mode: CallListControllerMode) { + public init(context: AccountContext, mode: CallListControllerMode) { self.context = context self.mode = mode self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/CallListControllerNode.swift b/submodules/TelegramUI/TelegramUI/CallListControllerNode.swift index 3988aca6cc..554119e450 100644 --- a/submodules/TelegramUI/TelegramUI/CallListControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/CallListControllerNode.swift @@ -8,6 +8,7 @@ import SwiftSignalKit import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext private struct CallListNodeListViewTransition { let callListView: CallListNodeView @@ -156,7 +157,7 @@ private final class CallListOpaqueTransactionState { } final class CallListControllerNode: ASDisplayNode { - private let context: AccountContextImpl + private let context: AccountContext private let mode: CallListControllerMode private var presentationData: PresentationData @@ -195,7 +196,7 @@ final class CallListControllerNode: ASDisplayNode { private let emptyStatePromise = Promise() private let emptyStateDisposable = MetaDisposable() - init(context: AccountContextImpl, mode: CallListControllerMode, presentationData: PresentationData, call: @escaping (PeerId) -> Void, openInfo: @escaping (PeerId, [Message]) -> Void, emptyStateUpdated: @escaping (Bool) -> Void) { + init(context: AccountContext, mode: CallListControllerMode, presentationData: PresentationData, call: @escaping (PeerId) -> Void, openInfo: @escaping (PeerId, [Message]) -> Void, emptyStateUpdated: @escaping (Bool) -> Void) { self.context = context self.mode = mode self.presentationData = presentationData diff --git a/submodules/TelegramUI/TelegramUI/CallRatingController.swift b/submodules/TelegramUI/TelegramUI/CallRatingController.swift index ccdd9a1c71..35b4ca5681 100644 --- a/submodules/TelegramUI/TelegramUI/CallRatingController.swift +++ b/submodules/TelegramUI/TelegramUI/CallRatingController.swift @@ -7,6 +7,7 @@ import Postbox import TelegramCore import TelegramPresentationData import TelegramVoip +import AccountContext private final class CallRatingAlertContentNode: AlertContentNode { private let strings: PresentationStrings @@ -263,7 +264,7 @@ func rateCallAndSendLogs(account: Account, callId: CallId, starsCount: Int, comm } } -func callRatingController(sharedContext: SharedAccountContextImpl, account: Account, callId: CallId, userInitiated: Bool, present: @escaping (ViewController, Any) -> Void) -> AlertController { +func callRatingController(sharedContext: SharedAccountContext, account: Account, callId: CallId, userInitiated: Bool, present: @escaping (ViewController, Any) -> Void) -> AlertController { let presentationData = sharedContext.currentPresentationData.with { $0 } let theme = presentationData.theme let strings = presentationData.strings diff --git a/submodules/TelegramUI/TelegramUI/CallSuggestTabController.swift b/submodules/TelegramUI/TelegramUI/CallSuggestTabController.swift index 18ad26c7d6..fbfcf10b01 100644 --- a/submodules/TelegramUI/TelegramUI/CallSuggestTabController.swift +++ b/submodules/TelegramUI/TelegramUI/CallSuggestTabController.swift @@ -7,6 +7,7 @@ import Postbox import TelegramCore import TelegramPresentationData import TelegramUIPreferences +import AccountContext private func generateIconImage(theme: AlertControllerTheme) -> UIImage? { return UIImage(bundleImageName: "Call List/AlertIcon") @@ -200,7 +201,7 @@ private final class CallSuggestTabAlertContentNode: AlertContentNode { } } -func callSuggestTabController(sharedContext: SharedAccountContextImpl) -> AlertController { +func callSuggestTabController(sharedContext: SharedAccountContext) -> AlertController { let presentationData = sharedContext.currentPresentationData.with { $0 } let theme = presentationData.theme let strings = presentationData.strings diff --git a/submodules/TelegramUI/TelegramUI/ChangePhoneNumberCodeController.swift b/submodules/TelegramUI/TelegramUI/ChangePhoneNumberCodeController.swift index 4beec55aa8..934e059499 100644 --- a/submodules/TelegramUI/TelegramUI/ChangePhoneNumberCodeController.swift +++ b/submodules/TelegramUI/TelegramUI/ChangePhoneNumberCodeController.swift @@ -6,6 +6,8 @@ import Postbox import TelegramCore import TelegramPresentationData import ItemListUI +import OverlayStatusController +import AccountContext private final class ChangePhoneNumberCodeControllerArguments { let updateEntryText: (String) -> Void @@ -171,7 +173,7 @@ protocol ChangePhoneNumberCodeController: class { private final class ChangePhoneNumberCodeControllerImpl: ItemListController, ChangePhoneNumberCodeController { private let applyCodeImpl: (Int) -> Void - init(context: AccountContextImpl, state: Signal<(ItemListControllerState, (ItemListNodeState, ChangePhoneNumberCodeEntry.ItemGenerationArguments)), NoError>, applyCodeImpl: @escaping (Int) -> Void) { + init(context: AccountContext, state: Signal<(ItemListControllerState, (ItemListNodeState, ChangePhoneNumberCodeEntry.ItemGenerationArguments)), NoError>, applyCodeImpl: @escaping (Int) -> Void) { self.applyCodeImpl = applyCodeImpl let presentationData = context.sharedContext.currentPresentationData.with { $0 } @@ -187,7 +189,7 @@ private final class ChangePhoneNumberCodeControllerImpl: ItemListController ViewController { +func changePhoneNumberCodeController(context: AccountContext, phoneNumber: String, codeData: ChangeAccountPhoneNumberData) -> ViewController { let initialState = ChangePhoneNumberCodeControllerState(codeText: "", checking: false) let statePromise = ValuePromise(initialState, ignoreRepeated: true) diff --git a/submodules/TelegramUI/TelegramUI/ChangePhoneNumberController.swift b/submodules/TelegramUI/TelegramUI/ChangePhoneNumberController.swift index b280c0d0db..29f3dc9025 100644 --- a/submodules/TelegramUI/TelegramUI/ChangePhoneNumberController.swift +++ b/submodules/TelegramUI/TelegramUI/ChangePhoneNumberController.swift @@ -6,13 +6,14 @@ import TelegramCore import SwiftSignalKit import TelegramPresentationData import ProgressNavigationButtonNode +import AccountContext final class ChangePhoneNumberController: ViewController { private var controllerNode: ChangePhoneNumberControllerNode { return self.displayNode as! ChangePhoneNumberControllerNode } - private let context: AccountContextImpl + private let context: AccountContext private var currentData: (Int32, String?, String)? private let requestDisposable = MetaDisposable() @@ -34,7 +35,7 @@ final class ChangePhoneNumberController: ViewController { private var presentationData: PresentationData - init(context: AccountContextImpl) { + init(context: AccountContext) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/ChangePhoneNumberIntroController.swift b/submodules/TelegramUI/TelegramUI/ChangePhoneNumberIntroController.swift index bf550f1322..57816b4085 100644 --- a/submodules/TelegramUI/TelegramUI/ChangePhoneNumberIntroController.swift +++ b/submodules/TelegramUI/TelegramUI/ChangePhoneNumberIntroController.swift @@ -5,6 +5,7 @@ import AsyncDisplayKit import TelegramCore import TelegramPresentationData import TextFormat +import AccountContext private final class ChangePhoneNumberIntroControllerNode: ASDisplayNode { var presentationData: PresentationData @@ -79,12 +80,12 @@ private final class ChangePhoneNumberIntroControllerNode: ASDisplayNode { } final class ChangePhoneNumberIntroController: ViewController { - private let context: AccountContextImpl + private let context: AccountContext private var didPlayPresentationAnimation = false private var presentationData: PresentationData - init(context: AccountContextImpl, phoneNumber: String) { + init(context: AccountContext, phoneNumber: String) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/ChannelAdminController.swift b/submodules/TelegramUI/TelegramUI/ChannelAdminController.swift index 5c5f96d59d..0a95adf375 100644 --- a/submodules/TelegramUI/TelegramUI/ChannelAdminController.swift +++ b/submodules/TelegramUI/TelegramUI/ChannelAdminController.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import TelegramPresentationData import ItemListUI +import AccountContext private let rankMaxLength: Int32 = 16 @@ -743,7 +744,7 @@ private func channelAdminControllerEntries(presentationData: PresentationData, s return entries } -public func channelAdminController(context: AccountContextImpl, peerId: PeerId, adminId: PeerId, initialParticipant: ChannelParticipant?, updated: @escaping (TelegramChatAdminRights) -> Void, upgradedToSupergroup: @escaping (PeerId, @escaping () -> Void) -> Void, transferedOwnership: @escaping (PeerId) -> Void) -> ViewController { +public func channelAdminController(context: AccountContext, peerId: PeerId, adminId: PeerId, initialParticipant: ChannelParticipant?, updated: @escaping (TelegramChatAdminRights) -> Void, upgradedToSupergroup: @escaping (PeerId, @escaping () -> Void) -> Void, transferedOwnership: @escaping (PeerId) -> Void) -> ViewController { let statePromise = ValuePromise(ChannelAdminControllerState(), ignoreRepeated: true) let stateValue = Atomic(value: ChannelAdminControllerState()) let updateState: ((ChannelAdminControllerState) -> ChannelAdminControllerState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/ChannelAdminsController.swift b/submodules/TelegramUI/TelegramUI/ChannelAdminsController.swift index 4a4559987b..4a0578eed8 100644 --- a/submodules/TelegramUI/TelegramUI/ChannelAdminsController.swift +++ b/submodules/TelegramUI/TelegramUI/ChannelAdminsController.swift @@ -7,6 +7,8 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext +import TemporaryCachedPeerDataManager private final class ChannelAdminsControllerArguments { let account: Account @@ -479,7 +481,7 @@ private func channelAdminsControllerEntries(presentationData: PresentationData, return entries } -public func channelAdminsController(context: AccountContextImpl, peerId: PeerId, loadCompleted: @escaping () -> Void = {}) -> ViewController { +public func channelAdminsController(context: AccountContext, peerId: PeerId, loadCompleted: @escaping () -> Void = {}) -> ViewController { let statePromise = ValuePromise(ChannelAdminsControllerState(), ignoreRepeated: true) let stateValue = Atomic(value: ChannelAdminsControllerState()) let updateState: ((ChannelAdminsControllerState) -> ChannelAdminsControllerState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/ChannelBannedMemberController.swift b/submodules/TelegramUI/TelegramUI/ChannelBannedMemberController.swift index 2b3558b570..83176288f6 100644 --- a/submodules/TelegramUI/TelegramUI/ChannelBannedMemberController.swift +++ b/submodules/TelegramUI/TelegramUI/ChannelBannedMemberController.swift @@ -6,6 +6,9 @@ import Postbox import TelegramCore import TelegramPresentationData import ItemListUI +import TelegramStringFormatting +import OverlayStatusController +import AccountContext private final class ChannelBannedMemberControllerArguments { let account: Account @@ -368,7 +371,7 @@ private func channelBannedMemberControllerEntries(presentationData: Presentation return entries } -public func channelBannedMemberController(context: AccountContextImpl, peerId: PeerId, memberId: PeerId, initialParticipant: ChannelParticipant?, updated: @escaping (TelegramChatBannedRights?) -> Void, upgradedToSupergroup: @escaping (PeerId, @escaping () -> Void) -> Void) -> ViewController { +public func channelBannedMemberController(context: AccountContext, peerId: PeerId, memberId: PeerId, initialParticipant: ChannelParticipant?, updated: @escaping (TelegramChatBannedRights?) -> Void, upgradedToSupergroup: @escaping (PeerId, @escaping () -> Void) -> Void) -> ViewController { let initialState = ChannelBannedMemberControllerState(referenceTimestamp: Int32(Date().timeIntervalSince1970), updatedFlags: nil, updatedTimeout: nil, updating: false) let statePromise = ValuePromise(initialState, ignoreRepeated: true) let stateValue = Atomic(value: initialState) diff --git a/submodules/TelegramUI/TelegramUI/ChannelBlacklistController.swift b/submodules/TelegramUI/TelegramUI/ChannelBlacklistController.swift index 1d492e20d6..a10612f7c0 100644 --- a/submodules/TelegramUI/TelegramUI/ChannelBlacklistController.swift +++ b/submodules/TelegramUI/TelegramUI/ChannelBlacklistController.swift @@ -7,6 +7,8 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import OverlayStatusController +import AccountContext private final class ChannelBlacklistControllerArguments { let account: Account @@ -260,7 +262,7 @@ private func channelBlacklistControllerEntries(presentationData: PresentationDat return entries } -public func channelBlacklistController(context: AccountContextImpl, peerId: PeerId) -> ViewController { +public func channelBlacklistController(context: AccountContext, peerId: PeerId) -> ViewController { let statePromise = ValuePromise(ChannelBlacklistControllerState(referenceTimestamp: Int32(Date().timeIntervalSince1970)), ignoreRepeated: true) let stateValue = Atomic(value: ChannelBlacklistControllerState(referenceTimestamp: Int32(Date().timeIntervalSince1970))) let updateState: ((ChannelBlacklistControllerState) -> ChannelBlacklistControllerState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/ChannelDiscussionGroupActionSheetItem.swift b/submodules/TelegramUI/TelegramUI/ChannelDiscussionGroupActionSheetItem.swift index 0dbb49edf2..c4089b0c03 100644 --- a/submodules/TelegramUI/TelegramUI/ChannelDiscussionGroupActionSheetItem.swift +++ b/submodules/TelegramUI/TelegramUI/ChannelDiscussionGroupActionSheetItem.swift @@ -6,14 +6,16 @@ import Display import Postbox import TelegramCore import TelegramPresentationData +import AvatarNode +import AccountContext final class ChannelDiscussionGroupActionSheetItem: ActionSheetItem { - let context: AccountContextImpl + let context: AccountContext let channelPeer: Peer let groupPeer: Peer let strings: PresentationStrings - init(context: AccountContextImpl, channelPeer: Peer, groupPeer: Peer, strings: PresentationStrings) { + init(context: AccountContext, channelPeer: Peer, groupPeer: Peer, strings: PresentationStrings) { self.context = context self.channelPeer = channelPeer self.groupPeer = groupPeer @@ -38,7 +40,7 @@ private final class ChannelDiscussionGroupActionSheetItemNode: ActionSheetItemNo private let groupAvatarNode: AvatarNode private let textNode: ImmediateTextNode - init(theme: ActionSheetControllerTheme, context: AccountContextImpl, channelPeer: Peer, groupPeer: Peer, strings: PresentationStrings) { + init(theme: ActionSheetControllerTheme, context: AccountContext, channelPeer: Peer, groupPeer: Peer, strings: PresentationStrings) { self.theme = theme self.channelAvatarNode = AvatarNode(font: avatarFont) diff --git a/submodules/TelegramUI/TelegramUI/ChannelDiscussionGroupSearchContainerNode.swift b/submodules/TelegramUI/TelegramUI/ChannelDiscussionGroupSearchContainerNode.swift index 9ffa00e41b..75a5d7fad1 100644 --- a/submodules/TelegramUI/TelegramUI/ChannelDiscussionGroupSearchContainerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChannelDiscussionGroupSearchContainerNode.swift @@ -8,6 +8,7 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import MergeLists +import AccountContext private enum ChannelDiscussionGroupSearchContent: Equatable { case peer(Peer) @@ -95,7 +96,7 @@ private struct ChannelDiscussionGroupSearchContainerState: Equatable { } final class ChannelDiscussionGroupSearchContainerNode: SearchDisplayControllerContentNode { - private let context: AccountContextImpl + private let context: AccountContext private let openPeer: (Peer) -> Void private let dimNode: ASDisplayNode @@ -112,7 +113,7 @@ final class ChannelDiscussionGroupSearchContainerNode: SearchDisplayControllerCo private let themeAndStringsPromise: Promise<(PresentationTheme, PresentationStrings, PresentationPersonNameOrder, PresentationPersonNameOrder, PresentationDateTimeFormat)> - init(context: AccountContextImpl, peers: [Peer], openPeer: @escaping (Peer) -> Void) { + init(context: AccountContext, peers: [Peer], openPeer: @escaping (Peer) -> Void) { self.context = context self.openPeer = openPeer diff --git a/submodules/TelegramUI/TelegramUI/ChannelDiscussionGroupSetupController.swift b/submodules/TelegramUI/TelegramUI/ChannelDiscussionGroupSetupController.swift index 46b8d0bb38..0e3b508be4 100644 --- a/submodules/TelegramUI/TelegramUI/ChannelDiscussionGroupSetupController.swift +++ b/submodules/TelegramUI/TelegramUI/ChannelDiscussionGroupSetupController.swift @@ -7,6 +7,8 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import OverlayStatusController +import AccountContext private final class ChannelDiscussionGroupSetupControllerArguments { let account: Account @@ -198,7 +200,7 @@ private struct ChannelDiscussionGroupSetupControllerState: Equatable { var searching: Bool = false } -public func channelDiscussionGroupSetupController(context: AccountContextImpl, peerId: PeerId) -> ViewController { +public func channelDiscussionGroupSetupController(context: AccountContext, peerId: PeerId) -> ViewController { let statePromise = ValuePromise(ChannelDiscussionGroupSetupControllerState(), ignoreRepeated: true) let stateValue = Atomic(value: ChannelDiscussionGroupSetupControllerState()) let updateState: ((ChannelDiscussionGroupSetupControllerState) -> ChannelDiscussionGroupSetupControllerState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/ChannelDiscussionGroupSetupSearchItem.swift b/submodules/TelegramUI/TelegramUI/ChannelDiscussionGroupSetupSearchItem.swift index 6eff16a1b5..df8da02ac5 100644 --- a/submodules/TelegramUI/TelegramUI/ChannelDiscussionGroupSetupSearchItem.swift +++ b/submodules/TelegramUI/TelegramUI/ChannelDiscussionGroupSetupSearchItem.swift @@ -7,15 +7,16 @@ import TelegramCore import SwiftSignalKit import TelegramPresentationData import ItemListUI +import AccountContext final class ChannelDiscussionGroupSetupSearchItem: ItemListControllerSearch { - let context: AccountContextImpl + let context: AccountContext let peers: [Peer] let cancel: () -> Void let dismissInput: () -> Void let openPeer: (Peer) -> Void - init(context: AccountContextImpl, peers: [Peer], cancel: @escaping () -> Void, dismissInput: @escaping () -> Void, openPeer: @escaping (Peer) -> Void) { + init(context: AccountContext, peers: [Peer], cancel: @escaping () -> Void, dismissInput: @escaping () -> Void, openPeer: @escaping (Peer) -> Void) { self.context = context self.peers = peers self.cancel = cancel @@ -57,7 +58,7 @@ final class ChannelDiscussionGroupSetupSearchItem: ItemListControllerSearch { private final class ChannelDiscussionGroupSetupSearchItemNode: ItemListControllerSearchNode { private let containerNode: ChannelDiscussionGroupSearchContainerNode - init(context: AccountContextImpl, peers: [Peer], openPeer: @escaping (Peer) -> Void, cancel: @escaping () -> Void, updateActivity: @escaping (Bool) -> Void, dismissInput: @escaping () -> Void) { + init(context: AccountContext, peers: [Peer], openPeer: @escaping (Peer) -> Void, cancel: @escaping () -> Void, updateActivity: @escaping (Bool) -> Void, dismissInput: @escaping () -> Void) { self.containerNode = ChannelDiscussionGroupSearchContainerNode(context: context, peers: peers, openPeer: { peer in openPeer(peer) }) diff --git a/submodules/TelegramUI/TelegramUI/ChannelInfoController.swift b/submodules/TelegramUI/TelegramUI/ChannelInfoController.swift index 7e1b07dc17..f0f6f0b0cb 100644 --- a/submodules/TelegramUI/TelegramUI/ChannelInfoController.swift +++ b/submodules/TelegramUI/TelegramUI/ChannelInfoController.swift @@ -10,6 +10,8 @@ import TelegramPresentationData import ItemListUI import AccountContext import TextFormat +import OverlayStatusController +import TelegramStringFormatting private final class ChannelInfoControllerArguments { let account: Account @@ -627,7 +629,7 @@ private func valuesRequiringUpdate(state: ChannelInfoState, view: PeerView) -> ( } } -public func channelInfoController(context: AccountContextImpl, peerId: PeerId) -> ViewController { +public func channelInfoController(context: AccountContext, peerId: PeerId) -> ViewController { let statePromise = ValuePromise(ChannelInfoState(), ignoreRepeated: true) let stateValue = Atomic(value: ChannelInfoState()) let updateState: ((ChannelInfoState) -> ChannelInfoState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/ChannelMembersController.swift b/submodules/TelegramUI/TelegramUI/ChannelMembersController.swift index de6c498f97..0b0ccd9adf 100644 --- a/submodules/TelegramUI/TelegramUI/ChannelMembersController.swift +++ b/submodules/TelegramUI/TelegramUI/ChannelMembersController.swift @@ -7,6 +7,7 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext private final class ChannelMembersControllerArguments { let account: Account @@ -255,7 +256,7 @@ private struct ChannelMembersControllerState: Equatable { } } -private func ChannelMembersControllerEntries(context: AccountContextImpl, presentationData: PresentationData, view: PeerView, state: ChannelMembersControllerState, participants: [RenderedChannelParticipant]?) -> [ChannelMembersEntry] { +private func ChannelMembersControllerEntries(context: AccountContext, presentationData: PresentationData, view: PeerView, state: ChannelMembersControllerState, participants: [RenderedChannelParticipant]?) -> [ChannelMembersEntry] { if participants == nil || participants?.count == nil { return [] } @@ -323,7 +324,7 @@ private func ChannelMembersControllerEntries(context: AccountContextImpl, presen return entries } -public func channelMembersController(context: AccountContextImpl, peerId: PeerId) -> ViewController { +public func channelMembersController(context: AccountContext, peerId: PeerId) -> ViewController { let statePromise = ValuePromise(ChannelMembersControllerState(), ignoreRepeated: true) let stateValue = Atomic(value: ChannelMembersControllerState()) let updateState: ((ChannelMembersControllerState) -> ChannelMembersControllerState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/ChannelMembersSearchContainerNode.swift b/submodules/TelegramUI/TelegramUI/ChannelMembersSearchContainerNode.swift index 8908bc184c..27211778ac 100644 --- a/submodules/TelegramUI/TelegramUI/ChannelMembersSearchContainerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChannelMembersSearchContainerNode.swift @@ -8,6 +8,8 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import MergeLists +import AccountContext +import TemporaryCachedPeerDataManager enum ChannelMembersSearchMode { case searchMembers @@ -191,7 +193,7 @@ private enum GroupMemberCategory { case members } -private func categorySignal(context: AccountContextImpl, peerId: PeerId, category: GroupMemberCategory) -> Signal<[RenderedChannelParticipant], NoError> { +private func categorySignal(context: AccountContext, peerId: PeerId, category: GroupMemberCategory) -> Signal<[RenderedChannelParticipant], NoError> { return Signal<[RenderedChannelParticipant], NoError> { subscriber in let disposableAndLoadMoreControl: (Disposable, PeerChannelMemberCategoryControl?) func processListState(_ listState: ChannelMemberListState) { @@ -234,7 +236,7 @@ private struct GroupMembersSearchContextState { final class GroupMembersSearchContext { fileprivate let state = Promise() - init(context: AccountContextImpl, peerId: PeerId) { + init(context: AccountContext, peerId: PeerId) { assert(Queue.mainQueue().isCurrent()) let combinedSignal = combineLatest(queue: .mainQueue(), categorySignal(context: context, peerId: peerId, category: .contacts), categorySignal(context: context, peerId: peerId, category: .bots), categorySignal(context: context, peerId: peerId, category: .admins), categorySignal(context: context, peerId: peerId, category: .members)) @@ -268,7 +270,7 @@ private struct ChannelMembersSearchContainerState: Equatable { } final class ChannelMembersSearchContainerNode: SearchDisplayControllerContentNode { - private let context: AccountContextImpl + private let context: AccountContext private let openPeer: (Peer, RenderedChannelParticipant?) -> Void private let mode: ChannelMembersSearchMode @@ -290,7 +292,7 @@ final class ChannelMembersSearchContainerNode: SearchDisplayControllerContentNod private let themeAndStringsPromise: Promise<(PresentationTheme, PresentationStrings, PresentationPersonNameOrder, PresentationPersonNameOrder, PresentationDateTimeFormat)> - init(context: AccountContextImpl, peerId: PeerId, mode: ChannelMembersSearchMode, filters: [ChannelMembersSearchFilter], searchContext: GroupMembersSearchContext?, openPeer: @escaping (Peer, RenderedChannelParticipant?) -> Void, updateActivity: @escaping (Bool) -> Void, present: @escaping (ViewController, Any?) -> Void) { + init(context: AccountContext, peerId: PeerId, mode: ChannelMembersSearchMode, filters: [ChannelMembersSearchFilter], searchContext: GroupMembersSearchContext?, openPeer: @escaping (Peer, RenderedChannelParticipant?) -> Void, updateActivity: @escaping (Bool) -> Void, present: @escaping (ViewController, Any?) -> Void) { self.context = context self.openPeer = openPeer self.mode = mode diff --git a/submodules/TelegramUI/TelegramUI/ChannelMembersSearchController.swift b/submodules/TelegramUI/TelegramUI/ChannelMembersSearchController.swift index 85f60b1e55..ec76ab46b3 100644 --- a/submodules/TelegramUI/TelegramUI/ChannelMembersSearchController.swift +++ b/submodules/TelegramUI/TelegramUI/ChannelMembersSearchController.swift @@ -5,6 +5,7 @@ import TelegramCore import Postbox import SwiftSignalKit import TelegramPresentationData +import AccountContext enum ChannelMembersSearchControllerMode { case promote @@ -19,7 +20,7 @@ enum ChannelMembersSearchFilter { final class ChannelMembersSearchController: ViewController { private let queue = Queue() - private let context: AccountContextImpl + private let context: AccountContext private let peerId: PeerId private let mode: ChannelMembersSearchControllerMode private let filters: [ChannelMembersSearchFilter] @@ -35,7 +36,7 @@ final class ChannelMembersSearchController: ViewController { private var searchContentNode: NavigationBarSearchContentNode? - init(context: AccountContextImpl, peerId: PeerId, mode: ChannelMembersSearchControllerMode, filters: [ChannelMembersSearchFilter] = [], openPeer: @escaping (Peer, RenderedChannelParticipant?) -> Void) { + init(context: AccountContext, peerId: PeerId, mode: ChannelMembersSearchControllerMode, filters: [ChannelMembersSearchFilter] = [], openPeer: @escaping (Peer, RenderedChannelParticipant?) -> Void) { self.context = context self.peerId = peerId self.mode = mode diff --git a/submodules/TelegramUI/TelegramUI/ChannelMembersSearchControllerNode.swift b/submodules/TelegramUI/TelegramUI/ChannelMembersSearchControllerNode.swift index 64472e0c28..21d7238e3a 100644 --- a/submodules/TelegramUI/TelegramUI/ChannelMembersSearchControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChannelMembersSearchControllerNode.swift @@ -8,6 +8,8 @@ import SwiftSignalKit import TelegramPresentationData import TelegramUIPreferences import MergeLists +import AccountContext +import TemporaryCachedPeerDataManager private final class ChannelMembersSearchInteraction { let openPeer: (Peer, RenderedChannelParticipant?) -> Void @@ -87,7 +89,7 @@ private func preparedTransition(from fromEntries: [ChannelMembersSearchEntry]?, } class ChannelMembersSearchControllerNode: ASDisplayNode { - private let context: AccountContextImpl + private let context: AccountContext private let peerId: PeerId private let mode: ChannelMembersSearchControllerMode private let filters: [ChannelMembersSearchFilter] @@ -110,7 +112,7 @@ class ChannelMembersSearchControllerNode: ASDisplayNode { private var disposable: Disposable? private var listControl: PeerChannelMemberCategoryControl? - init(context: AccountContextImpl, presentationData: PresentationData, peerId: PeerId, mode: ChannelMembersSearchControllerMode, filters: [ChannelMembersSearchFilter]) { + init(context: AccountContext, presentationData: PresentationData, peerId: PeerId, mode: ChannelMembersSearchControllerMode, filters: [ChannelMembersSearchFilter]) { self.context = context self.listNode = ListView() self.peerId = peerId diff --git a/submodules/TelegramUI/TelegramUI/ChannelOwnershipTransferController.swift b/submodules/TelegramUI/TelegramUI/ChannelOwnershipTransferController.swift index 0a192358f1..c9d1ab783a 100644 --- a/submodules/TelegramUI/TelegramUI/ChannelOwnershipTransferController.swift +++ b/submodules/TelegramUI/TelegramUI/ChannelOwnershipTransferController.swift @@ -8,6 +8,7 @@ import TelegramCore import TelegramPresentationData import ActivityIndicator import TextFormat +import AccountContext private final class ChannelOwnershipTransferPasswordFieldNode: ASDisplayNode, UITextFieldDelegate { private var theme: PresentationTheme @@ -399,7 +400,7 @@ private final class ChannelOwnershipTransferAlertContentNode: AlertContentNode { } } -private func commitChannelOwnershipTransferController(context: AccountContextImpl, peer: Peer, member: TelegramUser, present: @escaping (ViewController, Any?) -> Void, completion: @escaping (PeerId?) -> Void) -> ViewController { +private func commitChannelOwnershipTransferController(context: AccountContext, peer: Peer, member: TelegramUser, present: @escaping (ViewController, Any?) -> Void, completion: @escaping (PeerId?) -> Void) -> ViewController { let presentationData = context.sharedContext.currentPresentationData.with { $0 } var dismissImpl: (() -> Void)? @@ -497,7 +498,7 @@ private func commitChannelOwnershipTransferController(context: AccountContextImp return controller } -private func confirmChannelOwnershipTransferController(context: AccountContextImpl, peer: Peer, member: TelegramUser, present: @escaping (ViewController, Any?) -> Void, completion: @escaping (PeerId?) -> Void) -> ViewController { +private func confirmChannelOwnershipTransferController(context: AccountContext, peer: Peer, member: TelegramUser, present: @escaping (ViewController, Any?) -> Void, completion: @escaping (PeerId?) -> Void) -> ViewController { let presentationData = context.sharedContext.currentPresentationData.with { $0 } let theme = AlertControllerTheme(presentationTheme: presentationData.theme) @@ -528,7 +529,7 @@ private func confirmChannelOwnershipTransferController(context: AccountContextIm return controller } -func channelOwnershipTransferController(context: AccountContextImpl, peer: Peer, member: TelegramUser, initialError: ChannelOwnershipTransferError, present: @escaping (ViewController, Any?) -> Void, completion: @escaping (PeerId?) -> Void) -> ViewController { +func channelOwnershipTransferController(context: AccountContext, peer: Peer, member: TelegramUser, initialError: ChannelOwnershipTransferError, present: @escaping (ViewController, Any?) -> Void, completion: @escaping (PeerId?) -> Void) -> ViewController { let presentationData = context.sharedContext.currentPresentationData.with { $0 } let theme = AlertControllerTheme(presentationTheme: presentationData.theme) diff --git a/submodules/TelegramUI/TelegramUI/ChannelPermissionsController.swift b/submodules/TelegramUI/TelegramUI/ChannelPermissionsController.swift index 670c580c65..1287cec99d 100644 --- a/submodules/TelegramUI/TelegramUI/ChannelPermissionsController.swift +++ b/submodules/TelegramUI/TelegramUI/ChannelPermissionsController.swift @@ -7,6 +7,9 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import OverlayStatusController +import AccountContext +import TemporaryCachedPeerDataManager private final class ChannelPermissionsControllerArguments { let account: Account @@ -446,7 +449,7 @@ private func channelPermissionsControllerEntries(presentationData: PresentationD return entries } -public func channelPermissionsController(context: AccountContextImpl, peerId originalPeerId: PeerId, loadCompleted: @escaping () -> Void = {}) -> ViewController { +public func channelPermissionsController(context: AccountContext, peerId originalPeerId: PeerId, loadCompleted: @escaping () -> Void = {}) -> ViewController { let statePromise = ValuePromise(ChannelPermissionsControllerState(), ignoreRepeated: true) let stateValue = Atomic(value: ChannelPermissionsControllerState()) let updateState: ((ChannelPermissionsControllerState) -> ChannelPermissionsControllerState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/ChannelStatsController.swift b/submodules/TelegramUI/TelegramUI/ChannelStatsController.swift index b3b8cc4277..5da8bc19eb 100644 --- a/submodules/TelegramUI/TelegramUI/ChannelStatsController.swift +++ b/submodules/TelegramUI/TelegramUI/ChannelStatsController.swift @@ -7,19 +7,20 @@ import SwiftSignalKit import Postbox import TelegramPresentationData import ProgressNavigationButtonNode +import AccountContext final class ChannelStatsController: ViewController { private var controllerNode: ChannelStatsControllerNode { return self.displayNode as! ChannelStatsControllerNode } - private let context: AccountContextImpl + private let context: AccountContext private let url: String private let peerId: PeerId private var presentationData: PresentationData - init(context: AccountContextImpl, url: String, peerId: PeerId) { + init(context: AccountContext, url: String, peerId: PeerId) { self.context = context self.url = url self.peerId = peerId diff --git a/submodules/TelegramUI/TelegramUI/ChannelStatsControllerNode.swift b/submodules/TelegramUI/TelegramUI/ChannelStatsControllerNode.swift index c029f27a93..d4fe29f707 100644 --- a/submodules/TelegramUI/TelegramUI/ChannelStatsControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChannelStatsControllerNode.swift @@ -7,11 +7,12 @@ import TelegramCore import Postbox import SwiftSignalKit import TelegramPresentationData +import AccountContext final class ChannelStatsControllerNode: ViewControllerTracingNode, WKNavigationDelegate { private var webView: WKWebView? - private let context: AccountContextImpl + private let context: AccountContext private let peerId: PeerId var presentationData: PresentationData private let present: (ViewController, Any?) -> Void @@ -19,7 +20,7 @@ final class ChannelStatsControllerNode: ViewControllerTracingNode, WKNavigationD private let refreshDisposable = MetaDisposable() - init(context: AccountContextImpl, presentationData: PresentationData, peerId: PeerId, url: String, present: @escaping (ViewController, Any?) -> Void, updateActivity: @escaping (Bool) -> Void) { + init(context: AccountContext, presentationData: PresentationData, peerId: PeerId, url: String, present: @escaping (ViewController, Any?) -> Void, updateActivity: @escaping (Bool) -> Void) { self.context = context self.presentationData = presentationData self.peerId = peerId diff --git a/submodules/TelegramUI/TelegramUI/ChannelVisibilityController.swift b/submodules/TelegramUI/TelegramUI/ChannelVisibilityController.swift index 4e07377c03..241a727a4b 100644 --- a/submodules/TelegramUI/TelegramUI/ChannelVisibilityController.swift +++ b/submodules/TelegramUI/TelegramUI/ChannelVisibilityController.swift @@ -7,6 +7,8 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import OverlayStatusController +import AccountContext private final class ChannelVisibilityControllerArguments { let account: Account @@ -795,7 +797,7 @@ public enum ChannelVisibilityControllerMode { case privateLink } -public func channelVisibilityController(context: AccountContextImpl, peerId: PeerId, mode: ChannelVisibilityControllerMode, upgradedToSupergroup: @escaping (PeerId, @escaping () -> Void) -> Void) -> ViewController { +public func channelVisibilityController(context: AccountContext, peerId: PeerId, mode: ChannelVisibilityControllerMode, upgradedToSupergroup: @escaping (PeerId, @escaping () -> Void) -> Void) -> ViewController { let statePromise = ValuePromise(ChannelVisibilityControllerState(), ignoreRepeated: true) let stateValue = Atomic(value: ChannelVisibilityControllerState()) let updateState: ((ChannelVisibilityControllerState) -> ChannelVisibilityControllerState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/ChatAnimationGalleryItem.swift b/submodules/TelegramUI/TelegramUI/ChatAnimationGalleryItem.swift index 3bb97eb68d..68750e6171 100644 --- a/submodules/TelegramUI/TelegramUI/ChatAnimationGalleryItem.swift +++ b/submodules/TelegramUI/TelegramUI/ChatAnimationGalleryItem.swift @@ -8,14 +8,15 @@ import TelegramCore import Lottie import TelegramPresentationData import AnimationUI +import AccountContext class ChatAnimationGalleryItem: GalleryItem { - let context: AccountContextImpl + let context: AccountContext let presentationData: PresentationData let message: Message let location: MessageHistoryEntryLocation? - init(context: AccountContextImpl, presentationData: PresentationData, message: Message, location: MessageHistoryEntryLocation?) { + init(context: AccountContext, presentationData: PresentationData, message: Message, location: MessageHistoryEntryLocation?) { self.context = context self.presentationData = presentationData self.message = message @@ -66,7 +67,7 @@ private var backgroundButtonIcon: UIImage = { }() final class ChatAnimationGalleryItemNode: ZoomableContentGalleryItemNode { - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private var message: Message? @@ -80,14 +81,14 @@ final class ChatAnimationGalleryItemNode: ZoomableContentGalleryItemNode { private let statusNode: RadialStatusNode private let footerContentNode: ChatItemGalleryFooterContentNode - private var contextAndMedia: (AccountContextImpl, AnyMediaReference)? + private var contextAndMedia: (AccountContext, AnyMediaReference)? private var disposable = MetaDisposable() private var fetchDisposable = MetaDisposable() private let statusDisposable = MetaDisposable() private var status: MediaResourceStatus? - init(context: AccountContextImpl, presentationData: PresentationData) { + init(context: AccountContext, presentationData: PresentationData) { self.context = context self.presentationData = presentationData @@ -132,7 +133,7 @@ final class ChatAnimationGalleryItemNode: ZoomableContentGalleryItemNode { self.footerContentNode.setMessage(message) } - func setFile(context: AccountContextImpl, fileReference: FileMediaReference) { + func setFile(context: AccountContext, fileReference: FileMediaReference) { if self.contextAndMedia == nil || !self.contextAndMedia!.1.media.isEqual(to: fileReference.media) { let signal = chatMessageAnimatedStrickerBackingData(postbox: context.account.postbox, fileReference: fileReference, synchronousLoad: false) |> mapToSignal { value -> Signal in diff --git a/submodules/TelegramUI/TelegramUI/ChatAvatarNavigationNode.swift b/submodules/TelegramUI/TelegramUI/ChatAvatarNavigationNode.swift index 03cd0acd59..24b080d8ff 100644 --- a/submodules/TelegramUI/TelegramUI/ChatAvatarNavigationNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatAvatarNavigationNode.swift @@ -2,6 +2,7 @@ import Foundation import UIKit import AsyncDisplayKit import Display +import AvatarNode private let normalFont = UIFont(name: ".SFCompactRounded-Semibold", size: 16.0)! private let smallFont = UIFont(name: ".SFCompactRounded-Semibold", size: 12.0)! diff --git a/submodules/TelegramUI/TelegramUI/ChatBubbleInstantVideoDecoration.swift b/submodules/TelegramUI/TelegramUI/ChatBubbleInstantVideoDecoration.swift index d2820b6046..41906db6c7 100644 --- a/submodules/TelegramUI/TelegramUI/ChatBubbleInstantVideoDecoration.swift +++ b/submodules/TelegramUI/TelegramUI/ChatBubbleInstantVideoDecoration.swift @@ -4,6 +4,7 @@ import AsyncDisplayKit import Display import SwiftSignalKit import UniversalMediaPlayer +import AccountContext final class ChatBubbleInstantVideoDecoration: UniversalVideoDecoration { let backgroundNode: ASDisplayNode? diff --git a/submodules/TelegramUI/TelegramUI/ChatBubbleVideoDecoration.swift b/submodules/TelegramUI/TelegramUI/ChatBubbleVideoDecoration.swift index 165328cedb..343f703fd5 100644 --- a/submodules/TelegramUI/TelegramUI/ChatBubbleVideoDecoration.swift +++ b/submodules/TelegramUI/TelegramUI/ChatBubbleVideoDecoration.swift @@ -4,6 +4,7 @@ import AsyncDisplayKit import Display import SwiftSignalKit import UniversalMediaPlayer +import AccountContext final class ChatBubbleVideoDecoration: UniversalVideoDecoration { private let nativeSize: CGSize diff --git a/submodules/TelegramUI/TelegramUI/ChatButtonKeyboardInputNode.swift b/submodules/TelegramUI/TelegramUI/ChatButtonKeyboardInputNode.swift index 38c55bc98c..4b6c27902a 100644 --- a/submodules/TelegramUI/TelegramUI/ChatButtonKeyboardInputNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatButtonKeyboardInputNode.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import SwiftSignalKit import TelegramPresentationData +import AccountContext private final class ChatButtonKeyboardInputButtonNode: ASButtonNode { var button: ReplyMarkupButton? @@ -29,7 +30,7 @@ private final class ChatButtonKeyboardInputButtonNode: ASButtonNode { } final class ChatButtonKeyboardInputNode: ChatInputNode { - private let context: AccountContextImpl + private let context: AccountContext private let controllerInteraction: ChatControllerInteraction private let separatorNode: ASDisplayNode @@ -40,7 +41,7 @@ final class ChatButtonKeyboardInputNode: ChatInputNode { private var theme: PresentationTheme? - init(context: AccountContextImpl, controllerInteraction: ChatControllerInteraction) { + init(context: AccountContext, controllerInteraction: ChatControllerInteraction) { self.context = context self.controllerInteraction = controllerInteraction diff --git a/submodules/TelegramUI/TelegramUI/ChatController.swift b/submodules/TelegramUI/TelegramUI/ChatController.swift index 423f83d38f..58e2baae9a 100644 --- a/submodules/TelegramUI/TelegramUI/ChatController.swift +++ b/submodules/TelegramUI/TelegramUI/ChatController.swift @@ -13,6 +13,11 @@ import TelegramPresentationData import TelegramUIPreferences import DeviceAccess import TextFormat +import TelegramBaseController +import AccountContext +import TelegramStringFormatting +import OverlayStatusController +import DeviceLocationManager public enum ChatControllerPeekActions { case standard @@ -101,7 +106,7 @@ private func calculateSlowmodeActiveUntilTimestamp(account: Account, untilTimest let ChatControllerCount = Atomic(value: 0) -public final class ChatController: TelegramController, GalleryHiddenMediaTarget, UIDropInteractionDelegate { +public final class ChatController: TelegramBaseController, GalleryHiddenMediaTarget, UIDropInteractionDelegate { private var validLayout: ContainerViewLayout? weak var parentController: ViewController? @@ -109,7 +114,7 @@ public final class ChatController: TelegramController, GalleryHiddenMediaTarget, public var peekActions: ChatControllerPeekActions = .standard private var didSetup3dTouch: Bool = false - private let context: AccountContextImpl + private let context: AccountContext public let chatLocation: ChatLocation private let messageId: MessageId? private let botStart: ChatControllerInitialBotStart? @@ -264,7 +269,7 @@ public final class ChatController: TelegramController, GalleryHiddenMediaTarget, var purposefulAction: (() -> Void)? - public init(context: AccountContextImpl, chatLocation: ChatLocation, messageId: MessageId? = nil, botStart: ChatControllerInitialBotStart? = nil, mode: ChatControllerPresentationMode = .standard(previewing: false)) { + public init(context: AccountContext, chatLocation: ChatLocation, messageId: MessageId? = nil, botStart: ChatControllerInitialBotStart? = nil, mode: ChatControllerPresentationMode = .standard(previewing: false)) { let _ = ChatControllerCount.modify { value in return value + 1 } @@ -372,7 +377,7 @@ public final class ChatController: TelegramController, GalleryHiddenMediaTarget, } } - return openChatMessage(context: context, message: message, standalone: false, reverseMessageGalleryOrder: false, mode: mode, navigationController: strongSelf.navigationController as? NavigationController, dismissInput: { + return context.sharedContext.openChatMessage(OpenChatMessageParams(context: context, message: message, standalone: false, reverseMessageGalleryOrder: false, mode: mode, navigationController: strongSelf.navigationController as? NavigationController, dismissInput: { self?.chatDisplayNode.dismissInput() }, present: { c, a in self?.present(c, in: .window(.root), with: a, blockInteraction: true) @@ -409,7 +414,7 @@ public final class ChatController: TelegramController, GalleryHiddenMediaTarget, if let strongSelf = self, let controllerInteraction = strongSelf.controllerInteraction { var messageIdAndMedia: [MessageId: [Media]] = [:] - if let entry = entry, entry.index == centralIndex { + if let entry = entry as? InstantPageGalleryEntry, entry.index == centralIndex { messageIdAndMedia[message.id] = [galleryMedia] } @@ -471,7 +476,7 @@ public final class ChatController: TelegramController, GalleryHiddenMediaTarget, if let strongSelf = self { strongSelf.controllerInteraction?.addContact(phoneNumber) } - })) + }))) }, openPeer: { [weak self] id, navigation, fromMessage in self?.openPeer(peerId: id, navigation: navigation, fromMessage: fromMessage) }, openPeerMention: { [weak self] name in @@ -3824,7 +3829,7 @@ public final class ChatController: TelegramController, GalleryHiddenMediaTarget, } } - let shouldBeActive = combineLatest(MediaManager.globalAudioSession.isPlaybackActive() |> deliverOnMainQueue, self.chatDisplayNode.historyNode.hasVisiblePlayableItemNodes) + let shouldBeActive = combineLatest(self.context.sharedContext.mediaManager.audioSession.isPlaybackActive() |> deliverOnMainQueue, self.chatDisplayNode.historyNode.hasVisiblePlayableItemNodes) |> mapToSignal { [weak self] isPlaybackActive, hasVisiblePlayableItemNodes -> Signal in if hasVisiblePlayableItemNodes && !isPlaybackActive { return Signal { [weak self] subscriber in @@ -7071,7 +7076,7 @@ public final class ChatController: TelegramController, GalleryHiddenMediaTarget, return inputShortcuts + otherShortcuts } - func getTransitionInfo(messageId: MessageId, media: Media) -> ((UIView) -> Void, ASDisplayNode, () -> (UIView?, UIView?))? { + public func getTransitionInfo(messageId: MessageId, media: Media) -> ((UIView) -> Void, ASDisplayNode, () -> (UIView?, UIView?))? { var selectedNode: (ASDisplayNode, () -> (UIView?, UIView?))? self.chatDisplayNode.historyNode.forEachItemNode { itemNode in if let itemNode = itemNode as? ChatMessageItemView { diff --git a/submodules/TelegramUI/TelegramUI/ChatControllerInteraction.swift b/submodules/TelegramUI/TelegramUI/ChatControllerInteraction.swift index b68c91ae19..de290327bd 100644 --- a/submodules/TelegramUI/TelegramUI/ChatControllerInteraction.swift +++ b/submodules/TelegramUI/TelegramUI/ChatControllerInteraction.swift @@ -5,23 +5,7 @@ import AsyncDisplayKit import TelegramCore import Display import TelegramUIPreferences - -public enum ChatControllerInitialBotStartBehavior { - case interactive - case automatic(returnToPeerId: PeerId) -} - -public struct ChatControllerInitialBotStart { - let payload: String - let behavior: ChatControllerInitialBotStartBehavior -} - -public enum ChatControllerInteractionNavigateToPeer { - case `default` - case chat(textInputState: ChatTextInputState?, messageId: MessageId?) - case info - case withBotStartPayload(ChatControllerInitialBotStart) -} +import AccountContext struct ChatInterfaceHighlightedState: Equatable { let messageStableId: UInt32 @@ -56,15 +40,6 @@ public enum ChatControllerInteractionLongTapAction { case timecode(Double, String) } -public enum ChatControllerInteractionOpenMessageMode { - case `default` - case stream - case automaticPlayback - case landscape - case timecode(Double) - case link -} - struct ChatInterfacePollActionState: Equatable { var pollMessageIdsInProgress: [MessageId: Data] = [:] } diff --git a/submodules/TelegramUI/TelegramUI/ChatControllerNode.swift b/submodules/TelegramUI/TelegramUI/ChatControllerNode.swift index 41b451a70d..42728f2785 100644 --- a/submodules/TelegramUI/TelegramUI/ChatControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatControllerNode.swift @@ -8,6 +8,7 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import TextFormat +import AccountContext private final class ChatControllerNodeView: UITracingLayerView, WindowInputAccessoryHeightProvider, PreviewingHostView { var inputAccessoryHeight: (() -> CGFloat)? @@ -53,7 +54,7 @@ private struct ChatControllerNodeDerivedLayoutState { } class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { - let context: AccountContextImpl + let context: AccountContext let chatLocation: ChatLocation let controllerInteraction: ChatControllerInteraction private weak var controller: ChatController? @@ -187,7 +188,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { } }*/ - init(context: AccountContextImpl, chatLocation: ChatLocation, messageId: MessageId?, controllerInteraction: ChatControllerInteraction, chatPresentationInterfaceState: ChatPresentationInterfaceState, automaticMediaDownloadSettings: MediaAutoDownloadSettings, navigationBar: NavigationBar?, controller: ChatController?) { + init(context: AccountContext, chatLocation: ChatLocation, messageId: MessageId?, controllerInteraction: ChatControllerInteraction, chatPresentationInterfaceState: ChatPresentationInterfaceState, automaticMediaDownloadSettings: MediaAutoDownloadSettings, navigationBar: NavigationBar?, controller: ChatController?) { self.context = context self.chatLocation = chatLocation self.controllerInteraction = controllerInteraction diff --git a/submodules/TelegramUI/TelegramUI/ChatDocumentGalleryItem.swift b/submodules/TelegramUI/TelegramUI/ChatDocumentGalleryItem.swift index 5ec96c62c0..71cd735363 100644 --- a/submodules/TelegramUI/TelegramUI/ChatDocumentGalleryItem.swift +++ b/submodules/TelegramUI/TelegramUI/ChatDocumentGalleryItem.swift @@ -7,14 +7,15 @@ import SwiftSignalKit import WebKit import TelegramCore import TelegramPresentationData +import AccountContext class ChatDocumentGalleryItem: GalleryItem { - let context: AccountContextImpl + let context: AccountContext let presentationData: PresentationData let message: Message let location: MessageHistoryEntryLocation? - init(context: AccountContextImpl, presentationData: PresentationData, message: Message, location: MessageHistoryEntryLocation?) { + init(context: AccountContext, presentationData: PresentationData, message: Message, location: MessageHistoryEntryLocation?) { self.context = context self.presentationData = presentationData self.message = message @@ -93,7 +94,7 @@ class ChatDocumentGalleryItemNode: ZoomableContentGalleryItemNode, WKNavigationD private let webView: UIView - private var contextAndFile: (AccountContextImpl, FileMediaReference)? + private var contextAndFile: (AccountContext, FileMediaReference)? private let dataDisposable = MetaDisposable() private var itemIsVisible = false @@ -106,7 +107,7 @@ class ChatDocumentGalleryItemNode: ZoomableContentGalleryItemNode, WKNavigationD private let statusDisposable = MetaDisposable() private var status: MediaResourceStatus? - init(context: AccountContextImpl, presentationData: PresentationData) { + init(context: AccountContext, presentationData: PresentationData) { if #available(iOSApplicationExtension 11.0, iOS 11.0, *) { let preferences = WKPreferences() preferences.javaScriptEnabled = false @@ -165,7 +166,7 @@ class ChatDocumentGalleryItemNode: ZoomableContentGalleryItemNode, WKNavigationD return .single(.dark) } - func setFile(context: AccountContextImpl, fileReference: FileMediaReference) { + func setFile(context: AccountContext, fileReference: FileMediaReference) { let updateFile = self.contextAndFile?.1.media != fileReference.media self.contextAndFile = (context, fileReference) if updateFile { @@ -179,7 +180,7 @@ class ChatDocumentGalleryItemNode: ZoomableContentGalleryItemNode, WKNavigationD } } - private func setupStatus(context: AccountContextImpl, resource: MediaResource) { + private func setupStatus(context: AccountContext, resource: MediaResource) { self.statusDisposable.set((context.account.postbox.mediaBox.resourceStatus(resource) |> deliverOnMainQueue).start(next: { [weak self] status in if let strongSelf = self { diff --git a/submodules/TelegramUI/TelegramUI/ChatExternalFileGalleryItem.swift b/submodules/TelegramUI/TelegramUI/ChatExternalFileGalleryItem.swift index 73190f37a3..49fa601902 100644 --- a/submodules/TelegramUI/TelegramUI/ChatExternalFileGalleryItem.swift +++ b/submodules/TelegramUI/TelegramUI/ChatExternalFileGalleryItem.swift @@ -7,14 +7,15 @@ import SwiftSignalKit import WebKit import TelegramCore import TelegramPresentationData +import AccountContext class ChatExternalFileGalleryItem: GalleryItem { - let context: AccountContextImpl + let context: AccountContext let presentationData: PresentationData let message: Message let location: MessageHistoryEntryLocation? - init(context: AccountContextImpl, presentationData: PresentationData, message: Message, location: MessageHistoryEntryLocation?) { + init(context: AccountContext, presentationData: PresentationData, message: Message, location: MessageHistoryEntryLocation?) { self.context = context self.presentationData = presentationData self.message = message @@ -67,7 +68,7 @@ class ChatExternalFileGalleryItemNode: GalleryItemNode { private let actionTitleNode: ImmediateTextNode private let actionButtonNode: HighlightableButtonNode - private var contextAndFile: (AccountContextImpl, FileMediaReference)? + private var contextAndFile: (AccountContext, FileMediaReference)? private let dataDisposable = MetaDisposable() private var itemIsVisible = false @@ -80,7 +81,7 @@ class ChatExternalFileGalleryItemNode: GalleryItemNode { private let statusDisposable = MetaDisposable() private var status: MediaResourceStatus? - init(context: AccountContextImpl, presentationData: PresentationData) { + init(context: AccountContext, presentationData: PresentationData) { self.containerNode = ASDisplayNode() self.containerNode.backgroundColor = .white @@ -167,7 +168,7 @@ class ChatExternalFileGalleryItemNode: GalleryItemNode { return .single(.dark) } - func setFile(context: AccountContextImpl, fileReference: FileMediaReference) { + func setFile(context: AccountContext, fileReference: FileMediaReference) { let updateFile = self.contextAndFile?.1.media != fileReference.media self.contextAndFile = (context, fileReference) if updateFile { @@ -176,7 +177,7 @@ class ChatExternalFileGalleryItemNode: GalleryItemNode { } } - private func setupStatus(context: AccountContextImpl, resource: MediaResource) { + private func setupStatus(context: AccountContext, resource: MediaResource) { self.statusDisposable.set((context.account.postbox.mediaBox.resourceStatus(resource) |> deliverOnMainQueue).start(next: { [weak self] status in if let strongSelf = self { diff --git a/submodules/TelegramUI/TelegramUI/ChatHistoryEntriesForView.swift b/submodules/TelegramUI/TelegramUI/ChatHistoryEntriesForView.swift index 50b44fc043..4c4d62bd62 100644 --- a/submodules/TelegramUI/TelegramUI/ChatHistoryEntriesForView.swift +++ b/submodules/TelegramUI/TelegramUI/ChatHistoryEntriesForView.swift @@ -1,6 +1,7 @@ import Foundation import Postbox import TelegramCore +import TemporaryCachedPeerDataManager func chatHistoryEntriesForView(location: ChatLocation, view: MessageHistoryView, includeUnreadEntry: Bool, includeEmptyEntry: Bool, includeChatInfoEntry: Bool, includeSearchEntry: Bool, reverse: Bool, groupMessages: Bool, selectedMessages: Set?, presentationData: ChatPresentationData, historyAppearsCleared: Bool, associatedData: ChatMessageItemAssociatedData) -> [ChatHistoryEntry] { if historyAppearsCleared { diff --git a/submodules/TelegramUI/TelegramUI/ChatHistoryEntry.swift b/submodules/TelegramUI/TelegramUI/ChatHistoryEntry.swift index 6c03908e49..460a99e826 100644 --- a/submodules/TelegramUI/TelegramUI/ChatHistoryEntry.swift +++ b/submodules/TelegramUI/TelegramUI/ChatHistoryEntry.swift @@ -2,6 +2,7 @@ import Postbox import TelegramCore import TelegramPresentationData import MergeLists +import TemporaryCachedPeerDataManager public enum ChatHistoryMessageSelection: Equatable { case none diff --git a/submodules/TelegramUI/TelegramUI/ChatHistoryGridNode.swift b/submodules/TelegramUI/TelegramUI/ChatHistoryGridNode.swift index 47d6bb11e4..c46ea1d3ed 100644 --- a/submodules/TelegramUI/TelegramUI/ChatHistoryGridNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatHistoryGridNode.swift @@ -6,6 +6,7 @@ import Display import AsyncDisplayKit import TelegramCore import TelegramPresentationData +import AccountContext private class ChatGridLiveSelectorRecognizer: UIPanGestureRecognizer { private let selectionGestureActivationThreshold: CGFloat = 2.0 @@ -71,7 +72,7 @@ struct ChatHistoryGridViewTransition { let stationaryItems: GridNodeStationaryItems } -private func mappedInsertEntries(context: AccountContextImpl, peerId: PeerId, controllerInteraction: ChatControllerInteraction, entries: [ChatHistoryViewTransitionInsertEntry], theme: PresentationTheme, strings: PresentationStrings) -> [GridNodeInsertItem] { +private func mappedInsertEntries(context: AccountContext, peerId: PeerId, controllerInteraction: ChatControllerInteraction, entries: [ChatHistoryViewTransitionInsertEntry], theme: PresentationTheme, strings: PresentationStrings) -> [GridNodeInsertItem] { return entries.map { entry -> GridNodeInsertItem in switch entry.entry { case let .MessageEntry(message, _, _, _, _, _): @@ -88,7 +89,7 @@ private func mappedInsertEntries(context: AccountContextImpl, peerId: PeerId, co } } -private func mappedUpdateEntries(context: AccountContextImpl, peerId: PeerId, controllerInteraction: ChatControllerInteraction, entries: [ChatHistoryViewTransitionUpdateEntry], theme: PresentationTheme, strings: PresentationStrings) -> [GridNodeUpdateItem] { +private func mappedUpdateEntries(context: AccountContext, peerId: PeerId, controllerInteraction: ChatControllerInteraction, entries: [ChatHistoryViewTransitionUpdateEntry], theme: PresentationTheme, strings: PresentationStrings) -> [GridNodeUpdateItem] { return entries.map { entry -> GridNodeUpdateItem in switch entry.entry { case let .MessageEntry(message, _, _, _, _, _): @@ -105,7 +106,7 @@ private func mappedUpdateEntries(context: AccountContextImpl, peerId: PeerId, co } } -private func mappedChatHistoryViewListTransition(context: AccountContextImpl, peerId: PeerId, controllerInteraction: ChatControllerInteraction, transition: ChatHistoryViewTransition, from: ChatHistoryView?, presentationData: ChatPresentationData) -> ChatHistoryGridViewTransition { +private func mappedChatHistoryViewListTransition(context: AccountContext, peerId: PeerId, controllerInteraction: ChatControllerInteraction, transition: ChatHistoryViewTransition, from: ChatHistoryView?, presentationData: ChatPresentationData) -> ChatHistoryGridViewTransition { var mappedScrollToItem: GridNodeScrollToItem? if let scrollToItem = transition.scrollToItem { let mappedPosition: GridNodeScrollToItemPosition @@ -196,7 +197,7 @@ private func gridNodeLayoutForContainerLayout(size: CGSize) -> GridNodeLayoutTyp } public final class ChatHistoryGridNode: GridNode, ChatHistoryNode { - private let context: AccountContextImpl + private let context: AccountContext private let peerId: PeerId private let messageId: MessageId? private let tagMask: MessageTags? @@ -236,7 +237,7 @@ public final class ChatHistoryGridNode: GridNode, ChatHistoryNode { private var loadStateUpdated: ((ChatHistoryNodeLoadState, Bool) -> Void)? private let controllerInteraction: ChatControllerInteraction - public init(context: AccountContextImpl, peerId: PeerId, messageId: MessageId?, tagMask: MessageTags?, controllerInteraction: ChatControllerInteraction) { + public init(context: AccountContext, peerId: PeerId, messageId: MessageId?, tagMask: MessageTags?, controllerInteraction: ChatControllerInteraction) { self.context = context self.peerId = peerId self.messageId = messageId diff --git a/submodules/TelegramUI/TelegramUI/ChatHistoryListNode.swift b/submodules/TelegramUI/TelegramUI/ChatHistoryListNode.swift index f9679681d3..927b56aca1 100644 --- a/submodules/TelegramUI/TelegramUI/ChatHistoryListNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatHistoryListNode.swift @@ -8,6 +8,8 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import MediaResources +import AccountContext +import TemporaryCachedPeerDataManager private let historyMessageCount: Int = 100 @@ -174,7 +176,7 @@ private func maxMessageIndexForEntries(_ view: ChatHistoryView, indexRange: (Int return (incoming, overall) } -private func mappedInsertEntries(context: AccountContextImpl, chatLocation: ChatLocation, associatedData: ChatMessageItemAssociatedData, controllerInteraction: ChatControllerInteraction, mode: ChatHistoryListMode, entries: [ChatHistoryViewTransitionInsertEntry]) -> [ListViewInsertItem] { +private func mappedInsertEntries(context: AccountContext, chatLocation: ChatLocation, associatedData: ChatMessageItemAssociatedData, controllerInteraction: ChatControllerInteraction, mode: ChatHistoryListMode, entries: [ChatHistoryViewTransitionInsertEntry]) -> [ListViewInsertItem] { return entries.map { entry -> ListViewInsertItem in switch entry.entry { case let .MessageEntry(message, presentationData, read, _, selection, attributes): @@ -208,7 +210,7 @@ private func mappedInsertEntries(context: AccountContextImpl, chatLocation: Chat } } -private func mappedUpdateEntries(context: AccountContextImpl, chatLocation: ChatLocation, associatedData: ChatMessageItemAssociatedData, controllerInteraction: ChatControllerInteraction, mode: ChatHistoryListMode, entries: [ChatHistoryViewTransitionUpdateEntry]) -> [ListViewUpdateItem] { +private func mappedUpdateEntries(context: AccountContext, chatLocation: ChatLocation, associatedData: ChatMessageItemAssociatedData, controllerInteraction: ChatControllerInteraction, mode: ChatHistoryListMode, entries: [ChatHistoryViewTransitionUpdateEntry]) -> [ListViewUpdateItem] { return entries.map { entry -> ListViewUpdateItem in switch entry.entry { case let .MessageEntry(message, presentationData, read, _, selection, attributes): @@ -242,7 +244,7 @@ private func mappedUpdateEntries(context: AccountContextImpl, chatLocation: Chat } } -private func mappedChatHistoryViewListTransition(context: AccountContextImpl, chatLocation: ChatLocation, associatedData: ChatMessageItemAssociatedData, controllerInteraction: ChatControllerInteraction, mode: ChatHistoryListMode, transition: ChatHistoryViewTransition) -> ChatHistoryListViewTransition { +private func mappedChatHistoryViewListTransition(context: AccountContext, chatLocation: ChatLocation, associatedData: ChatMessageItemAssociatedData, controllerInteraction: ChatControllerInteraction, mode: ChatHistoryListMode, transition: ChatHistoryViewTransition) -> ChatHistoryListViewTransition { return ChatHistoryListViewTransition(historyView: transition.historyView, deleteItems: transition.deleteItems, insertItems: mappedInsertEntries(context: context, chatLocation: chatLocation, associatedData: associatedData, controllerInteraction: controllerInteraction, mode: mode, entries: transition.insertEntries), updateItems: mappedUpdateEntries(context: context, chatLocation: chatLocation, associatedData: associatedData, controllerInteraction: controllerInteraction, mode: mode, entries: transition.updateEntries), options: transition.options, scrollToItem: transition.scrollToItem, stationaryItemRange: transition.stationaryItemRange, initialData: transition.initialData, keyboardButtonsMessage: transition.keyboardButtonsMessage, cachedData: transition.cachedData, cachedDataMessages: transition.cachedDataMessages, readStateData: transition.readStateData, scrolledToIndex: transition.scrolledToIndex, peerType: associatedData.automaticDownloadPeerType, networkType: associatedData.automaticDownloadNetworkType, animateIn: transition.animateIn, reason: transition.reason, flashIndicators: transition.flashIndicators) } @@ -331,7 +333,7 @@ private struct ChatHistoryAnimatedEmojiConfiguration { } public final class ChatHistoryListNode: ListView, ChatHistoryNode { - private let context: AccountContextImpl + private let context: AccountContext private let chatLocation: ChatLocation private let messageId: MessageId? private let tagMask: MessageTags? @@ -441,7 +443,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode { private var loadedMessagesFromCachedDataDisposable: Disposable? - public init(context: AccountContextImpl, chatLocation: ChatLocation, tagMask: MessageTags?, messageId: MessageId?, controllerInteraction: ChatControllerInteraction, selectedMessages: Signal?, NoError>, mode: ChatHistoryListMode = .bubbles) { + public init(context: AccountContext, chatLocation: ChatLocation, tagMask: MessageTags?, messageId: MessageId?, controllerInteraction: ChatControllerInteraction, selectedMessages: Signal?, NoError>, mode: ChatHistoryListMode = .bubbles) { self.context = context self.chatLocation = chatLocation self.messageId = messageId diff --git a/submodules/TelegramUI/TelegramUI/ChatHistoryLocation.swift b/submodules/TelegramUI/TelegramUI/ChatHistoryLocation.swift index 05e94ae2e1..267303fa00 100644 --- a/submodules/TelegramUI/TelegramUI/ChatHistoryLocation.swift +++ b/submodules/TelegramUI/TelegramUI/ChatHistoryLocation.swift @@ -2,19 +2,4 @@ import Postbox import UIKit import Display -enum ChatHistoryInitialSearchLocation: Equatable { - case index(MessageIndex) - case id(MessageId) -} -struct ChatHistoryLocationInput: Equatable { - let content: ChatHistoryLocation - let id: Int32 -} - -enum ChatHistoryLocation: Equatable { - case Initial(count: Int) - case InitialSearch(location: ChatHistoryInitialSearchLocation, count: Int) - case Navigation(index: MessageHistoryAnchorIndex, anchorIndex: MessageHistoryAnchorIndex, count: Int) - case Scroll(index: MessageHistoryAnchorIndex, anchorIndex: MessageHistoryAnchorIndex, sourceIndex: MessageHistoryAnchorIndex, scrollPosition: ListViewScrollPosition, animated: Bool) -} diff --git a/submodules/TelegramUI/TelegramUI/ChatHistorySearchContainerNode.swift b/submodules/TelegramUI/TelegramUI/ChatHistorySearchContainerNode.swift index 14fc2e51bf..b1985f860a 100644 --- a/submodules/TelegramUI/TelegramUI/ChatHistorySearchContainerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatHistorySearchContainerNode.swift @@ -7,6 +7,7 @@ import Postbox import TelegramCore import TelegramPresentationData import MergeLists +import AccountContext private enum ChatHistorySearchEntryStableId: Hashable { case messageId(MessageId) @@ -78,7 +79,7 @@ private enum ChatHistorySearchEntry: Comparable, Identifiable { } } - func item(context: AccountContextImpl, peerId: PeerId, interaction: ChatControllerInteraction) -> ListViewItem { + func item(context: AccountContext, peerId: PeerId, interaction: ChatControllerInteraction) -> ListViewItem { switch self { case let .message(message, theme, strings, dateTimeFormat): return ListMessageItem(theme: theme, strings: strings, dateTimeFormat: dateTimeFormat, context: context, chatLocation: .peer(peerId), controllerInteraction: interaction, message: message, selection: .none, displayHeader: true) @@ -94,7 +95,7 @@ private struct ChatHistorySearchContainerTransition { let displayingResults: Bool } -private func chatHistorySearchContainerPreparedTransition(from fromEntries: [ChatHistorySearchEntry], to toEntries: [ChatHistorySearchEntry], query: String, displayingResults: Bool, context: AccountContextImpl, peerId: PeerId, interaction: ChatControllerInteraction) -> ChatHistorySearchContainerTransition { +private func chatHistorySearchContainerPreparedTransition(from fromEntries: [ChatHistorySearchEntry], to toEntries: [ChatHistorySearchEntry], query: String, displayingResults: Bool, context: AccountContext, peerId: PeerId, interaction: ChatControllerInteraction) -> ChatHistorySearchContainerTransition { let (deleteIndices, indicesAndItems, updateIndices) = mergeListsStableWithUpdates(leftList: fromEntries, rightList: toEntries) let deletions = deleteIndices.map { ListViewDeleteItem(index: $0, directionHint: nil) } @@ -105,7 +106,7 @@ private func chatHistorySearchContainerPreparedTransition(from fromEntries: [Cha } final class ChatHistorySearchContainerNode: SearchDisplayControllerContentNode { - private let context: AccountContextImpl + private let context: AccountContext private let dimNode: ASDisplayNode private let listNode: ListView @@ -135,7 +136,7 @@ final class ChatHistorySearchContainerNode: SearchDisplayControllerContentNode { private var enqueuedTransitions: [(ChatHistorySearchContainerTransition, Bool)] = [] - init(context: AccountContextImpl, peerId: PeerId, tagMask: MessageTags, interfaceInteraction: ChatControllerInteraction) { + init(context: AccountContext, peerId: PeerId, tagMask: MessageTags, interfaceInteraction: ChatControllerInteraction) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/ChatHistoryViewForLocation.swift b/submodules/TelegramUI/TelegramUI/ChatHistoryViewForLocation.swift index 77559fe27e..7e95433d3c 100644 --- a/submodules/TelegramUI/TelegramUI/ChatHistoryViewForLocation.swift +++ b/submodules/TelegramUI/TelegramUI/ChatHistoryViewForLocation.swift @@ -4,6 +4,7 @@ import Postbox import TelegramCore import SwiftSignalKit import Display +import AccountContext func preloadedChatHistoryViewForLocation(_ location: ChatHistoryLocationInput, account: Account, chatLocation: ChatLocation, fixedCombinedReadStates: MessageHistoryViewReadState?, tagMask: MessageTags?, additionalData: [AdditionalMessageHistoryViewData], orderStatistics: MessageHistoryViewOrderStatistics = []) -> Signal { return chatHistoryViewForLocation(location, account: account, chatLocation: chatLocation, fixedCombinedReadStates: fixedCombinedReadStates, tagMask: tagMask, additionalData: additionalData, orderStatistics: orderStatistics) diff --git a/submodules/TelegramUI/TelegramUI/ChatImageGalleryItem.swift b/submodules/TelegramUI/TelegramUI/ChatImageGalleryItem.swift index a9c426c4bb..60c9719169 100644 --- a/submodules/TelegramUI/TelegramUI/ChatImageGalleryItem.swift +++ b/submodules/TelegramUI/TelegramUI/ChatImageGalleryItem.swift @@ -6,6 +6,7 @@ import SwiftSignalKit import Postbox import TelegramCore import TelegramPresentationData +import AccountContext enum ChatMediaGalleryThumbnail: Equatable { case image(ImageMediaReference) @@ -71,14 +72,14 @@ final class ChatMediaGalleryThumbnailItem: GalleryThumbnailItem { } class ChatImageGalleryItem: GalleryItem { - let context: AccountContextImpl + let context: AccountContext let presentationData: PresentationData let message: Message let location: MessageHistoryEntryLocation? let performAction: (GalleryControllerInteractionTapAction) -> Void let openActionOptions: (GalleryControllerInteractionTapAction) -> Void - init(context: AccountContextImpl, presentationData: PresentationData, message: Message, location: MessageHistoryEntryLocation?, performAction: @escaping (GalleryControllerInteractionTapAction) -> Void, openActionOptions: @escaping (GalleryControllerInteractionTapAction) -> Void) { + init(context: AccountContext, presentationData: PresentationData, message: Message, location: MessageHistoryEntryLocation?, performAction: @escaping (GalleryControllerInteractionTapAction) -> Void, openActionOptions: @escaping (GalleryControllerInteractionTapAction) -> Void) { self.context = context self.presentationData = presentationData self.message = message @@ -146,7 +147,7 @@ class ChatImageGalleryItem: GalleryItem { } final class ChatImageGalleryItemNode: ZoomableContentGalleryItemNode { - private let context: AccountContextImpl + private let context: AccountContext private var message: Message? private let imageNode: TransformImageNode @@ -156,13 +157,13 @@ final class ChatImageGalleryItemNode: ZoomableContentGalleryItemNode { private let statusNode: RadialStatusNode private let footerContentNode: ChatItemGalleryFooterContentNode - private var contextAndMedia: (AccountContextImpl, AnyMediaReference)? + private var contextAndMedia: (AccountContext, AnyMediaReference)? private var fetchDisposable = MetaDisposable() private let statusDisposable = MetaDisposable() private var status: MediaResourceStatus? - init(context: AccountContextImpl, presentationData: PresentationData, performAction: @escaping (GalleryControllerInteractionTapAction) -> Void, openActionOptions: @escaping (GalleryControllerInteractionTapAction) -> Void) { + init(context: AccountContext, presentationData: PresentationData, performAction: @escaping (GalleryControllerInteractionTapAction) -> Void, openActionOptions: @escaping (GalleryControllerInteractionTapAction) -> Void) { self.context = context self.imageNode = TransformImageNode() @@ -230,7 +231,7 @@ final class ChatImageGalleryItemNode: ZoomableContentGalleryItemNode { self.contextAndMedia = (self.context, imageReference.abstract) } - func setFile(context: AccountContextImpl, fileReference: FileMediaReference) { + func setFile(context: AccountContext, fileReference: FileMediaReference) { if self.contextAndMedia == nil || !self.contextAndMedia!.1.media.isEqual(to: fileReference.media) { if var largestSize = fileReference.media.dimensions { var displaySize = largestSize.dividedByScreenScale() diff --git a/submodules/TelegramUI/TelegramUI/ChatInfo.swift b/submodules/TelegramUI/TelegramUI/ChatInfo.swift index 2ed9d49434..2d6839c659 100644 --- a/submodules/TelegramUI/TelegramUI/ChatInfo.swift +++ b/submodules/TelegramUI/TelegramUI/ChatInfo.swift @@ -2,7 +2,8 @@ import Foundation import Postbox import TelegramCore import Display +import AccountContext -func peerSharedMediaController(context: AccountContextImpl, peerId: PeerId) -> ViewController? { +func peerSharedMediaController(context: AccountContext, peerId: PeerId) -> ViewController? { return PeerMediaCollectionController(context: context, peerId: peerId) } diff --git a/submodules/TelegramUI/TelegramUI/ChatInputContextPanelNode.swift b/submodules/TelegramUI/TelegramUI/ChatInputContextPanelNode.swift index 01c9ab3e0b..2e74ea51aa 100644 --- a/submodules/TelegramUI/TelegramUI/ChatInputContextPanelNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatInputContextPanelNode.swift @@ -4,6 +4,7 @@ import AsyncDisplayKit import Display import TelegramCore import TelegramPresentationData +import AccountContext enum ChatInputContextPanelPlacement { case overPanels @@ -11,12 +12,12 @@ enum ChatInputContextPanelPlacement { } class ChatInputContextPanelNode: ASDisplayNode { - let context: AccountContextImpl + let context: AccountContext var interfaceInteraction: ChatPanelInterfaceInteraction? var placement: ChatInputContextPanelPlacement = .overPanels var theme: PresentationTheme - init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings) { + init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings) { self.context = context self.theme = theme diff --git a/submodules/TelegramUI/TelegramUI/ChatInputPanelNode.swift b/submodules/TelegramUI/TelegramUI/ChatInputPanelNode.swift index b078affb91..eb4914d024 100644 --- a/submodules/TelegramUI/TelegramUI/ChatInputPanelNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatInputPanelNode.swift @@ -4,9 +4,10 @@ import AsyncDisplayKit import Display import Postbox import TelegramCore +import AccountContext class ChatInputPanelNode: ASDisplayNode { - var context: AccountContextImpl? + var context: AccountContext? var interfaceInteraction: ChatPanelInterfaceInteraction? func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, maxHeight: CGFloat, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics) -> CGFloat { diff --git a/submodules/TelegramUI/TelegramUI/ChatInterfaceInputContextPanels.swift b/submodules/TelegramUI/TelegramUI/ChatInterfaceInputContextPanels.swift index d2b9042c7f..547cba4f8e 100644 --- a/submodules/TelegramUI/TelegramUI/ChatInterfaceInputContextPanels.swift +++ b/submodules/TelegramUI/TelegramUI/ChatInterfaceInputContextPanels.swift @@ -1,6 +1,7 @@ import Foundation import UIKit import TelegramCore +import AccountContext private func inputQueryResultPriority(_ result: ChatPresentationInputQueryResult) -> (Int, Bool) { switch result { @@ -23,7 +24,7 @@ private func inputQueryResultPriority(_ result: ChatPresentationInputQueryResult } } -func inputContextPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContextImpl, currentPanel: ChatInputContextPanelNode?, controllerInteraction: ChatControllerInteraction?, interfaceInteraction: ChatPanelInterfaceInteraction?) -> ChatInputContextPanelNode? { +func inputContextPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContext, currentPanel: ChatInputContextPanelNode?, controllerInteraction: ChatControllerInteraction?, interfaceInteraction: ChatPanelInterfaceInteraction?) -> ChatInputContextPanelNode? { guard let _ = chatPresentationInterfaceState.renderedPeer?.peer else { return nil } @@ -164,7 +165,7 @@ func inputContextPanelForChatPresentationIntefaceState(_ chatPresentationInterfa return nil } -func chatOverlayContextPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContextImpl, currentPanel: ChatInputContextPanelNode?, interfaceInteraction: ChatPanelInterfaceInteraction?) -> ChatInputContextPanelNode? { +func chatOverlayContextPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContext, currentPanel: ChatInputContextPanelNode?, interfaceInteraction: ChatPanelInterfaceInteraction?) -> ChatInputContextPanelNode? { guard let searchQuerySuggestionResult = chatPresentationInterfaceState.searchQuerySuggestionResult, let _ = chatPresentationInterfaceState.renderedPeer?.peer else { return nil } diff --git a/submodules/TelegramUI/TelegramUI/ChatInterfaceInputContexts.swift b/submodules/TelegramUI/TelegramUI/ChatInterfaceInputContexts.swift index 1fc4ead68e..bdfdebc011 100644 --- a/submodules/TelegramUI/TelegramUI/ChatInterfaceInputContexts.swift +++ b/submodules/TelegramUI/TelegramUI/ChatInterfaceInputContexts.swift @@ -3,6 +3,7 @@ import UIKit import TelegramCore import Postbox import Display +import AccountContext struct PossibleContextQueryTypes: OptionSet { var rawValue: Int32 @@ -197,7 +198,7 @@ func inputContextQueriesForChatPresentationIntefaceState(_ chatPresentationInter return result } -func inputTextPanelStateForChatPresentationInterfaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContextImpl) -> ChatTextInputPanelState { +func inputTextPanelStateForChatPresentationInterfaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContext) -> ChatTextInputPanelState { var contextPlaceholder: NSAttributedString? loop: for (_, result) in chatPresentationInterfaceState.inputQueryResults { if case let .contextRequestResult(peer, _) = result, let botUser = peer as? TelegramUser, let botInfo = botUser.botInfo, let inlinePlaceholder = botInfo.inlinePlaceholder { diff --git a/submodules/TelegramUI/TelegramUI/ChatInterfaceInputNodes.swift b/submodules/TelegramUI/TelegramUI/ChatInterfaceInputNodes.swift index dffebaaa93..f9101fb299 100644 --- a/submodules/TelegramUI/TelegramUI/ChatInterfaceInputNodes.swift +++ b/submodules/TelegramUI/TelegramUI/ChatInterfaceInputNodes.swift @@ -3,8 +3,9 @@ import UIKit import AsyncDisplayKit import TelegramCore import Postbox +import AccountContext -func inputNodeForChatPresentationIntefaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContextImpl, currentNode: ChatInputNode?, interfaceInteraction: ChatPanelInterfaceInteraction?, inputMediaNode: ChatMediaInputNode?, controllerInteraction: ChatControllerInteraction, inputPanelNode: ChatInputPanelNode?) -> ChatInputNode? { +func inputNodeForChatPresentationIntefaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContext, currentNode: ChatInputNode?, interfaceInteraction: ChatPanelInterfaceInteraction?, inputMediaNode: ChatMediaInputNode?, controllerInteraction: ChatControllerInteraction, inputPanelNode: ChatInputPanelNode?) -> ChatInputNode? { if !(inputPanelNode is ChatTextInputPanelNode) { return nil } diff --git a/submodules/TelegramUI/TelegramUI/ChatInterfaceState.swift b/submodules/TelegramUI/TelegramUI/ChatInterfaceState.swift index f254b131ce..e39f318c37 100644 --- a/submodules/TelegramUI/TelegramUI/ChatInterfaceState.swift +++ b/submodules/TelegramUI/TelegramUI/ChatInterfaceState.swift @@ -3,6 +3,7 @@ import UIKit import Postbox import TelegramCore import TextFormat +import AccountContext struct ChatInterfaceSelectionState: PostboxCoding, Equatable { let selectedIds: Set @@ -30,215 +31,6 @@ struct ChatInterfaceSelectionState: PostboxCoding, Equatable { } } -private enum ChatTextInputStateTextAttributeType: PostboxCoding, Equatable { - case bold - case italic - case monospace - case textMention(PeerId) - case textUrl(String) - - init(decoder: PostboxDecoder) { - switch decoder.decodeInt32ForKey("t", orElse: 0) { - case 0: - self = .bold - case 1: - self = .italic - case 2: - self = .monospace - case 3: - self = .textMention(PeerId(decoder.decodeInt64ForKey("peerId", orElse: 0))) - case 4: - self = .textUrl(decoder.decodeStringForKey("url", orElse: "")) - default: - assertionFailure() - self = .bold - } - } - - func encode(_ encoder: PostboxEncoder) { - switch self { - case .bold: - encoder.encodeInt32(0, forKey: "t") - case .italic: - encoder.encodeInt32(1, forKey: "t") - case .monospace: - encoder.encodeInt32(2, forKey: "t") - case let .textMention(id): - encoder.encodeInt32(3, forKey: "t") - encoder.encodeInt64(id.toInt64(), forKey: "peerId") - case let .textUrl(url): - encoder.encodeInt32(4, forKey: "t") - encoder.encodeString(url, forKey: "url") - } - } - - static func ==(lhs: ChatTextInputStateTextAttributeType, rhs: ChatTextInputStateTextAttributeType) -> Bool { - switch lhs { - case .bold: - if case .bold = rhs { - return true - } else { - return false - } - case .italic: - if case .italic = rhs { - return true - } else { - return false - } - case .monospace: - if case .monospace = rhs { - return true - } else { - return false - } - case let .textMention(id): - if case .textMention(id) = rhs { - return true - } else { - return false - } - case let .textUrl(url): - if case .textUrl(url) = rhs { - return true - } else { - return false - } - } - } -} - -private struct ChatTextInputStateTextAttribute: PostboxCoding, Equatable { - let type: ChatTextInputStateTextAttributeType - let range: Range - - init(type: ChatTextInputStateTextAttributeType, range: Range) { - self.type = type - self.range = range - } - - init(decoder: PostboxDecoder) { - self.type = decoder.decodeObjectForKey("type", decoder: { ChatTextInputStateTextAttributeType(decoder: $0) }) as! ChatTextInputStateTextAttributeType - self.range = Int(decoder.decodeInt32ForKey("range0", orElse: 0)) ..< Int(decoder.decodeInt32ForKey("range1", orElse: 0)) - } - - func encode(_ encoder: PostboxEncoder) { - encoder.encodeObject(self.type, forKey: "type") - encoder.encodeInt32(Int32(self.range.lowerBound), forKey: "range0") - encoder.encodeInt32(Int32(self.range.upperBound), forKey: "range1") - } - - static func ==(lhs: ChatTextInputStateTextAttribute, rhs: ChatTextInputStateTextAttribute) -> Bool { - return lhs.type == rhs.type && lhs.range == rhs.range - } -} - -private struct ChatTextInputStateText: PostboxCoding, Equatable { - let text: String - fileprivate let attributes: [ChatTextInputStateTextAttribute] - - init() { - self.text = "" - self.attributes = [] - } - - init(text: String, attributes: [ChatTextInputStateTextAttribute]) { - self.text = text - self.attributes = attributes - } - - init(attributedText: NSAttributedString) { - self.text = attributedText.string - var parsedAttributes: [ChatTextInputStateTextAttribute] = [] - attributedText.enumerateAttributes(in: NSRange(location: 0, length: attributedText.length), options: [], using: { attributes, range, _ in - for (key, value) in attributes { - if key == ChatTextInputAttributes.bold { - parsedAttributes.append(ChatTextInputStateTextAttribute(type: .bold, range: range.location ..< (range.location + range.length))) - } else if key == ChatTextInputAttributes.italic { - parsedAttributes.append(ChatTextInputStateTextAttribute(type: .italic, range: range.location ..< (range.location + range.length))) - } else if key == ChatTextInputAttributes.monospace { - parsedAttributes.append(ChatTextInputStateTextAttribute(type: .monospace, range: range.location ..< (range.location + range.length))) - } else if key == ChatTextInputAttributes.textMention, let value = value as? ChatTextInputTextMentionAttribute { - parsedAttributes.append(ChatTextInputStateTextAttribute(type: .textMention(value.peerId), range: range.location ..< (range.location + range.length))) - } else if key == ChatTextInputAttributes.textUrl, let value = value as? ChatTextInputTextUrlAttribute { - parsedAttributes.append(ChatTextInputStateTextAttribute(type: .textUrl(value.url), range: range.location ..< (range.location + range.length))) - } - } - }) - self.attributes = parsedAttributes - } - - init(decoder: PostboxDecoder) { - self.text = decoder.decodeStringForKey("text", orElse: "") - self.attributes = decoder.decodeObjectArrayWithDecoderForKey("attributes") - } - - func encode(_ encoder: PostboxEncoder) { - encoder.encodeString(self.text, forKey: "text") - encoder.encodeObjectArray(self.attributes, forKey: "attributes") - } - - static func ==(lhs: ChatTextInputStateText, rhs: ChatTextInputStateText) -> Bool { - return lhs.text == rhs.text && lhs.attributes == rhs.attributes - } - - func attributedText() -> NSAttributedString { - let result = NSMutableAttributedString(string: self.text) - for attribute in self.attributes { - switch attribute.type { - case .bold: - result.addAttribute(ChatTextInputAttributes.bold, value: true as NSNumber, range: NSRange(location: attribute.range.lowerBound, length: attribute.range.count)) - case .italic: - result.addAttribute(ChatTextInputAttributes.italic, value: true as NSNumber, range: NSRange(location: attribute.range.lowerBound, length: attribute.range.count)) - case .monospace: - result.addAttribute(ChatTextInputAttributes.monospace, value: true as NSNumber, range: NSRange(location: attribute.range.lowerBound, length: attribute.range.count)) - case let .textMention(id): - result.addAttribute(ChatTextInputAttributes.textMention, value: ChatTextInputTextMentionAttribute(peerId: id), range: NSRange(location: attribute.range.lowerBound, length: attribute.range.count)) - case let .textUrl(url): - result.addAttribute(ChatTextInputAttributes.textUrl, value: ChatTextInputTextUrlAttribute(url: url), range: NSRange(location: attribute.range.lowerBound, length: attribute.range.count)) - } - } - return result - } -} - -public struct ChatTextInputState: PostboxCoding, Equatable { - let inputText: NSAttributedString - let selectionRange: Range - - public static func ==(lhs: ChatTextInputState, rhs: ChatTextInputState) -> Bool { - return lhs.inputText.isEqual(to: rhs.inputText) && lhs.selectionRange == rhs.selectionRange - } - - init() { - self.inputText = NSAttributedString() - self.selectionRange = 0 ..< 0 - } - - init(inputText: NSAttributedString, selectionRange: Range) { - self.inputText = inputText - self.selectionRange = selectionRange - } - - init(inputText: NSAttributedString) { - self.inputText = inputText - let length = inputText.length - self.selectionRange = length ..< length - } - - public init(decoder: PostboxDecoder) { - self.inputText = ((decoder.decodeObjectForKey("at", decoder: { ChatTextInputStateText(decoder: $0) }) as? ChatTextInputStateText) ?? ChatTextInputStateText()).attributedText() - self.selectionRange = Int(decoder.decodeInt32ForKey("as0", orElse: 0)) ..< Int(decoder.decodeInt32ForKey("as1", orElse: 0)) - } - - public func encode(_ encoder: PostboxEncoder) { - encoder.encodeObject(ChatTextInputStateText(attributedText: self.inputText), forKey: "at") - - encoder.encodeInt32(Int32(self.selectionRange.lowerBound), forKey: "as0") - encoder.encodeInt32(Int32(self.selectionRange.upperBound), forKey: "as1") - } -} - struct ChatEditMessageState: PostboxCoding, Equatable { let messageId: MessageId let inputState: ChatTextInputState diff --git a/submodules/TelegramUI/TelegramUI/ChatInterfaceStateAccessoryPanels.swift b/submodules/TelegramUI/TelegramUI/ChatInterfaceStateAccessoryPanels.swift index 812c7e9bf4..07615f91e9 100644 --- a/submodules/TelegramUI/TelegramUI/ChatInterfaceStateAccessoryPanels.swift +++ b/submodules/TelegramUI/TelegramUI/ChatInterfaceStateAccessoryPanels.swift @@ -2,8 +2,9 @@ import Foundation import UIKit import AsyncDisplayKit import TelegramCore +import AccountContext -func accessoryPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContextImpl, currentPanel: AccessoryPanelNode?, interfaceInteraction: ChatPanelInterfaceInteraction?) -> AccessoryPanelNode? { +func accessoryPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContext, currentPanel: AccessoryPanelNode?, interfaceInteraction: ChatPanelInterfaceInteraction?) -> AccessoryPanelNode? { if let _ = chatPresentationInterfaceState.interfaceState.selectionState { return nil } diff --git a/submodules/TelegramUI/TelegramUI/ChatInterfaceStateContextMenus.swift b/submodules/TelegramUI/TelegramUI/ChatInterfaceStateContextMenus.swift index 94a23e56e9..07d56d9cae 100644 --- a/submodules/TelegramUI/TelegramUI/ChatInterfaceStateContextMenus.swift +++ b/submodules/TelegramUI/TelegramUI/ChatInterfaceStateContextMenus.swift @@ -7,6 +7,8 @@ import UIKit import SwiftSignalKit import MobileCoreServices import TelegramVoip +import OverlayStatusController +import AccountContext private struct MessageContextMenuData { let starStatus: Bool? @@ -18,7 +20,7 @@ private struct MessageContextMenuData { let messageActions: ChatAvailableMessageActions } -func canEditMessage(context: AccountContextImpl, limitsConfiguration: LimitsConfiguration, message: Message) -> Bool { +func canEditMessage(context: AccountContext, limitsConfiguration: LimitsConfiguration, message: Message) -> Bool { var hasEditRights = false var unlimitedInterval = false @@ -221,7 +223,7 @@ func updatedChatEditInterfaceMessagetState(state: ChatPresentationInterfaceState return updated } -func contextMenuForChatPresentationIntefaceState(chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContextImpl, messages: [Message], controllerInteraction: ChatControllerInteraction?, selectAll: Bool, interfaceInteraction: ChatPanelInterfaceInteraction?) -> Signal<[ChatMessageContextMenuAction], NoError> { +func contextMenuForChatPresentationIntefaceState(chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContext, messages: [Message], controllerInteraction: ChatControllerInteraction?, selectAll: Bool, interfaceInteraction: ChatPanelInterfaceInteraction?) -> Signal<[ChatMessageContextMenuAction], NoError> { guard let interfaceInteraction = interfaceInteraction, let controllerInteraction = controllerInteraction else { return .single([]) } diff --git a/submodules/TelegramUI/TelegramUI/ChatInterfaceStateContextQueries.swift b/submodules/TelegramUI/TelegramUI/ChatInterfaceStateContextQueries.swift index 260a5c039e..fe61e57bbd 100644 --- a/submodules/TelegramUI/TelegramUI/ChatInterfaceStateContextQueries.swift +++ b/submodules/TelegramUI/TelegramUI/ChatInterfaceStateContextQueries.swift @@ -7,6 +7,7 @@ import TelegramUIPreferences import TelegramUIPrivateModule import LegacyComponents import TextFormat +import AccountContext enum ChatContextQueryError { case inlineBotLocationRequest(PeerId) @@ -17,7 +18,7 @@ enum ChatContextQueryUpdate { case update(ChatPresentationInputQuery, Signal<(ChatPresentationInputQueryResult?) -> ChatPresentationInputQueryResult?, ChatContextQueryError>) } -func contextQueryResultStateForChatInterfacePresentationState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContextImpl, currentQueryStates: inout [ChatPresentationInputQueryKind: (ChatPresentationInputQuery, Disposable)]) -> [ChatPresentationInputQueryKind: ChatContextQueryUpdate] { +func contextQueryResultStateForChatInterfacePresentationState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContext, currentQueryStates: inout [ChatPresentationInputQueryKind: (ChatPresentationInputQuery, Disposable)]) -> [ChatPresentationInputQueryKind: ChatContextQueryUpdate] { guard let peer = chatPresentationInterfaceState.renderedPeer?.peer else { return [:] } @@ -60,7 +61,7 @@ func contextQueryResultStateForChatInterfacePresentationState(_ chatPresentation return updates } -private func updatedContextQueryResultStateForQuery(context: AccountContextImpl, peer: Peer, inputQuery: ChatPresentationInputQuery, previousQuery: ChatPresentationInputQuery?) -> Signal<(ChatPresentationInputQueryResult?) -> ChatPresentationInputQueryResult?, ChatContextQueryError> { +private func updatedContextQueryResultStateForQuery(context: AccountContext, peer: Peer, inputQuery: ChatPresentationInputQuery, previousQuery: ChatPresentationInputQuery?) -> Signal<(ChatPresentationInputQueryResult?) -> ChatPresentationInputQueryResult?, ChatContextQueryError> { switch inputQuery { case let .emoji(query): var signal: Signal<(ChatPresentationInputQueryResult?) -> ChatPresentationInputQueryResult?, ChatContextQueryError> = .complete() @@ -310,7 +311,7 @@ private func updatedContextQueryResultStateForQuery(context: AccountContextImpl, } } -func searchQuerySuggestionResultStateForChatInterfacePresentationState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContextImpl, currentQuery: ChatPresentationInputQuery?) -> (ChatPresentationInputQuery?, Signal<(ChatPresentationInputQueryResult?) -> ChatPresentationInputQueryResult?, NoError>)? { +func searchQuerySuggestionResultStateForChatInterfacePresentationState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContext, currentQuery: ChatPresentationInputQuery?) -> (ChatPresentationInputQuery?, Signal<(ChatPresentationInputQueryResult?) -> ChatPresentationInputQueryResult?, NoError>)? { var inputQuery: ChatPresentationInputQuery? if let search = chatPresentationInterfaceState.search { switch search.domain { @@ -364,7 +365,7 @@ func searchQuerySuggestionResultStateForChatInterfacePresentationState(_ chatPre private let dataDetector = try? NSDataDetector(types: NSTextCheckingResult.CheckingType([.link]).rawValue) -func urlPreviewStateForInputText(_ inputText: NSAttributedString?, context: AccountContextImpl, currentQuery: String?) -> (String?, Signal<(TelegramMediaWebpage?) -> TelegramMediaWebpage?, NoError>)? { +func urlPreviewStateForInputText(_ inputText: NSAttributedString?, context: AccountContext, currentQuery: String?) -> (String?, Signal<(TelegramMediaWebpage?) -> TelegramMediaWebpage?, NoError>)? { guard let text = inputText else { if currentQuery != nil { return (nil, .single({ _ in return nil })) diff --git a/submodules/TelegramUI/TelegramUI/ChatInterfaceStateInputPanels.swift b/submodules/TelegramUI/TelegramUI/ChatInterfaceStateInputPanels.swift index 76a583aad8..55fc4d6616 100644 --- a/submodules/TelegramUI/TelegramUI/ChatInterfaceStateInputPanels.swift +++ b/submodules/TelegramUI/TelegramUI/ChatInterfaceStateInputPanels.swift @@ -2,8 +2,9 @@ import Foundation import UIKit import AsyncDisplayKit import TelegramCore +import AccountContext -func inputPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContextImpl, currentPanel: ChatInputPanelNode?, textInputPanelNode: ChatTextInputPanelNode?, interfaceInteraction: ChatPanelInterfaceInteraction?) -> ChatInputPanelNode? { +func inputPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContext, currentPanel: ChatInputPanelNode?, textInputPanelNode: ChatTextInputPanelNode?, interfaceInteraction: ChatPanelInterfaceInteraction?) -> ChatInputPanelNode? { if let renderedPeer = chatPresentationInterfaceState.renderedPeer, renderedPeer.peer?.restrictionText != nil { return nil } diff --git a/submodules/TelegramUI/TelegramUI/ChatInterfaceTitlePanelNodes.swift b/submodules/TelegramUI/TelegramUI/ChatInterfaceTitlePanelNodes.swift index 59b1d885b4..9d5ec25225 100644 --- a/submodules/TelegramUI/TelegramUI/ChatInterfaceTitlePanelNodes.swift +++ b/submodules/TelegramUI/TelegramUI/ChatInterfaceTitlePanelNodes.swift @@ -1,8 +1,9 @@ import Foundation import UIKit import TelegramCore +import AccountContext -func titlePanelForChatPresentationInterfaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContextImpl, currentPanel: ChatTitleAccessoryPanelNode?, interfaceInteraction: ChatPanelInterfaceInteraction?) -> ChatTitleAccessoryPanelNode? { +func titlePanelForChatPresentationInterfaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContext, currentPanel: ChatTitleAccessoryPanelNode?, interfaceInteraction: ChatPanelInterfaceInteraction?) -> ChatTitleAccessoryPanelNode? { if case .overlay = chatPresentationInterfaceState.mode { return nil } diff --git a/submodules/TelegramUI/TelegramUI/ChatItemGalleryFooterContentNode.swift b/submodules/TelegramUI/TelegramUI/ChatItemGalleryFooterContentNode.swift index c3c70429eb..7737f70ea5 100644 --- a/submodules/TelegramUI/TelegramUI/ChatItemGalleryFooterContentNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatItemGalleryFooterContentNode.swift @@ -8,6 +8,8 @@ import SwiftSignalKit import Photos import TelegramPresentationData import TextFormat +import TelegramStringFormatting +import AccountContext private let deleteImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Accessory Panels/MessageSelectionThrash"), color: .white) private let actionImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Accessory Panels/MessageSelectionAction"), color: .white) @@ -137,7 +139,7 @@ class CaptionScrollWrapperNode: ASDisplayNode { } final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScrollViewDelegate { - private let context: AccountContextImpl + private let context: AccountContext private var theme: PresentationTheme private var strings: PresentationStrings private var dateTimeFormat: PresentationDateTimeFormat @@ -254,7 +256,7 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll } } - init(context: AccountContextImpl, presentationData: PresentationData) { + init(context: AccountContext, presentationData: PresentationData) { self.context = context self.theme = presentationData.theme self.strings = presentationData.strings diff --git a/submodules/TelegramUI/TelegramUI/ChatListController.swift b/submodules/TelegramUI/TelegramUI/ChatListController.swift index fab64158bd..3a14b3ee49 100644 --- a/submodules/TelegramUI/TelegramUI/ChatListController.swift +++ b/submodules/TelegramUI/TelegramUI/ChatListController.swift @@ -6,6 +6,9 @@ import Display import TelegramCore import TelegramPresentationData import TelegramUIPreferences +import TelegramBaseController +import OverlayStatusController +import AccountContext public func useSpecialTabBarIcons() -> Bool { return (Date(timeIntervalSince1970: 1545642000)...Date(timeIntervalSince1970: 1546387200)).contains(Date()) @@ -55,10 +58,10 @@ private func fixListNodeScrolling(_ listNode: ListView, searchNode: NavigationBa return false } -public class ChatListController: TelegramController, UIViewControllerPreviewingDelegate { +public class ChatListController: TelegramBaseController, UIViewControllerPreviewingDelegate { private var validLayout: ContainerViewLayout? - let context: AccountContextImpl + let context: AccountContext private let controlsHistoryPreload: Bool private let hideNetworkActivityStatus: Bool @@ -102,7 +105,7 @@ public class ChatListController: TelegramController, UIViewControllerPreviewingD } } - public init(context: AccountContextImpl, groupId: PeerGroupId, controlsHistoryPreload: Bool, hideNetworkActivityStatus: Bool = false) { + public init(context: AccountContext, groupId: PeerGroupId, controlsHistoryPreload: Bool, hideNetworkActivityStatus: Bool = false) { self.context = context self.controlsHistoryPreload = controlsHistoryPreload self.hideNetworkActivityStatus = hideNetworkActivityStatus diff --git a/submodules/TelegramUI/TelegramUI/ChatListControllerNode.swift b/submodules/TelegramUI/TelegramUI/ChatListControllerNode.swift index 47486b6457..493229bf61 100644 --- a/submodules/TelegramUI/TelegramUI/ChatListControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatListControllerNode.swift @@ -8,6 +8,7 @@ import SwiftSignalKit import TelegramPresentationData import MergeLists import ActivityIndicator +import AccountContext private final class ChatListControllerNodeView: UITracingLayerView, PreviewingHostView { var previewingDelegate: PreviewingHostViewDelegate? { @@ -38,7 +39,7 @@ private struct TestItem: Comparable, Identifiable { } final class ChatListControllerNode: ASDisplayNode { - private let context: AccountContextImpl + private let context: AccountContext private let groupId: PeerGroupId private var presentationData: PresentationData @@ -65,7 +66,7 @@ final class ChatListControllerNode: ASDisplayNode { let debugListView = ListView() - init(context: AccountContextImpl, groupId: PeerGroupId, controlsHistoryPreload: Bool, presentationData: PresentationData, controller: ChatListController) { + init(context: AccountContext, groupId: PeerGroupId, controlsHistoryPreload: Bool, presentationData: PresentationData, controller: ChatListController) { self.context = context self.groupId = groupId self.presentationData = presentationData diff --git a/submodules/TelegramUI/TelegramUI/ChatListItem.swift b/submodules/TelegramUI/TelegramUI/ChatListItem.swift index 08eae964c4..092a43552c 100644 --- a/submodules/TelegramUI/TelegramUI/ChatListItem.swift +++ b/submodules/TelegramUI/TelegramUI/ChatListItem.swift @@ -7,6 +7,9 @@ import SwiftSignalKit import TelegramCore import TelegramPresentationData import ItemListUI +import AvatarNode +import TelegramStringFormatting +import AccountContext enum ChatListItemContent { case peer(message: Message?, peer: RenderedPeer, combinedReadState: CombinedPeerReadState?, notificationSettings: PeerNotificationSettings?, presence: PeerPresence?, summaryInfo: ChatListMessageTagSummaryInfo, embeddedState: PeerChatListEmbeddedInterfaceState?, inputActivities: [(Peer, PeerInputActivity)]?, isAd: Bool, ignoreUnreadBadge: Bool) @@ -24,7 +27,7 @@ enum ChatListItemContent { class ChatListItem: ListViewItem { let presentationData: ChatListPresentationData - let context: AccountContextImpl + let context: AccountContext let peerGroupId: PeerGroupId let index: ChatListIndex let content: ChatListItemContent @@ -43,7 +46,7 @@ class ChatListItem: ListViewItem { let header: ListViewItemHeader? - init(presentationData: ChatListPresentationData, context: AccountContextImpl, peerGroupId: PeerGroupId, index: ChatListIndex, content: ChatListItemContent, editing: Bool, hasActiveRevealControls: Bool, selected: Bool, header: ListViewItemHeader?, enableContextActions: Bool, hiddenOffset: Bool, interaction: ChatListNodeInteraction) { + init(presentationData: ChatListPresentationData, context: AccountContext, peerGroupId: PeerGroupId, index: ChatListIndex, content: ChatListItemContent, editing: Bool, hasActiveRevealControls: Bool, selected: Bool, header: ListViewItemHeader?, enableContextActions: Bool, hiddenOffset: Bool, interaction: ChatListNodeInteraction) { self.presentationData = presentationData self.peerGroupId = peerGroupId self.context = context diff --git a/submodules/TelegramUI/TelegramUI/ChatListNode.swift b/submodules/TelegramUI/TelegramUI/ChatListNode.swift index d1388ee0df..566be61d57 100644 --- a/submodules/TelegramUI/TelegramUI/ChatListNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatListNode.swift @@ -7,6 +7,7 @@ import TelegramCore import Postbox import TelegramPresentationData import TelegramUIPreferences +import AccountContext public struct ChatListNodePeersFilter: OptionSet { public var rawValue: Int32 @@ -142,7 +143,7 @@ struct ChatListNodeState: Equatable { } } -private func mappedInsertEntries(context: AccountContextImpl, nodeInteraction: ChatListNodeInteraction, peerGroupId: PeerGroupId, mode: ChatListNodeMode, entries: [ChatListNodeViewTransitionInsertEntry]) -> [ListViewInsertItem] { +private func mappedInsertEntries(context: AccountContext, nodeInteraction: ChatListNodeInteraction, peerGroupId: PeerGroupId, mode: ChatListNodeMode, entries: [ChatListNodeViewTransitionInsertEntry]) -> [ListViewInsertItem] { return entries.map { entry -> ListViewInsertItem in switch entry.entry { case let .PeerEntry(index, presentationData, message, combinedReadState, notificationSettings, embeddedState, peer, presence, summaryInfo, editing, hasActiveRevealControls, selected, inputActivities, isAd): @@ -223,7 +224,7 @@ private func mappedInsertEntries(context: AccountContextImpl, nodeInteraction: C } } -private func mappedUpdateEntries(context: AccountContextImpl, nodeInteraction: ChatListNodeInteraction, peerGroupId: PeerGroupId, mode: ChatListNodeMode, entries: [ChatListNodeViewTransitionUpdateEntry]) -> [ListViewUpdateItem] { +private func mappedUpdateEntries(context: AccountContext, nodeInteraction: ChatListNodeInteraction, peerGroupId: PeerGroupId, mode: ChatListNodeMode, entries: [ChatListNodeViewTransitionUpdateEntry]) -> [ListViewUpdateItem] { return entries.map { entry -> ListViewUpdateItem in switch entry.entry { case let .PeerEntry(index, presentationData, message, combinedReadState, notificationSettings, embeddedState, peer, presence, summaryInfo, editing, hasActiveRevealControls, selected, inputActivities, isAd): @@ -262,7 +263,7 @@ private func mappedUpdateEntries(context: AccountContextImpl, nodeInteraction: C } } -private func mappedChatListNodeViewListTransition(context: AccountContextImpl, nodeInteraction: ChatListNodeInteraction, peerGroupId: PeerGroupId, mode: ChatListNodeMode, transition: ChatListNodeViewTransition) -> ChatListNodeListViewTransition { +private func mappedChatListNodeViewListTransition(context: AccountContext, nodeInteraction: ChatListNodeInteraction, peerGroupId: PeerGroupId, mode: ChatListNodeMode, transition: ChatListNodeViewTransition) -> ChatListNodeListViewTransition { return ChatListNodeListViewTransition(chatListView: transition.chatListView, deleteItems: transition.deleteItems, insertItems: mappedInsertEntries(context: context, nodeInteraction: nodeInteraction, peerGroupId: peerGroupId, mode: mode, entries: transition.insertEntries), updateItems: mappedUpdateEntries(context: context, nodeInteraction: nodeInteraction, peerGroupId: peerGroupId, mode: mode, entries: transition.updateEntries), options: transition.options, scrollToItem: transition.scrollToItem, stationaryItemRange: transition.stationaryItemRange) } @@ -305,7 +306,7 @@ enum ChatListNodeEmptyState: Equatable { final class ChatListNode: ListView { private let controlsHistoryPreload: Bool - private let context: AccountContextImpl + private let context: AccountContext private let groupId: PeerGroupId private let mode: ChatListNodeMode @@ -382,7 +383,7 @@ final class ChatListNode: ListView { private var hapticFeedback: HapticFeedback? - init(context: AccountContextImpl, groupId: PeerGroupId, controlsHistoryPreload: Bool, mode: ChatListNodeMode, theme: PresentationTheme, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, nameSortOrder: PresentationPersonNameOrder, nameDisplayOrder: PresentationPersonNameOrder, disableAnimations: Bool) { + init(context: AccountContext, groupId: PeerGroupId, controlsHistoryPreload: Bool, mode: ChatListNodeMode, theme: PresentationTheme, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, nameSortOrder: PresentationPersonNameOrder, nameDisplayOrder: PresentationPersonNameOrder, disableAnimations: Bool) { self.context = context self.groupId = groupId self.controlsHistoryPreload = controlsHistoryPreload diff --git a/submodules/TelegramUI/TelegramUI/ChatListSearchContainerNode.swift b/submodules/TelegramUI/TelegramUI/ChatListSearchContainerNode.swift index 58e4263687..0f484cad55 100644 --- a/submodules/TelegramUI/TelegramUI/ChatListSearchContainerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatListSearchContainerNode.swift @@ -8,6 +8,7 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import MergeLists +import AccountContext private enum ChatListRecentEntryStableId: Hashable { case topPeers @@ -72,7 +73,7 @@ private enum ChatListRecentEntry: Comparable, Identifiable { } } - func item(context: AccountContextImpl, filter: ChatListNodePeersFilter, peerSelected: @escaping (Peer) -> Void, peerLongTapped: @escaping (Peer) -> Void, clearRecentlySearchedPeers: @escaping () -> Void, setPeerIdWithRevealedOptions: @escaping (PeerId?, PeerId?) -> Void, deletePeer: @escaping (PeerId) -> Void) -> ListViewItem { + func item(context: AccountContext, filter: ChatListNodePeersFilter, peerSelected: @escaping (Peer) -> Void, peerLongTapped: @escaping (Peer) -> Void, clearRecentlySearchedPeers: @escaping () -> Void, setPeerIdWithRevealedOptions: @escaping (PeerId?, PeerId?) -> Void, deletePeer: @escaping (PeerId) -> Void) -> ListViewItem { switch self { case let .topPeers(peers, theme, strings): return ChatListRecentPeersListItem(theme: theme, strings: strings, account: context.account, peers: peers, peerSelected: { peer in @@ -325,7 +326,7 @@ enum ChatListSearchEntry: Comparable, Identifiable { } } - func item(context: AccountContextImpl, enableHeaders: Bool, filter: ChatListNodePeersFilter, interaction: ChatListNodeInteraction) -> ListViewItem { + func item(context: AccountContext, enableHeaders: Bool, filter: ChatListNodePeersFilter, interaction: ChatListNodeInteraction) -> ListViewItem { switch self { case let .localPeer(peer, associatedPeer, unreadBadge, _, theme, strings, nameSortOrder, nameDisplayOrder): let primaryPeer: Peer @@ -449,7 +450,7 @@ struct ChatListSearchContainerTransition { let displayingResults: Bool } -private func chatListSearchContainerPreparedRecentTransition(from fromEntries: [ChatListRecentEntry], to toEntries: [ChatListRecentEntry], context: AccountContextImpl, filter: ChatListNodePeersFilter, peerSelected: @escaping (Peer) -> Void, peerLongTapped: @escaping (Peer) -> Void, clearRecentlySearchedPeers: @escaping () -> Void, setPeerIdWithRevealedOptions: @escaping (PeerId?, PeerId?) -> Void, deletePeer: @escaping (PeerId) -> Void) -> ChatListSearchContainerRecentTransition { +private func chatListSearchContainerPreparedRecentTransition(from fromEntries: [ChatListRecentEntry], to toEntries: [ChatListRecentEntry], context: AccountContext, filter: ChatListNodePeersFilter, peerSelected: @escaping (Peer) -> Void, peerLongTapped: @escaping (Peer) -> Void, clearRecentlySearchedPeers: @escaping () -> Void, setPeerIdWithRevealedOptions: @escaping (PeerId?, PeerId?) -> Void, deletePeer: @escaping (PeerId) -> Void) -> ChatListSearchContainerRecentTransition { let (deleteIndices, indicesAndItems, updateIndices) = mergeListsStableWithUpdates(leftList: fromEntries, rightList: toEntries) let deletions = deleteIndices.map { ListViewDeleteItem(index: $0, directionHint: nil) } @@ -459,7 +460,7 @@ private func chatListSearchContainerPreparedRecentTransition(from fromEntries: [ return ChatListSearchContainerRecentTransition(deletions: deletions, insertions: insertions, updates: updates) } -func chatListSearchContainerPreparedTransition(from fromEntries: [ChatListSearchEntry], to toEntries: [ChatListSearchEntry], displayingResults: Bool, context: AccountContextImpl, enableHeaders: Bool, filter: ChatListNodePeersFilter, interaction: ChatListNodeInteraction) -> ChatListSearchContainerTransition { +func chatListSearchContainerPreparedTransition(from fromEntries: [ChatListSearchEntry], to toEntries: [ChatListSearchEntry], displayingResults: Bool, context: AccountContext, enableHeaders: Bool, filter: ChatListNodePeersFilter, interaction: ChatListNodeInteraction) -> ChatListSearchContainerTransition { let (deleteIndices, indicesAndItems, updateIndices) = mergeListsStableWithUpdates(leftList: fromEntries, rightList: toEntries) let deletions = deleteIndices.map { ListViewDeleteItem(index: $0, directionHint: nil) } @@ -520,7 +521,7 @@ private struct ChatListSearchMessagesContext { } final class ChatListSearchContainerNode: SearchDisplayControllerContentNode { - private let context: AccountContextImpl + private let context: AccountContext private let recentListNode: ListView private let listNode: ListView @@ -549,7 +550,7 @@ final class ChatListSearchContainerNode: SearchDisplayControllerContentNode { private let filter: ChatListNodePeersFilter - init(context: AccountContextImpl, filter: ChatListNodePeersFilter, groupId: PeerGroupId, openPeer: @escaping (Peer, Bool) -> Void, openRecentPeerOptions: @escaping (Peer) -> Void, openMessage: @escaping (Peer, MessageId) -> Void, addContact: ((String) -> Void)?) { + init(context: AccountContext, filter: ChatListNodePeersFilter, groupId: PeerGroupId, openPeer: @escaping (Peer, Bool) -> Void, openRecentPeerOptions: @escaping (Peer) -> Void, openMessage: @escaping (Peer, MessageId) -> Void, addContact: ((String) -> Void)?) { self.context = context self.filter = filter self.dimNode = ASDisplayNode() diff --git a/submodules/TelegramUI/TelegramUI/ChatMediaInputNode.swift b/submodules/TelegramUI/TelegramUI/ChatMediaInputNode.swift index 8d0c5653e4..7e7062793f 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMediaInputNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMediaInputNode.swift @@ -7,6 +7,7 @@ import TelegramCore import SwiftSignalKit import TelegramPresentationData import MergeLists +import AccountContext private struct PeerSpecificPackData { let peer: Peer @@ -390,7 +391,7 @@ private final class CollectionListContainerNode: ASDisplayNode { } final class ChatMediaInputNode: ChatInputNode { - private let context: AccountContextImpl + private let context: AccountContext private let peerId: PeerId? private let controllerInteraction: ChatControllerInteraction private let gifPaneIsActiveUpdated: (Bool) -> Void @@ -435,7 +436,7 @@ final class ChatMediaInputNode: ChatInputNode { return self._ready.get() } - init(context: AccountContextImpl, peerId: PeerId?, controllerInteraction: ChatControllerInteraction, theme: PresentationTheme, strings: PresentationStrings, gifPaneIsActiveUpdated: @escaping (Bool) -> Void) { + init(context: AccountContext, peerId: PeerId?, controllerInteraction: ChatControllerInteraction, theme: PresentationTheme, strings: PresentationStrings, gifPaneIsActiveUpdated: @escaping (Bool) -> Void) { self.context = context self.peerId = peerId self.controllerInteraction = controllerInteraction diff --git a/submodules/TelegramUI/TelegramUI/ChatMediaInputPeerSpecificItem.swift b/submodules/TelegramUI/TelegramUI/ChatMediaInputPeerSpecificItem.swift index 9544895a55..9162d17f04 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMediaInputPeerSpecificItem.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMediaInputPeerSpecificItem.swift @@ -6,6 +6,7 @@ import TelegramCore import SwiftSignalKit import Postbox import TelegramPresentationData +import AvatarNode final class ChatMediaInputPeerSpecificItem: ListViewItem { let account: Account diff --git a/submodules/TelegramUI/TelegramUI/ChatMediaInputTrendingPane.swift b/submodules/TelegramUI/TelegramUI/ChatMediaInputTrendingPane.swift index 4aac1bd2cf..fe878f5dc6 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMediaInputTrendingPane.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMediaInputTrendingPane.swift @@ -7,6 +7,8 @@ import TelegramCore import SwiftSignalKit import TelegramPresentationData import MergeLists +import OverlayStatusController +import AccountContext final class TrendingPaneInteraction { let installPack: (ItemCollectionInfo) -> Void @@ -107,7 +109,7 @@ private func trendingPaneEntries(trendingEntries: [FeaturedStickerPackItem], ins } final class ChatMediaInputTrendingPane: ChatMediaInputPane { - private let context: AccountContextImpl + private let context: AccountContext private let controllerInteraction: ChatControllerInteraction private let getItemIsPreviewed: (StickerPackItem) -> Bool @@ -127,7 +129,7 @@ final class ChatMediaInputTrendingPane: ChatMediaInputPane { var scrollingInitiated: (() -> Void)? - init(context: AccountContextImpl, controllerInteraction: ChatControllerInteraction, getItemIsPreviewed: @escaping (StickerPackItem) -> Bool) { + init(context: AccountContext, controllerInteraction: ChatControllerInteraction, getItemIsPreviewed: @escaping (StickerPackItem) -> Bool) { self.context = context self.controllerInteraction = controllerInteraction self.getItemIsPreviewed = getItemIsPreviewed diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageActionButtonsNode.swift b/submodules/TelegramUI/TelegramUI/ChatMessageActionButtonsNode.swift index e90094f074..97d3659fe1 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageActionButtonsNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageActionButtonsNode.swift @@ -5,6 +5,7 @@ import TelegramCore import Postbox import Display import TelegramPresentationData +import AccountContext private let titleFont = Font.medium(16.0) @@ -82,7 +83,7 @@ private final class ChatMessageActionButtonNode: ASDisplayNode { } } - class func asyncLayout(_ maybeNode: ChatMessageActionButtonNode?) -> (_ context: AccountContextImpl, _ theme: ChatPresentationThemeData, _ strings: PresentationStrings, _ message: Message, _ button: ReplyMarkupButton, _ constrainedWidth: CGFloat, _ position: MessageBubbleActionButtonPosition) -> (minimumWidth: CGFloat, layout: ((CGFloat) -> (CGSize, () -> ChatMessageActionButtonNode))) { + class func asyncLayout(_ maybeNode: ChatMessageActionButtonNode?) -> (_ context: AccountContext, _ theme: ChatPresentationThemeData, _ strings: PresentationStrings, _ message: Message, _ button: ReplyMarkupButton, _ constrainedWidth: CGFloat, _ position: MessageBubbleActionButtonPosition) -> (minimumWidth: CGFloat, layout: ((CGFloat) -> (CGSize, () -> ChatMessageActionButtonNode))) { let titleLayout = TextNode.asyncLayout(maybeNode?.titleNode) return { context, theme, strings, message, button, constrainedWidth, position in @@ -214,7 +215,7 @@ final class ChatMessageActionButtonsNode: ASDisplayNode { } } - class func asyncLayout(_ maybeNode: ChatMessageActionButtonsNode?) -> (_ context: AccountContextImpl, _ theme: ChatPresentationThemeData, _ strings: PresentationStrings, _ replyMarkup: ReplyMarkupMessageAttribute, _ message: Message, _ constrainedWidth: CGFloat) -> (minWidth: CGFloat, layout: (CGFloat) -> (CGSize, (_ animated: Bool) -> ChatMessageActionButtonsNode)) { + class func asyncLayout(_ maybeNode: ChatMessageActionButtonsNode?) -> (_ context: AccountContext, _ theme: ChatPresentationThemeData, _ strings: PresentationStrings, _ replyMarkup: ReplyMarkupMessageAttribute, _ message: Message, _ constrainedWidth: CGFloat) -> (minWidth: CGFloat, layout: (CGFloat) -> (CGSize, (_ animated: Bool) -> ChatMessageActionButtonsNode)) { let currentButtonLayouts = maybeNode?.buttonNodes.map { ChatMessageActionButtonNode.asyncLayout($0) } ?? [] return { context, theme, strings, replyMarkup, message, constrainedWidth in diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageActionUrlAuthController.swift b/submodules/TelegramUI/TelegramUI/ChatMessageActionUrlAuthController.swift index 06a390302e..9fcf97cfdb 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageActionUrlAuthController.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageActionUrlAuthController.swift @@ -8,6 +8,7 @@ import TelegramCore import TelegramPresentationData import CheckNode import TextFormat +import AccountContext private let textFont = Font.regular(13.0) private let boldTextFont = Font.semibold(13.0) @@ -296,7 +297,7 @@ private final class ChatMessageActionUrlAuthAlertContentNode: AlertContentNode { } } -func chatMessageActionUrlAuthController(context: AccountContextImpl, defaultUrl: String, domain: String, bot: Peer, requestWriteAccess: Bool, displayName: String, open: @escaping (Bool, Bool) -> Void) -> AlertController { +func chatMessageActionUrlAuthController(context: AccountContext, defaultUrl: String, domain: String, bot: Peer, requestWriteAccess: Bool, displayName: String, open: @escaping (Bool, Bool) -> Void) -> AlertController { let presentationData = context.sharedContext.currentPresentationData.with { $0 } let theme = presentationData.theme let strings = presentationData.strings diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageAnimatedStickerItemNode.swift b/submodules/TelegramUI/TelegramUI/ChatMessageAnimatedStickerItemNode.swift index 727f4f45d4..92f05cc5a7 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageAnimatedStickerItemNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageAnimatedStickerItemNode.swift @@ -9,6 +9,7 @@ import CoreImage import TelegramPresentationData import Compression import TextFormat +import AccountContext private let nameFont = Font.medium(14.0) private let inlineBotPrefixFont = Font.regular(14.0) diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageAttachedContentNode.swift b/submodules/TelegramUI/TelegramUI/ChatMessageAttachedContentNode.swift index 1d11c9589d..296b850d18 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageAttachedContentNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageAttachedContentNode.swift @@ -9,6 +9,7 @@ import Postbox import TelegramPresentationData import TelegramUIPreferences import TextFormat +import AccountContext private let titleFont = Font.semibold(15.0) private let textFont = Font.regular(15.0) @@ -229,7 +230,7 @@ final class ChatMessageAttachedContentNode: ASDisplayNode { private var additionalImageBadgeNode: ChatMessageInteractiveMediaBadge? private var linkHighlightingNode: LinkHighlightingNode? - private var context: AccountContextImpl? + private var context: AccountContext? private var message: Message? private var media: Media? private var theme: ChatPresentationThemeData? @@ -271,7 +272,7 @@ final class ChatMessageAttachedContentNode: ASDisplayNode { self.addSubnode(self.statusNode) } - func asyncLayout() -> (_ presentationData: ChatPresentationData, _ automaticDownloadSettings: MediaAutoDownloadSettings, _ associatedData: ChatMessageItemAssociatedData, _ context: AccountContextImpl, _ controllerInteraction: ChatControllerInteraction, _ message: Message, _ messageRead: Bool, _ title: String?, _ subtitle: NSAttributedString?, _ text: String?, _ entities: [MessageTextEntity]?, _ media: (Media, ChatMessageAttachedContentNodeMediaFlags)?, _ mediaBadge: String?, _ actionIcon: ChatMessageAttachedContentActionIcon?, _ actionTitle: String?, _ displayLine: Bool, _ layoutConstants: ChatMessageItemLayoutConstants, _ constrainedSize: CGSize) -> (CGFloat, (CGSize, ChatMessageBubbleContentPosition) -> (CGFloat, (CGFloat) -> (CGSize, (ListViewItemUpdateAnimation, Bool) -> Void))) { + func asyncLayout() -> (_ presentationData: ChatPresentationData, _ automaticDownloadSettings: MediaAutoDownloadSettings, _ associatedData: ChatMessageItemAssociatedData, _ context: AccountContext, _ controllerInteraction: ChatControllerInteraction, _ message: Message, _ messageRead: Bool, _ title: String?, _ subtitle: NSAttributedString?, _ text: String?, _ entities: [MessageTextEntity]?, _ media: (Media, ChatMessageAttachedContentNodeMediaFlags)?, _ mediaBadge: String?, _ actionIcon: ChatMessageAttachedContentActionIcon?, _ actionTitle: String?, _ displayLine: Bool, _ layoutConstants: ChatMessageItemLayoutConstants, _ constrainedSize: CGSize) -> (CGFloat, (CGSize, ChatMessageBubbleContentPosition) -> (CGFloat, (CGFloat) -> (CGSize, (ListViewItemUpdateAnimation, Bool) -> Void))) { let textAsyncLayout = TextNode.asyncLayout(self.textNode) let currentImage = self.media as? TelegramMediaImage let imageLayout = self.inlineImageNode.asyncLayout() diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageAvatarAccessoryItem.swift b/submodules/TelegramUI/TelegramUI/ChatMessageAvatarAccessoryItem.swift index ba500c8f21..21477ded25 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageAvatarAccessoryItem.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageAvatarAccessoryItem.swift @@ -4,11 +4,13 @@ import Postbox import Display import TelegramCore import TelegramPresentationData +import AvatarNode +import AccountContext private let avatarFont = UIFont(name: ".SFCompactRounded-Semibold", size: 16.0)! final class ChatMessageAvatarAccessoryItem: ListViewAccessoryItem { - private let context: AccountContextImpl + private let context: AccountContext private let peerId: PeerId private let peer: Peer? private let messageReference: MessageReference? @@ -17,7 +19,7 @@ final class ChatMessageAvatarAccessoryItem: ListViewAccessoryItem { private let day: Int32 - init(context: AccountContextImpl, peerId: PeerId, peer: Peer?, messageReference: MessageReference?, messageTimestamp: Int32, emptyColor: UIColor) { + init(context: AccountContext, peerId: PeerId, peer: Peer?, messageReference: MessageReference?, messageTimestamp: Int32, emptyColor: UIColor) { self.context = context self.peerId = peerId self.peer = peer diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageBubbleContentNode.swift b/submodules/TelegramUI/TelegramUI/ChatMessageBubbleContentNode.swift index 605abf112c..4e3bb82232 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageBubbleContentNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageBubbleContentNode.swift @@ -5,6 +5,7 @@ import Display import Postbox import TelegramCore import TelegramUIPreferences +import AccountContext enum ChatMessageBubbleContentBackgroundHiding { case never @@ -81,14 +82,14 @@ enum ChatMessageBubbleContentTapAction { } final class ChatMessageBubbleContentItem { - let context: AccountContextImpl + let context: AccountContext let controllerInteraction: ChatControllerInteraction let message: Message let read: Bool let presentationData: ChatPresentationData let associatedData: ChatMessageItemAssociatedData - init(context: AccountContextImpl, controllerInteraction: ChatControllerInteraction, message: Message, read: Bool, presentationData: ChatPresentationData, associatedData: ChatMessageItemAssociatedData) { + init(context: AccountContext, controllerInteraction: ChatControllerInteraction, message: Message, read: Bool, presentationData: ChatPresentationData, associatedData: ChatMessageItemAssociatedData) { self.context = context self.controllerInteraction = controllerInteraction self.message = message diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageBubbleItemNode.swift b/submodules/TelegramUI/TelegramUI/ChatMessageBubbleItemNode.swift index fa9438ff29..c347b94226 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageBubbleItemNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageBubbleItemNode.swift @@ -7,6 +7,8 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import TextFormat +import AccountContext +import TemporaryCachedPeerDataManager private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> [(Message, AnyClass)] { var result: [(Message, AnyClass)] = [] @@ -372,9 +374,9 @@ class ChatMessageBubbleItemNode: ChatMessageItemView { authorNameLayout: (TextNodeLayoutArguments) -> (TextNodeLayout, () -> TextNode), adminBadgeLayout: (TextNodeLayoutArguments) -> (TextNodeLayout, () -> TextNode), forwardInfoLayout: (ChatPresentationData, PresentationStrings, ChatMessageForwardInfoType, Peer?, String?, CGSize) -> (CGSize, () -> ChatMessageForwardInfoNode), - replyInfoLayout: (ChatPresentationData, PresentationStrings, AccountContextImpl, ChatMessageReplyInfoType, Message, CGSize) -> (CGSize, () -> ChatMessageReplyInfoNode), - actionButtonsLayout: (AccountContextImpl, ChatPresentationThemeData, PresentationStrings, ReplyMarkupMessageAttribute, Message, CGFloat) -> (minWidth: CGFloat, layout: (CGFloat) -> (CGSize, (Bool) -> ChatMessageActionButtonsNode)), - mosaicStatusLayout: (AccountContextImpl, ChatPresentationData, Bool, Int?, String, ChatMessageDateAndStatusType, CGSize) -> (CGSize, (Bool) -> ChatMessageDateAndStatusNode), + replyInfoLayout: (ChatPresentationData, PresentationStrings, AccountContext, ChatMessageReplyInfoType, Message, CGSize) -> (CGSize, () -> ChatMessageReplyInfoNode), + actionButtonsLayout: (AccountContext, ChatPresentationThemeData, PresentationStrings, ReplyMarkupMessageAttribute, Message, CGFloat) -> (minWidth: CGFloat, layout: (CGFloat) -> (CGSize, (Bool) -> ChatMessageActionButtonsNode)), + mosaicStatusLayout: (AccountContext, ChatPresentationData, Bool, Int?, String, ChatMessageDateAndStatusType, CGSize) -> (CGSize, (Bool) -> ChatMessageDateAndStatusNode), currentShareButtonNode: HighlightableButtonNode?, layoutConstants: ChatMessageItemLayoutConstants, currentItem: ChatMessageItem?, diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageContactBubbleContentNode.swift b/submodules/TelegramUI/TelegramUI/ChatMessageContactBubbleContentNode.swift index eea254f241..1ede92f814 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageContactBubbleContentNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageContactBubbleContentNode.swift @@ -6,6 +6,8 @@ import SwiftSignalKit import Postbox import TelegramCore import TelegramPresentationData +import AvatarNode +import AccountContext private let avatarFont = UIFont(name: ".SFCompactRounded-Semibold", size: 16.0)! diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageDateAndStatusNode.swift b/submodules/TelegramUI/TelegramUI/ChatMessageDateAndStatusNode.swift index 4266ffcdc1..d78286a8ad 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageDateAndStatusNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageDateAndStatusNode.swift @@ -5,6 +5,7 @@ import Postbox import Display import SwiftSignalKit import TelegramPresentationData +import AccountContext private let dateFont = UIFont.italicSystemFont(ofSize: 11.0) @@ -127,7 +128,7 @@ class ChatMessageDateAndStatusNode: ASDisplayNode { self.addSubnode(self.dateNode) } - func asyncLayout() -> (_ context: AccountContextImpl, _ presentationData: ChatPresentationData, _ edited: Bool, _ impressionCount: Int?, _ dateText: String, _ type: ChatMessageDateAndStatusType, _ constrainedSize: CGSize) -> (CGSize, (Bool) -> Void) { + func asyncLayout() -> (_ context: AccountContext, _ presentationData: ChatPresentationData, _ edited: Bool, _ impressionCount: Int?, _ dateText: String, _ type: ChatMessageDateAndStatusType, _ constrainedSize: CGSize) -> (CGSize, (Bool) -> Void) { let dateLayout = TextNode.asyncLayout(self.dateNode) var checkReadNode = self.checkReadNode @@ -506,7 +507,7 @@ class ChatMessageDateAndStatusNode: ASDisplayNode { } } - static func asyncLayout(_ node: ChatMessageDateAndStatusNode?) -> (_ context: AccountContextImpl, _ presentationData: ChatPresentationData, _ edited: Bool, _ impressionCount: Int?, _ dateText: String, _ type: ChatMessageDateAndStatusType, _ constrainedSize: CGSize) -> (CGSize, (Bool) -> ChatMessageDateAndStatusNode) { + static func asyncLayout(_ node: ChatMessageDateAndStatusNode?) -> (_ context: AccountContext, _ presentationData: ChatPresentationData, _ edited: Bool, _ impressionCount: Int?, _ dateText: String, _ type: ChatMessageDateAndStatusType, _ constrainedSize: CGSize) -> (CGSize, (Bool) -> ChatMessageDateAndStatusNode) { let currentLayout = node?.asyncLayout() return { context, presentationData, edited, impressionCount, dateText, type, constrainedSize in let resultNode: ChatMessageDateAndStatusNode diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageDateHeader.swift b/submodules/TelegramUI/TelegramUI/ChatMessageDateHeader.swift index ff80ca22b1..3ea4bdb968 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageDateHeader.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageDateHeader.swift @@ -4,6 +4,7 @@ import Display import AsyncDisplayKit import TelegramPresentationData import Postbox +import AccountContext private let timezoneOffset: Int32 = { let nowTimestamp = Int32(CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970) @@ -21,10 +22,10 @@ final class ChatMessageDateHeader: ListViewItemHeader { let id: Int64 let presentationData: ChatPresentationData - let context: AccountContextImpl + let context: AccountContext let action: ((Int32) -> Void)? - init(timestamp: Int32, presentationData: ChatPresentationData, context: AccountContextImpl, action: ((Int32) -> Void)? = nil) { + init(timestamp: Int32, presentationData: ChatPresentationData, context: AccountContext, action: ((Int32) -> Void)? = nil) { self.timestamp = timestamp self.presentationData = presentationData self.context = context @@ -86,13 +87,13 @@ final class ChatMessageDateHeaderNode: ListViewItemHeaderNode { private let localTimestamp: Int32 private var presentationData: ChatPresentationData - private let context: AccountContextImpl + private let context: AccountContext private var flashingOnScrolling = false private var stickDistanceFactor: CGFloat = 0.0 private var action: ((Int32) -> Void)? = nil - init(localTimestamp: Int32, presentationData: ChatPresentationData, context: AccountContextImpl, action: ((Int32) -> Void)? = nil) { + init(localTimestamp: Int32, presentationData: ChatPresentationData, context: AccountContext, action: ((Int32) -> Void)? = nil) { self.presentationData = presentationData self.context = context @@ -161,7 +162,7 @@ final class ChatMessageDateHeaderNode: ListViewItemHeaderNode { self.view.addGestureRecognizer(ListViewTapGestureRecognizer(target: self, action: #selector(self.tapGesture(_:)))) } - func updatePresentationData(_ presentationData: ChatPresentationData, context: AccountContextImpl) { + func updatePresentationData(_ presentationData: ChatPresentationData, context: AccountContext) { let graphics = PresentationResourcesChat.principalGraphics(mediaBox: context.account.postbox.mediaBox, knockoutWallpaper: context.sharedContext.immediateExperimentalUISettings.knockoutWallpaper, theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper) self.backgroundNode.image = graphics.dateStaticBackground diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageInstantVideoItemNode.swift b/submodules/TelegramUI/TelegramUI/ChatMessageInstantVideoItemNode.swift index 1c6b12f95f..58830a2d43 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageInstantVideoItemNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageInstantVideoItemNode.swift @@ -8,6 +8,7 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import TextFormat +import AccountContext private let nameFont = Font.medium(14.0) diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageInteractiveFileNode.swift b/submodules/TelegramUI/TelegramUI/ChatMessageInteractiveFileNode.swift index 20a898be70..d07e1eb221 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageInteractiveFileNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageInteractiveFileNode.swift @@ -7,6 +7,7 @@ import Display import TelegramCore import UniversalMediaPlayer import TelegramPresentationData +import AccountContext private struct FetchControls { let fetch: () -> Void @@ -60,7 +61,7 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode { var activateLocalContent: () -> Void = { } var requestUpdateLayout: (Bool) -> Void = { _ in } - private var context: AccountContextImpl? + private var context: AccountContext? private var message: Message? private var themeAndStrings: (ChatPresentationThemeData, PresentationStrings, String)? private var file: TelegramMediaFile? @@ -184,7 +185,7 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode { } } - func asyncLayout() -> (_ context: AccountContextImpl, _ presentationData: ChatPresentationData, _ message: Message, _ file: TelegramMediaFile, _ automaticDownload: Bool, _ incoming: Bool, _ isRecentActions: Bool, _ forcedResourceStatus: FileMediaResourceStatus?, _ dateAndStatusType: ChatMessageDateAndStatusType?, _ constrainedSize: CGSize) -> (CGFloat, (CGSize) -> (CGFloat, (CGFloat) -> (CGSize, (Bool) -> Void))) { + func asyncLayout() -> (_ context: AccountContext, _ presentationData: ChatPresentationData, _ message: Message, _ file: TelegramMediaFile, _ automaticDownload: Bool, _ incoming: Bool, _ isRecentActions: Bool, _ forcedResourceStatus: FileMediaResourceStatus?, _ dateAndStatusType: ChatMessageDateAndStatusType?, _ constrainedSize: CGSize) -> (CGFloat, (CGSize) -> (CGFloat, (CGFloat) -> (CGSize, (Bool) -> Void))) { let currentFile = self.file let titleAsyncLayout = TextNode.asyncLayout(self.titleNode) @@ -859,12 +860,12 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode { self.fetchingCompactTextNode.frame = CGRect(origin: self.descriptionNode.frame.origin, size: fetchingCompactSize) } - static func asyncLayout(_ node: ChatMessageInteractiveFileNode?) -> (_ context: AccountContextImpl, _ presentationData: ChatPresentationData, _ message: Message, _ file: TelegramMediaFile, _ automaticDownload: Bool, _ incoming: Bool, _ isRecentActions: Bool, _ forcedResourceStatus: FileMediaResourceStatus?, _ dateAndStatusType: ChatMessageDateAndStatusType?, _ constrainedSize: CGSize) -> (CGFloat, (CGSize) -> (CGFloat, (CGFloat) -> (CGSize, (Bool) -> ChatMessageInteractiveFileNode))) { + static func asyncLayout(_ node: ChatMessageInteractiveFileNode?) -> (_ context: AccountContext, _ presentationData: ChatPresentationData, _ message: Message, _ file: TelegramMediaFile, _ automaticDownload: Bool, _ incoming: Bool, _ isRecentActions: Bool, _ forcedResourceStatus: FileMediaResourceStatus?, _ dateAndStatusType: ChatMessageDateAndStatusType?, _ constrainedSize: CGSize) -> (CGFloat, (CGSize) -> (CGFloat, (CGFloat) -> (CGSize, (Bool) -> ChatMessageInteractiveFileNode))) { let currentAsyncLayout = node?.asyncLayout() return { context, presentationData, message, file, automaticDownload, incoming, isRecentActions, forcedResourceStatus, dateAndStatusType, constrainedSize in var fileNode: ChatMessageInteractiveFileNode - var fileLayout: (_ context: AccountContextImpl, _ presentationData: ChatPresentationData, _ message: Message, _ file: TelegramMediaFile, _ automaticDownload: Bool, _ incoming: Bool, _ isRecentActions: Bool, _ forcedResourceStatus: FileMediaResourceStatus?, _ dateAndStatusType: ChatMessageDateAndStatusType?, _ constrainedSize: CGSize) -> (CGFloat, (CGSize) -> (CGFloat, (CGFloat) -> (CGSize, (Bool) -> Void))) + var fileLayout: (_ context: AccountContext, _ presentationData: ChatPresentationData, _ message: Message, _ file: TelegramMediaFile, _ automaticDownload: Bool, _ incoming: Bool, _ isRecentActions: Bool, _ forcedResourceStatus: FileMediaResourceStatus?, _ dateAndStatusType: ChatMessageDateAndStatusType?, _ constrainedSize: CGSize) -> (CGFloat, (CGSize) -> (CGFloat, (CGFloat) -> (CGSize, (Bool) -> Void))) if let node = node, let currentAsyncLayout = currentAsyncLayout { fileNode = node diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageInteractiveInstantVideoNode.swift b/submodules/TelegramUI/TelegramUI/ChatMessageInteractiveInstantVideoNode.swift index ab9c101940..0f7ca428ff 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageInteractiveInstantVideoNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageInteractiveInstantVideoNode.swift @@ -7,6 +7,7 @@ import Postbox import TelegramCore import UniversalMediaPlayer import TelegramPresentationData +import AccountContext struct ChatMessageInstantVideoItemLayoutResult { let contentSize: CGSize diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageInteractiveMediaNode.swift b/submodules/TelegramUI/TelegramUI/ChatMessageInteractiveMediaNode.swift index 626a095eb4..2dababfa93 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageInteractiveMediaNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageInteractiveMediaNode.swift @@ -9,6 +9,7 @@ import TelegramPresentationData import TelegramUIPreferences import UniversalMediaPlayer import TextFormat +import AccountContext private struct FetchControls { let fetch: (Bool) -> Void @@ -53,7 +54,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode { private var badgeNode: ChatMessageInteractiveMediaBadge? private var tapRecognizer: UITapGestureRecognizer? - private var context: AccountContextImpl? + private var context: AccountContext? private var message: Message? private var media: Media? private var themeAndStrings: (PresentationTheme, PresentationStrings, String)? @@ -200,7 +201,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode { } } - func asyncLayout() -> (_ context: AccountContextImpl, _ theme: PresentationTheme, _ strings: PresentationStrings, _ dateTimeFormat: PresentationDateTimeFormat, _ message: Message, _ media: Media, _ automaticDownload: InteractiveMediaNodeAutodownloadMode, _ peerType: MediaAutoDownloadPeerType, _ sizeCalculation: InteractiveMediaNodeSizeCalculation, _ layoutConstants: ChatMessageItemLayoutConstants, _ contentMode: InteractiveMediaNodeContentMode) -> (CGSize, CGFloat, (CGSize, Bool, Bool, ImageCorners) -> (CGFloat, (CGFloat) -> (CGSize, (ContainedViewLayoutTransition, Bool) -> Void))) { + func asyncLayout() -> (_ context: AccountContext, _ theme: PresentationTheme, _ strings: PresentationStrings, _ dateTimeFormat: PresentationDateTimeFormat, _ message: Message, _ media: Media, _ automaticDownload: InteractiveMediaNodeAutodownloadMode, _ peerType: MediaAutoDownloadPeerType, _ sizeCalculation: InteractiveMediaNodeSizeCalculation, _ layoutConstants: ChatMessageItemLayoutConstants, _ contentMode: InteractiveMediaNodeContentMode) -> (CGSize, CGFloat, (CGSize, Bool, Bool, ImageCorners) -> (CGFloat, (CGFloat) -> (CGSize, (ContainedViewLayoutTransition, Bool) -> Void))) { let currentMessage = self.message let currentMedia = self.media let imageLayout = self.imageNode.asyncLayout() @@ -1201,12 +1202,12 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode { } } - static func asyncLayout(_ node: ChatMessageInteractiveMediaNode?) -> (_ context: AccountContextImpl, _ theme: PresentationTheme, _ strings: PresentationStrings, _ dateTimeFormat: PresentationDateTimeFormat, _ message: Message, _ media: Media, _ automaticDownload: InteractiveMediaNodeAutodownloadMode, _ peerType: MediaAutoDownloadPeerType, _ sizeCalculation: InteractiveMediaNodeSizeCalculation, _ layoutConstants: ChatMessageItemLayoutConstants, _ contentMode: InteractiveMediaNodeContentMode) -> (CGSize, CGFloat, (CGSize, Bool, Bool, ImageCorners) -> (CGFloat, (CGFloat) -> (CGSize, (ContainedViewLayoutTransition, Bool) -> ChatMessageInteractiveMediaNode))) { + static func asyncLayout(_ node: ChatMessageInteractiveMediaNode?) -> (_ context: AccountContext, _ theme: PresentationTheme, _ strings: PresentationStrings, _ dateTimeFormat: PresentationDateTimeFormat, _ message: Message, _ media: Media, _ automaticDownload: InteractiveMediaNodeAutodownloadMode, _ peerType: MediaAutoDownloadPeerType, _ sizeCalculation: InteractiveMediaNodeSizeCalculation, _ layoutConstants: ChatMessageItemLayoutConstants, _ contentMode: InteractiveMediaNodeContentMode) -> (CGSize, CGFloat, (CGSize, Bool, Bool, ImageCorners) -> (CGFloat, (CGFloat) -> (CGSize, (ContainedViewLayoutTransition, Bool) -> ChatMessageInteractiveMediaNode))) { let currentAsyncLayout = node?.asyncLayout() return { context, theme, strings, dateTimeFormat, message, media, automaticDownload, peerType, sizeCalculation, layoutConstants, contentMode in var imageNode: ChatMessageInteractiveMediaNode - var imageLayout: (_ context: AccountContextImpl, _ theme: PresentationTheme, _ strings: PresentationStrings, _ dateTimeFormat: PresentationDateTimeFormat, _ message: Message, _ media: Media, _ automaticDownload: InteractiveMediaNodeAutodownloadMode, _ peerType: MediaAutoDownloadPeerType, _ sizeCalculation: InteractiveMediaNodeSizeCalculation, _ layoutConstants: ChatMessageItemLayoutConstants, _ contentMode: InteractiveMediaNodeContentMode) -> (CGSize, CGFloat, (CGSize, Bool, Bool, ImageCorners) -> (CGFloat, (CGFloat) -> (CGSize, (ContainedViewLayoutTransition, Bool) -> Void))) + var imageLayout: (_ context: AccountContext, _ theme: PresentationTheme, _ strings: PresentationStrings, _ dateTimeFormat: PresentationDateTimeFormat, _ message: Message, _ media: Media, _ automaticDownload: InteractiveMediaNodeAutodownloadMode, _ peerType: MediaAutoDownloadPeerType, _ sizeCalculation: InteractiveMediaNodeSizeCalculation, _ layoutConstants: ChatMessageItemLayoutConstants, _ contentMode: InteractiveMediaNodeContentMode) -> (CGSize, CGFloat, (CGSize, Bool, Bool, ImageCorners) -> (CGFloat, (CGFloat) -> (CGSize, (ContainedViewLayoutTransition, Bool) -> Void))) if let node = node, let currentAsyncLayout = currentAsyncLayout { imageNode = node @@ -1306,7 +1307,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode { if let videoNode = self.videoNode, let context = self.context, (self.automaticPlayback ?? false) && !isAnimated { return ({ timecode in if let timecode = timecode { - context.sharedContext.mediaManager.playlistControl(.playback(.pause)) + context.sharedContext.mediaManager.playlistControl(.playback(.pause), type: nil) videoNode.playOnceWithSound(playAndRecord: false, seek: .timecode(timecode), actionAtEnd: actionAtEnd) } else { let _ = (context.sharedContext.mediaManager.globalMediaPlayerState diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageItem.swift b/submodules/TelegramUI/TelegramUI/ChatMessageItem.swift index 56868c88df..155a64cb8f 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageItem.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageItem.swift @@ -7,6 +7,7 @@ import SwiftSignalKit import TelegramCore import TelegramPresentationData import TelegramUIPreferences +import AccountContext public enum ChatMessageItemContent: Sequence { case message(message: Message, read: Bool, selection: ChatHistoryMessageSelection, attributes: ChatMessageEntryAttributes) @@ -246,7 +247,7 @@ public final class ChatMessageItemAssociatedData: Equatable { public final class ChatMessageItem: ListViewItem, CustomStringConvertible { let presentationData: ChatPresentationData - let context: AccountContextImpl + let context: AccountContext let chatLocation: ChatLocation let associatedData: ChatMessageItemAssociatedData let controllerInteraction: ChatControllerInteraction @@ -276,7 +277,7 @@ public final class ChatMessageItem: ListViewItem, CustomStringConvertible { } } - public init(presentationData: ChatPresentationData, context: AccountContextImpl, chatLocation: ChatLocation, associatedData: ChatMessageItemAssociatedData, controllerInteraction: ChatControllerInteraction, content: ChatMessageItemContent, disableDate: Bool = false, additionalContent: ChatMessageItemAdditionalContent? = nil) { + public init(presentationData: ChatPresentationData, context: AccountContext, chatLocation: ChatLocation, associatedData: ChatMessageItemAssociatedData, controllerInteraction: ChatControllerInteraction, content: ChatMessageItemContent, disableDate: Bool = false, additionalContent: ChatMessageItemAdditionalContent? = nil) { self.presentationData = presentationData self.context = context self.chatLocation = chatLocation diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageItemView.swift b/submodules/TelegramUI/TelegramUI/ChatMessageItemView.swift index 64cbd15aa9..76f4c4e8dc 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageItemView.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageItemView.swift @@ -4,6 +4,7 @@ import AsyncDisplayKit import Display import Postbox import TelegramCore +import AccountContext struct ChatMessageItemWidthFill { let compactInset: CGFloat diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageLiveLocationPositionNode.swift b/submodules/TelegramUI/TelegramUI/ChatMessageLiveLocationPositionNode.swift index e492a7ce61..9ecdfbd2fe 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageLiveLocationPositionNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageLiveLocationPositionNode.swift @@ -5,6 +5,7 @@ import AsyncDisplayKit import TelegramCore import Postbox import TelegramPresentationData +import AvatarNode private let avatarFont = UIFont(name: ".SFCompactRounded-Semibold", size: 24.0)! private let avatarBackgroundImage = UIImage(bundleImageName: "Chat/Message/LocationPin")?.precomposed() diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageLiveLocationTextNode.swift b/submodules/TelegramUI/TelegramUI/ChatMessageLiveLocationTextNode.swift index f4a5872358..e1cc7e6739 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageLiveLocationTextNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageLiveLocationTextNode.swift @@ -4,6 +4,7 @@ import AsyncDisplayKit import Display import TelegramPresentationData import TelegramUIPreferences +import TelegramStringFormatting private let textFont: UIFont = Font.regular(14.0) diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageMapBubbleContentNode.swift b/submodules/TelegramUI/TelegramUI/ChatMessageMapBubbleContentNode.swift index d6b9423015..4e0700c33c 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageMapBubbleContentNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageMapBubbleContentNode.swift @@ -5,6 +5,7 @@ import Display import SwiftSignalKit import Postbox import TelegramCore +import LiveLocationTimerNode private let titleFont = Font.medium(14.0) private let liveTitleFont = Font.medium(16.0) diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageMediaBubbleContentNode.swift b/submodules/TelegramUI/TelegramUI/ChatMessageMediaBubbleContentNode.swift index 78ae58ebcf..6926a26b28 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageMediaBubbleContentNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageMediaBubbleContentNode.swift @@ -6,6 +6,7 @@ import SwiftSignalKit import Postbox import TelegramCore import TelegramUIPreferences +import AccountContext class ChatMessageMediaBubbleContentNode: ChatMessageBubbleContentNode { override var supportsMosaic: Bool { diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageNotificationItem.swift b/submodules/TelegramUI/TelegramUI/ChatMessageNotificationItem.swift index 5f820f907a..4e5d45eca8 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageNotificationItem.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageNotificationItem.swift @@ -7,9 +7,11 @@ import TelegramCore import SwiftSignalKit import TelegramPresentationData import TelegramUIPreferences +import AvatarNode +import AccountContext public final class ChatMessageNotificationItem: NotificationItem { - let context: AccountContextImpl + let context: AccountContext let strings: PresentationStrings let nameDisplayOrder: PresentationPersonNameOrder let messages: [Message] @@ -20,7 +22,7 @@ public final class ChatMessageNotificationItem: NotificationItem { return messages.first?.id.peerId } - public init(context: AccountContextImpl, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, messages: [Message], tapAction: @escaping () -> Bool, expandAction: @escaping (() -> (ASDisplayNode?, () -> Void)) -> Void) { + public init(context: AccountContext, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, messages: [Message], tapAction: @escaping () -> Bool, expandAction: @escaping (() -> (ASDisplayNode?, () -> Void)) -> Void) { self.context = context self.strings = strings self.nameDisplayOrder = nameDisplayOrder diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageReplyInfoNode.swift b/submodules/TelegramUI/TelegramUI/ChatMessageReplyInfoNode.swift index bd17d3fe45..7cd6983b75 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageReplyInfoNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageReplyInfoNode.swift @@ -6,6 +6,7 @@ import Display import TelegramCore import SwiftSignalKit import TelegramPresentationData +import AccountContext private let titleFont = Font.medium(14.0) private let textFont = Font.regular(14.0) @@ -41,7 +42,7 @@ class ChatMessageReplyInfoNode: ASDisplayNode { self.contentNode.addSubnode(self.lineNode) } - class func asyncLayout(_ maybeNode: ChatMessageReplyInfoNode?) -> (_ theme: ChatPresentationData, _ strings: PresentationStrings, _ context: AccountContextImpl, _ type: ChatMessageReplyInfoType, _ message: Message, _ constrainedSize: CGSize) -> (CGSize, () -> ChatMessageReplyInfoNode) { + class func asyncLayout(_ maybeNode: ChatMessageReplyInfoNode?) -> (_ theme: ChatPresentationData, _ strings: PresentationStrings, _ context: AccountContext, _ type: ChatMessageReplyInfoType, _ message: Message, _ constrainedSize: CGSize) -> (CGSize, () -> ChatMessageReplyInfoNode) { let titleNodeLayout = TextNode.asyncLayout(maybeNode?.titleNode) let textNodeLayout = TextNode.asyncLayout(maybeNode?.textNode) diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageStickerItemNode.swift b/submodules/TelegramUI/TelegramUI/ChatMessageStickerItemNode.swift index 8a36354cfc..f7d51055a3 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageStickerItemNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageStickerItemNode.swift @@ -7,6 +7,7 @@ import Postbox import TelegramCore import TelegramPresentationData import TextFormat +import AccountContext private let nameFont = Font.medium(14.0) private let inlineBotPrefixFont = Font.regular(14.0) diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageWebpageBubbleContentNode.swift b/submodules/TelegramUI/TelegramUI/ChatMessageWebpageBubbleContentNode.swift index 1241971ba7..5f12057862 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageWebpageBubbleContentNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageWebpageBubbleContentNode.swift @@ -7,6 +7,7 @@ import SwiftSignalKit import TelegramCore import TelegramUIPreferences import TextFormat +import AccountContext enum WebsiteType { case generic diff --git a/submodules/TelegramUI/TelegramUI/ChatPanelInterfaceInteraction.swift b/submodules/TelegramUI/TelegramUI/ChatPanelInterfaceInteraction.swift index e041698ced..babac77bb7 100644 --- a/submodules/TelegramUI/TelegramUI/ChatPanelInterfaceInteraction.swift +++ b/submodules/TelegramUI/TelegramUI/ChatPanelInterfaceInteraction.swift @@ -4,6 +4,7 @@ import Postbox import SwiftSignalKit import TelegramCore import Display +import AccountContext public enum ChatFinishMediaRecordingAction { case dismiss diff --git a/submodules/TelegramUI/TelegramUI/ChatPinnedMessageTitlePanelNode.swift b/submodules/TelegramUI/TelegramUI/ChatPinnedMessageTitlePanelNode.swift index 0abcf97a3b..d45c99d556 100644 --- a/submodules/TelegramUI/TelegramUI/ChatPinnedMessageTitlePanelNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatPinnedMessageTitlePanelNode.swift @@ -7,9 +7,10 @@ import TelegramCore import SwiftSignalKit import TelegramPresentationData import TelegramUIPreferences +import AccountContext final class ChatPinnedMessageTitlePanelNode: ChatTitleAccessoryPanelNode { - private let context: AccountContextImpl + private let context: AccountContext private let tapButton: HighlightTrackingButtonNode private let closeButton: HighlightableButtonNode private let lineNode: ASImageNode @@ -27,7 +28,7 @@ final class ChatPinnedMessageTitlePanelNode: ChatTitleAccessoryPanelNode { private let queue = Queue() - init(context: AccountContextImpl) { + init(context: AccountContext) { self.context = context self.tapButton = HighlightTrackingButtonNode() diff --git a/submodules/TelegramUI/TelegramUI/ChatRecentActionsController.swift b/submodules/TelegramUI/TelegramUI/ChatRecentActionsController.swift index 1f3748bec1..005efebfd9 100644 --- a/submodules/TelegramUI/TelegramUI/ChatRecentActionsController.swift +++ b/submodules/TelegramUI/TelegramUI/ChatRecentActionsController.swift @@ -5,13 +5,15 @@ import TelegramCore import Postbox import SwiftSignalKit import TelegramPresentationData +import TelegramBaseController +import AccountContext -final class ChatRecentActionsController: TelegramController { +final class ChatRecentActionsController: TelegramBaseController { private var controllerNode: ChatRecentActionsControllerNode { return self.displayNode as! ChatRecentActionsControllerNode } - private let context: AccountContextImpl + private let context: AccountContext private let peer: Peer private var presentationData: PresentationData private var presentationDataDisposable: Disposable? @@ -21,7 +23,7 @@ final class ChatRecentActionsController: TelegramController { private let titleView: ChatRecentActionsTitleView - init(context: AccountContextImpl, peer: Peer) { + init(context: AccountContext, peer: Peer) { self.context = context self.peer = peer diff --git a/submodules/TelegramUI/TelegramUI/ChatRecentActionsControllerNode.swift b/submodules/TelegramUI/TelegramUI/ChatRecentActionsControllerNode.swift index beaa38c8d3..651448a985 100644 --- a/submodules/TelegramUI/TelegramUI/ChatRecentActionsControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatRecentActionsControllerNode.swift @@ -8,6 +8,8 @@ import Display import TelegramPresentationData import TelegramUIPreferences import SafariServices +import AccountContext +import TemporaryCachedPeerDataManager private final class ChatRecentActionsListOpaqueState { let entries: [ChatRecentActionsEntry] @@ -20,7 +22,7 @@ private final class ChatRecentActionsListOpaqueState { } final class ChatRecentActionsControllerNode: ViewControllerTracingNode { - private let context: AccountContextImpl + private let context: AccountContext private let peer: Peer private var presentationData: PresentationData @@ -71,7 +73,7 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode { private var adminsState: ChannelMemberListState? private let banDisposables = DisposableDict() - init(context: AccountContextImpl, peer: Peer, presentationData: PresentationData, interaction: ChatRecentActionsInteraction, pushController: @escaping (ViewController) -> Void, presentController: @escaping (ViewController, Any?) -> Void, getNavigationController: @escaping () -> NavigationController?) { + init(context: AccountContext, peer: Peer, presentationData: PresentationData, interaction: ChatRecentActionsInteraction, pushController: @escaping (ViewController) -> Void, presentController: @escaping (ViewController, Any?) -> Void, getNavigationController: @escaping () -> NavigationController?) { self.context = context self.peer = peer self.presentationData = presentationData @@ -144,7 +146,7 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode { break } } - return openChatMessage(context: context, message: message, standalone: true, reverseMessageGalleryOrder: false, navigationController: navigationController, dismissInput: { + return context.sharedContext.openChatMessage(OpenChatMessageParams(context: context, message: message, standalone: true, reverseMessageGalleryOrder: false, navigationController: navigationController, dismissInput: { //self?.chatDisplayNode.dismissInput() }, present: { c, a in self?.presentController(c, a) @@ -171,7 +173,7 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode { }, callPeer: { peerId in self?.controllerInteraction?.callPeer(peerId) }, enqueueMessage: { _ in - }, sendSticker: nil, setupTemporaryHiddenMedia: { _, _, _ in }, chatAvatarHiddenMedia: { _, _ in}) + }, sendSticker: nil, setupTemporaryHiddenMedia: { _, _, _ in }, chatAvatarHiddenMedia: { _, _ in })) } return false }, openPeer: { [weak self] peerId, _, message in diff --git a/submodules/TelegramUI/TelegramUI/ChatRecentActionsFilterController.swift b/submodules/TelegramUI/TelegramUI/ChatRecentActionsFilterController.swift index 0b6499df5f..fd48fcd01f 100644 --- a/submodules/TelegramUI/TelegramUI/ChatRecentActionsFilterController.swift +++ b/submodules/TelegramUI/TelegramUI/ChatRecentActionsFilterController.swift @@ -7,6 +7,7 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext private final class ChatRecentActionsFilterControllerArguments { let account: Account @@ -360,7 +361,7 @@ private func channelRecentActionsFilterControllerEntries(presentationData: Prese return entries } -public func channelRecentActionsFilterController(context: AccountContextImpl, peer: Peer, events: AdminLogEventsFlags, adminPeerIds: [PeerId]?, apply: @escaping (_ events: AdminLogEventsFlags, _ adminPeerIds: [PeerId]?) -> Void) -> ViewController { +public func channelRecentActionsFilterController(context: AccountContext, peer: Peer, events: AdminLogEventsFlags, adminPeerIds: [PeerId]?, apply: @escaping (_ events: AdminLogEventsFlags, _ adminPeerIds: [PeerId]?) -> Void) -> ViewController { let statePromise = ValuePromise(ChatRecentActionsFilterControllerState(events: events, adminPeerIds: adminPeerIds), ignoreRepeated: true) let stateValue = Atomic(value: ChatRecentActionsFilterControllerState(events: events, adminPeerIds: adminPeerIds)) let updateState: ((ChatRecentActionsFilterControllerState) -> ChatRecentActionsFilterControllerState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/ChatRecentActionsHistoryTransition.swift b/submodules/TelegramUI/TelegramUI/ChatRecentActionsHistoryTransition.swift index b3eca557c5..a5cd298699 100644 --- a/submodules/TelegramUI/TelegramUI/ChatRecentActionsHistoryTransition.swift +++ b/submodules/TelegramUI/TelegramUI/ChatRecentActionsHistoryTransition.swift @@ -5,6 +5,7 @@ import TelegramCore import Postbox import TelegramPresentationData import MergeLists +import AccountContext enum ChatRecentActionsEntryContentIndex: Int32 { case header = 0 @@ -104,7 +105,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable { return self.id } - func item(context: AccountContextImpl, peer: Peer, controllerInteraction: ChatControllerInteraction) -> ListViewItem { + func item(context: AccountContext, peer: Peer, controllerInteraction: ChatControllerInteraction) -> ListViewItem { switch self.entry.event.action { case let .changeTitle(_, new): var peers = SimpleDictionary() @@ -1059,7 +1060,7 @@ struct ChatRecentActionsHistoryTransition { let isEmpty: Bool } -func chatRecentActionsHistoryPreparedTransition(from fromEntries: [ChatRecentActionsEntry], to toEntries: [ChatRecentActionsEntry], type: ChannelAdminEventLogUpdateType, canLoadEarlier: Bool, displayingResults: Bool, context: AccountContextImpl, peer: Peer, controllerInteraction: ChatControllerInteraction) -> ChatRecentActionsHistoryTransition { +func chatRecentActionsHistoryPreparedTransition(from fromEntries: [ChatRecentActionsEntry], to toEntries: [ChatRecentActionsEntry], type: ChannelAdminEventLogUpdateType, canLoadEarlier: Bool, displayingResults: Bool, context: AccountContext, peer: Peer, controllerInteraction: ChatControllerInteraction) -> ChatRecentActionsHistoryTransition { let (deleteIndices, indicesAndItems, updateIndices) = mergeListsStableWithUpdates(leftList: fromEntries, rightList: toEntries) let deletions = deleteIndices.map { ListViewDeleteItem(index: $0, directionHint: nil) } diff --git a/submodules/TelegramUI/TelegramUI/ChatRestrictedInputPanelNode.swift b/submodules/TelegramUI/TelegramUI/ChatRestrictedInputPanelNode.swift index 37c743d542..799682520b 100644 --- a/submodules/TelegramUI/TelegramUI/ChatRestrictedInputPanelNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatRestrictedInputPanelNode.swift @@ -5,6 +5,7 @@ import Display import TelegramCore import Postbox import SwiftSignalKit +import TelegramStringFormatting final class ChatRestrictedInputPanelNode: ChatInputPanelNode { private let textNode: ImmediateTextNode diff --git a/submodules/TelegramUI/TelegramUI/ChatSecretAutoremoveTimerActionSheet.swift b/submodules/TelegramUI/TelegramUI/ChatSecretAutoremoveTimerActionSheet.swift index 9b386f7f79..6dd5289115 100644 --- a/submodules/TelegramUI/TelegramUI/ChatSecretAutoremoveTimerActionSheet.swift +++ b/submodules/TelegramUI/TelegramUI/ChatSecretAutoremoveTimerActionSheet.swift @@ -7,6 +7,7 @@ import TelegramCore import SwiftSignalKit import Photos import TelegramPresentationData +import AccountContext final class ChatSecretAutoremoveTimerActionSheetController: ActionSheetController { private var presentationDisposable: Disposable? @@ -16,7 +17,7 @@ final class ChatSecretAutoremoveTimerActionSheetController: ActionSheetControlle return self._ready } - init(context: AccountContextImpl, currentValue: Int32, applyValue: @escaping (Int32) -> Void) { + init(context: AccountContext, currentValue: Int32, applyValue: @escaping (Int32) -> Void) { let presentationData = context.sharedContext.currentPresentationData.with { $0 } let theme = presentationData.theme let strings = presentationData.strings diff --git a/submodules/TelegramUI/TelegramUI/ChatSendMessageActionSheetController.swift b/submodules/TelegramUI/TelegramUI/ChatSendMessageActionSheetController.swift index 9c035db637..a34fa006fd 100644 --- a/submodules/TelegramUI/TelegramUI/ChatSendMessageActionSheetController.swift +++ b/submodules/TelegramUI/TelegramUI/ChatSendMessageActionSheetController.swift @@ -4,13 +4,14 @@ import Display import AsyncDisplayKit import SwiftSignalKit import TelegramPresentationData +import AccountContext final class ChatSendMessageActionSheetController: ViewController { var controllerNode: ChatSendMessageActionSheetControllerNode { return self.displayNode as! ChatSendMessageActionSheetControllerNode } - private let context: AccountContextImpl + private let context: AccountContext private let controllerInteraction: ChatControllerInteraction? private let interfaceState: ChatPresentationInterfaceState private let sendButtonFrame: CGRect @@ -25,7 +26,7 @@ final class ChatSendMessageActionSheetController: ViewController { private let hapticFeedback = HapticFeedback() - init(context: AccountContextImpl, controllerInteraction: ChatControllerInteraction?, interfaceState: ChatPresentationInterfaceState, sendButtonFrame: CGRect, textInputNode: EditableTextNode, completion: @escaping () -> Void) { + init(context: AccountContext, controllerInteraction: ChatControllerInteraction?, interfaceState: ChatPresentationInterfaceState, sendButtonFrame: CGRect, textInputNode: EditableTextNode, completion: @escaping () -> Void) { self.context = context self.controllerInteraction = controllerInteraction self.interfaceState = interfaceState diff --git a/submodules/TelegramUI/TelegramUI/ChatSendMessageActionSheetControllerNode.swift b/submodules/TelegramUI/TelegramUI/ChatSendMessageActionSheetControllerNode.swift index 74877cbe4f..0a2be8b93e 100644 --- a/submodules/TelegramUI/TelegramUI/ChatSendMessageActionSheetControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatSendMessageActionSheetControllerNode.swift @@ -6,6 +6,7 @@ import Display import Postbox import TelegramCore import TelegramPresentationData +import AccountContext private let leftInset: CGFloat = 16.0 private let rightInset: CGFloat = 46.0 @@ -100,7 +101,7 @@ private final class ActionSheetItemNode: ASDisplayNode { } final class ChatSendMessageActionSheetControllerNode: ViewControllerTracingNode, UIScrollViewDelegate { - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private let sendButtonFrame: CGRect private let textFieldFrame: CGRect @@ -129,7 +130,7 @@ final class ChatSendMessageActionSheetControllerNode: ViewControllerTracingNode, private var validLayout: ContainerViewLayout? - init(context: AccountContextImpl, sendButtonFrame: CGRect, textInputNode: EditableTextNode, forwardedCount: Int?, send: (() -> Void)?, sendSilently: (() -> Void)?, cancel: (() -> Void)?) { + init(context: AccountContext, sendButtonFrame: CGRect, textInputNode: EditableTextNode, forwardedCount: Int?, send: (() -> Void)?, sendSilently: (() -> Void)?, cancel: (() -> Void)?) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } self.sendButtonFrame = sendButtonFrame diff --git a/submodules/TelegramUI/TelegramUI/ChatTextFormat.swift b/submodules/TelegramUI/TelegramUI/ChatTextFormat.swift index f832b5aedc..fef4a10caf 100644 --- a/submodules/TelegramUI/TelegramUI/ChatTextFormat.swift +++ b/submodules/TelegramUI/TelegramUI/ChatTextFormat.swift @@ -1,5 +1,6 @@ import Foundation import TextFormat +import AccountContext func chatTextInputAddFormattingAttribute(_ state: ChatTextInputState, attribute: NSAttributedString.Key) -> ChatTextInputState { if !state.selectionRange.isEmpty { diff --git a/submodules/TelegramUI/TelegramUI/ChatTextInputAudioRecordingTimeNode.swift b/submodules/TelegramUI/TelegramUI/ChatTextInputAudioRecordingTimeNode.swift index 4af1545a4f..b3c17a2531 100644 --- a/submodules/TelegramUI/TelegramUI/ChatTextInputAudioRecordingTimeNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatTextInputAudioRecordingTimeNode.swift @@ -4,6 +4,7 @@ import AsyncDisplayKit import Display import SwiftSignalKit import TelegramPresentationData +import AccountContext private final class ChatTextInputAudioRecordingTimeNodeParameters: NSObject { let timestamp: Double diff --git a/submodules/TelegramUI/TelegramUI/ChatTextInputMediaRecordingButton.swift b/submodules/TelegramUI/TelegramUI/ChatTextInputMediaRecordingButton.swift index 8feb54bcc1..c13c723532 100644 --- a/submodules/TelegramUI/TelegramUI/ChatTextInputMediaRecordingButton.swift +++ b/submodules/TelegramUI/TelegramUI/ChatTextInputMediaRecordingButton.swift @@ -6,6 +6,7 @@ import TelegramCore import SwiftSignalKit import TelegramPresentationData import LegacyComponents +import AccountContext private let offsetThreshold: CGFloat = 10.0 private let dismissOffsetThreshold: CGFloat = 70.0 diff --git a/submodules/TelegramUI/TelegramUI/ChatTextInputPanelNode.swift b/submodules/TelegramUI/TelegramUI/ChatTextInputPanelNode.swift index d5bd5cd33a..f6c727c1c7 100644 --- a/submodules/TelegramUI/TelegramUI/ChatTextInputPanelNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatTextInputPanelNode.swift @@ -7,6 +7,7 @@ import TelegramCore import MobileCoreServices import TelegramPresentationData import TextFormat +import AccountContext private let searchLayoutProgressImage = generateImage(CGSize(width: 22.0, height: 22.0), contextGenerator: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -261,7 +262,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate { } } - override var context: AccountContextImpl? { + override var context: AccountContext? { didSet { self.actionButtons.micButton.account = self.context?.account } diff --git a/submodules/TelegramUI/TelegramUI/ChatTextInputPanelState.swift b/submodules/TelegramUI/TelegramUI/ChatTextInputPanelState.swift index 8ea3b67761..d6712aae61 100644 --- a/submodules/TelegramUI/TelegramUI/ChatTextInputPanelState.swift +++ b/submodules/TelegramUI/TelegramUI/ChatTextInputPanelState.swift @@ -1,4 +1,5 @@ import Foundation +import AccountContext struct ChatTextInputPanelState: Equatable { let accessoryItems: [ChatTextInputAccessoryItem] diff --git a/submodules/TelegramUI/TelegramUI/ChatTextLinkEditController.swift b/submodules/TelegramUI/TelegramUI/ChatTextLinkEditController.swift index 3a48fe08e3..e33d462d61 100644 --- a/submodules/TelegramUI/TelegramUI/ChatTextLinkEditController.swift +++ b/submodules/TelegramUI/TelegramUI/ChatTextLinkEditController.swift @@ -6,6 +6,7 @@ import Display import Postbox import TelegramCore import TelegramPresentationData +import AccountContext private final class ChatTextLinkEditInputFieldNode: ASDisplayNode, ASEditableTextNodeDelegate { private var theme: PresentationTheme @@ -380,7 +381,7 @@ private final class ChatTextLinkEditAlertContentNode: AlertContentNode { } } -func chatTextLinkEditController(sharedContext: SharedAccountContextImpl, account: Account, text: String, link: String?, apply: @escaping (String?) -> Void) -> AlertController { +func chatTextLinkEditController(sharedContext: SharedAccountContext, account: Account, text: String, link: String?, apply: @escaping (String?) -> Void) -> AlertController { let presentationData = sharedContext.currentPresentationData.with { $0 } var dismissImpl: ((Bool) -> Void)? diff --git a/submodules/TelegramUI/TelegramUI/ChatTitleView.swift b/submodules/TelegramUI/TelegramUI/ChatTitleView.swift index 217286e4c9..839f2fc34a 100644 --- a/submodules/TelegramUI/TelegramUI/ChatTitleView.swift +++ b/submodules/TelegramUI/TelegramUI/ChatTitleView.swift @@ -9,6 +9,7 @@ import LegacyComponents import TelegramPresentationData import TelegramUIPreferences import ActivityIndicator +import TelegramStringFormatting enum ChatTitleContent { case peer(peerView: PeerView, onlineMemberCount: Int32?) diff --git a/submodules/TelegramUI/TelegramUI/ChatUnreadItem.swift b/submodules/TelegramUI/TelegramUI/ChatUnreadItem.swift index e73f376609..4d78f52459 100644 --- a/submodules/TelegramUI/TelegramUI/ChatUnreadItem.swift +++ b/submodules/TelegramUI/TelegramUI/ChatUnreadItem.swift @@ -5,6 +5,7 @@ import AsyncDisplayKit import Display import SwiftSignalKit import TelegramPresentationData +import AccountContext private let titleFont = UIFont.systemFont(ofSize: 13.0) @@ -13,7 +14,7 @@ class ChatUnreadItem: ListViewItem { let presentationData: ChatPresentationData let header: ChatMessageDateHeader - init(index: MessageIndex, presentationData: ChatPresentationData, context: AccountContextImpl) { + init(index: MessageIndex, presentationData: ChatPresentationData, context: AccountContext) { self.index = index self.presentationData = presentationData self.header = ChatMessageDateHeader(timestamp: index.timestamp, presentationData: presentationData, context: context) diff --git a/submodules/TelegramUI/TelegramUI/CheckDiskSpace.swift b/submodules/TelegramUI/TelegramUI/CheckDiskSpace.swift index 3be22a3d3f..7f5bd2f86e 100644 --- a/submodules/TelegramUI/TelegramUI/CheckDiskSpace.swift +++ b/submodules/TelegramUI/TelegramUI/CheckDiskSpace.swift @@ -1,6 +1,7 @@ import Foundation import Display import TelegramCore +import AccountContext func totalDiskSpace() -> Int64 { do { @@ -20,7 +21,7 @@ func freeDiskSpace() -> Int64 { } } -func checkAvailableDiskSpace(context: AccountContextImpl, threshold: Int64 = 100 * 1024 * 1024, present: @escaping (ViewController, Any?) -> Void) -> Bool { +func checkAvailableDiskSpace(context: AccountContext, threshold: Int64 = 100 * 1024 * 1024, present: @escaping (ViewController, Any?) -> Void) -> Bool { guard freeDiskSpace() < threshold else { return true } diff --git a/submodules/TelegramUI/TelegramUI/CommandChatInputContextPanelNode.swift b/submodules/TelegramUI/TelegramUI/CommandChatInputContextPanelNode.swift index eae103c380..4af459c6ef 100644 --- a/submodules/TelegramUI/TelegramUI/CommandChatInputContextPanelNode.swift +++ b/submodules/TelegramUI/TelegramUI/CommandChatInputContextPanelNode.swift @@ -6,6 +6,7 @@ import TelegramCore import Display import TelegramPresentationData import MergeLists +import AccountContext private struct CommandChatInputContextPanelEntryStableId: Hashable { let command: PeerCommand @@ -60,7 +61,7 @@ final class CommandChatInputContextPanelNode: ChatInputContextPanelNode { private var enqueuedTransitions: [(CommandChatInputContextPanelTransition, Bool)] = [] private var validLayout: (CGSize, CGFloat, CGFloat)? - override init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings) { + override init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings) { self.listView = ListView() self.listView.isOpaque = false self.listView.stackFromBottom = true diff --git a/submodules/TelegramUI/TelegramUI/CommandChatInputPanelItem.swift b/submodules/TelegramUI/TelegramUI/CommandChatInputPanelItem.swift index f66a30bcb4..c1350cc9bc 100644 --- a/submodules/TelegramUI/TelegramUI/CommandChatInputPanelItem.swift +++ b/submodules/TelegramUI/TelegramUI/CommandChatInputPanelItem.swift @@ -6,6 +6,7 @@ import TelegramCore import SwiftSignalKit import Postbox import TelegramPresentationData +import AvatarNode final class CommandChatInputPanelItem: ListViewItem { fileprivate let account: Account diff --git a/submodules/TelegramUI/TelegramUI/ComposeController.swift b/submodules/TelegramUI/TelegramUI/ComposeController.swift index 225bdf2a56..47a90275c7 100644 --- a/submodules/TelegramUI/TelegramUI/ComposeController.swift +++ b/submodules/TelegramUI/TelegramUI/ComposeController.swift @@ -6,9 +6,10 @@ import Postbox import SwiftSignalKit import TelegramCore import TelegramPresentationData +import AccountContext public class ComposeController: ViewController { - private let context: AccountContextImpl + private let context: AccountContext private var contactsNode: ComposeControllerNode { return self.displayNode as! ComposeControllerNode @@ -28,7 +29,7 @@ public class ComposeController: ViewController { private var searchContentNode: NavigationBarSearchContentNode? - public init(context: AccountContextImpl) { + public init(context: AccountContext) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/ComposeControllerNode.swift b/submodules/TelegramUI/TelegramUI/ComposeControllerNode.swift index 5a4473cb37..3439974240 100644 --- a/submodules/TelegramUI/TelegramUI/ComposeControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ComposeControllerNode.swift @@ -5,11 +5,12 @@ import Postbox import TelegramCore import SwiftSignalKit import TelegramPresentationData +import AccountContext final class ComposeControllerNode: ASDisplayNode { let contactListNode: ContactListNode - private let context: AccountContextImpl + private let context: AccountContext private var searchDisplayController: SearchDisplayController? private var containerLayout: (ContainerViewLayout, CGFloat)? @@ -26,7 +27,7 @@ final class ComposeControllerNode: ASDisplayNode { private var presentationData: PresentationData private var presentationDataDisposable: Disposable? - init(context: AccountContextImpl) { + init(context: AccountContext) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/ConfirmPhoneNumberController.swift b/submodules/TelegramUI/TelegramUI/ConfirmPhoneNumberController.swift index 2344a048dd..f790c14291 100644 --- a/submodules/TelegramUI/TelegramUI/ConfirmPhoneNumberController.swift +++ b/submodules/TelegramUI/TelegramUI/ConfirmPhoneNumberController.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import TelegramPresentationData import ItemListUI +import AccountContext private final class ConfirmPhoneNumberCodeControllerArguments { let updateEntryText: (String) -> Void @@ -157,7 +158,7 @@ protocol ConfirmPhoneNumberCodeController: class { private final class ConfirmPhoneNumberCodeControllerImpl: ItemListController, ConfirmPhoneNumberCodeController { private let applyCodeImpl: (Int) -> Void - init(context: AccountContextImpl, state: Signal<(ItemListControllerState, (ItemListNodeState, ConfirmPhoneNumberCodeEntry.ItemGenerationArguments)), NoError>, applyCodeImpl: @escaping (Int) -> Void) { + init(context: AccountContext, state: Signal<(ItemListControllerState, (ItemListNodeState, ConfirmPhoneNumberCodeEntry.ItemGenerationArguments)), NoError>, applyCodeImpl: @escaping (Int) -> Void) { self.applyCodeImpl = applyCodeImpl let presentationData = context.sharedContext.currentPresentationData.with { $0 } @@ -173,7 +174,7 @@ private final class ConfirmPhoneNumberCodeControllerImpl: ItemListController ViewController { +func confirmPhoneNumberCodeController(context: AccountContext, phoneNumber: String, codeData: CancelAccountResetData) -> ViewController { let initialState = ConfirmPhoneNumberCodeControllerState(codeText: "", checking: false) let statePromise = ValuePromise(initialState, ignoreRepeated: true) diff --git a/submodules/TelegramUI/TelegramUI/ContactListNode.swift b/submodules/TelegramUI/TelegramUI/ContactListNode.swift index e642a48c1e..c9b2b8b6f3 100644 --- a/submodules/TelegramUI/TelegramUI/ContactListNode.swift +++ b/submodules/TelegramUI/TelegramUI/ContactListNode.swift @@ -766,7 +766,7 @@ enum ContactListFilter { } final class ContactListNode: ASDisplayNode { - private let context: AccountContextImpl + private let context: AccountContext private var presentation: ContactListPresentation? private let filters: [ContactListFilter] @@ -833,7 +833,7 @@ final class ContactListNode: ASDisplayNode { private var authorizationNode: PermissionContentNode private let displayPermissionPlaceholder: Bool - init(context: AccountContextImpl, presentation: Signal, filters: [ContactListFilter] = [.excludeSelf], selectionState: ContactListNodeGroupSelectionState? = nil, displayPermissionPlaceholder: Bool = true, displaySortOptions: Bool = false) { + init(context: AccountContext, presentation: Signal, filters: [ContactListFilter] = [.excludeSelf], selectionState: ContactListNodeGroupSelectionState? = nil, displayPermissionPlaceholder: Bool = true, displaySortOptions: Bool = false) { self.context = context self.filters = filters self.displayPermissionPlaceholder = displayPermissionPlaceholder diff --git a/submodules/TelegramUI/TelegramUI/ContactMultiselectionController.swift b/submodules/TelegramUI/TelegramUI/ContactMultiselectionController.swift index e375f6478c..f767f47ced 100644 --- a/submodules/TelegramUI/TelegramUI/ContactMultiselectionController.swift +++ b/submodules/TelegramUI/TelegramUI/ContactMultiselectionController.swift @@ -7,6 +7,7 @@ import SwiftSignalKit import TelegramCore import TelegramPresentationData import ProgressNavigationButtonNode +import AccountContext enum ContactMultiselectionControllerMode { case groupCreation @@ -15,7 +16,7 @@ enum ContactMultiselectionControllerMode { } class ContactMultiselectionController: ViewController { - private let context: AccountContextImpl + private let context: AccountContext private let mode: ContactMultiselectionControllerMode private let titleView: CounterContollerTitleView @@ -65,7 +66,7 @@ class ContactMultiselectionController: ViewController { private let options: [ContactListAdditionalOption] private let filters: [ContactListFilter] - init(context: AccountContextImpl, mode: ContactMultiselectionControllerMode, options: [ContactListAdditionalOption], filters: [ContactListFilter] = [.excludeSelf]) { + init(context: AccountContext, mode: ContactMultiselectionControllerMode, options: [ContactListAdditionalOption], filters: [ContactListFilter] = [.excludeSelf]) { self.context = context self.mode = mode self.options = options diff --git a/submodules/TelegramUI/TelegramUI/ContactMultiselectionControllerNode.swift b/submodules/TelegramUI/TelegramUI/ContactMultiselectionControllerNode.swift index f142a9c164..3cc6d08353 100644 --- a/submodules/TelegramUI/TelegramUI/ContactMultiselectionControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ContactMultiselectionControllerNode.swift @@ -6,6 +6,7 @@ import TelegramCore import SwiftSignalKit import TelegramPresentationData import MergeLists +import AccountContext private struct SearchResultEntry: Identifiable { let index: Int @@ -29,7 +30,7 @@ final class ContactMultiselectionControllerNode: ASDisplayNode { let tokenListNode: EditableTokenListNode var searchResultsNode: ContactListNode? - private let context: AccountContextImpl + private let context: AccountContext private var containerLayout: (ContainerViewLayout, CGFloat, CGFloat)? @@ -46,7 +47,7 @@ final class ContactMultiselectionControllerNode: ASDisplayNode { private var presentationData: PresentationData private var presentationDataDisposable: Disposable? - init(context: AccountContextImpl, mode: ContactMultiselectionControllerMode, options: [ContactListAdditionalOption], filters: [ContactListFilter]) { + init(context: AccountContext, mode: ContactMultiselectionControllerMode, options: [ContactListAdditionalOption], filters: [ContactListFilter]) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/ContactSelectionController.swift b/submodules/TelegramUI/TelegramUI/ContactSelectionController.swift index 9997e097c8..be63a182ea 100644 --- a/submodules/TelegramUI/TelegramUI/ContactSelectionController.swift +++ b/submodules/TelegramUI/TelegramUI/ContactSelectionController.swift @@ -7,9 +7,10 @@ import SwiftSignalKit import TelegramCore import TelegramPresentationData import ProgressNavigationButtonNode +import AccountContext class ContactSelectionController: ViewController, PresentableController { - private let context: AccountContextImpl + private let context: AccountContext private let autoDismiss: Bool private var contactsNode: ContactSelectionControllerNode { @@ -64,7 +65,7 @@ class ContactSelectionController: ViewController, PresentableController { } } - init(context: AccountContextImpl, autoDismiss: Bool = true, title: @escaping (PresentationStrings) -> String, options: [ContactListAdditionalOption] = [], displayDeviceContacts: Bool = false, confirmation: @escaping (ContactListPeer) -> Signal = { _ in .single(true) }) { + init(context: AccountContext, autoDismiss: Bool = true, title: @escaping (PresentationStrings) -> String, options: [ContactListAdditionalOption] = [], displayDeviceContacts: Bool = false, confirmation: @escaping (ContactListPeer) -> Signal = { _ in .single(true) }) { self.context = context self.autoDismiss = autoDismiss self.titleProducer = title diff --git a/submodules/TelegramUI/TelegramUI/ContactSelectionControllerNode.swift b/submodules/TelegramUI/TelegramUI/ContactSelectionControllerNode.swift index 3e02fd1f02..08a17a1356 100644 --- a/submodules/TelegramUI/TelegramUI/ContactSelectionControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ContactSelectionControllerNode.swift @@ -5,6 +5,7 @@ import Postbox import TelegramCore import SwiftSignalKit import TelegramPresentationData +import AccountContext final class ContactSelectionControllerNode: ASDisplayNode { var displayProgress: Bool = false { @@ -21,7 +22,7 @@ final class ContactSelectionControllerNode: ASDisplayNode { let contactListNode: ContactListNode private let dimNode: ASDisplayNode - private let context: AccountContextImpl + private let context: AccountContext private var searchDisplayController: SearchDisplayController? private var containerLayout: (ContainerViewLayout, CGFloat)? @@ -35,7 +36,7 @@ final class ContactSelectionControllerNode: ASDisplayNode { var presentationData: PresentationData var presentationDataDisposable: Disposable? - init(context: AccountContextImpl, options: [ContactListAdditionalOption], displayDeviceContacts: Bool) { + init(context: AccountContext, options: [ContactListAdditionalOption], displayDeviceContacts: Bool) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } self.displayDeviceContacts = displayDeviceContacts diff --git a/submodules/TelegramUI/TelegramUI/ContactsController.swift b/submodules/TelegramUI/TelegramUI/ContactsController.swift index b642a2e916..30665e8680 100644 --- a/submodules/TelegramUI/TelegramUI/ContactsController.swift +++ b/submodules/TelegramUI/TelegramUI/ContactsController.swift @@ -8,6 +8,7 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import DeviceAccess +import AccountContext private func fixListNodeScrolling(_ listNode: ListView, searchNode: NavigationBarSearchContentNode) -> Bool { if searchNode.expansionProgress > 0.0 && searchNode.expansionProgress < 1.0 { @@ -54,7 +55,7 @@ private func fixListNodeScrolling(_ listNode: ListView, searchNode: NavigationBa } public class ContactsController: ViewController { - private let context: AccountContextImpl + private let context: AccountContext private var contactsNode: ContactsControllerNode { return self.displayNode as! ContactsControllerNode @@ -83,7 +84,7 @@ public class ContactsController: ViewController { } } - public init(context: AccountContextImpl) { + public init(context: AccountContext) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/ContactsControllerNode.swift b/submodules/TelegramUI/TelegramUI/ContactsControllerNode.swift index 44006d914f..bb1a44cf79 100644 --- a/submodules/TelegramUI/TelegramUI/ContactsControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ContactsControllerNode.swift @@ -8,6 +8,7 @@ import SwiftSignalKit import TelegramPresentationData import TelegramUIPreferences import DeviceAccess +import AccountContext private final class ContactsControllerNodeView: UITracingLayerView, PreviewingHostView { var previewingDelegate: PreviewingHostViewDelegate? { @@ -24,7 +25,7 @@ private final class ContactsControllerNodeView: UITracingLayerView, PreviewingHo final class ContactsControllerNode: ASDisplayNode { let contactListNode: ContactListNode - private let context: AccountContextImpl + private let context: AccountContext private(set) var searchDisplayController: SearchDisplayController? private var containerLayout: (ContainerViewLayout, CGFloat)? @@ -41,7 +42,7 @@ final class ContactsControllerNode: ASDisplayNode { weak var controller: ContactsController? - init(context: AccountContextImpl, sortOrder: Signal, present: @escaping (ViewController, Any?) -> Void, controller: ContactsController) { + init(context: AccountContext, sortOrder: Signal, present: @escaping (ViewController, Any?) -> Void, controller: ContactsController) { self.context = context self.controller = controller diff --git a/submodules/TelegramUI/TelegramUI/ContactsPeerItem.swift b/submodules/TelegramUI/TelegramUI/ContactsPeerItem.swift index 2935e9f173..f59d089d54 100644 --- a/submodules/TelegramUI/TelegramUI/ContactsPeerItem.swift +++ b/submodules/TelegramUI/TelegramUI/ContactsPeerItem.swift @@ -9,6 +9,9 @@ import TelegramPresentationData import TelegramUIPreferences import ItemListUI import CheckNode +import AvatarNode +import TelegramStringFormatting +import AccountContext private let titleFont = Font.regular(17.0) private let titleBoldFont = Font.medium(17.0) diff --git a/submodules/TelegramUI/TelegramUI/ContactsSearchContainerNode.swift b/submodules/TelegramUI/TelegramUI/ContactsSearchContainerNode.swift index ba54a53c16..c0f3089817 100644 --- a/submodules/TelegramUI/TelegramUI/ContactsSearchContainerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ContactsSearchContainerNode.swift @@ -8,6 +8,7 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import MergeLists +import AccountContext private enum ContactListSearchGroup { case contacts @@ -127,7 +128,7 @@ struct ContactsSearchCategories: OptionSet { } final class ContactsSearchContainerNode: SearchDisplayControllerContentNode { - private let context: AccountContextImpl + private let context: AccountContext private let openPeer: (ContactListPeer) -> Void private let dimNode: ASDisplayNode @@ -142,7 +143,7 @@ final class ContactsSearchContainerNode: SearchDisplayControllerContentNode { private var containerViewLayout: (ContainerViewLayout, CGFloat)? private var enqueuedTransitions: [ContactListSearchContainerTransition] = [] - init(context: AccountContextImpl, onlyWriteable: Bool, categories: ContactsSearchCategories, filters: [ContactListFilter] = [.excludeSelf], openPeer: @escaping (ContactListPeer) -> Void) { + init(context: AccountContext, onlyWriteable: Bool, categories: ContactsSearchCategories, filters: [ContactListFilter] = [.excludeSelf], openPeer: @escaping (ContactListPeer) -> Void) { self.context = context self.openPeer = openPeer diff --git a/submodules/TelegramUI/TelegramUI/ConvertToSupergroupController.swift b/submodules/TelegramUI/TelegramUI/ConvertToSupergroupController.swift index 498beb2401..15b6941b46 100644 --- a/submodules/TelegramUI/TelegramUI/ConvertToSupergroupController.swift +++ b/submodules/TelegramUI/TelegramUI/ConvertToSupergroupController.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import TelegramPresentationData import ItemListUI +import AccountContext private final class ConvertToSupergroupArguments { let convert: () -> Void @@ -115,7 +116,7 @@ private func convertToSupergroupEntries(presentationData: PresentationData) -> [ return entries } -public func convertToSupergroupController(context: AccountContextImpl, peerId: PeerId) -> ViewController { +public func convertToSupergroupController(context: AccountContext, peerId: PeerId) -> ViewController { var replaceControllerImpl: ((ViewController) -> Void)? var presentControllerImpl: ((ViewController, Any?) -> Void)? diff --git a/submodules/TelegramUI/TelegramUI/CreateChannelController.swift b/submodules/TelegramUI/TelegramUI/CreateChannelController.swift index b9d30c7d19..d087bbbe5e 100644 --- a/submodules/TelegramUI/TelegramUI/CreateChannelController.swift +++ b/submodules/TelegramUI/TelegramUI/CreateChannelController.swift @@ -7,6 +7,7 @@ import TelegramCore import TelegramPresentationData import LegacyComponents import ItemListUI +import AccountContext private struct CreateChannelArguments { let account: Account @@ -187,7 +188,7 @@ private func CreateChannelEntries(presentationData: PresentationData, state: Cre return entries } -public func createChannelController(context: AccountContextImpl) -> ViewController { +public func createChannelController(context: AccountContext) -> ViewController { let initialState = CreateChannelState(creating: false, editingName: ItemListAvatarAndNameInfoItemName.title(title: "", type: .channel), editingDescriptionText: "", avatar: nil) let statePromise = ValuePromise(initialState, ignoreRepeated: true) let stateValue = Atomic(value: initialState) diff --git a/submodules/TelegramUI/TelegramUI/CreateGroupController.swift b/submodules/TelegramUI/TelegramUI/CreateGroupController.swift index 04db31d318..7a9fcb2a7a 100644 --- a/submodules/TelegramUI/TelegramUI/CreateGroupController.swift +++ b/submodules/TelegramUI/TelegramUI/CreateGroupController.swift @@ -8,6 +8,7 @@ import TelegramPresentationData import TelegramUIPreferences import LegacyComponents import ItemListUI +import AccountContext public enum CreateGroupMode { case generic @@ -288,7 +289,7 @@ private func createGroupEntries(presentationData: PresentationData, state: Creat return entries } -public func createGroupController(context: AccountContextImpl, peerIds: [PeerId], initialTitle: String? = nil, mode: CreateGroupMode = .generic, completion: ((PeerId, @escaping () -> Void) -> Void)? = nil) -> ViewController { +public func createGroupController(context: AccountContext, peerIds: [PeerId], initialTitle: String? = nil, mode: CreateGroupMode = .generic, completion: ((PeerId, @escaping () -> Void) -> Void)? = nil) -> ViewController { var location: PeerGeoLocation? if case let .locatedGroup(latitude, longitude, address) = mode { location = PeerGeoLocation(latitude: latitude, longitude: longitude, address: address ?? "") diff --git a/submodules/TelegramUI/TelegramUI/CreatePasswordController.swift b/submodules/TelegramUI/TelegramUI/CreatePasswordController.swift index 02422b5344..7cbb9ad385 100644 --- a/submodules/TelegramUI/TelegramUI/CreatePasswordController.swift +++ b/submodules/TelegramUI/TelegramUI/CreatePasswordController.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import TelegramPresentationData import ItemListUI +import AccountContext private enum CreatePasswordField { case password @@ -221,7 +222,7 @@ enum CreatePasswordState: Equatable { case pendingVerification(emailPattern: String) } -func createPasswordController(context: AccountContextImpl, createPasswordContext: CreatePasswordContext, state: CreatePasswordState, completion: @escaping (String, String, Bool) -> Void, updatePasswordEmailConfirmation: @escaping ((String, String)?) -> Void, processPasswordEmailConfirmation: Bool = true) -> ViewController { +func createPasswordController(context: AccountContext, createPasswordContext: CreatePasswordContext, state: CreatePasswordState, completion: @escaping (String, String, Bool) -> Void, updatePasswordEmailConfirmation: @escaping ((String, String)?) -> Void, processPasswordEmailConfirmation: Bool = true) -> ViewController { let statePromise = ValuePromise(CreatePasswordControllerState(state: state), ignoreRepeated: true) let stateValue = Atomic(value: CreatePasswordControllerState(state: state)) let updateState: ((CreatePasswordControllerState) -> CreatePasswordControllerState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/CreatePollController.swift b/submodules/TelegramUI/TelegramUI/CreatePollController.swift index cdc64c9034..b98d3ba148 100644 --- a/submodules/TelegramUI/TelegramUI/CreatePollController.swift +++ b/submodules/TelegramUI/TelegramUI/CreatePollController.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import TelegramPresentationData import ItemListUI +import AccountContext private let maxTextLength = 255 private let maxOptionLength = 100 @@ -195,7 +196,7 @@ private func createPollControllerEntries(presentationData: PresentationData, sta return entries } -public func createPollController(context: AccountContextImpl, peerId: PeerId, completion: @escaping (EnqueueMessage) -> Void) -> ViewController { +public func createPollController(context: AccountContext, peerId: PeerId, completion: @escaping (EnqueueMessage) -> Void) -> ViewController { let statePromise = ValuePromise(CreatePollControllerState(), ignoreRepeated: true) let stateValue = Atomic(value: CreatePollControllerState()) let updateState: ((CreatePollControllerState) -> CreatePollControllerState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/CustomWallpaperPicker.swift b/submodules/TelegramUI/TelegramUI/CustomWallpaperPicker.swift index eeda8c94d5..b6c9fe9ca1 100644 --- a/submodules/TelegramUI/TelegramUI/CustomWallpaperPicker.swift +++ b/submodules/TelegramUI/TelegramUI/CustomWallpaperPicker.swift @@ -7,8 +7,9 @@ import TelegramCore import LegacyComponents import TelegramUIPreferences import MediaResources +import AccountContext -func presentCustomWallpaperPicker(context: AccountContextImpl, present: @escaping (ViewController) -> Void) { +func presentCustomWallpaperPicker(context: AccountContext, present: @escaping (ViewController) -> Void) { let presentationData = context.sharedContext.currentPresentationData.with { $0 } let _ = legacyWallpaperPicker(context: context, presentationData: presentationData).start(next: { generator in let legacyController = LegacyController(presentation: .modal(animateIn: true), theme: presentationData.theme) @@ -42,7 +43,7 @@ func presentCustomWallpaperPicker(context: AccountContextImpl, present: @escapin }) } -func uploadCustomWallpaper(context: AccountContextImpl, wallpaper: WallpaperGalleryEntry, mode: WallpaperPresentationOptions, cropRect: CGRect?, completion: @escaping () -> Void) { +func uploadCustomWallpaper(context: AccountContext, wallpaper: WallpaperGalleryEntry, mode: WallpaperPresentationOptions, cropRect: CGRect?, completion: @escaping () -> Void) { let imageSignal: Signal switch wallpaper { case let .wallpaper(wallpaper, _): diff --git a/submodules/TelegramUI/TelegramUI/DataAndStorageSettingsController.swift b/submodules/TelegramUI/TelegramUI/DataAndStorageSettingsController.swift index 3b83bb0b67..24cd66d65d 100644 --- a/submodules/TelegramUI/TelegramUI/DataAndStorageSettingsController.swift +++ b/submodules/TelegramUI/TelegramUI/DataAndStorageSettingsController.swift @@ -8,6 +8,7 @@ import LegacyComponents import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext private final class DataAndStorageControllerArguments { let openStorageUsage: () -> Void @@ -455,7 +456,7 @@ private func dataAndStorageControllerEntries(state: DataAndStorageControllerStat return entries } -func dataAndStorageController(context: AccountContextImpl, focusOnItemTag: DataAndStorageEntryTag? = nil) -> ViewController { +func dataAndStorageController(context: AccountContext, focusOnItemTag: DataAndStorageEntryTag? = nil) -> ViewController { let initialState = DataAndStorageControllerState() let statePromise = ValuePromise(initialState, ignoreRepeated: true) diff --git a/submodules/TelegramUI/TelegramUI/DataPrivacySettingsController.swift b/submodules/TelegramUI/TelegramUI/DataPrivacySettingsController.swift index bce29af8f5..dea90aca28 100644 --- a/submodules/TelegramUI/TelegramUI/DataPrivacySettingsController.swift +++ b/submodules/TelegramUI/TelegramUI/DataPrivacySettingsController.swift @@ -7,6 +7,8 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import OverlayStatusController +import AccountContext private final class DataPrivacyControllerArguments { let account: Account @@ -279,7 +281,7 @@ private func dataPrivacyControllerEntries(presentationData: PresentationData, st return entries } -public func dataPrivacyController(context: AccountContextImpl) -> ViewController { +public func dataPrivacyController(context: AccountContext) -> ViewController { let statePromise = ValuePromise(DataPrivacyControllerState(), ignoreRepeated: true) let stateValue = Atomic(value: DataPrivacyControllerState()) let updateState: ((DataPrivacyControllerState) -> DataPrivacyControllerState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/DateFormat.swift b/submodules/TelegramUI/TelegramUI/DateFormat.swift deleted file mode 100644 index f7ace2b5de..0000000000 --- a/submodules/TelegramUI/TelegramUI/DateFormat.swift +++ /dev/null @@ -1,111 +0,0 @@ -import Foundation -import TelegramPresentationData -import TelegramUIPreferences - -func stringForShortTimestamp(hours: Int32, minutes: Int32, dateTimeFormat: PresentationDateTimeFormat) -> String { - switch dateTimeFormat.timeFormat { - case .regular: - let hourString: String - if hours == 0 { - hourString = "12" - } else if hours > 12 { - hourString = "\(hours - 12)" - } else { - hourString = "\(hours)" - } - - let periodString: String - if hours >= 12 { - periodString = "PM" - } else { - periodString = "AM" - } - if minutes >= 10 { - return "\(hourString):\(minutes) \(periodString)" - } else { - return "\(hourString):0\(minutes) \(periodString)" - } - case .military: - return String(format: "%02d:%02d", arguments: [Int(hours), Int(minutes)]) - } -} - -func stringForMessageTimestamp(timestamp: Int32, dateTimeFormat: PresentationDateTimeFormat, local: Bool = true) -> String { - var t = Int(timestamp) - var timeinfo = tm() - if local { - localtime_r(&t, &timeinfo) - } else { - gmtime_r(&t, &timeinfo) - } - - return stringForShortTimestamp(hours: timeinfo.tm_hour, minutes: timeinfo.tm_min, dateTimeFormat: dateTimeFormat) -} - -func stringForFullDate(timestamp: Int32, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat) -> String { - var t: time_t = Int(timestamp) - var timeinfo = tm() - localtime_r(&t, &timeinfo); - - switch timeinfo.tm_mon + 1 { - case 1: - return strings.Time_PreciseDate_m1("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 - case 2: - return strings.Time_PreciseDate_m2("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 - case 3: - return strings.Time_PreciseDate_m3("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 - case 4: - return strings.Time_PreciseDate_m4("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 - case 5: - return strings.Time_PreciseDate_m5("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 - case 6: - return strings.Time_PreciseDate_m6("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 - case 7: - return strings.Time_PreciseDate_m7("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 - case 8: - return strings.Time_PreciseDate_m8("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 - case 9: - return strings.Time_PreciseDate_m9("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 - case 10: - return strings.Time_PreciseDate_m10("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 - case 11: - return strings.Time_PreciseDate_m11("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 - case 12: - return strings.Time_PreciseDate_m12("\(timeinfo.tm_mday)", "\(2000 + timeinfo.tm_year - 100)", stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat)).0 - default: - return "" - } -} - -func stringForDate(timestamp: Int32, strings: PresentationStrings) -> String { - let formatter = DateFormatter() - formatter.timeStyle = .none - formatter.dateStyle = .medium - formatter.timeZone = TimeZone(secondsFromGMT: 0) - formatter.locale = localeWithStrings(strings) - return formatter.string(from: Date(timeIntervalSince1970: Double(timestamp))) -} - -func stringForDateWithoutYear(date: Date, strings: PresentationStrings) -> String { - let formatter = DateFormatter() - formatter.timeStyle = .none - formatter.timeZone = TimeZone(secondsFromGMT: 0) - formatter.locale = localeWithStrings(strings) - formatter.setLocalizedDateFormatFromTemplate("MMMMd") - return formatter.string(from: date) -} - -func roundDateToDays(_ timestamp: Int32) -> Int32 { - var calendar = Calendar(identifier: .gregorian) - calendar.timeZone = TimeZone(secondsFromGMT: 0)! - var components = calendar.dateComponents(Set([.era, .year, .month, .day]), from: Date(timeIntervalSince1970: Double(timestamp))) - components.hour = 0 - components.minute = 0 - components.second = 0 - - guard let date = calendar.date(from: components) else { - assertionFailure() - return timestamp - } - return Int32(date.timeIntervalSince1970) -} diff --git a/submodules/TelegramUI/TelegramUI/DateSelectionActionSheetController.swift b/submodules/TelegramUI/TelegramUI/DateSelectionActionSheetController.swift index 5315435abb..2fe02a1825 100644 --- a/submodules/TelegramUI/TelegramUI/DateSelectionActionSheetController.swift +++ b/submodules/TelegramUI/TelegramUI/DateSelectionActionSheetController.swift @@ -7,6 +7,8 @@ import SwiftSignalKit import TelegramCore import Photos import TelegramPresentationData +import TelegramStringFormatting +import AccountContext final class DateSelectionActionSheetController: ActionSheetController { private var presentationDisposable: Disposable? @@ -16,7 +18,7 @@ final class DateSelectionActionSheetController: ActionSheetController { return self._ready } - init(context: AccountContextImpl, title: String?, currentValue: Int32, minimumDate: Date? = nil, maximumDate: Date? = nil, emptyTitle: String? = nil, applyValue: @escaping (Int32?) -> Void) { + init(context: AccountContext, title: String?, currentValue: Int32, minimumDate: Date? = nil, maximumDate: Date? = nil, emptyTitle: String? = nil, applyValue: @escaping (Int32?) -> Void) { let presentationData = context.sharedContext.currentPresentationData.with { $0 } let theme = presentationData.theme let strings = presentationData.strings diff --git a/submodules/TelegramUI/TelegramUI/DebugAccountsController.swift b/submodules/TelegramUI/TelegramUI/DebugAccountsController.swift index 3ed886ce2f..511c5405c5 100644 --- a/submodules/TelegramUI/TelegramUI/DebugAccountsController.swift +++ b/submodules/TelegramUI/TelegramUI/DebugAccountsController.swift @@ -6,15 +6,16 @@ import Postbox import TelegramCore import TelegramPresentationData import ItemListUI +import AccountContext private final class DebugAccountsControllerArguments { - let context: AccountContextImpl + let context: AccountContext let presentController: (ViewController, ViewControllerPresentationArguments) -> Void let switchAccount: (AccountRecordId) -> Void let loginNewAccount: () -> Void - init(context: AccountContextImpl, presentController: @escaping (ViewController, ViewControllerPresentationArguments) -> Void, switchAccount: @escaping (AccountRecordId) -> Void, loginNewAccount: @escaping () -> Void) { + init(context: AccountContext, presentController: @escaping (ViewController, ViewControllerPresentationArguments) -> Void, switchAccount: @escaping (AccountRecordId) -> Void, loginNewAccount: @escaping () -> Void) { self.context = context self.presentController = presentController self.switchAccount = switchAccount @@ -98,7 +99,7 @@ private func debugAccountsControllerEntries(view: AccountRecordsView, presentati return entries } -public func debugAccountsController(context: AccountContextImpl, accountManager: AccountManager) -> ViewController { +public func debugAccountsController(context: AccountContext, accountManager: AccountManager) -> ViewController { var presentControllerImpl: ((ViewController, ViewControllerPresentationArguments?) -> Void)? let arguments = DebugAccountsControllerArguments(context: context, presentController: { controller, arguments in diff --git a/submodules/TelegramUI/TelegramUI/DebugController.swift b/submodules/TelegramUI/TelegramUI/DebugController.swift index af6b45a7f1..125465f295 100644 --- a/submodules/TelegramUI/TelegramUI/DebugController.swift +++ b/submodules/TelegramUI/TelegramUI/DebugController.swift @@ -13,15 +13,17 @@ import MessageUI import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import OverlayStatusController +import AccountContext private final class DebugControllerArguments { - let sharedContext: SharedAccountContextImpl - let context: AccountContextImpl? + let sharedContext: SharedAccountContext + let context: AccountContext? let presentController: (ViewController, ViewControllerPresentationArguments?) -> Void let pushController: (ViewController) -> Void let getRootController: () -> UIViewController? - init(sharedContext: SharedAccountContextImpl, context: AccountContextImpl?, presentController: @escaping (ViewController, ViewControllerPresentationArguments?) -> Void, pushController: @escaping (ViewController) -> Void, getRootController: @escaping () -> UIViewController?) { + init(sharedContext: SharedAccountContext, context: AccountContext?, presentController: @escaping (ViewController, ViewControllerPresentationArguments?) -> Void, pushController: @escaping (ViewController) -> Void, getRootController: @escaping () -> UIViewController?) { self.sharedContext = sharedContext self.context = context self.presentController = presentController @@ -557,7 +559,7 @@ private func debugControllerEntries(presentationData: PresentationData, loggingS return entries } -public func debugController(sharedContext: SharedAccountContextImpl, context: AccountContextImpl?, modal: Bool = false) -> ViewController { +public func debugController(sharedContext: SharedAccountContext, context: AccountContext?, modal: Bool = false) -> ViewController { var presentControllerImpl: ((ViewController, ViewControllerPresentationArguments?) -> Void)? var pushControllerImpl: ((ViewController) -> Void)? var dismissImpl: (() -> Void)? diff --git a/submodules/TelegramUI/TelegramUI/DeclareEncodables.swift b/submodules/TelegramUI/TelegramUI/DeclareEncodables.swift index ce51ccde4d..16b1fd51fe 100644 --- a/submodules/TelegramUI/TelegramUI/DeclareEncodables.swift +++ b/submodules/TelegramUI/TelegramUI/DeclareEncodables.swift @@ -1,5 +1,5 @@ import Postbox - +import TemporaryCachedPeerDataManager import TelegramUIPreferences private var telegramUIDeclaredEncodables: Void = { diff --git a/submodules/TelegramUI/TelegramUI/DeleteChatPeerActionSheetItem.swift b/submodules/TelegramUI/TelegramUI/DeleteChatPeerActionSheetItem.swift index 0bfca45d17..41fea3f083 100644 --- a/submodules/TelegramUI/TelegramUI/DeleteChatPeerActionSheetItem.swift +++ b/submodules/TelegramUI/TelegramUI/DeleteChatPeerActionSheetItem.swift @@ -4,6 +4,8 @@ import Display import Postbox import TelegramCore import TelegramPresentationData +import AvatarNode +import AccountContext enum DeleteChatPeerAction { case delete @@ -11,13 +13,13 @@ enum DeleteChatPeerAction { } final class DeleteChatPeerActionSheetItem: ActionSheetItem { - let context: AccountContextImpl + let context: AccountContext let peer: Peer let chatPeer: Peer let action: DeleteChatPeerAction let strings: PresentationStrings - init(context: AccountContextImpl, peer: Peer, chatPeer: Peer, action: DeleteChatPeerAction, strings: PresentationStrings) { + init(context: AccountContext, peer: Peer, chatPeer: Peer, action: DeleteChatPeerAction, strings: PresentationStrings) { self.context = context self.peer = peer self.chatPeer = chatPeer @@ -44,7 +46,7 @@ private final class DeleteChatPeerActionSheetItemNode: ActionSheetItemNode { private let accessibilityArea: AccessibilityAreaNode - init(theme: ActionSheetControllerTheme, strings: PresentationStrings, context: AccountContextImpl, peer: Peer, chatPeer: Peer, action: DeleteChatPeerAction) { + init(theme: ActionSheetControllerTheme, strings: PresentationStrings, context: AccountContext, peer: Peer, chatPeer: Peer, action: DeleteChatPeerAction) { self.theme = theme self.strings = strings diff --git a/submodules/TelegramUI/TelegramUI/DeviceContactDataManager.swift b/submodules/TelegramUI/TelegramUI/DeviceContactDataManager.swift index 5aea10f670..0b00278e21 100644 --- a/submodules/TelegramUI/TelegramUI/DeviceContactDataManager.swift +++ b/submodules/TelegramUI/TelegramUI/DeviceContactDataManager.swift @@ -6,8 +6,7 @@ import Contacts import AddressBook import TelegramUIPreferences import DeviceAccess - -public typealias DeviceContactStableId = String +import AccountContext private protocol DeviceContactDataContext { func personNameDisplayOrder() -> PresentationPersonNameOrder @@ -473,7 +472,7 @@ private final class BasicDataForNormalizedNumberContext { } } -private final class DeviceContactDataManagerImpl { +private final class DeviceContactDataManagerPrivateImpl { private let queue: Queue private var accessInitialized = false @@ -760,14 +759,14 @@ private final class DeviceContactDataManagerImpl { } } -public final class DeviceContactDataManager { +public final class DeviceContactDataManagerImpl: DeviceContactDataManager { private let queue = Queue() - private let impl: QueueLocalObject + private let impl: QueueLocalObject init() { let queue = self.queue self.impl = QueueLocalObject(queue: queue, generate: { - return DeviceContactDataManagerImpl(queue: queue) + return DeviceContactDataManagerPrivateImpl(queue: queue) }) } @@ -856,7 +855,7 @@ public final class DeviceContactDataManager { } } - func appendContactData(_ contactData: DeviceContactExtendedData, to stableId: DeviceContactStableId) -> Signal { + public func appendContactData(_ contactData: DeviceContactExtendedData, to stableId: DeviceContactStableId) -> Signal { return Signal { subscriber in let disposable = MetaDisposable() self.impl.with({ impl in @@ -869,7 +868,7 @@ public final class DeviceContactDataManager { } } - func appendPhoneNumber(_ phoneNumber: DeviceContactPhoneNumberData, to stableId: DeviceContactStableId) -> Signal { + public func appendPhoneNumber(_ phoneNumber: DeviceContactPhoneNumberData, to stableId: DeviceContactStableId) -> Signal { return Signal { subscriber in let disposable = MetaDisposable() self.impl.with({ impl in @@ -882,7 +881,7 @@ public final class DeviceContactDataManager { } } - func createContactWithData(_ contactData: DeviceContactExtendedData) -> Signal<(DeviceContactStableId, DeviceContactExtendedData)?, NoError> { + public func createContactWithData(_ contactData: DeviceContactExtendedData) -> Signal<(DeviceContactStableId, DeviceContactExtendedData)?, NoError> { return Signal { subscriber in let disposable = MetaDisposable() self.impl.with({ impl in @@ -895,7 +894,7 @@ public final class DeviceContactDataManager { } } - func deleteContactWithAppSpecificReference(peerId: PeerId) -> Signal { + public func deleteContactWithAppSpecificReference(peerId: PeerId) -> Signal { return Signal { subscriber in let disposable = MetaDisposable() self.impl.with({ impl in diff --git a/submodules/TelegramUI/TelegramUI/DeviceContactInfoController.swift b/submodules/TelegramUI/TelegramUI/DeviceContactInfoController.swift index 26e7b5c0fb..68db49a79f 100644 --- a/submodules/TelegramUI/TelegramUI/DeviceContactInfoController.swift +++ b/submodules/TelegramUI/TelegramUI/DeviceContactInfoController.swift @@ -7,6 +7,8 @@ import TelegramCore import MessageUI import TelegramPresentationData import ItemListUI +import TelegramStringFormatting +import AccountContext private enum DeviceContactInfoAction { case sendMessage @@ -798,7 +800,7 @@ private final class DeviceContactInfoController: ItemListController Void)? = nil, cancelled: (() -> Void)? = nil) -> ViewController { +public func deviceContactInfoController(context: AccountContext, subject: DeviceContactInfoSubject, completed: (() -> Void)? = nil, cancelled: (() -> Void)? = nil) -> ViewController { var initialState = DeviceContactInfoState() if case let .create(peer, contactData, _, _, _) = subject { var peerPhoneNumber: String? @@ -1311,7 +1313,7 @@ public func deviceContactInfoController(context: AccountContextImpl, subject: De return controller } -private func addContactToExisting(context: AccountContextImpl, parentController: ViewController, contactData: DeviceContactExtendedData, completion: @escaping (Peer?, DeviceContactStableId, DeviceContactExtendedData) -> Void) { +private func addContactToExisting(context: AccountContext, parentController: ViewController, contactData: DeviceContactExtendedData, completion: @escaping (Peer?, DeviceContactStableId, DeviceContactExtendedData) -> Void) { let contactsController = ContactSelectionController(context: context, title: { $0.Contacts_Title }, displayDeviceContacts: true) parentController.present(contactsController, in: .window(.root), with: ViewControllerPresentationArguments(presentationAnimation: .modalSheet)) let _ = (contactsController.result @@ -1380,7 +1382,7 @@ private func addContactToExisting(context: AccountContextImpl, parentController: }) } -func addContactOptionsController(context: AccountContextImpl, peer: Peer?, contactData: DeviceContactExtendedData) -> ActionSheetController { +func addContactOptionsController(context: AccountContext, peer: Peer?, contactData: DeviceContactExtendedData) -> ActionSheetController { let presentationData = context.sharedContext.currentPresentationData.with { $0 } let controller = ActionSheetController(presentationTheme: presentationData.theme) let dismissAction: () -> Void = { [weak controller] in diff --git a/submodules/TelegramUI/TelegramUI/DisabledContextResultsChatInputContextPanelNode.swift b/submodules/TelegramUI/TelegramUI/DisabledContextResultsChatInputContextPanelNode.swift index 98b232b193..56e45b7044 100644 --- a/submodules/TelegramUI/TelegramUI/DisabledContextResultsChatInputContextPanelNode.swift +++ b/submodules/TelegramUI/TelegramUI/DisabledContextResultsChatInputContextPanelNode.swift @@ -4,6 +4,8 @@ import TelegramCore import AsyncDisplayKit import Display import TelegramPresentationData +import TelegramStringFormatting +import AccountContext final class DisabledContextResultsChatInputContextPanelNode: ChatInputContextPanelNode { private let containerNode: ASDisplayNode @@ -12,7 +14,7 @@ final class DisabledContextResultsChatInputContextPanelNode: ChatInputContextPan private var validLayout: (CGSize, CGFloat, CGFloat)? - override init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings) { + override init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings) { self.containerNode = ASDisplayNode() self.separatorNode = ASDisplayNode() self.textNode = ImmediateTextNode() diff --git a/submodules/TelegramUI/TelegramUI/EditAccessoryPanelNode.swift b/submodules/TelegramUI/TelegramUI/EditAccessoryPanelNode.swift index bce1ae5b4b..b7d7fc965b 100644 --- a/submodules/TelegramUI/TelegramUI/EditAccessoryPanelNode.swift +++ b/submodules/TelegramUI/TelegramUI/EditAccessoryPanelNode.swift @@ -8,6 +8,7 @@ import Display import TelegramPresentationData import TelegramUIPreferences import ActivityIndicator +import AccountContext final class EditAccessoryPanelNode: AccessoryPanelNode { let messageId: MessageId @@ -54,12 +55,12 @@ final class EditAccessoryPanelNode: AccessoryPanelNode { } } - private let context: AccountContextImpl + private let context: AccountContext var theme: PresentationTheme var strings: PresentationStrings var nameDisplayOrder: PresentationPersonNameOrder - init(context: AccountContextImpl, messageId: MessageId, theme: PresentationTheme, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder) { + init(context: AccountContext, messageId: MessageId, theme: PresentationTheme, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder) { self.context = context self.messageId = messageId self.theme = theme diff --git a/submodules/TelegramUI/TelegramUI/EditSettingsController.swift b/submodules/TelegramUI/TelegramUI/EditSettingsController.swift index 5e3c4f3e08..cbb9c6cca9 100644 --- a/submodules/TelegramUI/TelegramUI/EditSettingsController.swift +++ b/submodules/TelegramUI/TelegramUI/EditSettingsController.swift @@ -8,9 +8,10 @@ import TelegramCore import LegacyComponents import TelegramPresentationData import ItemListUI +import AccountContext private struct EditSettingsItemArguments { - let context: AccountContextImpl + let context: AccountContext let accountManager: AccountManager let avatarAndNameInfoContext: ItemListAvatarAndNameInfoItemContext @@ -298,7 +299,7 @@ private func editSettingsEntries(presentationData: PresentationData, state: Edit return entries } -func editSettingsController(context: AccountContextImpl, currentName: ItemListAvatarAndNameInfoItemName, currentBioText: String, accountManager: AccountManager, canAddAccounts: Bool, focusOnItemTag: EditSettingsEntryTag? = nil) -> ViewController { +func editSettingsController(context: AccountContext, currentName: ItemListAvatarAndNameInfoItemName, currentBioText: String, accountManager: AccountManager, canAddAccounts: Bool, focusOnItemTag: EditSettingsEntryTag? = nil) -> ViewController { let initialState = EditSettingsState(editingName: currentName, editingBioText: currentBioText) let statePromise = ValuePromise(initialState, ignoreRepeated: true) let stateValue = Atomic(value: initialState) diff --git a/submodules/TelegramUI/TelegramUI/EmojisChatInputContextPanelNode.swift b/submodules/TelegramUI/TelegramUI/EmojisChatInputContextPanelNode.swift index 2d0a9eb872..34d4c64e00 100644 --- a/submodules/TelegramUI/TelegramUI/EmojisChatInputContextPanelNode.swift +++ b/submodules/TelegramUI/TelegramUI/EmojisChatInputContextPanelNode.swift @@ -6,6 +6,7 @@ import TelegramCore import Display import TelegramPresentationData import MergeLists +import AccountContext private struct EmojisChatInputContextPanelEntryStableId: Hashable, Equatable { let symbol: String @@ -101,7 +102,7 @@ final class EmojisChatInputContextPanelNode: ChatInputContextPanelNode { private var enqueuedTransitions: [(EmojisChatInputContextPanelTransition, Bool)] = [] private var validLayout: (CGSize, CGFloat, CGFloat)? - override init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings) { + override init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings) { self.backgroundNode = ASImageNode() self.backgroundNode.displayWithoutProcessing = true self.backgroundNode.displaysAsynchronously = false diff --git a/submodules/TelegramUI/TelegramUI/FeaturedStickerPacksController.swift b/submodules/TelegramUI/TelegramUI/FeaturedStickerPacksController.swift index 55ec3b8dde..09d19e9971 100644 --- a/submodules/TelegramUI/TelegramUI/FeaturedStickerPacksController.swift +++ b/submodules/TelegramUI/TelegramUI/FeaturedStickerPacksController.swift @@ -7,6 +7,7 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext private final class FeaturedStickerPacksControllerArguments { let account: Account @@ -159,7 +160,7 @@ private func featuredStickerPacksControllerEntries(presentationData: Presentatio return entries } -public func featuredStickerPacksController(context: AccountContextImpl) -> ViewController { +public func featuredStickerPacksController(context: AccountContext) -> ViewController { let statePromise = ValuePromise(FeaturedStickerPacksControllerState(), ignoreRepeated: true) var presentControllerImpl: ((ViewController, ViewControllerPresentationArguments?) -> Void)? diff --git a/submodules/TelegramUI/TelegramUI/FetchManager.swift b/submodules/TelegramUI/TelegramUI/FetchManager.swift index e02ae126c1..bfc760d4d4 100644 --- a/submodules/TelegramUI/TelegramUI/FetchManager.swift +++ b/submodules/TelegramUI/TelegramUI/FetchManager.swift @@ -4,6 +4,7 @@ import TelegramCore import SwiftSignalKit import Postbox import TelegramUIPreferences +import AccountContext private struct FetchManagerLocationEntryId: Hashable { let location: FetchManagerLocation @@ -28,65 +29,6 @@ private struct FetchManagerLocationEntryId: Hashable { } } -enum FetchManagerForegroundDirection { - case toEarlier - case toLater -} - -enum FetchManagerPriority: Comparable { - case userInitiated - case foregroundPrefetch(direction: FetchManagerForegroundDirection, localOrder: MessageIndex) - case backgroundPrefetch(locationOrder: HistoryPreloadIndex, localOrder: MessageIndex) - - static func <(lhs: FetchManagerPriority, rhs: FetchManagerPriority) -> Bool { - switch lhs { - case .userInitiated: - switch rhs { - case .userInitiated: - return false - case .foregroundPrefetch: - return true - case .backgroundPrefetch: - return true - } - case let .foregroundPrefetch(lhsDirection, lhsLocalOrder): - switch rhs { - case .userInitiated: - return false - case let .foregroundPrefetch(rhsDirection, rhsLocalOrder): - if lhsDirection == rhsDirection { - switch lhsDirection { - case .toEarlier: - return lhsLocalOrder > rhsLocalOrder - case .toLater: - return lhsLocalOrder < rhsLocalOrder - } - } else { - if lhsDirection == .toEarlier { - return true - } else { - return false - } - } - case .backgroundPrefetch: - return true - } - case let .backgroundPrefetch(lhsLocationOrder, lhsLocalOrder): - switch rhs { - case .userInitiated: - return false - case .foregroundPrefetch: - return false - case let .backgroundPrefetch(rhsLocationOrder, rhsLocalOrder): - if lhsLocationOrder != rhsLocationOrder { - return lhsLocationOrder < rhsLocationOrder - } - return lhsLocalOrder > rhsLocalOrder - } - } - } -} - private final class FetchManagerLocationEntry { let id: FetchManagerLocationEntryId let episode: Int32 @@ -516,7 +458,7 @@ private final class FetchManagerCategoryContext { } } -public final class FetchManager { +public final class FetchManagerImpl: FetchManager { private let queue = Queue.mainQueue() private let postbox: Postbox private let storeManager: DownloadedMediaStoreManager? @@ -588,7 +530,7 @@ public final class FetchManager { } } - func interactivelyFetched(category: FetchManagerCategory, location: FetchManagerLocation, locationKey: FetchManagerLocationKey, mediaReference: AnyMediaReference?, resourceReference: MediaResourceReference, ranges: IndexSet = IndexSet(integersIn: 0 ..< Int(Int32.max) as Range), statsCategory: MediaResourceStatsCategory, elevatedPriority: Bool, userInitiated: Bool, priority: FetchManagerPriority = .userInitiated, storeToDownloadsPeerType: MediaAutoDownloadPeerType? = nil) -> Signal { + public func interactivelyFetched(category: FetchManagerCategory, location: FetchManagerLocation, locationKey: FetchManagerLocationKey, mediaReference: AnyMediaReference?, resourceReference: MediaResourceReference, ranges: IndexSet, statsCategory: MediaResourceStatsCategory, elevatedPriority: Bool, userInitiated: Bool, priority: FetchManagerPriority = .userInitiated, storeToDownloadsPeerType: MediaAutoDownloadPeerType?) -> Signal { let queue = self.queue return Signal { [weak self] subscriber in if let strongSelf = self { @@ -663,7 +605,7 @@ public final class FetchManager { } |> runOn(self.queue) } - func cancelInteractiveFetches(category: FetchManagerCategory, location: FetchManagerLocation, locationKey: FetchManagerLocationKey, resource: MediaResource) { + public func cancelInteractiveFetches(category: FetchManagerCategory, location: FetchManagerLocation, locationKey: FetchManagerLocationKey, resource: MediaResource) { self.queue.async { self.withCategoryContext(category, { context in context.cancelEntry(FetchManagerLocationEntryId(location: location, resourceId: resource.id, locationKey: locationKey)) @@ -673,7 +615,7 @@ public final class FetchManager { } } - func fetchStatus(category: FetchManagerCategory, location: FetchManagerLocation, locationKey: FetchManagerLocationKey, resource: MediaResource) -> Signal { + public func fetchStatus(category: FetchManagerCategory, location: FetchManagerLocation, locationKey: FetchManagerLocationKey, resource: MediaResource) -> Signal { let queue = self.queue return Signal { [weak self] subscriber in if let strongSelf = self { diff --git a/submodules/TelegramUI/TelegramUI/FetchManagerLocation.swift b/submodules/TelegramUI/TelegramUI/FetchManagerLocation.swift index 5d36b3aedd..7c6c2b2ca0 100644 --- a/submodules/TelegramUI/TelegramUI/FetchManagerLocation.swift +++ b/submodules/TelegramUI/TelegramUI/FetchManagerLocation.swift @@ -1,140 +1,2 @@ import Foundation import Postbox - -enum FetchManagerCategory: Int32 { - case image - case file - case voice - case animation -} - -enum FetchManagerLocationKey: Comparable, Hashable { - case messageId(MessageId) - case free - - static func ==(lhs: FetchManagerLocationKey, rhs: FetchManagerLocationKey) -> Bool { - switch lhs { - case let .messageId(id): - if case .messageId(id) = rhs { - return true - } else { - return false - } - case .free: - if case .free = rhs { - return true - } else { - return false - } - } - } - - static func <(lhs: FetchManagerLocationKey, rhs: FetchManagerLocationKey) -> Bool { - switch lhs { - case let .messageId(lhsId): - if case let .messageId(rhsId) = rhs { - return lhsId < rhsId - } else { - return true - } - case .free: - if case .free = rhs { - return false - } else { - return false - } - } - } - - var hashValue: Int { - switch self { - case let .messageId(id): - return id.hashValue - case .free: - return 1 - } - } -} - -struct FetchManagerPriorityKey: Comparable { - let locationKey: FetchManagerLocationKey - let hasElevatedPriority: Bool - let userInitiatedPriority: Int32? - let topReference: FetchManagerPriority? - - static func ==(lhs: FetchManagerPriorityKey, rhs: FetchManagerPriorityKey) -> Bool { - if lhs.locationKey != rhs.locationKey { - return false - } - if lhs.hasElevatedPriority != rhs.hasElevatedPriority { - return false - } - if lhs.userInitiatedPriority != rhs.userInitiatedPriority { - return false - } - if lhs.topReference != rhs.topReference { - return false - } - return true - } - - static func <(lhs: FetchManagerPriorityKey, rhs: FetchManagerPriorityKey) -> Bool { - if let lhsUserInitiatedPriority = lhs.userInitiatedPriority, let rhsUserInitiatedPriority = rhs.userInitiatedPriority { - if lhsUserInitiatedPriority != rhsUserInitiatedPriority { - if lhsUserInitiatedPriority > rhsUserInitiatedPriority { - return false - } else { - return true - } - } - } else if (lhs.userInitiatedPriority != nil) != (rhs.userInitiatedPriority != nil) { - if lhs.userInitiatedPriority != nil { - return true - } else { - return false - } - } - - if lhs.hasElevatedPriority != rhs.hasElevatedPriority { - if lhs.hasElevatedPriority { - return true - } else { - return false - } - } - - if lhs.topReference != rhs.topReference { - if let lhsTopReference = lhs.topReference, let rhsTopReference = rhs.topReference { - return lhsTopReference < rhsTopReference - } else if lhs.topReference != nil { - return true - } else { - return false - } - } - - return lhs.locationKey < rhs.locationKey - } -} - -enum FetchManagerLocation: Hashable { - case chat(PeerId) - - static func ==(lhs: FetchManagerLocation, rhs: FetchManagerLocation) -> Bool { - switch lhs { - case let .chat(peerId): - if case .chat(peerId) = rhs { - return true - } else { - return false - } - } - } - - var hashValue: Int { - switch self { - case let .chat(peerId): - return peerId.hashValue - } - } -} diff --git a/submodules/TelegramUI/TelegramUI/FetchMediaUtils.swift b/submodules/TelegramUI/TelegramUI/FetchMediaUtils.swift index 9da9890068..3cb2be962a 100644 --- a/submodules/TelegramUI/TelegramUI/FetchMediaUtils.swift +++ b/submodules/TelegramUI/TelegramUI/FetchMediaUtils.swift @@ -4,6 +4,7 @@ import TelegramCore import Postbox import SwiftSignalKit import TelegramUIPreferences +import AccountContext public func freeMediaFileInteractiveFetched(account: Account, fileReference: FileMediaReference) -> Signal { return fetchedMediaResource(mediaBox: account.postbox.mediaBox, reference: fileReference.resourceReference(fileReference.media.resource)) @@ -27,32 +28,32 @@ private func fetchCategoryForFile(_ file: TelegramMediaFile) -> FetchManagerCate } } -public func messageMediaFileInteractiveFetched(context: AccountContextImpl, message: Message, file: TelegramMediaFile, userInitiated: Bool) -> Signal { +public func messageMediaFileInteractiveFetched(context: AccountContext, message: Message, file: TelegramMediaFile, userInitiated: Bool) -> Signal { return messageMediaFileInteractiveFetched(fetchManager: context.fetchManager, messageId: message.id, messageReference: MessageReference(message), file: file, userInitiated: userInitiated, priority: .userInitiated) } func messageMediaFileInteractiveFetched(fetchManager: FetchManager, messageId: MessageId, messageReference: MessageReference, file: TelegramMediaFile, ranges: IndexSet = IndexSet(integersIn: 0 ..< Int(Int32.max) as Range), userInitiated: Bool, priority: FetchManagerPriority) -> Signal { let mediaReference = AnyMediaReference.message(message: messageReference, media: file) - return fetchManager.interactivelyFetched(category: fetchCategoryForFile(file), location: .chat(messageId.peerId), locationKey: .messageId(messageId), mediaReference: mediaReference, resourceReference: mediaReference.resourceReference(file.resource), ranges: ranges, statsCategory: statsCategoryForFileWithAttributes(file.attributes), elevatedPriority: false, userInitiated: userInitiated, priority: priority) + return fetchManager.interactivelyFetched(category: fetchCategoryForFile(file), location: .chat(messageId.peerId), locationKey: .messageId(messageId), mediaReference: mediaReference, resourceReference: mediaReference.resourceReference(file.resource), ranges: ranges, statsCategory: statsCategoryForFileWithAttributes(file.attributes), elevatedPriority: false, userInitiated: userInitiated, priority: priority, storeToDownloadsPeerType: nil) } -func messageMediaFileCancelInteractiveFetch(context: AccountContextImpl, messageId: MessageId, file: TelegramMediaFile) { +func messageMediaFileCancelInteractiveFetch(context: AccountContext, messageId: MessageId, file: TelegramMediaFile) { context.fetchManager.cancelInteractiveFetches(category: fetchCategoryForFile(file), location: .chat(messageId.peerId), locationKey: .messageId(messageId), resource: file.resource) } -public func messageMediaImageInteractiveFetched(context: AccountContextImpl, message: Message, image: TelegramMediaImage, resource: MediaResource, storeToDownloadsPeerType: MediaAutoDownloadPeerType?) -> Signal { +public func messageMediaImageInteractiveFetched(context: AccountContext, message: Message, image: TelegramMediaImage, resource: MediaResource, storeToDownloadsPeerType: MediaAutoDownloadPeerType?) -> Signal { return messageMediaImageInteractiveFetched(fetchManager: context.fetchManager, messageId: message.id, messageReference: MessageReference(message), image: image, resource: resource, userInitiated: true, priority: .userInitiated, storeToDownloadsPeerType: storeToDownloadsPeerType) } func messageMediaImageInteractiveFetched(fetchManager: FetchManager, messageId: MessageId, messageReference: MessageReference, image: TelegramMediaImage, resource: MediaResource, userInitiated: Bool, priority: FetchManagerPriority, storeToDownloadsPeerType: MediaAutoDownloadPeerType?) -> Signal { let mediaReference = AnyMediaReference.message(message: messageReference, media: image) - return fetchManager.interactivelyFetched(category: .image, location: .chat(messageId.peerId), locationKey: .messageId(messageId), mediaReference: mediaReference, resourceReference: mediaReference.resourceReference(resource), statsCategory: .image, elevatedPriority: false, userInitiated: userInitiated, priority: priority, storeToDownloadsPeerType: storeToDownloadsPeerType) + return fetchManager.interactivelyFetched(category: .image, location: .chat(messageId.peerId), locationKey: .messageId(messageId), mediaReference: mediaReference, resourceReference: mediaReference.resourceReference(resource), ranges: FetchCompleteRange, statsCategory: .image, elevatedPriority: false, userInitiated: userInitiated, priority: priority, storeToDownloadsPeerType: storeToDownloadsPeerType) } -func messageMediaImageCancelInteractiveFetch(context: AccountContextImpl, messageId: MessageId, image: TelegramMediaImage, resource: MediaResource) { +func messageMediaImageCancelInteractiveFetch(context: AccountContext, messageId: MessageId, image: TelegramMediaImage, resource: MediaResource) { context.fetchManager.cancelInteractiveFetches(category: .image, location: .chat(messageId.peerId), locationKey: .messageId(messageId), resource: resource) } -func messageMediaFileStatus(context: AccountContextImpl, messageId: MessageId, file: TelegramMediaFile) -> Signal { +func messageMediaFileStatus(context: AccountContext, messageId: MessageId, file: TelegramMediaFile) -> Signal { return context.fetchManager.fetchStatus(category: fetchCategoryForFile(file), location: .chat(messageId.peerId), locationKey: .messageId(messageId), resource: file.resource) } diff --git a/submodules/TelegramUI/TelegramUI/FileMediaResourceStatus.swift b/submodules/TelegramUI/TelegramUI/FileMediaResourceStatus.swift index 26dc3a42db..1bf2cf5aab 100644 --- a/submodules/TelegramUI/TelegramUI/FileMediaResourceStatus.swift +++ b/submodules/TelegramUI/TelegramUI/FileMediaResourceStatus.swift @@ -4,6 +4,7 @@ import TelegramCore import Postbox import SwiftSignalKit import UniversalMediaPlayer +import AccountContext enum FileMediaResourcePlaybackStatus: Equatable { case playing @@ -20,7 +21,7 @@ enum FileMediaResourceMediaStatus: Equatable { case playbackStatus(FileMediaResourcePlaybackStatus) } -private func internalMessageFileMediaPlaybackStatus(context: AccountContextImpl, file: TelegramMediaFile, message: Message, isRecentActions: Bool) -> Signal { +private func internalMessageFileMediaPlaybackStatus(context: AccountContext, file: TelegramMediaFile, message: Message, isRecentActions: Bool) -> Signal { guard let playerType = peerMessageMediaPlayerType(message) else { return .single(nil) } @@ -35,7 +36,7 @@ private func internalMessageFileMediaPlaybackStatus(context: AccountContextImpl, } } -func messageFileMediaPlaybackStatus(context: AccountContextImpl, file: TelegramMediaFile, message: Message, isRecentActions: Bool) -> Signal { +func messageFileMediaPlaybackStatus(context: AccountContext, file: TelegramMediaFile, message: Message, isRecentActions: Bool) -> Signal { var duration = 0.0 if let value = file.duration { duration = Double(value) @@ -46,7 +47,7 @@ func messageFileMediaPlaybackStatus(context: AccountContextImpl, file: TelegramM } } -func messageFileMediaResourceStatus(context: AccountContextImpl, file: TelegramMediaFile, message: Message, isRecentActions: Bool) -> Signal { +func messageFileMediaResourceStatus(context: AccountContext, file: TelegramMediaFile, message: Message, isRecentActions: Bool) -> Signal { let playbackStatus = internalMessageFileMediaPlaybackStatus(context: context, file: file, message: message, isRecentActions: isRecentActions) |> map { status -> MediaPlayerPlaybackStatus? in return status?.status } diff --git a/submodules/TelegramUI/TelegramUI/ForwardAccessoryPanelNode.swift b/submodules/TelegramUI/TelegramUI/ForwardAccessoryPanelNode.swift index 1135d928b6..6e0003995b 100644 --- a/submodules/TelegramUI/TelegramUI/ForwardAccessoryPanelNode.swift +++ b/submodules/TelegramUI/TelegramUI/ForwardAccessoryPanelNode.swift @@ -6,6 +6,7 @@ import Postbox import SwiftSignalKit import Display import TelegramPresentationData +import AccountContext func textStringForForwardedMessage(_ message: Message, strings: PresentationStrings) -> (String, Bool) { for media in message.media { @@ -78,7 +79,7 @@ final class ForwardAccessoryPanelNode: AccessoryPanelNode { var theme: PresentationTheme - init(context: AccountContextImpl, messageIds: [MessageId], theme: PresentationTheme, strings: PresentationStrings) { + init(context: AccountContext, messageIds: [MessageId], theme: PresentationTheme, strings: PresentationStrings) { self.messageIds = messageIds self.theme = theme diff --git a/submodules/TelegramUI/TelegramUI/ForwardPrivacyChatPreviewItem.swift b/submodules/TelegramUI/TelegramUI/ForwardPrivacyChatPreviewItem.swift index e86d01087d..1923fc8fbd 100644 --- a/submodules/TelegramUI/TelegramUI/ForwardPrivacyChatPreviewItem.swift +++ b/submodules/TelegramUI/TelegramUI/ForwardPrivacyChatPreviewItem.swift @@ -8,9 +8,10 @@ import Postbox import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext class ForwardPrivacyChatPreviewItem: ListViewItem, ItemListItem { - let context: AccountContextImpl + let context: AccountContext let theme: PresentationTheme let strings: PresentationStrings let sectionId: ItemListSectionId @@ -22,7 +23,7 @@ class ForwardPrivacyChatPreviewItem: ListViewItem, ItemListItem { let linkEnabled: Bool let tooltipText: String - init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings, sectionId: ItemListSectionId, fontSize: PresentationFontSize, wallpaper: TelegramWallpaper, dateTimeFormat: PresentationDateTimeFormat, nameDisplayOrder: PresentationPersonNameOrder, peerName: String, linkEnabled: Bool, tooltipText: String) { + init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, sectionId: ItemListSectionId, fontSize: PresentationFontSize, wallpaper: TelegramWallpaper, dateTimeFormat: PresentationDateTimeFormat, nameDisplayOrder: PresentationPersonNameOrder, peerName: String, linkEnabled: Bool, tooltipText: String) { self.context = context self.theme = theme self.strings = strings diff --git a/submodules/TelegramUI/TelegramUI/GalleryController.swift b/submodules/TelegramUI/TelegramUI/GalleryController.swift index 2395f68746..b30a9b5866 100644 --- a/submodules/TelegramUI/TelegramUI/GalleryController.swift +++ b/submodules/TelegramUI/TelegramUI/GalleryController.swift @@ -9,6 +9,7 @@ import TelegramCore import SafariServices import TelegramPresentationData import TextFormat +import AccountContext private func tagsForMessage(_ message: Message) -> MessageTags? { for media in message.media { @@ -135,7 +136,7 @@ private func galleryMessageCaptionText(_ message: Message) -> String { return message.text } -func galleryItemForEntry(context: AccountContextImpl, presentationData: PresentationData, entry: MessageHistoryEntry, isCentral: Bool = false, streamVideos: Bool, loopVideos: Bool = false, hideControls: Bool = false, fromPlayingVideo: Bool = false, landscape: Bool = false, timecode: Double? = nil, tempFilePath: String? = nil, playbackCompleted: @escaping () -> Void = {}, performAction: @escaping (GalleryControllerInteractionTapAction) -> Void = { _ in }, openActionOptions: @escaping (GalleryControllerInteractionTapAction) -> Void = { _ in }) -> GalleryItem? { +func galleryItemForEntry(context: AccountContext, presentationData: PresentationData, entry: MessageHistoryEntry, isCentral: Bool = false, streamVideos: Bool, loopVideos: Bool = false, hideControls: Bool = false, fromPlayingVideo: Bool = false, landscape: Bool = false, timecode: Double? = nil, tempFilePath: String? = nil, playbackCompleted: @escaping () -> Void = {}, performAction: @escaping (GalleryControllerInteractionTapAction) -> Void = { _ in }, openActionOptions: @escaping (GalleryControllerInteractionTapAction) -> Void = { _ in }) -> GalleryItem? { let message = entry.message let location = entry.location if let (media, mediaImage) = mediaForMessage(message: message) { @@ -268,26 +269,6 @@ public enum GalleryControllerItemNodeAction { case timecode(Double) } -final class GalleryControllerActionInteraction { - let openUrl: (String, Bool) -> Void - let openUrlIn: (String) -> Void - let openPeerMention: (String) -> Void - let openPeer: (PeerId) -> Void - let openHashtag: (String?, String) -> Void - let openBotCommand: (String) -> Void - let addContact: (String) -> Void - - init(openUrl: @escaping (String, Bool) -> Void, openUrlIn: @escaping (String) -> Void, openPeerMention: @escaping (String) -> Void, openPeer: @escaping (PeerId) -> Void, openHashtag: @escaping (String?, String) -> Void, openBotCommand: @escaping (String) -> Void, addContact: @escaping (String) -> Void) { - self.openUrl = openUrl - self.openUrlIn = openUrlIn - self.openPeerMention = openPeerMention - self.openPeer = openPeer - self.openHashtag = openHashtag - self.openBotCommand = openBotCommand - self.addContact = addContact - } -} - class GalleryController: ViewController { static let darkNavigationTheme = NavigationBarTheme(buttonColor: .white, disabledButtonColor: UIColor(rgb: 0x525252), primaryTextColor: .white, backgroundColor: UIColor(white: 0.0, alpha: 0.6), separatorColor: UIColor(white: 0.0, alpha: 0.8), badgeBackgroundColor: .clear, badgeStrokeColor: .clear, badgeTextColor: .clear) static let lightNavigationTheme = NavigationBarTheme(buttonColor: UIColor(rgb: 0x007ee5), disabledButtonColor: UIColor(rgb: 0xd0d0d0), primaryTextColor: .black, backgroundColor: UIColor(red: 0.968626451, green: 0.968626451, blue: 0.968626451, alpha: 1.0), separatorColor: UIColor(red: 0.6953125, green: 0.6953125, blue: 0.6953125, alpha: 1.0), badgeBackgroundColor: .clear, badgeStrokeColor: .clear, badgeTextColor: .clear) @@ -296,7 +277,7 @@ class GalleryController: ViewController { return self.displayNode as! GalleryControllerNode } - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private let source: GalleryControllerItemSource @@ -340,7 +321,7 @@ class GalleryController: ViewController { private var performAction: (GalleryControllerInteractionTapAction) -> Void private var openActionOptions: (GalleryControllerInteractionTapAction) -> Void - init(context: AccountContextImpl, source: GalleryControllerItemSource, invertItemOrder: Bool = false, streamSingleVideo: Bool = false, fromPlayingVideo: Bool = false, landscape: Bool = false, timecode: Double? = nil, synchronousLoad: Bool = false, replaceRootController: @escaping (ViewController, ValuePromise?) -> Void, baseNavigationController: NavigationController?, actionInteraction: GalleryControllerActionInteraction? = nil) { + init(context: AccountContext, source: GalleryControllerItemSource, invertItemOrder: Bool = false, streamSingleVideo: Bool = false, fromPlayingVideo: Bool = false, landscape: Bool = false, timecode: Double? = nil, synchronousLoad: Bool = false, replaceRootController: @escaping (ViewController, ValuePromise?) -> Void, baseNavigationController: NavigationController?, actionInteraction: GalleryControllerActionInteraction? = nil) { self.context = context self.source = source self.replaceRootController = replaceRootController @@ -861,7 +842,7 @@ class GalleryController: ViewController { if entry.message.stableId == self.centralEntryStableId { isCentral = true } - if let item = galleryItemForEntry(context: context, presentationData: self.presentationData, entry: entry, streamVideos: self.streamVideos, fromPlayingVideo: isCentral && self.fromPlayingVideo, landscape: isCentral && self.landscape, timecode: isCentral ? self.timecode : nil, performAction: self.performAction, openActionOptions: self.openActionOptions) { + if let item = galleryItemForEntry(context: self.context, presentationData: self.presentationData, entry: entry, streamVideos: self.streamVideos, fromPlayingVideo: isCentral && self.fromPlayingVideo, landscape: isCentral && self.landscape, timecode: isCentral ? self.timecode : nil, performAction: self.performAction, openActionOptions: self.openActionOptions) { if isCentral { centralItemIndex = items.count } diff --git a/submodules/TelegramUI/TelegramUI/GalleryHiddenMediaManager.swift b/submodules/TelegramUI/TelegramUI/GalleryHiddenMediaManager.swift index 86aa0ae74f..6ef1de21e7 100644 --- a/submodules/TelegramUI/TelegramUI/GalleryHiddenMediaManager.swift +++ b/submodules/TelegramUI/TelegramUI/GalleryHiddenMediaManager.swift @@ -3,28 +3,7 @@ import UIKit import Postbox import SwiftSignalKit import AsyncDisplayKit - -enum GalleryHiddenMediaId: Hashable { - case chat(AccountRecordId, MessageId, Media) - - static func ==(lhs: GalleryHiddenMediaId, rhs: GalleryHiddenMediaId) -> Bool { - switch lhs { - case let .chat(lhsAccountId ,lhsMessageId, lhsMedia): - if case let .chat(rhsAccountId, rhsMessageId, rhsMedia) = rhs, lhsAccountId == rhsAccountId, lhsMessageId == rhsMessageId, lhsMedia.isEqual(to: rhsMedia) { - return true - } else { - return false - } - } - } - - var hashValue: Int { - switch self { - case let .chat(_, messageId, _): - return messageId.hashValue - } - } -} +import AccountContext private final class GalleryHiddenMediaContext { private var ids = Set() @@ -42,10 +21,6 @@ private final class GalleryHiddenMediaContext { } } -protocol GalleryHiddenMediaTarget: class { - func getTransitionInfo(messageId: MessageId, media: Media) -> ((UIView) -> Void, ASDisplayNode, () -> (UIView?, UIView?))? -} - private final class GalleryHiddenMediaTargetHolder { weak var target: GalleryHiddenMediaTarget? @@ -54,7 +29,7 @@ private final class GalleryHiddenMediaTargetHolder { } } -final class GalleryHiddenMediaManager { +final class GalleryHiddenMediaManagerImpl: GalleryHiddenMediaManager { private var nextId: Int32 = 0 private var contexts: [GalleryHiddenMediaId: GalleryHiddenMediaContext] = [:] diff --git a/submodules/TelegramUI/TelegramUI/GalleryVideoDecoration.swift b/submodules/TelegramUI/TelegramUI/GalleryVideoDecoration.swift index db3f3722d6..61e4250c29 100644 --- a/submodules/TelegramUI/TelegramUI/GalleryVideoDecoration.swift +++ b/submodules/TelegramUI/TelegramUI/GalleryVideoDecoration.swift @@ -4,6 +4,7 @@ import AsyncDisplayKit import Display import SwiftSignalKit import UniversalMediaPlayer +import AccountContext final class GalleryVideoDecoration: UniversalVideoDecoration { let backgroundNode: ASDisplayNode? = nil diff --git a/submodules/TelegramUI/TelegramUI/GameController.swift b/submodules/TelegramUI/TelegramUI/GameController.swift index 5a8ff15ae0..6c17dce60f 100644 --- a/submodules/TelegramUI/TelegramUI/GameController.swift +++ b/submodules/TelegramUI/TelegramUI/GameController.swift @@ -6,19 +6,20 @@ import TelegramCore import SwiftSignalKit import Postbox import TelegramPresentationData +import AccountContext final class GameController: ViewController { private var controllerNode: GameControllerNode { return self.displayNode as! GameControllerNode } - private let context: AccountContextImpl + private let context: AccountContext private let url: String private let message: Message private var presentationData: PresentationData - init(context: AccountContextImpl, url: String, message: Message) { + init(context: AccountContext, url: String, message: Message) { self.context = context self.url = url self.message = message diff --git a/submodules/TelegramUI/TelegramUI/GameControllerNode.swift b/submodules/TelegramUI/TelegramUI/GameControllerNode.swift index 3b1914762e..82825076a6 100644 --- a/submodules/TelegramUI/TelegramUI/GameControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/GameControllerNode.swift @@ -7,6 +7,7 @@ import TelegramCore import Postbox import SwiftSignalKit import TelegramPresentationData +import AccountContext private class WeakGameScriptMessageHandler: NSObject, WKScriptMessageHandler { private let f: (WKScriptMessage) -> () @@ -25,12 +26,12 @@ private class WeakGameScriptMessageHandler: NSObject, WKScriptMessageHandler { final class GameControllerNode: ViewControllerTracingNode { private var webView: WKWebView? - private let context: AccountContextImpl + private let context: AccountContext var presentationData: PresentationData private let present: (ViewController, Any?) -> Void private let message: Message - init(context: AccountContextImpl, presentationData: PresentationData, url: String, present: @escaping (ViewController, Any?) -> Void, message: Message) { + init(context: AccountContext, presentationData: PresentationData, url: String, present: @escaping (ViewController, Any?) -> Void, message: Message) { self.context = context self.presentationData = presentationData self.present = present diff --git a/submodules/TelegramUI/TelegramUI/GifPaneSearchContentNode.swift b/submodules/TelegramUI/TelegramUI/GifPaneSearchContentNode.swift index f23dc27815..3e3012006a 100644 --- a/submodules/TelegramUI/TelegramUI/GifPaneSearchContentNode.swift +++ b/submodules/TelegramUI/TelegramUI/GifPaneSearchContentNode.swift @@ -6,6 +6,7 @@ import SwiftSignalKit import Postbox import TelegramCore import TelegramPresentationData +import AccountContext func paneGifSearchForQuery(account: Account, query: String, updateActivity: ((Bool) -> Void)?) -> Signal<[FileMediaReference]?, NoError> { let delayRequest = true @@ -98,7 +99,7 @@ func paneGifSearchForQuery(account: Account, query: String, updateActivity: ((Bo } final class GifPaneSearchContentNode: ASDisplayNode & PaneSearchContentNode { - private let context: AccountContextImpl + private let context: AccountContext private let controllerInteraction: ChatControllerInteraction private let inputNodeInteraction: ChatMediaInputNodeInteraction @@ -122,7 +123,7 @@ final class GifPaneSearchContentNode: ASDisplayNode & PaneSearchContentNode { var deactivateSearchBar: (() -> Void)? var updateActivity: ((Bool) -> Void)? - init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings, controllerInteraction: ChatControllerInteraction, inputNodeInteraction: ChatMediaInputNodeInteraction, trendingPromise: Promise<[FileMediaReference]?>) { + init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, controllerInteraction: ChatControllerInteraction, inputNodeInteraction: ChatMediaInputNodeInteraction, trendingPromise: Promise<[FileMediaReference]?>) { self.context = context self.controllerInteraction = controllerInteraction self.inputNodeInteraction = inputNodeInteraction diff --git a/submodules/TelegramUI/TelegramUI/GridMessageItem.swift b/submodules/TelegramUI/TelegramUI/GridMessageItem.swift index f6e8c8511c..292803a2a3 100644 --- a/submodules/TelegramUI/TelegramUI/GridMessageItem.swift +++ b/submodules/TelegramUI/TelegramUI/GridMessageItem.swift @@ -6,6 +6,8 @@ import TelegramCore import Postbox import SwiftSignalKit import TelegramPresentationData +import TelegramStringFormatting +import AccountContext private func mediaForMessage(_ message: Message) -> Media? { for media in message.media { @@ -105,12 +107,12 @@ final class GridMessageItemSectionNode: ASDisplayNode { final class GridMessageItem: GridItem { fileprivate let theme: PresentationTheme private let strings: PresentationStrings - private let context: AccountContextImpl + private let context: AccountContext fileprivate let message: Message private let controllerInteraction: ChatControllerInteraction let section: GridSection? - init(theme: PresentationTheme, strings: PresentationStrings, context: AccountContextImpl, message: Message, controllerInteraction: ChatControllerInteraction) { + init(theme: PresentationTheme, strings: PresentationStrings, context: AccountContext, message: Message, controllerInteraction: ChatControllerInteraction) { self.theme = theme self.strings = strings self.context = context @@ -139,7 +141,7 @@ final class GridMessageItem: GridItem { } final class GridMessageItemNode: GridItemNode { - private var currentState: (AccountContextImpl, Media, CGSize)? + private var currentState: (AccountContext, Media, CGSize)? private let imageNode: TransformImageNode private(set) var messageId: MessageId? private var item: GridMessageItem? @@ -188,7 +190,7 @@ final class GridMessageItemNode: GridItemNode { self.imageNode.view.addGestureRecognizer(recognizer) } - func setup(context: AccountContextImpl, item: GridMessageItem, media: Media, messageId: MessageId, controllerInteraction: ChatControllerInteraction, synchronousLoad: Bool) { + func setup(context: AccountContext, item: GridMessageItem, media: Media, messageId: MessageId, controllerInteraction: ChatControllerInteraction, synchronousLoad: Bool) { self.item = item if self.currentState == nil || self.currentState!.0 !== context || !self.currentState!.1.isEqual(to: media) { diff --git a/submodules/TelegramUI/TelegramUI/GroupInfoController.swift b/submodules/TelegramUI/TelegramUI/GroupInfoController.swift index 2145172fa4..b8c53ae207 100644 --- a/submodules/TelegramUI/TelegramUI/GroupInfoController.swift +++ b/submodules/TelegramUI/TelegramUI/GroupInfoController.swift @@ -12,9 +12,11 @@ import TelegramUIPreferences import ItemListUI import TextFormat import AccountContext +import TelegramStringFormatting +import TemporaryCachedPeerDataManager private final class GroupInfoArguments { - let context: AccountContextImpl + let context: AccountContext let avatarAndNameInfoContext: ItemListAvatarAndNameInfoItemContext let tapAvatarAction: () -> Void @@ -45,7 +47,7 @@ private final class GroupInfoArguments { let changeLocation: () -> Void let displayLocationContextMenu: (String) -> Void - init(context: AccountContextImpl, avatarAndNameInfoContext: ItemListAvatarAndNameInfoItemContext, tapAvatarAction: @escaping () -> Void, changeProfilePhoto: @escaping () -> Void, pushController: @escaping (ViewController) -> Void, presentController: @escaping (ViewController, ViewControllerPresentationArguments) -> Void, changeNotificationMuteSettings: @escaping () -> Void, openPreHistory: @escaping () -> Void, openSharedMedia: @escaping () -> Void, openAdministrators: @escaping () -> Void, openPermissions: @escaping () -> Void, updateEditingName: @escaping (ItemListAvatarAndNameInfoItemName) -> Void, updateEditingDescriptionText: @escaping (String) -> Void, setPeerIdWithRevealedOptions: @escaping (PeerId?, PeerId?) -> Void, addMember: @escaping () -> Void, promotePeer: @escaping (RenderedChannelParticipant) -> Void, restrictPeer: @escaping (RenderedChannelParticipant) -> Void, removePeer: @escaping (PeerId) -> Void, leave: @escaping () -> Void, displayUsernameShareMenu: @escaping (String) -> Void, displayUsernameContextMenu: @escaping (String) -> Void, displayAboutContextMenu: @escaping (String) -> Void, aboutLinkAction: @escaping (TextLinkItemActionType, TextLinkItem) -> Void, openStickerPackSetup: @escaping () -> Void, openGroupTypeSetup: @escaping () -> Void, openLinkedChannelSetup: @escaping () -> Void, openLocation: @escaping (PeerGeoLocation) -> Void, changeLocation: @escaping () -> Void, displayLocationContextMenu: @escaping (String) -> Void) { + init(context: AccountContext, avatarAndNameInfoContext: ItemListAvatarAndNameInfoItemContext, tapAvatarAction: @escaping () -> Void, changeProfilePhoto: @escaping () -> Void, pushController: @escaping (ViewController) -> Void, presentController: @escaping (ViewController, ViewControllerPresentationArguments) -> Void, changeNotificationMuteSettings: @escaping () -> Void, openPreHistory: @escaping () -> Void, openSharedMedia: @escaping () -> Void, openAdministrators: @escaping () -> Void, openPermissions: @escaping () -> Void, updateEditingName: @escaping (ItemListAvatarAndNameInfoItemName) -> Void, updateEditingDescriptionText: @escaping (String) -> Void, setPeerIdWithRevealedOptions: @escaping (PeerId?, PeerId?) -> Void, addMember: @escaping () -> Void, promotePeer: @escaping (RenderedChannelParticipant) -> Void, restrictPeer: @escaping (RenderedChannelParticipant) -> Void, removePeer: @escaping (PeerId) -> Void, leave: @escaping () -> Void, displayUsernameShareMenu: @escaping (String) -> Void, displayUsernameContextMenu: @escaping (String) -> Void, displayAboutContextMenu: @escaping (String) -> Void, aboutLinkAction: @escaping (TextLinkItemActionType, TextLinkItem) -> Void, openStickerPackSetup: @escaping () -> Void, openGroupTypeSetup: @escaping () -> Void, openLinkedChannelSetup: @escaping () -> Void, openLocation: @escaping (PeerGeoLocation) -> Void, changeLocation: @escaping () -> Void, displayLocationContextMenu: @escaping (String) -> Void) { self.context = context self.avatarAndNameInfoContext = avatarAndNameInfoContext self.tapAvatarAction = tapAvatarAction @@ -1261,7 +1263,7 @@ private func valuesRequiringUpdate(state: GroupInfoState, view: PeerView) -> (ti } } -public func groupInfoController(context: AccountContextImpl, peerId originalPeerId: PeerId, membersLoaded: @escaping () -> Void = {}) -> ViewController { +public func groupInfoController(context: AccountContext, peerId originalPeerId: PeerId, membersLoaded: @escaping () -> Void = {}) -> ViewController { let statePromise = ValuePromise(GroupInfoState(updatingAvatar: nil, editingState: nil, updatingName: nil, peerIdWithRevealedOptions: nil, temporaryParticipants: [], successfullyAddedParticipantIds: Set(), removingParticipantIds: Set(), savingData: false, searchingMembers: false), ignoreRepeated: true) let stateValue = Atomic(value: GroupInfoState(updatingAvatar: nil, editingState: nil, updatingName: nil, peerIdWithRevealedOptions: nil, temporaryParticipants: [], successfullyAddedParticipantIds: Set(), removingParticipantIds: Set(), savingData: false, searchingMembers: false)) let updateState: ((GroupInfoState) -> GroupInfoState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/GroupInfoSearchItem.swift b/submodules/TelegramUI/TelegramUI/GroupInfoSearchItem.swift index 31c71ee009..e546837462 100644 --- a/submodules/TelegramUI/TelegramUI/GroupInfoSearchItem.swift +++ b/submodules/TelegramUI/TelegramUI/GroupInfoSearchItem.swift @@ -6,9 +6,10 @@ import Postbox import TelegramCore import SwiftSignalKit import ItemListUI +import AccountContext final class ChannelMembersSearchItem: ItemListControllerSearch { - let context: AccountContextImpl + let context: AccountContext let peerId: PeerId let searchContext: GroupMembersSearchContext? let cancel: () -> Void @@ -20,7 +21,7 @@ final class ChannelMembersSearchItem: ItemListControllerSearch { private var activity: ValuePromise = ValuePromise(ignoreRepeated: false) private let activityDisposable = MetaDisposable() - init(context: AccountContextImpl, peerId: PeerId, searchContext: GroupMembersSearchContext?, searchMode: ChannelMembersSearchMode = .searchMembers, cancel: @escaping () -> Void, openPeer: @escaping (Peer, RenderedChannelParticipant?) -> Void, present: @escaping (ViewController, Any?) -> Void) { + init(context: AccountContext, peerId: PeerId, searchContext: GroupMembersSearchContext?, searchMode: ChannelMembersSearchMode = .searchMembers, cancel: @escaping () -> Void, openPeer: @escaping (Peer, RenderedChannelParticipant?) -> Void, present: @escaping (ViewController, Any?) -> Void) { self.context = context self.peerId = peerId self.searchContext = searchContext @@ -81,7 +82,7 @@ final class ChannelMembersSearchItem: ItemListControllerSearch { private final class ChannelMembersSearchItemNode: ItemListControllerSearchNode { private let containerNode: ChannelMembersSearchContainerNode - init(context: AccountContextImpl, peerId: PeerId, searchMode: ChannelMembersSearchMode, searchContext: GroupMembersSearchContext?, openPeer: @escaping (Peer, RenderedChannelParticipant?) -> Void, cancel: @escaping () -> Void, updateActivity: @escaping(Bool) -> Void, present: @escaping (ViewController, Any?) -> Void) { + init(context: AccountContext, peerId: PeerId, searchMode: ChannelMembersSearchMode, searchContext: GroupMembersSearchContext?, openPeer: @escaping (Peer, RenderedChannelParticipant?) -> Void, cancel: @escaping () -> Void, updateActivity: @escaping(Bool) -> Void, present: @escaping (ViewController, Any?) -> Void) { self.containerNode = ChannelMembersSearchContainerNode(context: context, peerId: peerId, mode: searchMode, filters: [], searchContext: searchContext, openPeer: { peer, participant in openPeer(peer, participant) }, updateActivity: updateActivity, present: present) diff --git a/submodules/TelegramUI/TelegramUI/GroupPreHistorySetupController.swift b/submodules/TelegramUI/TelegramUI/GroupPreHistorySetupController.swift index d4d14e9e9f..4e90bbc0d6 100644 --- a/submodules/TelegramUI/TelegramUI/GroupPreHistorySetupController.swift +++ b/submodules/TelegramUI/TelegramUI/GroupPreHistorySetupController.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import TelegramPresentationData import ItemListUI +import AccountContext private final class GroupPreHistorySetupArguments { let toggle: (Bool) -> Void @@ -113,7 +114,7 @@ private func groupPreHistorySetupEntries(isSupergroup: Bool, presentationData: P return entries } -public func groupPreHistorySetupController(context: AccountContextImpl, peerId: PeerId, upgradedToSupergroup: @escaping (PeerId, @escaping () -> Void) -> Void) -> ViewController { +public func groupPreHistorySetupController(context: AccountContext, peerId: PeerId, upgradedToSupergroup: @escaping (PeerId, @escaping () -> Void) -> Void) -> ViewController { let statePromise = ValuePromise(GroupPreHistorySetupState(), ignoreRepeated: true) let stateValue = Atomic(value: GroupPreHistorySetupState()) let updateState: ((GroupPreHistorySetupState) -> GroupPreHistorySetupState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/GroupStickerPackSetupController.swift b/submodules/TelegramUI/TelegramUI/GroupStickerPackSetupController.swift index 8d245b9dc2..58bbbdaaf1 100644 --- a/submodules/TelegramUI/TelegramUI/GroupStickerPackSetupController.swift +++ b/submodules/TelegramUI/TelegramUI/GroupStickerPackSetupController.swift @@ -7,6 +7,7 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext private final class GroupStickerPackSetupControllerArguments { let account: Account @@ -303,7 +304,7 @@ private func groupStickerPackSetupControllerEntries(presentationData: Presentati return entries } -public func groupStickerPackSetupController(context: AccountContextImpl, peerId: PeerId, currentPackInfo: StickerPackCollectionInfo?) -> ViewController { +public func groupStickerPackSetupController(context: AccountContext, peerId: PeerId, currentPackInfo: StickerPackCollectionInfo?) -> ViewController { let initialState = GroupStickerPackSetupControllerState(isSaving: false) let statePromise = ValuePromise(initialState, ignoreRepeated: true) diff --git a/submodules/TelegramUI/TelegramUI/GroupsInCommonController.swift b/submodules/TelegramUI/TelegramUI/GroupsInCommonController.swift index af6a4d468d..1907d1f4e3 100644 --- a/submodules/TelegramUI/TelegramUI/GroupsInCommonController.swift +++ b/submodules/TelegramUI/TelegramUI/GroupsInCommonController.swift @@ -7,6 +7,7 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext private final class GroupsInCommonControllerArguments { let account: Account @@ -25,24 +26,6 @@ private enum GroupsInCommonSection: Int32 { private enum GroupsInCommonEntryStableId: Hashable { case peer(PeerId) - - var hashValue: Int { - switch self { - case let .peer(peerId): - return peerId.hashValue - } - } - - static func ==(lhs: GroupsInCommonEntryStableId, rhs: GroupsInCommonEntryStableId) -> Bool { - switch lhs { - case let .peer(peerId): - if case .peer(peerId) = rhs { - return true - } else { - return false - } - } - } } private enum GroupsInCommonEntry: ItemListNodeEntry { @@ -133,7 +116,7 @@ private func groupsInCommonControllerEntries(presentationData: PresentationData, return entries } -public func groupsInCommonController(context: AccountContextImpl, peerId: PeerId) -> ViewController { +public func groupsInCommonController(context: AccountContext, peerId: PeerId) -> ViewController { let statePromise = ValuePromise(GroupsInCommonControllerState(), ignoreRepeated: true) let stateValue = Atomic(value: GroupsInCommonControllerState()) let updateState: ((GroupsInCommonControllerState) -> GroupsInCommonControllerState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/HashtagChatInputContextPanelNode.swift b/submodules/TelegramUI/TelegramUI/HashtagChatInputContextPanelNode.swift index 78f8825e46..bb0ac4cbaf 100644 --- a/submodules/TelegramUI/TelegramUI/HashtagChatInputContextPanelNode.swift +++ b/submodules/TelegramUI/TelegramUI/HashtagChatInputContextPanelNode.swift @@ -6,6 +6,8 @@ import TelegramCore import Display import TelegramPresentationData import MergeLists +import AccountContext +import AccountContext private struct HashtagChatInputContextPanelEntryStableId: Hashable { let text: String @@ -60,7 +62,7 @@ final class HashtagChatInputContextPanelNode: ChatInputContextPanelNode { private var enqueuedTransitions: [(HashtagChatInputContextPanelTransition, Bool)] = [] private var validLayout: (CGSize, CGFloat, CGFloat)? - override init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings) { + override init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings) { self.listView = ListView() self.listView.isOpaque = false self.listView.stackFromBottom = true diff --git a/submodules/TelegramUI/TelegramUI/HashtagSearchController.swift b/submodules/TelegramUI/TelegramUI/HashtagSearchController.swift index 58669c3b76..a47769403e 100644 --- a/submodules/TelegramUI/TelegramUI/HashtagSearchController.swift +++ b/submodules/TelegramUI/TelegramUI/HashtagSearchController.swift @@ -5,11 +5,13 @@ import TelegramCore import Postbox import SwiftSignalKit import TelegramPresentationData +import TelegramBaseController +import AccountContext -final class HashtagSearchController: TelegramController { +final class HashtagSearchController: TelegramBaseController { private let queue = Queue() - private let context: AccountContextImpl + private let context: AccountContext private let peer: Peer? private let query: String private var transitionDisposable: Disposable? @@ -21,7 +23,7 @@ final class HashtagSearchController: TelegramController { return self.displayNode as! HashtagSearchControllerNode } - init(context: AccountContextImpl, peer: Peer?, query: String) { + init(context: AccountContext, peer: Peer?, query: String) { self.context = context self.peer = peer self.query = query diff --git a/submodules/TelegramUI/TelegramUI/HashtagSearchControllerNode.swift b/submodules/TelegramUI/TelegramUI/HashtagSearchControllerNode.swift index 03a2404d7e..2ff9dc7e45 100644 --- a/submodules/TelegramUI/TelegramUI/HashtagSearchControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/HashtagSearchControllerNode.swift @@ -4,6 +4,7 @@ import AsyncDisplayKit import Postbox import TelegramCore import TelegramPresentationData +import AccountContext final class HashtagSearchControllerNode: ASDisplayNode { private let toolbarBackgroundNode: ASDisplayNode @@ -13,7 +14,7 @@ final class HashtagSearchControllerNode: ASDisplayNode { var chatController: ChatController? - private let context: AccountContextImpl + private let context: AccountContext private let query: String private var containerLayout: (ContainerViewLayout, CGFloat)? @@ -22,7 +23,7 @@ final class HashtagSearchControllerNode: ASDisplayNode { var navigationBar: NavigationBar? - init(context: AccountContextImpl, peer: Peer?, query: String, theme: PresentationTheme, strings: PresentationStrings) { + init(context: AccountContext, peer: Peer?, query: String, theme: PresentationTheme, strings: PresentationStrings) { self.context = context self.query = query self.listNode = ListView() diff --git a/submodules/TelegramUI/TelegramUI/HorizontalListContextResultsChatInputContextPanelNode.swift b/submodules/TelegramUI/TelegramUI/HorizontalListContextResultsChatInputContextPanelNode.swift index f877c3dafa..caa47666e3 100644 --- a/submodules/TelegramUI/TelegramUI/HorizontalListContextResultsChatInputContextPanelNode.swift +++ b/submodules/TelegramUI/TelegramUI/HorizontalListContextResultsChatInputContextPanelNode.swift @@ -7,6 +7,7 @@ import Display import SwiftSignalKit import TelegramPresentationData import MergeLists +import AccountContext private struct ChatContextResultStableId: Hashable { let result: ChatContextResult @@ -83,7 +84,7 @@ final class HorizontalListContextResultsChatInputContextPanelNode: ChatInputCont private var enqueuedTransitions: [(HorizontalListContextResultsChatInputContextPanelTransition, Bool)] = [] private var hasValidLayout = false - override init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings) { + override init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings) { self.strings = strings self.separatorNode = ASDisplayNode() diff --git a/submodules/TelegramUI/TelegramUI/HorizontalPeerItem.swift b/submodules/TelegramUI/TelegramUI/HorizontalPeerItem.swift index 8b06486c62..a59d7fcb5b 100644 --- a/submodules/TelegramUI/TelegramUI/HorizontalPeerItem.swift +++ b/submodules/TelegramUI/TelegramUI/HorizontalPeerItem.swift @@ -6,6 +6,7 @@ import AsyncDisplayKit import TelegramCore import SwiftSignalKit import TelegramPresentationData +import TelegramStringFormatting enum HorizontalPeerItemMode { case list diff --git a/submodules/TelegramUI/TelegramUI/HorizontalStickersChatContextPanelNode.swift b/submodules/TelegramUI/TelegramUI/HorizontalStickersChatContextPanelNode.swift index 5cbb688673..eca241287f 100755 --- a/submodules/TelegramUI/TelegramUI/HorizontalStickersChatContextPanelNode.swift +++ b/submodules/TelegramUI/TelegramUI/HorizontalStickersChatContextPanelNode.swift @@ -7,6 +7,7 @@ import Display import SwiftSignalKit import TelegramPresentationData import MergeLists +import AccountContext final class HorizontalStickersChatContextPanelInteraction { var previewedStickerItem: StickerPackItem? @@ -106,7 +107,7 @@ final class HorizontalStickersChatContextPanelNode: ChatInputContextPanelNode { private var stickerPreviewController: StickerPreviewController? - override init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings) { + override init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings) { self.strings = strings self.backgroundNode = ASImageNode() diff --git a/submodules/TelegramUI/TelegramUI/InChatPrefetchManager.swift b/submodules/TelegramUI/TelegramUI/InChatPrefetchManager.swift index 616a793c93..d9c7e73b1d 100644 --- a/submodules/TelegramUI/TelegramUI/InChatPrefetchManager.swift +++ b/submodules/TelegramUI/TelegramUI/InChatPrefetchManager.swift @@ -3,7 +3,7 @@ import SwiftSignalKit import Postbox import TelegramCore import TelegramUIPreferences -import TelegramUIPreferences +import AccountContext private final class PrefetchMediaContext { let fetchDisposable = MetaDisposable() @@ -18,7 +18,7 @@ struct InChatPrefetchOptions: Equatable { } final class InChatPrefetchManager { - private let context: AccountContextImpl + private let context: AccountContext private var settings: MediaAutoDownloadSettings private var options: InChatPrefetchOptions? @@ -27,7 +27,7 @@ final class InChatPrefetchManager { private var contexts: [MediaId: PrefetchMediaContext] = [:] - init(context: AccountContextImpl) { + init(context: AccountContext) { self.context = context self.settings = context.sharedContext.currentAutomaticMediaDownloadSettings.with { $0 } } diff --git a/submodules/TelegramUI/TelegramUI/InstalledStickerPacksController.swift b/submodules/TelegramUI/TelegramUI/InstalledStickerPacksController.swift index 9f47e4bdf3..69ac4a5c2f 100644 --- a/submodules/TelegramUI/TelegramUI/InstalledStickerPacksController.swift +++ b/submodules/TelegramUI/TelegramUI/InstalledStickerPacksController.swift @@ -8,6 +8,7 @@ import TelegramPresentationData import TelegramUIPreferences import ItemListUI import TextFormat +import AccountContext private final class InstalledStickerPacksControllerArguments { let account: Account @@ -444,7 +445,7 @@ public enum InstalledStickerPacksControllerMode { case masks } -public func installedStickerPacksController(context: AccountContextImpl, mode: InstalledStickerPacksControllerMode, archivedPacks: [ArchivedStickerPackItem]? = nil, updatedPacks: @escaping ([ArchivedStickerPackItem]?) -> Void = { _ in }, focusOnItemTag: InstalledStickerPacksEntryTag? = nil) -> ViewController { +public func installedStickerPacksController(context: AccountContext, mode: InstalledStickerPacksControllerMode, archivedPacks: [ArchivedStickerPackItem]? = nil, updatedPacks: @escaping ([ArchivedStickerPackItem]?) -> Void = { _ in }, focusOnItemTag: InstalledStickerPacksEntryTag? = nil) -> ViewController { let initialState = InstalledStickerPacksControllerState().withUpdatedEditing(mode == .modal) let statePromise = ValuePromise(initialState, ignoreRepeated: true) let stateValue = Atomic(value: initialState) diff --git a/submodules/TelegramUI/TelegramUI/InstantImageGalleryItem.swift b/submodules/TelegramUI/TelegramUI/InstantImageGalleryItem.swift index 72b1195e51..a39453aa27 100644 --- a/submodules/TelegramUI/TelegramUI/InstantImageGalleryItem.swift +++ b/submodules/TelegramUI/TelegramUI/InstantImageGalleryItem.swift @@ -6,6 +6,7 @@ import SwiftSignalKit import Postbox import TelegramCore import TelegramPresentationData +import AccountContext private struct InstantImageGalleryThumbnailItem: GalleryThumbnailItem { let account: Account @@ -31,7 +32,7 @@ private struct InstantImageGalleryThumbnailItem: GalleryThumbnailItem { } class InstantImageGalleryItem: GalleryItem { - let context: AccountContextImpl + let context: AccountContext let presentationData: PresentationData let imageReference: ImageMediaReference let caption: NSAttributedString @@ -40,7 +41,7 @@ class InstantImageGalleryItem: GalleryItem { let openUrl: (InstantPageUrlItem) -> Void let openUrlOptions: (InstantPageUrlItem) -> Void - init(context: AccountContextImpl, presentationData: PresentationData, imageReference: ImageMediaReference, caption: NSAttributedString, credit: NSAttributedString, location: InstantPageGalleryEntryLocation?, openUrl: @escaping (InstantPageUrlItem) -> Void, openUrlOptions: @escaping (InstantPageUrlItem) -> Void) { + init(context: AccountContext, presentationData: PresentationData, imageReference: ImageMediaReference, caption: NSAttributedString, credit: NSAttributedString, location: InstantPageGalleryEntryLocation?, openUrl: @escaping (InstantPageUrlItem) -> Void, openUrlOptions: @escaping (InstantPageUrlItem) -> Void) { self.context = context self.presentationData = presentationData self.imageReference = imageReference @@ -81,18 +82,18 @@ class InstantImageGalleryItem: GalleryItem { } final class InstantImageGalleryItemNode: ZoomableContentGalleryItemNode { - private let context: AccountContextImpl + private let context: AccountContext private let imageNode: TransformImageNode fileprivate let _ready = Promise() fileprivate let _title = Promise() private let footerContentNode: InstantPageGalleryFooterContentNode - private var contextAndMedia: (AccountContextImpl, AnyMediaReference)? + private var contextAndMedia: (AccountContext, AnyMediaReference)? private var fetchDisposable = MetaDisposable() - init(context: AccountContextImpl, presentationData: PresentationData, openUrl: @escaping (InstantPageUrlItem) -> Void, openUrlOptions: @escaping (InstantPageUrlItem) -> Void) { + init(context: AccountContext, presentationData: PresentationData, openUrl: @escaping (InstantPageUrlItem) -> Void, openUrlOptions: @escaping (InstantPageUrlItem) -> Void) { self.context = context self.imageNode = TransformImageNode() @@ -142,7 +143,7 @@ final class InstantImageGalleryItemNode: ZoomableContentGalleryItemNode { self.footerContentNode.setShareMedia(imageReference.abstract) } - func setFile(context: AccountContextImpl, fileReference: FileMediaReference) { + func setFile(context: AccountContext, fileReference: FileMediaReference) { if self.contextAndMedia == nil || !self.contextAndMedia!.1.media.isEqual(to: fileReference.media) { if let largestSize = fileReference.media.dimensions { let displaySize = largestSize.dividedByScreenScale() diff --git a/submodules/TelegramUI/TelegramUI/InstantPageAnchorItem.swift b/submodules/TelegramUI/TelegramUI/InstantPageAnchorItem.swift index 8527391ca9..af563bbdfa 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageAnchorItem.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageAnchorItem.swift @@ -4,6 +4,7 @@ import Postbox import TelegramCore import AsyncDisplayKit import TelegramPresentationData +import AccountContext final class InstantPageAnchorItem: InstantPageItem { let wantsNode: Bool = false @@ -25,7 +26,7 @@ final class InstantPageAnchorItem: InstantPageItem { func drawInTile(context: CGContext) { } - func node(context: AccountContextImpl, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { + func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { return nil } diff --git a/submodules/TelegramUI/TelegramUI/InstantPageArticleItem.swift b/submodules/TelegramUI/TelegramUI/InstantPageArticleItem.swift index 407b14458a..20d4862668 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageArticleItem.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageArticleItem.swift @@ -4,6 +4,7 @@ import Postbox import TelegramCore import AsyncDisplayKit import TelegramPresentationData +import AccountContext final class InstantPageArticleItem: InstantPageItem { var frame: CGRect @@ -30,7 +31,7 @@ final class InstantPageArticleItem: InstantPageItem { self.rtl = rtl } - func node(context: AccountContextImpl, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { + func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { return InstantPageArticleNode(context: context, item: self, webPage: self.webPage, strings: strings, theme: theme, contentItems: self.contentItems, contentSize: self.contentSize, cover: self.cover, url: self.url, webpageId: self.webpageId, rtl: self.rtl, openUrl: openUrl) } diff --git a/submodules/TelegramUI/TelegramUI/InstantPageArticleNode.swift b/submodules/TelegramUI/TelegramUI/InstantPageArticleNode.swift index a0c17cf1db..9b0126ddc5 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageArticleNode.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageArticleNode.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import SwiftSignalKit import TelegramPresentationData +import AccountContext final class InstantPageArticleNode: ASDisplayNode, InstantPageNode { let item: InstantPageArticleItem @@ -26,7 +27,7 @@ final class InstantPageArticleNode: ASDisplayNode, InstantPageNode { private var fetchedDisposable = MetaDisposable() - init(context: AccountContextImpl, item: InstantPageArticleItem, webPage: TelegramMediaWebpage, strings: PresentationStrings, theme: InstantPageTheme, contentItems: [InstantPageItem], contentSize: CGSize, cover: TelegramMediaImage?, url: String, webpageId: MediaId, rtl: Bool, openUrl: @escaping (InstantPageUrlItem) -> Void) { + init(context: AccountContext, item: InstantPageArticleItem, webPage: TelegramMediaWebpage, strings: PresentationStrings, theme: InstantPageTheme, contentItems: [InstantPageItem], contentSize: CGSize, cover: TelegramMediaImage?, url: String, webpageId: MediaId, rtl: Bool, openUrl: @escaping (InstantPageUrlItem) -> Void) { self.item = item self.url = url self.webpageId = webpageId diff --git a/submodules/TelegramUI/TelegramUI/InstantPageAudioItem.swift b/submodules/TelegramUI/TelegramUI/InstantPageAudioItem.swift index 852a16bcc3..64bcb67aee 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageAudioItem.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageAudioItem.swift @@ -4,6 +4,7 @@ import Postbox import TelegramCore import AsyncDisplayKit import TelegramPresentationData +import AccountContext final class InstantPageAudioItem: InstantPageItem { var frame: CGRect @@ -21,7 +22,7 @@ final class InstantPageAudioItem: InstantPageItem { self.medias = [media] } - func node(context: AccountContextImpl, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { + func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { return InstantPageAudioNode(context: context, strings: strings, theme: theme, webPage: self.webpage, media: self.media, openMedia: openMedia) } diff --git a/submodules/TelegramUI/TelegramUI/InstantPageAudioNode.swift b/submodules/TelegramUI/TelegramUI/InstantPageAudioNode.swift index 861031357a..a529218f55 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageAudioNode.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageAudioNode.swift @@ -7,6 +7,7 @@ import AsyncDisplayKit import Display import TelegramPresentationData import UniversalMediaPlayer +import AccountContext private func generatePlayButton(color: UIColor) -> UIImage? { return generateImage(CGSize(width: 48.0, height: 48.0), rotatedContext: { size, context in @@ -54,7 +55,7 @@ private func titleString(media: InstantPageMedia, theme: InstantPageTheme) -> NS } final class InstantPageAudioNode: ASDisplayNode, InstantPageNode { - private let context: AccountContextImpl + private let context: AccountContext let media: InstantPageMedia private let openMedia: (InstantPageMedia) -> Void private var strings: PresentationStrings @@ -75,7 +76,7 @@ final class InstantPageAudioNode: ASDisplayNode, InstantPageNode { private var isPlaying: Bool = false private var playbackState: SharedMediaPlayerItemPlaybackState? - init(context: AccountContextImpl, strings: PresentationStrings, theme: InstantPageTheme, webPage: TelegramMediaWebpage, media: InstantPageMedia, openMedia: @escaping (InstantPageMedia) -> Void) { + init(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, webPage: TelegramMediaWebpage, media: InstantPageMedia, openMedia: @escaping (InstantPageMedia) -> Void) { self.context = context self.strings = strings self.theme = theme diff --git a/submodules/TelegramUI/TelegramUI/InstantPageContentNode.swift b/submodules/TelegramUI/TelegramUI/InstantPageContentNode.swift index 9e215c7483..234d8e714b 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageContentNode.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageContentNode.swift @@ -6,9 +6,10 @@ import Postbox import TelegramCore import SwiftSignalKit import TelegramPresentationData +import AccountContext final class InstantPageContentNode : ASDisplayNode { - private let context: AccountContextImpl + private let context: AccountContext private let strings: PresentationStrings private let theme: InstantPageTheme @@ -36,7 +37,7 @@ final class InstantPageContentNode : ASDisplayNode { private var previousVisibleBounds: CGRect? - init(context: AccountContextImpl, strings: PresentationStrings, theme: InstantPageTheme, items: [InstantPageItem], contentSize: CGSize, inOverlayPanel: Bool = false, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void) { + init(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, items: [InstantPageItem], contentSize: CGSize, inOverlayPanel: Bool = false, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void) { self.context = context self.strings = strings self.theme = theme diff --git a/submodules/TelegramUI/TelegramUI/InstantPageController.swift b/submodules/TelegramUI/TelegramUI/InstantPageController.swift index aae509e3d4..caa5b127e9 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageController.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageController.swift @@ -6,9 +6,10 @@ import SwiftSignalKit import Display import TelegramPresentationData import TelegramUIPreferences +import AccountContext final class InstantPageController: ViewController { - private let context: AccountContextImpl + private let context: AccountContext private var webPage: TelegramMediaWebpage private let sourcePeerType: MediaAutoDownloadPeerType private let anchor: String? @@ -31,7 +32,7 @@ final class InstantPageController: ViewController { private var settingsDisposable: Disposable? private var themeSettings: PresentationThemeSettings? - init(context: AccountContextImpl, webPage: TelegramMediaWebpage, sourcePeerType: MediaAutoDownloadPeerType, anchor: String? = nil) { + init(context: AccountContext, webPage: TelegramMediaWebpage, sourcePeerType: MediaAutoDownloadPeerType, anchor: String? = nil) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/InstantPageControllerNode.swift b/submodules/TelegramUI/TelegramUI/InstantPageControllerNode.swift index befd12e5e0..e187377103 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageControllerNode.swift @@ -8,9 +8,10 @@ import Display import SafariServices import TelegramPresentationData import TelegramUIPreferences +import AccountContext final class InstantPageControllerNode: ASDisplayNode, UIScrollViewDelegate { - private let context: AccountContextImpl + private let context: AccountContext private var settings: InstantPagePresentationSettings? private var themeSettings: PresentationThemeSettings? private var presentationTheme: PresentationTheme @@ -80,7 +81,7 @@ final class InstantPageControllerNode: ASDisplayNode, UIScrollViewDelegate { return InstantPageStoredState(contentOffset: Double(self.scrollNode.view.contentOffset.y), details: details) } - init(context: AccountContextImpl, settings: InstantPagePresentationSettings?, themeSettings: PresentationThemeSettings?, presentationTheme: PresentationTheme, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, statusBar: StatusBar, sourcePeerType: MediaAutoDownloadPeerType, getNavigationController: @escaping () -> NavigationController?, present: @escaping (ViewController, Any?) -> Void, pushController: @escaping (ViewController) -> Void, openPeer: @escaping (PeerId) -> Void, navigateBack: @escaping () -> Void) { + init(context: AccountContext, settings: InstantPagePresentationSettings?, themeSettings: PresentationThemeSettings?, presentationTheme: PresentationTheme, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, statusBar: StatusBar, sourcePeerType: MediaAutoDownloadPeerType, getNavigationController: @escaping () -> NavigationController?, present: @escaping (ViewController, Any?) -> Void, pushController: @escaping (ViewController) -> Void, openPeer: @escaping (PeerId) -> Void, navigateBack: @escaping () -> Void) { self.context = context self.presentationTheme = presentationTheme self.dateTimeFormat = dateTimeFormat @@ -1268,7 +1269,7 @@ final class InstantPageControllerNode: ASDisplayNode, UIScrollViewDelegate { } } } - self.context.sharedContext.mediaManager.setPlaylist((self.context.account, InstantPageMediaPlaylist(webPage: webPage, items: medias, initialItemIndex: initialIndex)), type: file.isVoice ? .voice : .music) + self.context.sharedContext.mediaManager.setPlaylist((self.context.account, InstantPageMediaPlaylist(webPage: webPage, items: medias, initialItemIndex: initialIndex)), type: file.isVoice ? .voice : .music, control: .playback(.play)) return } diff --git a/submodules/TelegramUI/TelegramUI/InstantPageDetailsItem.swift b/submodules/TelegramUI/TelegramUI/InstantPageDetailsItem.swift index 02503ba2f3..e35851ee9b 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageDetailsItem.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageDetailsItem.swift @@ -5,6 +5,7 @@ import TelegramCore import AsyncDisplayKit import Display import TelegramPresentationData +import AccountContext final class InstantPageDetailsItem: InstantPageItem { var frame: CGRect @@ -31,7 +32,7 @@ final class InstantPageDetailsItem: InstantPageItem { self.index = index } - func node(context: AccountContextImpl, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { + func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { var expanded: Bool? if let expandedDetails = currentExpandedDetails, let currentlyExpanded = expandedDetails[self.index] { expanded = currentlyExpanded diff --git a/submodules/TelegramUI/TelegramUI/InstantPageDetailsNode.swift b/submodules/TelegramUI/TelegramUI/InstantPageDetailsNode.swift index fd6d414d7b..41703f4ae7 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageDetailsNode.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageDetailsNode.swift @@ -6,12 +6,13 @@ import Postbox import TelegramCore import SwiftSignalKit import TelegramPresentationData +import AccountContext private let detailsInset: CGFloat = 17.0 private let titleInset: CGFloat = 22.0 final class InstantPageDetailsNode: ASDisplayNode, InstantPageNode { - private let context: AccountContextImpl + private let context: AccountContext private let strings: PresentationStrings private let theme: InstantPageTheme let item: InstantPageDetailsItem @@ -32,7 +33,7 @@ final class InstantPageDetailsNode: ASDisplayNode, InstantPageNode { var requestLayoutUpdate: ((Bool) -> Void)? - init(context: AccountContextImpl, strings: PresentationStrings, theme: InstantPageTheme, item: InstantPageDetailsItem, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, currentlyExpanded: Bool?, updateDetailsExpanded: @escaping (Bool) -> Void) { + init(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, item: InstantPageDetailsItem, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, currentlyExpanded: Bool?, updateDetailsExpanded: @escaping (Bool) -> Void) { self.context = context self.strings = strings self.theme = theme diff --git a/submodules/TelegramUI/TelegramUI/InstantPageFeedbackItem.swift b/submodules/TelegramUI/TelegramUI/InstantPageFeedbackItem.swift index fe25996829..d87a30f89e 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageFeedbackItem.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageFeedbackItem.swift @@ -4,6 +4,7 @@ import Postbox import TelegramCore import AsyncDisplayKit import TelegramPresentationData +import AccountContext final class InstantPageFeedbackItem: InstantPageItem { var frame: CGRect @@ -18,7 +19,7 @@ final class InstantPageFeedbackItem: InstantPageItem { self.webPage = webPage } - func node(context: AccountContextImpl, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { + func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { return InstantPageFeedbackNode(context: context, strings: strings, theme: theme, webPage: self.webPage, openUrl: openUrl) } diff --git a/submodules/TelegramUI/TelegramUI/InstantPageFeedbackNode.swift b/submodules/TelegramUI/TelegramUI/InstantPageFeedbackNode.swift index 46fa08056d..9805d1847b 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageFeedbackNode.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageFeedbackNode.swift @@ -6,9 +6,10 @@ import Postbox import TelegramCore import SwiftSignalKit import TelegramPresentationData +import AccountContext final class InstantPageFeedbackNode: ASDisplayNode, InstantPageNode { - private let context: AccountContextImpl + private let context: AccountContext private let webPage: TelegramMediaWebpage private let openUrl: (InstantPageUrlItem) -> Void @@ -18,7 +19,7 @@ final class InstantPageFeedbackNode: ASDisplayNode, InstantPageNode { private let resolveDisposable = MetaDisposable() - init(context: AccountContextImpl, strings: PresentationStrings, theme: InstantPageTheme, webPage: TelegramMediaWebpage, openUrl: @escaping (InstantPageUrlItem) -> Void) { + init(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, webPage: TelegramMediaWebpage, openUrl: @escaping (InstantPageUrlItem) -> Void) { self.context = context self.webPage = webPage self.openUrl = openUrl diff --git a/submodules/TelegramUI/TelegramUI/InstantPageGalleryController.swift b/submodules/TelegramUI/TelegramUI/InstantPageGalleryController.swift index f985e8b8ab..4e153fac20 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageGalleryController.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageGalleryController.swift @@ -8,6 +8,7 @@ import AsyncDisplayKit import TelegramCore import SafariServices import TelegramPresentationData +import AccountContext struct InstantPageGalleryEntryLocation: Equatable { let position: Int32 @@ -30,7 +31,7 @@ struct InstantPageGalleryEntry: Equatable { return lhs.index == rhs.index && lhs.pageId == rhs.pageId && lhs.media == rhs.media && lhs.caption == rhs.caption && lhs.credit == rhs.credit && lhs.location == rhs.location } - func item(context: AccountContextImpl, webPage: TelegramMediaWebpage, message: Message?, presentationData: PresentationData, fromPlayingVideo: Bool, landscape: Bool, openUrl: @escaping (InstantPageUrlItem) -> Void, openUrlOptions: @escaping (InstantPageUrlItem) -> Void) -> GalleryItem { + func item(context: AccountContext, webPage: TelegramMediaWebpage, message: Message?, presentationData: PresentationData, fromPlayingVideo: Bool, landscape: Bool, openUrl: @escaping (InstantPageUrlItem) -> Void, openUrlOptions: @escaping (InstantPageUrlItem) -> Void) -> GalleryItem { let caption: NSAttributedString let credit: NSAttributedString @@ -129,7 +130,7 @@ class InstantPageGalleryController: ViewController { return self.displayNode as! GalleryControllerNode } - private let context: AccountContextImpl + private let context: AccountContext private let webPage: TelegramMediaWebpage private let message: Message? private var presentationData: PresentationData @@ -166,7 +167,7 @@ class InstantPageGalleryController: ViewController { private var innerOpenUrl: (InstantPageUrlItem) -> Void private var openUrlOptions: (InstantPageUrlItem) -> Void - init(context: AccountContextImpl, webPage: TelegramMediaWebpage, message: Message? = nil, entries: [InstantPageGalleryEntry], centralIndex: Int, fromPlayingVideo: Bool = false, landscape: Bool = false, timecode: Double? = nil, replaceRootController: @escaping (ViewController, ValuePromise?) -> Void, baseNavigationController: NavigationController?) { + init(context: AccountContext, webPage: TelegramMediaWebpage, message: Message? = nil, entries: [InstantPageGalleryEntry], centralIndex: Int, fromPlayingVideo: Bool = false, landscape: Bool = false, timecode: Double? = nil, replaceRootController: @escaping (ViewController, ValuePromise?) -> Void, baseNavigationController: NavigationController?) { self.context = context self.webPage = webPage self.message = message diff --git a/submodules/TelegramUI/TelegramUI/InstantPageGalleryFooterContentNode.swift b/submodules/TelegramUI/TelegramUI/InstantPageGalleryFooterContentNode.swift index f91f7f9359..08da327d59 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageGalleryFooterContentNode.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageGalleryFooterContentNode.swift @@ -8,13 +8,14 @@ import SwiftSignalKit import Photos import TelegramPresentationData import TextFormat +import AccountContext private let actionImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Accessory Panels/MessageSelectionAction"), color: .white) private let textFont = Font.regular(16.0) final class InstantPageGalleryFooterContentNode: GalleryFooterContentNode { - private let context: AccountContextImpl + private let context: AccountContext private var theme: PresentationTheme private var strings: PresentationStrings private var shareMedia: AnyMediaReference? @@ -27,7 +28,7 @@ final class InstantPageGalleryFooterContentNode: GalleryFooterContentNode { var openUrl: ((InstantPageUrlItem) -> Void)? var openUrlOptions: ((InstantPageUrlItem) -> Void)? - init(context: AccountContextImpl, presentationData: PresentationData) { + init(context: AccountContext, presentationData: PresentationData) { self.context = context self.theme = presentationData.theme self.strings = presentationData.strings diff --git a/submodules/TelegramUI/TelegramUI/InstantPageImageItem.swift b/submodules/TelegramUI/TelegramUI/InstantPageImageItem.swift index e113f60084..5d4f37303e 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageImageItem.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageImageItem.swift @@ -4,6 +4,7 @@ import Postbox import TelegramCore import AsyncDisplayKit import TelegramPresentationData +import AccountContext protocol InstantPageImageAttribute { } @@ -42,7 +43,7 @@ final class InstantPageImageItem: InstantPageItem { self.fit = fit } - func node(context: AccountContextImpl, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { + func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { return InstantPageImageNode(context: context, theme: theme, webPage: self.webPage, media: self.media, attributes: self.attributes, interactive: self.interactive, roundCorners: self.roundCorners, fit: self.fit, openMedia: openMedia, longPressMedia: longPressMedia) } diff --git a/submodules/TelegramUI/TelegramUI/InstantPageImageNode.swift b/submodules/TelegramUI/TelegramUI/InstantPageImageNode.swift index 180a4944a4..bc182217da 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageImageNode.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageImageNode.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import SwiftSignalKit import TelegramPresentationData +import AccountContext private struct FetchControls { let fetch: (Bool) -> Void @@ -13,7 +14,7 @@ private struct FetchControls { } final class InstantPageImageNode: ASDisplayNode, InstantPageNode { - private let context: AccountContextImpl + private let context: AccountContext private let webPage: TelegramMediaWebpage private var theme: InstantPageTheme let media: InstantPageMedia @@ -39,7 +40,7 @@ final class InstantPageImageNode: ASDisplayNode, InstantPageNode { private var themeUpdated: Bool = false - init(context: AccountContextImpl, theme: InstantPageTheme, webPage: TelegramMediaWebpage, media: InstantPageMedia, attributes: [InstantPageImageAttribute], interactive: Bool, roundCorners: Bool, fit: Bool, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void) { + init(context: AccountContext, theme: InstantPageTheme, webPage: TelegramMediaWebpage, media: InstantPageMedia, attributes: [InstantPageImageAttribute], interactive: Bool, roundCorners: Bool, fit: Bool, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void) { self.context = context self.theme = theme self.webPage = webPage diff --git a/submodules/TelegramUI/TelegramUI/InstantPageItem.swift b/submodules/TelegramUI/TelegramUI/InstantPageItem.swift index f0c8fb4ad9..c60a5e39c5 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageItem.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageItem.swift @@ -4,6 +4,7 @@ import Postbox import TelegramCore import AsyncDisplayKit import TelegramPresentationData +import AccountContext protocol InstantPageItem { var frame: CGRect { get set } @@ -13,7 +14,7 @@ protocol InstantPageItem { func matchesAnchor(_ anchor: String) -> Bool func drawInTile(context: CGContext) - func node(context: AccountContextImpl, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? + func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? func matchesNode(_ node: InstantPageNode) -> Bool func linkSelectionRects(at point: CGPoint) -> [CGRect] diff --git a/submodules/TelegramUI/TelegramUI/InstantPageLayout.swift b/submodules/TelegramUI/TelegramUI/InstantPageLayout.swift index 7df78329d1..02e5f542ef 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageLayout.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageLayout.swift @@ -5,6 +5,7 @@ import Postbox import Display import TelegramPresentationData import TelegramUIPreferences +import TelegramStringFormatting final class InstantPageLayout { let origin: CGPoint diff --git a/submodules/TelegramUI/TelegramUI/InstantPageMediaPlaylist.swift b/submodules/TelegramUI/TelegramUI/InstantPageMediaPlaylist.swift index 2aa3926791..c96a674d9c 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageMediaPlaylist.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageMediaPlaylist.swift @@ -4,6 +4,7 @@ import SwiftSignalKit import Postbox import TelegramCore import TelegramUIPreferences +import AccountContext struct InstantPageMediaPlaylistItemId: SharedMediaPlaylistItemId { let index: Int diff --git a/submodules/TelegramUI/TelegramUI/InstantPagePeerReferenceItem.swift b/submodules/TelegramUI/TelegramUI/InstantPagePeerReferenceItem.swift index 6b89efa3d2..06b321ded9 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPagePeerReferenceItem.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPagePeerReferenceItem.swift @@ -4,6 +4,7 @@ import Postbox import TelegramCore import AsyncDisplayKit import TelegramPresentationData +import AccountContext final class InstantPagePeerReferenceItem: InstantPageItem { var frame: CGRect @@ -24,7 +25,7 @@ final class InstantPagePeerReferenceItem: InstantPageItem { self.rtl = rtl } - func node(context: AccountContextImpl, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { + func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { return InstantPagePeerReferenceNode(context: context, strings: strings, theme: theme, initialPeer: self.initialPeer, safeInset: self.safeInset, transparent: self.transparent, rtl: self.rtl, openPeer: openPeer) } diff --git a/submodules/TelegramUI/TelegramUI/InstantPagePeerReferenceNode.swift b/submodules/TelegramUI/TelegramUI/InstantPagePeerReferenceNode.swift index 324610758d..ac1cb8cf7f 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPagePeerReferenceNode.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPagePeerReferenceNode.swift @@ -7,6 +7,7 @@ import AsyncDisplayKit import Display import TelegramPresentationData import ActivityIndicator +import AccountContext private enum JoinState: Equatable { case none @@ -45,7 +46,7 @@ private enum JoinState: Equatable { } final class InstantPagePeerReferenceNode: ASDisplayNode, InstantPageNode { - private let context: AccountContextImpl + private let context: AccountContext let safeInset: CGFloat private let transparent: Bool private let rtl: Bool @@ -66,7 +67,7 @@ final class InstantPagePeerReferenceNode: ASDisplayNode, InstantPageNode { private let joinDisposable = MetaDisposable() private var joinState: JoinState = .none - init(context: AccountContextImpl, strings: PresentationStrings, theme: InstantPageTheme, initialPeer: Peer, safeInset: CGFloat, transparent: Bool, rtl: Bool, openPeer: @escaping (PeerId) -> Void) { + init(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, initialPeer: Peer, safeInset: CGFloat, transparent: Bool, rtl: Bool, openPeer: @escaping (PeerId) -> Void) { self.context = context self.strings = strings self.theme = theme diff --git a/submodules/TelegramUI/TelegramUI/InstantPagePlayableVideoItem.swift b/submodules/TelegramUI/TelegramUI/InstantPagePlayableVideoItem.swift index 61ba4234ca..1f161067e3 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPagePlayableVideoItem.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPagePlayableVideoItem.swift @@ -4,6 +4,7 @@ import Postbox import TelegramCore import AsyncDisplayKit import TelegramPresentationData +import AccountContext final class InstantPagePlayableVideoItem: InstantPageItem { var frame: CGRect @@ -26,7 +27,7 @@ final class InstantPagePlayableVideoItem: InstantPageItem { self.interactive = interactive } - func node(context: AccountContextImpl, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { + func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { return InstantPagePlayableVideoNode(context: context, webPage: self.webPage, theme: theme, media: self.media, interactive: self.interactive, openMedia: openMedia) } diff --git a/submodules/TelegramUI/TelegramUI/InstantPagePlayableVideoNode.swift b/submodules/TelegramUI/TelegramUI/InstantPagePlayableVideoNode.swift index 8b156133f0..36185ee686 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPagePlayableVideoNode.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPagePlayableVideoNode.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import SwiftSignalKit import TelegramPresentationData +import AccountContext private struct FetchControls { let fetch: (Bool) -> Void @@ -13,7 +14,7 @@ private struct FetchControls { } final class InstantPagePlayableVideoNode: ASDisplayNode, InstantPageNode { - private let context: AccountContextImpl + private let context: AccountContext let media: InstantPageMedia private let interactive: Bool private let openMedia: (InstantPageMedia) -> Void @@ -30,7 +31,7 @@ final class InstantPagePlayableVideoNode: ASDisplayNode, InstantPageNode { private var localIsVisible = false - init(context: AccountContextImpl, webPage: TelegramMediaWebpage, theme: InstantPageTheme, media: InstantPageMedia, interactive: Bool, openMedia: @escaping (InstantPageMedia) -> Void) { + init(context: AccountContext, webPage: TelegramMediaWebpage, theme: InstantPageTheme, media: InstantPageMedia, interactive: Bool, openMedia: @escaping (InstantPageMedia) -> Void) { self.context = context self.media = media self.interactive = interactive diff --git a/submodules/TelegramUI/TelegramUI/InstantPageReferenceController.swift b/submodules/TelegramUI/TelegramUI/InstantPageReferenceController.swift index 7cf5480fde..2f89939908 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageReferenceController.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageReferenceController.swift @@ -5,6 +5,7 @@ import AsyncDisplayKit import Postbox import TelegramCore import SwiftSignalKit +import AccountContext final class InstantPageReferenceController: ViewController { private var controllerNode: InstantPageReferenceControllerNode { @@ -13,7 +14,7 @@ final class InstantPageReferenceController: ViewController { private var animatedIn = false - private let context: AccountContextImpl + private let context: AccountContext private let theme: InstantPageTheme private let webPage: TelegramMediaWebpage private let anchorText: NSAttributedString @@ -21,7 +22,7 @@ final class InstantPageReferenceController: ViewController { private let openUrlIn: (InstantPageUrlItem) -> Void private let present: (ViewController, Any?) -> Void - init(context: AccountContextImpl, theme: InstantPageTheme, webPage: TelegramMediaWebpage, anchorText: NSAttributedString, openUrl: @escaping (InstantPageUrlItem) -> Void, openUrlIn: @escaping (InstantPageUrlItem) -> Void, present: @escaping (ViewController, Any?) -> Void) { + init(context: AccountContext, theme: InstantPageTheme, webPage: TelegramMediaWebpage, anchorText: NSAttributedString, openUrl: @escaping (InstantPageUrlItem) -> Void, openUrlIn: @escaping (InstantPageUrlItem) -> Void, present: @escaping (ViewController, Any?) -> Void) { self.context = context self.theme = theme self.webPage = webPage diff --git a/submodules/TelegramUI/TelegramUI/InstantPageReferenceControllerNode.swift b/submodules/TelegramUI/TelegramUI/InstantPageReferenceControllerNode.swift index 53b3c63dc4..de9f2d38f8 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageReferenceControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageReferenceControllerNode.swift @@ -6,9 +6,10 @@ import Postbox import TelegramCore import SafariServices import TelegramPresentationData +import AccountContext class InstantPageReferenceControllerNode: ViewControllerTracingNode, UIScrollViewDelegate { - private let context: AccountContextImpl + private let context: AccountContext private let theme: InstantPageTheme private var presentationData: PresentationData private let webPage: TelegramMediaWebpage @@ -34,7 +35,7 @@ class InstantPageReferenceControllerNode: ViewControllerTracingNode, UIScrollVie var dismiss: (() -> Void)? var close: (() -> Void)? - init(context: AccountContextImpl, theme: InstantPageTheme, webPage: TelegramMediaWebpage, anchorText: NSAttributedString, openUrl: @escaping (InstantPageUrlItem) -> Void, openUrlIn: @escaping (InstantPageUrlItem) -> Void, present: @escaping (ViewController, Any?) -> Void) { + init(context: AccountContext, theme: InstantPageTheme, webPage: TelegramMediaWebpage, anchorText: NSAttributedString, openUrl: @escaping (InstantPageUrlItem) -> Void, openUrlIn: @escaping (InstantPageUrlItem) -> Void, present: @escaping (ViewController, Any?) -> Void) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } self.theme = theme diff --git a/submodules/TelegramUI/TelegramUI/InstantPageShapeItem.swift b/submodules/TelegramUI/TelegramUI/InstantPageShapeItem.swift index f23715b788..ce1103843d 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageShapeItem.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageShapeItem.swift @@ -4,6 +4,7 @@ import Postbox import TelegramCore import AsyncDisplayKit import TelegramPresentationData +import AccountContext enum InstantPageShape { case rect @@ -59,7 +60,7 @@ final class InstantPageShapeItem: InstantPageItem { return false } - func node(context: AccountContextImpl, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { + func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { return nil } diff --git a/submodules/TelegramUI/TelegramUI/InstantPageSlideshowItem.swift b/submodules/TelegramUI/TelegramUI/InstantPageSlideshowItem.swift index 85de36b564..0f213e172f 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageSlideshowItem.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageSlideshowItem.swift @@ -4,6 +4,7 @@ import Postbox import TelegramCore import AsyncDisplayKit import TelegramPresentationData +import AccountContext final class InstantPageSlideshowItem: InstantPageItem { var frame: CGRect @@ -18,7 +19,7 @@ final class InstantPageSlideshowItem: InstantPageItem { self.medias = medias } - func node(context: AccountContextImpl, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { + func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { return InstantPageSlideshowNode(context: context, theme: theme, webPage: webPage, medias: self.medias, openMedia: openMedia, longPressMedia: longPressMedia) } diff --git a/submodules/TelegramUI/TelegramUI/InstantPageSlideshowItemNode.swift b/submodules/TelegramUI/TelegramUI/InstantPageSlideshowItemNode.swift index 79f511b4fd..2f5b06eb1d 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageSlideshowItemNode.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageSlideshowItemNode.swift @@ -4,6 +4,7 @@ import TelegramCore import AsyncDisplayKit import Display import TelegramPresentationData +import AccountContext private final class InstantPageSlideshowItemNode: ASDisplayNode { private var _index: Int? @@ -61,7 +62,7 @@ private final class InstantPageSlideshowItemNode: ASDisplayNode { } private final class InstantPageSlideshowPagerNode: ASDisplayNode, UIScrollViewDelegate { - private let context: AccountContextImpl + private let context: AccountContext private let theme: InstantPageTheme private let webPage: TelegramMediaWebpage private let openMedia: (InstantPageMedia) -> Void @@ -95,7 +96,7 @@ private final class InstantPageSlideshowPagerNode: ASDisplayNode, UIScrollViewDe } } - init(context: AccountContextImpl, theme: InstantPageTheme, webPage: TelegramMediaWebpage, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, pageGap: CGFloat = 0.0) { + init(context: AccountContext, theme: InstantPageTheme, webPage: TelegramMediaWebpage, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, pageGap: CGFloat = 0.0) { self.context = context self.theme = theme self.webPage = webPage @@ -377,7 +378,7 @@ final class InstantPageSlideshowNode: ASDisplayNode, InstantPageNode { private let pagerNode: InstantPageSlideshowPagerNode private let pageControlNode: PageControlNode - init(context: AccountContextImpl, theme: InstantPageTheme, webPage: TelegramMediaWebpage, medias: [InstantPageMedia], openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void) { + init(context: AccountContext, theme: InstantPageTheme, webPage: TelegramMediaWebpage, medias: [InstantPageMedia], openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void) { self.medias = medias self.pagerNode = InstantPageSlideshowPagerNode(context: context, theme: theme, webPage: webPage, openMedia: openMedia, longPressMedia: longPressMedia) diff --git a/submodules/TelegramUI/TelegramUI/InstantPageTableItem.swift b/submodules/TelegramUI/TelegramUI/InstantPageTableItem.swift index 77c4b1e110..91f0642e52 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageTableItem.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageTableItem.swift @@ -5,6 +5,7 @@ import TelegramCore import Postbox import Display import TelegramPresentationData +import AccountContext private struct TableSide: OptionSet { var rawValue: Int32 = 0 @@ -197,7 +198,7 @@ final class InstantPageTableItem: InstantPageScrollableItem { return false } - func node(context: AccountContextImpl, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { + func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { var additionalNodes: [InstantPageNode] = [] for cell in self.cells { for item in cell.additionalItems { diff --git a/submodules/TelegramUI/TelegramUI/InstantPageTextItem.swift b/submodules/TelegramUI/TelegramUI/InstantPageTextItem.swift index 9602f03928..6be99e4a96 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageTextItem.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageTextItem.swift @@ -6,6 +6,7 @@ import Postbox import AsyncDisplayKit import TelegramPresentationData import TextFormat +import AccountContext final class InstantPageUrlItem: Equatable { let url: String @@ -330,7 +331,7 @@ final class InstantPageTextItem: InstantPageItem { return false } - func node(context: AccountContextImpl, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { + func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { return nil } @@ -379,7 +380,7 @@ final class InstantPageScrollableTextItem: InstantPageScrollableItem { context.restoreGState() } - func node(context: AccountContextImpl, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (ASDisplayNode & InstantPageNode)? { + func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (ASDisplayNode & InstantPageNode)? { var additionalNodes: [InstantPageNode] = [] for item in additionalItems { if item.wantsNode { diff --git a/submodules/TelegramUI/TelegramUI/InstantPageWebEmbedItem.swift b/submodules/TelegramUI/TelegramUI/InstantPageWebEmbedItem.swift index c0e51dbcb9..d4eb63c8a2 100644 --- a/submodules/TelegramUI/TelegramUI/InstantPageWebEmbedItem.swift +++ b/submodules/TelegramUI/TelegramUI/InstantPageWebEmbedItem.swift @@ -4,6 +4,7 @@ import Postbox import TelegramCore import AsyncDisplayKit import TelegramPresentationData +import AccountContext final class InstantPageWebEmbedItem: InstantPageItem { var frame: CGRect @@ -22,7 +23,7 @@ final class InstantPageWebEmbedItem: InstantPageItem { self.enableScrolling = enableScrolling } - func node(context: AccountContextImpl, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { + func node(context: AccountContext, strings: PresentationStrings, theme: InstantPageTheme, openMedia: @escaping (InstantPageMedia) -> Void, longPressMedia: @escaping (InstantPageMedia) -> Void, openPeer: @escaping (PeerId) -> Void, openUrl: @escaping (InstantPageUrlItem) -> Void, updateWebEmbedHeight: @escaping (CGFloat) -> Void, updateDetailsExpanded: @escaping (Bool) -> Void, currentExpandedDetails: [Int : Bool]?) -> (InstantPageNode & ASDisplayNode)? { return InstantPageWebEmbedNode(frame: self.frame, url: self.url, html: self.html, enableScrolling: self.enableScrolling, updateWebEmbedHeight: updateWebEmbedHeight) } diff --git a/submodules/TelegramUI/TelegramUI/InviteContactsController.swift b/submodules/TelegramUI/TelegramUI/InviteContactsController.swift index c8e476c4e9..3c98c29bca 100644 --- a/submodules/TelegramUI/TelegramUI/InviteContactsController.swift +++ b/submodules/TelegramUI/TelegramUI/InviteContactsController.swift @@ -7,9 +7,10 @@ import SwiftSignalKit import TelegramCore import MessageUI import TelegramPresentationData +import AccountContext public class InviteContactsController: ViewController, MFMessageComposeViewControllerDelegate, UINavigationControllerDelegate { - private let context: AccountContextImpl + private let context: AccountContext private var contactsNode: InviteContactsControllerNode { return self.displayNode as! InviteContactsControllerNode @@ -27,7 +28,7 @@ public class InviteContactsController: ViewController, MFMessageComposeViewContr private var searchContentNode: NavigationBarSearchContentNode? - public init(context: AccountContextImpl) { + public init(context: AccountContext) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/InviteContactsControllerNode.swift b/submodules/TelegramUI/TelegramUI/InviteContactsControllerNode.swift index ddce79f55e..1fec2d2e38 100644 --- a/submodules/TelegramUI/TelegramUI/InviteContactsControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/InviteContactsControllerNode.swift @@ -9,6 +9,7 @@ import TelegramPresentationData import TelegramUIPreferences import MergeLists import ActivityIndicator +import AccountContext private enum InviteContactsEntryId: Hashable { case option(index: Int) @@ -217,7 +218,7 @@ final class InviteContactsControllerNode: ASDisplayNode { let listNode: ListView private var activityIndicator: ActivityIndicator? - private let context: AccountContextImpl + private let context: AccountContext private var searchDisplayController: SearchDisplayController? private var validLayout: (ContainerViewLayout, CGFloat, CGFloat)? @@ -273,7 +274,7 @@ final class InviteContactsControllerNode: ASDisplayNode { private let currentContactIds = Atomic<[String]>(value: []) - init(context: AccountContextImpl) { + init(context: AccountContext) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/ItemListAvatarAndNameItem.swift b/submodules/TelegramUI/TelegramUI/ItemListAvatarAndNameItem.swift index 898e94270e..3886ed1adb 100644 --- a/submodules/TelegramUI/TelegramUI/ItemListAvatarAndNameItem.swift +++ b/submodules/TelegramUI/TelegramUI/ItemListAvatarAndNameItem.swift @@ -8,6 +8,8 @@ import SwiftSignalKit import TelegramPresentationData import ItemListUI import ActivityIndicator +import AvatarNode +import TelegramStringFormatting private let updatingAvatarOverlayImage = generateFilledCircleImage(diameter: 66.0, color: UIColor(white: 0.0, alpha: 0.4), backgroundColor: nil) diff --git a/submodules/TelegramUI/TelegramUI/ItemListCallListItem.swift b/submodules/TelegramUI/TelegramUI/ItemListCallListItem.swift index 53306c2f12..71f4ab6724 100644 --- a/submodules/TelegramUI/TelegramUI/ItemListCallListItem.swift +++ b/submodules/TelegramUI/TelegramUI/ItemListCallListItem.swift @@ -7,6 +7,7 @@ import Postbox import TelegramCore import TelegramPresentationData import ItemListUI +import TelegramStringFormatting class ItemListCallListItem: ListViewItem, ItemListItem { let theme: PresentationTheme diff --git a/submodules/TelegramUI/TelegramUI/ItemListPeerItem.swift b/submodules/TelegramUI/TelegramUI/ItemListPeerItem.swift index fa9935dd02..029860019b 100644 --- a/submodules/TelegramUI/TelegramUI/ItemListPeerItem.swift +++ b/submodules/TelegramUI/TelegramUI/ItemListPeerItem.swift @@ -8,6 +8,8 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AvatarNode +import TelegramStringFormatting struct ItemListPeerItemEditing: Equatable { let editable: Bool diff --git a/submodules/TelegramUI/TelegramUI/ItemListRecentSessionItem.swift b/submodules/TelegramUI/TelegramUI/ItemListRecentSessionItem.swift index 1973d79f90..18bf9911a6 100644 --- a/submodules/TelegramUI/TelegramUI/ItemListRecentSessionItem.swift +++ b/submodules/TelegramUI/TelegramUI/ItemListRecentSessionItem.swift @@ -7,6 +7,7 @@ import Postbox import TelegramCore import TelegramPresentationData import ItemListUI +import TelegramStringFormatting struct ItemListRecentSessionItemEditing: Equatable { let editable: Bool diff --git a/submodules/TelegramUI/TelegramUI/ItemListWebsiteItem.swift b/submodules/TelegramUI/TelegramUI/ItemListWebsiteItem.swift index 2f4c5cfa20..b89384eeb0 100644 --- a/submodules/TelegramUI/TelegramUI/ItemListWebsiteItem.swift +++ b/submodules/TelegramUI/TelegramUI/ItemListWebsiteItem.swift @@ -8,6 +8,8 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AvatarNode +import TelegramStringFormatting struct ItemListWebsiteItemEditing: Equatable { let editing: Bool diff --git a/submodules/TelegramUI/TelegramUI/JoinLinkPreviewController.swift b/submodules/TelegramUI/TelegramUI/JoinLinkPreviewController.swift index c5177d11a6..3de9facbbe 100644 --- a/submodules/TelegramUI/TelegramUI/JoinLinkPreviewController.swift +++ b/submodules/TelegramUI/TelegramUI/JoinLinkPreviewController.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import SwiftSignalKit import TelegramPresentationData +import AccountContext public final class JoinLinkPreviewController: ViewController { private var controllerNode: JoinLinkPreviewControllerNode { @@ -14,14 +15,14 @@ public final class JoinLinkPreviewController: ViewController { private var animatedIn = false - private let context: AccountContextImpl + private let context: AccountContext private let link: String private let navigateToPeer: (PeerId) -> Void private var presentationData: PresentationData private let disposable = MetaDisposable() - public init(context: AccountContextImpl, link: String, navigateToPeer: @escaping (PeerId) -> Void) { + public init(context: AccountContext, link: String, navigateToPeer: @escaping (PeerId) -> Void) { self.context = context self.link = link self.navigateToPeer = navigateToPeer diff --git a/submodules/TelegramUI/TelegramUI/JoinLinkPreviewControllerNode.swift b/submodules/TelegramUI/TelegramUI/JoinLinkPreviewControllerNode.swift index fccbfbff3c..5e3e93a66b 100644 --- a/submodules/TelegramUI/TelegramUI/JoinLinkPreviewControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/JoinLinkPreviewControllerNode.swift @@ -6,6 +6,7 @@ import SwiftSignalKit import Postbox import TelegramCore import TelegramPresentationData +import AccountContext struct JoinLinkPreviewData { let isGroup: Bool @@ -13,7 +14,7 @@ struct JoinLinkPreviewData { } final class JoinLinkPreviewControllerNode: ViewControllerTracingNode, UIScrollViewDelegate { - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private let requestLayout: (ContainedViewLayoutTransition) -> Void @@ -48,7 +49,7 @@ final class JoinLinkPreviewControllerNode: ViewControllerTracingNode, UIScrollVi private let disposable = MetaDisposable() - init(context: AccountContextImpl, requestLayout: @escaping (ContainedViewLayoutTransition) -> Void) { + init(context: AccountContext, requestLayout: @escaping (ContainedViewLayoutTransition) -> Void) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/JoinLinkPreviewPeerContentNode.swift b/submodules/TelegramUI/TelegramUI/JoinLinkPreviewPeerContentNode.swift index cb0fe62eba..0fac128fce 100644 --- a/submodules/TelegramUI/TelegramUI/JoinLinkPreviewPeerContentNode.swift +++ b/submodules/TelegramUI/TelegramUI/JoinLinkPreviewPeerContentNode.swift @@ -5,6 +5,8 @@ import Display import Postbox import TelegramCore import TelegramPresentationData +import AvatarNode +import AccountContext private let avatarFont = UIFont(name: ".SFCompactRounded-Semibold", size: 26.0)! @@ -34,7 +36,7 @@ final class JoinLinkPreviewPeerContentNode: ASDisplayNode, ShareContentContainer private let peerNodes: [SelectablePeerNode] private let moreNode: MoreNode? - init(context: AccountContextImpl, image: TelegramMediaImageRepresentation?, title: String, memberCount: Int32, members: [Peer], isGroup: Bool, theme: PresentationTheme, strings: PresentationStrings) { + init(context: AccountContext, image: TelegramMediaImageRepresentation?, title: String, memberCount: Int32, members: [Peer], isGroup: Bool, theme: PresentationTheme, strings: PresentationStrings) { self.avatarNode = AvatarNode(font: avatarFont) self.titleNode = ASTextNode() self.countNode = ASTextNode() diff --git a/submodules/TelegramUI/TelegramUI/LanguageLinkPreviewContentNode.swift b/submodules/TelegramUI/TelegramUI/LanguageLinkPreviewContentNode.swift index 78f5d8e6f7..9c10f9d082 100644 --- a/submodules/TelegramUI/TelegramUI/LanguageLinkPreviewContentNode.swift +++ b/submodules/TelegramUI/TelegramUI/LanguageLinkPreviewContentNode.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import TelegramPresentationData import TextFormat +import AccountContext final class LanguageLinkPreviewContentNode: ASDisplayNode, ShareContentContainerNode { private var contentOffsetUpdated: ((CGFloat, ContainedViewLayoutTransition) -> Void)? @@ -13,7 +14,7 @@ final class LanguageLinkPreviewContentNode: ASDisplayNode, ShareContentContainer private let titleNode: ImmediateTextNode private let textNode: ImmediateTextNode - init(context: AccountContextImpl, localizationInfo: LocalizationInfo, theme: PresentationTheme, strings: PresentationStrings, openTranslationUrl: @escaping (String) -> Void) { + init(context: AccountContext, localizationInfo: LocalizationInfo, theme: PresentationTheme, strings: PresentationStrings, openTranslationUrl: @escaping (String) -> Void) { self.titleNode = ImmediateTextNode() self.titleNode.textAlignment = .center diff --git a/submodules/TelegramUI/TelegramUI/LanguageLinkPreviewController.swift b/submodules/TelegramUI/TelegramUI/LanguageLinkPreviewController.swift index 0e351b2253..38af1434a4 100644 --- a/submodules/TelegramUI/TelegramUI/LanguageLinkPreviewController.swift +++ b/submodules/TelegramUI/TelegramUI/LanguageLinkPreviewController.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import SwiftSignalKit import TelegramPresentationData +import AccountContext public final class LanguageLinkPreviewController: ViewController { private var controllerNode: LanguageLinkPreviewControllerNode { @@ -14,14 +15,14 @@ public final class LanguageLinkPreviewController: ViewController { private var animatedIn = false - private let context: AccountContextImpl + private let context: AccountContext private let identifier: String private var localizationInfo: LocalizationInfo? private var presentationData: PresentationData private let disposable = MetaDisposable() - public init(context: AccountContextImpl, identifier: String) { + public init(context: AccountContext, identifier: String) { self.context = context self.identifier = identifier diff --git a/submodules/TelegramUI/TelegramUI/LanguageLinkPreviewControllerNode.swift b/submodules/TelegramUI/TelegramUI/LanguageLinkPreviewControllerNode.swift index 6b713fcb05..69acbe8383 100644 --- a/submodules/TelegramUI/TelegramUI/LanguageLinkPreviewControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/LanguageLinkPreviewControllerNode.swift @@ -7,9 +7,10 @@ import Postbox import TelegramCore import TelegramPresentationData import ActivityIndicator +import AccountContext final class LanguageLinkPreviewControllerNode: ViewControllerTracingNode, UIScrollViewDelegate { - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private let requestLayout: (ContainedViewLayoutTransition) -> Void @@ -46,7 +47,7 @@ final class LanguageLinkPreviewControllerNode: ViewControllerTracingNode, UIScro private let disposable = MetaDisposable() - init(context: AccountContextImpl, requestLayout: @escaping (ContainedViewLayoutTransition) -> Void, openUrl: @escaping (String) -> Void) { + init(context: AccountContext, requestLayout: @escaping (ContainedViewLayoutTransition) -> Void, openUrl: @escaping (String) -> Void) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/LanguageSuggestionController.swift b/submodules/TelegramUI/TelegramUI/LanguageSuggestionController.swift index 62dc57cff7..e77eb77318 100644 --- a/submodules/TelegramUI/TelegramUI/LanguageSuggestionController.swift +++ b/submodules/TelegramUI/TelegramUI/LanguageSuggestionController.swift @@ -6,6 +6,7 @@ import Display import TelegramCore import TelegramPresentationData import ActivityIndicator +import AccountContext struct LanguageSuggestionControllerStrings { let ChooseLanguage: String @@ -324,7 +325,7 @@ private final class LanguageSuggestionAlertContentNode: AlertContentNode { } } -func languageSuggestionController(context: AccountContextImpl, suggestedLocalization: SuggestedLocalizationInfo, currentLanguageCode: String, openSelection: @escaping () -> Void) -> AlertController? { +func languageSuggestionController(context: AccountContext, suggestedLocalization: SuggestedLocalizationInfo, currentLanguageCode: String, openSelection: @escaping () -> Void) -> AlertController? { guard let localization = suggestedLocalization.availableLocalizations.filter({ $0.languageCode == suggestedLocalization.languageCode }).first else { return nil } diff --git a/submodules/TelegramUI/TelegramUI/LegacyAttachmentMenu.swift b/submodules/TelegramUI/TelegramUI/LegacyAttachmentMenu.swift index 8414003f7c..f8b4642a63 100644 --- a/submodules/TelegramUI/TelegramUI/LegacyAttachmentMenu.swift +++ b/submodules/TelegramUI/TelegramUI/LegacyAttachmentMenu.swift @@ -7,8 +7,9 @@ import Postbox import TelegramCore import TelegramPresentationData import DeviceAccess +import AccountContext -func legacyAttachmentMenu(context: AccountContextImpl, peer: Peer, editMediaOptions: MessageMediaEditingOptions?, saveEditedPhotos: Bool, allowGrouping: Bool, theme: PresentationTheme, strings: PresentationStrings, parentController: LegacyController, recentlyUsedInlineBots: [Peer], initialCaption: String, openGallery: @escaping () -> Void, openCamera: @escaping (TGAttachmentCameraView?, TGMenuSheetController?) -> Void, openFileGallery: @escaping () -> Void, openWebSearch: @escaping () -> Void, openMap: @escaping () -> Void, openContacts: @escaping () -> Void, openPoll: @escaping () -> Void, presentSelectionLimitExceeded: @escaping () -> Void, presentCantSendMultipleFiles: @escaping () -> Void, sendMessagesWithSignals: @escaping ([Any]?, Bool) -> Void, selectRecentlyUsedInlineBot: @escaping (Peer) -> Void) -> TGMenuSheetController { +func legacyAttachmentMenu(context: AccountContext, peer: Peer, editMediaOptions: MessageMediaEditingOptions?, saveEditedPhotos: Bool, allowGrouping: Bool, theme: PresentationTheme, strings: PresentationStrings, parentController: LegacyController, recentlyUsedInlineBots: [Peer], initialCaption: String, openGallery: @escaping () -> Void, openCamera: @escaping (TGAttachmentCameraView?, TGMenuSheetController?) -> Void, openFileGallery: @escaping () -> Void, openWebSearch: @escaping () -> Void, openMap: @escaping () -> Void, openContacts: @escaping () -> Void, openPoll: @escaping () -> Void, presentSelectionLimitExceeded: @escaping () -> Void, presentCantSendMultipleFiles: @escaping () -> Void, sendMessagesWithSignals: @escaping ([Any]?, Bool) -> Void, selectRecentlyUsedInlineBot: @escaping (Peer) -> Void) -> TGMenuSheetController { let isSecretChat = peer.id.namespace == Namespaces.Peer.SecretChat let controller = TGMenuSheetController(context: parentController.context, dark: false)! @@ -171,7 +172,7 @@ func legacyMenuPaletteFromTheme(_ theme: PresentationTheme) -> TGMenuSheetPallet return TGMenuSheetPallete(dark: theme.overallDarkAppearance, backgroundColor: sheetTheme.opaqueItemBackgroundColor, selectionColor: sheetTheme.opaqueItemHighlightedBackgroundColor, separatorColor: sheetTheme.opaqueItemSeparatorColor, accentColor: sheetTheme.controlAccentColor, destructiveColor: sheetTheme.destructiveActionTextColor, textColor: sheetTheme.primaryTextColor, secondaryTextColor: sheetTheme.secondaryTextColor, spinnerColor: sheetTheme.secondaryTextColor, badgeTextColor: sheetTheme.controlAccentColor, badgeImage: nil, cornersImage: generateStretchableFilledCircleImage(diameter: 11.0, color: nil, strokeColor: nil, strokeWidth: nil, backgroundColor: sheetTheme.opaqueItemBackgroundColor)) } -func presentLegacyPasteMenu(context: AccountContextImpl, peer: Peer, saveEditedPhotos: Bool, allowGrouping: Bool, theme: PresentationTheme, strings: PresentationStrings, images: [UIImage], sendMessagesWithSignals: @escaping ([Any]?) -> Void, present: (ViewController, Any?) -> Void, initialLayout: ContainerViewLayout? = nil) -> ViewController { +func presentLegacyPasteMenu(context: AccountContext, peer: Peer, saveEditedPhotos: Bool, allowGrouping: Bool, theme: PresentationTheme, strings: PresentationStrings, images: [UIImage], sendMessagesWithSignals: @escaping ([Any]?) -> Void, present: (ViewController, Any?) -> Void, initialLayout: ContainerViewLayout? = nil) -> ViewController { let legacyController = LegacyController(presentation: .custom, theme: theme, initialLayout: initialLayout) legacyController.statusBar.statusBarStyle = .Ignore legacyController.controllerLoaded = { [weak legacyController] in diff --git a/submodules/TelegramUI/TelegramUI/LegacyCamera.swift b/submodules/TelegramUI/TelegramUI/LegacyCamera.swift index af50abc977..8f37802de1 100644 --- a/submodules/TelegramUI/TelegramUI/LegacyCamera.swift +++ b/submodules/TelegramUI/TelegramUI/LegacyCamera.swift @@ -5,8 +5,9 @@ import Display import TelegramCore import Postbox import SwiftSignalKit +import AccountContext -func presentedLegacyCamera(context: AccountContextImpl, peer: Peer, cameraView: TGAttachmentCameraView?, menuController: TGMenuSheetController?, parentController: ViewController, editingMedia: Bool, saveCapturedPhotos: Bool, mediaGrouping: Bool, initialCaption: String, sendMessagesWithSignals: @escaping ([Any]?) -> Void, recognizedQRCode: @escaping (String) -> Void = { _ in }) { +func presentedLegacyCamera(context: AccountContext, peer: Peer, cameraView: TGAttachmentCameraView?, menuController: TGMenuSheetController?, parentController: ViewController, editingMedia: Bool, saveCapturedPhotos: Bool, mediaGrouping: Bool, initialCaption: String, sendMessagesWithSignals: @escaping ([Any]?) -> Void, recognizedQRCode: @escaping (String) -> Void = { _ in }) { let presentationData = context.sharedContext.currentPresentationData.with { $0 } let legacyController = LegacyController(presentation: .custom, theme: presentationData.theme) legacyController.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .portrait, compactSize: .portrait) @@ -153,7 +154,7 @@ func presentedLegacyCamera(context: AccountContextImpl, peer: Peer, cameraView: parentController.present(legacyController, in: .window(.root)) } -func presentedLegacyShortcutCamera(context: AccountContextImpl, saveCapturedMedia: Bool, saveEditedPhotos: Bool, mediaGrouping: Bool, parentController: ViewController) { +func presentedLegacyShortcutCamera(context: AccountContext, saveCapturedMedia: Bool, saveEditedPhotos: Bool, mediaGrouping: Bool, parentController: ViewController) { let presentationData = context.sharedContext.currentPresentationData.with { $0 } let legacyController = LegacyController(presentation: .custom, theme: presentationData.theme) legacyController.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .portrait, compactSize: .portrait) diff --git a/submodules/TelegramUI/TelegramUI/LegacyInstantVideoController.swift b/submodules/TelegramUI/TelegramUI/LegacyInstantVideoController.swift index 1ae295a704..e99adc036e 100644 --- a/submodules/TelegramUI/TelegramUI/LegacyInstantVideoController.swift +++ b/submodules/TelegramUI/TelegramUI/LegacyInstantVideoController.swift @@ -7,6 +7,7 @@ import SwiftSignalKit import TelegramPresentationData import MediaResources import LegacyComponents +import AccountContext final class InstantVideoControllerRecordingStatus { let micLevel: Signal @@ -91,7 +92,7 @@ func legacyInputMicPalette(from theme: PresentationTheme) -> TGModernConversatio return TGModernConversationInputMicPallete(dark: theme.overallDarkAppearance, buttonColor: inputPanelTheme.actionControlFillColor, iconColor: inputPanelTheme.actionControlForegroundColor, backgroundColor: inputPanelTheme.panelBackgroundColor, borderColor: inputPanelTheme.panelSeparatorColor, lock: inputPanelTheme.panelControlAccentColor, textColor: inputPanelTheme.primaryTextColor, secondaryTextColor: inputPanelTheme.secondaryTextColor, recording: inputPanelTheme.mediaRecordingDotColor) } -func legacyInstantVideoController(theme: PresentationTheme, panelFrame: CGRect, context: AccountContextImpl, peerId: PeerId, slowmodeState: ChatSlowmodeState?, send: @escaping (EnqueueMessage) -> Void, displaySlowmodeTooltip: @escaping (ASDisplayNode, CGRect) -> Void) -> InstantVideoController { +func legacyInstantVideoController(theme: PresentationTheme, panelFrame: CGRect, context: AccountContext, peerId: PeerId, slowmodeState: ChatSlowmodeState?, send: @escaping (EnqueueMessage) -> Void, displaySlowmodeTooltip: @escaping (ASDisplayNode, CGRect) -> Void) -> InstantVideoController { let legacyController = InstantVideoController(presentation: .custom, theme: theme) legacyController.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .all) legacyController.lockOrientation = true diff --git a/submodules/TelegramUI/TelegramUI/LegacyLocationController.swift b/submodules/TelegramUI/TelegramUI/LegacyLocationController.swift index f09f138bea..648f2efd10 100644 --- a/submodules/TelegramUI/TelegramUI/LegacyLocationController.swift +++ b/submodules/TelegramUI/TelegramUI/LegacyLocationController.swift @@ -5,6 +5,7 @@ import LegacyComponents import TelegramCore import Postbox import TelegramPresentationData +import AccountContext private func generateClearIcon(color: UIColor) -> UIImage? { return generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Clear"), color: color) @@ -122,7 +123,7 @@ func legacyLocationPalette(from theme: PresentationTheme) -> TGLocationPallete { return TGLocationPallete(backgroundColor: listTheme.plainBackgroundColor, selectionColor: listTheme.itemHighlightedBackgroundColor, separatorColor: listTheme.itemPlainSeparatorColor, textColor: listTheme.itemPrimaryTextColor, secondaryTextColor: listTheme.itemSecondaryTextColor, accentColor: listTheme.itemAccentColor, destructiveColor: listTheme.itemDestructiveColor, locationColor: UIColor(rgb: 0x008df2), liveLocationColor: UIColor(rgb: 0xff6464), iconColor: searchTheme.backgroundColor, sectionHeaderBackgroundColor: theme.chatList.sectionHeaderFillColor, sectionHeaderTextColor: theme.chatList.sectionHeaderTextColor, searchBarPallete: TGSearchBarPallete(dark: theme.overallDarkAppearance, backgroundColor: searchTheme.backgroundColor, highContrastBackgroundColor: searchTheme.backgroundColor, textColor: searchTheme.inputTextColor, placeholderColor: searchTheme.inputPlaceholderTextColor, clearIcon: generateClearIcon(color: theme.rootController.navigationSearchBar.inputClearButtonColor), barBackgroundColor: searchTheme.backgroundColor, barSeparatorColor: searchTheme.separatorColor, plainBackgroundColor: searchTheme.backgroundColor, accentColor: searchTheme.accentColor, accentContrastColor: searchTheme.backgroundColor, menuBackgroundColor: searchTheme.backgroundColor, segmentedControlBackgroundImage: nil, segmentedControlSelectedImage: nil, segmentedControlHighlightedImage: nil, segmentedControlDividerImage: nil), avatarPlaceholder: nil) } -func legacyLocationController(message: Message?, mapMedia: TelegramMediaMap, context: AccountContextImpl, isModal: Bool, openPeer: @escaping (Peer) -> Void, sendLiveLocation: @escaping (CLLocationCoordinate2D, Int32) -> Void, stopLiveLocation: @escaping () -> Void, openUrl: @escaping (String) -> Void) -> ViewController { +func legacyLocationController(message: Message?, mapMedia: TelegramMediaMap, context: AccountContext, isModal: Bool, openPeer: @escaping (Peer) -> Void, sendLiveLocation: @escaping (CLLocationCoordinate2D, Int32) -> Void, stopLiveLocation: @escaping () -> Void, openUrl: @escaping (String) -> Void) -> ViewController { let legacyLocation = TGLocationMediaAttachment() legacyLocation.latitude = mapMedia.latitude legacyLocation.longitude = mapMedia.longitude diff --git a/submodules/TelegramUI/TelegramUI/LegacyLocationPicker.swift b/submodules/TelegramUI/TelegramUI/LegacyLocationPicker.swift index 2bd5bc898c..06965af4f6 100644 --- a/submodules/TelegramUI/TelegramUI/LegacyLocationPicker.swift +++ b/submodules/TelegramUI/TelegramUI/LegacyLocationPicker.swift @@ -6,12 +6,13 @@ import TelegramCore import Postbox import SwiftSignalKit import TelegramPresentationData +import AccountContext private func generateClearIcon(color: UIColor) -> UIImage? { return generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Clear"), color: color) } -func legacyLocationPickerController(context: AccountContextImpl, selfPeer: Peer, peer: Peer, sendLocation: @escaping (CLLocationCoordinate2D, MapVenue?, String?) -> Void, sendLiveLocation: @escaping (CLLocationCoordinate2D, Int32) -> Void, theme: PresentationTheme, customLocationPicker: Bool = false, presentationCompleted: @escaping () -> Void = {}) -> ViewController { +func legacyLocationPickerController(context: AccountContext, selfPeer: Peer, peer: Peer, sendLocation: @escaping (CLLocationCoordinate2D, MapVenue?, String?) -> Void, sendLiveLocation: @escaping (CLLocationCoordinate2D, Int32) -> Void, theme: PresentationTheme, customLocationPicker: Bool = false, presentationCompleted: @escaping () -> Void = {}) -> ViewController { let legacyController = LegacyController(presentation: .modal(animateIn: true), theme: theme) legacyController.presentationCompleted = { presentationCompleted() diff --git a/submodules/TelegramUI/TelegramUI/LegacyMediaPickers.swift b/submodules/TelegramUI/TelegramUI/LegacyMediaPickers.swift index f2e9f0b587..050471558f 100644 --- a/submodules/TelegramUI/TelegramUI/LegacyMediaPickers.swift +++ b/submodules/TelegramUI/TelegramUI/LegacyMediaPickers.swift @@ -9,12 +9,13 @@ import Display import TelegramPresentationData import TelegramUIPrivateModule import DeviceAccess +import AccountContext func guessMimeTypeByFileExtension(_ ext: String) -> String { return TGMimeTypeMap.mimeType(forExtension: ext) ?? "application/binary" } -func configureLegacyAssetPicker(_ controller: TGMediaAssetsController, context: AccountContextImpl, peer: Peer, captionsEnabled: Bool = true, storeCreatedAssets: Bool = true, showFileTooltip: Bool = false, initialCaption: String, presentWebSearch: (() -> Void)?, presentSelectionLimitExceeded: @escaping () -> Void) { +func configureLegacyAssetPicker(_ controller: TGMediaAssetsController, context: AccountContext, peer: Peer, captionsEnabled: Bool = true, storeCreatedAssets: Bool = true, showFileTooltip: Bool = false, initialCaption: String, presentWebSearch: (() -> Void)?, presentSelectionLimitExceeded: @escaping () -> Void) { let isSecretChat = peer.id.namespace == Namespaces.Peer.SecretChat controller.captionsEnabled = captionsEnabled @@ -39,7 +40,7 @@ func configureLegacyAssetPicker(_ controller: TGMediaAssetsController, context: controller.editingContext.setInitialCaption(initialCaption, entities: []) } -func legacyAssetPicker(context: AccountContextImpl, presentationData: PresentationData, editingMedia: Bool, fileMode: Bool, peer: Peer?, saveEditedPhotos: Bool, allowGrouping: Bool, selectionLimit: Int) -> Signal<(LegacyComponentsContext) -> TGMediaAssetsController, Void> { +func legacyAssetPicker(context: AccountContext, presentationData: PresentationData, editingMedia: Bool, fileMode: Bool, peer: Peer?, saveEditedPhotos: Bool, allowGrouping: Bool, selectionLimit: Int) -> Signal<(LegacyComponentsContext) -> TGMediaAssetsController, Void> { let isSecretChat = (peer?.id.namespace ?? 0) == Namespaces.Peer.SecretChat return Signal { subscriber in diff --git a/submodules/TelegramUI/TelegramUI/LegacySecureIdAttachmentMenu.swift b/submodules/TelegramUI/TelegramUI/LegacySecureIdAttachmentMenu.swift index c8ac6bb7fa..84f85bd1f6 100644 --- a/submodules/TelegramUI/TelegramUI/LegacySecureIdAttachmentMenu.swift +++ b/submodules/TelegramUI/TelegramUI/LegacySecureIdAttachmentMenu.swift @@ -5,6 +5,8 @@ import Display import SwiftSignalKit import Postbox import TelegramCore +import OverlayStatusController +import AccountContext enum SecureIdAttachmentMenuType { case generic @@ -26,7 +28,7 @@ struct SecureIdRecognizedDocumentData { let expiryDate: Date? } -func presentLegacySecureIdAttachmentMenu(context: AccountContextImpl, present: @escaping (ViewController) -> Void, validLayout: ContainerViewLayout, type: SecureIdAttachmentMenuType, recognizeDocumentData: Bool, completion: @escaping ([TelegramMediaResource], SecureIdRecognizedDocumentData?) -> Void) { +func presentLegacySecureIdAttachmentMenu(context: AccountContext, present: @escaping (ViewController) -> Void, validLayout: ContainerViewLayout, type: SecureIdAttachmentMenuType, recognizeDocumentData: Bool, completion: @escaping ([TelegramMediaResource], SecureIdRecognizedDocumentData?) -> Void) { let presentationData = context.sharedContext.currentPresentationData.with { $0 } let legacyController = LegacyController(presentation: .custom, theme: presentationData.theme, initialLayout: validLayout) legacyController.statusBar.statusBarStyle = .Ignore diff --git a/submodules/TelegramUI/TelegramUI/LegacyWallpaperPicker.swift b/submodules/TelegramUI/TelegramUI/LegacyWallpaperPicker.swift index 119ecefba6..6c5f704e39 100644 --- a/submodules/TelegramUI/TelegramUI/LegacyWallpaperPicker.swift +++ b/submodules/TelegramUI/TelegramUI/LegacyWallpaperPicker.swift @@ -5,8 +5,9 @@ import SwiftSignalKit import LegacyComponents import TelegramPresentationData import DeviceAccess +import AccountContext -func legacyWallpaperPicker(context: AccountContextImpl, presentationData: PresentationData) -> Signal<(LegacyComponentsContext) -> TGMediaAssetsController, Void> { +func legacyWallpaperPicker(context: AccountContext, presentationData: PresentationData) -> Signal<(LegacyComponentsContext) -> TGMediaAssetsController, Void> { return Signal { subscriber in let intent = TGMediaAssetsControllerSetCustomWallpaperIntent diff --git a/submodules/TelegramUI/TelegramUI/LegacyWebSearchEditor.swift b/submodules/TelegramUI/TelegramUI/LegacyWebSearchEditor.swift index 5785628b97..30d9d6b59d 100644 --- a/submodules/TelegramUI/TelegramUI/LegacyWebSearchEditor.swift +++ b/submodules/TelegramUI/TelegramUI/LegacyWebSearchEditor.swift @@ -7,8 +7,9 @@ import Postbox import SSignalKit import Display import TelegramPresentationData +import AccountContext -func presentLegacyWebSearchEditor(context: AccountContextImpl, theme: PresentationTheme, result: ChatContextResult, initialLayout: ContainerViewLayout?, updateHiddenMedia: @escaping (String?) -> Void, transitionHostView: @escaping () -> UIView?, transitionView: @escaping (ChatContextResult) -> UIView?, completed: @escaping (UIImage) -> Void, present: @escaping (ViewController, Any?) -> Void) { +func presentLegacyWebSearchEditor(context: AccountContext, theme: PresentationTheme, result: ChatContextResult, initialLayout: ContainerViewLayout?, updateHiddenMedia: @escaping (String?) -> Void, transitionHostView: @escaping () -> UIView?, transitionView: @escaping (ChatContextResult) -> UIView?, completed: @escaping (UIImage) -> Void, present: @escaping (ViewController, Any?) -> Void) { guard let item = legacyWebSearchItem(account: context.account, result: result) else { return } diff --git a/submodules/TelegramUI/TelegramUI/LegacyWebSearchGallery.swift b/submodules/TelegramUI/TelegramUI/LegacyWebSearchGallery.swift index d484f969c4..7cbe52bcbf 100644 --- a/submodules/TelegramUI/TelegramUI/LegacyWebSearchGallery.swift +++ b/submodules/TelegramUI/TelegramUI/LegacyWebSearchGallery.swift @@ -8,6 +8,7 @@ import SSignalKit import UIKit import Display import TelegramPresentationData +import AccountContext class LegacyWebSearchItem: NSObject, TGMediaEditableItem, TGMediaSelectableItem { var isVideo: Bool { @@ -308,7 +309,7 @@ private func galleryItems(account: Account, results: [ChatContextResult], curren return (galleryItems, focusItem) } -func presentLegacyWebSearchGallery(context: AccountContextImpl, peer: Peer?, theme: PresentationTheme, results: [ChatContextResult], current: ChatContextResult, selectionContext: TGMediaSelectionContext?, editingContext: TGMediaEditingContext, updateHiddenMedia: @escaping (String?) -> Void, initialLayout: ContainerViewLayout?, transitionHostView: @escaping () -> UIView?, transitionView: @escaping (ChatContextResult) -> UIView?, completed: @escaping (ChatContextResult) -> Void, present: (ViewController, Any?) -> Void) { +func presentLegacyWebSearchGallery(context: AccountContext, peer: Peer?, theme: PresentationTheme, results: [ChatContextResult], current: ChatContextResult, selectionContext: TGMediaSelectionContext?, editingContext: TGMediaEditingContext, updateHiddenMedia: @escaping (String?) -> Void, initialLayout: ContainerViewLayout?, transitionHostView: @escaping () -> UIView?, transitionView: @escaping (ChatContextResult) -> UIView?, completed: @escaping (ChatContextResult) -> Void, present: (ViewController, Any?) -> Void) { let legacyController = LegacyController(presentation: .custom, theme: theme, initialLayout: nil) legacyController.statusBar.statusBarStyle = theme.rootController.statusBarStyle.style diff --git a/submodules/TelegramUI/TelegramUI/ListMessageDateHeader.swift b/submodules/TelegramUI/TelegramUI/ListMessageDateHeader.swift index 5fcdd2b559..406d37c5c9 100644 --- a/submodules/TelegramUI/TelegramUI/ListMessageDateHeader.swift +++ b/submodules/TelegramUI/TelegramUI/ListMessageDateHeader.swift @@ -3,6 +3,7 @@ import UIKit import Display import AsyncDisplayKit import TelegramPresentationData +import TelegramStringFormatting private let timezoneOffset: Int32 = { let nowTimestamp = Int32(CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970) diff --git a/submodules/TelegramUI/TelegramUI/ListMessageFileItemNode.swift b/submodules/TelegramUI/TelegramUI/ListMessageFileItemNode.swift index bf2f2fc0e3..8a311ec852 100644 --- a/submodules/TelegramUI/TelegramUI/ListMessageFileItemNode.swift +++ b/submodules/TelegramUI/TelegramUI/ListMessageFileItemNode.swift @@ -7,6 +7,9 @@ import TelegramCore import SwiftSignalKit import TelegramPresentationData import ItemListUI +import AccountContext +import TelegramStringFormatting +import AccountContext private let extensionImageCache = Atomic<[UInt32: UIImage]>(value: [:]) @@ -170,7 +173,7 @@ final class ListMessageFileItemNode: ListMessageNode { private let progressNode: RadialProgressNode private var playbackOverlayNode: ListMessagePlaybackOverlayNode? - private var context: AccountContextImpl? + private var context: AccountContext? private (set) var message: Message? private var appliedItem: ListMessageItem? @@ -862,7 +865,7 @@ final class ListMessageFileItemNode: ListMessageNode { } case .playbackStatus: if let context = self.context { - context.sharedContext.mediaManager.playlistControl(.playback(.togglePlayPause)) + context.sharedContext.mediaManager.playlistControl(.playback(.togglePlayPause), type: nil) } } } diff --git a/submodules/TelegramUI/TelegramUI/ListMessageItem.swift b/submodules/TelegramUI/TelegramUI/ListMessageItem.swift index d8aae5a3ad..d05359c7ee 100644 --- a/submodules/TelegramUI/TelegramUI/ListMessageItem.swift +++ b/submodules/TelegramUI/TelegramUI/ListMessageItem.swift @@ -6,12 +6,13 @@ import TelegramCore import SwiftSignalKit import Postbox import TelegramPresentationData +import AccountContext final class ListMessageItem: ListViewItem { let theme: PresentationTheme let strings: PresentationStrings let dateTimeFormat: PresentationDateTimeFormat - let context: AccountContextImpl + let context: AccountContext let chatLocation: ChatLocation let controllerInteraction: ChatControllerInteraction let message: Message @@ -21,7 +22,7 @@ final class ListMessageItem: ListViewItem { let selectable: Bool = true - public init(theme: PresentationTheme, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, context: AccountContextImpl, chatLocation: ChatLocation, controllerInteraction: ChatControllerInteraction, message: Message, selection: ChatHistoryMessageSelection, displayHeader: Bool) { + public init(theme: PresentationTheme, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, context: AccountContext, chatLocation: ChatLocation, controllerInteraction: ChatControllerInteraction, message: Message, selection: ChatHistoryMessageSelection, displayHeader: Bool) { self.theme = theme self.strings = strings self.dateTimeFormat = dateTimeFormat diff --git a/submodules/TelegramUI/TelegramUI/LocalizationListController.swift b/submodules/TelegramUI/TelegramUI/LocalizationListController.swift index 16d6e12f59..d4e7d46dc4 100644 --- a/submodules/TelegramUI/TelegramUI/LocalizationListController.swift +++ b/submodules/TelegramUI/TelegramUI/LocalizationListController.swift @@ -6,9 +6,10 @@ import Postbox import SwiftSignalKit import TelegramCore import TelegramPresentationData +import AccountContext public class LocalizationListController: ViewController { - private let context: AccountContextImpl + private let context: AccountContext private var controllerNode: LocalizationListControllerNode { return self.displayNode as! LocalizationListControllerNode @@ -27,7 +28,7 @@ public class LocalizationListController: ViewController { private var searchContentNode: NavigationBarSearchContentNode? - public init(context: AccountContextImpl) { + public init(context: AccountContext) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/LocalizationListControllerNode.swift b/submodules/TelegramUI/TelegramUI/LocalizationListControllerNode.swift index 70ab35c561..d68e6e1e99 100644 --- a/submodules/TelegramUI/TelegramUI/LocalizationListControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/LocalizationListControllerNode.swift @@ -8,6 +8,7 @@ import SwiftSignalKit import TelegramPresentationData import MergeLists import ItemListUI +import AccountContext private enum LanguageListSection: ItemListSectionId { case official @@ -87,7 +88,7 @@ private final class LocalizationListSearchContainerNode: SearchDisplayController private let themeAndStringsPromise: Promise<(PresentationTheme, PresentationStrings)> - init(context: AccountContextImpl, listState: LocalizationListState, selectLocalization: @escaping (LocalizationInfo) -> Void, applyingCode: Signal) { + init(context: AccountContext, listState: LocalizationListState, selectLocalization: @escaping (LocalizationInfo) -> Void, applyingCode: Signal) { self.presentationData = context.sharedContext.currentPresentationData.with { $0 } self.themeAndStringsPromise = Promise((self.presentationData.theme, self.presentationData.strings)) @@ -275,7 +276,7 @@ private func preparedLanguageListNodeTransition(theme: PresentationTheme, string } final class LocalizationListControllerNode: ViewControllerTracingNode { - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private let navigationBar: NavigationBar private let requestActivateSearch: () -> Void @@ -305,7 +306,7 @@ final class LocalizationListControllerNode: ViewControllerTracingNode { } } - init(context: AccountContextImpl, presentationData: PresentationData, navigationBar: NavigationBar, requestActivateSearch: @escaping () -> Void, requestDeactivateSearch: @escaping () -> Void, updateCanStartEditing: @escaping (Bool?) -> Void, present: @escaping (ViewController, Any?) -> Void) { + init(context: AccountContext, presentationData: PresentationData, navigationBar: NavigationBar, requestActivateSearch: @escaping () -> Void, requestDeactivateSearch: @escaping () -> Void, updateCanStartEditing: @escaping (Bool?) -> Void, present: @escaping (ViewController, Any?) -> Void) { self.context = context self.presentationData = presentationData self.presentationDataValue.set(.single((presentationData.theme, presentationData.strings))) diff --git a/submodules/TelegramUI/TelegramUI/LogoutOptionsController.swift b/submodules/TelegramUI/TelegramUI/LogoutOptionsController.swift index bd36721293..b39bd127be 100644 --- a/submodules/TelegramUI/TelegramUI/LogoutOptionsController.swift +++ b/submodules/TelegramUI/TelegramUI/LogoutOptionsController.swift @@ -7,6 +7,8 @@ import TelegramCore import LegacyComponents import TelegramPresentationData import ItemListUI +import OverlayStatusController +import AccountContext private struct LogoutOptionsItemArguments { let addAccount: () -> Void @@ -117,7 +119,7 @@ private func logoutOptionsEntries(presentationData: PresentationData, canAddAcco return entries } -func logoutOptionsController(context: AccountContextImpl, navigationController: NavigationController, canAddAccounts: Bool, phoneNumber: String) -> ViewController { +func logoutOptionsController(context: AccountContext, navigationController: NavigationController, canAddAccounts: Bool, phoneNumber: String) -> ViewController { var pushControllerImpl: ((ViewController) -> Void)? var presentControllerImpl: ((ViewController, Any?) -> Void)? var replaceTopControllerImpl: ((ViewController) -> Void)? diff --git a/submodules/TelegramUI/TelegramUI/ManagedAudioRecorder.swift b/submodules/TelegramUI/TelegramUI/ManagedAudioRecorder.swift index 120417fc4d..832f990d33 100644 --- a/submodules/TelegramUI/TelegramUI/ManagedAudioRecorder.swift +++ b/submodules/TelegramUI/TelegramUI/ManagedAudioRecorder.swift @@ -6,6 +6,7 @@ import AVFoundation import TelegramCore import TelegramAudio import UniversalMediaPlayer +import AccountContext private let kOutputBus: UInt32 = 0 private let kInputBus: UInt32 = 1 @@ -133,12 +134,6 @@ private func rendererInputProc(refCon: UnsafeMutableRawPointer, ioActionFlags: U return noErr } -struct RecordedAudioData { - let compressedData: Data - let duration: Double - let waveform: Data? -} - private let beginToneData: TonePlayerData? = { guard let url = Bundle.main.url(forResource: "begin_record", withExtension: "caf") else { return nil @@ -642,13 +637,7 @@ final class ManagedAudioRecorderContext { } } -enum AudioRecordingState: Equatable { - case paused(duration: Double) - case recording(duration: Double, durationMediaTimestamp: Double) - case stopped -} - -final class ManagedAudioRecorder { +final class ManagedAudioRecorderImpl: ManagedAudioRecorder { private let queue = Queue() private var contextRef: Unmanaged? private let micLevelValue = ValuePromise(0.0) diff --git a/submodules/TelegramUI/TelegramUI/MediaManager.swift b/submodules/TelegramUI/TelegramUI/MediaManager.swift index 4dc1876760..c5e4f2be30 100644 --- a/submodules/TelegramUI/TelegramUI/MediaManager.swift +++ b/submodules/TelegramUI/TelegramUI/MediaManager.swift @@ -16,11 +16,6 @@ enum SharedMediaPlayerGroup: Int { case voiceAndInstantVideo = 1 } -public enum MediaManagerPlayerType { - case voice - case music -} - private let sharedAudioSession: ManagedAudioSession = { let audioSession = ManagedAudioSession() let _ = (audioSession.headsetConnected() |> deliverOnMainQueue).start(next: { value in @@ -29,11 +24,6 @@ private let sharedAudioSession: ManagedAudioSession = { return audioSession }() -enum SharedMediaPlayerItemPlaybackStateOrLoading: Equatable { - case state(SharedMediaPlayerItemPlaybackState) - case loading -} - private struct GlobalControlOptions: OptionSet { var rawValue: Int32 @@ -49,7 +39,7 @@ private struct GlobalControlOptions: OptionSet { static let seek = GlobalControlOptions(rawValue: 1 << 5) } -public final class MediaManager: NSObject { +public final class MediaManagerImpl: NSObject, MediaManager { public static var globalAudioSession: ManagedAudioSession { return sharedAudioSession } @@ -69,7 +59,7 @@ public final class MediaManager: NSObject { private let inForeground: Signal public let audioSession: ManagedAudioSession - public let overlayMediaManager = OverlayMediaManager() + public let overlayMediaManager: OverlayMediaManager = OverlayMediaManager() let sharedVideoContextManager = SharedVideoContextManager() private var nextPlayerIndex: Int32 = 0 @@ -124,12 +114,12 @@ public final class MediaManager: NSObject { } } private let musicMediaPlayerStateValue = Promise<(Account, SharedMediaPlayerItemPlaybackStateOrLoading)?>(nil) - var musicMediaPlayerState: Signal<(Account, SharedMediaPlayerItemPlaybackStateOrLoading)?, NoError> { + public var musicMediaPlayerState: Signal<(Account, SharedMediaPlayerItemPlaybackStateOrLoading)?, NoError> { return self.musicMediaPlayerStateValue.get() } private let globalMediaPlayerStateValue = Promise<(Account, SharedMediaPlayerItemPlaybackStateOrLoading, MediaManagerPlayerType)?>() - var globalMediaPlayerState: Signal<(Account, SharedMediaPlayerItemPlaybackStateOrLoading, MediaManagerPlayerType)?, NoError> { + public var globalMediaPlayerState: Signal<(Account, SharedMediaPlayerItemPlaybackStateOrLoading, MediaManagerPlayerType)?, NoError> { return self.globalMediaPlayerStateValue.get() } public var activeGlobalMediaPlayerAccountId: Signal<(AccountRecordId, Bool)?, NoError> { @@ -174,9 +164,9 @@ public final class MediaManager: NSObject { private let globalControlsStatusDisposable = MetaDisposable() private let globalAudioSessionForegroundDisposable = MetaDisposable() - let universalVideoManager = UniversalVideoContentManager() + public let universalVideoManager: UniversalVideoManager = UniversalVideoManagerImpl() - let galleryHiddenMediaManager = GalleryHiddenMediaManager() + public let galleryHiddenMediaManager: GalleryHiddenMediaManager = GalleryHiddenMediaManagerImpl() init(accountManager: AccountManager, inForeground: Signal) { self.accountManager = accountManager @@ -413,12 +403,12 @@ public final class MediaManager: NSObject { self.globalAudioSessionForegroundDisposable.dispose() } - func audioRecorder(beginWithTone: Bool, applicationBindings: TelegramApplicationBindings, beganWithTone: @escaping (Bool) -> Void) -> Signal { + public func audioRecorder(beginWithTone: Bool, applicationBindings: TelegramApplicationBindings, beganWithTone: @escaping (Bool) -> Void) -> Signal { return Signal { subscriber in let disposable = MetaDisposable() self.queue.async { - let audioRecorder = ManagedAudioRecorder(mediaManager: self, pushIdleTimerExtension: { [weak applicationBindings] in + let audioRecorder = ManagedAudioRecorderImpl(mediaManager: self, pushIdleTimerExtension: { [weak applicationBindings] in return applicationBindings?.pushIdleTimerExtension() ?? EmptyDisposable }, beginWithTone: beginWithTone, beganWithTone: beganWithTone) subscriber.putNext(audioRecorder) @@ -431,7 +421,7 @@ public final class MediaManager: NSObject { } } - func setPlaylist(_ playlist: (Account, SharedMediaPlaylist)?, type: MediaManagerPlayerType, control: SharedMediaPlayerControlAction = .playback(.play)) { + public func setPlaylist(_ playlist: (Account, SharedMediaPlaylist)?, type: MediaManagerPlayerType, control: SharedMediaPlayerControlAction) { assert(Queue.mainQueue().isCurrent()) let inputData: Signal<(Account, SharedMediaPlaylist, MusicPlaybackSettings)?, NoError> if let (account, playlist) = playlist { @@ -493,7 +483,7 @@ public final class MediaManager: NSObject { }), forKey: type) } - func playlistControl(_ control: SharedMediaPlayerControlAction, type: MediaManagerPlayerType? = nil) { + public func playlistControl(_ control: SharedMediaPlayerControlAction, type: MediaManagerPlayerType?) { assert(Queue.mainQueue().isCurrent()) let selectedType: MediaManagerPlayerType if let type = type { @@ -510,7 +500,7 @@ public final class MediaManager: NSObject { if self.voiceMediaPlayer != nil { switch control { case .playback(.play), .playback(.togglePlayPause): - self.setPlaylist(nil, type: .voice) + self.setPlaylist(nil, type: .voice, control: .playback(.pause)) default: break } @@ -519,7 +509,7 @@ public final class MediaManager: NSObject { } } - func filteredPlaylistState(accountId: AccountRecordId, playlistId: SharedMediaPlaylistId, itemId: SharedMediaPlaylistItemId, type: MediaManagerPlayerType) -> Signal { + public func filteredPlaylistState(accountId: AccountRecordId, playlistId: SharedMediaPlaylistId, itemId: SharedMediaPlaylistItemId, type: MediaManagerPlayerType) -> Signal { let signal: Signal<(Account, SharedMediaPlayerItemPlaybackStateOrLoading)?, NoError> switch type { case .voice: @@ -541,30 +531,30 @@ public final class MediaManager: NSObject { } @objc func playCommandEvent(_ command: AnyObject) { - self.playlistControl(.playback(.play)) + self.playlistControl(.playback(.play), type: nil) } @objc func pauseCommandEvent(_ command: AnyObject) { - self.playlistControl(.playback(.pause)) + self.playlistControl(.playback(.pause), type: nil) } @objc func previousTrackCommandEvent(_ command: AnyObject) { - self.playlistControl(.previous) + self.playlistControl(.previous, type: nil) } @objc func nextTrackCommandEvent(_ command: AnyObject) { - self.playlistControl(.next) + self.playlistControl(.next, type: nil) } @objc func togglePlayPauseCommandEvent(_ command: AnyObject) { - self.playlistControl(.playback(.togglePlayPause)) + self.playlistControl(.playback(.togglePlayPause), type: nil) } @objc func changePlaybackPositionCommandEvent(_ event: MPChangePlaybackPositionCommandEvent) { - self.playlistControl(.seek(event.positionTime)) + self.playlistControl(.seek(event.positionTime), type: nil) } - func setOverlayVideoNode(_ node: OverlayMediaItemNode?) { + public func setOverlayVideoNode(_ node: OverlayMediaItemNode?) { if let currentOverlayVideoNode = self.currentOverlayVideoNode { self.overlayMediaManager.controller?.removeNode(currentOverlayVideoNode, customTransition: true) self.currentOverlayVideoNode = nil diff --git a/submodules/TelegramUI/TelegramUI/MentionChatInputContextPanelNode.swift b/submodules/TelegramUI/TelegramUI/MentionChatInputContextPanelNode.swift index ab1df098d9..2a380fbadf 100644 --- a/submodules/TelegramUI/TelegramUI/MentionChatInputContextPanelNode.swift +++ b/submodules/TelegramUI/TelegramUI/MentionChatInputContextPanelNode.swift @@ -7,6 +7,7 @@ import Display import TelegramPresentationData import MergeLists import TextFormat +import AccountContext private struct MentionChatInputContextPanelEntry: Comparable, Identifiable { let index: Int @@ -59,7 +60,7 @@ final class MentionChatInputContextPanelNode: ChatInputContextPanelNode { private var enqueuedTransitions: [(CommandChatInputContextPanelTransition, Bool)] = [] private var validLayout: (CGSize, CGFloat, CGFloat)? - init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings, mode: MentionChatInputContextPanelMode) { + init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, mode: MentionChatInputContextPanelMode) { self.mode = mode self.listView = ListView() diff --git a/submodules/TelegramUI/TelegramUI/MentionChatInputPanelItem.swift b/submodules/TelegramUI/TelegramUI/MentionChatInputPanelItem.swift index 4e8dd1177c..d5f7f18afb 100644 --- a/submodules/TelegramUI/TelegramUI/MentionChatInputPanelItem.swift +++ b/submodules/TelegramUI/TelegramUI/MentionChatInputPanelItem.swift @@ -6,6 +6,7 @@ import TelegramCore import SwiftSignalKit import Postbox import TelegramPresentationData +import AvatarNode final class MentionChatInputPanelItem: ListViewItem { fileprivate let account: Account diff --git a/submodules/TelegramUI/TelegramUI/MultipleAvatarsNode.swift b/submodules/TelegramUI/TelegramUI/MultipleAvatarsNode.swift index 0642cad9fc..aa493aabaa 100644 --- a/submodules/TelegramUI/TelegramUI/MultipleAvatarsNode.swift +++ b/submodules/TelegramUI/TelegramUI/MultipleAvatarsNode.swift @@ -5,6 +5,7 @@ import AsyncDisplayKit import Postbox import TelegramCore import TelegramPresentationData +import AvatarNode private let avatarFont = UIFont(name: ".SFCompactRounded-Semibold", size: 13.0)! diff --git a/submodules/TelegramUI/TelegramUI/NativeVideoContent.swift b/submodules/TelegramUI/TelegramUI/NativeVideoContent.swift index 7458ad6094..60fe8a4952 100644 --- a/submodules/TelegramUI/TelegramUI/NativeVideoContent.swift +++ b/submodules/TelegramUI/TelegramUI/NativeVideoContent.swift @@ -7,6 +7,7 @@ import Postbox import TelegramCore import TelegramAudio import UniversalMediaPlayer +import AccountContext enum NativeVideoContentId: Hashable { case message(UInt32, MediaId) diff --git a/submodules/TelegramUI/TelegramUI/NavigateToChatController.swift b/submodules/TelegramUI/TelegramUI/NavigateToChatController.swift index fffac3a39b..12a873d391 100644 --- a/submodules/TelegramUI/TelegramUI/NavigateToChatController.swift +++ b/submodules/TelegramUI/TelegramUI/NavigateToChatController.swift @@ -3,6 +3,7 @@ import UIKit import Display import TelegramCore import Postbox +import AccountContext public enum NavigateToChatKeepStack { case `default` @@ -10,7 +11,7 @@ public enum NavigateToChatKeepStack { case never } -public func navigateToChatController(navigationController: NavigationController, chatController: ChatController? = nil, context: AccountContextImpl, chatLocation: ChatLocation, messageId: MessageId? = nil, botStart: ChatControllerInitialBotStart? = nil, updateTextInputState: ChatTextInputState? = nil, activateInput: Bool = false, keepStack: NavigateToChatKeepStack = .default, purposefulAction: (() -> Void)? = nil, scrollToEndIfExists: Bool = false, animated: Bool = true, options: NavigationAnimationOptions = [], parentGroupId: PeerGroupId? = nil, completion: @escaping () -> Void = {}) { +public func navigateToChatController(navigationController: NavigationController, chatController: ChatController? = nil, context: AccountContext, chatLocation: ChatLocation, messageId: MessageId? = nil, botStart: ChatControllerInitialBotStart? = nil, updateTextInputState: ChatTextInputState? = nil, activateInput: Bool = false, keepStack: NavigateToChatKeepStack = .default, purposefulAction: (() -> Void)? = nil, scrollToEndIfExists: Bool = false, animated: Bool = true, options: NavigationAnimationOptions = [], parentGroupId: PeerGroupId? = nil, completion: @escaping () -> Void = {}) { var found = false var isFirst = true for controller in navigationController.viewControllers.reversed() { diff --git a/submodules/TelegramUI/TelegramUI/NetworkUsageStatsController.swift b/submodules/TelegramUI/TelegramUI/NetworkUsageStatsController.swift index 877f913272..a5411c50b9 100644 --- a/submodules/TelegramUI/TelegramUI/NetworkUsageStatsController.swift +++ b/submodules/TelegramUI/TelegramUI/NetworkUsageStatsController.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import TelegramPresentationData import ItemListUI +import AccountContext private enum NetworkUsageControllerSection { case cellular @@ -376,7 +377,7 @@ private func networkUsageStatsControllerEntries(presentationData: PresentationDa return entries } -func networkUsageStatsController(context: AccountContextImpl) -> ViewController { +func networkUsageStatsController(context: AccountContext) -> ViewController { let section = ValuePromise(.cellular) let stats = Promise() stats.set(accountNetworkUsageStats(account: context.account, reset: [])) diff --git a/submodules/TelegramUI/TelegramUI/NotificationContainerController.swift b/submodules/TelegramUI/TelegramUI/NotificationContainerController.swift index b1fac0c262..f68ff574a2 100644 --- a/submodules/TelegramUI/TelegramUI/NotificationContainerController.swift +++ b/submodules/TelegramUI/TelegramUI/NotificationContainerController.swift @@ -5,6 +5,7 @@ import AsyncDisplayKit import TelegramCore import SwiftSignalKit import TelegramPresentationData +import AccountContext public final class NotificationContainerController: ViewController { private var controllerNode: NotificationContainerControllerNode { @@ -14,7 +15,7 @@ public final class NotificationContainerController: ViewController { private var presentationData: PresentationData private var presentationDataDisposable: Disposable? - public init(context: AccountContextImpl) { + public init(context: AccountContext) { self.presentationData = context.sharedContext.currentPresentationData.with { $0 } super.init(navigationBarPresentationData: nil) diff --git a/submodules/TelegramUI/TelegramUI/NotificationContentContext.swift b/submodules/TelegramUI/TelegramUI/NotificationContentContext.swift index 4a33ce2d55..719f5b43a5 100644 --- a/submodules/TelegramUI/TelegramUI/NotificationContentContext.swift +++ b/submodules/TelegramUI/TelegramUI/NotificationContentContext.swift @@ -14,7 +14,7 @@ private enum NotificationContentAuthorizationError { case unauthorized } -private var sharedAccountContext: SharedAccountContextImpl? +private var sharedAccountContext: SharedAccountContext? private var installedSharedLogger = false diff --git a/submodules/TelegramUI/TelegramUI/NotificationExceptionControllerNode.swift b/submodules/TelegramUI/TelegramUI/NotificationExceptionControllerNode.swift index e4c1522194..40f89db61d 100644 --- a/submodules/TelegramUI/TelegramUI/NotificationExceptionControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/NotificationExceptionControllerNode.swift @@ -9,6 +9,7 @@ import TelegramPresentationData import TelegramUIPreferences import ItemListUI import MergeLists +import AccountContext private final class NotificationExceptionState : Equatable { let mode:NotificationExceptionMode @@ -635,7 +636,7 @@ private extension PeerMuteState { } final class NotificationExceptionsControllerNode: ViewControllerTracingNode { - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private let navigationBar: NavigationBar private let requestActivateSearch: () -> Void @@ -664,7 +665,7 @@ final class NotificationExceptionsControllerNode: ViewControllerTracingNode { self.arguments?.selectPeer() } - init(context: AccountContextImpl, presentationData: PresentationData, navigationBar: NavigationBar, mode: NotificationExceptionMode, updatedMode:@escaping(NotificationExceptionMode)->Void, requestActivateSearch: @escaping () -> Void, requestDeactivateSearch: @escaping (Bool) -> Void, updateCanStartEditing: @escaping (Bool?) -> Void, present: @escaping (ViewController, Any?) -> Void, pushController: @escaping (ViewController) -> Void) { + init(context: AccountContext, presentationData: PresentationData, navigationBar: NavigationBar, mode: NotificationExceptionMode, updatedMode:@escaping(NotificationExceptionMode)->Void, requestActivateSearch: @escaping () -> Void, requestDeactivateSearch: @escaping (Bool) -> Void, updateCanStartEditing: @escaping (Bool?) -> Void, present: @escaping (ViewController, Any?) -> Void, pushController: @escaping (ViewController) -> Void) { self.context = context self.presentationData = presentationData self.presentationDataValue.set(.single((presentationData.theme, presentationData.strings))) @@ -1138,7 +1139,7 @@ private final class NotificationExceptionsSearchContainerNode: SearchDisplayCont private let updateNotificationsDisposable = MetaDisposable() private let themeAndStringsPromise: Promise<(PresentationTheme, PresentationStrings)> - init(context: AccountContextImpl, mode: NotificationExceptionMode, arguments: NotificationExceptionArguments) { + init(context: AccountContext, mode: NotificationExceptionMode, arguments: NotificationExceptionArguments) { self.presentationData = context.sharedContext.currentPresentationData.with { $0 } self.themeAndStringsPromise = Promise((self.presentationData.theme, self.presentationData.strings)) diff --git a/submodules/TelegramUI/TelegramUI/NotificationExceptionSettingsController.swift b/submodules/TelegramUI/TelegramUI/NotificationExceptionSettingsController.swift index 998fc270ef..490b6ab286 100644 --- a/submodules/TelegramUI/TelegramUI/NotificationExceptionSettingsController.swift +++ b/submodules/TelegramUI/TelegramUI/NotificationExceptionSettingsController.swift @@ -7,6 +7,7 @@ import TelegramCore import SwiftSignalKit import TelegramPresentationData import ItemListUI +import AccountContext private enum NotificationPeerExceptionSection: Int32 { case remove @@ -307,7 +308,7 @@ private struct NotificationExceptionPeerState : Equatable { } -func notificationPeerExceptionController(context: AccountContextImpl, peer: Peer, mode: NotificationExceptionMode, updatePeerSound: @escaping(PeerId, PeerMessageSound) -> Void, updatePeerNotificationInterval: @escaping(PeerId, Int32?) -> Void, updatePeerDisplayPreviews: @escaping(PeerId, PeerNotificationDisplayPreviews) -> Void, removePeerFromExceptions: @escaping () -> Void, modifiedPeer: @escaping () -> Void) -> ViewController { +func notificationPeerExceptionController(context: AccountContext, peer: Peer, mode: NotificationExceptionMode, updatePeerSound: @escaping(PeerId, PeerMessageSound) -> Void, updatePeerNotificationInterval: @escaping(PeerId, Int32?) -> Void, updatePeerDisplayPreviews: @escaping(PeerId, PeerNotificationDisplayPreviews) -> Void, removePeerFromExceptions: @escaping () -> Void, modifiedPeer: @escaping () -> Void) -> ViewController { let initialState = NotificationExceptionPeerState(canRemove: false) let statePromise = Promise(initialState) let stateValue = Atomic(value: initialState) diff --git a/submodules/TelegramUI/TelegramUI/NotificationExceptions.swift b/submodules/TelegramUI/TelegramUI/NotificationExceptions.swift index 8705fb73fd..5862bdb6e0 100644 --- a/submodules/TelegramUI/TelegramUI/NotificationExceptions.swift +++ b/submodules/TelegramUI/TelegramUI/NotificationExceptions.swift @@ -5,9 +5,10 @@ import SwiftSignalKit import Postbox import TelegramCore import TelegramPresentationData +import AccountContext public class NotificationExceptionsController: ViewController { - private let context: AccountContextImpl + private let context: AccountContext private var controllerNode: NotificationExceptionsControllerNode { return self.displayNode as! NotificationExceptionsControllerNode @@ -30,7 +31,7 @@ public class NotificationExceptionsController: ViewController { private var searchContentNode: NavigationBarSearchContentNode? - public init(context: AccountContextImpl, mode: NotificationExceptionMode, updatedMode: @escaping(NotificationExceptionMode) -> Void) { + public init(context: AccountContext, mode: NotificationExceptionMode, updatedMode: @escaping(NotificationExceptionMode) -> Void) { self.context = context self.mode = mode self.updatedMode = updatedMode diff --git a/submodules/TelegramUI/TelegramUI/NotificationSoundSelection.swift b/submodules/TelegramUI/TelegramUI/NotificationSoundSelection.swift index 341e62223c..45a4cbfed1 100644 --- a/submodules/TelegramUI/TelegramUI/NotificationSoundSelection.swift +++ b/submodules/TelegramUI/TelegramUI/NotificationSoundSelection.swift @@ -7,6 +7,7 @@ import TelegramCore import AVFoundation import TelegramPresentationData import ItemListUI +import AccountContext private struct NotificationSoundSelectionArguments { let account: Account @@ -212,7 +213,7 @@ public func fileNameForNotificationSound(_ sound: PeerMessageSound, defaultSound } } -func playSound(context: AccountContextImpl, sound: PeerMessageSound, defaultSound: PeerMessageSound?) -> Signal { +func playSound(context: AccountContext, sound: PeerMessageSound, defaultSound: PeerMessageSound?) -> Signal { if case .none = sound { return .complete() } else { @@ -253,7 +254,7 @@ func playSound(context: AccountContextImpl, sound: PeerMessageSound, defaultSoun } } -public func notificationSoundSelectionController(context: AccountContextImpl, isModal: Bool, currentSound: PeerMessageSound, defaultSound: PeerMessageSound?, completion: @escaping (PeerMessageSound) -> Void) -> ViewController { +public func notificationSoundSelectionController(context: AccountContext, isModal: Bool, currentSound: PeerMessageSound, defaultSound: PeerMessageSound?, completion: @escaping (PeerMessageSound) -> Void) -> ViewController { let statePromise = ValuePromise(NotificationSoundSelectionState(selectedSound: currentSound), ignoreRepeated: true) let stateValue = Atomic(value: NotificationSoundSelectionState(selectedSound: currentSound)) let updateState: ((NotificationSoundSelectionState) -> NotificationSoundSelectionState) -> Void = { f in @@ -278,21 +279,21 @@ public func notificationSoundSelectionController(context: AccountContextImpl, is }) let signal = combineLatest(context.sharedContext.presentationData, statePromise.get()) - |> map { presentationData, state -> (ItemListControllerState, (ItemListNodeState, NotificationSoundSelectionEntry.ItemGenerationArguments)) in - - let leftNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Cancel), style: .regular, enabled: true, action: { - arguments.cancel() - }) - - let rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Done), style: .bold, enabled: true, action: { - arguments.complete() - }) - - let controllerState = ItemListControllerState(theme: presentationData.theme, title: .text(presentationData.strings.Notifications_TextTone), leftNavigationButton: leftNavigationButton, rightNavigationButton: rightNavigationButton, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back)) - let listState = ItemListNodeState(entries: notificationsAndSoundsEntries(presentationData: presentationData, defaultSound: defaultSound, state: state), style: .blocks) - - return (controllerState, (listState, arguments)) - } + |> map { presentationData, state -> (ItemListControllerState, (ItemListNodeState, NotificationSoundSelectionEntry.ItemGenerationArguments)) in + + let leftNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Cancel), style: .regular, enabled: true, action: { + arguments.cancel() + }) + + let rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Done), style: .bold, enabled: true, action: { + arguments.complete() + }) + + let controllerState = ItemListControllerState(theme: presentationData.theme, title: .text(presentationData.strings.Notifications_TextTone), leftNavigationButton: leftNavigationButton, rightNavigationButton: rightNavigationButton, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back)) + let listState = ItemListNodeState(entries: notificationsAndSoundsEntries(presentationData: presentationData, defaultSound: defaultSound, state: state), style: .blocks) + + return (controllerState, (listState, arguments)) + } let controller = ItemListController(context: context, state: signal |> afterDisposed { playSoundDisposable.dispose() diff --git a/submodules/TelegramUI/TelegramUI/NotificationsAndSounds.swift b/submodules/TelegramUI/TelegramUI/NotificationsAndSounds.swift index 5317a0f0c3..08e0ac090f 100644 --- a/submodules/TelegramUI/TelegramUI/NotificationsAndSounds.swift +++ b/submodules/TelegramUI/TelegramUI/NotificationsAndSounds.swift @@ -11,7 +11,7 @@ import ItemListUI import AccountContext private final class NotificationsAndSoundsArguments { - let context: AccountContextImpl + let context: AccountContext let presentController: (ViewController, ViewControllerPresentationArguments?) -> Void let pushController: (ViewController) -> Void let soundSelectionDisposable: MetaDisposable @@ -50,7 +50,7 @@ private final class NotificationsAndSoundsArguments { let updateNotificationsFromAllAccounts: (Bool) -> Void - init(context: AccountContextImpl, presentController: @escaping (ViewController, ViewControllerPresentationArguments?) -> Void, pushController: @escaping(ViewController)->Void, soundSelectionDisposable: MetaDisposable, authorizeNotifications: @escaping () -> Void, suppressWarning: @escaping () -> Void, updateMessageAlerts: @escaping (Bool) -> Void, updateMessagePreviews: @escaping (Bool) -> Void, updateMessageSound: @escaping (PeerMessageSound) -> Void, updateGroupAlerts: @escaping (Bool) -> Void, updateGroupPreviews: @escaping (Bool) -> Void, updateGroupSound: @escaping (PeerMessageSound) -> Void, updateChannelAlerts: @escaping (Bool) -> Void, updateChannelPreviews: @escaping (Bool) -> Void, updateChannelSound: @escaping (PeerMessageSound) -> Void, updateInAppSounds: @escaping (Bool) -> Void, updateInAppVibration: @escaping (Bool) -> Void, updateInAppPreviews: @escaping (Bool) -> Void, updateDisplayNameOnLockscreen: @escaping (Bool) -> Void, updateTotalUnreadCountStyle: @escaping (Bool) -> Void, updateIncludeTag: @escaping (PeerSummaryCounterTags, Bool) -> Void, updateTotalUnreadCountCategory: @escaping (Bool) -> Void, resetNotifications: @escaping () -> Void, updatedExceptionMode: @escaping(NotificationExceptionMode) -> Void, openAppSettings: @escaping () -> Void, updateJoinedNotifications: @escaping (Bool) -> Void, updateNotificationsFromAllAccounts: @escaping (Bool) -> Void) { + init(context: AccountContext, presentController: @escaping (ViewController, ViewControllerPresentationArguments?) -> Void, pushController: @escaping(ViewController)->Void, soundSelectionDisposable: MetaDisposable, authorizeNotifications: @escaping () -> Void, suppressWarning: @escaping () -> Void, updateMessageAlerts: @escaping (Bool) -> Void, updateMessagePreviews: @escaping (Bool) -> Void, updateMessageSound: @escaping (PeerMessageSound) -> Void, updateGroupAlerts: @escaping (Bool) -> Void, updateGroupPreviews: @escaping (Bool) -> Void, updateGroupSound: @escaping (PeerMessageSound) -> Void, updateChannelAlerts: @escaping (Bool) -> Void, updateChannelPreviews: @escaping (Bool) -> Void, updateChannelSound: @escaping (PeerMessageSound) -> Void, updateInAppSounds: @escaping (Bool) -> Void, updateInAppVibration: @escaping (Bool) -> Void, updateInAppPreviews: @escaping (Bool) -> Void, updateDisplayNameOnLockscreen: @escaping (Bool) -> Void, updateTotalUnreadCountStyle: @escaping (Bool) -> Void, updateIncludeTag: @escaping (PeerSummaryCounterTags, Bool) -> Void, updateTotalUnreadCountCategory: @escaping (Bool) -> Void, resetNotifications: @escaping () -> Void, updatedExceptionMode: @escaping(NotificationExceptionMode) -> Void, openAppSettings: @escaping () -> Void, updateJoinedNotifications: @escaping (Bool) -> Void, updateNotificationsFromAllAccounts: @escaping (Bool) -> Void) { self.context = context self.presentController = presentController self.pushController = pushController @@ -803,7 +803,7 @@ private func notificationsAndSoundsEntries(authorizationStatus: AccessType, warn return entries } -public func notificationsAndSoundsController(context: AccountContextImpl, exceptionsList: NotificationExceptionsList?, focusOnItemTag: NotificationsAndSoundsEntryTag? = nil) -> ViewController { +public func notificationsAndSoundsController(context: AccountContext, exceptionsList: NotificationExceptionsList?, focusOnItemTag: NotificationsAndSoundsEntryTag? = nil) -> ViewController { var presentControllerImpl: ((ViewController, ViewControllerPresentationArguments?) -> Void)? var pushControllerImpl: ((ViewController) -> Void)? diff --git a/submodules/TelegramUI/TelegramUI/OpenAddContact.swift b/submodules/TelegramUI/TelegramUI/OpenAddContact.swift index b39dfd0f92..4985770196 100644 --- a/submodules/TelegramUI/TelegramUI/OpenAddContact.swift +++ b/submodules/TelegramUI/TelegramUI/OpenAddContact.swift @@ -3,8 +3,9 @@ import SwiftSignalKit import TelegramCore import Display import DeviceAccess +import AccountContext -func openAddContact(context: AccountContextImpl, firstName: String = "", lastName: String = "", phoneNumber: String, label: String = "_$!!$_", present: @escaping (ViewController, Any?) -> Void, pushController: @escaping (ViewController) -> Void, completed: @escaping () -> Void = {}) { +func openAddContact(context: AccountContext, firstName: String = "", lastName: String = "", phoneNumber: String, label: String = "_$!!$_", present: @escaping (ViewController, Any?) -> Void, pushController: @escaping (ViewController) -> Void, completed: @escaping () -> Void = {}) { let _ = (DeviceAccess.authorizationStatus(subject: .contacts) |> take(1) |> deliverOnMainQueue).start(next: { value in diff --git a/submodules/TelegramUI/TelegramUI/OpenChatMessage.swift b/submodules/TelegramUI/TelegramUI/OpenChatMessage.swift index 6693733f73..7cdc91857c 100644 --- a/submodules/TelegramUI/TelegramUI/OpenChatMessage.swift +++ b/submodules/TelegramUI/TelegramUI/OpenChatMessage.swift @@ -8,6 +8,7 @@ import PassKit import Lottie import TelegramUIPreferences import TelegramPresentationData +import AccountContext private enum ChatMessageGalleryControllerData { case url(String) @@ -24,7 +25,7 @@ private enum ChatMessageGalleryControllerData { case other(Media) } -private func chatMessageGalleryControllerData(context: AccountContextImpl, message: Message, navigationController: NavigationController?, standalone: Bool, reverseMessageGalleryOrder: Bool, mode: ChatControllerInteractionOpenMessageMode, synchronousLoad: Bool, actionInteraction: GalleryControllerActionInteraction?) -> ChatMessageGalleryControllerData? { +private func chatMessageGalleryControllerData(context: AccountContext, message: Message, navigationController: NavigationController?, standalone: Bool, reverseMessageGalleryOrder: Bool, mode: ChatControllerInteractionOpenMessageMode, synchronousLoad: Bool, actionInteraction: GalleryControllerActionInteraction?) -> ChatMessageGalleryControllerData? { var galleryMedia: Media? var otherMedia: Media? var instantPageMedia: (TelegramMediaWebpage, [InstantPageGalleryEntry])? @@ -179,7 +180,7 @@ enum ChatMessagePreviewControllerData { case gallery(GalleryController) } -func chatMessagePreviewControllerData(context: AccountContextImpl, message: Message, standalone: Bool, reverseMessageGalleryOrder: Bool, navigationController: NavigationController?) -> ChatMessagePreviewControllerData? { +func chatMessagePreviewControllerData(context: AccountContext, message: Message, standalone: Bool, reverseMessageGalleryOrder: Bool, navigationController: NavigationController?) -> ChatMessagePreviewControllerData? { if let mediaData = chatMessageGalleryControllerData(context: context, message: message, navigationController: navigationController, standalone: standalone, reverseMessageGalleryOrder: reverseMessageGalleryOrder, mode: .default, synchronousLoad: true, actionInteraction: nil) { switch mediaData { case let .gallery(gallery): @@ -193,17 +194,17 @@ func chatMessagePreviewControllerData(context: AccountContextImpl, message: Mess return nil } -func openChatMessage(context: AccountContextImpl, message: Message, standalone: Bool, reverseMessageGalleryOrder: Bool, mode: ChatControllerInteractionOpenMessageMode = .default, navigationController: NavigationController?, modal: Bool = false, dismissInput: @escaping () -> Void, present: @escaping (ViewController, Any?) -> Void, transitionNode: @escaping (MessageId, Media) -> (ASDisplayNode, () -> (UIView?, UIView?))?, addToTransitionSurface: @escaping (UIView) -> Void, openUrl: @escaping (String) -> Void, openPeer: @escaping (Peer, ChatControllerInteractionNavigateToPeer) -> Void, callPeer: @escaping (PeerId) -> Void, enqueueMessage: @escaping (EnqueueMessage) -> Void, sendSticker: ((FileMediaReference, ASDisplayNode, CGRect) -> Bool)?, setupTemporaryHiddenMedia: @escaping (Signal, Int, Media) -> Void, chatAvatarHiddenMedia: @escaping (Signal, Media) -> Void, actionInteraction: GalleryControllerActionInteraction? = nil) -> Bool { - if let mediaData = chatMessageGalleryControllerData(context: context, message: message, navigationController: navigationController, standalone: standalone, reverseMessageGalleryOrder: reverseMessageGalleryOrder, mode: mode, synchronousLoad: false, actionInteraction: actionInteraction) { +func openChatMessageImpl(_ params: OpenChatMessageParams) -> Bool { + if let mediaData = chatMessageGalleryControllerData(context: params.context, message: params.message, navigationController: params.navigationController, standalone: params.standalone, reverseMessageGalleryOrder: params.reverseMessageGalleryOrder, mode: params.mode, synchronousLoad: false, actionInteraction: params.actionInteraction) { switch mediaData { case let .url(url): - openUrl(url) + params.openUrl(url) return true case let .pass(file): - let _ = (context.account.postbox.mediaBox.resourceData(file.resource, option: .complete(waitUntilFetchStatus: true)) + let _ = (params.context.account.postbox.mediaBox.resourceData(file.resource, option: .complete(waitUntilFetchStatus: true)) |> take(1) |> deliverOnMainQueue).start(next: { data in - guard let navigationController = navigationController else { + guard let navigationController = params.navigationController else { return } if data.complete, let content = try? Data(contentsOf: URL(fileURLWithPath: data.path)) { @@ -218,104 +219,104 @@ func openChatMessage(context: AccountContextImpl, message: Message, standalone: }) return true case let .instantPage(gallery, centralIndex, galleryMedia): - setupTemporaryHiddenMedia(gallery.hiddenMedia, centralIndex, galleryMedia) + params.setupTemporaryHiddenMedia(gallery.hiddenMedia |> map { a -> Any? in a }, centralIndex, galleryMedia) - dismissInput() - present(gallery, InstantPageGalleryControllerPresentationArguments(transitionArguments: { entry in + params.dismissInput() + params.present(gallery, InstantPageGalleryControllerPresentationArguments(transitionArguments: { entry in var selectedTransitionNode: (ASDisplayNode, () -> (UIView?, UIView?))? if entry.index == centralIndex { - selectedTransitionNode = transitionNode(message.id, galleryMedia) + selectedTransitionNode = params.transitionNode(params.message.id, galleryMedia) } if let selectedTransitionNode = selectedTransitionNode { - return GalleryTransitionArguments(transitionNode: selectedTransitionNode, addToTransitionSurface: addToTransitionSurface) + return GalleryTransitionArguments(transitionNode: selectedTransitionNode, addToTransitionSurface: params.addToTransitionSurface) } return nil })) return true case let .map(mapMedia): - dismissInput() + params.dismissInput() - let controller = legacyLocationController(message: message, mapMedia: mapMedia, context: context, isModal: modal, openPeer: { peer in - openPeer(peer, .info) + let controller = legacyLocationController(message: params.message, mapMedia: mapMedia, context: params.context, isModal: params.modal, openPeer: { peer in + params.openPeer(peer, .info) }, sendLiveLocation: { coordinate, period in let outMessage: EnqueueMessage = .message(text: "", attributes: [], mediaReference: .standalone(media: TelegramMediaMap(latitude: coordinate.latitude, longitude: coordinate.longitude, geoPlace: nil, venue: nil, liveBroadcastingTimeout: period)), replyToMessageId: nil, localGroupingKey: nil) - enqueueMessage(outMessage) + params.enqueueMessage(outMessage) }, stopLiveLocation: { - context.liveLocationManager?.cancelLiveLocation(peerId: message.id.peerId) - }, openUrl: openUrl) + params.context.liveLocationManager?.cancelLiveLocation(peerId: params.message.id.peerId) + }, openUrl: params.openUrl) - if modal { - present(controller, nil) + if params.modal { + params.present(controller, nil) } else { - navigationController?.pushViewController(controller) + params.navigationController?.pushViewController(controller) } return true case let .stickerPack(reference): - let controller = StickerPackPreviewController(context: context, stickerPack: reference, parentNavigationController: navigationController) - controller.sendSticker = sendSticker - dismissInput() - present(controller, nil) + let controller = StickerPackPreviewController(context: params.context, stickerPack: reference, parentNavigationController: params.navigationController) + controller.sendSticker = params.sendSticker + params.dismissInput() + params.present(controller, nil) return true case let .document(file): - let presentationData = context.sharedContext.currentPresentationData.with { $0 } - if let rootController = navigationController?.view.window?.rootViewController { - presentDocumentPreviewController(rootController: rootController, theme: presentationData.theme, strings: presentationData.strings, postbox: context.account.postbox, file: file) + let presentationData = params.context.sharedContext.currentPresentationData.with { $0 } + if let rootController = params.navigationController?.view.window?.rootViewController { + presentDocumentPreviewController(rootController: rootController, theme: presentationData.theme, strings: presentationData.strings, postbox: params.context.account.postbox, file: file) } return true case let .audio(file): let location: PeerMessagesPlaylistLocation let playerType: MediaManagerPlayerType var control = SharedMediaPlayerControlAction.playback(.play) - if case let .timecode(time) = mode { + if case let .timecode(time) = params.mode { control = .seek(time) } - if (file.isVoice || file.isInstantVideo) && message.tags.contains(.voiceOrInstantVideo) { - if standalone { - location = .recentActions(message) + if (file.isVoice || file.isInstantVideo) && params.message.tags.contains(.voiceOrInstantVideo) { + if params.standalone { + location = .recentActions(params.message) } else { - location = .messages(peerId: message.id.peerId, tagMask: .voiceOrInstantVideo, at: message.id) + location = .messages(peerId: params.message.id.peerId, tagMask: .voiceOrInstantVideo, at: params.message.id) } playerType = .voice - } else if file.isMusic && message.tags.contains(.music) { - if standalone { - location = .recentActions(message) + } else if file.isMusic && params.message.tags.contains(.music) { + if params.standalone { + location = .recentActions(params.message) } else { - location = .messages(peerId: message.id.peerId, tagMask: .music, at: message.id) + location = .messages(peerId: params.message.id.peerId, tagMask: .music, at: params.message.id) } playerType = .music } else { - if standalone { - location = .recentActions(message) + if params.standalone { + location = .recentActions(params.message) } else { - location = .singleMessage(message.id) + location = .singleMessage(params.message.id) } playerType = (file.isVoice || file.isInstantVideo) ? .voice : .music } - context.sharedContext.mediaManager.setPlaylist((context.account, PeerMessagesMediaPlaylist(postbox: context.account.postbox, network: context.account.network, location: location)), type: playerType, control: control) + params.context.sharedContext.mediaManager.setPlaylist((params.context.account, PeerMessagesMediaPlaylist(postbox: params.context.account.postbox, network: params.context.account.network, location: location)), type: playerType, control: control) return true case let .gallery(gallery): - dismissInput() - present(gallery, GalleryControllerPresentationArguments(transitionArguments: { messageId, media in - let selectedTransitionNode = transitionNode(messageId, media) + params.dismissInput() + params.present(gallery, GalleryControllerPresentationArguments(transitionArguments: { messageId, media in + let selectedTransitionNode = params.transitionNode(messageId, media) if let selectedTransitionNode = selectedTransitionNode { - return GalleryTransitionArguments(transitionNode: selectedTransitionNode, addToTransitionSurface: addToTransitionSurface) + return GalleryTransitionArguments(transitionNode: selectedTransitionNode, addToTransitionSurface: params.addToTransitionSurface) } return nil })) return true case let .secretGallery(gallery): - dismissInput() - present(gallery, GalleryControllerPresentationArguments(transitionArguments: { messageId, media in - let selectedTransitionNode = transitionNode(messageId, media) + params.dismissInput() + params.present(gallery, GalleryControllerPresentationArguments(transitionArguments: { messageId, media in + let selectedTransitionNode = params.transitionNode(messageId, media) if let selectedTransitionNode = selectedTransitionNode { - return GalleryTransitionArguments(transitionNode: selectedTransitionNode, addToTransitionSurface: addToTransitionSurface) + return GalleryTransitionArguments(transitionNode: selectedTransitionNode, addToTransitionSurface: params.addToTransitionSurface) } return nil })) return true case let .other(otherMedia): if let contact = otherMedia as? TelegramMediaContact { - let _ = (context.account.postbox.transaction { transaction -> (Peer?, Bool?) in + let _ = (params.context.account.postbox.transaction { transaction -> (Peer?, Bool?) in if let peerId = contact.peerId { return (transaction.getPeer(peerId), transaction.isPeerContact(peerId: peerId)) } else { @@ -328,36 +329,36 @@ func openChatMessage(context: AccountContextImpl, message: Message, standalone: } else { contactData = DeviceContactExtendedData(basicData: DeviceContactBasicData(firstName: contact.firstName, lastName: contact.lastName, phoneNumbers: [DeviceContactPhoneNumberData(label: "_$!!$_", value: contact.phoneNumber)]), middleName: "", prefix: "", suffix: "", organization: "", jobTitle: "", department: "", emailAddresses: [], urls: [], addresses: [], birthdayDate: nil, socialProfiles: [], instantMessagingProfiles: []) } - let controller = deviceContactInfoController(context: context, subject: .vcard(peer, nil, contactData)) - navigationController?.pushViewController(controller) + let controller = deviceContactInfoController(context: params.context, subject: .vcard(peer, nil, contactData)) + params.navigationController?.pushViewController(controller) }) return true } case let .chatAvatars(controller, media): - dismissInput() - chatAvatarHiddenMedia(controller.hiddenMedia |> map { value -> MessageId? in + params.dismissInput() + params.chatAvatarHiddenMedia(controller.hiddenMedia |> map { value -> MessageId? in if value != nil { - return message.id + return params.message.id } else { return nil } }, media) - present(controller, AvatarGalleryControllerPresentationArguments(transitionArguments: { entry in - if let selectedTransitionNode = transitionNode(message.id, media) { - return GalleryTransitionArguments(transitionNode: selectedTransitionNode, addToTransitionSurface: addToTransitionSurface) + params.present(controller, AvatarGalleryControllerPresentationArguments(transitionArguments: { entry in + if let selectedTransitionNode = params.transitionNode(params.message.id, media) { + return GalleryTransitionArguments(transitionNode: selectedTransitionNode, addToTransitionSurface: params.addToTransitionSurface) } return nil })) case let .theme(media): - let controller = ThemePreviewController(context: context, previewTheme: makeDefaultDayPresentationTheme(accentColor: nil, serviceBackgroundColor: .black, baseColor: nil, day: true, preview: false), media: .message(message: MessageReference(message), media: media)) - present(controller, ViewControllerPresentationArguments(presentationAnimation: .modalSheet)) + let controller = ThemePreviewController(context: params.context, previewTheme: makeDefaultDayPresentationTheme(accentColor: nil, serviceBackgroundColor: .black, baseColor: nil, day: true, preview: false), media: .message(message: MessageReference(params.message), media: media)) + params.present(controller, ViewControllerPresentationArguments(presentationAnimation: .modalSheet)) } } return false } -func openChatInstantPage(context: AccountContextImpl, message: Message, sourcePeerType: MediaAutoDownloadPeerType?, navigationController: NavigationController) { +func openChatInstantPage(context: AccountContext, message: Message, sourcePeerType: MediaAutoDownloadPeerType?, navigationController: NavigationController) { for media in message.media { if let webpage = media as? TelegramMediaWebpage, case let .Loaded(content) = webpage.content { if let _ = content.instantPage { @@ -407,7 +408,7 @@ func openChatInstantPage(context: AccountContextImpl, message: Message, sourcePe } } -func openChatWallpaper(context: AccountContextImpl, message: Message, present: @escaping (ViewController, Any?) -> Void) { +func openChatWallpaper(context: AccountContext, message: Message, present: @escaping (ViewController, Any?) -> Void) { for media in message.media { if let webpage = media as? TelegramMediaWebpage, case let .Loaded(content) = webpage.content { let _ = (resolveUrl(account: context.account, url: content.url) diff --git a/submodules/TelegramUI/TelegramUI/OpenInActionSheetController.swift b/submodules/TelegramUI/TelegramUI/OpenInActionSheetController.swift index ba6fc7534a..7a82be4e6d 100644 --- a/submodules/TelegramUI/TelegramUI/OpenInActionSheetController.swift +++ b/submodules/TelegramUI/TelegramUI/OpenInActionSheetController.swift @@ -7,6 +7,7 @@ import Postbox import TelegramCore import MapKit import TelegramPresentationData +import AccountContext public struct OpenInControllerAction { let title: String @@ -21,7 +22,7 @@ final class OpenInActionSheetController: ActionSheetController { return self._ready } - init(context: AccountContextImpl, item: OpenInItem, additionalAction: OpenInControllerAction? = nil, openUrl: @escaping (String) -> Void) { + init(context: AccountContext, item: OpenInItem, additionalAction: OpenInControllerAction? = nil, openUrl: @escaping (String) -> Void) { let presentationData = context.sharedContext.currentPresentationData.with { $0 } let theme = presentationData.theme let strings = presentationData.strings @@ -86,12 +87,12 @@ final class OpenInActionSheetController: ActionSheetController { private final class OpenInActionSheetItem: ActionSheetItem { let postbox: Postbox - let context: AccountContextImpl + let context: AccountContext let strings: PresentationStrings let options: [OpenInOption] let invokeAction: (OpenInAction) -> Void - init(postbox: Postbox, context: AccountContextImpl, strings: PresentationStrings, options: [OpenInOption], invokeAction: @escaping (OpenInAction) -> Void) { + init(postbox: Postbox, context: AccountContext, strings: PresentationStrings, options: [OpenInOption], invokeAction: @escaping (OpenInAction) -> Void) { self.postbox = postbox self.context = context self.strings = strings @@ -119,7 +120,7 @@ private final class OpenInActionSheetItemNode: ActionSheetItemNode { let openInNodes: [OpenInAppNode] - init(postbox: Postbox, context: AccountContextImpl, theme: ActionSheetControllerTheme, strings: PresentationStrings, options: [OpenInOption], invokeAction: @escaping (OpenInAction) -> Void) { + init(postbox: Postbox, context: AccountContext, theme: ActionSheetControllerTheme, strings: PresentationStrings, options: [OpenInOption], invokeAction: @escaping (OpenInAction) -> Void) { self.theme = theme self.strings = strings @@ -206,7 +207,7 @@ private final class OpenInAppNode : ASDisplayNode { self.addSubnode(self.textNode) } - func setup(postbox: Postbox, context: AccountContextImpl, theme: ActionSheetControllerTheme, option: OpenInOption, invokeAction: @escaping (OpenInAction) -> Void) { + func setup(postbox: Postbox, context: AccountContext, theme: ActionSheetControllerTheme, option: OpenInOption, invokeAction: @escaping (OpenInAction) -> Void) { self.textNode.attributedText = NSAttributedString(string: option.title, font: textFont, textColor: theme.primaryTextColor, paragraphAlignment: .center) let iconSize = CGSize(width: 60.0, height: 60.0) diff --git a/submodules/TelegramUI/TelegramUI/OpenInOptions.swift b/submodules/TelegramUI/TelegramUI/OpenInOptions.swift index 0cc35bd781..b778a07726 100644 --- a/submodules/TelegramUI/TelegramUI/OpenInOptions.swift +++ b/submodules/TelegramUI/TelegramUI/OpenInOptions.swift @@ -3,6 +3,7 @@ import UIKit import TelegramCore import CoreLocation import MapKit +import AccountContext enum OpenInItem { case url(url: String) @@ -44,7 +45,7 @@ final class OpenInOption { } } -func availableOpenInOptions(context: AccountContextImpl, item: OpenInItem) -> [OpenInOption] { +func availableOpenInOptions(context: AccountContext, item: OpenInItem) -> [OpenInOption] { return allOpenInOptions(context: context, item: item).filter { option in if case let .other(_, _, scheme, _) = option.application { return context.sharedContext.applicationBindings.canOpenUrl("\(scheme)://") @@ -54,7 +55,7 @@ func availableOpenInOptions(context: AccountContextImpl, item: OpenInItem) -> [O } } -private func allOpenInOptions(context: AccountContextImpl, item: OpenInItem) -> [OpenInOption] { +private func allOpenInOptions(context: AccountContext, item: OpenInItem) -> [OpenInOption] { var options: [OpenInOption] = [] switch item { case let .url(url): diff --git a/submodules/TelegramUI/TelegramUI/OpenResolvedUrl.swift b/submodules/TelegramUI/TelegramUI/OpenResolvedUrl.swift index 1110bb1c42..002161aa5c 100644 --- a/submodules/TelegramUI/TelegramUI/OpenResolvedUrl.swift +++ b/submodules/TelegramUI/TelegramUI/OpenResolvedUrl.swift @@ -5,6 +5,8 @@ import Postbox import Display import SwiftSignalKit import TelegramUIPreferences +import AccountContext +import OverlayStatusController private func defaultNavigationForPeerId(_ peerId: PeerId?, navigation: ChatControllerInteractionNavigateToPeer) -> ChatControllerInteractionNavigateToPeer { if case .default = navigation { @@ -22,7 +24,7 @@ private func defaultNavigationForPeerId(_ peerId: PeerId?, navigation: ChatContr } } -func openResolvedUrl(_ resolvedUrl: ResolvedUrl, context: AccountContextImpl, urlContext: OpenURLContext = .generic, navigationController: NavigationController?, openPeer: @escaping (PeerId, ChatControllerInteractionNavigateToPeer) -> Void, sendFile: ((FileMediaReference) -> Void)? = nil, sendSticker: ((FileMediaReference, ASDisplayNode, CGRect) -> Bool)? = nil, present: @escaping (ViewController, Any?) -> Void, dismissInput: @escaping () -> Void) { +func openResolvedUrl(_ resolvedUrl: ResolvedUrl, context: AccountContext, urlContext: OpenURLContext = .generic, navigationController: NavigationController?, openPeer: @escaping (PeerId, ChatControllerInteractionNavigateToPeer) -> Void, sendFile: ((FileMediaReference) -> Void)? = nil, sendSticker: ((FileMediaReference, ASDisplayNode, CGRect) -> Bool)? = nil, present: @escaping (ViewController, Any?) -> Void, dismissInput: @escaping () -> Void) { let presentationData = context.sharedContext.currentPresentationData.with { $0 } switch resolvedUrl { case let .externalUrl(url): diff --git a/submodules/TelegramUI/TelegramUI/OpenSettings.swift b/submodules/TelegramUI/TelegramUI/OpenSettings.swift index 8f5455567f..833459e1c2 100644 --- a/submodules/TelegramUI/TelegramUI/OpenSettings.swift +++ b/submodules/TelegramUI/TelegramUI/OpenSettings.swift @@ -3,10 +3,12 @@ import Display import SwiftSignalKit import Postbox import TelegramCore +import OverlayStatusController +import AccountContext private let maximumNumberOfAccounts = 3 -func openEditSettings(context: AccountContextImpl, accountsAndPeers: Signal<((Account, Peer)?, [(Account, Peer, Int32)]), NoError>, focusOnItemTag: EditSettingsEntryTag? = nil, presentController: @escaping (ViewController, Any?) -> Void, pushController: @escaping (ViewController) -> Void) -> Disposable { +func openEditSettings(context: AccountContext, accountsAndPeers: Signal<((Account, Peer)?, [(Account, Peer, Int32)]), NoError>, focusOnItemTag: EditSettingsEntryTag? = nil, presentController: @escaping (ViewController, Any?) -> Void, pushController: @escaping (ViewController) -> Void) -> Disposable { let openEditingDisposable = MetaDisposable() var cancelImpl: (() -> Void)? let presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/OpenUrl.swift b/submodules/TelegramUI/TelegramUI/OpenUrl.swift index 8bebf26b2a..3eae0242b1 100644 --- a/submodules/TelegramUI/TelegramUI/OpenUrl.swift +++ b/submodules/TelegramUI/TelegramUI/OpenUrl.swift @@ -140,7 +140,7 @@ public enum OpenURLContext { case chat } -public func openExternalUrl(context: AccountContextImpl, urlContext: OpenURLContext = .generic, url: String, forceExternal: Bool = false, presentationData: PresentationData, navigationController: NavigationController?, dismissInput: @escaping () -> Void) { +public func openExternalUrl(context: AccountContext, urlContext: OpenURLContext = .generic, url: String, forceExternal: Bool = false, presentationData: PresentationData, navigationController: NavigationController?, dismissInput: @escaping () -> Void) { if forceExternal || url.lowercased().hasPrefix("tel:") || url.lowercased().hasPrefix("calshow:") { context.sharedContext.applicationBindings.openUrl(url) return diff --git a/submodules/TelegramUI/TelegramUI/OverlayPlayerController.swift b/submodules/TelegramUI/TelegramUI/OverlayAudioPlayerController.swift similarity index 82% rename from submodules/TelegramUI/TelegramUI/OverlayPlayerController.swift rename to submodules/TelegramUI/TelegramUI/OverlayAudioPlayerController.swift index f67b492a9c..32ea5cc2b6 100644 --- a/submodules/TelegramUI/TelegramUI/OverlayPlayerController.swift +++ b/submodules/TelegramUI/TelegramUI/OverlayAudioPlayerController.swift @@ -5,9 +5,10 @@ import Postbox import Display import SwiftSignalKit import TelegramUIPreferences +import AccountContext -final class OverlayPlayerController: ViewController { - private let context: AccountContextImpl +final class OverlayAudioPlayerControllerImpl: ViewController, OverlayAudioPlayerController { + private let context: AccountContext let peerId: PeerId let type: MediaManagerPlayerType let initialMessageId: MessageId @@ -17,13 +18,13 @@ final class OverlayPlayerController: ViewController { private var animatedIn = false - private var controllerNode: OverlayPlayerControllerNode { - return self.displayNode as! OverlayPlayerControllerNode + private var controllerNode: OverlayAudioPlayerControllerNode { + return self.displayNode as! OverlayAudioPlayerControllerNode } private var accountInUseDisposable: Disposable? - init(context: AccountContextImpl, peerId: PeerId, type: MediaManagerPlayerType, initialMessageId: MessageId, initialOrder: MusicPlaybackSettingsOrder, parentNavigationController: NavigationController?) { + init(context: AccountContext, peerId: PeerId, type: MediaManagerPlayerType, initialMessageId: MessageId, initialOrder: MusicPlaybackSettingsOrder, parentNavigationController: NavigationController?) { self.context = context self.peerId = peerId self.type = type @@ -49,7 +50,7 @@ final class OverlayPlayerController: ViewController { } override public func loadDisplayNode() { - self.displayNode = OverlayPlayerControllerNode(context: self.context, peerId: self.peerId, type: self.type, initialMessageId: self.initialMessageId, initialOrder: self.initialOrder, requestDismiss: { [weak self] in + self.displayNode = OverlayAudioPlayerControllerNode(context: self.context, peerId: self.peerId, type: self.type, initialMessageId: self.initialMessageId, initialOrder: self.initialOrder, requestDismiss: { [weak self] in self?.dismiss() }, requestShare: { [weak self] messageId in if let strongSelf = self { diff --git a/submodules/TelegramUI/TelegramUI/OverlayInstantVideoDecoration.swift b/submodules/TelegramUI/TelegramUI/OverlayInstantVideoDecoration.swift index 45ad8982e5..2b9f365df3 100644 --- a/submodules/TelegramUI/TelegramUI/OverlayInstantVideoDecoration.swift +++ b/submodules/TelegramUI/TelegramUI/OverlayInstantVideoDecoration.swift @@ -4,6 +4,7 @@ import AsyncDisplayKit import Display import SwiftSignalKit import UniversalMediaPlayer +import AccountContext private let backgroundImage = UIImage(bundleImageName: "Chat/Message/OverlayInstantVideoShadow")?.precomposed() diff --git a/submodules/TelegramUI/TelegramUI/OverlayInstantVideoNode.swift b/submodules/TelegramUI/TelegramUI/OverlayInstantVideoNode.swift index 96219aa914..b837d81a20 100644 --- a/submodules/TelegramUI/TelegramUI/OverlayInstantVideoNode.swift +++ b/submodules/TelegramUI/TelegramUI/OverlayInstantVideoNode.swift @@ -9,6 +9,7 @@ import TelegramPresentationData import UniversalMediaPlayer import TelegramUIPreferences import TelegramAudio +import AccountContext final class OverlayInstantVideoNode: OverlayMediaItemNode { private let content: UniversalVideoContent @@ -39,7 +40,7 @@ final class OverlayInstantVideoNode: OverlayMediaItemNode { var playbackEnded: (() -> Void)? - init(postbox: Postbox, audioSession: ManagedAudioSession, manager: UniversalVideoContentManager, content: UniversalVideoContent, close: @escaping () -> Void) { + init(postbox: Postbox, audioSession: ManagedAudioSession, manager: UniversalVideoManager, content: UniversalVideoContent, close: @escaping () -> Void) { self.close = close self.content = content var togglePlayPauseImpl: (() -> Void)? diff --git a/submodules/TelegramUI/TelegramUI/OverlayMediaController.swift b/submodules/TelegramUI/TelegramUI/OverlayMediaController.swift index dbdd09b488..a4f358ebe9 100644 --- a/submodules/TelegramUI/TelegramUI/OverlayMediaController.swift +++ b/submodules/TelegramUI/TelegramUI/OverlayMediaController.swift @@ -4,8 +4,9 @@ import Display import AsyncDisplayKit import SwiftSignalKit import Postbox +import AccountContext -public final class OverlayMediaController: ViewController { +public final class OverlayMediaControllerImpl: ViewController, OverlayMediaController { private var controllerNode: OverlayMediaControllerNode { return self.displayNode as! OverlayMediaControllerNode } @@ -25,15 +26,15 @@ public final class OverlayMediaController: ViewController { self.displayNodeDidLoad() } - var hasNodes: Bool { + public var hasNodes: Bool { return self.controllerNode.hasNodes } - func addNode(_ node: OverlayMediaItemNode, customTransition: Bool = false) { + public func addNode(_ node: OverlayMediaItemNode, customTransition: Bool) { self.controllerNode.addNode(node, customTransition: customTransition) } - func removeNode(_ node: OverlayMediaItemNode, customTransition: Bool = false) { + public func removeNode(_ node: OverlayMediaItemNode, customTransition: Bool) { self.controllerNode.removeNode(node, customTransition: customTransition) } diff --git a/submodules/TelegramUI/TelegramUI/OverlayMediaControllerNode.swift b/submodules/TelegramUI/TelegramUI/OverlayMediaControllerNode.swift index 9b3943835b..193bcd9906 100644 --- a/submodules/TelegramUI/TelegramUI/OverlayMediaControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/OverlayMediaControllerNode.swift @@ -4,6 +4,7 @@ import Display import AsyncDisplayKit import SwiftSignalKit import Postbox +import AccountContext private final class OverlayMediaControllerNodeView: UITracingLayerView { var hitTestImpl: ((CGPoint, UIEvent?) -> UIView?)? diff --git a/submodules/TelegramUI/TelegramUI/OverlayMediaItemNode.swift b/submodules/TelegramUI/TelegramUI/OverlayMediaItemNode.swift deleted file mode 100644 index a65659b71d..0000000000 --- a/submodules/TelegramUI/TelegramUI/OverlayMediaItemNode.swift +++ /dev/null @@ -1,65 +0,0 @@ -import Foundation -import UIKit -import AsyncDisplayKit - -struct OverlayMediaItemNodeGroup: Hashable, RawRepresentable { - var rawValue: Int32 - - init(rawValue: Int32) { - self.rawValue = rawValue - } - - var hashValue: Int { - return self.rawValue.hashValue - } -} - -enum OverlayMediaItemMinimizationEdge { - case left - case right -} - -class OverlayMediaItemNode: ASDisplayNode { - var hasAttachedContextUpdated: ((Bool) -> Void)? - var hasAttachedContext: Bool = false - - var unminimize: (() -> Void)? - - var group: OverlayMediaItemNodeGroup? { - return nil - } - - var tempExtendedTopInset: Bool { - return false - } - - var isMinimizeable: Bool { - return false - } - - var customTransition: Bool = false - - func setShouldAcquireContext(_ value: Bool) { - } - - func preferredSizeForOverlayDisplay() -> CGSize { - return CGSize(width: 50.0, height: 50.0) - } - - func updateLayout(_ size: CGSize) { - } - - func dismiss() { - } - - func updateMinimizedEdge(_ edge: OverlayMediaItemMinimizationEdge?, adjusting: Bool) { - } - - func performCustomTransitionIn() -> Bool { - return false - } - - func performCustomTransitionOut() -> Bool { - return false - } -} diff --git a/submodules/TelegramUI/TelegramUI/OverlayMediaManager.swift b/submodules/TelegramUI/TelegramUI/OverlayMediaManager.swift deleted file mode 100644 index 966b41c485..0000000000 --- a/submodules/TelegramUI/TelegramUI/OverlayMediaManager.swift +++ /dev/null @@ -1,9 +0,0 @@ -import Foundation - -public final class OverlayMediaManager { - public var controller: OverlayMediaController? - - public func attachOverlayMediaController(_ controller: OverlayMediaController) { - self.controller = controller - } -} diff --git a/submodules/TelegramUI/TelegramUI/OverlayPlayerControllerNode.swift b/submodules/TelegramUI/TelegramUI/OverlayPlayerControllerNode.swift index 53d89b9773..9cf8307f7d 100644 --- a/submodules/TelegramUI/TelegramUI/OverlayPlayerControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/OverlayPlayerControllerNode.swift @@ -7,11 +7,12 @@ import Postbox import TelegramCore import TelegramPresentationData import TelegramUIPreferences +import AccountContext -final class OverlayPlayerControllerNode: ViewControllerTracingNode, UIGestureRecognizerDelegate { +final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, UIGestureRecognizerDelegate { let ready = Promise() - private let context: AccountContextImpl + private let context: AccountContext private let peerId: PeerId private var presentationData: PresentationData private let type: MediaManagerPlayerType @@ -37,7 +38,7 @@ final class OverlayPlayerControllerNode: ViewControllerTracingNode, UIGestureRec private var presentationDataDisposable: Disposable? private let replacementHistoryNodeReadyDisposable = MetaDisposable() - init(context: AccountContextImpl, peerId: PeerId, type: MediaManagerPlayerType, initialMessageId: MessageId, initialOrder: MusicPlaybackSettingsOrder, requestDismiss: @escaping () -> Void, requestShare: @escaping (MessageId) -> Void) { + init(context: AccountContext, peerId: PeerId, type: MediaManagerPlayerType, initialMessageId: MessageId, initialOrder: MusicPlaybackSettingsOrder, requestDismiss: @escaping () -> Void, requestShare: @escaping (MessageId) -> Void) { self.context = context self.peerId = peerId self.presentationData = context.sharedContext.currentPresentationData.with { $0 } @@ -194,7 +195,7 @@ final class OverlayPlayerControllerNode: ViewControllerTracingNode, UIGestureRec openMessageImpl = { [weak self] id in if let strongSelf = self, strongSelf.isNodeLoaded, let message = strongSelf.historyNode.messageInCurrentHistoryView(id) { - return openChatMessage(context: strongSelf.context, message: message, standalone: false, reverseMessageGalleryOrder: false, navigationController: nil, dismissInput: { }, present: { _, _ in }, transitionNode: { _, _ in return nil }, addToTransitionSurface: { _ in }, openUrl: { _ in }, openPeer: { _, _ in }, callPeer: { _ in }, enqueueMessage: { _ in }, sendSticker: nil, setupTemporaryHiddenMedia: { _, _, _ in }, chatAvatarHiddenMedia: { _, _ in}) + return strongSelf.context.sharedContext.openChatMessage(OpenChatMessageParams(context: strongSelf.context, message: message, standalone: false, reverseMessageGalleryOrder: false, navigationController: nil, dismissInput: { }, present: { _, _ in }, transitionNode: { _, _ in return nil }, addToTransitionSurface: { _ in }, openUrl: { _ in }, openPeer: { _, _ in }, callPeer: { _ in }, enqueueMessage: { _ in }, sendSticker: nil, setupTemporaryHiddenMedia: { _, _, _ in }, chatAvatarHiddenMedia: { _, _ in })) } return false } diff --git a/submodules/TelegramUI/TelegramUI/OverlayPlayerControlsNode.swift b/submodules/TelegramUI/TelegramUI/OverlayPlayerControlsNode.swift index 13848820cb..394de12832 100644 --- a/submodules/TelegramUI/TelegramUI/OverlayPlayerControlsNode.swift +++ b/submodules/TelegramUI/TelegramUI/OverlayPlayerControlsNode.swift @@ -8,6 +8,7 @@ import SwiftSignalKit import TelegramPresentationData import UniversalMediaPlayer import TelegramUIPreferences +import AccountContext private func generateBackground(theme: PresentationTheme) -> UIImage? { return generateImage(CGSize(width: 20.0, height: 10.0 + 8.0), rotatedContext: { size, context in diff --git a/submodules/TelegramUI/TelegramUI/OverlayUniversalVideoNode.swift b/submodules/TelegramUI/TelegramUI/OverlayUniversalVideoNode.swift index 178ade029b..c4b09ebbb0 100644 --- a/submodules/TelegramUI/TelegramUI/OverlayUniversalVideoNode.swift +++ b/submodules/TelegramUI/TelegramUI/OverlayUniversalVideoNode.swift @@ -6,6 +6,7 @@ import Display import TelegramCore import Postbox import TelegramAudio +import AccountContext final class OverlayUniversalVideoNode: OverlayMediaItemNode { private let content: UniversalVideoContent @@ -28,7 +29,7 @@ final class OverlayUniversalVideoNode: OverlayMediaItemNode { } } - init(postbox: Postbox, audioSession: ManagedAudioSession, manager: UniversalVideoContentManager, content: UniversalVideoContent, expand: @escaping () -> Void, close: @escaping () -> Void) { + init(postbox: Postbox, audioSession: ManagedAudioSession, manager: UniversalVideoManager, content: UniversalVideoContent, expand: @escaping () -> Void, close: @escaping () -> Void) { self.content = content var unminimizeImpl: (() -> Void)? var togglePlayPauseImpl: (() -> Void)? diff --git a/submodules/TelegramUI/TelegramUI/OverlayVideoDecoration.swift b/submodules/TelegramUI/TelegramUI/OverlayVideoDecoration.swift index 6e87779c66..616942cc8d 100644 --- a/submodules/TelegramUI/TelegramUI/OverlayVideoDecoration.swift +++ b/submodules/TelegramUI/TelegramUI/OverlayVideoDecoration.swift @@ -5,6 +5,7 @@ import Display import SwiftSignalKit import UniversalMediaPlayer import LegacyComponents +import AccountContext private func setupArrowFrame(size: CGSize, edge: OverlayMediaItemMinimizationEdge, view: TGEmbedPIPPullArrowView) { let arrowX: CGFloat diff --git a/submodules/TelegramUI/TelegramUI/PaneSearchContainerNode.swift b/submodules/TelegramUI/TelegramUI/PaneSearchContainerNode.swift index 8fc09763bc..ddd7ae64ca 100644 --- a/submodules/TelegramUI/TelegramUI/PaneSearchContainerNode.swift +++ b/submodules/TelegramUI/TelegramUI/PaneSearchContainerNode.swift @@ -6,6 +6,7 @@ import SwiftSignalKit import Postbox import TelegramCore import TelegramPresentationData +import AccountContext private let searchBarHeight: CGFloat = 52.0 @@ -26,7 +27,7 @@ protocol PaneSearchContentNode { } final class PaneSearchContainerNode: ASDisplayNode { - private let context: AccountContextImpl + private let context: AccountContext private let mode: ChatMediaInputSearchMode public private(set) var contentNode: PaneSearchContentNode & ASDisplayNode private let controllerInteraction: ChatControllerInteraction @@ -41,7 +42,7 @@ final class PaneSearchContainerNode: ASDisplayNode { return self.contentNode.ready } - init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings, controllerInteraction: ChatControllerInteraction, inputNodeInteraction: ChatMediaInputNodeInteraction, mode: ChatMediaInputSearchMode, trendingGifsPromise: Promise<[FileMediaReference]?>, cancel: @escaping () -> Void) { + init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, controllerInteraction: ChatControllerInteraction, inputNodeInteraction: ChatMediaInputNodeInteraction, mode: ChatMediaInputSearchMode, trendingGifsPromise: Promise<[FileMediaReference]?>, cancel: @escaping () -> Void) { self.context = context self.mode = mode self.controllerInteraction = controllerInteraction diff --git a/submodules/TelegramUI/TelegramUI/PasscodeEntryController.swift b/submodules/TelegramUI/TelegramUI/PasscodeEntryController.swift index be79aa49c2..6c7a31de86 100644 --- a/submodules/TelegramUI/TelegramUI/PasscodeEntryController.swift +++ b/submodules/TelegramUI/TelegramUI/PasscodeEntryController.swift @@ -6,6 +6,7 @@ import SwiftSignalKit import Postbox import TelegramPresentationData import TelegramUIPreferences +import AccountContext final public class PasscodeEntryControllerPresentationArguments { let animated: Bool @@ -31,7 +32,7 @@ final public class PasscodeEntryController: ViewController { return self.displayNode as! PasscodeEntryControllerNode } - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private var presentationDataDisposable: Disposable? @@ -49,7 +50,7 @@ final public class PasscodeEntryController: ViewController { private var inBackground: Bool = false private var inBackgroundDisposable: Disposable? - public init(context: AccountContextImpl, challengeData: PostboxAccessChallengeData, biometrics: PasscodeEntryControllerBiometricsMode, arguments: PasscodeEntryControllerPresentationArguments) { + public init(context: AccountContext, challengeData: PostboxAccessChallengeData, biometrics: PasscodeEntryControllerBiometricsMode, arguments: PasscodeEntryControllerPresentationArguments) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } self.challengeData = challengeData diff --git a/submodules/TelegramUI/TelegramUI/PasscodeEntryControllerNode.swift b/submodules/TelegramUI/TelegramUI/PasscodeEntryControllerNode.swift index 9450e0e924..05b5f86dda 100644 --- a/submodules/TelegramUI/TelegramUI/PasscodeEntryControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/PasscodeEntryControllerNode.swift @@ -6,13 +6,14 @@ import SwiftSignalKit import Postbox import TelegramCore import TelegramPresentationData +import AccountContext private let titleFont = Font.regular(20.0) private let subtitleFont = Font.regular(15.0) private let buttonFont = Font.regular(17.0) final class PasscodeEntryControllerNode: ASDisplayNode { - private let context: AccountContextImpl + private let context: AccountContext private var theme: PresentationTheme private var strings: PresentationStrings private var wallpaper: TelegramWallpaper @@ -44,7 +45,7 @@ final class PasscodeEntryControllerNode: ASDisplayNode { var checkPasscode: ((String) -> Void)? var requestBiometrics: (() -> Void)? - init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings, wallpaper: TelegramWallpaper, passcodeType: PasscodeEntryFieldType, biometricsType: LocalAuthBiometricAuthentication?, arguments: PasscodeEntryControllerPresentationArguments, statusBar: StatusBar) { + init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, wallpaper: TelegramWallpaper, passcodeType: PasscodeEntryFieldType, biometricsType: LocalAuthBiometricAuthentication?, arguments: PasscodeEntryControllerPresentationArguments, statusBar: StatusBar) { self.context = context self.theme = theme self.strings = strings diff --git a/submodules/TelegramUI/TelegramUI/PasscodeOptionsController.swift b/submodules/TelegramUI/TelegramUI/PasscodeOptionsController.swift index d2bb122343..b5974fa931 100644 --- a/submodules/TelegramUI/TelegramUI/PasscodeOptionsController.swift +++ b/submodules/TelegramUI/TelegramUI/PasscodeOptionsController.swift @@ -9,6 +9,7 @@ import LocalAuthentication import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext private final class PasscodeOptionsControllerArguments { let turnPasscodeOff: () -> Void @@ -199,7 +200,7 @@ private func passcodeOptionsControllerEntries(presentationData: PresentationData return entries } -func passcodeOptionsController(context: AccountContextImpl) -> ViewController { +func passcodeOptionsController(context: AccountContext) -> ViewController { let initialState = PasscodeOptionsControllerState() let statePromise = ValuePromise(initialState, ignoreRepeated: true) @@ -383,7 +384,7 @@ func passcodeOptionsController(context: AccountContextImpl) -> ViewController { return controller } -public func passcodeOptionsAccessController(context: AccountContextImpl, animateIn: Bool = true, pushController: ((ViewController) -> Void)?, completion: @escaping (Bool) -> Void) -> Signal { +public func passcodeOptionsAccessController(context: AccountContext, animateIn: Bool = true, pushController: ((ViewController) -> Void)?, completion: @escaping (Bool) -> Void) -> Signal { return context.sharedContext.accountManager.transaction { transaction -> PostboxAccessChallengeData in return transaction.getAccessChallengeData() } @@ -437,7 +438,7 @@ public func passcodeOptionsAccessController(context: AccountContextImpl, animate } } -public func passcodeEntryController(context: AccountContextImpl, animateIn: Bool = true, completion: @escaping (Bool) -> Void) -> Signal { +public func passcodeEntryController(context: AccountContext, animateIn: Bool = true, completion: @escaping (Bool) -> Void) -> Signal { return context.sharedContext.accountManager.transaction { transaction -> PostboxAccessChallengeData in return transaction.getAccessChallengeData() } diff --git a/submodules/TelegramUI/TelegramUI/PasscodeSetupController.swift b/submodules/TelegramUI/TelegramUI/PasscodeSetupController.swift index 13b32dd987..7db159bdf0 100644 --- a/submodules/TelegramUI/TelegramUI/PasscodeSetupController.swift +++ b/submodules/TelegramUI/TelegramUI/PasscodeSetupController.swift @@ -6,6 +6,7 @@ import TelegramCore import SwiftSignalKit import Postbox import TelegramPresentationData +import AccountContext enum PasscodeSetupControllerMode { case setup(change: Bool, PasscodeEntryFieldType) @@ -17,7 +18,7 @@ final class PasscodeSetupController: ViewController { return self.displayNode as! PasscodeSetupControllerNode } - private let context: AccountContextImpl + private let context: AccountContext private var mode: PasscodeSetupControllerMode var complete: ((String, Bool) -> Void)? @@ -29,7 +30,7 @@ final class PasscodeSetupController: ViewController { private var nextAction: UIBarButtonItem? - init(context: AccountContextImpl, mode: PasscodeSetupControllerMode) { + init(context: AccountContext, mode: PasscodeSetupControllerMode) { self.context = context self.mode = mode self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/PeerAvatarImageGalleryItem.swift b/submodules/TelegramUI/TelegramUI/PeerAvatarImageGalleryItem.swift index 63119cb595..41e8895051 100644 --- a/submodules/TelegramUI/TelegramUI/PeerAvatarImageGalleryItem.swift +++ b/submodules/TelegramUI/TelegramUI/PeerAvatarImageGalleryItem.swift @@ -6,6 +6,7 @@ import SwiftSignalKit import Postbox import TelegramCore import TelegramPresentationData +import AccountContext private struct PeerAvatarImageGalleryThumbnailItem: GalleryThumbnailItem { let account: Account @@ -36,13 +37,13 @@ private struct PeerAvatarImageGalleryThumbnailItem: GalleryThumbnailItem { } class PeerAvatarImageGalleryItem: GalleryItem { - let context: AccountContextImpl + let context: AccountContext let peer: Peer let presentationData: PresentationData let entry: AvatarGalleryEntry let delete: (() -> Void)? - init(context: AccountContextImpl, peer: Peer, presentationData: PresentationData, entry: AvatarGalleryEntry, delete: (() -> Void)?) { + init(context: AccountContext, peer: Peer, presentationData: PresentationData, entry: AvatarGalleryEntry, delete: (() -> Void)?) { self.context = context self.peer = peer self.presentationData = presentationData @@ -88,7 +89,7 @@ class PeerAvatarImageGalleryItem: GalleryItem { } final class PeerAvatarImageGalleryItemNode: ZoomableContentGalleryItemNode { - private let context: AccountContextImpl + private let context: AccountContext private let peer: Peer private var entry: AvatarGalleryEntry? @@ -104,7 +105,7 @@ final class PeerAvatarImageGalleryItemNode: ZoomableContentGalleryItemNode { private let statusDisposable = MetaDisposable() private var status: MediaResourceStatus? - init(context: AccountContextImpl, presentationData: PresentationData, peer: Peer) { + init(context: AccountContext, presentationData: PresentationData, peer: Peer) { self.context = context self.peer = peer diff --git a/submodules/TelegramUI/TelegramUI/PeerBanTimeoutController.swift b/submodules/TelegramUI/TelegramUI/PeerBanTimeoutController.swift index 6bf063f91b..be537f8d5a 100644 --- a/submodules/TelegramUI/TelegramUI/PeerBanTimeoutController.swift +++ b/submodules/TelegramUI/TelegramUI/PeerBanTimeoutController.swift @@ -6,6 +6,8 @@ import UIKit import SwiftSignalKit import TelegramCore import TelegramPresentationData +import TelegramStringFormatting +import AccountContext final class PeerBanTimeoutController: ActionSheetController { private var presentationDisposable: Disposable? @@ -15,7 +17,7 @@ final class PeerBanTimeoutController: ActionSheetController { return self._ready } - init(context: AccountContextImpl, currentValue: Int32, applyValue: @escaping (Int32?) -> Void) { + init(context: AccountContext, currentValue: Int32, applyValue: @escaping (Int32?) -> Void) { let presentationData = context.sharedContext.currentPresentationData.with { $0 } let theme = presentationData.theme let strings = presentationData.strings diff --git a/submodules/TelegramUI/TelegramUI/PeerInfoController.swift b/submodules/TelegramUI/TelegramUI/PeerInfoController.swift index c6ae99d8a7..f841fceaa1 100644 --- a/submodules/TelegramUI/TelegramUI/PeerInfoController.swift +++ b/submodules/TelegramUI/TelegramUI/PeerInfoController.swift @@ -4,8 +4,9 @@ import Display import Postbox import SwiftSignalKit import TelegramCore +import AccountContext -func peerInfoController(context: AccountContextImpl, peer: Peer) -> ViewController? { +func peerInfoController(context: AccountContext, peer: Peer) -> ViewController? { if let _ = peer as? TelegramGroup { return groupInfoController(context: context, peerId: peer.id) } else if let channel = peer as? TelegramChannel { diff --git a/submodules/TelegramUI/TelegramUI/PeerMediaCollectionController.swift b/submodules/TelegramUI/TelegramUI/PeerMediaCollectionController.swift index fc29ca3c2c..fad3135ce5 100644 --- a/submodules/TelegramUI/TelegramUI/PeerMediaCollectionController.swift +++ b/submodules/TelegramUI/TelegramUI/PeerMediaCollectionController.swift @@ -8,11 +8,14 @@ import TelegramCore import SafariServices import TelegramPresentationData import TelegramUIPreferences +import TelegramBaseController +import OverlayStatusController +import AccountContext -public class PeerMediaCollectionController: TelegramController { +public class PeerMediaCollectionController: TelegramBaseController { private var validLayout: ContainerViewLayout? - private let context: AccountContextImpl + private let context: AccountContext private let peerId: PeerId private let messageId: MessageId? @@ -42,7 +45,7 @@ public class PeerMediaCollectionController: TelegramController { private var resolveUrlDisposable: MetaDisposable? - public init(context: AccountContextImpl, peerId: PeerId, messageId: MessageId? = nil) { + public init(context: AccountContext, peerId: PeerId, messageId: MessageId? = nil) { self.context = context self.peerId = peerId self.messageId = messageId @@ -87,7 +90,7 @@ public class PeerMediaCollectionController: TelegramController { return false } strongSelf.mediaCollectionDisplayNode.view.endEditing(true) - return openChatMessage(context: context, message: galleryMessage.message, standalone: false, reverseMessageGalleryOrder: true, navigationController: navigationController, dismissInput: { + return context.sharedContext.openChatMessage(OpenChatMessageParams(context: context, message: galleryMessage.message, standalone: false, reverseMessageGalleryOrder: true, navigationController: navigationController, dismissInput: { self?.mediaCollectionDisplayNode.view.endEditing(true) }, present: { c, a in self?.present(c, in: .window(.root), with: a, blockInteraction: true) @@ -107,7 +110,7 @@ public class PeerMediaCollectionController: TelegramController { }, callPeer: { peerId in self?.controllerInteraction?.callPeer(peerId) }, enqueueMessage: { _ in - }, sendSticker: nil, setupTemporaryHiddenMedia: { _, _, _ in }, chatAvatarHiddenMedia: { _, _ in}) + }, sendSticker: nil, setupTemporaryHiddenMedia: { _, _, _ in }, chatAvatarHiddenMedia: { _, _ in })) } return false }, openPeer: { [weak self] id, navigation, _ in diff --git a/submodules/TelegramUI/TelegramUI/PeerMediaCollectionControllerNode.swift b/submodules/TelegramUI/TelegramUI/PeerMediaCollectionControllerNode.swift index 740c21d873..fbdb4b4385 100644 --- a/submodules/TelegramUI/TelegramUI/PeerMediaCollectionControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/PeerMediaCollectionControllerNode.swift @@ -6,13 +6,14 @@ import SwiftSignalKit import Display import TelegramCore import TelegramPresentationData +import AccountContext struct PeerMediaCollectionMessageForGallery { let message: Message let fromSearchResults: Bool } -private func historyNodeImplForMode(_ mode: PeerMediaCollectionMode, context: AccountContextImpl, theme: PresentationTheme, peerId: PeerId, messageId: MessageId?, controllerInteraction: ChatControllerInteraction, selectedMessages: Signal?, NoError>) -> ChatHistoryNode & ASDisplayNode { +private func historyNodeImplForMode(_ mode: PeerMediaCollectionMode, context: AccountContext, theme: PresentationTheme, peerId: PeerId, messageId: MessageId?, controllerInteraction: ChatControllerInteraction, selectedMessages: Signal?, NoError>) -> ChatHistoryNode & ASDisplayNode { switch mode { case .photoOrVideo: let node = ChatHistoryGridNode(context: context, peerId: peerId, messageId: messageId, tagMask: .photoOrVideo, controllerInteraction: controllerInteraction) @@ -92,7 +93,7 @@ private func tagMaskForMode(_ mode: PeerMediaCollectionMode) -> MessageTags { } class PeerMediaCollectionControllerNode: ASDisplayNode { - private let context: AccountContextImpl + private let context: AccountContext private let peerId: PeerId private let controllerInteraction: ChatControllerInteraction private let interfaceInteraction: ChatPanelInterfaceInteraction @@ -132,7 +133,7 @@ class PeerMediaCollectionControllerNode: ASDisplayNode { private var presentationData: PresentationData - init(context: AccountContextImpl, peerId: PeerId, messageId: MessageId?, controllerInteraction: ChatControllerInteraction, interfaceInteraction: ChatPanelInterfaceInteraction, navigationBar: NavigationBar?, requestDeactivateSearch: @escaping () -> Void) { + init(context: AccountContext, peerId: PeerId, messageId: MessageId?, controllerInteraction: ChatControllerInteraction, interfaceInteraction: ChatPanelInterfaceInteraction, navigationBar: NavigationBar?, requestDeactivateSearch: @escaping () -> Void) { self.context = context self.peerId = peerId self.controllerInteraction = controllerInteraction diff --git a/submodules/TelegramUI/TelegramUI/PeerMessagesMediaPlaylist.swift b/submodules/TelegramUI/TelegramUI/PeerMessagesMediaPlaylist.swift index 69590ac1b8..62fa04f0b1 100644 --- a/submodules/TelegramUI/TelegramUI/PeerMessagesMediaPlaylist.swift +++ b/submodules/TelegramUI/TelegramUI/PeerMessagesMediaPlaylist.swift @@ -4,6 +4,7 @@ import SwiftSignalKit import Postbox import TelegramCore import TelegramUIPreferences +import AccountContext private enum PeerMessagesMediaPlaylistLoadAnchor { case messageId(MessageId) @@ -28,20 +29,6 @@ struct MessageMediaPlaylistItemStableId: Hashable { } } -struct PeerMessagesMediaPlaylistItemId: SharedMediaPlaylistItemId { - let messageId: MessageId - - func isEqual(to: SharedMediaPlaylistItemId) -> Bool { - if let to = to as? PeerMessagesMediaPlaylistItemId { - if self.messageId != to.messageId { - return false - } - return true - } - return false - } -} - private func extractFileMedia(_ message: Message) -> TelegramMediaFile? { var file: TelegramMediaFile? for media in message.media { diff --git a/submodules/TelegramUI/TelegramUI/PeerPresenceStatusManager.swift b/submodules/TelegramUI/TelegramUI/PeerPresenceStatusManager.swift index ef58217189..d0d4d2b277 100644 --- a/submodules/TelegramUI/TelegramUI/PeerPresenceStatusManager.swift +++ b/submodules/TelegramUI/TelegramUI/PeerPresenceStatusManager.swift @@ -1,6 +1,7 @@ import Foundation import SwiftSignalKit import TelegramCore +import TelegramStringFormatting final class PeerPresenceStatusManager { private let update: () -> Void diff --git a/submodules/TelegramUI/TelegramUI/PeerReportController.swift b/submodules/TelegramUI/TelegramUI/PeerReportController.swift index f0a8cdfd40..fe0e527b9e 100644 --- a/submodules/TelegramUI/TelegramUI/PeerReportController.swift +++ b/submodules/TelegramUI/TelegramUI/PeerReportController.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import TelegramPresentationData import ItemListUI +import AccountContext enum PeerReportSubject { case peer(PeerId) @@ -21,7 +22,7 @@ private enum PeerReportOption { case other } -func peerReportOptionsController(context: AccountContextImpl, subject: PeerReportSubject, present: @escaping (ViewController, Any?) -> Void) -> ViewController { +func peerReportOptionsController(context: AccountContext, subject: PeerReportSubject, present: @escaping (ViewController, Any?) -> Void) -> ViewController { let presentationData = context.sharedContext.currentPresentationData.with { $0 } let controller = ActionSheetController(theme: ActionSheetControllerTheme(presentationTheme: presentationData.theme)) @@ -186,7 +187,7 @@ private func peerReportControllerEntries(presentationData: PresentationData, sta return entries } -private func peerReportController(context: AccountContextImpl, subject: PeerReportSubject) -> ViewController { +private func peerReportController(context: AccountContext, subject: PeerReportSubject) -> ViewController { var dismissImpl: (() -> Void)? var presentControllerImpl: ((ViewController, ViewControllerPresentationArguments?) -> Void)? diff --git a/submodules/TelegramUI/TelegramUI/PeerSelectionController.swift b/submodules/TelegramUI/TelegramUI/PeerSelectionController.swift index 02e550c785..b086e0e09d 100644 --- a/submodules/TelegramUI/TelegramUI/PeerSelectionController.swift +++ b/submodules/TelegramUI/TelegramUI/PeerSelectionController.swift @@ -6,9 +6,10 @@ import TelegramCore import Postbox import TelegramPresentationData import ProgressNavigationButtonNode +import AccountContext public final class PeerSelectionController: ViewController { - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private var presentationDataDisposable: Disposable? @@ -49,7 +50,7 @@ public final class PeerSelectionController: ViewController { private var searchContentNode: NavigationBarSearchContentNode? - public init(context: AccountContextImpl, filter: ChatListNodePeersFilter = [.onlyWriteable], hasContactSelector: Bool = true, title: String? = nil) { + public init(context: AccountContext, filter: ChatListNodePeersFilter = [.onlyWriteable], hasContactSelector: Bool = true, title: String? = nil) { self.context = context self.filter = filter self.hasContactSelector = hasContactSelector diff --git a/submodules/TelegramUI/TelegramUI/PeerSelectionControllerNode.swift b/submodules/TelegramUI/TelegramUI/PeerSelectionControllerNode.swift index 9f33559362..e82e551e23 100644 --- a/submodules/TelegramUI/TelegramUI/PeerSelectionControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/PeerSelectionControllerNode.swift @@ -6,9 +6,10 @@ import Postbox import TelegramCore import SwiftSignalKit import TelegramPresentationData +import AccountContext final class PeerSelectionControllerNode: ASDisplayNode { - private let context: AccountContextImpl + private let context: AccountContext private let present: (ViewController, Any?) -> Void private let dismiss: () -> Void private let filter: ChatListNodePeersFilter @@ -51,7 +52,7 @@ final class PeerSelectionControllerNode: ASDisplayNode { return self.readyValue.get() } - init(context: AccountContextImpl, filter: ChatListNodePeersFilter, hasContactSelector: Bool, present: @escaping (ViewController, Any?) -> Void, dismiss: @escaping () -> Void) { + init(context: AccountContext, filter: ChatListNodePeersFilter, hasContactSelector: Bool, present: @escaping (ViewController, Any?) -> Void, dismiss: @escaping () -> Void) { self.context = context self.present = present self.dismiss = dismiss diff --git a/submodules/TelegramUI/TelegramUI/PeersNearbyController.swift b/submodules/TelegramUI/TelegramUI/PeersNearbyController.swift index ec2a4b997e..316418bd64 100644 --- a/submodules/TelegramUI/TelegramUI/PeersNearbyController.swift +++ b/submodules/TelegramUI/TelegramUI/PeersNearbyController.swift @@ -8,6 +8,9 @@ import MapKit import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import OverlayStatusController +import DeviceLocationManager +import AccountContext private struct PeerNearbyEntry { let peer: (Peer, CachedPeerData?) @@ -36,11 +39,11 @@ private func arePeerNearbyArraysEqual(_ lhs: [PeerNearbyEntry], _ rhs: [PeerNear } private final class PeersNearbyControllerArguments { - let context: AccountContextImpl + let context: AccountContext let openChat: (Peer) -> Void let openCreateGroup: (Double, Double, String?) -> Void - init(context: AccountContextImpl, openChat: @escaping (Peer) -> Void, openCreateGroup: @escaping (Double, Double, String?) -> Void) { + init(context: AccountContext, openChat: @escaping (Peer) -> Void, openCreateGroup: @escaping (Double, Double, String?) -> Void) { self.context = context self.openChat = openChat self.openCreateGroup = openCreateGroup @@ -282,7 +285,7 @@ private func peersNearbyControllerEntries(data: PeersNearbyData?, presentationDa return entries } -public func peersNearbyController(context: AccountContextImpl) -> ViewController { +public func peersNearbyController(context: AccountContext) -> ViewController { var pushControllerImpl: ((ViewController) -> Void)? var replaceAllButRootControllerImpl: ((ViewController, Bool) -> Void)? var replaceTopControllerImpl: ((ViewController) -> Void)? diff --git a/submodules/TelegramUI/TelegramUI/Permission.swift b/submodules/TelegramUI/TelegramUI/Permission.swift index 1b786fef04..e81d9ed7f8 100644 --- a/submodules/TelegramUI/TelegramUI/Permission.swift +++ b/submodules/TelegramUI/TelegramUI/Permission.swift @@ -71,7 +71,7 @@ public enum PermissionState: Equatable { } } -public func requiredPermissions(context: AccountContextImpl) -> Signal<(contacts: PermissionState, notifications: PermissionState, cellularData: PermissionState, siri: PermissionState), NoError> { +public func requiredPermissions(context: AccountContext) -> Signal<(contacts: PermissionState, notifications: PermissionState, cellularData: PermissionState, siri: PermissionState), NoError> { return combineLatest(DeviceAccess.authorizationStatus(subject: .contacts), DeviceAccess.authorizationStatus(applicationInForeground: context.sharedContext.applicationBindings.applicationInForeground, subject: .notifications), DeviceAccess.authorizationStatus(siriAuthorization: { return context.sharedContext.applicationBindings.siriAuthorization() }, subject: .cellularData), DeviceAccess.authorizationStatus(siriAuthorization: { diff --git a/submodules/TelegramUI/TelegramUI/PermissionController.swift b/submodules/TelegramUI/TelegramUI/PermissionController.swift index 80dbf1cf9d..2e08f837c3 100644 --- a/submodules/TelegramUI/TelegramUI/PermissionController.swift +++ b/submodules/TelegramUI/TelegramUI/PermissionController.swift @@ -6,9 +6,10 @@ import SwiftSignalKit import TelegramCore import TelegramPresentationData import DeviceAccess +import AccountContext public final class PermissionController : ViewController { - private let context: AccountContextImpl + private let context: AccountContext private let splitTest: PermissionUISplitTest? private var state: PermissionControllerContent? private var splashScreen = false @@ -26,7 +27,7 @@ public final class PermissionController : ViewController { private var skip: (() -> Void)? public var proceed: ((Bool) -> Void)? - public init(context: AccountContextImpl, splashScreen: Bool = true, splitTest: PermissionUISplitTest? = nil) { + public init(context: AccountContext, splashScreen: Bool = true, splitTest: PermissionUISplitTest? = nil) { self.context = context self.splitTest = splitTest self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/PermissionControllerNode.swift b/submodules/TelegramUI/TelegramUI/PermissionControllerNode.swift index 3a9a43d6f3..4674bbf7a1 100644 --- a/submodules/TelegramUI/TelegramUI/PermissionControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/PermissionControllerNode.swift @@ -5,6 +5,7 @@ import AsyncDisplayKit import SwiftSignalKit import TelegramCore import TelegramPresentationData +import AccountContext public struct PermissionControllerCustomIcon: Equatable { let light: UIImage? @@ -60,7 +61,7 @@ private func localizedString(for key: String, strings: PresentationStrings, fall } final class PermissionControllerNode: ASDisplayNode { - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private let splitTest: PermissionUISplitTest? @@ -72,7 +73,7 @@ final class PermissionControllerNode: ASDisplayNode { var openPrivacyPolicy: (() -> Void)? var dismiss: (() -> Void)? - init(context: AccountContextImpl, splitTest: PermissionUISplitTest?) { + init(context: AccountContext, splitTest: PermissionUISplitTest?) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } self.splitTest = splitTest diff --git a/submodules/TelegramUI/TelegramUI/PhoneLabelController.swift b/submodules/TelegramUI/TelegramUI/PhoneLabelController.swift index 9153b9ee4d..e04db33087 100644 --- a/submodules/TelegramUI/TelegramUI/PhoneLabelController.swift +++ b/submodules/TelegramUI/TelegramUI/PhoneLabelController.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import TelegramPresentationData import ItemListUI +import AccountContext private struct PhoneLabelArguments { let selectLabel: (String) -> Void @@ -82,7 +83,7 @@ private func phoneLabelEntries(presentationData: PresentationData, state: PhoneL return entries } -public func phoneLabelController(context: AccountContextImpl, currentLabel: String, completion: @escaping (String) -> Void) -> ViewController { +public func phoneLabelController(context: AccountContext, currentLabel: String, completion: @escaping (String) -> Void) -> ViewController { let statePromise = ValuePromise(PhoneLabelState(currentLabel: currentLabel)) let stateValue = Atomic(value: PhoneLabelState(currentLabel: currentLabel)) let updateState: ((PhoneLabelState) -> PhoneLabelState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/PhotoResources.swift b/submodules/TelegramUI/TelegramUI/PhotoResources.swift index 2dc7eb3957..718fe2d4a1 100644 --- a/submodules/TelegramUI/TelegramUI/PhotoResources.swift +++ b/submodules/TelegramUI/TelegramUI/PhotoResources.swift @@ -14,6 +14,7 @@ import WebP #endif import TelegramUIPreferences import MediaResources +import AccountContext private enum ResourceFileData { case data(Data) @@ -1754,7 +1755,7 @@ func internalMediaGridMessageVideo(postbox: Postbox, videoReference: FileMediaRe } } -func chatMessagePhotoStatus(context: AccountContextImpl, messageId: MessageId, photoReference: ImageMediaReference) -> Signal { +func chatMessagePhotoStatus(context: AccountContext, messageId: MessageId, photoReference: ImageMediaReference) -> Signal { if let largestRepresentation = largestRepresentationForPhoto(photoReference.media) { return context.fetchManager.fetchStatus(category: .image, location: .chat(messageId.peerId), locationKey: .messageId(messageId), resource: largestRepresentation.resource) } else { @@ -1773,7 +1774,7 @@ public func standaloneChatMessagePhotoInteractiveFetched(account: Account, photo } } -public func chatMessagePhotoInteractiveFetched(context: AccountContextImpl, photoReference: ImageMediaReference, storeToDownloadsPeerType: MediaAutoDownloadPeerType?) -> Signal { +public func chatMessagePhotoInteractiveFetched(context: AccountContext, photoReference: ImageMediaReference, storeToDownloadsPeerType: MediaAutoDownloadPeerType?) -> Signal { if let largestRepresentation = largestRepresentationForPhoto(photoReference.media) { return fetchedMediaResource(mediaBox: context.account.postbox.mediaBox, reference: photoReference.resourceReference(largestRepresentation.resource), statsCategory: .image, reportResultStatus: true) |> mapToSignal { type -> Signal in diff --git a/submodules/TelegramUI/TelegramUI/PlatformVideoContent.swift b/submodules/TelegramUI/TelegramUI/PlatformVideoContent.swift index c1db428a4c..7fcd018138 100644 --- a/submodules/TelegramUI/TelegramUI/PlatformVideoContent.swift +++ b/submodules/TelegramUI/TelegramUI/PlatformVideoContent.swift @@ -8,6 +8,7 @@ import TelegramCore import AVFoundation import UniversalMediaPlayer import TelegramAudio +import AccountContext enum PlatformVideoContentId: Hashable { case message(MessageId, UInt32, MediaId) diff --git a/submodules/TelegramUI/TelegramUI/PrefetchManager.swift b/submodules/TelegramUI/TelegramUI/PrefetchManager.swift index ab99e39646..a54017ce66 100644 --- a/submodules/TelegramUI/TelegramUI/PrefetchManager.swift +++ b/submodules/TelegramUI/TelegramUI/PrefetchManager.swift @@ -3,6 +3,7 @@ import SwiftSignalKit import Postbox import TelegramCore import TelegramUIPreferences +import AccountContext private final class PrefetchMediaContext { let fetchDisposable = MetaDisposable() @@ -20,7 +21,7 @@ private final class PrefetchManagerImpl { private var contexts: [MediaId: PrefetchMediaContext] = [:] - init(queue: Queue, sharedContext: SharedAccountContextImpl, account: Account, fetchManager: FetchManager) { + init(queue: Queue, sharedContext: SharedAccountContext, account: Account, fetchManager: FetchManager) { self.queue = queue self.account = account self.fetchManager = fetchManager @@ -142,7 +143,7 @@ final class PrefetchManager { private let impl: QueueLocalObject - init(sharedContext: SharedAccountContextImpl, account: Account, fetchManager: FetchManager) { + init(sharedContext: SharedAccountContext, account: Account, fetchManager: FetchManager) { let queue = Queue.mainQueue() self.queue = queue self.impl = QueueLocalObject(queue: queue, generate: { diff --git a/submodules/TelegramUI/TelegramUI/PresenceStrings.swift b/submodules/TelegramUI/TelegramUI/PresenceStrings.swift deleted file mode 100644 index 2db092a640..0000000000 --- a/submodules/TelegramUI/TelegramUI/PresenceStrings.swift +++ /dev/null @@ -1,404 +0,0 @@ -import Foundation -import Postbox -import TelegramCore -import TelegramPresentationData - -func stringForTimestamp(day: Int32, month: Int32, year: Int32, dateTimeFormat: PresentationDateTimeFormat) -> String { - let separator = dateTimeFormat.dateSeparator - switch dateTimeFormat.dateFormat { - case .monthFirst: - return String(format: "%d%@%d%@%02d", month, separator, day, separator, year - 100) - case .dayFirst: - return String(format: "%d%@%02d%@%02d", day, separator, month, separator, year - 100) - } -} - -func stringForTimestamp(day: Int32, month: Int32, dateTimeFormat: PresentationDateTimeFormat) -> String { - let separator = dateTimeFormat.dateSeparator - switch dateTimeFormat.dateFormat { - case .monthFirst: - return String(format: "%d%@%d", month, separator, day) - case .dayFirst: - return String(format: "%d%@%02d", day, separator, month) - } -} - -func shortStringForDayOfWeek(strings: PresentationStrings, day: Int32) -> String { - switch day { - case 0: - return strings.Weekday_ShortSunday - case 1: - return strings.Weekday_ShortMonday - case 2: - return strings.Weekday_ShortTuesday - case 3: - return strings.Weekday_ShortWednesday - case 4: - return strings.Weekday_ShortThursday - case 5: - return strings.Weekday_ShortFriday - case 6: - return strings.Weekday_ShortSaturday - default: - return "" - } -} - -func stringForMonth(strings: PresentationStrings, month: Int32) -> String { - switch month { - case 0: - return strings.Month_GenJanuary - case 1: - return strings.Month_GenFebruary - case 2: - return strings.Month_GenMarch - case 3: - return strings.Month_GenApril - case 4: - return strings.Month_GenMay - case 5: - return strings.Month_GenJune - case 6: - return strings.Month_GenJuly - case 7: - return strings.Month_GenAugust - case 8: - return strings.Month_GenSeptember - case 9: - return strings.Month_GenOctober - case 10: - return strings.Month_GenNovember - case 11: - return strings.Month_GenDecember - default: - return "" - } -} - -func stringForMonth(strings: PresentationStrings, month: Int32, ofYear year: Int32) -> String { - let yearString = "\(1900 + year)" - switch month { - case 0: - return strings.Time_MonthOfYear_m1(yearString).0 - case 1: - return strings.Time_MonthOfYear_m2(yearString).0 - case 2: - return strings.Time_MonthOfYear_m3(yearString).0 - case 3: - return strings.Time_MonthOfYear_m4(yearString).0 - case 4: - return strings.Time_MonthOfYear_m5(yearString).0 - case 5: - return strings.Time_MonthOfYear_m6(yearString).0 - case 6: - return strings.Time_MonthOfYear_m7(yearString).0 - case 7: - return strings.Time_MonthOfYear_m8(yearString).0 - case 8: - return strings.Time_MonthOfYear_m9(yearString).0 - case 9: - return strings.Time_MonthOfYear_m10(yearString).0 - case 10: - return strings.Time_MonthOfYear_m11(yearString).0 - default: - return strings.Time_MonthOfYear_m12(yearString).0 - } -} - -enum RelativeTimestampFormatDay { - case today - case yesterday -} - -func stringForUserPresence(strings: PresentationStrings, day: RelativeTimestampFormatDay, dateTimeFormat: PresentationDateTimeFormat, hours: Int32, minutes: Int32) -> String { - let dayString: String - switch day { - case .today: - dayString = strings.LastSeen_AtDate(strings.Time_TodayAt(stringForShortTimestamp(hours: hours, minutes: minutes, dateTimeFormat: dateTimeFormat)).0).0 - case .yesterday: - dayString = strings.LastSeen_YesterdayAt(stringForShortTimestamp(hours: hours, minutes: minutes, dateTimeFormat: dateTimeFormat)).0 - } - return dayString -} - -private func humanReadableStringForTimestamp(strings: PresentationStrings, day: RelativeTimestampFormatDay, dateTimeFormat: PresentationDateTimeFormat, hours: Int32, minutes: Int32) -> String { - let dayString: String - switch day { - case .today: - dayString = strings.Time_TodayAt(stringForShortTimestamp(hours: hours, minutes: minutes, dateTimeFormat: dateTimeFormat)).0 - case .yesterday: - dayString = strings.Time_YesterdayAt(stringForShortTimestamp(hours: hours, minutes: minutes, dateTimeFormat: dateTimeFormat)).0 - } - return dayString -} - -func humanReadableStringForTimestamp(strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, timestamp: Int32) -> String { - var t: time_t = time_t(timestamp) - var timeinfo: tm = tm() - localtime_r(&t, &timeinfo) - - let timestampNow = Int32(CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970) - var now: time_t = time_t(timestampNow) - var timeinfoNow: tm = tm() - localtime_r(&now, &timeinfoNow) - - if timeinfo.tm_year != timeinfoNow.tm_year { - return "\(stringForTimestamp(day: timeinfo.tm_mday, month: timeinfo.tm_mon + 1, year: timeinfo.tm_year, dateTimeFormat: dateTimeFormat))" - } - - let dayDifference = timeinfo.tm_yday - timeinfoNow.tm_yday - if dayDifference == 0 || dayDifference == -1 { - let day: RelativeTimestampFormatDay - if dayDifference == 0 { - day = .today - } else { - day = .yesterday - } - return humanReadableStringForTimestamp(strings: strings, day: day, dateTimeFormat: dateTimeFormat, hours: timeinfo.tm_hour, minutes: timeinfo.tm_min) - } else { - return "\(stringForTimestamp(day: timeinfo.tm_mday, month: timeinfo.tm_mon + 1, year: timeinfo.tm_year, dateTimeFormat: dateTimeFormat))" - } -} - -enum RelativeUserPresenceLastSeen { - case justNow - case minutesAgo(Int32) - case hoursAgo(Int32) - case todayAt(hours: Int32, minutes: Int32) - case yesterdayAt(hours: Int32, minutes: Int32) - case thisYear(month: Int32, day: Int32) - case atDate(year: Int32, month: Int32) -} - -enum RelativeUserPresenceStatus { - case offline - case online(at: Int32) - case lastSeen(at: Int32) - case recently - case lastWeek - case lastMonth -} - -func relativeUserPresenceStatus(_ presence: TelegramUserPresence, relativeTo timestamp: Int32) -> RelativeUserPresenceStatus { - switch presence.status { - case .none: - return .offline - case let .present(statusTimestamp): - if statusTimestamp >= timestamp { - return .online(at: statusTimestamp) - } else { - return .lastSeen(at: statusTimestamp) - } - case .recently: - let activeUntil = presence.lastActivity + 30 - if activeUntil >= timestamp { - return .online(at: activeUntil) - } else { - return .recently - } - case .lastWeek: - return .lastWeek - case .lastMonth: - return .lastMonth - } -} - -func stringForRelativeTimestamp(strings: PresentationStrings, relativeTimestamp: Int32, relativeTo timestamp: Int32, dateTimeFormat: PresentationDateTimeFormat) -> String { - var t: time_t = time_t(relativeTimestamp) - var timeinfo: tm = tm() - localtime_r(&t, &timeinfo) - - var now: time_t = time_t(timestamp) - var timeinfoNow: tm = tm() - localtime_r(&now, &timeinfoNow) - - if timeinfo.tm_year != timeinfoNow.tm_year { - return stringForTimestamp(day: timeinfo.tm_mday, month: timeinfo.tm_mon + 1, year: timeinfo.tm_year, dateTimeFormat: dateTimeFormat) - } - - let dayDifference = timeinfo.tm_yday - timeinfoNow.tm_yday - if dayDifference > -7 { - if dayDifference == 0 { - return stringForShortTimestamp(hours: timeinfo.tm_hour, minutes: timeinfo.tm_min, dateTimeFormat: dateTimeFormat) - } else { - return shortStringForDayOfWeek(strings: strings, day: timeinfo.tm_wday) - } - } else { - return stringForTimestamp(day: timeinfo.tm_mday, month: timeinfo.tm_mon + 1, dateTimeFormat: dateTimeFormat) - } -} - -func stringForRelativeLiveLocationTimestamp(strings: PresentationStrings, relativeTimestamp: Int32, relativeTo timestamp: Int32, dateTimeFormat: PresentationDateTimeFormat) -> String { - let difference = timestamp - relativeTimestamp - if difference < 60 { - return strings.LiveLocationUpdated_JustNow - } else if difference < 60 * 60 { - let minutes = difference / 60 - return strings.LiveLocationUpdated_MinutesAgo(minutes) - } else { - var t: time_t = time_t(relativeTimestamp) - var timeinfo: tm = tm() - localtime_r(&t, &timeinfo) - - var now: time_t = time_t(timestamp) - var timeinfoNow: tm = tm() - localtime_r(&now, &timeinfoNow) - - let dayDifference = timeinfo.tm_yday - timeinfoNow.tm_yday - - let hours = timeinfo.tm_hour - let minutes = timeinfo.tm_min - - if dayDifference == 0 { - return strings.LiveLocationUpdated_TodayAt(stringForShortTimestamp(hours: hours, minutes: minutes, dateTimeFormat: dateTimeFormat)).0 - } else { - return stringForFullDate(timestamp: relativeTimestamp, strings: strings, dateTimeFormat: dateTimeFormat) - } - } -} - -func stringForRelativeSymbolicTimestamp(strings: PresentationStrings, relativeTimestamp: Int32, relativeTo timestamp: Int32, dateTimeFormat: PresentationDateTimeFormat) -> String { - var t: time_t = time_t(relativeTimestamp) - var timeinfo: tm = tm() - localtime_r(&t, &timeinfo) - - var now: time_t = time_t(timestamp) - var timeinfoNow: tm = tm() - localtime_r(&now, &timeinfoNow) - - let dayDifference = timeinfo.tm_yday - timeinfoNow.tm_yday - - let hours = timeinfo.tm_hour - let minutes = timeinfo.tm_min - - if dayDifference == 0 { - return strings.Time_TodayAt(stringForShortTimestamp(hours: hours, minutes: minutes, dateTimeFormat: dateTimeFormat)).0 - } else { - return stringForFullDate(timestamp: relativeTimestamp, strings: strings, dateTimeFormat: dateTimeFormat) - } -} - -func stringForRelativeLiveLocationUpdateTimestamp(strings: PresentationStrings, relativeTimestamp: Int32, relativeTo timestamp: Int32, dateTimeFormat: PresentationDateTimeFormat) -> String { - var t: time_t = time_t(relativeTimestamp) - var timeinfo: tm = tm() - localtime_r(&t, &timeinfo) - - var now: time_t = time_t(timestamp) - var timeinfoNow: tm = tm() - localtime_r(&now, &timeinfoNow) - - if timeinfo.tm_year != timeinfoNow.tm_year { - return stringForTimestamp(day: timeinfo.tm_mday, month: timeinfo.tm_mon + 1, year: timeinfo.tm_year, dateTimeFormat: dateTimeFormat) - } - - let dayDifference = timeinfo.tm_yday - timeinfoNow.tm_yday - if dayDifference > -7 { - if dayDifference == 0 { - return stringForShortTimestamp(hours: timeinfo.tm_hour, minutes: timeinfo.tm_min, dateTimeFormat: dateTimeFormat) - } else { - return shortStringForDayOfWeek(strings: strings, day: timeinfo.tm_wday) - } - } else { - return stringForTimestamp(day: timeinfo.tm_mday, month: timeinfo.tm_mon + 1, dateTimeFormat: dateTimeFormat) - } -} - -func stringAndActivityForUserPresence(strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, presence: TelegramUserPresence, relativeTo timestamp: Int32, expanded: Bool = false) -> (String, Bool) { - switch presence.status { - case .none: - return (strings.LastSeen_Offline, false) - case let .present(statusTimestamp): - if statusTimestamp >= timestamp { - return (strings.Presence_online, true) - } else { - let difference = timestamp - statusTimestamp - if difference < 60 { - return (strings.LastSeen_JustNow, false) - } else if difference < 60 * 60 && !expanded { - let minutes = difference / 60 - return (strings.LastSeen_MinutesAgo(minutes), false) - } else { - var t: time_t = time_t(statusTimestamp) - var timeinfo: tm = tm() - localtime_r(&t, &timeinfo) - - var now: time_t = time_t(timestamp) - var timeinfoNow: tm = tm() - localtime_r(&now, &timeinfoNow) - - if timeinfo.tm_year != timeinfoNow.tm_year { - return (strings.LastSeen_AtDate(stringForTimestamp(day: timeinfo.tm_mday, month: timeinfo.tm_mon + 1, year: timeinfo.tm_year, dateTimeFormat: dateTimeFormat)).0, false) - } - - let dayDifference = timeinfo.tm_yday - timeinfoNow.tm_yday - if dayDifference == 0 || dayDifference == -1 { - let day: RelativeTimestampFormatDay - if dayDifference == 0 { - if expanded { - day = .today - } else { - let minutes = difference / (60 * 60) - return (strings.LastSeen_HoursAgo(minutes), false) - } - } else { - day = .yesterday - } - return (stringForUserPresence(strings: strings, day: day, dateTimeFormat: dateTimeFormat, hours: timeinfo.tm_hour, minutes: timeinfo.tm_min), false) - } else { - return (strings.LastSeen_AtDate(stringForTimestamp(day: timeinfo.tm_mday, month: timeinfo.tm_mon + 1, year: timeinfo.tm_year, dateTimeFormat: dateTimeFormat)).0, false) - } - } - } - case .recently: - let activeUntil = presence.lastActivity + 30 - if activeUntil >= timestamp { - return (strings.Presence_online, true) - } else { - return (strings.LastSeen_Lately, false) - } - case .lastWeek: - return (strings.LastSeen_WithinAWeek, false) - case .lastMonth: - return (strings.LastSeen_WithinAMonth, false) - } -} - -func userPresenceStringRefreshTimeout(_ presence: TelegramUserPresence, relativeTo timestamp: Int32) -> Double { - switch presence.status { - case let .present(statusTimestamp): - if statusTimestamp >= timestamp { - return Double(statusTimestamp - timestamp) - } else { - let difference = timestamp - statusTimestamp - if difference < 30 { - return Double((30 - difference) + 1) - } else if difference < 60 * 60 { - return Double((difference % 60) + 1) - } else { - return Double.infinity - } - } - case .recently: - let activeUntil = presence.lastActivity + 30 - if activeUntil >= timestamp { - return Double(activeUntil - timestamp + 1) - } else { - return Double.infinity - } - case .none, .lastWeek, .lastMonth: - return Double.infinity - } -} - - -func stringForRemainingMuteInterval(strings: PresentationStrings, muteInterval value: Int32) -> String { - let timestamp = Int32(CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970) - let value = max(1 * 60, value - timestamp) - if value <= 1 * 60 * 60 { - return strings.MuteExpires_Minutes(Int32(round(Float(value) / 60))) - } else if value <= 24 * 60 * 60 { - return strings.MuteExpires_Hours(Int32(round(Float(value) / (60 * 60)))) - } else { - return strings.MuteExpires_Days(Int32(round(Float(value) / (24 * 60 * 60)))) - } -} diff --git a/submodules/TelegramUI/TelegramUI/PrivacyAndSecurityController.swift b/submodules/TelegramUI/TelegramUI/PrivacyAndSecurityController.swift index 890c38fcdb..c010c38920 100644 --- a/submodules/TelegramUI/TelegramUI/PrivacyAndSecurityController.swift +++ b/submodules/TelegramUI/TelegramUI/PrivacyAndSecurityController.swift @@ -8,6 +8,7 @@ import TelegramPresentationData import TelegramUIPreferences import TelegramCallsUI import ItemListUI +import AccountContext private final class PrivacyAndSecurityControllerArguments { let account: Account @@ -419,7 +420,7 @@ private func privacyAndSecurityControllerEntries(presentationData: PresentationD return entries } -public func privacyAndSecurityController(context: AccountContextImpl, initialSettings: AccountPrivacySettings? = nil, updatedSettings: ((AccountPrivacySettings?) -> Void)? = nil, focusOnItemTag: PrivacyAndSecurityEntryTag? = nil) -> ViewController { +public func privacyAndSecurityController(context: AccountContext, initialSettings: AccountPrivacySettings? = nil, updatedSettings: ((AccountPrivacySettings?) -> Void)? = nil, focusOnItemTag: PrivacyAndSecurityEntryTag? = nil) -> ViewController { let statePromise = ValuePromise(PrivacyAndSecurityControllerState(), ignoreRepeated: true) let stateValue = Atomic(value: PrivacyAndSecurityControllerState()) let updateState: ((PrivacyAndSecurityControllerState) -> PrivacyAndSecurityControllerState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/PrivacyIntroController.swift b/submodules/TelegramUI/TelegramUI/PrivacyIntroController.swift index d235d43b96..375825a803 100644 --- a/submodules/TelegramUI/TelegramUI/PrivacyIntroController.swift +++ b/submodules/TelegramUI/TelegramUI/PrivacyIntroController.swift @@ -6,6 +6,7 @@ import Postbox import SwiftSignalKit import TelegramCore import TelegramPresentationData +import AccountContext enum PrivacyIntroControllerMode { case passcode @@ -77,7 +78,7 @@ final public class PrivacyIntroControllerPresentationArguments { } final class PrivacyIntroController: ViewController { - private let context: AccountContextImpl + private let context: AccountContext private let mode: PrivacyIntroControllerMode private let arguments: PrivacyIntroControllerPresentationArguments private let proceedAction: () -> Void @@ -91,7 +92,7 @@ final class PrivacyIntroController: ViewController { private var isDismissed: Bool = false - init(context: AccountContextImpl, mode: PrivacyIntroControllerMode, arguments: PrivacyIntroControllerPresentationArguments = PrivacyIntroControllerPresentationArguments(), proceedAction: @escaping () -> Void) { + init(context: AccountContext, mode: PrivacyIntroControllerMode, arguments: PrivacyIntroControllerPresentationArguments = PrivacyIntroControllerPresentationArguments(), proceedAction: @escaping () -> Void) { self.context = context self.mode = mode self.arguments = arguments diff --git a/submodules/TelegramUI/TelegramUI/PrivacyIntroControllerNode.swift b/submodules/TelegramUI/TelegramUI/PrivacyIntroControllerNode.swift index 3499dabcc7..d2380e956c 100644 --- a/submodules/TelegramUI/TelegramUI/PrivacyIntroControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/PrivacyIntroControllerNode.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import SwiftSignalKit import TelegramPresentationData +import AccountContext private func generateButtonImage(backgroundColor: UIColor, borderColor: UIColor, highlightColor: UIColor?) -> UIImage? { return generateImage(CGSize(width: 1.0, height: 44.0), contextGenerator: { size, context in @@ -30,7 +31,7 @@ private let textFont = Font.regular(14.0) private let buttonFont = Font.regular(17.0) final class PrivacyIntroControllerNode: ViewControllerTracingNode { - private let context: AccountContextImpl + private let context: AccountContext private let mode: PrivacyIntroControllerMode private var presentationData: PresentationData? private let proceedAction: () -> Void @@ -46,7 +47,7 @@ final class PrivacyIntroControllerNode: ViewControllerTracingNode { private var validLayout: (ContainerViewLayout, CGFloat)? - init(context: AccountContextImpl, mode: PrivacyIntroControllerMode, proceedAction: @escaping () -> Void) { + init(context: AccountContext, mode: PrivacyIntroControllerMode, proceedAction: @escaping () -> Void) { self.context = context self.mode = mode self.proceedAction = proceedAction diff --git a/submodules/TelegramUI/TelegramUI/ProxyListSettingsController.swift b/submodules/TelegramUI/TelegramUI/ProxyListSettingsController.swift index 52f32d6924..be56355b28 100644 --- a/submodules/TelegramUI/TelegramUI/ProxyListSettingsController.swift +++ b/submodules/TelegramUI/TelegramUI/ProxyListSettingsController.swift @@ -7,6 +7,7 @@ import TelegramCore import TelegramPresentationData import MtProtoKitDynamic import ItemListUI +import AccountContext private final class ProxySettingsControllerArguments { let toggleEnabled: (Bool) -> Void @@ -300,7 +301,7 @@ public enum ProxySettingsControllerMode { case modal } -public func proxySettingsController(context: AccountContextImpl, mode: ProxySettingsControllerMode = .default) -> ViewController { +public func proxySettingsController(context: AccountContext, mode: ProxySettingsControllerMode = .default) -> ViewController { let presentationData = context.sharedContext.currentPresentationData.with { $0 } return proxySettingsController(accountManager: context.sharedContext.accountManager, postbox: context.account.postbox, network: context.account.network, mode: mode, theme: presentationData.theme, strings: presentationData.strings, updatedPresentationData: context.sharedContext.presentationData |> map { ($0.theme, $0.strings) }) } diff --git a/submodules/TelegramUI/TelegramUI/ProxyServerActionSheetController.swift b/submodules/TelegramUI/TelegramUI/ProxyServerActionSheetController.swift index edf90d4ecd..f273657b31 100644 --- a/submodules/TelegramUI/TelegramUI/ProxyServerActionSheetController.swift +++ b/submodules/TelegramUI/TelegramUI/ProxyServerActionSheetController.swift @@ -8,6 +8,8 @@ import UIKit import SwiftSignalKit import TelegramPresentationData import ActivityIndicator +import OverlayStatusController +import AccountContext public final class ProxyServerActionSheetController: ActionSheetController { private var presentationDisposable: Disposable? @@ -19,7 +21,7 @@ public final class ProxyServerActionSheetController: ActionSheetController { private var isDismissed: Bool = false - convenience init(context: AccountContextImpl, server: ProxyServerSettings) { + convenience init(context: AccountContext, server: ProxyServerSettings) { let presentationData = context.sharedContext.currentPresentationData.with { $0 } self.init(theme: presentationData.theme, strings: presentationData.strings, accountManager: context.sharedContext.accountManager, postbox: context.account.postbox, network: context.account.network, server: server, presentationData: context.sharedContext.presentationData) } diff --git a/submodules/TelegramUI/TelegramUI/ProxyServerSettingsController.swift b/submodules/TelegramUI/TelegramUI/ProxyServerSettingsController.swift index d0f0cc0a46..2b470b9f59 100644 --- a/submodules/TelegramUI/TelegramUI/ProxyServerSettingsController.swift +++ b/submodules/TelegramUI/TelegramUI/ProxyServerSettingsController.swift @@ -11,6 +11,7 @@ import MtProtoKitDynamic #endif import TelegramPresentationData import ItemListUI +import AccountContext private func shareLink(for server: ProxyServerSettings) -> String { var link: String @@ -262,7 +263,7 @@ private func proxyServerSettings(with state: ProxyServerSettingsControllerState) return nil } -public func proxyServerSettingsController(context: AccountContextImpl, currentSettings: ProxyServerSettings? = nil) -> ViewController { +public func proxyServerSettingsController(context: AccountContext, currentSettings: ProxyServerSettings? = nil) -> ViewController { let presentationData = context.sharedContext.currentPresentationData.with { $0 } return proxyServerSettingsController(theme: presentationData.theme, strings: presentationData.strings, updatedPresentationData: context.sharedContext.presentationData |> map { ($0.theme, $0.strings) }, accountManager: context.sharedContext.accountManager, postbox: context.account.postbox, network: context.account.network, currentSettings: currentSettings) } diff --git a/submodules/TelegramUI/TelegramUI/RecentSessionsController.swift b/submodules/TelegramUI/TelegramUI/RecentSessionsController.swift index 2ed03d29a5..88223e33df 100644 --- a/submodules/TelegramUI/TelegramUI/RecentSessionsController.swift +++ b/submodules/TelegramUI/TelegramUI/RecentSessionsController.swift @@ -7,6 +7,7 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext private final class RecentSessionsControllerArguments { let account: Account @@ -410,7 +411,7 @@ private func recentSessionsControllerEntries(presentationData: PresentationData, return entries } -public func recentSessionsController(context: AccountContextImpl, activeSessionsContext: ActiveSessionsContext) -> ViewController { +public func recentSessionsController(context: AccountContext, activeSessionsContext: ActiveSessionsContext) -> ViewController { let statePromise = ValuePromise(RecentSessionsControllerState(), ignoreRepeated: true) let stateValue = Atomic(value: RecentSessionsControllerState()) let updateState: ((RecentSessionsControllerState) -> RecentSessionsControllerState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/ReplyAccessoryPanelNode.swift b/submodules/TelegramUI/TelegramUI/ReplyAccessoryPanelNode.swift index cdbc4850ed..d484e08401 100644 --- a/submodules/TelegramUI/TelegramUI/ReplyAccessoryPanelNode.swift +++ b/submodules/TelegramUI/TelegramUI/ReplyAccessoryPanelNode.swift @@ -7,6 +7,7 @@ import SwiftSignalKit import Display import TelegramPresentationData import TelegramUIPreferences +import AccountContext final class ReplyAccessoryPanelNode: AccessoryPanelNode { private let messageDisposable = MetaDisposable() @@ -24,7 +25,7 @@ final class ReplyAccessoryPanelNode: AccessoryPanelNode { var theme: PresentationTheme - init(context: AccountContextImpl, messageId: MessageId, theme: PresentationTheme, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder) { + init(context: AccountContext, messageId: MessageId, theme: PresentationTheme, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder) { self.messageId = messageId self.theme = theme diff --git a/submodules/TelegramUI/TelegramUI/ResetPasswordController.swift b/submodules/TelegramUI/TelegramUI/ResetPasswordController.swift index 2603e4b45b..f86f1929b5 100644 --- a/submodules/TelegramUI/TelegramUI/ResetPasswordController.swift +++ b/submodules/TelegramUI/TelegramUI/ResetPasswordController.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import TelegramPresentationData import ItemListUI +import AccountContext private final class ResetPasswordControllerArguments { let updateCodeText: (String) -> Void @@ -109,7 +110,7 @@ enum ResetPasswordState: Equatable { case pendingVerification(emailPattern: String) } -func resetPasswordController(context: AccountContextImpl, emailPattern: String, completion: @escaping () -> Void) -> ViewController { +func resetPasswordController(context: AccountContext, emailPattern: String, completion: @escaping () -> Void) -> ViewController { let statePromise = ValuePromise(ResetPasswordControllerState(), ignoreRepeated: true) let stateValue = Atomic(value: ResetPasswordControllerState()) let updateState: ((ResetPasswordControllerState) -> ResetPasswordControllerState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/SaveIncomingMediaController.swift b/submodules/TelegramUI/TelegramUI/SaveIncomingMediaController.swift index 0ec98a7996..ce3624239a 100644 --- a/submodules/TelegramUI/TelegramUI/SaveIncomingMediaController.swift +++ b/submodules/TelegramUI/TelegramUI/SaveIncomingMediaController.swift @@ -7,6 +7,7 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext private enum PeerType { case contact @@ -93,7 +94,7 @@ private func saveIncomingMediaControllerEntries(presentationData: PresentationDa return entries } -func saveIncomingMediaController(context: AccountContextImpl) -> ViewController { +func saveIncomingMediaController(context: AccountContext) -> ViewController { let arguments = SaveIncomingMediaControllerArguments(toggle: { type in let _ = updateMediaDownloadSettingsInteractively(accountManager: context.sharedContext.accountManager, { settings in var settings = settings diff --git a/submodules/TelegramUI/TelegramUI/SaveToCameraRoll.swift b/submodules/TelegramUI/TelegramUI/SaveToCameraRoll.swift index 4f546940cc..3e72f9b86e 100644 --- a/submodules/TelegramUI/TelegramUI/SaveToCameraRoll.swift +++ b/submodules/TelegramUI/TelegramUI/SaveToCameraRoll.swift @@ -7,13 +7,14 @@ import Photos import Display import MobileCoreServices import DeviceAccess +import AccountContext private enum SaveToCameraRollState { case progress(Float) case data(MediaResourceData) } -private func fetchMediaData(context: AccountContextImpl, postbox: Postbox, mediaReference: AnyMediaReference) -> Signal<(SaveToCameraRollState, Bool), NoError> { +private func fetchMediaData(context: AccountContext, postbox: Postbox, mediaReference: AnyMediaReference) -> Signal<(SaveToCameraRollState, Bool), NoError> { var resource: MediaResource? var isImage = true var fileExtension: String? @@ -76,7 +77,7 @@ private func fetchMediaData(context: AccountContextImpl, postbox: Postbox, media } } -func saveToCameraRoll(context: AccountContextImpl, postbox: Postbox, mediaReference: AnyMediaReference) -> Signal { +func saveToCameraRoll(context: AccountContext, postbox: Postbox, mediaReference: AnyMediaReference) -> Signal { return fetchMediaData(context: context, postbox: postbox, mediaReference: mediaReference) |> mapToSignal { state, isImage -> Signal in switch state { @@ -130,7 +131,7 @@ func saveToCameraRoll(context: AccountContextImpl, postbox: Postbox, mediaRefere } } -func copyToPasteboard(context: AccountContextImpl, postbox: Postbox, mediaReference: AnyMediaReference) -> Signal { +func copyToPasteboard(context: AccountContext, postbox: Postbox, mediaReference: AnyMediaReference) -> Signal { return fetchMediaData(context: context, postbox: postbox, mediaReference: mediaReference) |> mapToSignal { state, isImage -> Signal in if case let .data(data) = state, data.complete { diff --git a/submodules/TelegramUI/TelegramUI/SearchPeerMembers.swift b/submodules/TelegramUI/TelegramUI/SearchPeerMembers.swift index c8cdc41528..6e18243678 100644 --- a/submodules/TelegramUI/TelegramUI/SearchPeerMembers.swift +++ b/submodules/TelegramUI/TelegramUI/SearchPeerMembers.swift @@ -2,8 +2,9 @@ import Foundation import Postbox import TelegramCore import SwiftSignalKit +import AccountContext -func searchPeerMembers(context: AccountContextImpl, peerId: PeerId, query: String) -> Signal<[Peer], NoError> { +func searchPeerMembers(context: AccountContext, peerId: PeerId, query: String) -> Signal<[Peer], NoError> { if peerId.namespace == Namespaces.Peer.CloudChannel { return context.account.postbox.transaction { transaction -> CachedChannelData? in return transaction.getPeerCachedData(peerId: peerId) as? CachedChannelData diff --git a/submodules/TelegramUI/TelegramUI/SecretChatKeyController.swift b/submodules/TelegramUI/TelegramUI/SecretChatKeyController.swift index 3c589fbf57..40dc5a7f67 100644 --- a/submodules/TelegramUI/TelegramUI/SecretChatKeyController.swift +++ b/submodules/TelegramUI/TelegramUI/SecretChatKeyController.swift @@ -5,19 +5,20 @@ import AsyncDisplayKit import TelegramCore import Postbox import TelegramPresentationData +import AccountContext final class SecretChatKeyController: ViewController { private var controllerNode: SecretChatKeyControllerNode { return self.displayNode as! SecretChatKeyControllerNode } - private let context: AccountContextImpl + private let context: AccountContext private let fingerprint: SecretChatKeyFingerprint private let peer: Peer private var presentationData: PresentationData - init(context: AccountContextImpl, fingerprint: SecretChatKeyFingerprint, peer: Peer) { + init(context: AccountContext, fingerprint: SecretChatKeyFingerprint, peer: Peer) { self.context = context self.fingerprint = fingerprint self.peer = peer diff --git a/submodules/TelegramUI/TelegramUI/SecretChatKeyControllerNode.swift b/submodules/TelegramUI/TelegramUI/SecretChatKeyControllerNode.swift index f35949967c..c926a102f9 100644 --- a/submodules/TelegramUI/TelegramUI/SecretChatKeyControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/SecretChatKeyControllerNode.swift @@ -6,6 +6,7 @@ import TelegramCore import Postbox import TelegramPresentationData import TextFormat +import AccountContext private func processHexString(_ string: String) -> String { var result = "" @@ -24,7 +25,7 @@ private func processHexString(_ string: String) -> String { } final class SecretChatKeyControllerNode: ViewControllerTracingNode { - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private let fingerprint: SecretChatKeyFingerprint private let peer: Peer @@ -37,7 +38,7 @@ final class SecretChatKeyControllerNode: ViewControllerTracingNode { private var validImageSize: CGSize? - init(context: AccountContextImpl, presentationData: PresentationData, fingerprint: SecretChatKeyFingerprint, peer: Peer, getNavigationController: @escaping () -> NavigationController?) { + init(context: AccountContext, presentationData: PresentationData, fingerprint: SecretChatKeyFingerprint, peer: Peer, getNavigationController: @escaping () -> NavigationController?) { self.context = context self.presentationData = presentationData self.fingerprint = fingerprint diff --git a/submodules/TelegramUI/TelegramUI/SecretMediaPreviewController.swift b/submodules/TelegramUI/TelegramUI/SecretMediaPreviewController.swift index 58d68b634c..a2d74f04a3 100644 --- a/submodules/TelegramUI/TelegramUI/SecretMediaPreviewController.swift +++ b/submodules/TelegramUI/TelegramUI/SecretMediaPreviewController.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import SwiftSignalKit import TelegramPresentationData +import AccountContext private func galleryMediaForMedia(media: Media) -> Media? { if let media = media as? TelegramMediaImage { @@ -115,7 +116,7 @@ private final class SecretMediaPreviewControllerNode: GalleryControllerNode { } public final class SecretMediaPreviewController: ViewController { - private let context: AccountContextImpl + private let context: AccountContext private let _ready = Promise() override public var ready: Promise { @@ -142,7 +143,7 @@ public final class SecretMediaPreviewController: ViewController { private var screenCaptureEventsDisposable: Disposable? - public init(context: AccountContextImpl, messageId: MessageId) { + public init(context: AccountContext, messageId: MessageId) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/SecureIdAuthController.swift b/submodules/TelegramUI/TelegramUI/SecureIdAuthController.swift index 58795615a0..96ea6e1e1a 100644 --- a/submodules/TelegramUI/TelegramUI/SecureIdAuthController.swift +++ b/submodules/TelegramUI/TelegramUI/SecureIdAuthController.swift @@ -8,6 +8,7 @@ import TelegramCore import TelegramPresentationData import TextFormat import ProgressNavigationButtonNode +import AccountContext public enum SecureIdRequestResult: String { case success = "success" @@ -67,7 +68,7 @@ final class SecureIdAuthController: ViewController { return self.displayNode as! SecureIdAuthControllerNode } - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private let mode: SecureIdAuthControllerMode @@ -83,7 +84,7 @@ final class SecureIdAuthController: ViewController { private let hapticFeedback = HapticFeedback() - init(context: AccountContextImpl, mode: SecureIdAuthControllerMode) { + init(context: AccountContext, mode: SecureIdAuthControllerMode) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/SecureIdAuthControllerNode.swift b/submodules/TelegramUI/TelegramUI/SecureIdAuthControllerNode.swift index ef6f523ea1..bcaf45a91e 100644 --- a/submodules/TelegramUI/TelegramUI/SecureIdAuthControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/SecureIdAuthControllerNode.swift @@ -7,9 +7,10 @@ import Postbox import TelegramCore import TelegramPresentationData import ActivityIndicator +import AccountContext final class SecureIdAuthControllerNode: ViewControllerTracingNode { - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private let requestLayout: (ContainedViewLayoutTransition) -> Void private let interaction: SecureIdAuthControllerInteraction @@ -32,7 +33,7 @@ final class SecureIdAuthControllerNode: ViewControllerTracingNode { private let deleteValueDisposable = MetaDisposable() - init(context: AccountContextImpl, presentationData: PresentationData, requestLayout: @escaping (ContainedViewLayoutTransition) -> Void, interaction: SecureIdAuthControllerInteraction) { + init(context: AccountContext, presentationData: PresentationData, requestLayout: @escaping (ContainedViewLayoutTransition) -> Void, interaction: SecureIdAuthControllerInteraction) { self.context = context self.presentationData = presentationData self.requestLayout = requestLayout diff --git a/submodules/TelegramUI/TelegramUI/SecureIdAuthFormFieldNode.swift b/submodules/TelegramUI/TelegramUI/SecureIdAuthFormFieldNode.swift index e7bfd8ba2e..7168a48eb7 100644 --- a/submodules/TelegramUI/TelegramUI/SecureIdAuthFormFieldNode.swift +++ b/submodules/TelegramUI/TelegramUI/SecureIdAuthFormFieldNode.swift @@ -5,6 +5,7 @@ import AsyncDisplayKit import Display import TelegramCore import TelegramPresentationData +import TelegramStringFormatting enum SecureIdRequestedIdentityDocument: Int32 { case passport diff --git a/submodules/TelegramUI/TelegramUI/SecureIdAuthHeaderNode.swift b/submodules/TelegramUI/TelegramUI/SecureIdAuthHeaderNode.swift index 821ec85ef8..8727078f06 100644 --- a/submodules/TelegramUI/TelegramUI/SecureIdAuthHeaderNode.swift +++ b/submodules/TelegramUI/TelegramUI/SecureIdAuthHeaderNode.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import SwiftSignalKit import TelegramPresentationData +import AvatarNode private let avatarFont = UIFont(name: ".SFCompactRounded-Semibold", size: 26.0)! private let titleFont = Font.semibold(14.0) diff --git a/submodules/TelegramUI/TelegramUI/SecureIdDocumentFormController.swift b/submodules/TelegramUI/TelegramUI/SecureIdDocumentFormController.swift index a04644f33a..b82c8273fc 100644 --- a/submodules/TelegramUI/TelegramUI/SecureIdDocumentFormController.swift +++ b/submodules/TelegramUI/TelegramUI/SecureIdDocumentFormController.swift @@ -7,6 +7,7 @@ import Postbox import TelegramCore import TelegramPresentationData import ProgressNavigationButtonNode +import AccountContext enum SecureIdDocumentFormScrollToSubject { case selfie @@ -19,7 +20,7 @@ enum SecureIdDocumentFormRequestedData { } final class SecureIdDocumentFormController: FormController { - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private let updatedValues: ([SecureIdValueWithContext]) -> Void @@ -32,7 +33,7 @@ final class SecureIdDocumentFormController: FormController Void) { + init(context: AccountContext, secureIdContext: SecureIdAccessContext, requestedData: SecureIdDocumentFormRequestedData, requestOptionalData: Bool = false, scrollTo: SecureIdDocumentFormScrollToSubject? = nil, primaryLanguageByCountry: [String: String], values: [SecureIdValueWithContext], updatedValues: @escaping ([SecureIdValueWithContext]) -> Void) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } self.secureIdContext = secureIdContext diff --git a/submodules/TelegramUI/TelegramUI/SecureIdDocumentFormControllerNode.swift b/submodules/TelegramUI/TelegramUI/SecureIdDocumentFormControllerNode.swift index 164494e4e5..3fc26f4607 100644 --- a/submodules/TelegramUI/TelegramUI/SecureIdDocumentFormControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/SecureIdDocumentFormControllerNode.swift @@ -6,6 +6,8 @@ import TelegramCore import Postbox import SwiftSignalKit import TelegramPresentationData +import TelegramStringFormatting +import AccountContext private enum SecureIdDocumentFormTextField { case identifier @@ -2126,7 +2128,7 @@ enum SecureIdDocumentFormEntry: FormControllerEntry { } struct SecureIdDocumentFormControllerNodeInitParams { - let context: AccountContextImpl + let context: AccountContext let secureIdContext: SecureIdAccessContext } @@ -2139,7 +2141,7 @@ final class SecureIdDocumentFormControllerNode: FormControllerNode Void) -> GalleryItem { + func item(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, secureIdContext: SecureIdAccessContext, delete: @escaping (TelegramMediaResource) -> Void) -> GalleryItem { return SecureIdDocumentGalleryItem(context: context, theme: theme, strings: strings, secureIdContext: secureIdContext, resource: self.resource, caption: self.error, location: self.location, delete: { delete(self.resource) }) @@ -47,7 +48,7 @@ class SecureIdDocumentGalleryController: ViewController { return self.displayNode as! GalleryControllerNode } - private let context: AccountContextImpl + private let context: AccountContext private let secureIdContext: SecureIdAccessContext private var presentationData: PresentationData @@ -77,7 +78,7 @@ class SecureIdDocumentGalleryController: ViewController { var deleteResource: ((TelegramMediaResource) -> Void)? - init(context: AccountContextImpl, secureIdContext: SecureIdAccessContext, entries: [SecureIdDocumentGalleryEntry], centralIndex: Int, replaceRootController: @escaping (ViewController, ValuePromise?) -> Void) { + init(context: AccountContext, secureIdContext: SecureIdAccessContext, entries: [SecureIdDocumentGalleryEntry], centralIndex: Int, replaceRootController: @escaping (ViewController, ValuePromise?) -> Void) { self.context = context self.secureIdContext = secureIdContext self.replaceRootController = replaceRootController diff --git a/submodules/TelegramUI/TelegramUI/SecureIdDocumentGalleryFooterContentNode.swift b/submodules/TelegramUI/TelegramUI/SecureIdDocumentGalleryFooterContentNode.swift index 65f8b78b32..d1344bf760 100644 --- a/submodules/TelegramUI/TelegramUI/SecureIdDocumentGalleryFooterContentNode.swift +++ b/submodules/TelegramUI/TelegramUI/SecureIdDocumentGalleryFooterContentNode.swift @@ -7,6 +7,7 @@ import TelegramCore import SwiftSignalKit import Photos import TelegramPresentationData +import AccountContext private let deleteImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Accessory Panels/MessageSelectionThrash"), color: .white) @@ -15,7 +16,7 @@ private let titleFont = Font.medium(15.0) private let dateFont = Font.regular(14.0) final class SecureIdDocumentGalleryFooterContentNode: GalleryFooterContentNode { - private let context: AccountContextImpl + private let context: AccountContext private var theme: PresentationTheme private var strings: PresentationStrings @@ -30,7 +31,7 @@ final class SecureIdDocumentGalleryFooterContentNode: GalleryFooterContentNode { var delete: (() -> Void)? - init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings) { + init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings) { self.context = context self.theme = theme self.strings = strings diff --git a/submodules/TelegramUI/TelegramUI/SecureIdDocumentImageGalleryItem.swift b/submodules/TelegramUI/TelegramUI/SecureIdDocumentImageGalleryItem.swift index 3a9faaed8b..8d8bb79d48 100644 --- a/submodules/TelegramUI/TelegramUI/SecureIdDocumentImageGalleryItem.swift +++ b/submodules/TelegramUI/TelegramUI/SecureIdDocumentImageGalleryItem.swift @@ -6,9 +6,10 @@ import SwiftSignalKit import Postbox import TelegramCore import TelegramPresentationData +import AccountContext class SecureIdDocumentGalleryItem: GalleryItem { - let context: AccountContextImpl + let context: AccountContext let theme: PresentationTheme let strings: PresentationStrings let secureIdContext: SecureIdAccessContext @@ -17,7 +18,7 @@ class SecureIdDocumentGalleryItem: GalleryItem { let location: SecureIdDocumentGalleryEntryLocation let delete: () -> Void - init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings, secureIdContext: SecureIdAccessContext, resource: TelegramMediaResource, caption: String, location: SecureIdDocumentGalleryEntryLocation, delete: @escaping () -> Void) { + init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, secureIdContext: SecureIdAccessContext, resource: TelegramMediaResource, caption: String, location: SecureIdDocumentGalleryEntryLocation, delete: @escaping () -> Void) { self.context = context self.theme = theme self.strings = strings @@ -56,14 +57,14 @@ class SecureIdDocumentGalleryItem: GalleryItem { } final class SecureIdDocumentGalleryItemNode: ZoomableContentGalleryItemNode { - private let context: AccountContextImpl + private let context: AccountContext private let imageNode: TransformImageNode fileprivate let _ready = Promise() fileprivate let _title = Promise() private let footerContentNode: SecureIdDocumentGalleryFooterContentNode - private var contextAndMedia: (AccountContextImpl, SecureIdAccessContext, TelegramMediaResource)? + private var contextAndMedia: (AccountContext, SecureIdAccessContext, TelegramMediaResource)? private var fetchDisposable = MetaDisposable() @@ -73,7 +74,7 @@ final class SecureIdDocumentGalleryItemNode: ZoomableContentGalleryItemNode { } } - init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings) { + init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings) { self.context = context self.imageNode = TransformImageNode() diff --git a/submodules/TelegramUI/TelegramUI/SecureIdDocumentTypeSelectionController.swift b/submodules/TelegramUI/TelegramUI/SecureIdDocumentTypeSelectionController.swift index e0108f2922..54d741cc95 100644 --- a/submodules/TelegramUI/TelegramUI/SecureIdDocumentTypeSelectionController.swift +++ b/submodules/TelegramUI/TelegramUI/SecureIdDocumentTypeSelectionController.swift @@ -5,6 +5,7 @@ import AsyncDisplayKit import SwiftSignalKit import TelegramCore import TelegramPresentationData +import AccountContext private func stringForDocumentType(_ type: SecureIdRequestedIdentityDocument, strings: PresentationStrings) -> String { switch type { @@ -80,7 +81,7 @@ final class SecureIdDocumentTypeSelectionController: ActionSheetController { return self._ready } - init(context: AccountContextImpl, field: SecureIdParsedRequestedFormField, currentValues: [SecureIdValueWithContext], completion: @escaping (SecureIdDocumentFormRequestedData) -> Void) { + init(context: AccountContext, field: SecureIdParsedRequestedFormField, currentValues: [SecureIdValueWithContext], completion: @escaping (SecureIdDocumentFormRequestedData) -> Void) { let presentationData = context.sharedContext.currentPresentationData.with { $0 } let theme = presentationData.theme let strings = presentationData.strings diff --git a/submodules/TelegramUI/TelegramUI/SecureIdPlaintextFormController.swift b/submodules/TelegramUI/TelegramUI/SecureIdPlaintextFormController.swift index ab136c467a..b86e7a5203 100644 --- a/submodules/TelegramUI/TelegramUI/SecureIdPlaintextFormController.swift +++ b/submodules/TelegramUI/TelegramUI/SecureIdPlaintextFormController.swift @@ -7,6 +7,7 @@ import Postbox import TelegramCore import TelegramPresentationData import ProgressNavigationButtonNode +import AccountContext enum SecureIdPlaintextFormType { case phone @@ -14,7 +15,7 @@ enum SecureIdPlaintextFormType { } final class SecureIdPlaintextFormController: FormController { - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private let updatedValue: (SecureIdValueWithContext?) -> Void @@ -25,7 +26,7 @@ final class SecureIdPlaintextFormController: FormController Void) { + init(context: AccountContext, secureIdContext: SecureIdAccessContext, type: SecureIdPlaintextFormType, immediatelyAvailableValue: SecureIdValue?, updatedValue: @escaping (SecureIdValueWithContext?) -> Void) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } self.secureIdContext = secureIdContext diff --git a/submodules/TelegramUI/TelegramUI/SecureIdPlaintextFormControllerNode.swift b/submodules/TelegramUI/TelegramUI/SecureIdPlaintextFormControllerNode.swift index 76370cf70a..b159d07850 100644 --- a/submodules/TelegramUI/TelegramUI/SecureIdPlaintextFormControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/SecureIdPlaintextFormControllerNode.swift @@ -7,6 +7,7 @@ import Postbox import SwiftSignalKit import CoreTelephony import TelegramPresentationData +import AccountContext private func cleanPhoneNumber(_ text: String?) -> String { var cleanNumber = "" @@ -625,7 +626,7 @@ enum SecureIdPlaintextFormEntry: FormControllerEntry { } struct SecureIdPlaintextFormControllerNodeInitParams { - let context: AccountContextImpl + let context: AccountContext let secureIdContext: SecureIdAccessContext } @@ -643,7 +644,7 @@ final class SecureIdPlaintextFormControllerNode: FormControllerNode Void)? diff --git a/submodules/TelegramUI/TelegramUI/SecureIdValueFormFileItem.swift b/submodules/TelegramUI/TelegramUI/SecureIdValueFormFileItem.swift index 2151c83402..a29e038cbe 100644 --- a/submodules/TelegramUI/TelegramUI/SecureIdValueFormFileItem.swift +++ b/submodules/TelegramUI/TelegramUI/SecureIdValueFormFileItem.swift @@ -5,6 +5,7 @@ import Display import TelegramCore import TelegramPresentationData import ItemListUI +import TelegramStringFormatting private let textFont = Font.regular(16.0) private let labelFont = Font.regular(13.0) diff --git a/submodules/TelegramUI/TelegramUI/SelectablePeerNode.swift b/submodules/TelegramUI/TelegramUI/SelectablePeerNode.swift index 95a39b3b34..31e227b43a 100644 --- a/submodules/TelegramUI/TelegramUI/SelectablePeerNode.swift +++ b/submodules/TelegramUI/TelegramUI/SelectablePeerNode.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import SwiftSignalKit import TelegramPresentationData +import AvatarNode import LegacyComponents diff --git a/submodules/TelegramUI/TelegramUI/SelectivePrivacySettingsController.swift b/submodules/TelegramUI/TelegramUI/SelectivePrivacySettingsController.swift index 2810895775..a9360c7e9c 100644 --- a/submodules/TelegramUI/TelegramUI/SelectivePrivacySettingsController.swift +++ b/submodules/TelegramUI/TelegramUI/SelectivePrivacySettingsController.swift @@ -7,6 +7,7 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext enum SelectivePrivacySettingsKind { case presence @@ -40,7 +41,7 @@ enum SelectivePrivacySettingsPeerTarget { } private final class SelectivePrivacySettingsControllerArguments { - let context: AccountContextImpl + let context: AccountContext let updateType: (SelectivePrivacySettingType) -> Void let openSelective: (SelectivePrivacySettingsPeerTarget, Bool) -> Void @@ -48,7 +49,7 @@ private final class SelectivePrivacySettingsControllerArguments { let updateCallP2PMode: ((SelectivePrivacySettingType) -> Void)? let updateCallIntegrationEnabled: ((Bool) -> Void)? - init(context: AccountContextImpl, updateType: @escaping (SelectivePrivacySettingType) -> Void, openSelective: @escaping (SelectivePrivacySettingsPeerTarget, Bool) -> Void, updateCallP2PMode: ((SelectivePrivacySettingType) -> Void)?, updateCallIntegrationEnabled: ((Bool) -> Void)?) { + init(context: AccountContext, updateType: @escaping (SelectivePrivacySettingType) -> Void, openSelective: @escaping (SelectivePrivacySettingsPeerTarget, Bool) -> Void, updateCallP2PMode: ((SelectivePrivacySettingType) -> Void)?, updateCallIntegrationEnabled: ((Bool) -> Void)?) { self.context = context self.updateType = updateType self.openSelective = openSelective @@ -579,7 +580,7 @@ private func selectivePrivacySettingsControllerEntries(presentationData: Present return entries } -func selectivePrivacySettingsController(context: AccountContextImpl, kind: SelectivePrivacySettingsKind, current: SelectivePrivacySettings, callSettings: (SelectivePrivacySettings, VoiceCallSettings)? = nil, voipConfiguration: VoipConfiguration? = nil, callIntegrationAvailable: Bool? = nil, updated: @escaping (SelectivePrivacySettings, (SelectivePrivacySettings, VoiceCallSettings)?) -> Void) -> ViewController { +func selectivePrivacySettingsController(context: AccountContext, kind: SelectivePrivacySettingsKind, current: SelectivePrivacySettings, callSettings: (SelectivePrivacySettings, VoiceCallSettings)? = nil, voipConfiguration: VoipConfiguration? = nil, callIntegrationAvailable: Bool? = nil, updated: @escaping (SelectivePrivacySettings, (SelectivePrivacySettings, VoiceCallSettings)?) -> Void) -> ViewController { let strings = context.sharedContext.currentPresentationData.with { $0 }.strings var initialEnableFor: [PeerId: SelectivePrivacyPeer] = [:] diff --git a/submodules/TelegramUI/TelegramUI/SelectivePrivacySettingsPeersController.swift b/submodules/TelegramUI/TelegramUI/SelectivePrivacySettingsPeersController.swift index ea0c92a7c2..ab5a8dc6d4 100644 --- a/submodules/TelegramUI/TelegramUI/SelectivePrivacySettingsPeersController.swift +++ b/submodules/TelegramUI/TelegramUI/SelectivePrivacySettingsPeersController.swift @@ -7,6 +7,7 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext private final class SelectivePrivacyPeersControllerArguments { let account: Account @@ -223,7 +224,7 @@ private func selectivePrivacyPeersControllerEntries(presentationData: Presentati return entries } -public func selectivePrivacyPeersController(context: AccountContextImpl, title: String, initialPeers: [PeerId: SelectivePrivacyPeer], updated: @escaping ([PeerId: SelectivePrivacyPeer]) -> Void) -> ViewController { +public func selectivePrivacyPeersController(context: AccountContext, title: String, initialPeers: [PeerId: SelectivePrivacyPeer], updated: @escaping ([PeerId: SelectivePrivacyPeer]) -> Void) -> ViewController { let statePromise = ValuePromise(SelectivePrivacyPeersControllerState(), ignoreRepeated: true) let stateValue = Atomic(value: SelectivePrivacyPeersControllerState()) let updateState: ((SelectivePrivacyPeersControllerState) -> SelectivePrivacyPeersControllerState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/SettingsController.swift b/submodules/TelegramUI/TelegramUI/SettingsController.swift index 1d452e708f..51f3ec975b 100644 --- a/submodules/TelegramUI/TelegramUI/SettingsController.swift +++ b/submodules/TelegramUI/TelegramUI/SettingsController.swift @@ -16,6 +16,8 @@ import TelegramUIPreferences import DeviceAccess import ItemListUI import AccountContext +import OverlayStatusController +import AvatarNode private let maximumNumberOfAccounts = 3 @@ -532,12 +534,12 @@ private func settingsEntries(account: Account, presentationData: PresentationDat } public protocol SettingsController: class { - func updateContext(context: AccountContextImpl) + func updateContext(context: AccountContext) } private final class SettingsControllerImpl: ItemListController, SettingsController, TabBarContainedController { - let sharedContext: SharedAccountContextImpl - let contextValue: Promise + let sharedContext: SharedAccountContext + let contextValue: Promise var accountsAndPeersValue: ((Account, Peer)?, [(Account, Peer, Int32)])? var accountsAndPeersDisposable: Disposable? @@ -550,7 +552,7 @@ private final class SettingsControllerImpl: ItemListController, S return false } - init(currentContext: AccountContextImpl, contextValue: Promise, state: Signal<(ItemListControllerState, (ItemListNodeState, SettingsEntry.ItemGenerationArguments)), NoError>, tabBarItem: Signal?, accountsAndPeers: Signal<((Account, Peer)?, [(Account, Peer, Int32)]), NoError>) { + init(currentContext: AccountContext, contextValue: Promise, state: Signal<(ItemListControllerState, (ItemListNodeState, SettingsEntry.ItemGenerationArguments)), NoError>, tabBarItem: Signal?, accountsAndPeers: Signal<((Account, Peer)?, [(Account, Peer, Int32)]), NoError>) { self.sharedContext = currentContext.sharedContext self.contextValue = contextValue let presentationData = currentContext.sharedContext.currentPresentationData.with { $0 } @@ -579,7 +581,7 @@ private final class SettingsControllerImpl: ItemListController, S self.accountsAndPeersDisposable?.dispose() } - func updateContext(context: AccountContextImpl) { + func updateContext(context: AccountContext) { //self.contextValue.set(.single(context)) } @@ -600,7 +602,7 @@ private final class SettingsControllerImpl: ItemListController, S } } -public func settingsController(context: AccountContextImpl, accountManager: AccountManager) -> SettingsController & ViewController { +public func settingsController(context: AccountContext, accountManager: AccountManager) -> SettingsController & ViewController { let initialState = SettingsState(updatingAvatar: nil, accountIdWithRevealedOptions: nil, isSearching: false) let statePromise = ValuePromise(initialState, ignoreRepeated: true) let stateValue = Atomic(value: initialState) @@ -642,7 +644,7 @@ public func settingsController(context: AccountContextImpl, accountManager: Acco let archivedPacks = Promise<[ArchivedStickerPackItem]?>() - let contextValue = Promise() + let contextValue = Promise() let accountsAndPeers = Promise<((Account, Peer)?, [(Account, Peer, Int32)])>() accountsAndPeers.set(activeAccountsAndPeers(context: context)) @@ -1350,7 +1352,7 @@ public func settingsController(context: AccountContextImpl, accountManager: Acco |> take(1) |> deliverOnMainQueue).start(next: { context in accountsAndPeers.set(.never()) - context.sharedContext.switchToAccount(id: id) + context.sharedContext.switchToAccount(id: id, fromSettingsController: nil, withChatListController: nil) }) } controller.didAppear = { _ in @@ -1370,14 +1372,14 @@ public func settingsController(context: AccountContextImpl, accountManager: Acco } } }) - var sharedContext: SharedAccountContextImpl? + var sharedContext: SharedAccountContext? let _ = (contextValue.get() |> deliverOnMainQueue |> take(1)).start(next: { context in sharedContext = context.sharedContext }) if let selectedAccount = selectedAccount, let sharedContext = sharedContext { - let accountContext = AccountContextImpl(sharedContext: sharedContext, account: selectedAccount, limitsConfiguration: LimitsConfiguration.defaultValue) + let accountContext = sharedContext.makeTempAccountContext(account: selectedAccount) let chatListController = ChatListController(context: accountContext, groupId: .root, controlsHistoryPreload: false, hideNetworkActivityStatus: true) return chatListController } @@ -1389,7 +1391,7 @@ public func settingsController(context: AccountContextImpl, accountManager: Acco let _ = (contextValue.get() |> deliverOnMainQueue |> take(1)).start(next: { context in - context.sharedContext.switchToAccount(id: chatListController.context.account.id, withChatListController: chatListController) + context.sharedContext.switchToAccount(id: chatListController.context.account.id, fromSettingsController: nil, withChatListController: chatListController) }) } } @@ -1397,7 +1399,7 @@ public func settingsController(context: AccountContextImpl, accountManager: Acco let _ = (contextValue.get() |> take(1) |> deliverOnMainQueue).start(next: { context in - context.sharedContext.switchToAccount(id: id) + context.sharedContext.switchToAccount(id: id, fromSettingsController: nil, withChatListController: nil) }) } controller.addAccount = { diff --git a/submodules/TelegramUI/TelegramUI/SettingsSearchItem.swift b/submodules/TelegramUI/TelegramUI/SettingsSearchItem.swift index 93e9893424..5fb47c6429 100644 --- a/submodules/TelegramUI/TelegramUI/SettingsSearchItem.swift +++ b/submodules/TelegramUI/TelegramUI/SettingsSearchItem.swift @@ -8,6 +8,7 @@ import SwiftSignalKit import TelegramPresentationData import MergeLists import ItemListUI +import AccountContext extension NavigationBarSearchContentNode: ItemListControllerSearchNavigationContentNode { func activate() { @@ -56,7 +57,7 @@ extension SettingsSearchableItemIcon { } final class SettingsSearchItem: ItemListControllerSearch { - let context: AccountContextImpl + let context: AccountContext let theme: PresentationTheme let placeholder: String let activated: Bool @@ -72,7 +73,7 @@ final class SettingsSearchItem: ItemListControllerSearch { private var activity: ValuePromise = ValuePromise(ignoreRepeated: false) private let activityDisposable = MetaDisposable() - init(context: AccountContextImpl, theme: PresentationTheme, placeholder: String, activated: Bool, updateActivated: @escaping (Bool) -> Void, presentController: @escaping (ViewController, Any?) -> Void, pushController: @escaping (ViewController) -> Void, getNavigationController: (() -> NavigationController?)?, exceptionsList: Signal, archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>, privacySettings: Signal) { + init(context: AccountContext, theme: PresentationTheme, placeholder: String, activated: Bool, updateActivated: @escaping (Bool) -> Void, presentController: @escaping (ViewController, Any?) -> Void, pushController: @escaping (ViewController) -> Void, getNavigationController: (() -> NavigationController?)?, exceptionsList: Signal, archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>, privacySettings: Signal) { self.context = context self.theme = theme self.placeholder = placeholder @@ -321,7 +322,7 @@ private final class SettingsSearchContainerNode: SearchDisplayControllerContentN private var presentationDataDisposable: Disposable? private let presentationDataPromise: Promise - init(context: AccountContextImpl, openResult: @escaping (SettingsSearchableItem) -> Void, exceptionsList: Signal, archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>, privacySettings: Signal) { + init(context: AccountContext, openResult: @escaping (SettingsSearchableItem) -> Void, exceptionsList: Signal, archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>, privacySettings: Signal) { self.presentationData = context.sharedContext.currentPresentationData.with { $0 } self.presentationDataPromise = Promise(self.presentationData) @@ -617,7 +618,7 @@ private final class SettingsSearchContainerNode: SearchDisplayControllerContentN } private final class SettingsSearchItemNode: ItemListControllerSearchNode { - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private var containerLayout: (ContainerViewLayout, CGFloat)? private var searchDisplayController: SearchDisplayController? @@ -631,7 +632,7 @@ private final class SettingsSearchItemNode: ItemListControllerSearchNode { var cancel: () -> Void - init(context: AccountContextImpl, cancel: @escaping () -> Void, updateActivity: @escaping(Bool) -> Void, pushController: @escaping (ViewController) -> Void, presentController: @escaping (ViewController, Any?) -> Void, getNavigationController: (() -> NavigationController?)?, exceptionsList: Signal, archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>, privacySettings: Signal) { + init(context: AccountContext, cancel: @escaping () -> Void, updateActivity: @escaping(Bool) -> Void, pushController: @escaping (ViewController) -> Void, presentController: @escaping (ViewController, Any?) -> Void, getNavigationController: (() -> NavigationController?)?, exceptionsList: Signal, archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>, privacySettings: Signal) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } self.cancel = cancel diff --git a/submodules/TelegramUI/TelegramUI/SettingsSearchableItems.swift b/submodules/TelegramUI/TelegramUI/SettingsSearchableItems.swift index ffc7f55141..d46956f1e6 100644 --- a/submodules/TelegramUI/TelegramUI/SettingsSearchableItems.swift +++ b/submodules/TelegramUI/TelegramUI/SettingsSearchableItems.swift @@ -6,6 +6,8 @@ import Postbox import TelegramCore import TelegramUIPreferences import TelegramCallsUI +import OverlayStatusController +import AccountContext private let maximumNumberOfAccounts = 3 @@ -150,7 +152,7 @@ struct SettingsSearchableItem { let alternate: [String] let icon: SettingsSearchableItemIcon let breadcrumbs: [String] - let present: (AccountContextImpl, NavigationController?, @escaping (SettingsSearchableItemPresentation, ViewController?) -> Void) -> Void + let present: (AccountContext, NavigationController?, @escaping (SettingsSearchableItemPresentation, ViewController?) -> Void) -> Void } private func synonyms(_ string: String?) -> [String] { @@ -161,11 +163,11 @@ private func synonyms(_ string: String?) -> [String] { } } -private func profileSearchableItems(context: AccountContextImpl, canAddAccount: Bool) -> [SettingsSearchableItem] { +private func profileSearchableItems(context: AccountContext, canAddAccount: Bool) -> [SettingsSearchableItem] { let icon: SettingsSearchableItemIcon = .profile let strings = context.sharedContext.currentPresentationData.with { $0 }.strings - let presentProfileSettings: (AccountContextImpl, @escaping (SettingsSearchableItemPresentation, ViewController?) -> Void, EditSettingsEntryTag?) -> Void = { context, present, itemTag in + let presentProfileSettings: (AccountContext, @escaping (SettingsSearchableItemPresentation, ViewController?) -> Void, EditSettingsEntryTag?) -> Void = { context, present, itemTag in let _ = openEditSettings(context: context, accountsAndPeers: activeAccountsAndPeers(context: context), focusOnItemTag: itemTag, presentController: { controller, _ in present(.immediate, controller) }, pushController: { controller in @@ -211,11 +213,11 @@ private func profileSearchableItems(context: AccountContextImpl, canAddAccount: return items } -private func callSearchableItems(context: AccountContextImpl) -> [SettingsSearchableItem] { +private func callSearchableItems(context: AccountContext) -> [SettingsSearchableItem] { let icon: SettingsSearchableItemIcon = .calls let strings = context.sharedContext.currentPresentationData.with { $0 }.strings - let presentCallSettings: (AccountContextImpl, (SettingsSearchableItemPresentation, ViewController?) -> Void) -> Void = { context, present in + let presentCallSettings: (AccountContext, (SettingsSearchableItemPresentation, ViewController?) -> Void) -> Void = { context, present in present(.push, CallListController(context: context, mode: .navigation)) } @@ -229,11 +231,11 @@ private func callSearchableItems(context: AccountContextImpl) -> [SettingsSearch ] } -private func stickerSearchableItems(context: AccountContextImpl, archivedStickerPacks: [ArchivedStickerPackItem]?) -> [SettingsSearchableItem] { +private func stickerSearchableItems(context: AccountContext, archivedStickerPacks: [ArchivedStickerPackItem]?) -> [SettingsSearchableItem] { let icon: SettingsSearchableItemIcon = .stickers let strings = context.sharedContext.currentPresentationData.with { $0 }.strings - let presentStickerSettings: (AccountContextImpl, (SettingsSearchableItemPresentation, ViewController?) -> Void, InstalledStickerPacksEntryTag?) -> Void = { context, present, itemTag in + let presentStickerSettings: (AccountContext, (SettingsSearchableItemPresentation, ViewController?) -> Void, InstalledStickerPacksEntryTag?) -> Void = { context, present, itemTag in present(.push, installedStickerPacksController(context: context, mode: .general, archivedPacks: archivedStickerPacks, updatedPacks: { _ in }, focusOnItemTag: itemTag)) } @@ -259,11 +261,11 @@ private func stickerSearchableItems(context: AccountContextImpl, archivedSticker return items } -private func notificationSearchableItems(context: AccountContextImpl, settings: GlobalNotificationSettingsSet, exceptionsList: NotificationExceptionsList?) -> [SettingsSearchableItem] { +private func notificationSearchableItems(context: AccountContext, settings: GlobalNotificationSettingsSet, exceptionsList: NotificationExceptionsList?) -> [SettingsSearchableItem] { let icon: SettingsSearchableItemIcon = .notifications let strings = context.sharedContext.currentPresentationData.with { $0 }.strings - let presentNotificationSettings: (AccountContextImpl, (SettingsSearchableItemPresentation, ViewController?) -> Void, NotificationsAndSoundsEntryTag?) -> Void = { context, present, itemTag in + let presentNotificationSettings: (AccountContext, (SettingsSearchableItemPresentation, ViewController?) -> Void, NotificationsAndSoundsEntryTag?) -> Void = { context, present, itemTag in present(.push, notificationsAndSoundsController(context: context, exceptionsList: exceptionsList, focusOnItemTag: itemTag)) } @@ -412,15 +414,15 @@ private func notificationSearchableItems(context: AccountContextImpl, settings: ] } -private func privacySearchableItems(context: AccountContextImpl, privacySettings: AccountPrivacySettings?) -> [SettingsSearchableItem] { +private func privacySearchableItems(context: AccountContext, privacySettings: AccountPrivacySettings?) -> [SettingsSearchableItem] { let icon: SettingsSearchableItemIcon = .privacy let strings = context.sharedContext.currentPresentationData.with { $0 }.strings - let presentPrivacySettings: (AccountContextImpl, (SettingsSearchableItemPresentation, ViewController?) -> Void, PrivacyAndSecurityEntryTag?) -> Void = { context, present, itemTag in + let presentPrivacySettings: (AccountContext, (SettingsSearchableItemPresentation, ViewController?) -> Void, PrivacyAndSecurityEntryTag?) -> Void = { context, present, itemTag in present(.push, privacyAndSecurityController(context: context, focusOnItemTag: itemTag)) } - let presentSelectivePrivacySettings: (AccountContextImpl, SelectivePrivacySettingsKind, @escaping (SettingsSearchableItemPresentation, ViewController?) -> Void) -> Void = { context, kind, present in + let presentSelectivePrivacySettings: (AccountContext, SelectivePrivacySettingsKind, @escaping (SettingsSearchableItemPresentation, ViewController?) -> Void) -> Void = { context, kind, present in let privacySignal: Signal if let privacySettings = privacySettings { privacySignal = .single(privacySettings) @@ -468,7 +470,7 @@ private func privacySearchableItems(context: AccountContextImpl, privacySettings }) } - let presentDataPrivacySettings: (AccountContextImpl, (SettingsSearchableItemPresentation, ViewController?) -> Void) -> Void = { context, present in + let presentDataPrivacySettings: (AccountContext, (SettingsSearchableItemPresentation, ViewController?) -> Void) -> Void = { context, present in present(.push, dataPrivacyController(context: context)) } @@ -560,11 +562,11 @@ private func privacySearchableItems(context: AccountContextImpl, privacySettings ] } -private func dataSearchableItems(context: AccountContextImpl) -> [SettingsSearchableItem] { +private func dataSearchableItems(context: AccountContext) -> [SettingsSearchableItem] { let icon: SettingsSearchableItemIcon = .data let strings = context.sharedContext.currentPresentationData.with { $0 }.strings - let presentDataSettings: (AccountContextImpl, (SettingsSearchableItemPresentation, ViewController?) -> Void, DataAndStorageEntryTag?) -> Void = { context, present, itemTag in + let presentDataSettings: (AccountContext, (SettingsSearchableItemPresentation, ViewController?) -> Void, DataAndStorageEntryTag?) -> Void = { context, present, itemTag in present(.push, dataAndStorageController(context: context, focusOnItemTag: itemTag)) } @@ -614,11 +616,11 @@ private func dataSearchableItems(context: AccountContextImpl) -> [SettingsSearch ] } -private func proxySearchableItems(context: AccountContextImpl, servers: [ProxyServerSettings]) -> [SettingsSearchableItem] { +private func proxySearchableItems(context: AccountContext, servers: [ProxyServerSettings]) -> [SettingsSearchableItem] { let icon: SettingsSearchableItemIcon = .proxy let strings = context.sharedContext.currentPresentationData.with { $0 }.strings - let presentProxySettings: (AccountContextImpl, (SettingsSearchableItemPresentation, ViewController?) -> Void) -> Void = { context, present in + let presentProxySettings: (AccountContext, (SettingsSearchableItemPresentation, ViewController?) -> Void) -> Void = { context, present in present(.push, proxySettingsController(context: context)) } @@ -645,11 +647,11 @@ private func proxySearchableItems(context: AccountContextImpl, servers: [ProxySe return items } -private func appearanceSearchableItems(context: AccountContextImpl) -> [SettingsSearchableItem] { +private func appearanceSearchableItems(context: AccountContext) -> [SettingsSearchableItem] { let icon: SettingsSearchableItemIcon = .appearance let strings = context.sharedContext.currentPresentationData.with { $0 }.strings - let presentAppearanceSettings: (AccountContextImpl, (SettingsSearchableItemPresentation, ViewController?) -> Void, ThemeSettingsEntryTag?) -> Void = { context, present, itemTag in + let presentAppearanceSettings: (AccountContext, (SettingsSearchableItemPresentation, ViewController?) -> Void, ThemeSettingsEntryTag?) -> Void = { context, present, itemTag in present(.push, themeSettingsController(context: context, focusOnItemTag: itemTag)) } @@ -686,11 +688,11 @@ private func appearanceSearchableItems(context: AccountContextImpl) -> [Settings ] } -private func languageSearchableItems(context: AccountContextImpl, localizations: [LocalizationInfo]) -> [SettingsSearchableItem] { +private func languageSearchableItems(context: AccountContext, localizations: [LocalizationInfo]) -> [SettingsSearchableItem] { let icon: SettingsSearchableItemIcon = .language let strings = context.sharedContext.currentPresentationData.with { $0 }.strings - let applyLocalization: (AccountContextImpl, @escaping (SettingsSearchableItemPresentation, ViewController?) -> Void, String) -> Void = { context, present, languageCode in + let applyLocalization: (AccountContext, @escaping (SettingsSearchableItemPresentation, ViewController?) -> Void, String) -> Void = { context, present, languageCode in let presentationData = context.sharedContext.currentPresentationData.with { $0 } let controller = OverlayStatusController(theme: presentationData.theme, strings: presentationData.strings, type: .loading(cancelled: nil)) present(.immediate, controller) @@ -716,7 +718,7 @@ private func languageSearchableItems(context: AccountContextImpl, localizations: return items } -func settingsSearchableItems(context: AccountContextImpl, notificationExceptionsList: Signal, archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>, privacySettings: Signal) -> Signal<[SettingsSearchableItem], NoError> { +func settingsSearchableItems(context: AccountContext, notificationExceptionsList: Signal, archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>, privacySettings: Signal) -> Signal<[SettingsSearchableItem], NoError> { let watchAppInstalled = (context.watchManager?.watchAppInstalled ?? .single(false)) |> take(1) diff --git a/submodules/TelegramUI/TelegramUI/SettingsThemeWallpaperNode.swift b/submodules/TelegramUI/TelegramUI/SettingsThemeWallpaperNode.swift index 749f634fe5..a203b043fe 100644 --- a/submodules/TelegramUI/TelegramUI/SettingsThemeWallpaperNode.swift +++ b/submodules/TelegramUI/TelegramUI/SettingsThemeWallpaperNode.swift @@ -6,6 +6,7 @@ import TelegramCore import Postbox import SwiftSignalKit import TelegramPresentationData +import AccountContext private func whiteColorImage(theme: PresentationTheme) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> { return .single({ arguments in @@ -59,7 +60,7 @@ final class SettingsThemeWallpaperNode: ASDisplayNode { self.statusNode.transitionToState(state, animated: animated, completion: {}) } - func setWallpaper(context: AccountContextImpl, wallpaper: TelegramWallpaper, selected: Bool, size: CGSize, cornerRadius: CGFloat = 0.0, synchronousLoad: Bool = false) { + func setWallpaper(context: AccountContext, wallpaper: TelegramWallpaper, selected: Bool, size: CGSize, cornerRadius: CGFloat = 0.0, synchronousLoad: Bool = false) { self.buttonNode.frame = CGRect(origin: CGPoint(), size: size) self.backgroundNode.frame = CGRect(origin: CGPoint(), size: size) self.imageNode.frame = CGRect(origin: CGPoint(), size: size) diff --git a/submodules/TelegramUI/TelegramUI/SetupTwoStepVerificationController.swift b/submodules/TelegramUI/TelegramUI/SetupTwoStepVerificationController.swift index 7447f027dc..12fbe931f9 100644 --- a/submodules/TelegramUI/TelegramUI/SetupTwoStepVerificationController.swift +++ b/submodules/TelegramUI/TelegramUI/SetupTwoStepVerificationController.swift @@ -7,9 +7,10 @@ import SwiftSignalKit import TelegramCore import TelegramPresentationData import ProgressNavigationButtonNode +import AccountContext class SetupTwoStepVerificationController: ViewController { - private let context: AccountContextImpl + private let context: AccountContext private let initialState: SetupTwoStepVerificationInitialState private let stateUpdated: (SetupTwoStepVerificationStateUpdate, Bool, SetupTwoStepVerificationController) -> Void @@ -30,7 +31,7 @@ class SetupTwoStepVerificationController: ViewController { private var presentationData: PresentationData private var presentationDataDisposable: Disposable? - init(context: AccountContextImpl, initialState: SetupTwoStepVerificationInitialState, stateUpdated: @escaping (SetupTwoStepVerificationStateUpdate, Bool, SetupTwoStepVerificationController) -> Void) { + init(context: AccountContext, initialState: SetupTwoStepVerificationInitialState, stateUpdated: @escaping (SetupTwoStepVerificationStateUpdate, Bool, SetupTwoStepVerificationController) -> Void) { self.context = context self.initialState = initialState self.stateUpdated = stateUpdated diff --git a/submodules/TelegramUI/TelegramUI/SetupTwoStepVerificationControllerNode.swift b/submodules/TelegramUI/TelegramUI/SetupTwoStepVerificationControllerNode.swift index f8d90dc440..0b2cab0918 100644 --- a/submodules/TelegramUI/TelegramUI/SetupTwoStepVerificationControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/SetupTwoStepVerificationControllerNode.swift @@ -7,6 +7,7 @@ import TelegramCore import SwiftSignalKit import TelegramPresentationData import ActivityIndicator +import AccountContext enum SetupTwoStepVerificationInitialState { case automatic @@ -137,7 +138,7 @@ enum SetupTwoStepVerificationStateUpdate { } final class SetupTwoStepVerificationControllerNode: ViewControllerTracingNode { - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private let updateBackAction: (Bool) -> Void private let updateNextAction: (SetupTwoStepVerificationNextAction) -> Void @@ -150,7 +151,7 @@ final class SetupTwoStepVerificationControllerNode: ViewControllerTracingNode { private var contentNode: SetupTwoStepVerificationContentNode? private let actionDisposable = MetaDisposable() - init(context: AccountContextImpl, updateBackAction: @escaping (Bool) -> Void, updateNextAction: @escaping (SetupTwoStepVerificationNextAction) -> Void, stateUpdated: @escaping (SetupTwoStepVerificationStateUpdate, Bool) -> Void, present: @escaping (ViewController, Any?) -> Void, dismiss: @escaping () -> Void, initialState: SetupTwoStepVerificationInitialState) { + init(context: AccountContext, updateBackAction: @escaping (Bool) -> Void, updateNextAction: @escaping (SetupTwoStepVerificationNextAction) -> Void, stateUpdated: @escaping (SetupTwoStepVerificationStateUpdate, Bool) -> Void, present: @escaping (ViewController, Any?) -> Void, dismiss: @escaping () -> Void, initialState: SetupTwoStepVerificationInitialState) { self.context = context self.updateBackAction = updateBackAction self.updateNextAction = updateNextAction diff --git a/submodules/TelegramUI/TelegramUI/ShareController.swift b/submodules/TelegramUI/TelegramUI/ShareController.swift index e04b150f5a..2ab5df6924 100644 --- a/submodules/TelegramUI/TelegramUI/ShareController.swift +++ b/submodules/TelegramUI/TelegramUI/ShareController.swift @@ -7,6 +7,7 @@ import TelegramCore import SwiftSignalKit import TelegramPresentationData import TextFormat +import AccountContext public struct ShareControllerAction { let title: String @@ -192,8 +193,8 @@ public final class ShareController: ViewController { private var animatedIn = false - private let sharedContext: SharedAccountContextImpl - private let currentContext: AccountContextImpl + private let sharedContext: SharedAccountContext + private let currentContext: AccountContext private var currentAccount: Account private var presentationData: PresentationData private var presentationDataDisposable: Disposable? @@ -212,11 +213,11 @@ public final class ShareController: ViewController { public var dismissed: ((Bool) -> Void)? - public convenience init(context: AccountContextImpl, subject: ShareControllerSubject, preferredAction: ShareControllerPreferredAction = .default, showInChat: ((Message) -> Void)? = nil, externalShare: Bool = true, immediateExternalShare: Bool = false, switchableAccounts: [AccountWithInfo] = []) { + public convenience init(context: AccountContext, subject: ShareControllerSubject, preferredAction: ShareControllerPreferredAction = .default, showInChat: ((Message) -> Void)? = nil, externalShare: Bool = true, immediateExternalShare: Bool = false, switchableAccounts: [AccountWithInfo] = []) { self.init(sharedContext: context.sharedContext, currentContext: context, subject: subject, preferredAction: preferredAction, showInChat: showInChat, externalShare: externalShare, immediateExternalShare: immediateExternalShare, switchableAccounts: switchableAccounts) } - public init(sharedContext: SharedAccountContextImpl, currentContext: AccountContextImpl, subject: ShareControllerSubject, preferredAction: ShareControllerPreferredAction = .default, showInChat: ((Message) -> Void)? = nil, externalShare: Bool = true, immediateExternalShare: Bool = false, switchableAccounts: [AccountWithInfo] = []) { + public init(sharedContext: SharedAccountContext, currentContext: AccountContext, subject: ShareControllerSubject, preferredAction: ShareControllerPreferredAction = .default, showInChat: ((Message) -> Void)? = nil, externalShare: Bool = true, immediateExternalShare: Bool = false, switchableAccounts: [AccountWithInfo] = []) { self.sharedContext = sharedContext self.currentContext = currentContext self.currentAccount = currentContext.account @@ -656,11 +657,11 @@ public final class ShareController: ViewController { let postbox = self.currentAccount.postbox let signals: [Signal] = messages.compactMap { message -> Signal? in if let media = message.media.first { - let context: AccountContextImpl + let context: AccountContext if self.currentContext.account.id == self.currentAccount.id { context = self.currentContext } else { - context = AccountContextImpl(sharedContext: self.sharedContext, account: self.currentAccount, limitsConfiguration: .defaultValue) + context = self.sharedContext.makeTempAccountContext(account: self.currentAccount) } return TelegramUI.saveToCameraRoll(context: context, postbox: postbox, mediaReference: .message(message: MessageReference(message), media: media)) } else { @@ -683,21 +684,21 @@ public final class ShareController: ViewController { private func saveToCameraRoll(representations: [ImageRepresentationWithReference]) { let media = TelegramMediaImage(imageId: MediaId(namespace: 0, id: 0), representations: representations.map({ $0.representation }), immediateThumbnailData: nil, reference: nil, partialReference: nil) - let context: AccountContextImpl + let context: AccountContext if self.currentContext.account.id == self.currentAccount.id { context = self.currentContext } else { - context = AccountContextImpl(sharedContext: self.sharedContext, account: self.currentAccount, limitsConfiguration: .defaultValue) + context = self.sharedContext.makeTempAccountContext(account: self.currentAccount) } self.controllerNode.transitionToProgressWithValue(signal: TelegramUI.saveToCameraRoll(context: context, postbox: context.account.postbox, mediaReference: .standalone(media: media)) |> map(Optional.init)) } private func saveToCameraRoll(mediaReference: AnyMediaReference) { - let context: AccountContextImpl + let context: AccountContext if self.currentContext.account.id == self.currentAccount.id { context = self.currentContext } else { - context = AccountContextImpl(sharedContext: self.sharedContext, account: self.currentAccount, limitsConfiguration: .defaultValue) + context = self.sharedContext.makeTempAccountContext(account: self.currentAccount) } self.controllerNode.transitionToProgressWithValue(signal: TelegramUI.saveToCameraRoll(context: context, postbox: context.account.postbox, mediaReference: mediaReference) |> map(Optional.init)) } diff --git a/submodules/TelegramUI/TelegramUI/ShareControllerNode.swift b/submodules/TelegramUI/TelegramUI/ShareControllerNode.swift index 6445b5e5ab..099c38cf40 100644 --- a/submodules/TelegramUI/TelegramUI/ShareControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ShareControllerNode.swift @@ -6,6 +6,7 @@ import SwiftSignalKit import Postbox import TelegramCore import TelegramPresentationData +import AccountContext enum ShareState { case preparing @@ -23,7 +24,7 @@ func openExternalShare(state: () -> Signal) { } final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate { - private let sharedContext: SharedAccountContextImpl + private let sharedContext: SharedAccountContext private var presentationData: PresentationData private let externalShare: Bool private let immediateExternalShare: Bool @@ -71,7 +72,7 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate private var hapticFeedback: HapticFeedback? - init(sharedContext: SharedAccountContextImpl, defaultAction: ShareControllerAction?, requestLayout: @escaping (ContainedViewLayoutTransition) -> Void, presentError: @escaping (String?, String) -> Void, externalShare: Bool, immediateExternalShare: Bool) { + init(sharedContext: SharedAccountContext, defaultAction: ShareControllerAction?, requestLayout: @escaping (ContainedViewLayoutTransition) -> Void, presentError: @escaping (String?, String) -> Void, externalShare: Bool, immediateExternalShare: Bool) { self.sharedContext = sharedContext self.presentationData = sharedContext.currentPresentationData.with { $0 } self.externalShare = externalShare diff --git a/submodules/TelegramUI/TelegramUI/ShareControllerPeerGridItem.swift b/submodules/TelegramUI/TelegramUI/ShareControllerPeerGridItem.swift index 447842c54c..9daffe4840 100644 --- a/submodules/TelegramUI/TelegramUI/ShareControllerPeerGridItem.swift +++ b/submodules/TelegramUI/TelegramUI/ShareControllerPeerGridItem.swift @@ -6,6 +6,7 @@ import SwiftSignalKit import AsyncDisplayKit import Postbox import TelegramPresentationData +import TelegramStringFormatting final class ShareControllerInteraction { var foundPeers: [RenderedPeer] = [] diff --git a/submodules/TelegramUI/TelegramUI/ShareExtensionContext.swift b/submodules/TelegramUI/TelegramUI/ShareExtensionContext.swift index b4b023f845..f9319e36cd 100644 --- a/submodules/TelegramUI/TelegramUI/ShareExtensionContext.swift +++ b/submodules/TelegramUI/TelegramUI/ShareExtensionContext.swift @@ -198,7 +198,7 @@ public class ShareRootControllerImpl { |> take(1) let applicationInterface = account - |> mapToSignal { sharedContext, account, otherAccounts -> Signal<(AccountContextImpl, PostboxAccessChallengeData, [AccountWithInfo]), ShareAuthorizationError> in + |> mapToSignal { sharedContext, account, otherAccounts -> Signal<(AccountContext, PostboxAccessChallengeData, [AccountWithInfo]), ShareAuthorizationError> in let limitsConfiguration = account.postbox.transaction { transaction -> LimitsConfiguration in return transaction.getPreferencesEntry(key: PreferencesKeys.limitsConfiguration) as? LimitsConfiguration ?? LimitsConfiguration.defaultValue } @@ -206,7 +206,7 @@ public class ShareRootControllerImpl { |> take(1) |> deliverOnMainQueue |> introduceError(ShareAuthorizationError.self) - |> map { sharedData, limitsConfiguration, data -> (AccountContextImpl, PostboxAccessChallengeData, [AccountWithInfo]) in + |> map { sharedData, limitsConfiguration, data -> (AccountContext, PostboxAccessChallengeData, [AccountWithInfo]) in updateLegacyLocalization(strings: sharedContext.currentPresentationData.with({ $0 }).strings) let context = AccountContextImpl(sharedContext: sharedContext, account: account, limitsConfiguration: limitsConfiguration) return (context, data.data, otherAccounts) diff --git a/submodules/TelegramUI/TelegramUI/ShareItems.swift b/submodules/TelegramUI/TelegramUI/ShareItems.swift index 3f987e080d..28143de5a7 100644 --- a/submodules/TelegramUI/TelegramUI/ShareItems.swift +++ b/submodules/TelegramUI/TelegramUI/ShareItems.swift @@ -9,7 +9,7 @@ import MtProtoKitDynamic #endif import Display import TelegramUIPrivateModule - +import AccountContext import LegacyComponents enum UnpreparedShareItemContent { diff --git a/submodules/TelegramUI/TelegramUI/SharePeersContainerNode.swift b/submodules/TelegramUI/TelegramUI/SharePeersContainerNode.swift index 688b2010cc..ecab274e46 100644 --- a/submodules/TelegramUI/TelegramUI/SharePeersContainerNode.swift +++ b/submodules/TelegramUI/TelegramUI/SharePeersContainerNode.swift @@ -7,6 +7,8 @@ import SwiftSignalKit import Display import TelegramPresentationData import MergeLists +import AvatarNode +import AccountContext private let subtitleFont = Font.regular(12.0) @@ -67,7 +69,7 @@ private func preparedGridEntryTransition(account: Account, from fromEntries: [Sh } final class SharePeersContainerNode: ASDisplayNode, ShareContentContainerNode { - private let sharedContext: SharedAccountContextImpl + private let sharedContext: SharedAccountContext private let account: Account private let theme: PresentationTheme private let strings: PresentationStrings @@ -100,7 +102,7 @@ final class SharePeersContainerNode: ASDisplayNode, ShareContentContainerNode { let peersValue = Promise<[(RenderedPeer, PeerPresence?)]>() - init(sharedContext: SharedAccountContextImpl, account: Account, switchableAccounts: [AccountWithInfo], theme: PresentationTheme, strings: PresentationStrings, peers: [(RenderedPeer, PeerPresence?)], accountPeer: Peer, controllerInteraction: ShareControllerInteraction, externalShare: Bool, switchToAnotherAccount: @escaping () -> Void) { + init(sharedContext: SharedAccountContext, account: Account, switchableAccounts: [AccountWithInfo], theme: PresentationTheme, strings: PresentationStrings, peers: [(RenderedPeer, PeerPresence?)], accountPeer: Peer, controllerInteraction: ShareControllerInteraction, externalShare: Bool, switchToAnotherAccount: @escaping () -> Void) { self.sharedContext = sharedContext self.account = account self.theme = theme diff --git a/submodules/TelegramUI/TelegramUI/ShareSearchContainerNode.swift b/submodules/TelegramUI/TelegramUI/ShareSearchContainerNode.swift index 4c0a3007fc..4346e68ea5 100644 --- a/submodules/TelegramUI/TelegramUI/ShareSearchContainerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ShareSearchContainerNode.swift @@ -7,6 +7,7 @@ import SwiftSignalKit import Display import TelegramPresentationData import MergeLists +import AccountContext private let cancelFont = Font.regular(17.0) private let subtitleFont = Font.regular(12.0) @@ -165,7 +166,7 @@ private func preparedRecentEntryTransition(account: Account, from fromEntries: [ } final class ShareSearchContainerNode: ASDisplayNode, ShareContentContainerNode { - private let sharedContext: SharedAccountContextImpl + private let sharedContext: SharedAccountContext private let account: Account private let strings: PresentationStrings private let controllerInteraction: ShareControllerInteraction @@ -196,7 +197,7 @@ final class ShareSearchContainerNode: ASDisplayNode, ShareContentContainerNode { private let searchQuery = ValuePromise("", ignoreRepeated: true) private let searchDisposable = MetaDisposable() - init(sharedContext: SharedAccountContextImpl, account: Account, theme: PresentationTheme, strings: PresentationStrings, controllerInteraction: ShareControllerInteraction, recentPeers recentPeerList: [RenderedPeer]) { + init(sharedContext: SharedAccountContext, account: Account, theme: PresentationTheme, strings: PresentationStrings, controllerInteraction: ShareControllerInteraction, recentPeers recentPeerList: [RenderedPeer]) { self.sharedContext = sharedContext self.account = account self.strings = strings diff --git a/submodules/TelegramUI/TelegramUI/SharedAccountContext.swift b/submodules/TelegramUI/TelegramUI/SharedAccountContext.swift index 642e48f847..3ee59eb05b 100644 --- a/submodules/TelegramUI/TelegramUI/SharedAccountContext.swift +++ b/submodules/TelegramUI/TelegramUI/SharedAccountContext.swift @@ -7,6 +7,7 @@ import TelegramPresentationData import TelegramCallsUI import TelegramUIPreferences import AccountContext +import DeviceLocationManager private enum CallStatusText: Equatable { case none @@ -22,26 +23,6 @@ private final class AccountUserInterfaceInUseContext { } } -public final class AccountWithInfo: Equatable { - public let account: Account - public let peer: Peer - - init(account: Account, peer: Peer) { - self.account = account - self.peer = peer - } - - public static func ==(lhs: AccountWithInfo, rhs: AccountWithInfo) -> Bool { - if lhs.account !== rhs.account { - return false - } - if !arePeersEqual(lhs.peer, rhs.peer) { - return false - } - return true - } -} - private func preFetchedLegacyResourcePath(basePath: String, resource: MediaResource, cache: LegacyCache) -> String? { if let resource = resource as? CloudDocumentMediaResource { let videoPath = "\(basePath)/Documents/video/remote\(String(resource.fileId, radix: 16)).mov" @@ -75,7 +56,7 @@ private enum AddedAccountsResult { private var testHasInstance = false public final class SharedAccountContextImpl: SharedAccountContext { - let mainWindow: Window1? + public let mainWindow: Window1? public let applicationBindings: TelegramApplicationBindings public let basePath: String public let accountManager: AccountManager @@ -106,7 +87,7 @@ public final class SharedAccountContextImpl: SharedAccountContext { public let mediaManager: MediaManager public let contactDataManager: DeviceContactDataManager? - let locationManager: DeviceLocationManager? + public let locationManager: DeviceLocationManager? public var callManager: PresentationCallManager? private var callDisposable: Disposable? @@ -183,11 +164,11 @@ public final class SharedAccountContextImpl: SharedAccountContext { self.apsNotificationToken = apsNotificationToken self.voipNotificationToken = voipNotificationToken - self.mediaManager = MediaManager(accountManager: accountManager, inForeground: applicationBindings.applicationInForeground) + self.mediaManager = MediaManagerImpl(accountManager: accountManager, inForeground: applicationBindings.applicationInForeground) if applicationBindings.isMainApp { self.locationManager = DeviceLocationManager(queue: Queue.mainQueue()) - self.contactDataManager = DeviceContactDataManager() + self.contactDataManager = DeviceContactDataManagerImpl() } else { self.locationManager = nil self.contactDataManager = nil @@ -531,7 +512,7 @@ public final class SharedAccountContextImpl: SharedAccountContext { }) if let mainWindow = mainWindow, applicationBindings.isMainApp { - let callManager = PresentationCallManager(accountManager: self.accountManager, getDeviceAccessData: { + let callManager = PresentationCallManagerImpl(accountManager: self.accountManager, getDeviceAccessData: { return (self.currentPresentationData.with { $0 }, { [weak self] c, a in self?.presentGlobalController(c, a) }, { @@ -775,7 +756,7 @@ public final class SharedAccountContextImpl: SharedAccountContext { }).start() } - public func switchToAccount(id: AccountRecordId, fromSettingsController settingsController: (SettingsController & ViewController)? = nil, withChatListController chatListController: ChatListController? = nil) { + public func switchToAccount(id: AccountRecordId, fromSettingsController settingsController: ViewController? = nil, withChatListController chatListController: ViewController? = nil) { if self.activeAccountsValue?.primary?.id == id { return } @@ -799,7 +780,7 @@ public final class SharedAccountContextImpl: SharedAccountContext { } } } - self.switchingData = (settingsController, chatListController, chatsBadge) + self.switchingData = (settingsController as? (ViewController & SettingsController), chatListController as? ChatListController, chatsBadge) let _ = self.accountManager.transaction({ transaction -> Bool in if transaction.getCurrent()?.0 != id { @@ -819,6 +800,39 @@ public final class SharedAccountContextImpl: SharedAccountContext { self.navigateToChatImpl(accountId, peerId, messageId) } + public func messageFromPreloadedChatHistoryViewForLocation(id: MessageId, location: ChatHistoryLocationInput, account: Account, chatLocation: ChatLocation, tagMask: MessageTags?) -> Signal<(MessageIndex?, Bool), NoError> { + let historyView = preloadedChatHistoryViewForLocation(location, account: account, chatLocation: chatLocation, fixedCombinedReadStates: nil, tagMask: tagMask, additionalData: []) + return historyView + |> mapToSignal { historyView -> Signal<(MessageIndex?, Bool), NoError> in + switch historyView { + case .Loading: + return .single((nil, true)) + case let .HistoryView(view, _, _, _, _, _, _): + for entry in view.entries { + if entry.message.id == id { + return .single((entry.message.index, false)) + } + } + return .single((nil, false)) + } + } + |> take(until: { index in + return SignalTakeAction(passthrough: true, complete: !index.1) + }) + } + + public func makeOverlayAudioPlayerController(context: AccountContext, peerId: PeerId, type: MediaManagerPlayerType, initialMessageId: MessageId, initialOrder: MusicPlaybackSettingsOrder, parentNavigationController: NavigationController?) -> ViewController & OverlayAudioPlayerController { + return OverlayAudioPlayerControllerImpl(context: context, peerId: peerId, type: type, initialMessageId: initialMessageId, initialOrder: initialOrder, parentNavigationController: parentNavigationController) + } + + public func makeTempAccountContext(account: Account) -> AccountContext { + return AccountContextImpl(sharedContext: self, account: account, limitsConfiguration: .defaultValue) + } + + public func openChatMessage(_ params: OpenChatMessageParams) -> Bool { + return openChatMessageImpl(params) + } + private func updateStatusBarText() { if case let .inProgress(timestamp) = self.currentCallStatusText { let text: String @@ -918,6 +932,6 @@ public final class SharedAccountContextImpl: SharedAccountContext { } public func handleTextLinkAction(context: AccountContext, peerId: PeerId?, navigateDisposable: MetaDisposable, controller: ViewController, action: TextLinkItemActionType, itemLink: TextLinkItem) { - handleTextLinkActionImpl(context: context as! AccountContextImpl, peerId: peerId, navigateDisposable: navigateDisposable, controller: controller, action: action, itemLink: itemLink) + handleTextLinkActionImpl(context: context as! AccountContext, peerId: peerId, navigateDisposable: navigateDisposable, controller: controller, action: action, itemLink: itemLink) } } diff --git a/submodules/TelegramUI/TelegramUI/SharedMediaPlayer.swift b/submodules/TelegramUI/TelegramUI/SharedMediaPlayer.swift index 348dce7358..bae5036426 100644 --- a/submodules/TelegramUI/TelegramUI/SharedMediaPlayer.swift +++ b/submodules/TelegramUI/TelegramUI/SharedMediaPlayer.swift @@ -7,278 +7,7 @@ import TelegramUIPreferences import TelegramUIPrivateModule import UniversalMediaPlayer import TelegramAudio - -enum SharedMediaPlayerPlaybackControlAction { - case play - case pause - case togglePlayPause -} - -enum SharedMediaPlayerControlAction { - case next - case previous - case playback(SharedMediaPlayerPlaybackControlAction) - case seek(Double) - case setOrder(MusicPlaybackSettingsOrder) - case setLooping(MusicPlaybackSettingsLooping) - case setBaseRate(AudioPlaybackRate) -} - -enum SharedMediaPlaylistControlAction { - case next - case previous -} - -enum SharedMediaPlaybackDataType { - case music - case voice - case instantVideo -} - -enum SharedMediaPlaybackDataSource: Equatable { - case telegramFile(FileMediaReference) - - static func ==(lhs: SharedMediaPlaybackDataSource, rhs: SharedMediaPlaybackDataSource) -> Bool { - switch lhs { - case let .telegramFile(lhsFileReference): - if case let .telegramFile(rhsFileReference) = rhs { - if !lhsFileReference.media.isEqual(to: rhsFileReference.media) { - return false - } - return true - } else { - return false - } - } - } -} - -struct SharedMediaPlaybackData: Equatable { - let type: SharedMediaPlaybackDataType - let source: SharedMediaPlaybackDataSource - - static func ==(lhs: SharedMediaPlaybackData, rhs: SharedMediaPlaybackData) -> Bool { - return lhs.type == rhs.type && lhs.source == rhs.source - } -} - -struct SharedMediaPlaybackAlbumArt: Equatable { - let thumbnailResource: TelegramMediaResource - let fullSizeResource: TelegramMediaResource - - static func ==(lhs: SharedMediaPlaybackAlbumArt, rhs: SharedMediaPlaybackAlbumArt) -> Bool { - if !lhs.thumbnailResource.isEqual(to: rhs.thumbnailResource) { - return false - } - - if !lhs.fullSizeResource.isEqual(to: rhs.fullSizeResource) { - return false - } - - return true - } -} - -enum SharedMediaPlaybackDisplayData: Equatable { - case music(title: String?, performer: String?, albumArt: SharedMediaPlaybackAlbumArt?) - case voice(author: Peer?, peer: Peer?) - case instantVideo(author: Peer?, peer: Peer?, timestamp: Int32) - - static func ==(lhs: SharedMediaPlaybackDisplayData, rhs: SharedMediaPlaybackDisplayData) -> Bool { - switch lhs { - case let .music(lhsTitle, lhsPerformer, lhsAlbumArt): - if case let .music(rhsTitle, rhsPerformer, rhsAlbumArt) = rhs, lhsTitle == rhsTitle, lhsPerformer == rhsPerformer, lhsAlbumArt == rhsAlbumArt { - return true - } else { - return false - } - case let .voice(lhsAuthor, lhsPeer): - if case let .voice(rhsAuthor, rhsPeer) = rhs, arePeersEqual(lhsAuthor, rhsAuthor), arePeersEqual(lhsPeer, rhsPeer) { - return true - } else { - return false - } - case let .instantVideo(lhsAuthor, lhsPeer, lhsTimestamp): - if case let .instantVideo(rhsAuthor, rhsPeer, rhsTimestamp) = rhs, arePeersEqual(lhsAuthor, rhsAuthor), arePeersEqual(lhsPeer, rhsPeer), lhsTimestamp == rhsTimestamp { - return true - } else { - return false - } - } - } -} - -protocol SharedMediaPlaylistItem { - var stableId: AnyHashable { get } - var id: SharedMediaPlaylistItemId { get } - var playbackData: SharedMediaPlaybackData? { get } - var displayData: SharedMediaPlaybackDisplayData? { get } -} - -func arePlaylistItemsEqual(_ lhs: SharedMediaPlaylistItem?, _ rhs: SharedMediaPlaylistItem?) -> Bool { - if lhs?.stableId != rhs?.stableId { - return false - } - if lhs?.playbackData != rhs?.playbackData { - return false - } - if lhs?.displayData != rhs?.displayData { - return false - } - return true -} - -final class SharedMediaPlaylistState: Equatable { - let loading: Bool - let playedToEnd: Bool - let item: SharedMediaPlaylistItem? - let nextItem: SharedMediaPlaylistItem? - let previousItem: SharedMediaPlaylistItem? - let order: MusicPlaybackSettingsOrder - let looping: MusicPlaybackSettingsLooping - - init(loading: Bool, playedToEnd: Bool, item: SharedMediaPlaylistItem?, nextItem: SharedMediaPlaylistItem?, previousItem: SharedMediaPlaylistItem?, order: MusicPlaybackSettingsOrder, looping: MusicPlaybackSettingsLooping) { - self.loading = loading - self.playedToEnd = playedToEnd - self.item = item - self.nextItem = nextItem - self.previousItem = previousItem - self.order = order - self.looping = looping - } - - static func ==(lhs: SharedMediaPlaylistState, rhs: SharedMediaPlaylistState) -> Bool { - if lhs.loading != rhs.loading { - return false - } - if !arePlaylistItemsEqual(lhs.item, rhs.item) { - return false - } - if !arePlaylistItemsEqual(lhs.nextItem, rhs.nextItem) { - return false - } - if !arePlaylistItemsEqual(lhs.previousItem, rhs.previousItem) { - return false - } - if lhs.order != rhs.order { - return false - } - if lhs.looping != rhs.looping { - return false - } - return true - } -} - -protocol SharedMediaPlaylistId { - func isEqual(to: SharedMediaPlaylistId) -> Bool -} - -protocol SharedMediaPlaylistItemId { - func isEqual(to: SharedMediaPlaylistItemId) -> Bool -} - -func areSharedMediaPlaylistItemIdsEqual(_ lhs: SharedMediaPlaylistItemId?, _ rhs: SharedMediaPlaylistItemId?) -> Bool { - if let lhs = lhs, let rhs = rhs { - return lhs.isEqual(to: rhs) - } else if (lhs != nil) != (rhs != nil) { - return false - } else { - return true - } -} - -protocol SharedMediaPlaylistLocation { - func isEqual(to: SharedMediaPlaylistLocation) -> Bool -} - -protocol SharedMediaPlaylist: class { - var id: SharedMediaPlaylistId { get } - var location: SharedMediaPlaylistLocation { get } - var state: Signal { get } - var looping: MusicPlaybackSettingsLooping { get } - var currentItemDisappeared: (() -> Void)? { get set } - - func control(_ action: SharedMediaPlaylistControlAction) - func setOrder(_ order: MusicPlaybackSettingsOrder) - func setLooping(_ looping: MusicPlaybackSettingsLooping) - - func onItemPlaybackStarted(_ item: SharedMediaPlaylistItem) -} - -final class SharedMediaPlayerItemPlaybackState: Equatable { - let playlistId: SharedMediaPlaylistId - let playlistLocation: SharedMediaPlaylistLocation - let item: SharedMediaPlaylistItem - let previousItem: SharedMediaPlaylistItem? - let nextItem: SharedMediaPlaylistItem? - let status: MediaPlayerStatus - let order: MusicPlaybackSettingsOrder - let looping: MusicPlaybackSettingsLooping - let playerIndex: Int32 - - init(playlistId: SharedMediaPlaylistId, playlistLocation: SharedMediaPlaylistLocation, item: SharedMediaPlaylistItem, previousItem: SharedMediaPlaylistItem?, nextItem: SharedMediaPlaylistItem?, status: MediaPlayerStatus, order: MusicPlaybackSettingsOrder, looping: MusicPlaybackSettingsLooping, playerIndex: Int32) { - self.playlistId = playlistId - self.playlistLocation = playlistLocation - self.item = item - self.previousItem = previousItem - self.nextItem = nextItem - self.status = status - self.order = order - self.looping = looping - self.playerIndex = playerIndex - } - - static func ==(lhs: SharedMediaPlayerItemPlaybackState, rhs: SharedMediaPlayerItemPlaybackState) -> Bool { - if !lhs.playlistId.isEqual(to: rhs.playlistId) { - return false - } - if !arePlaylistItemsEqual(lhs.item, rhs.item) { - return false - } - if !arePlaylistItemsEqual(lhs.previousItem, rhs.previousItem) { - return false - } - if !arePlaylistItemsEqual(lhs.nextItem, rhs.nextItem) { - return false - } - if lhs.status != rhs.status { - return false - } - if lhs.playerIndex != rhs.playerIndex { - return false - } - if lhs.order != rhs.order { - return false - } - if lhs.looping != rhs.looping { - return false - } - return true - } -} - -enum SharedMediaPlayerState: Equatable { - case loading - case item(SharedMediaPlayerItemPlaybackState) - - static func ==(lhs: SharedMediaPlayerState, rhs: SharedMediaPlayerState) -> Bool { - switch lhs { - case .loading: - if case .loading = rhs { - return true - } else { - return false - } - case let .item(item): - if case .item(item) = rhs { - return true - } else { - return false - } - } - } -} +import AccountContext private enum SharedMediaPlaybackItem: Equatable { case audio(MediaPlayer) @@ -459,7 +188,7 @@ final class SharedMediaPlayer { playbackItem.pause() case let .instantVideo(node): node.setSoundEnabled(false) - strongSelf.overlayMediaManager.controller?.removeNode(node) + strongSelf.overlayMediaManager.controller?.removeNode(node, customTransition: false) } } strongSelf.playbackItem = nil @@ -487,7 +216,7 @@ final class SharedMediaPlayer { switch playbackData.source { case let .telegramFile(fileReference): let videoNode = OverlayInstantVideoNode(postbox: strongSelf.account.postbox, audioSession: strongSelf.audioSession, manager: mediaManager.universalVideoManager, content: NativeVideoContent(id: .message(item.message.stableId, fileReference.media.fileId), fileReference: fileReference, enableSound: false, baseRate: rateValue), close: { [weak mediaManager] in - mediaManager?.setPlaylist(nil, type: .voice) + mediaManager?.setPlaylist(nil, type: .voice, control: .playback(.pause)) }) strongSelf.playbackItem = .instantVideo(videoNode) videoNode.setSoundEnabled(true) @@ -516,7 +245,7 @@ final class SharedMediaPlayer { case .audio: break case let .instantVideo(node): - strongSelf.overlayMediaManager.controller?.addNode(node) + strongSelf.overlayMediaManager.controller?.addNode(node, customTransition: false) } if let scheduledPlaybackAction = strongSelf.scheduledPlaybackAction { @@ -641,7 +370,7 @@ final class SharedMediaPlayer { playbackItem.pause() case let .instantVideo(node): node.setSoundEnabled(false) - self.overlayMediaManager.controller?.removeNode(node) + self.overlayMediaManager.controller?.removeNode(node, customTransition: false) } } } diff --git a/submodules/TelegramUI/TelegramUI/SharedNotificationManager.swift b/submodules/TelegramUI/TelegramUI/SharedNotificationManager.swift index a87fbc7318..127075c8a5 100644 --- a/submodules/TelegramUI/TelegramUI/SharedNotificationManager.swift +++ b/submodules/TelegramUI/TelegramUI/SharedNotificationManager.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import TelegramPresentationData import TelegramCallsUI +import AccountContext private final class PollStateContext { let subscribers = Bag<(Bool) -> Void>() diff --git a/submodules/TelegramUI/TelegramUI/SharedWakeupManager.swift b/submodules/TelegramUI/TelegramUI/SharedWakeupManager.swift index cbc80096fe..f4aa1a9a63 100644 --- a/submodules/TelegramUI/TelegramUI/SharedWakeupManager.swift +++ b/submodules/TelegramUI/TelegramUI/SharedWakeupManager.swift @@ -4,6 +4,7 @@ import SwiftSignalKit import Postbox import TelegramCore import TelegramCallsUI +import AccountContext private struct AccountTasks { let stateSynchronization: Bool diff --git a/submodules/TelegramUI/TelegramUI/StickerPackPreviewController.swift b/submodules/TelegramUI/TelegramUI/StickerPackPreviewController.swift index 575d6b7e15..aac91c0319 100644 --- a/submodules/TelegramUI/TelegramUI/StickerPackPreviewController.swift +++ b/submodules/TelegramUI/TelegramUI/StickerPackPreviewController.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import SwiftSignalKit import TelegramUIPreferences +import AccountContext enum StickerPackPreviewControllerMode { case `default` @@ -20,7 +21,7 @@ final class StickerPackPreviewController: ViewController { private var animatedIn = false private var dismissed = false - private let context: AccountContextImpl + private let context: AccountContext private let mode: StickerPackPreviewControllerMode private weak var parentNavigationController: NavigationController? @@ -57,7 +58,7 @@ final class StickerPackPreviewController: ViewController { } } - init(context: AccountContextImpl, stickerPack: StickerPackReference, mode: StickerPackPreviewControllerMode = .default, parentNavigationController: NavigationController?) { + init(context: AccountContext, stickerPack: StickerPackReference, mode: StickerPackPreviewControllerMode = .default, parentNavigationController: NavigationController?) { self.context = context self.mode = mode self.parentNavigationController = parentNavigationController diff --git a/submodules/TelegramUI/TelegramUI/StickerPackPreviewControllerNode.swift b/submodules/TelegramUI/TelegramUI/StickerPackPreviewControllerNode.swift index 2209c7fad9..025ec2168c 100644 --- a/submodules/TelegramUI/TelegramUI/StickerPackPreviewControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/StickerPackPreviewControllerNode.swift @@ -10,6 +10,7 @@ import TelegramUIPreferences import MergeLists import ActivityIndicator import TextFormat +import AccountContext private struct StickerPackPreviewGridEntry: Comparable, Identifiable { let index: Int @@ -43,7 +44,7 @@ private struct StickerPackPreviewGridTransaction { } final class StickerPackPreviewControllerNode: ViewControllerTracingNode, UIScrollViewDelegate { - private let context: AccountContextImpl + private let context: AccountContext private let openShare: (() -> Void)? private var presentationData: PresentationData @@ -85,7 +86,7 @@ final class StickerPackPreviewControllerNode: ViewControllerTracingNode, UIScrol private var hapticFeedback: HapticFeedback? - init(context: AccountContextImpl, openShare: (() -> Void)?, openMention: @escaping (String) -> Void) { + init(context: AccountContext, openShare: (() -> Void)?, openMention: @escaping (String) -> Void) { self.context = context self.openShare = openShare self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/StickerPaneSearchContentNode.swift b/submodules/TelegramUI/TelegramUI/StickerPaneSearchContentNode.swift index aadb11e0aa..f1ae5895c9 100644 --- a/submodules/TelegramUI/TelegramUI/StickerPaneSearchContentNode.swift +++ b/submodules/TelegramUI/TelegramUI/StickerPaneSearchContentNode.swift @@ -9,6 +9,7 @@ import TelegramPresentationData import LegacyComponents import TelegramUIPrivateModule import MergeLists +import AccountContext final class StickerPaneSearchInteraction { let open: (StickerPackCollectionInfo) -> Void @@ -136,7 +137,7 @@ private func preparedChatMediaInputGridEntryTransition(account: Account, theme: } final class StickerPaneSearchContentNode: ASDisplayNode, PaneSearchContentNode { - private let context: AccountContextImpl + private let context: AccountContext private let controllerInteraction: ChatControllerInteraction private let inputNodeInteraction: ChatMediaInputNodeInteraction private var interaction: StickerPaneSearchInteraction? @@ -167,7 +168,7 @@ final class StickerPaneSearchContentNode: ASDisplayNode, PaneSearchContentNode { var deactivateSearchBar: (() -> Void)? var updateActivity: ((Bool) -> Void)? - init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings, controllerInteraction: ChatControllerInteraction, inputNodeInteraction: ChatMediaInputNodeInteraction) { + init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, controllerInteraction: ChatControllerInteraction, inputNodeInteraction: ChatMediaInputNodeInteraction) { self.context = context self.controllerInteraction = controllerInteraction self.inputNodeInteraction = inputNodeInteraction diff --git a/submodules/TelegramUI/TelegramUI/StickerPreviewController.swift b/submodules/TelegramUI/TelegramUI/StickerPreviewController.swift index c69016ec52..11521ec2a4 100644 --- a/submodules/TelegramUI/TelegramUI/StickerPreviewController.swift +++ b/submodules/TelegramUI/TelegramUI/StickerPreviewController.swift @@ -5,6 +5,7 @@ import AsyncDisplayKit import Postbox import TelegramCore import SwiftSignalKit +import AccountContext final class StickerPreviewControllerPresentationArguments { let transitionNode: (StickerPackItem) -> ASDisplayNode? @@ -21,10 +22,10 @@ final class StickerPreviewController: ViewController { private var animatedIn = false - private let context: AccountContextImpl + private let context: AccountContext private var item: StickerPackItem - init(context: AccountContextImpl, item: StickerPackItem) { + init(context: AccountContext, item: StickerPackItem) { self.context = context self.item = item diff --git a/submodules/TelegramUI/TelegramUI/StickerPreviewControllerNode.swift b/submodules/TelegramUI/TelegramUI/StickerPreviewControllerNode.swift index fb35612860..df1c461e2a 100644 --- a/submodules/TelegramUI/TelegramUI/StickerPreviewControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/StickerPreviewControllerNode.swift @@ -6,9 +6,10 @@ import SwiftSignalKit import Postbox import TelegramCore import TelegramPresentationData +import AccountContext final class StickerPreviewControllerNode: ASDisplayNode, UIScrollViewDelegate { - private let context: AccountContextImpl + private let context: AccountContext private let presentationData: PresentationData private let dimNode: ASDisplayNode @@ -22,7 +23,7 @@ final class StickerPreviewControllerNode: ASDisplayNode, UIScrollViewDelegate { var dismiss: (() -> Void)? var cancel: (() -> Void)? - init(context: AccountContextImpl) { + init(context: AccountContext) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/StickersChatInputContextPanelNode.swift b/submodules/TelegramUI/TelegramUI/StickersChatInputContextPanelNode.swift index e02c48ff4d..5bceb506a0 100644 --- a/submodules/TelegramUI/TelegramUI/StickersChatInputContextPanelNode.swift +++ b/submodules/TelegramUI/TelegramUI/StickersChatInputContextPanelNode.swift @@ -7,6 +7,7 @@ import Display import SwiftSignalKit import TelegramPresentationData import MergeLists +import AccountContext private struct StickersChatInputContextPanelEntryStableId: Hashable { let ids: [MediaId] @@ -77,7 +78,7 @@ final class StickersChatInputContextPanelNode: ChatInputContextPanelNode { private var stickerPreviewController: StickerPreviewController? - override init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings) { + override init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings) { self.strings = strings self.listView = ListView() diff --git a/submodules/TelegramUI/TelegramUI/StorageUsageController.swift b/submodules/TelegramUI/TelegramUI/StorageUsageController.swift index 84db54d190..66da6225a3 100644 --- a/submodules/TelegramUI/TelegramUI/StorageUsageController.swift +++ b/submodules/TelegramUI/TelegramUI/StorageUsageController.swift @@ -7,6 +7,8 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import OverlayStatusController +import AccountContext private final class StorageUsageControllerArguments { let account: Account @@ -265,7 +267,7 @@ private func stringForCategory(strings: PresentationStrings, category: PeerCache } } -func storageUsageController(context: AccountContextImpl, isModal: Bool = false) -> ViewController { +func storageUsageController(context: AccountContext, isModal: Bool = false) -> ViewController { let cacheSettingsPromise = Promise() cacheSettingsPromise.set(context.sharedContext.accountManager.sharedData(keys: [SharedDataKeys.cacheStorageSettings]) |> map { sharedData -> CacheStorageSettings in diff --git a/submodules/TelegramUI/TelegramUI/StoreDownloadedMedia.swift b/submodules/TelegramUI/TelegramUI/StoreDownloadedMedia.swift index 8c77f31d8d..cde6ba0158 100644 --- a/submodules/TelegramUI/TelegramUI/StoreDownloadedMedia.swift +++ b/submodules/TelegramUI/TelegramUI/StoreDownloadedMedia.swift @@ -4,6 +4,7 @@ import TelegramCore import Postbox import Photos import TelegramUIPreferences +import AccountContext private func appSpecificAssetCollection() -> Signal { return Signal { subscriber in @@ -138,7 +139,7 @@ private final class DownloadedMediaStoreContext { } } -private final class DownloadedMediaStoreManagerImpl { +private final class DownloadedMediaStoreManagerPrivateImpl { private let queue: Queue private let postbox: Postbox @@ -194,14 +195,14 @@ private final class DownloadedMediaStoreManagerImpl { } } -final class DownloadedMediaStoreManager { +final class DownloadedMediaStoreManagerImpl: DownloadedMediaStoreManager { private let queue = Queue() - private let impl: QueueLocalObject + private let impl: QueueLocalObject init(postbox: Postbox, accountManager: AccountManager) { let queue = self.queue self.impl = QueueLocalObject(queue: queue, generate: { - return DownloadedMediaStoreManagerImpl(queue: queue, postbox: postbox, accountManager: accountManager) + return DownloadedMediaStoreManagerPrivateImpl(queue: queue, postbox: postbox, accountManager: accountManager) }) } @@ -211,15 +212,3 @@ final class DownloadedMediaStoreManager { } } } - -func storeDownloadedMedia(storeManager: DownloadedMediaStoreManager?, media: AnyMediaReference, peerType: MediaAutoDownloadPeerType) -> Signal { - guard case let .message(message, _) = media, let timestamp = message.timestamp, let incoming = message.isIncoming, incoming, let secret = message.isSecret, !secret else { - return .complete() - } - - return Signal { [weak storeManager] subscriber in - storeManager?.store(media, timestamp: timestamp, peerType: peerType) - subscriber.putCompletion() - return EmptyDisposable - } -} diff --git a/submodules/TelegramUI/TelegramUI/StringForMessageTimestampStatus.swift b/submodules/TelegramUI/TelegramUI/StringForMessageTimestampStatus.swift index 8463032d30..9511a6c3bc 100644 --- a/submodules/TelegramUI/TelegramUI/StringForMessageTimestampStatus.swift +++ b/submodules/TelegramUI/TelegramUI/StringForMessageTimestampStatus.swift @@ -3,6 +3,7 @@ import Postbox import TelegramCore import TelegramPresentationData import TelegramUIPreferences +import TelegramStringFormatting enum MessageTimestampStatusFormat { case regular diff --git a/submodules/TelegramUI/TelegramUI/SuppressContactsWarning.swift b/submodules/TelegramUI/TelegramUI/SuppressContactsWarning.swift index 29a29fcde2..c8bbd60dea 100644 --- a/submodules/TelegramUI/TelegramUI/SuppressContactsWarning.swift +++ b/submodules/TelegramUI/TelegramUI/SuppressContactsWarning.swift @@ -4,8 +4,9 @@ import Display import SwiftSignalKit import TelegramCore import DeviceAccess +import AccountContext -func presentContactsWarningSuppression(context: AccountContextImpl, present: (ViewController, Any?) -> Void) { +func presentContactsWarningSuppression(context: AccountContext, present: (ViewController, Any?) -> Void) { let presentationData = context.sharedContext.currentPresentationData.with { $0 } present(textAlertController(context: context, title: presentationData.strings.Contacts_PermissionsSuppressWarningTitle, text: presentationData.strings.Contacts_PermissionsSuppressWarningText, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Contacts_PermissionsKeepDisabled, action: { ApplicationSpecificNotice.setPermissionWarning(accountManager: context.sharedContext.accountManager, permission: .contacts, value: Int32(Date().timeIntervalSince1970)) diff --git a/submodules/TelegramUI/TelegramUI/SystemVideoContent.swift b/submodules/TelegramUI/TelegramUI/SystemVideoContent.swift index 589cf99f61..dc29a0fd8a 100644 --- a/submodules/TelegramUI/TelegramUI/SystemVideoContent.swift +++ b/submodules/TelegramUI/TelegramUI/SystemVideoContent.swift @@ -8,6 +8,7 @@ import TelegramCore import TelegramAudio import LegacyComponents import UniversalMediaPlayer +import AccountContext final class SystemVideoContent: UniversalVideoContent { let id: AnyHashable diff --git a/submodules/TelegramUI/TelegramUI/TabBarAccountSwitchController.swift b/submodules/TelegramUI/TelegramUI/TabBarAccountSwitchController.swift index fa9841d8c7..ead8fcfb44 100644 --- a/submodules/TelegramUI/TelegramUI/TabBarAccountSwitchController.swift +++ b/submodules/TelegramUI/TelegramUI/TabBarAccountSwitchController.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import SwiftSignalKit import TelegramPresentationData +import AccountContext public final class TabBarAccountSwitchController: ViewController { private var controllerNode: TabBarAccountSwitchControllerNode { @@ -17,7 +18,7 @@ public final class TabBarAccountSwitchController: ViewController { return self._ready } - private let sharedContext: SharedAccountContextImpl + private let sharedContext: SharedAccountContext private let accounts: (primary: (Account, Peer), other: [(Account, Peer, Int32)]) private let canAddAccounts: Bool private let switchToAccount: (AccountRecordId) -> Void @@ -30,7 +31,7 @@ public final class TabBarAccountSwitchController: ViewController { private let hapticFeedback = HapticFeedback() - public init(sharedContext: SharedAccountContextImpl, accounts: (primary: (Account, Peer), other: [(Account, Peer, Int32)]), canAddAccounts: Bool, switchToAccount: @escaping (AccountRecordId) -> Void, addAccount: @escaping () -> Void, sourceNodes: [ASDisplayNode]) { + public init(sharedContext: SharedAccountContext, accounts: (primary: (Account, Peer), other: [(Account, Peer, Int32)]), canAddAccounts: Bool, switchToAccount: @escaping (AccountRecordId) -> Void, addAccount: @escaping () -> Void, sourceNodes: [ASDisplayNode]) { self.sharedContext = sharedContext self.accounts = accounts self.canAddAccounts = canAddAccounts diff --git a/submodules/TelegramUI/TelegramUI/TabBarAccountSwitchControllerNode.swift b/submodules/TelegramUI/TelegramUI/TabBarAccountSwitchControllerNode.swift index 181d5acd4b..2dd73f8d7a 100644 --- a/submodules/TelegramUI/TelegramUI/TabBarAccountSwitchControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/TabBarAccountSwitchControllerNode.swift @@ -5,6 +5,8 @@ import Display import Postbox import TelegramCore import TelegramPresentationData +import AvatarNode +import AccountContext private let avatarFont = UIFont(name: ".SFCompactRounded-Semibold", size: 16.0)! @@ -223,7 +225,7 @@ final class TabBarAccountSwitchControllerNode: ViewControllerTracingNode { private var validLayout: ContainerViewLayout? - init(sharedContext: SharedAccountContextImpl, accounts: (primary: (Account, Peer), other: [(Account, Peer, Int32)]), presentationData: PresentationData, canAddAccounts: Bool, switchToAccount: @escaping (AccountRecordId) -> Void, addAccount: @escaping () -> Void, cancel: @escaping () -> Void, sourceNodes: [ASDisplayNode]) { + init(sharedContext: SharedAccountContext, accounts: (primary: (Account, Peer), other: [(Account, Peer, Int32)]), presentationData: PresentationData, canAddAccounts: Bool, switchToAccount: @escaping (AccountRecordId) -> Void, addAccount: @escaping () -> Void, cancel: @escaping () -> Void, sourceNodes: [ASDisplayNode]) { self.presentationData = presentationData self.cancel = cancel self.sourceNodes = sourceNodes diff --git a/submodules/TelegramUI/TelegramUI/TelegramInitializeLegacyComponents.swift b/submodules/TelegramUI/TelegramUI/TelegramInitializeLegacyComponents.swift index d80a0dc54f..9d14c7a4e5 100644 --- a/submodules/TelegramUI/TelegramUI/TelegramInitializeLegacyComponents.swift +++ b/submodules/TelegramUI/TelegramUI/TelegramInitializeLegacyComponents.swift @@ -12,6 +12,7 @@ import TelegramPresentationData import DeviceAccess import TelegramAudio import LegacyComponents +import AccountContext var legacyComponentsApplication: UIApplication? @@ -28,16 +29,16 @@ func updateLegacyTheme() { private var legacyDocumentsStorePath: String? private var legacyCanOpenUrl: (URL) -> Bool = { _ in return false } private var legacyOpenUrl: (URL) -> Void = { _ in } -private weak var legacyContext: AccountContextImpl? +private weak var legacyContext: AccountContext? -func legacyContextGet() -> AccountContextImpl? { +func legacyContextGet() -> AccountContext? { return legacyContext } private final class LegacyComponentsAccessCheckerImpl: NSObject, LegacyComponentsAccessChecker { - private weak var context: AccountContextImpl? + private weak var context: AccountContext? - init(context: AccountContextImpl?) { + init(context: AccountContext?) { self.context = context } @@ -357,7 +358,7 @@ private final class LegacyComponentsGlobalsProviderImpl: NSObject, LegacyCompone } } -public func setupLegacyComponents(context: AccountContextImpl) { +public func setupLegacyComponents(context: AccountContext) { legacyContext = context } diff --git a/submodules/TelegramUI/TelegramUI/TelegramRootController.swift b/submodules/TelegramUI/TelegramUI/TelegramRootController.swift index 0ce2bcb3b3..5130d15743 100644 --- a/submodules/TelegramUI/TelegramUI/TelegramRootController.swift +++ b/submodules/TelegramUI/TelegramUI/TelegramRootController.swift @@ -6,9 +6,10 @@ import TelegramCore import SwiftSignalKit import TelegramPresentationData import TelegramUIPrivateModule +import AccountContext public final class TelegramRootController: NavigationController { - private let context: AccountContextImpl + private let context: AccountContext public var rootTabController: TabBarController? @@ -21,7 +22,7 @@ public final class TelegramRootController: NavigationController { private var presentationDataDisposable: Disposable? private var presentationData: PresentationData - public init(context: AccountContextImpl) { + public init(context: AccountContext) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } @@ -81,7 +82,9 @@ public final class TelegramRootController: NavigationController { public func addRootControllers(showCallsTab: Bool) { let tabBarController = TabBarController(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData), theme: TabBarControllerTheme(rootControllerTheme: self.presentationData.theme)) let chatListController = ChatListController(context: self.context, groupId: .root, controlsHistoryPreload: true) - chatListController.tabBarItem.badgeValue = self.context.sharedContext.switchingData.chatListBadge + if let sharedContext = self.context.sharedContext as? SharedAccountContextImpl { + chatListController.tabBarItem.badgeValue = sharedContext.switchingData.chatListBadge + } let callListController = CallListController(context: self.context, mode: .tab) var controllers: [ViewController] = [] @@ -97,9 +100,14 @@ public final class TelegramRootController: NavigationController { } controllers.append(chatListController) - let restoreSettignsController = self.context.sharedContext.switchingData.settingsController + var restoreSettignsController: (ViewController & SettingsController)? + if let sharedContext = self.context.sharedContext as? SharedAccountContextImpl { + restoreSettignsController = sharedContext.switchingData.settingsController + } restoreSettignsController?.updateContext(context: self.context) - self.context.sharedContext.switchingData = (nil, nil, nil) + if let sharedContext = self.context.sharedContext as? SharedAccountContextImpl { + sharedContext.switchingData = (nil, nil, nil) + } let accountSettingsController = restoreSettignsController ?? settingsController(context: self.context, accountManager: context.sharedContext.accountManager) controllers.append(accountSettingsController) diff --git a/submodules/TelegramUI/TelegramUI/TextLinkHandling.swift b/submodules/TelegramUI/TelegramUI/TextLinkHandling.swift index 92812ef007..439a06f2b5 100644 --- a/submodules/TelegramUI/TelegramUI/TextLinkHandling.swift +++ b/submodules/TelegramUI/TelegramUI/TextLinkHandling.swift @@ -6,10 +6,10 @@ import Display import SwiftSignalKit import TelegramUIPreferences import AccountContext - +import AccountContext import SafariServices -func handleTextLinkActionImpl(context: AccountContextImpl, peerId: PeerId?, navigateDisposable: MetaDisposable, controller: ViewController, action: TextLinkItemActionType, itemLink: TextLinkItem) { +func handleTextLinkActionImpl(context: AccountContext, peerId: PeerId?, navigateDisposable: MetaDisposable, controller: ViewController, action: TextLinkItemActionType, itemLink: TextLinkItem) { let presentImpl: (ViewController, Any?) -> Void = { controllerToPresent, _ in controller.present(controllerToPresent, in: .window(.root)) } diff --git a/submodules/TelegramUI/TelegramUI/ThemeAccentColorActionSheet.swift b/submodules/TelegramUI/TelegramUI/ThemeAccentColorActionSheet.swift index 57483e218b..8f0bdeda11 100644 --- a/submodules/TelegramUI/TelegramUI/ThemeAccentColorActionSheet.swift +++ b/submodules/TelegramUI/TelegramUI/ThemeAccentColorActionSheet.swift @@ -6,6 +6,7 @@ import UIKit import SwiftSignalKit import TelegramCore import TelegramPresentationData +import AccountContext final class ThemeAccentColorActionSheet: ActionSheetController { private var presentationDisposable: Disposable? @@ -15,7 +16,7 @@ final class ThemeAccentColorActionSheet: ActionSheetController { return self._ready } - init(context: AccountContextImpl, currentValue: Int32, applyValue: @escaping (Int32) -> Void) { + init(context: AccountContext, currentValue: Int32, applyValue: @escaping (Int32) -> Void) { let presentationData = context.sharedContext.currentPresentationData.with { $0 } let theme = presentationData.theme let strings = presentationData.strings diff --git a/submodules/TelegramUI/TelegramUI/ThemeAutoNightSettingsController.swift b/submodules/TelegramUI/TelegramUI/ThemeAutoNightSettingsController.swift index 2e3b77858c..eeb7ed3e47 100644 --- a/submodules/TelegramUI/TelegramUI/ThemeAutoNightSettingsController.swift +++ b/submodules/TelegramUI/TelegramUI/ThemeAutoNightSettingsController.swift @@ -8,6 +8,9 @@ import TelegramPresentationData import TelegramUIPreferences import TelegramUIPrivateModule import ItemListUI +import TelegramStringFormatting +import AccountContext +import DeviceLocationManager private enum TriggerMode { case none @@ -328,7 +331,7 @@ private func areSettingsValid(_ settings: AutomaticThemeSwitchSetting) -> Bool { } } -public func themeAutoNightSettingsController(context: AccountContextImpl) -> ViewController { +public func themeAutoNightSettingsController(context: AccountContext) -> ViewController { var presentControllerImpl: ((ViewController) -> Void)? let actionsDisposable = DisposableSet() diff --git a/submodules/TelegramUI/TelegramUI/ThemeAutoNightTimeSelectionActionSheet.swift b/submodules/TelegramUI/TelegramUI/ThemeAutoNightTimeSelectionActionSheet.swift index 7310b8825a..28d287d72f 100644 --- a/submodules/TelegramUI/TelegramUI/ThemeAutoNightTimeSelectionActionSheet.swift +++ b/submodules/TelegramUI/TelegramUI/ThemeAutoNightTimeSelectionActionSheet.swift @@ -5,6 +5,8 @@ import UIKit import SwiftSignalKit import TelegramCore import TelegramPresentationData +import TelegramStringFormatting +import AccountContext final class ThemeAutoNightTimeSelectionActionSheet: ActionSheetController { private var presentationDisposable: Disposable? @@ -14,7 +16,7 @@ final class ThemeAutoNightTimeSelectionActionSheet: ActionSheetController { return self._ready } - init(context: AccountContextImpl, currentValue: Int32, emptyTitle: String? = nil, applyValue: @escaping (Int32?) -> Void) { + init(context: AccountContext, currentValue: Int32, emptyTitle: String? = nil, applyValue: @escaping (Int32?) -> Void) { let presentationData = context.sharedContext.currentPresentationData.with { $0 } let theme = presentationData.theme let strings = presentationData.strings diff --git a/submodules/TelegramUI/TelegramUI/ThemeColorsGridController.swift b/submodules/TelegramUI/TelegramUI/ThemeColorsGridController.swift index 2ba308f52b..10cb5e656c 100644 --- a/submodules/TelegramUI/TelegramUI/ThemeColorsGridController.swift +++ b/submodules/TelegramUI/TelegramUI/ThemeColorsGridController.swift @@ -7,6 +7,7 @@ import TelegramCore import SwiftSignalKit import LegacyComponents import TelegramPresentationData +import AccountContext private func availableColors() -> [Int32] { return [ @@ -61,14 +62,14 @@ final class ThemeColorsGridController: ViewController { return self._ready } - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private var presentationDataDisposable: Disposable? private var validLayout: ContainerViewLayout? - init(context: AccountContextImpl) { + init(context: AccountContext) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/ThemeColorsGridControllerItem.swift b/submodules/TelegramUI/TelegramUI/ThemeColorsGridControllerItem.swift index b670d0b6e9..55ea164977 100644 --- a/submodules/TelegramUI/TelegramUI/ThemeColorsGridControllerItem.swift +++ b/submodules/TelegramUI/TelegramUI/ThemeColorsGridControllerItem.swift @@ -5,16 +5,17 @@ import TelegramCore import SwiftSignalKit import AsyncDisplayKit import Postbox +import AccountContext final class ThemeColorsGridControllerItem: GridItem { - let context: AccountContextImpl + let context: AccountContext let wallpaper: TelegramWallpaper let selected: Bool let interaction: ThemeColorsGridControllerInteraction let section: GridSection? = nil - init(context: AccountContextImpl, wallpaper: TelegramWallpaper, selected: Bool, interaction: ThemeColorsGridControllerInteraction) { + init(context: AccountContext, wallpaper: TelegramWallpaper, selected: Bool, interaction: ThemeColorsGridControllerInteraction) { self.context = context self.wallpaper = wallpaper self.selected = selected @@ -40,7 +41,7 @@ final class ThemeColorsGridControllerItemNode: GridItemNode { private let wallpaperNode: SettingsThemeWallpaperNode private var selectionNode: GridMessageSelectionNode? - private var currentState: (AccountContextImpl, TelegramWallpaper, Bool)? + private var currentState: (AccountContext, TelegramWallpaper, Bool)? private var interaction: ThemeColorsGridControllerInteraction? override init() { @@ -57,7 +58,7 @@ final class ThemeColorsGridControllerItemNode: GridItemNode { self.view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.tapGesture(_:)))) } - func setup(context: AccountContextImpl, wallpaper: TelegramWallpaper, selected: Bool, interaction: ThemeColorsGridControllerInteraction) { + func setup(context: AccountContext, wallpaper: TelegramWallpaper, selected: Bool, interaction: ThemeColorsGridControllerInteraction) { self.interaction = interaction if self.currentState == nil || self.currentState!.0 !== context || wallpaper != self.currentState!.1 || selected != self.currentState!.2 { diff --git a/submodules/TelegramUI/TelegramUI/ThemeColorsGridControllerNode.swift b/submodules/TelegramUI/TelegramUI/ThemeColorsGridControllerNode.swift index a67f997bd7..6d9178f63f 100644 --- a/submodules/TelegramUI/TelegramUI/ThemeColorsGridControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ThemeColorsGridControllerNode.swift @@ -8,6 +8,7 @@ import SwiftSignalKit import TelegramPresentationData import MergeLists import ItemListUI +import AccountContext final class ThemeColorsGridControllerInteraction { let openWallpaper: (TelegramWallpaper) -> Void @@ -34,7 +35,7 @@ private struct ThemeColorsGridControllerEntry: Comparable, Identifiable { return self.index } - func item(context: AccountContextImpl, interaction: ThemeColorsGridControllerInteraction) -> ThemeColorsGridControllerItem { + func item(context: AccountContext, interaction: ThemeColorsGridControllerInteraction) -> ThemeColorsGridControllerItem { return ThemeColorsGridControllerItem(context: context, wallpaper: self.wallpaper, selected: self.selected, interaction: interaction) } } @@ -48,7 +49,7 @@ private struct ThemeColorsGridEntryTransition { let scrollToItem: GridNodeScrollToItem? } -private func preparedThemeColorsGridEntryTransition(context: AccountContextImpl, from fromEntries: [ThemeColorsGridControllerEntry], to toEntries: [ThemeColorsGridControllerEntry], interaction: ThemeColorsGridControllerInteraction) -> ThemeColorsGridEntryTransition { +private func preparedThemeColorsGridEntryTransition(context: AccountContext, from fromEntries: [ThemeColorsGridControllerEntry], to toEntries: [ThemeColorsGridControllerEntry], interaction: ThemeColorsGridControllerInteraction) -> ThemeColorsGridEntryTransition { let stationaryItems: GridNodeStationaryItems = .none let scrollToItem: GridNodeScrollToItem? = nil @@ -62,7 +63,7 @@ private func preparedThemeColorsGridEntryTransition(context: AccountContextImpl, } final class ThemeColorsGridControllerNode: ASDisplayNode { - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private var controllerInteraction: ThemeColorsGridControllerInteraction? private let present: (ViewController, Any?) -> Void @@ -83,7 +84,7 @@ final class ThemeColorsGridControllerNode: ASDisplayNode { private var disposable: Disposable? - init(context: AccountContextImpl, presentationData: PresentationData, colors: [Int32], present: @escaping (ViewController, Any?) -> Void, pop: @escaping () -> Void, presentColorPicker: @escaping () -> Void) { + init(context: AccountContext, presentationData: PresentationData, colors: [Int32], present: @escaping (ViewController, Any?) -> Void, pop: @escaping () -> Void, presentColorPicker: @escaping () -> Void) { self.context = context self.presentationData = presentationData self.present = present diff --git a/submodules/TelegramUI/TelegramUI/ThemeGridController.swift b/submodules/TelegramUI/TelegramUI/ThemeGridController.swift index 993fd6cca5..88ca4491f6 100644 --- a/submodules/TelegramUI/TelegramUI/ThemeGridController.swift +++ b/submodules/TelegramUI/TelegramUI/ThemeGridController.swift @@ -8,6 +8,8 @@ import SwiftSignalKit import LegacyComponents import TelegramPresentationData import TelegramUIPreferences +import OverlayStatusController +import AccountContext final class ThemeGridController: ViewController { private var controllerNode: ThemeGridControllerNode { @@ -19,7 +21,7 @@ final class ThemeGridController: ViewController { return self._ready } - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private let presentationDataPromise = Promise() @@ -36,7 +38,7 @@ final class ThemeGridController: ViewController { return false } - init(context: AccountContextImpl) { + init(context: AccountContext) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } self.presentationDataPromise.set(.single(self.presentationData)) diff --git a/submodules/TelegramUI/TelegramUI/ThemeGridControllerItem.swift b/submodules/TelegramUI/TelegramUI/ThemeGridControllerItem.swift index 8aef96b721..6e588ee22f 100644 --- a/submodules/TelegramUI/TelegramUI/ThemeGridControllerItem.swift +++ b/submodules/TelegramUI/TelegramUI/ThemeGridControllerItem.swift @@ -5,9 +5,10 @@ import TelegramCore import SwiftSignalKit import AsyncDisplayKit import Postbox +import AccountContext final class ThemeGridControllerItem: GridItem { - let context: AccountContextImpl + let context: AccountContext let wallpaper: TelegramWallpaper let index: Int let selected: Bool @@ -15,7 +16,7 @@ final class ThemeGridControllerItem: GridItem { let section: GridSection? = nil - init(context: AccountContextImpl, wallpaper: TelegramWallpaper, index: Int, selected: Bool, interaction: ThemeGridControllerInteraction) { + init(context: AccountContext, wallpaper: TelegramWallpaper, index: Int, selected: Bool, interaction: ThemeGridControllerInteraction) { self.context = context self.wallpaper = wallpaper self.index = index @@ -42,7 +43,7 @@ final class ThemeGridControllerItemNode: GridItemNode { private let wallpaperNode: SettingsThemeWallpaperNode private var selectionNode: GridMessageSelectionNode? - private var currentState: (AccountContextImpl, TelegramWallpaper, Bool, Bool)? + private var currentState: (AccountContext, TelegramWallpaper, Bool, Bool)? private var interaction: ThemeGridControllerInteraction? override init() { @@ -59,7 +60,7 @@ final class ThemeGridControllerItemNode: GridItemNode { self.view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.tapGesture(_:)))) } - func setup(context: AccountContextImpl, wallpaper: TelegramWallpaper, selected: Bool, interaction: ThemeGridControllerInteraction, synchronousLoad: Bool) { + func setup(context: AccountContext, wallpaper: TelegramWallpaper, selected: Bool, interaction: ThemeGridControllerInteraction, synchronousLoad: Bool) { self.interaction = interaction if self.currentState == nil || self.currentState!.0 !== context || wallpaper != self.currentState!.1 || selected != self.currentState!.2 || synchronousLoad != self.currentState!.3 { diff --git a/submodules/TelegramUI/TelegramUI/ThemeGridControllerNode.swift b/submodules/TelegramUI/TelegramUI/ThemeGridControllerNode.swift index 3a1e4153ea..217d295ab0 100644 --- a/submodules/TelegramUI/TelegramUI/ThemeGridControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ThemeGridControllerNode.swift @@ -10,6 +10,7 @@ import TelegramPresentationData import TelegramUIPreferences import MergeLists import ItemListUI +import AccountContext private func areWallpapersEqual(_ lhs: TelegramWallpaper, _ rhs: TelegramWallpaper) -> Bool { switch lhs { @@ -111,7 +112,7 @@ private struct ThemeGridControllerEntry: Comparable, Identifiable { } } - func item(context: AccountContextImpl, interaction: ThemeGridControllerInteraction) -> ThemeGridControllerItem { + func item(context: AccountContext, interaction: ThemeGridControllerInteraction) -> ThemeGridControllerItem { return ThemeGridControllerItem(context: context, wallpaper: self.wallpaper, index: self.index, selected: self.selected, interaction: interaction) } } @@ -127,7 +128,7 @@ private struct ThemeGridEntryTransition { let synchronousLoad: Bool } -private func preparedThemeGridEntryTransition(context: AccountContextImpl, from fromEntries: [ThemeGridControllerEntry], to toEntries: [ThemeGridControllerEntry], interaction: ThemeGridControllerInteraction) -> ThemeGridEntryTransition { +private func preparedThemeGridEntryTransition(context: AccountContext, from fromEntries: [ThemeGridControllerEntry], to toEntries: [ThemeGridControllerEntry], interaction: ThemeGridControllerInteraction) -> ThemeGridEntryTransition { let stationaryItems: GridNodeStationaryItems = .none let scrollToItem: GridNodeScrollToItem? = nil @@ -178,7 +179,7 @@ private func selectedWallpapers(entries: [ThemeGridControllerEntry]?, state: The } final class ThemeGridControllerNode: ASDisplayNode { - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private var controllerInteraction: ThemeGridControllerInteraction? @@ -229,7 +230,7 @@ final class ThemeGridControllerNode: ASDisplayNode { private var disposable: Disposable? - init(context: AccountContextImpl, presentationData: PresentationData, presentPreviewController: @escaping (WallpaperListSource) -> Void, presentGallery: @escaping () -> Void, presentColors: @escaping () -> Void, emptyStateUpdated: @escaping (Bool) -> Void, deleteWallpapers: @escaping ([TelegramWallpaper], @escaping () -> Void) -> Void, shareWallpapers: @escaping ([TelegramWallpaper]) -> Void, resetWallpapers: @escaping () -> Void, popViewController: @escaping () -> Void) { + init(context: AccountContext, presentationData: PresentationData, presentPreviewController: @escaping (WallpaperListSource) -> Void, presentGallery: @escaping () -> Void, presentColors: @escaping () -> Void, emptyStateUpdated: @escaping (Bool) -> Void, deleteWallpapers: @escaping ([TelegramWallpaper], @escaping () -> Void) -> Void, shareWallpapers: @escaping ([TelegramWallpaper]) -> Void, resetWallpapers: @escaping () -> Void, popViewController: @escaping () -> Void) { self.context = context self.presentationData = presentationData self.presentPreviewController = presentPreviewController diff --git a/submodules/TelegramUI/TelegramUI/ThemeGridSearchContentNode.swift b/submodules/TelegramUI/TelegramUI/ThemeGridSearchContentNode.swift index cf88f27634..ac90ad2c2a 100644 --- a/submodules/TelegramUI/TelegramUI/ThemeGridSearchContentNode.swift +++ b/submodules/TelegramUI/TelegramUI/ThemeGridSearchContentNode.swift @@ -7,6 +7,7 @@ import Postbox import TelegramCore import TelegramPresentationData import MergeLists +import AccountContext enum WallpaperSearchColor: CaseIterable { case blue @@ -309,7 +310,7 @@ private struct ThemeGridSearchContext { } final class ThemeGridSearchContentNode: SearchDisplayControllerContentNode { - private let context: AccountContextImpl + private let context: AccountContext private let recentListNode: ListView private let gridNode: GridNode @@ -337,7 +338,7 @@ final class ThemeGridSearchContentNode: SearchDisplayControllerContentNode { return self._isSearching.get() } - init(context: AccountContextImpl, openResult: @escaping (ChatContextResult) -> Void) { + init(context: AccountContext, openResult: @escaping (ChatContextResult) -> Void) { self.context = context self.queryPromise = Promise(self.queryValue) diff --git a/submodules/TelegramUI/TelegramUI/ThemePreviewController.swift b/submodules/TelegramUI/TelegramUI/ThemePreviewController.swift index 2f89847ab6..9bd15e83ca 100644 --- a/submodules/TelegramUI/TelegramUI/ThemePreviewController.swift +++ b/submodules/TelegramUI/TelegramUI/ThemePreviewController.swift @@ -7,9 +7,10 @@ import AsyncDisplayKit import TelegramCore import TelegramPresentationData import TelegramUIPreferences +import AccountContext final class ThemePreviewController: ViewController { - private let context: AccountContextImpl + private let context: AccountContext private let previewTheme: PresentationTheme private let media: AnyMediaReference @@ -22,7 +23,7 @@ final class ThemePreviewController: ViewController { private var presentationData: PresentationData private var presentationDataDisposable: Disposable? - init(context: AccountContextImpl, previewTheme: PresentationTheme, media: AnyMediaReference) { + init(context: AccountContext, previewTheme: PresentationTheme, media: AnyMediaReference) { self.context = context self.previewTheme = previewTheme self.media = media diff --git a/submodules/TelegramUI/TelegramUI/ThemePreviewControllerNode.swift b/submodules/TelegramUI/TelegramUI/ThemePreviewControllerNode.swift index 2400f55441..c41669e930 100644 --- a/submodules/TelegramUI/TelegramUI/ThemePreviewControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ThemePreviewControllerNode.swift @@ -7,9 +7,10 @@ import AsyncDisplayKit import TelegramCore import TelegramPresentationData import TelegramUIPreferences +import AccountContext class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate { - private let context: AccountContextImpl + private let context: AccountContext private let previewTheme: PresentationTheme private var presentationData: PresentationData @@ -29,7 +30,7 @@ class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate { private var colorDisposable: Disposable? - init(context: AccountContextImpl, previewTheme: PresentationTheme, dismiss: @escaping () -> Void, apply: @escaping () -> Void) { + init(context: AccountContext, previewTheme: PresentationTheme, dismiss: @escaping () -> Void, apply: @escaping () -> Void) { self.context = context self.previewTheme = previewTheme diff --git a/submodules/TelegramUI/TelegramUI/ThemeSettingsChatPreviewItem.swift b/submodules/TelegramUI/TelegramUI/ThemeSettingsChatPreviewItem.swift index 8a61652829..5258348745 100644 --- a/submodules/TelegramUI/TelegramUI/ThemeSettingsChatPreviewItem.swift +++ b/submodules/TelegramUI/TelegramUI/ThemeSettingsChatPreviewItem.swift @@ -8,9 +8,10 @@ import Postbox import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext class ThemeSettingsChatPreviewItem: ListViewItem, ItemListItem { - let context: AccountContextImpl + let context: AccountContext let theme: PresentationTheme let componentTheme: PresentationTheme let strings: PresentationStrings @@ -20,7 +21,7 @@ class ThemeSettingsChatPreviewItem: ListViewItem, ItemListItem { let dateTimeFormat: PresentationDateTimeFormat let nameDisplayOrder: PresentationPersonNameOrder - init(context: AccountContextImpl, theme: PresentationTheme, componentTheme: PresentationTheme, strings: PresentationStrings, sectionId: ItemListSectionId, fontSize: PresentationFontSize, wallpaper: TelegramWallpaper, dateTimeFormat: PresentationDateTimeFormat, nameDisplayOrder: PresentationPersonNameOrder) { + init(context: AccountContext, theme: PresentationTheme, componentTheme: PresentationTheme, strings: PresentationStrings, sectionId: ItemListSectionId, fontSize: PresentationFontSize, wallpaper: TelegramWallpaper, dateTimeFormat: PresentationDateTimeFormat, nameDisplayOrder: PresentationPersonNameOrder) { self.context = context self.theme = theme self.componentTheme = componentTheme diff --git a/submodules/TelegramUI/TelegramUI/ThemeSettingsController.swift b/submodules/TelegramUI/TelegramUI/ThemeSettingsController.swift index ca975109b0..96534f1bb9 100644 --- a/submodules/TelegramUI/TelegramUI/ThemeSettingsController.swift +++ b/submodules/TelegramUI/TelegramUI/ThemeSettingsController.swift @@ -7,9 +7,10 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext private final class ThemeSettingsControllerArguments { - let context: AccountContextImpl + let context: AccountContext let selectTheme: (PresentationThemeReference) -> Void let selectFontSize: (PresentationFontSize) -> Void let openWallpaperSettings: () -> Void @@ -20,7 +21,7 @@ private final class ThemeSettingsControllerArguments { let disableAnimations: (Bool) -> Void let selectAppIcon: (String) -> Void - init(context: AccountContextImpl, selectTheme: @escaping (PresentationThemeReference) -> Void, selectFontSize: @escaping (PresentationFontSize) -> Void, openWallpaperSettings: @escaping () -> Void, selectAccentColor: @escaping (PresentationThemeAccentColor) -> Void, toggleColorSlider: @escaping (Bool) -> Void, openAutoNightTheme: @escaping () -> Void, toggleLargeEmoji: @escaping (Bool) -> Void, disableAnimations: @escaping (Bool) -> Void, selectAppIcon: @escaping (String) -> Void) { + init(context: AccountContext, selectTheme: @escaping (PresentationThemeReference) -> Void, selectFontSize: @escaping (PresentationFontSize) -> Void, openWallpaperSettings: @escaping () -> Void, selectAccentColor: @escaping (PresentationThemeAccentColor) -> Void, toggleColorSlider: @escaping (Bool) -> Void, openAutoNightTheme: @escaping () -> Void, toggleLargeEmoji: @escaping (Bool) -> Void, disableAnimations: @escaping (Bool) -> Void, selectAppIcon: @escaping (String) -> Void) { self.context = context self.selectTheme = selectTheme self.selectFontSize = selectFontSize @@ -341,7 +342,7 @@ private func themeSettingsControllerEntries(presentationData: PresentationData, return entries } -public func themeSettingsController(context: AccountContextImpl, focusOnItemTag: ThemeSettingsEntryTag? = nil) -> ViewController { +public func themeSettingsController(context: AccountContext, focusOnItemTag: ThemeSettingsEntryTag? = nil) -> ViewController { let initialState = ThemeSettingsState(displayColorSlider: false) let statePromise = ValuePromise(initialState, ignoreRepeated: true) let stateValue = Atomic(value: initialState) diff --git a/submodules/TelegramUI/TelegramUI/ThemedTextAlertController.swift b/submodules/TelegramUI/TelegramUI/ThemedTextAlertController.swift index 4559cc8231..fc507460d5 100644 --- a/submodules/TelegramUI/TelegramUI/ThemedTextAlertController.swift +++ b/submodules/TelegramUI/TelegramUI/ThemedTextAlertController.swift @@ -2,8 +2,9 @@ import Foundation import UIKit import Display import TelegramCore +import AccountContext -public func textAlertController(context: AccountContextImpl, title: String?, text: String, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal) -> AlertController { +public func textAlertController(context: AccountContext, title: String?, text: String, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal) -> AlertController { let presentationData = context.sharedContext.currentPresentationData.with { $0 } let controller = standardTextAlertController(theme: AlertControllerTheme(presentationTheme: presentationData.theme), title: title, text: text, actions: actions) @@ -17,7 +18,7 @@ public func textAlertController(context: AccountContextImpl, title: String?, tex return controller } -public func richTextAlertController(context: AccountContextImpl, title: NSAttributedString?, text: NSAttributedString, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal) -> AlertController { +public func richTextAlertController(context: AccountContext, title: NSAttributedString?, text: NSAttributedString, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal) -> AlertController { let presentationData = context.sharedContext.currentPresentationData.with { $0 } let theme = AlertControllerTheme(presentationTheme: presentationData.theme) diff --git a/submodules/TelegramUI/TelegramUI/TwoStepVerificationPasswordEntryController.swift b/submodules/TelegramUI/TelegramUI/TwoStepVerificationPasswordEntryController.swift index 0b72d8073c..f0d4512562 100644 --- a/submodules/TelegramUI/TelegramUI/TwoStepVerificationPasswordEntryController.swift +++ b/submodules/TelegramUI/TelegramUI/TwoStepVerificationPasswordEntryController.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import TelegramPresentationData import ItemListUI +import AccountContext private final class TwoStepVerificationPasswordEntryControllerArguments { let updateEntryText: (String) -> Void @@ -256,7 +257,7 @@ struct TwoStepVerificationPasswordEntryResult { let pendingEmail: TwoStepVerificationPendingEmail? } -func twoStepVerificationPasswordEntryController(context: AccountContextImpl, mode: TwoStepVerificationPasswordEntryMode, result: Promise) -> ViewController { +func twoStepVerificationPasswordEntryController(context: AccountContext, mode: TwoStepVerificationPasswordEntryMode, result: Promise) -> ViewController { let initialStage: PasswordEntryStage switch mode { case .setup, .change: diff --git a/submodules/TelegramUI/TelegramUI/TwoStepVerificationResetController.swift b/submodules/TelegramUI/TelegramUI/TwoStepVerificationResetController.swift index f751ca4f8f..cb7a9ac089 100644 --- a/submodules/TelegramUI/TelegramUI/TwoStepVerificationResetController.swift +++ b/submodules/TelegramUI/TelegramUI/TwoStepVerificationResetController.swift @@ -7,6 +7,7 @@ import TelegramCore import TelegramPresentationData import ItemListUI import TextFormat +import AccountContext private final class TwoStepVerificationResetControllerArguments { let updateEntryText: (String) -> Void @@ -133,7 +134,7 @@ private func twoStepVerificationResetControllerEntries(presentationData: Present return entries } -func twoStepVerificationResetController(context: AccountContextImpl, emailPattern: String, result: Promise) -> ViewController { +func twoStepVerificationResetController(context: AccountContext, emailPattern: String, result: Promise) -> ViewController { let initialState = TwoStepVerificationResetControllerState(codeText: "", checking: false) let statePromise = ValuePromise(initialState, ignoreRepeated: true) diff --git a/submodules/TelegramUI/TelegramUI/TwoStepVerificationUnlockController.swift b/submodules/TelegramUI/TelegramUI/TwoStepVerificationUnlockController.swift index 26e7db74ae..b493a6845e 100644 --- a/submodules/TelegramUI/TelegramUI/TwoStepVerificationUnlockController.swift +++ b/submodules/TelegramUI/TelegramUI/TwoStepVerificationUnlockController.swift @@ -7,6 +7,8 @@ import TelegramCore import TelegramPresentationData import ItemListUI import TextFormat +import OverlayStatusController +import AccountContext private final class TwoStepVerificationUnlockSettingsControllerArguments { let updatePasswordText: (String) -> Void @@ -248,7 +250,7 @@ enum TwoStepVerificationUnlockSettingsControllerData: Equatable { case manage(password: String, emailSet: Bool, pendingEmail: TwoStepVerificationPendingEmail?, hasSecureValues: Bool) } -func twoStepVerificationUnlockSettingsController(context: AccountContextImpl, mode: TwoStepVerificationUnlockSettingsControllerMode, openSetupPasswordImmediately: Bool = false) -> ViewController { +func twoStepVerificationUnlockSettingsController(context: AccountContext, mode: TwoStepVerificationUnlockSettingsControllerMode, openSetupPasswordImmediately: Bool = false) -> ViewController { let initialState = TwoStepVerificationUnlockSettingsControllerState() let statePromise = ValuePromise(initialState, ignoreRepeated: true) diff --git a/submodules/TelegramUI/TelegramUI/UndoOverlayController.swift b/submodules/TelegramUI/TelegramUI/UndoOverlayController.swift index fc34836691..799c55f121 100644 --- a/submodules/TelegramUI/TelegramUI/UndoOverlayController.swift +++ b/submodules/TelegramUI/TelegramUI/UndoOverlayController.swift @@ -4,6 +4,7 @@ import Display import TelegramCore import Postbox import TelegramPresentationData +import AccountContext public enum UndoOverlayContent { case removedChat(text: String) @@ -14,7 +15,7 @@ public enum UndoOverlayContent { } public final class UndoOverlayController: ViewController { - private let context: AccountContextImpl + private let context: AccountContext private let presentationData: PresentationData let content: UndoOverlayContent private let elevatedLayout: Bool @@ -23,7 +24,7 @@ public final class UndoOverlayController: ViewController { private var didPlayPresentationAnimation = false - public init(context: AccountContextImpl, content: UndoOverlayContent, elevatedLayout: Bool, animateInAsReplacement: Bool = false, action: @escaping (Bool) -> Void) { + public init(context: AccountContext, content: UndoOverlayContent, elevatedLayout: Bool, animateInAsReplacement: Bool = false, action: @escaping (Bool) -> Void) { self.context = context self.presentationData = context.sharedContext.currentPresentationData.with { $0 } self.content = content diff --git a/submodules/TelegramUI/TelegramUI/UniversalVideoContentManager.swift b/submodules/TelegramUI/TelegramUI/UniversalVideoContentManager.swift index 227f70453b..d6d9a1eee0 100644 --- a/submodules/TelegramUI/TelegramUI/UniversalVideoContentManager.swift +++ b/submodules/TelegramUI/TelegramUI/UniversalVideoContentManager.swift @@ -3,6 +3,7 @@ import UIKit import AsyncDisplayKit import SwiftSignalKit import UniversalMediaPlayer +import AccountContext private final class UniversalVideoContentSubscriber { let id: Int32 @@ -137,7 +138,7 @@ private final class UniversalVideoContentHolderCallbacks { } } -final class UniversalVideoContentManager { +final class UniversalVideoManagerImpl: UniversalVideoManager { private var holders: [AnyHashable: UniversalVideoContentHolder] = [:] private var holderCallbacks: [AnyHashable: UniversalVideoContentHolderCallbacks] = [:] diff --git a/submodules/TelegramUI/TelegramUI/UniversalVideoGalleryItem.swift b/submodules/TelegramUI/TelegramUI/UniversalVideoGalleryItem.swift index cd91bb7d78..6eab52d795 100644 --- a/submodules/TelegramUI/TelegramUI/UniversalVideoGalleryItem.swift +++ b/submodules/TelegramUI/TelegramUI/UniversalVideoGalleryItem.swift @@ -7,6 +7,7 @@ import Display import Postbox import TelegramPresentationData import UniversalMediaPlayer +import AccountContext enum UniversalVideoGalleryItemContentInfo { case message(Message) @@ -14,7 +15,7 @@ enum UniversalVideoGalleryItemContentInfo { } class UniversalVideoGalleryItem: GalleryItem { - let context: AccountContextImpl + let context: AccountContext let presentationData: PresentationData let content: UniversalVideoContent let originData: GalleryItemOriginData? @@ -30,7 +31,7 @@ class UniversalVideoGalleryItem: GalleryItem { let performAction: (GalleryControllerInteractionTapAction) -> Void let openActionOptions: (GalleryControllerInteractionTapAction) -> Void - init(context: AccountContextImpl, presentationData: PresentationData, content: UniversalVideoContent, originData: GalleryItemOriginData?, indexData: GalleryItemIndexData?, contentInfo: UniversalVideoGalleryItemContentInfo?, caption: NSAttributedString, credit: NSAttributedString? = nil, hideControls: Bool = false, fromPlayingVideo: Bool = false, landscape: Bool = false, timecode: Double? = nil, playbackCompleted: @escaping () -> Void = {}, performAction: @escaping (GalleryControllerInteractionTapAction) -> Void, openActionOptions: @escaping (GalleryControllerInteractionTapAction) -> Void) { + init(context: AccountContext, presentationData: PresentationData, content: UniversalVideoContent, originData: GalleryItemOriginData?, indexData: GalleryItemIndexData?, contentInfo: UniversalVideoGalleryItemContentInfo?, caption: NSAttributedString, credit: NSAttributedString? = nil, hideControls: Bool = false, fromPlayingVideo: Bool = false, landscape: Bool = false, timecode: Double? = nil, playbackCompleted: @escaping () -> Void = {}, performAction: @escaping (GalleryControllerInteractionTapAction) -> Void, openActionOptions: @escaping (GalleryControllerInteractionTapAction) -> Void) { self.context = context self.presentationData = presentationData self.content = content @@ -142,7 +143,7 @@ private struct FetchControls { } final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode { - private let context: AccountContextImpl + private let context: AccountContext private let presentationData: PresentationData fileprivate let _ready = Promise() @@ -185,7 +186,7 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode { var playbackCompleted: (() -> Void)? - init(context: AccountContextImpl, presentationData: PresentationData, performAction: @escaping (GalleryControllerInteractionTapAction) -> Void, openActionOptions: @escaping (GalleryControllerInteractionTapAction) -> Void) { + init(context: AccountContext, presentationData: PresentationData, performAction: @escaping (GalleryControllerInteractionTapAction) -> Void, openActionOptions: @escaping (GalleryControllerInteractionTapAction) -> Void) { self.context = context self.presentationData = presentationData self.scrubberView = ChatVideoGalleryItemScrubberView() diff --git a/submodules/TelegramUI/TelegramUI/UrlHandling.swift b/submodules/TelegramUI/TelegramUI/UrlHandling.swift index 2523b28853..9ea9b7d6d2 100644 --- a/submodules/TelegramUI/TelegramUI/UrlHandling.swift +++ b/submodules/TelegramUI/TelegramUI/UrlHandling.swift @@ -10,6 +10,7 @@ import MtProtoKitDynamic #endif import TelegramPresentationData import TelegramUIPreferences +import AccountContext enum ParsedInternalPeerUrlParameter { case botStart(String) diff --git a/submodules/TelegramUI/TelegramUI/UserInfoController.swift b/submodules/TelegramUI/TelegramUI/UserInfoController.swift index d8c3099235..5cab3cb95f 100644 --- a/submodules/TelegramUI/TelegramUI/UserInfoController.swift +++ b/submodules/TelegramUI/TelegramUI/UserInfoController.swift @@ -10,6 +10,9 @@ import TelegramPresentationData import ItemListUI import AccountContext import TextFormat +import OverlayStatusController +import TelegramStringFormatting +import AccountContext private final class UserInfoControllerArguments { let account: Account @@ -760,7 +763,7 @@ public enum UserInfoControllerMode { case calls(messages: [Message]) } -public func userInfoController(context: AccountContextImpl, peerId: PeerId, mode: UserInfoControllerMode = .generic) -> ViewController { +public func userInfoController(context: AccountContext, peerId: PeerId, mode: UserInfoControllerMode = .generic) -> ViewController { let statePromise = ValuePromise(UserInfoState(), ignoreRepeated: true) let stateValue = Atomic(value: UserInfoState()) let updateState: ((UserInfoState) -> UserInfoState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/UsernameSetupController.swift b/submodules/TelegramUI/TelegramUI/UsernameSetupController.swift index 07c9b07e68..1209d1a81f 100644 --- a/submodules/TelegramUI/TelegramUI/UsernameSetupController.swift +++ b/submodules/TelegramUI/TelegramUI/UsernameSetupController.swift @@ -6,6 +6,7 @@ import Postbox import TelegramCore import TelegramPresentationData import ItemListUI +import AccountContext private final class UsernameSetupControllerArguments { let account: Account @@ -219,7 +220,7 @@ private func usernameSetupControllerEntries(presentationData: PresentationData, return entries } -public func usernameSetupController(context: AccountContextImpl) -> ViewController { +public func usernameSetupController(context: AccountContext) -> ViewController { let statePromise = ValuePromise(UsernameSetupControllerState(), ignoreRepeated: true) let stateValue = Atomic(value: UsernameSetupControllerState()) let updateState: ((UsernameSetupControllerState) -> UsernameSetupControllerState) -> Void = { f in diff --git a/submodules/TelegramUI/TelegramUI/VerticalListContextResultsChatInputContextPanelNode.swift b/submodules/TelegramUI/TelegramUI/VerticalListContextResultsChatInputContextPanelNode.swift index 1a8e2da854..925a759fef 100644 --- a/submodules/TelegramUI/TelegramUI/VerticalListContextResultsChatInputContextPanelNode.swift +++ b/submodules/TelegramUI/TelegramUI/VerticalListContextResultsChatInputContextPanelNode.swift @@ -6,6 +6,7 @@ import TelegramCore import Display import TelegramPresentationData import MergeLists +import AccountContext private enum VerticalChatContextResultsEntryStableId: Hashable { case action @@ -126,7 +127,7 @@ final class VerticalListContextResultsChatInputContextPanelNode: ChatInputContex private var validLayout: (CGSize, CGFloat, CGFloat)? - override init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings) { + override init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings) { self.listView = ListView() self.listView.isOpaque = false self.listView.stackFromBottom = true diff --git a/submodules/TelegramUI/TelegramUI/VoiceCallDataSavingController.swift b/submodules/TelegramUI/TelegramUI/VoiceCallDataSavingController.swift index ff9d055d15..5acb97b20e 100644 --- a/submodules/TelegramUI/TelegramUI/VoiceCallDataSavingController.swift +++ b/submodules/TelegramUI/TelegramUI/VoiceCallDataSavingController.swift @@ -7,6 +7,7 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext private final class VoiceCallDataSavingControllerArguments { let updateSelection: (VoiceCallDataSaving) -> Void @@ -118,7 +119,7 @@ private func voiceCallDataSavingControllerEntries(presentationData: Presentation return entries } -func voiceCallDataSavingController(context: AccountContextImpl) -> ViewController { +func voiceCallDataSavingController(context: AccountContext) -> ViewController { let sharedSettings = context.sharedContext.accountManager.sharedData(keys: [ApplicationSpecificSharedDataKeys.voiceCallSettings]) |> map { sharedData -> (VoiceCallSettings, AutodownloadSettings) in let voiceCallSettings: VoiceCallSettings diff --git a/submodules/TelegramUI/TelegramUI/WakeupManager.swift b/submodules/TelegramUI/TelegramUI/WakeupManager.swift index b98d5e95e4..252abefacc 100644 --- a/submodules/TelegramUI/TelegramUI/WakeupManager.swift +++ b/submodules/TelegramUI/TelegramUI/WakeupManager.swift @@ -5,6 +5,7 @@ import UIKit import Postbox import UserNotifications import TelegramUIPreferences +import AccountContext private final class WakeupManagerTask { let nativeId: UIBackgroundTaskIdentifier diff --git a/submodules/TelegramUI/TelegramUI/WallpaperGalleryController.swift b/submodules/TelegramUI/TelegramUI/WallpaperGalleryController.swift index f0941fca9f..b652636268 100644 --- a/submodules/TelegramUI/TelegramUI/WallpaperGalleryController.swift +++ b/submodules/TelegramUI/TelegramUI/WallpaperGalleryController.swift @@ -10,6 +10,7 @@ import Photos import TelegramPresentationData import TelegramUIPreferences import MediaResources +import AccountContext enum WallpaperListType { case wallpapers(WallpaperPresentationOptions?) @@ -119,7 +120,7 @@ class WallpaperGalleryController: ViewController { return self.displayNode as! GalleryControllerNode } - private let context: AccountContextImpl + private let context: AccountContext private let source: WallpaperListSource var apply: ((WallpaperGalleryEntry, WallpaperPresentationOptions, CGRect?) -> Void)? @@ -157,7 +158,7 @@ class WallpaperGalleryController: ViewController { private var colorPanelEnabled = false private var patternPanelEnabled = false - init(context: AccountContextImpl, source: WallpaperListSource) { + init(context: AccountContext, source: WallpaperListSource) { self.context = context self.source = source self.presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/TelegramUI/TelegramUI/WallpaperGalleryItem.swift b/submodules/TelegramUI/TelegramUI/WallpaperGalleryItem.swift index 8232abaa2b..7cd575a05a 100644 --- a/submodules/TelegramUI/TelegramUI/WallpaperGalleryItem.swift +++ b/submodules/TelegramUI/TelegramUI/WallpaperGalleryItem.swift @@ -10,6 +10,7 @@ import TelegramPresentationData import TelegramUIPreferences import ProgressNavigationButtonNode import MediaResources +import AccountContext struct WallpaperGalleryItemArguments { let colorPreview: Bool @@ -24,11 +25,11 @@ struct WallpaperGalleryItemArguments { } class WallpaperGalleryItem: GalleryItem { - let context: AccountContextImpl + let context: AccountContext let entry: WallpaperGalleryEntry let arguments: WallpaperGalleryItemArguments - init(context: AccountContextImpl, entry: WallpaperGalleryEntry, arguments: WallpaperGalleryItemArguments) { + init(context: AccountContext, entry: WallpaperGalleryEntry, arguments: WallpaperGalleryItemArguments) { self.context = context self.entry = entry self.arguments = arguments @@ -62,7 +63,7 @@ private func reference(for resource: MediaResource, media: Media, message: Messa } final class WallpaperGalleryItemNode: GalleryItemNode { - private let context: AccountContextImpl + private let context: AccountContext var entry: WallpaperGalleryEntry? private var colorPreview: Bool = false private var contentSize: CGSize? @@ -92,7 +93,7 @@ final class WallpaperGalleryItemNode: GalleryItemNode { private var validLayout: ContainerViewLayout? private var validOffset: CGFloat? - init(context: AccountContextImpl) { + init(context: AccountContext) { self.context = context self.wrapperNode = ASDisplayNode() diff --git a/submodules/TelegramUI/TelegramUI/WallpaperPatternPanelNode.swift b/submodules/TelegramUI/TelegramUI/WallpaperPatternPanelNode.swift index cb41fab342..21df0b555d 100644 --- a/submodules/TelegramUI/TelegramUI/WallpaperPatternPanelNode.swift +++ b/submodules/TelegramUI/TelegramUI/WallpaperPatternPanelNode.swift @@ -6,6 +6,7 @@ import Display import TelegramCore import TelegramPresentationData import LegacyComponents +import AccountContext private let itemSize = CGSize(width: 88.0, height: 88.0) private let inset: CGFloat = 12.0 @@ -27,7 +28,7 @@ final class WallpaperPatternPanelNode: ASDisplayNode { var patternChanged: ((TelegramWallpaper, Int32?, Bool) -> Void)? - init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings) { + init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings) { self.theme = theme self.backgroundNode = ASDisplayNode() diff --git a/submodules/TelegramUI/TelegramUI/WallpaperUploadManager.swift b/submodules/TelegramUI/TelegramUI/WallpaperUploadManager.swift index f4421aeb02..cf3072bc8a 100644 --- a/submodules/TelegramUI/TelegramUI/WallpaperUploadManager.swift +++ b/submodules/TelegramUI/TelegramUI/WallpaperUploadManager.swift @@ -6,6 +6,7 @@ import SwiftSignalKit import TelegramPresentationData import TelegramUIPreferences import MediaResources +import AccountContext private extension TelegramWallpaper { var mainResource: MediaResource? { @@ -42,23 +43,8 @@ private func areMediaResourcesEqual(_ lhs: MediaResource?, _ rhs: MediaResource? } } -enum WallpaperUploadManagerStatus { - case none - case uploading(TelegramWallpaper, Float) - case uploaded(TelegramWallpaper, TelegramWallpaper) - - var wallpaper: TelegramWallpaper? { - switch self { - case let .uploading(wallpaper, _), let .uploaded(wallpaper, _): - return wallpaper - default: - return nil - } - } -} - -final class WallpaperUploadManager { - private let sharedContext: SharedAccountContextImpl +final class WallpaperUploadManagerImpl: WallpaperUploadManager { + private let sharedContext: SharedAccountContext private let account: Account private var context: WallpaperUploadContext? @@ -67,7 +53,7 @@ final class WallpaperUploadManager { private let statePromise = Promise(.none) - init(sharedContext: SharedAccountContextImpl, account: Account, presentationData: Signal) { + init(sharedContext: SharedAccountContext, account: Account, presentationData: Signal) { self.sharedContext = sharedContext self.account = account self.presentationDataDisposable.set(presentationData.start(next: { [weak self] presentationData in diff --git a/submodules/TelegramUI/TelegramUI/WatchCommunicationManager.swift b/submodules/TelegramUI/TelegramUI/WatchCommunicationManager.swift index c6425101b2..8161aa4626 100644 --- a/submodules/TelegramUI/TelegramUI/WatchCommunicationManager.swift +++ b/submodules/TelegramUI/TelegramUI/WatchCommunicationManager.swift @@ -6,6 +6,7 @@ import WatchCommon import TelegramUIPrivateModule import SSignalKit import TelegramUIPreferences +import AccountContext final class WatchCommunicationManager { private let queue: Queue @@ -16,7 +17,7 @@ final class WatchCommunicationManager { private let contextDisposable = MetaDisposable() private let presetsDisposable = MetaDisposable() - let accountContext = Promise(nil) + let accountContext = Promise(nil) private let presets = Promise(nil) private let navigateToMessagePipe = ValuePipe() diff --git a/submodules/TelegramUI/TelegramUI/WatchManager.swift b/submodules/TelegramUI/TelegramUI/WatchManager.swift index e568573369..11d0a2d9c0 100644 --- a/submodules/TelegramUI/TelegramUI/WatchManager.swift +++ b/submodules/TelegramUI/TelegramUI/WatchManager.swift @@ -2,20 +2,7 @@ import Foundation import SwiftSignalKit import Postbox import TelegramCore - -public struct WatchRunningTasks: Equatable { - public let running: Bool - public let version: Int32 - - public init(running: Bool, version: Int32) { - self.running = running - self.version = version - } - - public static func ==(lhs: WatchRunningTasks, rhs: WatchRunningTasks) -> Bool { - return lhs.running == rhs.running && lhs.version == rhs.version - } -} +import AccountContext public final class WatchManagerArguments { public let appInstalled: Signal @@ -29,7 +16,7 @@ public final class WatchManagerArguments { } } -public final class WatchManager { +public final class WatchManagerImpl: WatchManager { private let arguments: WatchManagerArguments? public init(arguments: WatchManagerArguments?) { diff --git a/submodules/TelegramUI/TelegramUI/WatchRequestHandlers.swift b/submodules/TelegramUI/TelegramUI/WatchRequestHandlers.swift index 3248352392..d53860ecac 100644 --- a/submodules/TelegramUI/TelegramUI/WatchRequestHandlers.swift +++ b/submodules/TelegramUI/TelegramUI/WatchRequestHandlers.swift @@ -6,6 +6,7 @@ import TelegramCore import LegacyComponents import WatchCommon import TelegramPresentationData +import AvatarNode let allWatchRequestHandlers: [AnyClass] = [ WatchChatListHandler.self, diff --git a/submodules/TelegramUI/TelegramUI/WatchSettingsController.swift b/submodules/TelegramUI/TelegramUI/WatchSettingsController.swift index fad3f4bb00..e353d538e8 100644 --- a/submodules/TelegramUI/TelegramUI/WatchSettingsController.swift +++ b/submodules/TelegramUI/TelegramUI/WatchSettingsController.swift @@ -7,6 +7,7 @@ import TelegramCore import TelegramPresentationData import TelegramUIPreferences import ItemListUI +import AccountContext private final class WatchSettingsControllerArguments { let updatePreset: (String, String) -> Void @@ -109,7 +110,7 @@ private func watchSettingsControllerEntries(presentationData: PresentationData, return entries } -public func watchSettingsController(context: AccountContextImpl) -> ViewController { +public func watchSettingsController(context: AccountContext) -> ViewController { var pushControllerImpl: ((ViewController) -> Void)? var presentControllerImpl: ((ViewController) -> Void)? diff --git a/submodules/TelegramUI/TelegramUI/WebEmbedVideoContent.swift b/submodules/TelegramUI/TelegramUI/WebEmbedVideoContent.swift index 226f4c5f93..2eb83c3fb3 100644 --- a/submodules/TelegramUI/TelegramUI/WebEmbedVideoContent.swift +++ b/submodules/TelegramUI/TelegramUI/WebEmbedVideoContent.swift @@ -8,6 +8,7 @@ import TelegramCore import TelegramAudio import UniversalMediaPlayer import LegacyComponents +import AccountContext final class WebEmbedVideoContent: UniversalVideoContent { let id: AnyHashable diff --git a/submodules/TelegramUI/TelegramUI/WebSearchController.swift b/submodules/TelegramUI/TelegramUI/WebSearchController.swift index 04f542c576..32f5ca9b46 100644 --- a/submodules/TelegramUI/TelegramUI/WebSearchController.swift +++ b/submodules/TelegramUI/TelegramUI/WebSearchController.swift @@ -7,6 +7,7 @@ import AsyncDisplayKit import TelegramCore import LegacyComponents import TelegramUIPreferences +import AccountContext func requestContextResults(account: Account, botId: PeerId, query: String, peerId: PeerId, offset: String = "", existingResults: ChatContextResultCollection? = nil, limit: Int = 60) -> Signal { return requestChatContextResults(account: account, botId: botId, peerId: peerId, query: query, offset: offset) @@ -105,7 +106,7 @@ private func selectionChangedSignal(selectionState: TGMediaSelectionContext) -> final class WebSearchController: ViewController { private var validLayout: ContainerViewLayout? - private let context: AccountContextImpl + private let context: AccountContext private let mode: WebSearchControllerMode private let peer: Peer? private let configuration: SearchBotsConfiguration @@ -131,7 +132,7 @@ final class WebSearchController: ViewController { private var navigationContentNode: WebSearchNavigationContentNode? - init(context: AccountContextImpl, peer: Peer?, configuration: SearchBotsConfiguration, mode: WebSearchControllerMode) { + init(context: AccountContext, peer: Peer?, configuration: SearchBotsConfiguration, mode: WebSearchControllerMode) { self.context = context self.mode = mode self.peer = peer diff --git a/submodules/TelegramUI/TelegramUI/WebSearchControllerNode.swift b/submodules/TelegramUI/TelegramUI/WebSearchControllerNode.swift index fcc329fc11..f84d5b2caf 100644 --- a/submodules/TelegramUI/TelegramUI/WebSearchControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/WebSearchControllerNode.swift @@ -9,6 +9,7 @@ import LegacyComponents import TelegramPresentationData import TelegramUIPreferences import MergeLists +import AccountContext private struct WebSearchContextResultStableId: Hashable { let result: ChatContextResult @@ -120,7 +121,7 @@ private func preparedWebSearchRecentTransition(from fromEntries: [WebSearchRecen } class WebSearchControllerNode: ASDisplayNode { - private let context: AccountContextImpl + private let context: AccountContext private let peer: Peer? private var theme: PresentationTheme private var strings: PresentationStrings @@ -172,7 +173,7 @@ class WebSearchControllerNode: ASDisplayNode { var cancel: (() -> Void)? var dismissInput: (() -> Void)? - init(context: AccountContextImpl, theme: PresentationTheme, strings: PresentationStrings, controllerInteraction: WebSearchControllerInteraction, peer: Peer?, mode: WebSearchMode) { + init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, controllerInteraction: WebSearchControllerInteraction, peer: Peer?, mode: WebSearchMode) { self.context = context self.theme = theme self.strings = strings diff --git a/submodules/TelegramUI/TelegramUI/WebSearchGalleryController.swift b/submodules/TelegramUI/TelegramUI/WebSearchGalleryController.swift index 9df6618da0..5a71aa03b7 100644 --- a/submodules/TelegramUI/TelegramUI/WebSearchGalleryController.swift +++ b/submodules/TelegramUI/TelegramUI/WebSearchGalleryController.swift @@ -8,6 +8,7 @@ import AsyncDisplayKit import TelegramCore import LegacyComponents import TelegramPresentationData +import AccountContext final class WebSearchGalleryControllerInteraction { let dismiss: (Bool) -> Void @@ -30,7 +31,7 @@ struct WebSearchGalleryEntry: Equatable { return lhs.result == rhs.result } - func item(context: AccountContextImpl, presentationData: PresentationData, controllerInteraction: WebSearchGalleryControllerInteraction?) -> GalleryItem { + func item(context: AccountContext, presentationData: PresentationData, controllerInteraction: WebSearchGalleryControllerInteraction?) -> GalleryItem { switch self.result { case let .externalReference(_, _, type, _, _, _, content, thumbnail, _): if let content = content, type == "gif", let thumbnailResource = thumbnail?.resource, let dimensions = content.dimensions { @@ -63,7 +64,7 @@ class WebSearchGalleryController: ViewController { return self.displayNode as! GalleryControllerNode } - private let context: AccountContextImpl + private let context: AccountContext private var presentationData: PresentationData private var controllerInteraction: WebSearchGalleryControllerInteraction? @@ -95,7 +96,7 @@ class WebSearchGalleryController: ViewController { private let replaceRootController: (ViewController, ValuePromise?) -> Void private let baseNavigationController: NavigationController? - init(context: AccountContextImpl, peer: Peer?, selectionState: TGMediaSelectionContext?, editingState: TGMediaEditingContext, entries: [WebSearchGalleryEntry], centralIndex: Int, replaceRootController: @escaping (ViewController, ValuePromise?) -> Void, baseNavigationController: NavigationController?, sendCurrent: @escaping (ChatContextResult) -> Void) { + init(context: AccountContext, peer: Peer?, selectionState: TGMediaSelectionContext?, editingState: TGMediaEditingContext, entries: [WebSearchGalleryEntry], centralIndex: Int, replaceRootController: @escaping (ViewController, ValuePromise?) -> Void, baseNavigationController: NavigationController?, sendCurrent: @escaping (ChatContextResult) -> Void) { self.context = context self.replaceRootController = replaceRootController self.baseNavigationController = baseNavigationController diff --git a/submodules/TelegramUI/TelegramUI/WebSearchGalleryFooterContentNode.swift b/submodules/TelegramUI/TelegramUI/WebSearchGalleryFooterContentNode.swift index fa72dff4b9..2537b2658f 100644 --- a/submodules/TelegramUI/TelegramUI/WebSearchGalleryFooterContentNode.swift +++ b/submodules/TelegramUI/TelegramUI/WebSearchGalleryFooterContentNode.swift @@ -7,9 +7,10 @@ import TelegramCore import SwiftSignalKit import LegacyComponents import TelegramPresentationData +import AccountContext final class WebSearchGalleryFooterContentNode: GalleryFooterContentNode { - private let context: AccountContextImpl + private let context: AccountContext private var theme: PresentationTheme private var strings: PresentationStrings @@ -19,7 +20,7 @@ final class WebSearchGalleryFooterContentNode: GalleryFooterContentNode { var cancel: (() -> Void)? var send: (() -> Void)? - init(context: AccountContextImpl, presentationData: PresentationData) { + init(context: AccountContext, presentationData: PresentationData) { self.context = context self.theme = presentationData.theme self.strings = presentationData.strings diff --git a/submodules/TelegramUI/TelegramUI/WebSearchVideoGalleryItem.swift b/submodules/TelegramUI/TelegramUI/WebSearchVideoGalleryItem.swift index 7dc44ab881..445d09105a 100644 --- a/submodules/TelegramUI/TelegramUI/WebSearchVideoGalleryItem.swift +++ b/submodules/TelegramUI/TelegramUI/WebSearchVideoGalleryItem.swift @@ -6,15 +6,16 @@ import TelegramCore import Display import Postbox import TelegramPresentationData +import AccountContext class WebSearchVideoGalleryItem: GalleryItem { - let context: AccountContextImpl + let context: AccountContext let presentationData: PresentationData let result: ChatContextResult let content: UniversalVideoContent let controllerInteraction: WebSearchGalleryControllerInteraction? - init(context: AccountContextImpl, presentationData: PresentationData, result: ChatContextResult, content: UniversalVideoContent, controllerInteraction: WebSearchGalleryControllerInteraction?) { + init(context: AccountContext, presentationData: PresentationData, result: ChatContextResult, content: UniversalVideoContent, controllerInteraction: WebSearchGalleryControllerInteraction?) { self.context = context self.presentationData = presentationData self.result = result @@ -45,7 +46,7 @@ private struct FetchControls { } final class WebSearchVideoGalleryItemNode: ZoomableContentGalleryItemNode { - private let context: AccountContextImpl + private let context: AccountContext private let strings: PresentationStrings private let controllerInteraction: WebSearchGalleryControllerInteraction? @@ -74,7 +75,7 @@ final class WebSearchVideoGalleryItemNode: ZoomableContentGalleryItemNode { var playbackCompleted: (() -> Void)? - init(context: AccountContextImpl, presentationData: PresentationData, controllerInteraction: WebSearchGalleryControllerInteraction?) { + init(context: AccountContext, presentationData: PresentationData, controllerInteraction: WebSearchGalleryControllerInteraction?) { self.context = context self.strings = presentationData.strings self.controllerInteraction = controllerInteraction diff --git a/submodules/TelegramUI/TelegramUI/WebpagePreviewAccessoryPanelNode.swift b/submodules/TelegramUI/TelegramUI/WebpagePreviewAccessoryPanelNode.swift index adc5064e6c..7a6d1c6272 100644 --- a/submodules/TelegramUI/TelegramUI/WebpagePreviewAccessoryPanelNode.swift +++ b/submodules/TelegramUI/TelegramUI/WebpagePreviewAccessoryPanelNode.swift @@ -6,6 +6,7 @@ import Postbox import SwiftSignalKit import Display import TelegramPresentationData +import AccountContext final class WebpagePreviewAccessoryPanelNode: AccessoryPanelNode { private let webpageDisposable = MetaDisposable() @@ -24,7 +25,7 @@ final class WebpagePreviewAccessoryPanelNode: AccessoryPanelNode { var theme: PresentationTheme var strings: PresentationStrings - init(context: AccountContextImpl, url: String, webpage: TelegramMediaWebpage, theme: PresentationTheme, strings: PresentationStrings) { + init(context: AccountContext, url: String, webpage: TelegramMediaWebpage, theme: PresentationTheme, strings: PresentationStrings) { self.url = url self.webpage = webpage self.theme = theme diff --git a/submodules/TelegramUI/TelegramUI_Xcode.xcodeproj/project.pbxproj b/submodules/TelegramUI/TelegramUI_Xcode.xcodeproj/project.pbxproj index 124e7aa8f1..ba9a408703 100644 --- a/submodules/TelegramUI/TelegramUI_Xcode.xcodeproj/project.pbxproj +++ b/submodules/TelegramUI/TelegramUI_Xcode.xcodeproj/project.pbxproj @@ -113,7 +113,6 @@ 09B4EE5E21AC626B00847FA6 /* PermissionContentNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09B4EE5D21AC626B00847FA6 /* PermissionContentNode.swift */; }; 09B4EE6021AD4A0E00847FA6 /* InstantPageContentNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09B4EE5F21AD4A0E00847FA6 /* InstantPageContentNode.swift */; }; 09B4EE6221AD791600847FA6 /* InstantPageStoredState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09B4EE6121AD791600847FA6 /* InstantPageStoredState.swift */; }; - 09C3466D2167D63A00B76780 /* Accessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09C3466C2167D63A00B76780 /* Accessibility.swift */; }; 09C500242142BA6400EF253E /* ItemListWebsiteItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09C500232142BA6400EF253E /* ItemListWebsiteItem.swift */; }; 09C9EA3821A044B500E90146 /* StringForDuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09C9EA3721A044B500E90146 /* StringForDuration.swift */; }; 09CE95002232729A00A7D2C3 /* StickerPaneSearchContentNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09CE94FF2232729A00A7D2C3 /* StickerPaneSearchContentNode.swift */; }; @@ -247,7 +246,6 @@ D00818CD22B595CB008A895F /* LightweightAccountData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D00818CC22B595CB008A895F /* LightweightAccountData.framework */; }; D00ACA4B20222C280045D427 /* libtgvoip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D00ACA4C20222C280045D427 /* libtgvoip.framework */; }; D00ACA5A2022897D0045D427 /* ProcessedPeerRestrictionText.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00ACA592022897D0045D427 /* ProcessedPeerRestrictionText.swift */; }; - D00ADFDD1EBB73C200873D2E /* OverlayMediaManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00ADFDC1EBB73C200873D2E /* OverlayMediaManager.swift */; }; D00BDA1F1EE5B69200C64C5E /* ChannelAdminController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00BDA1E1EE5B69200C64C5E /* ChannelAdminController.swift */; }; D00BED201F73F60F00922292 /* ShareSearchContainerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00BED1F1F73F60F00922292 /* ShareSearchContainerNode.swift */; }; D00BED221F73F82400922292 /* SharePeersContainerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00BED211F73F82400922292 /* SharePeersContainerNode.swift */; }; @@ -293,7 +291,6 @@ D0185E8A208A01AF005E1A6C /* ProxySettingsActionItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0185E89208A01AF005E1A6C /* ProxySettingsActionItem.swift */; }; D0185E8C208A025A005E1A6C /* ProxySettingsServerItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0185E8B208A025A005E1A6C /* ProxySettingsServerItem.swift */; }; D018BE58218C7BD800C02DDC /* ChatMessageDeliveryFailedNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D018BE57218C7BD800C02DDC /* ChatMessageDeliveryFailedNode.swift */; }; - D0192D3C210A44D00005FA10 /* DeviceContactData.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0192D3B210A44D00005FA10 /* DeviceContactData.swift */; }; D0192D44210A5AA50005FA10 /* DeviceContactDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0192D43210A5AA50005FA10 /* DeviceContactDataManager.swift */; }; D0192D46210F4F950005FA10 /* FixSearchableListNodeScrolling.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0192D45210F4F940005FA10 /* FixSearchableListNodeScrolling.swift */; }; D01A21AF1F39EA2E00DDA104 /* InstantPageTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = D01A21AE1F39EA2E00DDA104 /* InstantPageTheme.swift */; }; @@ -319,7 +316,7 @@ D0208AD91FA34017001F0D5F /* DeviceProximityManager.h in Headers */ = {isa = PBXBuildFile; fileRef = D0208AD71FA34017001F0D5F /* DeviceProximityManager.h */; }; D0208ADA1FA34017001F0D5F /* DeviceProximityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D0208AD81FA34017001F0D5F /* DeviceProximityManager.m */; }; D0208ADC1FA346A4001F0D5F /* RaiseToListen.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0208ADB1FA346A4001F0D5F /* RaiseToListen.swift */; }; - D020A9DA1FEAE675008C66F7 /* OverlayPlayerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D020A9D91FEAE675008C66F7 /* OverlayPlayerController.swift */; }; + D020A9DA1FEAE675008C66F7 /* OverlayAudioPlayerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D020A9D91FEAE675008C66F7 /* OverlayAudioPlayerController.swift */; }; D020A9DC1FEAE6E7008C66F7 /* OverlayPlayerControllerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D020A9DB1FEAE6E7008C66F7 /* OverlayPlayerControllerNode.swift */; }; D025402322E1C92D00AC0195 /* ChatSlowmodeItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D025402222E1C92D00AC0195 /* ChatSlowmodeItem.swift */; }; D025402522E1E00100AC0195 /* ChatSlowmodeHintController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D025402422E1E00100AC0195 /* ChatSlowmodeHintController.swift */; }; @@ -366,11 +363,7 @@ D0430B001FF4570500A35ADD /* WebController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0430AFF1FF4570500A35ADD /* WebController.swift */; }; D0430B021FF4584100A35ADD /* WebControllerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0430B011FF4584100A35ADD /* WebControllerNode.swift */; }; D0439B5B228EC4A00067E026 /* ChatMessagePhoneNumberRequestContentNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0439B5A228EC4A00067E026 /* ChatMessagePhoneNumberRequestContentNode.swift */; }; - D044A0FB20BDC40C00326FAC /* CachedChannelAdmins.swift in Sources */ = {isa = PBXBuildFile; fileRef = D044A0FA20BDC40C00326FAC /* CachedChannelAdmins.swift */; }; D04554A421B42982007A6DD9 /* ConfirmPhoneNumberController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D04554A321B42982007A6DD9 /* ConfirmPhoneNumberController.swift */; }; - D046142E2004DB3700EC0EF2 /* LiveLocationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D046142D2004DB3700EC0EF2 /* LiveLocationManager.swift */; }; - D04614372005094E00EC0EF2 /* DeviceLocationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D04614362005094E00EC0EF2 /* DeviceLocationManager.swift */; }; - D0461439200514F000EC0EF2 /* LiveLocationSummaryManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0461438200514F000EC0EF2 /* LiveLocationSummaryManager.swift */; }; D0471B491EFD59170074D609 /* BotCheckoutControllerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0471B481EFD59170074D609 /* BotCheckoutControllerNode.swift */; }; D0471B4B1EFD64AC0074D609 /* BotCheckoutHeaderItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0471B4A1EFD64AC0074D609 /* BotCheckoutHeaderItem.swift */; }; D0471B4F1EFD84600074D609 /* BotCheckoutPriceItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0471B4E1EFD84600074D609 /* BotCheckoutPriceItem.swift */; }; @@ -384,7 +377,6 @@ D0471B601EFEB5A70074D609 /* BotPaymentTextItemNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0471B5F1EFEB5A70074D609 /* BotPaymentTextItemNode.swift */; }; D0471B621EFEB5B70074D609 /* BotPaymentSwitchItemNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0471B611EFEB5B70074D609 /* BotPaymentSwitchItemNode.swift */; }; D0471B641EFEB5CB0074D609 /* BotPaymentItemNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0471B631EFEB5CB0074D609 /* BotPaymentItemNode.swift */; }; - D0477D1B1F617E5800412B44 /* UniversalVideoNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0477D1A1F617E5800412B44 /* UniversalVideoNode.swift */; }; D0477D1D1F617E8900412B44 /* NativeVideoContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0477D1C1F617E8900412B44 /* NativeVideoContent.swift */; }; D0477D1F1F619E0700412B44 /* GalleryVideoDecoration.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0477D1E1F619E0700412B44 /* GalleryVideoDecoration.swift */; }; D0477D211F61A47600412B44 /* UniversalVideoContentManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0477D201F61A47600412B44 /* UniversalVideoContentManager.swift */; }; @@ -395,7 +387,6 @@ D048EA8B1F4F298A00188713 /* InstantPageSettingsThemeItemNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D048EA8A1F4F298A00188713 /* InstantPageSettingsThemeItemNode.swift */; }; D048EA8D1F4F299A00188713 /* InstantPageSettingsSwitchItemNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D048EA8C1F4F299A00188713 /* InstantPageSettingsSwitchItemNode.swift */; }; D048EA8F1F4F2A9C00188713 /* InstantPageSettingsItemNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D048EA8E1F4F2A9C00188713 /* InstantPageSettingsItemNode.swift */; }; - D04B26EC20082EB50053A58C /* LocationBroadcastPanelWavesNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D04B26EB20082EB50053A58C /* LocationBroadcastPanelWavesNode.swift */; }; D04B4D111EEA04D400711AF6 /* MapResources.swift in Sources */ = {isa = PBXBuildFile; fileRef = D04B4D101EEA04D400711AF6 /* MapResources.swift */; }; D04B4D131EEA0A6500711AF6 /* ChatMessageMapBubbleContentNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D04B4D121EEA0A6500711AF6 /* ChatMessageMapBubbleContentNode.swift */; }; D04B4D661EEA993A00711AF6 /* LegacyLocationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D04B4D651EEA993A00711AF6 /* LegacyLocationController.swift */; }; @@ -476,6 +467,14 @@ D083491C209361DC008CFD52 /* AvatarGalleryItemFooterContentNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D083491B209361DC008CFD52 /* AvatarGalleryItemFooterContentNode.swift */; }; D084023420E295F000065674 /* GroupStickerPackSetupController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D084023320E295F000065674 /* GroupStickerPackSetupController.swift */; }; D08557E722C5FEB90026D6D2 /* AnimatedStickerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08557E622C5FEB90026D6D2 /* AnimatedStickerNode.swift */; }; + D08799F022F649A600C4D6B3 /* TelegramBaseController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D08799EF22F649A600C4D6B3 /* TelegramBaseController.framework */; }; + D0879A0D22F64E4C00C4D6B3 /* DeviceLocationManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879A0C22F64E4C00C4D6B3 /* DeviceLocationManager.framework */; }; + D0879B1F22F7189600C4D6B3 /* AvatarNode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B1E22F7189600C4D6B3 /* AvatarNode.framework */; }; + D0879B2122F7189B00C4D6B3 /* OverlayStatusController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B2022F7189B00C4D6B3 /* OverlayStatusController.framework */; }; + D0879B2322F718AA00C4D6B3 /* TelegramStringFormatting.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B2222F718AA00C4D6B3 /* TelegramStringFormatting.framework */; }; + D0879B2522F7198400C4D6B3 /* LiveLocationManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B2422F7198400C4D6B3 /* LiveLocationManager.framework */; }; + D0879B2722F7198900C4D6B3 /* LiveLocationTimerNode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B2622F7198900C4D6B3 /* LiveLocationTimerNode.framework */; }; + D0879B5B22F79EEF00C4D6B3 /* TemporaryCachedPeerDataManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B5A22F79EEF00C4D6B3 /* TemporaryCachedPeerDataManager.framework */; }; D087BFAD1F741B9D003FD209 /* ShareContentContainerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D087BFAC1F741B9D003FD209 /* ShareContentContainerNode.swift */; }; D087BFAF1F741BB7003FD209 /* ShareLoadingContainerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D087BFAE1F741BB7003FD209 /* ShareLoadingContainerNode.swift */; }; D087BFB11F745483003FD209 /* ShareSearchBarNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D087BFB01F745483003FD209 /* ShareSearchBarNode.swift */; }; @@ -489,7 +488,6 @@ D091C7A41F8EBB1E00D7DE13 /* ChatPresentationData.swift in Sources */ = {isa = PBXBuildFile; fileRef = D091C7A31F8EBB1E00D7DE13 /* ChatPresentationData.swift */; }; D091C7A61F8ECEA300D7DE13 /* SettingsThemeWallpaperNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D091C7A51F8ECEA300D7DE13 /* SettingsThemeWallpaperNode.swift */; }; D09250061FE5371D003F693F /* GlobalExperimentalSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09250051FE5371D003F693F /* GlobalExperimentalSettings.swift */; }; - D09394132007F5BB00997F31 /* LocationBroadcastNavigationAccessoryPanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09394122007F5BB00997F31 /* LocationBroadcastNavigationAccessoryPanel.swift */; }; D093D7D92062A9CA00BC3599 /* SecureIdAuthControllerState.swift in Sources */ = {isa = PBXBuildFile; fileRef = D093D7D82062A9CA00BC3599 /* SecureIdAuthControllerState.swift */; }; D093D7DB2062CFF500BC3599 /* SecureIdAuthFormContentNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D093D7DA2062CFF500BC3599 /* SecureIdAuthFormContentNode.swift */; }; D093D7DD2062D09A00BC3599 /* SecureIdAuthFormFieldNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D093D7DC2062D09A00BC3599 /* SecureIdAuthFormFieldNode.swift */; }; @@ -509,7 +507,6 @@ D0943B071FDEC529001522CC /* InstantVideoRadialStatusNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0943B061FDEC528001522CC /* InstantVideoRadialStatusNode.swift */; }; D0955FB521912B6000F89427 /* PresentationStrings.mapping in Resources */ = {isa = PBXBuildFile; fileRef = D0955FB32191278C00F89427 /* PresentationStrings.mapping */; }; D097C26820DD0A1D007BB4B8 /* PeerReportController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D097C26720DD0A1D007BB4B8 /* PeerReportController.swift */; }; - D097C26C20DD1EA5007BB4B8 /* OverlayStatusController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D097C26B20DD1EA5007BB4B8 /* OverlayStatusController.swift */; }; D099D74D1EEFEE1500A3128C /* GameController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D099D74C1EEFEE1500A3128C /* GameController.swift */; }; D099D74F1EEFEE6A00A3128C /* GameControllerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D099D74E1EEFEE6A00A3128C /* GameControllerNode.swift */; }; D099D7511EEFF91E00A3128C /* GameControllerTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D099D7501EEFF91E00A3128C /* GameControllerTitleView.swift */; }; @@ -534,7 +531,6 @@ D0AB269E21D56A12008F6685 /* ChannelPermissionsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0AB269D21D56A12008F6685 /* ChannelPermissionsController.swift */; }; D0ACCB1A1EC5E0C20079D8BF /* CallControllerKeyPreviewNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0ACCB191EC5E0C20079D8BF /* CallControllerKeyPreviewNode.swift */; }; D0ACCB1C1EC5FF4B0079D8BF /* ChatMessageCallBubbleContentNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0ACCB1B1EC5FF4B0079D8BF /* ChatMessageCallBubbleContentNode.swift */; }; - D0AD02E81FFFDE5F00C1DCFF /* ChatMessageLiveLocationTimerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0AD02E71FFFDE5F00C1DCFF /* ChatMessageLiveLocationTimerNode.swift */; }; D0AD02EA1FFFEBEF00C1DCFF /* ChatMessageLiveLocationTextNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0AD02E91FFFEBEF00C1DCFF /* ChatMessageLiveLocationTextNode.swift */; }; D0AD02EC20000D0100C1DCFF /* ChatMessageLiveLocationPositionNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0AD02EB20000D0100C1DCFF /* ChatMessageLiveLocationPositionNode.swift */; }; D0ADF966212E05A300310BBC /* TonePlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0ADF965212E05A300310BBC /* TonePlayer.swift */; }; @@ -615,7 +611,6 @@ D0BCC3D420404CC7008126C2 /* ChatMessageActionSheetController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BCC3D320404CC7008126C2 /* ChatMessageActionSheetController.swift */; }; D0BCC3D620404CD8008126C2 /* ChatMessageActionSheetControllerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BCC3D520404CD8008126C2 /* ChatMessageActionSheetControllerNode.swift */; }; D0BDB09B1F79C658002ABF2F /* SaveToCameraRoll.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BDB09A1F79C658002ABF2F /* SaveToCameraRoll.swift */; }; - D0BE303220601FFC00FBE6D8 /* LocationBroadcastActionSheetItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BE303120601FFC00FBE6D8 /* LocationBroadcastActionSheetItem.swift */; }; D0BE3037206139F500FBE6D8 /* ImageCompression.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BE3036206139F500FBE6D8 /* ImageCompression.swift */; }; D0BE30412061B80100FBE6D8 /* SecureIdAuthController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BE30402061B80100FBE6D8 /* SecureIdAuthController.swift */; }; D0BE30432061B80B00FBE6D8 /* SecureIdAuthControllerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BE30422061B80B00FBE6D8 /* SecureIdAuthControllerNode.swift */; }; @@ -633,14 +628,11 @@ D0C12A1D1F33A85600B3F66D /* ChatWallpaperBuiltin0.jpg in Resources */ = {isa = PBXBuildFile; fileRef = D0C12A1B1F33964900B3F66D /* ChatWallpaperBuiltin0.jpg */; }; D0C12EB01F9A8D1300600BB2 /* ListMessageDateHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C12EAF1F9A8D1300600BB2 /* ListMessageDateHeader.swift */; }; D0C26D571FDF2388004ABF18 /* OpenChatMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C26D561FDF2388004ABF18 /* OpenChatMessage.swift */; }; - D0C26D5E1FDF49E7004ABF18 /* DateFormat.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C26D5D1FDF49E7004ABF18 /* DateFormat.swift */; }; D0C27B3B1F4B453700A4E170 /* InstantPagePlayableVideoItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C27B3A1F4B453700A4E170 /* InstantPagePlayableVideoItem.swift */; }; D0C27B3D1F4B454800A4E170 /* InstantPagePlayableVideoNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C27B3C1F4B454800A4E170 /* InstantPagePlayableVideoNode.swift */; }; D0C44B641FC64D0500227BE0 /* SwipeToDismissGestureRecognizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C44B631FC64D0500227BE0 /* SwipeToDismissGestureRecognizer.swift */; }; D0C45E9F213FFAFD00988156 /* Lottie.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0C45E9E213FFAFD00988156 /* Lottie.framework */; }; D0C683FC21AD797F00A6CAD5 /* ChatListSelection.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C683FB21AD797F00A6CAD5 /* ChatListSelection.swift */; }; - D0CAD8FB20AE1D1B00ACD96E /* ChannelMemberCategoryListContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0CAD8FA20AE1D1B00ACD96E /* ChannelMemberCategoryListContext.swift */; }; - D0CAD8FD20AE467D00ACD96E /* PeerChannelMemberCategoriesContextsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0CAD8FC20AE467D00ACD96E /* PeerChannelMemberCategoriesContextsManager.swift */; }; D0CAD90120AEECAC00ACD96E /* ChatEditInterfaceMessageState.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0CAD90020AEECAC00ACD96E /* ChatEditInterfaceMessageState.swift */; }; D0CB27CF20C17A4A001ACF93 /* TermsOfServiceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0CB27CE20C17A4A001ACF93 /* TermsOfServiceController.swift */; }; D0CB27D220C17A7F001ACF93 /* TermsOfServiceControllerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0CB27D120C17A7F001ACF93 /* TermsOfServiceControllerNode.swift */; }; @@ -820,7 +812,6 @@ D0EC6CC31EB9F58800EBF1C3 /* LegacyNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D023ED311DDB60CF00BD496D /* LegacyNavigationController.swift */; }; D0EC6CC41EB9F58800EBF1C3 /* LegacyLocationPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0EFD8951DDE8249009E508A /* LegacyLocationPicker.swift */; }; D0EC6CC51EB9F58800EBF1C3 /* TGDataItem.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D03B221DECB1AD00220C46 /* TGDataItem.m */; }; - D0EC6CC61EB9F58800EBF1C3 /* PresenceStrings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0B844551DAC3AEE005F29E1 /* PresenceStrings.swift */; }; D0EC6CC71EB9F58800EBF1C3 /* PeerNotificationSoundStrings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08775081E3E59DE00A97350 /* PeerNotificationSoundStrings.swift */; }; D0EC6CC81EB9F58800EBF1C3 /* ProgressiveImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69E931D6B8C9B0046BCD6 /* ProgressiveImage.swift */; }; D0EC6CC91EB9F58800EBF1C3 /* WebP.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69E941D6B8C9B0046BCD6 /* WebP.swift */; }; @@ -853,7 +844,6 @@ D0EC6D0A1EB9F58800EBF1C3 /* internal.c in Sources */ = {isa = PBXBuildFile; fileRef = D0D03B031DECB0FE00220C46 /* internal.c */; }; D0EC6D0B1EB9F58800EBF1C3 /* opusfile.c in Sources */ = {isa = PBXBuildFile; fileRef = D0D03B051DECB0FE00220C46 /* opusfile.c */; }; D0EC6D0C1EB9F58800EBF1C3 /* stream.c in Sources */ = {isa = PBXBuildFile; fileRef = D0D03B071DECB0FE00220C46 /* stream.c */; }; - D0EC6D201EB9F58800EBF1C3 /* PeerAvatar.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69CDE1D6B87D30046BCD6 /* PeerAvatar.swift */; }; D0EC6D221EB9F58800EBF1C3 /* PhotoResources.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69E9F1D6B8E380046BCD6 /* PhotoResources.swift */; }; D0EC6D231EB9F58800EBF1C3 /* StickerResources.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69EA01D6B8E380046BCD6 /* StickerResources.swift */; }; D0EC6D251EB9F58800EBF1C3 /* FetchCachedRepresentations.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06879561DB8F22200424BBD /* FetchCachedRepresentations.swift */; }; @@ -869,7 +859,6 @@ D0EC6D311EB9F58800EBF1C3 /* RadialTimeoutNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00C7CE51E378FD00080C3D5 /* RadialTimeoutNode.swift */; }; D0EC6D321EB9F58800EBF1C3 /* TextNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69DC21D6B89DA0046BCD6 /* TextNode.swift */; }; D0EC6D331EB9F58800EBF1C3 /* ListSectionHeaderNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69DC01D6B89D30046BCD6 /* ListSectionHeaderNode.swift */; }; - D0EC6D341EB9F58800EBF1C3 /* AvatarNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69DF71D6B8A880046BCD6 /* AvatarNode.swift */; }; D0EC6D351EB9F58800EBF1C3 /* SearchBarNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69DCB1D6B8A0D0046BCD6 /* SearchBarNode.swift */; }; D0EC6D361EB9F58800EBF1C3 /* SearchBarPlaceholderNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69DCC1D6B8A0D0046BCD6 /* SearchBarPlaceholderNode.swift */; }; D0EC6D371EB9F58800EBF1C3 /* SearchDisplayController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69DCD1D6B8A0D0046BCD6 /* SearchDisplayController.swift */; }; @@ -877,10 +866,6 @@ D0EC6D3A1EB9F58800EBF1C3 /* AudioWaveformNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0568AAC1DF198130022E7DA /* AudioWaveformNode.swift */; }; D0EC6D3B1EB9F58800EBF1C3 /* EditableTokenListNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BC38621E3F9EFA0044D6FE /* EditableTokenListNode.swift */; }; D0EC6D3C1EB9F58800EBF1C3 /* PhoneInputNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D050F2121E48B61500988324 /* PhoneInputNode.swift */; }; - D0EC6D3E1EB9F58800EBF1C3 /* TelegramController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0736F241DF4D0E500F2C02A /* TelegramController.swift */; }; - D0EC6D3F1EB9F58800EBF1C3 /* MediaNavigationAccessoryPanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0736F291DF4D5FF00F2C02A /* MediaNavigationAccessoryPanel.swift */; }; - D0EC6D401EB9F58800EBF1C3 /* MediaNavigationAccessoryContainerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0736F2B1DF4DC2400F2C02A /* MediaNavigationAccessoryContainerNode.swift */; }; - D0EC6D411EB9F58800EBF1C3 /* MediaNavigationAccessoryHeaderNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0736F2D1DF4E54A00F2C02A /* MediaNavigationAccessoryHeaderNode.swift */; }; D0EC6D4B1EB9F58800EBF1C3 /* ChatListNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D07CFF781DCA226F00761F81 /* ChatListNode.swift */; }; D0EC6D4D1EB9F58800EBF1C3 /* ChatListHoleItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69DFB1D6B8A880046BCD6 /* ChatListHoleItem.swift */; }; D0EC6D4E1EB9F58800EBF1C3 /* ChatListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69DFC1D6B8A880046BCD6 /* ChatListItem.swift */; }; @@ -1184,7 +1169,6 @@ D0F760DD222034980074F7E5 /* ChannelStatsControllerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F760DC222034980074F7E5 /* ChannelStatsControllerNode.swift */; }; D0F9720F1FFE4BD5002595C8 /* notification.caf in Resources */ = {isa = PBXBuildFile; fileRef = D0C50E431E93FCD200F62E39 /* notification.caf */; }; D0F972101FFE4BD5002595C8 /* MessageSent.caf in Resources */ = {isa = PBXBuildFile; fileRef = D073CE621DCBBE5D007511FD /* MessageSent.caf */; }; - D0FA08BE20481EA300DD23FC /* Locale.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0FA08BD20481EA300DD23FC /* Locale.swift */; }; D0FA08C020483F9600DD23FC /* ExtractVideoData.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0FA08BF20483F9600DD23FC /* ExtractVideoData.swift */; }; D0FA08C8204982DC00DD23FC /* ChatTextInputActionButtonsNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0FA08C7204982DC00DD23FC /* ChatTextInputActionButtonsNode.swift */; }; D0FA08CA2049BEAC00DD23FC /* ChatEmptyNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0FA08C92049BEAC00DD23FC /* ChatEmptyNode.swift */; }; @@ -1196,7 +1180,6 @@ D0FC4FBB1F751E8900B7443F /* SelectablePeerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0FC4FBA1F751E8900B7443F /* SelectablePeerNode.swift */; }; D0FE4DDC1F09AD0400E8A0B3 /* PresentationSurfaceLevels.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0FE4DDB1F09AD0400E8A0B3 /* PresentationSurfaceLevels.swift */; }; D0FE4DE41F0AEBB900E8A0B3 /* SharedVideoContextManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0FE4DE31F0AEBB900E8A0B3 /* SharedVideoContextManager.swift */; }; - D0FE4DE61F0BA58A00E8A0B3 /* OverlayMediaItemNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0FE4DE51F0BA58A00E8A0B3 /* OverlayMediaItemNode.swift */; }; D0FFF7F61F55B82500BEBC01 /* InstantPageAudioItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0FFF7F51F55B82500BEBC01 /* InstantPageAudioItem.swift */; }; D0FFF7F81F55B83600BEBC01 /* InstantPageAudioNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0FFF7F71F55B83600BEBC01 /* InstantPageAudioNode.swift */; }; /* End PBXBuildFile section */ @@ -1307,7 +1290,6 @@ 09B4EE5D21AC626B00847FA6 /* PermissionContentNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermissionContentNode.swift; sourceTree = ""; }; 09B4EE5F21AD4A0E00847FA6 /* InstantPageContentNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstantPageContentNode.swift; sourceTree = ""; }; 09B4EE6121AD791600847FA6 /* InstantPageStoredState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstantPageStoredState.swift; sourceTree = ""; }; - 09C3466C2167D63A00B76780 /* Accessibility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Accessibility.swift; sourceTree = ""; }; 09C500232142BA6400EF253E /* ItemListWebsiteItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemListWebsiteItem.swift; sourceTree = ""; }; 09C9EA3721A044B500E90146 /* StringForDuration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StringForDuration.swift; sourceTree = ""; }; 09CE94FF2232729A00A7D2C3 /* StickerPaneSearchContentNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerPaneSearchContentNode.swift; sourceTree = ""; }; @@ -1448,7 +1430,6 @@ D00818CC22B595CB008A895F /* LightweightAccountData.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = LightweightAccountData.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D00ACA4C20222C280045D427 /* libtgvoip.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = libtgvoip.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D00ACA592022897D0045D427 /* ProcessedPeerRestrictionText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProcessedPeerRestrictionText.swift; sourceTree = ""; }; - D00ADFDC1EBB73C200873D2E /* OverlayMediaManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OverlayMediaManager.swift; sourceTree = ""; }; D00B3F9D1E3A4847003872C3 /* ItemListSectionHeaderItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemListSectionHeaderItem.swift; sourceTree = ""; }; D00BDA1E1EE5B69200C64C5E /* ChannelAdminController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChannelAdminController.swift; sourceTree = ""; }; D00BED1F1F73F60F00922292 /* ShareSearchContainerNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareSearchContainerNode.swift; sourceTree = ""; }; @@ -1518,7 +1499,6 @@ D018BE57218C7BD800C02DDC /* ChatMessageDeliveryFailedNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatMessageDeliveryFailedNode.swift; sourceTree = ""; }; D018D3311E6460B300C5E089 /* ChatUnblockInputPanelNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatUnblockInputPanelNode.swift; sourceTree = ""; }; D018D3341E6489EC00C5E089 /* CreateChannelController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateChannelController.swift; sourceTree = ""; }; - D0192D3B210A44D00005FA10 /* DeviceContactData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceContactData.swift; sourceTree = ""; }; D0192D43210A5AA50005FA10 /* DeviceContactDataManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceContactDataManager.swift; sourceTree = ""; }; D0192D45210F4F940005FA10 /* FixSearchableListNodeScrolling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FixSearchableListNodeScrolling.swift; sourceTree = ""; }; D01A21AE1F39EA2E00DDA104 /* InstantPageTheme.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InstantPageTheme.swift; sourceTree = ""; }; @@ -1552,7 +1532,7 @@ D0208AD71FA34017001F0D5F /* DeviceProximityManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeviceProximityManager.h; sourceTree = ""; }; D0208AD81FA34017001F0D5F /* DeviceProximityManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DeviceProximityManager.m; sourceTree = ""; }; D0208ADB1FA346A4001F0D5F /* RaiseToListen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RaiseToListen.swift; sourceTree = ""; }; - D020A9D91FEAE675008C66F7 /* OverlayPlayerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OverlayPlayerController.swift; sourceTree = ""; }; + D020A9D91FEAE675008C66F7 /* OverlayAudioPlayerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OverlayAudioPlayerController.swift; sourceTree = ""; }; D020A9DB1FEAE6E7008C66F7 /* OverlayPlayerControllerNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OverlayPlayerControllerNode.swift; sourceTree = ""; }; D0215D371E040F53001A0B1E /* InstantPageNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InstantPageNode.swift; sourceTree = ""; }; D0215D391E041003001A0B1E /* InstantPageLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InstantPageLayout.swift; sourceTree = ""; }; @@ -1652,12 +1632,8 @@ D0430AFF1FF4570500A35ADD /* WebController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebController.swift; sourceTree = ""; }; D0430B011FF4584100A35ADD /* WebControllerNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebControllerNode.swift; sourceTree = ""; }; D0439B5A228EC4A00067E026 /* ChatMessagePhoneNumberRequestContentNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatMessagePhoneNumberRequestContentNode.swift; sourceTree = ""; }; - D044A0FA20BDC40C00326FAC /* CachedChannelAdmins.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CachedChannelAdmins.swift; sourceTree = ""; }; D045549921B2F173007A6DD9 /* libturbojpeg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libturbojpeg.a; path = "third-party/libjpeg-turbo/libturbojpeg.a"; sourceTree = ""; }; D04554A321B42982007A6DD9 /* ConfirmPhoneNumberController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfirmPhoneNumberController.swift; sourceTree = ""; }; - D046142D2004DB3700EC0EF2 /* LiveLocationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiveLocationManager.swift; sourceTree = ""; }; - D04614362005094E00EC0EF2 /* DeviceLocationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceLocationManager.swift; sourceTree = ""; }; - D0461438200514F000EC0EF2 /* LiveLocationSummaryManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiveLocationSummaryManager.swift; sourceTree = ""; }; D04662801E68BA64006FAFC4 /* TransformOutgoingMessageMedia.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransformOutgoingMessageMedia.swift; sourceTree = ""; }; D0471B481EFD59170074D609 /* BotCheckoutControllerNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BotCheckoutControllerNode.swift; sourceTree = ""; }; D0471B4A1EFD64AC0074D609 /* BotCheckoutHeaderItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BotCheckoutHeaderItem.swift; sourceTree = ""; }; @@ -1672,7 +1648,6 @@ D0471B5F1EFEB5A70074D609 /* BotPaymentTextItemNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BotPaymentTextItemNode.swift; sourceTree = ""; }; D0471B611EFEB5B70074D609 /* BotPaymentSwitchItemNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BotPaymentSwitchItemNode.swift; sourceTree = ""; }; D0471B631EFEB5CB0074D609 /* BotPaymentItemNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BotPaymentItemNode.swift; sourceTree = ""; }; - D0477D1A1F617E5800412B44 /* UniversalVideoNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UniversalVideoNode.swift; sourceTree = ""; }; D0477D1C1F617E8900412B44 /* NativeVideoContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NativeVideoContent.swift; sourceTree = ""; }; D0477D1E1F619E0700412B44 /* GalleryVideoDecoration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GalleryVideoDecoration.swift; sourceTree = ""; }; D0477D201F61A47600412B44 /* UniversalVideoContentManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UniversalVideoContentManager.swift; sourceTree = ""; }; @@ -1689,7 +1664,6 @@ D049EAE51E44AD5600A2CD3A /* ChatMediaInputMetaSectionItemNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatMediaInputMetaSectionItemNode.swift; sourceTree = ""; }; D049EAED1E44BB3200A2CD3A /* ChatListRecentPeersListItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatListRecentPeersListItem.swift; sourceTree = ""; }; D049EAF21E44DE2500A2CD3A /* AuthorizationSequenceController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthorizationSequenceController.swift; sourceTree = ""; }; - D04B26EB20082EB50053A58C /* LocationBroadcastPanelWavesNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationBroadcastPanelWavesNode.swift; sourceTree = ""; }; D04B4D101EEA04D400711AF6 /* MapResources.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapResources.swift; sourceTree = ""; }; D04B4D121EEA0A6500711AF6 /* ChatMessageMapBubbleContentNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatMessageMapBubbleContentNode.swift; sourceTree = ""; }; D04B4D651EEA993A00711AF6 /* LegacyLocationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LegacyLocationController.swift; sourceTree = ""; }; @@ -1777,10 +1751,6 @@ D06F1EA31F6C0A5D00FE8B74 /* ChatHistorySearchContainerNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatHistorySearchContainerNode.swift; sourceTree = ""; }; D06F31E3213597FF001A0F12 /* ThemeAutoNightTimeSelectionActionSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemeAutoNightTimeSelectionActionSheet.swift; sourceTree = ""; }; D06F31E52135A41C001A0F12 /* ThemeSettingsBrightnessItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemeSettingsBrightnessItem.swift; sourceTree = ""; }; - D0736F241DF4D0E500F2C02A /* TelegramController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TelegramController.swift; sourceTree = ""; }; - D0736F291DF4D5FF00F2C02A /* MediaNavigationAccessoryPanel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaNavigationAccessoryPanel.swift; sourceTree = ""; }; - D0736F2B1DF4DC2400F2C02A /* MediaNavigationAccessoryContainerNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaNavigationAccessoryContainerNode.swift; sourceTree = ""; }; - D0736F2D1DF4E54A00F2C02A /* MediaNavigationAccessoryHeaderNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaNavigationAccessoryHeaderNode.swift; sourceTree = ""; }; D073CE621DCBBE5D007511FD /* MessageSent.caf */ = {isa = PBXFileReference; lastKnownFileType = file; name = MessageSent.caf; path = TelegramUI/Sounds/MessageSent.caf; sourceTree = ""; }; D073CE641DCBC26B007511FD /* ServiceSoundManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServiceSoundManager.swift; sourceTree = ""; }; D073CE701DCBF23F007511FD /* DeclareEncodables.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeclareEncodables.swift; sourceTree = ""; }; @@ -1842,6 +1812,14 @@ D087751B1E3F542500A97350 /* ContactMultiselectionControllerNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactMultiselectionControllerNode.swift; sourceTree = ""; }; D087751D1E3F579300A97350 /* CounterContollerTitleView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CounterContollerTitleView.swift; sourceTree = ""; }; D087751F1E3F595000A97350 /* ContactListActionItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactListActionItem.swift; sourceTree = ""; }; + D08799EF22F649A600C4D6B3 /* TelegramBaseController.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramBaseController.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879A0C22F64E4C00C4D6B3 /* DeviceLocationManager.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = DeviceLocationManager.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B1E22F7189600C4D6B3 /* AvatarNode.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = AvatarNode.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B2022F7189B00C4D6B3 /* OverlayStatusController.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = OverlayStatusController.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B2222F718AA00C4D6B3 /* TelegramStringFormatting.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramStringFormatting.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B2422F7198400C4D6B3 /* LiveLocationManager.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = LiveLocationManager.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B2622F7198900C4D6B3 /* LiveLocationTimerNode.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = LiveLocationTimerNode.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B5A22F79EEF00C4D6B3 /* TemporaryCachedPeerDataManager.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TemporaryCachedPeerDataManager.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D087BFAC1F741B9D003FD209 /* ShareContentContainerNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareContentContainerNode.swift; sourceTree = ""; }; D087BFAE1F741BB7003FD209 /* ShareLoadingContainerNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareLoadingContainerNode.swift; sourceTree = ""; }; D087BFB01F745483003FD209 /* ShareSearchBarNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareSearchBarNode.swift; sourceTree = ""; }; @@ -1862,7 +1840,6 @@ D091C7A31F8EBB1E00D7DE13 /* ChatPresentationData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatPresentationData.swift; sourceTree = ""; }; D091C7A51F8ECEA300D7DE13 /* SettingsThemeWallpaperNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsThemeWallpaperNode.swift; sourceTree = ""; }; D09250051FE5371D003F693F /* GlobalExperimentalSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlobalExperimentalSettings.swift; sourceTree = ""; }; - D09394122007F5BB00997F31 /* LocationBroadcastNavigationAccessoryPanel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationBroadcastNavigationAccessoryPanel.swift; sourceTree = ""; }; D093D7D82062A9CA00BC3599 /* SecureIdAuthControllerState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdAuthControllerState.swift; sourceTree = ""; }; D093D7DA2062CFF500BC3599 /* SecureIdAuthFormContentNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdAuthFormContentNode.swift; sourceTree = ""; }; D093D7DC2062D09A00BC3599 /* SecureIdAuthFormFieldNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdAuthFormFieldNode.swift; sourceTree = ""; }; @@ -1882,7 +1859,6 @@ D0943B061FDEC528001522CC /* InstantVideoRadialStatusNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstantVideoRadialStatusNode.swift; sourceTree = ""; }; D0955FB32191278C00F89427 /* PresentationStrings.mapping */ = {isa = PBXFileReference; lastKnownFileType = file; name = PresentationStrings.mapping; path = TelegramUI/Resources/PresentationStrings.mapping; sourceTree = ""; }; D097C26720DD0A1D007BB4B8 /* PeerReportController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PeerReportController.swift; sourceTree = ""; }; - D097C26B20DD1EA5007BB4B8 /* OverlayStatusController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OverlayStatusController.swift; sourceTree = ""; }; D099261E1E69791E00D95539 /* GroupsInCommonController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GroupsInCommonController.swift; sourceTree = ""; }; D099D74C1EEFEE1500A3128C /* GameController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GameController.swift; sourceTree = ""; }; D099D74E1EEFEE6A00A3128C /* GameControllerNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GameControllerNode.swift; sourceTree = ""; }; @@ -1924,7 +1900,6 @@ D0AB269D21D56A12008F6685 /* ChannelPermissionsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelPermissionsController.swift; sourceTree = ""; }; D0ACCB191EC5E0C20079D8BF /* CallControllerKeyPreviewNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CallControllerKeyPreviewNode.swift; sourceTree = ""; }; D0ACCB1B1EC5FF4B0079D8BF /* ChatMessageCallBubbleContentNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatMessageCallBubbleContentNode.swift; sourceTree = ""; }; - D0AD02E71FFFDE5F00C1DCFF /* ChatMessageLiveLocationTimerNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatMessageLiveLocationTimerNode.swift; sourceTree = ""; }; D0AD02E91FFFEBEF00C1DCFF /* ChatMessageLiveLocationTextNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatMessageLiveLocationTextNode.swift; sourceTree = ""; }; D0AD02EB20000D0100C1DCFF /* ChatMessageLiveLocationPositionNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatMessageLiveLocationPositionNode.swift; sourceTree = ""; }; D0ADF965212E05A300310BBC /* TonePlayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TonePlayer.swift; sourceTree = ""; }; @@ -2002,7 +1977,6 @@ D0B843CC1DA903BB005F29E1 /* PeerInfoController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PeerInfoController.swift; sourceTree = ""; }; D0B843D81DAAAA0C005F29E1 /* ItemListPeerItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemListPeerItem.swift; sourceTree = ""; }; D0B843DA1DAAB138005F29E1 /* ItemListPeerActionItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemListPeerActionItem.swift; sourceTree = ""; }; - D0B844551DAC3AEE005F29E1 /* PresenceStrings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PresenceStrings.swift; sourceTree = ""; }; D0B844571DAC44E8005F29E1 /* PeerPresenceStatusManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PeerPresenceStatusManager.swift; sourceTree = ""; }; D0B85C1B1FF6F76000E795B4 /* AuthorizationSequencePasswordRecoveryController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthorizationSequencePasswordRecoveryController.swift; sourceTree = ""; }; D0B85C1D1FF6F76600E795B4 /* AuthorizationSequencePasswordRecoveryControllerNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthorizationSequencePasswordRecoveryControllerNode.swift; sourceTree = ""; }; @@ -2020,7 +1994,6 @@ D0BCC3D320404CC7008126C2 /* ChatMessageActionSheetController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatMessageActionSheetController.swift; sourceTree = ""; }; D0BCC3D520404CD8008126C2 /* ChatMessageActionSheetControllerNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatMessageActionSheetControllerNode.swift; sourceTree = ""; }; D0BDB09A1F79C658002ABF2F /* SaveToCameraRoll.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SaveToCameraRoll.swift; sourceTree = ""; }; - D0BE303120601FFC00FBE6D8 /* LocationBroadcastActionSheetItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationBroadcastActionSheetItem.swift; sourceTree = ""; }; D0BE3036206139F500FBE6D8 /* ImageCompression.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageCompression.swift; sourceTree = ""; }; D0BE30402061B80100FBE6D8 /* SecureIdAuthController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdAuthController.swift; sourceTree = ""; }; D0BE30422061B80B00FBE6D8 /* SecureIdAuthControllerNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdAuthControllerNode.swift; sourceTree = ""; }; @@ -2040,7 +2013,6 @@ D0C12A1B1F33964900B3F66D /* ChatWallpaperBuiltin0.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; name = ChatWallpaperBuiltin0.jpg; path = TelegramUI/Resources/ChatWallpaperBuiltin0.jpg; sourceTree = ""; }; D0C12EAF1F9A8D1300600BB2 /* ListMessageDateHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListMessageDateHeader.swift; sourceTree = ""; }; D0C26D561FDF2388004ABF18 /* OpenChatMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenChatMessage.swift; sourceTree = ""; }; - D0C26D5D1FDF49E7004ABF18 /* DateFormat.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateFormat.swift; sourceTree = ""; }; D0C27B3A1F4B453700A4E170 /* InstantPagePlayableVideoItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InstantPagePlayableVideoItem.swift; sourceTree = ""; }; D0C27B3C1F4B454800A4E170 /* InstantPagePlayableVideoNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InstantPagePlayableVideoNode.swift; sourceTree = ""; }; D0C44B631FC64D0500227BE0 /* SwipeToDismissGestureRecognizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwipeToDismissGestureRecognizer.swift; sourceTree = ""; }; @@ -2057,8 +2029,6 @@ D0C932351E0988C60074F044 /* ChatButtonKeyboardInputNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatButtonKeyboardInputNode.swift; sourceTree = ""; }; D0C932371E09E0EA0074F044 /* ChatBotInfoItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatBotInfoItem.swift; sourceTree = ""; }; D0C9323B1E0B4AE90074F044 /* DataAndStorageSettingsController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataAndStorageSettingsController.swift; sourceTree = ""; }; - D0CAD8FA20AE1D1B00ACD96E /* ChannelMemberCategoryListContext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelMemberCategoryListContext.swift; sourceTree = ""; }; - D0CAD8FC20AE467D00ACD96E /* PeerChannelMemberCategoriesContextsManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PeerChannelMemberCategoriesContextsManager.swift; sourceTree = ""; }; D0CAD90020AEECAC00ACD96E /* ChatEditInterfaceMessageState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatEditInterfaceMessageState.swift; sourceTree = ""; }; D0CB27CE20C17A4A001ACF93 /* TermsOfServiceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TermsOfServiceController.swift; sourceTree = ""; }; D0CB27D120C17A7F001ACF93 /* TermsOfServiceControllerNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TermsOfServiceControllerNode.swift; sourceTree = ""; }; @@ -2332,7 +2302,6 @@ D0F67FF31EE6C10F000E5906 /* ChannelMembersSearchContainerNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChannelMembersSearchContainerNode.swift; sourceTree = ""; }; D0F680091EE750EE000E5906 /* ChannelBannedMemberController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChannelBannedMemberController.swift; sourceTree = ""; }; D0F69CD61D6B87D30046BCD6 /* MediaManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaManager.swift; sourceTree = ""; }; - D0F69CDE1D6B87D30046BCD6 /* PeerAvatar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PeerAvatar.swift; sourceTree = ""; }; D0F69CFB1D6B87D30046BCD6 /* TouchDownGestureRecognizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TouchDownGestureRecognizer.swift; sourceTree = ""; }; D0F69DB91D6B88190046BCD6 /* TelegramUI.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = TelegramUI.xcconfig; path = TelegramUI/Config/TelegramUI.xcconfig; sourceTree = ""; }; D0F69DC01D6B89D30046BCD6 /* ListSectionHeaderNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListSectionHeaderNode.swift; sourceTree = ""; }; @@ -2342,7 +2311,6 @@ D0F69DCC1D6B8A0D0046BCD6 /* SearchBarPlaceholderNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchBarPlaceholderNode.swift; sourceTree = ""; }; D0F69DCD1D6B8A0D0046BCD6 /* SearchDisplayController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchDisplayController.swift; sourceTree = ""; }; D0F69DCE1D6B8A0D0046BCD6 /* SearchDisplayControllerContentNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchDisplayControllerContentNode.swift; sourceTree = ""; }; - D0F69DF71D6B8A880046BCD6 /* AvatarNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AvatarNode.swift; sourceTree = ""; }; D0F69DF81D6B8A880046BCD6 /* ChatListController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatListController.swift; sourceTree = ""; }; D0F69DF91D6B8A880046BCD6 /* ChatListControllerNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatListControllerNode.swift; sourceTree = ""; }; D0F69DFB1D6B8A880046BCD6 /* ChatListHoleItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatListHoleItem.swift; sourceTree = ""; }; @@ -2407,7 +2375,6 @@ D0F760DA222034910074F7E5 /* ChannelStatsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelStatsController.swift; sourceTree = ""; }; D0F760DC222034980074F7E5 /* ChannelStatsControllerNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelStatsControllerNode.swift; sourceTree = ""; }; D0F7AB381DCFF87B009AD9A1 /* ChatMessageDateHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatMessageDateHeader.swift; sourceTree = ""; }; - D0FA08BD20481EA300DD23FC /* Locale.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Locale.swift; sourceTree = ""; }; D0FA08BF20483F9600DD23FC /* ExtractVideoData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtractVideoData.swift; sourceTree = ""; }; D0FA08C7204982DC00DD23FC /* ChatTextInputActionButtonsNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatTextInputActionButtonsNode.swift; sourceTree = ""; }; D0FA08C92049BEAC00DD23FC /* ChatEmptyNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatEmptyNode.swift; sourceTree = ""; }; @@ -2427,7 +2394,6 @@ D0FC4FBA1F751E8900B7443F /* SelectablePeerNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectablePeerNode.swift; sourceTree = ""; }; D0FE4DDB1F09AD0400E8A0B3 /* PresentationSurfaceLevels.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PresentationSurfaceLevels.swift; sourceTree = ""; }; D0FE4DE31F0AEBB900E8A0B3 /* SharedVideoContextManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SharedVideoContextManager.swift; sourceTree = ""; }; - D0FE4DE51F0BA58A00E8A0B3 /* OverlayMediaItemNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OverlayMediaItemNode.swift; sourceTree = ""; }; D0FFF7F51F55B82500BEBC01 /* InstantPageAudioItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstantPageAudioItem.swift; sourceTree = ""; }; D0FFF7F71F55B83600BEBC01 /* InstantPageAudioNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstantPageAudioNode.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -2437,6 +2403,14 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + D0879B5B22F79EEF00C4D6B3 /* TemporaryCachedPeerDataManager.framework in Frameworks */, + D0879B2722F7198900C4D6B3 /* LiveLocationTimerNode.framework in Frameworks */, + D0879B2522F7198400C4D6B3 /* LiveLocationManager.framework in Frameworks */, + D0879B2322F718AA00C4D6B3 /* TelegramStringFormatting.framework in Frameworks */, + D0879B2122F7189B00C4D6B3 /* OverlayStatusController.framework in Frameworks */, + D0879B1F22F7189600C4D6B3 /* AvatarNode.framework in Frameworks */, + D0879A0D22F64E4C00C4D6B3 /* DeviceLocationManager.framework in Frameworks */, + D08799F022F649A600C4D6B3 /* TelegramBaseController.framework in Frameworks */, D060184622F35D2B00796784 /* ItemListUI.framework in Frameworks */, D060184422F35D2400796784 /* ProgressNavigationButtonNode.framework in Frameworks */, D060184222F35D2000796784 /* ActivityIndicator.framework in Frameworks */, @@ -2706,8 +2680,6 @@ children = ( D079FCE81F06A76C0038FADE /* Notices.swift */, D09250051FE5371D003F693F /* GlobalExperimentalSettings.swift */, - D0CAD8FC20AE467D00ACD96E /* PeerChannelMemberCategoriesContextsManager.swift */, - D0CAD8FA20AE1D1B00ACD96E /* ChannelMemberCategoryListContext.swift */, D01749541E1082770057C89A /* StoredMessageFromSearchPeer.swift */, D0068FA721760FA300D1B315 /* StoreDownloadedMedia.swift */, D0EC55A2210231D600D1992C /* SearchPeerMembers.swift */, @@ -2899,8 +2871,6 @@ isa = PBXGroup; children = ( D00781042084DFB100369A39 /* UrlEscaping.swift */, - D0B844551DAC3AEE005F29E1 /* PresenceStrings.swift */, - D0C26D5D1FDF49E7004ABF18 /* DateFormat.swift */, D0BCC3D1203F0A6C008126C2 /* StringForMessageTimestampStatus.swift */, D00ACA592022897D0045D427 /* ProcessedPeerRestrictionText.swift */, 09C9EA3721A044B500E90146 /* StringForDuration.swift */, @@ -2959,7 +2929,6 @@ D01C7EFE1EF9D434008305F1 /* Device Contacts */ = { isa = PBXGroup; children = ( - D0192D3B210A44D00005FA10 /* DeviceContactData.swift */, D0192D43210A5AA50005FA10 /* DeviceContactDataManager.swift */, D0F4B0212110972300912B92 /* ContactInfoStrings.swift */, 090E63ED2196FE3A00E3C035 /* OpenAddContact.swift */, @@ -2970,7 +2939,7 @@ D020A9D81FEAE611008C66F7 /* Player */ = { isa = PBXGroup; children = ( - D020A9D91FEAE675008C66F7 /* OverlayPlayerController.swift */, + D020A9D91FEAE675008C66F7 /* OverlayAudioPlayerController.swift */, D020A9DB1FEAE6E7008C66F7 /* OverlayPlayerControllerNode.swift */, D0AA840B1FEB2BA3005C6E91 /* OverlayPlayerControlsNode.swift */, ); @@ -3144,9 +3113,6 @@ D04614352005093B00EC0EF2 /* Location */ = { isa = PBXGroup; children = ( - D04614362005094E00EC0EF2 /* DeviceLocationManager.swift */, - D046142D2004DB3700EC0EF2 /* LiveLocationManager.swift */, - D0461438200514F000EC0EF2 /* LiveLocationSummaryManager.swift */, 09DD88EE21BDDE2B000766BC /* Geocoding.swift */, ); name = Location; @@ -3172,7 +3138,6 @@ isa = PBXGroup; children = ( 09CC52A7210615AA000578F8 /* Web Embed */, - D0477D1A1F617E5800412B44 /* UniversalVideoNode.swift */, D06BEC761F62F68B0035A545 /* OverlayUniversalVideoNode.swift */, D0943B041FDDFDA0001522CC /* OverlayInstantVideoNode.swift */, D0477D1C1F617E8900412B44 /* NativeVideoContent.swift */, @@ -3328,13 +3293,6 @@ D0736F261DF4D2F300F2C02A /* Telegram Controller */ = { isa = PBXGroup; children = ( - D0736F241DF4D0E500F2C02A /* TelegramController.swift */, - D0736F291DF4D5FF00F2C02A /* MediaNavigationAccessoryPanel.swift */, - D0736F2B1DF4DC2400F2C02A /* MediaNavigationAccessoryContainerNode.swift */, - D0736F2D1DF4E54A00F2C02A /* MediaNavigationAccessoryHeaderNode.swift */, - D09394122007F5BB00997F31 /* LocationBroadcastNavigationAccessoryPanel.swift */, - D04B26EB20082EB50053A58C /* LocationBroadcastPanelWavesNode.swift */, - D0BE303120601FFC00FBE6D8 /* LocationBroadcastActionSheetItem.swift */, ); name = "Telegram Controller"; sourceTree = ""; @@ -3414,7 +3372,6 @@ D07ABBA4202A14BC003671DE /* LegacyImagePicker.swift */, D07ABBAA202A1BD1003671DE /* LegacyWallpaperPicker.swift */, D0380DAC204ED434000414AB /* LegacyLiveUploadInterface.swift */, - D097C26B20DD1EA5007BB4B8 /* OverlayStatusController.swift */, 09F799F921C3542D00820234 /* LegacyWebSearchGallery.swift */, 09F79A0C21C88E8900820234 /* LegacyWebSearchEditor.swift */, D0B21B1E22156D92003F741D /* LegacyCache.swift */, @@ -3545,6 +3502,14 @@ D08D45281D5E340200A7428A /* Frameworks */ = { isa = PBXGroup; children = ( + D0879B5A22F79EEF00C4D6B3 /* TemporaryCachedPeerDataManager.framework */, + D0879B2622F7198900C4D6B3 /* LiveLocationTimerNode.framework */, + D0879B2422F7198400C4D6B3 /* LiveLocationManager.framework */, + D0879B2222F718AA00C4D6B3 /* TelegramStringFormatting.framework */, + D0879B2022F7189B00C4D6B3 /* OverlayStatusController.framework */, + D0879B1E22F7189600C4D6B3 /* AvatarNode.framework */, + D0879A0C22F64E4C00C4D6B3 /* DeviceLocationManager.framework */, + D08799EF22F649A600C4D6B3 /* TelegramBaseController.framework */, D060184522F35D2B00796784 /* ItemListUI.framework */, D060184322F35D2400796784 /* ProgressNavigationButtonNode.framework */, D060184122F35D2000796784 /* ActivityIndicator.framework */, @@ -3768,8 +3733,6 @@ D0B69C3A20EBD8B3003632C7 /* Device */ = { isa = PBXGroup; children = ( - 09C3466C2167D63A00B76780 /* Accessibility.swift */, - D0FA08BD20481EA300DD23FC /* Locale.swift */, 09DD5D4F21ECC3C400D7007A /* SuppressContactsWarning.swift */, 099529B321D3E5D800805E13 /* CheckDiskSpace.swift */, D079FCDC1F05C4F20038FADE /* LocalAuth.swift */, @@ -4382,16 +4345,13 @@ D0D03AE41DECAE8900220C46 /* ManagedAudioRecorder.swift */, D0CFBB901FD881A600B65C0D /* AudioRecordningToneData.swift */, D0D03B2B1DED9B8900220C46 /* AudioWaveform.swift */, - D00ADFDC1EBB73C200873D2E /* OverlayMediaManager.swift */, D0EC6B421EB92DF600EBF1C3 /* OverlayMediaController.swift */, D0EC6B441EB92E5A00EBF1C3 /* OverlayMediaControllerNode.swift */, - D0FE4DE51F0BA58A00E8A0B3 /* OverlayMediaItemNode.swift */, D0FE4DE31F0AEBB900E8A0B3 /* SharedVideoContextManager.swift */, D09E63A91F0FC681003444CD /* PictureInPictureVideoControlsNode.swift */, D09E637D1F0E8C66003444CD /* Shared Media Player */, D0D03AE61DECB0D200220C46 /* Audio Recorder */, 0919546D229458E900E11046 /* Animated Stickers */, - D0F69CDE1D6B87D30046BCD6 /* PeerAvatar.swift */, D0F69E9D1D6B8E240046BCD6 /* Resources */, D0177B831DFB095000A5083A /* FileMediaResourceStatus.swift */, D0FA08BF20483F9600DD23FC /* ExtractVideoData.swift */, @@ -4436,7 +4396,6 @@ D00C7CE51E378FD00080C3D5 /* RadialTimeoutNode.swift */, D0F69DC21D6B89DA0046BCD6 /* TextNode.swift */, D0F69DC01D6B89D30046BCD6 /* ListSectionHeaderNode.swift */, - D0F69DF71D6B8A880046BCD6 /* AvatarNode.swift */, D0943AF51FDAAE7E001522CC /* MultipleAvatarsNode.swift */, D0568AAC1DF198130022E7DA /* AudioWaveformNode.swift */, D0BC38621E3F9EFA0044D6FE /* EditableTokenListNode.swift */, @@ -4594,7 +4553,6 @@ D0D2686A1D788F6600C422DA /* Title Accessory Panels */, 09D9689B221F74AA00B1458A /* Title Activity Indicator */, D0F69E441D6B8B850046BCD6 /* History Navigation */, - D044A0FA20BDC40C00326FAC /* CachedChannelAdmins.swift */, D01848E721A03BDA00B6DEBD /* ChatSearchState.swift */, D06350AD2229A7F800FA2B32 /* InChatPrefetchManager.swift */, 0921F60D228EE000001A13D7 /* ChatMessageActionUrlAuthController.swift */, @@ -4647,7 +4605,6 @@ D02F4AE81FCF370B004DFBAE /* ChatMessageInteractiveMediaBadge.swift */, D056CD751FF2A30900880D28 /* ChatSwipeToReplyRecognizer.swift */, D056CD771FF2A6EE00880D28 /* ChatMessageSwipeToReplyNode.swift */, - D0AD02E71FFFDE5F00C1DCFF /* ChatMessageLiveLocationTimerNode.swift */, D0AD02E91FFFEBEF00C1DCFF /* ChatMessageLiveLocationTextNode.swift */, D0AD02EB20000D0100C1DCFF /* ChatMessageLiveLocationPositionNode.swift */, D0E8174B2011F8A300B82BBB /* ChatMessageEventLogPreviousMessageContentNode.swift */, @@ -5278,14 +5235,12 @@ D0477D1F1F619E0700412B44 /* GalleryVideoDecoration.swift in Sources */, 09F799FA21C3542D00820234 /* LegacyWebSearchGallery.swift in Sources */, D01C99781F4F382C00DCFAF6 /* InstantPageSettingsItemTheme.swift in Sources */, - D0CAD8FB20AE1D1B00ACD96E /* ChannelMemberCategoryListContext.swift in Sources */, D0EC6CC21EB9F58800EBF1C3 /* LegacyEmptyController.swift in Sources */, D0EC6CC31EB9F58800EBF1C3 /* LegacyNavigationController.swift in Sources */, D0EC6CC41EB9F58800EBF1C3 /* LegacyLocationPicker.swift in Sources */, D0EC6CC51EB9F58800EBF1C3 /* TGDataItem.m in Sources */, D093D7DD2062D09A00BC3599 /* SecureIdAuthFormFieldNode.swift in Sources */, 092F36902157AB46001A9F49 /* ItemListCallListItem.swift in Sources */, - D0EC6CC61EB9F58800EBF1C3 /* PresenceStrings.swift in Sources */, D00817D522B47A14008A895F /* ApplicationShortcutItem.swift in Sources */, D077C5C122B59A800097D617 /* ApplicationContext.swift in Sources */, D0EC6CC71EB9F58800EBF1C3 /* PeerNotificationSoundStrings.swift in Sources */, @@ -5306,7 +5261,6 @@ D02D60B1206C189900FEFE1E /* SecureIdPlaintextFormController.swift in Sources */, D0CFBB951FD8B05000B65C0D /* OverlayInstantVideoDecoration.swift in Sources */, D0EC6CCE1EB9F58800EBF1C3 /* AccountContext.swift in Sources */, - D09394132007F5BB00997F31 /* LocationBroadcastNavigationAccessoryPanel.swift in Sources */, D0471B5C1EFEB4F30074D609 /* BotPaymentFieldItemNode.swift in Sources */, D0C27B3D1F4B454800A4E170 /* InstantPagePlayableVideoNode.swift in Sources */, D0EC6CD11EB9F58800EBF1C3 /* UrlHandling.swift in Sources */, @@ -5351,13 +5305,11 @@ D02B2B9820810DA00062476B /* StickerPaneSearchStickerItem.swift in Sources */, D020A9DC1FEAE6E7008C66F7 /* OverlayPlayerControllerNode.swift in Sources */, D05D8B742195CD890064586F /* SetupTwoStepVerificationController.swift in Sources */, - D04B26EC20082EB50053A58C /* LocationBroadcastPanelWavesNode.swift in Sources */, D06BEC8A1F6597A80035A545 /* OverlayVideoDecoration.swift in Sources */, 09619B9621A4ABF600493558 /* InstantPageReferenceControllerNode.swift in Sources */, D0AB263321C3DFEA008F6685 /* CreatePollOptionActionItem.swift in Sources */, 09FFBCDB22849CB500C33B4B /* PDF.swift in Sources */, 09D968A1221F7FF100B1458A /* ChatTypingActivityContentNode.swift in Sources */, - D0BE303220601FFC00FBE6D8 /* LocationBroadcastActionSheetItem.swift in Sources */, 090E778E22AA863A00CD99F5 /* PeersNearbyIconNode.swift in Sources */, D0EC6CF41EB9F58800EBF1C3 /* ManagedMediaId.swift in Sources */, 09D968A3221F800A00B1458A /* ChatUploadingActivityContentNode.swift in Sources */, @@ -5437,9 +5389,7 @@ D0D9DE0D20EFEA2E00F20B06 /* InstantPageMediaPlaylist.swift in Sources */, D01C06B11FBB4643001561AB /* JoinLinkPreviewControllerNode.swift in Sources */, D0C0B59B1EE019E5000F4D2C /* ChatSearchNavigationContentNode.swift in Sources */, - D0EC6D201EB9F58800EBF1C3 /* PeerAvatar.swift in Sources */, 09F664CC21EB552C00AB7E26 /* WallpaperSearchRecentQueries.swift in Sources */, - D0461439200514F000EC0EF2 /* LiveLocationSummaryManager.swift in Sources */, D056CD781FF2A6EE00880D28 /* ChatMessageSwipeToReplyNode.swift in Sources */, D0CE67941F7DB45100FFB557 /* ChatMessageContactBubbleContentNode.swift in Sources */, 09749BCD21F23139008FDDE9 /* WallpaperGalleryDecorationNode.swift in Sources */, @@ -5487,7 +5437,6 @@ D0EC6D2C1EB9F58800EBF1C3 /* TouchDownGestureRecognizer.swift in Sources */, 09DD88FA21BFD70B000766BC /* ThemedTextAlertController.swift in Sources */, D0EC6D2D1EB9F58800EBF1C3 /* TapLongTapOrDoubleTapGestureRecognizer.swift in Sources */, - 09C3466D2167D63A00B76780 /* Accessibility.swift in Sources */, D0FA08C020483F9600DD23FC /* ExtractVideoData.swift in Sources */, D025402522E1E00100AC0195 /* ChatSlowmodeHintController.swift in Sources */, D008177D22B46B7E008A895F /* TGContactModel.m in Sources */, @@ -5500,7 +5449,6 @@ D0BDB09B1F79C658002ABF2F /* SaveToCameraRoll.swift in Sources */, D087BFB31F748752003FD209 /* ShareControllerRecentPeersGridItem.swift in Sources */, 09CE950A2237B93500A7D2C3 /* SettingsSearchResultItem.swift in Sources */, - D0EC6D341EB9F58800EBF1C3 /* AvatarNode.swift in Sources */, D0AE303922B1D3620058D3BC /* LegacyBridgeAudio.swift in Sources */, 09F79A0921C829C700820234 /* GalleryNavigationRecipientNode.swift in Sources */, D0EC6D351EB9F58800EBF1C3 /* SearchBarNode.swift in Sources */, @@ -5521,17 +5469,13 @@ D0AD02EC20000D0100C1DCFF /* ChatMessageLiveLocationPositionNode.swift in Sources */, D01BAA581ED3283D00295217 /* AddFormatToStringWithRanges.swift in Sources */, D0E2CE6C222930540084E3DD /* PrefetchManager.swift in Sources */, - D0EC6D3E1EB9F58800EBF1C3 /* TelegramController.swift in Sources */, D0EB42011F30ED4F00838FE6 /* LegacyImageProcessors.m in Sources */, D087BFAF1F741BB7003FD209 /* ShareLoadingContainerNode.swift in Sources */, - D0EC6D3F1EB9F58800EBF1C3 /* MediaNavigationAccessoryPanel.swift in Sources */, D01590C322BDAEBC0017C33E /* BMPImage.cpp in Sources */, D0E9BA3B1F0558E800F079A4 /* NSString+Stripe.m in Sources */, D0CE8CE51F6F354400AA2DB0 /* ChatTextInputAccessoryItem.swift in Sources */, - D0EC6D401EB9F58800EBF1C3 /* MediaNavigationAccessoryContainerNode.swift in Sources */, 09F215AD2264DC4500AEDF6D /* PasscodeSetupController.swift in Sources */, D0E266FD1F66706500BFC79F /* ChatBubbleVideoDecoration.swift in Sources */, - D0EC6D411EB9F58800EBF1C3 /* MediaNavigationAccessoryHeaderNode.swift in Sources */, D097C26820DD0A1D007BB4B8 /* PeerReportController.swift in Sources */, D0471B491EFD59170074D609 /* BotCheckoutControllerNode.swift in Sources */, 09F664C621EB400A00AB7E26 /* ThemeGridSearchContentNode.swift in Sources */, @@ -5616,7 +5560,6 @@ D0B85C211FF70BEC00E795B4 /* AuthorizationSequenceAwaitingAccountResetControllerNode.swift in Sources */, D0EC6D6F1EB9F58800EBF1C3 /* AuthorizationSequenceCodeEntryController.swift in Sources */, 09F85BA721E7DA5F00D73170 /* BlurredImageNode.swift in Sources */, - D0C26D5E1FDF49E7004ABF18 /* DateFormat.swift in Sources */, D0068FA821760FA300D1B315 /* StoreDownloadedMedia.swift in Sources */, D0EC6D701EB9F58800EBF1C3 /* AuthorizationSequenceCodeEntryControllerNode.swift in Sources */, D0E9BA4D1F0559C700F079A4 /* NSString+Stripe_CardBrands.m in Sources */, @@ -5647,7 +5590,6 @@ D0EC6D7C1EB9F58800EBF1C3 /* HorizontalPeerItem.swift in Sources */, D0E9BADD1F0574D800F079A4 /* PKPayment+Stripe.m in Sources */, 09F215A022649BCB00AEDF6D /* PasscodeEntryInputFieldNode.swift in Sources */, - D0AD02E81FFFDE5F00C1DCFF /* ChatMessageLiveLocationTimerNode.swift in Sources */, D0EC6D7D1EB9F58800EBF1C3 /* ChatListSearchRecentPeersNode.swift in Sources */, D0EC6D7E1EB9F58800EBF1C3 /* ChatListSearchItemHeader.swift in Sources */, 0910B0ED21FA178C00F8F87D /* WallpaperPreviewMedia.swift in Sources */, @@ -5668,7 +5610,6 @@ D0EC6D851EB9F58800EBF1C3 /* ChatHistoryLocation.swift in Sources */, D0EC6D861EB9F58800EBF1C3 /* ChatAvatarNavigationNode.swift in Sources */, D0EC6D871EB9F58800EBF1C3 /* ChatTitleView.swift in Sources */, - D04614372005094E00EC0EF2 /* DeviceLocationManager.swift in Sources */, D0EC6D881EB9F58800EBF1C3 /* ChatControllerTitlePanelNodeContainer.swift in Sources */, 9F06830B21A404C4001D8EDB /* NotificationExceptionSettingsController.swift in Sources */, D008177922B46B7E008A895F /* ShareItems.swift in Sources */, @@ -5685,13 +5626,11 @@ D02D60C8206E705D00FEFE1E /* SecureIdValueFormPhoneItem.swift in Sources */, D0EC6D8F1EB9F58800EBF1C3 /* ChatMessageBubbleContentCalclulateImageCorners.swift in Sources */, D01776BC1F1E21AF0044446D /* RadialStatusBackgroundNode.swift in Sources */, - D0FE4DE61F0BA58A00E8A0B3 /* OverlayMediaItemNode.swift in Sources */, D00817DD22B47A14008A895F /* LockedWindowCoveringView.swift in Sources */, 0902838821931D960067EFBD /* LanguageSuggestionController.swift in Sources */, D0F19F6420E5A15B00EEC860 /* ChatMediaInputPeerSpecificItem.swift in Sources */, D0AEAE252080D6830013176E /* PaneSearchContainerNode.swift in Sources */, D01DBA9B209CC6AD00C64E64 /* ChatLinkPreview.swift in Sources */, - D044A0FB20BDC40C00326FAC /* CachedChannelAdmins.swift in Sources */, D01590AF22BD58AD0017C33E /* YUV.m in Sources */, D0EC6D901EB9F58900EBF1C3 /* ChatMessageBubbleContentNode.swift in Sources */, 09874E582107A4C300E190B8 /* VimeoEmbedImplementation.swift in Sources */, @@ -5721,7 +5660,6 @@ 09D304152173C0E900C00567 /* WatchManager.swift in Sources */, 9F06830921A404AB001D8EDB /* NotificationExceptionControllerNode.swift in Sources */, D039FB1921711B5D00BD1BAD /* PlatformVideoContent.swift in Sources */, - D0CAD8FD20AE467D00ACD96E /* PeerChannelMemberCategoriesContextsManager.swift in Sources */, D035734B22B5CCCA00F0920D /* LegacyBuffer.swift in Sources */, D0430B001FF4570500A35ADD /* WebController.swift in Sources */, 09D9689D221F74F000B1458A /* ChatTitleActivityNode.swift in Sources */, @@ -5739,7 +5677,6 @@ D0FBE84F2273395C00B33B52 /* ChatListArchiveInfoItem.swift in Sources */, D0439B5B228EC4A00067E026 /* ChatMessagePhoneNumberRequestContentNode.swift in Sources */, 09F664D021EBCFB900AB7E26 /* WallpaperCropNode.swift in Sources */, - D097C26C20DD1EA5007BB4B8 /* OverlayStatusController.swift in Sources */, D0EC6D9E1EB9F58900EBF1C3 /* ChatMessageWebpageBubbleContentNode.swift in Sources */, D06CF82720D0080200AC4CFF /* SecureIdAuthListContentNode.swift in Sources */, 09797873210633CD0077D77F /* InstantPageSettingsButtonItemNode.swift in Sources */, @@ -5860,7 +5797,7 @@ 09FE756D2153F5F900A3120F /* CallRouteActionSheetItem.swift in Sources */, D0BFAE4E20AB1D7B00793CF2 /* DisabledContextResultsChatInputContextPanelNode.swift in Sources */, D064EF871F69A06F00AC0398 /* MessageContentKind.swift in Sources */, - D020A9DA1FEAE675008C66F7 /* OverlayPlayerController.swift in Sources */, + D020A9DA1FEAE675008C66F7 /* OverlayAudioPlayerController.swift in Sources */, 09CE9513223825B700A7D2C3 /* CustomWallpaperPicker.swift in Sources */, D0E8174C2011F8A300B82BBB /* ChatMessageEventLogPreviousMessageContentNode.swift in Sources */, D0EC6DD91EB9F58900EBF1C3 /* HorizontalListContextResultsChatInputContextPanelNode.swift in Sources */, @@ -5868,7 +5805,6 @@ D0EC6DDA1EB9F58900EBF1C3 /* HorizontalListContextResultsChatInputPanelItem.swift in Sources */, D0EC6DDB1EB9F58900EBF1C3 /* ChatInputPanelNode.swift in Sources */, D01BAA221ECE076100295217 /* CallListCallItem.swift in Sources */, - D0477D1B1F617E5800412B44 /* UniversalVideoNode.swift in Sources */, D0E9BA081F0446A300F079A4 /* BotCheckoutPaymentShippingOptionSheetController.swift in Sources */, D0EC6DDC1EB9F58900EBF1C3 /* ChatTextInputPanelNode.swift in Sources */, D06350AE2229A7F800FA2B32 /* InChatPrefetchManager.swift in Sources */, @@ -5955,7 +5891,6 @@ D0C26D571FDF2388004ABF18 /* OpenChatMessage.swift in Sources */, D00817CA22B47A14008A895F /* WatchRequestHandlers.swift in Sources */, D00817E222B47A14008A895F /* UIImage+ImageEffects.m in Sources */, - D0FA08BE20481EA300DD23FC /* Locale.swift in Sources */, D0E412CE206A707400BEE4A2 /* FormControllerTextItem.swift in Sources */, D007019C2029E8F2006B9E34 /* LegacyICloudFileController.swift in Sources */, 0902838D2194AEB90067EFBD /* ImageTransparency.swift in Sources */, @@ -6056,7 +5991,6 @@ D0E9BA651F055B4500F079A4 /* BotCheckoutNativeCardEntryController.swift in Sources */, D02D60B3206C18A600FEFE1E /* SecureIdPlaintextFormControllerNode.swift in Sources */, D00ACA5A2022897D0045D427 /* ProcessedPeerRestrictionText.swift in Sources */, - D0192D3C210A44D00005FA10 /* DeviceContactData.swift in Sources */, D04203152037162700490EA5 /* MediaInputPaneTrendingItem.swift in Sources */, D0EC6E3B1EB9F58900EBF1C3 /* ItemListPeerItem.swift in Sources */, D0EC6E3C1EB9F58900EBF1C3 /* ItemListPeerActionItem.swift in Sources */, @@ -6128,7 +6062,6 @@ D0F4B0222110972300912B92 /* ContactInfoStrings.swift in Sources */, D0EC6E5D1EB9F58900EBF1C3 /* PrivacyAndSecurityController.swift in Sources */, D0EC6E5E1EB9F58900EBF1C3 /* ItemListRecentSessionItem.swift in Sources */, - D00ADFDD1EBB73C200873D2E /* OverlayMediaManager.swift in Sources */, D056CD7C1FF3E92C00880D28 /* DirectionalPanGestureRecognizer.swift in Sources */, D0EC6E5F1EB9F58900EBF1C3 /* RecentSessionsController.swift in Sources */, D0EC6E601EB9F58900EBF1C3 /* BlockedPeersController.swift in Sources */, @@ -6202,7 +6135,6 @@ D093D80820654A2900BC3599 /* BotPaymentDateItemNode.swift in Sources */, D04281FE200E639A009DDE36 /* ChatRecentActionsTitleView.swift in Sources */, D0ACCB1C1EC5FF4B0079D8BF /* ChatMessageCallBubbleContentNode.swift in Sources */, - D046142E2004DB3700EC0EF2 /* LiveLocationManager.swift in Sources */, D05677511F4CA0C2001B723E /* InstantPagePeerReferenceItem.swift in Sources */, 09F664CE21EBB3A100AB7E26 /* ImageBlur.swift in Sources */, D0EC6E891EB9F58900EBF1C3 /* FrameworkBundle.swift in Sources */, diff --git a/submodules/TelegramUpdateUI/Sources/UpdateInfoController.swift b/submodules/TelegramUpdateUI/Sources/UpdateInfoController.swift index 2dbb0a709a..5e6b683696 100644 --- a/submodules/TelegramUpdateUI/Sources/UpdateInfoController.swift +++ b/submodules/TelegramUpdateUI/Sources/UpdateInfoController.swift @@ -99,17 +99,17 @@ public func updateInfoController(context: AccountContext, appUpdateInfo: AppUpda actionsDisposable.add(navigateDisposable) let arguments = UpdateInfoControllerArguments(openAppStorePage: { - context.genericSharedContext.applicationBindings.openAppStorePage() + context.sharedContext.applicationBindings.openAppStorePage() }, linkAction: { action, itemLink in linkActionImpl?(action, itemLink) }) - let signal = context.genericSharedContext.presentationData + let signal = context.sharedContext.presentationData |> deliverOnMainQueue |> map { presentationData -> (ItemListControllerState, (ItemListNodeState, UpdateInfoControllerEntry.ItemGenerationArguments)) in let appIcon: PresentationAppIcon? - let appIcons = context.genericSharedContext.applicationBindings.getAvailableAlternateIcons() - if let alternateIconName = context.genericSharedContext.applicationBindings.getAlternateIconName() { + let appIcons = context.sharedContext.applicationBindings.getAvailableAlternateIcons() + if let alternateIconName = context.sharedContext.applicationBindings.getAlternateIconName() { appIcon = appIcons.filter { $0.name == alternateIconName }.first } else { appIcon = appIcons.filter { $0.isDefault }.first @@ -127,10 +127,10 @@ public func updateInfoController(context: AccountContext, appUpdateInfo: AppUpda actionsDisposable.dispose() } - let controller = ItemListController(sharedContext: context.genericSharedContext, state: signal) + let controller = ItemListController(sharedContext: context.sharedContext, state: signal) linkActionImpl = { [weak controller, weak context] action, itemLink in if let strongController = controller, let context = context { - context.genericSharedContext.handleTextLinkAction(context: context, peerId: nil, navigateDisposable: navigateDisposable, controller: strongController, action: action, itemLink: itemLink) + context.sharedContext.handleTextLinkAction(context: context, peerId: nil, navigateDisposable: navigateDisposable, controller: strongController, action: action, itemLink: itemLink) } } dismissImpl = { [weak controller] in diff --git a/submodules/TemporaryCachedPeerDataManager/Info.plist b/submodules/TemporaryCachedPeerDataManager/Info.plist new file mode 100644 index 0000000000..e1fe4cfb7b --- /dev/null +++ b/submodules/TemporaryCachedPeerDataManager/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + + diff --git a/submodules/TelegramUI/TelegramUI/CachedChannelAdmins.swift b/submodules/TemporaryCachedPeerDataManager/Sources/CachedChannelAdmins.swift similarity index 53% rename from submodules/TelegramUI/TelegramUI/CachedChannelAdmins.swift rename to submodules/TemporaryCachedPeerDataManager/Sources/CachedChannelAdmins.swift index 961b3c67d5..65f2c6b33b 100644 --- a/submodules/TelegramUI/TelegramUI/CachedChannelAdmins.swift +++ b/submodules/TemporaryCachedPeerDataManager/Sources/CachedChannelAdmins.swift @@ -3,46 +3,46 @@ import Postbox import TelegramCore import SwiftSignalKit -enum CachedChannelAdminRank: PostboxCoding, Equatable { +public enum CachedChannelAdminRank: PostboxCoding, Equatable { case owner case admin case custom(String) - init(decoder: PostboxDecoder) { + public init(decoder: PostboxDecoder) { let value: Int32 = decoder.decodeInt32ForKey("v", orElse: 0) switch value { - case 0: - self = .owner - case 1: - self = .admin - case 2: - self = .custom(decoder.decodeStringForKey("s", orElse: "")) - default: - self = .admin + case 0: + self = .owner + case 1: + self = .admin + case 2: + self = .custom(decoder.decodeStringForKey("s", orElse: "")) + default: + self = .admin } } - func encode(_ encoder: PostboxEncoder) { + public func encode(_ encoder: PostboxEncoder) { switch self { - case .owner: - encoder.encodeInt32(0, forKey: "v") - case .admin: - encoder.encodeInt32(1, forKey: "v") - case let .custom(rank): - encoder.encodeInt32(2, forKey: "v") - encoder.encodeString(rank, forKey: "s") + case .owner: + encoder.encodeInt32(0, forKey: "v") + case .admin: + encoder.encodeInt32(1, forKey: "v") + case let .custom(rank): + encoder.encodeInt32(2, forKey: "v") + encoder.encodeString(rank, forKey: "s") } } } -final class CachedChannelAdminRanks: PostboxCoding { - let ranks: Dictionary +public final class CachedChannelAdminRanks: PostboxCoding { + public let ranks: Dictionary - init(ranks: Dictionary) { + public init(ranks: Dictionary) { self.ranks = ranks } - init(decoder: PostboxDecoder) { + public init(decoder: PostboxDecoder) { self.ranks = decoder.decodeObjectDictionaryForKey("ranks", keyDecoder: { decoder in return PeerId(decoder.decodeInt64ForKey("k", orElse: 0)) }, valueDecoder: { decoder in @@ -50,13 +50,13 @@ final class CachedChannelAdminRanks: PostboxCoding { }) } - func encode(_ encoder: PostboxEncoder) { + public func encode(_ encoder: PostboxEncoder) { encoder.encodeObjectDictionary(self.ranks, forKey: "ranks", keyEncoder: { key, encoder in encoder.encodeInt64(key.toInt64(), forKey: "k") }) } - static func cacheKey(peerId: PeerId) -> ValueBoxKey { + public static func cacheKey(peerId: PeerId) -> ValueBoxKey { let key = ValueBoxKey(length: 8) key.setInt64(0, value: peerId.toInt64()) return key @@ -65,11 +65,11 @@ final class CachedChannelAdminRanks: PostboxCoding { private let collectionSpec = ItemCacheCollectionSpec(lowWaterItemCount: 100, highWaterItemCount: 200) -func cachedChannelAdminRanksEntryId(peerId: PeerId) -> ItemCacheEntryId { +public func cachedChannelAdminRanksEntryId(peerId: PeerId) -> ItemCacheEntryId { return ItemCacheEntryId(collectionId: 100, key: CachedChannelAdminRanks.cacheKey(peerId: peerId)) } -func updateCachedChannelAdminRanks(postbox: Postbox, peerId: PeerId, ranks: Dictionary) -> Signal { +public func updateCachedChannelAdminRanks(postbox: Postbox, peerId: PeerId, ranks: Dictionary) -> Signal { return postbox.transaction { transaction -> Void in transaction.putItemCacheEntry(id: ItemCacheEntryId(collectionId: 100, key: CachedChannelAdminRanks.cacheKey(peerId: peerId)), entry: CachedChannelAdminRanks(ranks: ranks), collectionSpec: collectionSpec) } diff --git a/submodules/TelegramUI/TelegramUI/ChannelMemberCategoryListContext.swift b/submodules/TemporaryCachedPeerDataManager/Sources/ChannelMemberCategoryListContext.swift similarity index 98% rename from submodules/TelegramUI/TelegramUI/ChannelMemberCategoryListContext.swift rename to submodules/TemporaryCachedPeerDataManager/Sources/ChannelMemberCategoryListContext.swift index 856986c2f1..697dbed30a 100644 --- a/submodules/TelegramUI/TelegramUI/ChannelMemberCategoryListContext.swift +++ b/submodules/TemporaryCachedPeerDataManager/Sources/ChannelMemberCategoryListContext.swift @@ -8,12 +8,12 @@ private let defaultEmptyTimeout: Double = 2.0 * 60.0 private let headUpdateTimeout: Double = 30.0 private let requestBatchSize: Int32 = 64 -enum ChannelMemberListLoadingState: Equatable { +public enum ChannelMemberListLoadingState: Equatable { case loading(initial: Bool) case ready(hasMore: Bool) } -extension ChannelParticipant { +public extension ChannelParticipant { var adminInfo: ChannelParticipantAdminInfo? { switch self { case .creator: @@ -47,15 +47,15 @@ extension ChannelParticipant { } } -struct ChannelMemberListState { - let list: [RenderedChannelParticipant] - let loadingState: ChannelMemberListLoadingState +public struct ChannelMemberListState { + public let list: [RenderedChannelParticipant] + public let loadingState: ChannelMemberListLoadingState - func withUpdatedList(_ list: [RenderedChannelParticipant]) -> ChannelMemberListState { + public func withUpdatedList(_ list: [RenderedChannelParticipant]) -> ChannelMemberListState { return ChannelMemberListState(list: list, loadingState: self.loadingState) } - func withUpdatedLoadingState(_ loadingState: ChannelMemberListLoadingState) -> ChannelMemberListState { + public func withUpdatedLoadingState(_ loadingState: ChannelMemberListLoadingState) -> ChannelMemberListState { return ChannelMemberListState(list: self.list, loadingState: loadingState) } } @@ -618,7 +618,7 @@ private final class ChannelMemberMultiCategoryListContext: ChannelMemberCategory } } -struct PeerChannelMemberCategoryControl { +public struct PeerChannelMemberCategoryControl { fileprivate let key: PeerChannelMemberContextKey } diff --git a/submodules/TelegramUI/TelegramUI/PeerChannelMemberCategoriesContextsManager.swift b/submodules/TemporaryCachedPeerDataManager/Sources/PeerChannelMemberCategoriesContextsManager.swift similarity index 83% rename from submodules/TelegramUI/TelegramUI/PeerChannelMemberCategoriesContextsManager.swift rename to submodules/TemporaryCachedPeerDataManager/Sources/PeerChannelMemberCategoriesContextsManager.swift index 6b25b53bda..e7a6db92f3 100644 --- a/submodules/TelegramUI/TelegramUI/PeerChannelMemberCategoriesContextsManager.swift +++ b/submodules/TemporaryCachedPeerDataManager/Sources/PeerChannelMemberCategoriesContextsManager.swift @@ -2,6 +2,7 @@ import Foundation import Postbox import TelegramCore import SwiftSignalKit +import TelegramStringFormatting enum PeerChannelMemberContextKey: Equatable, Hashable { case recent @@ -121,16 +122,16 @@ private final class PeerChannelMemberCategoriesContextsManagerImpl { } } -final class PeerChannelMemberCategoriesContextsManager { +public final class PeerChannelMemberCategoriesContextsManager { private let impl: QueueLocalObject - init() { + public init() { self.impl = QueueLocalObject(queue: Queue.mainQueue(), generate: { return PeerChannelMemberCategoriesContextsManagerImpl() }) } - func loadMore(peerId: PeerId, control: PeerChannelMemberCategoryControl?) { + public func loadMore(peerId: PeerId, control: PeerChannelMemberCategoryControl?) { if let control = control { self.impl.with { impl in impl.loadMore(peerId: peerId, control: control) @@ -149,7 +150,7 @@ final class PeerChannelMemberCategoriesContextsManager { } } - func externallyAdded(peerId: PeerId, participant: RenderedChannelParticipant) { + public func externallyAdded(peerId: PeerId, participant: RenderedChannelParticipant) { self.impl.with { impl in for (contextPeerId, context) in impl.contexts { if contextPeerId == peerId { @@ -159,7 +160,7 @@ final class PeerChannelMemberCategoriesContextsManager { } } - func externallyRemoved(peerId: PeerId, memberId: PeerId) { + public func externallyRemoved(peerId: PeerId, memberId: PeerId) { self.impl.with { impl in for (contextPeerId, context) in impl.contexts { if contextPeerId == peerId { @@ -169,7 +170,7 @@ final class PeerChannelMemberCategoriesContextsManager { } } - func recent(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId, searchQuery: String? = nil, requestUpdate: Bool = true, updated: @escaping (ChannelMemberListState) -> Void) -> (Disposable, PeerChannelMemberCategoryControl?) { + public func recent(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId, searchQuery: String? = nil, requestUpdate: Bool = true, updated: @escaping (ChannelMemberListState) -> Void) -> (Disposable, PeerChannelMemberCategoryControl?) { let key: PeerChannelMemberContextKey if let searchQuery = searchQuery { key = .recentSearch(searchQuery) @@ -179,33 +180,31 @@ final class PeerChannelMemberCategoriesContextsManager { return self.getContext(postbox: postbox, network: network, accountPeerId: accountPeerId, peerId: peerId, key: key, requestUpdate: requestUpdate, updated: updated) } - - - func admins(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId, searchQuery: String? = nil, updated: @escaping (ChannelMemberListState) -> Void) -> (Disposable, PeerChannelMemberCategoryControl?) { + public func admins(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId, searchQuery: String? = nil, updated: @escaping (ChannelMemberListState) -> Void) -> (Disposable, PeerChannelMemberCategoryControl?) { return self.getContext(postbox: postbox, network: network, accountPeerId: accountPeerId, peerId: peerId, key: .admins(searchQuery), requestUpdate: true, updated: updated) } - func contacts(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId, searchQuery: String? = nil, updated: @escaping (ChannelMemberListState) -> Void) -> (Disposable, PeerChannelMemberCategoryControl?) { + public func contacts(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId, searchQuery: String? = nil, updated: @escaping (ChannelMemberListState) -> Void) -> (Disposable, PeerChannelMemberCategoryControl?) { return self.getContext(postbox: postbox, network: network, accountPeerId: accountPeerId, peerId: peerId, key: .contacts(searchQuery), requestUpdate: true, updated: updated) } - func bots(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId, searchQuery: String? = nil, updated: @escaping (ChannelMemberListState) -> Void) -> (Disposable, PeerChannelMemberCategoryControl?) { + public func bots(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId, searchQuery: String? = nil, updated: @escaping (ChannelMemberListState) -> Void) -> (Disposable, PeerChannelMemberCategoryControl?) { return self.getContext(postbox: postbox, network: network, accountPeerId: accountPeerId, peerId: peerId, key: .bots(searchQuery), requestUpdate: true, updated: updated) } - func restricted(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId, searchQuery: String? = nil, updated: @escaping (ChannelMemberListState) -> Void) -> (Disposable, PeerChannelMemberCategoryControl?) { + public func restricted(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId, searchQuery: String? = nil, updated: @escaping (ChannelMemberListState) -> Void) -> (Disposable, PeerChannelMemberCategoryControl?) { return self.getContext(postbox: postbox, network: network, accountPeerId: accountPeerId, peerId: peerId, key: .restricted(searchQuery), requestUpdate: true, updated: updated) } - func banned(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId, searchQuery: String? = nil, updated: @escaping (ChannelMemberListState) -> Void) -> (Disposable, PeerChannelMemberCategoryControl?) { + public func banned(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId, searchQuery: String? = nil, updated: @escaping (ChannelMemberListState) -> Void) -> (Disposable, PeerChannelMemberCategoryControl?) { return self.getContext(postbox: postbox, network: network, accountPeerId: accountPeerId, peerId: peerId, key: .banned(searchQuery), requestUpdate: true, updated: updated) } - func restrictedAndBanned(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId, searchQuery: String? = nil, updated: @escaping (ChannelMemberListState) -> Void) -> (Disposable, PeerChannelMemberCategoryControl?) { + public func restrictedAndBanned(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId, searchQuery: String? = nil, updated: @escaping (ChannelMemberListState) -> Void) -> (Disposable, PeerChannelMemberCategoryControl?) { return self.getContext(postbox: postbox, network: network, accountPeerId: accountPeerId, peerId: peerId, key: .restrictedAndBanned(searchQuery), requestUpdate: true, updated: updated) } - func updateMemberBannedRights(account: Account, peerId: PeerId, memberId: PeerId, bannedRights: TelegramChatBannedRights?) -> Signal { + public func updateMemberBannedRights(account: Account, peerId: PeerId, memberId: PeerId, bannedRights: TelegramChatBannedRights?) -> Signal { return updateChannelMemberBannedRights(account: account, peerId: peerId, memberId: memberId, rights: bannedRights) |> deliverOnMainQueue |> beforeNext { [weak self] (previous, updated, isMember) in @@ -224,7 +223,7 @@ final class PeerChannelMemberCategoriesContextsManager { } } - func updateMemberAdminRights(account: Account, peerId: PeerId, memberId: PeerId, adminRights: TelegramChatAdminRights, rank: String?) -> Signal { + public func updateMemberAdminRights(account: Account, peerId: PeerId, memberId: PeerId, adminRights: TelegramChatAdminRights, rank: String?) -> Signal { return updateChannelAdminRights(account: account, peerId: peerId, adminId: memberId, rights: adminRights, rank: rank) |> map(Optional.init) |> deliverOnMainQueue @@ -244,7 +243,7 @@ final class PeerChannelMemberCategoriesContextsManager { } } - func transferOwnership(account: Account, peerId: PeerId, memberId: PeerId, password: String) -> Signal { + public func transferOwnership(account: Account, peerId: PeerId, memberId: PeerId, password: String) -> Signal { return updateChannelOwnership(account: account, accountStateManager: account.stateManager, channelId: peerId, memberId: memberId, password: password) |> map(Optional.init) |> deliverOnMainQueue @@ -264,7 +263,7 @@ final class PeerChannelMemberCategoriesContextsManager { } } - func join(account: Account, peerId: PeerId) -> Signal { + public func join(account: Account, peerId: PeerId) -> Signal { return joinChannel(account: account, peerId: peerId) |> deliverOnMainQueue |> beforeNext { [weak self] result in @@ -281,7 +280,7 @@ final class PeerChannelMemberCategoriesContextsManager { |> ignoreValues } - func addMember(account: Account, peerId: PeerId, memberId: PeerId) -> Signal { + public func addMember(account: Account, peerId: PeerId, memberId: PeerId) -> Signal { return addChannelMember(account: account, peerId: peerId, memberId: memberId) |> deliverOnMainQueue |> beforeNext { [weak self] result in @@ -299,7 +298,7 @@ final class PeerChannelMemberCategoriesContextsManager { |> ignoreValues } - func addMembers(account: Account, peerId: PeerId, memberIds: [PeerId]) -> Signal { + public func addMembers(account: Account, peerId: PeerId, memberIds: [PeerId]) -> Signal { let signals: [Signal<(ChannelParticipant?, RenderedChannelParticipant)?, AddChannelMemberError>] = memberIds.map({ memberId in return addChannelMember(account: account, peerId: peerId, memberId: memberId) |> map(Optional.init) @@ -329,7 +328,7 @@ final class PeerChannelMemberCategoriesContextsManager { } } - func recentOnline(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId) -> Signal { + public func recentOnline(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId) -> Signal { return Signal { [weak self] subscriber in guard let strongSelf = self else { subscriber.putNext(0) @@ -346,7 +345,7 @@ final class PeerChannelMemberCategoriesContextsManager { |> runOn(Queue.mainQueue()) } - func recentOnlineSmall(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId) -> Signal { + public func recentOnlineSmall(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId) -> Signal { return Signal { [weak self] subscriber in var previousIds: Set? let statusesDisposable = MetaDisposable() @@ -394,5 +393,4 @@ final class PeerChannelMemberCategoriesContextsManager { } |> runOn(Queue.mainQueue()) } - } diff --git a/submodules/TemporaryCachedPeerDataManager/Sources/TemporaryCachedPeerDataManager.h b/submodules/TemporaryCachedPeerDataManager/Sources/TemporaryCachedPeerDataManager.h new file mode 100644 index 0000000000..dd954bf90a --- /dev/null +++ b/submodules/TemporaryCachedPeerDataManager/Sources/TemporaryCachedPeerDataManager.h @@ -0,0 +1,19 @@ +// +// TemporaryCachedPeerDataManager.h +// TemporaryCachedPeerDataManager +// +// Created by Peter on 8/5/19. +// Copyright © 2019 Telegram Messenger LLP. All rights reserved. +// + +#import + +//! Project version number for TemporaryCachedPeerDataManager. +FOUNDATION_EXPORT double TemporaryCachedPeerDataManagerVersionNumber; + +//! Project version string for TemporaryCachedPeerDataManager. +FOUNDATION_EXPORT const unsigned char TemporaryCachedPeerDataManagerVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/submodules/TemporaryCachedPeerDataManager/TemporaryCachedPeerDataManager_Xcode.xcodeproj/project.pbxproj b/submodules/TemporaryCachedPeerDataManager/TemporaryCachedPeerDataManager_Xcode.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..9f59af3686 --- /dev/null +++ b/submodules/TemporaryCachedPeerDataManager/TemporaryCachedPeerDataManager_Xcode.xcodeproj/project.pbxproj @@ -0,0 +1,569 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + D0879B3B22F7962800C4D6B3 /* TemporaryCachedPeerDataManager.h in Headers */ = {isa = PBXBuildFile; fileRef = D0879B3922F7962800C4D6B3 /* TemporaryCachedPeerDataManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D0879B4622F7972700C4D6B3 /* PeerChannelMemberCategoriesContextsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879B4522F7972600C4D6B3 /* PeerChannelMemberCategoriesContextsManager.swift */; }; + D0879B4922F7972E00C4D6B3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B4822F7972E00C4D6B3 /* Foundation.framework */; }; + D0879B4B22F7973100C4D6B3 /* Postbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B4A22F7973100C4D6B3 /* Postbox.framework */; }; + D0879B4F22F7973B00C4D6B3 /* TelegramCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B4E22F7973B00C4D6B3 /* TelegramCore.framework */; }; + D0879B5122F7974000C4D6B3 /* SwiftSignalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B5022F7974000C4D6B3 /* SwiftSignalKit.framework */; }; + D0879B5522F7975C00C4D6B3 /* TelegramStringFormatting.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879B5422F7975C00C4D6B3 /* TelegramStringFormatting.framework */; }; + D0879B5722F7977E00C4D6B3 /* ChannelMemberCategoryListContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879B5622F7977E00C4D6B3 /* ChannelMemberCategoryListContext.swift */; }; + D0879B5922F79D0200C4D6B3 /* CachedChannelAdmins.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879B5822F79D0200C4D6B3 /* CachedChannelAdmins.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + D0879B3622F7962800C4D6B3 /* TemporaryCachedPeerDataManager.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TemporaryCachedPeerDataManager.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B3922F7962800C4D6B3 /* TemporaryCachedPeerDataManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TemporaryCachedPeerDataManager.h; sourceTree = ""; }; + D0879B3A22F7962800C4D6B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D0879B4522F7972600C4D6B3 /* PeerChannelMemberCategoriesContextsManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PeerChannelMemberCategoriesContextsManager.swift; sourceTree = ""; }; + D0879B4822F7972E00C4D6B3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + D0879B4A22F7973100C4D6B3 /* Postbox.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Postbox.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B4C22F7973600C4D6B3 /* TelegramCoreMac.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramCoreMac.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B4E22F7973B00C4D6B3 /* TelegramCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B5022F7974000C4D6B3 /* SwiftSignalKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SwiftSignalKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B5422F7975C00C4D6B3 /* TelegramStringFormatting.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramStringFormatting.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0879B5622F7977E00C4D6B3 /* ChannelMemberCategoryListContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChannelMemberCategoryListContext.swift; sourceTree = ""; }; + D0879B5822F79D0200C4D6B3 /* CachedChannelAdmins.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CachedChannelAdmins.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + D0879B3322F7962800C4D6B3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879B5522F7975C00C4D6B3 /* TelegramStringFormatting.framework in Frameworks */, + D0879B5122F7974000C4D6B3 /* SwiftSignalKit.framework in Frameworks */, + D0879B4F22F7973B00C4D6B3 /* TelegramCore.framework in Frameworks */, + D0879B4B22F7973100C4D6B3 /* Postbox.framework in Frameworks */, + D0879B4922F7972E00C4D6B3 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + D0879B2C22F7962800C4D6B3 = { + isa = PBXGroup; + children = ( + D0879B3A22F7962800C4D6B3 /* Info.plist */, + D0879B3822F7962800C4D6B3 /* Sources */, + D0879B3722F7962800C4D6B3 /* Products */, + D0879B4722F7972E00C4D6B3 /* Frameworks */, + ); + sourceTree = ""; + }; + D0879B3722F7962800C4D6B3 /* Products */ = { + isa = PBXGroup; + children = ( + D0879B3622F7962800C4D6B3 /* TemporaryCachedPeerDataManager.framework */, + ); + name = Products; + sourceTree = ""; + }; + D0879B3822F7962800C4D6B3 /* Sources */ = { + isa = PBXGroup; + children = ( + D0879B5822F79D0200C4D6B3 /* CachedChannelAdmins.swift */, + D0879B5622F7977E00C4D6B3 /* ChannelMemberCategoryListContext.swift */, + D0879B4522F7972600C4D6B3 /* PeerChannelMemberCategoriesContextsManager.swift */, + D0879B3922F7962800C4D6B3 /* TemporaryCachedPeerDataManager.h */, + ); + path = Sources; + sourceTree = ""; + }; + D0879B4722F7972E00C4D6B3 /* Frameworks */ = { + isa = PBXGroup; + children = ( + D0879B5422F7975C00C4D6B3 /* TelegramStringFormatting.framework */, + D0879B5022F7974000C4D6B3 /* SwiftSignalKit.framework */, + D0879B4E22F7973B00C4D6B3 /* TelegramCore.framework */, + D0879B4C22F7973600C4D6B3 /* TelegramCoreMac.framework */, + D0879B4A22F7973100C4D6B3 /* Postbox.framework */, + D0879B4822F7972E00C4D6B3 /* Foundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + D0879B3122F7962800C4D6B3 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879B3B22F7962800C4D6B3 /* TemporaryCachedPeerDataManager.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + D0879B3522F7962800C4D6B3 /* TemporaryCachedPeerDataManager */ = { + isa = PBXNativeTarget; + buildConfigurationList = D0879B3E22F7962800C4D6B3 /* Build configuration list for PBXNativeTarget "TemporaryCachedPeerDataManager" */; + buildPhases = ( + D0879B3122F7962800C4D6B3 /* Headers */, + D0879B3222F7962800C4D6B3 /* Sources */, + D0879B3322F7962800C4D6B3 /* Frameworks */, + D0879B3422F7962800C4D6B3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = TemporaryCachedPeerDataManager; + productName = TemporaryCachedPeerDataManager; + productReference = D0879B3622F7962800C4D6B3 /* TemporaryCachedPeerDataManager.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + D0879B2D22F7962800C4D6B3 /* Project object */ = { + isa = PBXProject; + attributes = { + DefaultBuildSystemTypeForWorkspace = Latest; + LastUpgradeCheck = 1030; + ORGANIZATIONNAME = "Telegram Messenger LLP"; + TargetAttributes = { + D0879B3522F7962800C4D6B3 = { + CreatedOnToolsVersion = 10.3; + LastSwiftMigration = 1030; + }; + }; + }; + buildConfigurationList = D0879B3022F7962800C4D6B3 /* Build configuration list for PBXProject "TemporaryCachedPeerDataManager_Xcode" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = D0879B2C22F7962800C4D6B3; + productRefGroup = D0879B3722F7962800C4D6B3 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + D0879B3522F7962800C4D6B3 /* TemporaryCachedPeerDataManager */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + D0879B3422F7962800C4D6B3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + D0879B3222F7962800C4D6B3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D0879B4622F7972700C4D6B3 /* PeerChannelMemberCategoriesContextsManager.swift in Sources */, + D0879B5722F7977E00C4D6B3 /* ChannelMemberCategoryListContext.swift in Sources */, + D0879B5922F79D0200C4D6B3 /* CachedChannelAdmins.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + D0879B3C22F7962800C4D6B3 /* DebugAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = DebugAppStoreLLC; + }; + D0879B3D22F7962800C4D6B3 /* ReleaseAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = ReleaseAppStoreLLC; + }; + D0879B3F22F7962800C4D6B3 /* DebugAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TemporaryCachedPeerDataManager; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = DebugAppStoreLLC; + }; + D0879B4022F7962800C4D6B3 /* ReleaseAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TemporaryCachedPeerDataManager; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = ReleaseAppStoreLLC; + }; + D0879B4122F7964C00C4D6B3 /* DebugHockeyapp */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = DebugHockeyapp; + }; + D0879B4222F7964C00C4D6B3 /* DebugHockeyapp */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TemporaryCachedPeerDataManager; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = DebugHockeyapp; + }; + D0879B4322F7965C00C4D6B3 /* ReleaseHockeyappInternal */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = ReleaseHockeyappInternal; + }; + D0879B4422F7965C00C4D6B3 /* ReleaseHockeyappInternal */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TemporaryCachedPeerDataManager; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = ReleaseHockeyappInternal; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + D0879B3022F7962800C4D6B3 /* Build configuration list for PBXProject "TemporaryCachedPeerDataManager_Xcode" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D0879B3C22F7962800C4D6B3 /* DebugAppStoreLLC */, + D0879B4122F7964C00C4D6B3 /* DebugHockeyapp */, + D0879B3D22F7962800C4D6B3 /* ReleaseAppStoreLLC */, + D0879B4322F7965C00C4D6B3 /* ReleaseHockeyappInternal */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ReleaseAppStoreLLC; + }; + D0879B3E22F7962800C4D6B3 /* Build configuration list for PBXNativeTarget "TemporaryCachedPeerDataManager" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D0879B3F22F7962800C4D6B3 /* DebugAppStoreLLC */, + D0879B4222F7964C00C4D6B3 /* DebugHockeyapp */, + D0879B4022F7962800C4D6B3 /* ReleaseAppStoreLLC */, + D0879B4422F7965C00C4D6B3 /* ReleaseHockeyappInternal */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ReleaseAppStoreLLC; + }; +/* End XCConfigurationList section */ + }; + rootObject = D0879B2D22F7962800C4D6B3 /* Project object */; +}