mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge commit '0290100f13850da9f5f45d40966375c964efa2cd'
This commit is contained in:
commit
0d0b0b7b89
@ -22,6 +22,7 @@ let package = Package(
|
||||
.package(name: "ManagedFile", path: "../ManagedFile"),
|
||||
.package(name: "RangeSet", path: "../Utils/RangeSet"),
|
||||
.package(name: "SSignalKit", path: "../SSignalKit"),
|
||||
.package(name: "CryptoUtils", path: "../CryptoUtils")
|
||||
],
|
||||
targets: [
|
||||
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||
@ -34,6 +35,7 @@ let package = Package(
|
||||
.product(name: "RangeSet", package: "RangeSet", condition: nil),
|
||||
.product(name: "sqlcipher", package: "sqlcipher", condition: nil),
|
||||
.product(name: "StringTransliteration", package: "StringTransliteration", condition: nil),
|
||||
.product(name: "CryptoUtils", package: "CryptoUtils", condition: nil),
|
||||
.product(name: "Crc32", package: "Crc32", condition: nil)],
|
||||
path: "Sources"),
|
||||
]
|
||||
|
@ -117,7 +117,7 @@ public func downloadAppUpdate(account: Account, source: String, messageId: Int32
|
||||
var dataDisposable: Disposable?
|
||||
var fetchDisposable: Disposable?
|
||||
var statusDisposable: Disposable?
|
||||
let removeDisposable = account.postbox.mediaBox.removeCachedResources(Set([media.resource.id])).start(completed: {
|
||||
let removeDisposable = account.postbox.mediaBox.removeCachedResources([media.resource.id]).start(completed: {
|
||||
let reference = MediaResourceReference.media(media: .message(message: MessageReference(message), media: media), resource: media.resource)
|
||||
|
||||
fetchDisposable = fetchedMediaResource(mediaBox: account.postbox.mediaBox, reference: reference).start()
|
||||
|
@ -90,16 +90,25 @@ public struct AccountSpecificCacheStorageSettings: Codable, Equatable {
|
||||
var value: Int32
|
||||
}
|
||||
|
||||
public var peerStorageTimeoutExceptions: [PeerId: Int32]
|
||||
public struct Value : Equatable {
|
||||
public let key: PeerId
|
||||
public let value: Int32
|
||||
public init(key: PeerId, value: Int32) {
|
||||
self.key = key
|
||||
self.value = value
|
||||
}
|
||||
}
|
||||
|
||||
public var peerStorageTimeoutExceptions: [Value]
|
||||
|
||||
public static var defaultSettings: AccountSpecificCacheStorageSettings {
|
||||
return AccountSpecificCacheStorageSettings(
|
||||
peerStorageTimeoutExceptions: [:]
|
||||
peerStorageTimeoutExceptions: []
|
||||
)
|
||||
}
|
||||
|
||||
public init(
|
||||
peerStorageTimeoutExceptions: [PeerId: Int32]
|
||||
peerStorageTimeoutExceptions: [Value]
|
||||
) {
|
||||
self.peerStorageTimeoutExceptions = peerStorageTimeoutExceptions
|
||||
}
|
||||
@ -109,9 +118,9 @@ public struct AccountSpecificCacheStorageSettings: Codable, Equatable {
|
||||
|
||||
if let data = try container.decodeIfPresent(Data.self, forKey: "peerStorageTimeoutExceptionsJson") {
|
||||
if let items = try? JSONDecoder().decode([PeerStorageTimeoutExceptionRepresentation].self, from: data) {
|
||||
var peerStorageTimeoutExceptions: [PeerId: Int32] = [:]
|
||||
var peerStorageTimeoutExceptions: [Value] = []
|
||||
for item in items {
|
||||
peerStorageTimeoutExceptions[item.key] = item.value
|
||||
peerStorageTimeoutExceptions.append(.init(key: item.key, value: item.value))
|
||||
}
|
||||
self.peerStorageTimeoutExceptions = peerStorageTimeoutExceptions
|
||||
} else {
|
||||
@ -126,8 +135,8 @@ public struct AccountSpecificCacheStorageSettings: Codable, Equatable {
|
||||
var container = encoder.container(keyedBy: StringCodingKey.self)
|
||||
|
||||
var peerStorageTimeoutExceptionsValues: [PeerStorageTimeoutExceptionRepresentation] = []
|
||||
for (key, value) in self.peerStorageTimeoutExceptions {
|
||||
peerStorageTimeoutExceptionsValues.append(PeerStorageTimeoutExceptionRepresentation(key: key, value: value))
|
||||
for value in self.peerStorageTimeoutExceptions {
|
||||
peerStorageTimeoutExceptionsValues.append(PeerStorageTimeoutExceptionRepresentation(key: value.key, value: value.value))
|
||||
}
|
||||
if let data = try? JSONEncoder().encode(peerStorageTimeoutExceptionsValues) {
|
||||
try container.encode(data, forKey: "peerStorageTimeoutExceptionsJson")
|
||||
|
@ -6,7 +6,7 @@ final class AutomaticCacheEvictionContext {
|
||||
private final class Impl {
|
||||
private struct CombinedSettings: Equatable {
|
||||
var categoryStorageTimeout: [CacheStorageSettings.PeerStorageCategory: Int32]
|
||||
var exceptions: [PeerId: Int32]
|
||||
var exceptions: [AccountSpecificCacheStorageSettings.Value]
|
||||
}
|
||||
|
||||
let queue: Queue
|
||||
@ -109,8 +109,8 @@ final class AutomaticCacheEvictionContext {
|
||||
|
||||
for peerId in peerIds {
|
||||
let timeout: Int32
|
||||
if let value = settings.exceptions[peerId] {
|
||||
timeout = value
|
||||
if let value = settings.exceptions.first(where: { $0.key == peerId }) {
|
||||
timeout = value.value
|
||||
} else {
|
||||
switch peerId.namespace {
|
||||
case Namespaces.Peer.CloudUser, Namespaces.Peer.SecretChat:
|
||||
|
@ -415,7 +415,7 @@ public final class OngoingGroupCallContext {
|
||||
private final class Impl {
|
||||
let queue: Queue
|
||||
let context: GroupCallThreadLocalContext
|
||||
let audioDevice: SharedCallAudioDevice?
|
||||
// let audioDevice: SharedCallAudioDevice?
|
||||
let sessionId = UInt32.random(in: 0 ..< UInt32(Int32.max))
|
||||
|
||||
let joinPayload = Promise<(String, UInt32)>()
|
||||
@ -433,8 +433,8 @@ public final class OngoingGroupCallContext {
|
||||
init(queue: Queue, inputDeviceId: String, outputDeviceId: String, audioSessionActive: Signal<Bool, NoError>, video: OngoingCallVideoCapturer?, requestMediaChannelDescriptions: @escaping (Set<UInt32>, @escaping ([MediaChannelDescription]) -> Void) -> Disposable, rejoinNeeded: @escaping () -> Void, outgoingAudioBitrateKbit: Int32?, videoContentType: VideoContentType, enableNoiseSuppression: Bool, disableAudioInput: Bool, preferX264: Bool, logPath: String) {
|
||||
self.queue = queue
|
||||
|
||||
self.audioDevice = nil
|
||||
let audioDevice = self.audioDevice
|
||||
// self.audioDevice = nil
|
||||
// let audioDevice = self.audioDevice
|
||||
|
||||
var networkStateUpdatedImpl: ((GroupCallNetworkState) -> Void)?
|
||||
var audioLevelsUpdatedImpl: (([NSNumber]) -> Void)?
|
||||
@ -541,8 +541,8 @@ public final class OngoingGroupCallContext {
|
||||
enableNoiseSuppression: enableNoiseSuppression,
|
||||
disableAudioInput: disableAudioInput,
|
||||
preferX264: preferX264,
|
||||
logPath: logPath,
|
||||
audioDevice: audioDevice
|
||||
logPath: logPath
|
||||
// audioDevice: audioDevice
|
||||
)
|
||||
|
||||
let queue = self.queue
|
||||
@ -595,7 +595,7 @@ public final class OngoingGroupCallContext {
|
||||
guard let `self` = self else {
|
||||
return
|
||||
}
|
||||
self.audioDevice?.setManualAudioSessionIsActive(isActive)
|
||||
// self.audioDevice?.setManualAudioSessionIsActive(isActive)
|
||||
#if os(iOS)
|
||||
self.context.setManualAudioSessionIsActive(isActive)
|
||||
#endif
|
||||
@ -907,11 +907,11 @@ public final class OngoingGroupCallContext {
|
||||
let mappedTone = tone.flatMap { tone in
|
||||
CallAudioTone(samples: tone.samples, sampleRate: tone.sampleRate, loopCount: tone.loopCount)
|
||||
}
|
||||
if let audioDevice = self.audioDevice {
|
||||
audioDevice.setTone(mappedTone)
|
||||
} else {
|
||||
// if let audioDevice = self.audioDevice {
|
||||
// audioDevice.setTone(mappedTone)
|
||||
// } else {
|
||||
self.context.setTone(mappedTone)
|
||||
}
|
||||
// }
|
||||
#endif
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user