Ensure the audio index is updated when items are changed

This commit is contained in:
Jackson Harper 2022-10-13 15:04:57 +08:00
parent 2e9bda7835
commit bafe1bd338
2 changed files with 7 additions and 6 deletions

View file

@ -434,7 +434,7 @@
Button(action: {
audioController.currentVoice = voice.key
self.showVoiceSheet = false
}) {
}, label: {
HStack {
Text(voice.name)
@ -445,8 +445,7 @@
}
}
.contentShape(Rectangle())
}
.buttonStyle(PlainButtonStyle())
}).buttonStyle(PlainButtonStyle())
}
}
.padding(.top, 32)
@ -455,11 +454,11 @@
}
.navigationBarTitle("Voice")
.navigationBarTitleDisplayMode(.inline)
.navigationBarItems(leading: Button(action: { self.showVoiceSheet = false }) {
.navigationBarItems(leading: Button(action: { self.showVoiceSheet = false }, label: {
Image(systemName: "chevron.backward")
.font(.appNavbarIcon)
.tint(.appGrayTextContrast)
})
}))
}
}

View file

@ -268,6 +268,7 @@
timeElapsed = 0
duration = 1
durations = nil
currentAudioIndex = 0
if let stoppedId = stoppedId {
EventTracker.track(
@ -491,6 +492,7 @@
}
return ""
}
currentAudioIndex = 0
} else {
textItems = nil
}
@ -940,7 +942,7 @@
let str = String(decoding: data, as: UTF8.self)
print("result speech file: ", str)
let document = try? JSONDecoder().decode(SpeechDocument.self, from: data)
document = try? JSONDecoder().decode(SpeechDocument.self, from: data)
// Cache the file - if it exists
if let document = document {