diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m index 7248264..7c15527 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m @@ -257,50 +257,45 @@ NSString * const KeyActionTypeOpen = @"openPage"; } } -// Privacy - Contacts Usage Description - (void)contactAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject { -// CNAuthorizationStatus status = [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts]; -// -// if (status == CNAuthorizationStatusAuthorized) { - __weak typeof(self) weakSelf = self; + __weak typeof(self) weakSelf = self; + + NSString *MDN = [actionInformation string:KeyCallNumber]; + + if (MDN) { + CNMutableContact *contact = [[CNMutableContact alloc] init]; + NSString *approach = [actionInformation stringForKey:@"approach"]; - NSString *MDN = [actionInformation string:KeyCallNumber]; + CNLabeledValue *phone = [[CNLabeledValue alloc] initWithLabel:CNLabelOther value:[[CNPhoneNumber alloc] initWithStringValue:MDN]]; + contact.phoneNumbers = @[phone]; - if (MDN) { - CNMutableContact *contact = [[CNMutableContact alloc] init]; - NSString *approach = [actionInformation stringForKey:@"approach"]; - - CNLabeledValue *phone = [[CNLabeledValue alloc] initWithLabel:CNLabelOther value:[[CNPhoneNumber alloc] initWithStringValue:MDN]]; - 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.delegate = weakSelf; - - [[MVMCoreNavigationHandler sharedNavigationHandler] presentViewController:controller animated:YES]; - }]; - } else if ([approach isEqualToString:KeyCreate]) { - [MVMCoreDispatchUtility performBlockOnMainThread:^{ - contact.givenName = [actionInformation string:@"firstName"]; - contact.familyName = [actionInformation string:@"lastName"]; - - CNContactStore *store = [[CNContactStore alloc] init]; - CNContactViewController *controller = [CNContactViewController viewControllerForNewContact:contact]; - controller.contactStore = store; - controller.delegate = weakSelf; - - UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController: controller]; - navigationController.modalPresentationStyle = UIModalPresentationPageSheet; - - [[MVMCoreNavigationHandler sharedNavigationHandler] pushViewController:controller animated:YES]; - }]; - } + 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.delegate = weakSelf; + + [[MVMCoreNavigationHandler sharedNavigationHandler] presentViewController:controller animated:YES]; + }]; + } else if ([approach isEqualToString:KeyCreate]) { + [MVMCoreDispatchUtility performBlockOnMainThread:^{ + contact.givenName = [actionInformation string:@"firstName"]; + contact.familyName = [actionInformation string:@"lastName"]; + + CNContactStore *store = [[CNContactStore alloc] init]; + CNContactViewController *controller = [CNContactViewController viewControllerForNewContact:contact]; + controller.contactStore = store; + controller.delegate = weakSelf; + + UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController: controller]; + navigationController.modalPresentationStyle = UIModalPresentationPageSheet; + + [[MVMCoreNavigationHandler sharedNavigationHandler] pushViewController:controller animated:YES]; + }]; } -// } + } } - (void)callAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {