JDFacade.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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 "UIWindow+Addtions.h"
  20. #import "NSLayoutConstraint+Additions.h"
  21. #import "UITableView+EnumarateCells.h"
  22. #import "TargetConditionals.h"
  23. //Common UI
  24. #import "CustomAlertView.h"
  25. //OpenSource
  26. @import ReactiveObjC;
  27. #import "AppDelegate.h"
  28. #import "LoginModel.h"
  29. #import "ModeModel.h"
  30. #import "DataSelectModel.h"
  31. @class DeviceModel;
  32. @class MainViewController;
  33. typedef void(^JDFacadeCompletionCallBackHandler)(void);
  34. typedef void(^JDFacadeFailureCallBackHandler)(void);
  35. typedef void(^JDFacadeSelectCallBackHandler)(DataSelectModel *seleced);
  36. extern CGRect gKeyboardRect;
  37. @interface JDFacade : NSObject {
  38. BOOL _isHomeHubOnlineState;
  39. }
  40. @property (strong, nonatomic) NSString *deviceUUID; //local uuid
  41. @property (strong, nonatomic) NSString *APNSToken; //APNS 토큰
  42. @property (strong, nonatomic) NSString *deviceHostName; //호스트네임
  43. @property (strong, nonatomic) NSString *keyboardRect; //키보드 사이즈
  44. @property (strong, nonatomic) LoginModel *loginUser;
  45. @property (strong, nonatomic) SignUpModel *signUpUser;
  46. @property (strong, nonatomic) NSString *signType; // 회원가입 유형
  47. @property (strong, nonatomic) NSArray<ModeModel> *modeList;
  48. @property (assign, nonatomic) KNMenuId wishMenuId;
  49. @property (assign, nonatomic) BOOL hasLoggedIn;
  50. //Local Temporary Variables
  51. @property (strong, nonatomic) NSString *tmpHomegrpName;
  52. @property (strong, nonatomic) NSString *tmpEmailId;
  53. @property (strong, nonatomic) NSString *tmpPassword;
  54. //tasks
  55. @property (weak, nonatomic) NSOperation *currentOperation;
  56. @property (weak, nonatomic) MainViewController *mainViewController;
  57. //Local Temporary Variables
  58. + (JDFacade *)facade;
  59. - (AppDelegate *)appDelegate;
  60. //Screens
  61. - (UIViewController *)currentViewController;
  62. - (id)viewControllerOnNaviationController:(Class)viewControllerClass;
  63. - (id)viewControllerOnPresentingViewController:(UIViewController *)vc viewControllerClass:(Class)viewControllerClass;
  64. - (id)viewControllerOnPresentedViewController:(UIViewController *)pvc viewControllerClass:(Class)viewControllerClass;
  65. //Keychain Wrapper
  66. - (void)storeObjectToKeychain:(id)object forKey:(NSString *)aKey;
  67. - (id)objectForKeyFromKeychain:(NSString *)aKey;
  68. - (void)removeObjectAtKeychain:(NSString *)aKey;
  69. //UserDefautls - Local Store
  70. - (void)storeObjectToUserDefaults:(id)object forKey:(NSString *)aKey;
  71. - (id)objectForKeyFromUserDefaults:(NSString *)aKey;
  72. //loading
  73. - (void)loadIndicator:(BOOL)showIndicator allowUserInteraction:(BOOL)allowUserInteracton;
  74. - (void)loadIndicatorWhileExecutingBlock:(dispatch_block_t)block;
  75. - (void)showLoadingWhileExecutingBlock:(dispatch_block_t)block completionHandler:(JDFacadeCompletionCallBackHandler)completion;
  76. //alert
  77. - (void)alert:(NSString *)message;
  78. - (void)warn:(NSString *)message;
  79. - (void)alert:(NSString *)message completionHander:(JDFacadeCompletionCallBackHandler)completion;
  80. - (void)alertTitle:(NSString *)title message:(NSString *)message;
  81. - (void)alertTitle:(NSString *)title message:(NSString *)message completionHander:(JDFacadeCompletionCallBackHandler)completion;
  82. - (void)confirm:(NSString *)message completion:(CustomAlertViewCallBackHandler)completion;
  83. - (void)confirmTitle:(NSString *)title message:(NSString *)message completion:(CustomAlertViewCallBackHandler)completion;
  84. - (void)confirmTitle:(NSString *)title message:(NSString *)message btnOKLabel:(NSString *)btnOKLabel
  85. btnCancelLabel:(NSString *)btnCancelLabel completion:(CustomAlertViewCallBackHandler)completion;
  86. - (void)retryAlert:(NSString *)message target:(id)target selector:(SEL)selector;
  87. - (void)retryAlert:(NSString *)message target:(id)target selector:(SEL)selector arguments:(id)arguments,... NS_REQUIRES_NIL_TERMINATION;
  88. - (void)retryAlert:(NSString *)message completionHander:(JDFacadeCompletionCallBackHandler)handler;
  89. -(void)selectDatas:(id)target listInfo:(DataSelectListModel *)listInfo completion:(JDFacadeSelectCallBackHandler)completion;
  90. - (void)fireLocalNotification:(NSString *)message;
  91. - (void)toast:(NSString *)message;
  92. //Control UI
  93. - (id)getRadioButtonStatus:(id)object;
  94. - (void)setRadioButtonStatus:(id)status object:(id)object;
  95. - (id)getCheckBoxStatus:(id)object;
  96. - (void)setCheckBoxStatus:(id)status object:(id)object;
  97. - (void)presentViewControllerByPush:(UIViewController *)vc;
  98. - (void)presentViewControllerByPush:(UIViewController *)vc pvc:(UIViewController *)pvc;
  99. - (void)dismissViewControllerByPush:(UIViewController *)vc;
  100. - (void)dismissViewControllerByPush:(UIViewController *)vc completion:(JDFacadeCompletionCallBackHandler)completion;
  101. - (void)dismissAllViewControllers;
  102. - (void)dismissModalStack:(BOOL)animated completion:(JDFacadeCompletionCallBackHandler)completion;
  103. //Biz Logic
  104. - (void)requestPollingHomeHubStatusInBackground;
  105. - (void)requestPollingHomeHubStatus:(JDFacadeCompletionCallBackHandler)completion;
  106. //UI Flow
  107. - (void)gotoLoginView;
  108. //- (void)gotoLoginViewWithExpiring;
  109. - (void)logout;
  110. - (void)loadInvitationView;
  111. - (void)gotoHomeHubRegistration;
  112. - (void)gotoStartHome:(BOOL)canGoBack;
  113. //- (void)gotoTutorial:(BOOL)isCalledFromMenu;
  114. - (void)gotoWishMenu:(KNMenuId)menuId;
  115. - (void)gotoWishMenu:(KNMenuId)menuId completion:(JDFacadeCompletionCallBackHandler)completion;
  116. //- (void)updateHomegrpListForLoginUser:(JDFacadeCompletionCallBackHandler)completion;
  117. - (void)updateLoginInfo:(JDFacadeCompletionCallBackHandler)completion;
  118. - (void)updateMainViewController;
  119. - (void)loadURLExternalBrowser:(NSString *)URLString;
  120. - (void)alertCameraPermissionDisabled;
  121. //Debug
  122. - (BOOL)redirectNSLog;
  123. - (void)showFlex;
  124. -(NSString *)getUrlWithCustID:(NSString *)str aditional:(NSString *)aditional;
  125. -(NSString *)getUrlWithCustAndGroupID:(NSString *)str aditional:(NSString *)aditional;
  126. -(NSString *)getUrlWithCustAndGroupID:(NSString *)str arguments:(NSArray *)arguments;
  127. -(NSString *)getUrlWithArr:(NSString *)str arguments:(NSArray *)arguments;
  128. -(NSString *)getUrlWithCustGroupIDAndMemberID:(NSString *)str;
  129. -(NSString *)getUrlWithCustAndGroupIDAndInputMemId:(NSString *)str inputId:(NSString *)inputId;
  130. @end