mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
add macos conditionals for share extension improvements
This commit is contained in:
parent
a4811104d6
commit
c5b3354d8f
5 changed files with 55 additions and 30 deletions
|
|
@ -153,15 +153,6 @@
|
|||
"version" : "2.1.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "pspdfkit-sp",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/PSPDFKit/PSPDFKit-SP",
|
||||
"state" : {
|
||||
"branch" : "master",
|
||||
"revision" : "e9757beadad1b30de84073d3c33c1cd0f7a94b80"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "sovran-swift",
|
||||
"kind" : "remoteSourceControl",
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ let package = Package(
|
|||
var appPackageDependencies: [Target.Dependency] {
|
||||
var deps: [Target.Dependency] = ["Views", "Services", "Models", "Utils"]
|
||||
// #if canImport(UIKit)
|
||||
deps.append(.product(name: "PSPDFKit", package: "PSPDFKit-SP"))
|
||||
// deps.append(.product(name: "PSPDFKit", package: "PSPDFKit-SP"))
|
||||
// #endif
|
||||
return deps
|
||||
}
|
||||
|
|
@ -70,7 +70,7 @@ var dependencies: [Package.Dependency] {
|
|||
.package(url: "https://github.com/google/GoogleSignIn-iOS", from: "6.2.2")
|
||||
]
|
||||
// #if canImport(UIKit)
|
||||
deps.append(.package(url: "https://github.com/PSPDFKit/PSPDFKit-SP", branch: "master"))
|
||||
// deps.append(.package(url: "https://github.com/PSPDFKit/PSPDFKit-SP", branch: "master"))
|
||||
// #endif
|
||||
return deps
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,7 +205,9 @@ struct ApplyLabelsListView: View {
|
|||
Section(
|
||||
content: {
|
||||
SearchBar(searchTerm: $viewModel.labelSearchFilter, horizontalPadding: 0)
|
||||
#if os(iOS)
|
||||
.listRowSeparator(.hidden)
|
||||
#endif
|
||||
},
|
||||
header: {
|
||||
Text("Apply Labels")
|
||||
|
|
@ -213,7 +215,9 @@ struct ApplyLabelsListView: View {
|
|||
.foregroundColor(.appGrayText)
|
||||
}
|
||||
)
|
||||
.listRowSeparator(.hidden)
|
||||
#if os(iOS)
|
||||
.listRowSeparator(.hidden)
|
||||
#endif
|
||||
Section {
|
||||
ForEach(viewModel.labels.applySearchFilter(viewModel.labelSearchFilter), id: \.self) { label in
|
||||
Button(
|
||||
|
|
@ -242,7 +246,9 @@ struct ApplyLabelsListView: View {
|
|||
.contentShape(Rectangle())
|
||||
}
|
||||
)
|
||||
.listRowSeparator(.hidden)
|
||||
#if os(iOS)
|
||||
.listRowSeparator(.hidden)
|
||||
#endif
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,32 +99,60 @@ public extension Color {
|
|||
}
|
||||
|
||||
static func lighten(color: Color, by percentage: CGFloat) -> Color {
|
||||
if let lightenedUIColor = UIColor(color).adjust(by: abs(percentage)) {
|
||||
return Color(lightenedUIColor)
|
||||
#if os(iOS)
|
||||
let lightenedColor = UIColor(color).adjust(by: abs(percentage))
|
||||
#else
|
||||
let lightenedColor = NSColor(color).adjust(by: abs(percentage))
|
||||
#endif
|
||||
if let lightenedColor = lightenedColor {
|
||||
return Color(lightenedColor)
|
||||
} else {
|
||||
return color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension UIColor {
|
||||
func lighter(by percentage: CGFloat = 30.0) -> UIColor? {
|
||||
adjust(by: abs(percentage))
|
||||
}
|
||||
#if os(iOS)
|
||||
extension UIColor {
|
||||
func lighter(by percentage: CGFloat = 30.0) -> UIColor? {
|
||||
adjust(by: abs(percentage))
|
||||
}
|
||||
|
||||
func darker(by percentage: CGFloat = 30.0) -> UIColor? {
|
||||
adjust(by: -1 * abs(percentage))
|
||||
}
|
||||
func darker(by percentage: CGFloat = 30.0) -> UIColor? {
|
||||
adjust(by: -1 * abs(percentage))
|
||||
}
|
||||
|
||||
func adjust(by percentage: CGFloat = 30.0) -> UIColor? {
|
||||
var red: CGFloat = 0, green: CGFloat = 0, blue: CGFloat = 0, alpha: CGFloat = 0
|
||||
if getRed(&red, green: &green, blue: &blue, alpha: &alpha) {
|
||||
return UIColor(red: min(red + percentage / 100, 1.0),
|
||||
func adjust(by percentage: CGFloat = 30.0) -> UIColor? {
|
||||
var red: CGFloat = 0, green: CGFloat = 0, blue: CGFloat = 0, alpha: CGFloat = 0
|
||||
if getRed(&red, green: &green, blue: &blue, alpha: &alpha) {
|
||||
return UIColor(red: min(red + percentage / 100, 1.0),
|
||||
green: min(green + percentage / 100, 1.0),
|
||||
blue: min(blue + percentage / 100, 1.0),
|
||||
alpha: alpha)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if os(macOS)
|
||||
extension NSColor {
|
||||
func lighter(by percentage: CGFloat = 30.0) -> NSColor? {
|
||||
adjust(by: abs(percentage))
|
||||
}
|
||||
|
||||
func darker(by percentage: CGFloat = 30.0) -> NSColor? {
|
||||
adjust(by: -1 * abs(percentage))
|
||||
}
|
||||
|
||||
func adjust(by percentage: CGFloat = 30.0) -> NSColor? {
|
||||
var red: CGFloat = 0, green: CGFloat = 0, blue: CGFloat = 0, alpha: CGFloat = 0
|
||||
getRed(&red, green: &green, blue: &blue, alpha: &alpha)
|
||||
return NSColor(red: min(red + percentage / 100, 1.0),
|
||||
green: min(green + percentage / 100, 1.0),
|
||||
blue: min(blue + percentage / 100, 1.0),
|
||||
alpha: alpha)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import Utils
|
|||
|
||||
class ShareViewController: NSViewController {
|
||||
override func loadView() {
|
||||
view = NSView(frame: NSRect(x: 0, y: 0, width: 400, height: 200))
|
||||
view = NSView(frame: NSRect(x: 0, y: 0, width: 400, height: 600))
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue