Skip to content

Commit e4f31d1

Browse files
committed
fix: Notification bar progress indicator anomaly
log: Incorrect replaces_id used when sending the “Received Successfully” notification upon completion (or failure to use the ID from the progress bar notification), causing the 99% progress notification to remain unchanged and persist on the desktop. When the status changes to complete, first read the current `a.notifyID` within the lock and save it as `currentID`. Then use this `currentID` as the `replaces_id` to send the 100% completion notification. This ensures the completion notification replaces the last progress notification (including the 99% progress notification). pms: bug-351711
1 parent 6225167 commit e4f31d1

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

bluetooth1/obex_agent.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,9 @@ func (a *obexAgent) receiveProgress(transfer *transferObj) {
312312
// 传送完成,移动到下载目录
313313
realFileName := moveTempFile(oriFilepath, filepath.Join(receiveBaseDir, transfer.oriFilename))
314314

315-
newID := a.notifyProgress(a.notify, a.notifyID, realFileName, transfer.deviceName, 100)
315+
// Use the last progress notification id as replaces_id so
316+
// the progress bubble (e.g. 99%) won't linger after completion.
317+
newID := a.notifyProgress(a.notify, currentID, realFileName, transfer.deviceName, 100)
316318

317319
notifyMu.Lock()
318320
a.notifyID = newID
@@ -455,12 +457,11 @@ func (a *obexAgent) notifyProgress(notify notifications.Notifications, replaceID
455457
logger.Warning("failed to send notify:", err)
456458
}
457459
} else {
458-
notify.CloseNotification(0, replaceID)
459460
actions = []string{"_view", gettext.Tr("View")}
460461
hints := map[string]dbus.Variant{"x-deepin-action-_view": dbus.MakeVariant("dde-file-manager,--show-item," + filename)}
461462
notifyID, err = notify.Notify(0,
462463
gettext.Tr("dde-control-center"),
463-
0,
464+
replaceID,
464465
notifyIconBluetoothConnected,
465466
fmt.Sprintf(gettext.Tr("You have received files from %q successfully"), device),
466467
gettext.Tr("Done"),
@@ -485,10 +486,9 @@ func (a *obexAgent) notifyFailed(notify notifications.Notifications, replaceID u
485486
body = gettext.Tr("Bluetooth connection failed")
486487
}
487488

488-
notify.CloseNotification(0, replaceID)
489489
notifyID, err := notify.Notify(0,
490490
gettext.Tr("dde-control-center"),
491-
0,
491+
replaceID,
492492
notifyIconBluetoothConnectFailed,
493493
summary,
494494
body,

gesture1/gesture_action.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ func (m *Manager) doHandle4Or5FingersSwipeDown() error {
109109
}
110110

111111
func (m *Manager) doMaximizeActiveWindow() error {
112-
return m.wm.MaximizeActiveWindow(0)
112+
return m.wm.PerformAction(0, wmActionToggleMaximize)
113113
}
114114

115115
func (m *Manager) doUnMaximizeActiveWindow() error {
116-
return m.wm.UnMaximizeActiveWindow(0)
116+
return m.wm.PerformAction(0, wmActionToggleMaximize)
117117
}
118118

119119
func (m *Manager) doMinimize() error {

0 commit comments

Comments
 (0)