TimelineKind refactor (#3193)

This commit is contained in:
Mauro
2024-08-22 20:33:21 +02:00
committed by GitHub
parent 8c07397548
commit 993fe8cd36
25 changed files with 69 additions and 71 deletions
@@ -54,19 +54,20 @@ struct PinnedItemsBannerView: View {
@ViewBuilder
private var viewAllButton: some View {
switch state {
case .loaded:
Button { onViewAllButtonTap() } label: {
Text(L10n.screenRoomPinnedBannerViewAllButtonTitle)
.font(.compound.bodyMDSemibold)
.foregroundStyle(Color.compound.textPrimary)
.padding(.horizontal, 16)
.padding(.vertical, 5)
}
case .loading:
ProgressView()
Button { onViewAllButtonTap() } label: {
Text(state.isLoading ? "" : L10n.screenRoomPinnedBannerViewAllButtonTitle)
.font(.compound.bodyMDSemibold)
.foregroundStyle(Color.compound.textPrimary)
.opacity(state.isLoading ? 0 : 1)
// Use overlay instead otherwise the sliding animation would not work
.overlay(alignment: .trailing) {
ProgressView()
.opacity(state.isLoading ? 1 : 0)
}
.padding(.horizontal, 16)
.padding(.vertical, 5)
}
.disabled(state.isLoading)
}
private var content: some View {
@@ -220,7 +220,6 @@ struct RoomScreen_Previews: PreviewProvider, TestablePreview {
static let roomViewModel = RoomScreenViewModel.mock(roomProxyMock: roomProxyMock)
static let timelineViewModel = TimelineViewModel(roomProxy: roomProxyMock,
timelineController: MockRoomTimelineController(),
isPinnedEventsTimeline: false,
mediaProvider: MockMediaProvider(),
mediaPlayerProvider: MediaPlayerProviderMock(),
voiceMessageMediaManager: VoiceMessageMediaManagerMock(),