Update API [skip ci]

This commit is contained in:
Ilya Laktyushin 2021-01-22 15:52:41 +03:00
parent aed1467617
commit cba5b9b5e1
4 changed files with 12 additions and 2 deletions

View File

@ -15,6 +15,7 @@ public struct PeerStatusSettings: PostboxCoding, Equatable {
public static let addExceptionWhenAddingContact = Flags(rawValue: 1 << 5)
public static let canReportIrrelevantGeoLocation = Flags(rawValue: 1 << 6)
public static let autoArchived = Flags(rawValue: 1 << 7)
public static let suggestAddMembers = Flags(rawValue: 1 << 8)
}

View File

@ -361,10 +361,10 @@ private final class PeerExportedInvitationsContextImpl {
var lastResult = self.results.last
if self.forceUpdate {
self.populateCache = true
self.forceUpdate = false
lastResult = nil
}
if !self.forceUpdate && self.loadedFromCache {
} else if self.loadedFromCache {
self.populateCache = false
self.loadedFromCache = false
}

View File

@ -55,6 +55,7 @@ public func removeGroupAdmin(account: Account, peerId: PeerId, adminId: PeerId)
public enum AddGroupAdminError {
case generic
case addMemberError(AddGroupMemberError)
case adminsTooMuch
}
public func addGroupAdmin(account: Account, peerId: PeerId, adminId: PeerId) -> Signal<Void, AddGroupAdminError> {
@ -79,6 +80,8 @@ public func addGroupAdmin(account: Account, peerId: PeerId, adminId: PeerId) ->
)
} else if error.errorDescription == "USER_PRIVACY_RESTRICTED" {
return .fail(.addMemberError(.privacy))
} else if error.errorDescription == "ADMINS_TOO_MUCH" {
return .fail(.adminsTooMuch)
}
return .fail(.generic)
}
@ -121,6 +124,7 @@ public func addGroupAdmin(account: Account, peerId: PeerId, adminId: PeerId) ->
public enum UpdateChannelAdminRightsError {
case generic
case addMemberError(AddChannelMemberError)
case adminsTooMuch
}
public func fetchChannelParticipant(account: Account, peerId: PeerId, participantId: PeerId) -> Signal<ChannelParticipant?, NoError> {
@ -203,6 +207,8 @@ public func updateChannelAdminRights(account: Account, peerId: PeerId, adminId:
return .fail(.addMemberError(.restricted))
} else if error.errorDescription == "USER_CHANNELS_TOO_MUCH" {
return .fail(.addMemberError(.tooMuchJoined))
} else if error.errorDescription == "ADMINS_TOO_MUCH" {
return .fail(.adminsTooMuch)
}
return .fail(.generic)
}

View File

@ -30,6 +30,9 @@ extension PeerStatusSettings {
if (flags & (1 << 7)) != 0 {
result.insert(.autoArchived)
}
if (flags & (1 << 8)) != 0 {
result.insert(.suggestAddMembers)
}
self = PeerStatusSettings(flags: result, geoDistance: geoDistance)
}
}