diff --git a/Signal/src/ViewControllers/ContactsPicker.swift b/Signal/src/ViewControllers/ContactsPicker.swift index db22a57e0..4729fcf01 100644 --- a/Signal/src/ViewControllers/ContactsPicker.swift +++ b/Signal/src/ViewControllers/ContactsPicker.swift @@ -59,6 +59,11 @@ public class ContactsPicker: OWSViewController, UITableViewDelegate, UITableView } private let collation = UILocalizedIndexedCollation.current() + public var collationForTests: UILocalizedIndexedCollation { + get { + return collation + } + } private let contactStore = CNContactStore() // Data Source State diff --git a/Signal/test/call/PeerConnectionClientTest.swift b/Signal/test/call/PeerConnectionClientTest.swift index c4b4926f5..34ef23466 100644 --- a/Signal/test/call/PeerConnectionClientTest.swift +++ b/Signal/test/call/PeerConnectionClientTest.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // import XCTest @@ -12,35 +12,37 @@ import WebRTC class FakePeerConnectionClientDelegate: PeerConnectionClientDelegate { enum ConnectionState { - case connected, failed + case connected, disconnected, failed } var connectionState: ConnectionState? var localIceCandidates = [RTCIceCandidate]() var dataChannelMessages = [OWSWebRTCProtosData]() - internal func peerConnectionClientIceConnected(_ peerconnectionClient: PeerConnectionClient) { + func peerConnectionClientIceConnected(_ peerconnectionClient: PeerConnectionClient) { connectionState = .connected } - internal func peerConnectionClientIceFailed(_ peerconnectionClient: PeerConnectionClient) { + func peerConnectionClientIceDisconnected(_ peerconnectionClient: PeerConnectionClient) { + connectionState = .disconnected + } + + func peerConnectionClientIceFailed(_ peerconnectionClient: PeerConnectionClient) { connectionState = .failed } - internal func peerConnectionClient(_ peerconnectionClient: PeerConnectionClient, addedLocalIceCandidate iceCandidate: RTCIceCandidate) { + func peerConnectionClient(_ peerconnectionClient: PeerConnectionClient, addedLocalIceCandidate iceCandidate: RTCIceCandidate) { localIceCandidates.append(iceCandidate) } - internal func peerConnectionClient(_ peerconnectionClient: PeerConnectionClient, received dataChannelMessage: OWSWebRTCProtosData) { + func peerConnectionClient(_ peerconnectionClient: PeerConnectionClient, received dataChannelMessage: OWSWebRTCProtosData) { dataChannelMessages.append(dataChannelMessage) } - internal func peerConnectionClient(_ peerconnectionClient: PeerConnectionClient, didUpdateLocal videoTrack: RTCVideoTrack?) { - + func peerConnectionClient(_ peerconnectionClient: PeerConnectionClient, didUpdateLocal videoTrack: RTCVideoTrack?) { } - internal func peerConnectionClient(_ peerconnectionClient: PeerConnectionClient, didUpdateRemote videoTrack: RTCVideoTrack?) { - + func peerConnectionClient(_ peerconnectionClient: PeerConnectionClient, didUpdateRemote videoTrack: RTCVideoTrack?) { } } diff --git a/Signal/test/contact/ContactsPickerTest.swift b/Signal/test/contact/ContactsPickerTest.swift index 21a86203e..c5279a0b2 100644 --- a/Signal/test/contact/ContactsPickerTest.swift +++ b/Signal/test/contact/ContactsPickerTest.swift @@ -32,10 +32,10 @@ final class ContactsPickerTest: XCTestCase { let emailOnlyContactD = CNMutableContact() emailOnlyContactD.emailAddresses.append(CNLabeledValue(label: nil, value: "dude@bla.com")) - let contactsPicker = ContactsPicker(delegate: nil) + let contactsPicker = ContactsPicker(allowsMultipleSelection: false, subtitleCellType: .phoneNumber) let collatedContacts = contactsPicker.collatedContacts([emailOnlyContactB, emailOnlyContactD]) - let sectionTitles = contactsPicker.collation.sectionTitles + let sectionTitles = contactsPicker.collationForTests.sectionTitles if let bIndex = sectionTitles.index(of: "B") { let bSectionContacts = collatedContacts[bIndex] XCTAssertEqual(bSectionContacts.first, emailOnlyContactB) @@ -54,10 +54,10 @@ final class ContactsPickerTest: XCTestCase { nameAndEmailContact.givenName = "Alice" nameAndEmailContact.emailAddresses.append(CNLabeledValue(label: nil, value: "nameAndEmail@bla.com")) - let contactsPicker = ContactsPicker(delegate: nil) + let contactsPicker = ContactsPicker(allowsMultipleSelection: false, subtitleCellType: .phoneNumber) let collatedContacts = contactsPicker.collatedContacts([nameAndEmailContact]) - let sectionTitles = contactsPicker.collation.sectionTitles + let sectionTitles = contactsPicker.collationForTests.sectionTitles if let aIndex = sectionTitles.index(of: "A") { let aSectionContacts = collatedContacts[aIndex] XCTAssertEqual(aSectionContacts.first, nameAndEmailContact)