{"action":"created","comment":{"url":"https://api.github.com/repos/ppy/osu/pulls/comments/100485739","pull_request_review_id":21193938,"id":100485739,"diff_hunk":"@@ -0,0 +1,111 @@\n+﻿// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.\r\n+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE\r\n+\r\n+using System.Linq;\r\n+using osu.Framework.Allocation;\r\n+using osu.Framework.Extensions.IEnumerableExtensions;\r\n+using osu.Framework.Graphics;\r\n+using osu.Framework.Graphics.Containers;\r\n+using osu.Framework.Graphics.Primitives;\r\n+using osu.Framework.Graphics.Sprites;\r\n+using osu.Framework.Graphics.Transformations;\r\n+using osu.Game.Graphics;\r\n+using osu.Game.Overlays.Notifications;\r\n+using OpenTK.Graphics;\r\n+\r\n+namespace osu.Game.Overlays\r\n+{\r\n+    public class NotificationManager : FocusedOverlayContainer\r\n+    {\r\n+        private const float width = 320;\r\n+\r\n+        public const float TRANSITION_LENGTH = 600;\r\n+\r\n+        private ScrollContainer scrollContainer;\r\n+        private FlowContainer<NotificationSection> sections;\r\n+\r\n+        [BackgroundDependencyLoader(permitNulls: true)]\r\n+        private void load(OsuColour colours)\r\n+        {\r\n+            Width = width;\r\n+            RelativeSizeAxes = Axes.Y;\r\n+\r\n+            Children = new Drawable[]\r\n+            {\r\n+                new Box\r\n+                {\r\n+                    RelativeSizeAxes = Axes.Both,\r\n+                    Colour = Color4.Black,\r\n+                    Alpha = 0.6f,\r\n+                },\r\n+                scrollContainer = new ScrollContainer()\r\n+                {\r\n+                    Margin = new MarginPadding { Top = Toolbar.Toolbar.HEIGHT },\r\n+                    Children = new[]\r\n+                    {\r\n+                        sections = new FlowContainer<NotificationSection>\r\n+                        {\r\n+                            Direction = FlowDirection.VerticalOnly,\r\n+                            AutoSizeAxes = Axes.Y,\r\n+                            RelativeSizeAxes = Axes.X,\r\n+                            Children = new []\r\n+                            {\r\n+                                new NotificationSection\r\n+                                {\r\n+                                    Title = @\"Notifications\",\r\n+                                    ClearText = @\"Clear All\",\r\n+                                    AcceptTypes = new [] { typeof(SimpleNotification) },\r\n+                                },\r\n+                                new NotificationSection\r\n+                                {\r\n+                                    Title = @\"Running Tasks\",\r\n+                                    ClearText = @\"Cancel All\",\r\n+                                    AcceptTypes = new [] { typeof(ProgressNotification) },\r\n+                                },\r\n+                            }\r\n+                        }\r\n+                    }\r\n+                }\r\n+            };\r\n+        }\r\n+\r\n+        int runningDepth = 0;\r\n+\r\n+        public void Post(Notification notification)\r\n+        {\r\n+            ++runningDepth;\r\n+            notification.Depth = notification.DisplayOnTop ? runningDepth : -runningDepth;\r\n+\r\n+            var hasCompletionTarget = notification as IHasCompletionTarget;\r\n+            if (hasCompletionTarget != null)\r\n+                hasCompletionTarget.CompletionTarget = Post;\r\n+\r\n+            var ourType = notification.GetType();\r\n+            sections.Children.FirstOrDefault(s => s.AcceptTypes.Any(accept => ourType == accept || ourType.IsSubclassOf(accept)))?.Add(notification);\r\n+        }\r\n+\r\n+        protected override void PopIn()\r\n+        {\r\n+            base.PopIn();\r\n+\r\n+            scrollContainer.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint);\r\n+            MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint);\r\n+            FadeTo(1, TRANSITION_LENGTH / 2);\r\n+        }\r\n+\r\n+        private void markAllRead()\r\n+        {\r\n+            sections.Children.ForEach(s => s.MarkAllRead());\r","path":"osu.Game/Overlays/NotificationManager.cs","position":98,"original_position":98,"commit_id":"8ec927899f3d04dfb0791b0d6c69ef490d5a21f3","original_commit_id":"8ec927899f3d04dfb0791b0d6c69ef490d5a21f3","user":{"login":"peppy","id":191335,"avatar_url":"https://avatars.githubusercontent.com/u/191335?v=3","gravatar_id":"","url":"https://api.github.com/users/peppy","html_url":"https://github.com/peppy","followers_url":"https://api.github.com/users/peppy/followers","following_url":"https://api.github.com/users/peppy/following{/other_user}","gists_url":"https://api.github.com/users/peppy/gists{/gist_id}","starred_url":"https://api.github.com/users/peppy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peppy/subscriptions","organizations_url":"https://api.github.com/users/peppy/orgs","repos_url":"https://api.github.com/users/peppy/repos","events_url":"https://api.github.com/users/peppy/events{/privacy}","received_events_url":"https://api.github.com/users/peppy/received_events","type":"User","site_admin":false},"body":"case-by-case. foreach in performance places to avoid delegate allocs (this isn't such a case).","created_at":"2017-02-10T07:53:10Z","updated_at":"2017-02-10T07:53:10Z","html_url":"https://github.com/ppy/osu/pull/344#discussion_r100485739","pull_request_url":"https://api.github.com/repos/ppy/osu/pulls/344","_links":{"self":{"href":"https://api.github.com/repos/ppy/osu/pulls/comments/100485739"},"html":{"href":"https://github.com/ppy/osu/pull/344#discussion_r100485739"},"pull_request":{"href":"https://api.github.com/repos/ppy/osu/pulls/344"}}},"pull_request":{"url":"https://api.github.com/repos/ppy/osu/pulls/344","id":105579029,"html_url":"https://github.com/ppy/osu/pull/344","diff_url":"https://github.com/ppy/osu/pull/344.diff","patch_url":"https://github.com/ppy/osu/pull/344.patch","issue_url":"https://api.github.com/repos/ppy/osu/issues/344","number":344,"state":"open","locked":false,"title":"Implement notifications.","user":{"login":"peppy","id":191335,"avatar_url":"https://avatars.githubusercontent.com/u/191335?v=3","gravatar_id":"","url":"https://api.github.com/users/peppy","html_url":"https://github.com/peppy","followers_url":"https://api.github.com/users/peppy/followers","following_url":"https://api.github.com/users/peppy/following{/other_user}","gists_url":"https://api.github.com/users/peppy/gists{/gist_id}","starred_url":"https://api.github.com/users/peppy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peppy/subscriptions","organizations_url":"https://api.github.com/users/peppy/orgs","repos_url":"https://api.github.com/users/peppy/repos","events_url":"https://api.github.com/users/peppy/events{/privacy}","received_events_url":"https://api.github.com/users/peppy/received_events","type":"User","site_admin":false},"body":"See https://streamable.com/u4zm1","created_at":"2017-02-10T07:31:33Z","updated_at":"2017-02-10T07:53:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8b1255778682d048d62d543033f6038ea79bab9e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ppy/osu/pulls/344/commits","review_comments_url":"https://api.github.com/repos/ppy/osu/pulls/344/comments","review_comment_url":"https://api.github.com/repos/ppy/osu/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ppy/osu/issues/344/comments","statuses_url":"https://api.github.com/repos/ppy/osu/statuses/8ec927899f3d04dfb0791b0d6c69ef490d5a21f3","head":{"label":"peppy:notifications-manager","ref":"notifications-manager","sha":"8ec927899f3d04dfb0791b0d6c69ef490d5a21f3","user":{"login":"peppy","id":191335,"avatar_url":"https://avatars.githubusercontent.com/u/191335?v=3","gravatar_id":"","url":"https://api.github.com/users/peppy","html_url":"https://github.com/peppy","followers_url":"https://api.github.com/users/peppy/followers","following_url":"https://api.github.com/users/peppy/following{/other_user}","gists_url":"https://api.github.com/users/peppy/gists{/gist_id}","starred_url":"https://api.github.com/users/peppy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peppy/subscriptions","organizations_url":"https://api.github.com/users/peppy/orgs","repos_url":"https://api.github.com/users/peppy/repos","events_url":"https://api.github.com/users/peppy/events{/privacy}","received_events_url":"https://api.github.com/users/peppy/received_events","type":"User","site_admin":false},"repo":{"id":66779187,"name":"osu","full_name":"peppy/osu","owner":{"login":"peppy","id":191335,"avatar_url":"https://avatars.githubusercontent.com/u/191335?v=3","gravatar_id":"","url":"https://api.github.com/users/peppy","html_url":"https://github.com/peppy","followers_url":"https://api.github.com/users/peppy/followers","following_url":"https://api.github.com/users/peppy/following{/other_user}","gists_url":"https://api.github.com/users/peppy/gists{/gist_id}","starred_url":"https://api.github.com/users/peppy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peppy/subscriptions","organizations_url":"https://api.github.com/users/peppy/orgs","repos_url":"https://api.github.com/users/peppy/repos","events_url":"https://api.github.com/users/peppy/events{/privacy}","received_events_url":"https://api.github.com/users/peppy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/peppy/osu","description":"rhythm is just a *click* away!","fork":true,"url":"https://api.github.com/repos/peppy/osu","forks_url":"https://api.github.com/repos/peppy/osu/forks","keys_url":"https://api.github.com/repos/peppy/osu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/peppy/osu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/peppy/osu/teams","hooks_url":"https://api.github.com/repos/peppy/osu/hooks","issue_events_url":"https://api.github.com/repos/peppy/osu/issues/events{/number}","events_url":"https://api.github.com/repos/peppy/osu/events","assignees_url":"https://api.github.com/repos/peppy/osu/assignees{/user}","branches_url":"https://api.github.com/repos/peppy/osu/branches{/branch}","tags_url":"https://api.github.com/repos/peppy/osu/tags","blobs_url":"https://api.github.com/repos/peppy/osu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/peppy/osu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/peppy/osu/git/refs{/sha}","trees_url":"https://api.github.com/repos/peppy/osu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/peppy/osu/statuses/{sha}","languages_url":"https://api.github.com/repos/peppy/osu/languages","stargazers_url":"https://api.github.com/repos/peppy/osu/stargazers","contributors_url":"https://api.github.com/repos/peppy/osu/contributors","subscribers_url":"https://api.github.com/repos/peppy/osu/subscribers","subscription_url":"https://api.github.com/repos/peppy/osu/subscription","commits_url":"https://api.github.com/repos/peppy/osu/commits{/sha}","git_commits_url":"https://api.github.com/repos/peppy/osu/git/commits{/sha}","comments_url":"https://api.github.com/repos/peppy/osu/comments{/number}","issue_comment_url":"https://api.github.com/repos/peppy/osu/issues/comments{/number}","contents_url":"https://api.github.com/repos/peppy/osu/contents/{+path}","compare_url":"https://api.github.com/repos/peppy/osu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/peppy/osu/merges","archive_url":"https://api.github.com/repos/peppy/osu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/peppy/osu/downloads","issues_url":"https://api.github.com/repos/peppy/osu/issues{/number}","pulls_url":"https://api.github.com/repos/peppy/osu/pulls{/number}","milestones_url":"https://api.github.com/repos/peppy/osu/milestones{/number}","notifications_url":"https://api.github.com/repos/peppy/osu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/peppy/osu/labels{/name}","releases_url":"https://api.github.com/repos/peppy/osu/releases{/id}","deployments_url":"https://api.github.com/repos/peppy/osu/deployments","created_at":"2016-08-28T16:39:44Z","updated_at":"2016-10-23T07:48:19Z","pushed_at":"2017-02-10T07:30:33Z","git_url":"git://github.com/peppy/osu.git","ssh_url":"git@github.com:peppy/osu.git","clone_url":"https://github.com/peppy/osu.git","svn_url":"https://github.com/peppy/osu","homepage":"https://osu.ppy.sh","size":2173,"stargazers_count":2,"watchers_count":2,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"ppy:master","ref":"master","sha":"c5cf6a69094749a2e307291178be2c7ccdba410a","user":{"login":"ppy","id":995763,"avatar_url":"https://avatars.githubusercontent.com/u/995763?v=3","gravatar_id":"","url":"https://api.github.com/users/ppy","html_url":"https://github.com/ppy","followers_url":"https://api.github.com/users/ppy/followers","following_url":"https://api.github.com/users/ppy/following{/other_user}","gists_url":"https://api.github.com/users/ppy/gists{/gist_id}","starred_url":"https://api.github.com/users/ppy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ppy/subscriptions","organizations_url":"https://api.github.com/users/ppy/orgs","repos_url":"https://api.github.com/users/ppy/repos","events_url":"https://api.github.com/users/ppy/events{/privacy}","received_events_url":"https://api.github.com/users/ppy/received_events","type":"Organization","site_admin":false},"repo":{"id":22456440,"name":"osu","full_name":"ppy/osu","owner":{"login":"ppy","id":995763,"avatar_url":"https://avatars.githubusercontent.com/u/995763?v=3","gravatar_id":"","url":"https://api.github.com/users/ppy","html_url":"https://github.com/ppy","followers_url":"https://api.github.com/users/ppy/followers","following_url":"https://api.github.com/users/ppy/following{/other_user}","gists_url":"https://api.github.com/users/ppy/gists{/gist_id}","starred_url":"https://api.github.com/users/ppy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ppy/subscriptions","organizations_url":"https://api.github.com/users/ppy/orgs","repos_url":"https://api.github.com/users/ppy/repos","events_url":"https://api.github.com/users/ppy/events{/privacy}","received_events_url":"https://api.github.com/users/ppy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ppy/osu","description":"rhythm is just a *click* away!","fork":false,"url":"https://api.github.com/repos/ppy/osu","forks_url":"https://api.github.com/repos/ppy/osu/forks","keys_url":"https://api.github.com/repos/ppy/osu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ppy/osu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ppy/osu/teams","hooks_url":"https://api.github.com/repos/ppy/osu/hooks","issue_events_url":"https://api.github.com/repos/ppy/osu/issues/events{/number}","events_url":"https://api.github.com/repos/ppy/osu/events","assignees_url":"https://api.github.com/repos/ppy/osu/assignees{/user}","branches_url":"https://api.github.com/repos/ppy/osu/branches{/branch}","tags_url":"https://api.github.com/repos/ppy/osu/tags","blobs_url":"https://api.github.com/repos/ppy/osu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ppy/osu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ppy/osu/git/refs{/sha}","trees_url":"https://api.github.com/repos/ppy/osu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ppy/osu/statuses/{sha}","languages_url":"https://api.github.com/repos/ppy/osu/languages","stargazers_url":"https://api.github.com/repos/ppy/osu/stargazers","contributors_url":"https://api.github.com/repos/ppy/osu/contributors","subscribers_url":"https://api.github.com/repos/ppy/osu/subscribers","subscription_url":"https://api.github.com/repos/ppy/osu/subscription","commits_url":"https://api.github.com/repos/ppy/osu/commits{/sha}","git_commits_url":"https://api.github.com/repos/ppy/osu/git/commits{/sha}","comments_url":"https://api.github.com/repos/ppy/osu/comments{/number}","issue_comment_url":"https://api.github.com/repos/ppy/osu/issues/comments{/number}","contents_url":"https://api.github.com/repos/ppy/osu/contents/{+path}","compare_url":"https://api.github.com/repos/ppy/osu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ppy/osu/merges","archive_url":"https://api.github.com/repos/ppy/osu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ppy/osu/downloads","issues_url":"https://api.github.com/repos/ppy/osu/issues{/number}","pulls_url":"https://api.github.com/repos/ppy/osu/pulls{/number}","milestones_url":"https://api.github.com/repos/ppy/osu/milestones{/number}","notifications_url":"https://api.github.com/repos/ppy/osu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ppy/osu/labels{/name}","releases_url":"https://api.github.com/repos/ppy/osu/releases{/id}","deployments_url":"https://api.github.com/repos/ppy/osu/deployments","created_at":"2014-07-31T04:26:30Z","updated_at":"2017-02-09T19:11:56Z","pushed_at":"2017-02-10T07:45:01Z","git_url":"git://github.com/ppy/osu.git","ssh_url":"git@github.com:ppy/osu.git","clone_url":"https://github.com/ppy/osu.git","svn_url":"https://github.com/ppy/osu","homepage":"https://osu.ppy.sh","size":2084,"stargazers_count":649,"watchers_count":649,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":145,"mirror_url":null,"open_issues_count":21,"forks":145,"open_issues":21,"watchers":649,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ppy/osu/pulls/344"},"html":{"href":"https://github.com/ppy/osu/pull/344"},"issue":{"href":"https://api.github.com/repos/ppy/osu/issues/344"},"comments":{"href":"https://api.github.com/repos/ppy/osu/issues/344/comments"},"review_comments":{"href":"https://api.github.com/repos/ppy/osu/pulls/344/comments"},"review_comment":{"href":"https://api.github.com/repos/ppy/osu/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ppy/osu/pulls/344/commits"},"statuses":{"href":"https://api.github.com/repos/ppy/osu/statuses/8ec927899f3d04dfb0791b0d6c69ef490d5a21f3"}}}}
{"actor":{"display_login":"peppy"}}