Display an info alert if a user taps on Highlight but does not have a highlight

This commit is contained in:
Jackson Harper 2022-11-25 15:10:02 +08:00
parent a3b53485ed
commit 18fc5d19a4

View file

@ -16,6 +16,7 @@ public struct ShareExtensionView: View {
@State var messageText: String?
@State var viewState = ViewState.mainView
@State var showHighlightInstructionAlert = false
enum FocusField: Hashable {
case titleEditor
@ -297,7 +298,7 @@ public struct ShareExtensionView: View {
Button(
action: {},
label: {
Button(action: {}, label: { Label("Dismiss", systemImage: "arrow.down.to.line") })
Button("Dismiss", role: .cancel, action: {})
}
)
Button(action: {
@ -452,7 +453,11 @@ public struct ShareExtensionView: View {
highlightSection
.onTapGesture {
withAnimation {
viewState = .viewingHighlight
if viewModel.highlightData != nil {
viewState = .viewingHighlight
} else {
showHighlightInstructionAlert = true
}
}
}
}
@ -481,6 +486,10 @@ public struct ShareExtensionView: View {
.sheet(isPresented: $labelsViewModel.showCreateLabelModal) {
CreateLabelView(viewModel: labelsViewModel)
}
.alert("Before saving an article select text in Safari to create a highlight on save.",
isPresented: $showHighlightInstructionAlert) {
Button("Ok", role: .cancel) { showHighlightInstructionAlert = false }
}
.environmentObject(viewModel.services.dataService)
.task {
await labelsViewModel.loadLabelsFromStore(dataService: viewModel.services.dataService)