sms action
This commit is contained in:
parent
8de374ed91
commit
c8f804abdb
@ -34,6 +34,7 @@
|
||||
01F2A04C23A82B1B00D954D8 /* ActionCallModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A04B23A82B1B00D954D8 /* ActionCallModel.swift */; };
|
||||
01F2A05223A8325100D954D8 /* ModelMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A05123A8325100D954D8 /* ModelMapping.swift */; };
|
||||
0A42538F23F3414800554656 /* Codable+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A42538E23F3414800554656 /* Codable+Helpers.swift */; };
|
||||
0AEBB84625FA75C000EA80EE /* ActionOpenSMSModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AEBB84525FA75C000EA80EE /* ActionOpenSMSModel.swift */; };
|
||||
0AFF597A23FC6E60005C24E8 /* ActionShareModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AFF597923FC6E60005C24E8 /* ActionShareModel.swift */; };
|
||||
30349BF11FCCA78A00546A1E /* MVMCoreSessionTimeHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 30349BEF1FCCA78A00546A1E /* MVMCoreSessionTimeHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
30349BF21FCCA78A00546A1E /* MVMCoreSessionTimeHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 30349BF01FCCA78A00546A1E /* MVMCoreSessionTimeHandler.m */; };
|
||||
@ -167,6 +168,7 @@
|
||||
0A11030B20864F94008ADD90 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
0A11030C20864F9A008ADD90 /* es-MX */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-MX"; path = "es-MX.lproj/Localizable.strings"; sourceTree = "<group>"; };
|
||||
0A42538E23F3414800554656 /* Codable+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Codable+Helpers.swift"; sourceTree = "<group>"; };
|
||||
0AEBB84525FA75C000EA80EE /* ActionOpenSMSModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionOpenSMSModel.swift; sourceTree = "<group>"; };
|
||||
0AFF597923FC6E60005C24E8 /* ActionShareModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionShareModel.swift; sourceTree = "<group>"; };
|
||||
30349BEF1FCCA78A00546A1E /* MVMCoreSessionTimeHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreSessionTimeHandler.h; sourceTree = "<group>"; };
|
||||
30349BF01FCCA78A00546A1E /* MVMCoreSessionTimeHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreSessionTimeHandler.m; sourceTree = "<group>"; };
|
||||
@ -446,6 +448,7 @@
|
||||
94C014D824212360005811A9 /* ActionSettingModel.swift */,
|
||||
BB780ADE250F8C890030BD2F /* ActionNoopModel.swift */,
|
||||
D27073B625BB45C4001C7246 /* ActionActionsModel.swift */,
|
||||
0AEBB84525FA75C000EA80EE /* ActionOpenSMSModel.swift */,
|
||||
);
|
||||
path = ActionType;
|
||||
sourceTree = "<group>";
|
||||
@ -885,6 +888,7 @@
|
||||
016FF6F2259A4FCC00F5E4AA /* ClientParameterModel.swift in Sources */,
|
||||
D2DEDCBB23C65BC300C44CC4 /* Percent.swift in Sources */,
|
||||
AFBB966A1FBA3A570008D868 /* MVMCoreLoadRequestOperation.m in Sources */,
|
||||
0AEBB84625FA75C000EA80EE /* ActionOpenSMSModel.swift in Sources */,
|
||||
016FF6FC259BA27E00F5E4AA /* ClientParameterProtocol.swift in Sources */,
|
||||
8876D5F31FB50AB000EB2E3D /* UIFont+MFSpacing.m in Sources */,
|
||||
D282AAB82240342D00C46919 /* NSNumber+Extension.swift in Sources */,
|
||||
|
||||
@ -50,6 +50,9 @@ extern NSString * _Nonnull const KeyActionTypeOpen;
|
||||
/// Goes back
|
||||
- (void)backAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject;
|
||||
|
||||
/// Opens Text Message
|
||||
- (void)smsAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject;
|
||||
|
||||
/// Makes a phone call
|
||||
- (void)callAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject;
|
||||
|
||||
|
||||
@ -69,6 +69,9 @@ NSString * const KeyActionTypeOpen = @"openPage";
|
||||
} else if ([actionType isEqualToString:KeyActionTypeCall]) {
|
||||
[self callAction:actionInformation additionalData:additionalData delegateObject:delegateObject];
|
||||
|
||||
} else if ([actionType isEqualToString:KeyActionTypeSMS]) {
|
||||
[self smsAction:actionInformation additionalData:additionalData delegateObject:delegateObject];
|
||||
|
||||
} else if ([actionType isEqualToString:KeyActionTypeShare]) {
|
||||
[self shareAction:actionInformation additionalData:additionalData delegateObject:delegateObject];
|
||||
|
||||
@ -261,6 +264,17 @@ NSString * const KeyActionTypeOpen = @"openPage";
|
||||
}
|
||||
}
|
||||
|
||||
/// Send Text Message
|
||||
- (void)smsAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
|
||||
|
||||
NSString *phoneNumber = [actionInformation stringForKey:KeyCallNumber];
|
||||
NSString *message = [actionInformation stringForKey:KeyMessage];
|
||||
NSString *smsQuery = [NSString stringWithFormat:@"sms:%@&body=%@", phoneNumber, message];
|
||||
// NSURL *url = [NSURL URLWithString:[smsQuery stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
|
||||
// [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
|
||||
[MVMCoreActionUtility linkAway:[smsQuery stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] appURLString:nil];
|
||||
}
|
||||
|
||||
- (void)callAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
|
||||
// Call
|
||||
NSString *callNumber = [actionInformation stringForKey:KeyCallNumber];
|
||||
|
||||
@ -34,6 +34,7 @@ extern NSString * const KeyActionTypeBack;
|
||||
extern NSString * const KeyActionTypeShare;
|
||||
extern NSString * const KeyShareType;
|
||||
extern NSString * const KeyShareText;
|
||||
extern NSString * const KeyActionTypeSMS;
|
||||
extern NSString * const KeyActionTypeCall;
|
||||
extern NSString * const KeyActionTypePreviousSubmit;
|
||||
extern NSString * const KeyActionTypeCancel;
|
||||
|
||||
@ -35,6 +35,7 @@ NSString * const KeyActionTypeRestart = @"restart";
|
||||
NSString * const KeyActionTypeBack = @"back";
|
||||
NSString * const KeyActionTypeShare = @"share";
|
||||
NSString * const KeyActionTypeCall = @"call";
|
||||
NSString * const KeyActionTypeSMS = @"sms";
|
||||
NSString * const KeyActionTypePreviousSubmit = @"previousSubmit";
|
||||
NSString * const KeyActionTypeCancel = @"cancel";
|
||||
NSString * const KeyActionTypeRedirect = @"switchApp";
|
||||
|
||||
33
MVMCore/MVMCore/Models/ActionType/ActionOpenSMSModel.swift
Normal file
33
MVMCore/MVMCore/Models/ActionType/ActionOpenSMSModel.swift
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// ActionOpenSMSModel.swift
|
||||
// MVMCore
|
||||
//
|
||||
// Created by Kevin Christiano on 3/11/21.
|
||||
// Copyright © 2021 myverizon. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
@objcMembers public class ActionOpenSMSModel: ActionModelProtocol {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Properties
|
||||
//--------------------------------------------------
|
||||
|
||||
public static var identifier: String = "sms"
|
||||
public var actionType: String = ActionCallModel.identifier
|
||||
// TODO: decode into phone number once action handler is re-written
|
||||
public var callNumber: String
|
||||
public var message: String?
|
||||
public var extraParameters: JSONValueDictionary?
|
||||
public var analyticsData: JSONValueDictionary?
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializer
|
||||
//--------------------------------------------------
|
||||
|
||||
public init(callNumber: String, message: String?, _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
||||
self.callNumber = callNumber
|
||||
self.message = message
|
||||
self.extraParameters = extraParameters
|
||||
self.analyticsData = analyticsData
|
||||
}
|
||||
}
|
||||
@ -6,7 +6,6 @@
|
||||
// Copyright © 2019 myverizon. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
@objcMembers public class ModelMapping: NSObject {
|
||||
|
||||
@ -22,5 +21,6 @@ import Foundation
|
||||
try? ModelRegistry.register(ActionSettingModel.self)
|
||||
try? ModelRegistry.register(ActionNoopModel.self)
|
||||
try? ModelRegistry.register(ActionActionsModel.self)
|
||||
try? ModelRegistry.register(ActionOpenSMSModel.self)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user