Various fixes

This commit is contained in:
Ilya Laktyushin 2024-07-26 14:11:25 +02:00
parent fd63e83d6e
commit 9975f939ce
4 changed files with 19 additions and 11 deletions

View File

@ -12564,6 +12564,7 @@ Sorry for the inconvenience.";
"WebBrowser.AddressBar.RecentlyVisited.Clear" = "Clear"; "WebBrowser.AddressBar.RecentlyVisited.Clear" = "Clear";
"WebBrowser.AddressBar.Bookmarks" = "BOOKMARKS"; "WebBrowser.AddressBar.Bookmarks" = "BOOKMARKS";
"WebBrowser.AddressBar.ShowMore" = "Show More";
"WebBrowser.OpenLinksIn.Title" = "OPEN LINKS IN"; "WebBrowser.OpenLinksIn.Title" = "OPEN LINKS IN";
"WebBrowser.AutoLogin" = "Auto-Login via Telegram"; "WebBrowser.AutoLogin" = "Auto-Login via Telegram";
@ -12656,3 +12657,6 @@ Sorry for the inconvenience.";
"WebBrowser.CopyLink" = "Copy Link"; "WebBrowser.CopyLink" = "Copy Link";
"WebBrowser.DeleteBookmark" = "Delete Bookmark"; "WebBrowser.DeleteBookmark" = "Delete Bookmark";
"WebBrowser.RemoveRecent" = "Remove from Recent"; "WebBrowser.RemoveRecent" = "Remove from Recent";
"Stars.Intro.Transaction.Gift.Title" = "Received Gift";
"Stars.Intro.Transaction.Gift.UnknownUser" = "Unknown User";

View File

@ -235,9 +235,9 @@ final class BrowserAddressListComponent: Component {
let sectionTitle: String let sectionTitle: String
if section.id == 0 { if section.id == 0 {
sectionTitle = "RECENTLY VISITED" sectionTitle = component.strings.WebBrowser_AddressBar_RecentlyVisited
} else if section.id == 1 { } else if section.id == 1 {
sectionTitle = "BOOKMARKS" sectionTitle = component.strings.WebBrowser_AddressBar_Bookmarks
} else { } else {
sectionTitle = "" sectionTitle = ""
} }
@ -249,7 +249,7 @@ final class BrowserAddressListComponent: Component {
style: .plain, style: .plain,
title: sectionTitle, title: sectionTitle,
insets: component.insets, insets: component.insets,
actionTitle: section.id == 0 ? "Clear" : nil, actionTitle: section.id == 0 ? component.strings.WebBrowser_AddressBar_RecentlyVisited_Clear : nil,
action: { [weak self] in action: { [weak self] in
if let self, let component = self.component { if let self, let component = self.component {
let _ = clearRecentlyVisitedLinks(engine: component.context.engine).start() let _ = clearRecentlyVisitedLinks(engine: component.context.engine).start()
@ -279,11 +279,11 @@ final class BrowserAddressListComponent: Component {
continue continue
} }
var id = 0 var id: String = ""
if section.id == 0 { if section.id == 0 {
id += i id = "recent_\(state.recent[i].content.url ?? "")"
} else if section.id == 1 { } else if section.id == 1 {
id += 1000 + i id = "bookmark_\(state.bookmarks[i].id.id)"
} }
let itemId = AnyHashable(id) let itemId = AnyHashable(id)
@ -458,11 +458,12 @@ final class BrowserAddressListComponent: Component {
bookmarks.append(entry.message) bookmarks.append(entry.message)
} }
let isFirstTime = self.stateValue == nil
self.stateValue = State( self.stateValue = State(
recent: recent, recent: recent,
bookmarks: bookmarks bookmarks: bookmarks
) )
self.state?.updated(transition: .immediate) self.state?.updated(transition: isFirstTime ? .immediate : .easeInOut(duration: 0.25))
}) })
} }

View File

@ -116,6 +116,10 @@ final class BrowserAddressListItemComponent: Component {
self.containerButton.clipsToBounds = value self.containerButton.clipsToBounds = value
self.containerButton.backgroundColor = value ? component.theme.list.plainBackgroundColor : nil self.containerButton.backgroundColor = value ? component.theme.list.plainBackgroundColor : nil
self.containerButton.layer.cornerRadius = value ? 10.0 : 0.0 self.containerButton.layer.cornerRadius = value ? 10.0 : 0.0
if value {
self.highlightedBackgroundLayer.opacity = 0.0
}
} }
self.extractedContainerView.willUpdateIsExtractedToContextPreview = { [weak self] value, transition in self.extractedContainerView.willUpdateIsExtractedToContextPreview = { [weak self] value, transition in
guard let self else { guard let self else {

View File

@ -218,8 +218,7 @@ final class StarsTransactionsListPanelComponent: Component {
} else { } else {
itemTitle = peer.displayTitle(strings: environment.strings, displayOrder: .firstLast) itemTitle = peer.displayTitle(strings: environment.strings, displayOrder: .firstLast)
if item.flags.contains(.isGift) { if item.flags.contains(.isGift) {
//TODO:localize itemSubtitle = environment.strings.Stars_Intro_Transaction_Gift_Title
itemSubtitle = "Received Gift"
} else { } else {
itemSubtitle = nil itemSubtitle = nil
} }
@ -233,8 +232,8 @@ final class StarsTransactionsListPanelComponent: Component {
case .fragment: case .fragment:
if component.isAccount { if component.isAccount {
if item.flags.contains(.isGift) { if item.flags.contains(.isGift) {
itemTitle = "Unknown User" itemTitle = environment.strings.Stars_Intro_Transaction_Gift_UnknownUser
itemSubtitle = "Received Gift" itemSubtitle = environment.strings.Stars_Intro_Transaction_Gift_Title
itemPeer = .fragment itemPeer = .fragment
} else { } else {
itemTitle = environment.strings.Stars_Intro_Transaction_FragmentTopUp_Title itemTitle = environment.strings.Stars_Intro_Transaction_FragmentTopUp_Title