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
|
return false
|
||||||
})
|
})
|
||||||
|
|
||||||
self.pushState()
|
self.pushState()
|
||||||
|
|
||||||
return _internal_buyStarGift(account: self.account, slug: slug, peerId: peerId)
|
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> {
|
func upgradeStarGift(formId: Int64?, reference: StarGiftReference, keepOriginalInfo: Bool) -> Signal<ProfileGiftsContext.State.StarGift, UpgradeStarGiftError> {
|
||||||
return Signal { [weak self] subscriber in
|
return Signal { [weak self] subscriber in
|
||||||
guard let self else {
|
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
|
return Signal { [weak self] subscriber in
|
||||||
guard let self else {
|
guard let self else {
|
||||||
return EmptyDisposable
|
return EmptyDisposable
|
||||||
@ -1539,6 +1546,16 @@ private final class ProfileGiftsContextImpl {
|
|||||||
if gift.reference == reference {
|
if gift.reference == reference {
|
||||||
return true
|
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
|
return false
|
||||||
}) {
|
}) {
|
||||||
if case let .unique(uniqueGift) = self.gifts[index].gift {
|
if case let .unique(uniqueGift) = self.gifts[index].gift {
|
||||||
@ -1552,6 +1569,16 @@ private final class ProfileGiftsContextImpl {
|
|||||||
if gift.reference == reference {
|
if gift.reference == reference {
|
||||||
return true
|
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
|
return false
|
||||||
}) {
|
}) {
|
||||||
if case let .unique(uniqueGift) = self.filteredGifts[index].gift {
|
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> {
|
public func transferStarGift(prepaid: Bool, reference: StarGiftReference, peerId: EnginePeer.Id) -> Signal<Never, TransferStarGiftError> {
|
||||||
return Signal { subscriber in
|
return Signal { subscriber in
|
||||||
let disposable = MetaDisposable()
|
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
|
return Signal { subscriber in
|
||||||
let disposable = MetaDisposable()
|
let disposable = MetaDisposable()
|
||||||
self.impl.with { impl in
|
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)
|
subscriber.putError(error)
|
||||||
}, completed: {
|
}, completed: {
|
||||||
subscriber.putCompletion()
|
subscriber.putCompletion()
|
||||||
@ -2524,6 +2557,11 @@ private final class ResaleGiftsContextImpl {
|
|||||||
self.loadMore()
|
self.loadMore()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func removeStarGift(gift: TelegramCore.StarGift) {
|
||||||
|
self.gifts.removeAll(where: { $0 == gift })
|
||||||
|
self.pushState()
|
||||||
|
}
|
||||||
|
|
||||||
func updateSorting(_ sorting: ResaleGiftsContext.Sorting) {
|
func updateSorting(_ sorting: ResaleGiftsContext.Sorting) {
|
||||||
guard self.sorting != sorting else {
|
guard self.sorting != sorting else {
|
||||||
return
|
return
|
||||||
@ -2710,6 +2748,13 @@ public final class ResaleGiftsContext {
|
|||||||
return disposable
|
return disposable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func removeStarGift(gift: TelegramCore.StarGift) {
|
||||||
|
self.impl.with { impl in
|
||||||
|
impl.removeStarGift(gift: gift)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public var currentState: ResaleGiftsContext.State? {
|
public var currentState: ResaleGiftsContext.State? {
|
||||||
var state: ResaleGiftsContext.State?
|
var state: ResaleGiftsContext.State?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user