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

Commit d46369b

Browse files
committed
Initial commit
1 parent b43b12a commit d46369b

23 files changed

+611
-25
lines changed

.gitignore

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Xcode
2+
#
3+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4+
5+
## User settings
6+
xcuserdata/
7+
## Obj-C/Swift specific
8+
*.hmap
9+
10+
## App packaging
11+
*.ipa
12+
*.dSYM.zip
13+
*.dSYM
14+
15+
## Playgrounds
16+
timeline.xctimeline
17+
playground.xcworkspace
18+
19+
.build/
20+
21+
Bitwarden/app/**
22+
!Bitwarden/app/.gitkeep

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "Bitwarden/browser"]
2+
path = Bitwarden/browser
3+
url = [email protected]:bitwarden/browser.git

Bitwarden.xcodeproj/project.pbxproj

+40-5
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,20 @@
1212
DD387514253B176C0021B81B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DD387513253B176C0021B81B /* Assets.xcassets */; };
1313
DD387517253B176C0021B81B /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DD387516253B176C0021B81B /* Preview Assets.xcassets */; };
1414
DD38751A253B176C0021B81B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DD387518253B176C0021B81B /* Main.storyboard */; };
15+
DD387533253B3EF40021B81B /* app in Resources */ = {isa = PBXBuildFile; fileRef = DD387532253B3EF40021B81B /* app */; };
1516
/* End PBXBuildFile section */
1617

1718
/* Begin PBXFileReference section */
18-
DD38750C253B176A0021B81B /* Bitwarden.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Bitwarden.app; sourceTree = BUILT_PRODUCTS_DIR; };
19+
DD38750C253B176A0021B81B /* Bitwarden Menu.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Bitwarden Menu.app"; sourceTree = BUILT_PRODUCTS_DIR; };
1920
DD38750F253B176A0021B81B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
2021
DD387511253B176A0021B81B /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
2122
DD387513253B176C0021B81B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
2223
DD387516253B176C0021B81B /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
2324
DD387519253B176C0021B81B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
2425
DD38751B253B176C0021B81B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
2526
DD38751C253B176C0021B81B /* Bitwarden.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Bitwarden.entitlements; sourceTree = "<group>"; };
27+
DD387532253B3EF40021B81B /* app */ = {isa = PBXFileReference; lastKnownFileType = folder; name = app; path = Bitwarden/app; sourceTree = "<group>"; };
28+
DD78FD55253C56B000A6184C /* build.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = build.sh; path = Bitwarden/build.sh; sourceTree = "<group>"; };
2629
/* End PBXFileReference section */
2730

2831
/* Begin PBXFrameworksBuildPhase section */
@@ -39,6 +42,8 @@
3942
DD387503253B176A0021B81B = {
4043
isa = PBXGroup;
4144
children = (
45+
DD78FD55253C56B000A6184C /* build.sh */,
46+
DD387532253B3EF40021B81B /* app */,
4247
DD38750E253B176A0021B81B /* Bitwarden */,
4348
DD38750D253B176A0021B81B /* Products */,
4449
);
@@ -47,7 +52,7 @@
4752
DD38750D253B176A0021B81B /* Products */ = {
4853
isa = PBXGroup;
4954
children = (
50-
DD38750C253B176A0021B81B /* Bitwarden.app */,
55+
DD38750C253B176A0021B81B /* Bitwarden Menu.app */,
5156
);
5257
name = Products;
5358
sourceTree = "<group>";
@@ -83,6 +88,7 @@
8388
buildPhases = (
8489
DD387508253B176A0021B81B /* Sources */,
8590
DD387509253B176A0021B81B /* Frameworks */,
91+
DD78FD54253C565F00A6184C /* Run Script */,
8692
DD38750A253B176A0021B81B /* Resources */,
8793
);
8894
buildRules = (
@@ -91,7 +97,7 @@
9197
);
9298
name = Bitwarden;
9399
productName = Bitwarden;
94-
productReference = DD38750C253B176A0021B81B /* Bitwarden.app */;
100+
productReference = DD38750C253B176A0021B81B /* Bitwarden Menu.app */;
95101
productType = "com.apple.product-type.application";
96102
};
97103
/* End PBXNativeTarget section */
@@ -100,6 +106,9 @@
100106
DD387504253B176A0021B81B /* Project object */ = {
101107
isa = PBXProject;
102108
attributes = {
109+
KnownAssetTags = (
110+
New,
111+
);
103112
LastSwiftUpdateCheck = 1200;
104113
LastUpgradeCheck = 1200;
105114
TargetAttributes = {
@@ -131,6 +140,7 @@
131140
isa = PBXResourcesBuildPhase;
132141
buildActionMask = 2147483647;
133142
files = (
143+
DD387533253B3EF40021B81B /* app in Resources */,
134144
DD38751A253B176C0021B81B /* Main.storyboard in Resources */,
135145
DD387517253B176C0021B81B /* Preview Assets.xcassets in Resources */,
136146
DD387514253B176C0021B81B /* Assets.xcassets in Resources */,
@@ -139,6 +149,27 @@
139149
};
140150
/* End PBXResourcesBuildPhase section */
141151

152+
/* Begin PBXShellScriptBuildPhase section */
153+
DD78FD54253C565F00A6184C /* Run Script */ = {
154+
isa = PBXShellScriptBuildPhase;
155+
buildActionMask = 2147483647;
156+
files = (
157+
);
158+
inputFileListPaths = (
159+
);
160+
inputPaths = (
161+
);
162+
name = "Run Script";
163+
outputFileListPaths = (
164+
);
165+
outputPaths = (
166+
);
167+
runOnlyForDeploymentPostprocessing = 0;
168+
shellPath = /bin/sh;
169+
shellScript = "pushd Bitwarden\n/Users/jonas/Workspace/Bitwarden/Bitwarden/build.sh\npopd\n";
170+
};
171+
/* End PBXShellScriptBuildPhase section */
172+
142173
/* Begin PBXSourcesBuildPhase section */
143174
DD387508253B176A0021B81B /* Sources */ = {
144175
isa = PBXSourcesBuildPhase;
@@ -284,6 +315,7 @@
284315
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
285316
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
286317
CODE_SIGN_ENTITLEMENTS = Bitwarden/Bitwarden.entitlements;
318+
CODE_SIGN_IDENTITY = "Apple Development";
287319
CODE_SIGN_STYLE = Automatic;
288320
COMBINE_HIDPI_IMAGES = YES;
289321
DEVELOPMENT_ASSET_PATHS = "\"Bitwarden/Preview Content\"";
@@ -296,8 +328,9 @@
296328
"@executable_path/../Frameworks",
297329
);
298330
MACOSX_DEPLOYMENT_TARGET = 10.15;
331+
MARKETING_VERSION = 0.0.1;
299332
PRODUCT_BUNDLE_IDENTIFIER = de.jonas.Bitwarden;
300-
PRODUCT_NAME = "$(TARGET_NAME)";
333+
PRODUCT_NAME = "$(TARGET_NAME) Menu";
301334
SWIFT_VERSION = 5.0;
302335
};
303336
name = Debug;
@@ -308,6 +341,7 @@
308341
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
309342
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
310343
CODE_SIGN_ENTITLEMENTS = Bitwarden/Bitwarden.entitlements;
344+
CODE_SIGN_IDENTITY = "Apple Development";
311345
CODE_SIGN_STYLE = Automatic;
312346
COMBINE_HIDPI_IMAGES = YES;
313347
DEVELOPMENT_ASSET_PATHS = "\"Bitwarden/Preview Content\"";
@@ -320,8 +354,9 @@
320354
"@executable_path/../Frameworks",
321355
);
322356
MACOSX_DEPLOYMENT_TARGET = 10.15;
357+
MARKETING_VERSION = 0.0.1;
323358
PRODUCT_BUNDLE_IDENTIFIER = de.jonas.Bitwarden;
324-
PRODUCT_NAME = "$(TARGET_NAME)";
359+
PRODUCT_NAME = "$(TARGET_NAME) Menu";
325360
SWIFT_VERSION = 5.0;
326361
};
327362
name = Release;

Bitwarden/AppDelegate.swift

+29-13
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,41 @@ import SwiftUI
1111
@NSApplicationMain
1212
class AppDelegate: NSObject, NSApplicationDelegate {
1313

14-
var window: NSWindow!
15-
14+
var popover: NSPopover!
15+
var statusBarItem: NSStatusItem!
1616

1717
func applicationDidFinishLaunching(_ aNotification: Notification) {
1818
// Create the SwiftUI view that provides the window contents.
1919
let contentView = ContentView()
20-
21-
// Create the window and set the content view.
22-
window = NSWindow(
23-
contentRect: NSRect(x: 0, y: 0, width: 480, height: 300),
24-
styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView],
25-
backing: .buffered, defer: false)
26-
window.isReleasedWhenClosed = false
27-
window.center()
28-
window.setFrameAutosaveName("Main Window")
29-
window.contentView = NSHostingView(rootView: contentView)
30-
window.makeKeyAndOrderFront(nil)
20+
21+
let _popover = NSPopover()
22+
23+
_popover.contentSize = NSSize(width: 375, height: 600)
24+
_popover.behavior = .transient
25+
_popover.contentViewController = NSHostingController(rootView: contentView)
26+
27+
self.popover = _popover
28+
29+
self.statusBarItem = NSStatusBar.system.statusItem(withLength: CGFloat(NSStatusItem.squareLength))
30+
31+
if (self.statusBarItem.button != nil) {
32+
self.statusBarItem.button!.image = NSImage(named: "TrayIcon")
33+
self.statusBarItem.button!.action = #selector(togglePopover(_:))
34+
}
3135
}
3236

37+
@objc func togglePopover(_ sender: AnyObject?) {
38+
if self.popover.isShown {
39+
self.popover.performClose(sender)
40+
} else if self.statusBarItem.button != nil {
41+
self.popover.show(
42+
relativeTo: self.statusBarItem.button!.bounds,
43+
of: self.statusBarItem.button!,
44+
preferredEdge: .minY
45+
)
46+
}
47+
}
48+
3349
func applicationWillTerminate(_ aNotification: Notification) {
3450
// Insert code here to tear down your application
3551
}

Bitwarden/Assets.xcassets/AccentColor.colorset/Contents.json

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"colors" : [
33
{
4+
"color" : {
5+
"platform" : "osx",
6+
"reference" : "controlAccentColor"
7+
},
48
"idiom" : "universal"
59
}
610
],

Bitwarden/Assets.xcassets/AppIcon.appiconset/Contents.json

+9
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,55 @@
66
"size" : "16x16"
77
},
88
{
9+
"filename" : "[email protected]",
910
"idiom" : "mac",
1011
"scale" : "2x",
1112
"size" : "16x16"
1213
},
1314
{
15+
"filename" : "[email protected]",
1416
"idiom" : "mac",
1517
"scale" : "1x",
1618
"size" : "32x32"
1719
},
1820
{
21+
"filename" : "[email protected]",
1922
"idiom" : "mac",
2023
"scale" : "2x",
2124
"size" : "32x32"
2225
},
2326
{
27+
"filename" : "[email protected]",
2428
"idiom" : "mac",
2529
"scale" : "1x",
2630
"size" : "128x128"
2731
},
2832
{
33+
"filename" : "[email protected]",
2934
"idiom" : "mac",
3035
"scale" : "2x",
3136
"size" : "128x128"
3237
},
3338
{
39+
"filename" : "[email protected]",
3440
"idiom" : "mac",
3541
"scale" : "1x",
3642
"size" : "256x256"
3743
},
3844
{
45+
"filename" : "[email protected]",
3946
"idiom" : "mac",
4047
"scale" : "2x",
4148
"size" : "256x256"
4249
},
4350
{
51+
"filename" : "[email protected]",
4452
"idiom" : "mac",
4553
"scale" : "1x",
4654
"size" : "512x512"
4755
},
4856
{
57+
"filename" : "[email protected]",
4958
"idiom" : "mac",
5059
"scale" : "2x",
5160
"size" : "512x512"
Loading
Loading
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "ToolbarItemIcon.pdf",
5+
"idiom" : "mac"
6+
},
7+
{
8+
"appearances" : [
9+
{
10+
"appearance" : "luminosity",
11+
"value" : "dark"
12+
}
13+
],
14+
"filename" : "ToolbarItemIcon_white.pdf",
15+
"idiom" : "mac"
16+
}
17+
],
18+
"info" : {
19+
"author" : "xcode",
20+
"version" : 1
21+
},
22+
"properties" : {
23+
"preserves-vector-representation" : true
24+
}
25+
}
Binary file not shown.
Binary file not shown.

Bitwarden/Bitwarden.entitlements

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5-
<key>com.apple.security.app-sandbox</key>
6-
<true/>
7-
<key>com.apple.security.files.user-selected.read-only</key>
8-
<true/>
5+
<key>com.apple.security.app-sandbox</key>
6+
<true/>
7+
<key>com.apple.security.files.user-selected.read-only</key>
8+
<true/>
9+
<key>com.apple.security.network.client</key>
10+
<true/>
911
</dict>
1012
</plist>

0 commit comments

Comments
 (0)