This commit is contained in:
Kevin G Christiano 2021-04-09 14:27:10 -04:00
commit f917c88bcb
4 changed files with 19 additions and 5 deletions

View File

@ -70,6 +70,9 @@ NSString * const KeyActionTypeOpen = @"openPage";
} else if ([actionType isEqualToString:KeyActionTypeCall]) { } else if ([actionType isEqualToString:KeyActionTypeCall]) {
[self callAction:actionInformation additionalData:additionalData delegateObject:delegateObject]; [self callAction:actionInformation additionalData:additionalData delegateObject:delegateObject];
} else if ([actionType isEqualToString:KeyActionTypeSMS]) {
[self smsAction:actionInformation additionalData:additionalData delegateObject:delegateObject];
} else if ([actionType isEqualToString:KeyActionTypeContact]) { } else if ([actionType isEqualToString:KeyActionTypeContact]) {
[self contactAction:actionInformation additionalData:additionalData delegateObject:delegateObject]; [self contactAction:actionInformation additionalData:additionalData delegateObject:delegateObject];
@ -257,6 +260,14 @@ NSString * const KeyActionTypeOpen = @"openPage";
} }
} }
- (void)smsAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
NSString *phoneNumber = [actionInformation stringForKey:@"phoneNumber"];
NSString *message = [actionInformation stringForKey:KeyMessage];
NSString *smsQuery = [NSString stringWithFormat:@"sms:%@&body=%@", phoneNumber, message];
[MVMCoreActionUtility linkAway:[smsQuery stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] appURLString:nil];
}
- (void)contactAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject { - (void)contactAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;

View File

@ -50,6 +50,7 @@ extern NSString * const KeyActionInformation;
extern NSString * const KeyLinkAwayAppURL; extern NSString * const KeyLinkAwayAppURL;
extern NSString * const KeyLinkAwayURL; extern NSString * const KeyLinkAwayURL;
extern NSString * const KeyCallNumber; extern NSString * const KeyCallNumber;
extern NSString * const KeyPhoneNumber;
extern NSString * const KeyPresentationStyle; extern NSString * const KeyPresentationStyle;
extern NSString * const KeyExtraParameters; extern NSString * const KeyExtraParameters;
extern NSString * const KeyContextRoot; extern NSString * const KeyContextRoot;

View File

@ -38,6 +38,7 @@ NSString * const KeyActionTypeRestart = @"restart";
NSString * const KeyActionTypeBack = @"back"; NSString * const KeyActionTypeBack = @"back";
NSString * const KeyActionTypeShare = @"share"; NSString * const KeyActionTypeShare = @"share";
NSString * const KeyActionTypeCall = @"call"; NSString * const KeyActionTypeCall = @"call";
NSString * const KeyActionTypeSMS = @"sms";
NSString * const KeyActionTypeContact = @"contact"; NSString * const KeyActionTypeContact = @"contact";
NSString * const KeyActionTypePreviousSubmit = @"previousSubmit"; NSString * const KeyActionTypePreviousSubmit = @"previousSubmit";
NSString * const KeyActionTypeCancel = @"cancel"; NSString * const KeyActionTypeCancel = @"cancel";
@ -49,6 +50,7 @@ NSString * const KeyActionInformation = @"actionInformation";
NSString * const KeyLinkAwayAppURL = @"appURL"; NSString * const KeyLinkAwayAppURL = @"appURL";
NSString * const KeyLinkAwayURL = @"browserUrl"; NSString * const KeyLinkAwayURL = @"browserUrl";
NSString * const KeyCallNumber = @"callNumber"; NSString * const KeyCallNumber = @"callNumber";
NSString * const KeyPhoneNumber = @"phoneNumber";
NSString * const KeyPresentationStyle = @"presentationStyle"; NSString * const KeyPresentationStyle = @"presentationStyle";
NSString * const KeyExtraParameters = @"extraParameters"; NSString * const KeyExtraParameters = @"extraParameters";
NSString * const KeyContextRoot = @"appContext"; NSString * const KeyContextRoot = @"appContext";

View File

@ -14,18 +14,18 @@
public static var identifier: String = "sms" public static var identifier: String = "sms"
public var actionType: String = ActionCallModel.identifier public var actionType: String = ActionCallModel.identifier
// TODO: decode into phone number once action handler is re-written
public var callNumber: String public var phoneNumber: String
public var message: String? public var message: String?
public var extraParameters: JSONValueDictionary? public var extraParameters: JSONValueDictionary?
public var analyticsData: JSONValueDictionary? public var analyticsData: JSONValueDictionary?
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Initializer // MARK: - Initializer
//-------------------------------------------------- //--------------------------------------------------
public init(callNumber: String, message: String?, _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) { public init(phoneNumber: String, message: String?, _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
self.callNumber = callNumber self.phoneNumber = phoneNumber
self.message = message self.message = message
self.extraParameters = extraParameters self.extraParameters = extraParameters
self.analyticsData = analyticsData self.analyticsData = analyticsData