mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-07 17:30:12 +00:00
Various fixes
This commit is contained in:
parent
ea63abbc8a
commit
bdaf5f5a02
@ -333,6 +333,7 @@ public enum ResolvedUrl {
|
|||||||
case shareStory(Int64)
|
case shareStory(Int64)
|
||||||
case storyFolder(peerId: PeerId, id: Int64)
|
case storyFolder(peerId: PeerId, id: Int64)
|
||||||
case giftCollection(peerId: PeerId, id: Int64)
|
case giftCollection(peerId: PeerId, id: Int64)
|
||||||
|
case sendGift(peerId: PeerId?)
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ResolveUrlResult {
|
public enum ResolveUrlResult {
|
||||||
|
|||||||
@ -676,8 +676,8 @@ public final class ListMessageFileItemNode: ListMessageNode {
|
|||||||
}
|
}
|
||||||
if descriptionString.isEmpty {
|
if descriptionString.isEmpty {
|
||||||
descriptionString = authorString.first ?? ""
|
descriptionString = authorString.first ?? ""
|
||||||
} else {
|
} else if let authorStringFirst = authorString.first {
|
||||||
descriptionString = "\(descriptionString) • \(authorString.first ?? "")"
|
descriptionString = "\(descriptionString) • \(authorStringFirst)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ public struct ExternalMusicAlbumArtResourceId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public var uniqueId: String {
|
public var uniqueId: String {
|
||||||
return "ext-album-art-\(isThumbnail ? "thump" : "full")-\(self.title.replacingOccurrences(of: "/", with: "_"))-\(self.performer.replacingOccurrences(of: "/", with: "_"))"
|
return "ext-album-art-\(self.isThumbnail ? "thumb" : "full")-\(self.title.replacingOccurrences(of: "/", with: "_"))-\(self.performer.replacingOccurrences(of: "/", with: "_"))"
|
||||||
}
|
}
|
||||||
|
|
||||||
public var hashValue: Int {
|
public var hashValue: Int {
|
||||||
|
|||||||
@ -1462,6 +1462,8 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode {
|
|||||||
break
|
break
|
||||||
case .giftCollection:
|
case .giftCollection:
|
||||||
break
|
break
|
||||||
|
case .sendGift:
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|||||||
@ -633,8 +633,7 @@ public final class TabSelectorComponent: Component {
|
|||||||
|
|
||||||
let estimatedContentWidth = 2.0 * spacing + innerContentWidth + (CGFloat(component.items.count - 1) * (spacing + innerInset))
|
let estimatedContentWidth = 2.0 * spacing + innerContentWidth + (CGFloat(component.items.count - 1) * (spacing + innerInset))
|
||||||
if component.customLayout?.fillWidth == true && estimatedContentWidth < availableSize.width {
|
if component.customLayout?.fillWidth == true && estimatedContentWidth < availableSize.width {
|
||||||
spacing = (availableSize.width - innerContentWidth) / CGFloat(component.items.count + 1)
|
spacing = (availableSize.width - innerContentWidth) / CGFloat(component.items.count + 1) - innerInset * 2.0
|
||||||
innerInset = 0.0
|
|
||||||
} else if estimatedContentWidth > availableSize.width && !allowScroll {
|
} else if estimatedContentWidth > availableSize.width && !allowScroll {
|
||||||
spacing = (availableSize.width - innerContentWidth) / CGFloat(component.items.count + 1)
|
spacing = (availableSize.width - innerContentWidth) / CGFloat(component.items.count + 1)
|
||||||
innerInset = 0.0
|
innerInset = 0.0
|
||||||
|
|||||||
@ -1549,5 +1549,19 @@ func openResolvedUrlImpl(
|
|||||||
}
|
}
|
||||||
navigationController?.pushViewController(controller)
|
navigationController?.pushViewController(controller)
|
||||||
}
|
}
|
||||||
|
case let .sendGift(peerId):
|
||||||
|
Task { @MainActor [weak navigationController] in
|
||||||
|
if let peerId {
|
||||||
|
let giftOptions = await (context.engine.payments.premiumGiftCodeOptions(peerId: nil, onlyCached: true) |> filter { !$0.isEmpty }).get()
|
||||||
|
|
||||||
|
let premiumOptions = giftOptions.filter { $0.users == 1 }.map { CachedPremiumGiftOption(months: $0.months, currency: $0.currency, amount: $0.amount, botUrl: "", storeProductId: $0.storeProductId) }
|
||||||
|
let controller = context.sharedContext.makeGiftOptionsController(context: context, peerId: peerId, premiumOptions: premiumOptions, hasBirthday: false, completion: nil)
|
||||||
|
controller.navigationPresentation = .modal
|
||||||
|
navigationController?.pushViewController(controller)
|
||||||
|
} else {
|
||||||
|
let controller = context.sharedContext.makePremiumGiftController(context: context, source: .settings(nil), completion: nil)
|
||||||
|
navigationController?.pushViewController(controller)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1037,6 +1037,35 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if parsedUrl.host == "send_gift" {
|
||||||
|
var recipient: String?
|
||||||
|
if let components = URLComponents(string: "/?" + query) {
|
||||||
|
if let queryItems = components.queryItems {
|
||||||
|
for queryItem in queryItems {
|
||||||
|
if let value = queryItem.value {
|
||||||
|
if queryItem.name == "to" {
|
||||||
|
recipient = value
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let recipient {
|
||||||
|
if let id = Int64(recipient) {
|
||||||
|
handleResolvedUrl(.sendGift(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id))))
|
||||||
|
} else {
|
||||||
|
let _ = (context.engine.peers.resolvePeerByName(name: recipient, referrer: nil)
|
||||||
|
|> deliverOnMainQueue).start(next: { result in
|
||||||
|
guard case let .result(peer) = result, let peer else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
handleResolvedUrl(.sendGift(peerId: peer.id))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
handleResolvedUrl(.sendGift(peerId: nil))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if parsedUrl.host == "stars" {
|
if parsedUrl.host == "stars" {
|
||||||
@ -1087,6 +1116,8 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur
|
|||||||
context.sharedContext.presentGlobalController(alertController, nil)
|
context.sharedContext.presentGlobalController(alertController, nil)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} else if parsedUrl.host == "send_gift" {
|
||||||
|
handleResolvedUrl(.sendGift(peerId: nil))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user