Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
xugenyuan
2024-05-07 09:54:50 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f2a2b31bd94b198031163a87f1b04bc16712094a
f2a2b31b
1 parent
d8497a68
ref |> Revert "ref |> Revert "ref |> 新增友盟统计""
This reverts commit
b233489b
.
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
73 additions
and
2 deletions
sight_harmony/AppScope/resources/rawfile/umconfig.json
sight_harmony/commons/wdKit/Index.ets
sight_harmony/commons/wdKit/oh-package.json5
sight_harmony/commons/wdKit/src/main/ets/umeng/UmengStats.ets
sight_harmony/products/phone/src/main/ets/entryability/EntryAbility.ets
sight_harmony/products/phone/src/main/ets/pages/launchPage/LaunchPage.ets
sight_harmony/AppScope/resources/rawfile/umconfig.json
0 → 100644
View file @
f2a2b31
{
"appKey"
:
"662f39fecac2a664de284236"
,
"channel"
:
"rmrb_china_0000"
}
\ No newline at end of file
...
...
sight_harmony/commons/wdKit/Index.ets
View file @
f2a2b31
...
...
@@ -51,3 +51,5 @@ export { NetworkManager } from './src/main/ets/network/NetworkManager'
export { NetworkType } from './src/main/ets/network/NetworkType'
export { CustomToast } from './src/main/ets/reusable/CustomToast'
export { UmengStats } from "./src/main/ets/umeng/UmengStats"
...
...
sight_harmony/commons/wdKit/oh-package.json5
View file @
f2a2b31
...
...
@@ -6,5 +6,8 @@
"description"
:
"Please describe the basic information."
,
"main"
:
"Index.ets"
,
"version"
:
"1.0.0"
,
"dependencies"
:
{}
"dependencies"
:
{
"@umeng/common"
:
"^1.0.21"
,
"@umeng/analytics"
:
"^1.0.19"
}
}
...
...
sight_harmony/commons/wdKit/src/main/ets/umeng/UmengStats.ets
0 → 100644
View file @
f2a2b31
import { preInit, InternalPlugin, setLogEnabled, init, onEventObject, onProfileSignOff,
onProfileSignIn } from '@umeng/analytics';
import { common } from '@kit.AbilityKit';
import { AccountManagerUtils } from '../utils/AccountManagerUtils';
import { UserDataLocal } from '../utils/UserDataLocal';
import { EmitterUtils } from '../utils/EmitterUtils';
export class UmengStats {
private static _inited = false
// 启动时调用
static preInit(context: common.UIAbilityContext) {
// 需在 AppScope/resources/rawfile/umconfig.json 配置key和channel
preInit({
context: context.getApplicationContext(),
plugins: [new InternalPlugin()],
enableLog: true
});
}
// 在用户同意隐私政策后再调用此方法
static initAfterAgreeProtocol() {
init();
UmengStats._inited = true
UmengStats.onLogin()
UmengStats.event("testHarmony", {"key1": "value1"})
}
// TODO: 登录成功调用
static onLogin() {
AccountManagerUtils.isLogin().then((login) => {
if (!login) { return }
let userId = UserDataLocal.getUserId()
if (userId.length > 0) {
onProfileSignIn("USER", userId)
}
})
}
// TODO: 退出登录调用
static onLogout() {
onProfileSignOff()
}
// 属性key,128位以内的非空字符串,value为256位以内的数值或字符串
static event(eventId: string, param?: Record<string, string | number>) {
if (!UmengStats._inited) {
return
}
onEventObject(eventId, param);
}
}
\ No newline at end of file
...
...
sight_harmony/products/phone/src/main/ets/entryability/EntryAbility.ets
View file @
f2a2b31
...
...
@@ -12,6 +12,7 @@ import {
NetworkType,
SPHelper,
StringUtils,
UmengStats,
WindowModel
} from 'wdKit';
import { HostEnum, HostManager, WDHttp } from 'wdNetwork';
...
...
@@ -21,6 +22,7 @@ import { WDPushNotificationManager } from 'wdHwAbility/Index';
export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
UmengStats.preInit(this.context)
SPHelper.init(this.context);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
registerRouter();
...
...
sight_harmony/products/phone/src/main/ets/pages/launchPage/LaunchPage.ets
View file @
f2a2b31
...
...
@@ -11,7 +11,7 @@ import { WDRouterPage } from 'wdRouter';
import { LaunchModel } from '../viewModel/LaunchModel'
import { LaunchPageModel } from '../viewModel/LaunchPageModel'
import LaunchDataModel from '../viewModel/LaunchDataModel'
import { Logger, SPHelper } from 'wdKit/Index';
import { Logger, SPHelper
, UmengStats
} from 'wdKit/Index';
import { SpConstants } from 'wdConstant/Index';
@Entry
...
...
@@ -44,6 +44,7 @@ struct LaunchPage {
}
onConfirm() {
UmengStats.initAfterAgreeProtocol()
// Save privacy agreement status.
this.saveIsPrivacy();
//跳转引导页
...
...
@@ -94,6 +95,9 @@ struct LaunchPage {
this.dialogController.open();
// }
} else {
UmengStats.initAfterAgreeProtocol()
//需要根据请求数据判断是否需要进入广告页,广告数据为nil则直接跳转到首页
//获取本地存储的启动页数据
...
...
Please
register
or
login
to post a comment