wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool:
  全屏时底部有块遮罩
  fix |> 修复横屏直播直播间多图消息展示样式与安卓不一致问题
  fix |> 图文详情页前端传递数据给原生方法调整
... ... @@ -54,7 +54,6 @@ export class BridgeWebViewControl extends webview.WebviewController {
* 刷新消息
*/
flushMessageQueue() {
hilog.error(0xFF00, TAG, 'flushMessageQueue');
this.loadUrlCustom(BridgeUtil.JS_FETCH_QUEUE_FROM_JAVA, (data: string) => {
let list: Array<Message> = JSON.parse(data)
if (list == null || list.length == 0) {
... ... @@ -105,6 +104,53 @@ export class BridgeWebViewControl extends webview.WebviewController {
}
receiveDataFromH5(url: string) {
if (!url.startsWith(BridgeUtil.YY_OVERRIDE_SCHEMA)) {
return
}
let functionName: string = url.replace('yy://__QUEUE_MESSAGE__/', '');
let value:Message = JSON.parse(functionName)
let responseId: string = value.responseId
// 是否是response CallBackFunction,收到消息,
if (StringUtils.isNotEmpty(responseId)) {
let call: Callback = this.responseCallbacks.get(responseId)
let responseData: string = value.responseData;
if (StringUtils.isEmpty(responseData) || call === undefined) {
return
}
call(responseData)
this.responseCallbacks.remove(responseId)
} else {
let responseFunction: Callback;
let callbackId: string = value.callbackId
let handlerName: string = value.handlerName
if (StringUtils.isNotEmpty(callbackId)) {
responseFunction = (data: string) => {
let msg: CallBackMessage = new CallBackMessage()
msg.responseId = callbackId
msg.responseData = data
msg.handlerName = handlerName
this.queueMessage(msg)
}
} else {
responseFunction = (data: string) => {
//TODO 更换log输出方式
// Logger.info(TAG, `default response:: ${data}`);
}
}
let handle: BridgeHandler
if (StringUtils.isNotEmpty(value.handlerName)) {
handle = this.messageHandlers.get(value.handlerName)
} else {
handle = new DefaultBridgeHandler()
}
if (handle != undefined && value.data != undefined) {
handle.handle(value, responseFunction)
}
}
}
private queueMessage(msg: CallBackMessage) {
// //TODO
this.dispatchMessage(msg);
... ...
... ... @@ -134,6 +134,7 @@ export struct WdWebComponent {
if (url.startsWith(BridgeUtil.YY_OVERRIDE_SCHEMA)) {
Logger.debug(TAG, 'flushMessageQueue');
this.webviewControl.flushMessageQueue()
// this.webviewControl.receiveDataFromH5(url)
return true
}
if (url.includes(BridgeUtil.BRIDGE_LOADED_MSG)) {
... ...
... ... @@ -99,8 +99,9 @@ export struct WdWebLocalComponent {
return true
}
if (url.startsWith(BridgeUtil.YY_OVERRIDE_SCHEMA)) {
Logger.debug(TAG, 'flushMessageQueue');
this.webviewControl.flushMessageQueue()
Logger.debug(TAG, 'flushMessageQueue:'+url);
// this.webviewControl.flushMessageQueue()
this.webviewControl.receiveDataFromH5(url)
return true
}
return this.onLoadIntercept(event.data.getRequestUrl().toString());
... ... @@ -147,6 +148,8 @@ export struct WdWebLocalComponent {
//webview 高度设置
private setCurrentPageOperate8: (data: Message) => void = (data) => {
Logger.debug('setCurrentPageOperate8: ' + data?.data?.webViewHeight)
if (data.handlerName === H5CallNativeType.jsCall_currentPageOperate && data?.data?.operateType === '8') {
if (typeof this.webHeight === 'number') {
if (Number(data?.data?.webViewHeight) > this.webHeight) {
... ...
... ... @@ -4,29 +4,6 @@ var dpr = window.devicePixelRatio || 1
var clientHeight = 0
var appFontSize = 'normalsize'
/* 判断设备类型 */
function judgTerminal() {
/* 返回当前的用户代理(User Agent)字符串 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1' */
const u = navigator.userAgent
const isXiaomi = u.indexOf('XiaoMi') > -1 // 小米手机
const isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1 // 其它安卓
const isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) // ios
const isHarmony = u.indexOf('ArkWeb') > -1
if (isAndroid) {
return 1
} else if (isIOS) {
if (isXiaomi) {
return 1
} else {
return 2
}
}else if (isHarmony){
return 2
}
return 1
}
// adjust body font size
function setBodyFontSize() {
if (document && document.body) {
... ...
... ... @@ -178,6 +178,7 @@ function judgTerminal() {
const isXiaomi = u.indexOf('XiaoMi') > -1 // 小米手机
const isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1 // 其它安卓
const isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) // ios
const isHarmony = u.indexOf('ArkWeb') > -1 // 鸿蒙
if (isAndroid) {
return 1
} else if (isIOS) {
... ... @@ -186,6 +187,8 @@ function judgTerminal() {
} else {
return 2
}
}else if (isHarmony){
return 2
}
return 1
... ...
... ... @@ -11,7 +11,6 @@ export struct TabLiveItemComponent {
photoList: PhotoListBean[] = []
aboutToAppear(): void {
}
build() {
... ... @@ -93,8 +92,9 @@ export struct TabLiveItemComponent {
if (this.item.pictureUrls.length > 1) {
Image(itemSub)
.width(`${100 / this.item.pictureUrls.length}%`)
// .height(70)
.objectFit(ImageFit.Contain)
.height(this.item.pictureUrls.length == 3 ? 57 : 87)
.objectFit(ImageFit.Cover)
.alt($r('app.media.cover_place_holder'))
.borderRadius(4)
} else {
Image(itemSub)
... ... @@ -102,6 +102,7 @@ export struct TabLiveItemComponent {
// .aspectRatio(this.getAspectRation())
// .height(177)
.objectFit(ImageFit.Contain)
.alt($r('app.media.cover_place_holder'))
.borderRadius(4)
}
}.onClick(() => {
... ... @@ -109,10 +110,13 @@ export struct TabLiveItemComponent {
})
})
}
.enableScrollInteraction(false)
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.margin({
top: 8,
})
.borderRadius(4)
}
//音频
else if (this.item.dataType === LiveMessageOptType.ZH_AUDIO_MSG) {
... ...
... ... @@ -8,7 +8,7 @@ import {
postInteractBrowsOperateParams
} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { HttpUtils } from 'wdNetwork/Index';
import { DateTimeUtils, Logger, WindowModel } from 'wdKit/Index';
import { DateTimeUtils, EmitterEventId, EmitterUtils, Logger, WindowModel } from 'wdKit/Index';
import { PlayerBottomView } from '../view/PlayerBottomView';
import { PlayerRightView } from '../view/PlayerRightView';
import { DisplayDirection } from 'wdConstant/Index';
... ... @@ -512,7 +512,11 @@ export struct DetailPlayShortVideoPage {
WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE)
if (this.displayDirection === DisplayDirection.VERTICAL) {
EmitterUtils.sendEvent(EmitterEventId.FULL_SCREEN, 0)
} else {
EmitterUtils.sendEvent(EmitterEventId.FULL_SCREEN, 1)
}
})
... ...
... ... @@ -29,7 +29,7 @@ export struct BottomNavigationComponent {
@Provide bottomRectHeight: number = 0
private bottomRectHeight1: string = AppStorage.get<number>('bottomSafeHeight') + 'px';
@Provide topRectHeight: number = 0
@Provide isLayoutFullScreen: boolean = false
@State isLayoutFullScreen: boolean = false
@Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL
@Provide isImmersive: boolean = false // 是否开启沉浸式模式 http://192.168.1.3:3300/project/3802/interface/api/189229
@Provide isNight: boolean = false // 是否开启夜间模式
... ... @@ -72,6 +72,13 @@ export struct BottomNavigationComponent {
this.changeBottomNav(assignChannel)
}
})
EmitterUtils.receiveEvent(EmitterEventId.FULL_SCREEN, (str?: string) => {
Logger.debug(TAG, 'receiveEvent FULL_SCREEN: ' + str)
if (str) {
// 跳转指定频道场景,传参底导id、频道id
this.isLayoutFullScreen = str == '1' ? true : false
}
})
}
aboutToDisappear() {
... ... @@ -120,8 +127,7 @@ export struct BottomNavigationComponent {
// 备注:鸿蒙目前只有修改三线导航背景方法,对于全面屏导航条手机需要设置背景色并使其扩散到导航区域
// .backgroundColor(this.barBackgroundColor)
.layoutWeight(1)
Blank().width('100%').height(this.bottomRectHeight1).backgroundColor(this.barBackgroundColor)
Blank().width('100%').height(this.bottomRectHeight1).backgroundColor(this.barBackgroundColor).visibility(this.isLayoutFullScreen?Visibility.None:Visibility.Visible)
}.height('100%').width('100%')
}
... ...
... ... @@ -70,8 +70,9 @@
message.callbackId = callbackId;
}
console.log("WebViewJavascriptBridge55: ", JSON.stringify(message));
sendMessageQueue.push(message);
messagingIframe.src = CUSTOM_PROTOCOL_SCHEME + '://' + QUEUE_HAS_MESSAGE;
messagingIframe.src = CUSTOM_PROTOCOL_SCHEME + '://' + QUEUE_HAS_MESSAGE + encodeURIComponent(JSON.stringify(message));
}
// 提供给native调用,该函数作用:获取sendMessageQueue返回给native,由于android不能直接获取返回的内容,所以使用url shouldOverrideUrlLoading 的方式返回内容
... ...