Skip to content

Commit

Permalink
Modify .gitignore and add Xcode Project
Browse files Browse the repository at this point in the history
  • Loading branch information
BertanT committed Jan 12, 2022
1 parent 6897384 commit d09c531
Show file tree
Hide file tree
Showing 46 changed files with 2,560 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## macOS Finder
**/.DS_Store

## User settings
xcuserdata/
*.xcworkspace

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
Expand Down
529 changes: 529 additions & 0 deletions Capturinator/Capturinator.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1310"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "565E3EAA26CE667F00E5FE4D"
BuildableName = "Capturinator.app"
BlueprintName = "Capturinator"
ReferencedContainer = "container:Capturinator.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "565E3EAA26CE667F00E5FE4D"
BuildableName = "Capturinator.app"
BlueprintName = "Capturinator"
ReferencedContainer = "container:Capturinator.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "565E3EAA26CE667F00E5FE4D"
BuildableName = "Capturinator.app"
BlueprintName = "Capturinator"
ReferencedContainer = "container:Capturinator.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
56 changes: 56 additions & 0 deletions Capturinator/Capturinator/App/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//
// AppDelegate.swift
// Object Capture Create
//
// Created by Bertan on 26.06.2021.
//

import SwiftUI
import AppKit
import UserNotifications

class AppDelegate: NSObject, NSApplicationDelegate {
@AppStorage("userSuppressedQuitAlert") private var userSuppressedQuitAlert = false
private var shouldAskBeforeQuitting = true

func applicationDidFinishLaunching(_ notification: Notification) {
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge]) { success, error in
if success {
print("User granted notifications access :)")
}else if let e = error {
print(e.localizedDescription)
}
}
}


func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
shouldAskBeforeQuitting = false
return true
}

func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {
if shouldAskBeforeQuitting, !userSuppressedQuitAlert {
let alert = NSAlert()
alert.alertStyle = .warning
alert.messageText = String(localized: "QuitAppAlertTitle", comment: "Title of the app termination confirmation dialog")
alert.informativeText = String(localized: "QuitAppAlertBody", comment: "Body of the app termination confirmation dialog")
alert.addButton(withTitle: String(localized: "Quit", comment: "Button: Quits app"))
alert.addButton(withTitle: String(localized: "Cancel", comment: "General purpose cancel button"))
alert.showsSuppressionButton = true

let response = alert.runModal()

if let suppressionResponse = alert.suppressionButton?.state {
if suppressionResponse == NSControl.StateValue.on {
userSuppressedQuitAlert = true
}
}

if response == .alertSecondButtonReturn {
return .terminateCancel
}
}
return .terminateNow
}
}
38 changes: 38 additions & 0 deletions Capturinator/Capturinator/App/CloseAlertWindowDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// CloseAlertWindowDelegate.swift
// Object Capture Create
//
// Created by Bertan on 28.06.2021.
//

import AppKit
import SwiftUI

class CloseAlertWindowDelegate: NSObject, NSWindowDelegate {
@AppStorage("userSuppressedWindowCloseAlert") private var userSuppressedWindowCloseAlert = false

func windowShouldClose(_ sender: NSWindow) -> Bool {
if !userSuppressedWindowCloseAlert {
let alert = NSAlert()
alert.alertStyle = .warning
alert.messageText = String(localized: "CloseWindowAlertTitle", comment: "Title of the window closing confirmation dialog")
alert.informativeText = String(localized: "CloseWindowAlertBody", comment: "Body of the window closing confirmation dialog")
alert.addButton(withTitle: NSLocalizedString("Close", comment: "Button: Closes window"))
alert.addButton(withTitle: String(localized: "Cancel"))
alert.showsSuppressionButton = true

let response = alert.runModal()

if let suppressionResponse = alert.suppressionButton?.state {
if suppressionResponse == NSControl.StateValue.on {
userSuppressedWindowCloseAlert = true
}
}

if response == .alertSecondButtonReturn {
return false
}
}
return true
}
}
66 changes: 66 additions & 0 deletions Capturinator/Capturinator/App/Object_Capture_CreateApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//
// Object_Capture_CreateApp.swift
// Object Capture Create
//
// Created by Bertan on 22.06.2021.
//

import SwiftUI

@main
struct Object_Capture_CreateApp: App {
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
@StateObject private var sharedData = SharedData()
@AppStorage("onboardingShown") private var onboardingShown = false
@State private var showingOnboarding = false
var supportsObjectCapture = CompatibilityChecker().checkObjectCaptureSupport()

var body: some Scene {
WindowGroup {
if supportsObjectCapture {
ContentView()
.frame(minWidth: 1280, maxWidth: .infinity, minHeight: 720, maxHeight: .infinity)
.environmentObject(sharedData)
.onAppear {
if !onboardingShown {
showingOnboarding = true
onboardingShown = true
}
}
.sheet(isPresented: $showingOnboarding) {
OnboardingView()

}
}else {
NotSupportedView()
.frame(minWidth: 1280, maxWidth: .infinity, minHeight: 720, maxHeight: .infinity)
}
}
.commands {
CommandGroup(replacing: .appInfo) {
Button(String(localized: "AboutMenuCommandTtitle", comment: "Menu Command: Shows the about this app window")){
NSApplication.shared.orderFrontStandardAboutPanel(
options: [
NSApplication.AboutPanelOptionKey.credits: NSAttributedString(string: String(localized: "AboutWindowText", comment: "Short description of the app") + "\n" + String(localized: "MadeWithLove"), attributes: [ NSAttributedString.Key.font: NSFont.labelFont(ofSize: 12)]),
NSApplication.AboutPanelOptionKey(rawValue: "Copyright"): Bundle.main.object(forInfoDictionaryKey: "NSHumanReadableCopyright") ?? ""
])

}
}
CommandGroup(replacing: .help) {
Button(String(localized: "GettingStartedMenuCommandTittle", comment: "Menu Command: Shows the onboarding screen")) {
showingOnboarding.toggle()
}
.keyboardShortcut("?")
}
CommandGroup(after: .help) {
Button(String(localized: "SupportMenuCommandTitle", comment: "Menu Command: Opens the Capturinator Support Website")) {
if let url = URL(string: "http://www.capturinator.bertan.codes/support") {
NSWorkspace.shared.open(url)
}
}
}
SidebarCommands()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"colors" : [
{
"color" : {
"platform" : "universal",
"reference" : "systemMintColor"
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"platform" : "universal",
"reference" : "systemMintColor"
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"images" : [
{
"filename" : "icon_16x16.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"filename" : "icon_16x16@[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"filename" : "icon_32x32.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"filename" : "icon_32x32@[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"filename" : "icon_128x128.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"filename" : "icon_128x128@[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"filename" : "icon_256x256.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"filename" : "icon_256x256@[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"filename" : "icon_512x512.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"filename" : "icon_512x512@[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions Capturinator/Capturinator/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
10 changes: 10 additions & 0 deletions Capturinator/Capturinator/Capturinator.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
</dict>
</plist>
Loading

0 comments on commit d09c531

Please sign in to comment.