fix web build
This commit is contained in:
parent
12bb369ac1
commit
36513d14d9
@ -16,7 +16,6 @@ class LogCenterService {
|
||||
defaultValue: 'https://qiyuan-log-center-api.airlabs.art',
|
||||
);
|
||||
static const String _url = '$_baseUrl/api/v1/logs/report';
|
||||
static const String _registerUrl = '$_baseUrl/api/v1/projects/register';
|
||||
static const String _projectId = 'airhub_app';
|
||||
static const String _repoUrl = 'https://gitea.airlabs.art/zyc/rtc_prd.git';
|
||||
|
||||
@ -30,24 +29,6 @@ class LogCenterService {
|
||||
));
|
||||
}
|
||||
|
||||
/// 初始化:向 Log Center 注册项目
|
||||
Future<void> initialize() async {
|
||||
try {
|
||||
await _dio.post(_registerUrl, data: {
|
||||
'project_id': _projectId,
|
||||
'repo_url': _repoUrl,
|
||||
'description': 'Flutter mobile app (subdirectory of rtc_prd repo)',
|
||||
'platform': defaultTargetPlatform.name,
|
||||
'environment': const String.fromEnvironment(
|
||||
'ENVIRONMENT',
|
||||
defaultValue: kDebugMode ? 'development' : 'production',
|
||||
),
|
||||
});
|
||||
} catch (_) {
|
||||
// 静默失败,不影响 App 启动
|
||||
}
|
||||
}
|
||||
|
||||
/// 上报 Flutter 框架错误(FlutterError)
|
||||
void reportFlutterError(FlutterErrorDetails details) {
|
||||
_report(
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/foundation.dart' show debugPrint, kIsWeb;
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:ali_auth/ali_auth.dart';
|
||||
import 'phone_auth_service_stub.dart'
|
||||
if (dart.library.io) 'package:ali_auth/ali_auth.dart';
|
||||
|
||||
part 'phone_auth_service.g.dart';
|
||||
|
||||
|
||||
@ -1,15 +1,76 @@
|
||||
/// Web 平台 stub — ali_auth 不支持 Web,提供空实现
|
||||
/// Web 平台 stub — ali_auth 依赖运营商 SIM 卡,Web 上不可用。
|
||||
/// 仅提供编译所需的空壳,运行时由 kIsWeb 守卫跳过。
|
||||
|
||||
class AliAuth {
|
||||
static Future<void> initSdk(dynamic model) async {}
|
||||
static void loginListen({required Function(Map<String, dynamic>) onEvent}) {}
|
||||
static Future<dynamic> initSdk(dynamic model) async {}
|
||||
static loginListen({
|
||||
bool type = true,
|
||||
required Function onEvent,
|
||||
Function? onError,
|
||||
bool isOnlyOne = true,
|
||||
}) {}
|
||||
static Future<dynamic> login({int timeout = 5000}) async {}
|
||||
static Future<void> quitPage() async {}
|
||||
static Future<void> hideLoading() async {}
|
||||
}
|
||||
|
||||
enum PageType {
|
||||
fullPort,
|
||||
fullLand,
|
||||
dialogPort,
|
||||
dialogLand,
|
||||
dialogBottom,
|
||||
customView,
|
||||
customXml,
|
||||
customGif,
|
||||
customMOV,
|
||||
customPIC,
|
||||
}
|
||||
|
||||
class AliAuthModel {
|
||||
AliAuthModel(String androidSk, String iosSk,
|
||||
{bool isDebug = false, bool autoQuitPage = false, dynamic pageType});
|
||||
}
|
||||
|
||||
class PageType {
|
||||
static const fullPort = 0;
|
||||
AliAuthModel(
|
||||
String? androidSk,
|
||||
String? iosSk, {
|
||||
dynamic isDebug,
|
||||
dynamic isDelay,
|
||||
dynamic autoQuitPage,
|
||||
dynamic pageType,
|
||||
dynamic dialogWidth,
|
||||
dynamic dialogHeight,
|
||||
dynamic dialogCornerRadiusArray,
|
||||
dynamic dialogAlpha,
|
||||
dynamic tapAuthPageMaskClosePage,
|
||||
dynamic navHidden,
|
||||
dynamic navReturnHidden,
|
||||
dynamic logoHidden,
|
||||
dynamic logoImgPath,
|
||||
dynamic logoWidth,
|
||||
dynamic logoHeight,
|
||||
dynamic logoOffsetY,
|
||||
dynamic numberColor,
|
||||
dynamic numFieldOffsetY,
|
||||
dynamic sloganHidden,
|
||||
dynamic logBtnText,
|
||||
dynamic logBtnTextColor,
|
||||
dynamic logBtnWidth,
|
||||
dynamic logBtnHeight,
|
||||
dynamic logBtnOffsetY,
|
||||
dynamic switchAccText,
|
||||
dynamic switchAccTextColor,
|
||||
dynamic switchOffsetY,
|
||||
dynamic privacyState,
|
||||
dynamic privacyBefore,
|
||||
dynamic privacyEnd,
|
||||
dynamic vendorPrivacyPrefix,
|
||||
dynamic vendorPrivacySuffix,
|
||||
dynamic protocolOneName,
|
||||
dynamic protocolOneURL,
|
||||
dynamic protocolTwoName,
|
||||
dynamic protocolTwoURL,
|
||||
dynamic privacyOffsetY_B,
|
||||
dynamic pageBackgroundPath,
|
||||
dynamic backgroundColor,
|
||||
dynamic pageBackgroundRadius,
|
||||
dynamic isHiddenCustom,
|
||||
});
|
||||
}
|
||||
|
||||
@ -14,8 +14,6 @@ void main() {
|
||||
|
||||
final container = ProviderContainer();
|
||||
final logCenter = container.read(logCenterServiceProvider);
|
||||
logCenter.initialize();
|
||||
|
||||
// 捕获 Flutter 框架错误(Widget build 异常等)
|
||||
FlutterError.onError = (details) {
|
||||
FlutterError.presentError(details); // 保留控制台输出
|
||||
|
||||
@ -1,57 +1,38 @@
|
||||
import 'dart:html' as html show window;
|
||||
import 'package:flutter/foundation.dart' show debugPrint;
|
||||
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
|
||||
import 'ali_auth_web_api.dart';
|
||||
import 'ali_auth_platform_interface.dart';
|
||||
export 'ali_auth_method_channel.dart';
|
||||
|
||||
/// A web implementation of the AliAuthPlatform of the AliAuth plugin.
|
||||
/// Web 平台 stub —— 一键登录依赖运营商 SIM 卡,Web 上不可用。
|
||||
/// 所有方法均为空实现,PhoneAuthService 已通过 kIsWeb 守卫跳过调用。
|
||||
class AliAuthPluginWeb extends AliAuthPlatform {
|
||||
/// Constructs a AliAuthWeb
|
||||
AliAuthPluginWeb();
|
||||
|
||||
AliAuthPluginWebApi aliAuthPluginWebApi = AliAuthPluginWebApi();
|
||||
|
||||
static void registerWith(Registrar registrar) {
|
||||
AliAuthPlatform.instance = AliAuthPluginWeb();
|
||||
}
|
||||
|
||||
/// Returns a [String] containing the version of the platform.
|
||||
@override
|
||||
Future<String?> getPlatformVersion() async {
|
||||
final version = html.window.navigator.userAgent;
|
||||
return version;
|
||||
}
|
||||
Future<String?> getPlatformVersion() async => 'web (unsupported)';
|
||||
|
||||
/// 获取SDK版本号
|
||||
@override
|
||||
Future<String?> getSdkVersion() async {
|
||||
return await aliAuthPluginWebApi.getVersion();
|
||||
}
|
||||
Future<String?> getSdkVersion() async => null;
|
||||
|
||||
/// 网络类型检查接口
|
||||
@override
|
||||
Future<String?> getConnection() async {
|
||||
return await aliAuthPluginWebApi.getConnection();
|
||||
}
|
||||
Future<String?> getConnection() async => null;
|
||||
|
||||
/// 设置SDK是否开启日志。开启后会在控制台打印更多内容便于排查问题。
|
||||
@override
|
||||
Future<void> setLoggerEnable(bool isEnable) async {
|
||||
return await aliAuthPluginWebApi.setLoggerEnable(isEnable);
|
||||
}
|
||||
Future<void> setLoggerEnable(bool isEnable) async {}
|
||||
|
||||
/// 身份鉴权
|
||||
@override
|
||||
Future<void> checkAuthAvailable(String accessToken, String jwtToken,
|
||||
Function(dynamic) success, Function(dynamic) error) async {
|
||||
aliAuthPluginWebApi.checkAuthAvailable(
|
||||
accessToken, jwtToken, success, error);
|
||||
debugPrint('[AliAuth] Web 平台不支持一键登录');
|
||||
}
|
||||
|
||||
/// 获取本机号码校验Token
|
||||
@override
|
||||
Future<void> getVerifyToken(
|
||||
Function(dynamic) success, Function(dynamic) error) async {
|
||||
aliAuthPluginWebApi.getVerifyToken(success, error);
|
||||
debugPrint('[AliAuth] Web 平台不支持一键登录');
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user