|
@@ -132,6 +132,7 @@
|
|
|
[self.wkwebView.configuration.userContentController addScriptMessageHandler:self name:@"login"];
|
|
[self.wkwebView.configuration.userContentController addScriptMessageHandler:self name:@"login"];
|
|
|
[self.wkwebView.configuration.userContentController addScriptMessageHandler:self name:@"logout"];
|
|
[self.wkwebView.configuration.userContentController addScriptMessageHandler:self name:@"logout"];
|
|
|
[self.wkwebView.configuration.userContentController addScriptMessageHandler:self name:@"UpdateBadge"];
|
|
[self.wkwebView.configuration.userContentController addScriptMessageHandler:self name:@"UpdateBadge"];
|
|
|
|
|
+ [self.wkwebView.configuration.userContentController addScriptMessageHandler:self name:@"QueryLaunchNotification"];
|
|
|
|
|
|
|
|
// [self.configuration.userContentController addScriptMessageHandler:self name:@"Color"];
|
|
// [self.configuration.userContentController addScriptMessageHandler:self name:@"Color"];
|
|
|
// [self.configuration.userContentController addScriptMessageHandler:self name:@"Pay"];
|
|
// [self.configuration.userContentController addScriptMessageHandler:self name:@"Pay"];
|
|
@@ -160,6 +161,7 @@
|
|
|
[self.wkwebView.configuration.userContentController removeScriptMessageHandlerForName:@"login"];
|
|
[self.wkwebView.configuration.userContentController removeScriptMessageHandlerForName:@"login"];
|
|
|
[self.wkwebView.configuration.userContentController removeScriptMessageHandlerForName:@"logout"];
|
|
[self.wkwebView.configuration.userContentController removeScriptMessageHandlerForName:@"logout"];
|
|
|
[self.wkwebView.configuration.userContentController removeScriptMessageHandlerForName:@"UpdateBadge"];
|
|
[self.wkwebView.configuration.userContentController removeScriptMessageHandlerForName:@"UpdateBadge"];
|
|
|
|
|
+ [self.wkwebView.configuration.userContentController removeScriptMessageHandlerForName:@"QueryLaunchNotification"];
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- (void)dealloc
|
|
- (void)dealloc
|
|
@@ -598,6 +600,25 @@
|
|
|
[self returnToWebPage:params value:Sret];
|
|
[self returnToWebPage:params value:Sret];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+- (void)ra_queryLaunchNotification:(NSDictionary *)params {
|
|
|
|
|
+
|
|
|
|
|
+ AppDelegate *delagate =(AppDelegate *) [[UIApplication sharedApplication]delegate];
|
|
|
|
|
+
|
|
|
|
|
+// NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
|
|
|
|
|
+// NSString *ver = [infoDic objectForKey:@"CFBundleShortVersionString"];
|
|
|
|
|
+// NSString *build = [infoDic objectForKey:@"CFBundleVersion"];
|
|
|
|
|
+// NSString *appVer = [NSString localizedStringWithFormat:@"Ver: %@ build %@",ver,build];
|
|
|
|
|
+//
|
|
|
|
|
+// NSMutableDictionary * ret = [NSMutableDictionary new];
|
|
|
|
|
+// ret[@"appVer"]=appVer;
|
|
|
|
|
+// ret[@"apnToken"]=delagate.apnToken ;
|
|
|
|
|
+//
|
|
|
|
|
+// NSString* Sret=[RAConvertor dict2string:ret];
|
|
|
|
|
+ [self returnToWebPage:params value:delagate.launchNotification];
|
|
|
|
|
+ delagate.launchNotification = nil;
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
- (void)ra_cleanCache:(NSDictionary *)params {
|
|
- (void)ra_cleanCache:(NSDictionary *)params {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -681,7 +702,7 @@
|
|
|
|
|
|
|
|
#pragma mark - Web Callback
|
|
#pragma mark - Web Callback
|
|
|
|
|
|
|
|
--(void) returnToWebPage:(NSDictionary*)params value:(NSObject*)value
|
|
|
|
|
|
|
+-(void) returnToWebPage:(NSDictionary*)params value:(NSString*)value
|
|
|
{
|
|
{
|
|
|
if(![params isNull:@"returnid"] )
|
|
if(![params isNull:@"returnid"] )
|
|
|
{
|
|
{
|
|
@@ -693,16 +714,19 @@
|
|
|
[self webPageCallback:params caller:params[@"id"] value:value];
|
|
[self webPageCallback:params caller:params[@"id"] value:value];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
--(void) webPageCallback:(NSDictionary*)params caller:(NSString*) callerid value:(NSObject*)value
|
|
|
|
|
|
|
+-(void) webPageCallback:(NSDictionary*)params caller:(NSString*) callerid value:(NSString*)value
|
|
|
{
|
|
{
|
|
|
// NSString* caller = [NSString stringWithFormat:@"'%@'",callerid];
|
|
// NSString* caller = [NSString stringWithFormat:@"'%@'",callerid];
|
|
|
NSString *caller = [callerid ra_stringByEscapingForJavascriptWithDelimiter:'\'' wrapWithDelimiters:YES];
|
|
NSString *caller = [callerid ra_stringByEscapingForJavascriptWithDelimiter:'\'' wrapWithDelimiters:YES];
|
|
|
- if([value isKindOfClass:NSString.class])
|
|
|
|
|
|
|
+ if(value==nil)
|
|
|
|
|
+ value=@"";
|
|
|
|
|
+// if([value isKindOfClass:NSString.class])
|
|
|
{
|
|
{
|
|
|
// value =[NSString stringWithFormat:@"'%@'",value];
|
|
// value =[NSString stringWithFormat:@"'%@'",value];
|
|
|
value = [(NSString *)value ra_stringByEscapingForJavascriptWithDelimiter:'\'' wrapWithDelimiters:YES];
|
|
value = [(NSString *)value ra_stringByEscapingForJavascriptWithDelimiter:'\'' wrapWithDelimiters:YES];
|
|
|
}
|
|
}
|
|
|
- NSString *jsStr = [NSString stringWithFormat:params[@"callback"],caller.UTF8String,value.description.UTF8String];
|
|
|
|
|
|
|
+
|
|
|
|
|
+ NSString *jsStr = [NSString stringWithFormat:params[@"callback"],caller.UTF8String,value.UTF8String];
|
|
|
[self.wkwebView evaluateJavaScript:jsStr completionHandler:^(id _Nullable result, NSError * _Nullable error) {
|
|
[self.wkwebView evaluateJavaScript:jsStr completionHandler:^(id _Nullable result, NSError * _Nullable error) {
|
|
|
NSLog(@"%@----%@",result, error);
|
|
NSLog(@"%@----%@",result, error);
|
|
|
}];
|
|
}];
|
|
@@ -874,7 +898,12 @@
|
|
|
} else if ([message.name isEqualToString:@"requestApplicationInfo"]) {
|
|
} else if ([message.name isEqualToString:@"requestApplicationInfo"]) {
|
|
|
|
|
|
|
|
[self handleRequestApplicationInfo: params];
|
|
[self handleRequestApplicationInfo: params];
|
|
|
- } else if ([message.name isEqualToString:@"UpdateBadge"]) {
|
|
|
|
|
|
|
+ }else if ([message.name isEqualToString:@"QueryLaunchNotification"]) {
|
|
|
|
|
+
|
|
|
|
|
+ [self ra_queryLaunchNotification: params];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ else if ([message.name isEqualToString:@"UpdateBadge"]) {
|
|
|
|
|
|
|
|
[self handleUpdateBadge: params];
|
|
[self handleUpdateBadge: params];
|
|
|
} else if ([message.name isEqualToString:@"cleanCache"]) {
|
|
} else if ([message.name isEqualToString:@"cleanCache"]) {
|
|
@@ -1002,6 +1031,7 @@
|
|
|
|
|
|
|
|
[self ra_selectContact:params];
|
|
[self ra_selectContact:params];
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
- (void)handleUpdateBadge:(NSDictionary *)params {
|
|
- (void)handleUpdateBadge:(NSDictionary *)params {
|
|
|
[UIApplication sharedApplication].applicationIconBadgeNumber = [params[@"count"] intValue];
|
|
[UIApplication sharedApplication].applicationIconBadgeNumber = [params[@"count"] intValue];
|
|
|
// [self ra_requestAppInfo:params];
|
|
// [self ra_requestAppInfo:params];
|
|
@@ -1009,6 +1039,9 @@
|
|
|
- (void)handleRequestApplicationInfo:(NSDictionary *)params {
|
|
- (void)handleRequestApplicationInfo:(NSDictionary *)params {
|
|
|
[self ra_requestAppInfo:params];
|
|
[self ra_requestAppInfo:params];
|
|
|
}
|
|
}
|
|
|
|
|
+- (void)QueryLaunchNotification:(NSDictionary *)params {
|
|
|
|
|
+ [self ra_requestAppInfo:params];
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
- (void)handleCleanCache:(NSDictionary *)params {
|
|
- (void)handleCleanCache:(NSDictionary *)params {
|
|
|
[self ra_cleanCache:params];
|
|
[self ra_cleanCache:params];
|