diff --git a/build-profile.json5 b/build-profile.json5 index 9e87e7e6f19020fe21192844709f192cec80fd44..c0ec88e63befd349f9377f3b7483799f329c3c61 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -5,8 +5,7 @@ { "name": "default", "signingConfig": "default", - "targetSdkVersion": "5.0.5(17)", - "compatibleSdkVersion": "5.0.5(17)", + "compatibleSdkVersion": "5.1.1(19)", "runtimeOS": "HarmonyOS", "buildOption": { "strictMode": { diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 7481655bc5be1619028d7d4c6193b64960a5b938..78824def364e528284812a12db667344e2a7eabb 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -1,12 +1,18 @@ import { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; +import { BusinessError } from '@kit.BasicServicesKit' import { window } from '@kit.ArkUI'; const DOMAIN = 0x0000; export default class EntryAbility extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { - this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + try { + this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + } catch (err) { + let error = err as BusinessError; + hilog.info(0x0000, 'testTag', `${error.code}, ${error.message}`); + } hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate'); } diff --git a/entry/src/main/ets/pages/RichTextExpand.ets b/entry/src/main/ets/pages/RichTextExpand.ets index ae795fde808f9c3b51d1c88479102d5ee11359f2..a989c7939ab27a8ee0ee9dd702a85ca2f5c2c18c 100644 --- a/entry/src/main/ets/pages/RichTextExpand.ets +++ b/entry/src/main/ets/pages/RichTextExpand.ets @@ -16,6 +16,8 @@ // [Start RichTextExpand] import { ItemData, RichTextContentModel, RichTextModel, TabData } from '../utils/Models'; import { RichItemPart } from '../view/RichItemPart'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { BusinessError } from '@kit.BasicServicesKit' @Entry @Component @@ -78,49 +80,55 @@ export struct RichTextExpand { //[StartExclude RichTextExpand] model.type = 'link'; model.fontColor = '#007DFF'; - model.content = this.getUIContext().getHostContext()!.resourceManager.getStringSync($r('app.string.topicName').id); - model.link = 'https://www.baidu.com'; - model.index = 0; - model.length = model.content.length; - //[EndExclude RichTextExpand] + try { + model.content = this.getUIContext().getHostContext()!.resourceManager.getStringSync($r('app.string.topicName').id); + model.link = 'https://www.baidu.com'; + model.index = 0; + model.length = model.content.length; + //[EndExclude RichTextExpand] - let model2 = new RichTextContentModel(); - //[StartExclude RichTextExpand] - model2.type = 'images'; - model2.content = '[表情]'; - model2.imgHeight = 19; - model2.imgWidth = 19; - model2.images = ['emoji_1', 'emoji_2', 'emoji_3']; - model2.index = model.index + model.length; - model2.length = model2.images.length; - //[EndExclude RichTextExpand] + let model2 = new RichTextContentModel(); + //[StartExclude RichTextExpand] + model2.type = 'images'; + model2.content = '[表情]'; + model2.imgHeight = 19; + model2.imgWidth = 19; + model2.images = ['emoji_1', 'emoji_2', 'emoji_3']; + model2.index = model.index + model.length; + model2.length = model2.images.length; + //[EndExclude RichTextExpand] - let model3 = new RichTextContentModel(); - //[StartExclude RichTextExpand] - model3.type = 'text'; - model3.fontColor = '#000000'; - model3.content = - ',' + - this.getUIContext().getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_long_title').id); - model3.index = model2.index + model2.length; - model3.length = model3.content.length; - //[EndExclude RichTextExpand] + let model3 = new RichTextContentModel(); + //[StartExclude RichTextExpand] + model3.type = 'text'; + model3.fontColor = '#000000'; + model3.content = + ',' + + this.getUIContext().getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_long_title').id); + model3.index = model2.index + model2.length; + model3.length = model3.content.length; + //[EndExclude RichTextExpand] - let model4 = new RichTextContentModel(); - //[StartExclude RichTextExpand] - model4.type = 'link'; - model4.fontColor = '#007DFF'; - model4.content = - this.getUIContext().getHostContext()!.resourceManager.getStringSync($r('app.string.environmentName').id); - model4.link = 'https://www.baidu.com'; - model4.index = model3.index + model3.length; - model4.length = model4.content.length; - //[EndExclude RichTextExpand] + let model4 = new RichTextContentModel(); + //[StartExclude RichTextExpand] + model4.type = 'link'; + model4.fontColor = '#007DFF'; + model4.content = + this.getUIContext().getHostContext()!.resourceManager.getStringSync($r('app.string.environmentName').id); + model4.link = 'https://www.baidu.com'; + model4.index = model3.index + model3.length; + model4.length = model4.content.length; + //[EndExclude RichTextExpand] - this.dataModel.textArray.push(model); - this.dataModel.textArray.push(model2); - this.dataModel.textArray.push(model3); - this.dataModel.textArray.push(model4); + this.dataModel.textArray.push(model); + this.dataModel.textArray.push(model2); + this.dataModel.textArray.push(model3); + this.dataModel.textArray.push(model4); + } catch (err) { + let error = err as BusinessError; + hilog.info(0x0000, 'testTag', `${error.code}, ${error.message}`); + model.content = ''; + } } build() { diff --git a/entry/src/main/ets/utils/TextUtils.ets b/entry/src/main/ets/utils/TextUtils.ets index 894ef9ed45e7a7ea5817272932c4f18ed5ed18f0..e411cc1dbf188bde552e33d96794949d227de7da 100644 --- a/entry/src/main/ets/utils/TextUtils.ets +++ b/entry/src/main/ets/utils/TextUtils.ets @@ -87,7 +87,7 @@ export class TextUtils { return source; } if (uiContext?.getHostContext()) { - return uiContext?.getHostContext()!.resourceManager.getStringSync(source); + return uiContext?.getHostContext()!.resourceManager.getStringSync(source.id); } return ''; } catch (error) { diff --git a/entry/src/main/ets/view/ItemPart.ets b/entry/src/main/ets/view/ItemPart.ets index adef698d606d9cbd5b11c5e16dcc1d0e52ee5691..cb75684fb5a049fd780a987ec923b616892e9f8f 100644 --- a/entry/src/main/ets/view/ItemPart.ets +++ b/entry/src/main/ets/view/ItemPart.ets @@ -16,6 +16,8 @@ // [Start ItemPart] import { LastSpanAttribute, TextSectionAttribute } from '../utils/Models'; import { TextExpandView } from './TextExpandView'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { BusinessError } from '@kit.BasicServicesKit' @Component export struct ItemPart { @@ -30,12 +32,29 @@ export struct ItemPart { .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_long_title').id)); rawTitleChange() { - this.textSectionAttribute = new TextSectionAttribute(this.getUIContext() - .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_long_title').id)); + try { + this.textSectionAttribute = new TextSectionAttribute(this.getUIContext() + .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_long_title').id)); + } catch (err) { + let error = err as BusinessError; + hilog.info(0x0000, 'testTag', `${error.code}, ${error.message}`); + } } //[EndExclude ItemPart] + handleContent() { + try { + return [this.getUIContext() + .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_expand_title').id), + this.getUIContext() + .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_collapse_title').id), + ]; + } catch (err) { + return ['', '']; + } + } + build() { ListItem() { Flex({ direction: FlexDirection.Column }) { @@ -86,11 +105,7 @@ export struct ItemPart { TextExpandView({ textSectionAttribute: this.textSectionAttribute, lastSpanAttribute: new LastSpanAttribute(0, 2, - [this.getUIContext() - .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_expand_title').id), - this.getUIContext() - .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_collapse_title').id), - ], 16, + this.handleContent(), 16, $r('app.color.text_expand_selected_tab_name')) }).id(`textClick${this.index}`) diff --git a/entry/src/main/ets/view/RichItemPart.ets b/entry/src/main/ets/view/RichItemPart.ets index 6e18ac914ae66c21b26a8cd32acfcc7f449f7f19..7caf2c03d4c5cf310443248f62a5b687974cefe7 100644 --- a/entry/src/main/ets/view/RichItemPart.ets +++ b/entry/src/main/ets/view/RichItemPart.ets @@ -16,6 +16,8 @@ // [Start RichItemPart] import { LastSpanAttribute, RichTextModel, RichTextSectionAttribute } from '../utils/Models'; import { RichTextExpandView } from './RichTextExpandView'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { BusinessError } from '@kit.BasicServicesKit' @Component export struct RichItemPart { @@ -28,6 +30,21 @@ export struct RichItemPart { @Prop tabItemIndex: number; @Prop dataModel: RichTextModel; + handleContent() { + try { + return [this.getUIContext() + .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_expand_title').id), + this.getUIContext() + .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_collapse_title').id), + ]; + } catch (err) { + let error = err as BusinessError; + hilog.info(0x0000, 'testTag', `${error.code}, ${error.message}`); + return ['', '']; + } + + } + build() { ListItem() { Flex({ direction: FlexDirection.Column }) { @@ -72,16 +89,13 @@ export struct RichItemPart { .height(28) .backgroundColor('#0d000000') }; + //[EndExclude RichItemPart] RichTextExpandView({ dataModel: this.dataModel, textSectionAttribute: new RichTextSectionAttribute(this.rawTitle), lastSpanAttribute: new LastSpanAttribute(0, 2, - [this.getUIContext() - .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_expand_title').id), - this.getUIContext() - .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_collapse_title').id), - ], 16, + this.handleContent(), 16, $r('app.color.text_expand_selected_tab_name')) }).id(`textClick${this.index}`); @@ -120,6 +134,7 @@ export struct RichItemPart { top: 17, bottom: 8, }) + //[EndExclude RichItemPart] } .padding({ left: 16, right: 16 }); diff --git a/entry/src/main/ets/view/RichTextExpandView.ets b/entry/src/main/ets/view/RichTextExpandView.ets index 65791145abc644dd5407d655fd4ccc6868c09e4d..85fd6de5b0b66d3a764520062bcd8da7beccf9cf 100644 --- a/entry/src/main/ets/view/RichTextExpandView.ets +++ b/entry/src/main/ets/view/RichTextExpandView.ets @@ -22,6 +22,8 @@ import { RichTextSectionAttribute } from '../utils/Models'; import { TextUtils } from '../utils/TextUtils'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { BusinessError } from '@kit.BasicServicesKit' @Component export struct RichTextExpandView { @@ -43,12 +45,17 @@ export struct RichTextExpandView { // [Start RichTextExpandView_dataModelChange] dataModelChange() { - this.lastSpanAttribute.content = [this.getUIContext() - .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_expand_title').id), - this.getUIContext() - .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_collapse_title').id), - ]; - this.getIsExpanded() + try { + this.lastSpanAttribute.content = [this.getUIContext() + .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_expand_title').id), + this.getUIContext() + .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_collapse_title').id), + ]; + this.getIsExpanded() + } catch (err) { + let error = err as BusinessError; + hilog.info(0x0000, 'testTag', `${error.code}, ${error.message}`); + } } // [End RichTextExpandView_dataModelChange] diff --git a/entry/src/main/ets/view/TextExpandView.ets b/entry/src/main/ets/view/TextExpandView.ets index de1e11b7cebd234afc6cb9297e9c977012f4ea12..7ce1b13f64d3062abe14fb31d782aad908442f11 100644 --- a/entry/src/main/ets/view/TextExpandView.ets +++ b/entry/src/main/ets/view/TextExpandView.ets @@ -15,6 +15,8 @@ // [Start TextExpandView] import { LastSpanAttribute, TextExpandModel, TextSectionAttribute } from '../utils/Models'; import { TextUtils } from '../utils/TextUtils'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { BusinessError } from '@kit.BasicServicesKit' @Component export struct TextExpandView { @@ -37,14 +39,19 @@ export struct TextExpandView { // [Start TextExpandView_textSectionAttributeChange] textSectionAttributeChange() { - this.textModifier.title = this.uiContext - .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_long_title').id); - this.lastSpanAttribute.content = [this.uiContext - .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_expand_title').id), - this.uiContext - .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_collapse_title').id), - ]; - this.getIsExpanded(); + try { + this.textModifier.title = this.uiContext + .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_long_title').id); + this.lastSpanAttribute.content = [this.uiContext + .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_expand_title').id), + this.uiContext + .getHostContext()!.resourceManager.getStringSync($r('app.string.text_expand_collapse_title').id), + ]; + this.getIsExpanded(); + } catch (err) { + let error = err as BusinessError; + hilog.info(0x0000, 'testTag', `${error.code}, ${error.message}`); + } } // [End TextExpandView_textSectionAttributeChange] diff --git a/oh-package-lock.json5 b/oh-package-lock.json5 index c6f99f5c73b06c5fdef7ec6f491b74b7befebe2e..a3925056904d5e0d6791438feddebc0014a84db0 100644 --- a/oh-package-lock.json5 +++ b/oh-package-lock.json5 @@ -1,6 +1,7 @@ { "meta": { - "stableOrder": true + "stableOrder": true, + "enableUnifiedLockfile": false }, "lockfileVersion": 3, "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",