added other action handler api
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
22d2d73b50
commit
6b23b35890
@ -156,6 +156,7 @@
|
||||
D2DEDCB923C6400600C44CC4 /* UnitInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DEDCB823C6400600C44CC4 /* UnitInterval.swift */; };
|
||||
D2DEDCBB23C65BC300C44CC4 /* Percent.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DEDCBA23C65BC300C44CC4 /* Percent.swift */; };
|
||||
D2E1FAD92260C3E400AEFD8C /* DelegateObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E1FAD82260C3E400AEFD8C /* DelegateObject.swift */; };
|
||||
EA34EF3327207AAC00DFC625 /* MVMOtherActionHandlerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = EA34EF322720788700DFC625 /* MVMOtherActionHandlerDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
EA3B264C25FC0B7600008074 /* ModelHandlerProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3B264B25FC0B7600008074 /* ModelHandlerProtocol.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
@ -303,6 +304,7 @@
|
||||
D2DEDCB823C6400600C44CC4 /* UnitInterval.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnitInterval.swift; sourceTree = "<group>"; };
|
||||
D2DEDCBA23C65BC300C44CC4 /* Percent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Percent.swift; sourceTree = "<group>"; };
|
||||
D2E1FAD82260C3E400AEFD8C /* DelegateObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DelegateObject.swift; sourceTree = "<group>"; };
|
||||
EA34EF322720788700DFC625 /* MVMOtherActionHandlerDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMOtherActionHandlerDelegate.h; sourceTree = "<group>"; };
|
||||
EA3B264B25FC0B7600008074 /* ModelHandlerProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelHandlerProtocol.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
@ -615,6 +617,7 @@
|
||||
AFBB96B61FBA3CEC0008D868 /* MVMCoreActionHandler.h */,
|
||||
AFBB96B71FBA3CEC0008D868 /* MVMCoreActionHandler.m */,
|
||||
D27073CC25BB4CEF001C7246 /* MVMCoreActionHandler+Extension.swift */,
|
||||
EA34EF322720788700DFC625 /* MVMOtherActionHandlerDelegate.h */,
|
||||
);
|
||||
path = ActionHandling;
|
||||
sourceTree = "<group>";
|
||||
@ -741,6 +744,7 @@
|
||||
AF43A74C1FC6109F008E9347 /* MVMCoreSessionObject.h in Headers */,
|
||||
8876D5F41FB50AB000EB2E3D /* UILabel+MFCustom.h in Headers */,
|
||||
AFFCFA681FCCC0D700FD0730 /* MVMCoreLoadingViewControllerProtocol.h in Headers */,
|
||||
EA34EF3327207AAC00DFC625 /* MVMOtherActionHandlerDelegate.h in Headers */,
|
||||
AFED77A21FCCA29400BAE689 /* MVMCoreViewControllerMappingObject.h in Headers */,
|
||||
AFFCFA661FCCC0D700FD0730 /* MVMCoreLoadingOverlayHandler.h in Headers */,
|
||||
);
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#import <MVMCore/MVMCoreActionDelegateProtocol.h>
|
||||
#import <MVMCore/MVMCoreLoadDelegateProtocol.h>
|
||||
#import <MVMCore/MVMCorePresentationDelegateProtocol.h>
|
||||
#import <MVMCore/MVMOtherActionHandlerDelegate.h>
|
||||
@class DelegateObject;
|
||||
|
||||
extern NSString * _Nonnull const KeyActionType;
|
||||
@ -22,6 +23,8 @@ extern NSString * _Nonnull const KeyActionTypeOpen;
|
||||
/// Returns the shared action handler
|
||||
+ (nullable instancetype)sharedActionHandler;
|
||||
|
||||
- (void) registerOtherActionHandler: (id<MVMOtherActionHandlerDelegate> _Nonnull)delegate;
|
||||
|
||||
/// Convenience function for handling actions. This will pull action and pageInfo out of the dictionary and call handleAction: actionInformation: with those values
|
||||
- (void)handleActionWithDictionary:(nullable NSDictionary *)dictionary additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject;
|
||||
|
||||
|
||||
@ -34,6 +34,8 @@ NSString * const KeyActionTypeLinkAway = @"openURL";
|
||||
NSString * const KeyActionTypeOpen = @"openPage";
|
||||
|
||||
@interface MVMCoreActionHandler() <CNContactViewControllerDelegate, CNContactPickerDelegate>
|
||||
@property (nonatomic, nonnull, strong) NSMutableArray<id<MVMOtherActionHandlerDelegate>> *otherActionHandlers;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MVMCoreActionHandler
|
||||
@ -41,6 +43,26 @@ NSString * const KeyActionTypeOpen = @"openPage";
|
||||
return [MVMCoreActionUtility initializerClassCheck:[MVMCoreObject sharedInstance].actionHandler classToVerify:self];
|
||||
}
|
||||
|
||||
- (instancetype) init {
|
||||
if (self = [super init]) {
|
||||
self.otherActionHandlers = [[NSMutableArray alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) registerOtherActionHandler: (id<MVMOtherActionHandlerDelegate> _Nonnull)delegate{
|
||||
[self.otherActionHandlers addObject:delegate];
|
||||
}
|
||||
|
||||
- (BOOL)handleActionWithAdditionalHandlers:(NSString *)actionType actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(DelegateObject *)delegateObject {
|
||||
for (id<MVMOtherActionHandlerDelegate> handler in self.otherActionHandlers) {
|
||||
if ([handler respondsToSelector:@selector(handleOtherActions:actionInformation:additionalData:delegateObject:)] && [handler handleOtherActions:actionType actionInformation:actionInformation additionalData:additionalData delegateObject:delegateObject]) {
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)handleActionWithDictionary:(nullable NSDictionary *)dictionary additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
|
||||
|
||||
NSString *action = [dictionary stringForKey:KeyActionType];
|
||||
@ -100,6 +122,8 @@ NSString * const KeyActionTypeOpen = @"openPage";
|
||||
// not a known action type.
|
||||
[self unknownAction:actionType actionInformation:actionInformation additionalData:additionalData delegateObject:delegateObject];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)getClientParameter:(nullable NSDictionary *)clientParametersMap requestParameters:(nullable NSDictionary *)requestParameters showLoadingOverlay:(BOOL)showLoadingOverlay completionHandler:(nonnull void (^)(NSDictionary * _Nullable parameters))completionHandler {
|
||||
@ -387,7 +411,7 @@ NSString * const KeyActionTypeOpen = @"openPage";
|
||||
}
|
||||
|
||||
- (BOOL)handleOtherActions:(nullable NSString *)actionType actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
|
||||
return NO;
|
||||
return [self handleActionWithAdditionalHandlers:actionType actionInformation:actionInformation additionalData:additionalData delegateObject:delegateObject];
|
||||
}
|
||||
|
||||
- (void)unknownAction:(nullable NSString *)actionType actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
//
|
||||
// MVMOtherActionHandlerDelegate.h
|
||||
// MVMCore
|
||||
//
|
||||
// Created by Matt Bruce on 10/20/21.
|
||||
// Copyright © 2021 myverizon. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MVMOtherActionHandlerDelegate_h
|
||||
#define MVMOtherActionHandlerDelegate_h
|
||||
@class DelegateObject;
|
||||
|
||||
@protocol MVMOtherActionHandlerDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
|
||||
- (BOOL)handleOtherActions:(nullable NSString *)actionType actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MVMOtherActionHandlerDelegate_h */
|
||||
@ -69,6 +69,7 @@ FOUNDATION_EXPORT const unsigned char MVMCoreVersionString[];
|
||||
#import <MVMCore/MVMCoreActionHandler.h>
|
||||
#import <MVMCore/MVMCoreActionDelegateProtocol.h>
|
||||
#import <MVMCore/MVMCoreActionUtility.h>
|
||||
#import <MVMCore/MVMOtherActionHandlerDelegate.h>
|
||||
|
||||
// Protocols
|
||||
#import <MVMCore/MVMCoreViewControllerProtocol.h>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user