Open datnt1987 opened 6 years ago
Hi guy, I think RIBs framework is design to work with 1 activity, many activities are not recommend, this was wrote in the tutorials.
Hi @Hayashi2026 , I read this android question and the answer seem satisfied our questions. Only things that I don't know how to exactly do this according the answer
Question: What about when you need to break the single activity model in order to open a second activity that can not be ported to RIBs (perhaps 3rd party activity)? How do you handle the onActivityForResult()?
Any RIB can start a second activity. When SecondActivity calls finishWithResult() the result is immediately delivered to the root of the FirstActivity. Since this data likely needs to be transmitted to the initiating RIB we use Workflows (see tutorial 4). This kills two birds with one stone: (1) it gets the data from the top of RootActivity down to the RIB that started the request (2) the workflow causes the RIB hierarchy to be recreated in its original form in case the SecondActivity had been killed. The benefit of using this pattern is that the same code path gets executed regardless of whether MainActivity had been killed while waiting for SecondActivity to finishWithResult().
If the SecondActivity is first party, you could also create an AppScope that both activities can be injected from. However, creating long lived app scopes like this is problematic and discouraged.
Pref: https://github.com/uber/RIBs/wiki/Android-Specific-Questions
Sorry, In Android tutorial 1, I passed/missed this:
RIB apps should avoid containing more than one activity since using multiple activities forces more state to exist inside a global scope
So in case tranfer between actitities is done. Finally I want to ask the other case, checking permission (Camera, Read Contact,.....), how do I check permissions and response (update UI, change view) from RootActivity to Child View.
Maybe you can do something similar to OptionsMenuService? Create something like AppPermissionsService to invoke all the listeners added (in your case a child RIB / Interactor)?
Hi guys, I've finished the tutorials, I found that these topics just mentioned about 1 activity with root and many view generated with RIB inside. So, for further, I want to work with many activities and in case I have to ask permission(Camera, location,...) from RIB View, how to do that?