Merge commit 'c1030b193da6bdda70e855e7c290b4bbcd1cb5c3'

This commit is contained in:
Ali 2019-11-01 13:54:41 +04:00
commit 7a01746ef7
10 changed files with 1499 additions and 1385 deletions

View File

@ -5012,6 +5012,7 @@ Any member of this group will be able to see messages in the channel.";
"ClearCache.FreeSpaceDescription" = "If you want to save space on your device, you don't need to delete anything.\n\nYou can use cache settings to remove unnecessary media — and re-download files if you need them again.";
"ClearCache.FreeSpace" = "Free Space";
"ClearCache.Success" = "**%@** freed on your %@!";
"ClearCache.StorageUsage" = "Storage Usage";
"Conversation.ScheduleMessage.SendWhenOnline" = "Send When Online";
"ScheduledMessages.ScheduledOnline" = "Scheduled until online";

View File

@ -140,7 +140,7 @@ private func galleryMessageCaptionText(_ message: Message) -> String {
return message.text
}
public 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 }, storeMediaPlaybackState: @escaping (MessageId, Double?) -> Void = { _, _ in }) -> GalleryItem? {
public 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, configuration: GalleryConfiguration? = nil, tempFilePath: String? = nil, playbackCompleted: @escaping () -> Void = {}, performAction: @escaping (GalleryControllerInteractionTapAction) -> Void = { _ in }, openActionOptions: @escaping (GalleryControllerInteractionTapAction) -> Void = { _ in }, storeMediaPlaybackState: @escaping (MessageId, Double?) -> Void = { _, _ in }) -> GalleryItem? {
let message = entry.message
let location = entry.location
if let (media, mediaImage) = mediaForMessage(message: message) {
@ -173,7 +173,7 @@ public func galleryItemForEntry(context: AccountContext, presentationData: Prese
}
let caption = galleryCaptionStringWithAppliedEntities(text, entities: entities)
return UniversalVideoGalleryItem(context: context, presentationData: presentationData, content: content, originData: GalleryItemOriginData(title: message.effectiveAuthor?.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), timestamp: message.timestamp), indexData: location.flatMap { GalleryItemIndexData(position: Int32($0.index), totalCount: Int32($0.count)) }, contentInfo: .message(message), caption: caption, hideControls: hideControls, fromPlayingVideo: fromPlayingVideo, landscape: landscape, timecode: timecode, playbackCompleted: playbackCompleted, performAction: performAction, openActionOptions: openActionOptions, storeMediaPlaybackState: storeMediaPlaybackState)
return UniversalVideoGalleryItem(context: context, presentationData: presentationData, content: content, originData: GalleryItemOriginData(title: message.effectiveAuthor?.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), timestamp: message.timestamp), indexData: location.flatMap { GalleryItemIndexData(position: Int32($0.index), totalCount: Int32($0.count)) }, contentInfo: .message(message), caption: caption, hideControls: hideControls, fromPlayingVideo: fromPlayingVideo, landscape: landscape, timecode: timecode, configuration: configuration, playbackCompleted: playbackCompleted, performAction: performAction, openActionOptions: openActionOptions, storeMediaPlaybackState: storeMediaPlaybackState)
} else {
if let fileName = file.fileName, (fileName as NSString).pathExtension.lowercased() == "json" {
return ChatAnimationGalleryItem(context: context, presentationData: presentationData, message: message, location: location)
@ -212,7 +212,7 @@ public func galleryItemForEntry(context: AccountContext, presentationData: Prese
}
}
if let content = content {
return UniversalVideoGalleryItem(context: context, presentationData: presentationData, content: content, originData: GalleryItemOriginData(title: message.effectiveAuthor?.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), timestamp: message.timestamp), indexData: location.flatMap { GalleryItemIndexData(position: Int32($0.index), totalCount: Int32($0.count)) }, contentInfo: .message(message), caption: NSAttributedString(string: ""), fromPlayingVideo: fromPlayingVideo, landscape: landscape, timecode: timecode, performAction: performAction, openActionOptions: openActionOptions, storeMediaPlaybackState: storeMediaPlaybackState)
return UniversalVideoGalleryItem(context: context, presentationData: presentationData, content: content, originData: GalleryItemOriginData(title: message.effectiveAuthor?.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), timestamp: message.timestamp), indexData: location.flatMap { GalleryItemIndexData(position: Int32($0.index), totalCount: Int32($0.count)) }, contentInfo: .message(message), caption: NSAttributedString(string: ""), fromPlayingVideo: fromPlayingVideo, landscape: landscape, timecode: timecode, configuration: configuration, performAction: performAction, openActionOptions: openActionOptions, storeMediaPlaybackState: storeMediaPlaybackState)
} else {
return nil
}
@ -273,6 +273,26 @@ public enum GalleryControllerItemNodeAction {
case timecode(Double)
}
public struct GalleryConfiguration {
static var defaultValue: GalleryConfiguration {
return GalleryConfiguration(youtubePictureInPictureEnabled: false)
}
public let youtubePictureInPictureEnabled: Bool
fileprivate init(youtubePictureInPictureEnabled: Bool) {
self.youtubePictureInPictureEnabled = youtubePictureInPictureEnabled
}
static func with(appConfiguration: AppConfiguration) -> GalleryConfiguration {
if let data = appConfiguration.data, let value = data["youtube_pip"] as? String {
return GalleryConfiguration(youtubePictureInPictureEnabled: value != "disabled")
} else {
return .defaultValue
}
}
}
public class GalleryController: ViewController, StandalonePresentableController {
public 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)
public 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)
@ -305,6 +325,7 @@ public class GalleryController: ViewController, StandalonePresentableController
private var entries: [MessageHistoryEntry] = []
private var centralEntryStableId: UInt32?
private var configuration: GalleryConfiguration?
private let centralItemTitle = Promise<String>()
private let centralItemTitleView = Promise<UIView?>()
@ -397,10 +418,14 @@ public class GalleryController: ViewController, StandalonePresentableController
}
let syncResult = Atomic<(Bool, (() -> Void)?)>(value: (false, nil))
self.disposable.set(messageView.start(next: { [weak self] view in
self.disposable.set(combineLatest(messageView, self.context.account.postbox.preferencesView(keys: [PreferencesKeys.appConfiguration])).start(next: { [weak self] view, preferencesView in
let f: () -> Void = {
if let strongSelf = self {
if let view = view {
let appConfiguration: AppConfiguration = preferencesView.values[PreferencesKeys.appConfiguration] as? AppConfiguration ?? .defaultValue
let configuration = GalleryConfiguration.with(appConfiguration: appConfiguration)
strongSelf.configuration = configuration
let entries = view.entries
var centralEntryStableId: UInt32?
loop: for i in 0 ..< entries.count {
@ -418,6 +443,7 @@ public class GalleryController: ViewController, StandalonePresentableController
}
}
}
if invertItemOrder {
strongSelf.entries = entries.reversed()
if let centralEntryStableId = centralEntryStableId {
@ -435,7 +461,7 @@ public class GalleryController: ViewController, StandalonePresentableController
if entry.message.stableId == strongSelf.centralEntryStableId {
isCentral = true
}
if let item = galleryItemForEntry(context: context, presentationData: strongSelf.presentationData, entry: entry, isCentral: isCentral, streamVideos: streamSingleVideo, fromPlayingVideo: isCentral && fromPlayingVideo, landscape: isCentral && landscape, timecode: isCentral ? timecode : nil, performAction: strongSelf.performAction, openActionOptions: strongSelf.openActionOptions, storeMediaPlaybackState: strongSelf.actionInteraction?.storeMediaPlaybackState ?? { _, _ in }) {
if let item = galleryItemForEntry(context: context, presentationData: strongSelf.presentationData, entry: entry, isCentral: isCentral, streamVideos: streamSingleVideo, fromPlayingVideo: isCentral && fromPlayingVideo, landscape: isCentral && landscape, timecode: isCentral ? timecode : nil, configuration: configuration, performAction: strongSelf.performAction, openActionOptions: strongSelf.openActionOptions, storeMediaPlaybackState: strongSelf.actionInteraction?.storeMediaPlaybackState ?? { _, _ in }) {
if isCentral {
centralItemIndex = items.count
}
@ -857,7 +883,7 @@ public class GalleryController: ViewController, StandalonePresentableController
if entry.message.stableId == self.centralEntryStableId {
isCentral = true
}
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, storeMediaPlaybackState: self.actionInteraction?.storeMediaPlaybackState ?? { _, _ in }) {
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, configuration: self.configuration, performAction: self.performAction, openActionOptions: self.openActionOptions, storeMediaPlaybackState: self.actionInteraction?.storeMediaPlaybackState ?? { _, _ in }) {
if isCentral {
centralItemIndex = items.count
}

View File

@ -31,12 +31,13 @@ public class UniversalVideoGalleryItem: GalleryItem {
let fromPlayingVideo: Bool
let landscape: Bool
let timecode: Double?
let configuration: GalleryConfiguration?
let playbackCompleted: () -> Void
let performAction: (GalleryControllerInteractionTapAction) -> Void
let openActionOptions: (GalleryControllerInteractionTapAction) -> Void
let storeMediaPlaybackState: (MessageId, Double?) -> Void
public 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, storeMediaPlaybackState: @escaping (MessageId, Double?) -> Void) {
public 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, configuration: GalleryConfiguration? = nil, playbackCompleted: @escaping () -> Void = {}, performAction: @escaping (GalleryControllerInteractionTapAction) -> Void, openActionOptions: @escaping (GalleryControllerInteractionTapAction) -> Void, storeMediaPlaybackState: @escaping (MessageId, Double?) -> Void) {
self.context = context
self.presentationData = presentationData
self.content = content
@ -49,6 +50,7 @@ public class UniversalVideoGalleryItem: GalleryItem {
self.fromPlayingVideo = fromPlayingVideo
self.landscape = landscape
self.timecode = timecode
self.configuration = configuration
self.playbackCompleted = playbackCompleted
self.performAction = performAction
self.openActionOptions = openActionOptions
@ -351,6 +353,7 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
self.dismissOnOrientationChange = item.landscape
var disablePictureInPicture = false
var disablePlayerControls = false
var isAnimated = false
if let content = item.content as? NativeVideoContent {
@ -358,8 +361,16 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
self.videoFramePreview = MediaPlayerFramePreview(postbox: item.context.account.postbox, fileReference: content.fileReference)
} else if let _ = item.content as? SystemVideoContent {
self._title.set(.single(item.presentationData.strings.Message_Video))
} else if let content = item.content as? WebEmbedVideoContent, case .iframe = webEmbedType(content: content.webpageContent) {
disablePlayerControls = true
} else if let content = item.content as? WebEmbedVideoContent {
let type = webEmbedType(content: content.webpageContent)
switch type {
case .youtube:
disablePictureInPicture = !(item.configuration?.youtubePictureInPictureEnabled ?? false)
case .iframe:
disablePlayerControls = true
default:
break
}
}
if let videoNode = self.videoNode {

View File

@ -1252,17 +1252,14 @@ public func settingsController(context: AccountContext, accountManager: AccountM
)
)
let hasWatchApp = Promise<Bool>(false)
hasWatchApp.set(
contextValue.get()
|> mapToSignal { context -> Signal<Bool, NoError> in
if let watchManager = context.watchManager {
return watchManager.watchAppInstalled
} else {
return .single(false)
}
let hasWatchApp = contextValue.get()
|> mapToSignal { context -> Signal<Bool, NoError> in
if let watchManager = context.watchManager {
return watchManager.watchAppInstalled
} else {
return .single(false)
}
)
}
let updatedPresentationData = contextValue.get()
|> mapToSignal { context -> Signal<PresentationData, NoError> in
@ -1280,7 +1277,7 @@ public func settingsController(context: AccountContext, accountManager: AccountM
return context.account.viewTracker.featuredStickerPacks()
}
let signal = combineLatest(queue: Queue.mainQueue(), contextValue.get(), updatedPresentationData, statePromise.get(), peerView, combineLatest(queue: Queue.mainQueue(), preferences, notifyExceptions.get(), notificationsAuthorizationStatus.get(), notificationsWarningSuppressed.get(), privacySettings.get(), displayPhoneNumberConfirmation.get()), combineLatest(featuredStickerPacks, archivedPacks.get()), combineLatest(hasWallet, hasPassport.get(), hasWatchApp.get()), accountsAndPeers.get())
let signal = combineLatest(queue: Queue.mainQueue(), contextValue.get(), updatedPresentationData, statePromise.get(), peerView, combineLatest(queue: Queue.mainQueue(), preferences, notifyExceptions.get(), notificationsAuthorizationStatus.get(), notificationsWarningSuppressed.get(), privacySettings.get(), displayPhoneNumberConfirmation.get()), combineLatest(featuredStickerPacks, archivedPacks.get()), combineLatest(hasWallet, hasPassport.get(), hasWatchApp), accountsAndPeers.get())
|> map { context, presentationData, state, view, preferencesAndExceptions, featuredAndArchived, hasWalletPassportAndWatch, accountsAndPeers -> (ItemListControllerState, (ItemListNodeState, Any)) in
let proxySettings: ProxySettings = preferencesAndExceptions.0.entries[SharedDataKeys.proxySettings] as? ProxySettings ?? ProxySettings.defaultSettings
let inAppNotificationSettings: InAppNotificationSettings = preferencesAndExceptions.0.entries[ApplicationSpecificSharedDataKeys.inAppNotificationSettings] as? InAppNotificationSettings ?? InAppNotificationSettings.defaultSettings

View File

@ -126,9 +126,9 @@ private func makeDarkPresentationTheme(accentColor: UIColor, baseColor: Presenta
)
let switchColors = PresentationThemeSwitch(
frameColor: UIColor(rgb: 0x5a5a5e),
frameColor: UIColor(rgb: 0x39393d),
handleColor: UIColor(rgb: 0x121212),
contentColor: UIColor(rgb: 0x77d572),
contentColor: UIColor(rgb: 0x67ce67),
positiveColor: constructiveColor,
negativeColor: destructiveColor
)
@ -137,8 +137,8 @@ private func makeDarkPresentationTheme(accentColor: UIColor, baseColor: Presenta
blocksBackgroundColor: UIColor(rgb: 0x000000),
plainBackgroundColor: UIColor(rgb: 0x000000),
itemPrimaryTextColor: UIColor(rgb: 0xffffff),
itemSecondaryTextColor: UIColor(rgb: 0x8f8f8f),
itemDisabledTextColor: UIColor(rgb: 0x4d4d4d),
itemSecondaryTextColor: UIColor(rgb: 0x98989e),
itemDisabledTextColor: UIColor(rgb: 0x8f8f8f),
itemAccentColor: accentColor,
itemHighlightedColor: UIColor(rgb: 0x28b772),
itemDestructiveColor: destructiveColor,

View File

@ -110,9 +110,9 @@ private func makeDefaultDayPresentationTheme(accentColor: UIColor, serviceBackgr
)
let switchColors = PresentationThemeSwitch(
frameColor: UIColor(rgb: 0xe0e0e0),
frameColor: UIColor(rgb: 0xe9e9ea),
handleColor: UIColor(rgb: 0xffffff),
contentColor: UIColor(rgb: 0x77d572),
contentColor: UIColor(rgb: 0x35c759),
positiveColor: constructiveColor,
negativeColor: destructiveColor
)

View File

@ -1613,24 +1613,79 @@ final class SharedApplicationContext {
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
if #available(iOS 10.0, *) {
if let startCallIntent = userActivity.interaction?.intent as? SupportedStartCallIntent {
guard let context = self.contextValue?.context else {
return true
}
let startCall: (Int32) -> Void = { userId in
let _ = context.sharedContext.callManager?.requestCall(account: context.account, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), endCurrentIfAny: false)
}
func cleanPhoneNumber(_ text: String) -> String {
var result = ""
for c in text {
if c == "+" {
if result.isEmpty {
result += String(c)
}
} else if c >= "0" && c <= "9" {
result += String(c)
}
}
return result
}
func matchPhoneNumbers(_ lhs: String, _ rhs: String) -> Bool {
if lhs.count < 10 && lhs.count == rhs.count {
return lhs == rhs
} else if lhs.count >= 10 && rhs.count >= 10 && lhs.suffix(10) == rhs.suffix(10) {
return true
} else {
return false
}
}
if let contact = startCallIntent.contacts?.first {
var processed = false
if let handle = contact.personHandle?.value {
if let userId = Int32(handle) {
if let context = self.contextValue {
let _ = context.context.sharedContext.callManager?.requestCall(account: context.context.account, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), endCurrentIfAny: false)
processed = true
}
}
}
if !processed, let handle = contact.customIdentifier, handle.hasPrefix("tg") {
if let handle = contact.customIdentifier, handle.hasPrefix("tg") {
let string = handle.suffix(from: handle.index(handle.startIndex, offsetBy: 2))
if let userId = Int32(string) {
if let context = self.contextValue {
let _ = context.context.sharedContext.callManager?.requestCall(account: context.context.account, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), endCurrentIfAny: false)
}
startCall(userId)
processed = true
}
}
if !processed, let handle = contact.personHandle, let value = handle.value {
switch handle.type {
case .unknown:
if let userId = Int32(value) {
startCall(userId)
processed = true
}
case .phoneNumber:
let phoneNumber = cleanPhoneNumber(value)
if !phoneNumber.isEmpty {
let _ = (context.account.postbox.transaction { transaction -> PeerId? in
var result: PeerId?
for peerId in transaction.getContactPeerIds() {
if let peer = transaction.getPeer(peerId) as? TelegramUser, let peerPhoneNumber = peer.phone {
if matchPhoneNumbers(phoneNumber, peerPhoneNumber) {
result = peer.id
break
}
}
}
return result
} |> deliverOnMainQueue).start(next: { peerId in
if let peerId = peerId {
startCall(peerId.id)
}
})
processed = true
}
default:
break
}
}
}
} else if let sendMessageIntent = userActivity.interaction?.intent as? INSendMessageIntent {
if let contact = sendMessageIntent.recipients?.first, let handle = contact.customIdentifier, handle.hasPrefix("tg") {

View File

@ -187,6 +187,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
private let enqueueMediaMessageDisposable = MetaDisposable()
private var resolvePeerByNameDisposable: MetaDisposable?
private var shareStatusDisposable: MetaDisposable?
private var clearCacheDisposable: MetaDisposable?
private let editingMessage = ValuePromise<Float?>(nil, ignoreRepeated: true)
private let startingBot = ValuePromise<Bool>(false, ignoreRepeated: true)
@ -2314,6 +2315,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
self.enqueueMediaMessageDisposable.dispose()
self.resolvePeerByNameDisposable?.dispose()
self.shareStatusDisposable?.dispose()
self.clearCacheDisposable?.dispose()
self.botCallbackAlertMessageDisposable?.dispose()
self.selectMessagePollOptionDisposables?.dispose()
for (_, info) in self.contextQueryStates {
@ -5117,7 +5119,16 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
case .dismiss:
self.dismiss()
case .clearCache:
let clearDisposable = MetaDisposable()
let controller = OverlayStatusController(theme: self.presentationData.theme, type: .loading(cancelled: nil))
self.present(controller, in: .window(.root))
let disposable: MetaDisposable
if let currentDisposable = self.clearCacheDisposable {
disposable = currentDisposable
} else {
disposable = MetaDisposable()
self.clearCacheDisposable = disposable
}
switch self.chatLocationInfoData {
case let .peer(peerView):
@ -5130,8 +5141,10 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
let peerId = peer.id
let cacheUsageStats = (collectCacheUsageStats(account: strongSelf.context.account, peerId: peer.id)
|> deliverOnMainQueue).start(next: { [weak self] result in
guard let strongSelf = self, case let .result(stats) = result, var categories = stats.media[peer.id] else {
|> deliverOnMainQueue).start(next: { [weak self, weak controller] result in
controller?.dismiss()
guard let strongSelf = self, case let .result(stats) = result, var categories = stats.media[peer.id] else {
return
}
let presentationData = strongSelf.presentationData
@ -5274,9 +5287,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
}
cancelImpl = {
clearDisposable.set(nil)
disposable.set(nil)
}
clearDisposable.set((signal
disposable.set((signal
|> deliverOnMainQueue).start(completed: { [weak self] in
if let strongSelf = self, let layout = strongSelf.validLayout {
let deviceName = UIDevice.current.userInterfaceIdiom == .pad ? "iPad" : "iPhone"
@ -5285,10 +5298,19 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}))
dismissAction()
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, { $0.updatedInterfaceState({ $0.withoutSelectionState() }) })
}))
items.append(ActionSheetButtonItem(title: presentationData.strings.ClearCache_StorageUsage, action: { [weak self] in
dismissAction()
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, { $0.updatedInterfaceState({ $0.withoutSelectionState() }) })
if let strongSelf = self {
let controller = storageUsageController(context: strongSelf.context, isModal: true)
strongSelf.present(controller, in: .window(.root), with: ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
}
}))
controller.setItemGroups([
ActionSheetItemGroup(items: items),
ActionSheetItemGroup(items: [ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, action: { dismissAction() })])
@ -7766,7 +7788,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
})
])])
self.chatDisplayNode.dismissInput()
self.present(actionSheet, in: .window(.root))
self.presentInGlobalOverlay(actionSheet)
//self.present(actionSheet, in: .window(.root))
}
@available(iOSApplicationExtension 11.0, iOS 11.0, *)