Browser improvements

This commit is contained in:
Ilya Laktyushin
2024-07-25 17:04:44 +02:00
parent 2eeb3be2b2
commit e0f95989d4
9 changed files with 61 additions and 24 deletions

View File

@@ -13,17 +13,20 @@ final class BrowserAddressListComponent: Component {
let context: AccountContext
let theme: PresentationTheme
let strings: PresentationStrings
let insets: UIEdgeInsets
let navigateTo: (String) -> Void
init(
context: AccountContext,
theme: PresentationTheme,
strings: PresentationStrings,
insets: UIEdgeInsets,
navigateTo: @escaping (String) -> Void
) {
self.context = context
self.theme = theme
self.strings = strings
self.insets = insets
self.navigateTo = navigateTo
}
@@ -37,6 +40,9 @@ final class BrowserAddressListComponent: Component {
if lhs.strings !== rhs.strings {
return false
}
if lhs.insets != rhs.insets {
return false
}
return true
}
@@ -211,6 +217,7 @@ final class BrowserAddressListComponent: Component {
theme: component.theme,
style: .plain,
title: sectionTitle,
insets: component.insets,
actionTitle: section.id == 0 ? "Clear" : nil,
action: { [weak self] in
if let self, let component = self.component {
@@ -292,6 +299,7 @@ final class BrowserAddressListComponent: Component {
webPage: webPage!,
message: itemMessage,
hasNext: true,
insets: component.insets,
action: {
if let url = webPage?.content.url {
navigateTo(url)
@@ -393,6 +401,7 @@ final class BrowserAddressListComponent: Component {
webPage: TelegramMediaWebpage(webpageId: EngineMedia.Id(namespace: 0, id: 0), content: .Loaded(TelegramMediaWebpageLoadedContent(url: "https://telegram.org", displayUrl: "https://telegram.org", hash: 0, type: nil, websiteName: "Telegram", title: "Telegram Telegram", text: "Telegram", embedUrl: nil, embedType: nil, embedSize: nil, duration: nil, author: nil, isMediaLargeByDefault: nil, image: nil, file: nil, story: nil, attributes: [], instantPage: nil))),
message: nil,
hasNext: true,
insets: .zero,
action: {}
)),
environment: {},