mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge commit 'ab5595c8d4ee03ec2500b6ccfc88f81b10e36859'
This commit is contained in:
commit
e2ea61dfe9
@ -13789,8 +13789,7 @@ Sorry for the inconvenience.";
|
|||||||
"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.TonGiftInfo" = "This gift is owned by a TON account. [View >]()";
|
"Gift.View.TonGiftAddressInfo" = "This gift is in TON Blockchain. [View >]()";
|
||||||
"Gift.View.ViewTonAddressUrl" = "https://tonviewer.com/%@";
|
|
||||||
"Gift.View.CopiedAddress" = "TON address copied to clipboard.";
|
"Gift.View.CopiedAddress" = "TON address copied to clipboard.";
|
||||||
|
|
||||||
"NameColor.AddProfileIcons" = "Add Icons To Profile";
|
"NameColor.AddProfileIcons" = "Add Icons To Profile";
|
||||||
|
@ -233,17 +233,6 @@
|
|||||||
[_wrapperView addSubview:_recipientLabel];
|
[_wrapperView addSubview:_recipientLabel];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasCameraButton)
|
|
||||||
{
|
|
||||||
_cameraButton = [[TGMediaPickerCameraButton alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 44.0f, 44.0f)];
|
|
||||||
_cameraButton.adjustsImageWhenHighlighted = false;
|
|
||||||
[_cameraButton addTarget:self action:@selector(cameraButtonPressed) forControlEvents:UIControlEventTouchUpInside];
|
|
||||||
|
|
||||||
[_wrapperView addSubview:_cameraButton];
|
|
||||||
|
|
||||||
//if (_selectionContext != nil)
|
|
||||||
// [_cameraButton setHidden:true animated:false];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_selectionContext != nil)
|
if (_selectionContext != nil)
|
||||||
{
|
{
|
||||||
@ -429,6 +418,15 @@
|
|||||||
[_wrapperView addSubview:_coverGalleryButton];
|
[_wrapperView addSubview:_coverGalleryButton];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasCameraButton)
|
||||||
|
{
|
||||||
|
_cameraButton = [[TGMediaPickerCameraButton alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 44.0f, 44.0f)];
|
||||||
|
_cameraButton.adjustsImageWhenHighlighted = false;
|
||||||
|
[_cameraButton addTarget:self action:@selector(cameraButtonPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
|
||||||
|
[_wrapperView addSubview:_cameraButton];
|
||||||
|
}
|
||||||
|
|
||||||
TGPhotoEditorDoneButton doneButton = isScheduledMessages ? TGPhotoEditorDoneButtonSchedule : TGPhotoEditorDoneButtonSend;
|
TGPhotoEditorDoneButton doneButton = isScheduledMessages ? TGPhotoEditorDoneButtonSchedule : TGPhotoEditorDoneButtonSend;
|
||||||
|
|
||||||
_portraitToolbarView = [[TGPhotoToolbarView alloc] initWithContext:_context backButton:TGPhotoEditorBackButtonBack doneButton:doneButton solidBackground:false];
|
_portraitToolbarView = [[TGPhotoToolbarView alloc] initWithContext:_context backButton:TGPhotoEditorBackButtonBack doneButton:doneButton solidBackground:false];
|
||||||
|
@ -322,7 +322,8 @@ func managedUniqueStarGifts(accountPeerId: PeerId, postbox: Postbox, network: Ne
|
|||||||
.pattern(name: "", file: patternFile, rarity: 0),
|
.pattern(name: "", file: patternFile, rarity: 0),
|
||||||
.backdrop(name: "", innerColor: innerColor, outerColor: outerColor, patternColor: patternColor, textColor: textColor, rarity: 0)
|
.backdrop(name: "", innerColor: innerColor, outerColor: outerColor, patternColor: patternColor, textColor: textColor, rarity: 0)
|
||||||
],
|
],
|
||||||
availability: StarGift.UniqueGift.Availability(issued: 0, total: 0)
|
availability: StarGift.UniqueGift.Availability(issued: 0, total: 0),
|
||||||
|
giftAddress: nil
|
||||||
)
|
)
|
||||||
if let entry = CodableEntry(RecentStarGiftItem(gift)) {
|
if let entry = CodableEntry(RecentStarGiftItem(gift)) {
|
||||||
items.append(OrderedItemListEntry(id: RecentStarGiftItemId(id).rawValue, contents: entry))
|
items.append(OrderedItemListEntry(id: RecentStarGiftItemId(id).rawValue, contents: entry))
|
||||||
|
@ -210,6 +210,7 @@ public enum StarGift: Equatable, Codable, PostboxCoding {
|
|||||||
case ownerAddress
|
case ownerAddress
|
||||||
case attributes
|
case attributes
|
||||||
case availability
|
case availability
|
||||||
|
case giftAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Attribute: Equatable, Codable, PostboxCoding {
|
public enum Attribute: Equatable, Codable, PostboxCoding {
|
||||||
@ -449,8 +450,9 @@ public enum StarGift: Equatable, Codable, PostboxCoding {
|
|||||||
public let owner: Owner
|
public let owner: Owner
|
||||||
public let attributes: [Attribute]
|
public let attributes: [Attribute]
|
||||||
public let availability: Availability
|
public let availability: Availability
|
||||||
|
public let giftAddress: String?
|
||||||
|
|
||||||
public init(id: Int64, title: String, number: Int32, slug: String, owner: Owner, attributes: [Attribute], availability: Availability) {
|
public init(id: Int64, title: String, number: Int32, slug: String, owner: Owner, attributes: [Attribute], availability: Availability, giftAddress: String?) {
|
||||||
self.id = id
|
self.id = id
|
||||||
self.title = title
|
self.title = title
|
||||||
self.number = number
|
self.number = number
|
||||||
@ -458,6 +460,7 @@ public enum StarGift: Equatable, Codable, PostboxCoding {
|
|||||||
self.owner = owner
|
self.owner = owner
|
||||||
self.attributes = attributes
|
self.attributes = attributes
|
||||||
self.availability = availability
|
self.availability = availability
|
||||||
|
self.giftAddress = giftAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(from decoder: Decoder) throws {
|
public init(from decoder: Decoder) throws {
|
||||||
@ -477,6 +480,7 @@ public enum StarGift: Equatable, Codable, PostboxCoding {
|
|||||||
}
|
}
|
||||||
self.attributes = try container.decode([UniqueGift.Attribute].self, forKey: .attributes)
|
self.attributes = try container.decode([UniqueGift.Attribute].self, forKey: .attributes)
|
||||||
self.availability = try container.decode(UniqueGift.Availability.self, forKey: .availability)
|
self.availability = try container.decode(UniqueGift.Availability.self, forKey: .availability)
|
||||||
|
self.giftAddress = try container.decodeIfPresent(String.self, forKey: .giftAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(decoder: PostboxDecoder) {
|
public init(decoder: PostboxDecoder) {
|
||||||
@ -495,6 +499,7 @@ public enum StarGift: Equatable, Codable, PostboxCoding {
|
|||||||
}
|
}
|
||||||
self.attributes = (try? decoder.decodeObjectArrayWithCustomDecoderForKey(CodingKeys.attributes.rawValue, decoder: { UniqueGift.Attribute(decoder: $0) })) ?? []
|
self.attributes = (try? decoder.decodeObjectArrayWithCustomDecoderForKey(CodingKeys.attributes.rawValue, decoder: { UniqueGift.Attribute(decoder: $0) })) ?? []
|
||||||
self.availability = decoder.decodeObjectForKey(CodingKeys.availability.rawValue, decoder: { UniqueGift.Availability(decoder: $0) }) as! UniqueGift.Availability
|
self.availability = decoder.decodeObjectForKey(CodingKeys.availability.rawValue, decoder: { UniqueGift.Availability(decoder: $0) }) as! UniqueGift.Availability
|
||||||
|
self.giftAddress = decoder.decodeOptionalStringForKey(CodingKeys.giftAddress.rawValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
@ -513,6 +518,7 @@ public enum StarGift: Equatable, Codable, PostboxCoding {
|
|||||||
}
|
}
|
||||||
try container.encode(self.attributes, forKey: .attributes)
|
try container.encode(self.attributes, forKey: .attributes)
|
||||||
try container.encode(self.availability, forKey: .availability)
|
try container.encode(self.availability, forKey: .availability)
|
||||||
|
try container.encodeIfPresent(self.giftAddress, forKey: .giftAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(_ encoder: PostboxEncoder) {
|
public func encode(_ encoder: PostboxEncoder) {
|
||||||
@ -530,6 +536,11 @@ public enum StarGift: Equatable, Codable, PostboxCoding {
|
|||||||
}
|
}
|
||||||
encoder.encodeObjectArray(self.attributes, forKey: CodingKeys.attributes.rawValue)
|
encoder.encodeObjectArray(self.attributes, forKey: CodingKeys.attributes.rawValue)
|
||||||
encoder.encodeObject(self.availability, forKey: CodingKeys.availability.rawValue)
|
encoder.encodeObject(self.availability, forKey: CodingKeys.availability.rawValue)
|
||||||
|
if let giftAddress = self.giftAddress {
|
||||||
|
encoder.encodeString(giftAddress, forKey: CodingKeys.giftAddress.rawValue)
|
||||||
|
} else {
|
||||||
|
encoder.encodeNil(forKey: CodingKeys.giftAddress.rawValue)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -615,7 +626,7 @@ extension StarGift {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
self = .generic(StarGift.Gift(id: id, file: file, price: stars, convertStars: convertStars, availability: availability, soldOut: soldOut, flags: flags, upgradeStars: upgradeStars))
|
self = .generic(StarGift.Gift(id: id, file: file, price: stars, convertStars: convertStars, availability: availability, soldOut: soldOut, flags: flags, upgradeStars: upgradeStars))
|
||||||
case let .starGiftUnique(_, id, title, slug, num, ownerPeerId, ownerName, ownerAddress, attributes, availabilityIssued, availabilityTotal, _):
|
case let .starGiftUnique(_, id, title, slug, num, ownerPeerId, ownerName, ownerAddress, attributes, availabilityIssued, availabilityTotal, giftAddress):
|
||||||
let owner: StarGift.UniqueGift.Owner
|
let owner: StarGift.UniqueGift.Owner
|
||||||
if let ownerAddress {
|
if let ownerAddress {
|
||||||
owner = .address(ownerAddress)
|
owner = .address(ownerAddress)
|
||||||
@ -626,7 +637,7 @@ extension StarGift {
|
|||||||
} else {
|
} else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
self = .unique(StarGift.UniqueGift(id: id, title: title, number: num, slug: slug, owner: owner, attributes: attributes.compactMap { UniqueGift.Attribute(apiAttribute: $0) }, availability: UniqueGift.Availability(issued: availabilityIssued, total: availabilityTotal)))
|
self = .unique(StarGift.UniqueGift(id: id, title: title, number: num, slug: slug, owner: owner, attributes: attributes.compactMap { UniqueGift.Attribute(apiAttribute: $0) }, availability: UniqueGift.Availability(issued: availabilityIssued, total: availabilityTotal), giftAddress: giftAddress))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1270,6 +1281,7 @@ public final class ProfileGiftsContext {
|
|||||||
case canExportDate
|
case canExportDate
|
||||||
case upgradeStars
|
case upgradeStars
|
||||||
case transferStars
|
case transferStars
|
||||||
|
case giftAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
public let gift: TelegramCore.StarGift
|
public let gift: TelegramCore.StarGift
|
||||||
|
@ -411,10 +411,6 @@ public final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode {
|
|||||||
let panelHeight = defaultHeight(metrics: metrics)
|
let panelHeight = defaultHeight(metrics: metrics)
|
||||||
|
|
||||||
if self.discussButton.isHidden {
|
if self.discussButton.isHidden {
|
||||||
if let action = self.action, action == .muteNotifications || action == .unmuteNotifications {
|
|
||||||
let buttonWidth = self.button.calculateSizeThatFits(CGSize(width: width, height: panelHeight)).width + 24.0
|
|
||||||
self.button.frame = CGRect(origin: CGPoint(x: floor((width - buttonWidth) / 2.0), y: 0.0), size: CGSize(width: buttonWidth, height: panelHeight))
|
|
||||||
|
|
||||||
if let peer = interfaceState.renderedPeer?.peer as? TelegramChannel {
|
if let peer = interfaceState.renderedPeer?.peer as? TelegramChannel {
|
||||||
if case .broadcast = peer.info, interfaceState.starGiftsAvailable {
|
if case .broadcast = peer.info, interfaceState.starGiftsAvailable {
|
||||||
if self.giftButton.isHidden && !isFirstTime {
|
if self.giftButton.isHidden && !isFirstTime {
|
||||||
@ -426,18 +422,22 @@ public final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode {
|
|||||||
self.helpButton.isHidden = true
|
self.helpButton.isHidden = true
|
||||||
|
|
||||||
self.presentGiftTooltip()
|
self.presentGiftTooltip()
|
||||||
} else if peer.flags.contains(.isGigagroup) {
|
} else if peer.flags.contains(.isGigagroup), self.action == .muteNotifications || self.action == .unmuteNotifications {
|
||||||
self.giftButton.isHidden = true
|
self.giftButton.isHidden = true
|
||||||
self.helpButton.isHidden = false
|
self.helpButton.isHidden = false
|
||||||
|
} else {
|
||||||
|
self.giftButton.isHidden = true
|
||||||
|
self.helpButton.isHidden = true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.giftButton.isHidden = true
|
self.giftButton.isHidden = true
|
||||||
self.helpButton.isHidden = true
|
self.helpButton.isHidden = true
|
||||||
}
|
}
|
||||||
|
if let action = self.action, action == .muteNotifications || action == .unmuteNotifications {
|
||||||
|
let buttonWidth = self.button.calculateSizeThatFits(CGSize(width: width, height: panelHeight)).width + 24.0
|
||||||
|
self.button.frame = CGRect(origin: CGPoint(x: floor((width - buttonWidth) / 2.0), y: 0.0), size: CGSize(width: buttonWidth, height: panelHeight))
|
||||||
} else {
|
} else {
|
||||||
self.button.frame = CGRect(origin: CGPoint(x: leftInset, y: 0.0), size: CGSize(width: width - leftInset - rightInset, height: panelHeight))
|
self.button.frame = CGRect(origin: CGPoint(x: leftInset, y: 0.0), size: CGSize(width: width - leftInset - rightInset, height: panelHeight))
|
||||||
self.giftButton.isHidden = true
|
|
||||||
self.helpButton.isHidden = true
|
|
||||||
}
|
}
|
||||||
self.giftButton.frame = CGRect(x: width - rightInset - panelHeight - 5.0, y: 0.0, width: panelHeight, height: panelHeight)
|
self.giftButton.frame = CGRect(x: width - rightInset - panelHeight - 5.0, y: 0.0, width: panelHeight, height: panelHeight)
|
||||||
self.helpButton.frame = CGRect(x: width - rightInset - panelHeight, y: 0.0, width: panelHeight, height: panelHeight)
|
self.helpButton.frame = CGRect(x: width - rightInset - panelHeight, y: 0.0, width: panelHeight, height: panelHeight)
|
||||||
|
@ -291,6 +291,8 @@ public final class GiftItemComponent: Component {
|
|||||||
var patternFile: TelegramMediaFile?
|
var patternFile: TelegramMediaFile?
|
||||||
var files: [Int64: TelegramMediaFile] = [:]
|
var files: [Int64: TelegramMediaFile] = [:]
|
||||||
|
|
||||||
|
var placeholderColor = component.theme.list.mediaPlaceholderColor
|
||||||
|
|
||||||
let emoji: ChatTextInputTextCustomEmojiAttribute?
|
let emoji: ChatTextInputTextCustomEmojiAttribute?
|
||||||
var animationOffset: CGFloat = 0.0
|
var animationOffset: CGFloat = 0.0
|
||||||
switch component.subject {
|
switch component.subject {
|
||||||
@ -326,6 +328,9 @@ public final class GiftItemComponent: Component {
|
|||||||
backgroundColor = UIColor(rgb: UInt32(bitPattern: outerColorValue))
|
backgroundColor = UIColor(rgb: UInt32(bitPattern: outerColorValue))
|
||||||
secondBackgroundColor = UIColor(rgb: UInt32(bitPattern: innerColorValue))
|
secondBackgroundColor = UIColor(rgb: UInt32(bitPattern: innerColorValue))
|
||||||
patternColor = UIColor(rgb: UInt32(bitPattern: patternColorValue))
|
patternColor = UIColor(rgb: UInt32(bitPattern: patternColorValue))
|
||||||
|
if let backgroundColor {
|
||||||
|
placeholderColor = backgroundColor
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -352,7 +357,7 @@ public final class GiftItemComponent: Component {
|
|||||||
cache: component.context.animationCache,
|
cache: component.context.animationCache,
|
||||||
renderer: component.context.animationRenderer,
|
renderer: component.context.animationRenderer,
|
||||||
unique: false,
|
unique: false,
|
||||||
placeholderColor: component.theme.list.mediaPlaceholderColor,
|
placeholderColor: placeholderColor,
|
||||||
pointSize: CGSize(width: iconSize.width * 2.0, height: iconSize.height * 2.0),
|
pointSize: CGSize(width: iconSize.width * 2.0, height: iconSize.height * 2.0),
|
||||||
loopCount: 1
|
loopCount: 1
|
||||||
)
|
)
|
||||||
|
@ -275,7 +275,7 @@ final class GiftOptionsScreenComponent: Component {
|
|||||||
|
|
||||||
let starsTitleOffset: CGFloat
|
let starsTitleOffset: CGFloat
|
||||||
let starsTitleFraction: CGFloat
|
let starsTitleFraction: CGFloat
|
||||||
if contentOffset > 350 {
|
if contentOffset > 350, self.starsTitle.view != nil {
|
||||||
starsTitleOffset = contentOffset + max(0.0, min(1.0, (contentOffset - 350.0) / starsTitleOffsetDelta)) * 10.0
|
starsTitleOffset = contentOffset + max(0.0, min(1.0, (contentOffset - 350.0) / starsTitleOffsetDelta)) * 10.0
|
||||||
starsTitleFraction = max(0.0, min(1.0, (starsTitleOffset - 350.0) / starsTitleOffsetDelta))
|
starsTitleFraction = max(0.0, min(1.0, (starsTitleOffset - 350.0) / starsTitleOffsetDelta))
|
||||||
if contentOffset > 380.0 {
|
if contentOffset > 380.0 {
|
||||||
|
@ -1889,9 +1889,9 @@ private final class GiftViewSheetContent: CombinedComponent {
|
|||||||
}
|
}
|
||||||
var addressToOpen: String?
|
var addressToOpen: String?
|
||||||
var descriptionText: String
|
var descriptionText: String
|
||||||
if let uniqueGift, case let .address(address) = uniqueGift.owner {
|
if let uniqueGift, let address = uniqueGift.giftAddress {
|
||||||
addressToOpen = address
|
addressToOpen = address
|
||||||
descriptionText = strings.Gift_View_TonGiftInfo
|
descriptionText = strings.Gift_View_TonGiftAddressInfo
|
||||||
} else if savedToProfile {
|
} else if savedToProfile {
|
||||||
descriptionText = isChannelGift ? strings.Gift_View_DisplayedInfoHide_Channel : strings.Gift_View_DisplayedInfoHide
|
descriptionText = isChannelGift ? strings.Gift_View_DisplayedInfoHide_Channel : strings.Gift_View_DisplayedInfoHide
|
||||||
} else if let upgradeStars, upgradeStars > 0 && !upgraded {
|
} else if let upgradeStars, upgradeStars > 0 && !upgraded {
|
||||||
@ -2562,8 +2562,10 @@ 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
|
openAddressImpl = { [weak self] address in
|
||||||
if let navigationController = self?.navigationController as? NavigationController {
|
if let navigationController = self?.navigationController as? NavigationController {
|
||||||
|
let configuration = GiftViewConfiguration.with(appConfiguration: context.currentAppConfiguration.with { $0 })
|
||||||
|
let url = configuration.explorerUrl + address
|
||||||
Queue.mainQueue().after(0.3) {
|
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: {})
|
context.sharedContext.openExternalUrl(context: context, urlContext: .generic, url: url, forceExternal: false, presentationData: presentationData, navigationController: navigationController, dismissInput: {})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3914,3 +3916,23 @@ private final class AvatarComponent: Component {
|
|||||||
return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition)
|
return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private struct GiftViewConfiguration {
|
||||||
|
public static var defaultValue: GiftViewConfiguration {
|
||||||
|
return GiftViewConfiguration(explorerUrl: "https://tonviewer.com")
|
||||||
|
}
|
||||||
|
|
||||||
|
public let explorerUrl: String
|
||||||
|
|
||||||
|
fileprivate init(explorerUrl: String) {
|
||||||
|
self.explorerUrl = explorerUrl
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func with(appConfiguration: AppConfiguration) -> GiftViewConfiguration {
|
||||||
|
if let data = appConfiguration.data, let value = data["ton_blockchain_explorer_url"] as? String {
|
||||||
|
return GiftViewConfiguration(explorerUrl: value)
|
||||||
|
} else {
|
||||||
|
return .defaultValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -10,7 +10,7 @@ import ShareController
|
|||||||
import LegacyUI
|
import LegacyUI
|
||||||
import LegacyMediaPickerUI
|
import LegacyMediaPickerUI
|
||||||
|
|
||||||
public func presentedLegacyCamera(context: AccountContext, peer: Peer?, chatLocation: ChatLocation, cameraView: TGAttachmentCameraView?, menuController: TGMenuSheetController?, parentController: ViewController, attachmentController: ViewController? = nil, editingMedia: Bool, saveCapturedPhotos: Bool, mediaGrouping: Bool, initialCaption: NSAttributedString, hasSchedule: Bool, enablePhoto: Bool, enableVideo: Bool, sendMessagesWithSignals: @escaping ([Any]?, Bool, Int32) -> Void, recognizedQRCode: @escaping (String) -> Void = { _ in }, presentSchedulePicker: @escaping (Bool, @escaping (Int32) -> Void) -> Void, presentTimerPicker: @escaping (@escaping (Int32) -> Void) -> Void, getCaptionPanelView: @escaping () -> TGCaptionPanelView?, dismissedWithResult: @escaping () -> Void = {}, finishedTransitionIn: @escaping () -> Void = {}) {
|
public func presentedLegacyCamera(context: AccountContext, peer: Peer?, chatLocation: ChatLocation, cameraView: TGAttachmentCameraView?, menuController: TGMenuSheetController?, parentController: ViewController, attachmentController: ViewController? = nil, editingMedia: Bool, saveCapturedPhotos: Bool, mediaGrouping: Bool, initialCaption: NSAttributedString, hasSchedule: Bool, enablePhoto: Bool, enableVideo: Bool, sendMessagesWithSignals: @escaping ([Any]?, Bool, Int32, ChatSendMessageActionSheetController.SendParameters?) -> Void, recognizedQRCode: @escaping (String) -> Void = { _ in }, presentSchedulePicker: @escaping (Bool, @escaping (Int32) -> Void) -> Void, presentTimerPicker: @escaping (@escaping (Int32) -> Void) -> Void, getCaptionPanelView: @escaping () -> TGCaptionPanelView?, dismissedWithResult: @escaping () -> Void = {}, finishedTransitionIn: @escaping () -> Void = {}) {
|
||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
let legacyController = LegacyController(presentation: .custom, theme: presentationData.theme)
|
let legacyController = LegacyController(presentation: .custom, theme: presentationData.theme)
|
||||||
legacyController.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .portrait, compactSize: .portrait)
|
legacyController.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .portrait, compactSize: .portrait)
|
||||||
@ -142,11 +142,17 @@ public func presentedLegacyCamera(context: AccountContext, peer: Peer?, chatLoca
|
|||||||
|
|
||||||
controller.finishedWithResults = { [weak menuController, weak legacyController] overlayController, selectionContext, editingContext, currentItem, silentPosting, scheduleTime in
|
controller.finishedWithResults = { [weak menuController, weak legacyController] overlayController, selectionContext, editingContext, currentItem, silentPosting, scheduleTime in
|
||||||
if let selectionContext = selectionContext, let editingContext = editingContext {
|
if let selectionContext = selectionContext, let editingContext = editingContext {
|
||||||
|
let textIsAboveMedia = editingContext.isCaptionAbove()
|
||||||
|
let parameters = ChatSendMessageActionSheetController.SendParameters(
|
||||||
|
effect: nil,
|
||||||
|
textIsAboveMedia: textIsAboveMedia
|
||||||
|
)
|
||||||
|
|
||||||
let nativeGenerator = legacyAssetPickerItemGenerator()
|
let nativeGenerator = legacyAssetPickerItemGenerator()
|
||||||
let signals = TGCameraController.resultSignals(for: selectionContext, editingContext: editingContext, currentItem: currentItem, storeAssets: saveCapturedPhotos && !isSecretChat, saveEditedPhotos: saveCapturedPhotos && !isSecretChat, descriptionGenerator: { _1, _2, _3 in
|
let signals = TGCameraController.resultSignals(for: selectionContext, editingContext: editingContext, currentItem: currentItem, storeAssets: saveCapturedPhotos && !isSecretChat, saveEditedPhotos: saveCapturedPhotos && !isSecretChat, descriptionGenerator: { _1, _2, _3 in
|
||||||
nativeGenerator(_1, _2, _3, nil)
|
nativeGenerator(_1, _2, _3, nil)
|
||||||
})
|
})
|
||||||
sendMessagesWithSignals(signals, silentPosting, scheduleTime)
|
sendMessagesWithSignals(signals, silentPosting, scheduleTime, parameters)
|
||||||
}
|
}
|
||||||
|
|
||||||
menuController?.dismiss(animated: false)
|
menuController?.dismiss(animated: false)
|
||||||
@ -163,7 +169,7 @@ public func presentedLegacyCamera(context: AccountContext, peer: Peer?, chatLoca
|
|||||||
description["timer"] = timer
|
description["timer"] = timer
|
||||||
}
|
}
|
||||||
if let item = legacyAssetPickerItemGenerator()(description, caption, nil, nil) {
|
if let item = legacyAssetPickerItemGenerator()(description, caption, nil, nil) {
|
||||||
sendMessagesWithSignals([SSignal.single(item)], false, 0)
|
sendMessagesWithSignals([SSignal.single(item)], false, 0, nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +195,7 @@ public func presentedLegacyCamera(context: AccountContext, peer: Peer?, chatLoca
|
|||||||
description["timer"] = timer
|
description["timer"] = timer
|
||||||
}
|
}
|
||||||
if let item = legacyAssetPickerItemGenerator()(description, caption, nil, nil) {
|
if let item = legacyAssetPickerItemGenerator()(description, caption, nil, nil) {
|
||||||
sendMessagesWithSignals([SSignal.single(item)], false, 0)
|
sendMessagesWithSignals([SSignal.single(item)], false, 0, nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
menuController?.dismiss(animated: false)
|
menuController?.dismiss(animated: false)
|
||||||
|
@ -1152,13 +1152,16 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||||||
title = EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
title = EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||||
}
|
}
|
||||||
title = title.replacingOccurrences(of: "\u{1160}", with: "").replacingOccurrences(of: "\u{3164}", with: "")
|
title = title.replacingOccurrences(of: "\u{1160}", with: "").replacingOccurrences(of: "\u{3164}", with: "")
|
||||||
|
if title.replacingOccurrences(of: "\u{fe0e}", with: "").trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
||||||
|
title = "" //"\u{00A0}"
|
||||||
|
}
|
||||||
if title.isEmpty {
|
if title.isEmpty {
|
||||||
if let peer = peer as? TelegramUser, let phone = peer.phone {
|
if let peer = peer as? TelegramUser, let phone = peer.phone {
|
||||||
title = formatPhoneNumber(context: self.context, number: phone)
|
title = formatPhoneNumber(context: self.context, number: phone)
|
||||||
} else if let addressName = peer.addressName {
|
} else if let addressName = peer.addressName {
|
||||||
title = "@\(addressName)"
|
title = "@\(addressName)"
|
||||||
} else {
|
} else {
|
||||||
title = " "
|
title = "_"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -458,7 +458,8 @@ final class UserAppearanceScreenComponent: Component {
|
|||||||
.pattern(name: "", file: patternFile, rarity: 0),
|
.pattern(name: "", file: patternFile, rarity: 0),
|
||||||
.backdrop(name: "", innerColor: innerColor, outerColor: outerColor, patternColor: patternColor, textColor: textColor, rarity: 0)
|
.backdrop(name: "", innerColor: innerColor, outerColor: outerColor, patternColor: patternColor, textColor: textColor, rarity: 0)
|
||||||
],
|
],
|
||||||
availability: StarGift.UniqueGift.Availability(issued: 0, total: 0)
|
availability: StarGift.UniqueGift.Availability(issued: 0, total: 0),
|
||||||
|
giftAddress: nil
|
||||||
)
|
)
|
||||||
signal = component.context.engine.accountData.setStarGiftStatus(starGift: gift, expirationDate: emojiStatus.expirationDate)
|
signal = component.context.engine.accountData.setStarGiftStatus(starGift: gift, expirationDate: emojiStatus.expirationDate)
|
||||||
} else {
|
} else {
|
||||||
|
@ -2412,11 +2412,11 @@ final class StoryItemSetContainerSendMessage {
|
|||||||
|
|
||||||
let storeCapturedMedia = peer.id.namespace != Namespaces.Peer.SecretChat
|
let storeCapturedMedia = peer.id.namespace != Namespaces.Peer.SecretChat
|
||||||
|
|
||||||
presentedLegacyCamera(context: component.context, peer: peer._asPeer(), chatLocation: .peer(id: peer.id), cameraView: cameraView, menuController: nil, parentController: parentController, attachmentController: self.attachmentController, editingMedia: false, saveCapturedPhotos: storeCapturedMedia, mediaGrouping: true, initialCaption: inputText, hasSchedule: peer.id.namespace != Namespaces.Peer.SecretChat, enablePhoto: enablePhoto, enableVideo: enableVideo, sendMessagesWithSignals: { [weak self, weak view] signals, silentPosting, scheduleTime in
|
presentedLegacyCamera(context: component.context, peer: peer._asPeer(), chatLocation: .peer(id: peer.id), cameraView: cameraView, menuController: nil, parentController: parentController, attachmentController: self.attachmentController, editingMedia: false, saveCapturedPhotos: storeCapturedMedia, mediaGrouping: true, initialCaption: inputText, hasSchedule: peer.id.namespace != Namespaces.Peer.SecretChat, enablePhoto: enablePhoto, enableVideo: enableVideo, sendMessagesWithSignals: { [weak self, weak view] signals, silentPosting, scheduleTime, parameters in
|
||||||
guard let self, let view else {
|
guard let self, let view else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.enqueueMediaMessages(view: view, peer: peer, replyToMessageId: replyToMessageId, replyToStoryId: replyToStoryId, signals: signals, silentPosting: silentPosting, scheduleTime: scheduleTime > 0 ? scheduleTime : nil)
|
self.enqueueMediaMessages(view: view, peer: peer, replyToMessageId: replyToMessageId, replyToStoryId: replyToStoryId, signals: signals, silentPosting: silentPosting, scheduleTime: scheduleTime > 0 ? scheduleTime : nil, parameters: parameters)
|
||||||
if !inputText.string.isEmpty {
|
if !inputText.string.isEmpty {
|
||||||
self.clearInputText(view: view)
|
self.clearInputText(view: view)
|
||||||
}
|
}
|
||||||
|
@ -4538,21 +4538,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
guard let self else {
|
guard let self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let controller = chatAgeRestrictionAlertController(context: self.context, updatedPresentationData: self.updatedPresentationData, completion: { [weak self] alwaysShow in
|
let controller = chatAgeRestrictionAlertController(context: self.context, updatedPresentationData: self.updatedPresentationData, completion: { _ in
|
||||||
guard let self else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if alwaysShow {
|
|
||||||
let _ = updateRemoteContentSettingsConfiguration(postbox: context.account.postbox, network: context.account.network, sensitiveContentEnabled: true).start()
|
|
||||||
|
|
||||||
self.present(UndoOverlayController(presentationData: self.presentationData, content: .info(title: nil, text: self.presentationData.strings.SensitiveContent_SettingsInfo, timeout: nil, customUndoText: nil), elevatedLayout: false, position: .top, action: { [weak self] action in
|
|
||||||
if case .info = action, let self {
|
|
||||||
let controller = self.context.sharedContext.makeDataAndStorageController(context: self.context, sensitiveContent: true)
|
|
||||||
self.push(controller)
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}), in: .current)
|
|
||||||
}
|
|
||||||
reveal()
|
reveal()
|
||||||
})
|
})
|
||||||
self.present(controller, in: .window(.root))
|
self.present(controller, in: .window(.root))
|
||||||
|
@ -880,7 +880,7 @@ extension ChatControllerImpl {
|
|||||||
hasSchedule = strongSelf.presentationInterfaceState.subject != .scheduledMessages && peer.id.namespace != Namespaces.Peer.SecretChat
|
hasSchedule = strongSelf.presentationInterfaceState.subject != .scheduledMessages && peer.id.namespace != Namespaces.Peer.SecretChat
|
||||||
}
|
}
|
||||||
|
|
||||||
presentedLegacyCamera(context: strongSelf.context, peer: strongSelf.presentationInterfaceState.renderedPeer?.peer, chatLocation: strongSelf.chatLocation, cameraView: cameraView, menuController: menuController, parentController: strongSelf, editingMedia: editMediaOptions != nil, saveCapturedPhotos: storeCapturedPhotos, mediaGrouping: true, initialCaption: inputText, hasSchedule: hasSchedule, enablePhoto: enablePhoto, enableVideo: enableVideo, sendMessagesWithSignals: { [weak self] signals, silentPosting, scheduleTime in
|
presentedLegacyCamera(context: strongSelf.context, peer: strongSelf.presentationInterfaceState.renderedPeer?.peer, chatLocation: strongSelf.chatLocation, cameraView: cameraView, menuController: menuController, parentController: strongSelf, editingMedia: editMediaOptions != nil, saveCapturedPhotos: storeCapturedPhotos, mediaGrouping: true, initialCaption: inputText, hasSchedule: hasSchedule, enablePhoto: enablePhoto, enableVideo: enableVideo, sendMessagesWithSignals: { [weak self] signals, _, _, _ in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.editMessageMediaWithLegacySignals(signals!)
|
strongSelf.editMessageMediaWithLegacySignals(signals!)
|
||||||
|
|
||||||
@ -1779,9 +1779,9 @@ extension ChatControllerImpl {
|
|||||||
}
|
}
|
||||||
let inputText = strongSelf.presentationInterfaceState.interfaceState.effectiveInputState.inputText
|
let inputText = strongSelf.presentationInterfaceState.interfaceState.effectiveInputState.inputText
|
||||||
|
|
||||||
presentedLegacyCamera(context: strongSelf.context, peer: strongSelf.presentationInterfaceState.renderedPeer?.peer, chatLocation: strongSelf.chatLocation, cameraView: cameraView, menuController: nil, parentController: strongSelf, attachmentController: self?.attachmentController, editingMedia: false, saveCapturedPhotos: storeCapturedMedia, mediaGrouping: true, initialCaption: inputText, hasSchedule: hasSchedule, enablePhoto: enablePhoto, enableVideo: enableVideo, sendMessagesWithSignals: { [weak self] signals, silentPosting, scheduleTime in
|
presentedLegacyCamera(context: strongSelf.context, peer: strongSelf.presentationInterfaceState.renderedPeer?.peer, chatLocation: strongSelf.chatLocation, cameraView: cameraView, menuController: nil, parentController: strongSelf, attachmentController: self?.attachmentController, editingMedia: false, saveCapturedPhotos: storeCapturedMedia, mediaGrouping: true, initialCaption: inputText, hasSchedule: hasSchedule, enablePhoto: enablePhoto, enableVideo: enableVideo, sendMessagesWithSignals: { [weak self] signals, silentPosting, scheduleTime, parameters in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.enqueueMediaMessages(signals: signals, silentPosting: silentPosting, scheduleTime: scheduleTime > 0 ? scheduleTime : nil)
|
strongSelf.enqueueMediaMessages(signals: signals, silentPosting: silentPosting, scheduleTime: scheduleTime > 0 ? scheduleTime : nil, parameters: parameters)
|
||||||
if !inputText.string.isEmpty {
|
if !inputText.string.isEmpty {
|
||||||
strongSelf.clearInputText()
|
strongSelf.clearInputText()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user