ResearchKit / AppCore

Core code shared by the initial ResearchKit apps.
Other
262 stars 82 forks source link

Onboarding process is tightly tied to AppDelegate, Sage and CoreData #24

Open p2 opened 9 years ago

p2 commented 9 years ago

Similar to issue #16 , the onboarding process, especially APCOnboarding and APCOnboardingTask, import all the things plus APCAppDelegate.h.

To make it usable with only parts of the onboarding process the header imports need to be cleaned up and some dependencies removed.

p2 commented 9 years ago

This can be remedied by removing APCOnboarding.prepareScenes and letting its delegate supply the scenes/tasks it should perform. I'm in the process of getting this done, might run into other issues.

p2 commented 9 years ago

I am working on cleaning this up on https://github.com/chb/AppCore/tree/develop/modularize_onboarding but it needs thorough refactoring in many areas.

jwe-apple commented 9 years ago

@peculiar Could you have a look and recommend next steps? Thanks!

p2 commented 9 years ago

What I currently have is that APCOnboarding asks the app delegate for all the different predefined scenes. It then creates steps for all the scenes and can start the process with only the scenes I have implemented (still WiP).

There are still dependencies I don't like very much, some view controllers for example ask the app delegate for the current user when probably the user should be known to APCOnboarding. And some view controllers handle their own step logic, and other things like this.

My current idea is to encapsulate everything into APCOnboarding and then a new app can subclass it to make it work as desired. The app delegate will be asked to create an instance of the desired class, as is already the case. Then all onboarding view controllers get a handle to that instance and all logic decisions delegated to it instead of asking the app delegate all the time.