//
//  AppDelegate.h
//  Project
//
//  Created by Phan Quang Hoang on 8/26/13.
//  Copyright (c) 2013 Phan Quang Hoang. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "SlashViewController.h"
#import "TopScreenView.h"
#import "ResearchListView.h"
#import "ListItemChange.h"
//@class ViewController;
#import "StartViewController.h"
#import "BaseWebViewController.h"

// PUSH通知種別
typedef NS_ENUM(NSUInteger, TYPE_PUSH) {
    TYPE_PUSH_TOP = 1,		// 連絡メール
    TYPE_PUSH_RESEARCH = 2,	// リサーチ
    TYPE_PUSH_TIMELINE = 3,	// タイムライン
    TYPE_PUSH_NEWS = 6,		// まちPRESS
	TYPE_PUSH_REMIND = 7,	// メールリマインダー	ADD 2015-10-16
};

@interface AppDelegate : UIResponder <UIApplicationDelegate, UIAlertViewDelegate, TopScreenViewDelegate> {
    
    int alertStatus;
    
    NSDictionary *notificationDic;
    NSUserDefaults *isFirstStartApp;
    SlashViewController *slashView;
    TopScreenView *topScreenView;
    ResearchListView *researchListView;
    BaseWebViewController * contentViewController;
    ListItemChange *listItemChangeView;
    
    NSString *siteId;
    BOOL userDisablePush;
}

@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) StartViewController *viewController;
@property (strong, nonatomic) UITabBarController *tabBarController;
@property (nonatomic, strong) UIButton *startApp;
@property (nonatomic, strong) UIButton *topButton;
@property (nonatomic, strong) UIButton *questionButton;
@property (nonatomic, strong) UIButton *listResearchButton;
@property (nonatomic, strong) UIButton *infoButton;
@property (nonatomic, strong) UIToolbar *footerView;
@property (nonatomic, strong) UIImageView *footerTopLine;
//@property (nonatomic, strong) NSData *device_token;
@property (nonatomic, strong) NSString *token;
@property (nonatomic, strong) NSString *keyId;
@property (nonatomic, strong) NSString *hostId;
@property (nonatomic, strong) NSString *result;
@property (nonatomic, strong) NSString *client_id;
@property (nonatomic, strong, getter=getUserAgentWithHostID) NSString *userAgent;
@property (nonatomic, strong) UIView *topAppView;
@property (nonatomic, strong) UIView *researchAppView;
@property (nonatomic, strong) UIView *questionAppView;
@property (nonatomic, strong) UIView *settingAppView;
@property (nonatomic, strong) UIButton *answercountButon;
@property (nonatomic, strong) UIButton *readcountButon;
@property (nonatomic, strong) UIButton *questionCountButon;
@property (nonatomic, strong) UIButton *infocountButton;
@property (nonatomic, strong) NSMutableArray *backTabbar;
@property (nonatomic, assign) BOOL isTabbarClick;
@property (nonatomic, assign) BOOL isReload;
@property (nonatomic, assign) BOOL isLaunchedByNoti;	// YES:通知からの起動
@property (nonatomic, assign) BOOL isTop;
@property (nonatomic, assign) BOOL isResearch;

@property (nonatomic, strong) NSString *isScreen;
@property (nonatomic, assign) BOOL isAddGroup;
@property (nonatomic, assign) BOOL isRegisterSuccess;

// [2013/12/12]
@property (nonatomic, assign) BOOL isLoadMore;
@property (nonatomic, strong) NSString *siteid;
@property (nonatomic, assign) BOOL isResearchAppear;
@property (nonatomic, assign) BOOL isTopAppear;
@property (nonatomic, assign) BOOL isTopInBackground;
@property (nonatomic, assign) BOOL viewInBackground;
@property (nonatomic, assign) NSInteger isFirstTimeAfterRegister;
@property (nonatomic) BOOL isStartSchemaRegisterAndFirstTimeApp;

@property (nonatomic) BOOL isEnterForeGround;	// 通知(連絡)時の画面 YES:メール詳細画面
@property (nonatomic) BOOL isDuplicateLogin;

// タイムアウトによるログイン失敗フラグ	ADD 2015-10-07
@property (nonatomic, assign) BOOL isLoginFailed;

//@property (nonatomic) BOOL isPushToContactDetail;	// DELETE 2015-09-18
@property (nonatomic) BOOL isPresentModel;

@property (nonatomic) BOOL isFirstTimeStartAppAndCantGoBack;

@property (nonatomic, assign) BOOL ignoreEmailPass;	// Email&Pass無視フラグ ADD 2015-09-09

// オフラインバー表示状態(YES:表示中 / NO:非表示)	ADD 2015-09-15
@property (nonatomic, assign) BOOL isShowOfflineBar;

@property (nonatomic, assign) BOOL isMFMailComposeViewController; // YES:メーラー起動中

// メール詳細より移行 ADD 2015-10-01
@property (nonatomic, assign) int cmsflg;		// CMS表示フラグ(0:非表示 / 1:表示)
@property (nonatomic, strong) NSString *cms_m;	// 下部WebView表示URL
@property (nonatomic, assign) int mobflg;		// 下部AdMobバナー表示(0:非表示 / 1:表示)

// push通知タイプ(TYPE_PUSH_TIMELINE)	ADD 2015-10-05
@property (nonatomic, assign) TYPE_PUSH pushType;
// 検索モードでトップに戻ったときリロードする
@property (nonatomic, strong) NSString* reloadMailSiteid;

@property (nonatomic, assign) BOOL isShowAlert;

// 内部WebView展開用(CommonPopupにて設定)
@property (nonatomic, strong) NSString *commonPopupUrl;

// ステータスバースタイル	ADD 2016-01-12
@property (nonatomic, assign) UIStatusBarStyle statusBarStyle;

- (void)popToContactList;
- (void)clickOnListResearchPage;
- (void)forwardLoginView;
- (void)changeLayoutAfterPresentModel;
- (void)changeOriginalWindows;
- (void)defaultOriginalWindows;

- (void)clickOnTopPage:(id)sender;
- (void)putApiLog:(NSString *)text;
- (void)setTopButtonHighlight;

// OFFLINE関連
- (BOOL)isOnlineAndAlert:(UIViewController*)topViewController;
- (void)alertOffline:(UIViewController*)viewController;
- (void)alertOffline:(UIViewController*)viewController completion:(void (^)(void))completion;
- (BOOL)isOffline;
- (void)alertWithViewController:(UIViewController*)controller title:(NSString*)title message:(NSString*)message completion:(void (^)(void))completion;
- (void)alertWithViewController:(UIViewController*)controller title:(NSString*)title message:(NSString*)message cancelButtonTitle:cancelButtonTitle completion:(void (^)(void))completion;

// タイムアウト関連
- (BOOL)alertTimeout:(UIViewController*)viewController completion:(void (^)(void))completion;


- (void)clickMyPage;	// ログイントップ画面	ADD 2015-09-09


- (NSMutableDictionary *)getMutableDictionaryFromURL:(NSArray *)arrayParams;

// 共通ポップアップ	ADD 2015-10-06
- (void)showCommonPopup:(NSString*)url delegate:(id)delegate;

// タイムアウト状態解除	ADD 2015-10-09
- (void)clearTimeout;

- (BOOL)isUIAlertControllerOnTop;

@end
