Implement Knock Logic (#3573)

* WIP RequestToJoin struct

* implemented the logic to display the cells

* knock request banner accept flow

* mark all knocks as seen implemented

* details logic

* implemented accept, decline and ban in the list

* added a loader and modified the stacked view

of the banner

* pr suggestions

* updated naming and loading strings

* added the initial loading state

improved code and the tests

* updated a string that has changed

* code improvement

* tests for the room screen view model

* room details tests

and improved the knock requests tests for the room screen

* knock requests list tests

* added error state alerts with retry

* struct has been renamed on the sdk

so I renamed it also on the app side

* update SDK
This commit is contained in:
Mauro
2024-12-16 15:32:45 +01:00
committed by GitHub
parent 016cdc687a
commit 45a630dd85
54 changed files with 1700 additions and 150 deletions
@@ -166,8 +166,7 @@ struct RoomDetailsScreen: View {
if context.viewState.canSeeKnockingRequests {
ListRow(label: .default(title: L10n.screenRoomDetailsRequestsToJoinTitle,
icon: \.askToJoin),
// TODO: Display count if requests > 0 when an API for them is available
details: .counter(1),
details: context.viewState.knockRequestsCount > 0 ? .counter(context.viewState.knockRequestsCount) : nil,
kind: .navigationLink {
context.send(viewAction: .processTapRequestsToJoin)
})
@@ -324,6 +323,7 @@ struct RoomDetailsScreen: View {
struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview {
static let genericRoomViewModel = {
ServiceLocator.shared.settings.knockingEnabled = true
let knockRequests: [KnockRequestProxyMock] = [.init()]
let members: [RoomMemberProxyMock] = [
.mockMeAdmin,
.mockAlice,
@@ -344,6 +344,7 @@ struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview {
isEncrypted: true,
canonicalAlias: "#alias:domain.com",
members: members,
knockRequestsState: .loaded(knockRequests),
joinRule: .knock))
var notificationSettingsProxyMockConfiguration = NotificationSettingsProxyMockConfiguration()
@@ -388,6 +389,7 @@ struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview {
}()
static let simpleRoomViewModel = {
let knockRequests: [KnockRequestProxyMock] = [.init()]
ServiceLocator.shared.settings.knockingEnabled = true
let members: [RoomMemberProxyMock] = [
.mockMeAdmin,
@@ -400,6 +402,7 @@ struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview {
isDirect: false,
isEncrypted: false,
members: members,
knockRequestsState: .loaded(knockRequests),
joinRule: .knock))
let notificationSettingsProxy = NotificationSettingsProxyMock(with: .init())