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
王士厅
2024-08-16 17:55:21 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
59cb603f3dcc8c6e6ea2da31386ac064ff6939ff
59cb603f
1 parent
b8c2a83d
fix: 注释log
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
89 additions
and
89 deletions
sight_harmony/features/wdComponent/src/main/ets/viewmodel/AudioSuspensionModel.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailVideoListPage.ets
sight_harmony/products/phone/src/main/ets/entryability/EntryAbility.ets
sight_harmony/products/phone/src/main/ets/pages/view/AudioComponent.ets
sight_harmony/products/phone/src/main/ets/pages/view/BottomNavigationComponent.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/AudioSuspensionModel.ets
View file @
59cb603
...
...
@@ -24,16 +24,16 @@ export class AudioSuspensionModel {
*/
private initPlayerController() {
if(this.playerController === undefined) {
Logger.info(TAG, 'playerController undefined')
//
Logger.info(TAG, 'playerController undefined')
AppStorage.setOrCreate('playerController', new WDPlayerController({loop: false}));
this.playerController = AppStorage.link<WDPlayerController>('playerController')
Logger.info(TAG, 'playerController create success')
//
Logger.info(TAG, 'playerController create success')
this.playerController.get().onStatusChange = (status: number) => {
console.info(TAG, 'this.currentStatus Model', status)
//
console.info(TAG, 'this.currentStatus Model', status)
EmitterUtils.sendEvent(EmitterEventId.AUDIO_CHANGE_STATUS, status)
}
} else {
Logger.info(TAG, 'playerController already exit')
//
Logger.info(TAG, 'playerController already exit')
}
}
/**
...
...
@@ -52,7 +52,7 @@ export class AudioSuspensionModel {
if (this.url === url) {
this.isMinimize = AppStorage.link<boolean>('isMinimize')
console.log(TAG, 'this.isMinimize', this.isMinimize?.get())
//
console.log(TAG, 'this.isMinimize', this.isMinimize?.get())
if (this.isMinimize?.get()) {
EmitterUtils.sendEvent(EmitterEventId.AUDIO_WINDOW_EXPAND, 1)
AppStorage.setOrCreate('isMinimize', false);
...
...
@@ -78,19 +78,19 @@ export class AudioSuspensionModel {
this.floatWindowClass.get().isShowing((err: BusinessError, data) => {
const errCode: number = err.code;
if (errCode) {
console.error(TAG, 'Failed window is showing Cause:' + JSON.stringify(err));
//
console.error(TAG, 'Failed window is showing Cause:' + JSON.stringify(err));
return;
}
console.info(TAG, 'window is showing: ' + JSON.stringify(data));
//
console.info(TAG, 'window is showing: ' + JSON.stringify(data));
if(data === false) {
// 显示当前窗口,使用callback异步回调。
this.floatWindowClass.get().showWindow((err: BusinessError) => {
let errCode: number = err.code;
if (errCode) {
console.error(TAG, 'floatWindowClass Failed to show the window. Cause: ' + JSON.stringify(err));
//
console.error(TAG, 'floatWindowClass Failed to show the window. Cause: ' + JSON.stringify(err));
return;
}
console.info(TAG, 'floatWindowClass Succeeded in showing the window.');
//
console.info(TAG, 'floatWindowClass Succeeded in showing the window.');
});
}
});
...
...
@@ -101,10 +101,10 @@ export class AudioSuspensionModel {
this.floatWindowClass.get().resize(width, height, (err: BusinessError) => {
let errCode: number = err.code;
if (errCode) {
console.error(TAG, 'floatWindowClass Failed to change the window size. Cause:' + JSON.stringify(err));
//
console.error(TAG, 'floatWindowClass Failed to change the window size. Cause:' + JSON.stringify(err));
return;
}
console.info(TAG, 'floatWindowClass Succeeded in changing the window size.');
//
console.info(TAG, 'floatWindowClass Succeeded in changing the window size.');
});
}
...
...
@@ -113,11 +113,11 @@ export class AudioSuspensionModel {
this.floatWindowClass.get().minimize((err: BusinessError) => {
const errCode: number = err.code;
if (errCode) {
console.error(TAG, 'Failed to minimize the window. Cause: ' + JSON.stringify(err));
//
console.error(TAG, 'Failed to minimize the window. Cause: ' + JSON.stringify(err));
return;
}
AppStorage.setOrCreate('isMinimize', true);
console.info(TAG, 'Succeeded in minimizing the window.');
//
console.info(TAG, 'Succeeded in minimizing the window.');
});
}
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailVideoListPage.ets
View file @
59cb603
...
...
@@ -64,7 +64,7 @@ export struct DetailVideoListPage {
await this.getContentDetail(this.contentId, this.relId, this.relType)
}
await this.queryVideoList()
console.log(TAG, 'aboutToAppear', JSON.stringify(action.params))
//
console.log(TAG, 'aboutToAppear', JSON.stringify(action.params))
} else {
// 无网络
...
...
@@ -77,13 +77,13 @@ export struct DetailVideoListPage {
}
aboutToDisappear(): void {
console.log(TAG, 'aboutToDisappear')
//
console.log(TAG, 'aboutToDisappear')
this.closeFullScreen()
}
// page show/hide只能在外层组件触发
onPageShow(): void {
console.log(TAG, 'onPageShow')
//
console.log(TAG, 'onPageShow')
this.pageShow = Math.random()
this.switchVideoStatus = true
this.openFullScreen()
...
...
@@ -94,10 +94,10 @@ export struct DetailVideoListPage {
this.AudioSuspension.floatWindowClass.get().isShowing((err: BusinessError, data) => {
const errCode: number = err.code;
if (errCode) {
console.error(TAG, 'Failed window is showing Cause:' + JSON.stringify(err));
//
console.error(TAG, 'Failed window is showing Cause:' + JSON.stringify(err));
return;
}
console.info(TAG, 'window is showing: ' + JSON.stringify(data));
//
console.info(TAG, 'window is showing: ' + JSON.stringify(data));
if(data) {
this.isShowAudioCom = true
this.AudioSuspension.playerController.get()?.pause();
...
...
@@ -107,7 +107,7 @@ export struct DetailVideoListPage {
}
onPageHide(): void {
console.log(TAG, 'onPageHide')
//
console.log(TAG, 'onPageHide')
this.switchVideoStatus = false
this.closeFullScreen()
...
...
@@ -116,7 +116,7 @@ export struct DetailVideoListPage {
duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000)
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal,duration)
console.info(TAG, 'this.isShowAudioCom: ' + this.isShowAudioCom);
//
console.info(TAG, 'this.isShowAudioCom: ' + this.isShowAudioCom);
if (this.isShowAudioCom) {
this.AudioSuspension.showWindow()
this.isShowAudioCom = false
...
...
@@ -170,7 +170,7 @@ export struct DetailVideoListPage {
relId: relId,
relType: relType
}).then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => {
console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data))
//
console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data))
this.isOffLine = resDTO.data == null ? true : false
if (resDTO.data) {
const params: contentListParams = {
...
...
@@ -184,7 +184,7 @@ export struct DetailVideoListPage {
if (res.data) {
this.interactDataList = this.interactDataList.concat(res.data)
}
console.log('获取互动点赞等数据===', JSON.stringify(res))
//
console.log('获取互动点赞等数据===', JSON.stringify(res))
})
this.data.push(resDTO.data[0])
}
...
...
@@ -202,7 +202,7 @@ export struct DetailVideoListPage {
if (res.data) {
await this.getContentInteract(res.data)
this.data = this.data.concat(res.data)
console.log('视频列表===', JSON.stringify(res.data))
//
console.log('视频列表===', JSON.stringify(res.data))
}
})
}
...
...
@@ -226,7 +226,7 @@ export struct DetailVideoListPage {
if (res.data) {
this.interactDataList = this.interactDataList.concat(res.data)
}
console.log('获取互动点赞等数据===', JSON.stringify(res))
//
console.log('获取互动点赞等数据===', JSON.stringify(res))
})
}
}
...
...
sight_harmony/products/phone/src/main/ets/entryability/EntryAbility.ets
View file @
59cb603
...
...
@@ -66,43 +66,43 @@ export default class EntryAbility extends UIAbility {
//../../../../../../features/wdLogin/src/main/ets/pages/launchPage/LaunchPage
windowStage.loadContent('pages/launchPage/LaunchPage', (err, data) => {
if (err.code) {
Logger.error(TAG, 'Failed to load the content. Cause: ' + JSON.stringify(err) ?? '');
//
Logger.error(TAG, 'Failed to load the content. Cause: ' + JSON.stringify(err) ?? '');
return;
}
Logger.info(TAG, 'Succeeded in loading the content. Data: ' + JSON.stringify(data) ?? '');
//
Logger.info(TAG, 'Succeeded in loading the content. Data: ' + JSON.stringify(data) ?? '');
});
// 1.创建悬浮窗
windowStage.createSubWindow('subWindow', (err: BusinessError, data) => {
let errCode: number = err.code;
if (errCode) {
Logger.error('floatWindowClass Failed to create the subwindow. Cause: ' + JSON.stringify(err));
//
Logger.error('floatWindowClass Failed to create the subwindow. Cause: ' + JSON.stringify(err));
return;
}
Logger.info('floatWindowClass Succeeded in creating the subwindow. Data: ' + JSON.stringify(data));
//
Logger.info('floatWindowClass Succeeded in creating the subwindow. Data: ' + JSON.stringify(data));
floatWindowClass = data;
AppStorage.setOrCreate('floatWindowClass', floatWindowClass);
// 2.悬浮窗窗口创建成功后,设置悬浮窗的位置、大小及相关属性等。
floatWindowClass.moveWindowTo(initMoveX, initMoveY, (err: BusinessError) => {
let errCode: number = err.code;
if (errCode) {
Logger.error('floatWindowClass Failed to move the window. Cause:' + JSON.stringify(err));
//
Logger.error('floatWindowClass Failed to move the window. Cause:' + JSON.stringify(err));
return;
}
Logger.info('floatWindowClass Succeeded in moving the window.');
//
Logger.info('floatWindowClass Succeeded in moving the window.');
});
// 3.为悬浮窗加载对应的目标页面。
floatWindowClass.setUIContent("pages/view/AudioComponent", (err: BusinessError) => {
let errCode: number = err.code;
if (errCode) {
Logger.error('floatWindowClass Failed to load the content. Cause:' + JSON.stringify(err));
//
Logger.error('floatWindowClass Failed to load the content. Cause:' + JSON.stringify(err));
return;
}
Logger.info('floatWindowClass Succeeded in loading the content.');
//
Logger.info('floatWindowClass Succeeded in loading the content.');
let color: string = 'rgba(0,0,0,0)';
try {
(floatWindowClass as window.Window).setWindowBackgroundColor(color);
} catch (exception) {
Logger.error('Failed to set the background color. Cause: ' + JSON.stringify(exception));
//
Logger.error('Failed to set the background color. Cause: ' + JSON.stringify(exception));
}
;
});
...
...
@@ -110,14 +110,14 @@ export default class EntryAbility extends UIAbility {
floatWindowClass.setWindowFocusable(false, (err: BusinessError) => {
const errCode: number = err.code;
if (errCode) {
console.error(`Failed to set the window to be focusable. Cause code: ${err.code}, message: ${err.message}`);
//
console.error(`Failed to set the window to be focusable. Cause code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in setting the window to be focusable.');
//
console.info('Succeeded in setting the window to be focusable.');
});
floatWindowClass.on('touchOutside', () => {
console.info('touchOutside');
//
console.info('touchOutside');
EmitterUtils.sendEvent(EmitterEventId.AUDIO_WINDOW_TYPE, 3)
});
...
...
@@ -142,20 +142,20 @@ export default class EntryAbility extends UIAbility {
// 普通phone以PORTRAIT/竖屏显示模式启动
// 折叠屏和tablet是以AUTO_ROTATION_RESTRICTED/受开关控制的自动旋转模式启动
WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT)
.then(() => {
Logger.info(TAG, 'setPreferredOrientation Succeeded');
})
.catch((err: Error) => {
Logger.info(TAG,
`setPreferredOrientation catch, error error.name : ${err.name}, error.message:${err.message}`);
})
} else if (DeviceUtil.is2in1()) {
// 2in1(PC)设备不支持旋转(无横竖屏模式),会以默认窗口(非全屏)显示模式启动Logger.info(TAG,`start at 2in1 window device )
Logger.info(TAG, 'start at 2in1 window device')
} else {
// 轻量级智能穿戴/lite wearable device
Logger.info(TAG, 'start at other type device')
// .then(() => {
// Logger.info(TAG, 'setPreferredOrientation Succeeded');
// })
// .catch((err: Error) => {
// Logger.info(TAG, `setPreferredOrientation catch, error error.name : ${err.name}, error.message:${err.message}`);
// })
}
// else if (DeviceUtil.is2in1()) {
// // 2in1(PC)设备不支持旋转(无横竖屏模式),会以默认窗口(非全屏)显示模式启动Logger.info(TAG,`start at 2in1 window device )
// Logger.info(TAG, 'start at 2in1 window device')
// } else {
// // 轻量级智能穿戴/lite wearable device
// Logger.info(TAG, 'start at other type device')
// }
}
...
...
@@ -163,29 +163,29 @@ export default class EntryAbility extends UIAbility {
(floatWindowClass as window.Window).destroyWindow((err: BusinessError) => {
let errCode: number = err.code;
if (errCode) {
Logger.error('floatWindowClass Failed to destroy the window. Cause: ' + JSON.stringify(err));
//
Logger.error('floatWindowClass Failed to destroy the window. Cause: ' + JSON.stringify(err));
return;
}
Logger.info('floatWindowClass Succeeded in destroying the window.');
//
Logger.info('floatWindowClass Succeeded in destroying the window.');
});
}
onWindowStageDestroy(): void {
// Main window is destroyed, release UI related resources
this.destroyFloatWindow()
Logger.info(TAG, 'Ability onWindowStageDestroy');
//
Logger.info(TAG, 'Ability onWindowStageDestroy');
}
onForeground(): void {
// Ability has brought to foreground
Logger.info(TAG, 'Ability onForeground');
//
Logger.info(TAG, 'Ability onForeground');
EmitterUtils.sendEmptyEvent(EmitterEventId.APP_ENTER_FOREGROUD)
}
onBackground(): void {
// Ability has back to background
Logger.info(TAG, 'Ability onBackground');
//
Logger.info(TAG, 'Ability onBackground');
EmitterUtils.sendEmptyEvent(EmitterEventId.APP_ENTER_BACKGROUD)
}
...
...
sight_harmony/products/phone/src/main/ets/pages/view/AudioComponent.ets
View file @
59cb603
...
...
@@ -50,10 +50,10 @@ struct Index {
EmitterUtils.receiveEvent(EmitterEventId.AUDIO_CHANGE_STATUS, (val: number | string | undefined) => {
// val 2 pause
if(val === PlayerConstants.STATUS_PAUSE || val === PlayerConstants.STATUS_COMPLETION) {
console.log(TAG,'AUDIO_CHANGE_STATUS this.currentStatus 2 ', val)
//
console.log(TAG,'AUDIO_CHANGE_STATUS this.currentStatus 2 ', val)
lottie.pause(this.name)
} else if(val === PlayerConstants.STATUS_START) {
console.log(TAG,'AUDIO_CHANGE_STATUS this.currentStatus 1 ', val)
//
console.log(TAG,'AUDIO_CHANGE_STATUS this.currentStatus 1 ', val)
lottie.play(this.name)
}
this.currentStatus = val
...
...
@@ -80,7 +80,7 @@ struct Index {
moveWindow() {
if (this.subWindow == null) {
console.info('Faild in destroying the window.');
//
console.info('Faild in destroying the window.');
} else {
this.subWindow.moveWindowTo(this.windowPosition.x, this.windowPosition.y);
}
...
...
@@ -88,7 +88,7 @@ struct Index {
onPageHide() {
// this.status = PlayerConstants.STATUS_PAUSE;
console.info('onPageHide');
//
console.info('onPageHide');
// this.AudioSuspension.playerController.get()?.pause();
}
...
...
@@ -110,15 +110,15 @@ struct Index {
.fontFamily('PingFang SC-Medium')
.fontWeight(500)
.alignSelf(ItemAlign.Start)
.onStart(() => {
console.info('Marquee animation complete onStart')
})
.onBounce(() => {
console.info('Marquee animation complete onBounce')
})
.onFinish(() => {
console.info('Marquee animation complete onFinish')
})
// .onStart(() => {
// console.info('Marquee animation complete onStart')
// })
// .onBounce(() => {
// console.info('Marquee animation complete onBounce')
// })
// .onFinish(() => {
// console.info('Marquee animation complete onFinish')
// })
Row() {
Text(this.currentTime)
...
...
@@ -209,9 +209,9 @@ struct Index {
}),
PanGesture(this.panOption)
//手势识别成功回调。
.onActionStart((event: GestureEvent) => {
console.info('Pan start');
})
// .onActionStart((event: GestureEvent) => {
// console.info('Pan start');
// })
// 手势移动过程中回调。发生拖拽时,获取到触摸点的位置,并将位置信息传递给windowPosition
.onActionUpdate((event: GestureEvent) => {
// this.windowPosition.x += event.offsetX;
...
...
@@ -219,9 +219,9 @@ struct Index {
this.windowPosition.y = Math.min(Math.max(newY, this.topSafeHeight), this.bottomSafeHeight);
})
//手势识别成功,手指抬起后触发回调。
.onActionEnd(() => {
console.info('Pan end');
})
// .onActionEnd(() => {
// console.info('Pan end');
// })
)
)
.borderRadius(4)
...
...
sight_harmony/products/phone/src/main/ets/pages/view/BottomNavigationComponent.ets
View file @
59cb603
...
...
@@ -61,11 +61,11 @@ export struct BottomNavigationComponent {
async aboutToAppear() {
Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`);
//
Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`);
this.getBottomData()
EmitterUtils.receiveEvent(EmitterEventId.JUMP_HOME_CHANNEL, (str?: string) => {
Logger.debug(TAG, 'receiveEvent JUMP_HOME_CHANNEL: ' + str)
//
Logger.debug(TAG, 'receiveEvent JUMP_HOME_CHANNEL: ' + str)
if (str) {
// 跳转指定频道场景,传参底导id、频道id
let assignChannel = JSON.parse(str) as AssignChannelParam
...
...
@@ -75,7 +75,7 @@ export struct BottomNavigationComponent {
}
aboutToDisappear() {
Logger.info(TAG, `aboutToDisappear, this.currentNavIndex: ${this.currentNavIndex}`);
//
Logger.info(TAG, `aboutToDisappear, this.currentNavIndex: ${this.currentNavIndex}`);
}
build() {
...
...
@@ -153,8 +153,8 @@ export struct BottomNavigationComponent {
this.handleAudio(navItem)
})
.onClick(() => {
Logger.info(TAG, `onChange, index: ${index}`);
Logger.info(TAG, `onChange, navItem: ${JSON.stringify(navItem)}`);
// Logger.info(TAG, `onChange, index: ${index}`);
// Logger.info(TAG, `onChange, navItem: ${JSON.stringify(navItem)}`);
// 底部bar埋点
const params: ParamType = {
"pageName": navItem.pageName,
...
...
@@ -267,10 +267,10 @@ export struct BottomNavigationComponent {
this.AudioSuspension.floatWindowClass.get().isShowing((err: BusinessError, data) => {
const errCode: number = err.code;
if (errCode) {
console.error(TAG, 'Failed window is showing Cause:' + JSON.stringify(err));
//
console.error(TAG, 'Failed window is showing Cause:' + JSON.stringify(err));
return;
}
console.info(TAG, 'window is showing: ' + JSON.stringify(data));
//
console.info(TAG, 'window is showing: ' + JSON.stringify(data));
if(data) {
this.isShowAudioCom = true
this.AudioSuspension.playerController.get()?.pause();
...
...
@@ -278,7 +278,7 @@ export struct BottomNavigationComponent {
}
});
} else {
console.info(TAG, 'this.isShowAudioCom: ' + this.isShowAudioCom);
//
console.info(TAG, 'this.isShowAudioCom: ' + this.isShowAudioCom);
if (this.isShowAudioCom) {
this.AudioSuspension.showWindow()
this.isShowAudioCom = false
...
...
@@ -288,7 +288,7 @@ export struct BottomNavigationComponent {
// 底导切换函数
async onBottomNavigationIndexChange(navItem: BottomNavDTO, index: number) {
Logger.info(TAG, `onBottomNavigationIndexChange to Index:${index},this.currentNavIndex: ${this.currentNavIndex}`);
//
Logger.info(TAG, `onBottomNavigationIndexChange to Index:${index},this.currentNavIndex: ${this.currentNavIndex}`);
if (navItem.name === '我的') {
this.barBackgroundColor = Color.White
...
...
@@ -309,7 +309,7 @@ export struct BottomNavigationComponent {
onBottomNavigationDataUpdated() {
Logger.error('yyyy', 'onBottomNavigationDataUpdated ' + JSON.stringify(this.bottomNavList))
//
Logger.error('yyyy', 'onBottomNavigationDataUpdated ' + JSON.stringify(this.bottomNavList))
}
/**
...
...
@@ -339,18 +339,18 @@ export struct BottomNavigationComponent {
}
private async getBottomData() {
Logger.debug(TAG, 'getBottomData')
//
Logger.debug(TAG, 'getBottomData')
// 1、缓存底导数据
let bottomCache = await ChannelViewModel.getBottomNavCacheData()
if (bottomCache && bottomCache.bottomNavList != null) {
Logger.debug(TAG, 'getBottomData cache success')
//
Logger.debug(TAG, 'getBottomData cache success')
this.setData(bottomCache)
this.getBottomDetail()
}else{
let bottomPreset = await ChannelViewModel.getBottomNavPresetData()
if (bottomPreset && bottomPreset.bottomNavList != null) {
Logger.debug(TAG, 'getBottomData Preset success')
//
Logger.debug(TAG, 'getBottomData Preset success')
this.setData(bottomPreset)
this.getBottomDetail()
}
...
...
@@ -359,7 +359,7 @@ export struct BottomNavigationComponent {
// 3、接口底导数据
let bottomNav = await ChannelViewModel.getBottomNavData()
if (bottomNav && bottomNav.bottomNavList != null) {
Logger.debug(TAG, 'getBottomNavData')
//
Logger.debug(TAG, 'getBottomNavData')
HomeChannelUtils.setBottomNavData(bottomNav)
if (this.bottomNavList == null || this.bottomNavList.length <= 0) {
// 底导没展示,则用接口数据(接口数据回来,不去覆盖缓存数据,没有缓存才加载)
...
...
@@ -395,7 +395,7 @@ export struct BottomNavigationComponent {
}
private setData(data: NavigationBodyDTO) {
Logger.debug(TAG, 'setData')
//
Logger.debug(TAG, 'setData')
if (data == null) {
return
}
...
...
@@ -421,7 +421,7 @@ export struct BottomNavigationComponent {
list = data.bottomNavList
}
if (list.length > 0) {
Logger.info(TAG, `setData, bottomNav.length: ${list.length}`);
//
Logger.info(TAG, `setData, bottomNav.length: ${list.length}`);
// 使用filter方法移除name为'服务'的项
list = list.filter(item => item.name !== '服务');
list.forEach(item => {
...
...
Please
register
or
login
to post a comment