Skip to content

Commit

Permalink
Fix last thorn in dark appearance support: acknowledgements
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoNatan committed Dec 5, 2018
1 parent 0b8775d commit cf96349
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 47 deletions.
46 changes: 30 additions & 16 deletions DetoxInstruments/DetoxInstruments/About.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14313.13.2" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="bf6-yZ-a8A">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="bf6-yZ-a8A">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14313.13.2"/>
<plugIn identifier="com.apple.WebKit2IBPlugin" version="14313.13.2"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -31,25 +30,40 @@ DQ
<action selector="dismissController:" target="IFz-vT-Tif" id="bdf-Ag-q8W"/>
</connections>
</button>
<wkWebView wantsLayer="YES" translatesAutoresizingMaskIntoConstraints="NO" id="G4y-1X-Fgc">
<scrollView borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" translatesAutoresizingMaskIntoConstraints="NO" id="F8b-rP-DYr">
<rect key="frame" x="0.0" y="61" width="716" height="368"/>
<wkWebViewConfiguration key="configuration" suppressesIncrementalRendering="YES">
<audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
<wkPreferences key="preferences" javaScriptCanOpenWindowsAutomatically="NO" javaScriptEnabled="NO"/>
</wkWebViewConfiguration>
</wkWebView>
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="H5t-9D-Q0h">
<rect key="frame" x="0.0" y="0.0" width="716" height="368"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView editable="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" smartInsertDelete="YES" id="gUN-eQ-kxs">
<rect key="frame" x="0.0" y="0.0" width="716" height="368"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<size key="minSize" width="716" height="368"/>
<size key="maxSize" width="716" height="10000000"/>
<color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
</textView>
</subviews>
</clipView>
<scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="gMc-0k-64O">
<rect key="frame" x="700" y="0.0" width="16" height="368"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
</subviews>
<constraints>
<constraint firstItem="G4y-1X-Fgc" firstAttribute="leading" secondItem="6nN-pc-lID" secondAttribute="leading" id="MyX-i4-qu5"/>
<constraint firstAttribute="trailing" secondItem="F8b-rP-DYr" secondAttribute="trailing" id="1FV-Fl-nEC"/>
<constraint firstItem="F8b-rP-DYr" firstAttribute="leading" secondItem="6nN-pc-lID" secondAttribute="leading" id="3qB-Lh-4vF"/>
<constraint firstItem="vj0-PU-j0i" firstAttribute="top" secondItem="F8b-rP-DYr" secondAttribute="bottom" constant="20" id="Vnf-oa-GkC"/>
<constraint firstAttribute="trailing" secondItem="vj0-PU-j0i" secondAttribute="trailing" constant="20" id="cYp-ri-n1g"/>
<constraint firstItem="vj0-PU-j0i" firstAttribute="top" secondItem="G4y-1X-Fgc" secondAttribute="bottom" constant="20" id="fdO-AM-pe6"/>
<constraint firstItem="F8b-rP-DYr" firstAttribute="top" secondItem="6nN-pc-lID" secondAttribute="top" id="ldE-fd-SEo"/>
<constraint firstAttribute="bottom" secondItem="vj0-PU-j0i" secondAttribute="bottom" constant="20" id="pDt-Sg-ioa"/>
<constraint firstAttribute="trailing" secondItem="G4y-1X-Fgc" secondAttribute="trailing" id="rED-rv-gc7"/>
<constraint firstItem="G4y-1X-Fgc" firstAttribute="top" secondItem="6nN-pc-lID" secondAttribute="top" id="x6R-r6-a1s"/>
</constraints>
</view>
<connections>
<outlet property="_webView" destination="G4y-1X-Fgc" id="XjT-6P-wyW"/>
<outlet property="_textView" destination="gUN-eQ-kxs" id="U7T-Ds-WB6"/>
</connections>
</viewController>
<customObject id="ij2-NW-1MZ" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
Expand Down Expand Up @@ -164,7 +178,7 @@ DQ
<constraint firstItem="7DH-4e-CoZ" firstAttribute="top" relation="greaterThanOrEqual" secondItem="5Jd-qH-cgz" secondAttribute="bottom" constant="20" id="zAy-5Q-8DH"/>
</constraints>
</view>
<color key="fillColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="fillColor" name="windowBackgroundColor" catalog="System" colorSpace="catalog"/>
</box>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="5nb-xv-6Gd">
<rect key="frame" x="35" y="41" width="128" height="128"/>
Expand Down Expand Up @@ -199,6 +213,6 @@ DQ
</scene>
</scenes>
<resources>
<image name="NSApplicationIcon" width="128" height="128"/>
<image name="NSApplicationIcon" width="32" height="32"/>
</resources>
</document>
9 changes: 3 additions & 6 deletions DetoxInstruments/DetoxInstruments/Acknowledgements.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<!DOCTYPE html>
<html><head><meta name="AppleTitle" content="Detox Instruments Help" /><meta name="copyright" content="Copyright © 2018" /><meta charset="UTF-8"><style>
</style>
<style>body { font-family: -apple-system-font, -webkit-system-font, "HelveticaNeue", "Helvetica Neue", "Helvetica", sans-serif; font-size: 16px; padding: 0px 10px 20px 10px; }
img { max-width: 100%; height: auto; }
pre { background-color: rgb(246, 248, 250); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; color: rgb(36, 41, 46); display: block; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.600000381469727px; line-height: 19px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 16px; padding-left: 16px; padding-right: 16px; padding-top: 16px; white-space: pre; word-break: normal; word-wrap: normal; }
blockquote { border-left-color: rgb(223, 226, 229); border-left-style: solid; border-left-width: 4px; box-sizing: border-box; color: rgb(106, 115, 125); display: block; margin-bottom: 16px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 16px; padding-right: 16px; padding-top: 0px; word-wrap: break-word; }
<html><head><meta name="AppleTitle" content="Detox Instruments Help" /><meta name="copyright" content="Copyright © 2018" /><meta charset="UTF-8">
<style>body { font-family: -apple-system-font; word-break: normal; word-wrap: normal; }
pre { padding-left: 2em; white-space: pre; }
ul { padding-left: 1.3em; }
</style>
<title>Acknowledgements</title></head><body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ @interface DTXAcknowledgementsViewController () <WKNavigationDelegate> @end

@implementation DTXAcknowledgementsViewController
{
IBOutlet __weak WKWebView* _webView;
// IBOutlet __weak WKWebView* _webView;
IBOutlet __weak NSTextView* _textView;
NSURL* _htmlURL;
}

Expand All @@ -23,20 +24,15 @@ - (void)viewDidLoad

_htmlURL = [[NSBundle mainBundle] URLForResource:@"Acknowledgements" withExtension:@"html"];

[_webView loadFileURL:_htmlURL allowingReadAccessToURL:_htmlURL];
_webView.navigationDelegate = self;
}

- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler;
{
if([navigationAction.request.URL isEqualTo:_htmlURL])
{
decisionHandler(WKNavigationActionPolicyAllow);
return;
}
NSMutableAttributedString* str = [[NSMutableAttributedString alloc] initWithData:[NSData dataWithContentsOfURL:_htmlURL] options:@{NSDocumentTypeDocumentOption: NSHTMLTextDocumentType, NSCharacterEncodingDocumentOption: @(NSUTF8StringEncoding)} documentAttributes:nil error:NULL];
[str addAttributes:@{NSForegroundColorAttributeName: NSColor.textColor} range:NSMakeRange(0, str.length)];

[str enumerateAttributesInRange:NSMakeRange(0, str.length) options:0 usingBlock:^(NSDictionary<NSAttributedStringKey,id> * _Nonnull attrs, NSRange range, BOOL * _Nonnull stop) {
NSLog(@"%@", attrs);
}];

[[NSWorkspace sharedWorkspace] openURL:navigationAction.request.URL];
decisionHandler(WKNavigationActionPolicyCancel);
[_textView.textStorage appendAttributedString:str];
_textView.textContainerInset = NSMakeSize(20, 20);
}

@end
4 changes: 2 additions & 2 deletions DetoxInstruments/DetoxInstruments/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
<key>CFBundleShortVersionString</key>
<string>1.6</string>
<key>CFBundleVersion</key>
<string>8308</string>
<string>8321</string>
<key>DTXBuildDate</key>
<date>2018-12-04T17:58:03Z</date>
<date>2018-12-05T16:51:22Z</date>
<key>DTXSourceRoot</key>
<string>$(DTXSRCROOT)</string>
<key>LSMinimumSystemVersion</key>
Expand Down
4 changes: 2 additions & 2 deletions Profiler/DTXProfiler/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<key>CFBundleShortVersionString</key>
<string>1.6</string>
<key>CFBundleVersion</key>
<string>8308</string>
<string>8321</string>
<key>DTXBuildDate</key>
<date>2018-12-04T17:58:03Z</date>
<date>2018-12-05T16:51:22Z</date>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down
10 changes: 3 additions & 7 deletions updateAcknowledgements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,9 @@ done <<< "$SUBMODULES"
TARGET_FILE=DetoxInstruments/DetoxInstruments/Acknowledgements.html

echo '<!DOCTYPE html>' > "${TARGET_FILE}"
echo '<html><head><meta name="AppleTitle" content="Detox Instruments Help" /><meta name="copyright" content="Copyright © 2018" /><meta charset="UTF-8"><style>' >> "${TARGET_FILE}"
# curl -s 'https://raw.githubusercontent.com/sindresorhus/github-markdown-css/gh-pages/github-markdown.css' >> "${TARGET_FILE}"
echo '</style>' >> "${TARGET_FILE}"
echo '<style>body { font-family: -apple-system-font, -webkit-system-font, "HelveticaNeue", "Helvetica Neue", "Helvetica", sans-serif; font-size: 16px; padding: 0px 10px 20px 10px; }' >> "${TARGET_FILE}"
echo 'img { max-width: 100%; height: auto; }' >> "${TARGET_FILE}"
echo 'pre { background-color: rgb(246, 248, 250); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; color: rgb(36, 41, 46); display: block; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.600000381469727px; line-height: 19px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 16px; padding-left: 16px; padding-right: 16px; padding-top: 16px; white-space: pre; word-break: normal; word-wrap: normal; }' >> "${TARGET_FILE}"
echo 'blockquote { border-left-color: rgb(223, 226, 229); border-left-style: solid; border-left-width: 4px; box-sizing: border-box; color: rgb(106, 115, 125); display: block; margin-bottom: 16px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 16px; padding-right: 16px; padding-top: 0px; word-wrap: break-word; }' >> "${TARGET_FILE}"
echo '<html><head><meta name="AppleTitle" content="Detox Instruments Help" /><meta name="copyright" content="Copyright © 2018" /><meta charset="UTF-8">' >> "${TARGET_FILE}"
echo '<style>body { font-family: -apple-system-font; word-break: normal; word-wrap: normal; }' >> "${TARGET_FILE}"
echo 'pre { padding-left: 2em; white-space: pre; }' >> "${TARGET_FILE}"
echo 'ul { padding-left: 1.3em; }' >> "${TARGET_FILE}"
echo '</style>' >> "${TARGET_FILE}"
echo '<title>Acknowledgements</title></head><body>' >> "${TARGET_FILE}"
Expand Down

0 comments on commit cf96349

Please sign in to comment.