72 lines
1.3 KiB
Dart
72 lines
1.3 KiB
Dart
//<com>
|
|
import 'firebase/firebase_helper.dart';
|
|
|
|
//</com>
|
|
|
|
//<cn>
|
|
import 'umeng/umeng_helper.dart';
|
|
//</cn>
|
|
|
|
class ApmHelper {
|
|
ApmHelper._internal();
|
|
|
|
factory ApmHelper() => _getInstance();
|
|
|
|
static ApmHelper get instance => _getInstance();
|
|
static ApmHelper? _instance;
|
|
|
|
// 增加开关
|
|
static bool enabled = false;
|
|
|
|
static ApmHelper _getInstance() {
|
|
_instance ??= ApmHelper._internal();
|
|
return _instance!;
|
|
}
|
|
|
|
Future<void> initApp() async {
|
|
//<cn>
|
|
await UmengHelper.instance.initApp();
|
|
//</cn>
|
|
//<com>
|
|
await FirebaseHelper.instance.initApp();
|
|
//</com>
|
|
}
|
|
|
|
Future<void> initSdk() async {
|
|
//<cn>
|
|
UmengHelper.instance.initSdk();
|
|
//</cn>
|
|
//<com>
|
|
// FirebaseHelper.instance.initSdk();
|
|
//</com>
|
|
}
|
|
|
|
Future<void> login(String userId) async {
|
|
//<cn>
|
|
UmengHelper.instance.login(userId);
|
|
//</cn>
|
|
//<com>
|
|
FirebaseHelper.instance.login(userId);
|
|
//</com>
|
|
}
|
|
|
|
Future<void> trackEvent(
|
|
String eventName, Map<String, Object> parameters) async {
|
|
//<cn>
|
|
UmengHelper.instance.trackEvent(eventName, parameters);
|
|
//</cn>
|
|
//<com>
|
|
FirebaseHelper.instance.trackEvent(eventName, parameters);
|
|
//</com>
|
|
}
|
|
|
|
Future<void> logout() async {
|
|
//<cn>
|
|
UmengHelper.instance.logout();
|
|
//</cn>
|
|
//<com>
|
|
FirebaseHelper.instance.logout();
|
|
//</com>
|
|
}
|
|
}
|