Skip to content
This repository has been archived by the owner on Jan 17, 2019. It is now read-only.

[WIP] Registering passing a feature model #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions include/HubFramework/HUBFeatureRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
@protocol HUBActionHandler;
@protocol HUBViewControllerScrollHandler;
@class HUBViewURIPredicate;
@class HUBFeatureRegistration;

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -71,6 +72,17 @@ NS_ASSUME_NONNULL_BEGIN
actionHandler:(nullable id<HUBActionHandler>)actionHandler
viewControllerScrollHandler:(nullable id<HUBViewControllerScrollHandler>)viewControllerScrollHandler;


/**
* Register a feature with the Hub Framework
*
* @param feature to be registered.
*
* Registering a feature with the same identifier as one that is already registered is considered a severe error and will
* trigger an assert.
*/
- (void)registerFeature:(HUBFeatureRegistration *)feature;

/**
* Unregister a feature from the Hub Framework
*
Expand Down
12 changes: 12 additions & 0 deletions sources/HUBFeatureRegistryImplementation.m
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ - (void)registerFeatureWithIdentifier:(NSString *)featureIdentifier
[self.registrationIdentifierOrder addObject:registration.featureIdentifier];
}

- (void)registerFeature:(HUBFeatureRegistration *)feature
{
[self registerFeatureWithIdentifier:feature.featureIdentifier
viewURIPredicate:feature.viewURIPredicate
title:feature.featureTitle
contentOperationFactories:feature.contentOperationFactories
contentReloadPolicy:feature.contentReloadPolicy
customJSONSchemaIdentifier:feature.customJSONSchemaIdentifier
actionHandler:feature.actionHandler
viewControllerScrollHandler:feature.viewControllerScrollHandler];
}

- (void)unregisterFeatureWithIdentifier:(NSString *)featureIdentifier
{
HUBFeatureRegistration * const registration = self.registrationsByIdentifier[featureIdentifier];
Expand Down