mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2024-12-23 06:33:43 +08:00
feat: AnalyticsApi update
This commit is contained in:
parent
155c8a0564
commit
348704c669
@ -7,7 +7,10 @@ import 'package:starcitizen_doctor/common/utils/log.dart';
|
|||||||
|
|
||||||
class AnalyticsApi {
|
class AnalyticsApi {
|
||||||
static touch(String key) async {
|
static touch(String key) async {
|
||||||
if (kDebugMode || kProfileMode) return;
|
if (kDebugMode || kProfileMode) {
|
||||||
|
dPrint("AnalyticsApi.touch === $key skip");
|
||||||
|
return;
|
||||||
|
}
|
||||||
dPrint("AnalyticsApi.touch === $key start");
|
dPrint("AnalyticsApi.touch === $key start");
|
||||||
try {
|
try {
|
||||||
final r = await RSHttp.postData(
|
final r = await RSHttp.postData(
|
||||||
|
@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart';
|
|||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
import 'package:starcitizen_doctor/api/analytics.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/binary_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/binary_conf.dart';
|
||||||
import 'package:starcitizen_doctor/common/helper/log_helper.dart';
|
import 'package:starcitizen_doctor/common/helper/log_helper.dart';
|
||||||
import 'package:starcitizen_doctor/common/rust/api/rs_process.dart';
|
import 'package:starcitizen_doctor/common/rust/api/rs_process.dart';
|
||||||
@ -51,6 +52,8 @@ class Unp4kCModel extends _$Unp4kCModel {
|
|||||||
|
|
||||||
String getGamePath() => _toolsState.scInstalledPath;
|
String getGamePath() => _toolsState.scInstalledPath;
|
||||||
|
|
||||||
|
bool _hasUnp4kRunTimeError = false;
|
||||||
|
|
||||||
void _init() async {
|
void _init() async {
|
||||||
final execDir = "${appGlobalState.applicationBinaryModuleDir}\\unp4kc";
|
final execDir = "${appGlobalState.applicationBinaryModuleDir}\\unp4kc";
|
||||||
await BinaryModuleConf.extractModule(
|
await BinaryModuleConf.extractModule(
|
||||||
@ -79,6 +82,15 @@ class Unp4kCModel extends _$Unp4kCModel {
|
|||||||
state = state.copyWith(
|
state = state.copyWith(
|
||||||
errorMessage: "${state.errorMessage}\n${event.data}");
|
errorMessage: "${state.errorMessage}\n${event.data}");
|
||||||
}
|
}
|
||||||
|
if (!_hasUnp4kRunTimeError) {
|
||||||
|
if (state.errorMessage.contains(
|
||||||
|
"You must install .NET to run this application") ||
|
||||||
|
state.errorMessage.contains(
|
||||||
|
"You must install or update .NET to run this application")) {
|
||||||
|
_hasUnp4kRunTimeError = true;
|
||||||
|
AnalyticsApi.touch("unp4k_no_runtime");
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case RsProcessStreamDataType.exit:
|
case RsProcessStreamDataType.exit:
|
||||||
dPrint("[unp4kc] exit: ${event.data}");
|
dPrint("[unp4kc] exit: ${event.data}");
|
||||||
|
@ -3,6 +3,7 @@ import 'package:flutter/scheduler.dart';
|
|||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:flutter_tilt/flutter_tilt.dart';
|
import 'package:flutter_tilt/flutter_tilt.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:starcitizen_doctor/api/analytics.dart';
|
||||||
import 'package:starcitizen_doctor/common/helper/log_helper.dart';
|
import 'package:starcitizen_doctor/common/helper/log_helper.dart';
|
||||||
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
||||||
import 'package:starcitizen_doctor/common/utils/log.dart';
|
import 'package:starcitizen_doctor/common/utils/log.dart';
|
||||||
@ -22,6 +23,7 @@ class HomeGameDoctorUI extends HookConsumerWidget {
|
|||||||
final model = ref.read(homeGameDoctorUIModelProvider.notifier);
|
final model = ref.read(homeGameDoctorUIModelProvider.notifier);
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
|
AnalyticsApi.touch("auto_scan_issues");
|
||||||
SchedulerBinding.instance.addPostFrameCallback((timeStamp) {
|
SchedulerBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
dPrint("HomeGameDoctorUI useEffect doCheck timeStamp === $timeStamp");
|
dPrint("HomeGameDoctorUI useEffect doCheck timeStamp === $timeStamp");
|
||||||
model.doCheck(context);
|
model.doCheck(context);
|
||||||
|
@ -6,6 +6,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|||||||
import 'package:re_editor/re_editor.dart';
|
import 'package:re_editor/re_editor.dart';
|
||||||
import 'package:re_highlight/languages/ini.dart';
|
import 'package:re_highlight/languages/ini.dart';
|
||||||
import 'package:re_highlight/styles/vs2015.dart';
|
import 'package:re_highlight/styles/vs2015.dart';
|
||||||
|
import 'package:starcitizen_doctor/api/analytics.dart';
|
||||||
import 'package:starcitizen_doctor/data/app_advanced_localization_data.dart';
|
import 'package:starcitizen_doctor/data/app_advanced_localization_data.dart';
|
||||||
import 'package:starcitizen_doctor/ui/home/home_ui_model.dart';
|
import 'package:starcitizen_doctor/ui/home/home_ui_model.dart';
|
||||||
import 'package:starcitizen_doctor/ui/home/localization/advanced_localization_ui_model.dart';
|
import 'package:starcitizen_doctor/ui/home/localization/advanced_localization_ui_model.dart';
|
||||||
@ -34,6 +35,11 @@ class AdvancedLocalizationUI extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() {
|
||||||
|
AnalyticsApi.touch("advanced_localization_launch");
|
||||||
|
return null;
|
||||||
|
}, const []);
|
||||||
|
|
||||||
return makeDefaultPage(
|
return makeDefaultPage(
|
||||||
title: S.current.home_localization_advanced_title(
|
title: S.current.home_localization_advanced_title(
|
||||||
homeUIState.scInstalledPath ?? "-"),
|
homeUIState.scInstalledPath ?? "-"),
|
||||||
|
@ -4,6 +4,7 @@ import 'dart:io';
|
|||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
import 'package:starcitizen_doctor/api/analytics.dart';
|
||||||
import 'package:starcitizen_doctor/common/utils/log.dart';
|
import 'package:starcitizen_doctor/common/utils/log.dart';
|
||||||
import 'package:starcitizen_doctor/common/utils/provider.dart';
|
import 'package:starcitizen_doctor/common/utils/provider.dart';
|
||||||
import 'package:starcitizen_doctor/data/app_advanced_localization_data.dart';
|
import 'package:starcitizen_doctor/data/app_advanced_localization_data.dart';
|
||||||
@ -233,8 +234,15 @@ class AdvancedLocalizationUIModel extends _$AdvancedLocalizationUIModel {
|
|||||||
final iniData = String.fromCharCodes(data);
|
final iniData = String.fromCharCodes(data);
|
||||||
return iniData;
|
return iniData;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
final errorMessage = e.toString();
|
||||||
|
if (errorMessage
|
||||||
|
.contains("You must install .NET to run this application") ||
|
||||||
|
errorMessage.contains(
|
||||||
|
"You must install or update .NET to run this application")) {
|
||||||
|
AnalyticsApi.touch("advanced_localization_no_runtime");
|
||||||
|
}
|
||||||
state = state.copyWith(
|
state = state.copyWith(
|
||||||
errorMessage: e.toString(),
|
errorMessage: errorMessage,
|
||||||
);
|
);
|
||||||
// rethrow;
|
// rethrow;
|
||||||
}
|
}
|
||||||
@ -281,6 +289,7 @@ class AdvancedLocalizationUIModel extends _$AdvancedLocalizationUIModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> doInstall() async {
|
Future<bool> doInstall() async {
|
||||||
|
AnalyticsApi.touch("advanced_localization_apply");
|
||||||
state = state.copyWith(
|
state = state.copyWith(
|
||||||
workingText:
|
workingText:
|
||||||
S.current.home_localization_advanced_msg_gen_localization_text);
|
S.current.home_localization_advanced_msg_gen_localization_text);
|
||||||
|
@ -4,6 +4,7 @@ import 'package:fluent_ui/fluent_ui.dart';
|
|||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:starcitizen_doctor/api/analytics.dart';
|
||||||
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
||||||
import 'package:starcitizen_doctor/common/io/rs_http.dart';
|
import 'package:starcitizen_doctor/common/io/rs_http.dart';
|
||||||
import 'package:starcitizen_doctor/common/utils/async.dart';
|
import 'package:starcitizen_doctor/common/utils/async.dart';
|
||||||
@ -14,9 +15,15 @@ class HostsBoosterDialogUI extends HookConsumerWidget {
|
|||||||
|
|
||||||
static final _hostsMap = {
|
static final _hostsMap = {
|
||||||
"Recaptcha": ["www.recaptcha.net", "recaptcha.net"],
|
"Recaptcha": ["www.recaptcha.net", "recaptcha.net"],
|
||||||
S.current.tools_hosts_info_rsi_official_website: ["robertsspaceindustries.com"],
|
S.current.tools_hosts_info_rsi_official_website: [
|
||||||
S.current.tools_hosts_info_rsi_zendesk: ["cloudimperiumservicesllc.zendesk.com"],
|
"robertsspaceindustries.com"
|
||||||
S.current.tools_hosts_info_rsi_customer_service: ["support.robertsspaceindustries.com"],
|
],
|
||||||
|
S.current.tools_hosts_info_rsi_zendesk: [
|
||||||
|
"cloudimperiumservicesllc.zendesk.com"
|
||||||
|
],
|
||||||
|
S.current.tools_hosts_info_rsi_customer_service: [
|
||||||
|
"support.robertsspaceindustries.com"
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -48,6 +55,7 @@ class HostsBoosterDialogUI extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
|
AnalyticsApi.touch("host_dns_boost");
|
||||||
// 监听 Hosts 文件变更
|
// 监听 Hosts 文件变更
|
||||||
_readHostsState(workingMap, checkedMap);
|
_readHostsState(workingMap, checkedMap);
|
||||||
return null;
|
return null;
|
||||||
@ -164,9 +172,10 @@ class HostsBoosterDialogUI extends HookConsumerWidget {
|
|||||||
child: FilledButton(
|
child: FilledButton(
|
||||||
onPressed: () => doHost(context),
|
onPressed: () => doHost(context),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding:
|
padding: const EdgeInsets.only(
|
||||||
const EdgeInsets.only(top: 3, bottom: 3, left: 12, right: 12),
|
top: 3, bottom: 3, left: 12, right: 12),
|
||||||
child: Text(S.current.tools_hosts_action_one_click_acceleration),
|
child: Text(
|
||||||
|
S.current.tools_hosts_action_one_click_acceleration),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -8,6 +8,7 @@ import 'package:flutter/foundation.dart';
|
|||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:starcitizen_doctor/api/analytics.dart';
|
||||||
import 'package:starcitizen_doctor/app.dart';
|
import 'package:starcitizen_doctor/app.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
||||||
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
||||||
@ -81,10 +82,12 @@ class RsiLauncherEnhanceDialogUI extends HookConsumerWidget {
|
|||||||
await assarState.value?.data
|
await assarState.value?.data
|
||||||
.writeMainJs(content: utf8.encode(newScript))
|
.writeMainJs(content: utf8.encode(newScript))
|
||||||
.unwrap(context: context);
|
.unwrap(context: context);
|
||||||
|
AnalyticsApi.touch("rsi_launcher_mod_apply");
|
||||||
await readState();
|
await readState();
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
|
AnalyticsApi.touch("rsi_launcher_mod_launch");
|
||||||
readState();
|
readState();
|
||||||
return null;
|
return null;
|
||||||
}, const []);
|
}, const []);
|
||||||
|
@ -5,6 +5,7 @@ import 'package:fluent_ui/fluent_ui.dart';
|
|||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:re_editor/re_editor.dart';
|
import 'package:re_editor/re_editor.dart';
|
||||||
|
import 'package:starcitizen_doctor/api/analytics.dart';
|
||||||
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
||||||
import 'package:starcitizen_doctor/data/app_unp4k_p4k_item_data.dart';
|
import 'package:starcitizen_doctor/data/app_unp4k_p4k_item_data.dart';
|
||||||
import 'package:starcitizen_doctor/provider/unp4kc.dart';
|
import 'package:starcitizen_doctor/provider/unp4kc.dart';
|
||||||
@ -21,6 +22,12 @@ class UnP4kcUI extends HookConsumerWidget {
|
|||||||
final model = ref.read(unp4kCModelProvider.notifier);
|
final model = ref.read(unp4kCModelProvider.notifier);
|
||||||
final files = model.getFiles();
|
final files = model.getFiles();
|
||||||
final paths = state.curPath.trim().split("\\");
|
final paths = state.curPath.trim().split("\\");
|
||||||
|
|
||||||
|
useEffect(() {
|
||||||
|
AnalyticsApi.touch("unp4k_launch");
|
||||||
|
return null;
|
||||||
|
}, const []);
|
||||||
|
|
||||||
return makeDefaultPage(context,
|
return makeDefaultPage(context,
|
||||||
title: S.current.tools_unp4k_title(model.getGamePath()),
|
title: S.current.tools_unp4k_title(model.getGamePath()),
|
||||||
useBodyContainer: false,
|
useBodyContainer: false,
|
||||||
@ -308,7 +315,8 @@ class UnP4kErrorWidget extends StatelessWidget {
|
|||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
FilledButton(
|
FilledButton(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 3),
|
padding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 12, vertical: 3),
|
||||||
child: Text(
|
child: Text(
|
||||||
S.current.tools_unp4k_missing_runtime_action_install),
|
S.current.tools_unp4k_missing_runtime_action_install),
|
||||||
),
|
),
|
||||||
|
@ -7,6 +7,7 @@ import 'package:desktop_webview_window/desktop_webview_window.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
|
import 'package:starcitizen_doctor/api/analytics.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
||||||
import 'package:starcitizen_doctor/common/io/rs_http.dart';
|
import 'package:starcitizen_doctor/common/io/rs_http.dart';
|
||||||
import 'package:starcitizen_doctor/common/utils/base_utils.dart';
|
import 'package:starcitizen_doctor/common/utils/base_utils.dart';
|
||||||
@ -206,6 +207,7 @@ class WebViewModel {
|
|||||||
for (var kv in appVersionData.webMirrors!.entries) {
|
for (var kv in appVersionData.webMirrors!.entries) {
|
||||||
if (url.startsWith(kv.key)) {
|
if (url.startsWith(kv.key)) {
|
||||||
finalUrl = url.replaceFirst(kv.key, kv.value);
|
finalUrl = url.replaceFirst(kv.key, kv.value);
|
||||||
|
AnalyticsApi.touch("webLocalization_with_boost_mirror");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user