Various Improvements

This commit is contained in:
Ilya Laktyushin
2021-08-07 22:55:08 +03:00
parent 6b3103bafc
commit 2e989d1369
46 changed files with 1743 additions and 254 deletions

View File

@@ -224,6 +224,7 @@ private final class DrawingStickersScreenNode: ViewControllerTracingNode {
if collectionId.namespace == ChatMediaInputPanelAuxiliaryNamespace.trending.rawValue {
strongSelf.controllerInteraction.navigationController()?.pushViewController(FeaturedStickersScreen(
context: strongSelf.context,
highlightedPackId: nil,
sendSticker: {
fileReference, sourceNode, sourceRect in
if let strongSelf = self {
@@ -262,12 +263,9 @@ private final class DrawingStickersScreenNode: ViewControllerTracingNode {
}
}, navigateBackToStickers: {
}, setGifMode: { _ in
}, openSettings: { [weak self] in
if let strongSelf = self {
// let controller = installedStickerPacksController(context: context, mode: .modal)
// controller.navigationPresentation = .modal
// strongSelf.controllerInteraction.navigationController()?.pushViewController(controller)
}
}, openSettings: {
}, openTrending: { _ in
}, dismissTrendingPacks: { _ in
}, toggleSearch: { [weak self] value, searchMode, query in
if let strongSelf = self {
if let searchMode = searchMode, value {
@@ -292,8 +290,8 @@ private final class DrawingStickersScreenNode: ViewControllerTracingNode {
if let strongSelf = self {
strongSelf.controllerInteraction.updateInputMode { current in
switch current {
case let .media(mode, _):
return .media(mode: mode, expanded: .search(searchMode))
case let .media(mode, _, focused):
return .media(mode: mode, expanded: .search(searchMode), focused: focused)
default:
return current
}
@@ -304,8 +302,8 @@ private final class DrawingStickersScreenNode: ViewControllerTracingNode {
} else {
strongSelf.controllerInteraction.updateInputMode { current in
switch current {
case let .media(mode, _):
return .media(mode: mode, expanded: nil)
case let .media(mode, _, focused):
return .media(mode: mode, expanded: nil, focused: focused)
default:
return current
}
@@ -341,6 +339,7 @@ private final class DrawingStickersScreenNode: ViewControllerTracingNode {
if collectionId.namespace == ChatMediaInputPanelAuxiliaryNamespace.trending.rawValue {
strongSelf.controllerInteraction.navigationController()?.pushViewController(FeaturedStickersScreen(
context: strongSelf.context,
highlightedPackId: nil,
sendSticker: {
fileReference, sourceNode, sourceRect in
if let strongSelf = self {
@@ -379,13 +378,10 @@ private final class DrawingStickersScreenNode: ViewControllerTracingNode {
}
}, navigateBackToStickers: {
}, setGifMode: { _ in
}, openSettings: { [weak self] in
if let strongSelf = self {
// let controller = installedStickerPacksController(context: context, mode: .modal)
// controller.navigationPresentation = .modal
// strongSelf.controllerInteraction.navigationController()?.pushViewController(controller)
}
}, toggleSearch: { [weak self] value, searchMode, query in
}, openSettings: {
}, openTrending: { _ in
}, dismissTrendingPacks: { _ in
}, toggleSearch: { [weak self] value, searchMode, query in
if let strongSelf = self {
if let searchMode = searchMode, value {
var searchContainerNode: PaneSearchContainerNode?
@@ -409,8 +405,8 @@ private final class DrawingStickersScreenNode: ViewControllerTracingNode {
if let strongSelf = self {
strongSelf.controllerInteraction.updateInputMode { current in
switch current {
case let .media(mode, _):
return .media(mode: mode, expanded: .search(searchMode))
case let .media(mode, _, focused):
return .media(mode: mode, expanded: .search(searchMode), focused: focused)
default:
return current
}
@@ -421,8 +417,8 @@ private final class DrawingStickersScreenNode: ViewControllerTracingNode {
} else {
strongSelf.controllerInteraction.updateInputMode { current in
switch current {
case let .media(mode, _):
return .media(mode: mode, expanded: nil)
case let .media(mode, _, focused):
return .media(mode: mode, expanded: nil, focused: focused)
default:
return current
}
@@ -592,20 +588,9 @@ private final class DrawingStickersScreenNode: ViewControllerTracingNode {
for info in view.collectionInfos {
installedPacks.insert(info.0)
}
var hasUnreadTrending: Bool?
for pack in trendingPacks {
if hasUnreadTrending == nil {
hasUnreadTrending = false
}
if pack.unread {
hasUnreadTrending = true
break
}
}
let panelEntries = chatMediaInputPanelEntries(view: view, savedStickers: savedStickers, recentStickers: recentStickers, peerSpecificPack: nil, canInstallPeerSpecificPack: .none, hasUnreadTrending: nil, theme: theme, hasGifs: false, hasSettings: false)
let gridEntries = chatMediaInputGridEntries(view: view, savedStickers: savedStickers, recentStickers: recentStickers, peerSpecificPack: nil, canInstallPeerSpecificPack: .none, hasSearch: false, hasAccessories: false, strings: strings, theme: theme)
let panelEntries = chatMediaInputPanelEntries(view: view, savedStickers: savedStickers, recentStickers: recentStickers, peerSpecificPack: nil, canInstallPeerSpecificPack: .none, theme: theme, hasGifs: false, hasSettings: false)
let gridEntries = chatMediaInputGridEntries(view: view, savedStickers: savedStickers, recentStickers: recentStickers, peerSpecificPack: nil, canInstallPeerSpecificPack: .none, trendingPacks: trendingPacks, hasSearch: false, hasAccessories: false, strings: strings, theme: theme)
let (previousPanelEntries, previousGridEntries) = previousStickerEntries.swap((panelEntries, gridEntries))
return (view, preparedChatMediaInputPanelEntryTransition(context: context, from: previousPanelEntries, to: panelEntries, inputNodeInteraction: stickersInputNodeInteraction, scrollToItem: nil), previousPanelEntries.isEmpty, preparedChatMediaInputGridEntryTransition(account: context.account, view: view, from: previousGridEntries, to: gridEntries, update: update, interfaceInteraction: controllerInteraction, inputNodeInteraction: stickersInputNodeInteraction, trendingInteraction: trendingInteraction), previousGridEntries.isEmpty)
@@ -639,8 +624,8 @@ private final class DrawingStickersScreenNode: ViewControllerTracingNode {
installedPacks.insert(info.0)
}
let panelEntries = chatMediaInputPanelEntries(view: view, savedStickers: nil, recentStickers: nil, peerSpecificPack: nil, canInstallPeerSpecificPack: .none, hasUnreadTrending: nil, theme: theme, hasGifs: false, hasSettings: false)
let gridEntries = chatMediaInputGridEntries(view: view, savedStickers: nil, recentStickers: nil, peerSpecificPack: nil, canInstallPeerSpecificPack: .none, hasSearch: false, hasAccessories: false, strings: strings, theme: theme)
let panelEntries = chatMediaInputPanelEntries(view: view, savedStickers: nil, recentStickers: nil, peerSpecificPack: nil, canInstallPeerSpecificPack: .none, theme: theme, hasGifs: false, hasSettings: false)
let gridEntries = chatMediaInputGridEntries(view: view, savedStickers: nil, recentStickers: nil, peerSpecificPack: nil, canInstallPeerSpecificPack: .none, trendingPacks: [], hasSearch: false, hasAccessories: false, strings: strings, theme: theme)
let (previousPanelEntries, previousGridEntries) = previousMaskEntries.swap((panelEntries, gridEntries))
return (view, preparedChatMediaInputPanelEntryTransition(context: context, from: previousPanelEntries, to: panelEntries, inputNodeInteraction: masksInputNodeInteraction, scrollToItem: nil), previousPanelEntries.isEmpty, preparedChatMediaInputGridEntryTransition(account: context.account, view: view, from: previousGridEntries, to: gridEntries, update: update, interfaceInteraction: controllerInteraction, inputNodeInteraction: masksInputNodeInteraction, trendingInteraction: trendingInteraction), previousGridEntries.isEmpty)