162 lines
8.1 KiB
Objective-C
162 lines
8.1 KiB
Objective-C
//
|
||
// XPEventHandle.m
|
||
// xplan-ios
|
||
//
|
||
// Created by duoban on 2022/12/5.
|
||
//
|
||
|
||
#import "XPEventHandle.h"
|
||
#import "XPFirebbaseEvent.h"
|
||
#import "XPEventHead.h"
|
||
static NSString *const isHaveWindow = @"0";
|
||
|
||
|
||
@implementation XPEventHandle
|
||
///埋点时必传参数
|
||
+(NSMutableDictionary *)getCommonAttributes{
|
||
NSString *timeSp = [NSString stringWithFormat:@"%ld", (long)[[NSDate date] timeIntervalSince1970] * 1000];
|
||
return [NSMutableDictionary dictionaryWithDictionary:@{
|
||
@"when":timeSp,
|
||
@"uid":[AccountInfoStorage instance].getUid ?: @"",
|
||
@"channel":[YYUtility appName],
|
||
@"appv":[YYUtility appVersion]
|
||
|
||
}];
|
||
}
|
||
|
||
#pragma mark - 埋点
|
||
///首页板块点击,1=搜索,2=创建房间,3=排行榜,4=分类导航;5=热门房间,6=banner轮播;7=扩列聊天-用户房间;8=扩列聊天-创建普通房;9=扩列聊天-创建游戏房;10=房间派对;11=菜单栏-首页;12=菜单栏-论坛;13=菜单栏-消息;14=菜单栏-我的
|
||
+(void)homeClickEventWithType:(NSString *)type{
|
||
NSMutableDictionary *attributes = [XPEventHandle getCommonAttributes];
|
||
[attributes setValue:kpikoHomepage forKey:kModule];
|
||
[attributes setValue:type forKey:kHomepageType];
|
||
[XPFirebbaseEvent event:kModuleHomepageClick attributes:attributes];
|
||
[XPEventHandle showWindowWtihText:[NSString stringWithFormat:@"埋点事件\n%@\n埋点参数\n%@",kModuleHomepageClick,[attributes mj_JSONString]]];
|
||
|
||
}
|
||
///导航栏tab板块点击,1=推荐,2=女神,3=男神,4=点唱;5=娱乐,6=开黑;7=交友;8=小游戏;
|
||
+(void)homeTabClickEventWithType:(NSString *)type{
|
||
NSMutableDictionary *attributes = [XPEventHandle getCommonAttributes];
|
||
[attributes setValue:kpikoHomepage forKey:kModule];
|
||
[attributes setValue:type forKey:kHomepageTab];
|
||
[XPFirebbaseEvent event:kTabHomepageClick attributes:attributes];
|
||
[XPEventHandle showWindowWtihText:[NSString stringWithFormat:@"埋点事件\n%@\n埋点参数\n%@",kTabHomepageClick,[attributes mj_JSONString]]];
|
||
|
||
}
|
||
///登录协议弹框展示
|
||
+(void)loginAgreementShowEvent{
|
||
NSMutableDictionary *attributes = [XPEventHandle getCommonAttributes];
|
||
[attributes setValue:kpikoLogin forKey:kModule];
|
||
[XPFirebbaseEvent event:kAgreementShow attributes:attributes];
|
||
[XPEventHandle showWindowWtihText:[NSString stringWithFormat:@"埋点事件\n%@\n埋点参数\n%@",kAgreementShow,[attributes mj_JSONString]]];
|
||
|
||
|
||
}
|
||
///登录协议点击,type,1=用户协议,2=隐私协议,3=同意, page,1=隐私协议与用户协议弹框,2=账号注册
|
||
+(void)loginAgreementClickEventWithWindowType:(NSString *)type{
|
||
NSMutableDictionary *attributes = [XPEventHandle getCommonAttributes];
|
||
[attributes setValue:kpikoLogin forKey:kModule];
|
||
[attributes setValue:type forKey:kClickType];
|
||
[attributes setValue:@"1" forKey:kPage];
|
||
[XPFirebbaseEvent event:KAgreementClick attributes:attributes];
|
||
[XPEventHandle showWindowWtihText:[NSString stringWithFormat:@"埋点事件\n%@\n埋点参数\n%@",KAgreementClick,[attributes mj_JSONString]]];
|
||
|
||
|
||
}
|
||
///登录协议点击,type,1=用户协议,2=隐私协议,3=同意, page,1=隐私协议与用户协议弹框,2=账号注册
|
||
+(void)loginAgreementClickEventWithType:(NSString *)type{
|
||
NSMutableDictionary *attributes = [XPEventHandle getCommonAttributes];
|
||
[attributes setValue:kpikoLogin forKey:kModule];
|
||
[attributes setValue:type forKey:kClickType];
|
||
[attributes setValue:@"2" forKey:kPage];
|
||
[XPFirebbaseEvent event:KAgreementClick attributes:attributes];
|
||
[XPEventHandle showWindowWtihText:[NSString stringWithFormat:@"埋点事件\n%@\n埋点参数\n%@",KAgreementClick,[attributes mj_JSONString]]];
|
||
|
||
|
||
}
|
||
///发起登录,1=Facebook登录,2=LINE登录,3=Google登录,4=手机号登录;5=ID登录(其他方式);
|
||
+(void)loginRequestEventWithType:(NSString *)type{
|
||
NSMutableDictionary *attributes = [XPEventHandle getCommonAttributes];
|
||
[attributes setValue:kpikoLogin forKey:kModule];
|
||
[attributes setValue:type forKey:kLoginType];
|
||
[XPFirebbaseEvent event:kLoginRequest attributes:attributes];
|
||
[XPEventHandle showWindowWtihText:[NSString stringWithFormat:@"埋点事件\n%@\n埋点参数\n%@",kLoginRequest,[attributes mj_JSONString]]];
|
||
|
||
|
||
}
|
||
///登录结果,type,1=Facebook登录,2=LINE登录,3=Google登录,4=手机号登录;5=ID登录(其他方式);result,0=失败,1=成功, failDetail,将具体失败原因上报
|
||
+(void)loginResultEventWithType:(NSString *)type result:(NSString *)result failDetail:(NSString * _Nullable)failDetail{
|
||
NSMutableDictionary *attributes = [XPEventHandle getCommonAttributes];
|
||
[attributes setValue:kpikoLogin forKey:kModule];
|
||
[attributes setValue:type forKey:kLoginType];
|
||
[attributes setValue:result forKey:kResult];
|
||
if(failDetail != nil){
|
||
[attributes setValue:failDetail forKey:kFailDetail];
|
||
}
|
||
[XPFirebbaseEvent event:kLoginResult attributes:attributes];
|
||
[XPEventHandle showWindowWtihText:[NSString stringWithFormat:@"埋点事件\n%@\n埋点参数\n%@",kLoginResult,[attributes mj_JSONString]]];
|
||
|
||
|
||
}
|
||
///首次启动
|
||
+(void)activateFirstEvent{
|
||
NSMutableDictionary *attributes = [XPEventHandle getCommonAttributes];
|
||
[attributes setValue:kpikoActivate forKey:kModule];
|
||
[XPFirebbaseEvent event:kFirstActivate attributes:attributes];
|
||
[XPEventHandle showWindowWtihText:[NSString stringWithFormat:@"埋点事件\n%@\n埋点参数\n%@",kFirstActivate,[attributes mj_JSONString]]];
|
||
|
||
|
||
}
|
||
///登录点击,1=Facebook登录,2=LINE登录,3=Google登录,4=手机号登录;5=ID登录(其他方式);
|
||
+(void)loginClickEventWithType:(NSString *)type{
|
||
NSMutableDictionary *attributes = [XPEventHandle getCommonAttributes];
|
||
[attributes setValue:kpikoLogin forKey:kModule];
|
||
[attributes setValue:type forKey:kClickType];
|
||
[XPFirebbaseEvent event:kLoginClick attributes:attributes];
|
||
[XPEventHandle showWindowWtihText:[NSString stringWithFormat:@"埋点事件\n%@\n埋点参数\n%@",kLoginClick,[attributes mj_JSONString]]];
|
||
|
||
|
||
}
|
||
///登录页面展示
|
||
+(void)loginShowEvent{
|
||
NSMutableDictionary *attributes = [XPEventHandle getCommonAttributes];
|
||
[attributes setValue:kpikoLogin forKey:kModule];
|
||
[XPFirebbaseEvent event:kLoginShow attributes:attributes];
|
||
[XPEventHandle showWindowWtihText:[NSString stringWithFormat:@"埋点事件\n%@\n埋点参数\n%@",kLoginShow,[attributes mj_JSONString]]];
|
||
|
||
|
||
}
|
||
///根据点击充值的入口上报,type,=房间内背包的充值入口,2=房间内赠送礼物时余额不足的充值入口,3=房间内贵族icon的充值入口;个人中心的充值入口,4=贵族中心的充值入口,5=星级厨房的充值入口;6=寻找小精灵的充值入口;7=寻爱之旅的充值入口;8=私聊送礼的充值入口,balance,返回用户具体余额
|
||
+(void)payPageShowEventWithType:(NSString *)type balance:(NSString *)balance{
|
||
NSMutableDictionary *attributes = [XPEventHandle getCommonAttributes];
|
||
[attributes setValue:kpikoPay forKey:kModule];
|
||
[attributes setValue:type forKey:kPaypageType];
|
||
[attributes setValue:balance forKey:kAccountBalance];
|
||
[XPFirebbaseEvent event:kPaypageShow attributes:attributes];
|
||
[XPEventHandle showWindowWtihText:[NSString stringWithFormat:@"埋点事件\n%@\n埋点参数\n%@",kPaypageShow,[attributes mj_JSONString]]];
|
||
|
||
}
|
||
///点击确认支付按钮,money,金额
|
||
+(void)payClickEventWithMoney:(NSString *)money{
|
||
NSMutableDictionary *attributes = [XPEventHandle getCommonAttributes];
|
||
[attributes setValue:kpikoPay forKey:kModule];
|
||
[attributes setValue:money forKey:kMoney];
|
||
[XPFirebbaseEvent event:kPayClick attributes:attributes];
|
||
[XPEventHandle showWindowWtihText:[NSString stringWithFormat:@"埋点事件\n%@\n埋点参数\n%@",kPayClick,[attributes mj_JSONString]]];
|
||
|
||
}
|
||
|
||
+(void)showWindowWtihText:(NSString *)text{
|
||
if([isHaveWindow isEqualToString:@"1"]){
|
||
TTAlertConfig *config = [[TTAlertConfig alloc]init];
|
||
config.message = text;
|
||
config.actionStyle = TTAlertActionConfirmStyle;
|
||
[TTPopup alertWithConfig:config showBorder:NO confirmHandler:^{
|
||
|
||
} cancelHandler:^{
|
||
|
||
}];
|
||
}
|
||
}
|
||
@end
|