Commit 4ea007a8 authored by 刘鹿杰's avatar 刘鹿杰

GMPhobos 库referrer_link 参数名统一。

修改极光推送进入页面时,链路中referrer_link 链路清空问题
parent 1b3e234c
...@@ -413,7 +413,7 @@ static NSString *sdkVersion = @"110"; ...@@ -413,7 +413,7 @@ static NSString *sdkVersion = @"110";
NSArray *referrerLink = sharedClient.visibleController.referrerLink; NSArray *referrerLink = sharedClient.visibleController.referrerLink;
if (![eventId isEqualToString:@"page_view"]) { if (![eventId isEqualToString:@"page_view"]) {
NSMutableDictionary *attributesParams = [NSMutableDictionary dictionaryWithDictionary:attributes]; NSMutableDictionary *attributesParams = [NSMutableDictionary dictionaryWithDictionary:attributes];
[attributesParams setValue:referrerLink ? : @[] forKey:@"referrer_Link"]; [attributesParams setValue:referrerLink ? : @[] forKey:@"referrer_link"];
attributes = attributesParams; attributes = attributesParams;
} }
[self catchNullForEvent:eventId attributes:attributes]; [self catchNullForEvent:eventId attributes:attributes];
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
- (void)initReferer; - (void)initReferer;
/** /**
// 只适用于链路中页面浏览PVLink 添加 refererLink 参数 // // 适用于链路中页面浏览事件的统计 添加 refererLink 参数
*/ */
- (void)initRefererLink; - (void)initRefererLink;
......
...@@ -45,23 +45,27 @@ ...@@ -45,23 +45,27 @@
} }
} }
// 只适用于链路中页面浏览PVLink 添加 refererLink 参数 // 适用于链路中页面浏览事件的统计 添加 refererLink 参数
- (void)initRefererLink { - (void)initRefererLink {
if ([self isKindOfClass:[UIViewController class]]) { if ([self isKindOfClass:[UIViewController class]]) {
// 分present与navigation两种情况 // 分present与navigation两种情况
UIViewController *me = (UIViewController *)self; UIViewController *me = (UIViewController *)self;
if (me.isPush.intValue) { // 如果是推送进来的,结果页面的referrerLink 为空数组, 此处添加过滤。
objc_setAssociatedObject(self, @selector(referrerLink), @[], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
return;
}
if (me.presentingViewController != nil) { if (me.presentingViewController != nil) {
// app全局只有一个navigation,发现此时用navigation.topViewController presentViewController时,最终使用的是navigation弹出的 // app全局只有一个navigation,发现此时用navigation.topViewController presentViewController时,最终使用的是navigation弹出的
// 所以此处要判断,如果是navigation弹出,最后还是要定位到topViewController // 所以此处要判断,如果是navigation弹出,最后还是要定位到topViewController
if ([me.presentingViewController isKindOfClass:[UINavigationController class]]) { if ([me.presentingViewController isKindOfClass:[UINavigationController class]]) {
UIViewController *top = ((UINavigationController *)me.presentingViewController).topViewController; UIViewController *top = ((UINavigationController *)me.presentingViewController).topViewController;
NSMutableArray *tempReferrerLink = [NSMutableArray arrayWithArray:top.referrerLink]; NSMutableArray *tempLink = [NSMutableArray arrayWithArray:top.referrerLink];
[tempReferrerLink addObject:top.pageName]; [tempLink addObject:top.pageName];
objc_setAssociatedObject(self, @selector(referrerLink), tempReferrerLink, OBJC_ASSOCIATION_RETAIN_NONATOMIC); objc_setAssociatedObject(self, @selector(referrerLink), tempLink, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
} else { } else {
NSMutableArray *tempRefererLink = [NSMutableArray arrayWithArray:me.presentingViewController.referrerLink]; NSMutableArray *tempLink = [NSMutableArray arrayWithArray:me.presentingViewController.referrerLink];
[tempRefererLink addObject:me.presentingViewController.pageName]; [tempLink addObject:me.presentingViewController.pageName];
objc_setAssociatedObject(self, @selector(referrerLink), tempRefererLink, OBJC_ASSOCIATION_RETAIN_NONATOMIC); objc_setAssociatedObject(self, @selector(referrerLink), tempLink, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
} }
} else { } else {
NSArray *navigationPool = ((UIViewController *)self).navigationController.viewControllers; NSArray *navigationPool = ((UIViewController *)self).navigationController.viewControllers;
...@@ -70,9 +74,9 @@ ...@@ -70,9 +74,9 @@
return ; return ;
} }
UIViewController *controller = navigationPool[refererIndex]; UIViewController *controller = navigationPool[refererIndex];
NSMutableArray *tempReferrerLink = [NSMutableArray arrayWithArray:controller.referrerLink]; NSMutableArray *tempLink = [NSMutableArray arrayWithArray:controller.referrerLink];
[tempReferrerLink addObject:controller.pageName]; [tempLink addObject:controller.pageName];
objc_setAssociatedObject(self, @selector(referrerLink), tempReferrerLink, OBJC_ASSOCIATION_RETAIN_NONATOMIC); objc_setAssociatedObject(self, @selector(referrerLink), tempLink, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
} }
} }
} }
......
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