Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
3j14 committed Oct 18, 2020
1 parent b43b12a commit d46369b
Show file tree
Hide file tree
Showing 23 changed files with 611 additions and 25 deletions.
22 changes: 22 additions & 0 deletions .gitignore
@@ -0,0 +1,22 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## User settings
xcuserdata/
## Obj-C/Swift specific
*.hmap

## App packaging
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

.build/

Bitwarden/app/**
!Bitwarden/app/.gitkeep
3 changes: 3 additions & 0 deletions .gitmodules
@@ -0,0 +1,3 @@
[submodule "Bitwarden/browser"]
path = Bitwarden/browser
url = git@github.com:bitwarden/browser.git
45 changes: 40 additions & 5 deletions Bitwarden.xcodeproj/project.pbxproj
Expand Up @@ -12,17 +12,20 @@
DD387514253B176C0021B81B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DD387513253B176C0021B81B /* Assets.xcassets */; };
DD387517253B176C0021B81B /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DD387516253B176C0021B81B /* Preview Assets.xcassets */; };
DD38751A253B176C0021B81B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DD387518253B176C0021B81B /* Main.storyboard */; };
DD387533253B3EF40021B81B /* app in Resources */ = {isa = PBXBuildFile; fileRef = DD387532253B3EF40021B81B /* app */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
DD38750C253B176A0021B81B /* Bitwarden.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Bitwarden.app; sourceTree = BUILT_PRODUCTS_DIR; };
DD38750C253B176A0021B81B /* Bitwarden Menu.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Bitwarden Menu.app"; sourceTree = BUILT_PRODUCTS_DIR; };
DD38750F253B176A0021B81B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
DD387511253B176A0021B81B /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
DD387513253B176C0021B81B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
DD387516253B176C0021B81B /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
DD387519253B176C0021B81B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
DD38751B253B176C0021B81B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
DD38751C253B176C0021B81B /* Bitwarden.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Bitwarden.entitlements; sourceTree = "<group>"; };
DD387532253B3EF40021B81B /* app */ = {isa = PBXFileReference; lastKnownFileType = folder; name = app; path = Bitwarden/app; sourceTree = "<group>"; };
DD78FD55253C56B000A6184C /* build.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = build.sh; path = Bitwarden/build.sh; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -39,6 +42,8 @@
DD387503253B176A0021B81B = {
isa = PBXGroup;
children = (
DD78FD55253C56B000A6184C /* build.sh */,
DD387532253B3EF40021B81B /* app */,
DD38750E253B176A0021B81B /* Bitwarden */,
DD38750D253B176A0021B81B /* Products */,
);
Expand All @@ -47,7 +52,7 @@
DD38750D253B176A0021B81B /* Products */ = {
isa = PBXGroup;
children = (
DD38750C253B176A0021B81B /* Bitwarden.app */,
DD38750C253B176A0021B81B /* Bitwarden Menu.app */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -83,6 +88,7 @@
buildPhases = (
DD387508253B176A0021B81B /* Sources */,
DD387509253B176A0021B81B /* Frameworks */,
DD78FD54253C565F00A6184C /* Run Script */,
DD38750A253B176A0021B81B /* Resources */,
);
buildRules = (
Expand All @@ -91,7 +97,7 @@
);
name = Bitwarden;
productName = Bitwarden;
productReference = DD38750C253B176A0021B81B /* Bitwarden.app */;
productReference = DD38750C253B176A0021B81B /* Bitwarden Menu.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
Expand All @@ -100,6 +106,9 @@
DD387504253B176A0021B81B /* Project object */ = {
isa = PBXProject;
attributes = {
KnownAssetTags = (
New,
);
LastSwiftUpdateCheck = 1200;
LastUpgradeCheck = 1200;
TargetAttributes = {
Expand Down Expand Up @@ -131,6 +140,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
DD387533253B3EF40021B81B /* app in Resources */,
DD38751A253B176C0021B81B /* Main.storyboard in Resources */,
DD387517253B176C0021B81B /* Preview Assets.xcassets in Resources */,
DD387514253B176C0021B81B /* Assets.xcassets in Resources */,
Expand All @@ -139,6 +149,27 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
DD78FD54253C565F00A6184C /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Run Script";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "pushd Bitwarden\n/Users/jonas/Workspace/Bitwarden/Bitwarden/build.sh\npopd\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
DD387508253B176A0021B81B /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down Expand Up @@ -284,6 +315,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Bitwarden/Bitwarden.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_ASSET_PATHS = "\"Bitwarden/Preview Content\"";
Expand All @@ -296,8 +328,9 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 0.0.1;
PRODUCT_BUNDLE_IDENTIFIER = de.jonas.Bitwarden;
PRODUCT_NAME = "$(TARGET_NAME)";
PRODUCT_NAME = "$(TARGET_NAME) Menu";
SWIFT_VERSION = 5.0;
};
name = Debug;
Expand All @@ -308,6 +341,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Bitwarden/Bitwarden.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_ASSET_PATHS = "\"Bitwarden/Preview Content\"";
Expand All @@ -320,8 +354,9 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 0.0.1;
PRODUCT_BUNDLE_IDENTIFIER = de.jonas.Bitwarden;
PRODUCT_NAME = "$(TARGET_NAME)";
PRODUCT_NAME = "$(TARGET_NAME) Menu";
SWIFT_VERSION = 5.0;
};
name = Release;
Expand Down
42 changes: 29 additions & 13 deletions Bitwarden/AppDelegate.swift
Expand Up @@ -11,25 +11,41 @@ import SwiftUI
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {

var window: NSWindow!

var popover: NSPopover!
var statusBarItem: NSStatusItem!

func applicationDidFinishLaunching(_ aNotification: Notification) {
// Create the SwiftUI view that provides the window contents.
let contentView = ContentView()

// Create the window and set the content view.
window = NSWindow(
contentRect: NSRect(x: 0, y: 0, width: 480, height: 300),
styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView],
backing: .buffered, defer: false)
window.isReleasedWhenClosed = false
window.center()
window.setFrameAutosaveName("Main Window")
window.contentView = NSHostingView(rootView: contentView)
window.makeKeyAndOrderFront(nil)

let _popover = NSPopover()

_popover.contentSize = NSSize(width: 375, height: 600)
_popover.behavior = .transient
_popover.contentViewController = NSHostingController(rootView: contentView)

self.popover = _popover

self.statusBarItem = NSStatusBar.system.statusItem(withLength: CGFloat(NSStatusItem.squareLength))

if (self.statusBarItem.button != nil) {
self.statusBarItem.button!.image = NSImage(named: "TrayIcon")
self.statusBarItem.button!.action = #selector(togglePopover(_:))
}
}

@objc func togglePopover(_ sender: AnyObject?) {
if self.popover.isShown {
self.popover.performClose(sender)
} else if self.statusBarItem.button != nil {
self.popover.show(
relativeTo: self.statusBarItem.button!.bounds,
of: self.statusBarItem.button!,
preferredEdge: .minY
)
}
}

func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}
Expand Down
4 changes: 4 additions & 0 deletions Bitwarden/Assets.xcassets/AccentColor.colorset/Contents.json
@@ -1,6 +1,10 @@
{
"colors" : [
{
"color" : {
"platform" : "osx",
"reference" : "controlAccentColor"
},
"idiom" : "universal"
}
],
Expand Down
9 changes: 9 additions & 0 deletions Bitwarden/Assets.xcassets/AppIcon.appiconset/Contents.json
Expand Up @@ -6,46 +6,55 @@
"size" : "16x16"
},
{
"filename" : "icon@32.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"filename" : "icon@32.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"filename" : "icon@64.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"filename" : "icon@128.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"filename" : "icon@256.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"filename" : "icon@256.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"filename" : "icon@512.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"filename" : "icon@512.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"filename" : "icon@1024.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions Bitwarden/Assets.xcassets/TrayIcon.imageset/Contents.json
@@ -0,0 +1,25 @@
{
"images" : [
{
"filename" : "ToolbarItemIcon.pdf",
"idiom" : "mac"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "ToolbarItemIcon_white.pdf",
"idiom" : "mac"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
}
}
Binary file not shown.
Binary file not shown.
10 changes: 6 additions & 4 deletions Bitwarden/Bitwarden.entitlements
Expand Up @@ -2,9 +2,11 @@
<!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-only</key>
<true/>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>

0 comments on commit d46369b

Please sign in to comment.