feat: 多端邀请接入
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'dart:convert';
|
||||
import 'package:openinstall_flutter_plugin/openinstall_flutter_plugin.dart';
|
||||
|
||||
import 'dart:io' show Platform, SocketException;
|
||||
import 'dart:math';
|
||||
@@ -165,6 +166,9 @@ class KRSplashController extends GetxController {
|
||||
}),
|
||||
]);
|
||||
|
||||
// 静默邀请初始化(在主流程完成后进行,不影响启动速度)
|
||||
_kr_initOpenInstall();
|
||||
|
||||
_initLog.logPhaseEnd('主初始化流程', success: true);
|
||||
} on TimeoutException catch (e) {
|
||||
// 🔧 P2优化:超时错误提供更友好的提示
|
||||
@@ -558,6 +562,22 @@ class KRSplashController extends GetxController {
|
||||
_kr_initialize();
|
||||
}
|
||||
|
||||
/// 初始化 OpenInstall
|
||||
void _kr_initOpenInstall() {
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
try {
|
||||
KRLogUtil.kr_i('🚀 初始化 OpenInstall...', tag: 'SplashController');
|
||||
OpeninstallFlutterPlugin().init((data) async {
|
||||
KRLogUtil.kr_i('收到 OpenInstall 唤醒数据: $data', tag: 'SplashController');
|
||||
// 处理唤醒时的邀请绑定
|
||||
KRAppRunData().kr_handleOpenInstallData(data);
|
||||
});
|
||||
} catch (e) {
|
||||
KRLogUtil.kr_e('OpenInstall 初始化失败: $e', tag: 'SplashController');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 🔧 P3优化:跳过初始化,直接进入主页
|
||||
void kr_skipInitialization() {
|
||||
KRLogUtil.kr_i('⏭️ 用户选择跳过初始化', tag: 'SplashController');
|
||||
|
||||
Reference in New Issue
Block a user