mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-16 07:16:38 +00:00
[client] Fix Linux UI flickering on state updates (#4886)
This commit is contained in:
@@ -312,6 +312,8 @@ type serviceClient struct {
|
|||||||
daemonVersion string
|
daemonVersion string
|
||||||
updateIndicationLock sync.Mutex
|
updateIndicationLock sync.Mutex
|
||||||
isUpdateIconActive bool
|
isUpdateIconActive bool
|
||||||
|
settingsEnabled bool
|
||||||
|
profilesEnabled bool
|
||||||
showNetworks bool
|
showNetworks bool
|
||||||
wNetworks fyne.Window
|
wNetworks fyne.Window
|
||||||
wProfiles fyne.Window
|
wProfiles fyne.Window
|
||||||
@@ -907,7 +909,7 @@ func (s *serviceClient) updateStatus() error {
|
|||||||
var systrayIconState bool
|
var systrayIconState bool
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case status.Status == string(internal.StatusConnected):
|
case status.Status == string(internal.StatusConnected) && !s.mUp.Disabled():
|
||||||
s.connected = true
|
s.connected = true
|
||||||
s.sendNotification = true
|
s.sendNotification = true
|
||||||
if s.isUpdateIconActive {
|
if s.isUpdateIconActive {
|
||||||
@@ -921,6 +923,7 @@ func (s *serviceClient) updateStatus() error {
|
|||||||
s.mUp.Disable()
|
s.mUp.Disable()
|
||||||
s.mDown.Enable()
|
s.mDown.Enable()
|
||||||
s.mNetworks.Enable()
|
s.mNetworks.Enable()
|
||||||
|
s.mExitNode.Enable()
|
||||||
go s.updateExitNodes()
|
go s.updateExitNodes()
|
||||||
systrayIconState = true
|
systrayIconState = true
|
||||||
case status.Status == string(internal.StatusConnecting):
|
case status.Status == string(internal.StatusConnecting):
|
||||||
@@ -1274,19 +1277,22 @@ func (s *serviceClient) checkAndUpdateFeatures() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s.updateIndicationLock.Lock()
|
||||||
|
defer s.updateIndicationLock.Unlock()
|
||||||
|
|
||||||
// Update settings menu based on current features
|
// Update settings menu based on current features
|
||||||
if features != nil && features.DisableUpdateSettings {
|
settingsEnabled := features == nil || !features.DisableUpdateSettings
|
||||||
s.setSettingsEnabled(false)
|
if s.settingsEnabled != settingsEnabled {
|
||||||
} else {
|
s.settingsEnabled = settingsEnabled
|
||||||
s.setSettingsEnabled(true)
|
s.setSettingsEnabled(settingsEnabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update profile menu based on current features
|
// Update profile menu based on current features
|
||||||
if s.mProfile != nil {
|
if s.mProfile != nil {
|
||||||
if features != nil && features.DisableProfiles {
|
profilesEnabled := features == nil || !features.DisableProfiles
|
||||||
s.mProfile.setEnabled(false)
|
if s.profilesEnabled != profilesEnabled {
|
||||||
} else {
|
s.profilesEnabled = profilesEnabled
|
||||||
s.mProfile.setEnabled(true)
|
s.mProfile.setEnabled(profilesEnabled)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user