Customizing UI

1. Notifications Events

To receive notification events from the user interactions with the UI, you must implement the GlanceDefaultUIDelegate protocol.

class GlanceUIManager: NSObject, GlanceDefaultUIDelegate {
    func glanceDefaultUIDialogAccepted() {
        
    }
    
    func glanceDefaultUIDialogCancelled() {
        
    }
    
    func glanceDefaultUIVoiceAuthenticationRequired() {
        
    }
    
    func glanceDefaultUIVoiceDidAuthenticate(_ dict: [AnyHashable : Any]!) {
        
    }
    
    func glanceDefaultUIVoiceAuthenticationFailed() {
        
    }
}
@protocol GlanceDefaultUIDelegate <NSObject>

@optional
-(void)glanceDefaultUIVoiceDidAuthenticate:(NSDictionary*)dict;

-(void)glanceDefaultUIVoiceAuthenticationRequired;
-(void)glanceDefaultUIVoiceAuthenticationFailed;

-(void)glanceDefaultUIDialogAccepted;
-(void)glanceDefaultUIDialogCancelled;

@end

2. Disabling default UI

If you want to use your own fully custom UI, you must disable the default UI, as it is on by default.

GlanceVisitor.defaultUI(false, delegate: self)
[GlanceVisitor defaultUI: NO delegate: myDelegate];

To use the default UI, but supply a GlanceDefaultUIDelegate or your own terms and conditions URL:

GlanceVisitor.defaultUI(false, delegate: self, termsURL: "https://www.example.com/terms")
[GlanceVisitor defaultUI: YES delegate: myDelegate termsURL: @"https://www.example.com/terms"];

3. Implementing custom UI

First, you must implement the GlanceCustomViewerDelegate protocol

class CustomViewerManager: GlanceCustomViewerDelegate {
    /**
     * Called when the agent viewer starts with a supplied UIView and size.
     *
     * @param glanceView    UIView displaying agent video.  Add this view to your interface.
     * @param size          Preferred size of the UIView
     */
    func glanceViewerDidStart(_ glanceView: UIView!, size: CGSize) {
        
    }
    
    /**
     * Called when the agent viewer has stopped
     *
     * @param glanceView    UIView displaying agent video.  Remove this view from your interface.
     */
    func glanceViewerDidStop(_ glanceView: UIView!) {
        
    }
}
/**
 * A delegate to manage the agent viewer video experience.
 */
@protocol GlanceCustomViewerDelegate

/**
 * Called when the agent viewer starts with a supplied UIView and size.
 *
 * @param glanceView    UIView displaying agent video.  Add this view to your interface.
 * @param size          Preferred size of the UIView
 */
-(void) glanceViewerDidStart:(UIView*)glanceView size:(CGSize)size;

/**
 * Called when the agent viewer has stopped
 *
 * @param glanceView    UIView displaying agent video.  Remove this view from your interface.
 */
-(void) glanceViewerDidStop:(UIView*)glanceView;
@end

In order to enable the integration you need to set the custom viewer delegate by calling the following method:

GlanceVisitor.setCustomViewerDelegate(self)
[GlanceVisitor setCustomViewerDelegate:self];