Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdbd3eaf

Browse files
committed
check token expiry on menu bar open
1 parent5362743 commitdbd3eaf

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

‎Coder Desktop/Coder Desktop/Coder_DesktopApp.swift

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,21 @@ class AppDelegate: NSObject, NSApplicationDelegate {
3737
}
3838

3939
func applicationDidFinishLaunching(_:Notification){
40-
menuBar=.init(menuBarExtra:FluidMenuBarExtra(title:"Coder Desktop", image:"MenuBarIcon"){
41-
VPNMenu<CoderVPNService>().frame(width:256)
42-
.environmentObject(self.vpn)
43-
.environmentObject(self.state)
44-
})
40+
menuBar=.init(menuBarExtra:FluidMenuBarExtra(
41+
title:"Coder Desktop",
42+
image:"MenuBarIcon",
43+
onAppear:{
44+
// If the VPN is enabled, it's likely the token isn't expired
45+
guard case.disabled=self.vpn.state,self.state.hasSessionelse{return}
46+
Task{@MainActorin
47+
awaitself.state.handleTokenExpiry()
48+
}
49+
}, content:{
50+
VPNMenu<CoderVPNService>().frame(width:256)
51+
.environmentObject(self.vpn)
52+
.environmentObject(self.state)
53+
}
54+
))
4555
// Subscribe to system VPN updates
4656
NotificationCenter.default.addObserver(
4757
self,
@@ -56,10 +66,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
5666
state.reconfigure()
5767
}
5868
}
59-
// Sign out if token is expired
60-
Task{@MainActorin
61-
await state.handleTokenExpiry()
62-
}
6369
}
6470

6571
// This function MUST eventually call `NSApp.reply(toApplicationShouldTerminate: true)`

‎Coder Desktop/project.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,12 @@ packages:
8989
url:https://github.com/SimplyDanny/SwiftLintPlugins
9090
from:0.57.1
9191
FluidMenuBarExtra:
92-
# Forked so we can dynamically update the menu bar icon.
92+
# Forked to:
93+
# - dDnamically update the menu bar icon
94+
# - Set onAppear/disappear handlers.
9395
# The upstream repo has a purposefully limited API
9496
url:https://github.com/coder/fluid-menu-bar-extra
95-
revision:020be37
97+
revision:96a861a
9698
KeychainAccess:
9799
url:https://github.com/kishikawakatsumi/KeychainAccess
98100
branch:e0c7eebc5a4465a3c4680764f26b7a61f567cdaf

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp