网络请求打通,ws 打通
This commit is contained in:
@@ -2636,7 +2636,15 @@ class UploadFileRequest extends ApiRequestable<UploadResult>
|
||||
final apiConfigProvider = Provider<ApiConfig>((ref) {
|
||||
return ApiConfig(
|
||||
baseURL: AppConfig.apiBaseUrl,
|
||||
platformHeaders: {'Platform': 'Android', 'client-version': '1.0.0'},
|
||||
platformHeaders: {
|
||||
'platform': DeviceInfo.platform, // 运行时同步读取(DeviceInfo.init() 预取)
|
||||
'os-type': DeviceInfo.osType.toString(), // Android=1 iOS=2 Windows=3 macOS=4 Linux=5
|
||||
'client-version': AppConfig.appVersion,
|
||||
'channel': AppConfig.channel,
|
||||
'lang': DeviceInfo.lang,
|
||||
'device-id': DeviceInfo.deviceId,
|
||||
'device-name': DeviceInfo.deviceName,
|
||||
},
|
||||
tokenExpiredCodes: {30002, 30003, 30124},
|
||||
forceLogoutCodes: {30125},
|
||||
onForceLogout: () { /* 清除登录态,跳转登录页 */ },
|
||||
@@ -6558,8 +6566,13 @@ final apiConfigProvider = Provider<ApiConfig>((ref) {
|
||||
return ApiConfig(
|
||||
baseURL: AppConfig.apiBaseUrl,
|
||||
platformHeaders: {
|
||||
'Platform': 'Android', // TODO: 运行时从平台 API 获取
|
||||
'client-version': '1.0.0', // TODO: 运行时从 package_info 获取
|
||||
'platform': DeviceInfo.platform, // 运行时同步读取(DeviceInfo.init() 预取)
|
||||
'os-type': DeviceInfo.osType.toString(), // Android=1 iOS=2 Windows=3 macOS=4 Linux=5
|
||||
'client-version': AppConfig.appVersion,
|
||||
'channel': AppConfig.channel,
|
||||
'lang': DeviceInfo.lang,
|
||||
'device-id': DeviceInfo.deviceId,
|
||||
'device-name': DeviceInfo.deviceName,
|
||||
},
|
||||
tokenExpiredCodes: {30002, 30003, 30124}, // 后端约定的 Token 过期错误码
|
||||
forceLogoutCodes: {30125}, // 后端约定的强制登出错误码
|
||||
@@ -7626,6 +7639,7 @@ linter:
|
||||
prefer_const_declarations: true
|
||||
prefer_const_literals_to_create_immutables: true
|
||||
prefer_final_locals: true
|
||||
always_use_package_imports: true # 禁止相对路径 import,一律用 package: 全路径
|
||||
|
||||
# 命名规则
|
||||
camel_case_types: true
|
||||
@@ -9794,6 +9808,7 @@ flowchart TD
|
||||
<li><strong>使用 Melos 管理依赖</strong>:Mono-Repo 保证版本一致性</li>
|
||||
<li><strong>编写完整测试</strong>:单元测试、集成测试、端到端测试</li>
|
||||
<li><strong>UI 层使用 ConsumerWidget</strong>:通过 ref.watch 监听状态,ref.read 读取 Provider</li>
|
||||
<li><strong>import 一律使用 package 全路径</strong>:禁止相对路径(<code>../base/colors.dart</code>),统一写 <code>package:im_app/core/ui/base/colors.dart</code>;相对路径文件移动后静默失效,全路径重构安全、跨包引用统一,已由 <code>always_use_package_imports: true</code> 强制执行</li>
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user