diff --git a/OpenHaystack/OpenHaystack.xcodeproj/project.pbxproj b/OpenHaystack/OpenHaystack.xcodeproj/project.pbxproj index 9593b33..8cb87af 100644 --- a/OpenHaystack/OpenHaystack.xcodeproj/project.pbxproj +++ b/OpenHaystack/OpenHaystack.xcodeproj/project.pbxproj @@ -18,12 +18,11 @@ 781EB3EC25DAD7EA00FEAA19 /* DecryptReports.swift in Sources */ = {isa = PBXBuildFile; fileRef = 025DFEDB248FED250039C718 /* DecryptReports.swift */; }; 781EB3EF25DAD7EA00FEAA19 /* MapViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0211DBC2249135D600ABB066 /* MapViewController.swift */; }; 781EB3F125DAD7EA00FEAA19 /* FindMyKeyDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7867874724A651C600199B09 /* FindMyKeyDecoder.swift */; }; - 781EB3F225DAD7EA00FEAA19 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78108B6F248E8FB50007E9C4 /* AppDelegate.swift */; }; + 781EB3F225DAD7EA00FEAA19 /* OpenHaystackApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78108B6F248E8FB50007E9C4 /* OpenHaystackApp.swift */; }; 781EB3F325DAD7EA00FEAA19 /* Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78108B8E248F70D40007E9C4 /* Models.swift */; }; 781EB3F425DAD7EA00FEAA19 /* FindMyController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78108B90248F72AF0007E9C4 /* FindMyController.swift */; }; 781EB3F525DAD7EA00FEAA19 /* BoringSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 024D98482490CE320063EBB6 /* BoringSSL.m */; }; 781EB3F725DAD7EA00FEAA19 /* Crypto in Frameworks */ = {isa = PBXBuildFile; productRef = 781EB3E725DAD7EA00FEAA19 /* Crypto */; }; - 781EB3FD25DAD7EA00FEAA19 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 78108B78248E8FB80007E9C4 /* Main.storyboard */; }; 781EB3FE25DAD7EA00FEAA19 /* MapViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0211DBC3249135D600ABB066 /* MapViewController.xib */; }; 781EB40025DAD7EA00FEAA19 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 78108B76248E8FB80007E9C4 /* Preview Assets.xcassets */; }; 781EB40225DAD7EA00FEAA19 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 78108B73248E8FB80007E9C4 /* Assets.xcassets */; }; @@ -110,10 +109,9 @@ 78023CAA25F7767000B083EF /* ESP32Controller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ESP32Controller.swift; sourceTree = ""; }; 78023CAE25F7797400B083EF /* ESP32 */ = {isa = PBXFileReference; lastKnownFileType = folder; path = ESP32; sourceTree = ""; }; 78023CB025F7841F00B083EF /* MicrocontrollerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MicrocontrollerTests.swift; sourceTree = ""; }; - 78108B6F248E8FB50007E9C4 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 78108B6F248E8FB50007E9C4 /* OpenHaystackApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenHaystackApp.swift; sourceTree = ""; }; 78108B73248E8FB80007E9C4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 78108B76248E8FB80007E9C4 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; - 78108B79248E8FB80007E9C4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 78108B7B248E8FB80007E9C4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 78108B82248E8FDD0007E9C4 /* OpenHaystack-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "OpenHaystack-Bridging-Header.h"; sourceTree = ""; }; 78108B83248E8FDD0007E9C4 /* ReportsFetcher.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReportsFetcher.h; sourceTree = ""; }; @@ -241,12 +239,11 @@ 78108B87248E8FF10007E9C4 /* ReportsFetcher */, 78EC226E25DBC2FC0042B775 /* HaystackApp */, 781EB40F25DADB0600FEAA19 /* AnisetteDataManager.swift */, - 78108B6F248E8FB50007E9C4 /* AppDelegate.swift */, + 78108B6F248E8FB50007E9C4 /* OpenHaystackApp.swift */, 0211DBC2249135D600ABB066 /* MapViewController.swift */, 116B4EEC24A913AA007BA636 /* SavePanel.swift */, 0211DBC3249135D600ABB066 /* MapViewController.xib */, 78108B73248E8FB80007E9C4 /* Assets.xcassets */, - 78108B78248E8FB80007E9C4 /* Main.storyboard */, 78108B7B248E8FB80007E9C4 /* Info.plist */, 78108B75248E8FB80007E9C4 /* Preview Content */, ); @@ -482,7 +479,6 @@ buildActionMask = 2147483647; files = ( 78023CAF25F7797400B083EF /* ESP32 in Resources */, - 781EB3FD25DAD7EA00FEAA19 /* Main.storyboard in Resources */, 7899D1D625DE74EE00115740 /* firmware.bin in Resources */, 781EB3FE25DAD7EA00FEAA19 /* MapViewController.xib in Resources */, 78EC227525DBCCA00042B775 /* .swiftlint.yml in Resources */, @@ -632,8 +628,8 @@ 7821DAD325F7C39A0054DC33 /* ESP32InstallSheet.swift in Sources */, 781EB3F125DAD7EA00FEAA19 /* FindMyKeyDecoder.swift in Sources */, 787D8AC125DECD3C00148766 /* AccessoryController.swift in Sources */, - 781EB3F225DAD7EA00FEAA19 /* AppDelegate.swift in Sources */, 78023CAB25F7767000B083EF /* ESP32Controller.swift in Sources */, + 781EB3F225DAD7EA00FEAA19 /* OpenHaystackApp.swift in Sources */, 781EB3F325DAD7EA00FEAA19 /* Models.swift in Sources */, 781EB3F425DAD7EA00FEAA19 /* FindMyController.swift in Sources */, 781EB3F525DAD7EA00FEAA19 /* BoringSSL.m in Sources */, @@ -674,17 +670,6 @@ }; /* End PBXTargetDependency section */ -/* Begin PBXVariantGroup section */ - 78108B78248E8FB80007E9C4 /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 78108B79248E8FB80007E9C4 /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - /* Begin XCBuildConfiguration section */ 78108B7D248E8FB80007E9C4 /* Debug */ = { isa = XCBuildConfiguration; diff --git a/OpenHaystack/OpenHaystack/AppDelegate.swift b/OpenHaystack/OpenHaystack/AppDelegate.swift deleted file mode 100644 index 5ad9acc..0000000 --- a/OpenHaystack/OpenHaystack/AppDelegate.swift +++ /dev/null @@ -1,44 +0,0 @@ -// OpenHaystack – Tracking personal Bluetooth devices via Apple's Find My network -// -// Copyright © 2021 Secure Mobile Networking Lab (SEEMOO) -// Copyright © 2021 The Open Wireless Link Project -// -// SPDX-License-Identifier: AGPL-3.0-only - -import Cocoa -import SwiftUI - -@NSApplicationMain -class AppDelegate: NSObject, NSApplicationDelegate { - - var window: NSWindow! - - private var mainView: some View { - if ProcessInfo().arguments.contains("-preview") { - return OpenHaystackMainView(accessoryController: AccessoryController(accessories: PreviewData.accessories)) - } - return OpenHaystackMainView() - } - - func applicationDidFinishLaunching(_ aNotification: Notification) { - // Create the window and set the content view. - window = NSWindow( - contentRect: NSRect(x: 0, y: 0, width: 750, height: 480), - styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView], - backing: .buffered, defer: false) - - window.center() - window.setFrameAutosaveName("Main Window") - window.contentView = NSHostingView(rootView: mainView) - window.makeKeyAndOrderFront(nil) - } - - func applicationWillTerminate(_ aNotification: Notification) { - // Insert code here to tear down your application - } - - func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { - return true - } - -} diff --git a/OpenHaystack/OpenHaystack/Info.plist b/OpenHaystack/OpenHaystack/Info.plist index 394b1d5..405cd0c 100644 --- a/OpenHaystack/OpenHaystack/Info.plist +++ b/OpenHaystack/OpenHaystack/Info.plist @@ -24,10 +24,6 @@ $(MACOSX_DEPLOYMENT_TARGET) NSHumanReadableCopyright Copyright © 2021 SEEMOO – TU Darmstadt - NSMainStoryboardFile - Main - NSPrincipalClass - NSApplication NSSupportsAutomaticTermination NSSupportsSuddenTermination diff --git a/OpenHaystack/OpenHaystack/OpenHaystackApp.swift b/OpenHaystack/OpenHaystack/OpenHaystackApp.swift new file mode 100644 index 0000000..d124bc9 --- /dev/null +++ b/OpenHaystack/OpenHaystack/OpenHaystackApp.swift @@ -0,0 +1,26 @@ +// OpenHaystack – Tracking personal Bluetooth devices via Apple's Find My network +// +// Copyright © 2021 Secure Mobile Networking Lab (SEEMOO) +// Copyright © 2021 The Open Wireless Link Project +// +// SPDX-License-Identifier: AGPL-3.0-only + +import SwiftUI + +@main +struct OpenHaystackApp: App { + + var body: some Scene { + WindowGroup { + if ProcessInfo().arguments.contains("-preview") { + OpenHaystackMainView(accessoryController: AccessoryController(accessories: PreviewData.accessories)) + } else { + OpenHaystackMainView() + } + } + .commands { + SidebarCommands() + } + } + +}