mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 21:45:19 +00:00
Various fixes
This commit is contained in:
parent
6ae4aa2b73
commit
97eea98f11
@ -623,7 +623,7 @@ public class BrowserScreen: ViewController, MinimizableController {
|
|||||||
self.controller?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { [weak self] action in
|
self.controller?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { [weak self] action in
|
||||||
if savedMessages, let self, action == .info {
|
if savedMessages, let self, action == .info {
|
||||||
let _ = (self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: self.context.account.peerId))
|
let _ = (self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: self.context.account.peerId))
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] peer in
|
|> deliverOnMainQueue).start(next: { [weak self] peer in
|
||||||
guard let self, let peer else {
|
guard let self, let peer else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -400,8 +400,6 @@ public final class SemanticStatusNode: ASControlNode {
|
|||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
self.layer.addSublayer(self.hierarchyTrackingLayer)
|
|
||||||
|
|
||||||
self.isOpaque = false
|
self.isOpaque = false
|
||||||
self.displaysAsynchronously = false
|
self.displaysAsynchronously = false
|
||||||
|
|
||||||
@ -410,6 +408,12 @@ public final class SemanticStatusNode: ASControlNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override func didLoad() {
|
||||||
|
super.didLoad()
|
||||||
|
|
||||||
|
self.layer.addSublayer(self.hierarchyTrackingLayer)
|
||||||
|
}
|
||||||
|
|
||||||
deinit {
|
deinit {
|
||||||
self.disposable?.dispose()
|
self.disposable?.dispose()
|
||||||
}
|
}
|
||||||
|
@ -974,8 +974,8 @@ private final class ProfileGiftsContextImpl {
|
|||||||
private let cacheDisposable = MetaDisposable()
|
private let cacheDisposable = MetaDisposable()
|
||||||
private let actionDisposable = MetaDisposable()
|
private let actionDisposable = MetaDisposable()
|
||||||
|
|
||||||
private var sorting: ProfileGiftsContext.Sorting = .date
|
private var sorting: ProfileGiftsContext.Sorting
|
||||||
private var filter: ProfileGiftsContext.Filters = ProfileGiftsContext.Filters.All
|
private var filter: ProfileGiftsContext.Filters
|
||||||
|
|
||||||
private var gifts: [ProfileGiftsContext.State.StarGift] = []
|
private var gifts: [ProfileGiftsContext.State.StarGift] = []
|
||||||
private var count: Int32?
|
private var count: Int32?
|
||||||
@ -993,10 +993,18 @@ private final class ProfileGiftsContextImpl {
|
|||||||
return self.stateValue.get()
|
return self.stateValue.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
init(queue: Queue, account: Account, peerId: EnginePeer.Id) {
|
init(
|
||||||
|
queue: Queue,
|
||||||
|
account: Account,
|
||||||
|
peerId: EnginePeer.Id,
|
||||||
|
sorting: ProfileGiftsContext.Sorting,
|
||||||
|
filter: ProfileGiftsContext.Filters
|
||||||
|
) {
|
||||||
self.queue = queue
|
self.queue = queue
|
||||||
self.account = account
|
self.account = account
|
||||||
self.peerId = peerId
|
self.peerId = peerId
|
||||||
|
self.sorting = sorting
|
||||||
|
self.filter = filter
|
||||||
|
|
||||||
self.loadMore()
|
self.loadMore()
|
||||||
}
|
}
|
||||||
@ -1664,10 +1672,15 @@ public final class ProfileGiftsContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(account: Account, peerId: EnginePeer.Id) {
|
public init(
|
||||||
|
account: Account,
|
||||||
|
peerId: EnginePeer.Id,
|
||||||
|
sorting: ProfileGiftsContext.Sorting = .date,
|
||||||
|
filter: ProfileGiftsContext.Filters = .All
|
||||||
|
) {
|
||||||
let queue = self.queue
|
let queue = self.queue
|
||||||
self.impl = QueueLocalObject(queue: queue, generate: {
|
self.impl = QueueLocalObject(queue: queue, generate: {
|
||||||
return ProfileGiftsContextImpl(queue: queue, account: account, peerId: peerId)
|
return ProfileGiftsContextImpl(queue: queue, account: account, peerId: peerId, sorting: sorting, filter: filter)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,16 +142,12 @@ final class GiftOptionsScreenComponent: Component {
|
|||||||
private var _effectiveStarGifts: ([StarGift], StarsFilter)?
|
private var _effectiveStarGifts: ([StarGift], StarsFilter)?
|
||||||
private var effectiveStarGifts: [StarGift]? {
|
private var effectiveStarGifts: [StarGift]? {
|
||||||
get {
|
get {
|
||||||
if let (currentGifts, currentFilter) = self._effectiveStarGifts, currentFilter == self.starsFilter {
|
if let (currentGifts, currentFilter) = self._effectiveStarGifts, currentFilter == self.starsFilter && currentFilter != .transfer {
|
||||||
return currentGifts
|
return currentGifts
|
||||||
} else if let allGifts = self.state?.starGifts {
|
} else if let allGifts = self.state?.starGifts {
|
||||||
if case .transfer = self.starsFilter {
|
if case .transfer = self.starsFilter {
|
||||||
let filteredGifts: [StarGift] = self.state?.transferStarGifts?.compactMap { gift in
|
let filteredGifts: [StarGift] = self.state?.transferStarGifts?.map { gift in
|
||||||
if case .unique = gift.gift {
|
return gift.gift
|
||||||
return gift.gift
|
|
||||||
} else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
} ?? []
|
} ?? []
|
||||||
self._effectiveStarGifts = (filteredGifts, self.starsFilter)
|
self._effectiveStarGifts = (filteredGifts, self.starsFilter)
|
||||||
return filteredGifts
|
return filteredGifts
|
||||||
@ -497,7 +493,7 @@ final class GiftOptionsScreenComponent: Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let bottomContentOffset = max(0.0, self.scrollView.contentSize.height - self.scrollView.contentOffset.y - self.scrollView.frame.height)
|
let bottomContentOffset = max(0.0, self.scrollView.contentSize.height - self.scrollView.contentOffset.y - self.scrollView.frame.height)
|
||||||
if interactive, bottomContentOffset < 200.0, case .transfer = self.starsFilter {
|
if interactive, bottomContentOffset < 320.0, case .transfer = self.starsFilter {
|
||||||
self.state?.starGiftsContext.loadMore()
|
self.state?.starGiftsContext.loadMore()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1348,7 +1344,7 @@ final class GiftOptionsScreenComponent: Component {
|
|||||||
) {
|
) {
|
||||||
self.context = context
|
self.context = context
|
||||||
|
|
||||||
self.starGiftsContext = ProfileGiftsContext(account: context.account, peerId: context.account.peerId)
|
self.starGiftsContext = ProfileGiftsContext(account: context.account, peerId: context.account.peerId, filter: [.unique, .displayed, .hidden])
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
@ -1380,8 +1376,11 @@ final class GiftOptionsScreenComponent: Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.peer = peer
|
self.peer = peer
|
||||||
self.disallowedGifts = disallowedGifts ?? []
|
if peerId == context.account.peerId {
|
||||||
|
self.disallowedGifts = []
|
||||||
|
} else {
|
||||||
|
self.disallowedGifts = disallowedGifts ?? []
|
||||||
|
}
|
||||||
if peerId != context.account.peerId {
|
if peerId != context.account.peerId {
|
||||||
if availableProducts.isEmpty {
|
if availableProducts.isEmpty {
|
||||||
var premiumProducts: [PremiumGiftProduct] = []
|
var premiumProducts: [PremiumGiftProduct] = []
|
||||||
@ -1434,7 +1433,7 @@ final class GiftOptionsScreenComponent: Component {
|
|||||||
|
|
||||||
if let disallowedGifts, disallowedGifts.contains(.unique) {
|
if let disallowedGifts, disallowedGifts.contains(.unique) {
|
||||||
} else {
|
} else {
|
||||||
self.transferStarGifts = profileGiftsState.gifts.compactMap { gift in
|
self.transferStarGifts = profileGiftsState.filteredGifts.compactMap { gift in
|
||||||
if case .unique = gift.gift {
|
if case .unique = gift.gift {
|
||||||
return gift
|
return gift
|
||||||
} else {
|
} else {
|
||||||
|
@ -2796,7 +2796,7 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
|||||||
} else {
|
} else {
|
||||||
let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.DisallowedGifts(id: peer.id))
|
let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.DisallowedGifts(id: peer.id))
|
||||||
|> deliverOnMainQueue).start(next: { disallowedGifts in
|
|> deliverOnMainQueue).start(next: { disallowedGifts in
|
||||||
if let disallowedGifts, disallowedGifts == TelegramDisallowedGifts.All {
|
if let disallowedGifts, disallowedGifts == TelegramDisallowedGifts.All && peer.id != context.account.peerId {
|
||||||
let alertController = textAlertController(context: context, title: nil, text: presentationData.strings.Gift_Send_GiftsDisallowed(EnginePeer(peer).compactDisplayTitle).string, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})])
|
let alertController = textAlertController(context: context, title: nil, text: presentationData.strings.Gift_Send_GiftsDisallowed(EnginePeer(peer).compactDisplayTitle).string, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})])
|
||||||
controller?.present(alertController, in: .window(.root))
|
controller?.present(alertController, in: .window(.root))
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user