CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

RepliesSDK-macOS 0.3.7

RepliesSDK-macOS 0.3.7

License MIT
ReleasedLast Release Aug 2020

Maintained by Replies Team.



  • By
  • Replies Team

RepliesSDK-macOS

A Framework to embed replies.io directly in your Mac application. Requires macOS 10.9 or higher.

How it works

The framework will download your suggestions and present them to the user if they match the keywords and the language the user typed in. The user language will be detected by macOS while the users types.

If you provide supportedLanguages the suggestions will fall back to the first language you provided if no suggestion for the users language has been found.

Basic Sample

# import <RepliesSDK/RepliesSDK.h>

[[RepliesIO sharedReplies] setAPIHost:@"1b.replies.io"]; // required
[[RepliesIO sharedReplies] setProductName:@"ProductName"]; // required
[[RepliesIO sharedReplies] setFormIdentifier:@"xxx"]; // required
[[RepliesIO sharedReplies] setSubjectTypes:@[RepliesIOSubjectProblem,RepliesIOSubjectFeatureRequest]]; // optional
[[RepliesIO sharedReplies] setSupportedLanguages:@[@"en",@"de"]]; // optional
[[RepliesIO sharedReplies] setMetaData:@{@"type":@"Test"}]; // optional
[[RepliesIO sharedReplies] setDelegate:self]; // optional
[[RepliesIO sharedReplies] presentWindow:self]; // showing the actual window
[[RepliesIO sharedReplies] setCustomWindowTitle:@"Get Help"]; // optional

APIHost

Use the host provided in Replies/Settings/Channels.

ProductName

Use one of the products you have setup in Replies/Settings/Products.

FormIdentifier

You can get the identifier from the Replies/Settings/Channels.

SubjectTypes

You are free in providing any NSArray of NSStrings as subjects. The built in constants are localized in the framework's languages

RepliesIOSubjectProblem = @"Problem";
RepliesIOSubjectFeatureRequest = @"Feature Request";
RepliesIOSubjectTestimonial = @"Testimonial";
RepliesIOSubjectOther = @"Other";
RepliesIOSubjectQuestion = @"Question";
RepliesIOSubjectInquiry = @"Inquiry";

Attachments

Besides the attachments the user can add, you may add attachments programmatically. The user will see a list off all attachments and can delete them.

[RepliesIOAttachment attachmentWithPath:aPath];
[RepliesIOAttachment attachmentWithData:aData fileName:@"Test.plist"];
[RepliesIOAttachment attachmentWithString:@"Hello World" fileName:@"Text.txt"];
[RepliesIOAttachment attachmentWithApplicationLog]; // Console log is gathered asyncronous
[RepliesIOAttachment attachmentWithPropertyList:aDictionary]; // Ends up as JSON File

MetaData

With Meta data you can add a NSDictionary with NSStrings providing additional data about your product. Please respect the user's privacy. Use attachments if possible.

NSMutableDictionary * aDictionary = [NSMutableDictionary dictionary];
[aDictionary setValue:[[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleVersion"] forKey:@"version"];
[[RepliesIO sharedReplies] setMetaData:aDictionary];

SupportedLanguages

If you provide an NSArray of language codes, Replies will indicate to the user that you only can provide support in those languages. However, the user is free to send you any gibberish he/she wants.

[[RepliesIO sharedReplies] setSupportedLanguages:@[@"en",@"fr",@"jp"]];

Menu

A menu can be added alongside the regular file attachment/screenshots buttons. Although this menu can contain any functionality, you should only use it to create attachments.

NSMenu * aMenu = [[NSMenu alloc] initWithTitle:@""];
[aMenu addItemWithTitle:@"Preferences" action:@selector(attachPreferences:) keyEquivalent:@""];
[[RepliesIO sharedReplies] setMenu:aMenu];


-(void)attachPreferences:(id)sender
{
    NSDictionary * aInfo = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
    NSData * aData = [NSPropertyListSerialization dataWithPropertyList:aInfo format:NSPropertyListXMLFormat_v1_0 options:nil error:nil];
    RepliesIOAttachment * attachment = [RepliesIOAttachment attachmentWithData:aData fileName:@"Preferences.plist"];
    [[RepliesIO sharedReplies] addAttachment:attachment];
}

Available Delegate Methods

-(void)repliesWillPresentWindow:(RepliesSDK *)replies;
-(void)repliesDidPresentWindow:(RepliesSDK *)replies;
-(void)replies:(RepliesSDK *)replies willSendMessage:(RepliesIOMessage *)message;
-(void)replies:(RepliesSDK *)replies didSendMessage:(RepliesIOMessage *)message;
-(void)replies:(RepliesSDK *)replies userDidVoteForSuggestion:(NSDictionary *)suggestion;

Delegate Sample

-(void)replies:(RepliesSDK *)replies didSendMessage:(RepliesIOMessage *)message
{
    RepliesIOConfirmationAlert * aAlert = [RepliesIOConfirmationAlert alertWithMessage:message];
    aAlert.informativeText = @"Thank you for contacting support.";
    [aAlert runModal];
}