HUBConnectivityStateResolver
@protocol HUBConnectivityStateResolver <NSObject>
Protocol implemented by objects that can resolve an application’s current connectivity state
By default, the Hub Framework provides an implementation of this protocol that uses Apple’s
SystemConfiguration framework. However, you can choose to supply a custom connectivity state
resolver by conforming to this protocol in a custom object and passing it when setting up your
application’s HUBManager
.
The Hub Framework passes the information provided by its connectivity state resolver to content operations when they are performed, enabling them to make decisions on whether to attempt to load remote content or not.
The resolver should also support observations; to enable the Hub Framework to react to changes in connectivity state. Whenever the resolver detected a change, it should call its observers.
-
Resolve the current connectivity state of the application
The Hub Framework will call this method on your connectivity state resolver every time it’s about to load content. It will be called once per content loading chain, ensuring connectivity state consistency within the chain.
Declaration
Objective-C
- (HUBConnectivityState)resolveConnectivityState;
-
Add an observer to the connectivity state resolver
The connectivity state resolver should not retain the observer. Instead, it should just keep a weak reference to it, and call it whenever the connectivity state was changed.
Declaration
Objective-C
- (void)addObserver:(nonnull id<HUBConnectivityStateResolverObserver>)observer;
Parameters
observer
The observer to add
-
Remove an observer from the connectivity state resolver
The connectivity state resolver should immediately remove the observer.
Declaration
Objective-C
- (void)removeObserver: (nonnull id<HUBConnectivityStateResolverObserver>)observer;
Parameters
observer
The observer to remove