JDFacade.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. //
  2. // JSFacade.h
  3. // kneet2
  4. //
  5. // Created by Created by Jason Lee on 10/1/15.
  6. // Copyright (c) 2015 ntels. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. //#import <ReactiveCocoa/ReactiveCocoa.h>
  10. #import "Common.h"
  11. #import "Definitions.h"
  12. #import "CommonUtil.h"
  13. //Categories
  14. #import "NSArray-Addtions.h"
  15. #import "NSDictionary-Additions.h"
  16. #import "NSString-Addtions.h"
  17. #import "NSDate+Utilities.h"
  18. #import "UIView+Additions.h"
  19. #import "UITableView+EnumarateCells.h"
  20. #import "TargetConditionals.h"
  21. //Common UI
  22. #import "CustomAlertView.h"
  23. //OpenSource
  24. @import ReactiveCocoa;
  25. #import "AppDelegate.h"
  26. #import "LoginModel.h"
  27. #import "ModeModel.h"
  28. @class DeviceModel;
  29. @class MainViewController;
  30. typedef void(^JDFacadeCompletionCallBackHandler)(void);
  31. typedef void(^JDFacadeFailureCallBackHandler)(void);
  32. @interface JDFacade : NSObject
  33. @property (strong, nonatomic) NSString *deviceUUID; //local uuid
  34. @property (strong, nonatomic) NSString *APNSToken; //APNS 토큰
  35. @property (strong, nonatomic) NSString *deviceHostName; //호스트네임
  36. @property (strong, nonatomic) LoginModel *loginUser;
  37. @property (strong, nonatomic) NSArray<ModeModel> *modeList;
  38. @property (assign, nonatomic) KNMenuId wishMenuId;
  39. @property (assign, nonatomic) BOOL hasLoggedIn;
  40. //Local Temporary Variables
  41. @property (strong, nonatomic) NSString *tmpHomegrpName;
  42. @property (strong, nonatomic) NSString *tmpEmailId;
  43. @property (strong, nonatomic) NSString *tmpPassword;
  44. //tasks
  45. @property (weak, nonatomic) NSOperation *currentOperation;
  46. @property (weak, nonatomic) MainViewController *mainViewController;
  47. //Local Temporary Variables
  48. + (JDFacade *)facade;
  49. - (AppDelegate *)appDelegate;
  50. //Screens
  51. - (UIViewController *)currentViewController;
  52. - (id)viewControllerOnNaviationController:(Class)viewControllerClass;
  53. - (id)viewControllerOnPresentingViewController:(UIViewController *)vc viewControllerClass:(Class)viewControllerClass;
  54. //Keychain Wrapper
  55. - (void)storeObjectToKeychain:(id)object forKey:(NSString *)aKey;
  56. - (id)objectForKeyFromKeychain:(NSString *)aKey;
  57. - (void)removeObjectAtKeychain:(NSString *)aKey;
  58. //UserDefautls - Local Store
  59. - (void)storeObjectToUserDefaults:(id)object forKey:(NSString *)aKey;
  60. - (id)objectForKeyFromUserDefaults:(NSString *)aKey;
  61. //loading
  62. - (void)loadIndicator:(BOOL)showIndicator allowUserInteraction:(BOOL)allowUserInteracton;
  63. - (void)loadIndicatorWhileExecutingBlock:(dispatch_block_t)block;
  64. - (void)showLoadingWhileExecutingBlock:(dispatch_block_t)block completionHandler:(JDFacadeCompletionCallBackHandler)completion;
  65. //alert
  66. - (void)alert:(NSString *)message;
  67. - (void)warn:(NSString *)message;
  68. - (void)alert:(NSString *)message completionHander:(JDFacadeCompletionCallBackHandler)completion;
  69. - (void)alertTitle:(NSString *)title message:(NSString *)message;
  70. - (void)alertTitle:(NSString *)title message:(NSString *)message completionHander:(JDFacadeCompletionCallBackHandler)completion;
  71. - (void)confirm:(NSString *)message completion:(CustomAlertViewCallBackHandler)completion;
  72. - (void)confirmTitle:(NSString *)title message:(NSString *)message completion:(CustomAlertViewCallBackHandler)completion;
  73. - (void)retryAlert:(NSString *)message target:(id)target selector:(SEL)selector;
  74. - (void)retryAlert:(NSString *)message target:(id)target selector:(SEL)selector arguments:(id)arguments,... NS_REQUIRES_NIL_TERMINATION;
  75. - (void)retryAlert:(NSString *)message completionHander:(JDFacadeCompletionCallBackHandler)handler;
  76. - (void)fireLocalNotification:(NSString *)message;
  77. - (void)toast:(NSString *)message;
  78. //Control UI
  79. - (id)getRadioButtonStatus:(id)object;
  80. - (void)setRadioButtonStatus:(id)status object:(id)object;
  81. - (id)getCheckBoxStatus:(id)object;
  82. - (void)setCheckBoxStatus:(id)status object:(id)object;
  83. - (void)presentViewControllerByPush:(UIViewController *)vc;
  84. - (void)presentViewControllerByPush:(UIViewController *)vc pvc:(UIViewController *)pvc;
  85. - (void)dismissViewControllerByPush:(UIViewController *)vc;
  86. - (void)dismissViewControllerByPush:(UIViewController *)vc completion:(JDFacadeCompletionCallBackHandler)completion;
  87. - (void)dismissAllViewControllers;
  88. - (void)dismissModalStack:(BOOL)animated completion:(JDFacadeCompletionCallBackHandler)completion;
  89. //Biz Logic
  90. - (void)requestPollingHomeHubStatusInBackground;
  91. //UI Flow
  92. - (void)gotoLoginView;
  93. - (void)gotoLoginViewWithExpiring;
  94. - (void)logout;
  95. - (void)loadInvitationView;
  96. - (void)gotoHomeHubRegistration;
  97. - (void)gotoStartHome:(BOOL)canGoBack;
  98. //- (void)gotoTutorial:(BOOL)isCalledFromMenu;
  99. - (void)gotoWishMenu:(KNMenuId)menuId;
  100. - (void)gotoWishMenu:(KNMenuId)menuId completion:(JDFacadeCompletionCallBackHandler)completion;
  101. //- (void)updateHomegrpListForLoginUser:(JDFacadeCompletionCallBackHandler)completion;
  102. - (void)updateLoginInfo:(JDFacadeCompletionCallBackHandler)completion;
  103. - (void)alertLocationServiceDisabled;
  104. - (void)alertCameraPermissionDisabled;
  105. //Debug
  106. - (BOOL)redirectNSLog;
  107. - (void)showFlex;
  108. @end