Skip to content

Instantly share code, notes, and snippets.

@oisin
Created February 9, 2014 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oisin/8901053 to your computer and use it in GitHub Desktop.
Save oisin/8901053 to your computer and use it in GitHub Desktop.
Changing the background colour of the Converser SDK generated feedback form.
# Simple tester for Converser SDK feedback form manipulation. No network connections
# made.
#import "CIOSecondViewController.h"
@interface CIOSecondViewController ()
@property (strong,nonatomic) VGConversationEngine *converser;
@end
@implementation CIOSecondViewController
- (void) viewDidLoad {
[super viewDidLoad];
if (self.converser == nil) {
self.converser = [[VGConversationEngine alloc] initWithAppKey:@"xxxxxxxxxxx"];
}
}
-(IBAction)showFeedbackForm:(id)sender {
NSLog(@"About to show feedback form");
// Ask the Converser SDK to create a controller that will run the feedback controller, and display it modally.
NSArray *fieldsArray = @[
@{@"Type": @"HeaderText", @"Label" : @"YOUR FEEDBACK"},
@{@"Type": @"DescriptionText", @"Label" : @"Your feedback is important to us, please fill in the box below with your query and we'll get right back to you."},
@{@"Type": @"TextArea", @"Label" : @"Enter your text here"},
@{@"Type": @"Name", @"Label" : @"Your name (optional)"},
@{@"Type": @"Email", @"Label" : @"Your email address (optional)"}
];
NSDictionary *hiddenData = @{@"Source": @"Converser feedback app testing...."};
ConverserNavigationController *cnc = [self.converser feedbackControllerWithFields:fieldsArray context:hiddenData delegate:self];
// Dive into the nav controller from the SDK and pull out the first view controller, which holds the generated form
// then adjust the background colour of the view to make it more legible.
//
UIViewController *vc = [cnc viewControllers][0];
vc.view.backgroundColor = [UIColor orangeColor];
[self presentViewController:cnc animated:YES completion:nil];
}
- (void) customFeedbackController:(VGCustomFeedbackViewController *)controller didFinishWithResult:(VGCustomFeedbackResultType)result error:(NSError *)error{
NSLog(@"User has completed feedback form");
[controller dismissViewControllerAnimated:YES completion:nil];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment