Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contest UI 23 #1186

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
718cc71
WIP ArchiveNode resize by scroll offset
aldammit Aug 25, 2023
e6c425d
[WIP] intermediate animation
aldammit Aug 25, 2023
f5934f5
[WIP] arrow to archive animation node
aldammit Aug 26, 2023
b80e5ea
[wip] navigation on archive placeholder, added params models for tran…
aldammit Aug 26, 2023
8eb2b70
[WIP] animated arrow, gradient and title
aldammit Aug 26, 2023
addfce2
[wip] gradient animation
aldammit Aug 26, 2023
41e0ef9
[WI{P] archiv transaction improvements
aldammit Aug 26, 2023
3685476
fixed update percentage of enough scrolled archieve
aldammit Aug 27, 2023
a94fd71
scroll handling updates
aldammit Aug 27, 2023
05c8fd8
[WIP Animation archive] fixed positions of subnode during transition
aldammit Aug 29, 2023
b44e287
[WIP] fixed size updates
aldammit Aug 29, 2023
ebf99d3
[WIP] animation. fixed updates according to animation progress
aldammit Aug 30, 2023
8d6d107
updated gradient appears animation
aldammit Aug 30, 2023
a24e0cf
alternative implementation using transition
aldammit Aug 30, 2023
6c20611
increased archive item size
aldammit Aug 30, 2023
3518dc7
fixed intermediate animatio
aldammit Aug 30, 2023
117535b
[WIP] animation from list item to archive icon
aldammit Aug 30, 2023
cf363e2
[WIP] transition to archive cell, implemented animated gradient and a…
aldammit Aug 30, 2023
6ea7fa8
updated gradient colors
aldammit Aug 30, 2023
2baa154
updated arrow color
aldammit Aug 30, 2023
ba509b8
chat list updates if archive is visible
aldammit Aug 30, 2023
19f6b17
fixed gradient, fixed animation trigger if archive already presented
aldammit Aug 30, 2023
b761d49
fixed arrow background resize, text positioning
aldammit Aug 30, 2023
86f5a9f
gradients generation optimized
aldammit Aug 30, 2023
c99dded
updated gradient to archive transition
aldammit Aug 31, 2023
7fb3f6c
archive transition, shadows
aldammit Aug 31, 2023
c797b7b
implemented shake and alpha animations for a textnode, scale for the …
aldammit Sep 1, 2023
9bfec96
fixed hidden archive by default
aldammit Sep 1, 2023
43090d2
WIP chat preview transition
aldammit Sep 2, 2023
778902e
Revert "fixed hidden archive by default"
aldammit Sep 2, 2023
d669850
Revert "Revert "fixed hidden archive by default""
aldammit Sep 2, 2023
9838bc6
[WIP] Chat preview animation
aldammit Sep 2, 2023
8571f2e
WIP chat preview transition animation updates
aldammit Sep 3, 2023
287858a
revert temp changes
aldammit Sep 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions build-system/template_minimal_development_configuration.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"bundle_id": "org.{! a random string !}.Telegram",
"api_id": "{! get one at https://my.telegram.org/apps !}",
"api_hash": "{! get one at https://my.telegram.org/apps !}",
"team_id": "{! check README.md !}",
"bundle_id": "org.31375bc829c0233d.Telegraph",
"api_id": "8",
"api_hash": "7245de8e747a0d6fbe11f7cc14fcc0bb",
"team_id": "JTVJ6L7R86",
"app_center_id": "0",
"is_internal_build": "true",
"is_appstore_build": "false",
Expand Down
11 changes: 11 additions & 0 deletions submodules/AccountContext/Sources/ChatController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,17 @@ public enum ChatControllerPresentationMode: Equatable {
case inline(NavigationController?)
}

public final class ChatListPreviewPresentationData {

public let sourceNodeAndRect: (() -> (ASDisplayNode, CGRect)?)
public let contentArea: (() -> (CGRect))

public init(sourceNodeAndRect: @escaping (() -> (ASDisplayNode, CGRect)?), contentArea: @escaping (() -> (CGRect))) {
self.sourceNodeAndRect = sourceNodeAndRect
self.contentArea = contentArea
}
}

public enum ChatPresentationInputQueryResult: Equatable {
case stickers([FoundStickerItem])
case hashtags([String])
Expand Down
25 changes: 14 additions & 11 deletions submodules/AvatarNode/Sources/AvatarNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@ private func calculateColors(explicitColorIndex: Int?, peerId: EnginePeer.Id?, i
} else if case let .archivedChatsIcon(hiddenByDefault) = icon, let theme = theme {
let backgroundColors: (UIColor, UIColor)
if hiddenByDefault {
backgroundColors = theme.chatList.unpinnedArchiveAvatarColor.backgroundColors.colors
} else {
backgroundColors = theme.chatList.pinnedArchiveAvatarColor.backgroundColors.colors
}
print("hidden by default")
// backgroundColors = theme.chatList.unpinnedArchiveAvatarColor.backgroundColors.colors
} //else {
backgroundColors = theme.chatList.pinnedArchiveAvatarColor.backgroundColors.colors
// }
colors = [backgroundColors.1, backgroundColors.0]
} else {
colors = AvatarNode.grayscaleColors
Expand Down Expand Up @@ -348,12 +349,13 @@ public final class AvatarNode: ASDisplayNode {
if let overrideImage = self.overrideImage, case let .archivedChatsIcon(hiddenByDefault) = overrideImage {
let backgroundColors: (UIColor, UIColor)
if hiddenByDefault {
backgroundColors = theme.chatList.unpinnedArchiveAvatarColor.backgroundColors.colors
iconColor = theme.chatList.unpinnedArchiveAvatarColor.foregroundColor
} else {
// backgroundColors = theme.chatList.unpinnedArchiveAvatarColor.backgroundColors.colors
// iconColor = theme.chatList.unpinnedArchiveAvatarColor.foregroundColor
print("archieve hidden by default")
} //else {
backgroundColors = theme.chatList.pinnedArchiveAvatarColor.backgroundColors.colors
iconColor = theme.chatList.pinnedArchiveAvatarColor.foregroundColor
}
// }
let colors: NSArray = [backgroundColors.1.cgColor, backgroundColors.0.cgColor]
backgroundColor = backgroundColors.1.mixedWith(backgroundColors.0, alpha: 0.5)
animationBackgroundNode.image = generateGradientFilledCircleImage(diameter: self.imageNode.frame.width, colors: colors)
Expand Down Expand Up @@ -566,10 +568,11 @@ public final class AvatarNode: ASDisplayNode {
if let parameters = parameters as? AvatarNodeParameters, parameters.icon != .none {
if case let .archivedChatsIcon(hiddenByDefault) = parameters.icon, let theme = parameters.theme {
if hiddenByDefault {
iconColor = theme.chatList.unpinnedArchiveAvatarColor.foregroundColor
} else {
// iconColor = theme.chatList.unpinnedArchiveAvatarColor.foregroundColor

} //else {
iconColor = theme.chatList.pinnedArchiveAvatarColor.foregroundColor
}
// }
}
}

Expand Down
1 change: 1 addition & 0 deletions submodules/ChatListUI/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ swift_library(
"//submodules/TelegramUI/Components/Stories/AvatarStoryIndicatorComponent",
"//submodules/TelegramUI/Components/PeerInfo/PeerInfoStoryGridScreen",
"//submodules/TelegramUI/Components/Settings/ArchiveInfoScreen",
"//submodules/TelegramUI/Components/Chat/ChatAvatarNavigationNode",
],
visibility = [
"//visibility:public",
Expand Down
71 changes: 54 additions & 17 deletions submodules/ChatListUI/Sources/ChatListController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1098,10 +1098,10 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
}

if !didDisplayTip {
#if DEBUG
#else
// #if DEBUG
// #else
let _ = ApplicationSpecificNotice.setDisplayChatListArchiveTooltip(accountManager: self.context.sharedContext.accountManager).start()
#endif
// #endif

self.push(ArchiveInfoScreen(context: self.context, settings: settings))
}
Expand Down Expand Up @@ -1289,6 +1289,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
}
}


switch item.content {
case let .groupReference(groupReference):
let chatListController = ChatListControllerImpl(context: strongSelf.context, location: .chatList(groupId: groupReference.groupId), controlsHistoryPreload: false, hideNetworkActivityStatus: true, previewing: true, enableDebugActions: false)
Expand All @@ -1304,33 +1305,66 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
case .chatList:
if case let .channel(channel) = peer.peer, channel.flags.contains(.isForum) {
if let threadId = threadId {
let source: ContextContentSource
// let source: ContextContentSource
let chatController = strongSelf.context.sharedContext.makeChatController(context: strongSelf.context, chatLocation: .replyThread(message: ChatReplyThreadMessage(
messageId: MessageId(peerId: peer.peerId, namespace: Namespaces.Message.Cloud, id: Int32(clamping: threadId)), channelMessageId: nil, isChannelPost: false, isForumPost: true, maxMessage: nil, maxReadIncomingMessageId: nil, maxReadOutgoingMessageId: nil, unreadCount: 0, initialFilledHoles: IndexSet(), initialAnchor: .automatic, isNotAvailable: false
)), subject: nil, botStart: nil, mode: .standard(previewing: true))
chatController.canReadHistory.set(false)
source = .controller(ContextControllerContentSourceImpl(controller: chatController, sourceNode: node, navigationController: strongSelf.navigationController as? NavigationController))

let contextController = ContextController(account: strongSelf.context.account, presentationData: strongSelf.presentationData, source: source, items: chatForumTopicMenuItems(context: strongSelf.context, peerId: peer.peerId, threadId: threadId, isPinned: nil, isClosed: nil, chatListController: strongSelf, joined: joined, canSelect: false) |> map { ContextController.Items(content: .list($0)) }, gesture: gesture)
strongSelf.presentInGlobalOverlay(contextController)


strongSelf.present(chatController, in: .window(.root), with: ChatListPreviewPresentationData(sourceNodeAndRect: {
return (node, node.frame)
}, contentArea: {
let baseContentFrame = strongSelf.chatListDisplayNode.mainContainerNode.currentItemNode.frame
if case let .known(topOffset) = strongSelf.chatListDisplayNode.mainContainerNode.currentItemNode.visibleContentOffset(),
case let .known(bottomOffset) = strongSelf.chatListDisplayNode.mainContainerNode.currentItemNode.visibleBottomContentOffset() {
return baseContentFrame.inset(by: .init(top: topOffset, left: .zero, bottom: bottomOffset, right: .zero))
} else {
return baseContentFrame.inset(by: strongSelf.chatListDisplayNode.mainContainerNode.currentItemNode.headerInsets)
}
}))

// source = .controller(ContextControllerContentSourceImpl(controller: chatController, sourceNode: node, navigationController: strongSelf.navigationController as? NavigationController))


// let contextController = ContextController(account: strongSelf.context.account, presentationData: strongSelf.presentationData, source: source, items: chatForumTopicMenuItems(context: strongSelf.context, peerId: peer.peerId, threadId: threadId, isPinned: nil, isClosed: nil, chatListController: strongSelf, joined: joined, canSelect: false) |> map { ContextController.Items(content: .list($0)) }, gesture: gesture)
// strongSelf.presentInGlobalOverlay(contextController)
} else {
let chatListController = ChatListControllerImpl(context: strongSelf.context, location: .forum(peerId: channel.id), controlsHistoryPreload: false, hideNetworkActivityStatus: true, previewing: true, enableDebugActions: false)
chatListController.navigationPresentation = .master
let contextController = ContextController(account: strongSelf.context.account, presentationData: strongSelf.presentationData, source: .controller(ContextControllerContentSourceImpl(controller: chatListController, sourceNode: node, navigationController: strongSelf.navigationController as? NavigationController)), items: chatContextMenuItems(context: strongSelf.context, peerId: peer.peerId, promoInfo: promoInfo, source: .chatList(filter: strongSelf.chatListDisplayNode.mainContainerNode.currentItemNode.chatListFilter), chatListController: strongSelf, joined: joined) |> map { ContextController.Items(content: .list($0)) }, gesture: gesture)
strongSelf.presentInGlobalOverlay(contextController)
}
} else {
let source: ContextContentSource
if let location = location {
source = .location(ChatListContextLocationContentSource(controller: strongSelf, location: location))
} else {
let chatController = strongSelf.context.sharedContext.makeChatController(context: strongSelf.context, chatLocation: .peer(id: peer.peerId), subject: nil, botStart: nil, mode: .standard(previewing: true))
chatController.canReadHistory.set(false)
source = .controller(ContextControllerContentSourceImpl(controller: chatController, sourceNode: node, navigationController: strongSelf.navigationController as? NavigationController))
}
// let source: ContextContentSource
// if let location = location {
// source = .location(ChatListContextLocationContentSource(controller: strongSelf, location: location))
// } else {
// let chatController = strongSelf.context.sharedContext.makeChatController(context: strongSelf.context, chatLocation: .peer(id: peer.peerId), subject: nil, botStart: nil, mode: .standard(previewing: true))
// chatController.canReadHistory.set(false)
// strongSelf.present(chatController, in: .window(.root), with: ChatListPreviewPresentationData(sourceNodeAndRect: {
// return (node, node.frame)
// }))

let chatPreviewController = ChatListPreviewController(context: strongSelf.context, chatLocation: .peer(id: peer.peerId))
strongSelf.present(chatPreviewController, in: .window(.root), with: ChatListPreviewPresentationData(sourceNodeAndRect: {
return (node, node.frame)
}, contentArea: {
let baseContentFrame = strongSelf.chatListDisplayNode.mainContainerNode.currentItemNode.frame
if case let .known(topOffset) = strongSelf.chatListDisplayNode.mainContainerNode.currentItemNode.visibleContentOffset(),
case let .known(bottomOffset) = strongSelf.chatListDisplayNode.mainContainerNode.currentItemNode.visibleBottomContentOffset() {
return baseContentFrame.inset(by: .init(top: topOffset, left: .zero, bottom: bottomOffset, right: .zero))
} else {
return baseContentFrame.inset(by: strongSelf.chatListDisplayNode.mainContainerNode.currentItemNode.headerInsets)
}
}))

// source = .controller(ContextControllerContentSourceImpl(controller: chatController, sourceNode: node, navigationController: strongSelf.navigationController as? NavigationController))
// }

let contextController = ContextController(account: strongSelf.context.account, presentationData: strongSelf.presentationData, source: source, items: chatContextMenuItems(context: strongSelf.context, peerId: peer.peerId, promoInfo: promoInfo, source: .chatList(filter: strongSelf.chatListDisplayNode.mainContainerNode.currentItemNode.chatListFilter), chatListController: strongSelf, joined: joined) |> map { ContextController.Items(content: .list($0)) }, gesture: gesture)
strongSelf.presentInGlobalOverlay(contextController)
// let contextController = ContextController(account: strongSelf.context.account, presentationData: strongSelf.presentationData, source: source, items: chatContextMenuItems(context: strongSelf.context, peerId: peer.peerId, promoInfo: promoInfo, source: .chatList(filter: strongSelf.chatListDisplayNode.mainContainerNode.currentItemNode.chatListFilter), chatListController: strongSelf, joined: joined) |> map { ContextController.Items(content: .list($0)) }, gesture: gesture)
// strongSelf.presentInGlobalOverlay(contextController)
}
case let .forum(pinnedIndex, _, threadId, _, _):
let isPinned: Bool
Expand Down Expand Up @@ -4648,6 +4682,8 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
if updatedValue {
state.hiddenItemShouldBeTemporaryRevealed = false
}
state.archiveParams.updateVisibility(isRevealed: state.hiddenItemShouldBeTemporaryRevealed,
isHiddenByDefault: updatedValue)
state.peerIdWithRevealedOptions = nil
return state
}
Expand Down Expand Up @@ -5117,6 +5153,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
strongSelf.chatListDisplayNode.effectiveContainerNode.updateState { state in
var state = state
state.hiddenItemShouldBeTemporaryRevealed = false
state.archiveParams.updateVisibility(isRevealed: false)
return state
}

Expand Down
Loading