Skip to content

Commit

Permalink
fix: wx.getSystemInfoSync() Due to the discontinuation of maintenance…
Browse files Browse the repository at this point in the history
… for this API, compatibility processing has been carried out
  • Loading branch information
TallNutAlt authored Dec 26, 2024
1 parent 72bdf6b commit 23a7bfb
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/common/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,20 @@ let systemInfo: SystemInfo;

export function getSystemInfoSync() {
if (systemInfo == null) {
systemInfo = wx.getSystemInfoSync();
try {
if (wx.canIUse('getAppBaseInfo')) {
systemInfo = wx.getAppBaseInfo();
// systemInfo = {
// ...wx.getSystemSetting(),
// ...wx.getAppAuthorizeSetting(),
// ...wx.getDeviceInfo(),
// ...wx.getWindowInfo(),
// ...wx.getAppBaseInfo()
// };
}
} catch (e) {
systemInfo = wx.getSystemInfoSync();
}
}

return systemInfo as SystemInfo;
Expand Down

0 comments on commit 23a7bfb

Please sign in to comment.