mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-01 07:57:01 +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
|
||||
}
|
||||
|
||||
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> {
|
||||
guard CNContactStore.authorizationStatus(for: .contacts) == .authorized else {
|
||||
return .fail(.generic)
|
||||
@ -43,7 +57,7 @@ func matchingDeviceContacts(stableIds: [String]) -> Signal<[MatchingDeviceContac
|
||||
return .single(contacts.map({ contact in
|
||||
let phoneNumbers = contact.phoneNumbers.compactMap({ number -> String? in
|
||||
if !number.value.stringValue.isEmpty {
|
||||
return number.value.stringValue
|
||||
return cleanPhoneNumber(number.value.stringValue)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
@ -75,22 +89,18 @@ func matchingCloudContacts(postbox: Postbox, contacts: [MatchingDeviceContact])
|
||||
var result: [(String, TelegramUser)] = []
|
||||
outer: for peerId in transaction.getContactPeerIds() {
|
||||
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) {
|
||||
for contact in contacts {
|
||||
if let contactPeerId = contact.peerId, contactPeerId == peerId {
|
||||
result.append((contact.stableId, peer))
|
||||
continue outer
|
||||
} else if let peerPhoneNumber = peer.phone {
|
||||
for contactPhoneNumber in contact.phoneNumbers {
|
||||
if matchPhoneNumbers(contactPhoneNumber, peerPhoneNumber) {
|
||||
result.append((contact.stableId, peer))
|
||||
continue outer
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for contact in contacts {
|
||||
if let contactPeerId = contact.peerId, contactPeerId == peerId {
|
||||
result.append((contact.stableId, peer))
|
||||
continue outer
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ typedef enum {
|
||||
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
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ private enum ResetPasswordEntry: ItemListNodeEntry, Equatable {
|
||||
func item(_ arguments: ResetPasswordControllerArguments) -> ListViewItem {
|
||||
switch self {
|
||||
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)
|
||||
}, action: {
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user