|
@@ -22,10 +22,7 @@ static NSString * const kHostAddress = @"localhost:50051";
|
|
|
|
|
|
@interface JYNewSearchViewController ()<WKNavigationDelegate,WKUIDelegate,WKScriptMessageHandler,CLLocationManagerDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate,CLLocationManagerDelegate,SKProductsRequestDelegate,SKPaymentTransactionObserver,ZKClipboardViewDelegate,WBFaceVerifyCustomerServiceDelegate,UIDocumentPickerDelegate>
|
|
|
{
|
|
|
- NSInteger _timeTick;
|
|
|
- NSInteger _time;
|
|
|
NSInteger pushIndex;//第几个模块过来的
|
|
|
- BOOL notiFinish;
|
|
|
BOOL isLoadRedDot;
|
|
|
CGPoint startTouch;
|
|
|
BOOL _isMoving;
|
|
@@ -35,9 +32,6 @@ static NSString * const kHostAddress = @"localhost:50051";
|
|
|
@property (nonatomic, strong) UIProgressView *progressView;
|
|
|
@property (nonatomic, strong) WKWebView *webView;
|
|
|
|
|
|
-@property (nonatomic, strong)NSMutableDictionary *notiDict;
|
|
|
-@property (nonatomic,weak)NSTimer *timer;
|
|
|
-
|
|
|
@property(nonatomic, assign)BOOL updateNotify;
|
|
|
|
|
|
@property(nonatomic,strong)CLLocationManager *locaationManager;
|
|
@@ -54,6 +48,7 @@ static NSString * const kHostAddress = @"localhost:50051";
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
@end
|
|
|
|
|
|
|
|
@@ -63,27 +58,18 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
|
|
|
|
|
|
@implementation JYNewSearchViewController
|
|
|
|
|
|
-
|
|
|
-
|
|
|
--(void)initGRPC{
|
|
|
- NSString * const kHostAddress = @"111.202.46.21:18053";
|
|
|
- [GRPCCall useInsecureConnectionsForHost:kHostAddress];
|
|
|
-
|
|
|
-// ProtoRPC *call = [client RPCToUnaryCallWithRequest:request handler:^(AUTHResponse *response, NSError *error) {
|
|
|
-// ...
|
|
|
-// }];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-(void)viewWillAppear:(BOOL)animated
|
|
|
{
|
|
|
[super viewWillAppear:animated];
|
|
|
[self.navigationController setNavigationBarHidden:YES animated:animated];
|
|
|
- if([GlobalData shareInstance].searchIsRed) {
|
|
|
+ if ([GlobalData shareInstance].isClickNotiStatus) {
|
|
|
[GlobalData shareInstance].searchIsRed = NO;
|
|
|
- [self webViewFirstRequest];
|
|
|
+ [GlobalData shareInstance].isClickNotiStatus = NO;
|
|
|
+ }else {
|
|
|
+ if([GlobalData shareInstance].searchIsRed) {
|
|
|
+ [GlobalData shareInstance].searchIsRed = NO;
|
|
|
+ [self webViewFirstRequest];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -552,20 +538,6 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
|
|
|
// Do any additional setup after loading the view.
|
|
|
NSLog(@"首页初始化");
|
|
|
|
|
|
-
|
|
|
- [self initGRPC];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
self.view.backgroundColor = [UIColor whiteColor];
|
|
|
|
|
|
|
|
@@ -574,7 +546,6 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
|
|
|
[self webViewFirstRequest];
|
|
|
[[AFNetworkReachabilityManager sharedManager] startMonitoring];
|
|
|
[self initNotification];
|
|
|
- [self initApnsTimer];
|
|
|
self.recognizer = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(paningGestureReceive:)];
|
|
|
[self.recognizer delaysTouchesBegan];
|
|
|
[self.view addGestureRecognizer:self.recognizer];
|
|
@@ -591,9 +562,6 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
|
|
|
//监听购买结果
|
|
|
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
|
|
|
|
|
|
-
|
|
|
-// UIButton *btn1 = [ZKControl createButtonWithFrame:CGRectMake(100, 100, 100, 100) title:@"测试上传" imageName:nil bgImageName:nil target:self method:@selector(btn1click)];
|
|
|
-// [self.view addSubview:btn1];
|
|
|
|
|
|
|
|
|
}
|
|
@@ -701,18 +669,6 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
|
|
|
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
--(void)initApnsTimer {
|
|
|
- //定时器
|
|
|
- if([LXUserDefaults isExistToken]) {
|
|
|
- self.notiDict = [[NSMutableDictionary alloc]initWithDictionary:[[NSUserDefaults standardUserDefaults] objectForKey:RemoteNotifications]];
|
|
|
- if(self.notiDict.count) {
|
|
|
- self.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timeFireMethod) userInfo:nil repeats:YES];
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-(void)haveRedPoint
|
|
|
{
|
|
|
NSLog(@"http请求-------小红点");
|
|
@@ -763,14 +719,15 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
|
|
|
/* 页面加载完成 */
|
|
|
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
|
|
|
NSLog(@"-----页面加载完成%@",webView.URL.absoluteString);
|
|
|
+ if (![GlobalData shareInstance].isSearchToLoad) {
|
|
|
+ [GlobalData shareInstance].isSearchToLoad = YES;
|
|
|
+ }
|
|
|
+
|
|
|
//第一次加载小红点
|
|
|
if(!isLoadRedDot) {
|
|
|
isLoadRedDot = true;
|
|
|
[self haveRedPoint];
|
|
|
}
|
|
|
- if(!notiFinish) {
|
|
|
- notiFinish = YES;
|
|
|
- }
|
|
|
[self.webView evaluateJavaScript:@"document.documentElement.style.webkitTouchCallout='none';" completionHandler:nil];
|
|
|
[self.webView evaluateJavaScript:@"document.documentElement.style.webkitUserSelect='none';"completionHandler:nil];
|
|
|
[self judgeIsHiddenBottom];//是否隐藏
|
|
@@ -1564,57 +1521,6 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
--(void)timeFireMethod{
|
|
|
- _timeTick++;
|
|
|
- if(self.webView&¬iFinish) { //点击通知启动
|
|
|
- NSDictionary *infoDict = self.notiDict[@"info"];
|
|
|
- if ([infoDict isKindOfClass:[NSString class]]) {
|
|
|
- infoDict = [[LXViewControllerManager shareViewControllerManager] dictionaryWithJsonString:self.notiDict[@"info"]];
|
|
|
- }
|
|
|
- if ([infoDict objectForKey:@"url"]) {//数据正常
|
|
|
- NSString * urlStr = [LXMD5 dealWithPushUrl:[NSString stringWithFormat:@"%@",infoDict[@"url"]] type:[NSString stringWithFormat:@"%@",infoDict[@"type"]]];
|
|
|
- NSString * menuname = [NSString stringWithFormat:@"%@",infoDict[@"menuname"]];
|
|
|
- //切换底部栏
|
|
|
- AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
- JYTabBarController *tab = (JYTabBarController *)delegate.window.rootViewController;
|
|
|
- NSDictionary *user_info = @{@"url":urlStr};
|
|
|
- if ([menuname isEqualToString:@"search"]) {
|
|
|
- tab.selectedIndex = 0;//切换底部栏
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsOne object:nil userInfo:user_info];
|
|
|
- }else if ([menuname isEqualToString:@"subscribe"]) {
|
|
|
- tab.selectedIndex = 1;//切换底部栏
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsTwo object:nil userInfo:user_info];
|
|
|
- }else if ([menuname isEqualToString:@"box"]) {
|
|
|
- tab.selectedIndex = 2;//切换底部栏
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsThree object:nil userInfo:user_info];
|
|
|
- }else if ([menuname isEqualToString:@"me"]) {
|
|
|
- tab.selectedIndex = 3;//切换底部栏
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsFour object:nil userInfo:user_info];
|
|
|
- }else if ([menuname isEqualToString:@"other"]) {
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushLinkUrlMethods object:nil userInfo:user_info];
|
|
|
- }else {
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlOtherMethods object:nil userInfo:user_info];
|
|
|
- }
|
|
|
- [self.timer invalidate];
|
|
|
- self.timer = nil;
|
|
|
- _timeTick = 0;
|
|
|
- [[NSUserDefaults standardUserDefaults] removeObjectForKey:RemoteNotifications];
|
|
|
- return;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- if (_timeTick == 60) {
|
|
|
- [self.timer invalidate];
|
|
|
- self.timer = nil;
|
|
|
- _timeTick = 0;
|
|
|
- [[NSUserDefaults standardUserDefaults] removeObjectForKey:RemoteNotifications];
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- (void)hideTabBar {
|
|
|
kMainQueue(^{
|
|
|
if (self.tabBarController.tabBar.hidden == YES) {
|
|
@@ -1631,8 +1537,7 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
|
|
|
}
|
|
|
- (void)showTabBar{
|
|
|
kMainQueue(^{
|
|
|
- if (self.tabBarController.tabBar.hidden == NO)
|
|
|
- {
|
|
|
+ if (self.tabBarController.tabBar.hidden == NO){
|
|
|
return;
|
|
|
}
|
|
|
UIView *contentView;
|
|
@@ -1961,12 +1866,15 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
|
|
|
}
|
|
|
-(void)openPushUrlMethodsOne:(NSNotification *)notification{
|
|
|
NSDictionary *infoDict = notification.userInfo;
|
|
|
+ NSLog(@"%@",infoDict);
|
|
|
if (!infoDict) {return;}
|
|
|
NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
|
|
|
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]]];
|
|
|
}
|
|
|
-(void)openPushLinkUrlMethods:(NSNotification *)notification{
|
|
|
NSDictionary *infoDict = notification.userInfo;
|
|
|
+ NSLog(@"%@",infoDict);
|
|
|
+
|
|
|
if (!infoDict) {return;}
|
|
|
NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
|
|
|
if (self.tabBarController.selectedIndex == 0) {
|