merging. molecule updates.

This commit is contained in:
Kevin G Christiano 2021-04-09 16:43:37 -04:00
parent 4400682469
commit 1d968bd2c1
2 changed files with 53 additions and 55 deletions

View File

@ -272,20 +272,20 @@ NSString * const KeyActionTypeOpen = @"openPage";
__weak typeof(self) weakSelf = self;
NSString *MDN = [actionInformation string:KeyCallNumber];
NSString *phoneNumber = [actionInformation string:@"phoneNumber"];
if (MDN) {
if (!phoneNumber) { return; }
CNMutableContact *contact = [[CNMutableContact alloc] init];
NSString *approach = [actionInformation stringForKey:@"approach"];
CNLabeledValue *phone = [[CNLabeledValue alloc] initWithLabel:CNLabelOther value:[[CNPhoneNumber alloc] initWithStringValue:MDN]];
CNLabeledValue *phone = [[CNLabeledValue alloc] initWithLabel:CNLabelOther value:[[CNPhoneNumber alloc] initWithStringValue:phoneNumber]];
contact.phoneNumbers = @[phone];
if ([approach isEqualToString:KeyAdd]) {
[MVMCoreDispatchUtility performBlockOnMainThread:^{
CNContactPickerViewController *controller = [[CNContactPickerViewController alloc] init];
// Setting to accessibilityValue as a workaround to pass data via the delegate function.
[controller setAccessibilityValue:MDN];
[controller setAccessibilityValue:phoneNumber];
controller.delegate = weakSelf;
[[MVMCoreNavigationHandler sharedNavigationHandler] presentViewController:controller animated:YES];
@ -307,7 +307,6 @@ NSString * const KeyActionTypeOpen = @"openPage";
}];
}
}
}
- (void)callAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
// Call
@ -405,12 +404,12 @@ NSString * const KeyActionTypeOpen = @"openPage";
- (void)contactPicker:(CNContactPickerViewController *)picker didSelectContact:(CNContact *)contact {
// This is a means to pass the data to this delegate function.
NSString *MDN = picker.accessibilityValue;
NSString *phoneNumber = picker.accessibilityValue;
if (MDN) {
if (!phoneNumber) { return; }
CNContactStore *store = [[CNContactStore alloc] init];
CNMutableContact *existingContact = [(CNMutableContact*)contact mutableCopy];
CNPhoneNumber * number = [[CNPhoneNumber alloc] initWithStringValue:MDN];
CNPhoneNumber * number = [[CNPhoneNumber alloc] initWithStringValue:phoneNumber];
CNLabeledValue * labelValue = [[CNLabeledValue alloc]initWithLabel:CNLabelOther value:number];
NSMutableArray<CNLabeledValue *> *phoneNumbers = [NSMutableArray new];
[phoneNumbers addObject:labelValue];
@ -425,7 +424,6 @@ NSString * const KeyActionTypeOpen = @"openPage";
[[MVMCoreNavigationHandler sharedNavigationHandler] pushViewController:controller animated:YES];
}];
}
}
#pragma mark - Open URL

View File

@ -17,7 +17,7 @@ import ContactsUI
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 phoneNumber: String
public var firstName: String?
public var lastName: String?
public var approach: String = KeyCreate
@ -28,8 +28,8 @@ import ContactsUI
// MARK: - Initializer
//--------------------------------------------------
public init(callNumber: String, firstName: String? = nil, lastName: String? = nil, approach: String = KeyCreate, _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
self.callNumber = callNumber
public init(phoneNumber: String, firstName: String? = nil, lastName: String? = nil, approach: String = KeyCreate, _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
self.phoneNumber = phoneNumber
self.firstName = firstName
self.lastName = lastName
self.approach = approach