Refactoring the platform-specific constructor injection.