|
@@ -24,36 +24,85 @@
|
|
|
|
|
|
|
|
[self initializeData];
|
|
[self initializeData];
|
|
|
|
|
|
|
|
|
|
+ [self chooseLoadController];
|
|
|
|
|
+
|
|
|
|
|
+ return YES;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ 选择要启动的页面
|
|
|
|
|
+ */
|
|
|
|
|
+-(void)chooseLoadController{
|
|
|
|
|
+
|
|
|
|
|
+ self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
|
|
|
|
|
+
|
|
|
|
|
+ self.window.backgroundColor = [UIColor whiteColor];
|
|
|
|
|
+ //自动登录,直接显示主页面
|
|
|
|
|
+ if ([YRUserInfo shareManager].isAutoLogin) {
|
|
|
|
|
+
|
|
|
|
|
+ YRMainVC *mainVC = [[YRMainVC alloc]init];
|
|
|
|
|
+
|
|
|
|
|
+ self.window.rootViewController = mainVC;
|
|
|
|
|
+
|
|
|
|
|
+ [YRLoginManager autoLoginsuccess:^{
|
|
|
|
|
+ //自动登录成功
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ } failure:^(NSString * _Nonnull errorStr) {
|
|
|
|
|
+ //自动登录失败
|
|
|
|
|
+ [YRAlertView showWithTitle:nil content:errorStr sureTitle:nil cancelTitle:nil click:^(NSInteger index) {
|
|
|
|
|
+
|
|
|
|
|
+ YRLoginVC *loginVC = [[YRLoginVC alloc]init];
|
|
|
|
|
+
|
|
|
|
|
+ loginVC.completed = ^(BOOL success) {
|
|
|
|
|
+
|
|
|
|
|
+ YRMainVC *mainVC = [[YRMainVC alloc]init];
|
|
|
|
|
+
|
|
|
|
|
+ [UIView animateWithDuration:0.3f animations:^{
|
|
|
|
|
+
|
|
|
|
|
+ self.window.rootViewController = mainVC;
|
|
|
|
|
+
|
|
|
|
|
+ }];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ self.window.rootViewController = loginVC;
|
|
|
|
|
+
|
|
|
|
|
+ }];
|
|
|
|
|
+
|
|
|
|
|
+ }];
|
|
|
|
|
+
|
|
|
|
|
+ }else{
|
|
|
|
|
+
|
|
|
YRLoginVC *loginVC = [[YRLoginVC alloc]init];
|
|
YRLoginVC *loginVC = [[YRLoginVC alloc]init];
|
|
|
|
|
|
|
|
loginVC.completed = ^(BOOL success) {
|
|
loginVC.completed = ^(BOOL success) {
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
YRMainVC *mainVC = [[YRMainVC alloc]init];
|
|
YRMainVC *mainVC = [[YRMainVC alloc]init];
|
|
|
|
|
|
|
|
[UIView animateWithDuration:0.3f animations:^{
|
|
[UIView animateWithDuration:0.3f animations:^{
|
|
|
|
|
|
|
|
self.window.rootViewController = mainVC;
|
|
self.window.rootViewController = mainVC;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
}];
|
|
}];
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
|
|
|
|
|
|
|
|
|
|
self.window.rootViewController = loginVC;
|
|
self.window.rootViewController = loginVC;
|
|
|
|
|
|
|
|
- self.window.backgroundColor = [UIColor whiteColor];
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
[self.window makeKeyAndVisible];
|
|
[self.window makeKeyAndVisible];
|
|
|
//加载动画结束后
|
|
//加载动画结束后
|
|
|
[YRAdView startLoad].loadCompleted = ^{
|
|
[YRAdView startLoad].loadCompleted = ^{
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- return YES;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|