Skip to content

Commit

Permalink
Beacon framework update
Browse files Browse the repository at this point in the history
  • Loading branch information
jgritman committed Mar 15, 2019
1 parent 0f78793 commit 9a771f4
Show file tree
Hide file tree
Showing 91 changed files with 219 additions and 37 deletions.
Binary file modified Beacon.framework/Beacon
Binary file not shown.
Binary file modified Beacon.framework/Beacon.bundle/Assets.car
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Beacon.framework/Beacon.bundle/Beacon.storyboardc/Info.plist
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Beacon.framework/Beacon.bundle/BeaconAttachmentCell.nib
Binary file not shown.
Binary file modified Beacon.framework/Beacon.bundle/BeaconContactFormField.nib
Binary file not shown.
Binary file modified Beacon.framework/Beacon.bundle/BeaconDateCustomField.nib
Binary file not shown.
Binary file modified Beacon.framework/Beacon.bundle/BeaconDatePicker.nib
Binary file not shown.
Binary file modified Beacon.framework/Beacon.bundle/BeaconDropdownCustomField.nib
Binary file not shown.
Binary file modified Beacon.framework/Beacon.bundle/BeaconDropdownPicker.nib
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Beacon.framework/Beacon.bundle/BeaconMultilineCustomField.nib
Binary file not shown.
Binary file modified Beacon.framework/Beacon.bundle/BeaconNumberCustomField.nib
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Beacon.framework/Beacon.bundle/BeaconSearchFooterView.nib
Binary file not shown.
Binary file modified Beacon.framework/Beacon.bundle/BeaconSinglelineCustomField.nib
Binary file not shown.
Binary file modified Beacon.framework/Beacon.bundle/HSBeaconLoadingViewController.nib
Binary file not shown.
Binary file modified Beacon.framework/Beacon.bundle/HSBeaconSearchResultsCell.nib
Binary file not shown.
Binary file modified Beacon.framework/Beacon.bundle/HSStatusMessageViewController.nib
Binary file not shown.
Binary file modified Beacon.framework/Beacon.bundle/Info.plist
Binary file not shown.
Binary file modified Beacon.framework/Beacon.bundle/en.lproj/BeaconLocalizable.strings
Binary file not shown.
1 change: 1 addition & 0 deletions Beacon.framework/Headers/Beacon.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ FOUNDATION_EXPORT const unsigned char BeaconVersionString[];
#import "HSBeacon.h"
#import "HSBeaconContactForm.h"
#import "HSBeaconSettings.h"
#import "HSBeaconSuggestionItem.h"
#import "HSBeaconUser.h"

#endif /* _BEACON_ */
21 changes: 21 additions & 0 deletions Beacon.framework/Headers/HSBeacon.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import <UIKit/UIKit.h>

@protocol HSBeaconSuggestionItem;
@class HSBeaconUser;
@class HSBeaconSettings;

Expand Down Expand Up @@ -110,6 +111,19 @@ NS_ASSUME_NONNULL_BEGIN
*/
+ (void)suggest:(NSArray <NSString *> *)articleIds;

/**
Programmatically change the suggestted items displayed. This implementation accepts
either `HSBeaconArticleSuggestion` or `HSBeaconLinkSuggestion` objects in the array.
If the Beacon is visible the change will take place right away. Otherwise, the article
data will change on the next open.
Passing in an empty array will restore the default list.
@param suggestions An array of HSBeaconArticleSuggestion or HSBeaconLinkSuggestion objects
*/
+ (void)suggestWithItems:(NSArray<id<HSBeaconSuggestionItem>> *)suggestions;

#pragma mark - Push Notifications

/**
Expand Down Expand Up @@ -329,6 +343,13 @@ You can use this method to open a specific Docs Article within Beacon, using the
*/
+ (void)openArticle:(NSString *)articleId beaconSettings:(HSBeaconSettings *)settings viewController:(UIViewController *)viewController signature:(NSString * _Nullable)signature;

/**
Resets the contact form by clearing all of its fields, custom fields and attachments. If your Beacon is in Normal Mode, calling reset will clear all contact form fields, including name and email address.
If your Beacon is in Secure Mode, calling reset will not clear the customer’s name or email address. Those inputs will remain hidden.
*/
+ (void)reset;

#pragma mark - Unavailable Methods

/**
Expand Down
15 changes: 15 additions & 0 deletions Beacon.framework/Headers/HSBeaconContactForm.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#import <Foundation/Foundation.h>

@class HSBeaconSettings;

NS_ASSUME_NONNULL_BEGIN
/**
A file attached to the new conversation contact form.
Expand All @@ -24,6 +26,12 @@ NS_ASSUME_NONNULL_BEGIN
*/
@interface HSBeaconContactForm : NSObject

/**
The id of the Beacon that's being prefilled. Useful if you have multiple Beacons in your app
and need different prefill logic for each one.
*/
@property(strong, nonatomic, readonly) HSBeaconSettings *beaconSettings;

/**
The customer email. This will be ignored if secure mode is used or if the customer has previously
sent a message through the Beacon SDK. Unlike the email set in the `login` method, this value
Expand Down Expand Up @@ -57,6 +65,13 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property(readonly) NSArray<id<HSBeaconContactFormAttachment>> *attachments;

/**
Create a contact form with the specified Beacon id. As a developer you won't need to
create a contact form, as the SDK will initialize the object and pass it to the delegate
method.
*/
- (instancetype)initWithBeaconSettings:(HSBeaconSettings *)beaconSettings;

/**
Adds a new attachment to this object. There is a maximum of 3 attachments allowed. Any calls
after the first 3 will be ignored and the method will return `NO`.
Expand Down
34 changes: 33 additions & 1 deletion Beacon.framework/Headers/HSBeaconSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#import "HSBeaconContactForm.h"
#import "HSBeaconMessagingSettings.h"
#import "HSBeaconSettings.h"

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -11,12 +12,43 @@ NS_ASSUME_NONNULL_BEGIN
*/
@protocol HSBeaconDelegate <NSObject>


@optional
/**
The `prefill` method is called before showing the new conversation contact form. Any values
set on the `form` object will be prepopulated for the customer.
*/
- (void)prefill:(HSBeaconContactForm *)form;


@optional
/**
This method is called the first time the Beacon is displayed, after the configuration
has been successfully loaded over the network.
*/
- (void)onBeaconInitialOpen:(HSBeaconSettings *)beaconSettings;


@optional
/**
This method is called anytime the Beacon modal is displayed.
*/
- (void)onBeaconOpen:(HSBeaconSettings *)beaconSettings;


@optional
/**
This method is called the first time the Beacon is dismissed each session.
*/
- (void)onBeaconInitialClose:(HSBeaconSettings *)beaconSettings;


@optional
/**
This method is called every time the Beacon modal is dismissed.
*/
- (void)onBeaconClose:(HSBeaconSettings *)beaconSettings;

@end


Expand Down Expand Up @@ -77,7 +109,7 @@ NS_ASSUME_NONNULL_BEGIN
Override the color from the Beacon Builder. The `useNavigationBarAppearance` option
will override this value.
*/
@property (weak, nonatomic, nullable) UIColor *color;
@property (strong, nonatomic, nullable) UIColor *color;

/**
Set different display options for messaging.
Expand Down
72 changes: 72 additions & 0 deletions Beacon.framework/Headers/HSBeaconSuggestionItem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/**
This protocol indicates an object can be passed into suggesiton overides via the
`HSBeacon` `suggestWithItems:` method.
*/
@protocol HSBeaconSuggestionItem

@end

/**
Provide an article id for suggestion overrides. The article title and url is looked
up from Help Scout before rendering the suggestion.
*/
@interface HSBeaconArticleSuggestion : NSObject <HSBeaconSuggestionItem>

/**
Initialize with the specified article id.
Article IDs can be found in Help Scout by navigating to the article and copying the
article ID from the URL. The URL is structured like this:
https://secure.helpscout.net/docs/[COLLECTION ID]/article/[ARTICLE ID]/
*/
- (instancetype)initWithId:(NSString *)articleId;

/**
The article id to look up and show in the suggestions table.
*/
@property (nonatomic, readonly) NSString *articleId;

#pragma mark - Unavailable Methods

/**
HSBeaconArticleSuggestion objects are immutable, so always initialze with the articleId constructor.
*/
- (instancetype) __unavailable init;

@end

/**
Provide an title and url for suggestion overrides. The url is opened in a modal using
`SFSafariViewController`.
*/
@interface HSBeaconLinkSuggestion : NSObject <HSBeaconSuggestionItem>

/**
Initialize a link suggestion with the specified url and text.
*/
- (instancetype)initWithUrl:(NSURL *)url text:(NSString *)text;

/**
The url the suggestion will open.
*/
@property (nonatomic, readonly) NSURL *url;

/**
The text rendered in the suggestions table.
*/
@property (nonatomic, readonly) NSString *text;

#pragma mark - Unavailable Methods

/**
HSBeaconLinkSuggestion objects are immutable, so always initialze with the url and text constructor.
*/
- (instancetype) __unavailable init;

@end

NS_ASSUME_NONNULL_END
Binary file modified Beacon.framework/Info.plist
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@

@property(weak, nonatomic) IBOutlet UILabel *messageSubtitle;

@property (weak, nonatomic) IBOutlet UIBarButtonItem *closeButton;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@

- (BOOL)sendPendingUploads;

/* this is for resetting the form */
- (void)deleteAttachments;

/* this is for post-send */
- (void)clearAttachments;

@end
4 changes: 3 additions & 1 deletion Beacon.framework/PrivateHeaders/HSBeaconBaseAPIClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ NS_ASSUME_NONNULL_BEGIN

@property (nonatomic, strong) NSURL *baseURL;
@property (nonatomic, strong) NSString *beaconId;
@property (nonatomic, strong) NSString *deviceId;
@property (nonatomic, strong) NSURLSession *beaconSession;

- (instancetype)initWithBeaconId:(NSString *)beaconId;
- (instancetype)initWithBeaconId:(NSString *)beaconId deviceId: (NSString *)deviceId;

/* this constructor is only used for testing */
- (instancetype)initWithBeaconId:(NSString *)beaconId session:(NSURLSession *)session;

- (NSURLSessionDataTask *)performGETRequestForURL:(NSURL *)url completion:(NetworkCompletionHandler)completion;
Expand Down
2 changes: 2 additions & 0 deletions Beacon.framework/PrivateHeaders/HSBeaconContactFormField.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

- (void)setText:(NSString *)text;

- (void)resetValue;

- (void)setPlaceholder:(NSString *)placeholder;

- (HSContactFieldValidationResult)validate:(BOOL)errorsDisplayed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@

- (HSBeaconEmailMessage *)constructMessage;

- (void)clearForm;
- (void)clearForm:(BOOL) forReset;

- (void)populateSecurityInfo;

- (void)setCustomFieldDefinitions:(NSArray<HSBeaconCustomFieldDefinition *> *)fieldDefinitions;

Expand Down
54 changes: 26 additions & 28 deletions Beacon.framework/PrivateHeaders/HSBeaconContext.h
Original file line number Diff line number Diff line change
@@ -1,61 +1,59 @@
#import <Foundation/Foundation.h>

#import "HSBeaconActivityLog.h"
#import "HSBeaconCloudFrontAPIClient.h"
#import "HSBeaconConfig.h"
#import "HSBeaconDocsAPIClient.h"
#import "HSBeaconEmailMessage.h"
#import "HSBeaconKeychainWrapper.h"
#import "HSBeaconLocalizedStrings.h"
#import "HSBeaconDocsAPIClient.h"
#import "HSBeaconMessagingAPIClient.h"
#import "HSBeaconCloudFrontAPIClient.h"
#import "HSBeaconReplyNotificationPayload.h"
#import "HSBeaconSecurityInfo.h"
#import "HSBeaconSuggestionItem.h"
#import "HSBeaconTintColor.h"
#import "HSBeaconReplyNotificationPayload.h"

NS_ASSUME_NONNULL_BEGIN

@interface HSBeaconContext : NSObject

@property (strong, nonatomic) HSBeaconConfig *config;
@property (readonly) HSBeaconSettings *beaconSettings;
@property (readonly) HSBeaconTintColor *tintColorSettings;
@property (readonly) HSBeaconDocsAPIClient *docsApiClient;
@property (readonly) HSBeaconMessagingAPIClient *messagingApiClient;
@property (readonly) HSBeaconCloudFrontAPIClient *cloudFrontApiClient;
@property (readonly) id<HSBeaconStringLocalizer> localizedStrings;
@property (readonly) HSBeaconActivityLog *activityLog;
@property (readonly) HSBeaconSecurityInfo *securityInfo;
@property (readonly) HSBeaconKeychainWrapper *keychainWrapper;

@property (readonly) NSMutableDictionary<NSNumber *, HSBeaconReplyMessage *> *draftReplies;
@property (readonly) BOOL messagingEnabled;
@property (readonly) BOOL docsOnly;
@property (readonly) BOOL docsEnabled;
@property (readonly) BOOL messagingOnly;
@property (readonly) BOOL validConfig;
@property (readonly, nonatomic) HSBeaconSettings *beaconSettings;
@property (readonly, nonatomic) HSBeaconTintColor *tintColorSettings;

/* these are readwrite for testing purposes */
@property (nonatomic) HSBeaconDocsAPIClient *docsApiClient;
@property (nonatomic) HSBeaconMessagingAPIClient *messagingApiClient;
@property (nonatomic) HSBeaconCloudFrontAPIClient *cloudFrontApiClient;
@property (nonatomic) id<HSBeaconStringLocalizer> localizedStrings;

@property (readonly, nonatomic) HSBeaconActivityLog *activityLog;
@property (readonly, nonatomic) HSBeaconSecurityInfo *securityInfo;
@property (readonly, nonatomic) HSBeaconKeychainWrapper *keychainWrapper;

@property (readonly, nonatomic) NSMutableDictionary<NSNumber *, HSBeaconReplyMessage *> *draftReplies;
@property (readonly, nonatomic) BOOL messagingEnabled;
@property (readonly, nonatomic) BOOL docsOnly;
@property (readonly, nonatomic) BOOL docsEnabled;
@property (readonly, nonatomic) BOOL messagingOnly;
@property (readonly, nonatomic) BOOL validConfig;

@property (readonly, nonatomic) BOOL showNameEnabled;
@property (readonly, nonatomic) BOOL showSubjectEnabled;
@property (readonly, nonatomic) BOOL attachmentsEnabled;
@property (readonly, nonatomic) BOOL customFieldsEnabled;
@property (readonly, nonatomic) BOOL showGetInTouchEnabled;

@property (strong, nonatomic) NSArray<NSString *> *suggestionArticleIds;
@property (strong, nonatomic) NSArray<id<HSBeaconSuggestionItem>> *customSuggestions;

@property (atomic) BOOL loadFailed;

@property (nonatomic) BOOL hasPreviousMessages;

@property (nullable) HSBeaconEmailMessage *draftMessage;

- (instancetype _Nonnull)initWithBeaconSettings:(HSBeaconSettings *_Nullable)beaconSettings user:(HSBeaconUser *_Nullable)user signature:(NSString *_Nullable)signature;

- (instancetype _Nonnull)initWithBeaconSettings:(HSBeaconSettings *_Nullable)beaconSettings
user:(HSBeaconUser *_Nullable)user
signature:(NSString *_Nullable)signature
stringLocalizer:(id<HSBeaconStringLocalizer>)stringLocalizer
messagingClient:(HSBeaconMessagingAPIClient *_Nullable)messagingClient;

- (void)lookupUserDeviceInfo;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

- (void)conversationUpdated:(HSBeaconConversation *)conversation;

- (void)conversationDismissed:(HSBeaconConversation *)conversation;

@end

@interface HSBeaconConversationDetailsController : UIViewController <HSCardStackEmbeddable>
Expand Down
2 changes: 2 additions & 0 deletions Beacon.framework/PrivateHeaders/HSBeaconLocalizedStrings.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (strong, nonatomic) NSDictionary<NSString *, NSString *> *configStrings;
@property BOOL useLocalOverrides;

+ (NSString *)localizableStringFromApp:(NSString *)key;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- (void)messageEntryComplete:(HSBeaconMessageEntryContainerController *)controller;
- (void)messageCountRefreshRequired:(HSBeaconMessageEntryContainerController *)controller;
- (void)showPreviousMessages:(HSBeaconMessageEntryContainerController *)controller;
- (void)reloadEntryController:(HSBeaconMessageEntryContainerController *)controller;

@end

Expand Down Expand Up @@ -41,8 +42,13 @@
@property(weak, nonatomic) IBOutlet HSBeaconErrorView *errorContainer;
@property(strong, nonatomic) IBOutlet NSLayoutConstraint *errorContainerHeight;

@property (weak, nonatomic) IBOutlet UIBarButtonItem *backButton;
@property (weak, nonatomic) IBOutlet UIBarButtonItem *closeButton;

- (void)sendMessage;

- (void)showPreviousMessages;

- (void)resetForm;

@end
Loading

0 comments on commit 9a771f4

Please sign in to comment.