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
8c006150f8
@ -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…
x
Reference in New Issue
Block a user