mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various improvements
This commit is contained in:
parent
d23c90ea7d
commit
e4d9d2e53a
@ -255,7 +255,13 @@ public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
months = monthsValue
|
||||
text = item.presentationData.strings.Notification_PremiumGift_Subtitle(item.presentationData.strings.Notification_PremiumGift_Months(months)).string
|
||||
case let .giftStars(_, _, count, _, _, _):
|
||||
months = 6
|
||||
if count <= 1000 {
|
||||
months = 3
|
||||
} else if count < 2500 {
|
||||
months = 6
|
||||
} else {
|
||||
months = 12
|
||||
}
|
||||
var peerName = ""
|
||||
if let peer = item.message.peers[item.message.id.peerId] {
|
||||
peerName = EnginePeer(peer).compactDisplayTitle
|
||||
|
@ -8,7 +8,7 @@ import DeviceLocationManager
|
||||
|
||||
func emojiFor(for meteocode: Int, date: Date, location: CLLocationCoordinate2D) -> String? {
|
||||
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)
|
||||
}
|
||||
return emoji
|
||||
|
@ -41,6 +41,7 @@ swift_library(
|
||||
"//submodules/ContextUI",
|
||||
"//submodules/UndoUI",
|
||||
"//submodules/GalleryUI",
|
||||
"//submodules/TelegramUI/Components/TextLoadingEffect",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
|
@ -24,6 +24,7 @@ import LottieComponent
|
||||
import LottieComponentResourceContent
|
||||
import UndoUI
|
||||
import GalleryUI
|
||||
import TextLoadingEffect
|
||||
|
||||
private final class StickerSelectionComponent: Component {
|
||||
typealias EnvironmentType = Empty
|
||||
@ -2216,6 +2217,7 @@ private final class InteractiveStickerButtonContent: Component {
|
||||
private let backgroundLayer = SimpleLayer()
|
||||
let tintBackgroundLayer = SimpleLayer()
|
||||
|
||||
private var loadingView: TextLoadingEffectView?
|
||||
private var icon: 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))
|
||||
}
|
||||
|
||||
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 {
|
||||
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
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -737,6 +737,7 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur
|
||||
var appName: String?
|
||||
var startApp: String?
|
||||
var text: String?
|
||||
var profile: Bool = false
|
||||
if let queryItems = components.queryItems {
|
||||
for queryItem in queryItems {
|
||||
if let value = queryItem.value {
|
||||
@ -779,6 +780,8 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur
|
||||
startGroup = ""
|
||||
} else if queryItem.name == "startchannel" {
|
||||
startChannel = ""
|
||||
} else if queryItem.name == "profile" {
|
||||
profile = true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -858,6 +861,13 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur
|
||||
}
|
||||
convertedUrl = result
|
||||
}
|
||||
if profile, let current = convertedUrl {
|
||||
if current.contains("?") {
|
||||
convertedUrl = current + "&profile"
|
||||
} else {
|
||||
convertedUrl = current + "?profile"
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if parsedUrl.host == "hostOverride" {
|
||||
if let components = URLComponents(string: "/?" + query) {
|
||||
|
@ -75,6 +75,7 @@ public enum ParsedInternalPeerUrlParameter {
|
||||
case story(Int32)
|
||||
case boost
|
||||
case text(String)
|
||||
case profile
|
||||
}
|
||||
|
||||
public enum ParsedInternalUrl {
|
||||
@ -318,6 +319,8 @@ public func parseInternalUrl(sharedContext: SharedAccountContext, query: String)
|
||||
return .peer(.name(peerName), .groupBotStart("", botAdminRights))
|
||||
} else if queryItem.name == "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 parameter = parameter {
|
||||
switch parameter {
|
||||
case .profile:
|
||||
return .single(.result(.peer(peer._asPeer(), .info(nil))))
|
||||
case let .text(text):
|
||||
var textInputState: ChatTextInputState?
|
||||
if !text.isEmpty {
|
||||
|
@ -1946,7 +1946,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
||||
guard let self else {
|
||||
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
|
||||
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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user