mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Knock Requests banner display logic (#3550)
* added the join rule to the info * update SDK and added logic to display the banner in the room screen * added the logic to display the banner
This commit is contained in:
@@ -29,12 +29,11 @@ struct RoomScreen: View {
|
||||
timeline
|
||||
.background(Color.compound.bgCanvasDefault.ignoresSafeArea())
|
||||
.overlay(alignment: .top) {
|
||||
Group {
|
||||
if roomContext.viewState.shouldShowPinnedEventsBanner {
|
||||
pinnedItemsBanner
|
||||
}
|
||||
}
|
||||
.animation(.elementDefault, value: roomContext.viewState.shouldShowPinnedEventsBanner)
|
||||
pinnedItemsBanner
|
||||
}
|
||||
// This can overlay on top of the pinnedItemsBanner
|
||||
.overlay(alignment: .top) {
|
||||
knockRequestsBanner
|
||||
}
|
||||
.safeAreaInset(edge: .bottom, spacing: 0) {
|
||||
VStack(spacing: 0) {
|
||||
@@ -119,11 +118,45 @@ struct RoomScreen: View {
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var pinnedItemsBanner: some View {
|
||||
PinnedItemsBannerView(state: roomContext.viewState.pinnedEventsBannerState,
|
||||
onMainButtonTap: { roomContext.send(viewAction: .tappedPinnedEventsBanner) },
|
||||
onViewAllButtonTap: { roomContext.send(viewAction: .viewAllPins) })
|
||||
.transition(.move(edge: .top))
|
||||
Group {
|
||||
if roomContext.viewState.shouldShowPinnedEventsBanner {
|
||||
PinnedItemsBannerView(state: roomContext.viewState.pinnedEventsBannerState,
|
||||
onMainButtonTap: { roomContext.send(viewAction: .tappedPinnedEventsBanner) },
|
||||
onViewAllButtonTap: { roomContext.send(viewAction: .viewAllPins) })
|
||||
.transition(.move(edge: .top))
|
||||
}
|
||||
}
|
||||
.animation(.elementDefault, value: roomContext.viewState.shouldShowPinnedEventsBanner)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var knockRequestsBanner: some View {
|
||||
Group {
|
||||
if roomContext.viewState.shouldSeeKnockRequests {
|
||||
KnockRequestsBannerView(requests: roomContext.viewState.unseenKnockRequests,
|
||||
onDismiss: dismissKnockRequestsBanner,
|
||||
onAccept: roomContext.viewState.canAcceptKnocks ? acceptKnockRequest : nil,
|
||||
onViewAll: onViewAllKnockRequests,
|
||||
mediaProvider: roomContext.mediaProvider)
|
||||
.padding(.top, 16)
|
||||
.transition(.move(edge: .top))
|
||||
}
|
||||
}
|
||||
.animation(.elementDefault, value: roomContext.viewState.shouldSeeKnockRequests)
|
||||
}
|
||||
|
||||
private func dismissKnockRequestsBanner() {
|
||||
// TODO: Implement
|
||||
}
|
||||
|
||||
private func acceptKnockRequest(userID: String) {
|
||||
// TODO: Implement
|
||||
}
|
||||
|
||||
private func onViewAllKnockRequests() {
|
||||
// TODO: Implement
|
||||
}
|
||||
|
||||
private var scrollToBottomButton: some View {
|
||||
|
||||
Reference in New Issue
Block a user