Fix build on MacOS
This commit is contained in:
@ -24,7 +24,9 @@ public struct AddNoteSheet: View {
|
||||
|
||||
public init(viewModel: ShareExtensionViewModel) {
|
||||
_viewModel = StateObject(wrappedValue: viewModel)
|
||||
UITextView.appearance().textContainerInset = UIEdgeInsets(top: 8, left: 4, bottom: 10, right: 4)
|
||||
#if os(iOS)
|
||||
UITextView.appearance().textContainerInset = UIEdgeInsets(top: 8, left: 4, bottom: 10, right: 4)
|
||||
#endif
|
||||
}
|
||||
|
||||
func saveNote() {
|
||||
@ -41,6 +43,7 @@ public struct AddNoteSheet: View {
|
||||
}
|
||||
.background(Color.extensionBackground)
|
||||
.navigationTitle("Add Note")
|
||||
#if os(iOS)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.navigationBarItems(leading: Button(action: {
|
||||
dismiss()
|
||||
@ -53,6 +56,10 @@ public struct AddNoteSheet: View {
|
||||
}, label: {
|
||||
Text("Save").bold()
|
||||
}))
|
||||
}.navigationViewStyle(StackNavigationViewStyle())
|
||||
#endif
|
||||
}
|
||||
#if os(iOS)
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,7 +26,9 @@ public struct EditInfoSheet: View {
|
||||
|
||||
public init(viewModel: ShareExtensionViewModel) {
|
||||
_viewModel = StateObject(wrappedValue: viewModel)
|
||||
UITextView.appearance().textContainerInset = UIEdgeInsets(top: 8, left: 4, bottom: 10, right: 4)
|
||||
#if os(iOS)
|
||||
UITextView.appearance().textContainerInset = UIEdgeInsets(top: 8, left: 4, bottom: 10, right: 4)
|
||||
#endif
|
||||
}
|
||||
|
||||
// func saveInfo() {
|
||||
|
||||
@ -29,8 +29,9 @@ public struct EditLabelsSheet: View {
|
||||
public init(viewModel: ShareExtensionViewModel, labelsViewModel: LabelsViewModel) {
|
||||
_viewModel = StateObject(wrappedValue: viewModel)
|
||||
_labelsViewModel = StateObject(wrappedValue: labelsViewModel)
|
||||
|
||||
UITextView.appearance().textContainerInset = UIEdgeInsets(top: 5, left: 2, bottom: 5, right: 2)
|
||||
#if os(iOS)
|
||||
UITextView.appearance().textContainerInset = UIEdgeInsets(top: 5, left: 2, bottom: 5, right: 2)
|
||||
#endif
|
||||
}
|
||||
|
||||
@MainActor
|
||||
@ -104,6 +105,7 @@ public struct EditLabelsSheet: View {
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.background(Color.extensionBackground)
|
||||
.navigationTitle("Set Labels")
|
||||
#if os(iOS)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.navigationBarItems(trailing: Button(action: {
|
||||
if let linkedItem = viewModel.linkedItem, let linkedItemId = linkedItem.id {
|
||||
@ -116,11 +118,14 @@ public struct EditLabelsSheet: View {
|
||||
}, label: {
|
||||
Text("Done").bold()
|
||||
}))
|
||||
#endif
|
||||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
#if os(iOS)
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
#endif
|
||||
.environmentObject(viewModel.services.dataService)
|
||||
.task {
|
||||
await labelsViewModel.loadLabelsFromStore(dataService: viewModel.services.dataService)
|
||||
}
|
||||
.task {
|
||||
await labelsViewModel.loadLabelsFromStore(dataService: viewModel.services.dataService)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,19 +255,21 @@ public struct ShareExtensionView: View {
|
||||
|
||||
HStack {
|
||||
Spacer()
|
||||
if UIDevice.isIPad {
|
||||
Button(action: {
|
||||
extensionContext?.completeRequest(returningItems: [], completionHandler: nil)
|
||||
}, label: {
|
||||
Text("Dismiss")
|
||||
.font(Font.system(size: 17, weight: .semibold))
|
||||
.tint(Color.appGrayText)
|
||||
.padding(20)
|
||||
})
|
||||
.frame(height: 50)
|
||||
.cornerRadius(24)
|
||||
.padding(.bottom, 15)
|
||||
}
|
||||
#if os(iOS)
|
||||
if UIDevice.isIPad {
|
||||
Button(action: {
|
||||
extensionContext?.completeRequest(returningItems: [], completionHandler: nil)
|
||||
}, label: {
|
||||
Text("Dismiss")
|
||||
.font(Font.system(size: 17, weight: .semibold))
|
||||
.tint(Color.appGrayText)
|
||||
.padding(20)
|
||||
})
|
||||
.frame(height: 50)
|
||||
.cornerRadius(24)
|
||||
.padding(.bottom, 15)
|
||||
}
|
||||
#endif
|
||||
Button(action: {
|
||||
viewModel.handleReadNowAction(extensionContext: extensionContext)
|
||||
}, label: {
|
||||
|
||||
@ -106,7 +106,6 @@ import Views
|
||||
.contextMenu {
|
||||
menuItems(item)
|
||||
}
|
||||
Divider().padding(5)
|
||||
}
|
||||
|
||||
if viewModel.isLoading {
|
||||
|
||||
@ -74,13 +74,27 @@ public struct LabelsEntryView: View {
|
||||
}
|
||||
}
|
||||
|
||||
var textFieldString: NSAttributedString {
|
||||
#if os(iOS)
|
||||
NSAttributedString(
|
||||
string: searchTerm,
|
||||
attributes: [
|
||||
NSAttributedString.Key.font: UIFont.systemFont(ofSize: 14)
|
||||
]
|
||||
)
|
||||
#else
|
||||
NSAttributedString(
|
||||
string: searchTerm,
|
||||
attributes: [
|
||||
NSAttributedString.Key.font: NSFont.systemFont(ofSize: 14)
|
||||
]
|
||||
)
|
||||
#endif
|
||||
}
|
||||
|
||||
var deletableTextField: some View {
|
||||
let str = NSAttributedString(
|
||||
string: searchTerm,
|
||||
attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 14)]
|
||||
)
|
||||
// Round it up to avoid jitter when typing
|
||||
let textWidth = max(25.0, Double(Int(str.size().width + 1)))
|
||||
let textWidth = max(25.0, Double(Int(textFieldString.size().width + 1)))
|
||||
let result = TextField("", text: $searchTerm)
|
||||
.frame(alignment: .topLeading)
|
||||
.frame(height: 25)
|
||||
|
||||
@ -499,7 +499,9 @@ struct WebReaderContainerView: View {
|
||||
showErrorAlertMessage: $showErrorAlertMessage
|
||||
)
|
||||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
#if os(iOS)
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
#endif
|
||||
}
|
||||
.sheet(isPresented: $showHighlightLabelsModal) {
|
||||
if let highlight = Highlight.lookup(byID: self.annotation, inContext: self.dataService.viewContext) {
|
||||
|
||||
@ -90,16 +90,18 @@ struct WelcomeView: View {
|
||||
NavigationView {
|
||||
BasicWebAppView.privacyPolicyWebView(baseURL: dataService.appEnvironment.webAppBaseURL)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button(
|
||||
action: {
|
||||
showPrivacyModal = false
|
||||
},
|
||||
label: {
|
||||
Text(LocalText.genericClose)
|
||||
}
|
||||
)
|
||||
}
|
||||
#if os(iOS)
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button(
|
||||
action: {
|
||||
showPrivacyModal = false
|
||||
},
|
||||
label: {
|
||||
Text(LocalText.genericClose)
|
||||
}
|
||||
)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -107,16 +109,18 @@ struct WelcomeView: View {
|
||||
NavigationView {
|
||||
BasicWebAppView.termsConditionsWebView(baseURL: dataService.appEnvironment.webAppBaseURL)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button(
|
||||
action: {
|
||||
showTermsModal = false
|
||||
},
|
||||
label: {
|
||||
Text(LocalText.genericClose)
|
||||
}
|
||||
)
|
||||
}
|
||||
#if os(iOS)
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button(
|
||||
action: {
|
||||
showTermsModal = false
|
||||
},
|
||||
label: {
|
||||
Text(LocalText.genericClose)
|
||||
}
|
||||
)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,33 +65,33 @@ public struct LibraryItemCard: View {
|
||||
if item.hasLabels {
|
||||
labels
|
||||
}
|
||||
|
||||
if let note = item.noteText {
|
||||
HStack(alignment: .top, spacing: 10) {
|
||||
avatarImage
|
||||
.frame(width: 20, height: 20)
|
||||
.padding(.vertical, 10)
|
||||
.padding(.leading, 10)
|
||||
|
||||
Text(note)
|
||||
.font(Font.system(size: 12))
|
||||
.multilineTextAlignment(.leading)
|
||||
.lineLimit(noteLineLimit)
|
||||
.frame(minHeight: 20)
|
||||
.padding(.vertical, 10)
|
||||
.padding(.trailing, 10)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(alignment: .topLeading)
|
||||
.background(Color.noteContainer)
|
||||
.cornerRadius(5)
|
||||
.allowsHitTesting(noteLineLimit != nil)
|
||||
.onTapGesture {
|
||||
noteLineLimit = nil
|
||||
}
|
||||
}
|
||||
//
|
||||
// if let note = item.noteText {
|
||||
// HStack(alignment: .top, spacing: 10) {
|
||||
// avatarImage
|
||||
// .frame(width: 20, height: 20)
|
||||
// .padding(.vertical, 10)
|
||||
// .padding(.leading, 10)
|
||||
//
|
||||
// Text(note)
|
||||
// .font(Font.system(size: 12))
|
||||
// .multilineTextAlignment(.leading)
|
||||
// .lineLimit(noteLineLimit)
|
||||
// .frame(minHeight: 20)
|
||||
// .padding(.vertical, 10)
|
||||
// .padding(.trailing, 10)
|
||||
//
|
||||
// Spacer()
|
||||
// }
|
||||
// .frame(maxWidth: .infinity)
|
||||
// .frame(alignment: .topLeading)
|
||||
// .background(Color.noteContainer)
|
||||
// .cornerRadius(5)
|
||||
// .allowsHitTesting(noteLineLimit != nil)
|
||||
// .onTapGesture {
|
||||
// noteLineLimit = nil
|
||||
// }
|
||||
// }
|
||||
}
|
||||
.padding(5)
|
||||
.padding(.top, 10)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"manifest_version": 2,
|
||||
"name": "Omnivore",
|
||||
"short_name": "Omnivore",
|
||||
"version": "2.6.2",
|
||||
"version": "2.8.0",
|
||||
"description": "Save PDFs and Articles to your Omnivore library",
|
||||
"author": "Omnivore Media, Inc",
|
||||
"default_locale": "en",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -62,6 +62,9 @@ import Views
|
||||
import Cocoa
|
||||
|
||||
class ShareViewController: NSViewController {
|
||||
let labelsViewModel = LabelsViewModel()
|
||||
let viewModel = ShareExtensionViewModel()
|
||||
|
||||
override func loadView() {
|
||||
view = NSView(frame: NSRect(x: 0, y: 0, width: 400, height: 600))
|
||||
}
|
||||
@ -69,7 +72,11 @@ import Views
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
embed(
|
||||
childViewController: NSViewController.makeShareExtensionController(extensionContext: extensionContext)
|
||||
childViewController: NSViewController.makeShareExtensionController(
|
||||
viewModel: viewModel,
|
||||
labelsViewModel: labelsViewModel,
|
||||
extensionContext: extensionContext
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user