|
@@ -21,11 +21,12 @@ export class SdkUtil {
|
|
|
|
|
|
public static videoAd:any =null;
|
|
|
public static isLookAd:boolean = false; //是否在看广告
|
|
|
+ public static gridGamePanel = null; //互推游戏组件
|
|
|
|
|
|
+ public static tt_systemInfo: any = null; //抖音_系统信息
|
|
|
public static wx_systemInfo:any = null; //微信_系统信息
|
|
|
public static ks_systemInfo:any = null; //ks_系统信息
|
|
|
|
|
|
- public static tt_systemInfo: any = null; //抖音_系统信息
|
|
|
private static tt_isSupportSidebar:boolean = false; //抖音_是否支持侧边栏
|
|
|
private static tt_isToEnterFromSidebar:boolean = false; //抖音_是否从侧边栏进入
|
|
|
|
|
@@ -56,6 +57,7 @@ export class SdkUtil {
|
|
|
|
|
|
this.getSystemInfo(()=> {
|
|
|
this.ttRegisterInfo()
|
|
|
+ this.registerGridGamePanel()
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -96,6 +98,20 @@ export class SdkUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 是否平台开发工具
|
|
|
+ public static is_devtools_platform():boolean {
|
|
|
+ if(SdkUtil.tt_systemInfo&&SdkUtil.tt_systemInfo.platform=='devtools') {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ if(SdkUtil.wx_systemInfo&&SdkUtil.wx_systemInfo.platform=='devtools') {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ if(SdkUtil.ks_systemInfo&&SdkUtil.ks_systemInfo.platform=='devtools') {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
// 自定义事件统计
|
|
|
public static customEventStatistics(eventType: string, objParams?: any) {
|
|
|
eventType = eventType.toString();
|
|
@@ -629,6 +645,82 @@ export class SdkUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 注册游戏互推组件
|
|
|
+ public static registerGridGamePanel() {
|
|
|
+ if(SdkUtil.is_devtools_platform()==true) { return }
|
|
|
+
|
|
|
+ switch (tools.platform) {
|
|
|
+ case config.Platform.TT:
|
|
|
+ try{
|
|
|
+ let height = SdkUtil.tt_systemInfo.safeArea.bottom
|
|
|
+ let gridGamePanel_top = 575
|
|
|
+ if(height) { gridGamePanel_top = height - 230 }
|
|
|
+ // console.log('gridGamePanel_top=',gridGamePanel_top)
|
|
|
+ // 单宫格gridCount: "one",可设置大小和位置 size:"large",position:{top:700,left:20},
|
|
|
+ // 四宫格gridCount: "four",可设置大小,设置位置无实际作用 size:"large"
|
|
|
+ // 九宫格gridCount: "nine",设置大小和位置无实际作用
|
|
|
+ const gridGamePanel = tt.createGridGamePanel({
|
|
|
+ gridCount: "one",
|
|
|
+ size:"large",
|
|
|
+ position:{top:gridGamePanel_top,left:10},
|
|
|
+ query: {
|
|
|
+ 'tte54693fb7a75fa0f02': "", //神秘的笔记
|
|
|
+ },
|
|
|
+ });
|
|
|
+ SdkUtil.gridGamePanel = gridGamePanel
|
|
|
+ } catch(error) {
|
|
|
+ console.log('error=',error)
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ case config.Platform.WX:
|
|
|
+ break;
|
|
|
+ case config.Platform.KS:
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 显示游戏互推组件
|
|
|
+ public static showGridGamePanel() {
|
|
|
+ if(SdkUtil.is_devtools_platform()==true) { return }
|
|
|
+ if(!SdkUtil.gridGamePanel) {return}
|
|
|
+
|
|
|
+ switch (tools.platform) {
|
|
|
+ case config.Platform.TT:
|
|
|
+ SdkUtil.gridGamePanel.show().then(() => {
|
|
|
+ console.log("tt 展示游戏推荐组件成功");
|
|
|
+ }).catch((err) => {
|
|
|
+ console.error("展示游戏推荐组件失败", err);
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case config.Platform.WX:
|
|
|
+ break;
|
|
|
+ case config.Platform.KS:
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 隐藏互推游戏组件
|
|
|
+ public static hideGridGamePanel() {
|
|
|
+ if(SdkUtil.is_devtools_platform()==true) { return }
|
|
|
+ if(!SdkUtil.gridGamePanel) {return}
|
|
|
+ switch (tools.platform) {
|
|
|
+ case config.Platform.TT:
|
|
|
+ SdkUtil.gridGamePanel.hide()
|
|
|
+ break;
|
|
|
+ case config.Platform.WX:
|
|
|
+ break;
|
|
|
+ case config.Platform.KS:
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//------------------------------ 微信相关 ------------------------------//
|
|
|
|
|
|
// 微信检查授权用户信息
|