Skip to content

Commit a03eb16

Browse files
committed
cleanup
1 parent 6ae638e commit a03eb16

3 files changed

Lines changed: 50 additions & 23 deletions

File tree

Object Info.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
B5D6B95F207E92B10012C280 /* settings.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = settings.plist; sourceTree = "<group>"; };
3838
B5E61EB925A8BF070047A25F /* Globals.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Globals.swift; sourceTree = "<group>"; };
3939
B5E61EBC25A8BF650047A25F /* WriteToLog.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WriteToLog.swift; sourceTree = "<group>"; };
40+
CE57AAA72D14C930007CF27B /* Object Info legacy.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Object Info legacy.entitlements"; sourceTree = "<group>"; };
4041
CECDF9F32D1495590039CD84 /* Object Info.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Object Info.entitlements"; sourceTree = "<group>"; };
4142
/* End PBXFileReference section */
4243

@@ -91,6 +92,7 @@
9192
B5932DE41F6FF3FC00720831 /* Main.storyboard */,
9293
B5932DE71F6FF3FC00720831 /* Info.plist */,
9394
B5D6B95F207E92B10012C280 /* settings.plist */,
95+
CE57AAA72D14C930007CF27B /* Object Info legacy.entitlements */,
9496
CECDF9F32D1495590039CD84 /* Object Info.entitlements */,
9597
B5450942290CEF9D00094739 /* Notes.md */,
9698
);
@@ -327,6 +329,7 @@
327329
buildSettings = {
328330
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
329331
CODE_SIGN_ENTITLEMENTS = "ObjectInfo/Object Info.entitlements";
332+
"CODE_SIGN_ENTITLEMENTS[sdk=*]" = "ObjectInfo/Object Info legacy.entitlements";
330333
CODE_SIGN_IDENTITY = "Apple Development";
331334
COMBINE_HIDPI_IMAGES = YES;
332335
CURRENT_PROJECT_VERSION = 1;
@@ -352,6 +355,7 @@
352355
buildSettings = {
353356
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
354357
CODE_SIGN_ENTITLEMENTS = "ObjectInfo/Object Info.entitlements";
358+
"CODE_SIGN_ENTITLEMENTS[sdk=*]" = "ObjectInfo/Object Info legacy.entitlements";
355359
CODE_SIGN_IDENTITY = "Apple Development";
356360
COMBINE_HIDPI_IMAGES = YES;
357361
CURRENT_PROJECT_VERSION = 1;

ObjectInfo/LoginVC.swift

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -624,11 +624,11 @@ class LoginVC: NSViewController, URLSessionDelegate, NSTextFieldDelegate {
624624

625625
// check shared settings
626626
print("[viewDidLoad] sharedSettingsPlistUrl: \(sharedSettingsPlistUrl.path)")
627-
if !FileManager.default.fileExists(atPath: sharedSettingsPlistUrl.path) {
628-
print("[viewDidLoad] creating settings file")
629-
sharedDefaults!.set(Date(), forKey: "created")
630-
sharedDefaults!.set([String:AnyObject](), forKey: "serversDict")
631-
}
627+
// if !FileManager.default.fileExists(atPath: sharedSettingsPlistUrl.path) {
628+
// print("[viewDidLoad] creating settings file")
629+
// sharedDefaults!.set(Date(), forKey: "created")
630+
// sharedDefaults!.set([String:AnyObject](), forKey: "serversDict")
631+
// }
632632
if (sharedDefaults!.object(forKey: "serversDict") as? [String:AnyObject] ?? [:]).count == 0 {
633633
sharedDefaults!.set(availableServersDict, forKey: "serversDict")
634634
}
@@ -703,19 +703,17 @@ class LoginVC: NSViewController, URLSessionDelegate, NSTextFieldDelegate {
703703
let _sharedContainerUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.\(appsGroupId)")
704704
let _sharedSettingsPlistUrl = (_sharedContainerUrl?.appendingPathComponent("Library/Preferences/group.\(appsGroupId).plist"))!
705705
print("[migrateSettings] _sharedSettingsPlistUrl: \(_sharedSettingsPlistUrl.path(percentEncoded: false))")
706-
// let filePath = "/Users/leslie/Library/Group Containers/group.PS2F6S478M.jamfie.SharedJPMA/Library/Preferences/group.PS2F6S478M.jamfie.SharedJPMA.plist"
706+
707707
if FileManager.default.fileExists(atPath: _sharedSettingsPlistUrl.path(percentEncoded: false)) {
708-
do {
709-
if !FileManager.default.fileExists(atPath: sharedSettingsPlistUrl.path(percentEncoded: false)) {
710-
try FileManager.default.copyItem(at: _sharedSettingsPlistUrl, to: sharedSettingsPlistUrl)
711-
} else {
712-
print("[migrateSettings] file exists")
713-
if FileManager.default.isReadableFile(atPath: _sharedSettingsPlistUrl.path(percentEncoded: false)) {
714-
print("[migrateSettings] file is readable")
715-
} else {
716-
print("[migrateSettings] file is not readable")
717-
}
718-
708+
if !FileManager.default.fileExists(atPath: sharedSettingsPlistUrl.path(percentEncoded: false)) {
709+
print("[viewDidLoad] creating settings file")
710+
sharedDefaults!.set(Date(), forKey: "created")
711+
sharedDefaults!.set([String:AnyObject](), forKey: "serversDict")
712+
}
713+
print("[migrateSettings] file exists")
714+
if FileManager.default.isReadableFile(atPath: _sharedSettingsPlistUrl.path(percentEncoded: false)) {
715+
print("[migrateSettings] file is readable")
716+
do {
719717
let data = try Data(contentsOf: _sharedSettingsPlistUrl)
720718
print("[migrateSettings] file settings to data")
721719

@@ -725,15 +723,17 @@ class LoginVC: NSViewController, URLSessionDelegate, NSTextFieldDelegate {
725723
print("[migrateSettings] setting value for key: \(key)")
726724
sharedDefaults!.set(value, forKey: key)
727725
}
726+
try FileManager.default.moveItem(atPath: _sharedSettingsPlistUrl.path(percentEncoded: false), toPath: _sharedSettingsPlistUrl.path(percentEncoded: false).appending(".bak_\(WriteToLog.shared.getCurrentTime())"))
727+
WriteToLog.shared.message(stringOfText: "[migrateSettings] migrated settings")
728+
} catch {
729+
print("[migrateSettings] failed to migrate settings")
728730
}
729-
try FileManager.default.moveItem(atPath: _sharedSettingsPlistUrl.path(percentEncoded: false), toPath: _sharedSettingsPlistUrl.path(percentEncoded: false).appending(".bak_\(WriteToLog.shared.getCurrentTime())"))
730-
WriteToLog.shared.message(stringOfText: "[migrateSettings] migrated settings")
731-
} catch {
732-
print("[migrateSettings] failed to migrate settings")
731+
} else {
732+
print("[migrateSettings] file is not readable")
733733
}
734734
} else {
735-
print("[migrateSettings] did not find old settings")
736-
}
735+
print("[migrateSettings] did not find old settings")
736+
}
737737
}
738738
}
739739

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.app-sandbox</key>
6+
<true/>
7+
<key>com.apple.security.application-groups</key>
8+
<array>
9+
<string>group.PS2F6S478M.jamfie.SharedJPMA</string>
10+
<string>PS2F6S478M.jamfie.SharedJPMA</string>
11+
</array>
12+
<key>com.apple.security.files.downloads.read-write</key>
13+
<true/>
14+
<key>com.apple.security.files.user-selected.read-write</key>
15+
<true/>
16+
<key>com.apple.security.network.client</key>
17+
<true/>
18+
<key>keychain-access-groups</key>
19+
<array>
20+
<string>$(AppIdentifierPrefix)jamfie.SharedJPMA</string>
21+
</array>
22+
</dict>
23+
</plist>

0 commit comments

Comments
 (0)