Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add view my profile page menu #21

Merged
merged 2 commits into from
Apr 30, 2022
Merged
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
14 changes: 13 additions & 1 deletion Sources/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,19 @@ class AppDelegate: NSObject, NSApplicationDelegate {
$0.keyEquivalent = "s"
$0.tag = 7
}

private let goalMenuItem = NSMenuItem().then {
$0.title = Localized.setGoal
$0.action = #selector(onChangeGoalClick)
$0.keyEquivalent = "g"
$0.tag = 8
}

private let viewMyProfileItem = NSMenuItem().then {
$0.title = Localized.viewMyProfile
$0.action = #selector(viewMyProfileClick)
$0.tag = 10
}


func applicationDidFinishLaunching(_: Notification) {
Expand All @@ -113,6 +119,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {

menu.addItem(.separator())
menu.addItem(userMenuItem)
menu.addItem(viewMyProfileItem)
menu.addItem(.separator())
menu.addItem(helpMenuItem)
menu.addItem(.separator())
Expand Down Expand Up @@ -279,6 +286,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
NSWorkspace.shared.open(url)
}

@objc func viewMyProfileClick() {
let url = URL(string: "https://github.com/" + (UserDefaults.standard.string(forKey: Consts.usernameDefaultKey) ?? ""))!
NSWorkspace.shared.open(url)
}

@objc func onSettingClick() {
showSettingAlert()
}
Expand Down
1 change: 1 addition & 0 deletions Sources/Consts/Localized.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ enum Localized {
static let goalInformation = NSLocalizedString("goal_information", comment: "Enter your GitHub username. We’ll fetch the number of contributions.")
static let setting = NSLocalizedString("setting", comment: "Preferences")
static let settingTitle = NSLocalizedString("setting_title", comment: "Preferences Title")
static let viewMyProfile = NSLocalizedString("view_my_profile", comment: "View my profile")

static let streakFristStage = NSLocalizedString("streak_first_stage", comment: "streak stage 1")
static let streakSecondStage = NSLocalizedString("streak_second_stage", comment: "streak stage 2")
Expand Down
1 change: 1 addition & 0 deletions Supporting FIles/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

"wellcome_user_message" = "👋 Hello, @${username} ${withFriend}";
"with_friend" = "\nwith @${username}";
"view_my_profile" = "🏡 View my profile";
"refresh" = "⏳ Refresh";
"change_username" = "🪄 Change username";
"change_friend_username" = "🤝 Change Friend username";
Expand Down
1 change: 1 addition & 0 deletions Supporting FIles/ko.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

"wellcome_user_message" = "👋 안녕, @${username} ${withFriend}";
"with_friend" = "\n @${username}와 함께";
"view_my_profile" = "🏡 내 프로필 보기";
"refresh" = "⏳ 새로고침";
"change_username" = "🪄 아이디 변경";
"change_friend_username" = "🤝 친구 아이디 변경";
Expand Down