File tree 2 files changed +19
-11
lines changed
2 files changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -37,11 +37,21 @@ class AppDelegate: NSObject, NSApplicationDelegate {
37
37
}
38
38
39
39
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. hasSession else { return }
46
+ Task { @MainActor in
47
+ await self . state. handleTokenExpiry ( )
48
+ }
49
+ } , content: {
50
+ VPNMenu < CoderVPNService > ( ) . frame ( width: 256 )
51
+ . environmentObject ( self . vpn)
52
+ . environmentObject ( self . state)
53
+ }
54
+ ) )
45
55
// Subscribe to system VPN updates
46
56
NotificationCenter . default. addObserver (
47
57
self ,
@@ -56,10 +66,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
56
66
state. reconfigure ( )
57
67
}
58
68
}
59
- // Sign out if token is expired
60
- Task { @MainActor in
61
- await state. handleTokenExpiry ( )
62
- }
63
69
}
64
70
65
71
// This function MUST eventually call `NSApp.reply(toApplicationShouldTerminate: true)`
Original file line number Diff line number Diff line change @@ -89,10 +89,12 @@ packages:
89
89
url : https://github.com/SimplyDanny/SwiftLintPlugins
90
90
from : 0.57.1
91
91
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.
93
95
# The upstream repo has a purposefully limited API
94
96
url : https://github.com/coder/fluid-menu-bar-extra
95
- revision : 020be37
97
+ revision : 96a861a
96
98
KeychainAccess :
97
99
url : https://github.com/kishikawakatsumi/KeychainAccess
98
100
branch : e0c7eebc5a4465a3c4680764f26b7a61f567cdaf
You can’t perform that action at this time.
0 commit comments