Skip to content

Commit

Permalink
Lift to SpeziSpeech 1.0, NavigationBar item improvements (#7)
Browse files Browse the repository at this point in the history
# Lift to SpeziSpeech 1.0, NavigationBar item improvements

## ♻️ Current situation & Problem
`SpeziChat` is still dependent on an old tagged version of
`SpeziSpeech`.
In addition, the navigation bar share icon always allocates space (even
when the icon is not shown - initially done for animation purposes),
leading to issues with `View`s reusing the `ChatView` while adding
navigation bar items.


## ⚙️ Release Notes 
- Lift `SpeziChat` to tagged 1.0.0 version of `SpeziSpeech`.
- Adjust navigation bar item behaviour of export button


## 📚 Documentation
--


## ✅ Testing
--


## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
philippzagar authored Jan 19, 2024
1 parent 8817bf4 commit 086ecb4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ let package = Package(
.library(name: "SpeziChat", targets: ["SpeziChat"])
],
dependencies: [
.package(url: "https://github.com/StanfordSpezi/SpeziSpeech", .upToNextMinor(from: "0.1.0"))
.package(url: "https://github.com/StanfordSpezi/SpeziSpeech", from: "1.0.0")
],
targets: [
.target(
Expand Down
41 changes: 22 additions & 19 deletions Sources/SpeziChat/ChatView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,14 @@ public struct ChatView: View {
}
}
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
Button(action: {
showShareSheet = true
}) {
Image(systemName: "square.and.arrow.up")
.accessibilityLabel(Text("EXPORT_CHAT_BUTTON", bundle: .module))
.opacity(exportEnabled ? 1.0 : 0.0)
.scaleEffect(exportEnabled ? 1.0 : 0.8)
.animation(.easeInOut, value: exportEnabled)
.disabled(!exportEnabled)
if exportEnabled {
ToolbarItem(placement: .topBarTrailing) {
Button(action: {
showShareSheet = true
}) {
Image(systemName: "square.and.arrow.up")
.accessibilityLabel(Text("EXPORT_CHAT_BUTTON", bundle: .module))
}
}
}
}
Expand Down Expand Up @@ -138,13 +136,18 @@ public struct ChatView: View {


#Preview {
ChatView(.constant(
[
ChatEntity(role: .system, content: "System Message!"),
ChatEntity(role: .system, content: "System Message (hidden)!"),
ChatEntity(role: .user, content: "User Message!"),
ChatEntity(role: .assistant, content: "Assistant Message!"),
ChatEntity(role: .function(name: "test_function"), content: "Function Message!")
]
))
NavigationStack {
ChatView(
.constant(
[
ChatEntity(role: .system, content: "System Message!"),
ChatEntity(role: .system, content: "System Message (hidden)!"),
ChatEntity(role: .user, content: "User Message!"),
ChatEntity(role: .assistant, content: "Assistant Message!"),
ChatEntity(role: .function(name: "test_function"), content: "Function Message!")
]
),
exportFormat: .pdf
)
}
}

0 comments on commit 086ecb4

Please sign in to comment.