mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-02 00:17:02 +00:00
Fixed Watch voice messages encoding
Fixed Siri contacts matching
This commit is contained in:
parent
b4541f7495
commit
dfb61a3267
@ -31,6 +31,20 @@ private func parseAppSpecificContactReference(_ value: String) -> PeerId? {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func cleanPhoneNumber(_ text: String) -> String {
|
||||||
|
var result = ""
|
||||||
|
for c in text {
|
||||||
|
if c == "+" {
|
||||||
|
if result.isEmpty {
|
||||||
|
result += String(c)
|
||||||
|
}
|
||||||
|
} else if c >= "0" && c <= "9" {
|
||||||
|
result += String(c)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
func matchingDeviceContacts(stableIds: [String]) -> Signal<[MatchingDeviceContact], IntentContactsError> {
|
func matchingDeviceContacts(stableIds: [String]) -> Signal<[MatchingDeviceContact], IntentContactsError> {
|
||||||
guard CNContactStore.authorizationStatus(for: .contacts) == .authorized else {
|
guard CNContactStore.authorizationStatus(for: .contacts) == .authorized else {
|
||||||
return .fail(.generic)
|
return .fail(.generic)
|
||||||
@ -43,7 +57,7 @@ func matchingDeviceContacts(stableIds: [String]) -> Signal<[MatchingDeviceContac
|
|||||||
return .single(contacts.map({ contact in
|
return .single(contacts.map({ contact in
|
||||||
let phoneNumbers = contact.phoneNumbers.compactMap({ number -> String? in
|
let phoneNumbers = contact.phoneNumbers.compactMap({ number -> String? in
|
||||||
if !number.value.stringValue.isEmpty {
|
if !number.value.stringValue.isEmpty {
|
||||||
return number.value.stringValue
|
return cleanPhoneNumber(number.value.stringValue)
|
||||||
} else {
|
} else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -75,20 +89,16 @@ func matchingCloudContacts(postbox: Postbox, contacts: [MatchingDeviceContact])
|
|||||||
var result: [(String, TelegramUser)] = []
|
var result: [(String, TelegramUser)] = []
|
||||||
outer: for peerId in transaction.getContactPeerIds() {
|
outer: for peerId in transaction.getContactPeerIds() {
|
||||||
if let peer = transaction.getPeer(peerId) as? TelegramUser {
|
if let peer = transaction.getPeer(peerId) as? TelegramUser {
|
||||||
if let peerPhoneNumber = peer.phone {
|
|
||||||
for contact in contacts {
|
|
||||||
for phoneNumber in contact.phoneNumbers {
|
|
||||||
if matchPhoneNumbers(phoneNumber, peerPhoneNumber) {
|
|
||||||
result.append((contact.stableId, peer))
|
|
||||||
continue outer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for contact in contacts {
|
for contact in contacts {
|
||||||
if let contactPeerId = contact.peerId, contactPeerId == peerId {
|
if let contactPeerId = contact.peerId, contactPeerId == peerId {
|
||||||
result.append((contact.stableId, peer))
|
result.append((contact.stableId, peer))
|
||||||
continue outer
|
continue outer
|
||||||
|
} else if let peerPhoneNumber = peer.phone {
|
||||||
|
for contactPhoneNumber in contact.phoneNumbers {
|
||||||
|
if matchPhoneNumbers(contactPhoneNumber, peerPhoneNumber) {
|
||||||
|
result.append((contact.stableId, peer))
|
||||||
|
continue outer
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ typedef enum {
|
|||||||
return queue;
|
return queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int encoderPacketSizeInBytes = TGBridgeAudioEncoderSampleRate / 1000 * 60 * 2;
|
static const int encoderPacketSizeInBytes = 16000 / 1000 * 60 * 2;
|
||||||
|
|
||||||
- (void)startWithCompletion:(void (^)(NSString *, int32_t))completion
|
- (void)startWithCompletion:(void (^)(NSString *, int32_t))completion
|
||||||
{
|
{
|
||||||
|
@ -65,7 +65,7 @@ private enum ResetPasswordEntry: ItemListNodeEntry, Equatable {
|
|||||||
func item(_ arguments: ResetPasswordControllerArguments) -> ListViewItem {
|
func item(_ arguments: ResetPasswordControllerArguments) -> ListViewItem {
|
||||||
switch self {
|
switch self {
|
||||||
case let .code(theme, text, value):
|
case let .code(theme, text, value):
|
||||||
return ItemListSingleLineInputItem(theme: theme, title: NSAttributedString(string: text), text: value, placeholder: "", type: .number, spacing: 10.0, tag: ResetPasswordEntryTag.code, sectionId: self.section, textUpdated: { updatedText in
|
return ItemListSingleLineInputItem(theme: theme, title: NSAttributedString(string: text, textColor: theme.list.itemPrimaryTextColor), text: value, placeholder: "", type: .number, spacing: 10.0, tag: ResetPasswordEntryTag.code, sectionId: self.section, textUpdated: { updatedText in
|
||||||
arguments.updateCodeText(updatedText)
|
arguments.updateCodeText(updatedText)
|
||||||
}, action: {
|
}, action: {
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user