Remove unused protocol.

This commit is contained in:
Doug 2024-08-12 10:57:51 +01:00 committed by Doug
parent c62c12397b
commit 8e9ed248e0
4 changed files with 6 additions and 80 deletions

View File

@ -29,7 +29,6 @@
024E70451A7CD9E4E034D8A9 /* VoiceMessageRoomTimelineItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D529B976F8B2AA654D923422 /* VoiceMessageRoomTimelineItem.swift */; };
02A92F8F4538CECDFB4F2607 /* RoomDirectorySearchScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1562EAF6231151A675BED7A9 /* RoomDirectorySearchScreenCoordinator.swift */; };
02D8DF8EB7537EB4E9019DDB /* EventBasedTimelineItemProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 218AB05B4E3889731959C5F1 /* EventBasedTimelineItemProtocol.swift */; };
02F4FAE40AF63A1941FD3BBA /* NotificationCenterProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10B7F8EE25775DE2A305CBB5 /* NotificationCenterProtocol.swift */; };
037006FB6DF1374F94E4058D /* Dictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFDCAC6CAAD65A2C24EA9C4B /* Dictionary.swift */; };
03CDCA6243F89B194E3FAD17 /* EncryptionAuthenticity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 955336CBD5ED73C792D1F580 /* EncryptionAuthenticity.swift */; };
0437765FF480249486893CC7 /* ScreenTrackerViewModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 196004E7695FBA292A7944AF /* ScreenTrackerViewModifier.swift */; };
@ -1234,7 +1233,6 @@
105429F29096729EDD3152CF /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/SAS.strings; sourceTree = "<group>"; };
1059E2AE7878CF7820592637 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
105B2A8426404EF66F00CFDB /* RoomTimelineItemFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomTimelineItemFactory.swift; sourceTree = "<group>"; };
10B7F8EE25775DE2A305CBB5 /* NotificationCenterProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationCenterProtocol.swift; sourceTree = "<group>"; };
10CC626F97AD70FF0420C115 /* RoomSummaryProviderProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomSummaryProviderProtocol.swift; sourceTree = "<group>"; };
10F130DF775CE6BC51A4E392 /* AppLockSetupBiometricsScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLockSetupBiometricsScreenModels.swift; sourceTree = "<group>"; };
10F32E0B4B83D2A11EE8D011 /* InviteUsersScreenSelectedItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InviteUsersScreenSelectedItem.swift; sourceTree = "<group>"; };
@ -4783,7 +4781,6 @@
7B25F959A434BB9923A3223F /* ExpiringTaskRunner.swift */,
6A580295A56B55A856CC4084 /* InfoPlistReader.swift */,
6AD1A853D605C2146B0DC028 /* MatrixEntityRegex.swift */,
10B7F8EE25775DE2A305CBB5 /* NotificationCenterProtocol.swift */,
B3A1398EFF65090FDA1CB639 /* ProcessInfo.swift */,
53482ECA4B6633961EC224F5 /* ScrollViewAdapter.swift */,
4481799F455B3DA243BDA2AC /* ShareToMapsAppActivity.swift */,
@ -6410,7 +6407,6 @@
0C58A846F61949B1D545D661 /* NoticeRoomTimelineItem.swift in Sources */,
9408CE8B8865C0C8DD4C9869 /* NoticeRoomTimelineItemContent.swift in Sources */,
368C8758FCD079E6AAA18C2C /* NoticeRoomTimelineView.swift in Sources */,
02F4FAE40AF63A1941FD3BBA /* NotificationCenterProtocol.swift in Sources */,
3F70E237CE4C3FAB02FC227F /* NotificationConstants.swift in Sources */,
CE9530A4CA661E090635C2F2 /* NotificationItemProxy.swift in Sources */,
FD4C21F8DA1E273DE94FCD1A /* NotificationItemProxyProtocol.swift in Sources */,

View File

@ -6332,50 +6332,6 @@ class NetworkMonitorMock: NetworkMonitorProtocol {
var underlyingReachabilityPublisher: CurrentValuePublisher<NetworkMonitorReachability, Never>!
}
class NotificationCenterMock: NotificationCenterProtocol {
//MARK: - post
var postNameObjectUnderlyingCallsCount = 0
var postNameObjectCallsCount: Int {
get {
if Thread.isMainThread {
return postNameObjectUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = postNameObjectUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
postNameObjectUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
postNameObjectUnderlyingCallsCount = newValue
}
}
}
}
var postNameObjectCalled: Bool {
return postNameObjectCallsCount > 0
}
var postNameObjectReceivedArguments: (aName: NSNotification.Name, anObject: Any?)?
var postNameObjectReceivedInvocations: [(aName: NSNotification.Name, anObject: Any?)] = []
var postNameObjectClosure: ((NSNotification.Name, Any?) -> Void)?
func post(name aName: NSNotification.Name, object anObject: Any?) {
postNameObjectCallsCount += 1
postNameObjectReceivedArguments = (aName: aName, anObject: anObject)
DispatchQueue.main.async {
self.postNameObjectReceivedInvocations.append((aName: aName, anObject: anObject))
}
postNameObjectClosure?(aName, anObject)
}
}
class NotificationManagerMock: NotificationManagerProtocol {
weak var delegate: NotificationManagerDelegate?

View File

@ -1,24 +0,0 @@
//
// Copyright 2023 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
// sourcery: AutoMockable
protocol NotificationCenterProtocol: AnyObject {
func post(name aName: NSNotification.Name, object anObject: Any?)
}
extension NotificationCenter: NotificationCenterProtocol { }

View File

@ -252,7 +252,7 @@ class RoomScreenViewModelTests: XCTestCase {
let items = [TextRoomTimelineItem(eventID: "t1"),
TextRoomTimelineItem(eventID: "t2"),
TextRoomTimelineItem(eventID: "t3")]
let (viewModel, _, timelineProxy, _, _) = readReceiptsConfiguration(with: items)
let (viewModel, _, timelineProxy, _) = readReceiptsConfiguration(with: items)
// When sending a read receipt for the last item.
viewModel.context.send(viewAction: .sendReadReceiptIfNeeded(items.last!.id))
@ -270,7 +270,7 @@ class RoomScreenViewModelTests: XCTestCase {
let items = [TextRoomTimelineItem(eventID: "t1"),
TextRoomTimelineItem(eventID: "t2"),
TextRoomTimelineItem(eventID: "t3")]
let (viewModel, _, timelineProxy, timelineController, _) = readReceiptsConfiguration(with: items)
let (viewModel, _, timelineProxy, timelineController) = readReceiptsConfiguration(with: items)
viewModel.context.send(viewAction: .sendReadReceiptIfNeeded(items.last!.id))
try await Task.sleep(for: .milliseconds(100))
XCTAssertEqual(timelineProxy.sendReadReceiptForTypeCallsCount, 1)
@ -303,7 +303,7 @@ class RoomScreenViewModelTests: XCTestCase {
let items = [SeparatorRoomTimelineItem(timelineID: "v1"),
SeparatorRoomTimelineItem(timelineID: "v2"),
SeparatorRoomTimelineItem(timelineID: "v3")]
let (viewModel, _, timelineProxy, _, _) = readReceiptsConfiguration(with: items)
let (viewModel, _, timelineProxy, _) = readReceiptsConfiguration(with: items)
// When sending a read receipt for the last item.
viewModel.context.send(viewAction: .sendReadReceiptIfNeeded(items.last!.id))
@ -318,7 +318,7 @@ class RoomScreenViewModelTests: XCTestCase {
let items: [RoomTimelineItemProtocol] = [TextRoomTimelineItem(eventID: "t1"),
TextRoomTimelineItem(eventID: "t2"),
SeparatorRoomTimelineItem(timelineID: "v3")]
let (viewModel, _, _, _, _) = readReceiptsConfiguration(with: items)
let (viewModel, _, _, _) = readReceiptsConfiguration(with: items)
// When sending a read receipt for the last item.
viewModel.context.send(viewAction: .sendReadReceiptIfNeeded(items.last!.id))
@ -330,9 +330,7 @@ class RoomScreenViewModelTests: XCTestCase {
private func readReceiptsConfiguration(with items: [RoomTimelineItemProtocol]) -> (RoomScreenViewModel,
RoomProxyMock,
TimelineProxyMock,
MockRoomTimelineController,
NotificationCenterMock) {
let notificationCenter = NotificationCenterMock()
MockRoomTimelineController) {
let roomProxy = RoomProxyMock(.init(name: ""))
let timelineProxy = TimelineProxyMock()
@ -354,7 +352,7 @@ class RoomScreenViewModelTests: XCTestCase {
appMediator: AppMediatorMock.default,
appSettings: ServiceLocator.shared.settings,
analyticsService: ServiceLocator.shared.analytics)
return (viewModel, roomProxy, timelineProxy, timelineController, notificationCenter)
return (viewModel, roomProxy, timelineProxy, timelineController)
}
func testShowReadReceipts() async throws {