This repository has been archived by the owner on Aug 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 20cefb4
Showing
63 changed files
with
4,434 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.DS_Store | ||
**/xcuserdata/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2021 Victor Gama | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
Podman.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
Podman.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?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>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
16 changes: 16 additions & 0 deletions
16
Podman.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"object": { | ||
"pins": [ | ||
{ | ||
"package": "Sparkle", | ||
"repositoryURL": "https://github.com/sparkle-project/Sparkle", | ||
"state": { | ||
"branch": null, | ||
"revision": "c0933a516b420806e9216e71bd13ba76c54f0de6", | ||
"version": "1.26.0" | ||
} | ||
} | ||
] | ||
}, | ||
"version": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// AppDelegate.h | ||
// Podman macOS | ||
// | ||
// Created by Victor Gama on 02/09/2021. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
@interface AppDelegate : NSObject <NSApplicationDelegate> | ||
|
||
|
||
/// Starts the agent by placing an icon in the system's Menu Bar. | ||
/// Multiple calls to this method has no effect. | ||
- (void)startAgent; | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
// | ||
// AppDelegate.m | ||
// Podman macOS | ||
// | ||
// Created by Victor Gama on 02/09/2021. | ||
// | ||
|
||
#import <Sparkle/Sparkle.h> | ||
|
||
#import "AppDelegate.h" | ||
#import "PMStatusBarController.h" | ||
#import "PopoverController.h" | ||
#import "PMManager.h" | ||
#import "PMMoveToApplications.h" | ||
#import "PMPreferences.h" | ||
#import "PMDispatch.h" | ||
|
||
@interface AppDelegate () | ||
|
||
@end | ||
|
||
@implementation AppDelegate { | ||
PMStatusBarController *controller; | ||
NSPopover *popover; | ||
BOOL agentRunning; | ||
} | ||
|
||
- (void)ensureSingleInstance { | ||
pid_t selfPid = [[NSRunningApplication currentApplication] processIdentifier]; | ||
NSArray *appArray = [NSRunningApplication runningApplicationsWithBundleIdentifier:[[NSBundle mainBundle] bundleIdentifier]]; | ||
for (NSRunningApplication *app in appArray) { | ||
if ([app processIdentifier] != selfPid) { | ||
[NSApp terminate:nil]; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
|
||
- (void)applicationWillFinishLaunching:(NSNotification *)notification { | ||
[self ensureSingleInstance]; | ||
#ifndef DEBUG | ||
[PMMoveToApplications moveToApplicationsFolderIfNecessary]; | ||
#endif | ||
} | ||
|
||
|
||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { | ||
SUUpdater *updater = [SUUpdater sharedUpdater]; | ||
updater.automaticallyChecksForUpdates = PMPreferences.checkForUpdates; | ||
updater.feedURL = [NSURL URLWithString:@"https://heyvito.github.io/podman-macos/sparkle.xml"]; | ||
|
||
PMOperationResult *detectPodmanResult = [PMManager.manager detectPodman]; | ||
switch ([detectPodmanResult detectStateValue]) { | ||
case PMDetectStateNotInPath: { | ||
NSAlert *alert = [[NSAlert alloc] init]; | ||
alert.alertStyle = NSAlertStyleCritical; | ||
alert.messageText = @"Podman for macOS did not find a Podman executable"; | ||
alert.informativeText = @"Make sure Podman is installed and available in your PATH."; | ||
[alert addButtonWithTitle:@"OK"]; | ||
[alert runModal]; | ||
[NSApp terminate:nil]; | ||
return; | ||
} | ||
case PMDetectStateError: { | ||
NSAlert *alert = [[NSAlert alloc] init]; | ||
alert.alertStyle = NSAlertStyleCritical; | ||
alert.messageText = @"Error detecting Podman executable"; | ||
alert.informativeText = detectPodmanResult.output; | ||
[alert addButtonWithTitle:@"OK"]; | ||
[alert runModal]; | ||
[NSApp terminate:nil]; | ||
return; | ||
} | ||
case PMDetectStateOK: | ||
NSLog(@"Podman detection succeeded."); | ||
} | ||
|
||
PMOperationResult *detectVMResult = [PMManager.manager detectVM]; | ||
switch ([detectVMResult vmPresenceValue]) { | ||
case PMVMPresenceError: { | ||
NSAlert *alert = [[NSAlert alloc] init]; | ||
alert.alertStyle = NSAlertStyleCritical; | ||
alert.messageText = @"Error detecting Podman Machine"; | ||
alert.informativeText = detectVMResult.output; | ||
[alert addButtonWithTitle:@"OK"]; | ||
[alert runModal]; | ||
[NSApp terminate:nil]; | ||
return; | ||
} | ||
|
||
case PMVMPresenceAbsent: { | ||
NSStoryboard *story = [NSStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]]; | ||
NSWindowController *windowController = [story instantiateControllerWithIdentifier:@"InstallWindow"]; | ||
[windowController showWindow:self]; | ||
return; | ||
} | ||
|
||
case PMVMPresencePresent: | ||
NSLog(@"Podman Machine detection succeeded."); | ||
} | ||
|
||
[self startAgent]; | ||
} | ||
|
||
|
||
- (void)startAgent { | ||
if (self->agentRunning) { | ||
return; | ||
} | ||
self->agentRunning = YES; | ||
|
||
NSStoryboard *story = [NSStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]]; | ||
NSViewController *viewController = [story instantiateControllerWithIdentifier:@"PopoverViewController"]; | ||
popover = [[NSPopover alloc] init]; | ||
popover.contentViewController = viewController; | ||
popover.behavior = NSPopoverBehaviorTransient; | ||
controller = [[PMStatusBarController alloc] initWithPopover:popover]; | ||
if (PMPreferences.startPodmanVM) { | ||
NSLog(@"PM is set to autostart VM"); | ||
if (PMManager.manager.serviceStatus == PMServiceStatusStopped) { | ||
[PMDispatch background:^{ | ||
PMOperationResult *result = [PMManager.manager startVM]; | ||
if (!result.succeeded) { | ||
[PMDispatch sync:^{ | ||
NSAlert *alert = [[NSAlert alloc] init]; | ||
alert.alertStyle = NSAlertStyleWarning; | ||
alert.messageText = @"Podman for macOS could not automatically start Podman's VM"; | ||
alert.informativeText = result.output; | ||
[alert addButtonWithTitle:@"OK"]; | ||
[alert runModal]; | ||
}]; | ||
} else { | ||
NSLog(@"VM started successfully."); | ||
} | ||
}]; | ||
} else { | ||
NSLog(@"VM is already running."); | ||
} | ||
} | ||
|
||
if (!PMPreferences.askedToStartAtLogin) { | ||
PMPreferences.askedToStartAtLogin = YES; | ||
NSAlert *alert = [[NSAlert alloc] init]; | ||
alert.alertStyle = NSAlertStyleInformational; | ||
alert.messageText = @"Would you like to Podman for macOS to start at login?"; | ||
alert.informativeText = @"This can be changed both in Podman for macOS's preferences and the System Preferences."; | ||
NSButton *yesButton = [alert addButtonWithTitle:@"Yes"]; | ||
yesButton.keyEquivalent = @"\r"; | ||
NSButton *noButton = [alert addButtonWithTitle:@"No"]; | ||
noButton.keyEquivalent = @"\033"; | ||
if([alert runModal] == NSAlertFirstButtonReturn) { | ||
PMPreferences.startAtLogin = YES; | ||
} | ||
} | ||
} | ||
|
||
|
||
- (void)applicationWillResignActive:(NSNotification *)notification { | ||
[popover close]; | ||
} | ||
|
||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Binary file added
BIN
+23.3 KB
Podman/Assets.xcassets/AppIcon.appiconset/icon_128x128@[email protected]
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.
Binary file added
BIN
+1.67 KB
Podman/Assets.xcassets/AppIcon.appiconset/icon_16x16@[email protected]
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.
Binary file added
BIN
+53.5 KB
Podman/Assets.xcassets/AppIcon.appiconset/icon_256x256@[email protected]
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.
Binary file added
BIN
+3.3 KB
Podman/Assets.xcassets/AppIcon.appiconset/icon_32x32@[email protected]
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.
Binary file added
BIN
+147 KB
Podman/Assets.xcassets/AppIcon.appiconset/icon_512x512@[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "icon.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"template-rendering-intent" : "template" | ||
} | ||
} |
Binary file not shown.
12 changes: 12 additions & 0 deletions
12
Podman/Assets.xcassets/podman-logo-full.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "podman-logo-full.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+13.9 KB
Podman/Assets.xcassets/podman-logo-full.imageset/podman-logo-full.pdf
Binary file not shown.
15 changes: 15 additions & 0 deletions
15
Podman/Assets.xcassets/podman-logo-text.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "podman-logo-text.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"template-rendering-intent" : "original" | ||
} | ||
} |
Binary file added
BIN
+5.15 KB
Podman/Assets.xcassets/podman-logo-text.imageset/podman-logo-text.pdf
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "podman-logo.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"template-rendering-intent" : "original" | ||
} | ||
} |
Binary file not shown.
Oops, something went wrong.