Skip to content

Commit

Permalink
add macOS 10.12 support
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianKahnert committed Nov 6, 2018
1 parent c897f65 commit 0e5c9db
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
4 changes: 2 additions & 2 deletions PDFArchiver.xcodeproj/project.pbxproj
Expand Up @@ -865,7 +865,7 @@
INFOPLIST_FILE = "$(SRCROOT)/PDFArchiver/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/PDFArchiver/External/OpenSSL/lib";
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 10.12;
OTHER_SWIFT_FLAGS = "-DDEBUG";
PRODUCT_BUNDLE_IDENTIFIER = de.JulianKahnert.PDFArchiver;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -891,7 +891,7 @@
INFOPLIST_FILE = "$(SRCROOT)/PDFArchiver/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/PDFArchiver/External/OpenSSL/lib";
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 10.12;
OTHER_SWIFT_FLAGS = "-DRELEASE";
PRODUCT_BUNDLE_IDENTIFIER = de.JulianKahnert.PDFArchiver;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
7 changes: 6 additions & 1 deletion PDFArchiver/Controllers/OnboardingViewController.swift
Expand Up @@ -80,7 +80,12 @@ class OnboardingViewController: NSViewController {

override func viewWillAppear() {
let cornerRadius = CGFloat(3)
let customViewColor = NSColor(named: "CustomViewBackground")?.withAlphaComponent(0.05).cgColor
let customViewColor: CGColor?
if #available(OSX 10.13, *) {
customViewColor = NSColor(named: "CustomViewBackground")?.withAlphaComponent(0.05).cgColor
} else {
customViewColor = NSColor(calibratedRed: 0.131, green: 0.172, blue: 0.231, alpha: 0.05).cgColor
}

// set background color
// TODO: do we really need this?
Expand Down
4 changes: 3 additions & 1 deletion PDFArchiver/Controllers/ViewController.swift
Expand Up @@ -139,7 +139,9 @@ class ViewController: NSViewController, Logging {
// set some PDF View settings
self.pdfContentView.displayMode = PDFDisplayMode.singlePage
self.pdfContentView.autoScales = true
self.pdfContentView.acceptsDraggedFiles = false
if #available(OSX 10.13, *) {
self.pdfContentView.acceptsDraggedFiles = false
}
self.pdfContentView.interpolationQuality = PDFInterpolationQuality.low

// update the view after all the settigns
Expand Down
20 changes: 17 additions & 3 deletions PDFArchiver/Views/HelperBackgroundViews.swift
Expand Up @@ -19,9 +19,17 @@ class BackgroundView: NSView {
self.wantsLayer = Constants.Layout.wantsLayer
self.layer?.cornerRadius = Constants.Layout.cornerRadius
if self.identifier?.rawValue == "MainViewBackground" || self.identifier?.rawValue == "OnboardingBackgroundView" {
self.layer?.backgroundColor = NSColor(named: "MainViewBackground")?.cgColor
if #available(OSX 10.13, *) {
self.layer?.backgroundColor = NSColor(named: "MainViewBackground")?.cgColor
} else {
self.layer?.backgroundColor = NSColor(calibratedRed: 0.980, green: 0.980, blue: 0.980, alpha: 1).cgColor
}
} else if self.identifier?.rawValue == "CustomViewBackground" {
self.layer?.backgroundColor = NSColor(named: "CustomViewBackground")?.withAlphaComponent(0.1).cgColor
if #available(OSX 10.13, *) {
self.layer?.backgroundColor = NSColor(named: "CustomViewBackground")?.withAlphaComponent(0.1).cgColor
} else {
self.layer?.backgroundColor = NSColor(calibratedRed: 0.131, green: 0.172, blue: 0.231, alpha: 1).cgColor
}
}
}
}
Expand All @@ -32,7 +40,13 @@ class PDFContentView: PDFView {
super.layout()

// set background color of the view
guard let pdfContentViewBackgroundColor = NSColor(named: "PDFContentViewBackground") else { fatalError("PDFContentViewBackground color not found!") }
let tmpPdfContentViewBackgroundColor: NSColor?
if #available(OSX 10.13, *) {
tmpPdfContentViewBackgroundColor = NSColor(named: "PDFContentViewBackground")
} else {
tmpPdfContentViewBackgroundColor = NSColor(calibratedRed: 0.213, green: 0.242, blue: 0.286, alpha: 0.05)
}
guard let pdfContentViewBackgroundColor = tmpPdfContentViewBackgroundColor else { fatalError("PDFContentViewBackground color not found!") }
self.backgroundColor = pdfContentViewBackgroundColor
self.layer?.cornerRadius = Constants.Layout.cornerRadius
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_openssl.sh
Expand Up @@ -21,7 +21,7 @@ cd "$OPENSSL_FOLDER/src"
make clean
./Configure darwin64-x86_64-cc
echo "Building x86 64 static library..."
make >> /dev/null 2>&1
make CXXFLAGS="-mmacosx-version-min=10.12" >> /dev/null 2>&1
make install >> /dev/null 2>&1

cp "LICENSE" "$OPENSSL_FOLDER"
Expand Down

0 comments on commit 0e5c9db

Please sign in to comment.