mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-19 01:31:33 +00:00
Merge commit 'a4e0b271bb56a3b376d9a0216dbd3a1f8645d454'
This commit is contained in:
commit
29b8c2780e
@ -255,7 +255,13 @@ public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
months = monthsValue
|
months = monthsValue
|
||||||
text = item.presentationData.strings.Notification_PremiumGift_Subtitle(item.presentationData.strings.Notification_PremiumGift_Months(months)).string
|
text = item.presentationData.strings.Notification_PremiumGift_Subtitle(item.presentationData.strings.Notification_PremiumGift_Months(months)).string
|
||||||
case let .giftStars(_, _, count, _, _, _):
|
case let .giftStars(_, _, count, _, _, _):
|
||||||
|
if count <= 1000 {
|
||||||
|
months = 3
|
||||||
|
} else if count < 2500 {
|
||||||
months = 6
|
months = 6
|
||||||
|
} else {
|
||||||
|
months = 12
|
||||||
|
}
|
||||||
var peerName = ""
|
var peerName = ""
|
||||||
if let peer = item.message.peers[item.message.id.peerId] {
|
if let peer = item.message.peers[item.message.id.peerId] {
|
||||||
peerName = EnginePeer(peer).compactDisplayTitle
|
peerName = EnginePeer(peer).compactDisplayTitle
|
||||||
|
@ -8,7 +8,7 @@ import DeviceLocationManager
|
|||||||
|
|
||||||
func emojiFor(for meteocode: Int, date: Date, location: CLLocationCoordinate2D) -> String? {
|
func emojiFor(for meteocode: Int, date: Date, location: CLLocationCoordinate2D) -> String? {
|
||||||
var emoji = weatherEmoji(for: meteocode)
|
var emoji = weatherEmoji(for: meteocode)
|
||||||
if ["☀️", "🌤️"].contains(emoji) && isNightTime(date: date, location: location) {
|
if ["☀️", "🌤️"].contains(emoji) && isNightTime(date: date, location: location) && !"".isEmpty {
|
||||||
emoji = moonPhaseEmoji(for: date)
|
emoji = moonPhaseEmoji(for: date)
|
||||||
}
|
}
|
||||||
return emoji
|
return emoji
|
||||||
|
@ -41,6 +41,7 @@ swift_library(
|
|||||||
"//submodules/ContextUI",
|
"//submodules/ContextUI",
|
||||||
"//submodules/UndoUI",
|
"//submodules/UndoUI",
|
||||||
"//submodules/GalleryUI",
|
"//submodules/GalleryUI",
|
||||||
|
"//submodules/TelegramUI/Components/TextLoadingEffect",
|
||||||
],
|
],
|
||||||
visibility = [
|
visibility = [
|
||||||
"//visibility:public",
|
"//visibility:public",
|
||||||
|
@ -24,6 +24,7 @@ import LottieComponent
|
|||||||
import LottieComponentResourceContent
|
import LottieComponentResourceContent
|
||||||
import UndoUI
|
import UndoUI
|
||||||
import GalleryUI
|
import GalleryUI
|
||||||
|
import TextLoadingEffect
|
||||||
|
|
||||||
private final class StickerSelectionComponent: Component {
|
private final class StickerSelectionComponent: Component {
|
||||||
typealias EnvironmentType = Empty
|
typealias EnvironmentType = Empty
|
||||||
@ -2216,6 +2217,7 @@ private final class InteractiveStickerButtonContent: Component {
|
|||||||
private let backgroundLayer = SimpleLayer()
|
private let backgroundLayer = SimpleLayer()
|
||||||
let tintBackgroundLayer = SimpleLayer()
|
let tintBackgroundLayer = SimpleLayer()
|
||||||
|
|
||||||
|
private var loadingView: TextLoadingEffectView?
|
||||||
private var icon: ComponentView<Empty>
|
private var icon: ComponentView<Empty>
|
||||||
private var title: ComponentView<Empty>
|
private var title: ComponentView<Empty>
|
||||||
|
|
||||||
@ -2295,8 +2297,24 @@ private final class InteractiveStickerButtonContent: Component {
|
|||||||
}
|
}
|
||||||
transition.setFrame(view: view, frame: CGRect(origin: CGPoint(x: padding + iconSize.width + spacing, y: floorToScreenPixels((buttonSize.height - titleSize.height) / 2.0)), size: titleSize))
|
transition.setFrame(view: view, frame: CGRect(origin: CGPoint(x: padding + iconSize.width + spacing, y: floorToScreenPixels((buttonSize.height - titleSize.height) / 2.0)), size: titleSize))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let loadingView = self.loadingView {
|
||||||
|
self.loadingView = nil
|
||||||
|
loadingView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.25, removeOnCompletion: false, completion: { _ in
|
||||||
|
loadingView.removeFromSuperview()
|
||||||
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
buttonSize = CGSize(width: 87.0, height: 34.0)
|
buttonSize = CGSize(width: 87.0, height: 34.0)
|
||||||
|
|
||||||
|
let loadingView: TextLoadingEffectView
|
||||||
|
if let current = self.loadingView {
|
||||||
|
loadingView = current
|
||||||
|
} else {
|
||||||
|
loadingView = TextLoadingEffectView()
|
||||||
|
self.addSubview(loadingView)
|
||||||
|
self.loadingView = loadingView
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.backgroundLayer.cornerRadius = 6.0
|
self.backgroundLayer.cornerRadius = 6.0
|
||||||
@ -2315,6 +2333,12 @@ private final class InteractiveStickerButtonContent: Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let loadingView = self.loadingView {
|
||||||
|
let loadingSize = CGSize(width: buttonSize.width - 18.0, height: 16.0)
|
||||||
|
loadingView.update(color: UIColor.white, rect: CGRect(origin: .zero, size: loadingSize))
|
||||||
|
loadingView.frame = CGRect(origin: CGPoint(x: floorToScreenPixels((buttonSize.width - loadingSize.width) / 2.0), y: floorToScreenPixels((buttonSize.width - loadingSize.width) / 2.0)), size: loadingSize)
|
||||||
|
}
|
||||||
|
|
||||||
return buttonSize
|
return buttonSize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -737,6 +737,7 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur
|
|||||||
var appName: String?
|
var appName: String?
|
||||||
var startApp: String?
|
var startApp: String?
|
||||||
var text: String?
|
var text: String?
|
||||||
|
var profile: Bool = false
|
||||||
if let queryItems = components.queryItems {
|
if let queryItems = components.queryItems {
|
||||||
for queryItem in queryItems {
|
for queryItem in queryItems {
|
||||||
if let value = queryItem.value {
|
if let value = queryItem.value {
|
||||||
@ -779,6 +780,8 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur
|
|||||||
startGroup = ""
|
startGroup = ""
|
||||||
} else if queryItem.name == "startchannel" {
|
} else if queryItem.name == "startchannel" {
|
||||||
startChannel = ""
|
startChannel = ""
|
||||||
|
} else if queryItem.name == "profile" {
|
||||||
|
profile = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -858,6 +861,13 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur
|
|||||||
}
|
}
|
||||||
convertedUrl = result
|
convertedUrl = result
|
||||||
}
|
}
|
||||||
|
if profile, let current = convertedUrl {
|
||||||
|
if current.contains("?") {
|
||||||
|
convertedUrl = current + "&profile"
|
||||||
|
} else {
|
||||||
|
convertedUrl = current + "?profile"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if parsedUrl.host == "hostOverride" {
|
} else if parsedUrl.host == "hostOverride" {
|
||||||
if let components = URLComponents(string: "/?" + query) {
|
if let components = URLComponents(string: "/?" + query) {
|
||||||
|
@ -75,6 +75,7 @@ public enum ParsedInternalPeerUrlParameter {
|
|||||||
case story(Int32)
|
case story(Int32)
|
||||||
case boost
|
case boost
|
||||||
case text(String)
|
case text(String)
|
||||||
|
case profile
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ParsedInternalUrl {
|
public enum ParsedInternalUrl {
|
||||||
@ -318,6 +319,8 @@ public func parseInternalUrl(sharedContext: SharedAccountContext, query: String)
|
|||||||
return .peer(.name(peerName), .groupBotStart("", botAdminRights))
|
return .peer(.name(peerName), .groupBotStart("", botAdminRights))
|
||||||
} else if queryItem.name == "boost" {
|
} else if queryItem.name == "boost" {
|
||||||
return .peer(.name(peerName), .boost)
|
return .peer(.name(peerName), .boost)
|
||||||
|
} else if queryItem.name == "profile" {
|
||||||
|
return .peer(.name(peerName), .profile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -688,6 +691,8 @@ private func resolveInternalUrl(context: AccountContext, url: ParsedInternalUrl)
|
|||||||
if let peer = peer {
|
if let peer = peer {
|
||||||
if let parameter = parameter {
|
if let parameter = parameter {
|
||||||
switch parameter {
|
switch parameter {
|
||||||
|
case .profile:
|
||||||
|
return .single(.result(.peer(peer._asPeer(), .info(nil))))
|
||||||
case let .text(text):
|
case let .text(text):
|
||||||
var textInputState: ChatTextInputState?
|
var textInputState: ChatTextInputState?
|
||||||
if !text.isEmpty {
|
if !text.isEmpty {
|
||||||
|
@ -1946,7 +1946,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
|||||||
guard let self else {
|
guard let self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let shareController = ShareController(context: context, subject: .url("https://t.me/\(addressName)"))
|
let shareController = ShareController(context: context, subject: .url("https://t.me/\(addressName)?profile"))
|
||||||
shareController.actionCompleted = { [weak self] in
|
shareController.actionCompleted = { [weak self] in
|
||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
self?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
self?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user