Merge branch 'beta'

# Conflicts:
#	submodules/Display/Source/TextNode.swift
This commit is contained in:
Ali 2023-07-18 22:14:30 +04:00
commit 541f335cac
4 changed files with 25 additions and 72 deletions

View File

@ -53,7 +53,7 @@ final class PeerInfoStoryGridScreenComponent: Component {
private weak var state: EmptyComponentState?
private var environment: EnvironmentType?
private var paneNode: PeerInfoStoryPaneNode?
private(set) var paneNode: PeerInfoStoryPaneNode?
private var paneStatusDisposable: Disposable?
private(set) var paneStatusText: String?
@ -171,74 +171,6 @@ final class PeerInfoStoryGridScreenComponent: Component {
self.environment?.controller()?.push(PeerInfoStoryGridScreen(context: component.context, peerId: component.peerId, scope: .archive))
})))
}
/*if photoCount != 0 && videoCount != 0 {
items.append(.separator)
let showPhotos: Bool
switch pane.contentType {
case .photo, .photoOrVideo:
showPhotos = true
default:
showPhotos = false
}
let showVideos: Bool
switch pane.contentType {
case .video, .photoOrVideo:
showVideos = true
default:
showVideos = false
}
items.append(.action(ContextMenuActionItem(text: strings.SharedMedia_ShowPhotos, icon: { theme in
if !showPhotos {
return nil
}
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Check"), color: theme.contextMenu.primaryColor)
}, action: { [weak pane] _, a in
a(.default)
guard let pane = pane else {
return
}
let updatedContentType: PeerInfoVisualMediaPaneNode.ContentType
switch pane.contentType {
case .photoOrVideo:
updatedContentType = .video
case .photo:
updatedContentType = .photo
case .video:
updatedContentType = .photoOrVideo
default:
updatedContentType = pane.contentType
}
pane.updateContentType(contentType: updatedContentType)
})))
items.append(.action(ContextMenuActionItem(text: strings.SharedMedia_ShowVideos, icon: { theme in
if !showVideos {
return nil
}
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Check"), color: theme.contextMenu.primaryColor)
}, action: { [weak pane] _, a in
a(.default)
guard let pane = pane else {
return
}
let updatedContentType: PeerInfoVisualMediaPaneNode.ContentType
switch pane.contentType {
case .photoOrVideo:
updatedContentType = .photo
case .photo:
updatedContentType = .photoOrVideo
case .video:
updatedContentType = .video
default:
updatedContentType = pane.contentType
}
pane.updateContentType(contentType: updatedContentType)
})))
}*/
}
let contextController = ContextController(account: component.context.account, presentationData: presentationData, source: .reference(PeerInfoContextReferenceContentSource(controller: controller, sourceNode: source)), items: .single(ContextController.Items(content: .list(items))), gesture: nil)
@ -554,8 +486,6 @@ public class PeerInfoStoryGridScreen: ViewControllerComponentContainer {
}
moreBarButton.addTarget(self, action: #selector(self.morePressed), forControlEvents: .touchUpInside)
self.navigationItem.setRightBarButton(moreBarButtonItem, animated: false)
self.titleView = ChatTitleView(
context: context, theme:
presentationData.theme,
@ -594,6 +524,8 @@ public class PeerInfoStoryGridScreen: ViewControllerComponentContainer {
title = nil
}
self.titleView?.titleContent = .custom(presentationData.strings.StoryList_TitleSaved, title, false)
self.navigationItem.setRightBarButton(self.moreBarButtonItem, animated: false)
case .archive:
guard let componentView = self.node.hostView.componentView as? PeerInfoStoryGridScreenComponent.View else {
return
@ -605,6 +537,19 @@ public class PeerInfoStoryGridScreen: ViewControllerComponentContainer {
title = presentationData.strings.StoryList_TitleArchive
}
self.titleView?.titleContent = .custom(title, nil, false)
var hasMenu = false
if componentView.selectedCount != 0 {
hasMenu = true
} else if let paneNode = componentView.paneNode, !paneNode.isEmpty {
hasMenu = true
}
if hasMenu {
self.navigationItem.setRightBarButton(self.moreBarButtonItem, animated: false)
} else {
self.navigationItem.setRightBarButton(nil, animated: false)
}
}
}

View File

@ -171,6 +171,13 @@ public extension StoryContainerScreen {
|> take(1)
|> mapToSignal { state -> Signal<StoryContentContextState, NoError> in
if let slice = state.slice {
#if DEBUG && true
if "".isEmpty {
return .single(state)
|> delay(4.0, queue: .mainQueue())
}
#endif
return waitUntilStoryMediaPreloaded(context: context, peerId: slice.peer.id, storyItem: slice.item.storyItem)
|> timeout(4.0, queue: .mainQueue(), alternate: .complete())
|> map { _ -> StoryContentContextState in

View File

@ -374,6 +374,7 @@ public final class StoryPeerListComponent: Component {
self.scrollContainerView = UIView()
self.scrollContainerView.clipsToBounds = true
self.scrollContainerView.isExclusiveTouch = true
self.titleView = UIImageView()
self.titleView.layer.anchorPoint = CGPoint(x: 0.0, y: 0.5)

@ -1 +1 @@
Subproject commit ef358c48b05ccd59319a7ceded340b75baffa751
Subproject commit ebc8452d3a0d0bc18822b4eb6ca61ec8fa7a70a5