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 |> 20055 直播频道,接口返回数据存在楼层无数据时,未做兼容处理,客户端展示空白页。
  fix |> uat 环境 空字段崩溃
  ref |> 启动性能优化2
  ref |> 启动性能优化
  ref |> log转换Logger
Showing 45 changed files with 264 additions and 122 deletions
... ... @@ -48,20 +48,26 @@ export class NetworkManager {
Logger.info(TAG, 'register success');
})
this.netCon.on('netAvailable', (data: connection.NetHandle) => {
Logger.info(TAG, 'netAvailable, data is: ' + JSON.stringify(data))
Logger.infoOptimize(TAG, () => {
return 'netAvailable, data is: ' + JSON.stringify(data)
})
})
this.netCon.on('netBlockStatusChange', (data: connection.NetBlockStatusInfo) => {
Logger.info(TAG, 'netBlockStatusChange, data is: ' + JSON.stringify(data))
// TODO 网络阻塞,是否创建新的网络、提示
})
this.netCon.on('netCapabilitiesChange', (data: connection.NetCapabilityInfo) => {
Logger.info(TAG, 'netCapabilitiesChange, data is: ' + JSON.stringify(data))
Logger.infoOptimize(TAG, () => {
return 'netCapabilitiesChange, data is: ' + JSON.stringify(data)
})
this.parseData(data)
// 可能多次通知
EmitterUtils.sendEvent(EmitterEventId.NETWORK_CONNECTED, JSON.stringify(this.networkType))
})
this.netCon.on('netConnectionPropertiesChange', (data: connection.NetConnectionPropertyInfo) => {
Logger.info(TAG, 'netConnectionPropertiesChange, data is: ' + JSON.stringify(data))
Logger.infoOptimize(TAG, () => {
return 'netConnectionPropertiesChange, data is: ' + JSON.stringify(data)
})
})
this.netCon.on('netUnavailable', ((data: void) => {
... ...
... ... @@ -10,8 +10,21 @@ const TAG: string = 'AppUtils';
*/
export class AppUtils {
private static buildVersion: string = ''
private static buildProductName: string = ''
private static buildBuildModeName: string = ''
static {
AppUtils.buildVersion = BuildProfile.BUILD_VERSION;
AppUtils.buildProductName = BuildProfile.PRODUCT_NAME;
AppUtils.buildBuildModeName = BuildProfile.BUILD_MODE_NAME;
Logger.isDebug = !AppUtils.isProductRELEASE()
}
public static isProductRELEASE() {
if (AppUtils.buildProductName == "productRELEASE" && AppUtils.buildBuildModeName == "release") {
return true
}
return false
}
// 全局应用context
... ...
... ... @@ -20,7 +20,7 @@ export class KVStoreHelper {
}
static init(context: Context) {
Logger.error(TAG, 'init')
Logger.debug(TAG, 'init')
KVStoreHelper._context = context;
KVStoreHelper.default.createKVManager()
KVStoreHelper.default.createKVStore()
... ... @@ -118,7 +118,9 @@ export class KVStoreHelper {
return;
}
success(data)
Logger.debug(TAG, `Succeeded in getting data. Data:${data}`);
Logger.debugOptimize(TAG, () => {
return `Succeeded in getting data. Data:${data}`
});
});
} catch (e) {
success(def)
... ...
... ... @@ -20,7 +20,7 @@ enum LogLevel {
*/
export class Logger {
private static domain: number = 0xFF00;
private static prefix: string = 'SightApp';
private static prefix: string = 'RMRB';
private static format: string = `%{public}s, %{public}s`;
private static format_ext: string = `%{public}s`;
/**
... ... @@ -28,6 +28,7 @@ export class Logger {
*/
private static CHUNK_SIZE: number = 3500;
static isDebug: boolean = true;
static isCloseOptimzied: boolean = false; // 正常用false,打开是为了暴露性能问题
/**
* constructor.
... ... @@ -35,7 +36,7 @@ export class Logger {
* @param Prefix Identifies the log tag.
* @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF.
*/
constructor(prefix: string = 'SightApp', domain: number = 0xFF00) {
constructor(prefix: string = 'RMRB', domain: number = 0xFF00) {
Logger.prefix = prefix;
Logger.domain = domain;
}
... ... @@ -47,6 +48,16 @@ export class Logger {
Logger.logContent(LogLevel.DEBUG, ...args)
}
static debugOptimize(tag: string, func: () => string) {
if (!Logger.isDebug || Logger.isCloseOptimzied) {
return
}
let param: string[] = []
param.push(tag)
param.push(func())
Logger.logContent(LogLevel.DEBUG, ...param)
}
static info(...args: string[]) {
if (!Logger.isDebug) {
return
... ... @@ -54,6 +65,16 @@ export class Logger {
Logger.logContent(LogLevel.INFO, ...args)
}
static infoOptimize(tag: string, func: () => string) {
if (!Logger.isDebug || Logger.isCloseOptimzied) {
return
}
let param: string[] = []
param.push(tag)
param.push(func())
Logger.logContent(LogLevel.INFO, ...param)
}
static warn(...args: string[]) {
if (!Logger.isDebug) {
return
... ... @@ -61,13 +82,33 @@ export class Logger {
Logger.logContent(LogLevel.WARN, ...args)
}
static warnOptimize(tag: string, func: () => string) {
if (!Logger.isDebug || Logger.isCloseOptimzied) {
return
}
let param: string[] = []
param.push(tag)
param.push(func())
Logger.logContent(LogLevel.WARN, ...param)
}
static error(...args: string[]) {
if (!Logger.isDebug) {
if (!Logger.isDebug || Logger.isCloseOptimzied) {
return
}
Logger.logContent(LogLevel.ERROR, ...args)
}
static errorOptimize(tag: string, func: () => string) {
if (!Logger.isDebug || Logger.isCloseOptimzied) {
return
}
let param: string[] = []
param.push(tag)
param.push(func())
Logger.logContent(LogLevel.ERROR, ...param)
}
static fatal(...args: string[]) {
if (!Logger.isDebug) {
return
... ... @@ -75,6 +116,16 @@ export class Logger {
Logger.logContent(LogLevel.FATAL, ...args)
}
static fatalOptimize(tag: string, func: () => string) {
if (!Logger.isDebug || Logger.isCloseOptimzied) {
return
}
let param: string[] = []
param.push(tag)
param.push(func())
Logger.logContent(LogLevel.FATAL, ...param)
}
static isLoggable(level: LogLevel) {
if (!Logger.isDebug) {
return
... ... @@ -103,7 +154,7 @@ export class Logger {
let prefix = Logger.prefix
if (tag) {
prefix = tag
prefix += "-" + tag
}
switch (level) {
... ... @@ -129,7 +180,7 @@ export class Logger {
let prefix = Logger.prefix
if (tag) {
prefix = tag
prefix += "-" + tag
}
switch (level) {
... ...
... ... @@ -30,6 +30,8 @@ const instance: AxiosInstance = axios.create({
// withCredentials: true
});
const TAG = "HttpRequest"
// 添加请求拦截器
instance.interceptors.request.use(
(config: InternalAxiosRequestConfig) => {
... ... @@ -39,12 +41,14 @@ instance.interceptors.request.use(
}
// 公共请求参数
// config.params.key = key
Logger.debug('HttpRequest', 'request: ' + config.url)
Logger.debugOptimize(TAG, () => {
return 'request: ' + config.url
})
return config;
},
(error: AxiosError) => {
// 请求错误
console.log(`全局请求失败拦截,message:${error.message}`)
Logger.error(`全局请求失败拦截,message:${error.message}`)
return Promise.reject(error);
}
);
... ... @@ -88,13 +92,15 @@ instance.interceptors.response.use(// 响应拦截器response类型就是Axios.r
// }
// const data: ResponseBean<any> = response.data
Logger.debug('HttpRequest', 'response ==============start=================')
Logger.debug('HttpRequest', 'response: ' + JSON.stringify(response.data))
Logger.debug('HttpRequest', 'response ==============end=================')
Logger.debug(TAG, 'response ==============start=================')
Logger.debugOptimize(TAG, () => {
return 'response: ' + JSON.stringify(response.data)
})
Logger.debug(TAG, 'response ==============end=================')
// 改造返回的数据,即将AxiosResponse的data返回,服务端返回的数据
return response.data;
} else {
console.log(`httpStatus:${response.status}-${response.status}!`)
Logger.error(TAG, `httpStatus:${response.status}-${response.status}!`)
// return Promise.reject(error);
return response.data;
}
... ... @@ -107,7 +113,7 @@ instance.interceptors.response.use(// 响应拦截器response类型就是Axios.r
if (error != null && error.response != null) {
let message = buildErrorMsg(error.response.status);
// 错误消息可以使用全局弹框展示出来
console.log(`httpStatus:${error.response?.status}-${message},请检查网络或联系管理员!`)
Logger.error(`httpStatus:${error.response?.status}-${message},请检查网络或联系管理员!`)
errorBean = buildError(error.response.status)
}
return Promise.reject(errorBean);
... ...
... ... @@ -33,7 +33,9 @@ export class AppLinkingManager {
this.onNewWant(want, true)
}
onNewWant(want: Want, startup: boolean = false) {
Logger.debug(TAG, "want: " + JSON.stringify(want))
Logger.debugOptimize(TAG, () => {
return "want: " + JSON.stringify(want)
})
let uri = want?.uri
if (!uri) {
return
... ...
... ... @@ -7,5 +7,6 @@
"license": "Apache-2.0",
"packageType": "InterfaceHar",
"dependencies": {
"wdKit": "file:../wdKit"
}
}
\ No newline at end of file
... ...
... ... @@ -9,6 +9,7 @@ import { uniformTypeDescriptor as utd } from '@kit.ArkData';
import { JSON } from '@kit.ArkTS';
import { image } from '@kit.ImageKit';
import { WDShareBase } from '../WDShareBase';
import { Logger } from 'wdKit';
const TAG = "WDSystemShare"
... ... @@ -32,9 +33,9 @@ export class WDSystemShare implements WDShareInterface {
selectionMode: systemShare.SelectionMode.SINGLE
});
console.log(TAG, "分享控制器调用完成")
Logger.debug(TAG, "分享控制器调用完成")
} catch (e) {
console.log(TAG, "异常1" + JSON.stringify(e))
Logger.error(TAG, "异常1" + JSON.stringify(e))
fail(e)
}
})
... ... @@ -45,7 +46,7 @@ export class WDSystemShare implements WDShareInterface {
if (contentType === ShareContentType.PrueText) {
let prueText = content as ShareContentText
console.log(TAG, "分享纯文本")
Logger.debug(TAG, "分享纯文本")
resolve(new systemShare.SharedData({
utd: utd.UniformDataType.PLAIN_TEXT,
content: prueText.text
... ... @@ -55,7 +56,7 @@ export class WDSystemShare implements WDShareInterface {
if (contentType === ShareContentType.ImageAndText) {
let imageAndText = content as ShareContentImageAndText
console.log(TAG, "分享图片和文本")
Logger.debug(TAG, "分享图片和文本")
let data: systemShare.SharedData = new systemShare.SharedData({
utd: utd.UniformDataType.PLAIN_TEXT,
content: imageAndText.title
... ... @@ -68,11 +69,11 @@ export class WDSystemShare implements WDShareInterface {
return
}
console.log(TAG, "分享链接和文本")
Logger.debug(TAG, "分享链接和文本")
let link = content as ShareContentLink
let posterImg: Uint8Array | undefined = undefined
let shareLink = this.generateShareLink(link)
console.log("TAG, 分享 shareLink ==> " + shareLink)
Logger.debug("TAG, 分享 shareLink ==> " + shareLink)
if (!context || !link.posterImg) {
let data: systemShare.SharedData = new systemShare.SharedData({
... ... @@ -100,7 +101,7 @@ export class WDSystemShare implements WDShareInterface {
resolve(data)
})
.catch((e: Error) => {
console.log(TAG, "异常" + JSON.stringify(e))
Logger.error(TAG, "异常" + JSON.stringify(e))
fail(e)
})
})
... ...
... ... @@ -70,7 +70,9 @@ export struct WdWebComponent {
for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) {
let handleName = H5CallNativeType.JsCallTypeList[i];
let handle = (data: Message, f: Callback) => {
Logger.debug('registerHandlers handlerName: ' + JSON.stringify(data))
Logger.debugOptimize(TAG, () => {
return 'recivedData: ' + JSON.stringify(data)
})
this.defaultPerformJSCallNative(data, f)
this.defaultGetReceiveSubjectData(data, f)
};
... ...
... ... @@ -52,7 +52,9 @@ export class WebArticleEventHandler implements WebEvents {
url = url.replace("%(?![0-9a-fA-F]{2})", "%25")
.replace("\\+", "%2B");
url = decodeURIComponent(url)
Logger.debug(TAG, 'Web onLoadIntercept url: ' + url);
Logger.debugOptimize(TAG, () => {
return 'Web onLoadIntercept url: ' + url
});
if (url.startsWith(BridgeUtil.YY_RETURN_DATA)) {
this.webviewControl?.handlerReturnData(url)
return true
... ... @@ -70,7 +72,9 @@ export class WebArticleEventHandler implements WebEvents {
for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) {
let handleName = H5CallNativeType.JsCallTypeList[i];
let handle = (data: Message, f: Callback) => {
Logger.debug('registerHandlers handlerName: ' + JSON.stringify(data.data))
Logger.debugOptimize(TAG, () => {
return 'receivedData: ' + JSON.stringify(data.data)
})
if (this.currentPageOperateBlock) {
this.currentPageOperateBlock(data, f)
}
... ...
... ... @@ -16,13 +16,14 @@ import { Card19Component } from './cardview/Card19Component';
import { Card20Component } from './cardview/Card20Component';
import { Card21Component } from './cardview/Card21Component';
import { SearchContentComponent } from './cardview/SearchContentComponent';
import { DateTimeUtils } from 'wdKit/Index';
import { DateTimeUtils, Logger } from 'wdKit/Index';
import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index';
import { LiveBigImage02Component } from './cardview/LiveBigImage02Component';
import { LiveBigImage01Component } from './cardview/LiveBigImage01Component';
import { behindDivider } from './cardCommon/behindDivider'
import PageModel from '../viewmodel/PageModel';
const TAG = "CardParser"
/**
* card适配器,卡片样式汇总,依据ContentDTO#appStyle
* 卡片样式,最小单元样式布局
... ... @@ -42,7 +43,9 @@ export struct CardParser {
isNeedDivider:boolean = true
aboutToAppear(): void {
console.log('CardParser-', JSON.stringify(this.contentDTO))
Logger.debugOptimize(TAG, () => {
return JSON.stringify(this.contentDTO)
})
}
onPageShow() {
... ...
... ... @@ -43,7 +43,7 @@ export struct CarderInteraction {
this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + ''
this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
this.contentDTO.shareFlag = this.contentDTO.shareFlag ? this.contentDTO.shareFlag : '1'
console.log('是否显示分享',this.contentDTO.shareFlag)
Logger.debug(TAG, '是否显示分享',this.contentDTO.shareFlag)
// 内容用 点赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
this.likesStyle = this.contentDetailData.likesStyle
this.openLikes = this.contentDetailData.openLikes == 1 ? true : false
... ...
... ... @@ -27,6 +27,7 @@ import {
import { LabelComponent } from './view/LabelComponent';
import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent';
import { behindDivider } from './cardCommon/behindDivider'
import { Logger } from 'wdKit';
/**
* comp适配器.
... ... @@ -46,7 +47,9 @@ export struct CompParser {
aboutToAppear(): void {
console.log('CompParser', JSON.stringify(this.compDTO))
Logger.debugOptimize('CompParser', () => {
return JSON.stringify(this.compDTO)
})
this.pageName = this.pageModel.pageInfo.name
// 轮播图屏蔽音频类型稿件
if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
... ...
... ... @@ -663,7 +663,7 @@ export struct DynamicDetailComponent {
styleType: 1,
onCommentIconClick:()=>{
const info = componentUtils.getRectangleById('comment');
console.log(JSON.stringify(info))
Logger.debug(TAG, JSON.stringify(info))
if (!this.offsetY) {
this.offsetY = componentUtils.getRectangleById('comment').windowOffset.y
... ... @@ -861,7 +861,7 @@ export struct DynamicDetailComponent {
this.newsStatusOfUser = data[0];
// Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
} catch (exception) {
console.error(TAG, JSON.stringify(exception))
Logger.error(TAG, JSON.stringify(exception))
}
}
... ...
... ... @@ -360,7 +360,7 @@ export struct ImageAndTextPageComponent {
this.getRecommend()
}
if (this.contentDetailData?.openLikes === 1) {
console.log(TAG, '点赞this.getInteractDataStatus()')
Logger.debug(TAG, '点赞this.getInteractDataStatus()')
this.getInteractDataStatus()
this.queryContentInteractCount()
}
... ... @@ -425,11 +425,11 @@ export struct ImageAndTextPageComponent {
}
// console.log(TAG,'contentDetailData', JSON.stringify(params.contentList))
let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
console.log(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data))
Logger.debug(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data))
this.newsStatusOfUser = data[0];
// console.log(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
} catch (exception) {
console.error(TAG,'exception', JSON.stringify(exception))
Logger.debug(TAG,'exception', JSON.stringify(exception))
}
}
... ...
import { ContentDTO, joinPeopleNum } from 'wdBean/Index'
import { DateTimeUtils } from 'wdKit/Index'
import { DateTimeUtils, Logger } from 'wdKit/Index'
import { LottieView } from '../../components/lottie/LottieView';
import { LiveModel } from '../../viewmodel/LiveModel'
import font from '@ohos.font';
import text from '@ohos.graphics.text';
const TAG = "CardMediaInfo"
/**
* 这里是样式卡中,右下角显示的音视频信息
* 目前已知:
... ... @@ -86,11 +87,13 @@ export struct CardMediaInfo {
*/
async getJoinPeopleNum() {
if (this.contentDTO.objectType !== '2') return;
console.log('getJoinPeopleNum-ContentDTO', JSON.stringify(this.contentDTO.objectId))
let liveIdList: string = this.contentDTO.objectId
let data: joinPeopleNum[] = await LiveModel.getJoinPeopleNum(liveIdList)
this.joinPeopleNum = data[0].pv;
console.log('getJoinPeopleNum ', this.joinPeopleNum)
Logger.debugOptimize(TAG, () => {
return 'getJoinPeopleNum-ContentDTO' + JSON.stringify(this.contentDTO.objectId)
})
LiveModel.getJoinPeopleNum(this.contentDTO.objectId).then((data) => {
this.joinPeopleNum = data[0].pv;
Logger.debug(TAG, 'getJoinPeopleNum ' + this.joinPeopleNum)
})
}
build() {
... ...
... ... @@ -6,6 +6,8 @@ import { SearchShowRed, textItem, titleInitRes } from '../../utils/searchShowRed
import measure from '@ohos.measure'
import display from '@ohos.display';
const TAG = "CardSourceInfo"
@Reusable
@Component
export struct CardSourceInfo {
... ... @@ -48,7 +50,7 @@ export struct CardSourceInfo {
processText() {
const sourceText = this.contentDTO.rmhPlatform === 1 ? this.contentDTO.rmhInfo?.rmhName : this.contentDTO.source;
if (this.isLimited() && sourceText.length > this.maxLength) {
if (sourceText && this.isLimited() && sourceText.length > this.maxLength) {
this.displayText = sourceText.substring(0, this.maxLength) + '...';
this.isEllipsisActive = true;
} else {
... ... @@ -171,25 +173,25 @@ export struct CardSourceInfo {
calcContentSpace() {
console.log('display-text ,', this.displayText)
// Logger.debug(TAG, 'display-text ' + this.displayText)
if (this.isLimited()) return;
const screenWidth = display.getDefaultDisplaySync().width
let leftSpace = screenWidth;
console.log('display-leftSpace ', leftSpace)
// Logger.debug(TAG, 'display-leftSpace ' + leftSpace)
const souceSize = this.getContentSize(this.displayText, 12);
const dotSize = 11;
if (this.contentDTO.cornerMark || this.contentDTO.corner) {
const cornerSize = this.getContentSize(this.contentDTO.cornerMark || this.contentDTO.corner, 12);
leftSpace = leftSpace - cornerSize
console.log('display-cornerMark ', cornerSize)
// Logger.debug(TAG, ('display-cornerMark ' + cornerSize)
}
if (this.showTime()) {
const timeSize = this.getContentSize(this.handleTimeStr(), 12);
leftSpace = leftSpace - dotSize - timeSize
console.log('display-showtime')
// Logger.debug(TAG, 'display-showtime')
}
if (!this.isEllipsisActive) {
... ... @@ -199,14 +201,14 @@ export struct CardSourceInfo {
commentSize = this.getContentSize(`${this.handlerNum(commentNum.toString())}评`, 12);
}
leftSpace = leftSpace - dotSize - commentSize
console.log('display-commentSize ', commentSize)
// Logger.debug(TAG, 'display-commentSize ' + commentSize)
}
if (leftSpace < souceSize) {
this.onlyShowCornerAndSource = true;
console.log('display-size 1')
// Logger.debug(TAG, 'display-size 1')
}
console.log('display-size 2,', leftSpace, souceSize, this.onlyShowCornerAndSource)
// Logger.debug(TAG, 'display-size 2,' + leftSpace + " " + souceSize + " " + this.onlyShowCornerAndSource)
}
build() {
... ...
... ... @@ -18,6 +18,8 @@ import { InfomationCardClick } from '../../utils/infomationCardClick'
import measure from '@ohos.measure'
import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel'
const TAG = "RmhTitle"
@Component
export struct RmhTitle {
@State compDTO: CompDTO = new CompDTO()
... ... @@ -57,7 +59,7 @@ export struct RmhTitle {
status: this.followStatus == '0' ? 1 : 0,
}
ContentDetailRequest.postInteractAccentionOperate(params2).then(res => {
console.log('rmhTitle-data', JSON.stringify(res.data))
Logger.debug(TAG, 'rmhTitle-data' + JSON.stringify(res.data))
InfomationCardClick.track(
this.compDTO,
... ... @@ -74,7 +76,7 @@ export struct RmhTitle {
this.followStatus = '1'
// 弹窗样式与何时调用待确认
ContentDetailRequest.postPointLevelOperate({ operateType: 6 }).then((res) => {
console.log('关注号主获取积分==', JSON.stringify(res.data))
Logger.debug(TAG, '关注号主获取积分==', JSON.stringify(res.data))
if (res.data?.showToast) {
// ToastUtils.showToast(res.data.ruleName + '+' + res.data.rulePoint + '积分', 1000);
}
... ...
... ... @@ -29,8 +29,10 @@ export struct Card6Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State compIndex: number = 0;
async aboutToAppear(): Promise<void> {
console.log('Card6Component', JSON.stringify(this.contentDTO))
aboutToAppear() {
Logger.debugOptimize(TAG, () => {
return 'Card6Component' + JSON.stringify(this.contentDTO)
})
this.titleInit();
const curRouter = router.getState().name;
this.clicked = hasClicked(this.contentDTO.objectId, curRouter)
... ...
import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource,
Logger,
PublicDialogManager,
StringUtils } from 'wdKit/Index';
import { CommentItemCustomType, commentItemModel, WDPublicUserType } from '../model/CommentModel';
... ... @@ -325,8 +326,9 @@ export struct CommentComponent {
,this.publishCommentModel.targetType
,this.firstPageHotIds)
.then(commentListModel => {
console.log('评论:', JSON.stringify(commentListModel.list))
Logger.debugOptimize('Comment', () => {
return '评论:' + JSON.stringify(commentListModel.list)
})
if (pageIndex == 1) {
// 保存第一页热门评论ids
if (commentListModel.hotIds.length > 0) {
... ...
... ... @@ -160,10 +160,9 @@ export struct CommentCustomDialog {
// this.textInputController.stopEditing()
inputMethod.getController().hideTextInput((err: BusinessError) => {
if (err) {
console.error(`Failed to hideTextInput: ${JSON.stringify(err)}`);
Logger.error(TAG, `Failed to hideTextInput: ${JSON.stringify(err)}`);
return;
}
// console.log('Succeeded in hiding text input.');
})
// this.showKeyboardOnFocus = false
// focusControl.requestFocus("textAreaId") // 弹起键盘
... ... @@ -188,7 +187,7 @@ export struct CommentCustomDialog {
// this.textInputController.stopEditing()
inputMethod.getController().hideTextInput((err: BusinessError) => {
if (err) {
console.error(`Failed to hideTextInput: ${JSON.stringify(err)}`);
Logger.debug(TAG, `Failed to hideTextInput: ${JSON.stringify(err)}`);
return;
}
// console.log('Succeeded in hiding text input.');
... ...
... ... @@ -50,7 +50,7 @@ export struct ZhSingleRow03 {
@State compIndex: number = 0;
resetMoreTips() {
console.log('resetMoreTips', this.moreWidth, this.initMoreWidth)
Logger.debug(TAG, 'resetMoreTips' + this.moreWidth + ' ' + this.initMoreWidth)
if (this.moreWidth < this.initMoreWidth * 2) {
this.moreTips = '查看更多';
}
... ...
... ... @@ -184,7 +184,7 @@ export struct PageComponent {
// 挂角广告
this.pageHornAd()
}
}.layoutWeight(1)
}
@Builder
... ... @@ -301,7 +301,7 @@ export struct PageComponent {
}
async aboutToAppear() {
aboutToAppear() {
// 选中tab,才请求数据。拦截大量接口请求
if (this.navIndex === this.currentTopNavSelectedIndex) {
this.getData();
... ... @@ -364,7 +364,7 @@ export struct PageComponent {
autoRefresh(this.pageModel, this.pageAdvModel)
}
async getData() {
getData() {
if (this.timer) {
clearTimeout(this.timer)
}
... ...
... ... @@ -20,7 +20,7 @@ export struct FirstTabTopSearchComponent {
private swiperController: SwiperController = new SwiperController()
navItem: BottomNavDTO = {} as BottomNavDTO
async aboutToAppear() {
aboutToAppear() {
this.getSearchHint()
}
... ...
import router from '@ohos.router'
import { Params } from 'wdBean';
import { DateTimeUtils, NetworkUtil, NumberFormatterUtils, StringUtils } from 'wdKit';
import { DateTimeUtils, Logger, NetworkUtil, NumberFormatterUtils, StringUtils } from 'wdKit';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import { TrackingPageBrowse, TrackConstants, ParamType, Tracking } from 'wdTracking/Index';
import { OtherHomePageBottomCommentComponent } from '../components/mine/home/OtherHomePageBottomCommentComponent';
... ... @@ -422,7 +422,7 @@ struct OtherNormalUserHomePage {
}
this.getUserLevel()
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
Logger.error(TAG, JSON.stringify(err))
})
}
getUserLevel(){
... ... @@ -440,7 +440,7 @@ struct OtherNormalUserHomePage {
this.levelId = value[0].level
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
Logger.error(TAG,JSON.stringify(err))
})
}
... ...
... ... @@ -2,7 +2,7 @@ import { Params } from 'wdBean/Index';
import { CustomTitleUI } from '../components/reusable/CustomTitleUI';
import { router } from '@kit.ArkUI';
import { FollowListDetailItem } from '../viewmodel/FollowListDetailItem';
import { LazyDataSource, SPHelper, StringUtils } from 'wdKit/Index';
import { LazyDataSource, Logger, SPHelper, StringUtils } from 'wdKit/Index';
import SearcherAboutDataModel from '../model/SearcherAboutDataModel';
import { CreatorDetailRequestItem } from '../viewmodel/CreatorDetailRequestItem';
import { FollowListStatusRequestItem } from '../viewmodel/FollowListStatusRequestItem';
... ... @@ -133,7 +133,7 @@ struct SearchCreatorPage {
this.isLoading = false
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
Logger.error(TAG,"请求失败" + JSON.stringify(err))
this.isLoading = false
this.count = this.count===-1?0:this.count
})
... ... @@ -190,7 +190,7 @@ struct SearchCreatorPage {
.layoutWeight(1)
.scrollBar(BarState.Off)
.onReachEnd(()=>{
console.log(TAG,"触底了");
Logger.debug(TAG,"触底了");
if(!this.isLoading){
this.isLoading = true
//加载分页数据
... ...
import { TAG } from '@ohos/hypium/src/main/Constant';
import { ContentDTO } from 'wdBean/Index';
import { SpConstants } from 'wdConstant/Index'
import { DateTimeUtils, LazyDataSource, NetworkUtil, SPHelper, StringUtils} from 'wdKit/Index'
import { DateTimeUtils, LazyDataSource, Logger, NetworkUtil, SPHelper, StringUtils} from 'wdKit/Index'
import { ProcessUtils } from 'wdRouter/Index';
import { VisitorCommentComponent } from '../components/mine/home/VisitorCommentComponent';
import { CustomPullToRefresh } from '../components/reusable/CustomPullToRefresh';
... ... @@ -176,7 +176,7 @@ struct VisitorCommentPage {
this.isGetRequest = true
this.isLoading = false
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
Logger.error(TAG, "get " + JSON.stringify(err))
this.isGetRequest = true
this.isLoading = false
})
... ...
import { TrackingContent, TrackConstants, ParamType } from 'wdTracking';
import { CompDTO, ContentDTO } from 'wdBean';
import { Logger } from 'wdKit';
export class InfomationCardClick {
... ... @@ -95,7 +96,7 @@ export class InfomationCardClick {
} else if (contentDTO.source) {
extParams['saAuthorName'] = contentDTO.source;
}
console.log('InfomationCardClick-params:', JSON.stringify(extParams))
Logger.debug('InfomationCardClick-params:', JSON.stringify(extParams))
if (action === 'detailPageShow') {
TrackingContent.common(TrackConstants.EventType.Click, pageId, pageName, extParams);
} else if (action === 'like') {
... ... @@ -106,7 +107,7 @@ export class InfomationCardClick {
TrackingContent.follow(bl, followUserId, followUserName, pageId, pageName, extParams)
}
} catch (err) {
console.log('InfomationCardClick-err', JSON.stringify(err))
Logger.error('InfomationCardClick-err', JSON.stringify(err))
}
}
}
\ No newline at end of file
... ...
import { Logger } from "wdKit";
export interface textItem {
content: string,
isRed: boolean
... ... @@ -8,6 +10,8 @@ export interface titleInitRes {
textArr: textItem[]
}
const TAG = "SearchShowRed"
export class SearchShowRed {
// title: this.contentDTO.title
static titleInit(title: string) {
... ... @@ -27,7 +31,9 @@ export class SearchShowRed {
res.push(content);
}
console.log('SearchShowRed-res', JSON.stringify(res))
Logger.debugOptimize(TAG, () => {
return 'SearchShowRed-res' + JSON.stringify(res)
})
SearchShowRed.formatTitle(
html.replaceAll('<em>', '').replaceAll('</em>', ''),
... ... @@ -41,7 +47,9 @@ export class SearchShowRed {
titleMarked,
textArr
}
console.log('SearchShowRed-titleInitRes', JSON.stringify(titleInitRes))
Logger.debugOptimize(TAG, () => {
return 'SearchShowRed-titleInitRes ' + JSON.stringify(titleInitRes)
})
return titleInitRes
}
... ...
import { Logger } from 'wdKit';
import { HttpUtils } from 'wdNetwork/Index';
export interface mournsInfoModel{
... ... @@ -80,7 +81,7 @@ export class GrayManageModel {
this.videoList = mourns.videoList
this.serverList = mourns.serverList
this.grayUserList = mourns.greyUserList
console.log(TAG, 'LaunchDataModel.mourns', JSON.stringify(mourns))
Logger.debug(TAG, 'LaunchDataModel.mourns', JSON.stringify(mourns))
}
// 国殇模式开启
... ...
... ... @@ -118,7 +118,7 @@ export class LiveModel {
fail(data.message)
return
}
console.log('LiveLikeComponent data.data', data.data)
Logger.debug(TAG, 'LiveLikeComponent data.data ' + data.data)
success(data.data)
}, (error: Error) => {
fail(error.message)
... ...
... ... @@ -810,7 +810,9 @@ export class PageHelper {
}
}).catch((err: string | Resource) => {
promptAction.showToast({ message: err });
if(err != "resDTO is empty"){
promptAction.showToast({ message: err });
}
this.loadMoreEnd(pageModel)
})
}
... ...
... ... @@ -53,7 +53,9 @@ export class PlayViewModel {
return
}
Logger.info(TAG, JSON.stringify(data))
Logger.infoOptimize(TAG, () => {
return JSON.stringify(data)
})
this.newsTitle = data.newsTitle
this.editorName = data.editorName
this.newsSummary = data.newsSummary
... ... @@ -87,7 +89,9 @@ export class PlayViewModel {
}
let contentDetailDTO: ContentDetailDTO = resDTO.data[0]
Logger.info(TAG, JSON.stringify(contentDetailDTO))
Logger.infoOptimize(TAG, () => {
return JSON.stringify(contentDetailDTO)
})
this.newsTitle = contentDetailDTO.newsTitle
this.editorName = contentDetailDTO.editorName
this.newsSummary = contentDetailDTO.newsSummary
... ...
... ... @@ -146,7 +146,9 @@ export class GetuiPush {
},
//命令相应回复
onReceiveCommandResult: (result: GTCmdMessage) => {
Logger.debug(TAG, "推送 Cmd Message = " + JSON.stringify(result))
Logger.debugOptimize(TAG, () => {
return "推送 Cmd Message = " + JSON.stringify(result)
})
this.dealWithCmdMessage(result)
},
//sdk 收到透传消息
... ... @@ -198,7 +200,9 @@ export class GetuiPush {
this.onNewWant(want, true)
}
onNewWant(want: Want, startup: boolean = false) {
Logger.debug(TAG, "want: " + JSON.stringify(want))
Logger.debugOptimize(TAG, () => {
return "want: " + JSON.stringify(want)
})
this.lastPushContent = undefined
let pushContent = PushContentParser.getPushLinkFromWant(want)
... ... @@ -441,7 +445,7 @@ export class GetuiPush {
bean["appVersion"] = AppUtils.getAppVersionName()
bean["platform"] = 3
HttpBizUtil.post<ResponseDTO<string>>(url, bean).then((data) => {
Logger.debug(TAG, "上传cid成功" + JSON.stringify(data))
Logger.debug(TAG, "上传cid成功")
}).catch((e: BusinessError) => {
Logger.debug(TAG, "上传cid失败" + JSON.stringify(e))
})
... ...
... ... @@ -5,6 +5,7 @@ import { SpConstants } from 'wdConstant/Index';
import { EmitterEventId, EmitterUtils, Logger, PermissionUtils, ResourcesUtils, SPHelper } from 'wdKit/Index';
import { ResponseDTO } from 'wdNetwork/Index';
const TAG = "HWLocationUtils"
/**
* 系统定位服务实现
* */
... ... @@ -21,7 +22,7 @@ export class HWLocationUtils {
maxAccuracy: 0
};
geoLocationManager.on('locationChange', requestInfo, (data) => {
Logger.debug('location :' + JSON.stringify(data))
Logger.debug(TAG, JSON.stringify(data))
})
}
... ... @@ -35,7 +36,7 @@ export class HWLocationUtils {
maxAccuracy: 0
};
geoLocationManager.on('locationChange', requestInfo, (data) => {
Logger.debug('location :' + JSON.stringify(data)) //{"latitude":31.86870096,"longitude":117.3015341,"altitude":0,"accuracy":5000,"speed":0,"timeStamp":1713332445643,"direction":0,"timeSinceBoot":589519570869240,"additions":"","additionSize":0}
Logger.debug(TAG, JSON.stringify(data)) //{"latitude":31.86870096,"longitude":117.3015341,"altitude":0,"accuracy":5000,"speed":0,"timeStamp":1713332445643,"direction":0,"timeSinceBoot":589519570869240,"additions":"","additionSize":0}
let record: Record<string, string | number> = {};
record['latitude'] = data.latitude
record['longitude'] = data.longitude
... ... @@ -75,13 +76,16 @@ export class HWLocationUtils {
try {
geoLocationManager.getCurrentLocation(requestInfo).then((result) => {
//{"latitude":31.8687047,"longitude":117.30152005,"altitude":0,"accuracy":5000,"speed":0,"timeStamp":1713331875766,"direction":0,"timeSinceBoot":588949694096931,"additions":"","additionSize":0}
Logger.debug('location' + JSON.stringify(result))
Logger.debugOptimize('location', () => {
return JSON.stringify(result)
})
HWLocationUtils.getReverseGeoCodeRequest(result.latitude, result.longitude)
})
.catch((error: number) => {
Logger.debug('location' + JSON.stringify(error))
Logger.error(TAG, JSON.stringify(error))
});
} catch (err) {
Logger.error(TAG, JSON.stringify(err))
}
}
... ... @@ -89,7 +93,7 @@ export class HWLocationUtils {
let requestInfo: geoLocationManager.GeoCodeRequest = { 'description': description };
geoLocationManager.getAddressesFromLocationName(requestInfo, (error, data) => {
if (data) {
Logger.debug('location :' + JSON.stringify(data))
Logger.debug(TAG, JSON.stringify(data))
}
//[{"latitude":31.898204927828598,"longitude":117.29702564819466,"locale":"zh","placeName":"安徽省合肥市瑶海区白龙路与北二环路辅路交叉口南20米","countryCode":"CN","countryName":"中国","administrativeArea":"安徽省","subAdministrativeArea":"合肥市","locality":"合肥市","subLocality":"瑶海区","roadName":"白龙路与北二环路辅路","subRoadName":"20","premises":"20","postalCode":"","phoneNumber":"18756071597","addressUrl":"","descriptionsSize":0,"isFromMock":false}]
})
... ... @@ -103,10 +107,12 @@ export class HWLocationUtils {
};
geoLocationManager.getAddressesFromLocation(requestInfo, async (error, data) => {
if (error) {
Logger.debug('location :' + JSON.stringify(error))
Logger.error(TAG, JSON.stringify(error))
}
if (data) {
Logger.debug('location :' + JSON.stringify(data))
Logger.debugOptimize(TAG, () => {
return JSON.stringify(data)
})
if (data[0] && data[0].administrativeArea && data[0].subAdministrativeArea) {
let cityName = data[0].subAdministrativeArea;
let name = await SPHelper.default.get(SpConstants.LOCATION_CITY_NAME, '') as string
... ... @@ -136,7 +142,7 @@ export class HWLocationUtils {
// geoLocationManager.off('locationChange')
return new Promise<boolean>((success, fail) => {
geoLocationManager.off("locationChange", (data) => {
Logger.debug('location :' + JSON.stringify(data))
Logger.debug(TAG, JSON.stringify(data))
success(true)
})
})
... ...
... ... @@ -256,7 +256,9 @@ export class VoiceRecoginizer {
}
async AsrInit(path:string, filePath:string): Promise<number> {
//console.log("AsrInit this is " + JSON.stringify(this))
Logger.debugOptimize(TAG, () => {
return "AsrInit this is " + JSON.stringify(this)
})
// console.info("AsrInit path: " + path);
//获取工作路径, 这里获得当前nuisdk.aar中assets路径
... ...
... ... @@ -41,11 +41,12 @@ export class LoginModule {
HuaweiAuth.sharedInstance().registerEvents()
AccountManagerUtils.isLogin().then((login) => {
if (!login) {
HuaweiAuth.sharedInstance().rePrefetchAnonymousPhone()
}
})
// 这里启动不在预先取匿名手机号
// AccountManagerUtils.isLogin().then((login) => {
// if (!login) {
// HuaweiAuth.sharedInstance().rePrefetchAnonymousPhone()
// }
// })
RouterJumpInterceptor.register(WDRouterPage.loginPage, new LoginJumpHandler())
}
... ...
... ... @@ -63,7 +63,9 @@ export default class HuaweiAuth {
controller.executeRequest(authRequest).then((response: authentication.AuthorizationWithHuaweiIDResponse) => {
let anonymousPhone = response.data?.extraInfo?.quickLoginAnonymousPhone;
if (anonymousPhone) {
Logger.info(TAG, 'get anonymousPhone, ' + JSON.stringify(response));
Logger.infoOptimize(TAG, () => {
return 'get anonymousPhone, ' + JSON.stringify(response)
})
this._anonymousPhone = anonymousPhone as string
resolve(this._anonymousPhone)
return;
... ...
... ... @@ -157,7 +157,7 @@ export class WDAliPlayerController {
if (this.pageParam) {
console.log('播放视频pageParam', JSON.stringify(this.pageParam))
Logger.debug(TAG, '播放视频pageParam', JSON.stringify(this.pageParam))
// 播放埋点
TrackingPlay.videoPositivePlay(Math.floor((DateTimeUtils.getTimeStamp() - this.creatStartTime) / 1000),
this.pageName, this.pageName, this.pageParam)
... ... @@ -172,7 +172,7 @@ export class WDAliPlayerController {
if (this.pageParam) {
let initDuration = Math.floor(Number(this.duration) / 1000)
let currentPlayTime: number = Math.floor((DateTimeUtils.getTimeStamp() - this.creatStartTime) / 1000) //当前播放时间
console.log('播放结束')
Logger.debug(TAG, '播放结束')
// 播放结束埋点
TrackingPlay.videoPlayEnd(currentPlayTime, initDuration, currentPlayTime, this.pageName, this.pageName,
this.pageParam)
... ... @@ -279,7 +279,7 @@ export class WDAliPlayerController {
this.status = PlayerConstants.STATUS_ERROR;
this.watchStatus();
console.log('播放错误',JSON.stringify(error))
Logger.error(TAG, '播放错误',JSON.stringify(error))
TrackingPlay.videoPlayError(errorInfo.getMsg(), this.pageName, this.pageName, this.pageParam)
}
});
... ...
import componentUtils from '@ohos.arkui.componentUtils';
import { WDPlayerController } from '../controller/WDPlayerController'
import { WindowModel } from 'wdKit';
import { Logger } from '../utils/Logger';
import { WindowModel, Logger } from 'wdKit';
import { enableAliPlayer } from '../utils/GlobalSetting';
import { WDAliPlayerController } from '../controller/WDAliPlayerController';
... ... @@ -24,11 +23,11 @@ class MGPlayRenderViewIns {
static add() {
MGPlayRenderViewIns.intCount++;
WindowModel.shared.setWindowKeepScreenOn(true);
console.log("add-- +1")
Logger.debug(TAG, "add-- +1")
}
static del() {
console.log("del-- -1")
Logger.debug(TAG, "del-- -1")
MGPlayRenderViewIns.intCount--;
if (MGPlayRenderViewIns.intCount <= 0) {
WindowModel.shared.setWindowKeepScreenOn(false);
... ...
import componentUtils from '@ohos.arkui.componentUtils';
import { WindowModel } from 'wdKit';
import { Logger } from '../utils/Logger';
import { WindowModel, Logger } from 'wdKit';
import { enableAliPlayer } from '../utils/GlobalSetting';
import { WDAliPlayerController } from '../controller/WDAliPlayerController';
... ... @@ -23,11 +22,11 @@ class MGPlayRenderViewIns {
static add() {
MGPlayRenderViewIns.intCount++;
WindowModel.shared.setWindowKeepScreenOn(true);
console.log("add-- +1")
Logger.debug(TAG, "add-- +1")
}
static del() {
console.log("del-- -1")
Logger.debug(TAG, "del-- -1")
MGPlayRenderViewIns.intCount--;
if (MGPlayRenderViewIns.intCount <= 0) {
WindowModel.shared.setWindowKeepScreenOn(false);
... ...
... ... @@ -24,11 +24,11 @@ class MGPlayRenderViewIns {
static add() {
MGPlayRenderViewIns.intCount++;
WindowModel.shared.setWindowKeepScreenOn(true);
console.log("add-- +1")
Logger.debug(TAG, "add-- +1")
}
static del() {
console.log("del-- -1")
Logger.debug(TAG, "del-- -1")
MGPlayRenderViewIns.intCount--;
if (MGPlayRenderViewIns.intCount <= 0) {
WindowModel.shared.setWindowKeepScreenOn(false);
... ...
... ... @@ -24,11 +24,11 @@ class MGPlayRenderViewIns {
static add() {
MGPlayRenderViewIns.intCount++;
WindowModel.shared.setWindowKeepScreenOn(true);
console.log("add-- +1")
Logger.debug(TAG, "add-- +1")
}
static del() {
console.log("del-- -1")
Logger.debug(TAG, "del-- -1")
MGPlayRenderViewIns.intCount--;
if (MGPlayRenderViewIns.intCount <= 0) {
WindowModel.shared.setWindowKeepScreenOn(false);
... ... @@ -66,7 +66,6 @@ export struct WDPlayerRenderView {
}
this.playerController.onVideoSizeChange = (width: number, height: number) => {
console.log(`WDPlayerRenderView onVideoSizeChange width:${width} videoTop:${height}`)
Logger.info(TAG, ` onVideoSizeChange width:${width} height:${height}`)
this.videoWidth = width;
this.videoHeight = height;
... ...
... ... @@ -16,6 +16,7 @@ import { LaunchPageModel } from './viewModel/LaunchPageModel';
import { JSON } from '@kit.ArkTS';
import { WebArticleEventHandler, WebPoolManager } from 'wdWebComponent';
import { BridgeWebViewControl } from 'wdJsBridge';
import { webview } from '@kit.ArkWeb';
const TAG = 'MainPage';
... ... @@ -40,8 +41,6 @@ struct MainPage {
aboutToAppear() {
StartupManager.sharedInstance().appReachMainPage()
this.breakpointSystem.register()
// Logger.info(TAG, `aboutToAppear `);
... ... @@ -64,7 +63,14 @@ struct MainPage {
}
setTimeout(() => {
// 这里延后,因为有可能是换端进入H5页面
setTimeout(() => {
StartupManager.sharedInstance().appReachMainPage()
}, 200)
webview.WebviewController.initializeWebEngine()
ComponentModule.preInitArticleWebTemplate(this.getUIContext())
}, 500)
}
... ...
... ... @@ -49,7 +49,9 @@ export class StartupManager {
// App启动
appOnCreate(want: Want, launchParam: AbilityConstant.LaunchParam, context: common.UIAbilityContext) {
Logger.debug(TAG, "App onCreate: " + `\nwant: ${want}\nlaunchParam: ${launchParam}`)
Logger.debugOptimize(TAG, () => {
return "App onCreate: " + `\nwant: ${want}\nlaunchParam: ${launchParam}`
})
this.context = context
// 设置图片文件数据缓存上限为200MB (200MB=200*1024*1024B=209715200B)
app.setImageFileCacheSize(209715200)
... ... @@ -124,9 +126,11 @@ export class StartupManager {
this.initSensorData()
this.initTingyun()
setTimeout(() => {
this.initTingyun()
this.initGeTuiPush()
this.initGeTuiPush()
}, 1000)
this.initUmengStat()
... ... @@ -161,7 +165,7 @@ export class StartupManager {
//TODO:
// 提前初始化webview
webview.WebviewController.initializeWebEngine()
// webview.WebviewController.initializeWebEngine()
initGlobalPlayerSettings(this.context!)
... ...