mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
API
This commit is contained in:
@@ -41,7 +41,7 @@ func _internal_resolvePeerByName(account: Account, name: String, ageLimit: Int32
|
||||
return .single(.result(cachedEntry.peerId))
|
||||
} else {
|
||||
return .single(.progress)
|
||||
|> then(account.network.request(Api.functions.contacts.resolveUsername(username: normalizedName))
|
||||
|> then(account.network.request(Api.functions.contacts.resolveUsername(flags: 0, username: normalizedName, referer: nil))
|
||||
|> mapError { _ -> Void in
|
||||
return Void()
|
||||
}
|
||||
|
||||
@@ -1632,6 +1632,22 @@ public extension TelegramEngine {
|
||||
_internal_setStarsReactionDefaultToPrivate(isPrivate: isPrivate, transaction: transaction)
|
||||
}).startStandalone()
|
||||
}
|
||||
|
||||
public func updateStarRefProgram(id: EnginePeer.Id, program: (commissionPermille: Int32, durationMonths: Int32?)?) -> Signal<Never, NoError> {
|
||||
return _internal_updateStarRefProgram(account: self.account, id: id, program: program)
|
||||
}
|
||||
|
||||
public func requestConnectedStarRefBots(id: EnginePeer.Id, offset: (timestamp: Int32, link: String)?, limit: Int) -> Signal<TelegramConnectedStarRefBotList?, NoError> {
|
||||
return _internal_requestConnectedStarRefBots(account: self.account, id: id, offset: offset, limit: limit)
|
||||
}
|
||||
|
||||
public func requestSuggestedStarRefBots(id: EnginePeer.Id, orderByCommission: Bool, offset: String?, limit: Int) -> Signal<TelegramSuggestedStarRefBotList?, NoError> {
|
||||
return _internal_requestSuggestedStarRefBots(account: self.account, id: id, orderByCommission: orderByCommission, offset: offset, limit: limit)
|
||||
}
|
||||
|
||||
public func connectStarRefBot(id: EnginePeer.Id, botId: EnginePeer.Id) -> Signal<TelegramConnectedStarRefBotList.Item, ConnectStarRefBotError> {
|
||||
return _internal_connectStarRefBot(account: self.account, id: id, botId: botId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ func _internal_fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPee
|
||||
}
|
||||
|
||||
switch fullUser {
|
||||
case let .userFull(_, _, _, _, _, _, _, _, userFullNotifySettings, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _):
|
||||
case let .userFull(_, _, _, _, _, _, _, _, userFullNotifySettings, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _):
|
||||
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: parsedPeers)
|
||||
transaction.updateCurrentPeerNotificationSettings([peerId: TelegramPeerNotificationSettings(apiSettings: userFullNotifySettings)])
|
||||
}
|
||||
@@ -270,7 +270,7 @@ func _internal_fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPee
|
||||
previous = CachedUserData()
|
||||
}
|
||||
switch fullUser {
|
||||
case let .userFull(userFullFlags, userFullFlags2, _, userFullAbout, userFullSettings, personalPhoto, profilePhoto, fallbackPhoto, _, userFullBotInfo, userFullPinnedMsgId, userFullCommonChatsCount, _, userFullTtlPeriod, userFullThemeEmoticon, _, _, _, userPremiumGiftOptions, userWallpaper, stories, businessWorkHours, businessLocation, greetingMessage, awayMessage, businessIntro, birthday, personalChannelId, personalChannelMessage, starGiftsCount):
|
||||
case let .userFull(userFullFlags, userFullFlags2, _, userFullAbout, userFullSettings, personalPhoto, profilePhoto, fallbackPhoto, _, userFullBotInfo, userFullPinnedMsgId, userFullCommonChatsCount, _, userFullTtlPeriod, userFullThemeEmoticon, _, _, _, userPremiumGiftOptions, userWallpaper, stories, businessWorkHours, businessLocation, greetingMessage, awayMessage, businessIntro, birthday, personalChannelId, personalChannelMessage, starGiftsCount, starRefProgram):
|
||||
let _ = stories
|
||||
let botInfo = userFullBotInfo.flatMap(BotInfo.init(apiBotInfo:))
|
||||
let isBlocked = (userFullFlags & (1 << 0)) != 0
|
||||
@@ -396,6 +396,11 @@ func _internal_fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPee
|
||||
)
|
||||
}
|
||||
|
||||
var mappedStarRefProgram: TelegramStarRefProgram?
|
||||
if let starRefProgram {
|
||||
mappedStarRefProgram = TelegramStarRefProgram(apiStarRefProgram: starRefProgram)
|
||||
}
|
||||
|
||||
return previous.withUpdatedAbout(userFullAbout)
|
||||
.withUpdatedBotInfo(botInfo)
|
||||
.withUpdatedEditableBotInfo(editableBotInfo)
|
||||
@@ -427,6 +432,7 @@ func _internal_fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPee
|
||||
.withUpdatedPersonalChannel(personalChannel)
|
||||
.withUpdatedBotPreview(botPreview)
|
||||
.withUpdatedStarGiftsCount(starGiftsCount)
|
||||
.withUpdatedStarRefProgram(mappedStarRefProgram)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user