陈剑华

Merge remote-tracking branch 'origin/main'

... ... @@ -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) {
... ...
... ... @@ -96,21 +96,16 @@ export default struct MinePageUserSimpleInfoUI {
})
if (this.levelId !== 0){
Stack(){
Image($r('app.media.mine_grade_bg'))
.width(44)
.height(15)
.objectFit(ImageFit.Auto)
Text(`等级${this.levelId}`)
.fontColor(Color.White)
.fontFamily('PingFang SC-Semibold')
.fontWeight(600)
.textAlign(TextAlign.Center)
.fontColor($r('app.color.white'))
.fontSize(10)
.width(this.levelId > 9 ? 35: 26)
.lineHeight(15)
}
.margin({top: 10})
.fontWeight(600)
.margin({ left: 6 })
.backgroundImage($r("app.media.mine_grade_bg"))
.backgroundImageSize(ImageSize.FILL)
.padding({left: 6,right: 6})
.height(16)
}
}
.alignItems(HorizontalAlign.Start)
... ...
... ... @@ -7,11 +7,13 @@ export struct FollowSecondTabsComponent{
@Link data:FollowListItem[]
@State firstIndex:number = 0
@State currentIndex: number = 0
@Prop LeftTab:number = 0 //监听tab变化,重置列表tabIndex = 0
private swiperController: SwiperController = new SwiperController()
fontColor: string = '#000000'
selectedFontColor: string = '#ED2800'
aboutToAppear(){
}
build(){
... ... @@ -76,7 +78,7 @@ export struct FollowSecondTabsComponent{
Swiper(this.swiperController ) {
ForEach(this.data[this.firstIndex].children, (item: FollowSecondListItem, index: number ) => {
FollowThirdTabsComponent({data:$data,firstIndex:$firstIndex,secondIndex:index})
FollowThirdTabsComponent({data:$data,firstIndex:$firstIndex,secondIndex:index,LeftTab:this.LeftTab})
}, (item: FollowListItem, index: number) => index.toString())
}
.loop(false)
... ... @@ -102,6 +104,7 @@ export struct FollowSecondTabsComponent{
.onClick(()=>{
this.currentIndex = index
this.swiperController.changeIndex(this.currentIndex)
this.LeftTab = Math.random()
})
.justifyContent(FlexAlign.Center)
.height(50)
... ...
... ... @@ -10,11 +10,21 @@ export struct FollowThirdTabsComponent{
@Link firstIndex: number
@State secondIndex:number = -1
@Watch('LeftTabChange') @Prop LeftTab : number
private swiperController: SwiperController = new SwiperController()
private listScroller: Scroller = new Scroller()
fontColor: string = '#666666'
selectedFontColor: string = '#222222'
///重置界面选择
LeftTabChange(){
if (this.currentIndex != 0) {
this.currentIndex = 0
this.swiperController.changeIndex(this.currentIndex)
this.listScroller.scrollToIndex(this.currentIndex, true, ScrollAlign.CENTER)
}
}
build(){
if(this.data != null){
if(this.data[this.firstIndex].children[this.secondIndex].children == null || this.data[this.firstIndex].children[this.secondIndex].children.length == 0){
... ... @@ -25,6 +35,7 @@ export struct FollowThirdTabsComponent{
}
}
@Builder TabBuilder(index: number, item: FollowThirdListItem) {
Column(){
Row(){
... ... @@ -54,12 +65,10 @@ export struct FollowThirdTabsComponent{
this.listScroller.scrollToIndex(index, true, ScrollAlign.CENTER)
})
.offset({x: -5})
.height(84)
.height(40)
.justifyContent(FlexAlign.End)
}
@Builder FollowThirdUI(){
Column(){
... ... @@ -76,7 +85,7 @@ export struct FollowThirdTabsComponent{
.scrollBar(BarState.Off)
.listDirection(Axis.Horizontal)
.width('100%')
.height(84)
.height(40)
.padding({left: 16,right: 25})
// Column() {
... ...
... ... @@ -107,7 +107,7 @@ export struct HomePageBottomCommentComponent {
//没有更多数据 显示提示
if (!this.hasMore) {
ListItem() {
ListHasNoMoreDataUI().height(this.bottomCompH > 100 ? this.bottomCompH :100)
ListHasNoMoreDataUI().height(this.bottomCompH > 80 ? this.bottomCompH :80)
}
}
}
... ... @@ -172,7 +172,7 @@ export struct HomePageBottomCommentComponent {
parentCommentUserName))
})
this.bottomCompH = DisplayUtils.getDeviceHeight() - data.length*180
this.bottomCompH = DisplayUtils.getDeviceHeight() - data.length*160
if (status.commentIdList.length === 0) {
if (this.curPageNum === 1) this.data_comment.clear()
... ...
... ... @@ -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)
}
})
... ...
... ... @@ -403,6 +403,8 @@ export struct DetailVideoListPage {
// TODO:下拉刷新“努力加载中”
if (!this.peopleShipHomeCreatorId) {
this.queryVideoList()
} else {
this.getRmhPublishNexts(this.peopleShipHomeCreatorId, `${this.data[this.currentIndex].newsId}`, 1, 1, 10, systemDateTime.getTime(false));
}
// this.getRmhPublishNexts(this.peopleShipHomeCreatorId, this.contentId, 1, 1, 10, systemDateTime.getTime(false));
}
... ...
... ... @@ -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 的方式返回内容
... ...