feat(security): 加固令牌与会话隔离,完善局域网授权与相册分页
- 令牌改用安全存储持久化,登录/登出按会话版本重建 ProviderScope 并清理账号缓存 - dio 401 刷新改为并发共享单次刷新,避免旧会话覆盖新账号令牌 - Android 17 增加局域网权限申请与网络安全配置,iOS 补充本地网络说明与钥匙串权限 - 相册分页加载并及时释放缩略图/媒体缓存,远程连接销毁时释放信令与 WebRTC - 升级 AGP 9 / Gradle 9 / compileSdk 37,统一第三方插件 compileSdk,Windows 启用 /utf-8 - 新增 dio 刷新、会话隔离与相册分页单元测试
This commit is contained in:
1 parent
7435588fa7
commit
4976a26892
41 files changed
+1232
-654
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../../app/constants/app_constants.dart';
|
||||
import '../network/api_exception.dart';
|
||||
|
||||
class LocalNetworkAccess {
|
||||
LocalNetworkAccess._();
|
||||
|
||||
static const _channel = MethodChannel('com.ttstd.familycare/app');
|
||||
static final _backendHost = Uri.parse(AppConstants.kBaseUrl).host;
|
||||
static Future<bool?>? _pending;
|
||||
|
||||
static Future<void> ensure(Uri uri) async {
|
||||
if (!Platform.isAndroid || uri.host != _backendHost) return;
|
||||
|
||||
final request = _pending ??= _channel.invokeMethod<bool>(
|
||||
'requestLocalNetwork',
|
||||
);
|
||||
try {
|
||||
if (await request == true) return;
|
||||
} finally {
|
||||
if (identical(_pending, request)) _pending = null;
|
||||
}
|
||||
throw const ApiException(
|
||||
code: 'LOCAL_NETWORK_DENIED',
|
||||
message: '请允许访问局域网后重试',
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user