Showing
6 changed files
with
2 additions
and
73 deletions
| @@ -49,5 +49,3 @@ export { NetworkUtil } from './src/main/ets/utils/NetworkUtil' | @@ -49,5 +49,3 @@ export { NetworkUtil } from './src/main/ets/utils/NetworkUtil' | ||
| 49 | export { NetworkManager } from './src/main/ets/network/NetworkManager' | 49 | export { NetworkManager } from './src/main/ets/network/NetworkManager' |
| 50 | 50 | ||
| 51 | export { NetworkType } from './src/main/ets/network/NetworkType' | 51 | export { NetworkType } from './src/main/ets/network/NetworkType' |
| 52 | - | ||
| 53 | -export { UmengStats } from "./src/main/ets/umeng/UmengStats" |
| @@ -6,8 +6,5 @@ | @@ -6,8 +6,5 @@ | ||
| 6 | "description": "Please describe the basic information.", | 6 | "description": "Please describe the basic information.", |
| 7 | "main": "Index.ets", | 7 | "main": "Index.ets", |
| 8 | "version": "1.0.0", | 8 | "version": "1.0.0", |
| 9 | - "dependencies": { | ||
| 10 | - "@umeng/common": "^1.0.21", | ||
| 11 | - "@umeng/analytics": "^1.0.19" | ||
| 12 | - } | 9 | + "dependencies": {} |
| 13 | } | 10 | } |
| 1 | -import { preInit, InternalPlugin, setLogEnabled, init, onEventObject, onProfileSignOff, | ||
| 2 | - onProfileSignIn } from '@umeng/analytics'; | ||
| 3 | -import { common } from '@kit.AbilityKit'; | ||
| 4 | -import { AccountManagerUtils } from '../utils/AccountManagerUtils'; | ||
| 5 | -import { UserDataLocal } from '../utils/UserDataLocal'; | ||
| 6 | -import { EmitterUtils } from '../utils/EmitterUtils'; | ||
| 7 | - | ||
| 8 | -export class UmengStats { | ||
| 9 | - | ||
| 10 | - private static _inited = false | ||
| 11 | - | ||
| 12 | - // 启动时调用 | ||
| 13 | - static preInit(context: common.UIAbilityContext) { | ||
| 14 | - | ||
| 15 | - // 需在 AppScope/resources/rawfile/umconfig.json 配置key和channel | ||
| 16 | - preInit({ | ||
| 17 | - context: context.getApplicationContext(), | ||
| 18 | - plugins: [new InternalPlugin()], | ||
| 19 | - enableLog: true | ||
| 20 | - | ||
| 21 | - }); | ||
| 22 | - } | ||
| 23 | - | ||
| 24 | - // 在用户同意隐私政策后再调用此方法 | ||
| 25 | - static initAfterAgreeProtocol() { | ||
| 26 | - init(); | ||
| 27 | - UmengStats._inited = true | ||
| 28 | - | ||
| 29 | - UmengStats.onLogin() | ||
| 30 | - UmengStats.event("testHarmony", {"key1": "value1"}) | ||
| 31 | - } | ||
| 32 | - | ||
| 33 | - // TODO: 登录成功调用 | ||
| 34 | - static onLogin() { | ||
| 35 | - AccountManagerUtils.isLogin().then((login) => { | ||
| 36 | - if (!login) { return } | ||
| 37 | - | ||
| 38 | - let userId = UserDataLocal.getUserId() | ||
| 39 | - if (userId.length > 0) { | ||
| 40 | - onProfileSignIn("USER", userId) | ||
| 41 | - } | ||
| 42 | - }) | ||
| 43 | - } | ||
| 44 | - // TODO: 退出登录调用 | ||
| 45 | - static onLogout() { | ||
| 46 | - onProfileSignOff() | ||
| 47 | - } | ||
| 48 | - | ||
| 49 | - // 属性key,128位以内的非空字符串,value为256位以内的数值或字符串 | ||
| 50 | - static event(eventId: string, param?: Record<string, string | number>) { | ||
| 51 | - if (!UmengStats._inited) { | ||
| 52 | - return | ||
| 53 | - } | ||
| 54 | - onEventObject(eventId, param); | ||
| 55 | - } | ||
| 56 | -} |
| @@ -12,7 +12,6 @@ import { | @@ -12,7 +12,6 @@ import { | ||
| 12 | NetworkType, | 12 | NetworkType, |
| 13 | SPHelper, | 13 | SPHelper, |
| 14 | StringUtils, | 14 | StringUtils, |
| 15 | - UmengStats, | ||
| 16 | WindowModel | 15 | WindowModel |
| 17 | } from 'wdKit'; | 16 | } from 'wdKit'; |
| 18 | import { HostEnum, HostManager, WDHttp } from 'wdNetwork'; | 17 | import { HostEnum, HostManager, WDHttp } from 'wdNetwork'; |
| @@ -22,7 +21,6 @@ import { WDPushNotificationManager } from 'wdHwAbility/Index'; | @@ -22,7 +21,6 @@ import { WDPushNotificationManager } from 'wdHwAbility/Index'; | ||
| 22 | 21 | ||
| 23 | export default class EntryAbility extends UIAbility { | 22 | export default class EntryAbility extends UIAbility { |
| 24 | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { | 23 | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { |
| 25 | - UmengStats.preInit(this.context) | ||
| 26 | SPHelper.init(this.context); | 24 | SPHelper.init(this.context); |
| 27 | hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); | 25 | hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); |
| 28 | registerRouter(); | 26 | registerRouter(); |
| @@ -11,7 +11,7 @@ import { WDRouterPage } from 'wdRouter'; | @@ -11,7 +11,7 @@ import { WDRouterPage } from 'wdRouter'; | ||
| 11 | import { LaunchModel } from '../viewModel/LaunchModel' | 11 | import { LaunchModel } from '../viewModel/LaunchModel' |
| 12 | import { LaunchPageModel } from '../viewModel/LaunchPageModel' | 12 | import { LaunchPageModel } from '../viewModel/LaunchPageModel' |
| 13 | import LaunchDataModel from '../viewModel/LaunchDataModel' | 13 | import LaunchDataModel from '../viewModel/LaunchDataModel' |
| 14 | -import { Logger, SPHelper, UmengStats } from 'wdKit/Index'; | 14 | +import { Logger, SPHelper } from 'wdKit/Index'; |
| 15 | import { SpConstants } from 'wdConstant/Index'; | 15 | import { SpConstants } from 'wdConstant/Index'; |
| 16 | 16 | ||
| 17 | @Entry | 17 | @Entry |
| @@ -44,7 +44,6 @@ struct LaunchPage { | @@ -44,7 +44,6 @@ struct LaunchPage { | ||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | onConfirm() { | 46 | onConfirm() { |
| 47 | - UmengStats.initAfterAgreeProtocol() | ||
| 48 | // Save privacy agreement status. | 47 | // Save privacy agreement status. |
| 49 | this.saveIsPrivacy(); | 48 | this.saveIsPrivacy(); |
| 50 | //跳转引导页 | 49 | //跳转引导页 |
| @@ -95,9 +94,6 @@ struct LaunchPage { | @@ -95,9 +94,6 @@ struct LaunchPage { | ||
| 95 | this.dialogController.open(); | 94 | this.dialogController.open(); |
| 96 | // } | 95 | // } |
| 97 | } else { | 96 | } else { |
| 98 | - | ||
| 99 | - UmengStats.initAfterAgreeProtocol() | ||
| 100 | - | ||
| 101 | //需要根据请求数据判断是否需要进入广告页,广告数据为nil则直接跳转到首页 | 97 | //需要根据请求数据判断是否需要进入广告页,广告数据为nil则直接跳转到首页 |
| 102 | //获取本地存储的启动页数据 | 98 | //获取本地存储的启动页数据 |
| 103 | 99 |
-
Please register or login to post a comment