android10 / android10/Android-CleanArchitecture-Kotlin
Integration with APIs which return the result in `onActivityResult()`
- 主要言語
- Kotlin
- スター
- 4.8k
- フォーク
- 929
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Hi,
How do you add integration with SDKs that deliver the result to `onActivityResult` method of fragment/activity? For example if you'd like to implement Authentication via Facebook SDK you would:
1. Create a [CallbackManager](https://developers.facebook.com/docs/reference/android/current/interface/CallbackManager/)
2. Register it via `registerCallback()` of [LoginManager](https://developers.facebook.com/docs/reference/android/current/class/LoginManager/) and pass a [FacebookCallback](https://developers.facebook.com/docs/reference/android/current/interface/FacebookCallback/) there,
3. Pass the arguments received in `onActivityResult()` to the callback manager created in the step 1.
Then if you call `LoginManager.getInstance().logInWithReadPermissions(fragment/activity, permissions)` you will get your callback called with the result.
Besides of that, you shouldn't forget about unregistering callbacks when you're done. All of this brings quite strong coupling between components. Are there any ideas on how to keep the **Dependency rule** in place?
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
評価
この issue はまだ評価されていません。