{"action":"created","comment":{"url":"https://api.github.com/repos/inorichi/tachiyomi/pulls/comments/136557328","pull_request_review_id":60112750,"id":136557328,"diff_hunk":"@@ -0,0 +1,114 @@\n+package eu.kanade.tachiyomi.ui.catalogue.main\n+\n+import android.os.Bundle\n+import eu.kanade.tachiyomi.data.preference.PreferencesHelper\n+import eu.kanade.tachiyomi.data.preference.getOrDefault\n+import eu.kanade.tachiyomi.source.CatalogueSource\n+import eu.kanade.tachiyomi.source.LocalSource\n+import eu.kanade.tachiyomi.source.SourceManager\n+import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter\n+import rx.Observable\n+import rx.Subscription\n+import rx.android.schedulers.AndroidSchedulers\n+import uy.kohesive.injekt.Injekt\n+import uy.kohesive.injekt.api.get\n+\n+/**\n+ * Presenter of [CatalogueMainController]\n+ * Function calls should be done from here. UI calls should be done from the controller.\n+ *\n+ * @param sourceManager manages the different sources.\n+ * @param preferencesHelper manages the database calls.\n+ */\n+class CatalogueMainPresenter(\n+        val sourceManager: SourceManager = Injekt.get(),\n+        private val preferencesHelper: PreferencesHelper = Injekt.get()\n+) : BasePresenter<CatalogueMainController>() {\n+\n+    /**\n+     * Enabled sources.\n+     */\n+    var sources = getEnabledSources()\n+\n+    /**\n+     * Subscription for retrieving enabled sources.\n+     */\n+    private var sourceSubscription: Subscription? = null\n+\n+    /**\n+     * Subscription for retrieving most recent used source.\n+     */\n+    private var recentSourceSubscription: Subscription? = null\n+\n+    override fun onCreate(savedState: Bundle?) {\n+        super.onCreate(savedState)\n+\n+        // Load enabled sources\n+        loadSources()\n+\n+        // Load most recently used source.\n+        loadRecentSources()\n+    }\n+\n+    override fun onDestroy() {\n+        // Unsubscribe subscriptions.\n+        recentSourceSubscription?.unsubscribe()","path":"app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/main/CatalogueMainPresenter.kt","position":55,"original_position":55,"commit_id":"01c6b0415c28ceb95baa204b2d2d345546c71ee3","original_commit_id":"01c6b0415c28ceb95baa204b2d2d345546c71ee3","user":{"login":"inorichi","id":3521738,"avatar_url":"https://avatars3.githubusercontent.com/u/3521738?v=4","gravatar_id":"","url":"https://api.github.com/users/inorichi","html_url":"https://github.com/inorichi","followers_url":"https://api.github.com/users/inorichi/followers","following_url":"https://api.github.com/users/inorichi/following{/other_user}","gists_url":"https://api.github.com/users/inorichi/gists{/gist_id}","starred_url":"https://api.github.com/users/inorichi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inorichi/subscriptions","organizations_url":"https://api.github.com/users/inorichi/orgs","repos_url":"https://api.github.com/users/inorichi/repos","events_url":"https://api.github.com/users/inorichi/events{/privacy}","received_events_url":"https://api.github.com/users/inorichi/received_events","type":"User","site_admin":false},"body":"These are automatically unsubscribed. All the extension methods `subscribe*()` in the presenter unsubscribe automatically in `onDestroy`","created_at":"2017-09-01T11:53:35Z","updated_at":"2017-09-01T12:00:37Z","html_url":"https://github.com/inorichi/tachiyomi/pull/849#discussion_r136557328","pull_request_url":"https://api.github.com/repos/inorichi/tachiyomi/pulls/849","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/inorichi/tachiyomi/pulls/comments/136557328"},"html":{"href":"https://github.com/inorichi/tachiyomi/pull/849#discussion_r136557328"},"pull_request":{"href":"https://api.github.com/repos/inorichi/tachiyomi/pulls/849"}}},"pull_request":{"url":"https://api.github.com/repos/inorichi/tachiyomi/pulls/849","id":125913527,"html_url":"https://github.com/inorichi/tachiyomi/pull/849","diff_url":"https://github.com/inorichi/tachiyomi/pull/849.diff","patch_url":"https://github.com/inorichi/tachiyomi/pull/849.patch","issue_url":"https://api.github.com/repos/inorichi/tachiyomi/issues/849","number":849,"state":"open","locked":false,"title":"Global Search","user":{"login":"NoodleMage","id":9655378,"avatar_url":"https://avatars2.githubusercontent.com/u/9655378?v=4","gravatar_id":"","url":"https://api.github.com/users/NoodleMage","html_url":"https://github.com/NoodleMage","followers_url":"https://api.github.com/users/NoodleMage/followers","following_url":"https://api.github.com/users/NoodleMage/following{/other_user}","gists_url":"https://api.github.com/users/NoodleMage/gists{/gist_id}","starred_url":"https://api.github.com/users/NoodleMage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NoodleMage/subscriptions","organizations_url":"https://api.github.com/users/NoodleMage/orgs","repos_url":"https://api.github.com/users/NoodleMage/repos","events_url":"https://api.github.com/users/NoodleMage/events{/privacy}","received_events_url":"https://api.github.com/users/NoodleMage/received_events","type":"User","site_admin":false},"body":"Initial code for global search. Note that this is just a humble beginning on which we can build. Closes #45 \r\n\r\n# Screens\r\n![screenshot_20170724-151421_framed](https://user-images.githubusercontent.com/9655378/28525069-3fc61918-7083-11e7-88e7-0220e570a38e.png)\r\n![screenshot_1497560352_framed](https://user-images.githubusercontent.com/9655378/27201928-de7aead4-521f-11e7-9f68-2460a92228da.png)\r\n![screenshot_1497560358_framed](https://user-images.githubusercontent.com/9655378/27201931-de8405ce-521f-11e7-9c65-35522d82cfff.png)\r\n![screenshot_20170724-151457_framed](https://user-images.githubusercontent.com/9655378/28525076-46fc6b7e-7083-11e7-91ff-39f95adb614a.png)\r\n","created_at":"2017-06-15T21:12:26Z","updated_at":"2017-09-01T12:00:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c27d0368ed0c67675468448d7ab2adc54c0cff70","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/inorichi/tachiyomi/pulls/849/commits","review_comments_url":"https://api.github.com/repos/inorichi/tachiyomi/pulls/849/comments","review_comment_url":"https://api.github.com/repos/inorichi/tachiyomi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/inorichi/tachiyomi/issues/849/comments","statuses_url":"https://api.github.com/repos/inorichi/tachiyomi/statuses/01c6b0415c28ceb95baa204b2d2d345546c71ee3","head":{"label":"NoodleMage:global_search","ref":"global_search","sha":"01c6b0415c28ceb95baa204b2d2d345546c71ee3","user":{"login":"NoodleMage","id":9655378,"avatar_url":"https://avatars2.githubusercontent.com/u/9655378?v=4","gravatar_id":"","url":"https://api.github.com/users/NoodleMage","html_url":"https://github.com/NoodleMage","followers_url":"https://api.github.com/users/NoodleMage/followers","following_url":"https://api.github.com/users/NoodleMage/following{/other_user}","gists_url":"https://api.github.com/users/NoodleMage/gists{/gist_id}","starred_url":"https://api.github.com/users/NoodleMage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NoodleMage/subscriptions","organizations_url":"https://api.github.com/users/NoodleMage/orgs","repos_url":"https://api.github.com/users/NoodleMage/repos","events_url":"https://api.github.com/users/NoodleMage/events{/privacy}","received_events_url":"https://api.github.com/users/NoodleMage/received_events","type":"User","site_admin":false},"repo":{"id":50176868,"name":"tachiyomi","full_name":"NoodleMage/tachiyomi","owner":{"login":"NoodleMage","id":9655378,"avatar_url":"https://avatars2.githubusercontent.com/u/9655378?v=4","gravatar_id":"","url":"https://api.github.com/users/NoodleMage","html_url":"https://github.com/NoodleMage","followers_url":"https://api.github.com/users/NoodleMage/followers","following_url":"https://api.github.com/users/NoodleMage/following{/other_user}","gists_url":"https://api.github.com/users/NoodleMage/gists{/gist_id}","starred_url":"https://api.github.com/users/NoodleMage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NoodleMage/subscriptions","organizations_url":"https://api.github.com/users/NoodleMage/orgs","repos_url":"https://api.github.com/users/NoodleMage/repos","events_url":"https://api.github.com/users/NoodleMage/events{/privacy}","received_events_url":"https://api.github.com/users/NoodleMage/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/NoodleMage/tachiyomi","description":null,"fork":true,"url":"https://api.github.com/repos/NoodleMage/tachiyomi","forks_url":"https://api.github.com/repos/NoodleMage/tachiyomi/forks","keys_url":"https://api.github.com/repos/NoodleMage/tachiyomi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NoodleMage/tachiyomi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NoodleMage/tachiyomi/teams","hooks_url":"https://api.github.com/repos/NoodleMage/tachiyomi/hooks","issue_events_url":"https://api.github.com/repos/NoodleMage/tachiyomi/issues/events{/number}","events_url":"https://api.github.com/repos/NoodleMage/tachiyomi/events","assignees_url":"https://api.github.com/repos/NoodleMage/tachiyomi/assignees{/user}","branches_url":"https://api.github.com/repos/NoodleMage/tachiyomi/branches{/branch}","tags_url":"https://api.github.com/repos/NoodleMage/tachiyomi/tags","blobs_url":"https://api.github.com/repos/NoodleMage/tachiyomi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NoodleMage/tachiyomi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NoodleMage/tachiyomi/git/refs{/sha}","trees_url":"https://api.github.com/repos/NoodleMage/tachiyomi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NoodleMage/tachiyomi/statuses/{sha}","languages_url":"https://api.github.com/repos/NoodleMage/tachiyomi/languages","stargazers_url":"https://api.github.com/repos/NoodleMage/tachiyomi/stargazers","contributors_url":"https://api.github.com/repos/NoodleMage/tachiyomi/contributors","subscribers_url":"https://api.github.com/repos/NoodleMage/tachiyomi/subscribers","subscription_url":"https://api.github.com/repos/NoodleMage/tachiyomi/subscription","commits_url":"https://api.github.com/repos/NoodleMage/tachiyomi/commits{/sha}","git_commits_url":"https://api.github.com/repos/NoodleMage/tachiyomi/git/commits{/sha}","comments_url":"https://api.github.com/repos/NoodleMage/tachiyomi/comments{/number}","issue_comment_url":"https://api.github.com/repos/NoodleMage/tachiyomi/issues/comments{/number}","contents_url":"https://api.github.com/repos/NoodleMage/tachiyomi/contents/{+path}","compare_url":"https://api.github.com/repos/NoodleMage/tachiyomi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NoodleMage/tachiyomi/merges","archive_url":"https://api.github.com/repos/NoodleMage/tachiyomi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NoodleMage/tachiyomi/downloads","issues_url":"https://api.github.com/repos/NoodleMage/tachiyomi/issues{/number}","pulls_url":"https://api.github.com/repos/NoodleMage/tachiyomi/pulls{/number}","milestones_url":"https://api.github.com/repos/NoodleMage/tachiyomi/milestones{/number}","notifications_url":"https://api.github.com/repos/NoodleMage/tachiyomi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NoodleMage/tachiyomi/labels{/name}","releases_url":"https://api.github.com/repos/NoodleMage/tachiyomi/releases{/id}","deployments_url":"https://api.github.com/repos/NoodleMage/tachiyomi/deployments","created_at":"2016-01-22T11:16:18Z","updated_at":"2016-04-17T19:09:37Z","pushed_at":"2017-08-31T09:19:13Z","git_url":"git://github.com/NoodleMage/tachiyomi.git","ssh_url":"git@github.com:NoodleMage/tachiyomi.git","clone_url":"https://github.com/NoodleMage/tachiyomi.git","svn_url":"https://github.com/NoodleMage/tachiyomi","homepage":null,"size":5275,"stargazers_count":0,"watchers_count":0,"language":"Kotlin","has_issues":false,"has_projects":true,"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":"inorichi:master","ref":"master","sha":"2f6d163a7acf4672fa39ecd225532a79bef770e1","user":{"login":"inorichi","id":3521738,"avatar_url":"https://avatars3.githubusercontent.com/u/3521738?v=4","gravatar_id":"","url":"https://api.github.com/users/inorichi","html_url":"https://github.com/inorichi","followers_url":"https://api.github.com/users/inorichi/followers","following_url":"https://api.github.com/users/inorichi/following{/other_user}","gists_url":"https://api.github.com/users/inorichi/gists{/gist_id}","starred_url":"https://api.github.com/users/inorichi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inorichi/subscriptions","organizations_url":"https://api.github.com/users/inorichi/orgs","repos_url":"https://api.github.com/users/inorichi/repos","events_url":"https://api.github.com/users/inorichi/events{/privacy}","received_events_url":"https://api.github.com/users/inorichi/received_events","type":"User","site_admin":false},"repo":{"id":43807251,"name":"tachiyomi","full_name":"inorichi/tachiyomi","owner":{"login":"inorichi","id":3521738,"avatar_url":"https://avatars3.githubusercontent.com/u/3521738?v=4","gravatar_id":"","url":"https://api.github.com/users/inorichi","html_url":"https://github.com/inorichi","followers_url":"https://api.github.com/users/inorichi/followers","following_url":"https://api.github.com/users/inorichi/following{/other_user}","gists_url":"https://api.github.com/users/inorichi/gists{/gist_id}","starred_url":"https://api.github.com/users/inorichi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inorichi/subscriptions","organizations_url":"https://api.github.com/users/inorichi/orgs","repos_url":"https://api.github.com/users/inorichi/repos","events_url":"https://api.github.com/users/inorichi/events{/privacy}","received_events_url":"https://api.github.com/users/inorichi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/inorichi/tachiyomi","description":"Free and open source manga reader for Android","fork":false,"url":"https://api.github.com/repos/inorichi/tachiyomi","forks_url":"https://api.github.com/repos/inorichi/tachiyomi/forks","keys_url":"https://api.github.com/repos/inorichi/tachiyomi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/inorichi/tachiyomi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/inorichi/tachiyomi/teams","hooks_url":"https://api.github.com/repos/inorichi/tachiyomi/hooks","issue_events_url":"https://api.github.com/repos/inorichi/tachiyomi/issues/events{/number}","events_url":"https://api.github.com/repos/inorichi/tachiyomi/events","assignees_url":"https://api.github.com/repos/inorichi/tachiyomi/assignees{/user}","branches_url":"https://api.github.com/repos/inorichi/tachiyomi/branches{/branch}","tags_url":"https://api.github.com/repos/inorichi/tachiyomi/tags","blobs_url":"https://api.github.com/repos/inorichi/tachiyomi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/inorichi/tachiyomi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/inorichi/tachiyomi/git/refs{/sha}","trees_url":"https://api.github.com/repos/inorichi/tachiyomi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/inorichi/tachiyomi/statuses/{sha}","languages_url":"https://api.github.com/repos/inorichi/tachiyomi/languages","stargazers_url":"https://api.github.com/repos/inorichi/tachiyomi/stargazers","contributors_url":"https://api.github.com/repos/inorichi/tachiyomi/contributors","subscribers_url":"https://api.github.com/repos/inorichi/tachiyomi/subscribers","subscription_url":"https://api.github.com/repos/inorichi/tachiyomi/subscription","commits_url":"https://api.github.com/repos/inorichi/tachiyomi/commits{/sha}","git_commits_url":"https://api.github.com/repos/inorichi/tachiyomi/git/commits{/sha}","comments_url":"https://api.github.com/repos/inorichi/tachiyomi/comments{/number}","issue_comment_url":"https://api.github.com/repos/inorichi/tachiyomi/issues/comments{/number}","contents_url":"https://api.github.com/repos/inorichi/tachiyomi/contents/{+path}","compare_url":"https://api.github.com/repos/inorichi/tachiyomi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/inorichi/tachiyomi/merges","archive_url":"https://api.github.com/repos/inorichi/tachiyomi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/inorichi/tachiyomi/downloads","issues_url":"https://api.github.com/repos/inorichi/tachiyomi/issues{/number}","pulls_url":"https://api.github.com/repos/inorichi/tachiyomi/pulls{/number}","milestones_url":"https://api.github.com/repos/inorichi/tachiyomi/milestones{/number}","notifications_url":"https://api.github.com/repos/inorichi/tachiyomi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/inorichi/tachiyomi/labels{/name}","releases_url":"https://api.github.com/repos/inorichi/tachiyomi/releases{/id}","deployments_url":"https://api.github.com/repos/inorichi/tachiyomi/deployments","created_at":"2015-10-07T09:51:12Z","updated_at":"2017-09-01T06:53:10Z","pushed_at":"2017-08-31T09:19:15Z","git_url":"git://github.com/inorichi/tachiyomi.git","ssh_url":"git@github.com:inorichi/tachiyomi.git","clone_url":"https://github.com/inorichi/tachiyomi.git","svn_url":"https://github.com/inorichi/tachiyomi","homepage":"","size":5187,"stargazers_count":799,"watchers_count":799,"language":"Kotlin","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":155,"mirror_url":null,"open_issues_count":122,"forks":155,"open_issues":122,"watchers":799,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/inorichi/tachiyomi/pulls/849"},"html":{"href":"https://github.com/inorichi/tachiyomi/pull/849"},"issue":{"href":"https://api.github.com/repos/inorichi/tachiyomi/issues/849"},"comments":{"href":"https://api.github.com/repos/inorichi/tachiyomi/issues/849/comments"},"review_comments":{"href":"https://api.github.com/repos/inorichi/tachiyomi/pulls/849/comments"},"review_comment":{"href":"https://api.github.com/repos/inorichi/tachiyomi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/inorichi/tachiyomi/pulls/849/commits"},"statuses":{"href":"https://api.github.com/repos/inorichi/tachiyomi/statuses/01c6b0415c28ceb95baa204b2d2d345546c71ee3"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"inorichi"}}