统一 Rust 与 TypeScript 格式化门禁
纳入 AGC Cargo workspace 的统一 rustfmt 检查与格式化入口 完成项目 TypeScript/Prettier 与 Rust 全量格式化 修复 Pingora expected executable 门禁的空白敏感误报 同步开发运维文档与 AGC skill pack 格式化忽略规则
This commit is contained in:
@@ -101,7 +101,11 @@ function saveImageToAlbum(filePath) {
|
||||
function copyTempFileWithName(tempFilePath, fileName) {
|
||||
const fileSystem = wx.getFileSystemManager && wx.getFileSystemManager();
|
||||
const userDataPath = wx.env && wx.env.USER_DATA_PATH;
|
||||
if (!fileSystem || !userDataPath || typeof fileSystem.copyFile !== 'function') {
|
||||
if (
|
||||
!fileSystem ||
|
||||
!userDataPath ||
|
||||
typeof fileSystem.copyFile !== 'function'
|
||||
) {
|
||||
return Promise.resolve(tempFilePath);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,10 +64,14 @@ describe('wechat share-grid shell page', () => {
|
||||
|
||||
expect(page.data.loading).toBe(false);
|
||||
expect(page.data.errorMessage).toBe('九宫切图保存失败。');
|
||||
expect(page.data.errorMessage).not.toContain('private native download detail');
|
||||
expect(page.data.errorMessage).not.toContain(
|
||||
'private native download detail',
|
||||
);
|
||||
expect(consoleError).toHaveBeenCalledWith('[share-grid] download failed');
|
||||
expect(consoleError).toHaveBeenCalledWith('[share-grid] save failed');
|
||||
expect(consoleError.mock.calls.flat()).not.toContain('private native download detail');
|
||||
expect(consoleError.mock.calls.flat()).not.toContain(
|
||||
'private native download detail',
|
||||
);
|
||||
consoleError.mockRestore();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -18,7 +18,8 @@ const {
|
||||
resolveWebViewUrlFromRuntimeConfig,
|
||||
} = require('../host-bridge/webView');
|
||||
|
||||
const CLIENT_INSTANCE_STORAGE_KEY = 'genarrative:mini-program-client-instance-id';
|
||||
const CLIENT_INSTANCE_STORAGE_KEY =
|
||||
'genarrative:mini-program-client-instance-id';
|
||||
const PAY_RESULT_STORAGE_KEY = 'genarrative:wechat-pay-result';
|
||||
const AUTH_RESULT_STORAGE_KEY = 'genarrative:mini-program-auth-result';
|
||||
const AUTH_ACTION_LOGIN = 'login';
|
||||
@@ -26,7 +27,8 @@ const PAY_RESULT_RECHECK_DELAY_MS = 120;
|
||||
const WEB_VIEW_SHARE_TITLE = '陶泥儿';
|
||||
const WECHAT_LOGIN_UNAVAILABLE_MESSAGE = '微信登录失败,请稍后重试。';
|
||||
const WECHAT_BIND_PHONE_UNAVAILABLE_MESSAGE = '绑定手机号失败,请稍后重试。';
|
||||
const WECHAT_BIND_PHONE_AUTH_REQUIRED_MESSAGE = '需要授权手机号后才能完成绑定。';
|
||||
const WECHAT_BIND_PHONE_AUTH_REQUIRED_MESSAGE =
|
||||
'需要授权手机号后才能完成绑定。';
|
||||
|
||||
function showWebViewShareMenu() {
|
||||
if (typeof wx.showShareMenu !== 'function') {
|
||||
@@ -41,9 +43,7 @@ function showWebViewShareMenu() {
|
||||
|
||||
function resolveNativeShareQuery(page) {
|
||||
return (
|
||||
(page && page._currentShareTarget) ||
|
||||
(page && page._lastLaunchQuery) ||
|
||||
{}
|
||||
(page && page._currentShareTarget) || (page && page._lastLaunchQuery) || {}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -67,11 +67,15 @@ function isConfiguredEntryUrl(value) {
|
||||
}
|
||||
|
||||
function trimTrailingSlash(value) {
|
||||
return String(value || '').trim().replace(/\/+$/u, '');
|
||||
return String(value || '')
|
||||
.trim()
|
||||
.replace(/\/+$/u, '');
|
||||
}
|
||||
|
||||
function readWebViewSourceQueryValue(key) {
|
||||
return String((WEB_VIEW_SOURCE_QUERY && WEB_VIEW_SOURCE_QUERY[key]) || '').trim();
|
||||
return String(
|
||||
(WEB_VIEW_SOURCE_QUERY && WEB_VIEW_SOURCE_QUERY[key]) || '',
|
||||
).trim();
|
||||
}
|
||||
|
||||
function isConfiguredApiBaseUrl(value) {
|
||||
@@ -125,7 +129,10 @@ function isDefaultDisplayName(value, publicUserCode) {
|
||||
function shouldRequestNicknameAfterLogin(authResult) {
|
||||
const user = authResult && authResult.user ? authResult.user : {};
|
||||
const wechatDisplayName = normalizeNicknameInput(user.wechatDisplayName);
|
||||
if (wechatDisplayName && !isDefaultDisplayName(wechatDisplayName, user.publicUserCode)) {
|
||||
if (
|
||||
wechatDisplayName &&
|
||||
!isDefaultDisplayName(wechatDisplayName, user.publicUserCode)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -139,7 +146,9 @@ function shouldRequestNicknameAfterLogin(authResult) {
|
||||
}
|
||||
|
||||
function normalizeMiniProgramEnv(value) {
|
||||
const normalized = String(value || '').trim().toLowerCase();
|
||||
const normalized = String(value || '')
|
||||
.trim()
|
||||
.toLowerCase();
|
||||
if (normalized === 'release') {
|
||||
return 'release';
|
||||
}
|
||||
@@ -430,14 +439,17 @@ function createWechatWebViewPage() {
|
||||
// 中文注释:web-view 只能打开已配置业务域名;未配置时展示本地提示,避免空白页误判。
|
||||
if (!isConfiguredEntryUrl(runtimeConfig.webViewEntryUrl)) {
|
||||
this.setData({
|
||||
errorMessage: '请先在 miniprogram/config.js 填写 WEB_VIEW_ENTRY_URL。',
|
||||
errorMessage:
|
||||
'请先在 miniprogram/config.js 填写 WEB_VIEW_ENTRY_URL。',
|
||||
loading: false,
|
||||
webViewUrl: '',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const forcedPhoneBinding = parseBooleanQueryFlag(query.phoneBindingRequired);
|
||||
const forcedPhoneBinding = parseBooleanQueryFlag(
|
||||
query.phoneBindingRequired,
|
||||
);
|
||||
const returnToPreviousPage = shouldReturnToPreviousPage(query);
|
||||
if (!shouldStartAuthFromQuery(query) && !forcedPhoneBinding) {
|
||||
this.setData({
|
||||
@@ -552,7 +564,10 @@ function createWechatWebViewPage() {
|
||||
nicknameRequired: false,
|
||||
phoneBindingRequired: false,
|
||||
returnToPreviousPage,
|
||||
webViewUrl: resolveWebViewUrl(authResult, this._lastLaunchQuery || {}),
|
||||
webViewUrl: resolveWebViewUrl(
|
||||
authResult,
|
||||
this._lastLaunchQuery || {},
|
||||
),
|
||||
});
|
||||
} catch (error) {
|
||||
logWebViewAuthFailure('auth flow failed', error);
|
||||
@@ -580,7 +595,10 @@ function createWechatWebViewPage() {
|
||||
loading: false,
|
||||
nicknameRequired: false,
|
||||
phoneBindingRequired: false,
|
||||
webViewUrl: resolveWebViewUrl(authResult, this._lastLaunchQuery || {}),
|
||||
webViewUrl: resolveWebViewUrl(
|
||||
authResult,
|
||||
this._lastLaunchQuery || {},
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user