mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
9f6c3a920f
@ -1480,11 +1480,18 @@ private final class ProfileGiftsContextImpl {
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
self.pushState()
|
||||
|
||||
return _internal_buyStarGift(account: self.account, slug: slug, peerId: peerId)
|
||||
}
|
||||
|
||||
func removeStarGift(gift: TelegramCore.StarGift) {
|
||||
self.gifts.removeAll(where: { $0.gift == gift })
|
||||
self.filteredGifts.removeAll(where: { $0.gift == gift })
|
||||
self.pushState()
|
||||
}
|
||||
|
||||
func upgradeStarGift(formId: Int64?, reference: StarGiftReference, keepOriginalInfo: Bool) -> Signal<ProfileGiftsContext.State.StarGift, UpgradeStarGiftError> {
|
||||
return Signal { [weak self] subscriber in
|
||||
guard let self else {
|
||||
@ -1520,7 +1527,7 @@ private final class ProfileGiftsContextImpl {
|
||||
}
|
||||
}
|
||||
|
||||
func updateStarGiftResellPrice(reference: StarGiftReference, price: Int64?) -> Signal<Never, UpdateStarGiftPriceError> {
|
||||
func updateStarGiftResellPrice(reference: StarGiftReference, price: Int64?, id: Int64?) -> Signal<Never, UpdateStarGiftPriceError> {
|
||||
return Signal { [weak self] subscriber in
|
||||
guard let self else {
|
||||
return EmptyDisposable
|
||||
@ -1539,6 +1546,16 @@ private final class ProfileGiftsContextImpl {
|
||||
if gift.reference == reference {
|
||||
return true
|
||||
}
|
||||
switch gift.gift {
|
||||
case .generic(let gift):
|
||||
if gift.id == id {
|
||||
return true
|
||||
}
|
||||
case .unique(let uniqueGift):
|
||||
if uniqueGift.id == id {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}) {
|
||||
if case let .unique(uniqueGift) = self.gifts[index].gift {
|
||||
@ -1552,6 +1569,16 @@ private final class ProfileGiftsContextImpl {
|
||||
if gift.reference == reference {
|
||||
return true
|
||||
}
|
||||
switch gift.gift {
|
||||
case .generic(let gift):
|
||||
if gift.id == id {
|
||||
return true
|
||||
}
|
||||
case .unique(let uniqueGift):
|
||||
if uniqueGift.id == id {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}) {
|
||||
if case let .unique(uniqueGift) = self.filteredGifts[index].gift {
|
||||
@ -1935,6 +1962,12 @@ public final class ProfileGiftsContext {
|
||||
}
|
||||
}
|
||||
|
||||
public func removeStarGift(gift: TelegramCore.StarGift) {
|
||||
self.impl.with { impl in
|
||||
impl.removeStarGift(gift: gift)
|
||||
}
|
||||
}
|
||||
|
||||
public func transferStarGift(prepaid: Bool, reference: StarGiftReference, peerId: EnginePeer.Id) -> Signal<Never, TransferStarGiftError> {
|
||||
return Signal { subscriber in
|
||||
let disposable = MetaDisposable()
|
||||
@ -1965,11 +1998,11 @@ public final class ProfileGiftsContext {
|
||||
}
|
||||
}
|
||||
|
||||
public func updateStarGiftResellPrice(reference: StarGiftReference, price: Int64?) -> Signal<Never, UpdateStarGiftPriceError> {
|
||||
public func updateStarGiftResellPrice(reference: StarGiftReference, price: Int64?, id: Int64? = nil) -> Signal<Never, UpdateStarGiftPriceError> {
|
||||
return Signal { subscriber in
|
||||
let disposable = MetaDisposable()
|
||||
self.impl.with { impl in
|
||||
disposable.set(impl.updateStarGiftResellPrice(reference: reference, price: price).start(error: { error in
|
||||
disposable.set(impl.updateStarGiftResellPrice(reference: reference, price: price, id: id).start(error: { error in
|
||||
subscriber.putError(error)
|
||||
}, completed: {
|
||||
subscriber.putCompletion()
|
||||
@ -2524,6 +2557,11 @@ private final class ResaleGiftsContextImpl {
|
||||
self.loadMore()
|
||||
}
|
||||
|
||||
func removeStarGift(gift: TelegramCore.StarGift) {
|
||||
self.gifts.removeAll(where: { $0 == gift })
|
||||
self.pushState()
|
||||
}
|
||||
|
||||
func updateSorting(_ sorting: ResaleGiftsContext.Sorting) {
|
||||
guard self.sorting != sorting else {
|
||||
return
|
||||
@ -2710,6 +2748,13 @@ public final class ResaleGiftsContext {
|
||||
return disposable
|
||||
}
|
||||
}
|
||||
|
||||
public func removeStarGift(gift: TelegramCore.StarGift) {
|
||||
self.impl.with { impl in
|
||||
impl.removeStarGift(gift: gift)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public var currentState: ResaleGiftsContext.State? {
|
||||
var state: ResaleGiftsContext.State?
|
||||
|
Loading…
x
Reference in New Issue
Block a user