/*---------------------------------------------------------------------------*/
/* WebViewController.h                                                       */
/* copyright (c) innovaphone 2015                                            */
/*                                                                           */
/*---------------------------------------------------------------------------*/

#import <SafariServices/SafariServices.h>
#if (defined(CLIENT_IOS_USE_WKWEBVIEW) || defined(CLIENT_IOS_USE_WKWEBVIEW_WINDOWS))
#import <WebKit/WebKit.h>
#endif
#import <JavaScriptCore/JavaScriptCore.h>
#import <QuickLook/QuickLook.h>

@interface WebViewController :
#ifdef CLIENT_IOS_USE_SFSAFARIVIEW
    SFSafariViewController <UIDocumentInteractionControllerDelegate>
- (id) initWithURL:(NSURL *)url;
#else
#ifdef CLIENT_IOS_USE_WKWEBVIEW
    UIViewController <UIDocumentInteractionControllerDelegate, BackButtonDelegate,
#ifdef CLIENT_IOS_USE_SFSAFARIVIEW_WINDOWS
        SFSafariViewControllerDelegate,
#else
#if !defined(CLIENT_IOS_USE_WKWEBVIEW_WINDOWS)
        UIWebViewDelegate,
#endif
#endif
#if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 145000)
        WKDownloadDelegate,
#endif
        WKNavigationDelegate, WKScriptMessageHandler, WKUIDelegate, QLPreviewControllerDelegate, QLPreviewControllerDataSource>
@property (nonatomic,weak) IBOutlet WKWebView *webView;
#else
    UIViewController <UIDocumentInteractionControllerDelegate, BackButtonDelegate,
#ifdef CLIENT_IOS_USE_SFSAFARIVIEW_WINDOWS
        SFSafariViewControllerDelegate,
#else
#ifdef CLIENT_IOS_USE_WKWEBVIEW_WINDOWS
#if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 145000)
        WKDownloadDelegate,
#endif
        WKNavigationDelegate, WKScriptMessageHandler, WKUIDelegate,
#endif
#endif
        UIWebViewDelegate, QLPreviewControllerDelegate, QLPreviewControllerDataSource>
@property (nonatomic,weak) IBOutlet UIWebView *webView;
#endif
#endif

@property (nonatomic) WebViewNavigationController *navigationController;
#ifdef CLIENT_IOS_USE_WKWEBVIEW_WINDOWS
@property (nonatomic,weak) IBOutlet WKWebView *webViewWindow;
#else
@property (nonatomic,weak) IBOutlet UIWebView *webViewWindow;
#endif

@property (nonatomic) JSContext *parentJsContext;
@property (nonatomic) NSURL *startUrl;
@property (nonatomic) BOOL statusBarHidden;
@property (nonatomic) UIStatusBarStyle statusBarStyle;
@property (nonatomic) UIColor *statusBarColor;
@property (nonatomic) UIColor *statusBarTextColor;

- (void) updateTextZoomFactor:(float)factor;

+ (NSData *) decodeBase64WithString:(NSString *)strBase64;

@property (copy) void (^logBrowser)(bool log);
@property (copy) void (^setStatusBarAppearance)(BOOL hidden, UIStatusBarStyle style, UIColor *color, UIColor *textColor);

@end
