Skip to content

Commit fa103fe

Browse files
committed
fix(harmony): enable page config
1 parent 70cfc76 commit fa103fe

File tree

5 files changed

+47
-43
lines changed

5 files changed

+47
-43
lines changed

.github/workflows/auto-review.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
- name: Checkout
1414
uses: actions/checkout@v4
1515
- name : GITHUB CONTEXT
16-
env:
17-
GITHUB_CONTEXT: ${{ toJson(github) }}
18-
run: echo "$GITHUB_CONTEXT"
16+
env:
17+
GITHUB_CONTEXT: ${{ toJson(github) }}
18+
run: echo "$GITHUB_CONTEXT"
1919
- name: Get commit message
2020
run: |
2121
COMMIT_MESSAGE=$(git log --format=%B -n 1)

.github/workflows/publish.yml

+7
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,13 @@ jobs:
196196

197197
# ------------------ publish -------------
198198

199+
- name: Setup open-harmony configuration
200+
run: |
201+
mkdir -p ./.ssh
202+
echo "${{ secrets.OHPM_PRIVATE_KEY }}" > ./.ssh/id_taro_harmony
203+
# ohpm config set key_path ./.ssh/id_taro_harmony
204+
# ohpm config set publish_id ${{ secrets.OHPM_PUBLISH_CODE }}
205+
199206
- name: Publish
200207
run: |
201208
if [ '${{ github.event_name }}' == 'pull_request' ] ; then

packages/taro-platform-harmony-cpp/src/index.ts

+17-3
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,25 @@ export default (ctx: IPluginContext, options: IOptions = {}) => {
117117
profile.buildOptionSet.forEach((option) => {
118118
option.arkOptions ||= {}
119119
option.arkOptions.obfuscation ||= {}
120-
option.arkOptions.obfuscation.consumerFiles ||= []
121-
option.arkOptions.obfuscation.consumerFiles.push(
120+
option.arkOptions.obfuscation.ruleOptions ||= {}
121+
option.arkOptions.obfuscation.ruleOptions.files ||= []
122+
const obfuscations = [
122123
'./consumer-rules.txt',
123124
'./src/main/cpp/types/taro-native-node/obfuscation-rules.txt',
124-
)
125+
]
126+
if (hapName !== 'entry') {
127+
option.arkOptions.obfuscation.ruleOptions.enable = true
128+
option.arkOptions.obfuscation.consumerFiles ||= []
129+
const files: string[] = option.arkOptions.obfuscation.consumerFiles
130+
if (!files.includes(obfuscations[0])) {
131+
files.push(...obfuscations)
132+
}
133+
} else {
134+
const files: string[] = option.arkOptions.obfuscation.ruleOptions.files
135+
if (!files.includes(obfuscations[0])) {
136+
files.push(...obfuscations)
137+
}
138+
}
125139
})
126140

127141
const C_API_TXT = chalk.yellow('C-API')

packages/taro-platform-harmony-cpp/src/program/vite/page.ts

+18-35
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { isFunction, isObject, isString } from '@tarojs/shared'
2+
import { TARO_TABBAR_PAGE_PATH } from '@tarojs/vite-runner/dist/harmony/page'
23
import { escapePath } from '@tarojs/vite-runner/dist/utils'
34

45
import { getProjectId } from '../../utils'
@@ -481,24 +482,24 @@ export default function (this: Harmony): PluginOption {
481482
? [
482483
`if (this.pageStack[0].path !== this.entryPagePath && this.navigationBarHomeBtn && this.pageStack.length === 1) {`,
483484
` Image($r('app.media.taro_home'))`,
484-
// FIXME ` .height(convertNumber2VP(40 / 7.5, 'vw'))`,
485-
// FIXME ` .width(convertNumber2VP(40 / 7.5, 'vw'))`,
486-
// FIXME ` .margin({ left: convertNumber2VP(40 / 7.5, 'vw'), right: convertNumber2VP(-20 / 7.5, 'vw') })`,
485+
` .height(convertNumber2VP(40 / 7.5, 'vw'))`,
486+
` .width(convertNumber2VP(40 / 7.5, 'vw'))`,
487+
` .margin({ left: convertNumber2VP(40 / 7.5, 'vw'), right: convertNumber2VP(-20 / 7.5, 'vw') })`,
487488
` .fillColor((this.navigationBarTextStyle || '${this.appConfig.window?.navigationBarTextStyle}') !== 'black' ? Color.White : Color.Black)`,
488489
` .objectFit(ImageFit.Contain)`,
489490
` .onClick(() => {`,
490-
// FIXME ` router.replaceUrl({`,
491-
// FIXME ` url: this.tabBarList.find(e => e.pagePath === this.entryPagePath) ? '${TARO_TABBAR_PAGE_PATH}' : this.entryPagePath,`,
492-
// FIXME ` params: {`,
493-
// FIXME ` '$page': this.entryPagePath,`,
494-
// FIXME ` },`,
495-
// FIXME ` })`,
491+
` router.replaceUrl({`,
492+
` url: this.tabBarList.find(e => e.pagePath === this.entryPagePath) ? '${TARO_TABBAR_PAGE_PATH}' : this.entryPagePath,`,
493+
` params: {`,
494+
` '$page': this.entryPagePath,`,
495+
` },`,
496+
` })`,
496497
` })`,
497498
` } else if (this.pageStack.length > 1) {`,
498499
` Image($r('app.media.taro_arrow_left'))`,
499-
// FIXME ` .height(convertNumber2VP(40 / 7.5, 'vw'))`,
500-
// FIXME ` .width(convertNumber2VP(40 / 7.5, 'vw'))`,
501-
// FIXME ` .margin({ left: convertNumber2VP(40 / 7.5, 'vw'), right: convertNumber2VP(-20 / 7.5, 'vw') })`,
500+
` .height(convertNumber2VP(40 / 7.5, 'vw'))`,
501+
` .width(convertNumber2VP(40 / 7.5, 'vw'))`,
502+
` .margin({ left: convertNumber2VP(40 / 7.5, 'vw'), right: convertNumber2VP(-20 / 7.5, 'vw') })`,
502503
` .fillColor((this.navigationBarTextStyle || '${this.appConfig.window?.navigationBarTextStyle}') !== 'black' ? Color.White : Color.Black)`,
503504
` .objectFit(ImageFit.Contain)`,
504505
` .onClick(() => {`,
@@ -507,14 +508,14 @@ export default function (this: Harmony): PluginOption {
507508
` }`,
508509
] : [], 2)}`,
509510
` Text(this.navigationBarTitleText${this.isTabbarPage ? '[this.tabBarCurrentIndex]' : ''} || '${this.appConfig.window?.navigationBarTitleText || ''}')`,
510-
// FIXME ` .margin({ left: convertNumber2VP(40 / 7.5, 'vw') })`,
511-
// FIXME ` .fontSize(convertNumber2VP(32 / 7.5, 'vw'))`,
511+
` .margin({ left: convertNumber2VP(40 / 7.5, 'vw') })`,
512+
` .fontSize(convertNumber2VP(32 / 7.5, 'vw'))`,
512513
` .fontColor((this.navigationBarTextStyle${this.isTabbarPage ? '[this.tabBarCurrentIndex]' : ''} || '${this.appConfig.window?.navigationBarTextStyle}') !== 'black' ? Color.White : Color.Black)`,
513514
` if (this.navigationBarLoading${this.isTabbarPage ? '[this.tabBarCurrentIndex]' : ''}) {`,
514515
` LoadingProgress()`,
515-
// FIXME ` .margin({ left: convertNumber2VP(10 / 7.5, 'vw') })`,
516-
// FIXME ` .height(convertNumber2VP(40 / 7.5, 'vw'))`,
517-
// FIXME ` .width(convertNumber2VP(40 / 7.5, 'vw'))`,
516+
` .margin({ left: convertNumber2VP(10 / 7.5, 'vw') })`,
517+
` .height(convertNumber2VP(40 / 7.5, 'vw'))`,
518+
` .width(convertNumber2VP(40 / 7.5, 'vw'))`,
518519
` .color((this.navigationBarTextStyle${this.isTabbarPage ? '[this.tabBarCurrentIndex]' : ''} || '${this.appConfig.window?.navigationBarTextStyle}') !== 'black' ? Color.White : Color.Black)`,
519520
` }`,
520521
`}`,
@@ -525,24 +526,6 @@ export default function (this: Harmony): PluginOption {
525526
` top: px2vp(sysInfo.safeArea?.top || 0),`,
526527
`})`,
527528
`.zIndex(1)`,
528-
// 'NavBar({',
529-
// // ' isAdaptStatusBar: true,', 由于内置 windowStage 为 undefined 实际无效
530-
// ' isAutoDark: true,',
531-
// ` statusBarHeight: this.statusBarHeight,`,
532-
// ` bgColor: this.navigationBarBackgroundColor || '${
533-
// this.appConfig.window?.navigationBarBackgroundColor || '#000000'
534-
// }',`,
535-
// ` mainTitleText: new TextParam(this.navigationBarTitleText || '${
536-
// this.appConfig.window?.navigationBarTitleText || ''
537-
// }', null, this.navigationBarTextStyle || '${
538-
// this.appConfig.window?.navigationBarTextStyle || 'white'
539-
// }', null),`,
540-
// ' useBackIcon: true,',
541-
// ' onBackClick: () => {',
542-
// ' navigateBack()', // 需要拦截适配返回,组件提供的返回与 NavDestination 不兼容
543-
// ' return true',
544-
// ' },',
545-
// '})',
546529
]),
547530
})
548531

packages/taro-vite-runner/src/harmony/template/page.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,10 @@ export default class Parser extends BaseParser {
198198
decorator: 'StorageProp("__TARO_ENTRY_PAGE_PATH")', name: 'entryPagePath', type: 'string', foreach: () => '""', disabled: this.buildConfig.isBuildNativeComp
199199
}, false),
200200
this.renderState({
201-
decorator: 'State', name: 'appConfig', type: 'Taro.AppConfig', foreach: () => 'window.__taroAppConfig || {}', disabled: this.buildConfig.isBuildNativeComp || !this.isTabbarPage
201+
decorator: 'State', name: 'appConfig', type: 'Taro.AppConfig', foreach: () => 'window.__taroAppConfig || {}', disabled: this.buildConfig.isBuildNativeComp
202202
}, false),
203203
this.renderState({
204-
decorator: 'State', name: 'tabBarList', type: `${this.isTabbarPage ? 'ITabBarItem' : 'Taro.TabBarItem'}[]`, foreach: () => 'this.appConfig.tabBar?.list || []', disabled: this.buildConfig.isBuildNativeComp || !this.isTabbarPage
204+
decorator: 'State', name: 'tabBarList', type: `${this.isTabbarPage ? 'ITabBarItem' : 'Taro.TabBarItem'}[]`, foreach: () => 'this.appConfig.tabBar?.list || []', disabled: this.buildConfig.isBuildNativeComp
205205
}, false),
206206
].filter(item => item !== '').flat()
207207

0 commit comments

Comments
 (0)