Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
126fe46
feat: add tabbar on harmony
May 9, 2026
bca05f6
feat: resolve conflicts
May 9, 2026
e0ce5b3
feat(fe): add h5 tabbar
May 9, 2026
a6f8341
fix(fe): tabbar height
May 9, 2026
da80991
fix: code review issue and compile tabbar icon
May 11, 2026
1af9104
fix: code review issue
May 11, 2026
89b1c34
feat: remove useless comment
May 12, 2026
53b4c91
fix(fe): modal 样式问题
May 12, 2026
3a4e7e0
fix(fe): modal 样式问题
May 12, 2026
99647a2
feat: merge conflicts
May 12, 2026
1d7d427
feat: merge conflicts
May 12, 2026
12e085d
feat: change style logic
May 12, 2026
352ab7b
feat: add tabbar function and style
May 12, 2026
f36c55b
Merge remote-tracking branch 'upstream/main' into fix-modal
May 13, 2026
12732d6
feat(fe): adapt relative icon path issue
May 13, 2026
2bc636f
feat: 修复展示tabbar 展开缓慢的问题
May 13, 2026
474150f
feat(fe): border color issue
May 18, 2026
3b1a729
feat(jssdk): provide promiselike
May 21, 2026
5911676
Merge remote-tracking branch 'upstream/main' into fix-modal
May 21, 2026
946ab84
Merge remote-tracking branch 'upstream/main' into fix-modal
May 24, 2026
7a935b6
fix(harmony): resolve QuickJS VERSION file conflict with C++ <version…
May 24, 2026
9f45c41
Merge remote-tracking branch 'upstream/main' into fix/quickjs-version…
May 25, 2026
8716e41
feat(harmony,fe): implement getAppBaseInfo with hostEnv snapshot and …
May 26, 2026
7116236
Merge remote-tracking branch 'upstream/main' into fix/quickjs-version…
May 26, 2026
6f14ab6
test(service): update system-info tests for field filtering
May 26, 2026
5ec8685
feat(JSSDK): update version
May 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 46 additions & 39 deletions fe/packages/container/src/pages/miniApp/miniApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -1544,25 +1544,25 @@ export class MiniApp {
const onComplete = this.createCallbackFunction(complete)

onSuccess?.({
statusBarHeight: bar.height,
brand: 'devtools',
mode: 'default',
model: 'web',
platform: 'devtools',
system: 'web',
deviceOrientation: 'portrait',
SDKVersion: '3.0.0',
language: 'zh_CN',
wifiEnabled: true,
safeArea: {
width: wb.width,
height: wb.height,
top: wb.top,
bottom: wb.bottom,
left: wb.left,
right: wb.right,
},
})
statusBarHeight: bar.height,
brand: "devtools",
mode: "default",
model: "web",
platform: "devtools",
system: "web",
deviceOrientation: "portrait",
SDKVersion: "3.0.0",
language: "zh_CN",
wifiEnabled: true,
safeArea: {
width: wb.width,
height: wb.height,
top: wb.top,
bottom: wb.bottom,
left: wb.left,
right: wb.right,
},
});
onComplete?.()
}

Expand Down Expand Up @@ -1602,26 +1602,33 @@ export class MiniApp {
const statusBarHeight = statusBar?.getBoundingClientRect().height || 20

return {
brand: 'devtools',
model: 'web',
platform: 'devtools',
system: 'web',
SDKVersion: '3.0.0', // vant组件库 判断 canIUseModel version 需要大于 2.9.3
pixelRatio: globalThis.devicePixelRatio || 1,
screenWidth: width,
screenHeight: height,
windowWidth: width,
windowHeight: height,
statusBarHeight,
safeArea: {
left: 0,
right: width,
top: statusBarHeight,
bottom: height,
width,
height: Math.max(height - statusBarHeight, 0),
},
}
brand: "devtools",
model: "web",
platform: "devtools",
system: "web",
SDKVersion: "3.0.0", // vant组件库 判断 canIUseModel version 需要大于 2.9.3
pixelRatio: globalThis.devicePixelRatio || 1,
screenWidth: width,
screenHeight: height,
windowWidth: width,
windowHeight: height,
statusBarHeight,
safeArea: {
left: 0,
right: width,
top: statusBarHeight,
bottom: height,
width,
height: Math.max(height - statusBarHeight, 0),
},
enableDebug: false,
host: { appId: "" },
language: navigator.language || "zh_CN",
version: "",
theme: globalThis.matchMedia?.('(prefers-color-scheme: dark)')?.matches ? "dark" : "light",
fontSizeScaleFactor: 1,
fontSizeSetting: 16,
};
}

showToast(opts = {}) {
Expand Down
44 changes: 41 additions & 3 deletions fe/packages/service/__tests__/system-info.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,57 @@ describe('system info api', () => {

it('should prefer host env sync info for system-related apis', () => {
const systemInfo = {
// window info fields
statusBarHeight: 20,
windowWidth: 375,
windowHeight: 667,
screenWidth: 375,
screenHeight: 667,
pixelRatio: 2,
safeArea: { top: 20, bottom: 667, left: 0, right: 375, width: 375, height: 647 },
// app base info fields
SDKVersion: '3.0.0',
enableDebug: false,
host: { appId: 'test' },
language: 'zh_CN',
version: '1.0.0',
theme: 'light',
fontSizeScaleFactor: 1,
fontSizeSetting: 16,
// device info fields
brand: 'test',
model: 'test',
platform: 'devtools',
system: 'web',
}

hostEnv.init({ systemInfo })

expect(getWindowInfo()).toBe(systemInfo)
expect(getWindowInfo()).toEqual({
pixelRatio: 2,
screenWidth: 375,
screenHeight: 667,
windowWidth: 375,
windowHeight: 667,
statusBarHeight: 20,
safeArea: { top: 20, bottom: 667, left: 0, right: 375, width: 375, height: 647 },
})
expect(getSystemInfoSync()).toBe(systemInfo)
expect(getAppBaseInfo()).toBe(systemInfo)
expect(getDeviceInfo()).toBe(systemInfo)
expect(getAppBaseInfo()).toEqual({
SDKVersion: '3.0.0',
enableDebug: false,
host: { appId: 'test' },
language: 'zh_CN',
version: '1.0.0',
theme: 'light',
fontSizeScaleFactor: 1,
fontSizeSetting: 16,
})
expect(getDeviceInfo()).toEqual({
brand: 'test',
model: 'test',
platform: 'devtools',
system: 'web',
})
})
})
49 changes: 43 additions & 6 deletions fe/packages/service/src/api/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,51 @@ import hostEnv from '../../core/host-env'
import message from '../../core/message'
import router from '../../core/router'

const hostEnvResolvers = {
getWindowInfo: () => hostEnv.getSystemInfo(),
getSystemInfoSync: () => hostEnv.getSystemInfo(),
getAppBaseInfo: () => hostEnv.getSystemInfo(),
getDeviceInfo: () => hostEnv.getSystemInfo(),
getMenuButtonBoundingClientRect: () => hostEnv.getMenuRect(),
function pick(obj, keys) {
if (!obj) return obj;
const result = {};
for (const key of keys) {
if (key in obj) result[key] = obj[key];
}
return result;
}

const hostEnvResolvers = {
getWindowInfo: () =>
pick(hostEnv.getSystemInfo(), [
"pixelRatio",
"screenWidth",
"screenHeight",
"windowWidth",
"windowHeight",
"statusBarHeight",
"safeArea",
"screenTop",
]),
getSystemInfoSync: () => hostEnv.getSystemInfo(),
getAppBaseInfo: () =>
pick(hostEnv.getSystemInfo(), [
"SDKVersion",
"enableDebug",
"host",
"language",
"version",
"theme",
"fontSizeScaleFactor",
"fontSizeSetting",
]),
getDeviceInfo: () =>
pick(hostEnv.getSystemInfo(), [
"abi",
"benchmarkLevel",
"brand",
"model",
"platform",
"system",
]),
getMenuButtonBoundingClientRect: () => hostEnv.getMenuRect(),
};

const promiseUnsupportedApis = new Set([
'connectSocket',
'downloadFile',
Expand Down
26 changes: 10 additions & 16 deletions harmony/dimina/src/main/cpp/CMakeLists.txt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文件的改动是什么目的

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

鸿蒙之前的修改,在 macOS 跑不起来。生成的文件格式,不被 macOS 识别。让 CC 修复了一下。

Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,18 @@ FetchContent_Declare(
)
FetchContent_MakeAvailable(quickjs)

# Handle the version file to prevent compilation errors
set(VERSION_FILE "${quickjs_SOURCE_DIR}/version")
# Handle the VERSION file to prevent conflicts with C++ standard <version> header
# on case-insensitive filesystems (macOS). QuickJS ships a plain-text VERSION file
# which shadows the C++17/20 <version> header when quickjs_SOURCE_DIR is in the
# include path, causing "expected unqualified-id" errors in C++ compilations.
set(VERSION_FILE "${quickjs_SOURCE_DIR}/VERSION")
set(VERSION_H_FILE "${quickjs_SOURCE_DIR}/version.h")
set(VERSION_TXT_FILE "${quickjs_SOURCE_DIR}/version.txt")

# 只在首次配置时处理 version 文件
if(EXISTS "${VERSION_FILE}" AND NOT EXISTS "${VERSION_H_FILE}")
# Read the version content
if(EXISTS "${VERSION_FILE}")
file(READ "${VERSION_FILE}" QJS_VERSION)
string(STRIP "${QJS_VERSION}" QJS_VERSION)

# Create a version.h file
file(WRITE "${VERSION_H_FILE}" "#define QJS_VERSION \"${QJS_VERSION}\"\n")

# Rename the original version file to prevent it from being compiled
file(RENAME "${VERSION_FILE}" "${VERSION_TXT_FILE}")
elseif(NOT EXISTS "${VERSION_FILE}" AND NOT EXISTS "${VERSION_H_FILE}" AND EXISTS "${VERSION_TXT_FILE}")
# 如果 version.txt 已存在,从它创建 version.h
file(READ "${VERSION_TXT_FILE}" QJS_VERSION)
string(STRIP "${QJS_VERSION}" QJS_VERSION)
file(WRITE "${VERSION_H_FILE}" "#define QJS_VERSION \"${QJS_VERSION}\"\n")
file(REMOVE "${VERSION_FILE}")
endif()

# Set build type to Release for optimization
Expand Down Expand Up @@ -88,6 +79,9 @@ if(DIMINA_UPDATE_QUICKJS_ON_BUILD)
add_custom_target(update_quickjs_latest
COMMAND ${GIT_EXECUTABLE} fetch --depth=1 origin master
COMMAND ${GIT_EXECUTABLE} reset --hard FETCH_HEAD
# Remove the VERSION file to prevent conflicts with the C++ standard <version> header
# on case-insensitive filesystems (macOS). The version value is already in version.h.
COMMAND ${CMAKE_COMMAND} -E rm -f "${quickjs_SOURCE_DIR}/VERSION"
WORKING_DIRECTORY ${quickjs_SOURCE_DIR}
COMMENT "Updating QuickJS to latest origin/master"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import { DMPLogger } from '../EventTrack/DMPLogger';
import batteryInfo from '@ohos.batteryInfo';
import deviceInfo from '@ohos.deviceInfo';
import { DMPDeviceUtil } from '../Utils/DMPDeviceUtils';
import { bundleManager } from '@kit.AbilityKit';
import { bundleManager, ConfigurationConstant, common } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
import { DMPMap } from '../Utils/DMPMap';
import BuildProfile from '../../../../BuildProfile';
import { access } from '@kit.ConnectivityKit';
import { i18n } from '@kit.LocalizationKit';

export class DMPContainerBridgesModuleSystem extends DMPContainerBridgesModule {
private bundleInfo?: bundleManager.BundleInfo
Expand All @@ -17,7 +18,7 @@ export class DMPContainerBridgesModuleSystem extends DMPContainerBridgesModule {

getExportMethods(): string[] {
return ['getSystemInfoSync', 'getEnv', 'getSystemInfoAsync', 'getAccountInfoSync', 'getSystemInfo',
'getDiminaCurStackPages', 'getSystemSetting', 'getWindowInfo'];
'getDiminaCurStackPages', 'getSystemSetting', 'getWindowInfo', 'getAppBaseInfo'];
}

getWindowInfo(data: DMPMap, callback: DMPBridgeCallback) {
Expand Down Expand Up @@ -63,6 +64,20 @@ export class DMPContainerBridgesModuleSystem extends DMPContainerBridgesModule {
}
}

getAppBaseInfo(data: DMPMap, callback: DMPBridgeCallback) {
const info = this.systemInfo()
const keys = ['SDKVersion', 'enableDebug', 'host', 'language', 'version',
'theme', 'fontSizeScaleFactor', 'fontSizeSetting']
const result = new DMPMap()
for (const key of keys) {
const value: string | number | boolean | object | undefined = info.get(key)
if (value !== undefined) {
result.set(key, value)
}
}
return result
}

getSystemInfoSync(data: DMPMap, callback: DMPBridgeCallback) {
const currentTime = Date.now();
// 检查缓存是否有效(10秒)
Expand Down Expand Up @@ -135,7 +150,35 @@ export class DMPContainerBridgesModuleSystem extends DMPContainerBridgesModule {

//星河sdk版本
result.set('SDKVersion', BuildProfile.HAR_VERSION);
result.set('enableDebug', this.app.appConfig.isDebugMode);
result.set('debugEnv', this.app.appConfig.isDebugMode ? 1 : 0)

// language: 微信客户端设置的语言
const locale = i18n.System.getSystemLocale()
result.set('language', locale)

// theme: 系统当前主题
try {
const uiContext = getContext(this) as common.UIAbilityContext
const colorMode = uiContext.config.colorMode
result.set('theme', colorMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK ? 'dark' : 'light')
} catch (e) {
result.set('theme', 'light')
}

// host: 宿主信息
result.set('host', { appId: this.app.appConfig.appId })

// font settings
try {
const uiCtx = getContext(this) as common.UIAbilityContext
const fontSizeScale: number = uiCtx.config.fontSizeScale ?? 1.0
result.set('fontSizeScaleFactor', fontSizeScale)
result.set('fontSizeSetting', Math.round(16 * fontSizeScale))
} catch (e) {
result.set('fontSizeScaleFactor', 1.0)
result.set('fontSizeSetting', 16)
}
try {

result.set('appid', this.app.bundleManager.getBundleInfo().appId)
Expand Down
2 changes: 2 additions & 0 deletions harmony/dimina/src/main/ets/Container/DMPContainer.ets
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { DMPBridges } from '../Bridges/DMPBridges';
import { DMPApp } from '../DApp/DMPApp';
import { DMPChannelProxyNext } from '../Service/DMPChannelProxyNext';
import { DMPMap } from '../Utils/DMPMap';
import { DMPHostEnvBuilder } from '../Utils/DMPHostEnvBuilder';

export enum ResourceLoadType {
Init = 0 << 0,
Expand Down Expand Up @@ -43,6 +44,7 @@ export class DMPContainer {
appId: this.app.appConfig.appId,
pagePath: pagePath,
root: root,
hostEnv: DMPHostEnvBuilder.buildSnapshot(this.app),
}
})

Expand Down
Loading
Loading