|
@@ -105,6 +105,10 @@ JSExportAs(isInstallWeixin, -(int)jsIsInstallWeixin:(NSString *)str);// 是否
|
|
|
[[AFNetworkReachabilityManager sharedManager] startMonitoring];
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(netReachChanged:) name:AFNetworkingReachabilityDidChangeNotification object:nil];
|
|
|
|
|
|
+
|
|
|
+ //2018 7 28修改新增js
|
|
|
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(messageAccept:) name:@"messageAccept" object:nil];
|
|
|
+
|
|
|
// [self clearWeb];
|
|
|
|
|
|
UIPanGestureRecognizer *recognizer = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(paningGestureReceive:)];
|
|
@@ -233,20 +237,45 @@ JSExportAs(isInstallWeixin, -(int)jsIsInstallWeixin:(NSString *)str);// 是否
|
|
|
return;
|
|
|
}
|
|
|
NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
|
|
|
+
|
|
|
if (urlStr) {
|
|
|
[[LXViewControllerManager shareViewControllerManager] showHudText:nil];
|
|
|
self.afterOpenPushMessage = YES;
|
|
|
- NSString *url = [NSString stringWithFormat:@"%@%@", kHost, urlStr];
|
|
|
- url = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
|
|
- [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:@"kNewWebControllerDismiss" object:nil];
|
|
|
+
|
|
|
+
|
|
|
+ if([infoDict[@"type"] isEqualToString:@"message"]) {
|
|
|
+ NSString *url = [NSString stringWithFormat:@"%@",urlStr];
|
|
|
+ url = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
|
|
+ [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"kNewWebControllerDismiss" object:nil];
|
|
|
+ }else {
|
|
|
+ NSString *url = [NSString stringWithFormat:@"%@%@", kHost, urlStr];
|
|
|
+ url = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
|
|
+ [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"kNewWebControllerDismiss" object:nil];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+-(void)messageAccept:(NSNotification *)userInfo
|
|
|
+{
|
|
|
+ NSDictionary * infoDic = [userInfo object];
|
|
|
+
|
|
|
+ NSString *textJS = [NSString stringWithFormat:@"messageAccept('%@','%@','%@')",infoDic[@"mid"],infoDic[@"rectype"],infoDic[@"openid"]];
|
|
|
+ JSContext *context = [self.webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
|
|
|
+ [context evaluateScript:textJS];
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// 收到通知消息
|
|
|
-(void)afterReceiveNewMsg{
|
|
|
+ NSLog(@"afterReceiveNewMsg");
|
|
|
JSContext *context = [self.webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
|
|
|
[context evaluateScript:@"afterReceiveNewMsg()"];
|
|
|
}
|
|
@@ -555,6 +584,8 @@ JSExportAs(isInstallWeixin, -(int)jsIsInstallWeixin:(NSString *)str);// 是否
|
|
|
}
|
|
|
// 取未读消息总数
|
|
|
-(int)jsGetUnReadMessageCount:(NSString *)openid{
|
|
|
+ NSLog(@"openid=%@",openid);
|
|
|
+// NSLog(@"%d",[[LXDataBaseManager shareDataBaseManager] getUnReadMessageCount:openid]);
|
|
|
return [[LXDataBaseManager shareDataBaseManager] getUnReadMessageCount:openid];
|
|
|
}
|
|
|
|