Video avatar fixes

This commit is contained in:
Ilya Laktyushin 2020-07-10 22:00:41 +03:00
parent 9500196d5b
commit 28394131a5
4 changed files with 18 additions and 6 deletions

View File

@ -130,9 +130,8 @@ public func initialAvatarGalleryEntries(account: Account, peer: Peer) -> Signal<
initialPhoto = photo
}
if let photo = initialPhoto {
if let photo = initialPhoto, !photo.videoRepresentations.isEmpty {
return [.topImage(photo.representations.map({ ImageRepresentationWithReference(representation: $0, reference: MediaResourceReference.standalone(resource: $0.resource)) }), photo.videoRepresentations, nil, nil, nil)]
// return [.image(photo.imageId, photo.reference, photo.representations.map({ ImageRepresentationWithReference(representation: $0, reference: MediaResourceReference.standalone(resource: $0.resource)) }), photo.videoRepresentations, peer, 0, nil, nil, photo.immediateThumbnailData, nil)]
} else {
return initialEntries
}

View File

@ -846,7 +846,7 @@ public func channelAdminsController(context: AccountContext, peerId initialPeerI
return controller
}
func rebuildControllerStackAfterSupergroupUpgrade(controller: ViewController, navigationController: NavigationController, replace: ((UIViewController) -> UIViewController)? = nil) {
public func rebuildControllerStackAfterSupergroupUpgrade(controller: ViewController, navigationController: NavigationController, replace: ((UIViewController) -> UIViewController)? = nil) {
var controllers = navigationController.viewControllers
for i in 0 ..< controllers.count {
if controllers[i] === controller {

View File

@ -1320,8 +1320,9 @@ final class PeerInfoEditingAvatarOverlayNode: ASDisplayNode {
overlayHidden = true
}
let targetAlpha: CGFloat = overlayHidden ? 0.0 : 1.0
if self.updatingAvatarOverlay.alpha != targetAlpha {
let targetIconAlpha: CGFloat = iconHidden ? 0.0 : 1.0
let targetOverlayAlpha: CGFloat = overlayHidden ? 0.0 : 1.0
if self.updatingAvatarOverlay.alpha != targetOverlayAlpha || self.iconNode.alpha != targetIconAlpha {
let update = {
self.statusNode.transitionToState(.none)
self.currentRepresentation = nil

View File

@ -48,6 +48,7 @@ import DeviceAccess
import LegacyMediaPickerUI
import TelegramNotices
import SaveToCameraRoll
import PeerInfoUI
protocol PeerInfoScreenItem: class {
var id: AnyHashable { get }
@ -3545,7 +3546,18 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
guard let data = self.data, let peer = data.peer else {
return
}
self.controller?.push(groupPreHistorySetupController(context: self.context, peerId: peer.id, upgradedToSupergroup: { _, f in f() }))
var upgradedToSupergroupImpl: (() -> Void)?
let controller = groupPreHistorySetupController(context: self.context, peerId: peer.id, upgradedToSupergroup: { _, f in
upgradedToSupergroupImpl?()
f()
})
self.controller?.push(controller)
upgradedToSupergroupImpl = { [weak controller] in
if let controller = controller, let navigationController = controller.navigationController as? NavigationController {
rebuildControllerStackAfterSupergroupUpgrade(controller: controller, navigationController: navigationController)
}
}
}
private func openPermissions() {