contact action
This commit is contained in:
parent
dc90af50b2
commit
a25e88427a
@ -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 {
|
- (void)contactAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
|
||||||
|
|
||||||
// CNAuthorizationStatus status = [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts];
|
__weak typeof(self) weakSelf = self;
|
||||||
//
|
|
||||||
// if (status == CNAuthorizationStatusAuthorized) {
|
NSString *MDN = [actionInformation string:KeyCallNumber];
|
||||||
__weak typeof(self) weakSelf = self;
|
|
||||||
|
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) {
|
if ([approach isEqualToString:KeyAdd]) {
|
||||||
CNMutableContact *contact = [[CNMutableContact alloc] init];
|
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
||||||
NSString *approach = [actionInformation stringForKey:@"approach"];
|
CNContactPickerViewController *controller = [[CNContactPickerViewController alloc] init];
|
||||||
|
// Setting to accessibilityValue as a workaround to pass data via the delegate function.
|
||||||
CNLabeledValue *phone = [[CNLabeledValue alloc] initWithLabel:CNLabelOther value:[[CNPhoneNumber alloc] initWithStringValue:MDN]];
|
[controller setAccessibilityValue:MDN];
|
||||||
contact.phoneNumbers = @[phone];
|
controller.delegate = weakSelf;
|
||||||
|
|
||||||
if ([approach isEqualToString:KeyAdd]) {
|
[[MVMCoreNavigationHandler sharedNavigationHandler] presentViewController:controller animated:YES];
|
||||||
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
}];
|
||||||
CNContactPickerViewController *controller = [[CNContactPickerViewController alloc] init];
|
} else if ([approach isEqualToString:KeyCreate]) {
|
||||||
// Setting to accessibilityValue as a workaround to pass data via the delegate function.
|
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
||||||
[controller setAccessibilityValue:MDN];
|
contact.givenName = [actionInformation string:@"firstName"];
|
||||||
controller.delegate = weakSelf;
|
contact.familyName = [actionInformation string:@"lastName"];
|
||||||
|
|
||||||
[[MVMCoreNavigationHandler sharedNavigationHandler] presentViewController:controller animated:YES];
|
CNContactStore *store = [[CNContactStore alloc] init];
|
||||||
}];
|
CNContactViewController *controller = [CNContactViewController viewControllerForNewContact:contact];
|
||||||
} else if ([approach isEqualToString:KeyCreate]) {
|
controller.contactStore = store;
|
||||||
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
controller.delegate = weakSelf;
|
||||||
contact.givenName = [actionInformation string:@"firstName"];
|
|
||||||
contact.familyName = [actionInformation string:@"lastName"];
|
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController: controller];
|
||||||
|
navigationController.modalPresentationStyle = UIModalPresentationPageSheet;
|
||||||
CNContactStore *store = [[CNContactStore alloc] init];
|
|
||||||
CNContactViewController *controller = [CNContactViewController viewControllerForNewContact:contact];
|
[[MVMCoreNavigationHandler sharedNavigationHandler] pushViewController:controller animated:YES];
|
||||||
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 {
|
- (void)callAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user