{"action":"created","comment":{"url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/comments/60547934","id":60547934,"diff_hunk":"@@ -0,0 +1,101 @@\n+// Copyright (c) Microsoft Corporation.\n+// All rights reserved.\n+//\n+// This code is licensed under the MIT License.\n+//\n+// Permission is hereby granted, free of charge, to any person obtaining a copy\n+// of this software and associated documentation files(the \"Software\"), to deal\n+// in the Software without restriction, including without limitation the rights\n+// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell\n+// copies of the Software, and to permit persons to whom the Software is\n+// furnished to do so, subject to the following conditions :\n+//\n+// The above copyright notice and this permission notice shall be included in\n+// all copies or substantial portions of the Software.\n+//\n+// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n+// THE SOFTWARE.\n+\n+package com.microsoft.aad.adal;\n+\n+import java.util.Map;\n+\n+/**\n+ * Interface that provides ability to client application\n+ * send telemetry events to server\n+ *\n+ * In order to send ADAL instrumentation events to any instrumentation service\n+ * client application needs to implement IEventListener interface\n+ * and set it for ClientAnalytics\n+ * (@use ClientAnalytics.getInstance().setEventListener)\n+ */\n+public class ClientAnalytics {\n+\n+    private IEventListener mEventListener;\n+\n+    /**\n+     * Empty constructor, use ClientAnalytics.getInstance()\n+     */\n+    private ClientAnalytics() {\n+    }\n+\n+    /**\n+     * @return event logger\n+     */\n+    public static ClientAnalytics getInstance() {\n+        return InstanceHolder.sInstance;\n+    }\n+\n+    /**\n+     * Set custom event listener.\n+     * @param eventListener client implementation of instrumentation event logger\n+     */\n+    public void setEventListener(IEventListener eventListener) {\n+        mEventListener = eventListener;\n+    }\n+\n+    /**\n+     * send event to listener\n+     * @param eventName\n+     * @param properties\n+     */\n+    static void logEvent(final String eventName, Map<String, String> properties) {\n+        InstanceHolder.sInstance.log(eventName, properties);\n+    }\n+\n+    /**\n+     * if there is event listener set send event to listener\n+     * @param eventName\n+     * @param properties\n+     */\n+    private void log(final String eventName, Map<String, String> properties) {\n+        if (mEventListener != null) {\n+            mEventListener.logEvent(eventName, properties);\n+        }\n+    }\n+\n+    /**\n+     * Event listener interface\n+     */\n+    public interface IEventListener {\n+\n+        /**\n+         * Sends event info to server\n+         * @param eventName specified name of event that appears of server\n+         * @param properties set of metrics that classifies this event\n+         */\n+        void logEvent(final String eventName, Map<String, String> properties);","path":"src/src/com/microsoft/aad/adal/ClientAnalytics.java","position":92,"original_position":92,"commit_id":"c83705b0be4bbafee16fd492592296461572c836","original_commit_id":"c83705b0be4bbafee16fd492592296461572c836","user":{"login":"agamemnum","id":9207562,"avatar_url":"https://avatars.githubusercontent.com/u/9207562?v=3","gravatar_id":"","url":"https://api.github.com/users/agamemnum","html_url":"https://github.com/agamemnum","followers_url":"https://api.github.com/users/agamemnum/followers","following_url":"https://api.github.com/users/agamemnum/following{/other_user}","gists_url":"https://api.github.com/users/agamemnum/gists{/gist_id}","starred_url":"https://api.github.com/users/agamemnum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agamemnum/subscriptions","organizations_url":"https://api.github.com/users/agamemnum/orgs","repos_url":"https://api.github.com/users/agamemnum/repos","events_url":"https://api.github.com/users/agamemnum/events{/privacy}","received_events_url":"https://api.github.com/users/agamemnum/received_events","type":"User","site_admin":false},"body":"why string is final, but Map isn't :-) both final?","created_at":"2016-04-21T09:05:20Z","updated_at":"2016-04-21T09:05:20Z","html_url":"https://github.com/AzureAD/azure-activedirectory-library-for-android/pull/598#discussion_r60547934","pull_request_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/598","_links":{"self":{"href":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/comments/60547934"},"html":{"href":"https://github.com/AzureAD/azure-activedirectory-library-for-android/pull/598#discussion_r60547934"},"pull_request":{"href":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/598"}}},"pull_request":{"url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/598","id":67142449,"html_url":"https://github.com/AzureAD/azure-activedirectory-library-for-android/pull/598","diff_url":"https://github.com/AzureAD/azure-activedirectory-library-for-android/pull/598.diff","patch_url":"https://github.com/AzureAD/azure-activedirectory-library-for-android/pull/598.patch","issue_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/issues/598","number":598,"state":"open","locked":false,"title":"Provide interface for telemetry events","user":{"login":"imakhalova","id":15003397,"avatar_url":"https://avatars.githubusercontent.com/u/15003397?v=3","gravatar_id":"","url":"https://api.github.com/users/imakhalova","html_url":"https://github.com/imakhalova","followers_url":"https://api.github.com/users/imakhalova/followers","following_url":"https://api.github.com/users/imakhalova/following{/other_user}","gists_url":"https://api.github.com/users/imakhalova/gists{/gist_id}","starred_url":"https://api.github.com/users/imakhalova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imakhalova/subscriptions","organizations_url":"https://api.github.com/users/imakhalova/orgs","repos_url":"https://api.github.com/users/imakhalova/repos","events_url":"https://api.github.com/users/imakhalova/events{/privacy}","received_events_url":"https://api.github.com/users/imakhalova/received_events","type":"User","site_admin":false},"body":"Added interface IEventListener which needs to be implemented by consumer application which allows to send events to server (whatever client analytics used)","created_at":"2016-04-20T07:51:49Z","updated_at":"2016-04-21T09:05:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"213f41543f9bf68efbaec7f35ae8fce6b24f0735","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/598/commits","review_comments_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/598/comments","review_comment_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/issues/598/comments","statuses_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/statuses/c83705b0be4bbafee16fd492592296461572c836","head":{"label":"imakhalova:telemetry","ref":"telemetry","sha":"c83705b0be4bbafee16fd492592296461572c836","user":{"login":"imakhalova","id":15003397,"avatar_url":"https://avatars.githubusercontent.com/u/15003397?v=3","gravatar_id":"","url":"https://api.github.com/users/imakhalova","html_url":"https://github.com/imakhalova","followers_url":"https://api.github.com/users/imakhalova/followers","following_url":"https://api.github.com/users/imakhalova/following{/other_user}","gists_url":"https://api.github.com/users/imakhalova/gists{/gist_id}","starred_url":"https://api.github.com/users/imakhalova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imakhalova/subscriptions","organizations_url":"https://api.github.com/users/imakhalova/orgs","repos_url":"https://api.github.com/users/imakhalova/repos","events_url":"https://api.github.com/users/imakhalova/events{/privacy}","received_events_url":"https://api.github.com/users/imakhalova/received_events","type":"User","site_admin":false},"repo":{"id":51237079,"name":"azure-activedirectory-library-for-android","full_name":"imakhalova/azure-activedirectory-library-for-android","owner":{"login":"imakhalova","id":15003397,"avatar_url":"https://avatars.githubusercontent.com/u/15003397?v=3","gravatar_id":"","url":"https://api.github.com/users/imakhalova","html_url":"https://github.com/imakhalova","followers_url":"https://api.github.com/users/imakhalova/followers","following_url":"https://api.github.com/users/imakhalova/following{/other_user}","gists_url":"https://api.github.com/users/imakhalova/gists{/gist_id}","starred_url":"https://api.github.com/users/imakhalova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imakhalova/subscriptions","organizations_url":"https://api.github.com/users/imakhalova/orgs","repos_url":"https://api.github.com/users/imakhalova/repos","events_url":"https://api.github.com/users/imakhalova/events{/privacy}","received_events_url":"https://api.github.com/users/imakhalova/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/imakhalova/azure-activedirectory-library-for-android","description":"The ADAL SDK for Android gives you the ability to add support for Work Accounts to your application with just a few lines of additional code. This SDK gives your application the full functionality of Microsoft Azure AD, including industry standard protocol support for OAuth2, Web API integration with user level consent, and two factor authentication support.","fork":true,"url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android","forks_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/forks","keys_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/teams","hooks_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/hooks","issue_events_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/issues/events{/number}","events_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/events","assignees_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/assignees{/user}","branches_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/branches{/branch}","tags_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/tags","blobs_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/statuses/{sha}","languages_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/languages","stargazers_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/stargazers","contributors_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/contributors","subscribers_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/subscribers","subscription_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/subscription","commits_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/contents/{+path}","compare_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/merges","archive_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/downloads","issues_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/issues{/number}","pulls_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/pulls{/number}","milestones_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/milestones{/number}","notifications_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/labels{/name}","releases_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/releases{/id}","deployments_url":"https://api.github.com/repos/imakhalova/azure-activedirectory-library-for-android/deployments","created_at":"2016-02-07T05:42:06Z","updated_at":"2016-02-07T05:42:07Z","pushed_at":"2016-04-21T07:16:16Z","git_url":"git://github.com/imakhalova/azure-activedirectory-library-for-android.git","ssh_url":"git@github.com:imakhalova/azure-activedirectory-library-for-android.git","clone_url":"https://github.com/imakhalova/azure-activedirectory-library-for-android.git","svn_url":"https://github.com/imakhalova/azure-activedirectory-library-for-android","homepage":"http://www.windowsazure.com/en-us/services/active-directory/","size":9969,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"AzureAD:dev","ref":"dev","sha":"05fd8dfcb7254b3e8caf93a55a34e5d0d60546f8","user":{"login":"AzureAD","id":2966316,"avatar_url":"https://avatars.githubusercontent.com/u/2966316?v=3","gravatar_id":"","url":"https://api.github.com/users/AzureAD","html_url":"https://github.com/AzureAD","followers_url":"https://api.github.com/users/AzureAD/followers","following_url":"https://api.github.com/users/AzureAD/following{/other_user}","gists_url":"https://api.github.com/users/AzureAD/gists{/gist_id}","starred_url":"https://api.github.com/users/AzureAD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AzureAD/subscriptions","organizations_url":"https://api.github.com/users/AzureAD/orgs","repos_url":"https://api.github.com/users/AzureAD/repos","events_url":"https://api.github.com/users/AzureAD/events{/privacy}","received_events_url":"https://api.github.com/users/AzureAD/received_events","type":"Organization","site_admin":false},"repo":{"id":14703238,"name":"azure-activedirectory-library-for-android","full_name":"AzureAD/azure-activedirectory-library-for-android","owner":{"login":"AzureAD","id":2966316,"avatar_url":"https://avatars.githubusercontent.com/u/2966316?v=3","gravatar_id":"","url":"https://api.github.com/users/AzureAD","html_url":"https://github.com/AzureAD","followers_url":"https://api.github.com/users/AzureAD/followers","following_url":"https://api.github.com/users/AzureAD/following{/other_user}","gists_url":"https://api.github.com/users/AzureAD/gists{/gist_id}","starred_url":"https://api.github.com/users/AzureAD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AzureAD/subscriptions","organizations_url":"https://api.github.com/users/AzureAD/orgs","repos_url":"https://api.github.com/users/AzureAD/repos","events_url":"https://api.github.com/users/AzureAD/events{/privacy}","received_events_url":"https://api.github.com/users/AzureAD/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AzureAD/azure-activedirectory-library-for-android","description":"The ADAL SDK for Android gives you the ability to add support for Work Accounts to your application with just a few lines of additional code. This SDK gives your application the full functionality of Microsoft Azure AD, including industry standard protocol support for OAuth2, Web API integration with user level consent, and two factor authentication support.","fork":false,"url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android","forks_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/forks","keys_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/teams","hooks_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/hooks","issue_events_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/issues/events{/number}","events_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/events","assignees_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/assignees{/user}","branches_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/branches{/branch}","tags_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/tags","blobs_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/statuses/{sha}","languages_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/languages","stargazers_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/stargazers","contributors_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/contributors","subscribers_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/subscribers","subscription_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/subscription","commits_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/contents/{+path}","compare_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/merges","archive_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/downloads","issues_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/issues{/number}","pulls_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls{/number}","milestones_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/milestones{/number}","notifications_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/labels{/name}","releases_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/releases{/id}","deployments_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/deployments","created_at":"2013-11-26T00:59:05Z","updated_at":"2016-04-20T01:30:50Z","pushed_at":"2016-04-21T07:16:16Z","git_url":"git://github.com/AzureAD/azure-activedirectory-library-for-android.git","ssh_url":"git@github.com:AzureAD/azure-activedirectory-library-for-android.git","clone_url":"https://github.com/AzureAD/azure-activedirectory-library-for-android.git","svn_url":"https://github.com/AzureAD/azure-activedirectory-library-for-android","homepage":"http://www.windowsazure.com/en-us/services/active-directory/","size":24666,"stargazers_count":63,"watchers_count":63,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":50,"mirror_url":null,"open_issues_count":76,"forks":50,"open_issues":76,"watchers":63,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/598"},"html":{"href":"https://github.com/AzureAD/azure-activedirectory-library-for-android/pull/598"},"issue":{"href":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/issues/598"},"comments":{"href":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/issues/598/comments"},"review_comments":{"href":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/598/comments"},"review_comment":{"href":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/598/commits"},"statuses":{"href":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/statuses/c83705b0be4bbafee16fd492592296461572c836"}}}}