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 |> 版本修改
  ref |> 冷启动优化
  fix |> 评论行数显示优化
@@ -2,8 +2,8 @@ @@ -2,8 +2,8 @@
2 "app": { 2 "app": {
3 "bundleName": "com.peopledailychina.hosactivity", 3 "bundleName": "com.peopledailychina.hosactivity",
4 "vendor": "$string:app_vendor", 4 "vendor": "$string:app_vendor",
5 - "versionCode": 7402,  
6 - "versionName": "7.4.0.2", 5 + "versionCode": 7403,
  6 + "versionName": "7.4.0.3",
7 "icon": "$media:app_icon", 7 "icon": "$media:app_icon",
8 "label": "$string:app_name" 8 "label": "$string:app_name"
9 } 9 }
@@ -49,6 +49,7 @@ @@ -49,6 +49,7 @@
49 "signingConfig": "default", 49 "signingConfig": "default",
50 "compileSdkVersion": "5.0.0(12)", 50 "compileSdkVersion": "5.0.0(12)",
51 "compatibleSdkVersion": "5.0.0(12)", 51 "compatibleSdkVersion": "5.0.0(12)",
  52 + "compatibleSdkVersionStage": "beta3",
52 "runtimeOS": "HarmonyOS", 53 "runtimeOS": "HarmonyOS",
53 "buildOption": { 54 "buildOption": {
54 "arkOptions": { 55 "arkOptions": {
@@ -64,6 +65,7 @@ @@ -64,6 +65,7 @@
64 "signingConfig": "release", 65 "signingConfig": "release",
65 "compileSdkVersion": "5.0.0(12)", 66 "compileSdkVersion": "5.0.0(12)",
66 "compatibleSdkVersion": "5.0.0(12)", 67 "compatibleSdkVersion": "5.0.0(12)",
  68 + "compatibleSdkVersionStage": "beta3",
67 "runtimeOS": "HarmonyOS", 69 "runtimeOS": "HarmonyOS",
68 "buildOption": { 70 "buildOption": {
69 "arkOptions": { 71 "arkOptions": {
@@ -5,6 +5,7 @@ import { AccountManagerUtils } from '../utils/AccountManagerUtils'; @@ -5,6 +5,7 @@ import { AccountManagerUtils } from '../utils/AccountManagerUtils';
5 import { UserDataLocal } from '../utils/UserDataLocal'; 5 import { UserDataLocal } from '../utils/UserDataLocal';
6 import { EmitterUtils } from '../utils/EmitterUtils'; 6 import { EmitterUtils } from '../utils/EmitterUtils';
7 import { EmitterEventId } from '../utils/EmitterEventId'; 7 import { EmitterEventId } from '../utils/EmitterEventId';
  8 +import { Logger } from '../utils/Logger';
8 9
9 export class UmengStats { 10 export class UmengStats {
10 11
@@ -17,7 +18,7 @@ export class UmengStats { @@ -17,7 +18,7 @@ export class UmengStats {
17 preInit({ 18 preInit({
18 context: context.getApplicationContext(), 19 context: context.getApplicationContext(),
19 plugins: [new InternalPlugin()], 20 plugins: [new InternalPlugin()],
20 - enableLog: true 21 + enableLog: Logger.isDebug
21 22
22 }); 23 });
23 } 24 }
@@ -75,10 +75,19 @@ export class CacheData { @@ -75,10 +75,19 @@ export class CacheData {
75 }) 75 })
76 } 76 }
77 77
78 - static getNetworkData(data: CacheData): string { 78 + static getNetworkDataSync(data: CacheData): string {
79 if (data.networkData) { 79 if (data.networkData) {
80 return JSON.stringify(data.networkData); 80 return JSON.stringify(data.networkData);
81 } 81 }
82 return ""; 82 return "";
83 } 83 }
  84 + static getNetworkDataAsync(data: CacheData): Promise<string> {
  85 + return new Promise((resolve) => {
  86 + let string = ""
  87 + if (data.networkData) {
  88 + string = JSON.stringify(data.networkData);
  89 + }
  90 + resolve(string)
  91 + })
  92 + }
84 } 93 }
@@ -751,7 +751,7 @@ struct commentHeaderView { @@ -751,7 +751,7 @@ struct commentHeaderView {
751 maxline: 3, 751 maxline: 3,
752 fontSize: 16, 752 fontSize: 16,
753 fontWeight: FontWeight.Regular, 753 fontWeight: FontWeight.Regular,
754 - marginWidth: (this.isZD?60:70 + 16) 754 + marginWidth: (this.isZD?60:this.leftGap + 16)
755 }) 755 })
756 .margin({ left: this.leftGap, right: 16,top:-12 }) 756 .margin({ left: this.leftGap, right: 16,top:-12 })
757 .onClick(() => { 757 .onClick(() => {
@@ -41,36 +41,37 @@ export struct CommentText { @@ -41,36 +41,37 @@ export struct CommentText {
41 promise: Promise<Array<display.Display>> = display.getAllDisplays() 41 promise: Promise<Array<display.Display>> = display.getAllDisplays()
42 42
43 aboutToAppear() { 43 aboutToAppear() {
44 - // this.longMessage = TestLongText 44 + let tempMessage = new String(this.longMessage)
  45 + tempMessage = tempMessage.replace(/\n/g,'')
  46 + // console.log(`>>>>>>>文本:${this.longMessage}-${tempMessage}`)
45 47
46 - console.log(`文本宽度为:${this.textWidth}`)  
47 let padding = vp2px(5 + this.marginWidth) 48 let padding = vp2px(5 + this.marginWidth)
48 49
49 this.textWidth = measure.measureText({ 50 this.textWidth = measure.measureText({
50 - textContent: this.longMessage, 51 + textContent: tempMessage.toString(),
51 fontSize: this.fontSize, 52 fontSize: this.fontSize,
52 fontWeight: this.fontWeight, 53 fontWeight: this.fontWeight,
53 - constraintWidth: (this.screenWidth - padding),  
54 wordBreak:WordBreak.BREAK_ALL 54 wordBreak:WordBreak.BREAK_ALL
55 }) 55 })
56 56
57 - console.log(`文本宽度为:${this.textWidth}`)  
58 - 57 + // console.log(`>>>>>>>文本宽度为:${this.textWidth}-${this.contentText}`)
59 this.promise.then((data: Array<display.Display>) => { 58 this.promise.then((data: Array<display.Display>) => {
60 console.log(`所有的屏幕信息:${JSON.stringify(data)}`) 59 console.log(`所有的屏幕信息:${JSON.stringify(data)}`)
61 //单位为像素 60 //单位为像素
62 this.screenWidth = data[0]["width"] 61 this.screenWidth = data[0]["width"]
63 - // 屏幕宽度 * 最大行数 * 组件宽度比例 和 文字测量宽度 62 + // 屏幕宽度 * 最大行数 * 组件宽度比例 和 文字测量宽度3900,,3951
64 this.isExpanded = (this.screenWidth - padding) * this.lines <= this.textWidth 63 this.isExpanded = (this.screenWidth - padding) * this.lines <= this.textWidth
65 // this.expandedStates = this.isExpanded; 64 // this.expandedStates = this.isExpanded;
66 65
67 let lines = this.getTextLineNum( 66 let lines = this.getTextLineNum(
68 - this.longMessage, 67 + tempMessage.toString(),
69 (this.screenWidth - padding), 68 (this.screenWidth - padding),
70 this.lineHeight, 69 this.lineHeight,
71 this.fontSize, 70 this.fontSize,
72 this.fontWeight 71 this.fontWeight
73 ) 72 )
  73 +
  74 + console.log(`>>>>>>>行高数:${lines}-${this.screenWidth}-${this.longMessage}`)
74 if (lines > 3) { 75 if (lines > 3) {
75 this.isExpanded = true 76 this.isExpanded = true
76 } 77 }
@@ -82,8 +83,8 @@ export struct CommentText { @@ -82,8 +83,8 @@ export struct CommentText {
82 let padding = vp2px(5 + this.marginWidth) 83 let padding = vp2px(5 + this.marginWidth)
83 let maxLineTextWidth = (this.screenWidth - padding) * this.maxline; 84 let maxLineTextWidth = (this.screenWidth - padding) * this.maxline;
84 85
85 - for (let index = 0; index < this.longMessage.length; index++) {  
86 - const element = this.longMessage.substring(0, index) 86 + for (let index = 0; index < tempMessage.length; index++) {
  87 + const element = tempMessage.substring(0, index)
87 const string = element + this.collapseText; //截取 88 const string = element + this.collapseText; //截取
88 const thisTextWidth = measure.measureText({ 89 const thisTextWidth = measure.measureText({
89 textContent: string, 90 textContent: string,
@@ -3,7 +3,7 @@ import { LottieView } from '../../lottie/LottieView' @@ -3,7 +3,7 @@ import { LottieView } from '../../lottie/LottieView'
3 import lottie from '@ohos/lottie'; 3 import lottie from '@ohos/lottie';
4 import { CommonConstants } from 'wdConstant'; 4 import { CommonConstants } from 'wdConstant';
5 import { common} from '@kit.AbilityKit'; 5 import { common} from '@kit.AbilityKit';
6 -import { VoiceRecoginizer } from 'wdHwAbility/src/main/ets/voiceRecognizer/VoiceRecoginizer'; 6 +import { VoiceRecoginizer } from 'wdHwAbility';
7 7
8 @Component 8 @Component
9 export struct VoiceInputView { 9 export struct VoiceInputView {
@@ -42,8 +42,10 @@ export class ChannelViewModel { @@ -42,8 +42,10 @@ export class ChannelViewModel {
42 CacheData.getLocalCacheData(CacheData.bottomCacheKey).then((data) => { 42 CacheData.getLocalCacheData(CacheData.bottomCacheKey).then((data) => {
43 // Logger.debug(TAG, 'getBottomNavCacheData 333 ' + JSON.stringify(data)); 43 // Logger.debug(TAG, 'getBottomNavCacheData 333 ' + JSON.stringify(data));
44 if (data) { 44 if (data) {
45 - let navBean = JSON.parse(CacheData.getNetworkData(data)) as NavigationBodyDTO  
46 - success(navBean) 45 + CacheData.getNetworkDataAsync(data).then((json) => {
  46 + let navBean = JSON.parse(json) as NavigationBodyDTO
  47 + success(navBean)
  48 + })
47 } else { 49 } else {
48 success(null) 50 success(null)
49 } 51 }
@@ -68,8 +70,10 @@ export class ChannelViewModel { @@ -68,8 +70,10 @@ export class ChannelViewModel {
68 return new Promise<NavigationDetailDTO | null>((success) => { 70 return new Promise<NavigationDetailDTO | null>((success) => {
69 CacheData.getLocalCacheData(CacheData.channelCacheDataKey + id).then((data) => { 71 CacheData.getLocalCacheData(CacheData.channelCacheDataKey + id).then((data) => {
70 if (data) { 72 if (data) {
71 - let navBean = JSON.parse(CacheData.getNetworkData(data)) as NavigationDetailDTO  
72 - success(navBean) 73 + CacheData.getNetworkDataAsync(data).then((json) => {
  74 + let navBean = JSON.parse(json) as NavigationDetailDTO
  75 + success(navBean)
  76 + })
73 } else { 77 } else {
74 success(null) 78 success(null)
75 } 79 }
@@ -367,8 +367,10 @@ export class PageViewModel extends BaseViewModel { @@ -367,8 +367,10 @@ export class PageViewModel extends BaseViewModel {
367 CacheData.getLocalCacheData(CacheData.comPageInfoCacheKey + pageId).then((data) => { 367 CacheData.getLocalCacheData(CacheData.comPageInfoCacheKey + pageId).then((data) => {
368 // Logger.debug(TAG, 'getPageInfoCache 333 ' + JSON.stringify(data)); 368 // Logger.debug(TAG, 'getPageInfoCache 333 ' + JSON.stringify(data));
369 if (data) { 369 if (data) {
370 - let navBean = JSON.parse(CacheData.getNetworkData(data)) as PageInfoDTO  
371 - success(navBean) 370 + CacheData.getNetworkDataAsync(data).then((json) => {
  371 + let navBean = JSON.parse(json) as PageInfoDTO
  372 + success(navBean)
  373 + })
372 } else { 374 } else {
373 success(null) 375 success(null)
374 } 376 }
@@ -391,8 +393,10 @@ export class PageViewModel extends BaseViewModel { @@ -391,8 +393,10 @@ export class PageViewModel extends BaseViewModel {
391 .then((data) => { 393 .then((data) => {
392 // Logger.debug(TAG, 'getPageGroupCacheData 333 ' + JSON.stringify(data)); 394 // Logger.debug(TAG, 'getPageGroupCacheData 333 ' + JSON.stringify(data));
393 if (data) { 395 if (data) {
394 - let navBean = JSON.parse(CacheData.getNetworkData(data)) as PageDTO  
395 - success(navBean) 396 + CacheData.getNetworkDataAsync(data).then((json) => {
  397 + let navBean = JSON.parse(json) as PageDTO
  398 + success(navBean)
  399 + })
396 } else { 400 } else {
397 success(null) 401 success(null)
398 } 402 }
1 import { audio } from '@kit.AudioKit' 1 import { audio } from '@kit.AudioKit'
2 import { ArkTSUtils } from '@kit.ArkTS' 2 import { ArkTSUtils } from '@kit.ArkTS'
3 -import {getVoicebufferDataLengthByte} from 'neonui' 3 +import lazy {getVoicebufferDataLengthByte} from 'neonui'
4 import process from '@ohos.process' 4 import process from '@ohos.process'
5 -import { NativeNui } from 'neonui' 5 +import lazy { NativeNui } from 'neonui'
6 6
7 let TAG:string = "AudioCapturer" 7 let TAG:string = "AudioCapturer"
8 //音频采集器类,主要用于采集音频,写入文件 8 //音频采集器类,主要用于采集音频,写入文件
1 1
2 -import {NativeNui,Constants,MapToJson,INativeNuiCallback, AsrResult, KwsResult} from 'neonui' 2 +import lazy {NativeNui,Constants,MapToJson,INativeNuiCallback, AsrResult, KwsResult} from 'neonui'
3 import { PermissionUtils,DeviceUtil, Logger, DateTimeUtils } from 'wdKit'; 3 import { PermissionUtils,DeviceUtil, Logger, DateTimeUtils } from 'wdKit';
4 import AudioCapturer from './AudioCapture'; 4 import AudioCapturer from './AudioCapture';
5 import { common, Permissions } from '@kit.AbilityKit'; 5 import { common, Permissions } from '@kit.AbilityKit';
@@ -71,14 +71,20 @@ export default class HuaweiAuth { @@ -71,14 +71,20 @@ export default class HuaweiAuth {
71 return; 71 return;
72 } 72 }
73 73
74 - Logger.info(TAG, 'get anonymousPhone is empty. ' + JSON.stringify(response)); 74 + Logger.infoOptimize(TAG, () => {
  75 + return 'get anonymousPhone is empty. ' + JSON.stringify(response)
  76 + });
75 fail("获取匿名手机号为空") 77 fail("获取匿名手机号为空")
76 }).catch((err: BusinessError) => { 78 }).catch((err: BusinessError) => {
77 - Logger.error(TAG, 'get anonymousPhone failed. ' + JSON.stringify(err)); 79 + Logger.errorOptimize(TAG, () => {
  80 + return 'get anonymousPhone failed. ' + JSON.stringify(err)
  81 + })
78 fail("获取匿名手机号失败") 82 fail("获取匿名手机号失败")
79 }) 83 })
80 } catch (err) { 84 } catch (err) {
81 - Logger.error(TAG, 'get anonymousPhone fail. ' + JSON.stringify(err)); 85 + Logger.errorOptimize(TAG, () => {
  86 + return 'get anonymousPhone fail. ' + JSON.stringify(err)
  87 + })
82 fail("获取匿名手机号失败") 88 fail("获取匿名手机号失败")
83 } 89 }
84 }) 90 })
@@ -63,15 +63,14 @@ struct MainPage { @@ -63,15 +63,14 @@ struct MainPage {
63 } 63 }
64 64
65 setTimeout(() => { 65 setTimeout(() => {
66 - // 这里延后,因为有可能是换端进入H5页面  
67 - setTimeout(() => {  
68 - StartupManager.sharedInstance().appReachMainPage()  
69 - }, 200)  
70 -  
71 webview.WebviewController.initializeWebEngine() 66 webview.WebviewController.initializeWebEngine()
72 ComponentModule.preInitArticleWebTemplate(this.getUIContext()) 67 ComponentModule.preInitArticleWebTemplate(this.getUIContext())
  68 + }, 1000)
  69 + // 这里延后,因为有可能是换端进入H5页面
  70 + setTimeout(() => {
  71 + StartupManager.sharedInstance().appReachMainPage()
  72 + }, 700)
73 73
74 - }, 500)  
75 } 74 }
76 75
77 pageTransition() { 76 pageTransition() {