{"action":"created","issue":{"url":"https://api.github.com/repos/f2prateek/rx-preferences/issues/32","repository_url":"https://api.github.com/repos/f2prateek/rx-preferences","labels_url":"https://api.github.com/repos/f2prateek/rx-preferences/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/f2prateek/rx-preferences/issues/32/comments","events_url":"https://api.github.com/repos/f2prateek/rx-preferences/issues/32/events","html_url":"https://github.com/f2prateek/rx-preferences/issues/32","id":106172981,"number":32,"title":"Make Preference into an interface","user":{"login":"dalewking","id":346062,"avatar_url":"https://avatars.githubusercontent.com/u/346062?v=3","gravatar_id":"","url":"https://api.github.com/users/dalewking","html_url":"https://github.com/dalewking","followers_url":"https://api.github.com/users/dalewking/followers","following_url":"https://api.github.com/users/dalewking/following{/other_user}","gists_url":"https://api.github.com/users/dalewking/gists{/gist_id}","starred_url":"https://api.github.com/users/dalewking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dalewking/subscriptions","organizations_url":"https://api.github.com/users/dalewking/orgs","repos_url":"https://api.github.com/users/dalewking/repos","events_url":"https://api.github.com/users/dalewking/events{/privacy}","received_events_url":"https://api.github.com/users/dalewking/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2015-09-12T17:13:25Z","updated_at":"2016-11-30T17:50:55Z","closed_at":null,"body":"Preference itself is a final class that can only be created through static methods in another class. You have created a unit test nightmare. You should change Preference into an interface and extract the implementation to another class. When using dependency injection the classes needing access to the Preference would inject the interface instead of a concrete class. That makes creating mock preferences for unit testing a breeze.\n\nWithout this, unit testing of classes that depend on a preference is much more difficult. It would require mocking SharedPreferences but having to capture the listener that is registered internally for preference changes.\n"},"comment":{"url":"https://api.github.com/repos/f2prateek/rx-preferences/issues/comments/263943920","html_url":"https://github.com/f2prateek/rx-preferences/issues/32#issuecomment-263943920","issue_url":"https://api.github.com/repos/f2prateek/rx-preferences/issues/32","id":263943920,"user":{"login":"f2prateek","id":843979,"avatar_url":"https://avatars.githubusercontent.com/u/843979?v=3","gravatar_id":"","url":"https://api.github.com/users/f2prateek","html_url":"https://github.com/f2prateek","followers_url":"https://api.github.com/users/f2prateek/followers","following_url":"https://api.github.com/users/f2prateek/following{/other_user}","gists_url":"https://api.github.com/users/f2prateek/gists{/gist_id}","starred_url":"https://api.github.com/users/f2prateek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/f2prateek/subscriptions","organizations_url":"https://api.github.com/users/f2prateek/orgs","repos_url":"https://api.github.com/users/f2prateek/repos","events_url":"https://api.github.com/users/f2prateek/events{/privacy}","received_events_url":"https://api.github.com/users/f2prateek/received_events","type":"User","site_admin":false},"created_at":"2016-11-30T17:50:55Z","updated_at":"2016-11-30T17:50:55Z","body":"\r\nI do see how it could be useful in the cases you're describing - I just don't think it's general enough to incur the overhead in the core library. So I don't think a read only interface is the responsibility of this library. That should live in your application. And you can just as easily observe to `Observable<Foo>` instead of dealing with a Preference object.\r\n"}}
{"actor":{"display_login":"f2prateek"}}