|
@@ -21,19 +21,30 @@
|
|
|
#import <AMapFoundationKit/AMapFoundationKit.h>
|
|
#import <AMapFoundationKit/AMapFoundationKit.h>
|
|
|
#import <Bugly/Bugly.h>
|
|
#import <Bugly/Bugly.h>
|
|
|
|
|
|
|
|
-@interface AppDelegate () <HJWelcomeViewDelegate>
|
|
|
|
|
|
|
+#import "BMainViewController.h"//自发布的
|
|
|
|
|
+#import "BReleaseJobsViewController.h"//发布工作
|
|
|
|
|
+#import "BReleaseViewController.h"
|
|
|
|
|
+
|
|
|
|
|
+@interface AppDelegate () <HJWelcomeViewDelegate,UITabBarControllerDelegate>
|
|
|
|
|
+
|
|
|
|
|
+@property (nonatomic, strong) BMainViewController *bTabBarC;
|
|
|
|
|
+@property (nonatomic, assign) int lastIndex;//tabBar选中的上一个的视图索引
|
|
|
|
|
+@property (nonatomic, strong) HJConfirmPanelViewController *confirmVC;//弹出页面
|
|
|
|
|
+
|
|
|
|
|
|
|
|
@end
|
|
@end
|
|
|
|
|
|
|
|
@implementation AppDelegate
|
|
@implementation AppDelegate
|
|
|
|
|
|
|
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
|
|
|
|
+
|
|
|
|
|
+ [[HJAppUserType sharedInstance] loadUserType];
|
|
|
|
|
+
|
|
|
//配置Bugly
|
|
//配置Bugly
|
|
|
[Bugly startWithAppId:kBuglyAppID];
|
|
[Bugly startWithAppId:kBuglyAppID];
|
|
|
|
|
|
|
|
//配置广告数据
|
|
//配置广告数据
|
|
|
[self setupAd];
|
|
[self setupAd];
|
|
|
-
|
|
|
|
|
// 高德地图
|
|
// 高德地图
|
|
|
[AMapServices sharedServices].apiKey = kGAODEAPIKey;
|
|
[AMapServices sharedServices].apiKey = kGAODEAPIKey;
|
|
|
|
|
|
|
@@ -53,83 +64,119 @@
|
|
|
|
|
|
|
|
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
|
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
|
|
self.window.backgroundColor = [UIColor whiteColor];
|
|
self.window.backgroundColor = [UIColor whiteColor];
|
|
|
|
|
+ //引导页
|
|
|
HJWelcomeViewController *welcomeViewController = [[HJWelcomeViewController alloc] init];
|
|
HJWelcomeViewController *welcomeViewController = [[HJWelcomeViewController alloc] init];
|
|
|
welcomeViewController.delegate = self;
|
|
welcomeViewController.delegate = self;
|
|
|
- if (welcomeViewController.isShow) {
|
|
|
|
|
|
|
+ if (welcomeViewController.isShow)
|
|
|
|
|
+ {
|
|
|
self.window.rootViewController = welcomeViewController;
|
|
self.window.rootViewController = welcomeViewController;
|
|
|
- } else {
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
self.window.rootViewController = [self setupFirstViewController];
|
|
self.window.rootViewController = [self setupFirstViewController];
|
|
|
}
|
|
}
|
|
|
[self.window makeKeyAndVisible];
|
|
[self.window makeKeyAndVisible];
|
|
|
|
|
|
|
|
return YES;
|
|
return YES;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//iOS 9 之前用
|
|
//iOS 9 之前用
|
|
|
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
|
|
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
|
|
|
|
|
+
|
|
|
return [WXApi handleOpenURL:url delegate:[HJWeiXinAPIManager sharedManager]];
|
|
return [WXApi handleOpenURL:url delegate:[HJWeiXinAPIManager sharedManager]];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
|
|
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
|
|
|
|
|
+
|
|
|
return [WXApi handleOpenURL:url delegate:[HJWeiXinAPIManager sharedManager]];
|
|
return [WXApi handleOpenURL:url delegate:[HJWeiXinAPIManager sharedManager]];
|
|
|
}
|
|
}
|
|
|
//iOS 9之后用
|
|
//iOS 9之后用
|
|
|
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
|
|
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
|
|
|
|
|
+
|
|
|
return [WXApi handleOpenURL:url delegate:[HJWeiXinAPIManager sharedManager]];
|
|
return [WXApi handleOpenURL:url delegate:[HJWeiXinAPIManager sharedManager]];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-- (void)applicationWillResignActive:(UIApplication *)application {
|
|
|
|
|
- // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
|
|
|
|
- // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-- (void)applicationDidEnterBackground:(UIApplication *)application {
|
|
|
|
|
- // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
|
|
|
|
- // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-- (void)applicationWillEnterForeground:(UIApplication *)application {
|
|
|
|
|
- // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-- (void)applicationDidBecomeActive:(UIApplication *)application {
|
|
|
|
|
- // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-- (void)applicationWillTerminate:(UIApplication *)application {
|
|
|
|
|
- // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
#pragma mark - HJWelcomeViewDelegate
|
|
#pragma mark - HJWelcomeViewDelegate
|
|
|
|
|
|
|
|
- (void)skipWelcomeView:(HJWelcomeViewController *)welcomeView {
|
|
- (void)skipWelcomeView:(HJWelcomeViewController *)welcomeView {
|
|
|
|
|
+
|
|
|
self.window.rootViewController = [self setupFirstViewController];
|
|
self.window.rootViewController = [self setupFirstViewController];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - event response
|
|
#pragma mark - event response
|
|
|
|
|
|
|
|
- (void)launchStartButtonClicked:(UIButton *)sender {
|
|
- (void)launchStartButtonClicked:(UIButton *)sender {
|
|
|
|
|
+
|
|
|
[XHLaunchAd removeAndAnimated:YES];
|
|
[XHLaunchAd removeAndAnimated:YES];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - private methods
|
|
#pragma mark - private methods
|
|
|
|
|
|
|
|
- (UIViewController *)setupFirstViewController {
|
|
- (UIViewController *)setupFirstViewController {
|
|
|
|
|
+
|
|
|
NSString *userID = [HJUserInfoModel userInfo].userID;
|
|
NSString *userID = [HJUserInfoModel userInfo].userID;
|
|
|
- if (userID != nil && ![userID isEqualToString:@""]) {
|
|
|
|
|
- HJMainViewController *mainViewController = [[HJMainViewController alloc] init];
|
|
|
|
|
- return mainViewController;
|
|
|
|
|
- } else {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (userID != nil && ![userID isEqualToString:@""])
|
|
|
|
|
+ { //c端
|
|
|
|
|
+ if (USERTYPE)
|
|
|
|
|
+ {
|
|
|
|
|
+ _bTabBarC = [[BMainViewController alloc]init];
|
|
|
|
|
+ _bTabBarC.delegate = self;
|
|
|
|
|
+ return _bTabBarC;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {//自发布
|
|
|
|
|
+ HJMainViewController *mainViewController = [[HJMainViewController alloc] init];
|
|
|
|
|
+ return mainViewController;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
HJLoginViewController *loginViewController = [[HJLoginViewController alloc] init];
|
|
HJLoginViewController *loginViewController = [[HJLoginViewController alloc] init];
|
|
|
UINavigationController *loginNav = [[UINavigationController alloc] initWithRootViewController:loginViewController];
|
|
UINavigationController *loginNav = [[UINavigationController alloc] initWithRootViewController:loginViewController];
|
|
|
return loginNav;
|
|
return loginNav;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
+- (void)switchTabBar {
|
|
|
|
|
+
|
|
|
|
|
+ self.window.rootViewController = [self setupFirstViewController];
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+#pragma mark - UITabBarControllerDelegate 代理
|
|
|
|
|
+- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
|
|
|
|
|
+{
|
|
|
|
|
+ if (_bTabBarC.tabBar.selectedItem.tag == 2 && [[HJCompanyInfoModel companyInfo].authenticationStatus integerValue] == 0)
|
|
|
|
|
+ {//取消tabBar的点击事件
|
|
|
|
|
+ return NO;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ _lastIndex = (int)tabBarController.selectedIndex;
|
|
|
|
|
+ return YES;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+}
|
|
|
|
|
+- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
|
|
|
|
|
+{
|
|
|
|
|
+ if (tabBarController.selectedIndex == 2)
|
|
|
|
|
+ {
|
|
|
|
|
+ if ([[HJCompanyInfoModel companyInfo].authenticationStatus integerValue] == 3 || [[HJCompanyInfoModel companyInfo].authenticationStatus integerValue] == 2 || [[HJCompanyInfoModel companyInfo].authenticationStatus integerValue] == 1)
|
|
|
|
|
+ {
|
|
|
|
|
+ tabBarController.selectedIndex = _lastIndex ;
|
|
|
|
|
+ BReleaseJobsViewController *certification=[[BReleaseJobsViewController alloc]init];
|
|
|
|
|
+ UINavigationController *navi=[[UINavigationController alloc]initWithRootViewController:certification];
|
|
|
|
|
+ [self.window.rootViewController presentViewController:navi animated:YES completion:nil];
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ tabBarController.selectedIndex = _lastIndex ;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+/* 配置启动页 */
|
|
|
- (void)setupAd {
|
|
- (void)setupAd {
|
|
|
|
|
+
|
|
|
//设置你工程的启动页使用的是:LaunchImage 还是 LaunchScreen.storyboard(不设置默认:LaunchImage)
|
|
//设置你工程的启动页使用的是:LaunchImage 还是 LaunchScreen.storyboard(不设置默认:LaunchImage)
|
|
|
[XHLaunchAd setLaunchSourceType:SourceTypeLaunchScreen];
|
|
[XHLaunchAd setLaunchSourceType:SourceTypeLaunchScreen];
|
|
|
|
|
|
|
@@ -147,11 +194,31 @@
|
|
|
launchVersionLabel.textAlignment = NSTextAlignmentCenter;
|
|
launchVersionLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
|
|
|
|
|
XHLaunchImageAdConfiguration *imageAdconfiguration = [XHLaunchImageAdConfiguration defaultConfiguration];
|
|
XHLaunchImageAdConfiguration *imageAdconfiguration = [XHLaunchImageAdConfiguration defaultConfiguration];
|
|
|
- imageAdconfiguration.duration = 3;
|
|
|
|
|
|
|
+ imageAdconfiguration.duration = 1;
|
|
|
imageAdconfiguration.subViews = @[launchVersionLabel, launchStartButton];
|
|
imageAdconfiguration.subViews = @[launchVersionLabel, launchStartButton];
|
|
|
imageAdconfiguration.skipButtonType = SkipTypeNone;
|
|
imageAdconfiguration.skipButtonType = SkipTypeNone;
|
|
|
imageAdconfiguration.showFinishAnimate = ShowFinishAnimateLite;
|
|
imageAdconfiguration.showFinishAnimate = ShowFinishAnimateLite;
|
|
|
[XHLaunchAd imageAdWithImageAdConfiguration:imageAdconfiguration delegate:self];
|
|
[XHLaunchAd imageAdWithImageAdConfiguration:imageAdconfiguration delegate:self];
|
|
|
}
|
|
}
|
|
|
|
|
+- (void)applicationWillResignActive:(UIApplication *)application {
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+- (void)applicationDidEnterBackground:(UIApplication *)application {
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+- (void)applicationWillEnterForeground:(UIApplication *)application {
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+- (void)applicationDidBecomeActive:(UIApplication *)application {
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+- (void)applicationWillTerminate:(UIApplication *)application {
|
|
|
|
|
+ // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
|
|
|
@end
|
|
@end
|