Skip to content

Commit

Permalink
Various fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
laktyushin committed Aug 2, 2024
1 parent 4a44c61 commit aff6322
Show file tree
Hide file tree
Showing 62 changed files with 1,377 additions and 810 deletions.
6 changes: 4 additions & 2 deletions submodules/AccountContext/Sources/AccountContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ public enum ResolvedUrl {
case startAttach(peerId: PeerId, payload: String?, choose: ResolvedBotChoosePeerTypes?)
case invoice(slug: String, invoice: TelegramMediaInvoice?)
case premiumOffer(reference: String?)
case starsTopup(amount: Int64?)
case chatFolder(slug: String)
case story(peerId: PeerId, id: Int32)
case boost(peerId: PeerId?, status: ChannelBoostStatus?, myBoostStatus: MyBoostStatus?)
Expand Down Expand Up @@ -755,7 +756,7 @@ public class MediaEditorTransitionOutExternalState {
}

public protocol MediaEditorScreenResult {

var target: Stories.PendingTarget { get }
}

public protocol TelegramRootControllerInterface: NavigationController {
Expand Down Expand Up @@ -963,7 +964,8 @@ public protocol SharedAccountContext: AnyObject {
func presentContactsWarningSuppression(context: AccountContext, present: (ViewController, Any?) -> Void)
func openImagePicker(context: AccountContext, completion: @escaping (UIImage) -> Void, present: @escaping (ViewController) -> Void)
func openAddPeerMembers(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)?, parentController: ViewController, groupPeer: Peer, selectAddMemberDisposable: MetaDisposable, addMemberDisposable: MetaDisposable)
func openChatInstantPage(context: AccountContext, message: Message, sourcePeerType: MediaAutoDownloadPeerType?, navigationController: NavigationController)
func makeInstantPageController(context: AccountContext, message: Message, sourcePeerType: MediaAutoDownloadPeerType?) -> ViewController?
func makeInstantPageController(context: AccountContext, webPage: TelegramMediaWebpage, anchor: String?, sourceLocation: InstantPageSourceLocation) -> ViewController
func openChatWallpaper(context: AccountContext, message: Message, present: @escaping (ViewController, Any?) -> Void)

func makeRecentSessionsController(context: AccountContext, activeSessionsContext: ActiveSessionsContext) -> ViewController & RecentSessionsController
Expand Down
4 changes: 2 additions & 2 deletions submodules/AccountContext/Sources/ChatController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,12 @@ public struct ChatControllerInitialAttachBotStart {
}

public struct ChatControllerInitialBotAppStart {
public let botApp: BotApp
public let botApp: BotApp?
public let payload: String?
public let justInstalled: Bool
public let compact: Bool

public init(botApp: BotApp, payload: String?, justInstalled: Bool, compact: Bool) {
public init(botApp: BotApp?, payload: String?, justInstalled: Bool, compact: Bool) {
self.botApp = botApp
self.payload = payload
self.justInstalled = justInstalled
Expand Down
2 changes: 1 addition & 1 deletion submodules/AccountContext/Sources/Premium.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public enum BoostSubject: Equatable {
}

public enum StarsPurchasePurpose: Equatable {
case generic
case generic(requiredStars: Int64?)
case transfer(peerId: EnginePeer.Id, requiredStars: Int64)
case subscription(peerId: EnginePeer.Id, requiredStars: Int64, renew: Bool)
case gift(peerId: EnginePeer.Id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ public final class DefaultAnimatedStickerNodeImpl: ASDisplayNode, AnimatedSticke

strongSelf.frameUpdated(frame.index, frame.totalFrames)
strongSelf.currentFrameIndex = frame.index
strongSelf.currentFrameCount = frame.totalFrames;
strongSelf.currentFrameCount = frame.totalFrames
strongSelf.currentFrameRate = frameRate

if frame.isLastFrame {
Expand Down
2 changes: 1 addition & 1 deletion submodules/AttachmentUI/Sources/AttachmentController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ public class AttachmentController: ViewController, MinimizableController {
}
if case .ended = recognizer.state {
if let lastController = self.currentControllers.last {
if let controller = self.controller, controller.shouldMinimizeOnSwipe?(self.currentType) == true {
if let controller = self.controller, let layout = self.validLayout, !layout.metrics.isTablet, controller.shouldMinimizeOnSwipe?(self.currentType) == true {
self.minimize()
return
}
Expand Down
1 change: 1 addition & 0 deletions submodules/BrowserUI/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ swift_library(
"//submodules/SearchBarNode",
"//submodules/TelegramUI/Components/SaveProgressScreen",
"//submodules/TelegramUI/Components/ListActionItemComponent",
"//submodules/Utils/DeviceModel",
],
visibility = [
"//visibility:public",
Expand Down
24 changes: 2 additions & 22 deletions submodules/BrowserUI/Sources/BrowserAddressBarComponent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,7 @@ final class AddressBarContentComponent: Component {
}
let isActive = self.textField?.isFirstResponder ?? false

var title: String = ""
if let parsedUrl = URL(string: component.url) {
title = parsedUrl.host ?? component.url
if title.hasPrefix("www.") {
title.removeSubrange(title.startIndex ..< title.index(title.startIndex, offsetBy: 4))
}
title = title.idnaDecoded ?? title
}

let title = getDisplayUrl(component.url, hostOnly: true)
self.update(theme: component.theme, strings: component.strings, size: availableSize, isActive: isActive, title: title.lowercased(), isSecure: component.isSecure, collapseFraction: collapseFraction, isTablet: component.metrics.isTablet, transition: transition)

return availableSize
Expand Down Expand Up @@ -449,19 +441,7 @@ final class AddressBarContentComponent: Component {
textField.addTarget(self, action: #selector(self.textFieldChanged(_:)), for: .editingChanged)
}

var address = self.component?.url ?? ""
if let components = URLComponents(string: address) {
if #available(iOS 16.0, *), let encodedHost = components.encodedHost {
if let decodedHost = components.host, encodedHost != decodedHost {
address = address.replacingOccurrences(of: encodedHost, with: decodedHost)
}
} else if let encodedHost = components.host {
if let decodedHost = components.host?.idnaDecoded, encodedHost != decodedHost {
address = address.replacingOccurrences(of: encodedHost, with: decodedHost)
}
}
}

let address = getDisplayUrl(self.component?.url ?? "", trim: false)
if textField.text != address {
textField.text = address
self.clearIconView.isHidden = address.isEmpty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,23 +176,7 @@ final class BrowserAddressListItemComponent: Component {
if case let .Loaded(content) = component.webPage.content {
title = content.title ?? content.url

var address = content.url
if let components = URLComponents(string: address) {
if #available(iOS 16.0, *), let encodedHost = components.encodedHost {
if let decodedHost = components.host, encodedHost != decodedHost {
address = address.replacingOccurrences(of: encodedHost, with: decodedHost)
}
} else if let encodedHost = components.host {
if let decodedHost = components.host?.idnaDecoded, encodedHost != decodedHost {
address = address.replacingOccurrences(of: encodedHost, with: decodedHost)
}
}
}
address = address.replacingOccurrences(of: "https://www.", with: "")
address = address.replacingOccurrences(of: "https://", with: "")
address = address.replacingOccurrences(of: "tonsite://", with: "")
address = address.trimmingCharacters(in: CharacterSet(charactersIn: "/"))
subtitle = address
subtitle = getDisplayUrl(content.url)

parsedUrl = URL(string: content.url)

Expand Down
2 changes: 1 addition & 1 deletion submodules/BrowserUI/Sources/BrowserBookmarksScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ public final class BrowserBookmarksScreen: ViewController {

self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Back, style: .plain, target: nil, action: nil)

self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Cancel, style: .plain, target: self, action: #selector(self.cancelPressed))
self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Close, style: .plain, target: self, action: #selector(self.cancelPressed))
self.title = self.presentationData.strings.WebBrowser_Bookmarks_Title

self.searchContentNode = NavigationBarSearchContentNode(theme: self.presentationData.theme, placeholder: self.presentationData.strings.Common_Search, activate: { [weak self] in
Expand Down
Loading

0 comments on commit aff6322

Please sign in to comment.