diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index bf0539a5c4..9c8be390a0 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -15984,7 +15984,7 @@ Error: %8$@"; "Notification.PollAddedOptionYou" = "You added the option \"%1$@\" to the poll"; "Notification.PollDeletedOption" = "%1$@ deleted the option \"%2$@\" from the poll"; -"Notification.PollDeletedOptionYou" = "You deleted the option \"%1$@\" to the poll"; +"Notification.PollDeletedOptionYou" = "You deleted the option \"%1$@\" from the poll"; "Notification.ManagedBotCreated" = "%@ bot created"; @@ -16034,7 +16034,7 @@ Error: %8$@"; "Chat.Poll.ReplyToOption" = "Reply to Option"; "Chat.Poll.VoteOption" = "Vote"; "Chat.Poll.RetractOptionVote" = "Retract Vote"; -"Chat.Poll.RemoveOption" = "Remoev"; +"Chat.Poll.RemoveOption" = "Remove"; "Chat.Poll.ContextMenu.SectionOption" = "Option"; "Chat.Poll.ContextMenu.SectionPoll" = "Poll"; diff --git a/submodules/TelegramUI/Components/Chat/ChatMessagePollBubbleContentNode/Sources/ChatMessagePollBubbleContentNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessagePollBubbleContentNode/Sources/ChatMessagePollBubbleContentNode.swift index e5fc326947..680de32103 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessagePollBubbleContentNode/Sources/ChatMessagePollBubbleContentNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessagePollBubbleContentNode/Sources/ChatMessagePollBubbleContentNode.swift @@ -3726,7 +3726,7 @@ private func resolvedOptionOrder(for item: ChatMessageBubbleContentItem) -> [(In return [] } let defaultOrderedOptions = Array(poll.options.enumerated()).map { ($0.offset, $0.element) } - guard poll.shuffleAnswers else { + guard poll.shuffleAnswers && !poll.isCreator else { return defaultOrderedOptions } diff --git a/submodules/TelegramUI/Components/ComposePollScreen/Sources/ComposePollScreen.swift b/submodules/TelegramUI/Components/ComposePollScreen/Sources/ComposePollScreen.swift index 061ffff5a0..125cf38947 100644 --- a/submodules/TelegramUI/Components/ComposePollScreen/Sources/ComposePollScreen.swift +++ b/submodules/TelegramUI/Components/ComposePollScreen/Sources/ComposePollScreen.swift @@ -1255,9 +1255,10 @@ final class ComposePollScreenComponent: Component { if !self.isQuiz { self.canAddOptions = true } + } else { + self.shuffleOptions = true } self.canRevote = true - self.shuffleOptions = true self.pollOptions.append(ComposePollScreenComponent.PollOption( id: self.nextPollOptionId diff --git a/submodules/TelegramUI/Sources/OverlayAudioPlayerController.swift b/submodules/TelegramUI/Sources/OverlayAudioPlayerController.swift index 30ecc50713..bce9e5b293 100644 --- a/submodules/TelegramUI/Sources/OverlayAudioPlayerController.swift +++ b/submodules/TelegramUI/Sources/OverlayAudioPlayerController.swift @@ -10,6 +10,7 @@ import ShareController import UndoUI import AttachmentFileController import LegacyMediaPickerUI +import ICloudResources final class OverlayAudioPlayerControllerImpl: ViewController, OverlayAudioPlayerController { private let context: AccountContext @@ -49,6 +50,7 @@ final class OverlayAudioPlayerControllerImpl: ViewController, OverlayAudioPlayer super.init(navigationBarPresentationData: nil) self.statusBar.statusBarStyle = .Ignore + self.automaticallyControlPresentationContextLayout = false self.ready.set(.never()) @@ -167,11 +169,59 @@ final class OverlayAudioPlayerControllerImpl: ViewController, OverlayAudioPlayer } dismissImpl?() let presentationData = self.context.sharedContext.currentPresentationData.with { $0 } - let controller = legacyICloudFilePicker(theme: presentationData.theme, mode: .import, documentTypes: ["public.mp3", "public.mpeg-4-audio", "public.aac-audio", "org.xiph.flac"], completion: { urls in - guard let url = urls.first else { + let controller = legacyICloudFilePicker(theme: presentationData.theme, mode: .default, documentTypes: ["public.mp3", "public.mpeg-4-audio", "public.aac-audio", "org.xiph.flac"], completion: { [weak self] urls in + guard let self, let url = urls.first else { return } - print(url) + + let _ = (iCloudFileDescription(url) + |> deliverOnMainQueue).start(next: { [weak self] item in + guard let self, let item else { + return + } + let fileId = Int64.random(in: Int64.min ... Int64.max) + let mimeType = guessMimeTypeByFileExtension((item.fileName as NSString).pathExtension) + var previewRepresentations: [TelegramMediaImageRepresentation] = [] + if mimeType.hasPrefix("image/") || mimeType == "application/pdf" { + previewRepresentations.append(TelegramMediaImageRepresentation(dimensions: PixelDimensions(width: 320, height: 320), resource: ICloudFileResource(urlData: item.urlData, thumbnail: true), progressiveSizes: [], immediateThumbnailData: nil, hasVideo: false, isPersonal: false)) + } + var attributes: [TelegramMediaFileAttribute] = [] + attributes.append(.FileName(fileName: item.fileName)) + if let audioMetadata = item.audioMetadata { + attributes.append(.Audio(isVoice: false, duration: audioMetadata.duration, title: audioMetadata.title, performer: audioMetadata.performer, waveform: nil)) + } + + let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: fileId), partialReference: nil, resource: ICloudFileResource(urlData: item.urlData, thumbnail: false), previewRepresentations: previewRepresentations, videoThumbnails: [], immediateThumbnailData: nil, mimeType: mimeType, size: Int64(item.fileSize), attributes: attributes, alternativeRepresentations: []) + + let _ = (standaloneUploadedFile( + postbox: self.context.account.postbox, + network: self.context.account.network, + peerId: self.context.account.peerId, + text: "", + source: .resource(.media(media: .standalone(media: file), resource: file.resource)), + thumbnailData: file.immediateThumbnailData, + mimeType: file.mimeType, + attributes: file.attributes, + hintFileIsLarge: false + ) + |> deliverOnMainQueue).start(next: { [weak self] value in + guard let self else { + return + } + switch value { + case let .result(result): + switch result { + case let .media(resultMedia): + if let resultFile = resultMedia.media as? TelegramMediaFile { + self.context.account.postbox.mediaBox.moveResourceData(from: file.resource.id, to: resultFile.resource.id, synchronous: true) + self.controllerNode.addToSavedMusic(file: .standalone(media: file)) + } + } + default: + break + } + }) + }) }) self.present(controller, in: .window(.root)) }, diff --git a/submodules/TelegramUI/Sources/OverlayAudioPlayerControllerNode.swift b/submodules/TelegramUI/Sources/OverlayAudioPlayerControllerNode.swift index 6210ba72fb..b33068592d 100644 --- a/submodules/TelegramUI/Sources/OverlayAudioPlayerControllerNode.swift +++ b/submodules/TelegramUI/Sources/OverlayAudioPlayerControllerNode.swift @@ -47,8 +47,10 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu private let historyFrameNode: SparseNode private let historyFrameLeftOverlayNode: ASDisplayNode private let historyFrameRightOverlayNode: ASDisplayNode + private let historyFrameTopOverlayClipNode: ASDisplayNode private let historyFrameTopOverlayNode: ASDisplayNode private let historyFrameTopMaskNode: ASImageNode + private let collapseNode: HighlightableButtonNode private let headerButtons = ComponentView() private let title = ComponentView() @@ -73,7 +75,7 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu private var peer: EnginePeer? private var copyProtectionEnabled = false - + init( context: AccountContext, chatLocation: ChatLocation, @@ -279,6 +281,9 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu self.historyFrameRightOverlayNode = ASDisplayNode() self.historyFrameRightOverlayNode.backgroundColor = self.presentationData.theme.list.modalBlocksBackgroundColor + self.historyFrameTopOverlayClipNode = ASDisplayNode() + self.historyFrameTopOverlayClipNode.clipsToBounds = true + self.historyFrameTopOverlayNode = ASDisplayNode() self.historyFrameTopOverlayNode.cornerRadius = 38.0 self.historyFrameTopOverlayNode.clipsToBounds = true @@ -321,6 +326,10 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu ) self.historyNode.clipsToBounds = true + self.collapseNode = HighlightableButtonNode() + self.collapseNode.displaysAsynchronously = false + self.collapseNode.setImage(generateCollapseIcon(theme: self.presentationData.theme), for: []) + super.init() self.backgroundColor = nil @@ -425,8 +434,10 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu self.historyFrameNode.addSubnode(self.historyFrameLeftOverlayNode) self.historyFrameNode.addSubnode(self.historyFrameRightOverlayNode) - self.historyFrameNode.addSubnode(self.historyFrameTopOverlayNode) + self.historyFrameNode.addSubnode(self.historyFrameTopOverlayClipNode) + self.historyFrameTopOverlayClipNode.addSubnode(self.historyFrameTopOverlayNode) self.historyFrameNode.addSubnode(self.historyFrameTopMaskNode) + self.historyFrameNode.addSubnode(self.collapseNode) self.historyNode.beganInteractiveDragging = { [weak self] _ in self?.controlsNode.collapse() @@ -617,6 +628,8 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu self.historyFrameTopOverlayNode.backgroundColor = self.presentationData.theme.list.modalBlocksBackgroundColor self.historyFrameTopMaskNode.image = PresentationResourcesItemList.cornersImage(self.presentationData.theme.withModalBlocksBackground(), top: true, bottom: false, glass: true) + self.collapseNode.setImage(generateCollapseIcon(theme: self.presentationData.theme), for: []) + self.controlsNode.updatePresentationData(self.presentationData) } @@ -642,6 +655,7 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu let _ = self.context.engine.messages.enqueueOutgoingMessage(to: self.context.account.peerId, replyTo: nil, content: .file(file)).start() + //TODO:localize let controller = UndoOverlayController( presentationData: self.presentationData, content: .forward(savedMessages: true, text: "Audio forwarded to Saved Messages."), @@ -649,7 +663,7 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu return true } ) - self.getParentController()?.present(controller, in: .window(.root)) + self.getParentController()?.present(controller, in: .current) } private func updateMusicSaved(file: FileMediaReference, isSaved: Bool) { @@ -712,7 +726,7 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu return true } ) - self.getParentController()?.present(controller, in: .window(.root)) + self.getParentController()?.present(controller, in: .current) self.updateMusicSaved(file: file, isSaved: true) } @@ -743,7 +757,7 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu self.context.sharedContext.mediaManager.setPlaylist(nil, type: self.type, control: .playback(.pause)) } } else { - self.getParentController()?.present(controller, in: .window(.root)) + self.getParentController()?.present(controller, in: .current) } self.updateMusicSaved(file: file, isSaved: false) @@ -786,7 +800,7 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu return } - let expandDistance: CGFloat = 78.0 + let expandDistance = self.effectiveHeaderHeight let topOffsetFraction = max(0.0, min(1.0, self.historyContentOffset / expandDistance)) let minScale: CGFloat = (layout.size.width - 6.0 * 2.0) / layout.size.width @@ -803,6 +817,14 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu transition.updateCornerRadius(node: self.containerContainingNode, cornerRadius: layout.deviceMetrics.screenCornerRadius) } + private var effectiveHeaderHeight: CGFloat { + var headerHeight: CGFloat = 38.0 + if let playlistLocation = self.playlistLocation as? PeerMessagesPlaylistLocation, case .savedMusic = playlistLocation { + headerHeight = 78.0 + } + return headerHeight + } + func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) { self.validLayout = layout @@ -821,7 +843,8 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu insets.right = 16.0 insets.bottom = 0.0 - let headerHeight: CGFloat = 78.0 + let headerHeight = self.effectiveHeaderHeight + let listTopInset = layoutTopInset + headerHeight let listNodeSize = CGSize(width: layout.size.width, height: layout.size.height - listTopInset - controlsHeight) @@ -843,100 +866,107 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu replacementHistoryNode.updateLayout(transition: transition, updateSizeAndInsets: updateSizeAndInsets) } - - let leftControlItems: [GlassControlGroupComponent.Item] = [ - GlassControlGroupComponent.Item( - id: AnyHashable("close"), - content: .icon("Navigation/Close"), - action: { [weak self] in - guard let self else { - return - } - self.requestDismiss() - } - ) - ] - var rightControlItems: [GlassControlGroupComponent.Item] = [] - if let playlistLocation = self.playlistLocation as? PeerMessagesPlaylistLocation, case let .savedMusic(savedMusicContext, _, _) = playlistLocation, savedMusicContext.peerId == self.context.account.peerId { - rightControlItems.append( + if let playlistLocation = self.playlistLocation as? PeerMessagesPlaylistLocation, case .savedMusic = playlistLocation { + let leftControlItems: [GlassControlGroupComponent.Item] = [ GlassControlGroupComponent.Item( - id: AnyHashable("add"), - content: .icon("Navigation/Add"), + id: AnyHashable("close"), + content: .icon("Navigation/Close"), action: { [weak self] in guard let self else { return } - self.requestAdd() + self.requestDismiss() } ) - ) - } -// rightControlItems.append( -// GlassControlGroupComponent.Item( -// id: AnyHashable("search"), -// content: .icon("Navigation/Search"), -// action: { -// } -// ) -// ) - - let headerInset: CGFloat = 16.0 - let headerButtonsSize = self.headerButtons.update( - transition: ComponentTransition(transition), - component: AnyComponent( - GlassControlPanelComponent( - theme: self.presentationData.theme, - leftItem: GlassControlPanelComponent.Item( - items: leftControlItems, - background: .panel - ), - centralItem: nil, - rightItem: rightControlItems.isEmpty ? nil : GlassControlPanelComponent.Item( - items: rightControlItems, - background: .panel - ), - centerAlignmentIfPossible: true, - isDark: self.presentationData.theme.overallDarkAppearance + ] + var rightControlItems: [GlassControlGroupComponent.Item] = [] + if let playlistLocation = self.playlistLocation as? PeerMessagesPlaylistLocation, case let .savedMusic(savedMusicContext, _, _) = playlistLocation, savedMusicContext.peerId == self.context.account.peerId { + rightControlItems.append( + GlassControlGroupComponent.Item( + id: AnyHashable("add"), + content: .icon("Navigation/Add"), + action: { [weak self] in + guard let self else { + return + } + self.requestAdd() + } + ) ) - ), - environment: {}, - containerSize: CGSize(width: layout.size.width - headerInset * 2.0, height: 44.0) - ) - if let headerButtonsView = self.headerButtons.view { - if headerButtonsView.superview == nil { - self.historyFrameNode.view.addSubview(headerButtonsView) } - headerButtonsView.frame = CGRect(origin: CGPoint(x: headerInset, y: headerInset), size: headerButtonsSize) - } - - //TODO:localize - let titleString: String - if let peer = self.peer { - if peer.id == self.context.account.peerId { - titleString = "Your Playlist" + // rightControlItems.append( + // GlassControlGroupComponent.Item( + // id: AnyHashable("search"), + // content: .icon("Navigation/Search"), + // action: { + // } + // ) + // ) + + let headerInset: CGFloat = 16.0 + let headerButtonsSize = self.headerButtons.update( + transition: ComponentTransition(transition), + component: AnyComponent( + GlassControlPanelComponent( + theme: self.presentationData.theme, + leftItem: GlassControlPanelComponent.Item( + items: leftControlItems, + background: .panel + ), + centralItem: nil, + rightItem: rightControlItems.isEmpty ? nil : GlassControlPanelComponent.Item( + items: rightControlItems, + background: .panel + ), + centerAlignmentIfPossible: true, + isDark: self.presentationData.theme.overallDarkAppearance + ) + ), + environment: {}, + containerSize: CGSize(width: layout.size.width - headerInset * 2.0, height: 44.0) + ) + if let headerButtonsView = self.headerButtons.view { + if headerButtonsView.superview == nil { + self.historyFrameNode.view.addSubview(headerButtonsView) + } + headerButtonsView.frame = CGRect(origin: CGPoint(x: headerInset, y: headerInset), size: headerButtonsSize) + } + + //TODO:localize + let titleString: String + if let peer = self.peer { + if peer.id == self.context.account.peerId { + titleString = "Your Playlist" + } else { + titleString = "\(peer.compactDisplayTitle)'s Playlist" + } } else { - titleString = "\(peer.compactDisplayTitle)'s Playlist" + titleString = "" + } + + let titleSize = self.title.update( + transition: ComponentTransition(transition), + component: AnyComponent( + MultilineTextComponent(text: .plain(NSAttributedString(string: titleString, font: Font.semibold(17.0), textColor: self.presentationData.theme.list.itemPrimaryTextColor))) + ), + environment: {}, + containerSize: CGSize(width: layout.size.width - 70.0 * 2.0, height: headerHeight) + ) + if let titleView = self.title.view { + if titleView.superview == nil { + self.historyFrameNode.view.addSubview(titleView) + } + titleView.frame = CGRect(origin: CGPoint(x: floor((layout.size.width - titleSize.width) / 2.0), y: 29.0), size: titleSize) } - } else { - titleString = "Playlist" } - let titleSize = self.title.update( - transition: ComponentTransition(transition), - component: AnyComponent( - MultilineTextComponent(text: .plain(NSAttributedString(string: titleString, font: Font.semibold(17.0), textColor: self.presentationData.theme.list.itemPrimaryTextColor))) - ), - environment: {}, - containerSize: CGSize(width: layout.size.width - 70.0 * 2.0, height: headerHeight) - ) - if let titleView = self.title.view { - if titleView.superview == nil { - self.historyFrameNode.view.addSubview(titleView) - } - titleView.frame = CGRect(origin: CGPoint(x: floor((layout.size.width - titleSize.width) / 2.0), y: 29.0), size: titleSize) - } + transition.updateFrame(node: self.collapseNode, frame: CGRect(origin: CGPoint(x: 0.0, y: -7.0), size: CGSize(width: layout.size.width, height: 30.0))) self.updateHistoryContentOffset(self.historyNode.visibleContentOffset(), transition: transition) + + var layout = layout + layout.intrinsicInsets.bottom = controlsHeight + self.getParentController()?.presentationContext.containerLayoutUpdated(layout, transition: transition) } func animateIn() { @@ -1041,7 +1071,7 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu self.floatingHeaderOffset = offset let sideInset: CGFloat = 16.0 - let headerHeight: CGFloat = 78.0 + let headerHeight = self.effectiveHeaderHeight let layoutTopInset: CGFloat = max(layout.statusBarHeight ?? 0.0, layout.safeInsets.top) @@ -1052,11 +1082,12 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu let frameFrame = CGRect(origin: CGPoint(x: 0.0, y: backgroundOffset), size: CGSize(width: layout.size.width, height: layout.size.height)) let topOverlayFrame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: layout.size.width, height: headerHeight)) - let leftOverlayFrame = CGRect(origin: CGPoint(x: 0.0, y: headerHeight), size: CGSize(width: sideInset, height: layout.size.height)) - let rightOverlayFrame = CGRect(origin: CGPoint(x: layout.size.width - sideInset, y: headerHeight), size: CGSize(width: sideInset, height: layout.size.height)) + let leftOverlayFrame = CGRect(origin: CGPoint(x: 0.0, y: topOverlayFrame.maxY - 1.0), size: CGSize(width: sideInset, height: layout.size.height)) + let rightOverlayFrame = CGRect(origin: CGPoint(x: layout.size.width - sideInset, y: topOverlayFrame.maxY - 1.0), size: CGSize(width: sideInset, height: layout.size.height)) self.historyFrameNode.frame = frameFrame - self.historyFrameTopOverlayNode.frame = topOverlayFrame + self.historyFrameTopOverlayClipNode.frame = topOverlayFrame + self.historyFrameTopOverlayNode.frame = CGRect(origin: .zero, size: CGSize(width: topOverlayFrame.width, height: 78.0)) self.historyFrameLeftOverlayNode.frame = leftOverlayFrame self.historyFrameRightOverlayNode.frame = rightOverlayFrame if let image = self.historyFrameTopMaskNode.image { @@ -1490,3 +1521,15 @@ private final class OverlayAudioPlayerContextExtractedContentSource: ContextExtr return ContextControllerPutBackViewInfo(contentAreaInScreenSpace: UIScreen.main.bounds) } } + +private func generateCollapseIcon(theme: PresentationTheme) -> UIImage? { + return generateImage(CGSize(width: 36.0, height: 6.0), rotatedContext: { size, context in + let bounds = CGRect(origin: CGPoint(), size: size) + context.clear(bounds) + + let path = UIBezierPath(roundedRect: bounds, cornerRadius: 3.0) + context.setFillColor(theme.list.controlSecondaryColor.cgColor) + context.addPath(path.cgPath) + context.fillPath() + }) +} diff --git a/submodules/TelegramUI/Sources/OverlayAudioPlayerControlsNode.swift b/submodules/TelegramUI/Sources/OverlayAudioPlayerControlsNode.swift index 1f33852b61..e5e79fdbb5 100644 --- a/submodules/TelegramUI/Sources/OverlayAudioPlayerControlsNode.swift +++ b/submodules/TelegramUI/Sources/OverlayAudioPlayerControlsNode.swift @@ -38,17 +38,6 @@ private func generateBackground(theme: PresentationTheme) -> UIImage? { })?.stretchableImage(withLeftCapWidth: 10, topCapHeight: 10 + 8) } -private func generateCollapseIcon(theme: PresentationTheme) -> UIImage? { - return generateImage(CGSize(width: 38.0, height: 5.0), rotatedContext: { size, context in - let bounds = CGRect(origin: CGPoint(), size: size) - context.clear(bounds) - - let path = UIBezierPath(roundedRect: bounds, cornerRadius: 2.5) - context.setFillColor(theme.list.controlSecondaryColor.cgColor) - context.addPath(path.cgPath) - context.fillPath() - }) -} private func optionsRateImage(rate: String, color: UIColor = .white) -> UIImage? { let isLarge = "".isEmpty @@ -151,8 +140,6 @@ final class OverlayAudioPlayerControlsNode: ASDisplayNode { private let backgroundNode: ASImageNode - private let collapseNode: HighlightableButtonNode - private let albumArtNode: TransformImageNode private var largeAlbumArtNode: TransformImageNode? private let titleNode: TextNode @@ -244,11 +231,7 @@ final class OverlayAudioPlayerControlsNode: ASDisplayNode { self.backgroundNode.displayWithoutProcessing = true self.backgroundNode.displaysAsynchronously = false self.backgroundNode.image = generateBackground(theme: presentationData.theme) - - self.collapseNode = HighlightableButtonNode() - self.collapseNode.displaysAsynchronously = false - self.collapseNode.setImage(generateCollapseIcon(theme: presentationData.theme), for: []) - + self.albumArtNode = TransformImageNode() self.titleNode = TextNode() @@ -312,9 +295,7 @@ final class OverlayAudioPlayerControlsNode: ASDisplayNode { super.init() self.addSubnode(self.backgroundNode) - - //self.addSubnode(self.collapseNode) - + self.addSubnode(self.albumArtNode) //self.addSubnode(self.titleNode) self.addSubnode(self.descriptionNode) @@ -564,7 +545,6 @@ final class OverlayAudioPlayerControlsNode: ASDisplayNode { self?.control?(.seek(value)) } - self.collapseNode.addTarget(self, action: #selector(self.collapsePressed), forControlEvents: .touchUpInside) self.shareNode.addTarget(self, action: #selector(self.sharePressed), forControlEvents: .touchUpInside) self.orderButton.addTarget(self, action: #selector(self.orderPressed), forControlEvents: .touchUpInside) self.loopingButton.addTarget(self, action: #selector(self.loopingPressed), forControlEvents: .touchUpInside) @@ -705,7 +685,6 @@ final class OverlayAudioPlayerControlsNode: ASDisplayNode { self.forwardButton.circleColor = presentationData.theme.list.controlSecondaryColor.withAlphaComponent(0.35) self.backgroundNode.image = generateBackground(theme: presentationData.theme) - self.collapseNode.setImage(generateCollapseIcon(theme: presentationData.theme), for: []) self.shareNode.setImage(generateTintedImage(image: UIImage(bundleImageName: "GlobalMusicPlayer/Share"), color: presentationData.theme.list.itemPrimaryTextColor), for: []) self.scrubberNode.updateColors(backgroundColor: presentationData.theme.list.controlSecondaryColor, foregroundColor: presentationData.theme.list.itemPrimaryTextColor) self.leftDurationLabel.textColor = presentationData.theme.list.itemSecondaryTextColor @@ -872,9 +851,7 @@ final class OverlayAudioPlayerControlsNode: ASDisplayNode { let panelHeight = OverlayAudioPlayerControlsNode.heightForLayout(width: width, leftInset: leftInset, rightInset: rightInset, bottomInset: bottomInset, maxHeight: maxHeight, isExpanded: self.isExpanded, savedMusic: nil) transition.updateFrame(node: self.separatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: panelHeight), size: CGSize(width: width, height: UIScreenPixel))) - - transition.updateFrame(node: self.collapseNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 2.0), size: CGSize(width: width, height: 30.0))) - + let sideInset: CGFloat = 16.0 let sideButtonsInset: CGFloat = sideInset + 60.0