Various fixes

This commit is contained in:
Ilya Laktyushin
2023-09-17 00:01:09 +04:00
parent 54375b7682
commit bd20e2f636
11 changed files with 57 additions and 23 deletions

View File

@@ -10003,3 +10003,17 @@ Sorry for the inconvenience.";
"Conversation.BoostChannel" = "BOOST";
"MediaEditor.Audio" = "Audio";
"Stats.Statistics" = "Statistics";
"Stats.Boosts" = "Boosts";
"Stats.Boosts.BoostersNone" = "BOOSTERS";
"Stats.Boosts.Boosters_1" = "%@ BOOSTER";
"Stats.Boosts.Boosters_any" = "%@ BOOSTERS";
"Stats.Boosts.NoBoostersYet" = "No users currently boost your channel";
"Stats.Boosts.BoostersInfo" = "Your channel is currently boosted by these users.";
"Stats.Boosts.ExpiresOn" = "Boost expires on %@";
"Stats.Boosts.OverviewHeader" = "OVERVIEW";
"Stats.Boosts.LinkHeader" = "LINK FOR BOOSTING";
"Stats.Boosts.LinkInfo" = "Share this link with your subscribers to get more boosts.";

View File

@@ -247,12 +247,15 @@ open class ViewControllerComponentContainer: ViewController {
|> deliverOnMainQueue).start(next: { [weak self] presentationData in
if let strongSelf = self {
var theme = presentationData.theme
var resolvedTheme = resolveTheme(baseTheme: presentationData.theme, theme: strongSelf.theme)
if case .modal = presentationMode {
theme = theme.withModalBlocksBackground()
resolvedTheme = resolvedTheme.withModalBlocksBackground()
}
strongSelf.node.presentationData = presentationData.withUpdated(theme: theme)
strongSelf.node.resolvedTheme = resolveTheme(baseTheme: presentationData.theme, theme: strongSelf.theme)
strongSelf.node.resolvedTheme = resolvedTheme
switch statusBarStyle {
case .none:

View File

@@ -483,6 +483,10 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
public func remove(uuid: UUID, animated: Bool = false, announce: Bool = true) {
if let view = self.getView(for: uuid) {
if self.selectedEntityView === view {
if let stickerEntityView = self.selectedEntityView as? DrawingStickerEntityView {
stickerEntityView.onDeselection()
}
self.selectedEntityView = nil
self.selectionChanged(nil)
self.hasSelectionChanged(false)

View File

@@ -554,7 +554,7 @@ final class LimitsPageComponent: CombinedComponent {
)
let background = background.update(
component: Rectangle(color: theme.list.plainBackgroundColor),
component: Rectangle(color: theme.overallDarkAppearance ? theme.list.blocksBackgroundColor : theme.list.plainBackgroundColor),
availableSize: scroll.size,
transition: context.transition
)

View File

@@ -1553,8 +1553,14 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
let sideInsets = sideInset * 2.0 + environment.safeInsets.left + environment.safeInsets.right
var size = CGSize(width: context.availableSize.width, height: 0.0)
var topBackgroundColor = theme.list.plainBackgroundColor
let bottomBackgroundColor = theme.list.blocksBackgroundColor
if theme.overallDarkAppearance {
topBackgroundColor = bottomBackgroundColor
}
let overscroll = overscroll.update(
component: Rectangle(color: theme.list.plainBackgroundColor),
component: Rectangle(color: topBackgroundColor),
availableSize: CGSize(width: context.availableSize.width, height: 1000),
transition: context.transition
)
@@ -1565,8 +1571,8 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
let fade = fade.update(
component: RoundedRectangle(
colors: [
theme.list.plainBackgroundColor,
theme.list.blocksBackgroundColor
topBackgroundColor,
bottomBackgroundColor
],
cornerRadius: 0.0,
gradientDirection: .vertical
@@ -2862,7 +2868,7 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
completion: {
completionImpl?()
}
), navigationBarAppearance: .transparent, theme: forceDark ? .dark : .default)
), navigationBarAppearance: .transparent, presentationMode: modal ? .modal : .default, theme: forceDark ? .dark : .default)
let presentationData = context.sharedContext.currentPresentationData.with { $0 }

View File

@@ -53,6 +53,7 @@ public class PremiumLimitsListScreen: ViewController {
if forceDark {
self.presentationData = self.presentationData.withUpdated(theme: defaultDarkPresentationTheme)
}
self.presentationData = self.presentationData.withUpdated(theme: self.presentationData.theme.withModalBlocksBackground())
self.controller = controller
@@ -71,7 +72,7 @@ public class PremiumLimitsListScreen: ViewController {
super.init()
self.containerView.clipsToBounds = true
self.containerView.backgroundColor = self.presentationData.theme.list.plainBackgroundColor
self.containerView.backgroundColor = self.presentationData.theme.overallDarkAppearance ? self.presentationData.theme.list.blocksBackgroundColor : self.presentationData.theme.list.plainBackgroundColor
self.addSubnode(self.dim)
@@ -1149,7 +1150,7 @@ private class FooterNode: ASDisplayNode {
self.buttonNode.title = title
self.coverNode = ASDisplayNode()
self.coverNode.backgroundColor = self.theme.list.plainBackgroundColor
self.coverNode.backgroundColor = self.theme.overallDarkAppearance ? self.theme.list.blocksBackgroundColor : self.theme.list.plainBackgroundColor
self.pageIndicatorView = ComponentHostView<Empty>()
self.pageIndicatorView.isUserInteractionEnabled = false

View File

@@ -611,7 +611,7 @@ final class StoriesPageComponent: CombinedComponent {
)
let background = background.update(
component: Rectangle(color: theme.list.plainBackgroundColor),
component: Rectangle(color: theme.overallDarkAppearance ? theme.list.blocksBackgroundColor : theme.list.plainBackgroundColor),
availableSize: scroll.size,
transition: context.transition
)

View File

@@ -474,7 +474,7 @@ private enum StatsEntry: ItemListNodeEntry {
})
case let .booster(_, _, dateTimeFormat, peer, expires):
let expiresValue = stringForFullDate(timestamp: expires, strings: presentationData.strings, dateTimeFormat: dateTimeFormat)
return ItemListPeerItem(presentationData: presentationData, dateTimeFormat: PresentationDateTimeFormat(), nameDisplayOrder: presentationData.nameDisplayOrder, context: arguments.context, peer: peer, presence: nil, text: .text("Boost expires on \(expiresValue)", .secondary), label: .none, editing: ItemListPeerItemEditing(editable: false, editing: false, revealed: false), switchValue: nil, enabled: true, selectable: false, sectionId: self.section, action: {
return ItemListPeerItem(presentationData: presentationData, dateTimeFormat: PresentationDateTimeFormat(), nameDisplayOrder: presentationData.nameDisplayOrder, context: arguments.context, peer: peer, presence: nil, text: .text(presentationData.strings.Stats_Boosts_ExpiresOn(expiresValue).string, .secondary), label: .none, editing: ItemListPeerItemEditing(editable: false, editing: false, revealed: false), switchValue: nil, enabled: true, selectable: true, sectionId: self.section, action: {
arguments.openPeer(peer)
}, setPeerIdWithRevealedOptions: { _, _ in }, removePeer: { _ in })
case let .boostersExpand(theme, title):
@@ -617,19 +617,19 @@ private func channelStatsControllerEntries(state: ChannelStatsControllerState, p
}
entries.append(.boostLevel(presentationData.theme, Int32(boostData.boosts), Int32(boostData.level), progress))
entries.append(.boostOverviewTitle(presentationData.theme, "OVERVIEW"))
entries.append(.boostOverviewTitle(presentationData.theme, presentationData.strings.Stats_Boosts_OverviewHeader))
entries.append(.boostOverview(presentationData.theme, boostData))
let boostersTitle: String
let boostersPlaceholder: String?
let boostersFooter: String?
if let boostersState, boostersState.count > 0 {
boostersTitle = "\(boostersState.count) BOOSTERS"
boostersTitle = presentationData.strings.Stats_Boosts_Boosters(boostersState.count)
boostersPlaceholder = nil
boostersFooter = "Your channel is currently boosted by these users."
boostersFooter = presentationData.strings.Stats_Boosts_BoostersInfo
} else {
boostersTitle = "BOOSTERS"
boostersPlaceholder = "No users currently boost your channel"
boostersTitle = presentationData.strings.Stats_Boosts_BoostersNone
boostersPlaceholder = presentationData.strings.Stats_Boosts_NoBoostersYet
boostersFooter = nil
}
entries.append(.boostersTitle(presentationData.theme, boostersTitle))
@@ -663,7 +663,7 @@ private func channelStatsControllerEntries(state: ChannelStatsControllerState, p
entries.append(.boostersInfo(presentationData.theme, boostersFooter))
}
entries.append(.boostLinkTitle(presentationData.theme, "LINK FOR BOOSTING"))
entries.append(.boostLinkTitle(presentationData.theme, presentationData.strings.Stats_Boosts_LinkHeader))
if let peer {
let link: String
@@ -675,7 +675,7 @@ private func channelStatsControllerEntries(state: ChannelStatsControllerState, p
entries.append(.boostLink(presentationData.theme, link))
}
entries.append(.boostLinkInfo(presentationData.theme, "Share this link with your subscribers to get more boosts."))
entries.append(.boostLinkInfo(presentationData.theme, presentationData.strings.Stats_Boosts_LinkInfo))
}
}
@@ -834,7 +834,9 @@ public func channelStatsController(context: AccountContext, updatedPresentationD
return map
}
let controllerState = ItemListControllerState(presentationData: ItemListPresentationData(presentationData), title: .sectionControl(["Statistics", "Boosts"], state.section == .boosts ? 1 : 0), leftNavigationButton: nil, rightNavigationButton: nil, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: true)
let controllerState = ItemListControllerState(presentationData: ItemListPresentationData(presentationData), title: .sectionControl([presentationData.strings.Stats_Statistics, presentationData.strings.Stats_Boosts], state.section == .boosts ? 1 : 0), leftNavigationButton: nil, rightNavigationButton: nil, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: true)
let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: channelStatsControllerEntries(state: state, peer: peer, data: data, messages: messages, interactions: interactions, boostData: boostData, boostersState: boostersState, presentationData: presentationData), style: .blocks, emptyStateItem: emptyStateItem, crossfadeState: previous == nil, animateChanges: false)
return (controllerState, (listState, arguments))

View File

@@ -4449,7 +4449,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
return
}
if !skipSendCheck, let sendAsPeerId = self.state.privacy.sendAsPeerId, sendAsPeerId.namespace == Namespaces.Peer.CloudChannel {
if !self.isEditingStory, !skipSendCheck, let sendAsPeerId = self.state.privacy.sendAsPeerId, sendAsPeerId.namespace == Namespaces.Peer.CloudChannel {
let _ = (self.context.engine.messages.checkStoriesUploadAvailability(target: .peer(sendAsPeerId))
|> deliverOnMainQueue).start(next: { [weak self] status in
guard let self else {

View File

@@ -450,7 +450,7 @@ public final class PeerListItemComponent: Component {
leftInset += 9.0
}
var rightInset: CGFloat = contextInset * 2.0 + 8.0 + component.sideInset
if component.reaction != nil {
if component.reaction != nil || component.rightAccessory != .none {
rightInset += 32.0
}

View File

@@ -854,7 +854,11 @@ final class ChatPinnedMessageTitlePanelNode: ChatTitleAccessoryPanelNode {
case .text:
controllerInteraction.sendMessage(button.title)
case let .url(url):
controllerInteraction.openUrl(url, true, nil, nil)
var isConcealed = true
if url.hasPrefix("tg://") {
isConcealed = false
}
controllerInteraction.openUrl(url, isConcealed, nil, nil)
case .requestMap:
controllerInteraction.shareCurrentLocation()
case .requestPhone: