{"action":"created","issue":{"url":"https://api.github.com/repos/stephanenicolas/toothpick/issues/286","repository_url":"https://api.github.com/repos/stephanenicolas/toothpick","labels_url":"https://api.github.com/repos/stephanenicolas/toothpick/issues/286/labels{/name}","comments_url":"https://api.github.com/repos/stephanenicolas/toothpick/issues/286/comments","events_url":"https://api.github.com/repos/stephanenicolas/toothpick/issues/286/events","html_url":"https://github.com/stephanenicolas/toothpick/issues/286","id":301801797,"number":286,"title":"Using toothpick in libraries","user":{"login":"lukaville","id":725526,"avatar_url":"https://avatars0.githubusercontent.com/u/725526?v=4","gravatar_id":"","url":"https://api.github.com/users/lukaville","html_url":"https://github.com/lukaville","followers_url":"https://api.github.com/users/lukaville/followers","following_url":"https://api.github.com/users/lukaville/following{/other_user}","gists_url":"https://api.github.com/users/lukaville/gists{/gist_id}","starred_url":"https://api.github.com/users/lukaville/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukaville/subscriptions","organizations_url":"https://api.github.com/users/lukaville/orgs","repos_url":"https://api.github.com/users/lukaville/repos","events_url":"https://api.github.com/users/lukaville/events{/privacy}","received_events_url":"https://api.github.com/users/lukaville/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-03-02T15:22:29Z","updated_at":"2018-03-02T16:31:43Z","closed_at":null,"author_association":"NONE","body":"I'm trying to use toothpick in a library project (no toothpick classes/objects exposed to the clients of the library). But I faced a problem that if a client of the library uses preventMultipleRootScopes configuration it will fail because of the library opens new root scope. Also, we can't set isolated toothpick configuration in the library and in the client project because ConfigurationHolder.configuration field is static. How can I use multiple toothpicks with different configuration at the same time? Is it intended to use tootpick in this way?"},"comment":{"url":"https://api.github.com/repos/stephanenicolas/toothpick/issues/comments/369974137","html_url":"https://github.com/stephanenicolas/toothpick/issues/286#issuecomment-369974137","issue_url":"https://api.github.com/repos/stephanenicolas/toothpick/issues/286","id":369974137,"user":{"login":"stephanenicolas","id":1832925,"avatar_url":"https://avatars3.githubusercontent.com/u/1832925?v=4","gravatar_id":"","url":"https://api.github.com/users/stephanenicolas","html_url":"https://github.com/stephanenicolas","followers_url":"https://api.github.com/users/stephanenicolas/followers","following_url":"https://api.github.com/users/stephanenicolas/following{/other_user}","gists_url":"https://api.github.com/users/stephanenicolas/gists{/gist_id}","starred_url":"https://api.github.com/users/stephanenicolas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephanenicolas/subscriptions","organizations_url":"https://api.github.com/users/stephanenicolas/orgs","repos_url":"https://api.github.com/users/stephanenicolas/repos","events_url":"https://api.github.com/users/stephanenicolas/events{/privacy}","received_events_url":"https://api.github.com/users/stephanenicolas/received_events","type":"User","site_admin":false},"created_at":"2018-03-02T16:31:43Z","updated_at":"2018-03-02T16:31:43Z","author_association":"OWNER","body":"To be a little more precise on this:\r\n\r\nwhen you create a scope you do:\r\n```java\r\nTP.openScopes(app, activity);\r\n//install modules, etc.\r\n```\r\nwhen you use a scope, not creating it but just using it, you do:\r\n```java\r\nTP.openScope(activity);\r\n//use the scope\r\n```\r\n\r\n`openscope` is a nice method has it returns a scope, creating it if needed. But it means that you can actually create scopes when you want to use scopes. A very common use case it to use `openscope` in a background thread, and this gets executed right after you activity was destroyed. \r\n\r\nIn this case, `openscope` will not return the activity scope that was created under the app scope (because the activity got destroyed and its scope got closed), but it will return a new root scope starting at the activity level. \r\n\r\nTo detect such issues, we have the configuration to detect multiple root scopes. This will help you to detect where your code is using TP wrong.  \r\n\r\nTP fully supports concurrent injection, but we have to take care on Android of not using an object after it died in its lifecycle."}}
{"actor":{"display_login":"stephanenicolas"}}