rename and update
This commit is contained in:
parent
d9aa011f05
commit
f272cd580b
@ -34,7 +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 */; };
|
||||
0ACC81A22613C73800A9C886 /* ActionMakeContactModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ACC81A12613C73800A9C886 /* ActionMakeContactModel.swift */; };
|
||||
0ACC81A22613C73800A9C886 /* ActionContactModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ACC81A12613C73800A9C886 /* ActionContactModel.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, ); }; };
|
||||
@ -170,7 +170,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>"; };
|
||||
0ACC81A12613C73800A9C886 /* ActionMakeContactModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionMakeContactModel.swift; sourceTree = "<group>"; };
|
||||
0ACC81A12613C73800A9C886 /* ActionContactModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionContactModel.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>"; };
|
||||
@ -454,7 +454,7 @@
|
||||
BB780ADE250F8C890030BD2F /* ActionNoopModel.swift */,
|
||||
D27073B625BB45C4001C7246 /* ActionActionsModel.swift */,
|
||||
0AEBB84525FA75C000EA80EE /* ActionOpenSMSModel.swift */,
|
||||
0ACC81A12613C73800A9C886 /* ActionMakeContactModel.swift */,
|
||||
0ACC81A12613C73800A9C886 /* ActionContactModel.swift */,
|
||||
);
|
||||
path = ActionType;
|
||||
sourceTree = "<group>";
|
||||
@ -856,7 +856,7 @@
|
||||
8876D5E91FB50AB000EB2E3D /* NSArray+MFConvenience.m in Sources */,
|
||||
D27073B725BB45C4001C7246 /* ActionActionsModel.swift in Sources */,
|
||||
946EE1B2237B5F260036751F /* JSONValue.swift in Sources */,
|
||||
0ACC81A22613C73800A9C886 /* ActionMakeContactModel.swift in Sources */,
|
||||
0ACC81A22613C73800A9C886 /* ActionContactModel.swift in Sources */,
|
||||
AFBB96971FBA3A9A0008D868 /* MVMCorePresentViewControllerOperation.m in Sources */,
|
||||
AF43A5781FBA5B7C008E9347 /* MVMCoreJSONConstants.m in Sources */,
|
||||
AFBB96691FBA3A570008D868 /* MVMCoreRequestParameters.m in Sources */,
|
||||
|
||||
@ -11,13 +11,14 @@
|
||||
#import <MVMCore/MVMCoreActionDelegateProtocol.h>
|
||||
#import <MVMCore/MVMCoreLoadDelegateProtocol.h>
|
||||
#import <MVMCore/MVMCorePresentationDelegateProtocol.h>
|
||||
#import <ContactsUI/ContactsUI.h>
|
||||
@class DelegateObject;
|
||||
|
||||
extern NSString * _Nonnull const KeyActionType;
|
||||
extern NSString * _Nonnull const KeyActionTypeLinkAway;
|
||||
extern NSString * _Nonnull const KeyActionTypeOpen;
|
||||
|
||||
@interface MVMCoreActionHandler : NSObject
|
||||
@interface MVMCoreActionHandler : NSObject <CNContactViewControllerDelegate>
|
||||
|
||||
/// Returns the shared action handler
|
||||
+ (nullable instancetype)sharedActionHandler;
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
#import <SafariServices/SafariServices.h>
|
||||
#import <MVMCore/MVMCore-Swift.h>
|
||||
#import "MVMCoreLoadingOverlayHandler.h"
|
||||
#import <ContactsUI/ContactsUI.h>
|
||||
|
||||
NSString * const KeyActionType = @"actionType";
|
||||
NSString * const KeyActionTypeLinkAway = @"openURL";
|
||||
@ -258,21 +259,55 @@ NSString * const KeyActionTypeOpen = @"openPage";
|
||||
|
||||
- (void)contactAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
|
||||
|
||||
__weak typeof(self) weakSelf = self;
|
||||
NSString *approach = [actionInformation stringForKey:@"approach"];
|
||||
NSString *MDN = [actionInformation string:KeyCallNumber];
|
||||
|
||||
if ([approach isEqualToString:KeyAdd]) {
|
||||
|
||||
} else if ([approach isEqualToString:KeyCreate]) {
|
||||
|
||||
NSString *firstName = [actionInformation string:@"firstName"];
|
||||
NSString *lastname = [actionInformation string:@"lastName"];
|
||||
|
||||
}
|
||||
|
||||
// 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];
|
||||
CNContactStore *store = [[CNContactStore alloc] init];
|
||||
CNMutableContact *mutContact = [[CNMutableContact alloc] init];
|
||||
|
||||
CNLabeledValue *phone = [[CNLabeledValue alloc] initWithLabel:CNLabelHome value:[[CNPhoneNumber alloc] initWithStringValue:MDN]];
|
||||
mutContact.phoneNumbers = @[phone];
|
||||
|
||||
CNContactViewController *controller = [[CNContactViewController alloc] init];
|
||||
controller.contactStore = store;
|
||||
controller.delegate = weakSelf;
|
||||
|
||||
|
||||
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
||||
[[MVMCoreNavigationHandler sharedNavigationHandler] presentViewController:controller animated:YES];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)contactViewController:(CNContactViewController *)viewController didCompleteWithContact:(CNContact *)contact {
|
||||
|
||||
[[MVMCoreNavigationHandler sharedNavigationHandler] removeCurrentViewController];
|
||||
}
|
||||
|
||||
- (BOOL)contactViewController:(CNContactViewController *)viewController shouldPerformDefaultActionForContactProperty:(CNContactProperty *)property {
|
||||
return YES;
|
||||
}
|
||||
/*
|
||||
let store = CNContactStore()
|
||||
let contact = CNMutableContact()
|
||||
let homePhone = CNLabeledValue(label: CNLabelHome, value: CNPhoneNumber(stringValue :phNo ))
|
||||
contact.phoneNumbers = [homePhone]
|
||||
let controller = CNContactViewController(forUnknownContact : contact)
|
||||
controller.contactStore = store
|
||||
controller.delegate = self
|
||||
self.navigationController?.setNavigationBarHidden(false, animated: true)
|
||||
self.navigationController!.pushViewController(controller, animated: true)
|
||||
*/
|
||||
|
||||
- (void)callAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
|
||||
// Call
|
||||
NSString *callNumber = [actionInformation stringForKey:KeyCallNumber];
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
//
|
||||
// ActionMakeContactModel.swift
|
||||
// ActionContactModel.swift
|
||||
// MVMCore
|
||||
//
|
||||
// Created by Kevin Christiano on 3/30/21.
|
||||
@ -7,7 +7,7 @@
|
||||
//
|
||||
|
||||
|
||||
@objcMembers public class ActionMakeContactModel: ActionModelProtocol {
|
||||
@objcMembers public class ActionContactModel: ActionModelProtocol {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Properties
|
||||
//--------------------------------------------------
|
||||
@ -15,18 +15,21 @@
|
||||
public static var identifier: String = "contact"
|
||||
public var actionType: String = ActionCallModel.identifier
|
||||
// TODO: decode into phone number once action handler is re-written
|
||||
// public var callNumber: String
|
||||
public var callNumber: String
|
||||
public var firstName: String?
|
||||
public var lastName: String?
|
||||
public var approach: String = KeyCreate
|
||||
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
|
||||
public init(callNumber: String, firstName: String? = nil, lastName: String? = nil, _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
||||
self.callNumber = callNumber
|
||||
self.firstName = firstName
|
||||
self.lastName = lastName
|
||||
self.extraParameters = extraParameters
|
||||
self.analyticsData = analyticsData
|
||||
}
|
||||
@ -23,7 +23,7 @@
|
||||
try? ModelRegistry.register(ActionNoopModel.self)
|
||||
try? ModelRegistry.register(ActionActionsModel.self)
|
||||
try? ModelRegistry.register(ActionOpenSMSModel.self)
|
||||
try? ModelRegistry.register(ActionMakeContactModel.self)
|
||||
try? ModelRegistry.register(ActionContactModel.self)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user