|
@@ -517,56 +517,65 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
|
|
|
|
|
#pragma mark 根据不同消息跳转不同界面
|
|
|
- (void)getVCUserInfoDict:(NSMutableDictionary *)infoDict {
|
|
|
- if (![NSString isEmptyString:[infoDict ks_stringValueForKey:@"memo"]]) {
|
|
|
- NSData *jsonData = [[infoDict ks_stringValueForKey:@"memo"] mj_JSONData];
|
|
|
- NSError *error;
|
|
|
- NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error];
|
|
|
- if (!error) {
|
|
|
- UIViewController *vc = self.window.rootViewController;
|
|
|
- NSString *token = UserDefault(TokenKey);
|
|
|
- if ([vc isKindOfClass:[LaunchAnimationViewController class]] || [NSString isEmptyString:token]) {
|
|
|
- self.outLinkParm = [NSMutableDictionary dictionaryWithDictionary:dict];
|
|
|
- return;
|
|
|
- }
|
|
|
- NSString *action = [dict ks_stringValueForKey:@"action"];
|
|
|
- if ([action isEqualToString:@"app"]) { // 跳原生
|
|
|
- NSString *pageType = [dict ks_stringValueForKey:@"pageTag"];
|
|
|
- if ([pageType isEqualToString:@"buyPractice"] || [pageType isEqualToString:@"courseRemind"]) {
|
|
|
- [self.tabBarController tabBarSelectedWithIndex:1];
|
|
|
- CustomNavViewController *navCtrl = self.tabBarController.selectedViewController;
|
|
|
- [navCtrl popToRootViewControllerAnimated:YES];
|
|
|
- }
|
|
|
- else if ([pageType isEqualToString:@"evaluate"]) {
|
|
|
- [self.tabBarController tabBarSelectedWithIndex:0];
|
|
|
- CustomNavViewController *navCtrl = self.tabBarController.selectedViewController;
|
|
|
- ReceiveEvaluateListController *ctrl = [[ReceiveEvaluateListController alloc] init];
|
|
|
- [navCtrl pushViewController:ctrl animated:YES];
|
|
|
+ BOOL isJPush = [[infoDict allKeys] containsObject:@"_j_msgid"]; // 极光推送标识区分
|
|
|
+ if (isJPush) {
|
|
|
+ if (![NSString isEmptyString:[infoDict ks_stringValueForKey:@"memo"]]) {
|
|
|
+ NSData *jsonData = [[infoDict ks_stringValueForKey:@"memo"] mj_JSONData];
|
|
|
+ NSError *error;
|
|
|
+ NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error];
|
|
|
+ if (!error) {
|
|
|
+ UIViewController *vc = self.window.rootViewController;
|
|
|
+ NSString *token = UserDefault(TokenKey);
|
|
|
+ if ([vc isKindOfClass:[LaunchAnimationViewController class]] || [NSString isEmptyString:token]) {
|
|
|
+ self.outLinkParm = [NSMutableDictionary dictionaryWithDictionary:dict];
|
|
|
+ return;
|
|
|
}
|
|
|
- else if ([pageType isEqualToString:@"homework"]) {
|
|
|
- NSString *parmString = [dict ks_stringValueForKey:@"params"];
|
|
|
- NSData *parmData = [parmString mj_JSONData];
|
|
|
- NSDictionary *parm = [NSJSONSerialization JSONObjectWithData:parmData options:NSJSONReadingMutableContainers error:&error];
|
|
|
- if (!error) {
|
|
|
- HomeworkDetailViewController *detailVC = [[HomeworkDetailViewController alloc] init];
|
|
|
- detailVC.courseId = [parm ks_stringValueForKey:@"courseId"];
|
|
|
- detailVC.studentId = [parm ks_stringValueForKey:@"studentId"];
|
|
|
+ NSString *action = [dict ks_stringValueForKey:@"action"];
|
|
|
+ if ([action isEqualToString:@"app"]) { // 跳原生
|
|
|
+ NSString *pageType = [dict ks_stringValueForKey:@"pageTag"];
|
|
|
+ if ([pageType isEqualToString:@"buyPractice"] || [pageType isEqualToString:@"courseRemind"]) {
|
|
|
+ [self.tabBarController tabBarSelectedWithIndex:1];
|
|
|
CustomNavViewController *navCtrl = self.tabBarController.selectedViewController;
|
|
|
- [navCtrl pushViewController:detailVC animated:YES];
|
|
|
+ [navCtrl popToRootViewControllerAnimated:YES];
|
|
|
}
|
|
|
- }
|
|
|
- else if ([pageType isEqualToString:@"musicSheet"]) {
|
|
|
- MyMusicViewController *musicCtrl = [[MyMusicViewController alloc] init];
|
|
|
- CustomNavViewController *navCtrl = self.tabBarController.selectedViewController;
|
|
|
- [navCtrl pushViewController:musicCtrl animated:YES];
|
|
|
- }
|
|
|
- else if ([pageType isEqualToString:@"message"]) {
|
|
|
- UIViewController *vc = [UIApplication sharedApplication].keyWindow.rootViewController;
|
|
|
- if ([vc isKindOfClass:[UITabBarController class]]) {
|
|
|
- KSTabBarViewController *tabCtrl = (KSTabBarViewController *)vc;
|
|
|
- CustomNavViewController *navCtrl = (CustomNavViewController *)tabCtrl.selectedViewController;
|
|
|
- if ([navCtrl.visibleViewController isKindOfClass:NSClassFromString(@"NotiferMessageViewController")]) {
|
|
|
- NotiferMessageViewController *ctrl = (NotiferMessageViewController *)navCtrl.visibleViewController;
|
|
|
- [ctrl refreshView];
|
|
|
+ else if ([pageType isEqualToString:@"evaluate"]) {
|
|
|
+ [self.tabBarController tabBarSelectedWithIndex:0];
|
|
|
+ CustomNavViewController *navCtrl = self.tabBarController.selectedViewController;
|
|
|
+ ReceiveEvaluateListController *ctrl = [[ReceiveEvaluateListController alloc] init];
|
|
|
+ [navCtrl pushViewController:ctrl animated:YES];
|
|
|
+ }
|
|
|
+ else if ([pageType isEqualToString:@"homework"]) {
|
|
|
+ NSString *parmString = [dict ks_stringValueForKey:@"params"];
|
|
|
+ NSData *parmData = [parmString mj_JSONData];
|
|
|
+ NSDictionary *parm = [NSJSONSerialization JSONObjectWithData:parmData options:NSJSONReadingMutableContainers error:&error];
|
|
|
+ if (!error) {
|
|
|
+ HomeworkDetailViewController *detailVC = [[HomeworkDetailViewController alloc] init];
|
|
|
+ detailVC.courseId = [parm ks_stringValueForKey:@"courseId"];
|
|
|
+ detailVC.studentId = [parm ks_stringValueForKey:@"studentId"];
|
|
|
+ CustomNavViewController *navCtrl = self.tabBarController.selectedViewController;
|
|
|
+ [navCtrl pushViewController:detailVC animated:YES];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if ([pageType isEqualToString:@"musicSheet"]) {
|
|
|
+ MyMusicViewController *musicCtrl = [[MyMusicViewController alloc] init];
|
|
|
+ CustomNavViewController *navCtrl = self.tabBarController.selectedViewController;
|
|
|
+ [navCtrl pushViewController:musicCtrl animated:YES];
|
|
|
+ }
|
|
|
+ else if ([pageType isEqualToString:@"message"]) {
|
|
|
+ UIViewController *vc = [UIApplication sharedApplication].keyWindow.rootViewController;
|
|
|
+ if ([vc isKindOfClass:[UITabBarController class]]) {
|
|
|
+ KSTabBarViewController *tabCtrl = (KSTabBarViewController *)vc;
|
|
|
+ CustomNavViewController *navCtrl = (CustomNavViewController *)tabCtrl.selectedViewController;
|
|
|
+ if ([navCtrl.visibleViewController isKindOfClass:NSClassFromString(@"NotiferMessageViewController")]) {
|
|
|
+ NotiferMessageViewController *ctrl = (NotiferMessageViewController *)navCtrl.visibleViewController;
|
|
|
+ [ctrl refreshView];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ [self.tabBarController tabBarSelectedWithIndex:0];
|
|
|
+ CustomNavViewController *navCtrl = self.tabBarController.selectedViewController;
|
|
|
+ NotiferMessageViewController *ctrl = [[NotiferMessageViewController alloc] init];
|
|
|
+ [navCtrl pushViewController:ctrl animated:YES];
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
[self.tabBarController tabBarSelectedWithIndex:0];
|
|
@@ -575,21 +584,21 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
|
|
[navCtrl pushViewController:ctrl animated:YES];
|
|
|
}
|
|
|
}
|
|
|
- else {
|
|
|
- [self.tabBarController tabBarSelectedWithIndex:0];
|
|
|
- CustomNavViewController *navCtrl = self.tabBarController.selectedViewController;
|
|
|
- NotiferMessageViewController *ctrl = [[NotiferMessageViewController alloc] init];
|
|
|
- [navCtrl pushViewController:ctrl animated:YES];
|
|
|
- }
|
|
|
- }
|
|
|
- else { // 统一跳转消息列表
|
|
|
- UIViewController *vc = [UIApplication sharedApplication].keyWindow.rootViewController;
|
|
|
- if ([vc isKindOfClass:[UITabBarController class]]) {
|
|
|
- KSTabBarViewController *tabCtrl = (KSTabBarViewController *)vc;
|
|
|
- CustomNavViewController *navCtrl = (CustomNavViewController *)tabCtrl.selectedViewController;
|
|
|
- if ([navCtrl.visibleViewController isKindOfClass:NSClassFromString(@"NotiferMessageViewController")]) {
|
|
|
- NotiferMessageViewController *ctrl = (NotiferMessageViewController *)navCtrl.visibleViewController;
|
|
|
- [ctrl refreshView];
|
|
|
+ else { // 统一跳转消息列表
|
|
|
+ UIViewController *vc = [UIApplication sharedApplication].keyWindow.rootViewController;
|
|
|
+ if ([vc isKindOfClass:[UITabBarController class]]) {
|
|
|
+ KSTabBarViewController *tabCtrl = (KSTabBarViewController *)vc;
|
|
|
+ CustomNavViewController *navCtrl = (CustomNavViewController *)tabCtrl.selectedViewController;
|
|
|
+ if ([navCtrl.visibleViewController isKindOfClass:NSClassFromString(@"NotiferMessageViewController")]) {
|
|
|
+ NotiferMessageViewController *ctrl = (NotiferMessageViewController *)navCtrl.visibleViewController;
|
|
|
+ [ctrl refreshView];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ [self.tabBarController tabBarSelectedWithIndex:0];
|
|
|
+ CustomNavViewController *navCtrl = self.tabBarController.selectedViewController;
|
|
|
+ NotiferMessageViewController *ctrl = [[NotiferMessageViewController alloc] init];
|
|
|
+ [navCtrl pushViewController:ctrl animated:YES];
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
[self.tabBarController tabBarSelectedWithIndex:0];
|
|
@@ -598,23 +607,17 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
|
|
[navCtrl pushViewController:ctrl animated:YES];
|
|
|
}
|
|
|
}
|
|
|
- else {
|
|
|
- [self.tabBarController tabBarSelectedWithIndex:0];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ NSString *webUrl = [dict ks_stringValueForKey:@"url"];
|
|
|
+ if (![NSString isEmptyString:webUrl]) {
|
|
|
+ KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
|
|
|
+ webCtrl.url = [webUrl getUrlEndcodeString];
|
|
|
CustomNavViewController *navCtrl = self.tabBarController.selectedViewController;
|
|
|
- NotiferMessageViewController *ctrl = [[NotiferMessageViewController alloc] init];
|
|
|
- [navCtrl pushViewController:ctrl animated:YES];
|
|
|
+ [navCtrl pushViewController:webCtrl animated:YES];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- else {
|
|
|
- NSString *webUrl = [dict ks_stringValueForKey:@"url"];
|
|
|
- if (![NSString isEmptyString:webUrl]) {
|
|
|
- KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
|
|
|
- webCtrl.url = [webUrl getUrlEndcodeString];
|
|
|
- CustomNavViewController *navCtrl = self.tabBarController.selectedViewController;
|
|
|
- [navCtrl pushViewController:webCtrl animated:YES];
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
else { // 跳转到聊天
|