Skip to content

fix(storage): align sync storage APIs with WeChat behavior#190

Merged
dos1in merged 2 commits intodidi:mainfrom
EchoTechFE:fix/ios-storage-sync-bridge-params
Apr 7, 2026
Merged

fix(storage): align sync storage APIs with WeChat behavior#190
dos1in merged 2 commits intodidi:mainfrom
EchoTechFE:fix/ios-storage-sync-bridge-params

Conversation

@lbb00
Copy link
Copy Markdown
Contributor

@lbb00 lbb00 commented Mar 31, 2026

修复 iOS 和 Android 端 Storage 同步接口的参数解析逻辑。对齐微信官方的文档

Fixes #164

@lbb00 lbb00 changed the title fix(ios): align storage sync bridge params fix(storage): align sync storage APIs with WeChat behavior Apr 3, 2026
@lbb00
Copy link
Copy Markdown
Contributor Author

lbb00 commented Apr 3, 2026

进一步排查发现 removeStorageSync 的根因在 JS SDK 层——使用了 rest 参数 (...opts) 导致单个 key 被包装为数组,Android 端 optString 解析得到 ["key"] 而非 key,静默删除失败。已将 JS SDK 改为普通参数 (opts),并对齐 iOS/Harmony 端为字符串解析,与 getStorageSync 保持一致。

@dos1in
Copy link
Copy Markdown
Member

dos1in commented Apr 7, 2026

需要解决下代码冲突

@lbb00 lbb00 force-pushed the fix/ios-storage-sync-bridge-params branch from d187b02 to dd483cb Compare April 7, 2026 03:58
lbb00 added 2 commits April 7, 2026 12:06
…t type support

Return empty string instead of null/nil when key doesn't exist,
matching WeChat official behavior. Applied to iOS and Android.

Also add JSONObject/JSONArray support in Android storage set/get
and getStorageSync return to preserve structured data types.
@lbb00 lbb00 force-pushed the fix/ios-storage-sync-bridge-params branch from dd483cb to 18d84a9 Compare April 7, 2026 04:07
@lbb00
Copy link
Copy Markdown
Contributor Author

lbb00 commented Apr 7, 2026

需要解决下代码冲突

done

@dos1in dos1in merged commit a3d67f9 into didi:main Apr 7, 2026
1 check passed
lbb00 added a commit to EchoTechFE/dimina that referenced this pull request Apr 7, 2026
* fix(ios): align storage sync bridge params

* fix(storage): align getStorageSync with WeChat behavior and add Object type support

Return empty string instead of null/nil when key doesn't exist,
matching WeChat official behavior. Applied to iOS and Android.

Also add JSONObject/JSONArray support in Android storage set/get
and getStorageSync return to preserve structured data types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] wx.getStorageSync和wx.getStorageSync不支持?

2 participants