M3 补全:移除 EchoSample 样板 + getcompareCode 接版本决策 + app_gamename
- 移除 EchoSampleProvider(组装根/导出/文件):M3 全部 Provider 已就位, getTime 由 DeviceProvider 提供;样板回显仅 M1 测试页用,生产无依赖 - getcompareCode:启动期 StartupOrchestrator 把网络 App 版本(VersionDecision.appVersion) 存 KvStore(KV_KEY_NET_APP_VERSION),DeviceProvider 同步读出与本地 config.appversion 比较, 本地>网络→'1' 否则'0'(对齐 Android apputil.code 语义) - app_gamename:VersionXml.parse 解析子 <game name>;ResourceManager.localGameName 暴露; AppDataInjector.buildValues 接 gameName 参数;大厅/子游戏两处注入均填入 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
cc5db07ddd
commit
01e4c0e99e
@@ -13,7 +13,7 @@ import { common } from '@kit.AbilityKit';
|
||||
import { Downloader, FileSystem, KvStore, ProgressCallback, Unzipper } from 'platform';
|
||||
import { Logger } from 'common';
|
||||
import { AppConfig } from '../config/AppConfig';
|
||||
import { VersionXml } from './VersionXml';
|
||||
import { VersionXml, VersionXmlInfo } from './VersionXml';
|
||||
|
||||
/** 资源路径集合。 */
|
||||
export interface ResourcePaths {
|
||||
@@ -73,18 +73,28 @@ export class ResourceManager {
|
||||
return FileSystem.exists(this.cachedPaths.indexPath);
|
||||
}
|
||||
|
||||
/** 本地资源版本(version.xml 的 version;缺失返回 0)。 */
|
||||
localVersion(): number {
|
||||
/** 解析本地 version.xml(取首个存在的候选;缺失 → 默认空信息)。 */
|
||||
private readVersionXml(): VersionXmlInfo {
|
||||
const candidates: string[] = [
|
||||
`${this.cachedPaths.gameDir}/version.xml`,
|
||||
`${this.cachedPaths.urlpath}/version.xml`,
|
||||
];
|
||||
for (const p of candidates) {
|
||||
if (FileSystem.exists(p)) {
|
||||
return VersionXml.parseVersion(FileSystem.readText(p));
|
||||
return VersionXml.parse(FileSystem.readText(p));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return { version: 0, gameName: '' };
|
||||
}
|
||||
|
||||
/** 本地资源版本(version.xml 的 version;缺失返回 0)。 */
|
||||
localVersion(): number {
|
||||
return this.readVersionXml().version;
|
||||
}
|
||||
|
||||
/** 本地游戏名(version.xml 子 <game name>;缺失返回 ''),写入 app_data 的 app_gamename。 */
|
||||
localGameName(): string {
|
||||
return this.readVersionXml().gameName;
|
||||
}
|
||||
|
||||
/** 持久化路径到 KvStore(供容器/重启读取)。 */
|
||||
|
||||
Reference in New Issue
Block a user