contact behavior

This commit is contained in:
Kevin G Christiano 2021-04-07 14:15:12 -04:00
parent f5613644a0
commit 4686dc8256

View File

@ -274,9 +274,10 @@ NSString * const KeyActionTypeOpen = @"openPage";
contact.phoneNumbers = @[phone];
if ([approach isEqualToString:KeyAdd]) {
// Nothing for now.
[MVMCoreDispatchUtility performBlockOnMainThread:^{
CNContactPickerViewController *controller = [[CNContactPickerViewController alloc] init];
// Setting to accessibilityValue as a workaround to pass data via the delegate function.
[controller setAccessibilityValue:MDN];
controller.delegate = weakSelf;
[[MVMCoreNavigationHandler sharedNavigationHandler] presentViewController:controller animated:YES];
@ -395,9 +396,13 @@ 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;
if (MDN) {
CNContactStore *store = [[CNContactStore alloc] init];
CNMutableContact *existingContact = [(CNMutableContact*)contact mutableCopy];
CNPhoneNumber * number = [[CNPhoneNumber alloc] initWithStringValue:@"1234567890"];
CNPhoneNumber * number = [[CNPhoneNumber alloc] initWithStringValue:MDN];
CNLabeledValue * labelValue = [[CNLabeledValue alloc]initWithLabel:CNLabelOther value:number];
NSMutableArray<CNLabeledValue *> *phoneNumbers = [NSMutableArray new];
[phoneNumbers addObject:labelValue];
@ -409,8 +414,9 @@ NSString * const KeyActionTypeOpen = @"openPage";
controller.delegate = self;
[MVMCoreDispatchUtility performBlockOnMainThread:^{
[[MVMCoreNavigationHandler sharedNavigationHandler] presentViewController:controller animated:YES];
[[MVMCoreNavigationHandler sharedNavigationHandler] pushViewController:controller animated:YES];
}];
}
}
#pragma mark - Open URL