~ubuntu-push-hackers/ubuntu-push/vivid-overlay

« back to all changes in this revision

Viewing changes to client/service/postal.go

  • Committer: CI Train Bot
  • Author(s): jonas-drange
  • Date: 2015-11-03 13:40:34 UTC
  • mfrom: (91.277.4 automatic)
  • Revision ID: ci-train-bot@canonical.com-20151103134034-0dkcfkhgljxmsikm
[postal] make sure we don't gobble notifications when screen is locked, even if the app getting notified is focused. Fixes: #1469398

Show diffs side-by-side

added added

removed removed

Lines of Context:
428
428
                return false
429
429
        }
430
430
 
 
431
        locked := svc.unityGreeter.IsActive()
 
432
        focused := svc.windowStack.IsAppFocused(app)
 
433
 
431
434
        if output.Notification.Card != nil && output.Notification.Card.Popup {
432
 
                if svc.unityGreeter.IsActive() {
 
435
                if locked {
433
436
                        // Screen is locked, ensure popup is false
434
437
                        output.Notification.Card.Popup = false
435
438
                }
436
439
        }
437
440
 
438
 
        if !svc.windowStack.IsAppFocused(app) {
439
 
                if isBlacklisted(app) {
440
 
                        svc.Log.Debugf("notification skipped (except emblem counter) because app is blacklisted")
441
 
                        return svc.emblemCounter.Present(app, nid, output.Notification)
442
 
                }
443
 
 
444
 
                b := false
445
 
                for _, p := range svc.Presenters {
446
 
                        // we don't want this to shortcut :)
447
 
                        b = p.Present(app, nid, output.Notification) || b
448
 
                }
449
 
                return b
450
 
        } else {
 
441
        if !locked && focused {
451
442
                svc.Log.Debugf("notification skipped because app is focused.")
452
443
                return false
453
444
        }
 
445
 
 
446
        if isBlacklisted(app) {
 
447
                svc.Log.Debugf("notification skipped (except emblem counter) because app is blacklisted")
 
448
                return svc.emblemCounter.Present(app, nid, output.Notification)
 
449
        }
 
450
 
 
451
        b := false
 
452
        for _, p := range svc.Presenters {
 
453
                // we don't want this to shortcut :)
 
454
                b = p.Present(app, nid, output.Notification) || b
 
455
        }
 
456
        return b
454
457
}