diff --git a/entry/src/main/ets/component/common/constants/CommonConstants.ets b/entry/src/main/ets/component/common/constants/CommonConstants.ets index 41ae45c619806be82c3dce043da2730c0ad3d623..aab878b0640d18195c85e49c32d9ac3797bb44da 100644 --- a/entry/src/main/ets/component/common/constants/CommonConstants.ets +++ b/entry/src/main/ets/component/common/constants/CommonConstants.ets @@ -13,6 +13,8 @@ * limitations under the License. */ +const uiContext: UIContext | undefined = AppStorage.get('uiContext'); + export class CommonConstants { /** * Full percent. @@ -129,5 +131,5 @@ export class CommonConstants { /** * home exit toast. */ - static readonly EXIT_TOAST: string = getContext(this).resourceManager.getStringSync($r('app.string.HOME_EXIT_TOAST')); + static readonly EXIT_TOAST: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.HOME_EXIT_TOAST')); } \ No newline at end of file diff --git a/entry/src/main/ets/component/common/constants/DetailConstants.ets b/entry/src/main/ets/component/common/constants/DetailConstants.ets index 9c9505cf9d77abb5b9e718618cdfd358cb22af58..492cfc3603390478b64447020da0b3d57a9b2d3e 100644 --- a/entry/src/main/ets/component/common/constants/DetailConstants.ets +++ b/entry/src/main/ets/component/common/constants/DetailConstants.ets @@ -13,11 +13,13 @@ * limitations under the License. */ +const uiContext: UIContext | undefined = AppStorage.get('uiContext'); + export class DetailConstants { /** * Living. */ - static readonly LIVING: string = getContext(this).resourceManager.getStringSync($r('app.string.LIVING')); + static readonly LIVING: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.LIVING')); /** * Product detail resources. */ @@ -76,9 +78,9 @@ export class DetailConstants { * Product select type list. */ static readonly SELECT_NAME_LIST: string[] = - [getContext(this).resourceManager.getStringSync($r('app.string.SELECT_NAME_LIST1')), - getContext(this).resourceManager.getStringSync($r('app.string.SELECT_NAME_LIST2')), - getContext(this).resourceManager.getStringSync($r('app.string.SELECT_NAME_LIST3'))]; + [uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SELECT_NAME_LIST1')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SELECT_NAME_LIST2')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SELECT_NAME_LIST3'))]; /** * Product image list. */ @@ -88,16 +90,16 @@ export class DetailConstants { * Button names. */ static readonly BUTTON_NAMES: string[] = - [getContext(this).resourceManager.getStringSync($r('app.string.BUTTON_NAMES1')), - getContext(this).resourceManager.getStringSync($r('app.string.BUTTON_NAMES2'))]; + [uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.BUTTON_NAMES1')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.BUTTON_NAMES2'))]; /** * Pay address and contact. */ static readonly PAY_INFO: string[] = - ['XXXX大道XXXXX楼XX单元XX号', getContext(this).resourceManager.getStringSync($r('app.string.PAY_INFO1')), - getContext(this).resourceManager.getStringSync($r('app.string.PAY_INFO2')), - getContext(this).resourceManager.getStringSync($r('app.string.PAY_INFO3')), - getContext(this).resourceManager.getStringSync($r('app.string.PAY_INFO4'))]; + ['XXXX大道XXXXX楼XX单元XX号', uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PAY_INFO1')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PAY_INFO2')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PAY_INFO3')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PAY_INFO4'))]; /** * Product config list. */ diff --git a/entry/src/main/ets/component/common/constants/HomeConstants.ets b/entry/src/main/ets/component/common/constants/HomeConstants.ets index 219145c68cc0a4cba33e89a50cf756a7e72f7e57..d9d9de3d6a67784f1967720fe823301fda323d27 100644 --- a/entry/src/main/ets/component/common/constants/HomeConstants.ets +++ b/entry/src/main/ets/component/common/constants/HomeConstants.ets @@ -13,16 +13,18 @@ * limitations under the License. */ +const uiContext: UIContext | undefined = AppStorage.get('uiContext'); + export class HomeConstants { /** * Footer tab topics. */ static readonly FOOTER_TOPIC_LIST: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST1')), - getContext(this).resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST2')), - getContext(this).resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST3')), - getContext(this).resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST4')), - getContext(this).resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST5'))]; + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST1')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST2')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST3')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST4')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST5'))]; /** * Footer topic icons. @@ -41,16 +43,16 @@ export class HomeConstants { * Top bar text list. */ static readonly TOP_BAR_TEXTS: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.TOP_BAR_TEXTS1')), - getContext(this).resourceManager.getStringSync($r('app.string.TOP_BAR_TEXTS2')), - getContext(this).resourceManager.getStringSync($r('app.string.TOP_BAR_TEXTS3')), - getContext(this).resourceManager.getStringSync($r('app.string.TOP_BAR_TEXTS4'))]; + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.TOP_BAR_TEXTS1')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.TOP_BAR_TEXTS2')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.TOP_BAR_TEXTS3')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.TOP_BAR_TEXTS4'))]; /** * Search placeholder. */ static readonly SEARCH_PLACEHOLDER: string = - getContext(this).resourceManager.getStringSync($r('app.string.searching')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.searching')); /** * Recommended product list. @@ -67,16 +69,16 @@ export class HomeConstants { * Good categories. */ static readonly GOOD_CATEGORIES: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES1')), - getContext(this).resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES2')), - getContext(this).resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES3')), - getContext(this).resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES4')), - getContext(this).resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES5')), - getContext(this).resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES6')), - getContext(this).resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES7')), - getContext(this).resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES8')), - getContext(this).resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES9')), - getContext(this).resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES10'))]; + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES1')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES2')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES3')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES4')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES5')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES6')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES7')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES8')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES9')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES10'))]; /** * Good category images. @@ -128,30 +130,30 @@ export class HomeConstants { * Price unit. */ static readonly PRICE_UNIT: string[] = ['¥', - getContext(this).resourceManager.getStringSync($r('app.string.PRICE_UNIT'))]; + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRICE_UNIT'))]; /** * Home title list. */ static readonly HOME_TITLES: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.HOME_TITLES1')), - getContext(this).resourceManager.getStringSync($r('app.string.HOME_TITLES2')), - getContext(this).resourceManager.getStringSync($r('app.string.HOME_TITLES3'))]; + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.HOME_TITLES1')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.HOME_TITLES2')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.HOME_TITLES3'))]; /** * Home button text list. */ static readonly BUTTON_TEXTS: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.BUTTON_TEXTS1')), - getContext(this).resourceManager.getStringSync($r('app.string.BUTTON_TEXTS2'))]; + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.BUTTON_TEXTS1')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.BUTTON_TEXTS2'))]; /** * Welfare tip text. */ static readonly TIP_TEXTS: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.TIP_TEXTS1')), - getContext(this).resourceManager.getStringSync($r('app.string.TIP_TEXTS2')), - getContext(this).resourceManager.getStringSync($r('app.string.TIP_TEXTS3'))]; + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.TIP_TEXTS1')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.TIP_TEXTS2')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.TIP_TEXTS3'))]; /** * Gradient color list. @@ -169,18 +171,18 @@ export class HomeConstants { * Section products title list. */ static readonly SECTION_PRODUCTS_TITLES: string[][] = [ - [getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_TITLES1'))], + [uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_TITLES1'))], ['HUAWEI Mate 50', - getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_TITLES2'))], + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_TITLES2'))], ['Sound X NEW'], ['HUAWEI MatePad Air'], ['HUAWEI MateBook 14s']]; /** * Section products info list. */ static readonly SECTION_PRODUCTS_INFO: string[] = ['', - getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO1')), '', - getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO2')), - getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO3'))]; + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO1')), '', + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO2')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO3'))]; /** * Section products price list. @@ -191,11 +193,11 @@ export class HomeConstants { * Section products feature list. */ static readonly SECTION_PRODUCTS_FEATURES: string[][] = [ - [getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES1'))], - [getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES2'))], - [getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES3'))], - [getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES4'))], - [getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES5'))]]; + [uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES1'))], + [uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES2'))], + [uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES3'))], + [uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES4'))], + [uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES5'))]]; /** * Section products comment list. diff --git a/entry/src/main/ets/component/common/constants/LiveConstants.ets b/entry/src/main/ets/component/common/constants/LiveConstants.ets index c69b605d68171d2ff659ac99e9bfa66c4aa5ffc0..93eddb0d5897c4e7357b6556eff6fa4162e9f18c 100644 --- a/entry/src/main/ets/component/common/constants/LiveConstants.ets +++ b/entry/src/main/ets/component/common/constants/LiveConstants.ets @@ -13,6 +13,8 @@ * limitations under the License. */ +const uiContext: UIContext | undefined = AppStorage.get('uiContext'); + export class LiveConstants { /** * Live product image list. @@ -137,25 +139,25 @@ export class LiveConstants { * Live comments title left text. */ static readonly LIVING_LEFT_TEXT: string = - getContext(this).resourceManager.getStringSync($r('app.string.LIVING_LEFT_TEXT')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.LIVING_LEFT_TEXT')); /** * Live comments title left text. */ static readonly LIVING_RIGHT_TEXT: string = - getContext(this).resourceManager.getStringSync($r('app.string.LIVING_RIGHT_TEXT')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.LIVING_RIGHT_TEXT')); /** * Live comments title left text. */ static readonly LIVING_WRITE: string = - getContext(this).resourceManager.getStringSync($r('app.string.LIVING_WRITE')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.LIVING_WRITE')); /** * Live title top. */ static readonly LIVING_TITLE_TOP: string = - getContext(this).resourceManager.getStringSync($r('app.string.store_name')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.store_name')); /** * Live title bottom. */ static readonly LIVING_TITLE_BOTTOM: string = - getContext(this).resourceManager.getStringSync($r('app.string.number_of_viewers')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.number_of_viewers')); } \ No newline at end of file diff --git a/entry/src/main/ets/component/common/constants/LoginConstants.ets b/entry/src/main/ets/component/common/constants/LoginConstants.ets index 9edec79c2ea5b579d5a2b7565b968d6c732840db..dfde0b1b9764eee251507cf2637cbd1f8d40b6ce 100644 --- a/entry/src/main/ets/component/common/constants/LoginConstants.ets +++ b/entry/src/main/ets/component/common/constants/LoginConstants.ets @@ -13,105 +13,107 @@ * limitations under the License. */ +const uiContext: UIContext | undefined = AppStorage.get('uiContext'); + export class LoginConstants { /** * Login title. */ - static readonly LOGIN_TEXT: string = getContext(this).resourceManager.getStringSync($r('app.string.LOGIN_TITLE')); + static readonly LOGIN_TEXT: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.LOGIN_TITLE')); /** * Login TextInput placeholder1. */ static readonly LOGIN_PLACEHOLDER1: string = - getContext(this).resourceManager.getStringSync($r('app.string.LOGIN_PLACEHOLDER1')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.LOGIN_PLACEHOLDER1')); /** * Login TextInput placeholder2. */ static readonly LOGIN_PLACEHOLDER2: string = - getContext(this).resourceManager.getStringSync($r('app.string.LOGIN_PLACEHOLDER2')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.LOGIN_PLACEHOLDER2')); /** * Login TextInput1 text. */ static readonly LOGIN_INPUT_TEXT: string = - getContext(this).resourceManager.getStringSync($r('app.string.LOGIN_INPUT_TEXT')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.LOGIN_INPUT_TEXT')); /** * Login button. */ - static readonly LOGIN_BUTTON: string = getContext(this).resourceManager.getStringSync($r('app.string.LOGIN_BUTTON')); + static readonly LOGIN_BUTTON: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.LOGIN_BUTTON')); /** * Login show toast. */ - static readonly LOGIN_TOAST: string = getContext(this).resourceManager.getStringSync($r('app.string.LOGIN_TOAST')); + static readonly LOGIN_TOAST: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.LOGIN_TOAST')); /** * Privacy dialog title. */ static readonly PRIVACY_DIALOG_TITLE: string = - getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DIALOG_TITLE')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DIALOG_TITLE')); /** * Privacy dialog text1. */ static readonly PRIVACY_DIALOG_TEXT1: string = - getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DIALOG_TEXT1')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DIALOG_TEXT1')); /** * Privacy dialog text2. */ static readonly PRIVACY_DIALOG_TEXT2: string = - getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DIALOG_TEXT2')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DIALOG_TEXT2')); /** * Privacy dialog text3. */ static readonly PRIVACY_DIALOG_TEXT3: string = - getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DIALOG_TEXT3')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DIALOG_TEXT3')); /** * Privacy dialog text4. */ static readonly PRIVACY_DIALOG_TEXT4: string = - getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DIALOG_TEXT4')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DIALOG_TEXT4')); /** * Privacy dialog left button. */ static readonly PRIVACY_DIALOG_LEFT_BUTTON: string = - getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DIALOG_LEFT_BUTTON')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DIALOG_LEFT_BUTTON')); /** * Privacy dialog right button. */ static readonly PRIVACY_DIALOG_RIGHT_BUTTON: string = - getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DIALOG_RIGHT_BUTTON')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DIALOG_RIGHT_BUTTON')); /** * Privacy detail title. */ static readonly PRIVACY_DETAIL_TITLE: string = - getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_TITLE')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_TITLE')); /** * Privacy detail text1. */ static readonly PRIVACY_DETAIL_TEXT1: string = - getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_TEXT1')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_TEXT1')); /** * Privacy detail text2. */ static readonly PRIVACY_DETAIL_TEXT2: string = - getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_TEXT2')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_TEXT2')); /** * Privacy detail text3. */ static readonly PRIVACY_DETAIL_TEXT3: string = - getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_TEXT3')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_TEXT3')); /** * Privacy detail text4. */ static readonly PRIVACY_DETAIL_TEXT4: string = - getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_TEXT4')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_TEXT4')); /** * Privacy detail content. */ static readonly PRIVACY_DETAIL_INFO: string[] = - [getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_ITEM_TEXT1')), - getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_ITEM_TEXT2')), - getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_ITEM_TEXT3')), - getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_ITEM_TEXT4')), - getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_ITEM_TEXT5')), - getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_ITEM_TEXT6')), - getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_ITEM_TEXT7')), - getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_ITEM_TEXT8')), - getContext(this).resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_ITEM_TEXT9'))]; + [uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_ITEM_TEXT1')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_ITEM_TEXT2')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_ITEM_TEXT3')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_ITEM_TEXT4')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_ITEM_TEXT5')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_ITEM_TEXT6')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_ITEM_TEXT7')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_ITEM_TEXT8')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PRIVACY_DETAIL_ITEM_TEXT9'))]; } \ No newline at end of file diff --git a/entry/src/main/ets/component/common/constants/MineConstants.ets b/entry/src/main/ets/component/common/constants/MineConstants.ets index db739b662ff4805a6786dd4e2e42bd6bdf5d14ad..cf856509743b500a426bbab08f332a1cf24bb949 100644 --- a/entry/src/main/ets/component/common/constants/MineConstants.ets +++ b/entry/src/main/ets/component/common/constants/MineConstants.ets @@ -13,85 +13,87 @@ * limitations under the License. */ +const uiContext: UIContext | undefined = AppStorage.get('uiContext'); + export class MineConstants{ /** * Mine page title. */ - static readonly MINE_TITLE: string = getContext(this).resourceManager.getStringSync($r('app.string.MINE_TITLE')); + static readonly MINE_TITLE: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.MINE_TITLE')); /** * Mine page text1. */ - static readonly MINE_TEXT1: string = getContext(this).resourceManager.getStringSync($r('app.string.MINE_TEXT1')); + static readonly MINE_TEXT1: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.MINE_TEXT1')); /** * Mine page text2. */ - static readonly MINE_TEXT2: string = getContext(this).resourceManager.getStringSync($r('app.string.MINE_TEXT2')); + static readonly MINE_TEXT2: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.MINE_TEXT2')); /** * Mine animation settings page content. */ - static readonly MINE_ANIMATION_CONTENT: string = getContext(this).resourceManager.getStringSync($r('app.string.MINE_ANIMATION_CONTENT')); + static readonly MINE_ANIMATION_CONTENT: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.MINE_ANIMATION_CONTENT')); /** * Mine page animation type1. */ - static readonly MINE_ANIMATION_TYPE1: string = getContext(this).resourceManager.getStringSync($r('app.string.MINE_ANIMATION_TYPE1')); + static readonly MINE_ANIMATION_TYPE1: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.MINE_ANIMATION_TYPE1')); /** * Mine page animation type2. */ - static readonly MINE_ANIMATION_TYPE2: string = getContext(this).resourceManager.getStringSync($r('app.string.MINE_ANIMATION_TYPE2')); + static readonly MINE_ANIMATION_TYPE2: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.MINE_ANIMATION_TYPE2')); /** * Mine page animation type3. */ - static readonly MINE_ANIMATION_TYPE3: string = getContext(this).resourceManager.getStringSync($r('app.string.MINE_ANIMATION_TYPE3')); + static readonly MINE_ANIMATION_TYPE3: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.MINE_ANIMATION_TYPE3')); /** * Personalized transition animation page title. */ - static readonly PERSONALIZED_ANIMATION_TITLE: string = getContext(this).resourceManager.getStringSync($r('app.string.PERSONALIZED_ANIMATION_TITLE')); + static readonly PERSONALIZED_ANIMATION_TITLE: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PERSONALIZED_ANIMATION_TITLE')); /** * Personalized transition animation type1. */ - static readonly PERSONALIZED_ANIMATION_TYPE1: string = getContext(this).resourceManager.getStringSync($r('app.string.PERSONALIZED_ANIMATION_TYPE1')); + static readonly PERSONALIZED_ANIMATION_TYPE1: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PERSONALIZED_ANIMATION_TYPE1')); /** * Personalized transition animation type2. */ - static readonly PERSONALIZED_ANIMATION_TYPE2: string = getContext(this).resourceManager.getStringSync($r('app.string.PERSONALIZED_ANIMATION_TYPE2')); + static readonly PERSONALIZED_ANIMATION_TYPE2: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PERSONALIZED_ANIMATION_TYPE2')); /** * Personalized transition animation type3. */ - static readonly PERSONALIZED_ANIMATION_TYPE3: string = getContext(this).resourceManager.getStringSync($r('app.string.PERSONALIZED_ANIMATION_TYPE3')); + static readonly PERSONALIZED_ANIMATION_TYPE3: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PERSONALIZED_ANIMATION_TYPE3')); /** * Mine page button text. */ - static readonly MINE_BUTTON_TEXT: string = getContext(this).resourceManager.getStringSync($r('app.string.MINE_BUTTON_TEXT')); + static readonly MINE_BUTTON_TEXT: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.MINE_BUTTON_TEXT')); /** * Mine page user name. */ - static readonly MINE_NAME: string = getContext(this).resourceManager.getStringSync($r('app.string.MINE_NAME')); + static readonly MINE_NAME: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.MINE_NAME')); /** * Mine log out page title. */ - static readonly MINE_LOG_OUT_TITLE: string = getContext(this).resourceManager.getStringSync($r('app.string.MINE_LOG_OUT_TITLE')); + static readonly MINE_LOG_OUT_TITLE: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.MINE_LOG_OUT_TITLE')); /** * Mine log out page text. */ - static readonly MINE_LOG_OUT_TEXT: string = getContext(this).resourceManager.getStringSync($r('app.string.MINE_LOG_OUT_TEXT')); + static readonly MINE_LOG_OUT_TEXT: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.MINE_LOG_OUT_TEXT')); /** * Mine log out page button text. */ - static readonly MINE_LOG_OUT_BUTTON: string = getContext(this).resourceManager.getStringSync($r('app.string.MINE_LOG_OUT_BUTTON')); + static readonly MINE_LOG_OUT_BUTTON: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.MINE_LOG_OUT_BUTTON')); /** * Exit login title. */ - static readonly EXIT_LOGIN_TITLE: string = getContext(this).resourceManager.getStringSync($r('app.string.EXIT_LOGIN_TITLE')); + static readonly EXIT_LOGIN_TITLE: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.EXIT_LOGIN_TITLE')); /** * Exit login content. */ - static readonly EXIT_LOGIN_CONTENT: string = getContext(this).resourceManager.getStringSync($r('app.string.EXIT_LOGIN_CONTENT')); + static readonly EXIT_LOGIN_CONTENT: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.EXIT_LOGIN_CONTENT')); /** * Exit login left button. */ - static readonly EXIT_LOGIN_LEFT_BUTTON: string = getContext(this).resourceManager.getStringSync($r('app.string.EXIT_LOGIN_LEFT_BUTTON')); + static readonly EXIT_LOGIN_LEFT_BUTTON: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.EXIT_LOGIN_LEFT_BUTTON')); /** * Exit login right button. */ - static readonly EXIT_LOGIN_RIGHT_BUTTON: string = getContext(this).resourceManager.getStringSync($r('app.string.EXIT_LOGIN_RIGHT_BUTTON')); + static readonly EXIT_LOGIN_RIGHT_BUTTON: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.EXIT_LOGIN_RIGHT_BUTTON')); } \ No newline at end of file diff --git a/entry/src/main/ets/component/common/constants/PayConstants.ets b/entry/src/main/ets/component/common/constants/PayConstants.ets index 520a29fe5366054835f348e80d907931933c3150..a7c69a3c76ae2479741b0e2971dd9e79836cbf12 100644 --- a/entry/src/main/ets/component/common/constants/PayConstants.ets +++ b/entry/src/main/ets/component/common/constants/PayConstants.ets @@ -13,49 +13,51 @@ * limitations under the License. */ +const uiContext: UIContext | undefined = AppStorage.get('uiContext'); + export class PayConstants { /** * Pay card text1. */ - static readonly PAY_CARD_TEXT1: string = getContext(this).resourceManager.getStringSync($r('app.string.PAY_CARD_TEXT1')); + static readonly PAY_CARD_TEXT1: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PAY_CARD_TEXT1')); /** * Pay card text2. */ - static readonly PAY_CARD_TEXT2: string = getContext(this).resourceManager.getStringSync($r('app.string.PAY_CARD_TEXT2')); + static readonly PAY_CARD_TEXT2: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PAY_CARD_TEXT2')); /** * Pay card text3. */ - static readonly PAY_CARD_TEXT3: string = getContext(this).resourceManager.getStringSync($r('app.string.PAY_CARD_TEXT3')); + static readonly PAY_CARD_TEXT3: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PAY_CARD_TEXT3')); /** * Pay card text2. */ - static readonly PAY_CARD_BUTTON: string = getContext(this).resourceManager.getStringSync($r('app.string.PAY_CARD_BUTTON')); + static readonly PAY_CARD_BUTTON: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PAY_CARD_BUTTON')); /** * Pay cancel title. */ - static readonly PAY_CANCEL_TITLE: string = getContext(this).resourceManager.getStringSync($r('app.string.PAY_CANCEL_TITLE')); + static readonly PAY_CANCEL_TITLE: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PAY_CANCEL_TITLE')); /** * Pay cancel content. */ - static readonly PAY_CANCEL_CONTENT: string = getContext(this).resourceManager.getStringSync($r('app.string.PAY_CANCEL_CONTENT')); + static readonly PAY_CANCEL_CONTENT: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PAY_CANCEL_CONTENT')); /** * Pay cancel button1. */ - static readonly PAY_CANCEL_BUTTON1: string = getContext(this).resourceManager.getStringSync($r('app.string.PAY_CANCEL_SEE')); + static readonly PAY_CANCEL_BUTTON1: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PAY_CANCEL_SEE')); /** * Pay cancel button2. */ - static readonly PAY_CANCEL_BUTTON2: string = getContext(this).resourceManager.getStringSync($r('app.string.PAY_CANCEL_CONFIRM')); + static readonly PAY_CANCEL_BUTTON2: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PAY_CANCEL_CONFIRM')); /** * Pay success title. */ - static readonly PAY_SUCCESS_TITLE: string = getContext(this).resourceManager.getStringSync($r('app.string.PAY_SUCCESS_TITLE')); + static readonly PAY_SUCCESS_TITLE: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PAY_SUCCESS_TITLE')); /** * Pay success text. */ - static readonly PAY_SUCCESS_TEXT: string = getContext(this).resourceManager.getStringSync($r('app.string.PAY_SUCCESS_TEXT')); + static readonly PAY_SUCCESS_TEXT: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PAY_SUCCESS_TEXT')); /** * Pay success button text. */ - static readonly PAY_SUCCESS_BUTTON: string = getContext(this).resourceManager.getStringSync($r('app.string.PAY_SUCCESS_BUTTON')); + static readonly PAY_SUCCESS_BUTTON: string = uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.PAY_SUCCESS_BUTTON')); } \ No newline at end of file diff --git a/entry/src/main/ets/component/common/constants/ShoppingBagConstants.ets b/entry/src/main/ets/component/common/constants/ShoppingBagConstants.ets index 685df467c2093286594238f68212f29218e268fa..f41c0bce0d719882b122ebd6ec43d49f08d08574 100644 --- a/entry/src/main/ets/component/common/constants/ShoppingBagConstants.ets +++ b/entry/src/main/ets/component/common/constants/ShoppingBagConstants.ets @@ -13,6 +13,8 @@ * limitations under the License. */ +const uiContext: UIContext | undefined = AppStorage.get('uiContext'); + export class ShoppingBagConstants { /** * Product names. @@ -44,10 +46,10 @@ export class ShoppingBagConstants { * Product status list. */ static readonly PRODUCT_STATUS_LIST: Array> = - [[getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_PAID'))], - [getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_UNPAID'))], - [getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_PAID'))], - [getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_UNPAID'))]]; + [[uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SHOPPING_PAID'))], + [uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SHOPPING_UNPAID'))], + [uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SHOPPING_PAID'))], + [uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SHOPPING_UNPAID'))]]; /** * Product price list. */ @@ -81,9 +83,9 @@ export class ShoppingBagConstants { * Shopping bag titles. */ static readonly SHOPPING_BAG_TITLES: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_BAG_TITLES1')), - getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_BAG_TITLES2')), - getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_BAG_TITLES3'))]; + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SHOPPING_BAG_TITLES1')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SHOPPING_BAG_TITLES2')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SHOPPING_BAG_TITLES3'))]; /** * Shopping discount title list. */ @@ -99,11 +101,11 @@ export class ShoppingBagConstants { * Shopping card foot title list. */ static readonly SHOPPING_CARD_FOOT_TITLES: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_CARD_FOOT_TITLES1')), - getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_CARD_FOOT_TITLES2')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SHOPPING_CARD_FOOT_TITLES1')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SHOPPING_CARD_FOOT_TITLES2')), '¥', '12999', - getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_CARD_FOOT_TITLES3')), - getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_CARD_FOOT_TITLES4'))]; + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SHOPPING_CARD_FOOT_TITLES3')), + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SHOPPING_CARD_FOOT_TITLES4'))]; /** * Shopping card name list. */ @@ -119,15 +121,15 @@ export class ShoppingBagConstants { * Shopping card settlement button. */ static readonly SHOPPING_SETTLEMENT_BUTTON: string = - getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_SETTLEMENT_BUTTON')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SHOPPING_SETTLEMENT_BUTTON')); /** * Shopping unpaid. */ static readonly SHOPPING_UNPAID: string = - getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_UNPAID')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SHOPPING_UNPAID')); /** * Shopping paid. */ static readonly SHOPPING_PAID: string = - getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_PAID')); + uiContext!.getHostContext()!.resourceManager.getStringSync($r('app.string.SHOPPING_PAID')); } \ No newline at end of file diff --git a/entry/src/main/ets/component/live/LiveComments.ets b/entry/src/main/ets/component/live/LiveComments.ets index f48457d90b6bb32c44807d9c88e982bdbb50995b..0885afc99ead857531e502726a7647969a20d8be 100644 --- a/entry/src/main/ets/component/live/LiveComments.ets +++ b/entry/src/main/ets/component/live/LiveComments.ets @@ -23,6 +23,8 @@ import { LiveCommentsHeader } from './LiveCommentsHeader'; import { CommentNodeController } from './CommentInput'; import { PageConstant } from '../../constant/PageConstant'; +const uiContext: UIContext | undefined = AppStorage.get('uiContext'); + interface LiveCommentsParamType { commentRenderNode: CommentNodeController; } @@ -30,7 +32,7 @@ interface LiveCommentsParamType { @HMLifecycle({lifecycleName: 'liveCommentLifecycle'}) export class LiveCommentLifecycle implements IHMLifecycle { onShown(ctx: HMLifecycleContext): void { - window.getLastWindow(getContext(this), (err, data) => { + window.getLastWindow(uiContext!.getHostContext(), (err, data) => { if(err.code > 0) { console.error(`${err.code} ${err.message}`); return; @@ -42,7 +44,7 @@ export class LiveCommentLifecycle implements IHMLifecycle { } onHidden(ctx: HMLifecycleContext): void { - window.getLastWindow(getContext(this), (err, data) => { + window.getLastWindow(uiContext!.getHostContext(), (err, data) => { if(err.code > 0) { console.error(`${err.code} ${err.message}`); return; diff --git a/entry/src/main/ets/component/live/LiveHome.ets b/entry/src/main/ets/component/live/LiveHome.ets index 54b5abf6082398d1837e2412fa1ed02c2442bd26..23329efb0fcc7b4ce73cefe901110e96961eab59 100644 --- a/entry/src/main/ets/component/live/LiveHome.ets +++ b/entry/src/main/ets/component/live/LiveHome.ets @@ -56,7 +56,7 @@ export class LiveHomeLifecycle implements IHMLifecycle { videoSrc: VideoSrc = new VideoSrc($rawfile('camera-ais.mp4')); onShown(ctx: HMLifecycleContext): void { - window.getLastWindow(getContext(this), (err, data) => { + window.getLastWindow(uiContext!.getHostContext(), (err, data) => { if(err.code > 0) { console.error(`${err.code} ${err.message}`); return; @@ -68,7 +68,7 @@ export class LiveHomeLifecycle implements IHMLifecycle { } onHidden(ctx: HMLifecycleContext): void { - window.getLastWindow(getContext(this), (err, data) => { + window.getLastWindow(uiContext!.getHostContext(), (err, data) => { if(err.code > 0) { console.error(`${err.code} ${err.message}`); return; @@ -185,7 +185,7 @@ export struct LiveHome { @StorageLink('changeVideoHeight') videoHeight: string | number = CommonConstants.FULL_PERCENT; aboutToAppear(): void { - window.getLastWindow(getContext(this), (err, win) => { + window.getLastWindow(uiContext!.getHostContext(), (err, win) => { win.getUIContext().setKeyboardAvoidMode(KeyboardAvoidMode.RESIZE); }); }