mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Knocked Preview implementation (#3426)
* JoinRoomScreen ui for knocking * code improvement * updated previews * added knocked state with tests * send knock request * Apply suggestions from code review Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> * pr comments * update tests * new API * knock implementation and cancel knock * update strings * added a knocked cell in the home screen * design update * updated SDK * simplified the invite case code * pr comments * updated previews * added message as reason * updated strings * fixing tests --------- Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>
This commit is contained in:
@@ -23,8 +23,7 @@ class HomeScreenRoomTests: XCTestCase {
|
||||
hasOngoingCall: Bool) {
|
||||
roomSummary = RoomSummary(roomListItem: .init(noPointer: .init()),
|
||||
id: "Test room",
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
joinRequestType: nil,
|
||||
name: "Test room",
|
||||
isDirect: false,
|
||||
avatarURL: nil,
|
||||
|
||||
@@ -56,6 +56,23 @@ class JoinRoomScreenViewModelTests: XCTestCase {
|
||||
}.fulfill()
|
||||
}
|
||||
|
||||
func testCancelKnock() async throws {
|
||||
setupViewModel(knocked: true)
|
||||
|
||||
try await deferFulfillment(viewModel.context.$viewState) { state in
|
||||
state.mode == .knocked
|
||||
}.fulfill()
|
||||
|
||||
context.send(viewAction: .cancelKnock)
|
||||
XCTAssertEqual(viewModel.context.alertInfo?.id, .cancelKnock)
|
||||
|
||||
let deferred = deferFulfillment(viewModel.actionsPublisher) { action in
|
||||
action == .dismiss
|
||||
}
|
||||
context.alertInfo?.secondaryButton?.action?()
|
||||
try await deferred.fulfill()
|
||||
}
|
||||
|
||||
private func setupViewModel(throwing: Bool = false, knocked: Bool = false) {
|
||||
let clientProxy = ClientProxyMock(.init())
|
||||
|
||||
@@ -75,7 +92,10 @@ class JoinRoomScreenViewModelTests: XCTestCase {
|
||||
|
||||
if knocked {
|
||||
clientProxy.roomForIdentifierClosure = { _ in
|
||||
.knocked(KnockedRoomProxyMock(.init()))
|
||||
let roomProxy = KnockedRoomProxyMock(.init())
|
||||
// to test the cancel knock function
|
||||
roomProxy.cancelKnockUnderlyingReturnValue = .success(())
|
||||
return .knocked(roomProxy)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -80,8 +80,7 @@ class LoggingTests: XCTestCase {
|
||||
let heroName = "Pseudonym"
|
||||
let roomSummary = RoomSummary(roomListItem: .init(noPointer: .init()),
|
||||
id: "myroomid",
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
joinRequestType: nil,
|
||||
name: roomName,
|
||||
isDirect: true,
|
||||
avatarURL: nil,
|
||||
|
||||
@@ -56,8 +56,7 @@ class RoomSummaryTests: XCTestCase {
|
||||
func makeSummary(isDirect: Bool, hasRoomAvatar: Bool) -> RoomSummary {
|
||||
RoomSummary(roomListItem: .init(noPointer: .init()),
|
||||
id: roomDetails.id,
|
||||
isInvite: false,
|
||||
inviter: nil,
|
||||
joinRequestType: nil,
|
||||
name: roomDetails.name,
|
||||
isDirect: isDirect,
|
||||
avatarURL: hasRoomAvatar ? roomDetails.avatarURL : nil,
|
||||
|
||||
Reference in New Issue
Block a user