Last active
May 6, 2020 05:14
-
-
Save mattpodwysocki/ce529abe5cd5fa2159004e0cf98d2483 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@class MSNotificationHub; | |
@class MSInstallation; | |
@protocol MSInstallationEnrichmentDelegate <NSObject> | |
@optional | |
- (void)notificationHub:(MSNotificationHub *)notificationHub willEnrichInstallation:(MSInstallation *)installation; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@class MSNotificationHub; | |
@class MSInstallation; | |
@protocol MSInstallationManagementDelegate <NSObject> | |
@optional | |
- (void)notificationHub:(MSNotificationHub *)notificationHub willUpsertInstallation:(MSInstallation *)installation; | |
- (void)notificationHub:(MSNotificationHub *)notificationHub willDeleteInstallation:(NSString *)installationId; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import "MSInstallationEnrichmentDelegate.h" | |
#import "MSInstallationManagementDelegate.h" | |
@interface MSNotificationHub : NSObject | |
// Other details not in scope | |
@property(nonatomic) id<MSInstallationEnrichmentDelegate> enrichmentDelegate; | |
@property(nonatomic) id<MSInstallationManagementDelegate> managementDelegate; | |
+ (void)setEnrichmentDelegate:(nullable id<MSInstallationEnrichmentDelegate>)enrichmentDelegate; | |
+ (void)setManagementDelegate:(nullable id<MSInstallationManagementDelegate>)managementDelegate; | |
@end |
I'm also not sure the "willDo" pattern is appropriate here. "will" typically means: we're about to do something, here's a chance to hook into the lifecycle. In this case there's no lifecycle, the delegate method is expected to do the work.
That also applies to delegate methods right? If the delegate is optional, and isn't set, then what should be the default behavior? I would think there wouldn't be a default behavior in that case.
For our case, we need the default behavior to be sending the Installation to the NH API.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm just not a fan of the term "enrich" in an SDK. On the Android side we went with "visitor", which also isn't great.. but at least it's more commonly used.