mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 11:20:18 +00:00
Fixed contact import data format
Additional fixes for music in background when switching accounts
This commit is contained in:
parent
b0815c344e
commit
02836dc2d8
@ -483,7 +483,7 @@ private final class DeviceContactDataManagerImpl {
|
|||||||
var importableContactData: [String: (DeviceContactStableId, ImportableDeviceContactData)] = [:]
|
var importableContactData: [String: (DeviceContactStableId, ImportableDeviceContactData)] = [:]
|
||||||
for (stableId, basicData) in self.stableIdToBasicContactData {
|
for (stableId, basicData) in self.stableIdToBasicContactData {
|
||||||
for phoneNumber in basicData.phoneNumbers {
|
for phoneNumber in basicData.phoneNumbers {
|
||||||
let normalizedNumber = formatPhoneNumber(phoneNumber.value)
|
let normalizedNumber = phoneNumber.value
|
||||||
var replace = false
|
var replace = false
|
||||||
if let current = importableContactData[normalizedNumber] {
|
if let current = importableContactData[normalizedNumber] {
|
||||||
if stableId < current.0 {
|
if stableId < current.0 {
|
||||||
|
|||||||
@ -431,12 +431,10 @@ final class ManagedAudioRecorderContext {
|
|||||||
self.beganWithTone(false)
|
self.beganWithTone(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.audioUnit.with { audioUnit -> Void in
|
if let audioUnit = self.audioUnit.with({ $0 }) {
|
||||||
if let audioUnit = audioUnit {
|
guard AudioOutputUnitStart(audioUnit) == noErr else {
|
||||||
guard AudioOutputUnitStart(audioUnit) == noErr else {
|
self.stop()
|
||||||
self.stop()
|
return
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,6 +46,15 @@ public final class MediaManager: NSObject {
|
|||||||
return sharedAudioSession
|
return sharedAudioSession
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private let isCurrentPromise = ValuePromise<Bool>(false)
|
||||||
|
var isCurrent: Bool = false {
|
||||||
|
didSet {
|
||||||
|
if self.isCurrent != oldValue {
|
||||||
|
self.isCurrentPromise.set(self.isCurrent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private let queue = Queue.mainQueue()
|
private let queue = Queue.mainQueue()
|
||||||
|
|
||||||
private let postbox: Postbox
|
private let postbox: Postbox
|
||||||
@ -370,8 +379,11 @@ public final class MediaManager: NSObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.globalAudioSessionForegroundDisposable.set((shouldKeepAudioSession |> deliverOnMainQueue).start(next: { [weak self] value in
|
self.globalAudioSessionForegroundDisposable.set((shouldKeepAudioSession |> deliverOnMainQueue).start(next: { [weak self] value in
|
||||||
if value {
|
guard let strongSelf = self else {
|
||||||
self?.audioSession.dropAll()
|
return
|
||||||
|
}
|
||||||
|
if strongSelf.isCurrent && value {
|
||||||
|
strongSelf.audioSession.dropAll()
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -105,6 +105,12 @@ public final class TelegramApplicationContext {
|
|||||||
|
|
||||||
private var storedPassword: (String, CFAbsoluteTime, SwiftSignalKit.Timer)?
|
private var storedPassword: (String, CFAbsoluteTime, SwiftSignalKit.Timer)?
|
||||||
|
|
||||||
|
public var isCurrent: Bool = false {
|
||||||
|
didSet {
|
||||||
|
self.mediaManager?.isCurrent = self.isCurrent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public init(applicationBindings: TelegramApplicationBindings, accountManager: AccountManager, account: Account?, initialPresentationDataAndSettings: InitialPresentationDataAndSettings, postbox: Postbox) {
|
public init(applicationBindings: TelegramApplicationBindings, accountManager: AccountManager, account: Account?, initialPresentationDataAndSettings: InitialPresentationDataAndSettings, postbox: Postbox) {
|
||||||
if account != nil {
|
if account != nil {
|
||||||
self.mediaManager = MediaManager(postbox: postbox, inForeground: applicationBindings.applicationInForeground)
|
self.mediaManager = MediaManager(postbox: postbox, inForeground: applicationBindings.applicationInForeground)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user