123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- //
- // DataManager.m
- // Artimenring
- //
- // Created by BaH Cy on 2/11/15.
- // Copyright (c) 2015 BaH Cy. All rights reserved.
- //
- #import "DataManager.h"
- #import "DataManager+timer.h"
- #import "SKTabbarViewController.h"
- #import "SKBabyDetailInfoViewController.h"
- #import "ARMacros.h"
- #import "UserDataHelper.h"
- @implementation MutableDelegateObject
- @end
- @interface DataManager() {
- FBSDKLoginManager* mFBSDKLoginManager;
- }
- @end
- @implementation DataManager
- + (DataManager *)shared {
- static DataManager *manager;
- static dispatch_once_t token;
- dispatch_once(&token, ^{
- manager = [[DataManager alloc] init];
- [manager initData];
- });
- return manager;
- }
- - (void)initData {
- self.mChildList = [[NSMutableArray alloc] init];
- self.mPushRecordArray = [NSMutableArray array];
- self.mAddressMap = [[NSMutableDictionary alloc] init];
- self.delegateObjects = [[NSMutableArray alloc] init];
- }
- - (BOOL)isLogin {
- return self.loginModel != nil;
- }
- - (void)logout {
- [UserDataHelper setHasLogin:NO];
-
- [[SKWebSocket share] disconnect];
- [[VideoManager shared] logoutJuphoon];
-
- self.loginModel = nil;
- self.mSelectChildModel = nil;
- [self.delegateObjects removeAllObjects];
- [self.mChildList removeAllObjects];
- self.isNewNotification = NO;
- [self stopChildsDevicesTimer];
- [self showSKLoginViewController];
- }
- - (void)showTabBarController {
- SKTabbarViewController* nav = [[SKTabbarViewController alloc] init];
- [[[UIApplication sharedApplication] delegate].window setRootViewController:nav];
- }
- - (void)showSKLoginViewController {
- NSString* identifier = @"LoginVC";
- UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
- UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:identifier];
- UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:vc];
- [[[UIApplication sharedApplication] delegate].window setRootViewController:nav];
- }
- - (void)showSKSelectAreaViewController {
- NSString* identifier = @"SelectAreaVC";
- UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
- UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:identifier];
- UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:vc];
- [[[UIApplication sharedApplication] delegate].window setRootViewController:nav];
- }
- - (void)showBindViewController {
- [DataManager shared].bindOptions = BO_ADD;
- UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
- SKBabyDetailInfoViewController *controller = [storyboard instantiateViewControllerWithIdentifier:@"BabyDetailInfo"];
- controller.opType = 2;
- controller.from = 1;
- controller.childModel = [[ChildModel alloc] init];
- controller.hidesBottomBarWhenPushed = YES;
- UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:controller];
- [[[UIApplication sharedApplication] delegate].window setRootViewController:nav];
- }
- - (BOOL)isRootTabBarController {
- UIViewController* vc = [UIApplication sharedApplication].keyWindow.rootViewController;
- return [vc isKindOfClass:[UITabBarController class]];
- }
- - (id)getFBSDKLoginManager {
- return mFBSDKLoginManager;
- }
- - (void)setFBSDKLoginManager:(id)manager {
- mFBSDKLoginManager = manager;
- }
- @end
|