mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Make AnalyticsService mockable via `AnalyticsServiceProtocol (#5599)
* Create AnalyticsServiceProtocol and conform AnalyticsService * Replace AnalyticsService properties and arguments with AnalyticsServiceProtocol * Inline AnalyticsServiceMock replacing old mock * handle more complex AnalyticsServiceMock callsites * move documentation from AnalyticsService to AnalyticsServiceProtocol
This commit is contained in:
+1
-1
@@ -13,7 +13,7 @@ struct RoomMembersListScreenCoordinatorParameters {
|
||||
let userSession: UserSessionProtocol
|
||||
let roomProxy: JoinedRoomProxyProtocol
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
let analytics: AnalyticsService
|
||||
let analytics: AnalyticsServiceProtocol
|
||||
}
|
||||
|
||||
enum RoomMembersListScreenCoordinatorAction {
|
||||
|
||||
@@ -15,7 +15,7 @@ class RoomMembersListScreenViewModel: RoomMembersListScreenViewModelType, RoomMe
|
||||
private let userSession: UserSessionProtocol
|
||||
private let roomProxy: JoinedRoomProxyProtocol
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
private let analytics: AnalyticsService
|
||||
private let analytics: AnalyticsServiceProtocol
|
||||
|
||||
private var members: [RoomMemberProxyProtocol] = []
|
||||
private var currentUserProxy: RoomMemberProxyProtocol?
|
||||
@@ -30,7 +30,7 @@ class RoomMembersListScreenViewModel: RoomMembersListScreenViewModelType, RoomMe
|
||||
userSession: UserSessionProtocol,
|
||||
roomProxy: JoinedRoomProxyProtocol,
|
||||
userIndicatorController: UserIndicatorControllerProtocol,
|
||||
analytics: AnalyticsService) {
|
||||
analytics: AnalyticsServiceProtocol) {
|
||||
self.userSession = userSession
|
||||
self.roomProxy = roomProxy
|
||||
self.userIndicatorController = userIndicatorController
|
||||
|
||||
@@ -262,6 +262,6 @@ struct RoomMembersListScreen_Previews: PreviewProvider, TestablePreview {
|
||||
ownUserID: ownUserID,
|
||||
powerLevelsConfiguration: .init(canUserInvite: false))),
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analytics: .mock())
|
||||
analytics: AnalyticsServiceMock.default())
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -132,7 +132,7 @@ struct RoomMembersListMemberCell_Previews: PreviewProvider, TestablePreview {
|
||||
static let viewModel = RoomMembersListScreenViewModel(userSession: UserSessionMock(.init()),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Some room", members: [])),
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analytics: .mock())
|
||||
analytics: AnalyticsServiceMock.default())
|
||||
static var previews: some View {
|
||||
VStack(spacing: 0) {
|
||||
Section("Invited/Joined") {
|
||||
|
||||
Reference in New Issue
Block a user