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
liyubing
2024-06-12 20:24:11 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
87a2432fd2ab5bfafc41e1fa872ff97c67b66168
87a2432f
2 parents
3d3c30d4
fe26f7f3
Merge remote-tracking branch 'origin/main'
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
87 additions
and
17 deletions
sight_harmony/build-profile.json5
sight_harmony/commons/wdKit/build-profile.json5
sight_harmony/commons/wdKit/hvigorfile.ts
sight_harmony/commons/wdKit/src/main/ets/utils/AppUtils.ets
sight_harmony/commons/wdNetwork/src/main/ets/http/AxiosRequest.ets
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpCommonParams.ets
sight_harmony/features/wdComponent/src/main/ets/components/setting/AboutPageUI.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
sight_harmony/features/wdPlayer/src/main/ets/pages/WDPlayerRenderView.ets
sight_harmony/build-profile.json5
View file @
87a2432
...
...
@@ -50,6 +50,13 @@
"compileSdkVersion"
:
"5.0.0(12)"
,
"compatibleSdkVersion"
:
"5.0.0(12)"
,
"runtimeOS"
:
"HarmonyOS"
,
"buildOption"
:
{
"arkOptions"
:
{
"buildProfileFields"
:
{
"BUILD_VERSION"
:
""
}
}
},
}
,
{
"name"
:
"productRELEASE"
,
...
...
@@ -57,6 +64,13 @@
"compileSdkVersion"
:
"5.0.0(12)"
,
"compatibleSdkVersion"
:
"5.0.0(12)"
,
"runtimeOS"
:
"HarmonyOS"
,
"buildOption"
:
{
"arkOptions"
:
{
"buildProfileFields"
:
{
"BUILD_VERSION"
:
""
}
}
}
}
],
"buildModeSet"
:
[
...
...
sight_harmony/commons/wdKit/build-profile.json5
View file @
87a2432
...
...
@@ -2,7 +2,9 @@
"apiType"
:
"stageMode"
,
"buildOption"
:
{
"arkOptions"
:
{
//
"apPath"
:
"./modules.ap"
/*
Profile
used
for
profile-guided
optimization
(PGO)
,
a
compiler
optimization
technique
to
improve
app
runtime
performance.
*/
"buildProfileFields"
:
{
"BUILD_TIME"
:
""
}
}
},
"buildOptionSet"
:
[
...
...
@@ -16,6 +18,9 @@
"./obfuscation-rules.txt"
]
}
},
"buildProfileFields"
:
{
"BUILD_TIME"
:
""
}
}
},
...
...
sight_harmony/commons/wdKit/hvigorfile.ts
View file @
87a2432
import
{
hspTasks
}
from
'@ohos/hvigor-ohos-plugin'
;
import
{
appTasks
,
OhosAppContext
,
OhosPluginId
}
from
'@ohos/hvigor-ohos-plugin'
;
import
{
hvigor
,
getNode
}
from
'@ohos/hvigor'
// 获取根节点
const
rootNode
=
getNode
(
__filename
);
// 为根节点添加一个afterNodeEvaluate hook 在hook中修改根目录下的build-profile.json5的内容并使能
rootNode
.
afterNodeEvaluate
(
node
=>
{
// 获取app插件的上下文对象
const
appContext
=
node
.
getContext
(
OhosPluginId
.
OHOS_HSP_PLUGIN
)
as
OhosHspContext
;
// 通过上下文对象获取从根目录build-profile.json5文件中读出来的obj对象
const
buildProfileOpt
=
appContext
.
getBuildProfileOpt
();
buildProfileOpt
[
'buildOption'
][
'arkOptions'
][
'buildProfileFields'
]
=
{
"BUILD_VERSION"
:
getBuildVersion
(),
};
// 将obj对象设置回上下文对象以使能到构建的过程与结果中
appContext
.
setBuildProfileOpt
(
buildProfileOpt
);
})
export
default
{
system
:
hspTasks
,
/* Built-in plugin of Hvigor. It cannot be modified. */
plugins
:[]
/* Custom plugin to extend the functionality of Hvigor. */
plugins
:
[]
/* Custom plugin to extend the functionality of Hvigor. */
}
function
getBuildVersion
()
{
// build时间作为版本
let
now
=
new
Date
()
let
year
=
now
.
getFullYear
()
let
month
=
(
'0'
+
(
now
.
getMonth
()
+
1
)).
slice
(
-
2
)
let
day
=
(
'0'
+
(
now
.
getDate
())).
slice
(
-
2
)
let
hours
=
(
'0'
+
(
now
.
getHours
())).
slice
(
-
2
)
let
minutes
=
(
'0'
+
(
now
.
getMinutes
())).
slice
(
-
2
)
let
str
=
year
+
month
+
day
+
hours
+
minutes
return
str
;
}
\ No newline at end of file
...
...
sight_harmony/commons/wdKit/src/main/ets/utils/AppUtils.ets
View file @
87a2432
import bundleManager from '@ohos.bundle.bundleManager';
import common from '@ohos.app.ability.common';
import { Logger } from './Logger';
import BuildProfile from 'BuildProfile';
const TAG: string = 'AppUtils';
...
...
@@ -8,9 +9,14 @@ const TAG: string = 'AppUtils';
* 与应用相关属性或操作
*/
export class AppUtils {
private static buildVersion: string = ''
static {
AppUtils.buildVersion = BuildProfile.BUILD_VERSION;
}
/**
* 获取应用名称
* 即:
咪咕视频
* 即:
人民日报
*/
static getAppName(context: common.Context): string {
// todo:获取到的是 $string:app_name
...
...
@@ -20,7 +26,6 @@ export class AppUtils {
/**
* 获取应用的包名
* 即:com.cmcc.myapplication
*/
static getPackageName(context: common.Context): string {
return context.applicationInfo?.name;
...
...
@@ -60,7 +65,6 @@ export class AppUtils {
}
static getOSName() {
// TODO: 待确认,暂时写死Android
return "Harmony"
}
...
...
@@ -74,5 +78,12 @@ export class AppUtils {
}
return '';
}
/**
* 应用build版本,时间,如:'202405291450'
*/
static getBuildVersion(): string {
return AppUtils.buildVersion;
}
}
...
...
sight_harmony/commons/wdNetwork/src/main/ets/http/AxiosRequest.ets
View file @
87a2432
...
...
@@ -40,9 +40,6 @@ instance.interceptors.request.use(
// 公共请求参数
// config.params.key = key
Logger.debug('HttpRequest', 'request: ' + config.url)
// TODO 临时打印token,测试token失效。待删除
Logger.debug('HttpRequest', 'request token: ' + config?.headers?.get('RMRB-X-TOKEN'))
Logger.debug('HttpRequest', 'request cookie: ' + config?.headers?.get('cookie'))
return config;
},
(error: AxiosError) => {
...
...
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpCommonParams.ets
View file @
87a2432
...
...
@@ -16,7 +16,7 @@ export class HttpParams {
headers['plat'] = DeviceUtil.getPlat()
headers['Content-Type'] = 'application/json; charset=utf-8'
headers['device_id'] = DeviceUtil.clientId()
headers['build_version'] =
HttpParams.get
Version()
headers['build_version'] =
AppUtils.getBuild
Version()
headers['adcode'] = HttpUtils.getProvinceCode()
headers['os_version'] = DeviceUtil.getOsVersion()
headers['system'] = AppUtils.getOSName()
...
...
@@ -80,9 +80,4 @@ export class HttpParams {
headers['city_dode'] = encodeURI(cityCode)
}
}
private static getVersion() {
// TODO build时间,待对接build生成属性
return '202401242103';
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/setting/AboutPageUI.ets
View file @
87a2432
...
...
@@ -47,7 +47,7 @@ export struct AboutPageUI {
context.getApplicationContext();
let appVerion = AppUtils.getAppVersionName()
if (StringUtils.isNotEmpty(appVerion)) {
this.version = "版本号:" + appVerion
this.version = "版本号:" + appVerion
+ '.' + AppUtils.getBuildVersion()
}
}
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
View file @
87a2432
...
...
@@ -403,7 +403,8 @@ export struct DetailPlayShortVideoPage {
this.playerController.firstPlay(this.contentDetailData.videoInfo[0].videoUrl, this.PageName, this.PageName,
this.pageParam);
}
}
},
liftVideo: $showCommentList,
})
.width(this.playerWidth)
.height(this.playerHeight)
...
...
sight_harmony/features/wdPlayer/src/main/ets/pages/WDPlayerRenderView.ets
View file @
87a2432
...
...
@@ -49,6 +49,9 @@ export struct WDPlayerRenderView {
@State videoHeight: number = 9
@State videoRatio: number = 16 / 9
@State selfSize: Size = new Size('100%', '100%');
// 是否上推视频中
@Link liftVideo: boolean
private enableAliPlayer = false
aboutToAppear() {
...
...
@@ -61,7 +64,7 @@ export struct WDPlayerRenderView {
this.playerController.onVideoSizeChange = (width: number, height: number) => {
// console.log(`WDPlayerRenderView onVideoSizeChange width:${width} videoTop:${height}`)
Logger.info(TAG, ` onVideoSizeChange width:${width}
videoTop
:${height}`)
Logger.info(TAG, ` onVideoSizeChange width:${width}
height
:${height}`)
this.videoWidth = width;
this.videoHeight = height;
this.videoRatio = width / height
...
...
@@ -127,6 +130,21 @@ export struct WDPlayerRenderView {
if (info.size.width > 0 && info.size.height > 0) {
if (!this.liftVideo) {
if (this.videoHeight > 0 && this.videoWidth > 0) {
this.xComponentController.setXComponentSurfaceRect({
surfaceWidth: info.size.width,
surfaceHeight: info.size.width / this.videoRatio,
});
return
}
this.xComponentController.setXComponentSurfaceRect({
surfaceWidth: info.size.width,
surfaceHeight: info.size.height,
});
return
}
// 竖屏
if (this.videoHeight > 0 && this.videoWidth > 0 && this.videoWidth < this.videoHeight) {
let ratio = this.videoWidth / this.videoHeight
...
...
Please
register
or
login
to post a comment