JDFacade.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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 "Common.h"
  10. #import "Definitions.h"
  11. #import "CommonUtil.h"
  12. //Categories
  13. #import "NSDictionary-Additions.h"
  14. #import "NSString-Addtions.h"
  15. #import "NSDate+Utilities.h"
  16. #import "UIView+Additions.h"
  17. #import "UITableView+EnumarateCells.h"
  18. #import "TargetConditionals.h"
  19. //OpenSource
  20. //#import "ReactiveCocoa.h"
  21. #import "AppDelegate.h"
  22. #import "LoginModel.h"
  23. #import "ModeModel.h"
  24. typedef void(^JDFacadeCompletionCallBackHandler)(void);
  25. typedef void(^JDFacadeFailureCallBackHandler)(void);
  26. @interface JDFacade : NSObject
  27. @property (strong, nonatomic) NSString *deviceUUID; //local uuid
  28. @property (strong, nonatomic) NSString *APNSToken; //APNS 토큰
  29. @property (strong, nonatomic) LoginModel *loginUser;
  30. @property (strong, nonatomic) HomeGroupModel *loginHomeGroup;
  31. @property (strong, nonatomic) NSArray<ModeModel> *modeList;
  32. @property (assign, nonatomic) KNMenuId wishMenuId;
  33. @property (assign, nonatomic) BOOL hasLoggedIn;
  34. //Local Temporary Variables
  35. @property (strong, nonatomic) NSString *tmpHomegrpName;
  36. @property (strong, nonatomic) NSString *tmpEmailId;
  37. @property (strong, nonatomic) NSString *tmpPassword;
  38. //tasks
  39. @property (weak, nonatomic) NSOperation *currentOperation;
  40. //Local Temporary Variables
  41. + (JDFacade *)facade;
  42. - (AppDelegate *)appDelegate;
  43. //Screens
  44. - (UIViewController *)currentViewController;
  45. - (id)viewControllerOnNaviationController:(Class)viewControllerClass;
  46. - (id)viewControllerOnPresentingViewController:(UIViewController *)vc viewControllerClass:(Class)viewControllerClass;
  47. //Keychain Wrapper
  48. - (void)storeObjectToKeychain:(id)object forKey:(NSString *)aKey;
  49. - (id)objectForKeyFromKeychain:(NSString *)aKey;
  50. - (void)removeObjectAtKeychain:(NSString *)aKey;
  51. //UserDefautls - Local Store
  52. - (void)storeObjectToUserDefaults:(id)object forKey:(NSString *)aKey;
  53. - (id)objectForKeyFromUserDefaults:(NSString *)aKey;
  54. //loading
  55. - (void)loadIndicator:(BOOL)showIndicator allowUserInteraction:(BOOL)allowUserInteracton;
  56. - (void)loadIndicatorWhileExecutingBlock:(dispatch_block_t)block;
  57. - (void)showLoadingWhileExecutingBlock:(dispatch_block_t)block completionHandler:(JDFacadeCompletionCallBackHandler)completion;
  58. //alert
  59. - (void)alert:(NSString *)message;
  60. - (void)warn:(NSString *)message;
  61. - (void)alert:(NSString *)message completionHander:(JDFacadeCompletionCallBackHandler)completion;
  62. - (void)retryAlert:(NSString *)message target:(id)target selector:(SEL)selector;
  63. - (void)retryAlert:(NSString *)message target:(id)target selector:(SEL)selector arguments:(id)arguments,... NS_REQUIRES_NIL_TERMINATION;
  64. - (void)fireLocalNotification:(NSString *)message;
  65. - (void)toast:(NSString *)message;
  66. //Control UI
  67. - (id)getRadioButtonStatus:(id)object;
  68. - (void)setRadioButtonStatus:(id)status object:(id)object;
  69. - (id)getCheckBoxStatus:(id)object;
  70. - (void)setCheckBoxStatus:(id)status object:(id)object;
  71. - (void)presentViewControllerByPush:(UIViewController *)vc;
  72. - (void)presentViewControllerByPush:(UIViewController *)vc pvc:(UIViewController *)pvc;
  73. - (void)dismissViewControllerByPush:(UIViewController *)vc;
  74. - (void)dismissViewControllerByPush:(UIViewController *)vc completion:(JDFacadeCompletionCallBackHandler)completion;
  75. //UI Flow
  76. - (void)gotoLoginView;
  77. - (void)gotoLoginViewWithExpiring;
  78. - (void)logout;
  79. - (void)loadInvitationView;
  80. - (void)checkDefaultHome;
  81. - (void)gotoStartHome:(BOOL)canGoBack;
  82. //- (void)gotoTutorial:(BOOL)isCalledFromMenu;
  83. - (void)gotoWishMenu:(KNMenuId)menuId;
  84. - (void)gotoWishMenu:(KNMenuId)menuId completion:(JDFacadeCompletionCallBackHandler)completion;
  85. //- (void)updateHomegrpListForLoginUser:(JDFacadeCompletionCallBackHandler)completion;
  86. - (void)updateLoginInfo:(JDFacadeCompletionCallBackHandler)completion;
  87. - (void)alertLocationServiceDisabled;
  88. - (void)alertCameraPermissionDisabled;
  89. //Debug
  90. - (BOOL)redirectNSLog;
  91. - (void)showFlex;
  92. @end