Skip to content

Commit

Permalink
Support for displaying help
Browse files Browse the repository at this point in the history
  • Loading branch information
vashpan committed Sep 7, 2019
1 parent 1a9f05f commit 297082d
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 4 deletions.
16 changes: 16 additions & 0 deletions DevCleaner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
712F99A020D6810A003927BC /* MessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 712F999F20D6810A003927BC /* MessageView.swift */; };
7140B617231A81DC005768A7 /* ReviewRequests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7140B616231A81DC005768A7 /* ReviewRequests.swift */; };
7140B61A231BC697005768A7 /* Manual in Resources */ = {isa = PBXBuildFile; fileRef = 7140B619231BC697005768A7 /* Manual */; };
7140B61D231BE5FB005768A7 /* Help.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7140B61C231BE5FB005768A7 /* Help.storyboard */; };
7140B61F2323E1F7005768A7 /* HelpViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7140B61E2323E1F7005768A7 /* HelpViewController.swift */; };
714AB65F22DA87FA00A7FBB7 /* DeviceLogsFileEntry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 714AB65E22DA87FA00A7FBB7 /* DeviceLogsFileEntry.swift */; };
7155325E2061AFD80025EB75 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7155325D2061AFD80025EB75 /* Logger.swift */; };
715E8C3D216566FD0059A2E5 /* Weak.swift in Sources */ = {isa = PBXBuildFile; fileRef = 715E8C3C216566FD0059A2E5 /* Weak.swift */; };
Expand Down Expand Up @@ -67,6 +69,8 @@
712F999F20D6810A003927BC /* MessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageView.swift; sourceTree = "<group>"; };
7140B616231A81DC005768A7 /* ReviewRequests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewRequests.swift; sourceTree = "<group>"; };
7140B619231BC697005768A7 /* Manual */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Manual; sourceTree = "<group>"; };
7140B61C231BE5FB005768A7 /* Help.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Help.storyboard; sourceTree = "<group>"; };
7140B61E2323E1F7005768A7 /* HelpViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HelpViewController.swift; sourceTree = "<group>"; };
714AB65E22DA87FA00A7FBB7 /* DeviceLogsFileEntry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceLogsFileEntry.swift; sourceTree = "<group>"; };
7155325D2061AFD80025EB75 /* Logger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = "<group>"; };
715E8C3C216566FD0059A2E5 /* Weak.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Weak.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -178,6 +182,15 @@
path = Base;
sourceTree = "<group>";
};
7140B61B231BE5C5005768A7 /* Help Window */ = {
isa = PBXGroup;
children = (
7140B61C231BE5FB005768A7 /* Help.storyboard */,
7140B61E2323E1F7005768A7 /* HelpViewController.swift */,
);
path = "Help Window";
sourceTree = "<group>";
};
7162E1272097622B00081E4E /* Preferences Window */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -210,6 +223,7 @@
71743ECA2078147B00EC0FE2 /* View Controllers */ = {
isa = PBXGroup;
children = (
7140B61B231BE5C5005768A7 /* Help Window */,
7162E1272097622B00081E4E /* Preferences Window */,
71743ECB207815D300EC0FE2 /* Main Window */,
);
Expand Down Expand Up @@ -370,6 +384,7 @@
71AAD2A32316A99F00D6B133 /* dev-cleaner.sh in Resources */,
7110B4962030F17B00EDBFA3 /* Assets.xcassets in Resources */,
7110B4992030F17B00EDBFA3 /* Main.storyboard in Resources */,
7140B61D231BE5FB005768A7 /* Help.storyboard in Resources */,
7140B61A231BC697005768A7 /* Manual in Resources */,
71C8ACDE20A4EC2200E7A13B /* Credits.rtf in Resources */,
);
Expand Down Expand Up @@ -430,6 +445,7 @@
718D4ABE23140ABA001E9382 /* Files.swift in Sources */,
7100BEE322F6E771002E82B2 /* Profiler.swift in Sources */,
71A21A0C20541BE800B55651 /* XcodeFiles.swift in Sources */,
7140B61F2323E1F7005768A7 /* HelpViewController.swift in Sources */,
717AB6B620C71F4D0096743C /* LoadingView.swift in Sources */,
712F999E20D65229003927BC /* Donations.swift in Sources */,
7185E5D320D0775200C1C918 /* DonationViewController.swift in Sources */,
Expand Down
1 change: 0 additions & 1 deletion DevCleaner/Base/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}

// MARK: Actions

@IBAction func openAppReview(_ sender: Any) {
ReviewRequests.shared.showReviewOnTheAppStore()
}
Expand Down
2 changes: 2 additions & 0 deletions DevCleaner/Resources/DevCleaner.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>
63 changes: 63 additions & 0 deletions DevCleaner/View Controllers/Help Window/Help.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14865.1" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="lcH-gJ-8Xh">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14865.1"/>
<plugIn identifier="com.apple.WebKit2IBPlugin" version="14865.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Window Controller-->
<scene sceneID="GYz-je-o37">
<objects>
<windowController showSeguePresentationStyle="single" id="lcH-gJ-8Xh" sceneMemberID="viewController">
<window key="window" title="DevCleaner Help" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" tabbingMode="disallowed" id="rLk-dr-8gE">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<rect key="contentRect" x="425" y="461" width="600" height="800"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
<value key="minSize" type="size" width="300" height="600"/>
<connections>
<outlet property="delegate" destination="lcH-gJ-8Xh" id="fxE-Ns-1tf"/>
</connections>
</window>
<connections>
<segue destination="3kP-K3-jsn" kind="relationship" relationship="window.shadowedContentViewController" id="iIj-rZ-etA"/>
</connections>
</windowController>
<customObject id="w46-el-tsG" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="197" y="-604"/>
</scene>
<!--DevCleaner for Xcode Help-->
<scene sceneID="CjE-oI-EP3">
<objects>
<viewController title="DevCleaner for Xcode Help" id="3kP-K3-jsn" customClass="HelpViewController" customModule="DevCleaner" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" id="QZq-ge-LiZ">
<rect key="frame" x="0.0" y="0.0" width="544" height="477"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<wkWebView wantsLayer="YES" translatesAutoresizingMaskIntoConstraints="NO" id="sQ7-Yg-Sup">
<rect key="frame" x="0.0" y="0.0" width="544" height="477"/>
<wkWebViewConfiguration key="configuration">
<audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
<wkPreferences key="preferences" javaScriptCanOpenWindowsAutomatically="NO" javaScriptEnabled="NO"/>
</wkWebViewConfiguration>
</wkWebView>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="sQ7-Yg-Sup" secondAttribute="bottom" id="D3s-FZ-H4w"/>
<constraint firstAttribute="trailing" secondItem="sQ7-Yg-Sup" secondAttribute="trailing" id="XQb-Wh-NP1"/>
<constraint firstItem="sQ7-Yg-Sup" firstAttribute="top" secondItem="QZq-ge-LiZ" secondAttribute="top" id="hxT-uQ-LlA"/>
<constraint firstItem="sQ7-Yg-Sup" firstAttribute="leading" secondItem="QZq-ge-LiZ" secondAttribute="leading" id="w7j-6J-Plm"/>
</constraints>
</view>
<connections>
<outlet property="helpWebView" destination="sQ7-Yg-Sup" id="0Dr-Du-CDx"/>
</connections>
</viewController>
<customObject id="8A1-hA-bid" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="197" y="343.5"/>
</scene>
</scenes>
</document>
28 changes: 28 additions & 0 deletions DevCleaner/View Controllers/Help Window/HelpViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// HelpViewController.swift
// DevCleaner
//
// Created by Konrad Kołakowski on 07/09/2019.
// Copyright © 2019 One Minute Games. All rights reserved.
//

import Cocoa
import WebKit

final class HelpViewController: NSViewController {
// MARK: Properties & outlets
@IBOutlet private weak var helpWebView: WKWebView!

// MARK: Initialization & overrides
override func viewDidLoad() {
super.viewDidLoad()

// load manual HTML
guard let helpUrl = Bundle.main.url(forResource: "manual", withExtension: "html", subdirectory: "Manual") else {
log.error("HelpViewController: Can't find manual HTML file!")
return
}

self.helpWebView.loadFileURL(helpUrl, allowingReadAccessTo: helpUrl.deletingLastPathComponent())
}
}
14 changes: 11 additions & 3 deletions DevCleaner/View Controllers/Main Window/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
<items>
<menuItem title="DevCleaner Help" keyEquivalent="?" id="FKE-Sm-Kum">
<connections>
<action selector="showHelp:" target="Ady-hI-5gd" id="y7X-2Q-9no"/>
<segue destination="hQu-1h-PrG" kind="show" id="KpA-mP-HVH"/>
</connections>
</menuItem>
</items>
Expand All @@ -125,15 +125,23 @@
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1" y="-138"/>
<point key="canvasLocation" x="-9" y="-211"/>
</scene>
<!--Preferences-->
<scene sceneID="t22-AP-hJD">
<objects>
<controllerPlaceholder storyboardName="Preferences" id="nZ1-vI-bJQ" sceneMemberID="viewController"/>
<customObject id="h3h-tG-T4B" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1" y="23"/>
<point key="canvasLocation" x="-49" y="37"/>
</scene>
<!--Help-->
<scene sceneID="6fu-lN-y6i">
<objects>
<controllerPlaceholder storyboardName="Help" id="hQu-1h-PrG" sceneMemberID="viewController"/>
<customObject id="ceU-06-grc" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="55" y="37"/>
</scene>
<!--Window Controller-->
<scene sceneID="R2V-B0-nI4">
Expand Down

0 comments on commit 297082d

Please sign in to comment.