Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: fix |> 临时屏蔽 fix |> 判断controller与web组件是否绑定 ref |> 增加设备拉黑 ref |> 点击查看评论按钮,页面顶部蒙层颜色过浅 ref |> 增加调试设备profile fix |> 添加返回到稿件详情页刷新页面逻辑 ref |> 竖屏直播横屏流全屏后,增加点击浮层消失功能
Showing
11 changed files
with
60 additions
and
5 deletions
| 1 | + | ||
| 2 | +export interface eventParams { | ||
| 3 | + event: string; | ||
| 4 | +} | ||
| 5 | + | ||
| 6 | +export const enum NativeCallH5Event { | ||
| 7 | + NativeCallH5EventPageWillAppear = '1', | ||
| 8 | + NativeCallH5EventPageWillDisAppear = '2', | ||
| 9 | + NativeCallH5EventAppWillEnterForeground = '3', | ||
| 10 | + NativeCallH5EventAppEnterBackground = '4', | ||
| 11 | + NativeCallH5EventAppPlayingAudio = '5', | ||
| 12 | + NativeCallH5EventUpdateBrowseCount = '6', | ||
| 13 | + NativeCallH5EventStartLoadingOnReuse = '7', | ||
| 14 | + | ||
| 15 | + NativeCallH5EventNightModel = '9', | ||
| 16 | + NativeCallH5EventFontSizesChange = '10', | ||
| 17 | + NativeCallH5EventFollowEvent = '11', | ||
| 18 | + NativeCallH5EventLikeEvent = '12' | ||
| 19 | + | ||
| 20 | +} | ||
| 21 | + | ||
| 1 | /** | 22 | /** |
| 2 | * native调用h5,事件id枚举 | 23 | * native调用h5,事件id枚举 |
| 3 | * app主动调用h5方法 | 24 | * app主动调用h5方法 |
| 4 | */ | 25 | */ |
| 5 | export const enum NativeCallH5Type { | 26 | export const enum NativeCallH5Type { |
| 6 | jsCall_receiveAppData = 'jsCall_receiveAppData', | 27 | jsCall_receiveAppData = 'jsCall_receiveAppData', |
| 28 | + jsCall_appNotifyEvent = 'jsCall_appNotifyEvent', | ||
| 7 | // TODO 业务自行新增类型,自行调用,例: | 29 | // TODO 业务自行新增类型,自行调用,例: |
| 8 | // TODO this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData,xxxx) | 30 | // TODO this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData,xxxx) |
| 9 | 31 |
| @@ -4,8 +4,9 @@ import { Logger, WindowModel } from 'wdKit/Index'; | @@ -4,8 +4,9 @@ import { Logger, WindowModel } from 'wdKit/Index'; | ||
| 4 | import { performJSCallNative } from './JsBridgeBiz'; | 4 | import { performJSCallNative } from './JsBridgeBiz'; |
| 5 | import { H5CallNativeType } from './H5CallNativeType'; | 5 | import { H5CallNativeType } from './H5CallNativeType'; |
| 6 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | 6 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; |
| 7 | -import { DateTimeUtils } from 'wdKit' | 7 | +import { DateTimeUtils,EmitterUtils,EmitterEventId } from 'wdKit' |
| 8 | import { window } from '@kit.ArkUI'; | 8 | import { window } from '@kit.ArkUI'; |
| 9 | +import { NativeCallH5Type,NativeCallH5Event,eventParams } from './NativeCallH5Type'; | ||
| 9 | 10 | ||
| 10 | const TAG = 'WdWebLocalComponent'; | 11 | const TAG = 'WdWebLocalComponent'; |
| 11 | 12 | ||
| @@ -32,6 +33,7 @@ export struct WdWebLocalComponent { | @@ -32,6 +33,7 @@ export struct WdWebLocalComponent { | ||
| 32 | @State progressOpacity: number = 1 | 33 | @State progressOpacity: number = 1 |
| 33 | @State durationStringTime: string = ''; | 34 | @State durationStringTime: string = ''; |
| 34 | private progressTimerNumber: number = 0 | 35 | private progressTimerNumber: number = 0 |
| 36 | + private webIsLoaded:boolean = false | ||
| 35 | @State isPause: boolean = true; | 37 | @State isPause: boolean = true; |
| 36 | controller: VideoController = new VideoController() | 38 | controller: VideoController = new VideoController() |
| 37 | @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm'; | 39 | @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm'; |
| @@ -183,6 +185,7 @@ export struct WdWebLocalComponent { | @@ -183,6 +185,7 @@ export struct WdWebLocalComponent { | ||
| 183 | private defaultPerformJSCallNative: (data: Message, f: Callback) => void = (data: Message, f: Callback) => { | 185 | private defaultPerformJSCallNative: (data: Message, f: Callback) => void = (data: Message, f: Callback) => { |
| 184 | performJSCallNative(data, f) | 186 | performJSCallNative(data, f) |
| 185 | } | 187 | } |
| 188 | + | ||
| 186 | onPageBegin: (url?: string) => void = () => { | 189 | onPageBegin: (url?: string) => void = () => { |
| 187 | Logger.debug(TAG, 'onPageBegin'); | 190 | Logger.debug(TAG, 'onPageBegin'); |
| 188 | this.registerHandlers(); | 191 | this.registerHandlers(); |
| @@ -195,6 +198,7 @@ export struct WdWebLocalComponent { | @@ -195,6 +198,7 @@ export struct WdWebLocalComponent { | ||
| 195 | Logger.debug(TAG, 'onPageEnd'); | 198 | Logger.debug(TAG, 'onPageEnd'); |
| 196 | this.onWebPrepared() | 199 | this.onWebPrepared() |
| 197 | this.isPageEnd = true | 200 | this.isPageEnd = true |
| 201 | + this.webIsLoaded = true | ||
| 198 | } | 202 | } |
| 199 | onLoadIntercept: (url?: string) => boolean = () => { | 203 | onLoadIntercept: (url?: string) => boolean = () => { |
| 200 | Logger.debug(TAG, 'onLoadIntercept return false'); | 204 | Logger.debug(TAG, 'onLoadIntercept return false'); |
| @@ -228,6 +232,20 @@ export struct WdWebLocalComponent { | @@ -228,6 +232,20 @@ export struct WdWebLocalComponent { | ||
| 228 | } | 232 | } |
| 229 | } | 233 | } |
| 230 | 234 | ||
| 235 | + aboutToAppear(): void { | ||
| 236 | + this.webIsLoaded = false | ||
| 237 | + EmitterUtils.receiveEvent(EmitterEventId.APP_PAGE_SHOW, () => { | ||
| 238 | + let params = {'event':NativeCallH5Event.NativeCallH5EventPageWillAppear} as eventParams; | ||
| 239 | + let jsonString = JSON.stringify(params); | ||
| 240 | + Logger.debug(TAG, 'APP_PAGE_SHOW'+this.webIsLoaded); | ||
| 241 | + // if (this.webIsLoaded) { | ||
| 242 | + // this.webviewControl.callHandle(NativeCallH5Type.jsCall_appNotifyEvent, jsonString, (data: string) => { | ||
| 243 | + // Logger.debug(TAG, "from js data = " + data); | ||
| 244 | + // }) | ||
| 245 | + // } | ||
| 246 | + }) | ||
| 247 | + } | ||
| 248 | + | ||
| 231 | @Builder | 249 | @Builder |
| 232 | videoComp(){ | 250 | videoComp(){ |
| 233 | Video({ | 251 | Video({ |
| @@ -34,6 +34,7 @@ export struct CommentListDialogView { | @@ -34,6 +34,7 @@ export struct CommentListDialogView { | ||
| 34 | height: this.maxHeight + 'px', | 34 | height: this.maxHeight + 'px', |
| 35 | preferType: SheetType.BOTTOM, | 35 | preferType: SheetType.BOTTOM, |
| 36 | showClose: false, | 36 | showClose: false, |
| 37 | + maskColor: "#50000000", | ||
| 37 | dragBar: false, | 38 | dragBar: false, |
| 38 | onDisappear: () => { | 39 | onDisappear: () => { |
| 39 | this.showCommentList = false | 40 | this.showCommentList = false |
| @@ -68,6 +68,7 @@ export struct PlayerUIComponent { | @@ -68,6 +68,7 @@ export struct PlayerUIComponent { | ||
| 68 | Stack() { | 68 | Stack() { |
| 69 | // 标题 | 69 | // 标题 |
| 70 | PlayerTitleComponent({ playerController: this.playerController }) | 70 | PlayerTitleComponent({ playerController: this.playerController }) |
| 71 | + .visibility(!this.isFullScreen ? Visibility.Visible : (this.isShowControl && this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? Visibility.Visible : Visibility.Hidden)) | ||
| 71 | 72 | ||
| 72 | PlayerCommentComponent() | 73 | PlayerCommentComponent() |
| 73 | .visibility(this.isShowControl ? Visibility.Hidden : Visibility.Visible) | 74 | .visibility(this.isShowControl ? Visibility.Hidden : Visibility.Visible) |
| @@ -6,6 +6,7 @@ import { AccountManagerUtils, SPHelper } from 'wdKit/Index' | @@ -6,6 +6,7 @@ import { AccountManagerUtils, SPHelper } from 'wdKit/Index' | ||
| 6 | import { LoginViewModel } from './pages/login/LoginViewModel' | 6 | import { LoginViewModel } from './pages/login/LoginViewModel' |
| 7 | import { SpConstants } from 'wdConstant/Index' | 7 | import { SpConstants } from 'wdConstant/Index' |
| 8 | import { ReportDeviceInfo } from './reportDeviceInfo/ReportDeviceInfo' | 8 | import { ReportDeviceInfo } from './reportDeviceInfo/ReportDeviceInfo' |
| 9 | +import { common } from '@kit.AbilityKit' | ||
| 9 | 10 | ||
| 10 | class LoginJumpHandler implements JumpInterceptorAction { | 11 | class LoginJumpHandler implements JumpInterceptorAction { |
| 11 | 12 | ||
| @@ -42,12 +43,17 @@ export class LoginModule { | @@ -42,12 +43,17 @@ export class LoginModule { | ||
| 42 | } | 43 | } |
| 43 | 44 | ||
| 44 | // 启动进入主页 和 每次登录成功调用 | 45 | // 启动进入主页 和 每次登录成功调用 |
| 45 | - static reportDeviceInfo() { | 46 | + static reportDeviceInfo(context?: common.UIAbilityContext) { |
| 46 | ReportDeviceInfo.reportDeviceInfo().then((res) => { | 47 | ReportDeviceInfo.reportDeviceInfo().then((res) => { |
| 47 | let nickName = res.touristNickName | 48 | let nickName = res.touristNickName |
| 48 | if (res.touristNickName) { | 49 | if (res.touristNickName) { |
| 49 | SPHelper.default.save(SpConstants.TOURIST_NICK_NAME, res.touristNickName) | 50 | SPHelper.default.save(SpConstants.TOURIST_NICK_NAME, res.touristNickName) |
| 50 | } | 51 | } |
| 52 | + | ||
| 53 | + if (res.blockStatus == -2) { | ||
| 54 | + // Exit the application. | ||
| 55 | + context?.terminateSelf(); | ||
| 56 | + } | ||
| 51 | }) | 57 | }) |
| 52 | } | 58 | } |
| 53 | } | 59 | } |
| @@ -38,4 +38,5 @@ export class ReportDeviceInfo { | @@ -38,4 +38,5 @@ export class ReportDeviceInfo { | ||
| 38 | export class ReportDeviceInfoRes { | 38 | export class ReportDeviceInfoRes { |
| 39 | clean : number = 0 | 39 | clean : number = 0 |
| 40 | touristNickName : string = "" | 40 | touristNickName : string = "" |
| 41 | + blockStatus: number = 0 // 当等于-2时,表示拉黑 | ||
| 41 | } | 42 | } |
| 1 | import { Action } from 'wdBean'; | 1 | import { Action } from 'wdBean'; |
| 2 | import { ImageAndTextPageComponent } from 'wdComponent' | 2 | import { ImageAndTextPageComponent } from 'wdComponent' |
| 3 | -import { Logger } from 'wdKit' | 3 | +import { Logger,EmitterUtils,EmitterEventId } from 'wdKit' |
| 4 | import router from '@ohos.router'; | 4 | import router from '@ohos.router'; |
| 5 | import { TrackConstants } from 'wdTracking/Index'; | 5 | import { TrackConstants } from 'wdTracking/Index'; |
| 6 | 6 | ||
| @@ -47,6 +47,7 @@ struct ImageAndTextDetailPage { | @@ -47,6 +47,7 @@ struct ImageAndTextDetailPage { | ||
| 47 | 47 | ||
| 48 | onPageShow() { | 48 | onPageShow() { |
| 49 | this.pageShow = Math.random() | 49 | this.pageShow = Math.random() |
| 50 | + EmitterUtils.sendEmptyEvent(EmitterEventId.APP_PAGE_SHOW) | ||
| 50 | Logger.info(TAG, 'onPageShow'); | 51 | Logger.info(TAG, 'onPageShow'); |
| 51 | } | 52 | } |
| 52 | 53 |
| @@ -137,7 +137,7 @@ export class StartupManager { | @@ -137,7 +137,7 @@ export class StartupManager { | ||
| 137 | return new Promise((resolve) => { | 137 | return new Promise((resolve) => { |
| 138 | Logger.debug(TAG, "App 初次进入首页,开始其他任务初始化") | 138 | Logger.debug(TAG, "App 初次进入首页,开始其他任务初始化") |
| 139 | 139 | ||
| 140 | - LoginModule.reportDeviceInfo() | 140 | + LoginModule.reportDeviceInfo(this.context) |
| 141 | 141 | ||
| 142 | GetuiPush.sharedInstance().requestEnableNotifications(this.context!).then((enabled) => { | 142 | GetuiPush.sharedInstance().requestEnableNotifications(this.context!).then((enabled) => { |
| 143 | HWLocationUtils.startLocationService() | 143 | HWLocationUtils.startLocationService() |
No preview for this file type
-
Please register or login to post a comment