Skip to content

Commit

Permalink
Add waveform placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
alfogrillo committed Oct 19, 2023
1 parent c6b04b7 commit d7b37be
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ElementX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -6100,7 +6100,7 @@
repositoryURL = "https://github.com/dmrschmidt/DSWaveformImage";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 14.0.0;
minimumVersion = 14.1.0;
};
};
61916C63E3F5BD900F08DA0C /* XCRemoteSwiftPackageReference "KeychainAccess" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/dmrschmidt/DSWaveformImage",
"state" : {
"revision" : "730021fa5bab91aae2f77d90e1c1c8c4985c0756",
"version" : "14.0.0"
"revision" : "6a4c99a8ab2d2a03f42de21fb8777172ebbcccb1",
"version" : "14.1.0"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ struct VoiceMessageRoomPlaybackView: View {
})
}
}
.animation(.elementDefault, value: playerState.fileURL)
.onChange(of: dragState) { newDragState in
switch newDragState {
case .inactive:
Expand Down Expand Up @@ -164,15 +163,20 @@ struct VoiceMessageRoomPlaybackView: View {
if let url = playerState.fileURL {
WaveformView(audioURL: url,
configuration: .init(style: .striped(.init(color: .black, width: waveformLineWidth, spacing: waveformLinePadding)),
verticalScalingFactor: 1.0))
verticalScalingFactor: 1.0),
placeholder: { estimatedWaveformView })
.progressMask(progress: playerState.progress)
} else {
EstimatedWaveformView(lineWidth: waveformLineWidth,
linePadding: waveformLinePadding,
waveform: playerState.waveform,
progress: playerState.progress)
estimatedWaveformView
}
}

private var estimatedWaveformView: some View {
EstimatedWaveformView(lineWidth: waveformLineWidth,
linePadding: waveformLinePadding,
waveform: playerState.waveform,
progress: playerState.progress)
}
}

private enum DragState: Equatable {
Expand Down
2 changes: 1 addition & 1 deletion project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ packages:
branch: 0.0.1
DSWaveformImage:
url: https://github.com/dmrschmidt/DSWaveformImage
minorVersion: 14.0.0
minorVersion: 14.1.0



0 comments on commit d7b37be

Please sign in to comment.