Clear window attention if all messages are marked read
Fixes #758 // FREEBIE
This commit is contained in:
		
					parent
					
						
							
								0cd7f84a05
							
						
					
				
			
			
				commit
				
					
						72dd93aa02
					
				
			
		
					 2 changed files with 7 additions and 1 deletions
				
			
		| 
						 | 
					@ -62,6 +62,9 @@
 | 
				
			||||||
            storage.put("unreadCount", newUnreadCount);
 | 
					            storage.put("unreadCount", newUnreadCount);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            setUnreadCount(newUnreadCount);
 | 
					            setUnreadCount(newUnreadCount);
 | 
				
			||||||
 | 
					            if (newUnreadCount === 0) {
 | 
				
			||||||
 | 
					                window.clearAttention();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }))();
 | 
					    }))();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,6 +22,9 @@
 | 
				
			||||||
            extension.windows.drawAttention(inboxWindowId);
 | 
					            extension.windows.drawAttention(inboxWindowId);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					    window.clearAttention = function() {
 | 
				
			||||||
 | 
					        extension.windows.clearAttention(inboxWindowId);
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Inbox window controller */
 | 
					    /* Inbox window controller */
 | 
				
			||||||
    var inboxFocused = false;
 | 
					    var inboxFocused = false;
 | 
				
			||||||
| 
						 | 
					@ -58,7 +61,7 @@
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
                appWindow.contentWindow.addEventListener('focus', function() {
 | 
					                appWindow.contentWindow.addEventListener('focus', function() {
 | 
				
			||||||
                    inboxFocused = true;
 | 
					                    inboxFocused = true;
 | 
				
			||||||
                    extension.windows.clearAttention(inboxWindowId);
 | 
					                    clearAttention();
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // close the inbox if background.html is refreshed
 | 
					                // close the inbox if background.html is refreshed
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue