|
@@ -25,6 +25,8 @@
|
|
|
#import "HJHomeDataBox.h"
|
|
#import "HJHomeDataBox.h"
|
|
|
#import <AMapLocationKit/AMapLocationKit.h>
|
|
#import <AMapLocationKit/AMapLocationKit.h>
|
|
|
#import "HJCityPickerCity.h"
|
|
#import "HJCityPickerCity.h"
|
|
|
|
|
+#import "HJCheckVersionAPIManager.h"
|
|
|
|
|
+#import "HJUpdateViewController.h"
|
|
|
|
|
|
|
|
@interface HJHomeViewController () <UITableViewDelegate, UIScrollViewDelegate, HJNavBarViewDelegate, HJJobSortViewDelegate, HJCityPickerViewDelegate, FBAPIManagerDelegate, FBAPIManagerInterceptor>
|
|
@interface HJHomeViewController () <UITableViewDelegate, UIScrollViewDelegate, HJNavBarViewDelegate, HJJobSortViewDelegate, HJCityPickerViewDelegate, FBAPIManagerDelegate, FBAPIManagerInterceptor>
|
|
|
@property (nonatomic, strong) HJNavBarView *navBarView;
|
|
@property (nonatomic, strong) HJNavBarView *navBarView;
|
|
@@ -35,6 +37,7 @@
|
|
|
@property (nonatomic, strong) HJPositionDataBox *positionDataBox;
|
|
@property (nonatomic, strong) HJPositionDataBox *positionDataBox;
|
|
|
@property (nonatomic, strong) HJHomeDataBox *homeDataBox;
|
|
@property (nonatomic, strong) HJHomeDataBox *homeDataBox;
|
|
|
@property (nonatomic, strong) AMapLocationManager *locationManager;
|
|
@property (nonatomic, strong) AMapLocationManager *locationManager;
|
|
|
|
|
+@property (nonatomic, strong) HJCheckVersionAPIManager *checkAPIManager;
|
|
|
@end
|
|
@end
|
|
|
|
|
|
|
|
@implementation HJHomeViewController
|
|
@implementation HJHomeViewController
|
|
@@ -71,6 +74,10 @@
|
|
|
}];
|
|
}];
|
|
|
//[self.pageListView.tableView layoutIfNeeded]; // 对tableView重新布局以后要立即调用该方法,不然会有显示bug。
|
|
//[self.pageListView.tableView layoutIfNeeded]; // 对tableView重新布局以后要立即调用该方法,不然会有显示bug。
|
|
|
|
|
|
|
|
|
|
+ //检查更新
|
|
|
|
|
+ self.checkAPIManager.version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
|
|
|
|
|
+ [self.checkAPIManager start];
|
|
|
|
|
+
|
|
|
// 调用banner图片URL
|
|
// 调用banner图片URL
|
|
|
[self.getBannerAPIManager start];
|
|
[self.getBannerAPIManager start];
|
|
|
|
|
|
|
@@ -212,6 +219,20 @@
|
|
|
NSArray *imageURLStringArray = [manager fetchDataWithBox:self.homeDataBox];
|
|
NSArray *imageURLStringArray = [manager fetchDataWithBox:self.homeDataBox];
|
|
|
self.headerView.adScrollView.imageURLStringArray = imageURLStringArray;
|
|
self.headerView.adScrollView.imageURLStringArray = imageURLStringArray;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (manager == self.checkAPIManager) {
|
|
|
|
|
+ id fetchData = [manager fetchDataWithBox:nil];
|
|
|
|
|
+ //判断是否是最新版本
|
|
|
|
|
+ if (![[fetchData valueForKeyPath:@"data.isLatest"] boolValue]) {
|
|
|
|
|
+ HJUpdateViewController *vc = [[HJUpdateViewController alloc] init];
|
|
|
|
|
+ vc.cancelHidden = [[fetchData valueForKeyPath:@"data.hpVersion.isForceUpdate"] boolValue];
|
|
|
|
|
+ vc.updateText = [fetchData valueForKeyPath:@"data.hpVersion.description"];
|
|
|
|
|
+ vc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
|
|
|
|
|
+ vc.modalPresentationStyle = UIModalPresentationOverCurrentContext;
|
|
|
|
|
+ self.navigationController.definesPresentationContext = NO;
|
|
|
|
|
+ [self presentViewController:vc animated:YES completion:nil];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- (void)managerCallAPIDidFailed:(FBBaseAPIManager *)manager {
|
|
- (void)managerCallAPIDidFailed:(FBBaseAPIManager *)manager {
|
|
@@ -226,6 +247,14 @@
|
|
|
|
|
|
|
|
#pragma mark - getters and setters
|
|
#pragma mark - getters and setters
|
|
|
|
|
|
|
|
|
|
+- (HJCheckVersionAPIManager *)checkAPIManager {
|
|
|
|
|
+ if (_checkAPIManager == nil) {
|
|
|
|
|
+ _checkAPIManager = [[HJCheckVersionAPIManager alloc] init];
|
|
|
|
|
+ _checkAPIManager.APIManagerDelegate = self;
|
|
|
|
|
+ }
|
|
|
|
|
+ return _checkAPIManager;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
- (AMapLocationManager *)locationManager {
|
|
- (AMapLocationManager *)locationManager {
|
|
|
if (_locationManager == nil) {
|
|
if (_locationManager == nil) {
|
|
|
_locationManager = [[AMapLocationManager alloc] init];
|
|
_locationManager = [[AMapLocationManager alloc] init];
|