Skip to content

Commit

Permalink
make changes per app review recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
dlo committed Sep 25, 2018
1 parent 4a9803f commit 646f4bc
Show file tree
Hide file tree
Showing 11 changed files with 245 additions and 48 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.xcarchive
build/
*/Products/usr/local/bin
Binaries/
15 changes: 7 additions & 8 deletions Health Data Importer XML Splitter/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14313.18"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -16,7 +15,7 @@
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Health XML Splitter" systemMenu="apple" id="uQy-DD-JDr">
<items>
<menuItem title="About Health Data Importer XML Splitter" id="5kV-Vb-QxS">
<menuItem title="About Health XML Splitter" id="5kV-Vb-QxS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="Ady-hI-5gd" id="Exp-CZ-Vem"/>
Expand All @@ -25,7 +24,7 @@
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
<menuItem title="Hide Health Data Importer XML Splitter" keyEquivalent="h" id="Olw-nP-bQN">
<menuItem title="Hide Health XML Splitter" keyEquivalent="h" id="Olw-nP-bQN">
<connections>
<action selector="hide:" target="Ady-hI-5gd" id="PnN-Uc-m68"/>
</connections>
Expand All @@ -43,7 +42,7 @@
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
<menuItem title="Quit Health Data Importer XML Splitter" keyEquivalent="q" id="4sb-4s-VLi">
<menuItem title="Quit Health XML Splitter" keyEquivalent="q" id="4sb-4s-VLi">
<connections>
<action selector="terminate:" target="Ady-hI-5gd" id="Te7-pn-YzF"/>
</connections>
Expand All @@ -57,7 +56,7 @@
<outlet property="delegate" destination="Voe-Tx-rLC" id="PrD-fu-P6m"/>
</connections>
</application>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="Health_Data_Importer_XML_Splitter" customModuleProvider="target"/>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="Health_XML_Splitter" customModuleProvider="target"/>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
Expand Down Expand Up @@ -87,7 +86,7 @@
<!--Delegate-->
<scene sceneID="hIz-AP-VOD">
<objects>
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModule="Health_Data_Importer_XML_Splitter" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModule="Health_XML_Splitter" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" wantsLayer="YES" id="m2S-Jp-Qdl">
<rect key="frame" x="0.0" y="0.0" width="200" height="200"/>
<autoresizingMask key="autoresizingMask"/>
Expand All @@ -108,7 +107,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="luh-1H-DaG">
<rect key="frame" x="81" y="69" width="37" height="17"/>
<rect key="frame" x="82" y="69" width="37" height="17"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="9IV-A3-jQl">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
Expand All @@ -119,7 +118,7 @@
<rect key="frame" x="0.0" y="0.0" width="200" height="200"/>
<imageCell key="cell" enabled="NO" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="Dropzone" id="4c8-TG-S20"/>
</imageView>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Kn8-0f-Wvx" customClass="DragTargetView" customModule="Health_Data_Importer_XML_Splitter" customModuleProvider="target">
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Kn8-0f-Wvx" customClass="DragTargetView" customModule="Health_XML_Splitter" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="200" height="200"/>
<connections>
<outlet property="delegate" destination="XfG-lQ-9wD" id="Ttf-gH-3cR"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.downloads.read-write</key>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.inherit</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<false/>
</dict>
</plist>
2 changes: 1 addition & 1 deletion Health Data Importer XML Splitter/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>5</string>
<string>11</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.healthcare-fitness</string>
<key>LSMinimumSystemVersion</key>
Expand Down
44 changes: 29 additions & 15 deletions Health Data Importer XML Splitter/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,7 @@ final class ViewController: NSViewController, NSDraggingDestination {
}

var fileName: String?
lazy var directoryPath: String? = {
guard let downloads = NSSearchPathForDirectoriesInDomains(.downloadsDirectory, .userDomainMask, true).first?.appending("/Split_Health_Export") else {
return nil
}

try? FileManager.default.createDirectory(atPath: downloads, withIntermediateDirectories: true, attributes: nil)
return downloads
}()
var directoryPath: String?

var status = Status.waiting {
didSet {
Expand Down Expand Up @@ -157,10 +150,14 @@ final class ViewController: NSViewController, NSDraggingDestination {
guard let fileType = url.processableFileType else {
return
}

displayOpenPanel(canChooseFiles: false) { directoryURL in
self.directoryPath = directoryURL?.path

switch fileType {
case .xml: processXMLDocument(url: url)
case .zip: processZipFile(url: url)
switch fileType {
case .xml: self.processXMLDocument(url: url)
case .zip: self.processZipFile(url: url)
}
}
}
}
Expand Down Expand Up @@ -261,21 +258,38 @@ extension ViewController: DragViewDelegate {
}

func dragViewDidTouchUpInside() {
displayOpenPanel(canChooseFiles: true) { url in
guard let url = url else {
return
}

self.handleURL(url: url)
}
}

func displayOpenPanel(canChooseFiles: Bool, _ callback: @escaping (URL?) -> ()) {
let panel = NSOpenPanel()
panel.canChooseDirectories = false

if !canChooseFiles {
panel.message = "Select the folder in which you'd like the generated files to be placed."
}

panel.allowsMultipleSelection = false
panel.canChooseFiles = true
panel.canChooseFiles = canChooseFiles
panel.canChooseDirectories = !canChooseFiles

guard let window = view.window else {
callback(nil)
return
}

panel.beginSheetModal(for: window) { response in
guard let url = panel.url, response.rawValue == 1 else {
callback(nil)
return
}

self.handleURL(url: url)
callback(url)
}
}
}
Expand Down
Binary file added Screenshots.sketch
Binary file not shown.
33 changes: 17 additions & 16 deletions XML Splitter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@
3701FFB71F772C1300282157 /* XML Splitter */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "XML Splitter"; sourceTree = BUILT_PRODUCTS_DIR; };
3701FFBA1F772C1300282157 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
3701FFC11F772C8300282157 /* Parser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Parser.swift; sourceTree = "<group>"; };
377DDE502156A90D0012329F /* Health Data Importer XML Splitter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Health Data Importer XML Splitter.app"; sourceTree = BUILT_PRODUCTS_DIR; };
377DDE502156A90D0012329F /* Health XML Splitter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Health XML Splitter.app"; sourceTree = BUILT_PRODUCTS_DIR; };
377DDE522156A90D0012329F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
377DDE542156A90D0012329F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
377DDE562156A90D0012329F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
377DDE592156A90D0012329F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
377DDE5B2156A90D0012329F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
377DDE5C2156A90D0012329F /* Health_Data_Importer_XML_Splitter.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Health_Data_Importer_XML_Splitter.entitlements; sourceTree = "<group>"; };
377DDE602156AEF10012329F /* DragTargetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DragTargetView.swift; sourceTree = "<group>"; };
377DDE652156EC600012329F /* ProcessableFileType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProcessableFileType.swift; sourceTree = "<group>"; };
377DDE672156EC760012329F /* URL+HealthXMLSplitter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URL+HealthXMLSplitter.swift"; sourceTree = "<group>"; };
377DDE692156F7820012329F /* zipItUp.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = zipItUp.sh; sourceTree = "<group>"; };
37D8EF52215813C800F7246F /* Health Data Importer XML Splitter.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Health Data Importer XML Splitter.entitlements"; sourceTree = "<group>"; };
69C48A1C5278A9089BC23664 /* Pods-XML Splitter.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-XML Splitter.release.xcconfig"; path = "Pods/Target Support Files/Pods-XML Splitter/Pods-XML Splitter.release.xcconfig"; sourceTree = "<group>"; };
87C0DB769100B9853A455ED5 /* Pods_XML_Splitter.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_XML_Splitter.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C42123A54E2D27D44B620F74 /* Pods-XML Splitter.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-XML Splitter.debug.xcconfig"; path = "Pods/Target Support Files/Pods-XML Splitter/Pods-XML Splitter.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -103,7 +103,7 @@
isa = PBXGroup;
children = (
3701FFB71F772C1300282157 /* XML Splitter */,
377DDE502156A90D0012329F /* Health Data Importer XML Splitter.app */,
377DDE502156A90D0012329F /* Health XML Splitter.app */,
);
name = Products;
sourceTree = "<group>";
Expand All @@ -120,6 +120,7 @@
377DDE512156A90D0012329F /* Health Data Importer XML Splitter */ = {
isa = PBXGroup;
children = (
37D8EF52215813C800F7246F /* Health Data Importer XML Splitter.entitlements */,
377DDE522156A90D0012329F /* AppDelegate.swift */,
377DDE692156F7820012329F /* zipItUp.sh */,
377DDE542156A90D0012329F /* ViewController.swift */,
Expand All @@ -129,7 +130,6 @@
377DDE562156A90D0012329F /* Assets.xcassets */,
377DDE582156A90D0012329F /* Main.storyboard */,
377DDE5B2156A90D0012329F /* Info.plist */,
377DDE5C2156A90D0012329F /* Health_Data_Importer_XML_Splitter.entitlements */,
);
path = "Health Data Importer XML Splitter";
sourceTree = "<group>";
Expand Down Expand Up @@ -164,9 +164,9 @@
productReference = 3701FFB71F772C1300282157 /* XML Splitter */;
productType = "com.apple.product-type.tool";
};
377DDE4F2156A90D0012329F /* Health Data Importer XML Splitter */ = {
377DDE4F2156A90D0012329F /* Health XML Splitter */ = {
isa = PBXNativeTarget;
buildConfigurationList = 377DDE5F2156A90D0012329F /* Build configuration list for PBXNativeTarget "Health Data Importer XML Splitter" */;
buildConfigurationList = 377DDE5F2156A90D0012329F /* Build configuration list for PBXNativeTarget "Health XML Splitter" */;
buildPhases = (
9110DB82D965C4357F322C33 /* [CP] Check Pods Manifest.lock */,
377DDE4C2156A90D0012329F /* Sources */,
Expand All @@ -178,9 +178,9 @@
);
dependencies = (
);
name = "Health Data Importer XML Splitter";
name = "Health XML Splitter";
productName = "Health Data Importer XML Splitter";
productReference = 377DDE502156A90D0012329F /* Health Data Importer XML Splitter.app */;
productReference = 377DDE502156A90D0012329F /* Health XML Splitter.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
Expand All @@ -203,6 +203,9 @@
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.HardenedRuntime = {
enabled = 0;
};
com.apple.Sandbox = {
enabled = 1;
};
};
Expand All @@ -223,7 +226,7 @@
projectRoot = "";
targets = (
3701FFB61F772C1300282157 /* XML Splitter */,
377DDE4F2156A90D0012329F /* Health Data Importer XML Splitter */,
377DDE4F2156A90D0012329F /* Health XML Splitter */,
);
};
/* End PBXProject section */
Expand Down Expand Up @@ -397,7 +400,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
Expand Down Expand Up @@ -450,7 +453,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand Down Expand Up @@ -485,12 +488,11 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_ENTITLEMENTS = "Health Data Importer XML Splitter/Health_Data_Importer_XML_Splitter.entitlements";
CODE_SIGN_ENTITLEMENTS = "Health Data Importer XML Splitter/Health Data Importer XML Splitter.entitlements";
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = 63553QQ62F;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "Health Data Importer XML Splitter/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
Expand All @@ -508,12 +510,11 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_ENTITLEMENTS = "Health Data Importer XML Splitter/Health_Data_Importer_XML_Splitter.entitlements";
CODE_SIGN_ENTITLEMENTS = "Health Data Importer XML Splitter/Health Data Importer XML Splitter.entitlements";
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = 63553QQ62F;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "Health Data Importer XML Splitter/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MTL_FAST_MATH = YES;
Expand Down Expand Up @@ -545,7 +546,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
377DDE5F2156A90D0012329F /* Build configuration list for PBXNativeTarget "Health Data Importer XML Splitter" */ = {
377DDE5F2156A90D0012329F /* Build configuration list for PBXNativeTarget "Health XML Splitter" */ = {
isa = XCConfigurationList;
buildConfigurations = (
377DDE5D2156A90D0012329F /* Debug */,
Expand Down
Loading

0 comments on commit 646f4bc

Please sign in to comment.