mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
8c006150f8
2 changed files with 10 additions and 4 deletions
|
|
@ -13,7 +13,7 @@ public enum CreateGroupError {
|
|||
case serverProvided(String)
|
||||
}
|
||||
|
||||
func _internal_createGroup(account: Account, title: String, peerIds: [PeerId]) -> Signal<PeerId?, CreateGroupError> {
|
||||
func _internal_createGroup(account: Account, title: String, peerIds: [PeerId], ttlPeriod: Int32?) -> Signal<PeerId?, CreateGroupError> {
|
||||
return account.postbox.transaction { transaction -> Signal<PeerId?, CreateGroupError> in
|
||||
var inputUsers: [Api.InputUser] = []
|
||||
for peerId in peerIds {
|
||||
|
|
@ -23,7 +23,13 @@ func _internal_createGroup(account: Account, title: String, peerIds: [PeerId]) -
|
|||
return .single(nil)
|
||||
}
|
||||
}
|
||||
return account.network.request(Api.functions.messages.createChat(flags: 0, users: inputUsers, title: title, ttlPeriod: nil))
|
||||
|
||||
var flags: Int32 = 0
|
||||
if let _ = ttlPeriod {
|
||||
flags |= 1 << 0
|
||||
}
|
||||
|
||||
return account.network.request(Api.functions.messages.createChat(flags: flags, users: inputUsers, title: title, ttlPeriod: ttlPeriod))
|
||||
|> mapError { error -> CreateGroupError in
|
||||
if error.errorDescription == "USERS_TOO_FEW" {
|
||||
return .privacy
|
||||
|
|
|
|||
|
|
@ -137,8 +137,8 @@ public extension TelegramEngine {
|
|||
return _internal_convertGroupToSupergroup(account: self.account, peerId: peerId)
|
||||
}
|
||||
|
||||
public func createGroup(title: String, peerIds: [PeerId]) -> Signal<PeerId?, CreateGroupError> {
|
||||
return _internal_createGroup(account: self.account, title: title, peerIds: peerIds)
|
||||
public func createGroup(title: String, peerIds: [PeerId], ttlPeriod: Int32?) -> Signal<PeerId?, CreateGroupError> {
|
||||
return _internal_createGroup(account: self.account, title: title, peerIds: peerIds, ttlPeriod: ttlPeriod)
|
||||
}
|
||||
|
||||
public func createSecretChat(peerId: PeerId) -> Signal<PeerId, CreateSecretChatError> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue