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

#import <AddressBook/AddressBook.h>
#import <AddressBookUI/AddressBookUI.h>
#import <MessageUI/MessageUI.h>
#import <PushKit/PushKit.h>
#import <AVFoundation/AVFoundation.h>
#import <SafariServices/SafariServices.h>
#import <CallKit/CallKit.h>
#import <CallKit/CXError.h>
#import <Intents/Intents.h>
#import <ReplayKit/ReplayKit.h>

//#define CLIENT_IOS_USE_SFSAFARIVIEW
#define CLIENT_IOS_USE_WKWEBVIEW
//#define CLIENT_IOS_USE_SFSAFARIVIEW_WINDOWS
#define CLIENT_IOS_USE_WKWEBVIEW_WINDOWS
#define XCODE_VERSION_GREATER_THAN_OR_EQUAL_TO_8 __has_include(<UserNotifications/UserNotifications.h>)
// Notification become independent from UIKit
#if XCODE_VERSION_GREATER_THAN_OR_EQUAL_TO_8
@import UserNotifications;
#endif

#define COLOR_TEXT_LIGHT_SCHEME 0x8da0a6
#define COLOR_TEXT_DARK_SCHEME  0x8da0a6

#define FONT_CATEGORY_HEADLINE      0
#define FONT_CATEGORY_SUBHEADLINE   1
#define FONT_CATEGORY_BODY          2
#define FONT_CATEGORY_FOOTNOTE      3
#define FONT_CATEGORY_CAPTION1      4
#define FONT_CATEGORY_CAPTION2      5

/* #define SUBSTITUTE_FONT_NAME    "TitilliumWeb-Regular" */
/* #define SUBSTITUTE_FONT_NAME_BOLD "TitilliumWeb-Bold" */

@class Forms;
@class IosPhone;
@class WebViewController;

extern IosPhone * phone_ios_ios_phone;
extern bool phone_ios_ring_in_headset;
extern bool phone_ios_log_browser;

@interface PhoneIosDelegate : UIResponder <UIApplicationDelegate,
#if XCODE_VERSION_GREATER_THAN_OR_EQUAL_TO_8
    UNUserNotificationCenterDelegate,
#endif
    INStartCallIntentHandling, INStartAudioCallIntentHandling, INStartVideoCallIntentHandling, INSearchCallHistoryIntentHandling,
    RPBroadcastActivityViewControllerDelegate,
    UIAlertViewDelegate,IosAsyncSignal,FormsDelegate,
    MFMailComposeViewControllerDelegate,ABUnknownPersonViewControllerDelegate,
    PKPushRegistryDelegate, SFSafariViewControllerDelegate,
    CXProviderDelegate,
    CPApplicationDelegate, CPSessionConfigurationDelegate>

@property (nonatomic) UIWindow *window;
@property (nonatomic) Forms *forms;
@property (nonatomic) bool orientation_adaptation_off;
@property (nonatomic) bool dtmfActive;
@property (nonatomic) bool hookstateOffhook;
@property (nonatomic) bool microphoneMuted;
@property (nonatomic) bool headsetPresent;
@property (nonatomic) bool headsetEnabled;
@property (nonatomic) bool headsetSwitched;
@property (nonatomic) bool speakerphoneEnabled;
@property (nonatomic) bool speakerphoneSwitched;
@property (nonatomic) IosPhone *ios_phone;
@property (nonatomic) NSMutableArray *ringtone_table;
@property (nonatomic) int playing_ringtone;
@property (nonatomic) NSString *url_to_load;
@property (nonatomic) NSString *cert_string;
@property (nonatomic) bool webcam_active;
@property (nonatomic) bool connInfoUp;
@property (nonatomic) bool connInfoStandby;
@property (nonatomic) NSString *connInfoCur;
@property (nonatomic) NSString *connInfoPri;
@property (nonatomic) NSString *connInfoSec;
@property (nonatomic) UIScene *scene;

@property (copy) void (^trc)(NSString *text);
@property (copy) bool (^calls_to_display)();
@property (copy) bool (^messages_to_display)();
@property (copy) bool (^no_media_call_mode)();
@property (copy) void (^do_diversion_click)(bool unsolicited);
@property (copy) void (^forms_event_shutdown)(bool user_shutdown);
@property (copy) void (^forms_event_open_permalink)(NSString *link);
@property (copy) void (^dialContact)(NSString *phoneNumber);
@property (copy) void (^transferToContact)(NSString *phoneNumber);
@property (copy) void (^updateProximitySensor)();
@property (copy) NSArray * (^contactsForSearchString)(NSString *searchString);
@property (copy) ABRecordRef (^personForRecordID)(int32_t recordID);
@property (copy) void (^startFixCert)();
@property (copy) void (^showToast)(NSString *text);
@property (copy) WebViewController *(^webViewController)();
@property (copy) UIFont * (^fontForCategory)(int fontCategory);

@property (nonatomic) bool CurrentCallNotifcationPending;

/*- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(UILocalNotification *)notification completionHandler:(void (^)())completionHandler;*/

+ (UIColor *) colorRGB:(int)rgb;

- (void) onRemoteControl:(UIEvent *)theEvent;
//- (id) wkWebViewProcessPool;
- (void) try_start_ui:(id)context;

@end
