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
d174bacfc9
commit
a2607093bd
@ -13771,7 +13771,6 @@ Sorry for the inconvenience.";
|
|||||||
"PeerInfo.Gifts.NoResults" = "No Matching Gifts";
|
"PeerInfo.Gifts.NoResults" = "No Matching Gifts";
|
||||||
"PeerInfo.Gifts.NoResults.ViewAll" = "View All Gifts";
|
"PeerInfo.Gifts.NoResults.ViewAll" = "View All Gifts";
|
||||||
|
|
||||||
|
|
||||||
"Gift.Displayed.ChannelText" = "The gift is now shown on the channel's Page.";
|
"Gift.Displayed.ChannelText" = "The gift is now shown on the channel's Page.";
|
||||||
"Gift.Hidden.ChannelText" = "The gift is removed from the channel's Page.";
|
"Gift.Hidden.ChannelText" = "The gift is removed from the channel's Page.";
|
||||||
|
|
||||||
@ -13784,7 +13783,7 @@ Sorry for the inconvenience.";
|
|||||||
"AvatarUpload.ViewAction" = "View";
|
"AvatarUpload.ViewAction" = "View";
|
||||||
|
|
||||||
"Notification.StarGift.TitleShort" = "Gift";
|
"Notification.StarGift.TitleShort" = "Gift";
|
||||||
|
|
||||||
"Notification.StarsGift.SentSomeone" = "Someone sent you a gift";
|
"Notification.StarsGift.SentSomeone" = "Someone sent you a gift";
|
||||||
|
|
||||||
"Notification.StarsGift.UpgradeChannel" = "A gift was turned into a unique collectible";
|
"Notification.StarsGift.UpgradeChannel" = "A gift was turned into a unique collectible";
|
||||||
|
|
||||||
|
"Gift.View.ViewTonAddressUrl" = "https://tonviewer.com/%@";
|
||||||
|
@ -46,6 +46,7 @@ private final class GiftViewSheetContent: CombinedComponent {
|
|||||||
let subject: GiftViewScreen.Subject
|
let subject: GiftViewScreen.Subject
|
||||||
let cancel: (Bool) -> Void
|
let cancel: (Bool) -> Void
|
||||||
let openPeer: (EnginePeer) -> Void
|
let openPeer: (EnginePeer) -> Void
|
||||||
|
let openAddress: (String) -> Void
|
||||||
let updateSavedToProfile: (Bool) -> Void
|
let updateSavedToProfile: (Bool) -> Void
|
||||||
let convertToStars: () -> Void
|
let convertToStars: () -> Void
|
||||||
let openStarsIntro: () -> Void
|
let openStarsIntro: () -> Void
|
||||||
@ -64,6 +65,7 @@ private final class GiftViewSheetContent: CombinedComponent {
|
|||||||
subject: GiftViewScreen.Subject,
|
subject: GiftViewScreen.Subject,
|
||||||
cancel: @escaping (Bool) -> Void,
|
cancel: @escaping (Bool) -> Void,
|
||||||
openPeer: @escaping (EnginePeer) -> Void,
|
openPeer: @escaping (EnginePeer) -> Void,
|
||||||
|
openAddress: @escaping (String) -> Void,
|
||||||
updateSavedToProfile: @escaping (Bool) -> Void,
|
updateSavedToProfile: @escaping (Bool) -> Void,
|
||||||
convertToStars: @escaping () -> Void,
|
convertToStars: @escaping () -> Void,
|
||||||
openStarsIntro: @escaping () -> Void,
|
openStarsIntro: @escaping () -> Void,
|
||||||
@ -81,6 +83,7 @@ private final class GiftViewSheetContent: CombinedComponent {
|
|||||||
self.subject = subject
|
self.subject = subject
|
||||||
self.cancel = cancel
|
self.cancel = cancel
|
||||||
self.openPeer = openPeer
|
self.openPeer = openPeer
|
||||||
|
self.openAddress = openAddress
|
||||||
self.updateSavedToProfile = updateSavedToProfile
|
self.updateSavedToProfile = updateSavedToProfile
|
||||||
self.convertToStars = convertToStars
|
self.convertToStars = convertToStars
|
||||||
self.openStarsIntro = openStarsIntro
|
self.openStarsIntro = openStarsIntro
|
||||||
@ -1161,6 +1164,7 @@ private final class GiftViewSheetContent: CombinedComponent {
|
|||||||
let tableItalicFont = Font.italic(15.0)
|
let tableItalicFont = Font.italic(15.0)
|
||||||
let tableBoldItalicFont = Font.semiboldItalic(15.0)
|
let tableBoldItalicFont = Font.semiboldItalic(15.0)
|
||||||
let tableMonospaceFont = Font.monospace(15.0)
|
let tableMonospaceFont = Font.monospace(15.0)
|
||||||
|
let tableLargeMonospaceFont = Font.monospace(16.0)
|
||||||
|
|
||||||
let tableTextColor = theme.list.itemPrimaryTextColor
|
let tableTextColor = theme.list.itemPrimaryTextColor
|
||||||
let tableLinkColor = theme.list.itemAccentColor
|
let tableLinkColor = theme.list.itemAccentColor
|
||||||
@ -1280,11 +1284,26 @@ private final class GiftViewSheetContent: CombinedComponent {
|
|||||||
)
|
)
|
||||||
))
|
))
|
||||||
case let .address(address):
|
case let .address(address):
|
||||||
|
func formatAddress(_ str: String) -> String {
|
||||||
|
var result = str
|
||||||
|
let middleIndex = result.index(result.startIndex, offsetBy: str.count / 2)
|
||||||
|
result.insert("\n", at: middleIndex)
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
tableItems.append(.init(
|
tableItems.append(.init(
|
||||||
id: "address_owner",
|
id: "address_owner",
|
||||||
title: strings.Gift_Unique_Owner,
|
title: strings.Gift_Unique_Owner,
|
||||||
component: AnyComponent(
|
component: AnyComponent(
|
||||||
MultilineTextComponent(text: .plain(NSAttributedString(string: address, font: tableMonospaceFont, textColor: tableLinkColor)))
|
Button(
|
||||||
|
content: AnyComponent(
|
||||||
|
MultilineTextComponent(text: .plain(NSAttributedString(string: formatAddress(address), font: tableLargeMonospaceFont, textColor: tableLinkColor)), maximumNumberOfLines: 2, lineSpacing: 0.2)
|
||||||
|
),
|
||||||
|
action: {
|
||||||
|
component.openAddress(address)
|
||||||
|
component.cancel(true)
|
||||||
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@ -2171,6 +2190,7 @@ private final class GiftViewSheetComponent: CombinedComponent {
|
|||||||
let context: AccountContext
|
let context: AccountContext
|
||||||
let subject: GiftViewScreen.Subject
|
let subject: GiftViewScreen.Subject
|
||||||
let openPeer: (EnginePeer) -> Void
|
let openPeer: (EnginePeer) -> Void
|
||||||
|
let openAddress: (String) -> Void
|
||||||
let updateSavedToProfile: (Bool) -> Void
|
let updateSavedToProfile: (Bool) -> Void
|
||||||
let convertToStars: () -> Void
|
let convertToStars: () -> Void
|
||||||
let openStarsIntro: () -> Void
|
let openStarsIntro: () -> Void
|
||||||
@ -2187,6 +2207,7 @@ private final class GiftViewSheetComponent: CombinedComponent {
|
|||||||
context: AccountContext,
|
context: AccountContext,
|
||||||
subject: GiftViewScreen.Subject,
|
subject: GiftViewScreen.Subject,
|
||||||
openPeer: @escaping (EnginePeer) -> Void,
|
openPeer: @escaping (EnginePeer) -> Void,
|
||||||
|
openAddress: @escaping (String) -> Void,
|
||||||
updateSavedToProfile: @escaping (Bool) -> Void,
|
updateSavedToProfile: @escaping (Bool) -> Void,
|
||||||
convertToStars: @escaping () -> Void,
|
convertToStars: @escaping () -> Void,
|
||||||
openStarsIntro: @escaping () -> Void,
|
openStarsIntro: @escaping () -> Void,
|
||||||
@ -2202,6 +2223,7 @@ private final class GiftViewSheetComponent: CombinedComponent {
|
|||||||
self.context = context
|
self.context = context
|
||||||
self.subject = subject
|
self.subject = subject
|
||||||
self.openPeer = openPeer
|
self.openPeer = openPeer
|
||||||
|
self.openAddress = openAddress
|
||||||
self.updateSavedToProfile = updateSavedToProfile
|
self.updateSavedToProfile = updateSavedToProfile
|
||||||
self.convertToStars = convertToStars
|
self.convertToStars = convertToStars
|
||||||
self.openStarsIntro = openStarsIntro
|
self.openStarsIntro = openStarsIntro
|
||||||
@ -2253,6 +2275,7 @@ private final class GiftViewSheetComponent: CombinedComponent {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
openPeer: context.component.openPeer,
|
openPeer: context.component.openPeer,
|
||||||
|
openAddress: context.component.openAddress,
|
||||||
updateSavedToProfile: context.component.updateSavedToProfile,
|
updateSavedToProfile: context.component.updateSavedToProfile,
|
||||||
convertToStars: context.component.convertToStars,
|
convertToStars: context.component.convertToStars,
|
||||||
openStarsIntro: context.component.openStarsIntro,
|
openStarsIntro: context.component.openStarsIntro,
|
||||||
@ -2413,6 +2436,7 @@ public class GiftViewScreen: ViewControllerComponentContainer {
|
|||||||
self.subject = subject
|
self.subject = subject
|
||||||
|
|
||||||
var openPeerImpl: ((EnginePeer) -> Void)?
|
var openPeerImpl: ((EnginePeer) -> Void)?
|
||||||
|
var openAddressImpl: ((String) -> Void)?
|
||||||
var updateSavedToProfileImpl: ((Bool) -> Void)?
|
var updateSavedToProfileImpl: ((Bool) -> Void)?
|
||||||
var convertToStarsImpl: (() -> Void)?
|
var convertToStarsImpl: (() -> Void)?
|
||||||
var openStarsIntroImpl: (() -> Void)?
|
var openStarsIntroImpl: (() -> Void)?
|
||||||
@ -2433,6 +2457,9 @@ public class GiftViewScreen: ViewControllerComponentContainer {
|
|||||||
openPeer: { peerId in
|
openPeer: { peerId in
|
||||||
openPeerImpl?(peerId)
|
openPeerImpl?(peerId)
|
||||||
},
|
},
|
||||||
|
openAddress: { address in
|
||||||
|
openAddressImpl?(address)
|
||||||
|
},
|
||||||
updateSavedToProfile: { added in
|
updateSavedToProfile: { added in
|
||||||
updateSavedToProfileImpl?(added)
|
updateSavedToProfileImpl?(added)
|
||||||
},
|
},
|
||||||
@ -2493,6 +2520,13 @@ public class GiftViewScreen: ViewControllerComponentContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||||
|
openAddressImpl = { [weak self] address in
|
||||||
|
if let navigationController = self?.navigationController as? NavigationController {
|
||||||
|
Queue.mainQueue().after(0.3) {
|
||||||
|
context.sharedContext.openExternalUrl(context: context, urlContext: .generic, url: presentationData.strings.Gift_View_ViewTonAddressUrl(address).string, forceExternal: false, presentationData: presentationData, navigationController: navigationController, dismissInput: {})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
updateSavedToProfileImpl = { [weak self] added in
|
updateSavedToProfileImpl = { [weak self] added in
|
||||||
guard let self, let arguments = self.subject.arguments, let reference = arguments.reference else {
|
guard let self, let arguments = self.subject.arguments, let reference = arguments.reference else {
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user