├── .babelrc ├── .eslintrc.json ├── .gitignore ├── .jsbeautifyrc ├── CHANGELOG.md ├── LICENSE ├── README.md ├── assets ├── README.CC.md ├── README.EGRET.md ├── README.LAYA.md ├── README.MG.md ├── README.MP.md ├── README.UNI.md ├── ThinkingAnalyticsSDK.d.ts ├── tdanalytics.cc.d.ts ├── tdanalytics.d.ts ├── tdanalytics.egret.d.ts ├── tdanalytics.laya.d.ts └── tdanalytics.uniapp.d.ts ├── build.sh ├── package-lock.json ├── package.json ├── rollup.config.js └── src ├── Config.js ├── PlatformAPI.js ├── PropertyChecker.js ├── SenderQueue.js ├── TDAnalytics.cc.js ├── TDAnalytics.egret.js ├── TDAnalytics.js ├── TDAnalytics.laya.js ├── ThinkingDataAPI.cc.js ├── ThinkingDataAPI.egret.js ├── ThinkingDataAPI.js ├── ThinkingDataAPI.laya.js ├── ThinkingDataAPI.uniapp.js ├── loader-global.js ├── native ├── cc │ ├── android │ │ ├── CocosCreatorProxyApi.java │ │ ├── TDAnalytics.aar │ │ └── TDCore.aar │ ├── ios │ │ ├── CocosCreatorProxyApi.h │ │ ├── CocosCreatorProxyApi.mm │ │ ├── ThinkingDataCore.framework │ │ │ ├── .gitkeep │ │ │ ├── Headers │ │ │ │ ├── NSData+TDGzip.h │ │ │ │ ├── NSObject+TDSwizzle.h │ │ │ │ ├── TAAnnotation.h │ │ │ │ ├── TAContext.h │ │ │ │ ├── TAModuleManager.h │ │ │ │ ├── TAModuleProtocol.h │ │ │ │ ├── TARouter.h │ │ │ │ ├── TAServiceManager.h │ │ │ │ ├── TAServiceProtocol.h │ │ │ │ ├── TDClassHelper.h │ │ │ │ ├── TDJSONUtil.h │ │ │ │ ├── TDMethodHelper.h │ │ │ │ ├── TDNewSwizzle.h │ │ │ │ ├── TDSwizzler.h │ │ │ │ └── ThinkingDataCore.h │ │ │ ├── Info.plist │ │ │ ├── Modules │ │ │ │ └── module.modulemap │ │ │ └── ThinkingDataCore │ │ └── ThinkingSDK.framework │ │ │ ├── Headers │ │ │ ├── TDAnalytics+Multiple.h │ │ │ ├── TDAnalytics+Public.h │ │ │ ├── TDAnalytics+ThirdParty.h │ │ │ ├── TDAnalytics+WebView.h │ │ │ ├── TDAnalytics.h │ │ │ ├── TDAutoTrackConst.h │ │ │ ├── TDAutoTrackProtocol.h │ │ │ ├── TDAutoTrackPublicHeader.h │ │ │ ├── TDConfig.h │ │ │ ├── TDConstant.h │ │ │ ├── TDDeviceInfo.h │ │ │ ├── TDEditableEventModel.h │ │ │ ├── TDEventModel.h │ │ │ ├── TDFirstEventModel.h │ │ │ ├── TDOverwriteEventModel.h │ │ │ ├── TDPresetProperties.h │ │ │ ├── TDSecretKey.h │ │ │ ├── TDSecurityPolicy.h │ │ │ ├── TDUpdateEventModel.h │ │ │ ├── ThinkingAnalyticsSDK+OldPublic.h │ │ │ ├── ThinkingAnalyticsSDK.h │ │ │ ├── ThinkingSDK.h │ │ │ └── UIView+ThinkingAnalytics.h │ │ │ ├── Info.plist │ │ │ ├── Modules │ │ │ └── module.modulemap │ │ │ └── ThinkingSDK │ └── openharmony │ │ ├── CocosCreatorProxyApi.ts │ │ └── TDAnalytics.har ├── egret │ ├── android │ │ ├── EgretProxyApi.java │ │ └── ThinkingSDK.aar │ └── ios │ │ ├── EgretProxyApi.h │ │ ├── EgretProxyApi.mm │ │ └── ThinkingSDK.framework │ │ ├── Headers │ │ ├── TDConfig.h │ │ ├── TDConstant.h │ │ ├── TDDeviceInfo.h │ │ ├── TDEditableEventModel.h │ │ ├── TDEventModel.h │ │ ├── TDFirstEventModel.h │ │ ├── TDPresetProperties.h │ │ ├── TDSecretKey.h │ │ ├── TDSecurityPolicy.h │ │ ├── ThinkingAnalyticsSDK.h │ │ └── ThinkingSDK.h │ │ ├── Info.plist │ │ ├── Modules │ │ └── module.modulemap │ │ └── ThinkingSDK └── laya │ ├── android │ ├── LayaProxyApi.java │ ├── TDAnalytics.aar │ └── TDCore.aar │ └── ios │ ├── LayaProxyApi.h │ ├── LayaProxyApi.mm │ ├── ThinkingDataCore.framework │ ├── .gitkeep │ ├── Headers │ │ ├── NSData+TDGzip.h │ │ ├── NSObject+TDSwizzle.h │ │ ├── TAAnnotation.h │ │ ├── TAContext.h │ │ ├── TAModuleManager.h │ │ ├── TAModuleProtocol.h │ │ ├── TARouter.h │ │ ├── TAServiceManager.h │ │ ├── TAServiceProtocol.h │ │ ├── TDClassHelper.h │ │ ├── TDJSONUtil.h │ │ ├── TDMethodHelper.h │ │ ├── TDNewSwizzle.h │ │ ├── TDSwizzler.h │ │ └── ThinkingDataCore.h │ ├── Info.plist │ ├── Modules │ │ └── module.modulemap │ └── ThinkingDataCore │ └── ThinkingSDK.framework │ ├── Headers │ ├── TDAnalytics+Multiple.h │ ├── TDAnalytics+Public.h │ ├── TDAnalytics+ThirdParty.h │ ├── TDAnalytics+WebView.h │ ├── TDAnalytics.h │ ├── TDAutoTrackConst.h │ ├── TDAutoTrackProtocol.h │ ├── TDAutoTrackPublicHeader.h │ ├── TDConfig.h │ ├── TDConstant.h │ ├── TDDeviceInfo.h │ ├── TDEditableEventModel.h │ ├── TDEventModel.h │ ├── TDFirstEventModel.h │ ├── TDOverwriteEventModel.h │ ├── TDPresetProperties.h │ ├── TDSecretKey.h │ ├── TDSecurityPolicy.h │ ├── TDUpdateEventModel.h │ ├── ThinkingAnalyticsSDK+OldPublic.h │ ├── ThinkingAnalyticsSDK.h │ ├── ThinkingSDK.h │ └── UIView+ThinkingAnalytics.h │ ├── Info.plist │ ├── Modules │ └── module.modulemap │ └── ThinkingSDK ├── platform ├── AutoTrack.mg.js ├── AutoTrack.mp.js ├── PlatformProxy.cocoscreator.js ├── PlatformProxy.egret.js ├── PlatformProxy.js ├── PlatformProxy.laya.js ├── PlatformProxy.qg.js ├── PlatformProxy.quick.js ├── PlatformProxy.tb.mg.js ├── PlatformProxy.uniapp.js ├── PlatformProxy.vivo.qg.js └── PlatformProxy.web.js ├── regenerator-runtime ├── LICENSE ├── README.md ├── package.json ├── path.js └── runtime.js └── utils.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["@babel/env", {"modules": false}] 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es6": true 5 | }, 6 | "extends": "eslint:recommended", 7 | "parserOptions": { 8 | "sourceType": "module" 9 | }, 10 | "rules": { 11 | "camelcase": "error", 12 | "eol-last": "error", 13 | "eqeqeq": "error", 14 | "indent": 15 | [2, 4, {"SwitchCase": 1}], 16 | "linebreak-style": [ 17 | "error", 18 | "unix" 19 | ], 20 | "no-console": "off", 21 | "no-trailing-spaces": "error", 22 | "quotes": [ 23 | "error", 24 | "single" 25 | ], 26 | "semi": [ 27 | "error", 28 | "always" 29 | ] 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | thinkingdata*.min.js 3 | /*.min.js 4 | .vscode/ 5 | node_modules 6 | /build 7 | /release 8 | thinkingdata.*.js 9 | .tea 10 | *.meta -------------------------------------------------------------------------------- /.jsbeautifyrc: -------------------------------------------------------------------------------- 1 | { 2 | "brace_style": "collapse", 3 | 4 | "break_chained_methods": true, 5 | 6 | "end_with_newline": true, 7 | 8 | "eval_code": false, 9 | 10 | "indent_char": " ", 11 | 12 | "indent_level": 0, 13 | 14 | "indent_size": 4, 15 | 16 | "indent_with_tabs": false, 17 | 18 | "jslint_happy": false, 19 | 20 | "keep_array_indentation": false, 21 | 22 | "keep_function_indentation": false, 23 | 24 | "max_preserve_newlines": 10, 25 | 26 | "preserve_newlines": true, 27 | 28 | "space_after_anon_function": true, 29 | 30 | "space_before_conditional": true, 31 | 32 | "space_in_empty_paren": false, 33 | 34 | "space_in_paren": false, 35 | 36 | "unescape_strings": false, 37 | 38 | "wrap_line_length": 0 39 | } 40 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | **v3.0.0** (2023-08-28) 2 | - 代码优化 3 | 4 | **v2.2.4** (2023-07-28) 5 | - 代码优化 6 | 7 | **v2.2.1** (2023-04-21) 8 | - 代码优化 9 | 10 | **v2.2.0** (2022-08-15) 11 | - 新增支持 npm 接入 12 | - 新增支持事件缓存 13 | - 代码优化 14 | 15 | **v2.1.0** (2022-06-28) 16 | - 新增支持去重追加用户属性 17 | - Web平台支持ta_page_show/ta_page_hide事件 18 | - 新增支持数据加密上报 19 | - 代码优化 20 | 21 | **v2.0.3** (2022-02-15) 22 | - 自动采集事件支持自定义属性 23 | - 代码优化 24 | 25 | **v2.0.2** (2021-12-31) 26 | - 代码优化 27 | 28 | **v2.0.1** (2021-11-15) 29 | - 代码优化 30 | 31 | **v2.0.0** (2021-09-15) 32 | - 支持暂停/开始、停止/恢复数据上报 33 | - 支持事件黑名单 34 | - 代码优化 35 | 36 | **v1.8.2** (2021-06-24) 37 | - 支持预制属性获取 38 | - fix bug:原生/web平台运行时,断网重连导致的数据发送失败问题 39 | 40 | **v1.8.1** (2021-03-08) 41 | - 新增快手小程序的支持 42 | 43 | **v1.8.0** (2020-11-20) 44 | - 新增哔哩哔哩小游戏支持 45 | - 完善游戏引擎支持:支持 ts 项目接入 46 | - 完善游戏引擎支持:支持常见小游戏、快游戏平台(华为、小米、OPPO、VIVO)、H5 游戏 47 | - 项目结构调整,简化平台配置和打包脚本 48 | - 其他代码细节层面的优化 49 | 50 | **v1.7.1** (2020-08-27) 51 | - 支持魅族平台 52 | 53 | **v1.7.0** (2020-08-24) 54 | - 支持首次事件,可更新事件,可重写事件 55 | 56 | **v1.6.2** (2020-07-23) 57 | - 支持钉钉小程序 58 | - 修复华为快游戏上报异常问题 59 | 60 | **v1.6.1** (2020-07-10) 61 | - 支持华为快游戏 62 | 63 | **v1.6.0** (2020-06-10) 64 | - 支持 debug 模式 65 | 66 | **v1.5.1** (2020-03-21) 67 | - 支持白鹭引擎小游戏平台:微信小游戏、百度小游戏、QQ小游戏、VIVO小游戏、OPPO小游戏 68 | - 支持 LAYABOX 引擎小游戏平台:微信小游戏、百度小游戏、QQ小游戏、VIVO小游戏、OPPO小游戏 69 | - 支持 CocosCreator 引擎小游戏平台:微信小游戏、百度小游戏、VIVO小游戏、OPPO小游戏 70 | 71 | **v1.5.0** (2020-02-10) 72 | - 属性值支持 Array 类型 73 | - 新增 userAppend 接口 74 | - 去除本地属性值检查 75 | 76 | **v1.4.4** (2019-12-24) 77 | - 修复 VIVO 和 OPPO 平台首次 appHide 没有计时 78 | 79 | **v1.4.3** (2019-12-20) 80 | - 优化OPPO快游戏网络请求 81 | 82 | **v1.4.2** (2019-11-19) 83 | - 新增支持平台:VIVO快游戏 84 | 85 | **v1.4.1** (2019-11-13) 86 | - 新增支持平台:OPPO快游戏 87 | 88 | **v1.4.0** (2019-10-18) 89 | - 支持重置用户属性 90 | - 事件预置属性新增时间偏移,适配多时区需求 91 | 92 | **v1.3.2** (2019-09-29) 93 | - 修复 v1.3.1 引入的部分平台的兼容性问题 94 | 95 | **v1.3.1** (2019-09-27) 96 | - 支持数据上报的回调函数 onComplete 97 | 98 | **v1.3.0** (2019-08-13) 99 | - 集成方式有重大更新,请参考使用手册 100 | - 代码优化 101 | - #network_type 属性根据网络状态更新 102 | - 数据发送内容:用户属性数据不传送预制属性,简化发送内容 103 | - 优化日志打印 104 | - 新增接口 105 | - getAccountId() 106 | - getDistinctId() 107 | - timeEvent() 108 | - initInstance() 109 | - identify() 同 authorizeOpenID() 110 | - getDeviceId() 111 | - getSuperProperties() 112 | - unsetSuperProperty() 113 | - setDynamicSuperProperties() 114 | - 多实例 115 | - 通过调用 initInstance(name, config) 可以创建新的实例. 116 | - 子实例默认使用父实例的配置,默认情况下不启用本地缓存 117 | - 配置信息 118 | - enablePersistence 父实例默认为true,子实例默认为false 119 | - asyncPersistence 异步读取缓存 120 | - maxRetries 当请求失败或超时时的重试次数, 默认为3次 121 | - sendTimeout 超时时间,单位为毫秒 122 | - enableLog: true, // 是否打开日志打印 123 | - 跨平台 124 | = 支持主流小程序小游戏平台:微信、百度、支付宝、字节跳动、快应用 125 | - 增加预置属性 #mp_platform,标识应用所在的平台 126 | - #lib 为 MP/MG,分别代表小程序和小游戏 127 | 128 | **v1.2.2** (2019-05-13) 129 | - 修复了极端情况下,访客ID可能为空的问题 130 | 131 | **v1.2.1** (2019-04-22) 132 | - 增加了公共事件属性的接口: 133 | - setSuperProperties 134 | - clearSuperProperties 135 | 136 | **v1.2.0** (2019-04-18) 137 | - 初始化方式改动: 增加了初始化接口init,在init调用前触发的事件,将会被缓存于消息队列,init调用时,会将 #account_id 与 #distinct_id 同步到消息队列的数据中,并发送这些数据. 138 | - 增加自动采集功能 139 | - track接口添加了设置事件触发时间的重载 140 | - 添加了对包含插件的小程序的支持 141 | 142 | **v1.1.1** (2019-01-08) 143 | - 修复了PageView误报的问题 144 | 145 | **v1.1.0** (2018-07-06) 146 | - 微信小程序SDK上线,提供接口:track、authorizeOpenID、login、logout、userSet、userSetOnce、userAdd、userDel 147 | 148 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ThinkingData SDK for Mini-Program and Mini-Game 2 | ![output](https://user-images.githubusercontent.com/53337625/205621683-ed9b97ef-6a52-4903-a2c0-a955dddebb7d.png) 3 | 4 | This is the [ThinkingData](https://www.thinkingdata.cn)™ SDK for Mini-Program and Mini-Game. Documentation is available on our help center in the following languages: 5 | 6 | - [中文](https://docs.thinkingdata.cn/ta-manual/latest/installation/installation_menu/client_sdk/game_engine_sdk_installation/unity_sdk_installation/unity_sdk_installation.html) 7 | --- 8 | -------------------------------------------------------------------------------- /assets/README.CC.md: -------------------------------------------------------------------------------- 1 | ## ThinkingAnalytics SDK 接入指南 - CocosCreator 2 | 3 | ThinkingAnalytics SDK 实现了对 CocosCreator 引擎开发的小游戏的埋点接口。您可以通过集成 ThinkingAnalytics SDK 向 TA (ThinkingAnalytics) 集群上报数据。 4 | 5 | 如果您需要详细的使用说明,请参考我们的[官方使用手册](https://docs.thinkingdata.cn/ta-manual/latest/installation/installation_menu/client_sdk/mp_sdk_installation/cocoscreator_sdk_installation.html)。 6 | 7 | ### 一、在您的项目中集成 TA SDK 8 | 如果您的项目是 TypeScript 工程,接入步骤如下: 9 | 1. 将声明文件 ThinkingAnalyticsSDK.d.ts 放入项目根目录下 assets 同级的 libs 目录,如果 libs 不存在,新建 libs 目录 10 | 2. 将 SDK 文件 (thinkingdata.mg.cocoscreator.min.js) 放入 assets/Script 目录中 11 | 12 | 如果您的项目是 JavaScript 工程,您可以直接将 SDK 文件 (thinkingdata.mg.cocoscreator.min.js) 放入 assets/Script 目录中 13 | 14 | ### 二、初始化 SDK 15 | 集成 TA SDK 后,您可以在代码中直接使用 ThinkingAnalyticsAPI: 16 | 17 | ```js 18 | // TA SDK 配置对象 19 | var config = { 20 | appId: 'YOUR_APPID', // 项目 APP ID 21 | serverUrl: 'YOUR_SERVER_URL', // 上报地址 22 | autoTrack: { 23 | appShow: true, // 自动采集 ta_mg_show 24 | appHide: true, // 自动采集 ta_mg_hide 25 | } 26 | }; 27 | 28 | // 创建 TA 实例 29 | var ta = new ThinkingAnalyticsAPI(config); 30 | 31 | // 初始化 32 | ta.init(); 33 | 34 | // 上报一个简单事件, 事件名为 test_event 35 | ta.track('test_event'); 36 | ``` 37 | -------------------------------------------------------------------------------- /assets/README.EGRET.md: -------------------------------------------------------------------------------- 1 | ## ThinkingAnalytics SDK 接入指南 - Egret 2 | 3 | ThinkingAnalytics SDK 实现了对 Egret 白鹭引擎开发的小游戏的埋点接口。您可以通过集成 ThinkingAnalytics SDK 向 TA (ThinkingAnalytics) 集群上报数据。 4 | 5 | 如果您需要详细的使用说明,请参考我们的[官方使用手册](https://docs.thinkingdata.cn/ta-manual/latest/installation/installation_menu/client_sdk/mp_sdk_installation/egret_sdk_installation.html)。 6 | 7 | ### 一、在您的项目中集成 TA SDK 8 | 9 | ThinkingAnalyticsSDK 目录放入您项目的 libs 目录下。然后在您项目的配置文件 egretProperties.json 中引入 TA SDK: 10 | ```json 11 | { 12 | "name": "ThinkingAnalyticsSDK", 13 | "path": "./libs/ThinkingAnalyticsSDK" 14 | } 15 | ``` 16 | 17 | ### 二、初始化 SDK 18 | 19 | 集成 TA SDK 后,您可以在代码中直接使用 ThinkingAnalyticsAPI: 20 | 21 | ```ts 22 | // TA SDK 配置对象 23 | var config = { 24 | appId: 'YOUR_APPID', // 项目 APP ID 25 | serverUrl: 'YOUR_SERVER_URL', // 上报地址 26 | autoTrack: { 27 | appShow: true, // 自动采集 ta_mg_show 28 | appHide: true, // 自动采集 ta_mg_hide 29 | } 30 | }; 31 | 32 | // 创建 TA 实例 33 | var ta = new ThinkingAnalyticsAPI(config); 34 | 35 | // 初始化 36 | ta.init(); 37 | 38 | // 上报一个简单事件, 事件名为 test_event 39 | ta.track('test_event'); 40 | ``` 41 | -------------------------------------------------------------------------------- /assets/README.LAYA.md: -------------------------------------------------------------------------------- 1 | ## ThinkingAnalytics SDK 接入指南 - LAYA 引擎 2 | 3 | ThinkingAnalytics SDK 实现了对 LAYA 引擎开发的小游戏的埋点接口。您可以通过集成 ThinkingAnalytics SDK 向 TA (ThinkingAnalytics) 集群上报数据。 4 | 5 | 如果您需要详细的使用说明,请参考我们的[官方使用手册](https://docs.thinkingdata.cn/ta-manual/latest/installation/installation_menu/client_sdk/mp_sdk_installation/laya_sdk_installation.html)。 6 | 7 | ### 一、概述 8 | 9 | ThinkingAnalytics SDK 包含三个文件,您可以根据您的项目类型,选择对应的文件来集成。 10 | 11 | 如果您的项目是 TypeScript 工程,您需要用到: 12 | * ThinkingAnalyticsSDK.d.ts 13 | * thinkingdata.mg.layats.min.js 14 | 15 | 如果您的项目是 JavaScript 工程,您需要用到: 16 | * thinkingdata.mg.laya.min.js 17 | 18 | ### 二、TypeScript 工程集成方法 19 | 20 | 如果您的项目是 TypeScript 工程,接入步骤如下: 21 | 1. 将声明文件 ThinkingAnalyticsSDK.d.ts 放入 libs 目录 22 | 2. 将 SDK 文件(thinkingdata.mg.layats.min.js)放入 bin/js 目录中 23 | 3. 修改 bin/index.js 文件,加载 TA SDK: 24 | ```js 25 | // 在加载 bundle.js 之前加载 TA SDK 26 | loadLib("js/thinkingdata.mg.layats.min.js"); 27 | loadLib("js/bundle.js"); 28 | ``` 29 | 30 | ### 三、JavaScript 工程集成方法 31 | 32 | 如果您的项目是 JavaScript 工程,您可以直接将 `thinkingdata.mg.laya.min.js` 放入您的工程中,在源码中引用: 33 | ```js 34 | import ThinkingAnalyticsAPI from "./thinkingdata.mg.laya.min"; 35 | ``` 36 | 37 | ### 四、初始化 SDK 38 | 39 | ```js 40 | // TA SDK 配置对象 41 | var config = { 42 | appId: 'YOUR_APPID', // 项目 APP ID 43 | serverUrl: 'YOUR_SERVER_URL', // 上报地址 44 | autoTrack: { 45 | appShow: true, // 自动采集 ta_mg_show 46 | appHide: true, // 自动采集 ta_mg_hide 47 | } 48 | }; 49 | 50 | // 创建 TA 实例 51 | var ta = new ThinkingAnalyticsAPI(config); 52 | 53 | // 初始化 54 | ta.init(); 55 | 56 | // 上报一个简单事件, 事件名为 test_event 57 | ta.track('test_event'); 58 | ``` 59 | -------------------------------------------------------------------------------- /assets/README.MG.md: -------------------------------------------------------------------------------- 1 | ## ThinkingAnalytics SDK 接入指南 - 小游戏 2 | 3 | ThinkingAnalytics SDK 实现了针对常见小游戏、快游戏平台的埋点接口。您可以通过集成 ThinkingAnalytics SDK 向 TA (ThinkingAnalytics) 集群上报数据。 4 | 5 | 对于小游戏开发,我们提供了白鹭引擎、Laya、CocosCreator 等常见游戏引擎的接入方案。如果您需要对应引擎的解决方案,请参考我们的[官方使用手册](https://docs.thinkingdata.cn/ta-manual/latest/installation/installation_menu/client_sdk/mp_sdk_installation/mp_sdk_installation.html)。 6 | 7 | 如果您只需要在指定平台接入小游戏 SDK,向 TA 上报数据,请继续阅读本文。 8 | 9 | ### 一、引入 TA SDK 10 | 11 | 平台和 SDK 文件对应关系: 12 | * 微信小游戏: thinkingdata.mg.wx.min.js 13 | * QQ 小游戏: thinkingdata.mg.qq.min.js 14 | * 字节跳动小游戏: thinkingdata.mg.tt.min.js 15 | * 百度小游戏: thinkingdata.mg.swan.min.js 16 | * 哔哩哔哩小游戏: thinkingdata.mg.bl.min.js 17 | * 华为快游戏: thinkingdata.mg.huawei.min.js 18 | * OPPO 快游戏: thinkingdata.mg.oppo.min.js 19 | * VIVO 快游戏: thinkingdata.mg.vivo.min.js 20 | * 魅族快游戏: thinkingdata.mg.mz.min.js 21 | 22 | 以微信小游戏为例,在 game.js 中添加以下代码以引入 TA SDK 23 | 24 | ```js 25 | var ThinkingAnalyticsAPI = require("./thinkingdata.mg.wx.min.js"); 26 | ``` 27 | 28 | ### 二、初始化 SDK 29 | 30 | ```js 31 | // TA SDK 配置对象 32 | var config = { 33 | appId: 'YOUR_APPID', // 项目 APP ID 34 | serverUrl: 'YOUR_SERVER_URL', // 上报地址 35 | autoTrack: { 36 | appShow: true, // 自动采集 ta_mg_show 37 | appHide: true, // 自动采集 ta_mg_hide 38 | } 39 | }; 40 | 41 | // 创建 TA 实例 42 | var ta = new ThinkingAnalyticsAPI(config); 43 | 44 | // 初始化 45 | ta.init(); 46 | 47 | // 上报一个简单事件, 事件名为 test_event 48 | ta.track('test_event'); 49 | ``` 50 | -------------------------------------------------------------------------------- /assets/README.MP.md: -------------------------------------------------------------------------------- 1 | ## ThinkingAnalytics SDK 接入指南 - 小程序 2 | 3 | ThinkingAnalytics SDK 实现了针对常见小程序平台和快应用的埋点接口。您可以通过集成 ThinkingAnalytics SDK 向 TA (ThinkingAnalytics) 集群上报数据。 4 | 5 | 详细的使用说明,请参考我们的[官方使用手册](https://docs.thinkingdata.cn/ta-manual/latest/installation/installation_menu/client_sdk/mp_sdk_installation/mp_sdk_installation.html)。 6 | 7 | 8 | ### 一、引入 TA SDK 9 | 10 | 平台和 SDK 文件对应关系: 11 | * 微信小程序: thinkingdata.wx.min.js 12 | * 百度小程序: thinkingdata.swan.min.js 13 | * 字节跳动小程序: thinkingdata.tt.min.js 14 | * 支付宝小程序: thinkingdata.my.min.js 15 | * 钉钉小程序: thinkingdata.dd.min.js 16 | * 快应用: thinkingdata.quick.min.js 17 | 18 | 以微信小程序为例,在 app.js 中添加以下代码以引入 TA SDK 19 | 20 | ```js 21 | var ThinkingAnalyticsAPI = require("./thinkingdata.wx.min.js"); 22 | ``` 23 | 24 | ### 二、初始化 SDK 25 | 26 | ```js 27 | // TA SDK 配置对象 28 | var config = { 29 | appId: 'YOUR_APPID', // 项目 APP ID 30 | serverUrl: 'YOUR_SERVER_URL', // 上报地址 31 | autoTrack: { 32 | appLaunch: true, // 自动采集 ta_mp_launch 33 | appShow: true, // 自动采集 ta_mp_show 34 | appHide: true, // 自动采集 ta_mp_hide 35 | } 36 | }; 37 | 38 | // 创建 TA 实例 39 | var ta = new ThinkingAnalyticsAPI(config); 40 | 41 | // 初始化 42 | ta.init(); 43 | 44 | // 上报一条数据 45 | ta.track('test_event'); 46 | ``` 47 | 48 | > 注意: 快应用暂不支持自动采集 49 | -------------------------------------------------------------------------------- /assets/README.UNI.md: -------------------------------------------------------------------------------- 1 | # ThinkingData SDK for uni-app 2 | ![output](https://user-images.githubusercontent.com/53337625/205621683-ed9b97ef-6a52-4903-a2c0-a955dddebb7d.png) 3 | 4 | This is the [ThinkingData](https://www.thinkingdata.cn)™ SDK for Erlang. Documentation is available on our help center in the following languages: 5 | 6 | - [English](https://docs.thinkingdata.cn/ta-manual/latest/en/installation/installation_menu/server_sdk/uniapp_sdk_installation/uniapp_sdk_installation.html) 7 | - [中文](https://docs.thinkingdata.cn/ta-manual/latest/installation/installation_menu/server_sdk/uniapp_sdk_installation/uniapp_sdk_installation.html) 8 | 9 | --- 10 | 11 | -------------------------------------------------------------------------------- /assets/ThinkingAnalyticsSDK.d.ts: -------------------------------------------------------------------------------- 1 | 2 | declare class ThinkingAnalyticsAPI { 3 | constructor(config:any); 4 | init(): void; 5 | track(eventName:string): void; 6 | track(eventName:string, properties:any): void; 7 | track(eventName:string, properties:any, time:any): void; 8 | track(eventName:string, properties:any, time:any, onComplete:any): void; 9 | track(taEvent:any): void; 10 | trackUpdate(taEvent:any): void; 11 | trackFirstEvent(taEvent:any): void; 12 | trackOverwrite(taEvent:any): void; 13 | timeEvent(eventName:string): void; 14 | login(accoundId:string): void; 15 | logout(): void; 16 | setSuperProperties(properties:any): void; 17 | unsetSuperProperty(properties:any): void; 18 | clearSuperProperties(): void; 19 | userSet(properties:any): void; 20 | userSetOnce(properties:any): void; 21 | userAppend(properties:any): void; 22 | userUniqAppend(properties:any): void; 23 | userAdd(properties:any): void; 24 | userUnset(property:string): void; 25 | userDel(): void; 26 | flush(): void; 27 | authorizeOpenID(distinctId:string): void; 28 | identify(distinctId:string): void; 29 | initInstance(name:string): ThinkingAnalyticsAPI; 30 | initInstance(name:string, config:any): ThinkingAnalyticsAPI; 31 | lightInstance(name:string): any; 32 | setDynamicSuperProperties(properties: any): void; 33 | getDeviceId(callback?: any): string; 34 | getDistinctId(callback?: any): string; 35 | getAccountId(callback?: any): string; 36 | getPresetProperties(callback?: any): any; 37 | getSuperProperties(callback?: any): any; 38 | /** 39 | * Pause/Resume reporting event data 40 | * @param {bool} enabled:true is Resume, false is Pause 41 | * @deprecated This method is deprecated, use setTrackStatus() instand. 42 | */ 43 | enableTracking(enabled:boolean): void; 44 | /** 45 | * Stop reporting event data, and cache data will be cleared 46 | * @deprecated This method is deprecated, use setTrackStatus() instand. 47 | */ 48 | optOutTracking(): void; 49 | /** 50 | * Stop reporting event data, and cache data will be cleared, and flush a user_del 51 | * @deprecated This method is deprecated, use setTrackStatus() instand. 52 | */ 53 | optOutTrackingAndDeleteUser(): void; 54 | /** 55 | * Allow reporting event data 56 | * @deprecated This method is deprecated, use setTrackStatus() instand. 57 | */ 58 | optInTracking(): void; 59 | /** 60 | * Set status for events reporting 61 | * PAUSE, pause events reporting 62 | * STOP, stop events reporting, and cache data will be cleared 63 | * SAVE_ONLY, event data stores in the cache, but not be reported (native support, js equal to NORMAL) 64 | * NORMAL, resume event reporting 65 | * @param {string} status, events reporting status 66 | */ 67 | setTrackStatus(status: string): void; 68 | } 69 | -------------------------------------------------------------------------------- /assets/tdanalytics.cc.d.ts: -------------------------------------------------------------------------------- 1 | declare class TDAnalytics { 2 | static init(config:any): void; 3 | 4 | static track(options:any, appId?:string): void; 5 | static trackFirst(options:any, appId?:string): void; 6 | static trackUpdate(options:any, appId?:string): void; 7 | static trackOverwrite(options:any, appId?:string): void; 8 | static timeEvent(options:any, appId?:string): void; 9 | 10 | static userSet(options:any, appId?:string): void; 11 | static userSetOnce(options:any, appId?:string): void; 12 | static userUnset(options:any, appId?:string): void; 13 | static userAdd(options:any, appId?:string): void; 14 | static userAppend(options:any, appId?:string): void; 15 | static userUniqAppend(options:any, appId?:string): void; 16 | static userDelete(options?:any, appId?:string): void; 17 | 18 | static setSuperProperties(properties:any, appId?:string): void; 19 | static unsetSuperProperty(property:string, appId?:string): void; 20 | static clearSuperProperties(appId?:string): void; 21 | static getSuperProperties(appId?:string): any; 22 | 23 | static setDynamicSuperProperties(dynamicProperties: any, appId?: string): void; 24 | static getPresetProperties(appId?: string): any; 25 | 26 | static login(accoundId:string, appId?: string): void; 27 | static logout(appId?: string): void; 28 | static getAccountId(appId?: string): string; 29 | 30 | static setDistinctId(distinctId:string, appId?: string): void; 31 | static getDistinctId(appId?: string): string; 32 | 33 | static lightInstance(appId?: string): any; 34 | 35 | static getDeviceId(appId?: string): string; 36 | 37 | static flush(appId?: string): void; 38 | static setTrackStatus(status: string): void; 39 | 40 | static getSDKVersion(): string; 41 | 42 | static ThinkingDataAPI(): any; 43 | } 44 | -------------------------------------------------------------------------------- /assets/tdanalytics.d.ts: -------------------------------------------------------------------------------- 1 | declare class TDAnalytics { 2 | static init(config:any): void; 3 | 4 | static track(options:any, appId?:string): void; 5 | static trackFirst(options:any, appId?:string): void; 6 | static trackUpdate(options:any, appId?:string): void; 7 | static trackOverwrite(options:any, appId?:string): void; 8 | static timeEvent(options:any, appId?:string): void; 9 | 10 | static userSet(options:any, appId?:string): void; 11 | static userSetOnce(options:any, appId?:string): void; 12 | static userUnset(options:any, appId?:string): void; 13 | static userAdd(options:any, appId?:string): void; 14 | static userAppend(options:any, appId?:string): void; 15 | static userUniqAppend(options:any, appId?:string): void; 16 | static userDelete(options?:any, appId?:string): void; 17 | 18 | static setSuperProperties(properties:any, appId?:string): void; 19 | static unsetSuperProperty(property:string, appId?:string): void; 20 | static clearSuperProperties(appId?:string): void; 21 | static getSuperProperties(appId?:string): any; 22 | 23 | static setDynamicSuperProperties(dynamicProperties: any, appId?: string): void; 24 | static getPresetProperties(appId?: string): any; 25 | 26 | static login(accoundId:string, appId?: string): void; 27 | static logout(appId?: string): void; 28 | static getAccountId(appId?: string): string; 29 | 30 | static setDistinctId(distinctId:string, appId?: string): void; 31 | static getDistinctId(appId?: string): string; 32 | 33 | static lightInstance(appId?: string): any; 34 | 35 | static getDeviceId(appId?: string): string; 36 | 37 | static flush(appId?: string): void; 38 | static setTrackStatus(status: string, appId?: string): void; 39 | 40 | static getSDKVersion(): string; 41 | 42 | static ThinkingDataAPI(): any; 43 | } 44 | -------------------------------------------------------------------------------- /assets/tdanalytics.egret.d.ts: -------------------------------------------------------------------------------- 1 | declare class TDAnalytics { 2 | static init(config:any): void; 3 | 4 | static track(options:any, appId?:string): void; 5 | static trackFirst(options:any, appId?:string): void; 6 | static trackUpdate(options:any, appId?:string): void; 7 | static trackOverwrite(options:any, appId?:string): void; 8 | static timeEvent(options:any, appId?:string): void; 9 | 10 | static userSet(options:any, appId?:string): void; 11 | static userSetOnce(options:any, appId?:string): void; 12 | static userUnset(options:any, appId?:string): void; 13 | static userAdd(options:any, appId?:string): void; 14 | static userAppend(options:any, appId?:string): void; 15 | static userUniqAppend(options:any, appId?:string): void; 16 | static userDelete(options?:any, appId?:string): void; 17 | 18 | static setSuperProperties(properties:any, appId?:string): void; 19 | static unsetSuperProperty(property:string, appId?:string): void; 20 | static clearSuperProperties(appId?:string): void; 21 | static getSuperProperties(appId?:string): any; 22 | static getSuperPropertiesAsync(callback: any, appId?:string): void; 23 | 24 | static setDynamicSuperProperties(dynamicProperties: any, appId?: string): void; 25 | static getPresetProperties(appId?: string): any; 26 | static getPresetPropertiesAsync(callback: any, appId?: string): void; 27 | 28 | static login(accoundId:string, appId?: string): void; 29 | static logout(appId?: string): void; 30 | static getAccountId(appId?: string): string; 31 | static getAccountIdAsync(callback: any, appId?: string): void; 32 | 33 | static setDistinctId(distinctId:string, appId?: string): void; 34 | static getDistinctId(appId?: string): string; 35 | static getDistinctIdAsync(callback: any, appId?: string): void; 36 | 37 | static lightInstance(appId?: string): any; 38 | 39 | static getDeviceId(appId?: string): string; 40 | static getDeviceIdAsync(callback: any, appId?: string): void; 41 | 42 | static flush(appId?: string): void; 43 | static setTrackStatus(status: string, appId?: string): void; 44 | 45 | static getSDKVersion(): string; 46 | 47 | static ThinkingDataAPI(): any; 48 | } 49 | -------------------------------------------------------------------------------- /assets/tdanalytics.laya.d.ts: -------------------------------------------------------------------------------- 1 | declare class TDAnalytics { 2 | static init(config:any): void; 3 | 4 | static track(options:any, appId?:string): void; 5 | static trackFirst(options:any, appId?:string): void; 6 | static trackUpdate(options:any, appId?:string): void; 7 | static trackOverwrite(options:any, appId?:string): void; 8 | static timeEvent(options:any, appId?:string): void; 9 | 10 | static userSet(options:any, appId?:string): void; 11 | static userSetOnce(options:any, appId?:string): void; 12 | static userUnset(options:any, appId?:string): void; 13 | static userAdd(options:any, appId?:string): void; 14 | static userAppend(options:any, appId?:string): void; 15 | static userUniqAppend(options:any, appId?:string): void; 16 | static userDelete(options?:any, appId?:string): void; 17 | 18 | static setSuperProperties(properties:any, appId?:string): void; 19 | static unsetSuperProperty(property:string, appId?:string): void; 20 | static clearSuperProperties(appId?:string): void; 21 | static getSuperProperties(appId?:string): any; 22 | static getSuperPropertiesAsync(callback: any, appId?:string): void; 23 | 24 | static setDynamicSuperProperties(dynamicProperties: any, appId?: string): void; 25 | static getPresetProperties(appId?: string): any; 26 | static getPresetPropertiesAsync(callback: any, appId?: string): void; 27 | 28 | static login(accoundId:string, appId?: string): void; 29 | static logout(appId?: string): void; 30 | static getAccountId(appId?: string): string; 31 | static getAccountIdAsync(callback: any, appId?: string): void; 32 | 33 | static setDistinctId(distinctId:string, appId?: string): void; 34 | static getDistinctId(appId?: string): string; 35 | static getDistinctIdAsync(callback: any, appId?: string): void; 36 | 37 | static lightInstance(appId?: string): any; 38 | 39 | static getDeviceId(appId?: string): string; 40 | static getDeviceIdAsync(callback: any, appId?: string): void; 41 | 42 | static flush(appId?: string): void; 43 | static setTrackStatus(status: string, appId?: string): void; 44 | 45 | static getSDKVersion(): string; 46 | 47 | static ThinkingDataAPI(): any; 48 | } 49 | -------------------------------------------------------------------------------- /assets/tdanalytics.uniapp.d.ts: -------------------------------------------------------------------------------- 1 | declare class TDAnalytics { 2 | static init(config:any): void; 3 | 4 | static track(options:any, appId?:string): void; 5 | static trackFirst(options:any, appId?:string): void; 6 | static trackUpdate(options:any, appId?:string): void; 7 | static trackOverwrite(options:any, appId?:string): void; 8 | static timeEvent(options:any, appId?:string): void; 9 | 10 | static userSet(options:any, appId?:string): void; 11 | static userSetOnce(options:any, appId?:string): void; 12 | static userUnset(options:any, appId?:string): void; 13 | static userAdd(options:any, appId?:string): void; 14 | static userAppend(options:any, appId?:string): void; 15 | static userUniqAppend(options:any, appId?:string): void; 16 | static userDelete(options?:any, appId?:string): void; 17 | 18 | static setSuperProperties(properties:any, appId?:string): void; 19 | static unsetSuperProperty(property:string, appId?:string): void; 20 | static clearSuperProperties(appId?:string): void; 21 | static getSuperProperties(appId?:string): any; 22 | 23 | static setDynamicSuperProperties(dynamicProperties: any, appId?: string): void; 24 | static getPresetProperties(appId?: string): any; 25 | 26 | static login(accoundId:string, appId?: string): void; 27 | static logout(appId?: string): void; 28 | static getAccountId(appId?: string): string; 29 | 30 | static setDistinctId(distinctId:string, appId?: string): void; 31 | static getDistinctId(appId?: string): string; 32 | 33 | static lightInstance(appId?: string): any; 34 | 35 | static getDeviceId(appId?: string): string; 36 | 37 | static flush(appId?: string): void; 38 | static setTrackStatus(status: string, appId?: string): void; 39 | 40 | static getSDKVersion(): string; 41 | 42 | static ThinkingDataAPI(): any; 43 | } 44 | export default TDAnalytics -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "The official ThinkingData MiniProgram library", 3 | "devDependencies": { 4 | "@babel/core": "^7.9.0", 5 | "@babel/preset-env": "^7.9.0", 6 | "eslint": "^6.8.0", 7 | "rollup": "^1.32.1", 8 | "rollup-plugin-babel": "^4.4.0", 9 | "rollup-plugin-replace": "^2.2.0", 10 | "rollup-plugin-terser": "^5.3.0", 11 | "uglify-js": "^3.10.1" 12 | }, 13 | "license": "Apache-2.0", 14 | "name": "thinkingdata-mini-program", 15 | "scripts": { 16 | "build": "./build.sh build", 17 | "build-all": "./build.sh", 18 | "lint": "eslint ./src", 19 | "release": "./build.sh release", 20 | "release-uniapp":"./build.sh release-uniapp" 21 | }, 22 | "version": "3.3.0", 23 | "creator": { 24 | "version": "3.2.0" 25 | }, 26 | "uuid": "963a9855-dc93-4a0a-8e49-a65f4d0bc0f8" 27 | } 28 | -------------------------------------------------------------------------------- /src/Config.js: -------------------------------------------------------------------------------- 1 | export var Config = { 2 | LIB_VERSION: 'R_VERSION', 3 | LIB_NAME: 'R_LIB_NAME', 4 | }; 5 | -------------------------------------------------------------------------------- /src/PlatformAPI.js: -------------------------------------------------------------------------------- 1 | import PlatformProxy from 'R_PLATFORM_PROXY'; 2 | 3 | export default class PlatformAPI { 4 | static _getCurrentPlatform() { 5 | return this.currentPlatform || (this.currentPlatform = PlatformProxy.createInstance()); 6 | } 7 | 8 | /** 9 | * Get platform specific configuration: persistenceName required 10 | */ 11 | static getConfig() { 12 | return this._getCurrentPlatform().getConfig(); 13 | } 14 | 15 | static initConfig(config) { 16 | this._getCurrentPlatform().initSdkConfig(config); 17 | } 18 | 19 | static isWxPlat() { 20 | return this.getConfig().plat === 'wx'; 21 | } 22 | 23 | /** 24 | * Get local cache data 25 | * @param {string} name: cache key 26 | * @param {boolean} async: enable asynchronous getting cached 27 | * @param {function} callback: callback when getting data asynchronously, the parameter is an object 28 | * @return return cached data, it is an object 29 | */ 30 | static getStorage(name, async, callback) { 31 | return this._getCurrentPlatform().getStorage(name, async, callback); 32 | } 33 | 34 | /** 35 | * Set local cache data 36 | * @param {string} name: cache key 37 | * @param {string} value: JSON string value 38 | */ 39 | static setStorage(name, value) { 40 | return this._getCurrentPlatform().setStorage(name, value); 41 | } 42 | 43 | /** 44 | * Delete data in local cache with key 45 | * @param {*} name: cache key 46 | */ 47 | static removeStorage(name) { 48 | return this._getCurrentPlatform().removeStorage(name); 49 | } 50 | 51 | /** 52 | * Get system information asynchronously 53 | * @param {object} options: callback when getting completion 54 | * callback parameter: 55 | * brand: string, device brand 56 | * model: string, device model 57 | * screenWidth: number, screen width, unit px 58 | * screenHeight: number, screen height, unit px 59 | * system: string, operating system and version 60 | * platform: string, client platform 61 | */ 62 | static getSystemInfo(options) { 63 | return this._getCurrentPlatform().getSystemInfo(options); 64 | } 65 | 66 | /** 67 | * Get network type asynchronously 68 | * @param {object} options: callback when getting completion 69 | * res.networkType string: network type 70 | */ 71 | static getNetworkType(options) { 72 | return this._getCurrentPlatform().getNetworkType(options); 73 | } 74 | 75 | /** 76 | * Listen for network state change 77 | * @param {function} callback: callback when network state changing 78 | */ 79 | static onNetworkStatusChange(callback) { 80 | this._getCurrentPlatform().onNetworkStatusChange(callback); 81 | } 82 | 83 | /** 84 | * Make a network request 85 | * @param {object} options: parameters, including: 86 | * url string server url 87 | * data string/object request parameters 88 | * method string HTTP method 89 | * success function success callback 90 | * fail function fail callback 91 | * complete function complete callback 92 | */ 93 | static request(options) { 94 | return this._getCurrentPlatform().request(options); 95 | } 96 | 97 | /** 98 | * Initialize the lifecycle monitoring instance 99 | * @param {ThinkingDataAPI} instance: SDK instance, listen lifecycle of application 100 | * @param {object} config: auto-tracking events config 101 | */ 102 | static initAutoTrackInstance(instance, config) { 103 | return this._getCurrentPlatform().initAutoTrackInstance(instance, config); 104 | } 105 | 106 | /** 107 | * Set instance to global 108 | * @param {object} instance 109 | * @param {string} name 110 | */ 111 | static setGlobal(instance, name) { 112 | if (instance && name) { 113 | this._getCurrentPlatform().setGlobal(instance, name); 114 | } 115 | } 116 | 117 | /** 118 | * Get system startup information, and register APP cut-off foreground callback 119 | * @param {function} callback 120 | */ 121 | static getAppOptions(callback) { 122 | return this._getCurrentPlatform().getAppOptions(callback); 123 | } 124 | 125 | /** 126 | * Toast Debug information 127 | * @param {string} msg: information to display 128 | */ 129 | static showDebugToast(msg) { 130 | this._getCurrentPlatform().showToast(msg); 131 | } 132 | 133 | static setGlobalData(data) { 134 | this._getCurrentPlatform().setGlobalData(data); 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /src/PropertyChecker.js: -------------------------------------------------------------------------------- 1 | import { 2 | _, 3 | logger, 4 | } from './utils'; 5 | 6 | /** @const */ 7 | var KEY_NAME_MATCH_REGEX = /^[a-zA-Z][a-zA-Z0-9_]{0,49}$/; 8 | 9 | export class PropertyChecker { 10 | static stripProperties(prop) { 11 | if (!_.isObject(prop)) { 12 | return prop; 13 | } 14 | _.each(prop, function (v, k) { 15 | if (!(_.isString(v) || _.isNumber(v) || _.isDate(v) || _.isBoolean(v) || _.isArray(v) || _.isObject(v))) { 16 | logger.warn('Your data -', k, v, '- format does not meet requirements and may not be stored correctly. Attribute values only support String, Number, Date, Boolean, Array, Object'); 17 | } 18 | }); 19 | return prop; 20 | } 21 | 22 | static _checkPropertiesKey(obj) { 23 | var flag = true; 24 | _.each(obj, (content, key) => { 25 | if (!KEY_NAME_MATCH_REGEX.test(key)) { 26 | logger.warn('Invalid KEY: ' + key); 27 | flag = false; 28 | } 29 | }); 30 | return flag; 31 | } 32 | static event(s) { 33 | if (!_.isString(s) || !KEY_NAME_MATCH_REGEX.test(s)) { 34 | logger.warn('Check the parameter format. The eventName must start with an English letter and contain no more than 50 characters including letters, digits, and underscores: ' + s); 35 | return false; 36 | } else { 37 | return true; 38 | } 39 | } 40 | 41 | static propertyName(s) { 42 | if (!_.isString(s) || !KEY_NAME_MATCH_REGEX.test(s)) { 43 | logger.warn('Check the parameter format. PropertyName must start with a letter and contain letters, digits, and underscores (_). The value is a string of no more than 50 characters: ' + s); 44 | return false; 45 | } else { 46 | return true; 47 | } 48 | } 49 | static properties(p) { 50 | this.stripProperties(p); 51 | if (p) { 52 | if (_.isObject(p)) { 53 | if (this._checkPropertiesKey(p)) { 54 | return true; 55 | } else { 56 | logger.warn('Check the parameter format. The properties key must start with a letter, contain digits, letters, and underscores (_), and contain a maximum of 50 characters'); 57 | return false; 58 | } 59 | } else { 60 | logger.warn('properties can be none, but it must be an object'); 61 | return false; 62 | } 63 | } else { 64 | return true; 65 | } 66 | } 67 | static propertiesMust(p) { 68 | this.stripProperties(p); 69 | if (p === undefined || !_.isObject(p) || _.isEmptyObject(p)) { 70 | logger.warn('properties must be an object with a value'); 71 | return false; 72 | } else { 73 | if (this._checkPropertiesKey(p)) { 74 | return true; 75 | } else { 76 | logger.warn('Check the parameter format. The properties key must start with a letter, contain digits, letters, and underscores (_), and contain a maximum of 50 characters'); 77 | return false; 78 | } 79 | } 80 | } 81 | static userId(id) { 82 | if (_.isString(id) && /^.{1,64}$/.test(id)) { 83 | return true; 84 | } else { 85 | logger.warn('The user ID must be a string of less than 64 characters and cannot be null'); 86 | return false; 87 | } 88 | } 89 | 90 | static userAddProperties(p) { 91 | if (!this.propertiesMust(p)) return false; 92 | for (var i in p) { 93 | if (!_.isNumber(p[i])) { 94 | logger.warn('The attributes of userAdd need to be Number'); 95 | return false; 96 | } 97 | } 98 | return true; 99 | } 100 | 101 | static userAppendProperties(p) { 102 | if (!this.propertiesMust(p)) return false; 103 | for (var i in p) { 104 | if (!_.isArray(p[i])) { 105 | logger.warn('The attribute of userAppend must be Array'); 106 | return false; 107 | } 108 | } 109 | return true; 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/loader-global.js: -------------------------------------------------------------------------------- 1 | import TA from './ThinkingDataAPI'; 2 | 3 | window['ThinkingAnalyticsAPI'] = TA; 4 | -------------------------------------------------------------------------------- /src/native/cc/android/TDAnalytics.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThinkingDataAnalytics/mp-sdk/1f4d7dd3123496718d129acc9c38177db914a1b4/src/native/cc/android/TDAnalytics.aar -------------------------------------------------------------------------------- /src/native/cc/android/TDCore.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThinkingDataAnalytics/mp-sdk/1f4d7dd3123496718d129acc9c38177db914a1b4/src/native/cc/android/TDCore.aar -------------------------------------------------------------------------------- /src/native/cc/ios/CocosCreatorProxyApi.h: -------------------------------------------------------------------------------- 1 | // 2 | // CocosCreatorProxyApi.h 3 | // NewProject-mobile 4 | // 5 | // Created by huangdiao on 2021/7/20. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface CocosCreatorProxyApi : NSObject 13 | 14 | @end 15 | 16 | NS_ASSUME_NONNULL_END 17 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingDataCore.framework/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThinkingDataAnalytics/mp-sdk/1f4d7dd3123496718d129acc9c38177db914a1b4/src/native/cc/ios/ThinkingDataCore.framework/.gitkeep -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingDataCore.framework/Headers/NSData+TDGzip.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface NSData (TDGzip) 4 | 5 | + (NSData *)td_gzipData:(NSData *)dataa; 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingDataCore.framework/Headers/NSObject+TDSwizzle.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | @interface NSObject (TDSwizzle) 5 | 6 | + (BOOL)td_swizzleMethod:(SEL)origSel withMethod:(SEL)altSel error:(NSError **)error; 7 | + (BOOL)td_swizzleClassMethod:(SEL)origSel withClassMethod:(SEL)altSel error:(NSError **)error; 8 | 9 | @end 10 | NS_ASSUME_NONNULL_END 11 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingDataCore.framework/Headers/TAAnnotation.h: -------------------------------------------------------------------------------- 1 | // 2 | // TAAnnotation.h 3 | // Pods 4 | // 5 | // Created by wwango on 2022/10/8. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | #ifndef ThinkingModSectName 13 | 14 | #define ThinkingModSectName "ThinkingMods" 15 | 16 | #endif 17 | 18 | #ifndef ThinkingServiceSectName 19 | 20 | #define ThinkingServiceSectName "ThinkingServices" 21 | 22 | #endif 23 | 24 | 25 | #define ThinkingDATA(sectname) __attribute((used, section("__DATA,"#sectname" "))) 26 | 27 | 28 | #define ThinkingMod(name) \ 29 | char * k##name##_mod ThinkingDATA(ThinkingMods) = ""#name""; 30 | 31 | #define ThinkingService(servicename,impl) \ 32 | char * k##servicename##_service ThinkingDATA(ThinkingServices) = "{ \""#servicename"\" : \""#impl"\"}"; 33 | 34 | @interface TAAnnotation : NSObject 35 | 36 | @end 37 | 38 | NS_ASSUME_NONNULL_END 39 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingDataCore.framework/Headers/TAContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // TAContext.h 3 | // ThinkingSDK.default-Base-Core-Extension-Router-Util-iOS 4 | // 5 | // Created by wwango on 2022/10/7. 6 | // 7 | 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface TAContext : NSObject 14 | 15 | @property(nonatomic, strong) id application; 16 | 17 | @property(nonatomic, strong) NSDictionary *launchOptions; 18 | 19 | @property(atomic, strong) NSDictionary *customParam; 20 | 21 | + (instancetype)shareInstance; 22 | 23 | - (void)addServiceWithImplInstance:(id)implInstance serviceName:(NSString *)serviceName; 24 | 25 | - (void)removeServiceWithServiceName:(NSString *)serviceName; 26 | 27 | - (id)getServiceInstanceFromServiceName:(NSString *)serviceName; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingDataCore.framework/Headers/TAModuleManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // TAModuleManager.h 3 | // Pods 4 | // 5 | // Created by wwango on 2022/10/8. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | typedef NS_ENUM(NSUInteger, TAModuleLevel) 13 | { 14 | TAModuleBasic = 0, 15 | TAModuleNormal = 1 16 | }; 17 | 18 | typedef NS_ENUM(NSInteger, TAModuleEventType) 19 | { 20 | TAMSetupEvent = 0, 21 | TAMInitEvent, 22 | TAMTearDownEvent, 23 | TAMSplashEvent, 24 | TAMQuickActionEvent, 25 | TAMWillResignActiveEvent, 26 | TAMDidEnterBackgroundEvent, 27 | TAMWillEnterForegroundEvent, 28 | TAMDidBecomeActiveEvent, 29 | TAMWillTerminateEvent, 30 | TAMUnmountEvent, 31 | TAMOpenURLEvent, 32 | TAMDidReceiveMemoryWarningEvent, 33 | TAMDidFailToRegisterForRemoteNotificationsEvent, 34 | TAMDidRegisterForRemoteNotificationsEvent, 35 | TAMDidReceiveRemoteNotificationEvent, 36 | TAMDidReceiveLocalNotificationEvent, 37 | TAMWillPresentNotificationEvent, 38 | TAMDidReceiveNotificationResponseEvent, 39 | TAMWillContinueUserActivityEvent, 40 | TAMContinueUserActivityEvent, 41 | TAMDidFailToContinueUserActivityEvent, 42 | TAMDidUpdateUserActivityEvent, 43 | TAMDidCustomEvent = 1000 44 | 45 | }; 46 | 47 | @interface TAModuleManager : NSObject 48 | 49 | + (instancetype)sharedManager; 50 | 51 | // If you do not comply with set Level protocol, the default Normal 52 | - (void)registerDynamicModule:(Class)moduleClass; 53 | 54 | - (void)unRegisterDynamicModule:(Class)moduleClass; 55 | 56 | - (void)loadLocalModules; 57 | 58 | - (void)registedAllModules; 59 | 60 | - (void)registerCustomEvent:(NSInteger)eventType 61 | withModuleInstance:(id)moduleInstance 62 | andSelectorStr:(NSString *)selectorStr; 63 | 64 | - (void)triggerEvent:(NSInteger)eventType; 65 | 66 | - (void)triggerEvent:(NSInteger)eventType withCustomParam:(NSDictionary * _Nullable)customParam; 67 | 68 | 69 | @end 70 | 71 | NS_ASSUME_NONNULL_END 72 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingDataCore.framework/Headers/TAModuleProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // TAModuleProtocol.h 3 | // ThinkingSDK.default-Base-Core-Extension-Router-Util-iOS 4 | // 5 | // Created by wwango on 2022/10/7. 6 | // 7 | 8 | #import 9 | 10 | #define TA_EXPORT_MODULE(isAsync) \ 11 | + (void)load { [[TAModuleManager sharedManager] registerDynamicModule:[self class]]; } \ 12 | -(BOOL)async { return [[NSString stringWithUTF8String:#isAsync] boolValue];} 13 | 14 | @class TAContext; 15 | 16 | 17 | NS_ASSUME_NONNULL_BEGIN 18 | 19 | @protocol TAModuleProtocol 20 | 21 | @optional 22 | 23 | - (void)basicModuleLevel; 24 | 25 | - (NSInteger)modulePriority; 26 | 27 | - (BOOL)async; 28 | 29 | - (void)modSetUp:(TAContext *)context; 30 | 31 | - (void)modInit:(TAContext *)context; 32 | 33 | - (void)modSplash:(TAContext *)context; 34 | 35 | - (void)modQuickAction:(TAContext *)context; 36 | 37 | - (void)modTearDown:(TAContext *)context; 38 | 39 | - (void)modWillResignActive:(TAContext *)context; 40 | 41 | - (void)modDidEnterBackground:(TAContext *)context; 42 | 43 | - (void)modWillEnterForeground:(TAContext *)context; 44 | 45 | - (void)modDidBecomeActive:(TAContext *)context; 46 | 47 | - (void)modWillTerminate:(TAContext *)context; 48 | 49 | - (void)modUnmount:(TAContext *)context; 50 | 51 | - (void)modOpenURL:(TAContext *)context; 52 | 53 | - (void)modDidReceiveMemoryWaring:(TAContext *)context; 54 | 55 | - (void)modDidFailToRegisterForRemoteNotifications:(TAContext *)context; 56 | 57 | - (void)modDidRegisterForRemoteNotifications:(TAContext *)context; 58 | 59 | - (void)modDidReceiveRemoteNotification:(TAContext *)context; 60 | 61 | - (void)modDidReceiveLocalNotification:(TAContext *)context; 62 | 63 | - (void)modWillPresentNotification:(TAContext *)context; 64 | 65 | - (void)modDidReceiveNotificationResponse:(TAContext *)context; 66 | 67 | - (void)modWillContinueUserActivity:(TAContext *)context; 68 | 69 | - (void)modContinueUserActivity:(TAContext *)context; 70 | 71 | - (void)modDidFailToContinueUserActivity:(TAContext *)context; 72 | 73 | - (void)modDidUpdateContinueUserActivity:(TAContext *)context; 74 | 75 | - (void)modHandleWatchKitExtensionRequest:(TAContext *)context; 76 | 77 | - (void)modDidCustomEvent:(TAContext *)context; 78 | 79 | @end 80 | 81 | NS_ASSUME_NONNULL_END 82 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingDataCore.framework/Headers/TARouter.h: -------------------------------------------------------------------------------- 1 | // 2 | // TARouter.h 3 | // Pods 4 | // 5 | // Created by wwango on 2022/10/8. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | static NSString *const TARURLSchemeGlobalKey = @"URLGlobalScheme"; 13 | static NSString *const TARURLHostCallService = @"call.service.thinkingdata"; 14 | static NSString *const TARURLHostRegister = @"register.thinking"; 15 | static NSString *const TARURLSubPathSplitPattern = @"."; 16 | static NSString *const TARURLQueryParamsKey = @"params"; 17 | 18 | typedef void(^TARPathComponentCustomHandler)(NSDictionary *params); 19 | 20 | @interface TARouter : NSObject 21 | 22 | - (instancetype)init NS_UNAVAILABLE; 23 | + (instancetype)new NS_UNAVAILABLE; 24 | 25 | + (instancetype)globalRouter; 26 | + (instancetype)routerForScheme:(NSString *)scheme; 27 | 28 | //url - > com.thinkingdata://call.service/pathComponentKey.protocolName.selector/...?params={}(value url encode) 29 | + (BOOL)canOpenURL:(NSURL *)URL; 30 | + (BOOL)openURL:(NSURL *)URL; 31 | + (BOOL)openURL:(NSURL *)URL 32 | withParams:(NSDictionary *> *)params; 33 | + (BOOL)openURL:(NSURL *)URL 34 | withParams:(NSDictionary *> *)params 35 | andThen:(void(^)(NSString *pathComponentKey, id obj, id returnValue))then; 36 | @end 37 | 38 | NS_ASSUME_NONNULL_END 39 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingDataCore.framework/Headers/TAServiceManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // TAServiceManager.h 3 | // ThinkingSDK.default-Base-Core-Extension-Router-Util-iOS 4 | // 5 | // Created by wwango on 2022/10/7. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface TAServiceManager : NSObject 13 | 14 | @property (nonatomic, assign) BOOL enableException; 15 | 16 | + (instancetype)sharedManager; 17 | 18 | - (void)registerLocalServices; 19 | 20 | - (void)registerService:(Protocol *)service implClass:(Class)implClass; 21 | 22 | - (id)createService:(Protocol *)service; 23 | - (id)createService:(Protocol *)service withServiceName:(NSString *)serviceName; 24 | - (id)createService:(Protocol *)service withServiceName:(NSString *)serviceName shouldCache:(BOOL)shouldCache; 25 | 26 | @end 27 | 28 | NS_ASSUME_NONNULL_END 29 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingDataCore.framework/Headers/TAServiceProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // TAServiceProtocol.h 3 | // ThinkingSDK.default-Base-Core-Extension-Router-Util-iOS 4 | // 5 | // Created by wwango on 2022/10/7. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @protocol TAServiceProtocol 13 | 14 | @optional 15 | 16 | + (BOOL)singleton; 17 | 18 | + (id)shareInstance; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingDataCore.framework/Headers/TDClassHelper.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | NS_ASSUME_NONNULL_BEGIN 5 | 6 | @interface TDClassHelper : NSObject 7 | 8 | + (Class _Nullable)allocateClassWithObject:(id)object className:(NSString *)className; 9 | 10 | + (void)registerClass:(Class)cla; 11 | 12 | + (BOOL)setObject:(id)object toClass:(Class)cla; 13 | 14 | @end 15 | 16 | NS_ASSUME_NONNULL_END 17 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingDataCore.framework/Headers/TDJSONUtil.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | @interface TDJSONUtil : NSObject 6 | 7 | + (NSString *)JSONStringForObject:(id)object; 8 | 9 | + (NSData *)JSONSerializeForObject:(id)object; 10 | 11 | @end 12 | 13 | NS_ASSUME_NONNULL_END 14 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingDataCore.framework/Headers/TDMethodHelper.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | NS_ASSUME_NONNULL_BEGIN 5 | 6 | @interface TDMethodHelper : NSObject 7 | 8 | + (IMP)implementationOfMethodSelector:(SEL)selector fromClass:(Class)aClass; 9 | 10 | + (void)addInstanceMethodWithSelector:(SEL)methodSelector fromClass:(Class)fromClass toClass:(Class)toClass; 11 | 12 | + (void)addInstanceMethodWithDestinationSelector:(SEL)destinationSelector sourceSelector:(SEL)sourceSelector fromClass:(Class)fromClass toClass:(Class)toClass; 13 | 14 | + (void)addClassMethodWithDestinationSelector:(SEL)destinationSelector sourceSelector:(SEL)sourceSelector fromClass:(Class)fromClass toClass:(Class)toClass; 15 | 16 | + (IMP _Nullable)replaceInstanceMethodWithDestinationSelector:(SEL)destinationSelector sourceSelector:(SEL)sourceSelector fromClass:(Class)fromClass toClass:(Class)toClass; 17 | 18 | /// swizzle respondsToSelector 方法 19 | /// 用于处理未实现代理方法也能采集事件的逻辑 20 | + (void)swizzleRespondsToSelector; 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingDataCore.framework/Headers/TDNewSwizzle.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | NS_ASSUME_NONNULL_BEGIN 5 | 6 | @interface NSObject (TDNewSwizzle) 7 | 8 | + (BOOL)td_new_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError **)error_; 9 | + (BOOL)td_new_swizzleClassMethod:(SEL)origSel_ withClassMethod:(SEL)altSel_ error:(NSError **)error_; 10 | + (BOOL)td_new_swizzleMethod:(SEL)origSel_ withClass:(Class)altCla_ withMethod:(SEL)altSel_ error:(NSError **)error_; 11 | 12 | @end 13 | 14 | NS_ASSUME_NONNULL_END 15 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingDataCore.framework/Headers/TDSwizzler.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #pragma clang diagnostic push 4 | #pragma clang diagnostic ignored "-Wstrict-prototypes" 5 | typedef void (^swizzleBlock)(); 6 | #pragma clang diagnostic pop 7 | 8 | @interface TDSwizzler : NSObject 9 | 10 | + (void)swizzleSelector:(SEL)aSelector onClass:(Class)aClass withBlock:(swizzleBlock)block named:(NSString *)aName; 11 | + (void)unswizzleSelector:(SEL)aSelector onClass:(Class)aClass named:(NSString *)aName; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingDataCore.framework/Headers/ThinkingDataCore.h: -------------------------------------------------------------------------------- 1 | // 2 | // ThinkingDataCore.h 3 | // ThinkingDataCore 4 | // 5 | // Created by Hale on 2023/7/24. 6 | // 7 | 8 | #import 9 | 10 | //! Project version number for ThinkingDataCore. 11 | FOUNDATION_EXPORT double ThinkingDataCoreVersionNumber; 12 | 13 | //! Project version string for ThinkingDataCore. 14 | FOUNDATION_EXPORT const unsigned char ThinkingDataCoreVersionString[]; 15 | 16 | // In this header, you should import all the public headers of your framework using statements like #import 17 | 18 | #import 19 | #import 20 | #import 21 | #import 22 | #import 23 | #import 24 | #import 25 | #import 26 | #import 27 | #import 28 | #import 29 | #import 30 | #import 31 | #import 32 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingDataCore.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThinkingDataAnalytics/mp-sdk/1f4d7dd3123496718d129acc9c38177db914a1b4/src/native/cc/ios/ThinkingDataCore.framework/Info.plist -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingDataCore.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module ThinkingDataCore { 2 | umbrella header "ThinkingDataCore.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingDataCore.framework/ThinkingDataCore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThinkingDataAnalytics/mp-sdk/1f4d7dd3123496718d129acc9c38177db914a1b4/src/native/cc/ios/ThinkingDataCore.framework/ThinkingDataCore -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Headers/TDAnalytics+ThirdParty.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDAnalytics+ThirdParty.h 3 | // ThinkingSDK 4 | // 5 | // Created by 杨雄 on 2023/8/17. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface TDAnalytics (ThirdParty) 13 | 14 | #if TARGET_OS_IOS 15 | 16 | + (void)enableThirdPartySharing:(TDThirdPartyType)type API_UNAVAILABLE(macos); 17 | + (void)enableThirdPartySharing:(TDThirdPartyType)type properties:(NSDictionary *)properties API_UNAVAILABLE(macos); 18 | 19 | + (void)enableThirdPartySharing:(TDThirdPartyType)type withAppId:(NSString *)appId API_UNAVAILABLE(macos); 20 | + (void)enableThirdPartySharing:(TDThirdPartyType)type properties:(NSDictionary *)properties withAppId:(NSString *)appId API_UNAVAILABLE(macos); 21 | 22 | #endif 23 | 24 | @end 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Headers/TDAnalytics+WebView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDAnalytics+WebView.h 3 | // ThinkingSDK 4 | // 5 | // Created by 杨雄 on 2023/8/17. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface TDAnalytics (WebView) 13 | 14 | /// H5 is connected with the native APP SDK and used in conjunction with the addWebViewUserAgent interface 15 | /// @param webView webView 16 | /// @param request NSURLRequest request 17 | /// @return YES:Process this request NO: This request has not been processed 18 | + (BOOL)showUpWebView:(id)webView withRequest:(NSURLRequest *)request; 19 | 20 | /// When connecting data with H5, you need to call this interface to configure UserAgent 21 | + (void)addWebViewUserAgent; 22 | 23 | /// H5 is connected with the native APP SDK and used in conjunction with the addWebViewUserAgent interface 24 | /// @param webView webView 25 | /// @param request NSURLRequest request 26 | /// @param appId appId 27 | /// @return YES:Process this request NO: This request has not been processed 28 | + (BOOL)showUpWebView:(id)webView withRequest:(NSURLRequest *)request withAppId:(NSString * _Nullable)appId; 29 | 30 | @end 31 | 32 | NS_ASSUME_NONNULL_END 33 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Headers/TDAnalytics.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDAnalytics.h 3 | // ThinkingSDK 4 | // 5 | // Created by 杨雄 on 2023/8/17. 6 | // 7 | 8 | #import 9 | 10 | #if TARGET_OS_IOS 11 | #import 12 | 13 | #if __has_include() 14 | #import 15 | #else 16 | #import "TDAutoTrackPublicHeader.h" 17 | #endif 18 | 19 | #elif TARGET_OS_OSX 20 | #import 21 | 22 | #endif 23 | 24 | #if __has_include() 25 | #import 26 | #else 27 | #import "TDFirstEventModel.h" 28 | #endif 29 | 30 | #if __has_include() 31 | #import 32 | #else 33 | #import "TDEditableEventModel.h" 34 | #endif 35 | 36 | 37 | #if __has_include() 38 | #import 39 | #else 40 | #import "TDConfig.h" 41 | #endif 42 | 43 | #if __has_include() 44 | #import 45 | #else 46 | #import "TDPresetProperties.h" 47 | #endif 48 | 49 | 50 | NS_ASSUME_NONNULL_BEGIN 51 | 52 | @interface TDAnalytics : NSObject 53 | 54 | @end 55 | 56 | NS_ASSUME_NONNULL_END 57 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Headers/TDAutoTrackConst.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDAutoTrackConst.h 3 | // Pods 4 | // 5 | // Created by 杨雄 on 2023/7/23. 6 | // 7 | 8 | #ifndef TDAutoTrackConst_h 9 | #define TDAutoTrackConst_h 10 | 11 | #import 12 | 13 | typedef NS_OPTIONS(NSInteger, TDAutoTrackEventType) { 14 | TDAutoTrackEventTypeNone = 0, 15 | TDAutoTrackEventTypeAppStart = 1 << 0, 16 | TDAutoTrackEventTypeAppEnd = 1 << 1, 17 | TDAutoTrackEventTypeAppClick = 1 << 2, 18 | TDAutoTrackEventTypeAppViewScreen = 1 << 3, 19 | TDAutoTrackEventTypeAppViewCrash = 1 << 4, 20 | TDAutoTrackEventTypeAppInstall = 1 << 5, 21 | TDAutoTrackEventTypeAll = TDAutoTrackEventTypeAppStart | TDAutoTrackEventTypeAppEnd | TDAutoTrackEventTypeAppClick | TDAutoTrackEventTypeAppInstall | TDAutoTrackEventTypeAppViewCrash | TDAutoTrackEventTypeAppViewScreen 22 | }; 23 | 24 | static NSString * const TD_APP_START_EVENT = @"ta_app_start"; 25 | static NSString * const TD_APP_START_BACKGROUND_EVENT = @"ta_app_bg_start"; 26 | static NSString * const TD_APP_END_EVENT = @"ta_app_end"; 27 | static NSString * const TD_APP_VIEW_EVENT = @"ta_app_view"; 28 | static NSString * const TD_APP_CLICK_EVENT = @"ta_app_click"; 29 | static NSString * const TD_APP_CRASH_EVENT = @"ta_app_crash"; 30 | static NSString * const TD_APP_INSTALL_EVENT = @"ta_app_install"; 31 | 32 | #endif /* TDAutoTrackConst_h */ 33 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Headers/TDAutoTrackProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDAutoTrackProtocol.h 3 | // ThinkingSDK 4 | // 5 | // Created by Yangxiongon 2022/7/1. 6 | // 7 | 8 | #ifndef TDAutoTrackProtocol_h 9 | #define TDAutoTrackProtocol_h 10 | 11 | #import 12 | 13 | @protocol TDUIViewAutoTrackDelegate 14 | 15 | @optional 16 | 17 | /** 18 | UITableView event properties 19 | 20 | @return event properties 21 | */ 22 | - (NSDictionary *)thinkingAnalytics_tableView:(UITableView *)tableView autoTrackPropertiesAtIndexPath:(NSIndexPath *)indexPath; 23 | 24 | /** 25 | APPID UITableView event properties 26 | 27 | @return event properties 28 | */ 29 | - (NSDictionary *)thinkingAnalyticsWithAppid_tableView:(UITableView *)tableView autoTrackPropertiesAtIndexPath:(NSIndexPath *)indexPath; 30 | 31 | @optional 32 | 33 | /** 34 | UICollectionView event properties 35 | 36 | @return event properties 37 | */ 38 | - (NSDictionary *)thinkingAnalytics_collectionView:(UICollectionView *)collectionView autoTrackPropertiesAtIndexPath:(NSIndexPath *)indexPath; 39 | 40 | /** 41 | APPID UICollectionView event properties 42 | 43 | @return event properties 44 | */ 45 | - (NSDictionary *)thinkingAnalyticsWithAppid_collectionView:(UICollectionView *)collectionView autoTrackPropertiesAtIndexPath:(NSIndexPath *)indexPath; 46 | 47 | @end 48 | 49 | 50 | @protocol TDAutoTracker 51 | 52 | @optional 53 | 54 | - (NSDictionary *)getTrackProperties; 55 | 56 | 57 | - (NSDictionary *)getTrackPropertiesWithAppid; 58 | 59 | @end 60 | 61 | /** 62 | Automatically track the page 63 | */ 64 | @protocol TDScreenAutoTracker 65 | 66 | @optional 67 | 68 | /** 69 | Attributes for custom page view events 70 | */ 71 | - (NSString *)getScreenUrl; 72 | 73 | /** 74 | Configure the properties of the APPID custom page view event 75 | */ 76 | - (NSDictionary *)getScreenUrlWithAppid; 77 | 78 | @end 79 | 80 | #endif /* TDAutoTrackProtocol_h */ 81 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Headers/TDAutoTrackPublicHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDAutoTrackPublicHeader.h 3 | // ThinkingSDK 4 | // 5 | // Created by Yangxiongon 2022/7/1. 6 | // 7 | 8 | #ifndef TDAutoTrackPublicHeader_h 9 | #define TDAutoTrackPublicHeader_h 10 | 11 | #if __has_include() 12 | #import 13 | #else 14 | #import "TDAutoTrackProtocol.h" 15 | #endif 16 | 17 | #if __has_include() 18 | #import 19 | #else 20 | #import "UIView+ThinkingAnalytics.h" 21 | #endif 22 | 23 | #if __has_include() 24 | #import 25 | #else 26 | #import "TDAutoTrackConst.h" 27 | #endif 28 | 29 | #endif /* TDAutoTrackPublicHeader_h */ 30 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Headers/TDConfig.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #if __has_include() 4 | #import 5 | #else 6 | #import "TDConstant.h" 7 | #endif 8 | 9 | #if __has_include() 10 | #import 11 | #else 12 | #import "TDSecurityPolicy.h" 13 | #endif 14 | 15 | #if TARGET_OS_IOS 16 | #if __has_include() 17 | #import 18 | #else 19 | #import "TDSecretKey.h" 20 | #endif 21 | #endif 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | @interface TDConfig:NSObject 26 | 27 | /// app id 28 | @property (atomic, copy) NSString *appid; 29 | 30 | /// server url 31 | @property (atomic, copy) NSString *configureURL; 32 | 33 | /// SDK mode 34 | @property (nonatomic, assign) TDMode mode; 35 | 36 | /// Set default time zone. 37 | /// You can use this time zone to compare the offset of the current time zone and the default time zone 38 | @property (nonatomic, strong) NSTimeZone *defaultTimeZone; 39 | 40 | /// SDK instance name 41 | @property (nonatomic, copy) NSString *name; 42 | 43 | /// Set the network environment for reporting data 44 | @property (nonatomic, assign) TDReportingNetworkType reportingNetworkType; 45 | 46 | /// Data upload interval 47 | @property (nonatomic, strong) NSNumber *uploadInterval; 48 | 49 | /// When there is data to upload, when the number of data cache reaches the uploadsize, upload the data immediately 50 | @property (nonatomic, strong) NSNumber *uploadSize; 51 | 52 | /// Event blacklist, event names that are not counted are added here 53 | @property (strong, nonatomic) NSArray *disableEvents; 54 | 55 | /// instance Token 56 | @property (atomic, copy) NSString *(^getInstanceName)(void); 57 | 58 | /// Initialize and configure background self-starting events 59 | /// YES: Collect background self-starting events 60 | /// NO: Do not collect background self-starting events 61 | @property (nonatomic, assign) BOOL trackRelaunchedInBackgroundEvents; 62 | 63 | /// app launchOptions 64 | @property (nonatomic, copy) NSDictionary *launchOptions; 65 | 66 | /// Initialize and configure the certificate verification policy 67 | @property (nonatomic, strong) TDSecurityPolicy *securityPolicy; 68 | 69 | /// share data with App Extension 70 | @property (nonatomic, copy) NSString *appGroupName; 71 | 72 | @property (nonatomic, assign) BOOL enableReceiptPush; 73 | 74 | #if TARGET_OS_IOS 75 | /// enable encryption 76 | @property (nonatomic, assign) BOOL enableEncrypt DEPRECATED_MSG_ATTRIBUTE("Deprecated. replace with: -enableEncryptWithVersion:publicKey:"); 77 | /// Get local key configuration 78 | @property (nonatomic, strong) TDSecretKey *secretKey DEPRECATED_MSG_ATTRIBUTE("Deprecated. replace with: -enableEncryptWithVersion:publicKey:"); 79 | #endif 80 | /** 81 | Debug Mode 82 | */ 83 | @property (nonatomic, assign) ThinkingAnalyticsDebugMode debugMode DEPRECATED_MSG_ATTRIBUTE("Deprecated. replace with property: mode"); 84 | /** 85 | Network environment for data transmission 86 | */ 87 | @property (assign, nonatomic) ThinkingNetworkType networkTypePolicy DEPRECATED_MSG_ATTRIBUTE("Deprecated. don't need this property"); 88 | /** 89 | Set automatic burying type 90 | */ 91 | @property (assign, nonatomic) ThinkingAnalyticsAutoTrackEventType autoTrackEventType DEPRECATED_MSG_ATTRIBUTE("Deprecated. don't need this property"); 92 | /** 93 | The maximum number of cached events, the default is 10000, the minimum is 5000 94 | */ 95 | @property (class, nonatomic) NSInteger maxNumEvents DEPRECATED_MSG_ATTRIBUTE("Please config TAConfigInfo in main info.plist"); 96 | /** 97 | Data cache expiration time, the default is 10 days, the longest is 10 days 98 | */ 99 | @property (class, nonatomic) NSInteger expirationDays DEPRECATED_MSG_ATTRIBUTE("Please config TAConfigInfo in main info.plist"); 100 | 101 | - (void)setNetworkType:(ThinkingAnalyticsNetworkType)type DEPRECATED_MSG_ATTRIBUTE("Deprecated. replace with: -setUploadNetworkType:"); 102 | - (void)updateConfig:(void(^)(NSDictionary *dict))block DEPRECATED_MSG_ATTRIBUTE("Deprecated"); 103 | - (NSString *)getMapInstanceToken DEPRECATED_MSG_ATTRIBUTE("Deprecated"); 104 | + (TDConfig *)defaultTDConfig DEPRECATED_MSG_ATTRIBUTE("Deprecated"); 105 | 106 | /// Initialize the SDK config file 107 | /// @param appId project app Id 108 | /// @param serverUrl Thinking Engine receiver url 109 | - (instancetype)initWithAppId:(NSString *)appId serverUrl:(NSString *)serverUrl; 110 | 111 | /// enable encrypt 112 | /// @param version version of the encryption configuration file 113 | /// @param publicKey public key 114 | - (void)enableEncryptWithVersion:(NSUInteger)version publicKey:(NSString *)publicKey; 115 | 116 | @end 117 | NS_ASSUME_NONNULL_END 118 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Headers/TDConstant.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDConstant.h 3 | // ThinkingSDK 4 | // 5 | // Created by LiHuanan on 2020/9/8. 6 | // Copyright © 2020 thinkingdata. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | Log Level 13 | 14 | - TDLoggingLevelNone : Not enabled by default 15 | */ 16 | typedef NS_OPTIONS(NSInteger, TDLoggingLevel) { 17 | /** 18 | Not enabled by default 19 | */ 20 | TDLoggingLevelNone = 0, 21 | 22 | /** 23 | Error Log 24 | */ 25 | TDLoggingLevelError = 1 << 0, 26 | 27 | 28 | /** 29 | Warning Log 30 | */ 31 | TDLoggingLevelWarning = 1 << 1, 32 | 33 | /** 34 | Info Log 35 | */ 36 | TDLoggingLevelInfo = 1 << 2, 37 | 38 | /** 39 | Debug Log 40 | */ 41 | TDLoggingLevelDebug = 1 << 3, 42 | }; 43 | 44 | /** 45 | Debug Mode 46 | 47 | - ThinkingAnalyticsDebugOff : Not enabled by default 48 | */ 49 | __attribute__((deprecated("This class is deprecated. Use the newClass instead: TDMode"))) 50 | typedef NS_OPTIONS(NSInteger, ThinkingAnalyticsDebugMode) { 51 | /** 52 | Not enabled by default 53 | */ 54 | ThinkingAnalyticsDebugOff = 0, 55 | 56 | /** 57 | Enable DebugOnly Mode, Data is not persisted 58 | */ 59 | ThinkingAnalyticsDebugOnly = 1 << 0, 60 | 61 | /** 62 | Enable Debug Mode,Data will persist 63 | */ 64 | ThinkingAnalyticsDebug = 1 << 1, 65 | 66 | /** 67 | Enable Debug Mode,Data will persist,Equivalent to ThinkingAnalyticsDebug 68 | */ 69 | ThinkingAnalyticsDebugOn = ThinkingAnalyticsDebug, 70 | }; 71 | 72 | /** 73 | Debug Mode 74 | 75 | - ThinkingAnalyticsDebugOff : Not enabled by default 76 | */ 77 | typedef NS_OPTIONS(NSInteger, TDMode) { 78 | /** 79 | Not enabled by default 80 | */ 81 | TDModeNormal = 0, 82 | 83 | /** 84 | Enable DebugOnly Mode, Data is not persisted 85 | */ 86 | TDModeDebugOnly = 1 << 0, 87 | 88 | /** 89 | Enable Debug Mode,Data will persist 90 | */ 91 | TDModeDebug = 1 << 1, 92 | }; 93 | 94 | 95 | /** 96 | Https Certificate Verification Mode 97 | */ 98 | typedef NS_OPTIONS(NSInteger, TDSSLPinningMode) { 99 | /** 100 | The default authentication method will only verify the certificate returned by the server in the system's trusted certificate list 101 | */ 102 | TDSSLPinningModeNone = 0, 103 | 104 | /** 105 | The public key of the verification certificate 106 | */ 107 | TDSSLPinningModePublicKey = 1 << 0, 108 | 109 | /** 110 | Verify all contents of the certificate 111 | */ 112 | TDSSLPinningModeCertificate = 1 << 1 113 | }; 114 | 115 | /** 116 | Custom HTTPS Authentication 117 | */ 118 | typedef NSURLSessionAuthChallengeDisposition (^TDURLSessionDidReceiveAuthenticationChallengeBlock)(NSURLSession *_Nullable session, NSURLAuthenticationChallenge *_Nullable challenge, NSURLCredential *_Nullable __autoreleasing *_Nullable credential); 119 | 120 | 121 | 122 | /** 123 | Network Type Enum 124 | 125 | - TDNetworkTypeDefault : 3G、4G、WIFI 126 | */ 127 | __attribute__((deprecated("This class is deprecated. Use the newClass instead: TDReportingNetworkType"))) 128 | typedef NS_OPTIONS(NSInteger, ThinkingAnalyticsNetworkType) { 129 | 130 | /** 131 | only WIFI 132 | */ 133 | TDNetworkTypeOnlyWIFI = 1 << 0, 134 | 135 | /** 136 | 2G、3G、4G、WIFI 137 | */ 138 | TDNetworkTypeALL = 1 << 1, 139 | 140 | /** 141 | 3G、4G、WIFI 142 | */ 143 | TDNetworkTypeDefault = TDNetworkTypeALL, 144 | }; 145 | 146 | typedef NS_OPTIONS(NSInteger, TDReportingNetworkType) { 147 | TDReportingNetworkTypeWIFI = 1 << 0, 148 | TDReportingNetworkTypeALL = 1 << 1, 149 | }; 150 | 151 | /** 152 | Auto-Tracking Enum 153 | 154 | - ThinkingAnalyticsEventTypeNone : auto-tracking is not enabled by default 155 | */ 156 | __attribute__((deprecated("This class is deprecated. Use the newClass instead: TDAutoTrackEventType"))) 157 | typedef NS_OPTIONS(NSInteger, ThinkingAnalyticsAutoTrackEventType) { 158 | 159 | /** 160 | auto-tracking is not enabled by default 161 | */ 162 | ThinkingAnalyticsEventTypeNone = 0, 163 | 164 | /* 165 | Active Events 166 | */ 167 | ThinkingAnalyticsEventTypeAppStart = 1 << 0, 168 | 169 | /** 170 | Inactive Events 171 | */ 172 | ThinkingAnalyticsEventTypeAppEnd = 1 << 1, 173 | 174 | /** 175 | Clicked events 176 | */ 177 | ThinkingAnalyticsEventTypeAppClick = 1 << 2, 178 | 179 | /** 180 | View Page Events 181 | */ 182 | ThinkingAnalyticsEventTypeAppViewScreen = 1 << 3, 183 | 184 | /** 185 | Crash Events 186 | */ 187 | ThinkingAnalyticsEventTypeAppViewCrash = 1 << 4, 188 | 189 | /** 190 | Installation Events 191 | */ 192 | ThinkingAnalyticsEventTypeAppInstall = 1 << 5, 193 | /** 194 | All Events 195 | */ 196 | ThinkingAnalyticsEventTypeAll = ThinkingAnalyticsEventTypeAppStart | ThinkingAnalyticsEventTypeAppEnd | ThinkingAnalyticsEventTypeAppClick | ThinkingAnalyticsEventTypeAppInstall | ThinkingAnalyticsEventTypeAppViewCrash | ThinkingAnalyticsEventTypeAppViewScreen 197 | 198 | }; 199 | 200 | typedef NS_OPTIONS(NSInteger, ThinkingNetworkType) { 201 | ThinkingNetworkTypeNONE = 0, 202 | ThinkingNetworkType2G = 1 << 0, 203 | ThinkingNetworkType3G = 1 << 1, 204 | ThinkingNetworkType4G = 1 << 2, 205 | ThinkingNetworkTypeWIFI = 1 << 3, 206 | ThinkingNetworkType5G = 1 << 4, 207 | ThinkingNetworkTypeALL = 0xFF, 208 | }; 209 | 210 | 211 | typedef NS_OPTIONS(NSInteger, TDThirdPartyType) { 212 | TDThirdPartyTypeNone = 0, 213 | TDThirdPartyTypeAppsFlyer = 1 << 0, 214 | TDThirdPartyTypeIronSource = 1 << 1, 215 | TDThirdPartyTypeAdjust = 1 << 2, 216 | TDThirdPartyTypeBranch = 1 << 3, 217 | TDThirdPartyTypeTopOn = 1 << 4, 218 | TDThirdPartyTypeTracking = 1 << 5, 219 | TDThirdPartyTypeTradPlus = 1 << 6, 220 | TDThirdPartyTypeAppLovin = 1 << 7, 221 | TDThirdPartyTypeKochava = 1 << 8, 222 | TDThirdPartyTypeTalkingData = 1 << 9, 223 | TDThirdPartyTypeFirebase = 1 << 10, 224 | }; 225 | 226 | __attribute__((deprecated("This class is deprecated. Use the newClass instead: TDThirdPartyType"))) 227 | typedef NS_OPTIONS(NSUInteger, TAThirdPartyShareType) { 228 | TAThirdPartyShareTypeNONE = TDThirdPartyTypeNone, 229 | TAThirdPartyShareTypeAPPSFLYER = TDThirdPartyTypeAppsFlyer, 230 | TAThirdPartyShareTypeIRONSOURCE = TDThirdPartyTypeIronSource, 231 | TAThirdPartyShareTypeADJUST = TDThirdPartyTypeAdjust, 232 | TAThirdPartyShareTypeBRANCH = TDThirdPartyTypeBranch, 233 | TAThirdPartyShareTypeTOPON = TDThirdPartyTypeTopOn, 234 | TAThirdPartyShareTypeTRACKING = TDThirdPartyTypeTracking, 235 | TAThirdPartyShareTypeTRADPLUS = TDThirdPartyTypeTradPlus, 236 | TAThirdPartyShareTypeAPPLOVIN = TDThirdPartyTypeAppLovin, 237 | TAThirdPartyShareTypeKOCHAVA = TDThirdPartyTypeKochava, 238 | TAThirdPartyShareTypeTALKINGDATA = TDThirdPartyTypeTalkingData, 239 | TAThirdPartyShareTypeFIREBASE = TDThirdPartyTypeFirebase, 240 | 241 | TDThirdPartyShareTypeNONE = TAThirdPartyShareTypeNONE, 242 | TDThirdPartyShareTypeAPPSFLYER = TAThirdPartyShareTypeAPPSFLYER, 243 | TDThirdPartyShareTypeIRONSOURCE = TAThirdPartyShareTypeIRONSOURCE, 244 | TDThirdPartyShareTypeADJUST = TAThirdPartyShareTypeADJUST, 245 | TDThirdPartyShareTypeBRANCH = TAThirdPartyShareTypeBRANCH, 246 | TDThirdPartyShareTypeTOPON = TAThirdPartyShareTypeTOPON, 247 | TDThirdPartyShareTypeTRACKING = TAThirdPartyShareTypeTRACKING, 248 | TDThirdPartyShareTypeTRADPLUS = TAThirdPartyShareTypeTRADPLUS, 249 | }; 250 | 251 | //MARK: - Data reporting status 252 | typedef NS_ENUM(NSInteger, TDTrackStatus) { 253 | /// Suspend reporting 254 | TDTrackStatusPause, 255 | /// Stop reporting and clear cache 256 | TDTrackStatusStop, 257 | /// Suspend reporting and continue to persist data 258 | TDTrackStatusSaveOnly, 259 | /// reset normal 260 | TDTrackStatusNormal 261 | }; 262 | 263 | 264 | //MARK: - Data reporting status 265 | __attribute__((deprecated("This class is deprecated. Use the newClass instead: TDTrackStatus"))) 266 | typedef NS_ENUM(NSInteger, TATrackStatus) { 267 | /// Suspend reporting 268 | TATrackStatusPause, 269 | /// Stop reporting and clear cache 270 | TATrackStatusStop, 271 | /// Suspend reporting and continue to persist data 272 | TATrackStatusSaveOnly, 273 | /// reset normal 274 | TATrackStatusNormal 275 | }; 276 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Headers/TDDeviceInfo.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | FOUNDATION_EXTERN NSString *const VERSION; 6 | 7 | @interface TDDeviceInfo : NSObject 8 | 9 | + (TDDeviceInfo *)sharedManager; 10 | 11 | 12 | @property (nonatomic, copy) NSString *uniqueId; 13 | @property (nonatomic, copy) NSString *deviceId; 14 | @property (nonatomic, copy) NSString *appVersion; 15 | @property (nonatomic, readonly) BOOL isFirstOpen; 16 | @property (nonatomic, copy) NSString *libName; 17 | @property (nonatomic, copy) NSString *libVersion; 18 | 19 | + (NSString *)libVersion; 20 | + (NSString*)bundleId; 21 | 22 | - (void)td_updateData; 23 | - (NSDictionary *)td_collectProperties; 24 | 25 | + (NSDate *)td_getInstallTime; 26 | 27 | - (NSDictionary *)getAutomaticData; 28 | 29 | + (NSString *)currentRadio; 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Headers/TDEditableEventModel.h: -------------------------------------------------------------------------------- 1 | 2 | #if __has_include() 3 | #import 4 | #else 5 | #import "TDUpdateEventModel.h" 6 | #endif 7 | 8 | #if __has_include() 9 | #import 10 | #else 11 | #import "TDOverwriteEventModel.h" 12 | #endif 13 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Headers/TDEventModel.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | typedef NSString *kEDEventTypeName; 6 | 7 | FOUNDATION_EXTERN kEDEventTypeName const TD_EVENT_TYPE_TRACK_FIRST; 8 | FOUNDATION_EXTERN kEDEventTypeName const TD_EVENT_TYPE_TRACK_UPDATE; 9 | FOUNDATION_EXTERN kEDEventTypeName const TD_EVENT_TYPE_TRACK_OVERWRITE; 10 | 11 | @interface TDEventModel : NSObject 12 | 13 | - (instancetype)init NS_UNAVAILABLE; 14 | + (instancetype)new NS_UNAVAILABLE; 15 | 16 | @property (nonatomic, copy, readonly) NSString *eventName; 17 | @property (nonatomic, copy, readonly) kEDEventTypeName eventType; 18 | @property (nonatomic, strong) NSDictionary *properties; 19 | 20 | - (void)configTime:(NSDate *)time timeZone:(NSTimeZone *)timeZone; 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Headers/TDFirstEventModel.h: -------------------------------------------------------------------------------- 1 | 2 | #if __has_include() 3 | #import 4 | #else 5 | #import "TDEventModel.h" 6 | #endif 7 | 8 | 9 | NS_ASSUME_NONNULL_BEGIN 10 | 11 | @interface TDFirstEventModel : TDEventModel 12 | 13 | - (instancetype)initWithEventName:(NSString * _Nullable)eventName; 14 | 15 | - (instancetype)initWithEventName:(NSString * _Nullable)eventName firstCheckID:(NSString *)firstCheckID; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Headers/TDOverwriteEventModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDOverwriteEventModel.h 3 | // ThinkingSDK 4 | // 5 | // Created by Yangxiongon 2022/7/1. 6 | // 7 | 8 | #if __has_include() 9 | #import 10 | #else 11 | #import "TDEventModel.h" 12 | #endif 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface TDOverwriteEventModel : TDEventModel 17 | 18 | - (instancetype)initWithEventName:(NSString *)eventName eventID:(NSString *)eventID; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Headers/TDPresetProperties.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDPresetProperties.h 3 | // ThinkingSDK 4 | // 5 | // Created by huangdiao on 2021/5/25. 6 | // Copyright © 2021 thinkingdata. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface TDPresetProperties : NSObject 14 | 15 | @property (nonatomic, copy, readonly) NSString *bundle_id; 16 | @property (nonatomic, copy, readonly) NSString *carrier; 17 | @property (nonatomic, copy, readonly) NSString *device_id; 18 | @property (nonatomic, copy, readonly) NSString *device_model; 19 | @property (nonatomic, copy, readonly) NSString *manufacturer; 20 | @property (nonatomic, copy, readonly) NSString *network_type; 21 | @property (nonatomic, copy, readonly) NSString *os; 22 | @property (nonatomic, copy, readonly) NSString *os_version; 23 | @property (nonatomic, copy, readonly) NSNumber *screen_height; 24 | @property (nonatomic, copy, readonly) NSNumber *screen_width; 25 | @property (nonatomic, copy, readonly) NSString *system_language; 26 | @property (nonatomic, copy, readonly) NSNumber *zone_offset; 27 | @property (nonatomic, copy, readonly) NSString *install_time; 28 | 29 | /** 30 | * The key of the returned event preset property starts with "#", and it is not recommended to use it directly as the property of the event 31 | */ 32 | - (NSDictionary *)toEventPresetProperties; 33 | 34 | @end 35 | 36 | NS_ASSUME_NONNULL_END 37 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Headers/TDSecretKey.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDSecretKey.h 3 | // ThinkingSDK 4 | // 5 | // Created by wwango on 2022/1/21. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface TDSecretKey : NSObject 13 | 14 | /// Initialize key information 15 | - (instancetype)initWithVersion:(NSUInteger)version publicKey:(NSString *)publicKey; 16 | 17 | /// Initialize key information 18 | /// @param version key version number 19 | /// @param publicKey public key 20 | /// @param asymmetricEncryption asymmetric encryption type 21 | /// @param symmetricEncryption Symmetric encryption type 22 | - (instancetype)initWithVersion:(NSUInteger)version 23 | publicKey:(NSString *)publicKey 24 | asymmetricEncryption:(NSString *)asymmetricEncryption 25 | symmetricEncryption:(NSString *)symmetricEncryption; 26 | 27 | @property (nonatomic, assign, readonly) NSUInteger version; 28 | @property (nonatomic, copy, readonly) NSString *publicKey; 29 | @property (nonatomic, copy, readonly) NSString *symmetricEncryption; 30 | @property (nonatomic, copy, readonly) NSString *asymmetricEncryption; 31 | 32 | /// Whether the key information is available 33 | @property (nonatomic, assign, readonly) BOOL isValid; 34 | 35 | @end 36 | 37 | NS_ASSUME_NONNULL_END 38 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Headers/TDSecurityPolicy.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | Thinks AFNetworking: https://github.com/AFNetworking/AFNetworking 4 | */ 5 | #import 6 | 7 | #if __has_include() 8 | #import 9 | #else 10 | #import "TDConstant.h" 11 | #endif 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | 16 | @interface TDSecurityPolicy: NSObject 17 | 18 | @property (nonatomic, assign) BOOL allowInvalidCertificates; 19 | @property (nonatomic, assign) BOOL validatesDomainName; 20 | @property (nonatomic, copy) TDURLSessionDidReceiveAuthenticationChallengeBlock sessionDidReceiveAuthenticationChallenge; 21 | + (instancetype)policyWithPinningMode:(TDSSLPinningMode)pinningMode; 22 | + (instancetype)defaultPolicy; 23 | - (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust forDomain:(NSString *)domain; 24 | 25 | @end 26 | 27 | #ifndef __Require_Quiet 28 | #define __Require_Quiet(assertion, exceptionLabel) \ 29 | do \ 30 | { \ 31 | if ( __builtin_expect(!(assertion), 0) ) \ 32 | { \ 33 | goto exceptionLabel; \ 34 | } \ 35 | } while ( 0 ) 36 | #endif 37 | 38 | #ifndef __Require_noErr_Quiet 39 | #define __Require_noErr_Quiet(errorCode, exceptionLabel) \ 40 | do \ 41 | { \ 42 | if ( __builtin_expect(0 != (errorCode), 0) ) \ 43 | { \ 44 | goto exceptionLabel; \ 45 | } \ 46 | } while ( 0 ) 47 | #endif 48 | 49 | 50 | NS_ASSUME_NONNULL_END 51 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Headers/TDUpdateEventModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDUpdateEventModel.h 3 | // ThinkingSDK 4 | // 5 | // Created by Yangxiongon 2022/7/1. 6 | // 7 | 8 | #if __has_include() 9 | #import 10 | #else 11 | #import "TDEventModel.h" 12 | #endif 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface TDUpdateEventModel : TDEventModel 17 | 18 | - (instancetype)initWithEventName:(NSString *)eventName eventID:(NSString *)eventID; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Headers/ThinkingAnalyticsSDK.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #if TARGET_OS_IOS 4 | #import 5 | 6 | #if __has_include() 7 | #import 8 | #else 9 | #import "TDAutoTrackPublicHeader.h" 10 | #endif 11 | 12 | #elif TARGET_OS_OSX 13 | #import 14 | 15 | #endif 16 | 17 | #if __has_include() 18 | #import 19 | #else 20 | #import "TDFirstEventModel.h" 21 | #endif 22 | 23 | #if __has_include() 24 | #import 25 | #else 26 | #import "TDEditableEventModel.h" 27 | #endif 28 | 29 | 30 | #if __has_include() 31 | #import 32 | #else 33 | #import "TDConfig.h" 34 | #endif 35 | 36 | #if __has_include() 37 | #import 38 | #else 39 | #import "TDPresetProperties.h" 40 | #endif 41 | 42 | 43 | NS_ASSUME_NONNULL_BEGIN 44 | 45 | @interface ThinkingAnalyticsSDK : NSObject 46 | 47 | 48 | @end 49 | 50 | NS_ASSUME_NONNULL_END 51 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Headers/ThinkingSDK.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | #if __has_include() 5 | #import 6 | #else 7 | #import "ThinkingAnalyticsSDK.h" 8 | #endif 9 | 10 | #if __has_include() 11 | #import 12 | #else 13 | #import "TDFirstEventModel.h" 14 | #endif 15 | 16 | #if __has_include() 17 | #import 18 | #else 19 | #import "TDEditableEventModel.h" 20 | #endif 21 | 22 | #if __has_include() 23 | #import 24 | #else 25 | #import "TDConfig.h" 26 | #endif 27 | 28 | #if __has_include() 29 | #import 30 | #else 31 | #import "TDPresetProperties.h" 32 | #endif 33 | 34 | #if __has_include() 35 | #import 36 | #else 37 | #import "TDDeviceInfo.h" 38 | #endif 39 | 40 | #if __has_include() 41 | #import 42 | #else 43 | #import "TDAnalytics+Public.h" 44 | #endif 45 | 46 | #if __has_include() 47 | #import 48 | #else 49 | #import "TDAnalytics+Multiple.h" 50 | #endif 51 | 52 | #if __has_include() 53 | #import 54 | #else 55 | #import "TDAnalytics+WebView.h" 56 | #endif 57 | 58 | #if __has_include() 59 | #import 60 | #else 61 | #import "TDAnalytics+ThirdParty.h" 62 | #endif 63 | 64 | #if __has_include() 65 | #import 66 | #else 67 | #import "ThinkingAnalyticsSDK+OldPublic.h" 68 | #endif 69 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Headers/UIView+ThinkingAnalytics.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+ThinkingAnalytics.h 3 | // ThinkingSDK 4 | // 5 | // Created by Yangxiongon 2022/7/1. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface UIView (ThinkingAnalytics) 13 | 14 | /** 15 | Set the control element ID 16 | */ 17 | @property (copy,nonatomic) NSString *thinkingAnalyticsViewID; 18 | 19 | /** 20 | Configure the control element ID of APPID 21 | */ 22 | @property (strong,nonatomic) NSDictionary *thinkingAnalyticsViewIDWithAppid; 23 | 24 | /** 25 | Ignore the click event of a control 26 | */ 27 | @property (nonatomic,assign) BOOL thinkingAnalyticsIgnoreView; 28 | 29 | /** 30 | Configure APPID to ignore the click event of a control 31 | */ 32 | @property (strong,nonatomic) NSDictionary *thinkingAnalyticsIgnoreViewWithAppid; 33 | 34 | /** 35 | Properties of custom control click event 36 | */ 37 | @property (strong,nonatomic) NSDictionary *thinkingAnalyticsViewProperties; 38 | 39 | /** 40 | Configure the properties of the APPID custom control click event 41 | */ 42 | @property (strong,nonatomic) NSDictionary *thinkingAnalyticsViewPropertiesWithAppid; 43 | 44 | /** 45 | thinkingAnalyticsDelegate 46 | */ 47 | @property (nonatomic, weak, nullable) id thinkingAnalyticsDelegate; 48 | 49 | @end 50 | 51 | NS_ASSUME_NONNULL_END 52 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThinkingDataAnalytics/mp-sdk/1f4d7dd3123496718d129acc9c38177db914a1b4/src/native/cc/ios/ThinkingSDK.framework/Info.plist -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module ThinkingSDK { 2 | umbrella header "ThinkingSDK.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /src/native/cc/ios/ThinkingSDK.framework/ThinkingSDK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThinkingDataAnalytics/mp-sdk/1f4d7dd3123496718d129acc9c38177db914a1b4/src/native/cc/ios/ThinkingSDK.framework/ThinkingSDK -------------------------------------------------------------------------------- /src/native/cc/openharmony/CocosCreatorProxyApi.ts: -------------------------------------------------------------------------------- 1 | import { TDAnalytics, TDConfig, TDMode, TDAutoTrackEventType, TDNetworkType } from '@thinkingdata/analytics'; 2 | 3 | function setCustomerLibInfo(param: string): void { 4 | try { 5 | let obj = JSON.parse(param) 6 | TDAnalytics.setCustomerLibInfo(obj['lib'], obj['version']) 7 | } catch (e) { 8 | } 9 | } 10 | 11 | function initWithConfig(param: string): void { 12 | try { 13 | let obj = JSON.parse(param) 14 | if (obj['enableLog'] === true) { 15 | TDAnalytics.enableLog(true) 16 | } 17 | let config = new TDConfig() 18 | config.appId = obj['appId'] 19 | config.serverUrl = obj['serverUrl'] 20 | TDAnalytics.initWithConfig(globalThis.appContext, config) 21 | } catch (e) { 22 | } 23 | } 24 | 25 | function track(param: string): void { 26 | try { 27 | let obj = JSON.parse(param) 28 | TDAnalytics.track({ 29 | eventName: obj['eventName'], 30 | properties: obj['properties'] 31 | }, obj['appId']) 32 | } catch (e) { 33 | } 34 | } 35 | 36 | function trackUpdate(param: string): void { 37 | try { 38 | let obj = JSON.parse(param) 39 | TDAnalytics.trackUpdate({ 40 | eventName: obj['event']['eventName'], 41 | properties: obj['event']['properties'], 42 | eventId: obj['event']['eventId'] 43 | }, obj['appId']) 44 | } catch (e) { 45 | } 46 | } 47 | 48 | function trackFirst(param: string): void { 49 | try { 50 | let obj = JSON.parse(param) 51 | TDAnalytics.trackFirst({ 52 | eventName: obj['event']['eventName'], 53 | properties: obj['event']['properties'], 54 | firstCheckId: obj['event']['firstCheckId'] 55 | }, obj['appId']) 56 | } catch (e) { 57 | } 58 | } 59 | 60 | function trackOverwrite(param: string): void { 61 | try { 62 | let obj = JSON.parse(param) 63 | TDAnalytics.trackOverwrite({ 64 | eventName: obj['event']['eventName'], 65 | properties: obj['event']['properties'], 66 | eventId: obj['event']['eventId'] 67 | }, obj['appId']) 68 | } catch (e) { 69 | } 70 | } 71 | 72 | function timeEvent(param: string): void { 73 | try { 74 | let obj = JSON.parse(param) 75 | TDAnalytics.timeEvent(obj['eventName'], obj['appId']) 76 | } catch (e) { 77 | } 78 | } 79 | 80 | function login(param: string): void { 81 | try { 82 | let obj = JSON.parse(param) 83 | TDAnalytics.login(obj['accountId'], obj['appId']) 84 | } catch (e) { 85 | } 86 | } 87 | 88 | function logout(param: string): void { 89 | TDAnalytics.logout(param) 90 | } 91 | 92 | function setSuperProperties(param: string): void { 93 | try { 94 | let obj = JSON.parse(param) 95 | TDAnalytics.setSuperProperties(obj['properties'], obj['appId']) 96 | } catch (e) { 97 | } 98 | } 99 | 100 | function getSuperProperties(param: string): string { 101 | return TDAnalytics.getSuperProperties(param) 102 | } 103 | 104 | function unsetSuperProperty(param: string): void { 105 | try { 106 | let obj = JSON.parse(param) 107 | TDAnalytics.unsetSuperProperty(obj['property'], obj['appId']) 108 | } catch (e) { 109 | } 110 | } 111 | 112 | function clearSuperProperties(param: string): void { 113 | TDAnalytics.clearSuperProperties(param) 114 | } 115 | 116 | function userSet(param: string): void { 117 | try { 118 | let obj = JSON.parse(param) 119 | TDAnalytics.userSet({ 120 | properties: obj['properties'], 121 | }, obj['appId']) 122 | } catch (e) { 123 | } 124 | } 125 | 126 | function userSetOnce(param: string): void { 127 | try { 128 | let obj = JSON.parse(param) 129 | TDAnalytics.userSetOnce({ 130 | properties: obj['properties'], 131 | }, obj['appId']) 132 | } catch (e) { 133 | } 134 | } 135 | 136 | function userAppend(param: string): void { 137 | try { 138 | let obj = JSON.parse(param) 139 | TDAnalytics.userAppend({ 140 | properties: obj['properties'], 141 | }, obj['appId']) 142 | } catch (e) { 143 | } 144 | } 145 | 146 | function userUniqAppend(param: string): void { 147 | try { 148 | let obj = JSON.parse(param) 149 | TDAnalytics.userUniqAppend({ 150 | properties: obj['properties'], 151 | }, obj['appId']) 152 | } catch (e) { 153 | } 154 | } 155 | 156 | function userAdd(param: string): void { 157 | try { 158 | let obj = JSON.parse(param) 159 | TDAnalytics.userAdd({ 160 | properties: obj['properties'], 161 | }, obj['appId']) 162 | } catch (e) { 163 | } 164 | } 165 | 166 | function userUnset(param: string): void { 167 | try { 168 | let obj = JSON.parse(param) 169 | TDAnalytics.userUnset({ 170 | property: obj['property'], 171 | }, obj['appId']) 172 | } catch (e) { 173 | } 174 | } 175 | 176 | function userDel(param: string): void { 177 | TDAnalytics.userDelete({}, param) 178 | } 179 | 180 | function flush(param: string): void { 181 | TDAnalytics.flush(param) 182 | } 183 | 184 | function setDistinctId(param: string): void { 185 | try { 186 | let obj = JSON.parse(param) 187 | TDAnalytics.setDistinctId(obj['distinctId'], obj['appId']) 188 | } catch (e) { 189 | } 190 | } 191 | 192 | function getDeviceId(param: string): string { 193 | return TDAnalytics.getDeviceId(param) 194 | } 195 | 196 | function getDistinctId(param: string): string { 197 | return TDAnalytics.getDistinctId(param) 198 | } 199 | 200 | function getAccountId(param: string): string { 201 | return TDAnalytics.getAccountId(param) 202 | } 203 | 204 | function getPresetProperties(param: string) { 205 | return TDAnalytics.getPresetProperties(param) 206 | } 207 | 208 | 209 | export { 210 | setCustomerLibInfo, 211 | initWithConfig, 212 | track, 213 | trackUpdate, 214 | trackFirst, 215 | trackOverwrite, 216 | timeEvent, 217 | login, 218 | logout, 219 | setSuperProperties, 220 | getSuperProperties, 221 | unsetSuperProperty, 222 | clearSuperProperties, 223 | userSet, 224 | userSetOnce, 225 | userAppend, 226 | userUniqAppend, 227 | userAdd, 228 | userUnset, 229 | userDel, 230 | flush, 231 | setDistinctId, 232 | getDeviceId, 233 | getDistinctId, 234 | getAccountId, 235 | getPresetProperties 236 | } -------------------------------------------------------------------------------- /src/native/cc/openharmony/TDAnalytics.har: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThinkingDataAnalytics/mp-sdk/1f4d7dd3123496718d129acc9c38177db914a1b4/src/native/cc/openharmony/TDAnalytics.har -------------------------------------------------------------------------------- /src/native/egret/android/ThinkingSDK.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThinkingDataAnalytics/mp-sdk/1f4d7dd3123496718d129acc9c38177db914a1b4/src/native/egret/android/ThinkingSDK.aar -------------------------------------------------------------------------------- /src/native/egret/ios/EgretProxyApi.h: -------------------------------------------------------------------------------- 1 | // 2 | // EgretProxyApi.h 3 | // NewProject-mobile 4 | // 5 | // Created by huangdiao on 2021/7/20. 6 | // 7 | 8 | #import 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface EgretProxyApi : NSObject 14 | 15 | //@property (class, nonatomic, copy) EgretNativeIOS* nativeProxy; 16 | 17 | + (void)registExternalInterface:(EgretNativeIOS *)native; 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /src/native/egret/ios/ThinkingSDK.framework/Headers/TDConfig.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #if __has_include() 4 | #import 5 | #else 6 | #import "TDConstant.h" 7 | #endif 8 | 9 | #if __has_include() 10 | #import 11 | #else 12 | #import "TDSecurityPolicy.h" 13 | #endif 14 | 15 | #if __has_include() 16 | #import 17 | #else 18 | #import "TDSecretKey.h" 19 | #endif 20 | 21 | 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | 26 | 27 | @interface TDConfig:NSObject 28 | /** 29 | 设置自动埋点类型 30 | */ 31 | @property (assign, nonatomic) ThinkingAnalyticsAutoTrackEventType autoTrackEventType; 32 | /** 33 | 数据发送的网络环境 34 | */ 35 | @property (assign, nonatomic) ThinkingNetworkType networkTypePolicy; 36 | /** 37 | 数据上传间隔时间 38 | */ 39 | @property (nonatomic, strong) NSNumber *uploadInterval; 40 | /** 41 | 当有数据上传时,数据缓存的条数达到uploadsize时,立即上传数据 42 | */ 43 | @property (nonatomic, strong) NSNumber *uploadSize; 44 | /** 45 | 事件黑名单,不进行统计的事件名称添加到此处 46 | */ 47 | @property (strong, nonatomic) NSArray *disableEvents; 48 | /** 49 | 最多缓存事件条数,默认10000条,最小为5000条 50 | */ 51 | @property (class, nonatomic) NSInteger maxNumEvents DEPRECATED_MSG_ATTRIBUTE("Please config TAConfigInfo in main info.plist"); 52 | /** 53 | 数据缓存过期时间,默认10天,最长为10天 54 | */ 55 | @property (class, nonatomic) NSInteger expirationDays DEPRECATED_MSG_ATTRIBUTE("Please config TAConfigInfo in main info.plist"); 56 | /** 57 | 应用的唯一appid 58 | */ 59 | @property (atomic, copy) NSString *appid; 60 | /** 61 | 获取实例唯一标识 62 | */ 63 | @property (atomic, copy) NSString *(^getInstanceName)(void); 64 | /** 65 | 数据上传的服务器地址 66 | */ 67 | @property (atomic, copy) NSString *configureURL; 68 | 69 | /** 70 | 初始化配置后台自启事件 YES:采集后台自启事件 NO:不采集后台自启事件 71 | */ 72 | @property (nonatomic, assign) BOOL trackRelaunchedInBackgroundEvents; 73 | /** 74 | 初始化配置 Debug 模式 75 | */ 76 | @property (nonatomic, assign) ThinkingAnalyticsDebugMode debugMode; 77 | 78 | /** 79 | 初始化配置 launchOptions 80 | */ 81 | @property (nonatomic, copy) NSDictionary *launchOptions; 82 | 83 | /** 84 | 初始化配置证书校验策略 85 | */ 86 | @property (nonatomic, strong) TDSecurityPolicy *securityPolicy; 87 | 88 | /** 89 | 设置默认时区 90 | 可以使用该时区,对比当前时间所在时区和默认时区的offset 91 | */ 92 | @property (nonatomic, strong) NSTimeZone *defaultTimeZone; 93 | 94 | /** 95 | 实例的标识 96 | */ 97 | @property (nonatomic, copy) NSString *name; 98 | 99 | + (TDConfig *)defaultTDConfig; 100 | - (instancetype)initWithAppId:(NSString *)appId serverUrl:(NSString *)serverUrl; 101 | - (void)updateConfig:(void(^)(NSDictionary *secretKey))block; 102 | - (void)setNetworkType:(ThinkingAnalyticsNetworkType)type; 103 | 104 | 105 | /// 是否开启加密 106 | @property (nonatomic, assign) BOOL enableEncrypt; 107 | 108 | /// 获取本地密钥配置 109 | @property (nonatomic, strong) TDSecretKey *secretKey; 110 | 111 | /// 获取实例标识 112 | - (NSString *)getMapInstanceToken; 113 | 114 | @end 115 | NS_ASSUME_NONNULL_END 116 | -------------------------------------------------------------------------------- /src/native/egret/ios/ThinkingSDK.framework/Headers/TDConstant.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDConstant.h 3 | // ThinkingSDK 4 | // 5 | // Created by LiHuanan on 2020/9/8. 6 | // Copyright © 2020 thinkingdata. All rights reserved. 7 | // 8 | 9 | #import 10 | /** 11 | Debug 模式 12 | 13 | - ThinkingAnalyticsDebugOff : 默认不开启 Debug 模式 14 | */ 15 | typedef NS_OPTIONS(NSInteger, ThinkingAnalyticsDebugMode) { 16 | /** 17 | 默认不开启 Debug 模式 18 | */ 19 | ThinkingAnalyticsDebugOff = 0, 20 | 21 | /** 22 | 开启 DebugOnly 模式,不入库 23 | */ 24 | ThinkingAnalyticsDebugOnly = 1 << 0, 25 | 26 | /** 27 | 开启 Debug 模式,并入库 28 | */ 29 | ThinkingAnalyticsDebug = 1 << 1, 30 | 31 | /** 32 | 开启 Debug 模式,并入库,等同于 ThinkingAnalyticsDebug 33 | [兼容swift] swift 调用 oc 中的枚举类型,需要遵守 [枚举类型名+枚举值] 的规则。 34 | */ 35 | ThinkingAnalyticsDebugOn = ThinkingAnalyticsDebug, 36 | }; 37 | 38 | 39 | /** 40 | Log 级别 41 | 42 | - TDLoggingLevelNone : 默认不开启 43 | */ 44 | typedef NS_OPTIONS(NSInteger, TDLoggingLevel) { 45 | /** 46 | 默认不开启 47 | */ 48 | TDLoggingLevelNone = 0, 49 | 50 | /** 51 | Error Log 52 | */ 53 | TDLoggingLevelError = 1 << 0, 54 | 55 | /** 56 | Info Log 57 | */ 58 | TDLoggingLevelInfo = 1 << 1, 59 | 60 | /** 61 | Debug Log 62 | */ 63 | TDLoggingLevelDebug = 1 << 2, 64 | }; 65 | 66 | /** 67 | 证书验证模式 68 | */ 69 | typedef NS_OPTIONS(NSInteger, TDSSLPinningMode) { 70 | /** 71 | 默认认证方式,只会在系统的信任的证书列表中对服务端返回的证书进行验证 72 | */ 73 | TDSSLPinningModeNone = 0, 74 | 75 | /** 76 | 校验证书的公钥 77 | */ 78 | TDSSLPinningModePublicKey = 1 << 0, 79 | 80 | /** 81 | 校验证书的所有内容 82 | */ 83 | TDSSLPinningModeCertificate = 1 << 1 84 | }; 85 | 86 | /** 87 | 自定义 HTTPS 认证 88 | */ 89 | typedef NSURLSessionAuthChallengeDisposition (^TDURLSessionDidReceiveAuthenticationChallengeBlock)(NSURLSession *_Nullable session, NSURLAuthenticationChallenge *_Nullable challenge, NSURLCredential *_Nullable __autoreleasing *_Nullable credential); 90 | 91 | 92 | 93 | /** 94 | 上报数据网络条件 95 | 96 | - TDNetworkTypeDefault : 默认 3G、4G、WIFI 97 | */ 98 | typedef NS_OPTIONS(NSInteger, ThinkingAnalyticsNetworkType) { 99 | 100 | /** 101 | 默认 3G、4G、WIFI 102 | */ 103 | TDNetworkTypeDefault = 0, 104 | 105 | /** 106 | 仅WIFI 107 | */ 108 | TDNetworkTypeOnlyWIFI = 1 << 0, 109 | 110 | /** 111 | 2G、3G、4G、WIFI 112 | */ 113 | TDNetworkTypeALL = 1 << 1, 114 | }; 115 | 116 | /** 117 | 自动采集事件 118 | 119 | - ThinkingAnalyticsEventTypeNone : 默认不开启自动埋点 120 | */ 121 | typedef NS_OPTIONS(NSInteger, ThinkingAnalyticsAutoTrackEventType) { 122 | 123 | /** 124 | 默认不开启自动埋点 125 | */ 126 | ThinkingAnalyticsEventTypeNone = 0, 127 | 128 | /* 129 | APP 启动或从后台恢复事件 130 | */ 131 | ThinkingAnalyticsEventTypeAppStart = 1 << 0, 132 | 133 | /** 134 | APP 进入后台事件 135 | */ 136 | ThinkingAnalyticsEventTypeAppEnd = 1 << 1, 137 | 138 | /** 139 | APP 控件点击事件 140 | */ 141 | ThinkingAnalyticsEventTypeAppClick = 1 << 2, 142 | 143 | /** 144 | APP 浏览页面事件 145 | */ 146 | ThinkingAnalyticsEventTypeAppViewScreen = 1 << 3, 147 | 148 | /** 149 | APP 崩溃信息 150 | */ 151 | ThinkingAnalyticsEventTypeAppViewCrash = 1 << 4, 152 | 153 | /** 154 | APP 安装之后的首次打开 155 | */ 156 | ThinkingAnalyticsEventTypeAppInstall = 1 << 5, 157 | /** 158 | 以上全部 APP 事件 159 | */ 160 | ThinkingAnalyticsEventTypeAll = ThinkingAnalyticsEventTypeAppStart | ThinkingAnalyticsEventTypeAppEnd | ThinkingAnalyticsEventTypeAppClick | ThinkingAnalyticsEventTypeAppInstall | ThinkingAnalyticsEventTypeAppViewCrash | ThinkingAnalyticsEventTypeAppViewScreen 161 | 162 | }; 163 | 164 | typedef NS_OPTIONS(NSInteger, ThinkingNetworkType) { 165 | ThinkingNetworkTypeNONE = 0, 166 | ThinkingNetworkType2G = 1 << 0, 167 | ThinkingNetworkType3G = 1 << 1, 168 | ThinkingNetworkType4G = 1 << 2, 169 | ThinkingNetworkTypeWIFI = 1 << 3, 170 | ThinkingNetworkType5G = 1 << 4, 171 | ThinkingNetworkTypeALL = 0xFF, 172 | }; 173 | 174 | 175 | typedef NS_OPTIONS(NSInteger, TAThirdPartyShareType) { 176 | TAThirdPartyShareTypeNONE = 0, 177 | TAThirdPartyShareTypeAPPSFLYER = 1 << 0, 178 | TAThirdPartyShareTypeIRONSOURCE = 1 << 1, 179 | TAThirdPartyShareTypeADJUST = 1 << 2, 180 | TAThirdPartyShareTypeBRANCH = 1 << 3, 181 | TAThirdPartyShareTypeTOPON = 1 << 4, 182 | TAThirdPartyShareTypeTRACKING = 1 << 5, 183 | TAThirdPartyShareTypeTRADPLUS = 1 << 6, 184 | }; 185 | 186 | //MARK: - 数据上报状态 187 | typedef NS_ENUM(NSInteger, TATrackStatus) { 188 | /// 暂停SDK上报 189 | TATrackStatusPause, 190 | /// 停止SDK上报并清除缓存 191 | TATrackStatusStop, 192 | /// 可以入库 暂停发送数据 193 | TATrackStatusSaveOnly, 194 | /// 恢复所有状态 195 | TATrackStatusNormal 196 | }; 197 | -------------------------------------------------------------------------------- /src/native/egret/ios/ThinkingSDK.framework/Headers/TDDeviceInfo.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | FOUNDATION_EXTERN NSString *const VERSION; 6 | 7 | @interface TDDeviceInfo : NSObject 8 | 9 | + (TDDeviceInfo *)sharedManager; 10 | 11 | 12 | @property (nonatomic, copy) NSString *uniqueId;// 默认访客ID,一般是设备ID+安装次数组成 13 | @property (nonatomic, copy) NSString *deviceId;// 设备id 14 | @property (nonatomic, copy) NSString *appVersion;// app版本号 15 | @property (nonatomic, readonly) BOOL isFirstOpen;// 是否是第一次启动 16 | @property (nonatomic, copy) NSString *libName; // 库名称,外层库可以修改该字段 17 | @property (nonatomic, copy) NSString *libVersion;// 库版本号,外层库可以修改该字段 18 | 19 | + (NSString *)libVersion; 20 | + (NSString*)bundleId; 21 | 22 | - (void)td_updateData; 23 | - (NSDictionary *)td_collectProperties; 24 | 25 | + (NSDate *)td_getInstallTime; 26 | 27 | /// 获取属性 28 | /// 注意线程问题 29 | - (NSDictionary *)getAutomaticData; 30 | 31 | // 获取手机供应商信息 32 | + (NSString *)currentRadio; 33 | 34 | @end 35 | 36 | NS_ASSUME_NONNULL_END 37 | -------------------------------------------------------------------------------- /src/native/egret/ios/ThinkingSDK.framework/Headers/TDEditableEventModel.h: -------------------------------------------------------------------------------- 1 | 2 | #if __has_include() 3 | #import 4 | #else 5 | #import "TDEventModel.h" 6 | #endif 7 | 8 | NS_ASSUME_NONNULL_BEGIN 9 | 10 | @interface TDEditableEventModel : TDEventModel 11 | 12 | - (instancetype)initWithEventName:(NSString *)eventName eventID:(NSString *)eventID; 13 | 14 | @end 15 | 16 | @interface TDUpdateEventModel : TDEditableEventModel 17 | 18 | @end 19 | 20 | @interface TDOverwriteEventModel : TDEditableEventModel 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /src/native/egret/ios/ThinkingSDK.framework/Headers/TDEventModel.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | typedef NS_OPTIONS(NSInteger, TimeValueType) { 6 | TDTimeValueTypeNone = 0, 7 | TDTimeValueTypeTimeOnly = 1 << 0, 8 | TDTimeValueTypeAll = 1 << 1, 9 | }; 10 | 11 | typedef NSString *kEDEventTypeName; 12 | 13 | /** 14 | 当eventType为 TD_EVENT_TYPE_TRACK_FIRST 时, 15 | track事件会添加extraID为: #first_check_id 16 | */ 17 | FOUNDATION_EXTERN kEDEventTypeName const TD_EVENT_TYPE_TRACK_FIRST; 18 | 19 | /** 20 | 当eventType为 TD_EVENT_TYPE_TRACK_UPDATE 或 TD_EVENT_TYPE_TRACK_OVERWRITE 时, 21 | track事件会添加extraID为: #event_id 22 | */ 23 | FOUNDATION_EXTERN kEDEventTypeName const TD_EVENT_TYPE_TRACK_UPDATE; 24 | FOUNDATION_EXTERN kEDEventTypeName const TD_EVENT_TYPE_TRACK_OVERWRITE; 25 | 26 | @interface TDEventModel : NSObject 27 | 28 | - (instancetype)init NS_UNAVAILABLE; 29 | + (instancetype)new NS_UNAVAILABLE; 30 | 31 | @property (nonatomic, copy, readonly) NSString *eventName; 32 | @property (nonatomic, copy, readonly) kEDEventTypeName eventType; // Default is TD_EVENT_TYPE_TRACK 33 | 34 | @property (nonatomic, strong) NSDictionary *properties; 35 | 36 | - (void)configTime:(NSDate *)time timeZone:(NSTimeZone * _Nullable)timeZone; 37 | 38 | @end 39 | 40 | NS_ASSUME_NONNULL_END 41 | -------------------------------------------------------------------------------- /src/native/egret/ios/ThinkingSDK.framework/Headers/TDFirstEventModel.h: -------------------------------------------------------------------------------- 1 | 2 | #if __has_include() 3 | #import 4 | #else 5 | #import "TDEventModel.h" 6 | #endif 7 | 8 | 9 | NS_ASSUME_NONNULL_BEGIN 10 | 11 | @interface TDFirstEventModel : TDEventModel 12 | 13 | - (instancetype)initWithEventName:(NSString * _Nullable)eventName; 14 | 15 | - (instancetype)initWithEventName:(NSString * _Nullable)eventName firstCheckID:(NSString *)firstCheckID; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /src/native/egret/ios/ThinkingSDK.framework/Headers/TDPresetProperties.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDPresetProperties.h 3 | // ThinkingSDK 4 | // 5 | // Created by huangdiao on 2021/5/25. 6 | // Copyright © 2021 thinkingdata. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface TDPresetProperties : NSObject 14 | 15 | @property (nonatomic, copy, readonly) NSString *bundle_id; 16 | @property (nonatomic, copy, readonly) NSString *carrier; 17 | @property (nonatomic, copy, readonly) NSString *device_id; 18 | @property (nonatomic, copy, readonly) NSString *device_model; 19 | @property (nonatomic, copy, readonly) NSString *manufacturer; 20 | @property (nonatomic, copy, readonly) NSString *network_type; 21 | @property (nonatomic, copy, readonly) NSString *os; 22 | @property (nonatomic, copy, readonly) NSString *os_version; 23 | @property (nonatomic, copy, readonly) NSNumber *screen_height; 24 | @property (nonatomic, copy, readonly) NSNumber *screen_width; 25 | @property (nonatomic, copy, readonly) NSString *system_language; 26 | @property (nonatomic, copy, readonly) NSNumber *zone_offset; 27 | 28 | /** 29 | * 返回事件预置属性的Key以"#"开头,不建直接作为事件的Property使用 30 | */ 31 | - (NSDictionary *)toEventPresetProperties; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /src/native/egret/ios/ThinkingSDK.framework/Headers/TDSecretKey.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDSecretKey.h 3 | // ThinkingSDK 4 | // 5 | // Created by wwango on 2022/1/21. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface TDSecretKey : NSObject 13 | 14 | /// 初始化密钥信息 15 | /// @param version 密钥版本号 16 | /// @param publicKey 公钥 17 | /// 默认采用RSA+AES加密方式 18 | - (instancetype)initWithVersion:(NSUInteger)version publicKey:(NSString *)publicKey; 19 | 20 | /// 初始化密钥信息 21 | /// @param version 密钥版本号 22 | /// @param publicKey 公钥 23 | /// @param asymmetricEncryption 非对称加密类型 24 | /// @param symmetricEncryption 对称加密类型 25 | - (instancetype)initWithVersion:(NSUInteger)version 26 | publicKey:(NSString *)publicKey 27 | asymmetricEncryption:(NSString *)asymmetricEncryption 28 | symmetricEncryption:(NSString *)symmetricEncryption; 29 | 30 | @property (nonatomic, assign, readonly) NSUInteger version; 31 | @property (nonatomic, copy, readonly) NSString *publicKey; 32 | @property (nonatomic, copy, readonly) NSString *symmetricEncryption; 33 | @property (nonatomic, copy, readonly) NSString *asymmetricEncryption; 34 | 35 | /// 该密钥信息是否可用 36 | @property (nonatomic, assign, readonly) BOOL isValid; 37 | 38 | @end 39 | 40 | NS_ASSUME_NONNULL_END 41 | -------------------------------------------------------------------------------- /src/native/egret/ios/ThinkingSDK.framework/Headers/TDSecurityPolicy.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | 感谢 AFNetworking: https://github.com/AFNetworking/AFNetworking 4 | TDSecurityPolicy与 AFSecurityPolicy 实现基本相同 5 | */ 6 | #import 7 | 8 | #if __has_include() 9 | #import 10 | #else 11 | #import "TDConstant.h" 12 | #endif 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | 17 | @interface TDSecurityPolicy: NSObject 18 | 19 | @property (nonatomic, assign) BOOL allowInvalidCertificates; 20 | @property (nonatomic, assign) BOOL validatesDomainName; 21 | @property (nonatomic, copy) TDURLSessionDidReceiveAuthenticationChallengeBlock sessionDidReceiveAuthenticationChallenge; 22 | + (instancetype)policyWithPinningMode:(TDSSLPinningMode)pinningMode; 23 | + (instancetype)defaultPolicy; 24 | - (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust forDomain:(NSString *)domain; 25 | 26 | @end 27 | 28 | #ifndef __Require_Quiet 29 | #define __Require_Quiet(assertion, exceptionLabel) \ 30 | do \ 31 | { \ 32 | if ( __builtin_expect(!(assertion), 0) ) \ 33 | { \ 34 | goto exceptionLabel; \ 35 | } \ 36 | } while ( 0 ) 37 | #endif 38 | 39 | #ifndef __Require_noErr_Quiet 40 | #define __Require_noErr_Quiet(errorCode, exceptionLabel) \ 41 | do \ 42 | { \ 43 | if ( __builtin_expect(0 != (errorCode), 0) ) \ 44 | { \ 45 | goto exceptionLabel; \ 46 | } \ 47 | } while ( 0 ) 48 | #endif 49 | 50 | 51 | NS_ASSUME_NONNULL_END 52 | -------------------------------------------------------------------------------- /src/native/egret/ios/ThinkingSDK.framework/Headers/ThinkingSDK.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | #if __has_include() 5 | #import 6 | #else 7 | #import "ThinkingAnalyticsSDK.h" 8 | #endif 9 | 10 | #if __has_include() 11 | #import 12 | #else 13 | #import "TDFirstEventModel.h" 14 | #endif 15 | 16 | #if __has_include() 17 | #import 18 | #else 19 | #import "TDEditableEventModel.h" 20 | #endif 21 | 22 | #if __has_include() 23 | #import 24 | #else 25 | #import "TDConfig.h" 26 | #endif 27 | 28 | #if __has_include() 29 | #import 30 | #else 31 | #import "TDPresetProperties.h" 32 | #endif 33 | 34 | #if __has_include() 35 | #import 36 | #else 37 | #import "TDDeviceInfo.h" 38 | #endif 39 | -------------------------------------------------------------------------------- /src/native/egret/ios/ThinkingSDK.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThinkingDataAnalytics/mp-sdk/1f4d7dd3123496718d129acc9c38177db914a1b4/src/native/egret/ios/ThinkingSDK.framework/Info.plist -------------------------------------------------------------------------------- /src/native/egret/ios/ThinkingSDK.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module ThinkingSDK { 2 | umbrella header "ThinkingSDK.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /src/native/egret/ios/ThinkingSDK.framework/ThinkingSDK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThinkingDataAnalytics/mp-sdk/1f4d7dd3123496718d129acc9c38177db914a1b4/src/native/egret/ios/ThinkingSDK.framework/ThinkingSDK -------------------------------------------------------------------------------- /src/native/laya/android/TDAnalytics.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThinkingDataAnalytics/mp-sdk/1f4d7dd3123496718d129acc9c38177db914a1b4/src/native/laya/android/TDAnalytics.aar -------------------------------------------------------------------------------- /src/native/laya/android/TDCore.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThinkingDataAnalytics/mp-sdk/1f4d7dd3123496718d129acc9c38177db914a1b4/src/native/laya/android/TDCore.aar -------------------------------------------------------------------------------- /src/native/laya/ios/LayaProxyApi.h: -------------------------------------------------------------------------------- 1 | // 2 | // LayaProxyApi.h 3 | // NewProject-mobile 4 | // 5 | // Created by huangdiao on 2021/7/20. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface LayaProxyApi : NSObject 13 | 14 | @end 15 | 16 | NS_ASSUME_NONNULL_END 17 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingDataCore.framework/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThinkingDataAnalytics/mp-sdk/1f4d7dd3123496718d129acc9c38177db914a1b4/src/native/laya/ios/ThinkingDataCore.framework/.gitkeep -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingDataCore.framework/Headers/NSData+TDGzip.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface NSData (TDGzip) 4 | 5 | + (NSData *)td_gzipData:(NSData *)dataa; 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingDataCore.framework/Headers/NSObject+TDSwizzle.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | @interface NSObject (TDSwizzle) 5 | 6 | + (BOOL)td_swizzleMethod:(SEL)origSel withMethod:(SEL)altSel error:(NSError **)error; 7 | + (BOOL)td_swizzleClassMethod:(SEL)origSel withClassMethod:(SEL)altSel error:(NSError **)error; 8 | 9 | @end 10 | NS_ASSUME_NONNULL_END 11 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingDataCore.framework/Headers/TAAnnotation.h: -------------------------------------------------------------------------------- 1 | // 2 | // TAAnnotation.h 3 | // Pods 4 | // 5 | // Created by wwango on 2022/10/8. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | #ifndef ThinkingModSectName 13 | 14 | #define ThinkingModSectName "ThinkingMods" 15 | 16 | #endif 17 | 18 | #ifndef ThinkingServiceSectName 19 | 20 | #define ThinkingServiceSectName "ThinkingServices" 21 | 22 | #endif 23 | 24 | 25 | #define ThinkingDATA(sectname) __attribute((used, section("__DATA,"#sectname" "))) 26 | 27 | 28 | #define ThinkingMod(name) \ 29 | char * k##name##_mod ThinkingDATA(ThinkingMods) = ""#name""; 30 | 31 | #define ThinkingService(servicename,impl) \ 32 | char * k##servicename##_service ThinkingDATA(ThinkingServices) = "{ \""#servicename"\" : \""#impl"\"}"; 33 | 34 | @interface TAAnnotation : NSObject 35 | 36 | @end 37 | 38 | NS_ASSUME_NONNULL_END 39 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingDataCore.framework/Headers/TAContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // TAContext.h 3 | // ThinkingSDK.default-Base-Core-Extension-Router-Util-iOS 4 | // 5 | // Created by wwango on 2022/10/7. 6 | // 7 | 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface TAContext : NSObject 14 | 15 | @property(nonatomic, strong) id application; 16 | 17 | @property(nonatomic, strong) NSDictionary *launchOptions; 18 | 19 | @property(atomic, strong) NSDictionary *customParam; 20 | 21 | + (instancetype)shareInstance; 22 | 23 | - (void)addServiceWithImplInstance:(id)implInstance serviceName:(NSString *)serviceName; 24 | 25 | - (void)removeServiceWithServiceName:(NSString *)serviceName; 26 | 27 | - (id)getServiceInstanceFromServiceName:(NSString *)serviceName; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingDataCore.framework/Headers/TAModuleManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // TAModuleManager.h 3 | // Pods 4 | // 5 | // Created by wwango on 2022/10/8. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | typedef NS_ENUM(NSUInteger, TAModuleLevel) 13 | { 14 | TAModuleBasic = 0, 15 | TAModuleNormal = 1 16 | }; 17 | 18 | typedef NS_ENUM(NSInteger, TAModuleEventType) 19 | { 20 | TAMSetupEvent = 0, 21 | TAMInitEvent, 22 | TAMTearDownEvent, 23 | TAMSplashEvent, 24 | TAMQuickActionEvent, 25 | TAMWillResignActiveEvent, 26 | TAMDidEnterBackgroundEvent, 27 | TAMWillEnterForegroundEvent, 28 | TAMDidBecomeActiveEvent, 29 | TAMWillTerminateEvent, 30 | TAMUnmountEvent, 31 | TAMOpenURLEvent, 32 | TAMDidReceiveMemoryWarningEvent, 33 | TAMDidFailToRegisterForRemoteNotificationsEvent, 34 | TAMDidRegisterForRemoteNotificationsEvent, 35 | TAMDidReceiveRemoteNotificationEvent, 36 | TAMDidReceiveLocalNotificationEvent, 37 | TAMWillPresentNotificationEvent, 38 | TAMDidReceiveNotificationResponseEvent, 39 | TAMWillContinueUserActivityEvent, 40 | TAMContinueUserActivityEvent, 41 | TAMDidFailToContinueUserActivityEvent, 42 | TAMDidUpdateUserActivityEvent, 43 | TAMDidCustomEvent = 1000 44 | 45 | }; 46 | 47 | @interface TAModuleManager : NSObject 48 | 49 | + (instancetype)sharedManager; 50 | 51 | // If you do not comply with set Level protocol, the default Normal 52 | - (void)registerDynamicModule:(Class)moduleClass; 53 | 54 | - (void)unRegisterDynamicModule:(Class)moduleClass; 55 | 56 | - (void)loadLocalModules; 57 | 58 | - (void)registedAllModules; 59 | 60 | - (void)registerCustomEvent:(NSInteger)eventType 61 | withModuleInstance:(id)moduleInstance 62 | andSelectorStr:(NSString *)selectorStr; 63 | 64 | - (void)triggerEvent:(NSInteger)eventType; 65 | 66 | - (void)triggerEvent:(NSInteger)eventType withCustomParam:(NSDictionary * _Nullable)customParam; 67 | 68 | 69 | @end 70 | 71 | NS_ASSUME_NONNULL_END 72 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingDataCore.framework/Headers/TAModuleProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // TAModuleProtocol.h 3 | // ThinkingSDK.default-Base-Core-Extension-Router-Util-iOS 4 | // 5 | // Created by wwango on 2022/10/7. 6 | // 7 | 8 | #import 9 | 10 | #define TA_EXPORT_MODULE(isAsync) \ 11 | + (void)load { [[TAModuleManager sharedManager] registerDynamicModule:[self class]]; } \ 12 | -(BOOL)async { return [[NSString stringWithUTF8String:#isAsync] boolValue];} 13 | 14 | @class TAContext; 15 | 16 | 17 | NS_ASSUME_NONNULL_BEGIN 18 | 19 | @protocol TAModuleProtocol 20 | 21 | @optional 22 | 23 | - (void)basicModuleLevel; 24 | 25 | - (NSInteger)modulePriority; 26 | 27 | - (BOOL)async; 28 | 29 | - (void)modSetUp:(TAContext *)context; 30 | 31 | - (void)modInit:(TAContext *)context; 32 | 33 | - (void)modSplash:(TAContext *)context; 34 | 35 | - (void)modQuickAction:(TAContext *)context; 36 | 37 | - (void)modTearDown:(TAContext *)context; 38 | 39 | - (void)modWillResignActive:(TAContext *)context; 40 | 41 | - (void)modDidEnterBackground:(TAContext *)context; 42 | 43 | - (void)modWillEnterForeground:(TAContext *)context; 44 | 45 | - (void)modDidBecomeActive:(TAContext *)context; 46 | 47 | - (void)modWillTerminate:(TAContext *)context; 48 | 49 | - (void)modUnmount:(TAContext *)context; 50 | 51 | - (void)modOpenURL:(TAContext *)context; 52 | 53 | - (void)modDidReceiveMemoryWaring:(TAContext *)context; 54 | 55 | - (void)modDidFailToRegisterForRemoteNotifications:(TAContext *)context; 56 | 57 | - (void)modDidRegisterForRemoteNotifications:(TAContext *)context; 58 | 59 | - (void)modDidReceiveRemoteNotification:(TAContext *)context; 60 | 61 | - (void)modDidReceiveLocalNotification:(TAContext *)context; 62 | 63 | - (void)modWillPresentNotification:(TAContext *)context; 64 | 65 | - (void)modDidReceiveNotificationResponse:(TAContext *)context; 66 | 67 | - (void)modWillContinueUserActivity:(TAContext *)context; 68 | 69 | - (void)modContinueUserActivity:(TAContext *)context; 70 | 71 | - (void)modDidFailToContinueUserActivity:(TAContext *)context; 72 | 73 | - (void)modDidUpdateContinueUserActivity:(TAContext *)context; 74 | 75 | - (void)modHandleWatchKitExtensionRequest:(TAContext *)context; 76 | 77 | - (void)modDidCustomEvent:(TAContext *)context; 78 | 79 | @end 80 | 81 | NS_ASSUME_NONNULL_END 82 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingDataCore.framework/Headers/TARouter.h: -------------------------------------------------------------------------------- 1 | // 2 | // TARouter.h 3 | // Pods 4 | // 5 | // Created by wwango on 2022/10/8. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | static NSString *const TARURLSchemeGlobalKey = @"URLGlobalScheme"; 13 | static NSString *const TARURLHostCallService = @"call.service.thinkingdata"; 14 | static NSString *const TARURLHostRegister = @"register.thinking"; 15 | static NSString *const TARURLSubPathSplitPattern = @"."; 16 | static NSString *const TARURLQueryParamsKey = @"params"; 17 | 18 | typedef void(^TARPathComponentCustomHandler)(NSDictionary *params); 19 | 20 | @interface TARouter : NSObject 21 | 22 | - (instancetype)init NS_UNAVAILABLE; 23 | + (instancetype)new NS_UNAVAILABLE; 24 | 25 | + (instancetype)globalRouter; 26 | + (instancetype)routerForScheme:(NSString *)scheme; 27 | 28 | //url - > com.thinkingdata://call.service/pathComponentKey.protocolName.selector/...?params={}(value url encode) 29 | + (BOOL)canOpenURL:(NSURL *)URL; 30 | + (BOOL)openURL:(NSURL *)URL; 31 | + (BOOL)openURL:(NSURL *)URL 32 | withParams:(NSDictionary *> *)params; 33 | + (BOOL)openURL:(NSURL *)URL 34 | withParams:(NSDictionary *> *)params 35 | andThen:(void(^)(NSString *pathComponentKey, id obj, id returnValue))then; 36 | @end 37 | 38 | NS_ASSUME_NONNULL_END 39 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingDataCore.framework/Headers/TAServiceManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // TAServiceManager.h 3 | // ThinkingSDK.default-Base-Core-Extension-Router-Util-iOS 4 | // 5 | // Created by wwango on 2022/10/7. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface TAServiceManager : NSObject 13 | 14 | @property (nonatomic, assign) BOOL enableException; 15 | 16 | + (instancetype)sharedManager; 17 | 18 | - (void)registerLocalServices; 19 | 20 | - (void)registerService:(Protocol *)service implClass:(Class)implClass; 21 | 22 | - (id)createService:(Protocol *)service; 23 | - (id)createService:(Protocol *)service withServiceName:(NSString *)serviceName; 24 | - (id)createService:(Protocol *)service withServiceName:(NSString *)serviceName shouldCache:(BOOL)shouldCache; 25 | 26 | @end 27 | 28 | NS_ASSUME_NONNULL_END 29 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingDataCore.framework/Headers/TAServiceProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // TAServiceProtocol.h 3 | // ThinkingSDK.default-Base-Core-Extension-Router-Util-iOS 4 | // 5 | // Created by wwango on 2022/10/7. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @protocol TAServiceProtocol 13 | 14 | @optional 15 | 16 | + (BOOL)singleton; 17 | 18 | + (id)shareInstance; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingDataCore.framework/Headers/TDClassHelper.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | NS_ASSUME_NONNULL_BEGIN 5 | 6 | @interface TDClassHelper : NSObject 7 | 8 | + (Class _Nullable)allocateClassWithObject:(id)object className:(NSString *)className; 9 | 10 | + (void)registerClass:(Class)cla; 11 | 12 | + (BOOL)setObject:(id)object toClass:(Class)cla; 13 | 14 | @end 15 | 16 | NS_ASSUME_NONNULL_END 17 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingDataCore.framework/Headers/TDJSONUtil.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | @interface TDJSONUtil : NSObject 6 | 7 | + (NSString *)JSONStringForObject:(id)object; 8 | 9 | + (NSData *)JSONSerializeForObject:(id)object; 10 | 11 | @end 12 | 13 | NS_ASSUME_NONNULL_END 14 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingDataCore.framework/Headers/TDMethodHelper.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | NS_ASSUME_NONNULL_BEGIN 5 | 6 | @interface TDMethodHelper : NSObject 7 | 8 | + (IMP)implementationOfMethodSelector:(SEL)selector fromClass:(Class)aClass; 9 | 10 | + (void)addInstanceMethodWithSelector:(SEL)methodSelector fromClass:(Class)fromClass toClass:(Class)toClass; 11 | 12 | + (void)addInstanceMethodWithDestinationSelector:(SEL)destinationSelector sourceSelector:(SEL)sourceSelector fromClass:(Class)fromClass toClass:(Class)toClass; 13 | 14 | + (void)addClassMethodWithDestinationSelector:(SEL)destinationSelector sourceSelector:(SEL)sourceSelector fromClass:(Class)fromClass toClass:(Class)toClass; 15 | 16 | + (IMP _Nullable)replaceInstanceMethodWithDestinationSelector:(SEL)destinationSelector sourceSelector:(SEL)sourceSelector fromClass:(Class)fromClass toClass:(Class)toClass; 17 | 18 | /// swizzle respondsToSelector 方法 19 | /// 用于处理未实现代理方法也能采集事件的逻辑 20 | + (void)swizzleRespondsToSelector; 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingDataCore.framework/Headers/TDNewSwizzle.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | NS_ASSUME_NONNULL_BEGIN 5 | 6 | @interface NSObject (TDNewSwizzle) 7 | 8 | + (BOOL)td_new_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError **)error_; 9 | + (BOOL)td_new_swizzleClassMethod:(SEL)origSel_ withClassMethod:(SEL)altSel_ error:(NSError **)error_; 10 | + (BOOL)td_new_swizzleMethod:(SEL)origSel_ withClass:(Class)altCla_ withMethod:(SEL)altSel_ error:(NSError **)error_; 11 | 12 | @end 13 | 14 | NS_ASSUME_NONNULL_END 15 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingDataCore.framework/Headers/TDSwizzler.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #pragma clang diagnostic push 4 | #pragma clang diagnostic ignored "-Wstrict-prototypes" 5 | typedef void (^swizzleBlock)(); 6 | #pragma clang diagnostic pop 7 | 8 | @interface TDSwizzler : NSObject 9 | 10 | + (void)swizzleSelector:(SEL)aSelector onClass:(Class)aClass withBlock:(swizzleBlock)block named:(NSString *)aName; 11 | + (void)unswizzleSelector:(SEL)aSelector onClass:(Class)aClass named:(NSString *)aName; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingDataCore.framework/Headers/ThinkingDataCore.h: -------------------------------------------------------------------------------- 1 | // 2 | // ThinkingDataCore.h 3 | // ThinkingDataCore 4 | // 5 | // Created by Hale on 2023/7/24. 6 | // 7 | 8 | #import 9 | 10 | //! Project version number for ThinkingDataCore. 11 | FOUNDATION_EXPORT double ThinkingDataCoreVersionNumber; 12 | 13 | //! Project version string for ThinkingDataCore. 14 | FOUNDATION_EXPORT const unsigned char ThinkingDataCoreVersionString[]; 15 | 16 | // In this header, you should import all the public headers of your framework using statements like #import 17 | 18 | #import 19 | #import 20 | #import 21 | #import 22 | #import 23 | #import 24 | #import 25 | #import 26 | #import 27 | #import 28 | #import 29 | #import 30 | #import 31 | #import 32 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingDataCore.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThinkingDataAnalytics/mp-sdk/1f4d7dd3123496718d129acc9c38177db914a1b4/src/native/laya/ios/ThinkingDataCore.framework/Info.plist -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingDataCore.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module ThinkingDataCore { 2 | umbrella header "ThinkingDataCore.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingDataCore.framework/ThinkingDataCore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThinkingDataAnalytics/mp-sdk/1f4d7dd3123496718d129acc9c38177db914a1b4/src/native/laya/ios/ThinkingDataCore.framework/ThinkingDataCore -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Headers/TDAnalytics+ThirdParty.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDAnalytics+ThirdParty.h 3 | // ThinkingSDK 4 | // 5 | // Created by 杨雄 on 2023/8/17. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface TDAnalytics (ThirdParty) 13 | 14 | #if TARGET_OS_IOS 15 | 16 | + (void)enableThirdPartySharing:(TDThirdPartyType)type API_UNAVAILABLE(macos); 17 | + (void)enableThirdPartySharing:(TDThirdPartyType)type properties:(NSDictionary *)properties API_UNAVAILABLE(macos); 18 | 19 | + (void)enableThirdPartySharing:(TDThirdPartyType)type withAppId:(NSString *)appId API_UNAVAILABLE(macos); 20 | + (void)enableThirdPartySharing:(TDThirdPartyType)type properties:(NSDictionary *)properties withAppId:(NSString *)appId API_UNAVAILABLE(macos); 21 | 22 | #endif 23 | 24 | @end 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Headers/TDAnalytics+WebView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDAnalytics+WebView.h 3 | // ThinkingSDK 4 | // 5 | // Created by 杨雄 on 2023/8/17. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface TDAnalytics (WebView) 13 | 14 | /// H5 is connected with the native APP SDK and used in conjunction with the addWebViewUserAgent interface 15 | /// @param webView webView 16 | /// @param request NSURLRequest request 17 | /// @return YES:Process this request NO: This request has not been processed 18 | + (BOOL)showUpWebView:(id)webView withRequest:(NSURLRequest *)request; 19 | 20 | /// When connecting data with H5, you need to call this interface to configure UserAgent 21 | + (void)addWebViewUserAgent; 22 | 23 | /// H5 is connected with the native APP SDK and used in conjunction with the addWebViewUserAgent interface 24 | /// @param webView webView 25 | /// @param request NSURLRequest request 26 | /// @param appId appId 27 | /// @return YES:Process this request NO: This request has not been processed 28 | + (BOOL)showUpWebView:(id)webView withRequest:(NSURLRequest *)request withAppId:(NSString * _Nullable)appId; 29 | 30 | @end 31 | 32 | NS_ASSUME_NONNULL_END 33 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Headers/TDAnalytics.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDAnalytics.h 3 | // ThinkingSDK 4 | // 5 | // Created by 杨雄 on 2023/8/17. 6 | // 7 | 8 | #import 9 | 10 | #if TARGET_OS_IOS 11 | #import 12 | 13 | #if __has_include() 14 | #import 15 | #else 16 | #import "TDAutoTrackPublicHeader.h" 17 | #endif 18 | 19 | #elif TARGET_OS_OSX 20 | #import 21 | 22 | #endif 23 | 24 | #if __has_include() 25 | #import 26 | #else 27 | #import "TDFirstEventModel.h" 28 | #endif 29 | 30 | #if __has_include() 31 | #import 32 | #else 33 | #import "TDEditableEventModel.h" 34 | #endif 35 | 36 | 37 | #if __has_include() 38 | #import 39 | #else 40 | #import "TDConfig.h" 41 | #endif 42 | 43 | #if __has_include() 44 | #import 45 | #else 46 | #import "TDPresetProperties.h" 47 | #endif 48 | 49 | 50 | NS_ASSUME_NONNULL_BEGIN 51 | 52 | @interface TDAnalytics : NSObject 53 | 54 | @end 55 | 56 | NS_ASSUME_NONNULL_END 57 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Headers/TDAutoTrackConst.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDAutoTrackConst.h 3 | // Pods 4 | // 5 | // Created by 杨雄 on 2023/7/23. 6 | // 7 | 8 | #ifndef TDAutoTrackConst_h 9 | #define TDAutoTrackConst_h 10 | 11 | #import 12 | 13 | typedef NS_OPTIONS(NSInteger, TDAutoTrackEventType) { 14 | TDAutoTrackEventTypeNone = 0, 15 | TDAutoTrackEventTypeAppStart = 1 << 0, 16 | TDAutoTrackEventTypeAppEnd = 1 << 1, 17 | TDAutoTrackEventTypeAppClick = 1 << 2, 18 | TDAutoTrackEventTypeAppViewScreen = 1 << 3, 19 | TDAutoTrackEventTypeAppViewCrash = 1 << 4, 20 | TDAutoTrackEventTypeAppInstall = 1 << 5, 21 | TDAutoTrackEventTypeAll = TDAutoTrackEventTypeAppStart | TDAutoTrackEventTypeAppEnd | TDAutoTrackEventTypeAppClick | TDAutoTrackEventTypeAppInstall | TDAutoTrackEventTypeAppViewCrash | TDAutoTrackEventTypeAppViewScreen 22 | }; 23 | 24 | static NSString * const TD_APP_START_EVENT = @"ta_app_start"; 25 | static NSString * const TD_APP_START_BACKGROUND_EVENT = @"ta_app_bg_start"; 26 | static NSString * const TD_APP_END_EVENT = @"ta_app_end"; 27 | static NSString * const TD_APP_VIEW_EVENT = @"ta_app_view"; 28 | static NSString * const TD_APP_CLICK_EVENT = @"ta_app_click"; 29 | static NSString * const TD_APP_CRASH_EVENT = @"ta_app_crash"; 30 | static NSString * const TD_APP_INSTALL_EVENT = @"ta_app_install"; 31 | 32 | #endif /* TDAutoTrackConst_h */ 33 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Headers/TDAutoTrackProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDAutoTrackProtocol.h 3 | // ThinkingSDK 4 | // 5 | // Created by Yangxiongon 2022/7/1. 6 | // 7 | 8 | #ifndef TDAutoTrackProtocol_h 9 | #define TDAutoTrackProtocol_h 10 | 11 | #import 12 | 13 | @protocol TDUIViewAutoTrackDelegate 14 | 15 | @optional 16 | 17 | /** 18 | UITableView event properties 19 | 20 | @return event properties 21 | */ 22 | - (NSDictionary *)thinkingAnalytics_tableView:(UITableView *)tableView autoTrackPropertiesAtIndexPath:(NSIndexPath *)indexPath; 23 | 24 | /** 25 | APPID UITableView event properties 26 | 27 | @return event properties 28 | */ 29 | - (NSDictionary *)thinkingAnalyticsWithAppid_tableView:(UITableView *)tableView autoTrackPropertiesAtIndexPath:(NSIndexPath *)indexPath; 30 | 31 | @optional 32 | 33 | /** 34 | UICollectionView event properties 35 | 36 | @return event properties 37 | */ 38 | - (NSDictionary *)thinkingAnalytics_collectionView:(UICollectionView *)collectionView autoTrackPropertiesAtIndexPath:(NSIndexPath *)indexPath; 39 | 40 | /** 41 | APPID UICollectionView event properties 42 | 43 | @return event properties 44 | */ 45 | - (NSDictionary *)thinkingAnalyticsWithAppid_collectionView:(UICollectionView *)collectionView autoTrackPropertiesAtIndexPath:(NSIndexPath *)indexPath; 46 | 47 | @end 48 | 49 | 50 | @protocol TDAutoTracker 51 | 52 | @optional 53 | 54 | - (NSDictionary *)getTrackProperties; 55 | 56 | 57 | - (NSDictionary *)getTrackPropertiesWithAppid; 58 | 59 | @end 60 | 61 | /** 62 | Automatically track the page 63 | */ 64 | @protocol TDScreenAutoTracker 65 | 66 | @optional 67 | 68 | /** 69 | Attributes for custom page view events 70 | */ 71 | - (NSString *)getScreenUrl; 72 | 73 | /** 74 | Configure the properties of the APPID custom page view event 75 | */ 76 | - (NSDictionary *)getScreenUrlWithAppid; 77 | 78 | @end 79 | 80 | #endif /* TDAutoTrackProtocol_h */ 81 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Headers/TDAutoTrackPublicHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDAutoTrackPublicHeader.h 3 | // ThinkingSDK 4 | // 5 | // Created by Yangxiongon 2022/7/1. 6 | // 7 | 8 | #ifndef TDAutoTrackPublicHeader_h 9 | #define TDAutoTrackPublicHeader_h 10 | 11 | #if __has_include() 12 | #import 13 | #else 14 | #import "TDAutoTrackProtocol.h" 15 | #endif 16 | 17 | #if __has_include() 18 | #import 19 | #else 20 | #import "UIView+ThinkingAnalytics.h" 21 | #endif 22 | 23 | #if __has_include() 24 | #import 25 | #else 26 | #import "TDAutoTrackConst.h" 27 | #endif 28 | 29 | #endif /* TDAutoTrackPublicHeader_h */ 30 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Headers/TDConfig.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #if __has_include() 4 | #import 5 | #else 6 | #import "TDConstant.h" 7 | #endif 8 | 9 | #if __has_include() 10 | #import 11 | #else 12 | #import "TDSecurityPolicy.h" 13 | #endif 14 | 15 | #if TARGET_OS_IOS 16 | #if __has_include() 17 | #import 18 | #else 19 | #import "TDSecretKey.h" 20 | #endif 21 | #endif 22 | 23 | NS_ASSUME_NONNULL_BEGIN 24 | 25 | @interface TDConfig:NSObject 26 | 27 | /// app id 28 | @property (atomic, copy) NSString *appid; 29 | 30 | /// server url 31 | @property (atomic, copy) NSString *configureURL; 32 | 33 | /// SDK mode 34 | @property (nonatomic, assign) TDMode mode; 35 | 36 | /// Set default time zone. 37 | /// You can use this time zone to compare the offset of the current time zone and the default time zone 38 | @property (nonatomic, strong) NSTimeZone *defaultTimeZone; 39 | 40 | /// SDK instance name 41 | @property (nonatomic, copy) NSString *name; 42 | 43 | /// Set the network environment for reporting data 44 | @property (nonatomic, assign) TDReportingNetworkType reportingNetworkType; 45 | 46 | /// Data upload interval 47 | @property (nonatomic, strong) NSNumber *uploadInterval; 48 | 49 | /// When there is data to upload, when the number of data cache reaches the uploadsize, upload the data immediately 50 | @property (nonatomic, strong) NSNumber *uploadSize; 51 | 52 | /// Event blacklist, event names that are not counted are added here 53 | @property (strong, nonatomic) NSArray *disableEvents; 54 | 55 | /// instance Token 56 | @property (atomic, copy) NSString *(^getInstanceName)(void); 57 | 58 | /// Initialize and configure background self-starting events 59 | /// YES: Collect background self-starting events 60 | /// NO: Do not collect background self-starting events 61 | @property (nonatomic, assign) BOOL trackRelaunchedInBackgroundEvents; 62 | 63 | /// app launchOptions 64 | @property (nonatomic, copy) NSDictionary *launchOptions; 65 | 66 | /// Initialize and configure the certificate verification policy 67 | @property (nonatomic, strong) TDSecurityPolicy *securityPolicy; 68 | 69 | /// share data with App Extension 70 | @property (nonatomic, copy) NSString *appGroupName; 71 | 72 | @property (nonatomic, assign) BOOL enableReceiptPush; 73 | 74 | #if TARGET_OS_IOS 75 | /// enable encryption 76 | @property (nonatomic, assign) BOOL enableEncrypt DEPRECATED_MSG_ATTRIBUTE("Deprecated. replace with: -enableEncryptWithVersion:publicKey:"); 77 | /// Get local key configuration 78 | @property (nonatomic, strong) TDSecretKey *secretKey DEPRECATED_MSG_ATTRIBUTE("Deprecated. replace with: -enableEncryptWithVersion:publicKey:"); 79 | #endif 80 | /** 81 | Debug Mode 82 | */ 83 | @property (nonatomic, assign) ThinkingAnalyticsDebugMode debugMode DEPRECATED_MSG_ATTRIBUTE("Deprecated. replace with property: mode"); 84 | /** 85 | Network environment for data transmission 86 | */ 87 | @property (assign, nonatomic) ThinkingNetworkType networkTypePolicy DEPRECATED_MSG_ATTRIBUTE("Deprecated. don't need this property"); 88 | /** 89 | Set automatic burying type 90 | */ 91 | @property (assign, nonatomic) ThinkingAnalyticsAutoTrackEventType autoTrackEventType DEPRECATED_MSG_ATTRIBUTE("Deprecated. don't need this property"); 92 | /** 93 | The maximum number of cached events, the default is 10000, the minimum is 5000 94 | */ 95 | @property (class, nonatomic) NSInteger maxNumEvents DEPRECATED_MSG_ATTRIBUTE("Please config TAConfigInfo in main info.plist"); 96 | /** 97 | Data cache expiration time, the default is 10 days, the longest is 10 days 98 | */ 99 | @property (class, nonatomic) NSInteger expirationDays DEPRECATED_MSG_ATTRIBUTE("Please config TAConfigInfo in main info.plist"); 100 | 101 | - (void)setNetworkType:(ThinkingAnalyticsNetworkType)type DEPRECATED_MSG_ATTRIBUTE("Deprecated. replace with: -setUploadNetworkType:"); 102 | - (void)updateConfig:(void(^)(NSDictionary *dict))block DEPRECATED_MSG_ATTRIBUTE("Deprecated"); 103 | - (NSString *)getMapInstanceToken DEPRECATED_MSG_ATTRIBUTE("Deprecated"); 104 | + (TDConfig *)defaultTDConfig DEPRECATED_MSG_ATTRIBUTE("Deprecated"); 105 | 106 | /// Initialize the SDK config file 107 | /// @param appId project app Id 108 | /// @param serverUrl Thinking Engine receiver url 109 | - (instancetype)initWithAppId:(NSString *)appId serverUrl:(NSString *)serverUrl; 110 | 111 | /// enable encrypt 112 | /// @param version version of the encryption configuration file 113 | /// @param publicKey public key 114 | - (void)enableEncryptWithVersion:(NSUInteger)version publicKey:(NSString *)publicKey; 115 | 116 | @end 117 | NS_ASSUME_NONNULL_END 118 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Headers/TDConstant.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDConstant.h 3 | // ThinkingSDK 4 | // 5 | // Created by LiHuanan on 2020/9/8. 6 | // Copyright © 2020 thinkingdata. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | Log Level 13 | 14 | - TDLoggingLevelNone : Not enabled by default 15 | */ 16 | typedef NS_OPTIONS(NSInteger, TDLoggingLevel) { 17 | /** 18 | Not enabled by default 19 | */ 20 | TDLoggingLevelNone = 0, 21 | 22 | /** 23 | Error Log 24 | */ 25 | TDLoggingLevelError = 1 << 0, 26 | 27 | 28 | /** 29 | Warning Log 30 | */ 31 | TDLoggingLevelWarning = 1 << 1, 32 | 33 | /** 34 | Info Log 35 | */ 36 | TDLoggingLevelInfo = 1 << 2, 37 | 38 | /** 39 | Debug Log 40 | */ 41 | TDLoggingLevelDebug = 1 << 3, 42 | }; 43 | 44 | /** 45 | Debug Mode 46 | 47 | - ThinkingAnalyticsDebugOff : Not enabled by default 48 | */ 49 | __attribute__((deprecated("This class is deprecated. Use the newClass instead: TDMode"))) 50 | typedef NS_OPTIONS(NSInteger, ThinkingAnalyticsDebugMode) { 51 | /** 52 | Not enabled by default 53 | */ 54 | ThinkingAnalyticsDebugOff = 0, 55 | 56 | /** 57 | Enable DebugOnly Mode, Data is not persisted 58 | */ 59 | ThinkingAnalyticsDebugOnly = 1 << 0, 60 | 61 | /** 62 | Enable Debug Mode,Data will persist 63 | */ 64 | ThinkingAnalyticsDebug = 1 << 1, 65 | 66 | /** 67 | Enable Debug Mode,Data will persist,Equivalent to ThinkingAnalyticsDebug 68 | */ 69 | ThinkingAnalyticsDebugOn = ThinkingAnalyticsDebug, 70 | }; 71 | 72 | /** 73 | Debug Mode 74 | 75 | - ThinkingAnalyticsDebugOff : Not enabled by default 76 | */ 77 | typedef NS_OPTIONS(NSInteger, TDMode) { 78 | /** 79 | Not enabled by default 80 | */ 81 | TDModeNormal = 0, 82 | 83 | /** 84 | Enable DebugOnly Mode, Data is not persisted 85 | */ 86 | TDModeDebugOnly = 1 << 0, 87 | 88 | /** 89 | Enable Debug Mode,Data will persist 90 | */ 91 | TDModeDebug = 1 << 1, 92 | }; 93 | 94 | 95 | /** 96 | Https Certificate Verification Mode 97 | */ 98 | typedef NS_OPTIONS(NSInteger, TDSSLPinningMode) { 99 | /** 100 | The default authentication method will only verify the certificate returned by the server in the system's trusted certificate list 101 | */ 102 | TDSSLPinningModeNone = 0, 103 | 104 | /** 105 | The public key of the verification certificate 106 | */ 107 | TDSSLPinningModePublicKey = 1 << 0, 108 | 109 | /** 110 | Verify all contents of the certificate 111 | */ 112 | TDSSLPinningModeCertificate = 1 << 1 113 | }; 114 | 115 | /** 116 | Custom HTTPS Authentication 117 | */ 118 | typedef NSURLSessionAuthChallengeDisposition (^TDURLSessionDidReceiveAuthenticationChallengeBlock)(NSURLSession *_Nullable session, NSURLAuthenticationChallenge *_Nullable challenge, NSURLCredential *_Nullable __autoreleasing *_Nullable credential); 119 | 120 | 121 | 122 | /** 123 | Network Type Enum 124 | 125 | - TDNetworkTypeDefault : 3G、4G、WIFI 126 | */ 127 | __attribute__((deprecated("This class is deprecated. Use the newClass instead: TDReportingNetworkType"))) 128 | typedef NS_OPTIONS(NSInteger, ThinkingAnalyticsNetworkType) { 129 | 130 | /** 131 | only WIFI 132 | */ 133 | TDNetworkTypeOnlyWIFI = 1 << 0, 134 | 135 | /** 136 | 2G、3G、4G、WIFI 137 | */ 138 | TDNetworkTypeALL = 1 << 1, 139 | 140 | /** 141 | 3G、4G、WIFI 142 | */ 143 | TDNetworkTypeDefault = TDNetworkTypeALL, 144 | }; 145 | 146 | typedef NS_OPTIONS(NSInteger, TDReportingNetworkType) { 147 | TDReportingNetworkTypeWIFI = 1 << 0, 148 | TDReportingNetworkTypeALL = 1 << 1, 149 | }; 150 | 151 | /** 152 | Auto-Tracking Enum 153 | 154 | - ThinkingAnalyticsEventTypeNone : auto-tracking is not enabled by default 155 | */ 156 | __attribute__((deprecated("This class is deprecated. Use the newClass instead: TDAutoTrackEventType"))) 157 | typedef NS_OPTIONS(NSInteger, ThinkingAnalyticsAutoTrackEventType) { 158 | 159 | /** 160 | auto-tracking is not enabled by default 161 | */ 162 | ThinkingAnalyticsEventTypeNone = 0, 163 | 164 | /* 165 | Active Events 166 | */ 167 | ThinkingAnalyticsEventTypeAppStart = 1 << 0, 168 | 169 | /** 170 | Inactive Events 171 | */ 172 | ThinkingAnalyticsEventTypeAppEnd = 1 << 1, 173 | 174 | /** 175 | Clicked events 176 | */ 177 | ThinkingAnalyticsEventTypeAppClick = 1 << 2, 178 | 179 | /** 180 | View Page Events 181 | */ 182 | ThinkingAnalyticsEventTypeAppViewScreen = 1 << 3, 183 | 184 | /** 185 | Crash Events 186 | */ 187 | ThinkingAnalyticsEventTypeAppViewCrash = 1 << 4, 188 | 189 | /** 190 | Installation Events 191 | */ 192 | ThinkingAnalyticsEventTypeAppInstall = 1 << 5, 193 | /** 194 | All Events 195 | */ 196 | ThinkingAnalyticsEventTypeAll = ThinkingAnalyticsEventTypeAppStart | ThinkingAnalyticsEventTypeAppEnd | ThinkingAnalyticsEventTypeAppClick | ThinkingAnalyticsEventTypeAppInstall | ThinkingAnalyticsEventTypeAppViewCrash | ThinkingAnalyticsEventTypeAppViewScreen 197 | 198 | }; 199 | 200 | typedef NS_OPTIONS(NSInteger, ThinkingNetworkType) { 201 | ThinkingNetworkTypeNONE = 0, 202 | ThinkingNetworkType2G = 1 << 0, 203 | ThinkingNetworkType3G = 1 << 1, 204 | ThinkingNetworkType4G = 1 << 2, 205 | ThinkingNetworkTypeWIFI = 1 << 3, 206 | ThinkingNetworkType5G = 1 << 4, 207 | ThinkingNetworkTypeALL = 0xFF, 208 | }; 209 | 210 | 211 | typedef NS_OPTIONS(NSInteger, TDThirdPartyType) { 212 | TDThirdPartyTypeNone = 0, 213 | TDThirdPartyTypeAppsFlyer = 1 << 0, 214 | TDThirdPartyTypeIronSource = 1 << 1, 215 | TDThirdPartyTypeAdjust = 1 << 2, 216 | TDThirdPartyTypeBranch = 1 << 3, 217 | TDThirdPartyTypeTopOn = 1 << 4, 218 | TDThirdPartyTypeTracking = 1 << 5, 219 | TDThirdPartyTypeTradPlus = 1 << 6, 220 | TDThirdPartyTypeAppLovin = 1 << 7, 221 | TDThirdPartyTypeKochava = 1 << 8, 222 | TDThirdPartyTypeTalkingData = 1 << 9, 223 | TDThirdPartyTypeFirebase = 1 << 10, 224 | }; 225 | 226 | __attribute__((deprecated("This class is deprecated. Use the newClass instead: TDThirdPartyType"))) 227 | typedef NS_OPTIONS(NSUInteger, TAThirdPartyShareType) { 228 | TAThirdPartyShareTypeNONE = TDThirdPartyTypeNone, 229 | TAThirdPartyShareTypeAPPSFLYER = TDThirdPartyTypeAppsFlyer, 230 | TAThirdPartyShareTypeIRONSOURCE = TDThirdPartyTypeIronSource, 231 | TAThirdPartyShareTypeADJUST = TDThirdPartyTypeAdjust, 232 | TAThirdPartyShareTypeBRANCH = TDThirdPartyTypeBranch, 233 | TAThirdPartyShareTypeTOPON = TDThirdPartyTypeTopOn, 234 | TAThirdPartyShareTypeTRACKING = TDThirdPartyTypeTracking, 235 | TAThirdPartyShareTypeTRADPLUS = TDThirdPartyTypeTradPlus, 236 | TAThirdPartyShareTypeAPPLOVIN = TDThirdPartyTypeAppLovin, 237 | TAThirdPartyShareTypeKOCHAVA = TDThirdPartyTypeKochava, 238 | TAThirdPartyShareTypeTALKINGDATA = TDThirdPartyTypeTalkingData, 239 | TAThirdPartyShareTypeFIREBASE = TDThirdPartyTypeFirebase, 240 | 241 | TDThirdPartyShareTypeNONE = TAThirdPartyShareTypeNONE, 242 | TDThirdPartyShareTypeAPPSFLYER = TAThirdPartyShareTypeAPPSFLYER, 243 | TDThirdPartyShareTypeIRONSOURCE = TAThirdPartyShareTypeIRONSOURCE, 244 | TDThirdPartyShareTypeADJUST = TAThirdPartyShareTypeADJUST, 245 | TDThirdPartyShareTypeBRANCH = TAThirdPartyShareTypeBRANCH, 246 | TDThirdPartyShareTypeTOPON = TAThirdPartyShareTypeTOPON, 247 | TDThirdPartyShareTypeTRACKING = TAThirdPartyShareTypeTRACKING, 248 | TDThirdPartyShareTypeTRADPLUS = TAThirdPartyShareTypeTRADPLUS, 249 | }; 250 | 251 | //MARK: - Data reporting status 252 | typedef NS_ENUM(NSInteger, TDTrackStatus) { 253 | /// Suspend reporting 254 | TDTrackStatusPause, 255 | /// Stop reporting and clear cache 256 | TDTrackStatusStop, 257 | /// Suspend reporting and continue to persist data 258 | TDTrackStatusSaveOnly, 259 | /// reset normal 260 | TDTrackStatusNormal 261 | }; 262 | 263 | 264 | //MARK: - Data reporting status 265 | __attribute__((deprecated("This class is deprecated. Use the newClass instead: TDTrackStatus"))) 266 | typedef NS_ENUM(NSInteger, TATrackStatus) { 267 | /// Suspend reporting 268 | TATrackStatusPause, 269 | /// Stop reporting and clear cache 270 | TATrackStatusStop, 271 | /// Suspend reporting and continue to persist data 272 | TATrackStatusSaveOnly, 273 | /// reset normal 274 | TATrackStatusNormal 275 | }; 276 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Headers/TDDeviceInfo.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | FOUNDATION_EXTERN NSString *const VERSION; 6 | 7 | @interface TDDeviceInfo : NSObject 8 | 9 | + (TDDeviceInfo *)sharedManager; 10 | 11 | 12 | @property (nonatomic, copy) NSString *uniqueId; 13 | @property (nonatomic, copy) NSString *deviceId; 14 | @property (nonatomic, copy) NSString *appVersion; 15 | @property (nonatomic, readonly) BOOL isFirstOpen; 16 | @property (nonatomic, copy) NSString *libName; 17 | @property (nonatomic, copy) NSString *libVersion; 18 | 19 | + (NSString *)libVersion; 20 | + (NSString*)bundleId; 21 | 22 | - (void)td_updateData; 23 | - (NSDictionary *)td_collectProperties; 24 | 25 | + (NSDate *)td_getInstallTime; 26 | 27 | - (NSDictionary *)getAutomaticData; 28 | 29 | + (NSString *)currentRadio; 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Headers/TDEditableEventModel.h: -------------------------------------------------------------------------------- 1 | 2 | #if __has_include() 3 | #import 4 | #else 5 | #import "TDUpdateEventModel.h" 6 | #endif 7 | 8 | #if __has_include() 9 | #import 10 | #else 11 | #import "TDOverwriteEventModel.h" 12 | #endif 13 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Headers/TDEventModel.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | typedef NSString *kEDEventTypeName; 6 | 7 | FOUNDATION_EXTERN kEDEventTypeName const TD_EVENT_TYPE_TRACK_FIRST; 8 | FOUNDATION_EXTERN kEDEventTypeName const TD_EVENT_TYPE_TRACK_UPDATE; 9 | FOUNDATION_EXTERN kEDEventTypeName const TD_EVENT_TYPE_TRACK_OVERWRITE; 10 | 11 | @interface TDEventModel : NSObject 12 | 13 | - (instancetype)init NS_UNAVAILABLE; 14 | + (instancetype)new NS_UNAVAILABLE; 15 | 16 | @property (nonatomic, copy, readonly) NSString *eventName; 17 | @property (nonatomic, copy, readonly) kEDEventTypeName eventType; 18 | @property (nonatomic, strong) NSDictionary *properties; 19 | 20 | - (void)configTime:(NSDate *)time timeZone:(NSTimeZone *)timeZone; 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Headers/TDFirstEventModel.h: -------------------------------------------------------------------------------- 1 | 2 | #if __has_include() 3 | #import 4 | #else 5 | #import "TDEventModel.h" 6 | #endif 7 | 8 | 9 | NS_ASSUME_NONNULL_BEGIN 10 | 11 | @interface TDFirstEventModel : TDEventModel 12 | 13 | - (instancetype)initWithEventName:(NSString * _Nullable)eventName; 14 | 15 | - (instancetype)initWithEventName:(NSString * _Nullable)eventName firstCheckID:(NSString *)firstCheckID; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Headers/TDOverwriteEventModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDOverwriteEventModel.h 3 | // ThinkingSDK 4 | // 5 | // Created by Yangxiongon 2022/7/1. 6 | // 7 | 8 | #if __has_include() 9 | #import 10 | #else 11 | #import "TDEventModel.h" 12 | #endif 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface TDOverwriteEventModel : TDEventModel 17 | 18 | - (instancetype)initWithEventName:(NSString *)eventName eventID:(NSString *)eventID; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Headers/TDPresetProperties.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDPresetProperties.h 3 | // ThinkingSDK 4 | // 5 | // Created by huangdiao on 2021/5/25. 6 | // Copyright © 2021 thinkingdata. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface TDPresetProperties : NSObject 14 | 15 | @property (nonatomic, copy, readonly) NSString *bundle_id; 16 | @property (nonatomic, copy, readonly) NSString *carrier; 17 | @property (nonatomic, copy, readonly) NSString *device_id; 18 | @property (nonatomic, copy, readonly) NSString *device_model; 19 | @property (nonatomic, copy, readonly) NSString *manufacturer; 20 | @property (nonatomic, copy, readonly) NSString *network_type; 21 | @property (nonatomic, copy, readonly) NSString *os; 22 | @property (nonatomic, copy, readonly) NSString *os_version; 23 | @property (nonatomic, copy, readonly) NSNumber *screen_height; 24 | @property (nonatomic, copy, readonly) NSNumber *screen_width; 25 | @property (nonatomic, copy, readonly) NSString *system_language; 26 | @property (nonatomic, copy, readonly) NSNumber *zone_offset; 27 | @property (nonatomic, copy, readonly) NSString *install_time; 28 | 29 | /** 30 | * The key of the returned event preset property starts with "#", and it is not recommended to use it directly as the property of the event 31 | */ 32 | - (NSDictionary *)toEventPresetProperties; 33 | 34 | @end 35 | 36 | NS_ASSUME_NONNULL_END 37 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Headers/TDSecretKey.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDSecretKey.h 3 | // ThinkingSDK 4 | // 5 | // Created by wwango on 2022/1/21. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface TDSecretKey : NSObject 13 | 14 | /// Initialize key information 15 | - (instancetype)initWithVersion:(NSUInteger)version publicKey:(NSString *)publicKey; 16 | 17 | /// Initialize key information 18 | /// @param version key version number 19 | /// @param publicKey public key 20 | /// @param asymmetricEncryption asymmetric encryption type 21 | /// @param symmetricEncryption Symmetric encryption type 22 | - (instancetype)initWithVersion:(NSUInteger)version 23 | publicKey:(NSString *)publicKey 24 | asymmetricEncryption:(NSString *)asymmetricEncryption 25 | symmetricEncryption:(NSString *)symmetricEncryption; 26 | 27 | @property (nonatomic, assign, readonly) NSUInteger version; 28 | @property (nonatomic, copy, readonly) NSString *publicKey; 29 | @property (nonatomic, copy, readonly) NSString *symmetricEncryption; 30 | @property (nonatomic, copy, readonly) NSString *asymmetricEncryption; 31 | 32 | /// Whether the key information is available 33 | @property (nonatomic, assign, readonly) BOOL isValid; 34 | 35 | @end 36 | 37 | NS_ASSUME_NONNULL_END 38 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Headers/TDSecurityPolicy.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | Thinks AFNetworking: https://github.com/AFNetworking/AFNetworking 4 | */ 5 | #import 6 | 7 | #if __has_include() 8 | #import 9 | #else 10 | #import "TDConstant.h" 11 | #endif 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | 16 | @interface TDSecurityPolicy: NSObject 17 | 18 | @property (nonatomic, assign) BOOL allowInvalidCertificates; 19 | @property (nonatomic, assign) BOOL validatesDomainName; 20 | @property (nonatomic, copy) TDURLSessionDidReceiveAuthenticationChallengeBlock sessionDidReceiveAuthenticationChallenge; 21 | + (instancetype)policyWithPinningMode:(TDSSLPinningMode)pinningMode; 22 | + (instancetype)defaultPolicy; 23 | - (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust forDomain:(NSString *)domain; 24 | 25 | @end 26 | 27 | #ifndef __Require_Quiet 28 | #define __Require_Quiet(assertion, exceptionLabel) \ 29 | do \ 30 | { \ 31 | if ( __builtin_expect(!(assertion), 0) ) \ 32 | { \ 33 | goto exceptionLabel; \ 34 | } \ 35 | } while ( 0 ) 36 | #endif 37 | 38 | #ifndef __Require_noErr_Quiet 39 | #define __Require_noErr_Quiet(errorCode, exceptionLabel) \ 40 | do \ 41 | { \ 42 | if ( __builtin_expect(0 != (errorCode), 0) ) \ 43 | { \ 44 | goto exceptionLabel; \ 45 | } \ 46 | } while ( 0 ) 47 | #endif 48 | 49 | 50 | NS_ASSUME_NONNULL_END 51 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Headers/TDUpdateEventModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // TDUpdateEventModel.h 3 | // ThinkingSDK 4 | // 5 | // Created by Yangxiongon 2022/7/1. 6 | // 7 | 8 | #if __has_include() 9 | #import 10 | #else 11 | #import "TDEventModel.h" 12 | #endif 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface TDUpdateEventModel : TDEventModel 17 | 18 | - (instancetype)initWithEventName:(NSString *)eventName eventID:(NSString *)eventID; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Headers/ThinkingAnalyticsSDK.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #if TARGET_OS_IOS 4 | #import 5 | 6 | #if __has_include() 7 | #import 8 | #else 9 | #import "TDAutoTrackPublicHeader.h" 10 | #endif 11 | 12 | #elif TARGET_OS_OSX 13 | #import 14 | 15 | #endif 16 | 17 | #if __has_include() 18 | #import 19 | #else 20 | #import "TDFirstEventModel.h" 21 | #endif 22 | 23 | #if __has_include() 24 | #import 25 | #else 26 | #import "TDEditableEventModel.h" 27 | #endif 28 | 29 | 30 | #if __has_include() 31 | #import 32 | #else 33 | #import "TDConfig.h" 34 | #endif 35 | 36 | #if __has_include() 37 | #import 38 | #else 39 | #import "TDPresetProperties.h" 40 | #endif 41 | 42 | 43 | NS_ASSUME_NONNULL_BEGIN 44 | 45 | @interface ThinkingAnalyticsSDK : NSObject 46 | 47 | 48 | @end 49 | 50 | NS_ASSUME_NONNULL_END 51 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Headers/ThinkingSDK.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | #if __has_include() 5 | #import 6 | #else 7 | #import "ThinkingAnalyticsSDK.h" 8 | #endif 9 | 10 | #if __has_include() 11 | #import 12 | #else 13 | #import "TDFirstEventModel.h" 14 | #endif 15 | 16 | #if __has_include() 17 | #import 18 | #else 19 | #import "TDEditableEventModel.h" 20 | #endif 21 | 22 | #if __has_include() 23 | #import 24 | #else 25 | #import "TDConfig.h" 26 | #endif 27 | 28 | #if __has_include() 29 | #import 30 | #else 31 | #import "TDPresetProperties.h" 32 | #endif 33 | 34 | #if __has_include() 35 | #import 36 | #else 37 | #import "TDDeviceInfo.h" 38 | #endif 39 | 40 | #if __has_include() 41 | #import 42 | #else 43 | #import "TDAnalytics+Public.h" 44 | #endif 45 | 46 | #if __has_include() 47 | #import 48 | #else 49 | #import "TDAnalytics+Multiple.h" 50 | #endif 51 | 52 | #if __has_include() 53 | #import 54 | #else 55 | #import "TDAnalytics+WebView.h" 56 | #endif 57 | 58 | #if __has_include() 59 | #import 60 | #else 61 | #import "TDAnalytics+ThirdParty.h" 62 | #endif 63 | 64 | #if __has_include() 65 | #import 66 | #else 67 | #import "ThinkingAnalyticsSDK+OldPublic.h" 68 | #endif 69 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Headers/UIView+ThinkingAnalytics.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+ThinkingAnalytics.h 3 | // ThinkingSDK 4 | // 5 | // Created by Yangxiongon 2022/7/1. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface UIView (ThinkingAnalytics) 13 | 14 | /** 15 | Set the control element ID 16 | */ 17 | @property (copy,nonatomic) NSString *thinkingAnalyticsViewID; 18 | 19 | /** 20 | Configure the control element ID of APPID 21 | */ 22 | @property (strong,nonatomic) NSDictionary *thinkingAnalyticsViewIDWithAppid; 23 | 24 | /** 25 | Ignore the click event of a control 26 | */ 27 | @property (nonatomic,assign) BOOL thinkingAnalyticsIgnoreView; 28 | 29 | /** 30 | Configure APPID to ignore the click event of a control 31 | */ 32 | @property (strong,nonatomic) NSDictionary *thinkingAnalyticsIgnoreViewWithAppid; 33 | 34 | /** 35 | Properties of custom control click event 36 | */ 37 | @property (strong,nonatomic) NSDictionary *thinkingAnalyticsViewProperties; 38 | 39 | /** 40 | Configure the properties of the APPID custom control click event 41 | */ 42 | @property (strong,nonatomic) NSDictionary *thinkingAnalyticsViewPropertiesWithAppid; 43 | 44 | /** 45 | thinkingAnalyticsDelegate 46 | */ 47 | @property (nonatomic, weak, nullable) id thinkingAnalyticsDelegate; 48 | 49 | @end 50 | 51 | NS_ASSUME_NONNULL_END 52 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThinkingDataAnalytics/mp-sdk/1f4d7dd3123496718d129acc9c38177db914a1b4/src/native/laya/ios/ThinkingSDK.framework/Info.plist -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module ThinkingSDK { 2 | umbrella header "ThinkingSDK.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /src/native/laya/ios/ThinkingSDK.framework/ThinkingSDK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThinkingDataAnalytics/mp-sdk/1f4d7dd3123496718d129acc9c38177db914a1b4/src/native/laya/ios/ThinkingSDK.framework/ThinkingSDK -------------------------------------------------------------------------------- /src/platform/AutoTrack.mg.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | import { 3 | _ 4 | } from '../utils'; 5 | 6 | export default class AutoTrackBridge { 7 | constructor(instance, config, currentPlatform) { 8 | 9 | this.taInstance = instance; 10 | this.config = config.autoTrack || {}; 11 | this.disablePresetList = config.disablePresetProperties || []; 12 | 13 | var options = currentPlatform.getLaunchOptionsSync(); 14 | this._onLaunch(options); 15 | this._onShow(options); 16 | 17 | this.startTracked = true; 18 | 19 | currentPlatform.onShow((options) => { 20 | this._onShow(options); 21 | }); 22 | 23 | currentPlatform.onHide(() => { 24 | this.startTracked = false; 25 | if (this.config.appHide) { 26 | var properties = {}; 27 | _.extend(properties, this.config.properties); 28 | if (_.isFunction(this.config.callback)) { 29 | _.extend(properties, this.config.callback('appHide')); 30 | } 31 | this.taInstance._internalTrack('ta_mg_hide', properties); 32 | this.taInstance.flush(); 33 | } 34 | }); 35 | } 36 | 37 | _onLaunch(options){ 38 | if (!this.disablePresetList.includes('#scene')) { 39 | if (options && options.scene) { 40 | this.taInstance._setAutoTrackProperties({ 41 | '#scene': options.scene, 42 | }); 43 | } 44 | } 45 | if (this.config.appLaunch) { 46 | var properties = {}; 47 | _.extend(properties, this.config.properties); 48 | if (_.isFunction(this.config.callback)) { 49 | _.extend(properties, this.config.callback('appLaunch')); 50 | } 51 | if (!this.disablePresetList.includes('#start_reason')) { 52 | if (options) { 53 | properties['#start_reason'] = JSON.stringify(options); 54 | } 55 | } 56 | this.taInstance._internalTrack('ta_mg_launch', properties); 57 | } 58 | } 59 | 60 | _onShow(options) { 61 | if (this.startTracked) return; 62 | 63 | if (this.config.appHide) { 64 | this.taInstance.timeEvent('ta_mg_hide'); 65 | } 66 | 67 | if (this.config.appShow) { 68 | var properties = {}; 69 | _.extend(properties, this.config.properties); 70 | if (_.isFunction(this.config.callback)) { 71 | _.extend(properties, this.config.callback('appShow')); 72 | } 73 | if (!this.disablePresetList.includes('#start_reason')) { 74 | if (options) { 75 | properties['#start_reason'] = JSON.stringify(options); 76 | } 77 | } 78 | this.taInstance._internalTrack('ta_mg_show', properties); 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/platform/PlatformProxy.cocoscreator.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | import PlatformProxy from './PlatformProxy'; 3 | import PlatformProxyVivo from './PlatformProxy.vivo.qg'; 4 | import PlatformProxyQg from './PlatformProxy.qg'; 5 | import PlatformProxyWeb from './PlatformProxy.web'; 6 | import { _ } from '../utils'; 7 | 8 | export default class PlatformProxyCC { 9 | static createInstance() { 10 | var CCPlatform = Object.freeze({ 11 | 'WECHAT_GAME': 104, 12 | 'QQ_PLAY': 105, 13 | 'BAIDU_GAME': 107, 14 | 'VIVO_GAME': 108, 15 | 'OPPO_GAME': 109, 16 | 'HUAWEI_GAME': 110, 17 | 'XIAOMI_GAME': 111, 18 | 'BYTEDANCE_GAME': 117, 19 | 'QTT_GAME': 116, 20 | 'LINKSURE': 119, 21 | 'ALI_GAME': 113, 22 | 23 | 'WECHAT_MINI_GAME': 'WECHAT_GAME', 24 | 'BAIDU_MINI_GAME': 'BAIDU_MINI_GAME', 25 | 'XIAOMI_QUICK_GAME': 'XIAOMI_QUICK_GAME', 26 | 'OPPO_MINI_GAME': 'OPPO_MINI_GAME', 27 | 'VIVO_MINI_GAME': 'VIVO_MINI_GAME', 28 | 'HUAWEI_QUICK_GAME': 'HUAWEI_QUICK_GAME', 29 | 'BYTEDANCE_MINI_GAME': 'BYTEDANCE_MINI_GAME', 30 | 'QTT_MINI_GAME': 'QTT_MINI_GAME', 31 | 'LINKSURE_MINI_GAME': 'LINKSURE_MINI_GAME', 32 | 'ALIPAY_MINI_GAME': 'ALIPAY_MINI_GAME' 33 | }); 34 | if (cc.sys.platform === CCPlatform.WECHAT_GAME || cc.sys.platform === CCPlatform.WECHAT_MINI_GAME) { 35 | return PlatformProxy._createInstance('wechat_mg'); 36 | } else if (cc.sys.platform === CCPlatform.BAIDU_GAME || cc.sys.platform === CCPlatform.BAIDU_MIN_GAME) { 37 | return PlatformProxy._createInstance('baidu_mg'); 38 | } else if (cc.sys.platform === CCPlatform.VIVO_GAME || cc.sys.platform === CCPlatform.VIVO_MINI_GAME) { 39 | return PlatformProxyVivo.createInstance(); 40 | } else if (cc.sys.platform === CCPlatform.QQ_PLAY) { 41 | return PlatformProxy._createInstance('qq_mg'); 42 | } else if (cc.sys.platform === CCPlatform.OPPO_GAME || cc.sys.platform === CCPlatform.OPPO_MINI_GAME) { 43 | return PlatformProxyQg._createInstance('oppo'); 44 | /** @TODO config.persistenceName = 'thinkingdata_qg_oppo_game'; */ 45 | } else if (cc.sys.platform === CCPlatform.HUAWEI_GAME || cc.sys.platform === CCPlatform.HUAWEI_QUICK_GAME) { 46 | return PlatformProxyQg._createInstance('huawei'); 47 | } else if (cc.sys.platform === CCPlatform.XIAOMI_GAME || cc.sys.platform === CCPlatform.XIAOMI_QUICK_GAME) { 48 | return PlatformProxyQg._createInstance('xiaomi'); 49 | } else if (cc.sys.platform === CCPlatform.BYTEDANCE_GAME || cc.sys.platform === CCPlatform.BYTEDANCE_MINI_GAME) { 50 | return PlatformProxy._createInstance('tt_mg'); 51 | //} else if (cc.sys.isBrowser) { 52 | } else if (cc.sys.platform === CCPlatform.ALI_GAME || cc.sys.platform === CCPlatform.ALIPAY_MINI_GAME) { 53 | return PlatformProxy._createInstance('ali_mg'); 54 | } else { 55 | let platform = PlatformProxyWeb.createInstance(); 56 | 57 | platform._sysCallback = function () { 58 | return { 59 | system: cc.sys.os.replace(' ', '') + ' ' + cc.sys.osVersion, 60 | }; 61 | }; 62 | 63 | platform.getNetworkType = function (options) { 64 | var network = {}; 65 | switch (cc.sys.getNetworkType()) { 66 | case cc.sys.NetworkType.LAN: 67 | network['networkType'] = 'WIFI'; break; 68 | case cc.sys.NetworkType.WWAN: 69 | network['networkType'] = 'WWAN'; break; 70 | default: 71 | network['networkType'] = 'NONE'; break; 72 | } 73 | options.success(network); 74 | options.complete(); 75 | }; 76 | platform.getSystemInfo = function (options) { 77 | let res = { 78 | // eslint-disable-next-line 79 | mp_platform: cc.sys.platform.toString(), 80 | system: platform._getOs(), 81 | screenWidth: window.screen.width, 82 | screenHeight: window.screen.height, 83 | // systemLanguage: cc.sys.language, 84 | }; 85 | if (platform._sysCallback) { 86 | res = _.extend(res, platform._sysCallback(options)); 87 | } 88 | options.success(res); 89 | options.complete(); 90 | }; 91 | return platform; 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/platform/PlatformProxy.egret.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | import { 3 | _ 4 | } from '../utils'; 5 | import PlatformProxy from './PlatformProxy'; 6 | import PlatformProxyVivo from './PlatformProxy.vivo.qg'; 7 | import PlatformProxyQg from './PlatformProxy.qg'; 8 | import PlatformProxyWeb from './PlatformProxy.web'; 9 | 10 | export default class PlatformProxyEgret { 11 | static createInstance() { 12 | if (egret.Capabilities.runtimeType === egret.RuntimeType.WXGAME) { 13 | return PlatformProxy._createInstance('wechat_mg'); 14 | } else if (egret.Capabilities.runtimeType === egret.RuntimeType.BAIDUGAME) { 15 | return PlatformProxy._createInstance('baidu_mg'); 16 | } else if (egret.Capabilities.runtimeType === egret.RuntimeType.QQGAME) { 17 | return PlatformProxy._createInstance('qq_mg'); 18 | } else if (egret.Capabilities.runtimeType === egret.RuntimeType.VIVOGAME) { 19 | return PlatformProxyVivo.createInstance(); 20 | } else if (egret.Capabilities.runtimeType === egret.RuntimeType.OPPOGAME) { 21 | return PlatformProxyQg._createInstance('oppo'); 22 | /** @TODO config.persistenceName = 'thinkingdata_qg_oppo_game'; */ 23 | } else if (egret.Capabilities.runtimeType === egret.RuntimeType.QGAME) { 24 | return PlatformProxyQg._createInstance('xiaomi'); 25 | } else if (egret.Capabilities.runtimeType === egret.RuntimeType.FASTGAME) { 26 | return PlatformProxyQg._createInstance('huawei'); 27 | } else if (egret.Capabilities.runtimeType === egret.RuntimeType.QHGAME) { 28 | return PlatformProxy._createInstance('qh360_mg'); 29 | } else if (egret.Capabilities.runtimeType === egret.RuntimeType.TTGAME) { 30 | return PlatformProxy._createInstance('tt_mg'); 31 | } else if (egret.Capabilities.runtimeType === egret.RuntimeType.MYGAME) { 32 | return PlatformProxy._createInstance('ali_mp'); 33 | } else if (egret.Capabilities.runtimeType === egret.RuntimeType.TBCREATIVEAPP) { 34 | return PlatformProxy._createInstance('tb_mp'); 35 | } else { 36 | let platform = PlatformProxyWeb.createInstance(); 37 | 38 | platform._sysCallback = function() { 39 | return { 40 | system: egret.Capabilities.os.replace(/\s*/g, ''), 41 | // eslint-disable-next-line 42 | mp_platform: egret.Capabilities.runtimeType, 43 | }; 44 | }; 45 | 46 | platform.request = function (options) { 47 | var res = {}; 48 | let httpMethod = options.method === 'GET' ? egret.HttpMethod.GET : egret.HttpMethod.POST; 49 | let request = new egret.HttpRequest(); 50 | request.timeout = 10000; 51 | request.responseType = egret.HttpResponseType.TEXT; 52 | request.open(options.url, httpMethod); 53 | if (options.header) { 54 | for (var key in options.header) { 55 | request.setRequestHeader(key, options.header[key]); 56 | } 57 | } 58 | request.send(options.data); 59 | request.addEventListener(egret.Event.COMPLETE, function(event){ 60 | res['statusCode'] = 200; 61 | var response = event.currentTarget.response; 62 | if (_.isJSONString(response)) { 63 | res['data'] = JSON.parse(response); 64 | } 65 | options.success(res); 66 | }, platform); 67 | request.addEventListener(egret.IOErrorEvent.IO_ERROR, function(){ 68 | res.errMsg = 'network error'; 69 | options.fail(res); 70 | },platform); 71 | return request; 72 | }; 73 | return platform; 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/platform/PlatformProxy.laya.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | 3 | import PlatformProxy from './PlatformProxy'; 4 | import PlatformProxyVivo from './PlatformProxy.vivo.qg'; 5 | import PlatformProxyQg from './PlatformProxy.qg'; 6 | import PlatformProxyWeb from './PlatformProxy.web'; 7 | 8 | export default class PlatformProxyLaya { 9 | static createInstance() { 10 | if (Laya.Browser.onMiniGame) { 11 | return PlatformProxy._createInstance('wechat_mg'); 12 | } else if (Laya.Browser.onBDMiniGame) { 13 | return PlatformProxy._createInstance('baidu_mg'); 14 | } else if (Laya.Browser.onVVMiniGame) { 15 | return PlatformProxyVivo.createInstance(); 16 | } else if (Laya.Browser.onQQMiniGame) { 17 | return PlatformProxy._createInstance('qq_mg'); 18 | } else if (Laya.Browser.onQGMiniGame) { 19 | return PlatformProxyQg._createInstance('oppo'); 20 | /** @TODO config.persistenceName = 'thinkingdata_qg_oppo_game'; */ 21 | } else if (Laya.Browser.onHWMiniGame) { 22 | return PlatformProxyQg._createInstance('huawei'); 23 | } else if (Laya.Browser.onKGMiniGame) { 24 | return PlatformProxyQg._createInstance('xiaomi'); 25 | } else if (Laya.Browser.onTTMiniGame) { 26 | return PlatformProxy._createInstance('tt_mg'); 27 | } else if (Laya.Browser.onBLMiniGame) { 28 | return PlatformProxy._createInstance('bl_mg'); 29 | } else if (Laya.Browser.onAlipayMiniGame) { 30 | return PlatformProxy._createInstance('ali_mg'); 31 | } else if (Laya.Browser.onTBMiniGame) { 32 | return PlatformProxy._createInstance('tb_mp'); 33 | } else { 34 | return PlatformProxyWeb.createInstance(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/platform/PlatformProxy.quick.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | import fetch from '@system.fetch'; 3 | import device from '@system.device'; 4 | import network from '@system.network'; 5 | import storage from '@system.storage'; 6 | import prompt from '@system.prompt'; 7 | 8 | import { 9 | _, 10 | logger 11 | } from '../utils'; 12 | 13 | /** 14 | * Quick application interface 15 | */ 16 | export default class PlatformProxy { 17 | 18 | constructor() { 19 | this.config = {persistenceName: 'thinkingdata', persistenceNameOld: 'thinkingdata_quick_mp', asyncPersistence: true}; 20 | } 21 | 22 | static createInstance() { 23 | return new PlatformProxy(); 24 | } 25 | 26 | /** 27 | * Get platform specific configuration: persistenceName required 28 | */ 29 | getConfig() { 30 | return this.config || {}; 31 | } 32 | 33 | initSdkConfig(_config) { 34 | 35 | } 36 | 37 | /** 38 | * Get local cache data 39 | * @param {string} name: cache key 40 | * @param {boolean} async: enable asynchronous getting cached 41 | * @param {function} callback: callback when getting data asynchronously, the parameter is an object 42 | * @return return cached data, it is an object 43 | */ 44 | getStorage(name, async, callback) { 45 | if (!async) logger.warn('ThinkingAnalytics: invalid storage configuration'); 46 | storage.get({ 47 | key: name, 48 | success: function(ret) { 49 | var data = _.isJSONString(ret) ? JSON.parse(ret) : {}; 50 | callback(data); 51 | }, 52 | fail: function() { 53 | logger.warn('ThinkingAnalytics: getStorage faild'); 54 | callback({}); 55 | } 56 | }); 57 | } 58 | 59 | /** 60 | * Set local cache data 61 | * @param {string} name: cache key 62 | * @param {string} value: JSON string value 63 | */ 64 | setStorage(name, value) { 65 | storage.set({ 66 | key: name, 67 | value: value 68 | }); 69 | } 70 | 71 | /** 72 | * Delete data in local cache with key 73 | * @param {*} name: cache key 74 | */ 75 | removeStorage(name) { 76 | storage.delete({ 77 | key: name 78 | }); 79 | } 80 | 81 | /** 82 | * Get system information asynchronously 83 | * @param {object} options: callback when getting completion 84 | * callback parameter: 85 | * brand: string, device brand 86 | * model: string, device model 87 | * screenWidth: number, screen width, unit px 88 | * screenHeight: number, screen height, unit px 89 | * system: string, operating system and version 90 | * platform: string, client platform 91 | */ 92 | getSystemInfo(options) { 93 | device.getInfo({ 94 | success(ret) { 95 | var deviceInfo = ret; 96 | var systemArr = [ret['osType'], ret['osVersionName']]; 97 | var system = systemArr.join(' '); 98 | deviceInfo['system'] = system; 99 | deviceInfo['screenWidth'] = ret['screenWidth'] / (ret['screenDensity']>0 ? ret['screenDensity'] : 1); 100 | deviceInfo['screenHeight'] = ret['screenHeight'] / (ret['screenDensity']>0 ? ret['screenDensity'] : 1); 101 | deviceInfo['mp_platform'] = 'quickapp'; 102 | options.success(deviceInfo); 103 | }, 104 | complete() { 105 | options.complete(); 106 | } 107 | }); 108 | } 109 | 110 | /** 111 | * Get network type asynchronously 112 | * @param {object} options: callback when getting completion 113 | * res.networkType string: network type 114 | */ 115 | getNetworkType(options) { 116 | network.getType({ 117 | success(data) { 118 | options.success({ 119 | networkType: data.type 120 | }); 121 | }, 122 | complete() { 123 | options.complete(); 124 | } 125 | }); 126 | } 127 | 128 | /** 129 | * Listen for network state change 130 | * @param {function} callback: callback when network state changing 131 | */ 132 | onNetworkStatusChange(callback) { 133 | network.subscribe({ 134 | callback(data) { 135 | callback({ 136 | networkType: data.type 137 | }); 138 | } 139 | }); 140 | } 141 | 142 | /** 143 | * Make a network request 144 | * @param {object} options: parameters, including: 145 | * url string server url 146 | * data string/object request parameters 147 | * method string HTTP method 148 | * success function success callback 149 | * fail function fail callback 150 | * complete function complete callback 151 | */ 152 | request(options) { 153 | return fetch.fetch({ 154 | url: options.url, 155 | data: options.data, 156 | method: options.method, 157 | header: options.header, 158 | success: function (response) { 159 | var res = {}; 160 | res['statusCode'] = response.code; 161 | if (_.isJSONString(response.data)) { 162 | res['data'] = JSON.parse(response.data); 163 | } 164 | options.success(res); 165 | }, 166 | fail: function fail(data) { 167 | var res = {}; 168 | res['errMsg'] = data['message']; 169 | options.fail(res); 170 | } 171 | }); 172 | } 173 | 174 | 175 | /** 176 | * Initialize the lifecycle monitoring instance 177 | * @param {ThinkingDataAPI} instance: SDK instance, listen lifecycle of application 178 | * @param {object} config: auto-tracking events config 179 | */ 180 | initAutoTrackInstance() { 181 | logger.warn('ThinkingAnalytics: Quick App does not support automatic collection. You can contact TA support personnel to collect related events'); 182 | } 183 | 184 | setGlobal(instance, name) { 185 | globalThis[name] = instance; 186 | } 187 | 188 | /** 189 | * Get system startup information, and register APP cut-off foreground callback 190 | */ 191 | getAppOptions() { 192 | return {}; 193 | } 194 | 195 | /** 196 | * Toast Debug information 197 | * @param {string} msg: information to display 198 | */ 199 | showToast(msg) { 200 | prompt.showToast({ 201 | message: msg, 202 | duration: 2000 203 | }); 204 | } 205 | 206 | setGlobalData(_data) { 207 | } 208 | } 209 | -------------------------------------------------------------------------------- /src/platform/PlatformProxy.tb.mg.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | // import cloud from '@tbmp/mp-cloud-sdk'; 3 | const Cloud = require('@tbmp/mp-cloud-sdk'); 4 | var cloud = new Cloud.Cloud(); 5 | import '../regenerator-runtime/runtime'; 6 | import { 7 | _ 8 | } from '../utils'; 9 | export default class PlatformProxy { 10 | 11 | constructor() { 12 | this.config = { persistenceName: 'thinkingdata', persistenceNameOld: 'thinkingdata_tt_game' }; 13 | } 14 | 15 | static createInstance() { 16 | return new PlatformProxy(); 17 | } 18 | 19 | initSdkConfig(config) { 20 | this.initConfig = config; 21 | cloud.init({ 22 | env: this.initConfig.cloudEnv 23 | }); 24 | } 25 | 26 | getConfig() { 27 | return this.config || {}; 28 | } 29 | 30 | /** 31 | * Get local cache data 32 | * @param {string} name: cache key 33 | * @param {boolean} async: enable asynchronous getting cached 34 | * @param {function} callback: callback when getting data asynchronously, the parameter is an object 35 | * @return return cached data, it is an object 36 | */ 37 | getStorage(name, async, callback) { 38 | // if (!async) logger.warn('TA: invalid storage configuration'); 39 | if (async) { 40 | my.getStorage({ 41 | key: name, 42 | success(res) { 43 | var data = _.isJSONString(res) ? JSON.parse(res) : {}; 44 | callback(data); 45 | }, 46 | fail() { 47 | callback({}); 48 | } 49 | }); 50 | } else { 51 | var data = my.getStorageSync({ key: name }); 52 | if (_.isObject(data)) { 53 | return data.data ? JSON.parse(data.data) : {}; 54 | } else { 55 | return {}; 56 | } 57 | } 58 | } 59 | 60 | /** 61 | * Set local cache data 62 | * @param {string} name: cache key 63 | * @param {string} value: JSON string value 64 | */ 65 | setStorage(name, value) { 66 | try { 67 | my.setStorageSync({ 68 | key: name, 69 | data: value, 70 | }); 71 | } catch (e) { } 72 | } 73 | 74 | /** 75 | * Delete data in local cache with key 76 | * @param {*} name: cache key 77 | */ 78 | removeStorage(name) { 79 | try { 80 | my.removeStorage({ 81 | key: name 82 | }); 83 | } catch (e) { } 84 | } 85 | 86 | getSystemInfo(options) { 87 | my.getSystemInfo({ 88 | success(res) { 89 | res.system = res.system + ' ' + res.version; 90 | res.systemLanguage = res.language; 91 | res.mp_platform = 'tb'; 92 | options.success(res); 93 | }, 94 | complete() { 95 | options.complete(); 96 | } 97 | }); 98 | } 99 | 100 | getNetworkType(options) { 101 | my.getNetworkType({ 102 | success(res) { 103 | options.success(res); 104 | }, 105 | complete() { 106 | options.complete(); 107 | } 108 | }); 109 | } 110 | 111 | onNetworkStatusChange(callback) { 112 | my.onNetworkStatusChange(callback); 113 | } 114 | 115 | async request(options) { 116 | try { 117 | var postConfig = {}; 118 | postConfig.path = this.getUrlPath(options.url); 119 | postConfig.method = options.method; 120 | postConfig.headers = options.header; 121 | postConfig.exts = { 122 | cloudAppId: this.initConfig.cloudAppId, 123 | // timeout: 3000, 124 | domain: this.initConfig.serverUrl 125 | } 126 | if (options.method === 'GET') { 127 | postConfig.params = { 128 | appid: this.initConfig.appId 129 | }; 130 | } else if (options.method === 'POST') { 131 | postConfig.body = options.data; 132 | } 133 | let result = await cloud.application.httpRequest(postConfig); 134 | if (result) { 135 | options.success(JSON.parse(result)); 136 | } else { 137 | options.fail({ 138 | errMsg: 'error' 139 | }) 140 | } 141 | } catch (error) { 142 | options.fail({ 143 | errMsg: error 144 | }) 145 | } 146 | } 147 | 148 | getUrlPath(url) { 149 | if (url.includes('sync_xcx')) { 150 | return '/sync_xcx'; 151 | } else if (url.includes('data_debug')) { 152 | return '/data_debug'; 153 | } else if (url.includes('config')) { 154 | return '/config' 155 | } 156 | } 157 | 158 | initAutoTrackInstance(instance, config) { 159 | 160 | } 161 | 162 | setGlobal(instance, name) { 163 | 164 | } 165 | 166 | getAppOptions() { 167 | return {}; 168 | } 169 | 170 | showToast(msg) { 171 | my.showToast({ 172 | content: msg, 173 | duration: 3000 174 | }); 175 | } 176 | 177 | setGlobalData(_data) { 178 | } 179 | 180 | } -------------------------------------------------------------------------------- /src/platform/PlatformProxy.uniapp.js: -------------------------------------------------------------------------------- 1 | /* global uni */ 2 | import { logger } from '../utils'; 3 | import PlatformProxy from './PlatformProxy'; 4 | export default class PlatformProxyUniapp extends PlatformProxy { 5 | static createInstance() { 6 | 7 | var proxy = new PlatformProxyUniapp(uni, { persistenceName: 'thinkingdata', persistenceNameOld: 'thinkingdata_uniapp' }, { mpPlatform: 'uniapp', mp: true, platform: 'uniapp' }); 8 | 9 | // #ifdef MP-WEIXIN 10 | proxy = PlatformProxy._createInstance('wechat_mp'); 11 | // #endif 12 | 13 | // #ifdef MP-ALIPAY 14 | proxy = PlatformProxy._createInstance('ali_mp'); 15 | // #endif 16 | 17 | // #ifdef MP-BAIDU 18 | proxy = PlatformProxy._createInstance('baidu_mp'); 19 | // #endif 20 | 21 | // #ifdef MP-TOUTIAO 22 | proxy = PlatformProxy._createInstance('tt_mp'); 23 | // #endif 24 | 25 | // #ifdef MP-LARK 26 | proxy = PlatformProxy._createInstance('tt_mp'); 27 | // #endif 28 | 29 | // #ifdef MP-QQ 30 | proxy = PlatformProxy._createInstance('qq_mp'); 31 | // #endif 32 | 33 | // #ifdef MP-KUAISHOU 34 | proxy = PlatformProxy._createInstance('kuaishou_mp'); 35 | // #endif 36 | 37 | // #ifdef MP-JD 38 | proxy = PlatformProxy._createInstance('jd_mp'); 39 | // #endif 40 | 41 | // #ifdef MP-360 42 | proxy = PlatformProxy._createInstance('qh360_mp'); 43 | // #endif 44 | 45 | // #ifdef H5 46 | proxy = PlatformProxy._createInstance('WEB'); 47 | // #endif 48 | 49 | return proxy; 50 | } 51 | 52 | initAutoTrackInstance(instance, config) { 53 | logger.info(instance); 54 | logger.info(config); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/platform/PlatformProxy.vivo.qg.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | import { 3 | _ 4 | } from '../utils'; 5 | 6 | class AutoTrackBridge { 7 | constructor(instance, config) { 8 | 9 | this.taInstance = instance; 10 | this.config = config || {}; 11 | // The onShow of VIVO Quick Game is defined as the event of returning to the foreground, so the onshow at startup is added here. 12 | if (this.config.appShow) { 13 | this.taInstance._internalTrack('ta_mg_show'); 14 | } 15 | 16 | if (this.config.appHide) { 17 | this.taInstance.timeEvent('ta_mg_hide'); 18 | } 19 | 20 | qg.onShow(() => { 21 | if (this.config.appHide) { 22 | this.taInstance.timeEvent('ta_mg_hide'); 23 | } 24 | 25 | if (this.config.appShow) { 26 | var properties = {}; 27 | _.extend(properties, this.config.properties); 28 | if (_.isFunction(this.config.callback)) { 29 | _.extend(properties, this.config.callback('appShow')); 30 | } 31 | this.taInstance._internalTrack('ta_mg_show'); 32 | } 33 | }); 34 | 35 | qg.onHide(() => { 36 | if (this.config.appHide) { 37 | var properties = {}; 38 | _.extend(properties, this.config.properties); 39 | if (_.isFunction(this.config.callback)) { 40 | _.extend(properties, this.config.callback('appHide')); 41 | } 42 | this.taInstance._internalTrack('ta_mg_hide'); 43 | } 44 | }); 45 | } 46 | } 47 | 48 | /** 49 | * vivo mini game interface 50 | */ 51 | export default class PlatformProxy { 52 | 53 | constructor() { 54 | this.config = {persistenceName: 'thinkingdata', persistenceNameOld: 'thinkingdata_qg_vivo_game', asyncPersistence: true}; 55 | } 56 | 57 | static createInstance() { 58 | return new PlatformProxy(); 59 | } 60 | 61 | /** 62 | * Get platform specific configuration: persistenceName required 63 | */ 64 | getConfig() { 65 | return this.config || {}; 66 | } 67 | 68 | initSdkConfig(_config) { 69 | 70 | } 71 | 72 | /** 73 | * Get local cache data 74 | * @param {string} name: cache key 75 | * @param {boolean} async: enable asynchronous getting cached 76 | * @param {function} callback: callback when getting data asynchronously, the parameter is an object 77 | * @return return cached data, it is an object 78 | */ 79 | getStorage(name, async, callback) { 80 | // if (!async) logger.warn('TA: invalid storage configuration'); 81 | if (async) { 82 | qg.getStorage({ 83 | key: name, 84 | success(res) { 85 | var data = _.isJSONString(res) ? JSON.parse(res) : {}; 86 | callback(data); 87 | }, 88 | fail() { 89 | callback({}); 90 | } 91 | }); 92 | } else { 93 | var data = qg.getStorageSync({ key: name }); 94 | if (_.isJSONString(data)) { 95 | return JSON.parse(data); 96 | } else { 97 | return {}; 98 | } 99 | } 100 | } 101 | 102 | /** 103 | * Set local cache data 104 | * @param {string} name: cache key 105 | * @param {string} value: JSON string value 106 | */ 107 | setStorage(name, value) { 108 | qg.setStorage({ 109 | key: name, 110 | value: value 111 | }); 112 | } 113 | 114 | /** 115 | * Delete data in local cache with key 116 | * @param {*} name: cache key 117 | */ 118 | removeStorage(name) { 119 | qg.deleteStorage({ 120 | key: name 121 | }); 122 | } 123 | 124 | /** 125 | * Get system information asynchronously 126 | * @param {object} options: callback when getting completion 127 | * callback parameter: 128 | * brand: string, device brand 129 | * model: string, device model 130 | * screenWidth: number, screen width, unit px 131 | * screenHeight: number, screen height, unit px 132 | * system: string, operating system and version 133 | * platform: string, client platform 134 | */ 135 | getSystemInfo(options) { 136 | qg.getSystemInfo({ 137 | success(ret) { 138 | var deviceInfo = ret; 139 | var systemArr = [ret['osType'], ret['osVersionName']]; 140 | var system = systemArr.join(' '); 141 | deviceInfo['brand'] = ret['manufacturer']; 142 | deviceInfo['system'] = system; 143 | deviceInfo['mp_platform'] = 'vivo_qg'; 144 | options.success(deviceInfo); 145 | }, 146 | complete: function () { 147 | options.complete(); 148 | } 149 | }); 150 | } 151 | 152 | /** 153 | * Get network type asynchronously 154 | * @param {object} options: callback when getting completion 155 | * res.networkType string: network type 156 | */ 157 | getNetworkType(options) { 158 | qg.getNetworkType({ 159 | success(data) { 160 | var networkInfo = data; 161 | networkInfo['networkType'] = data.type; 162 | options.success(networkInfo); 163 | }, 164 | complete() { 165 | options.complete(); 166 | } 167 | }); 168 | } 169 | 170 | /** 171 | * Listen for network state change 172 | * @param {function} callback: callback when network state changing 173 | */ 174 | onNetworkStatusChange(callback) { 175 | qg.subscribeNetworkStatus({ 176 | callback(data) { 177 | var networkInfo = data; 178 | networkInfo['networkType'] = data.type; 179 | callback(networkInfo); 180 | } 181 | }); 182 | } 183 | 184 | /** 185 | * Make a network request 186 | * @param {object} options: parameters, including: 187 | * url string server url 188 | * data string/object request parameters 189 | * method string HTTP method 190 | * success function success callback 191 | * fail function fail callback 192 | * complete function complete callback 193 | */ 194 | request(options) { 195 | return qg.request({ 196 | url: options.url, 197 | data: options.data, 198 | method: options.method, 199 | header: options.header, 200 | success: function (response) { 201 | options.success(response); 202 | }, 203 | fail: function fail(data) { 204 | options.fail(data); 205 | } 206 | }); 207 | } 208 | 209 | /** 210 | * Initialize the lifecycle monitoring instance 211 | * @param {ThinkingDataAPI} instance: SDK instance, listen lifecycle of application 212 | * @param {object} config: auto-tracking events config 213 | */ 214 | initAutoTrackInstance(instance, config) { 215 | return new AutoTrackBridge(instance, config.autoTrack); 216 | } 217 | 218 | setGlobal(instance, name) { 219 | globalThis[name] = instance; 220 | } 221 | 222 | /** 223 | * Get system startup information, and register APP cut-off foreground callback 224 | */ 225 | getAppOptions() { 226 | return {}; 227 | } 228 | 229 | /** 230 | * Toast Debug information 231 | * @param {string} msg: information to display 232 | */ 233 | showToast(msg) { 234 | qg.showToast({ 235 | message: msg, 236 | duration: 0 237 | }); 238 | } 239 | 240 | setGlobalData(_data) { 241 | 242 | } 243 | } 244 | -------------------------------------------------------------------------------- /src/platform/PlatformProxy.web.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | import { 3 | _ 4 | } from '../utils'; 5 | 6 | export default class PlatformProxy { 7 | 8 | constructor() { 9 | this.config = {persistenceName: 'thinkingdata', persistenceNameOld: 'thinkingdata_mg'}; 10 | } 11 | 12 | static createInstance() { 13 | return new PlatformProxy(); 14 | } 15 | 16 | /** 17 | * Get platform specific configuration: persistenceName required 18 | */ 19 | getConfig() { 20 | return this.config; 21 | } 22 | 23 | initSdkConfig(_config) { 24 | 25 | } 26 | 27 | /** 28 | * Get local cache data 29 | * @param {string} name: cache key 30 | * @param {boolean} async: enable asynchronous getting cached 31 | * @param {function} callback: callback when getting data asynchronously, the parameter is an object 32 | * @return return cached data, it is an object 33 | */ 34 | getStorage(name, async, callback) { 35 | // if (async) logger.warn('TA: invalid storage configuration'); 36 | var data = localStorage.getItem(name); 37 | if (async) { 38 | if (_.isJSONString(data)) { 39 | callback(JSON.parse(data)); 40 | } else { 41 | callback({}); 42 | } 43 | } else { 44 | if (_.isJSONString(data)) { 45 | return JSON.parse(data); 46 | } else { 47 | return {}; 48 | } 49 | } 50 | } 51 | 52 | /** 53 | * Set local cache data 54 | * @param {string} name: cache key 55 | * @param {string} value: JSON string value 56 | */ 57 | setStorage(name, value) { 58 | localStorage.setItem(name, value); 59 | } 60 | 61 | /** 62 | * Delete data in local cache with key 63 | * @param {*} name: cache key 64 | */ 65 | removeStorage(name) { 66 | localStorage.removeItem(name); 67 | } 68 | 69 | _setSystemProxy(callback) { 70 | this._sysCallback = callback; 71 | } 72 | /** 73 | * Get system information asynchronously 74 | * @param {object} options: callback when getting completion 75 | * callback parameter: 76 | * brand: string, device brand 77 | * model: string, device model 78 | * screenWidth: number, screen width, unit px 79 | * screenHeight: number, screen height, unit px 80 | * system: string, operating system and version 81 | * platform: string, client platform 82 | */ 83 | getSystemInfo(options) { 84 | let res = { 85 | // eslint-disable-next-line 86 | mp_platform: 'web', 87 | system: this._getOs(), 88 | screenWidth: window.screen.width, 89 | screenHeight: window.screen.height, 90 | systemLanguage: navigator.language 91 | }; 92 | 93 | if (this._sysCallback) { 94 | res = _.extend(res, this._sysCallback(options)); 95 | } 96 | 97 | options.success(res); 98 | options.complete(); 99 | } 100 | 101 | _getOs() { 102 | let a = navigator.userAgent; 103 | if (/Windows/i.test(a)) { 104 | if (/Phone/.test(a) || /WPDesktop/.test(a)) { 105 | return 'Windows Phone'; 106 | } 107 | return 'Windows'; 108 | } else if (/(iPhone|iPad|iPod)/.test(a)) { 109 | return 'iOS'; 110 | } else if (/Android/.test(a)) { 111 | return 'Android'; 112 | } else if (/(BlackBerry|PlayBook|BB10)/i.test(a)) { 113 | return 'BlackBerry'; 114 | } else if (/Mac/i.test(a)) { 115 | return 'MacOS'; 116 | } else if (/Linux/.test(a)) { 117 | return 'Linux'; 118 | } else if (/CrOS/.test(a)) { 119 | return 'ChromeOS'; 120 | } else { 121 | return ''; 122 | } 123 | } 124 | 125 | /** 126 | * Get network type asynchronously 127 | * @param {object} options: callback when getting completion 128 | * res.networkType string: network type 129 | */ 130 | getNetworkType(options) { 131 | options.complete(); 132 | } 133 | 134 | /** 135 | * Listen for network state change 136 | * @param {function} callback: callback when network state changing 137 | */ 138 | onNetworkStatusChange() { 139 | } 140 | 141 | /** 142 | * Make a network request 143 | * @param {object} options: parameters, including: 144 | * url string server url 145 | * data string/object request parameters 146 | * method string HTTP method 147 | * success function success callback 148 | * fail function fail callback 149 | * complete function complete callback 150 | */ 151 | request(options) { 152 | var res = {}; 153 | var xhr = new XMLHttpRequest(); 154 | xhr.open(options.method, options.url); 155 | if (options.header) { 156 | for (var key in options.header) { 157 | xhr.setRequestHeader(key, options.header[key]); 158 | } 159 | } 160 | xhr.onreadystatechange = function () { 161 | if (xhr.readyState === 4 && xhr.status === 200) { 162 | res['statusCode'] = 200; 163 | if (_.isJSONString(xhr.responseText)) { 164 | res['data'] = JSON.parse(xhr.responseText); 165 | } 166 | options.success(res); 167 | }else if(xhr.status !== 200){ 168 | res.errMsg = 'network error'; 169 | options.fail(res); 170 | } 171 | }; 172 | xhr.ontimeout = function() { 173 | res.errMsg = 'timeout'; 174 | options.fail(res); 175 | }; 176 | xhr.send(options.data); 177 | return xhr; 178 | } 179 | 180 | initAutoTrackInstance(instance, config) { 181 | this.instance = instance; 182 | this.autoTrack = config.autoTrack; 183 | 184 | var _that = this; 185 | _that.onPageShow(); 186 | if (_that.autoTrack.appHide) { 187 | _that.instance.timeEvent('ta_page_hide'); 188 | } 189 | 190 | if ('onvisibilitychange' in document) { 191 | document.onvisibilitychange = function () { 192 | if (document.hidden) { 193 | _that.onPageHide(true); 194 | } else { 195 | _that.onPageShow(); 196 | if (_that.autoTrack.appHide) { 197 | _that.instance.timeEvent('ta_page_hide'); 198 | } 199 | } 200 | }; 201 | } 202 | } 203 | 204 | setGlobal(instance, name) { 205 | window[name] = instance; 206 | } 207 | 208 | /** 209 | * Get system startup information, and register APP cut-off foreground callback 210 | * @TODO 211 | */ 212 | getAppOptions() { 213 | } 214 | 215 | /** 216 | * Toast Debug information 217 | * @param {string} msg: information to display 218 | */ 219 | showToast() { 220 | } 221 | 222 | onPageShow() { 223 | if (this.autoTrack.appShow) { 224 | var properties = {}; 225 | _.extend(properties, this.autoTrack.properties); 226 | if (_.isFunction(this.autoTrack.callback)) { 227 | _.extend(properties, this.autoTrack.callback('appShow')); 228 | } 229 | this.instance._internalTrack('ta_page_show', properties); 230 | } 231 | } 232 | 233 | onPageHide(tryBeacon) { 234 | if (this.autoTrack.appHide) { 235 | var properties = {}; 236 | _.extend(properties, this.autoTrack.properties); 237 | if (_.isFunction(this.autoTrack.callback)) { 238 | _.extend(properties, this.autoTrack.callback('appHide')); 239 | } 240 | this.instance._internalTrack('ta_page_hide', properties, new Date(), null, tryBeacon); 241 | } 242 | } 243 | 244 | setGlobalData(_data) { 245 | 246 | } 247 | } 248 | -------------------------------------------------------------------------------- /src/regenerator-runtime/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2014-present, Facebook, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/regenerator-runtime/README.md: -------------------------------------------------------------------------------- 1 | # regenerator-runtime 2 | 3 | Standalone runtime for 4 | [Regenerator](https://github.com/facebook/regenerator)-compiled generator 5 | and `async` functions. 6 | 7 | To import the runtime as a module (recommended), either of the following 8 | import styles will work: 9 | ```js 10 | // CommonJS 11 | const regeneratorRuntime = require("regenerator-runtime"); 12 | 13 | // ECMAScript 2015 14 | import regeneratorRuntime from "regenerator-runtime"; 15 | ``` 16 | 17 | To ensure that `regeneratorRuntime` is defined globally, either of the 18 | following styles will work: 19 | ```js 20 | // CommonJS 21 | require("regenerator-runtime/runtime"); 22 | 23 | // ECMAScript 2015 24 | import "regenerator-runtime/runtime.js"; 25 | ``` 26 | 27 | To get the absolute file system path of `runtime.js`, evaluate the 28 | following expression: 29 | ```js 30 | require("regenerator-runtime/path").path 31 | ``` 32 | -------------------------------------------------------------------------------- /src/regenerator-runtime/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "regenerator-runtime", 3 | "author": "Ben Newman ", 4 | "description": "Runtime for Regenerator-compiled generator and async functions.", 5 | "version": "0.14.1", 6 | "main": "runtime.js", 7 | "keywords": [ 8 | "regenerator", 9 | "runtime", 10 | "generator", 11 | "async" 12 | ], 13 | "sideEffects": true, 14 | "repository": { 15 | "type": "git", 16 | "url": "https://github.com/facebook/regenerator/tree/main/packages/runtime" 17 | }, 18 | "license": "MIT" 19 | } 20 | -------------------------------------------------------------------------------- /src/regenerator-runtime/path.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | exports.path = require("path").join( 3 | __dirname, 4 | "runtime.js" 5 | ); 6 | --------------------------------------------------------------------------------