adding play audio action. current implementation.

This commit is contained in:
Christiano, Kevin 2021-07-15 13:32:29 +00:00 committed by Pfeil, Scott Robert
parent cfcf959314
commit 3a4e317ccf
10 changed files with 41 additions and 8 deletions

View File

@ -293,20 +293,41 @@ NSString * const KeyActionTypeOpen = @"openPage";
[[MVMCoreNavigationHandler sharedNavigationHandler] presentViewController:controller animated:YES];
}];
} else if ([approach isEqualToString:KeyCreate]) {
contact.givenName = [actionInformation string:@"firstName"];
contact.familyName = [actionInformation string:@"lastName"];
[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];
}];
} else if ([approach isEqualToString:KeyView]) {
NSCharacterSet *symbols = [NSCharacterSet characterSetWithCharactersInString:@".+()-  "];
NSString *contactPhoneNumber = [actionInformation string:@"phoneNumber"];
contactPhoneNumber = [[contactPhoneNumber componentsSeparatedByCharactersInSet:symbols] componentsJoinedByString:@""];
CNPhoneNumber *number = [[CNPhoneNumber alloc] initWithStringValue:contactPhoneNumber];
NSPredicate *contactPredicate = [CNContact predicateForContactsMatchingPhoneNumber:number];
NSArray *displayedKeys = @[[CNContactViewController descriptorForRequiredKeys]];
CNContactStore *store = [[CNContactStore alloc] init];
NSError *error;
CNContact *viewContact = [[store unifiedContactsMatchingPredicate:contactPredicate keysToFetch:displayedKeys error:&error] firstObject];
if (viewContact) {
[MVMCoreDispatchUtility performBlockOnMainThread:^{
CNContactViewController *controller = [CNContactViewController viewControllerForNewContact:viewContact];
controller.contactStore = store;
controller.delegate = weakSelf;
[[MVMCoreNavigationHandler sharedNavigationHandler] pushViewController:controller animated:YES];
}];
} else {
// No contacts found, show an alert
MVMCoreErrorObject *error = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorContactUnAvailable] code:ErrorCodeDefault domain:ErrorDomainNative location:[NSString stringWithFormat:@"%@_%@",NSStringFromClass([delegateObject.actionDelegate class]),KeyActionTypeContact]];
error.silentError = NO;
[self handleActionError:error actionInformation:actionInformation additionalData:additionalData delegateObject:delegateObject];
}
}
}

View File

@ -15,3 +15,4 @@ extern NSString * const HardcodedOK;
extern NSString * const HardcodedErrorCritical;
extern NSString * const HardcodedErrorUnableToProcess;
extern NSString * const HardcodedErrorContactUnAvailable;

View File

@ -15,3 +15,4 @@ NSString * const HardcodedOK = @"okCaps";
NSString * const HardcodedErrorCritical = @"Error Message Critical Key";
NSString * const HardcodedErrorUnableToProcess = @"Error Message Unable To Process Request Key";
NSString * const HardcodedErrorContactUnAvailable = @"Contact not available";

View File

@ -28,6 +28,7 @@ extern NSString * const KeyPostAction;
extern NSString * const KeyAdd;
extern NSString * const KeyCreate;
extern NSString * const KeyView;
extern NSString * const KeyLinks;
extern NSString * const KeyTitle;

View File

@ -30,6 +30,7 @@ NSString * const KeyPostAction = @"PostAction";
NSString * const KeyAdd = @"add";
NSString * const KeyCreate = @"create";
NSString * const KeyView = @"view";
NSString * const KeyLinks = @"Links";
NSString * const KeyTitle = @"title";

View File

@ -15,7 +15,7 @@ import ContactsUI
//--------------------------------------------------
public static var identifier: String = "contact"
public var actionType: String = ActionCallModel.identifier
public var actionType: String = ActionContactModel.identifier
public var phoneNumber: String
public var firstName: String?

View File

@ -13,7 +13,7 @@
//--------------------------------------------------
public static var identifier: String = "sms"
public var actionType: String = ActionCallModel.identifier
public var actionType: String = ActionOpenSMSModel.identifier
public var phoneNumber: String
public var message: String?

View File

@ -13,3 +13,5 @@
"Error Message Critical Key" = "Unable to process your request at this time. Please contact Customer Service by dialing *611. Thank you.";
"Error Message Unable To Process Request Key" = "Unable to process your request. Please try again later.";
//Fios
"Contact not available" = "Contact not available";

View File

@ -12,3 +12,6 @@
"Error Message Critical Key" = "En este momento no podemos procesar tu solicitud. Comunícate con Servicio al Cliente marcando *611. Muchas gracias.";
"Error Message Unable To Process Request Key" = "No podemos procesar tu solicitud. Vuelve a intentarlo más tarde.";
//Fios
"Contact not available" = "Contacto no disponible";

View File

@ -12,3 +12,6 @@
"Error Message Critical Key" = "En este momento no podemos procesar tu solicitud. Comunícate con Servicio al Cliente marcando *611. Muchas gracias.";
"Error Message Unable To Process Request Key" = "No podemos procesar tu solicitud. Vuelve a intentarlo más tarde.";
//Fios
"Contact not available" = "Contacto no disponible";