Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ gitimoji.xcodeproj/xcuserdata/
timeline.xctimeline
playground.xcworkspace
.build/
gitimoji.xcodeproj/project.xcworkspace/xcuserdata
1 change: 1 addition & 0 deletions gitimoji/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ enum Constants {
enum DefaultKey: String {
case gitmojiFetchURL
case copyEmoji
case closePopoverAfterCopy
}

enum Link {
Expand Down
6 changes: 6 additions & 0 deletions gitimoji/Views/Components/EmojiRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ struct EmojiRow: View {
@AppStorage(Constants.DefaultKey.copyEmoji.rawValue)
private var copyEmoji = false

@AppStorage(Constants.DefaultKey.closePopoverAfterCopy.rawValue)
private var closePopoverAfterCopy = false

var body: some View {
Button(action: {
// copy to clipboard
Expand Down Expand Up @@ -55,6 +58,9 @@ struct EmojiRow: View {
Timer.scheduledTimer(withTimeInterval: 1.0, repeats: false) { timer in
withAnimation {
self.recentlyCopied = false
if closePopoverAfterCopy {
NSApp.sendAction(#selector(AppDelegate.togglePopover), to: nil, from: nil)
}
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions gitimoji/Views/Settings/GeneralSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ struct GeneralSettingsView: View {
@AppStorage(Constants.DefaultKey.copyEmoji.rawValue)
private var copyEmoji = false

@AppStorage(Constants.DefaultKey.closePopoverAfterCopy.rawValue)
private var closePopoverAfterCopy = false

@AppStorage(Constants.DefaultKey.gitmojiFetchURL.rawValue)
private var url: URL = URL(string: "https://raw.githubusercontent.com/carloscuesta/gitmoji/master/packages/gitmojis/src/gitmojis.json")!

Expand All @@ -31,6 +34,13 @@ struct GeneralSettingsView: View {
Text("Emoji eg. 🎉").tag(true)
}

HStack {
Spacer()
Toggle(isOn: $closePopoverAfterCopy) {
Text("Close popover automatically after copy")
}
}

HStack {
Text("Toggle App Window")
Spacer()
Expand Down