Commit 43e5ab3e authored by lmj_521aiau@163.com's avatar lmj_521aiau@163.com

no message

parent 6dd830b8
......@@ -59,7 +59,7 @@
[[ZJLocationManager shared] initWithLocationUpdateInfo:^(ZJLocationModel * model, CLLocation * location) {
[self updateMySelf:model];
[self uploadSelfLocation:location placemark:model];
// [self uploadSelfLocation:location placemark:model];
}];
}
......@@ -76,45 +76,6 @@
[self pauseTimer];
}
//- (void)checkAndRequestLocationService {
// if ([CLLocationManager locationServicesEnabled]) {
// [self.locationManager startUpdatingLocation];
// CLAuthorizationStatus locStatus = [CLLocationManager authorizationStatus];
// switch (locStatus) {
// case kCLAuthorizationStatusNotDetermined:
// [_locationManager requestWhenInUseAuthorization];
// case kCLAuthorizationStatusDenied:
// // 提示
// break;
// case kCLAuthorizationStatusRestricted:
// break;
// case kCLAuthorizationStatusAuthorizedWhenInUse:
// break;
// case kCLAuthorizationStatusAuthorizedAlways:
// break;
// default:
// break;
// }
// } else {
// [AlertControllerTool alertControllerWithTitle:kLocalizedString(@"alert_location_service") message:kLocalizedString(@"alert_location_authority") cancelTitle:kLocalizedString(@"alert_setting") cancelBlock:^{
//
// NSURL * url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
//
// if([[UIApplication sharedApplication] canOpenURL:url]) {
//
// if (@available(iOS 10.0, *)) {
// [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
// }else{
// [[UIApplication sharedApplication] openURL:url];
// }
// }
//
// } confirm:kLocalizedString(@"alert_cancel") confirmBlock:^(id s) {
//
// } finishBlock:nil];
// }
//}
- (void)setTimer{
count = refreshCount;
......@@ -153,69 +114,6 @@
}
}
///// 获取自己位置信息
//- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
//
// NSString *oldLatitude = [NSString stringWithFormat:@"%.3f", oldLocation.coordinate.latitude];
// NSString *newLatitude = [NSString stringWithFormat:@"%.3f", newLocation.coordinate.latitude];
//
// if ([oldLatitude isEqualToString:newLatitude]) {
// return;
// }
//
// NSLog(@"OldLocation %f %f", oldLocation.coordinate.latitude, oldLocation.coordinate.longitude);
// NSLog(@"NewLocation %f %f", newLocation.coordinate.latitude, newLocation.coordinate.longitude);
//
// // 获取当前所在的城市名
// CLGeocoder *geocoder = [[CLGeocoder alloc] init];
//
// [geocoder reverseGeocodeLocation: newLocation completionHandler:^(NSArray<CLPlacemark *> * _Nullable placemarks, NSError * _Nullable error) {
// if (placemarks.count > 0) {
// CLPlacemark *placemark = [placemarks firstObject];
// //获取城市
// NSString *city = placemark.locality;
// if (!city) {
// //四大直辖市的城市信息无法通过locality获得,只能通过获取省份的方法来获得(如果city为空,则可知为直辖市)
// city = placemark.administrativeArea;
// }
//
// // 市
// NSLog(@"locality,%@",placemark.addressDictionary);
// // 区
// NSLog(@"subLocality,%@",placemark.subLocality);
// // 街道
// NSLog(@"thoroughfare,%@",placemark.thoroughfare);
// // 子街道
// NSLog(@"subThoroughfare,%@",placemark.subThoroughfare);
//
//// // 位置名
////   NSLog(@"subLocality, %@",placemark.subLocality);
// // 国家
////   NSLog(@"country,%@",placemark.country);
//
// [self updateMySelf:placemark];
// [self uploadSelfLocation:newLocation placemark:placemark];
//
// }else if (error == nil && [placemarks count] == 0) {
// NSLog(@"No results were returned.");
// } else if (error != nil){
// NSLog(@"An error occurred = %@", error);
// }
// }];
//
//// [manager stopUpdatingLocation]; //不用的时候关闭更新位置服务
//}
//- (NSString *)currentDate{
//
// NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
// [formatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"];
// NSDate *datenow = [NSDate date];
// NSString *currentTimeString = [formatter stringFromDate:datenow];
//
// return currentTimeString;
//}
- (void)setUI{
self.view.backgroundColor = kColorWithRGB(251, 251, 251);
......@@ -390,39 +288,7 @@
}
#pragma mark 好友列表
- (void)getFriendList{
// [self.memberTableView reloadData];
//
// if (![ZJUserInfoManager shared].isLogin) {
// //未登录
// return;
// }
//
// [[TQNetworkTools shared] getWithAction:findFriendList parameters:@{} success:^(id _Nonnull response) {
//
// if([[response objectForKey:@"status"] integerValue] == 200){
//
// if (self.friendDataSource.count > 1) {
// [self.friendDataSource removeObjectsInRange:NSMakeRange(1, self.friendDataSource.count-1)];
// }
//
// for (NSDictionary * infoDic in response[@"result"][@"data"]) {
// ZJFriendModel * model = [ZJFriendModel new];
// [model setValuesForKeysWithDictionary:infoDic];
// [self.friendDataSource addObject:model];
// }
//
// [self.memberTableView reloadData];
//
// }else{
// [MBProgressHUD showError:[NSString stringWithFormat:@"%@", [response objectForKey:@"msg"]] toView:self.view];
// }
//
// } failure:^(NSError * _Nonnull error) {
//// [MBProgressHUD showError:[NSString stringWithFormat:@"获取好友列表失败\n%@", error.description] toView:self.view];
// }];
}
- (void)getFriendList{}
#pragma mark 编辑好友昵称
- (void)editFriendNickName:(ZJFriendModel *)model{
......@@ -462,50 +328,6 @@
}];
}
#pragma mark 同步最后一次位置信息
- (void)uploadSelfLocation:(CLLocation *)location placemark:(ZJLocationModel *)model{
if (![ZJUserInfoManager shared].isLogin) {
return;
}
// ZJLocationModel * model = [ZJLocationModel new];
// model.address = [NSString stringWithFormat:@"%@%@%@%@", placemark.locality?:@"", placemark.subLocality?:@"", placemark.thoroughfare?:@"", placemark.subThoroughfare?:@""];
// model.city = placemark.locality ? :placemark.administrativeArea;
//
// // 转化为火星坐标
// CLLocationCoordinate2D coord = [location coordinate];
// coord = [JZLocationConverter wgs84ToGcj02:coord];
//
// // model.cityCode 未知
// model.latitude = coord.latitude;
// model.longitude = coord.longitude;
//
//// model.locationType 未知
// model.time = [self currentDate];
NSDictionary * modelDic = [model dictionaryWithValuesForKeys:@[@"address", @"city", @"latitude", @"longitude", @"time"]];
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:modelDic options:NSJSONWritingPrettyPrinted error:nil];
NSString * string = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
[[TQNetworkTools shared] postWithAction:syncLocationDataLast parameters:@{@"LocationSyncData":string} success:^(id _Nonnull response) {
NSString *result = [[NSString alloc] initWithData:response
encoding:NSUTF8StringEncoding];
NSData * data = [result dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary * responseDict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
if([[responseDict objectForKey:@"status"] integerValue] == 200){
NSLog(@"success");
} else if ([[responseDict objectForKey:@"status"] integerValue] == 105) {
[MBProgressHUD showError:[responseDict objectForKey:@"msg"] toView:self.view];
}
} failure:^(NSError * _Nonnull error) {
}];
}
- (void)dealloc{
if (timer) {
dispatch_source_cancel(timer);
......
......@@ -351,7 +351,7 @@
NSString * phone = phoneTextfield.text;
NSString * phoneCode = currentCountryCode;
[[TQNetworkTools shared] postWithAction:getSmsCode parameters:@{@"phoneNo":phone, @"phoneCode":phoneCode} success:^(id _Nonnull response) {
[[TQNetworkTools shared] postWithAction:getSmsCode parameters:@{@"phoneNo":phone, /*@"phoneCode":phoneCode*/} success:^(id _Nonnull response) {
// self->isSend = YES;
NSLog(@"getSmsCode response %@", response);
if([[response objectForKey:@"status"] integerValue] == 200){
......
......@@ -178,9 +178,9 @@
- (void)setupUI {
_zoom = 20;
_zoom = 18;
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.868 longitude:151.2086 zoom:_zoom];
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:+40.75921100 longitude:-73.98463800 zoom:_zoom];
///初始化地图
// self.mapView = [[MAMapView alloc] initWithFrame:self.view.bounds];
......@@ -227,10 +227,6 @@
// self.track = [[MAAnimatedAnnotation alloc] init];
// self.track.title = @"pointReuseIndetifier1";
// [self.mapView addAnnotation:self.track];
_initialPolyline = [[GMSPolyline alloc] init];
_initiallinepath = [GMSMutablePath path];
}
- (void)setPoint:(CLLocationCoordinate2D)point target:(NSInteger)target{
......@@ -270,6 +266,9 @@
//画线,使用轨迹回放
- (void)drawLineWithLocationArray:(NSArray *)locationArray{
_initialPolyline = [[GMSPolyline alloc] init];
_initiallinepath = [GMSMutablePath path];
_initialPolyline.map = nil;
_initialPolyline.strokeColor = [UIColor blueColor];
......@@ -313,6 +312,8 @@
_endMarker.title = @"end";
_endMarker.map = _mapView;
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:(startCoordinate.latitude+endCoordinate.latitude)/2 longitude:(startCoordinate.longitude+endCoordinate.longitude)/2 zoom:_zoom];
_mapView.camera = camera;
for(int idx = 0; idx < self.initiallinepath.count; idx++){
......@@ -324,111 +325,39 @@
self.actionMarker.title = @"move";
self.actionMarker.map = self.mapView;
// [self.actionMarker.layer addSublayer: ];
// [self haha:[self hehe]];
_actionlinepath = [GMSMutablePath path];
_count = 0;
dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0));
dispatch_source_set_timer(timer, DISPATCH_TIME_NOW, 0.3 * NSEC_PER_SEC, 0 * NSEC_PER_SEC);
dispatch_source_set_timer(timer, DISPATCH_TIME_NOW, 0.16 * NSEC_PER_SEC, 0 * NSEC_PER_SEC);
dispatch_source_set_event_handler(timer, ^{
// if (self.count < self.initiallinepath.count) {
//
// CLLocationCoordinate2D coordinate = [self.initiallinepath coordinateAtIndex:self.count];
// [self.actionlinepath addCoordinate:coordinate];
//
// self.actionPolyline = [GMSPolyline polylineWithPath:self.actionlinepath];
// self.actionPolyline.strokeColor = [UIColor greenColor];
// self.actionPolyline.strokeWidth = 2;
// [CATransaction begin];
// [CATransaction setAnimationDuration:0.3];
// self.actionMarker.position = coordinate;
//// self.actionMarker.rotation = location.course
// self.actionPolyline.map = self.mapView;
// [CATransaction commit];
// self.count++;
// }else{
// dispatch_source_cancel(timer);
// }
});
dispatch_resume(timer);
}
-(void)addMarkers:(GMSPath *)path{
}
- (CAShapeLayer *)hehe{
UIBezierPath *breizerPath = [UIBezierPath bezierPath];
for(int i = 0; i < self.initiallinepath.count; i++){
CLLocationCoordinate2D coordinate = [self.initiallinepath coordinateAtIndex:i];
[breizerPath addLineToPoint:[_mapView.projection pointForCoordinate:coordinate]];
}
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.path = [[breizerPath bezierPathByReversingPath] CGPath];
shapeLayer.strokeColor = [[UIColor redColor] CGColor];
shapeLayer.lineWidth = 1.0;
shapeLayer.fillColor = [[UIColor redColor] CGColor];
shapeLayer.lineJoin = kCALineJoinRound;
shapeLayer.lineCap = kCALineCapRound;
shapeLayer.cornerRadius = 5;
return shapeLayer;
}
- (void)haha:(CAShapeLayer *)layer{
CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
pathAnimation.duration = 10;
// pathAnimation.delegate = self;
[pathAnimation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]];
pathAnimation.fromValue = [NSNumber numberWithFloat:0.0f];
pathAnimation.toValue = [NSNumber numberWithFloat:1.0f];
pathAnimation.repeatCount = 100;
[layer addAnimation:pathAnimation forKey:@"strokeEnd"];
[self.mapView.layer addSublayer:layer];
}
if (self.count < self.initiallinepath.count) {
-(void)animate:(GMSPath *)path {
CLLocationCoordinate2D coordinate = [self.initiallinepath coordinateAtIndex:self.count];
[self.actionlinepath addCoordinate:coordinate];
// for(int idx = 0; idx < path.count; idx++){
//
// }
dispatch_async(dispatch_get_main_queue(), ^{
if (self.count < path.count) {
[self.actionlinepath addCoordinate:[path coordinateAtIndex:self.count]];
self.actionPolyline = [GMSPolyline polylineWithPath:self.actionlinepath];
self.actionPolyline.strokeColor = [UIColor greenColor];
self.actionPolyline.strokeWidth = 2;
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:coordinate.latitude longitude:coordinate.longitude zoom:20];
[CATransaction begin];
[CATransaction setAnimationDuration:0.15];
self.actionMarker.position = coordinate;
// self.actionMarker.rotation = location.course
[self.mapView animateToCameraPosition:camera];
self.actionPolyline.map = self.mapView;
[self.arrayPolylineGreen addObject:self.actionPolyline];
[CATransaction commit];
self.count++;
// self.actionMarker.map = nil;
// self.actionMarker = [GMSMarker markerWithPosition:[path coordinateAtIndex:self.count]];
// self.actionMarker.icon = [UIImage imageNamed:@"map_track_move_icon"];
// self.actionMarker.title = @"move";
// self.actionMarker.map = self.mapView;
}else {
self.count = 0;
self.actionMarker.map = nil;
self.actionlinepath = [[GMSMutablePath alloc] init];
for (GMSPolyline *line in self.arrayPolylineGreen) {
line.map = nil;
}
}else{
dispatch_source_cancel(timer);
}
});
dispatch_resume(timer);
}
//- (void) drawLineAction {
......
......@@ -213,8 +213,8 @@ static TQNetworkTools* _tools = nil;
// [dict setValue: @"1" forKey: @"tgtk"];
// 获取BundleID
[dict setValue: [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"] forKey: @"pkg"];
// [dict setValue: @"com.app.zhiji" forKey: @"pkg"]; //cs
// [dict setValue: [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"] forKey: @"pkg"];
[dict setValue: @"com.app.zhiji" forKey: @"pkg"]; //cs
NSString *identifierForVendor = [[data Read] objectForKey:@"Identifier"];;
[dict setValue: identifierForVendor forKey: @"device"];
......@@ -230,8 +230,8 @@ static TQNetworkTools* _tools = nil;
// }
//appLs
[dict setValue: @"040087e60c36fd63" forKey: @"appLs"];
// [dict setValue: @"d904ceaa1b3f6444" forKey: @"appLs"]; //cs
// [dict setValue: @"040087e60c36fd63" forKey: @"appLs"];
[dict setValue: @"d904ceaa1b3f6444" forKey: @"appLs"]; //cs
// 设置网络类型
[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
......@@ -556,8 +556,8 @@ static TQNetworkTools* _tools = nil;
[dict setValue: identifierForVendor forKey: @"device"];
NSLog(@"identifierForVendor info == %@", identifierForVendor);
// 获取BundleID
[dict setValue: [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"] forKey: @"pkg"];
// [dict setValue: @"com.app.zhiji" forKey: @"pkg"];
// [dict setValue: [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"] forKey: @"pkg"];
[dict setValue: @"com.app.zhiji" forKey: @"pkg"];
// 设置时间戳
NSTimeInterval today = [[NSDate date] timeIntervalSince1970] * 1000;
......@@ -569,8 +569,8 @@ static TQNetworkTools* _tools = nil;
// }
//appLs
[dict setValue: @"040087e60c36fd63" forKey: @"appLs"];
// [dict setValue: @"d904ceaa1b3f6444" forKey: @"appLs"];
// [dict setValue: @"040087e60c36fd63" forKey: @"appLs"];
[dict setValue: @"d904ceaa1b3f6444" forKey: @"appLs"];
[dict addEntriesFromDictionary:[self signParams:dict]];
......
......@@ -26,15 +26,15 @@
//#define ServerHost @"https://feedapitest.zhangxinhulian.com"
//#define ServerHostFeed @"https://feedapitest.zhangxinhulian.com"
//#define ServerReport @"http://report.zhangxinhulian.com"
//#define ServerHost @"https://feedapi.zhangxinhulian.com"
//#define ServerHostFeed @"https://feedapi.zhangxinhulian.com"
#define ServerReport @"http://report.zhangxinhulian.com"
#define ServerHost @"https://feedapi.zhangxinhulian.com"
#define ServerHostFeed @"https://feedapi.zhangxinhulian.com"
//
//#else
#define ServerReport @"http://report.linking100.com"
#define ServerHost @"https://feedapi.linking100.com"
#define ServerHostFeed @"https://feedapi.linking100.com"
//#define ServerReport @"http://report.linking100.com"
//#define ServerHost @"https://feedapi.linking100.com"
//#define ServerHostFeed @"https://feedapi.linking100.com"
//#endif
......@@ -11,6 +11,7 @@
#import "AlertControllerTool.h"
#import <CoreLocation/CoreLocation.h>
#import "JZLocationConverter.h"
#import "ZJUserInfoManager.h"
@interface ZJLocationManager()<CLLocationManagerDelegate>{
......@@ -155,6 +156,8 @@ static ZJLocationManager * manager;
model.latitude = coord.latitude;
model.longitude = coord.longitude;
[self uploadSelfLocation:location placemark:model];
if (_callBack) {
_callBack(model, location);
}
......@@ -169,4 +172,48 @@ static ZJLocationManager * manager;
return currentTimeString;
}
#pragma mark 同步最后一次位置信息
- (void)uploadSelfLocation:(CLLocation *)location placemark:(ZJLocationModel *)model{
if (![ZJUserInfoManager shared].isLogin) {
return;
}
// ZJLocationModel * model = [ZJLocationModel new];
// model.address = [NSString stringWithFormat:@"%@%@%@%@", placemark.locality?:@"", placemark.subLocality?:@"", placemark.thoroughfare?:@"", placemark.subThoroughfare?:@""];
// model.city = placemark.locality ? :placemark.administrativeArea;
//
// // 转化为火星坐标
// CLLocationCoordinate2D coord = [location coordinate];
// coord = [JZLocationConverter wgs84ToGcj02:coord];
//
// // model.cityCode 未知
// model.latitude = coord.latitude;
// model.longitude = coord.longitude;
//
//// model.locationType 未知
// model.time = [self currentDate];
NSDictionary * modelDic = [model dictionaryWithValuesForKeys:@[@"address", @"city", @"latitude", @"longitude", @"time"]];
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:modelDic options:NSJSONWritingPrettyPrinted error:nil];
NSString * string = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
[[TQNetworkTools shared] postWithAction:syncLocationDataLast parameters:@{@"LocationSyncData":string} success:^(id _Nonnull response) {
NSString *result = [[NSString alloc] initWithData:response
encoding:NSUTF8StringEncoding];
NSData * data = [result dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary * responseDict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
if([[responseDict objectForKey:@"status"] integerValue] == 200){
NSLog(@"success");
} else if ([[responseDict objectForKey:@"status"] integerValue] == 105) {
[MBProgressHUD showError:[responseDict objectForKey:@"msg"] toView:nil];
}
} failure:^(NSError * _Nonnull error) {
}];
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment