Add debug export to clipboard
This commit is contained in:
@@ -88,9 +88,7 @@ Future<void> _lazyBootstrap(
|
||||
await filesEditor.init();
|
||||
|
||||
initLoggers(container.read, debug);
|
||||
_logger.info(
|
||||
"os: [${Platform.operatingSystem}](${Platform.operatingSystemVersion}), processor count [${Platform.numberOfProcessors}]",
|
||||
);
|
||||
_logger.info(container.read(appInfoProvider).format());
|
||||
|
||||
final silentStart = container.read(silentStartNotifierProvider);
|
||||
if (silentStart) {
|
||||
|
||||
@@ -25,6 +25,7 @@ class AppRepositoryImpl
|
||||
release: Release.read(),
|
||||
installerMedia: packageInfo.installerStore,
|
||||
operatingSystem: Platform.operatingSystem,
|
||||
operatingSystemVersion: Platform.operatingSystemVersion,
|
||||
environment: environment,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ class AppInfo with _$AppInfo {
|
||||
required Release release,
|
||||
String? installerMedia,
|
||||
required String operatingSystem,
|
||||
required String operatingSystemVersion,
|
||||
required Environment environment,
|
||||
}) = _AppInfo;
|
||||
|
||||
@@ -25,6 +26,12 @@ class AppInfo with _$AppInfo {
|
||||
? version
|
||||
: "$version ${environment.name}";
|
||||
|
||||
/// formats app info for sharing
|
||||
String format() => '''
|
||||
$name v$version ($buildNumber) ${environment.name}
|
||||
${release.name} release ${installerMedia != null ? "via $installerMedia" : ""}
|
||||
$operatingSystem [$operatingSystemVersion]''';
|
||||
|
||||
factory AppInfo.fromJson(Map<String, dynamic> json) =>
|
||||
_$AppInfoFromJson(json);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:hiddify/core/prefs/prefs.dart';
|
||||
import 'package:hiddify/utils/platform_utils.dart';
|
||||
@@ -7,6 +9,8 @@ part 'config_options.g.dart';
|
||||
|
||||
@freezed
|
||||
class ConfigOptions with _$ConfigOptions {
|
||||
const ConfigOptions._();
|
||||
|
||||
@JsonSerializable(fieldRename: FieldRename.kebab)
|
||||
const factory ConfigOptions({
|
||||
@Default(false) bool executeConfigAsIs,
|
||||
@@ -36,6 +40,11 @@ class ConfigOptions with _$ConfigOptions {
|
||||
setSystemProxy: PlatformUtils.isDesktop,
|
||||
);
|
||||
|
||||
String format() {
|
||||
const encoder = JsonEncoder.withIndent(' ');
|
||||
return encoder.convert(toJson());
|
||||
}
|
||||
|
||||
factory ConfigOptions.fromJson(Map<String, dynamic> json) =>
|
||||
_$ConfigOptionsFromJson(json);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:hiddify/core/core_providers.dart';
|
||||
import 'package:hiddify/domain/constants.dart';
|
||||
@@ -45,6 +46,22 @@ class AboutPage extends HookConsumerWidget {
|
||||
slivers: [
|
||||
SliverAppBar(
|
||||
title: Text(t.about.pageTitle),
|
||||
actions: [
|
||||
PopupMenuButton(
|
||||
itemBuilder: (context) {
|
||||
return [
|
||||
PopupMenuItem(
|
||||
child: Text(t.general.addToClipboard),
|
||||
onTap: () {
|
||||
Clipboard.setData(
|
||||
ClipboardData(text: appInfo.format()),
|
||||
);
|
||||
},
|
||||
),
|
||||
];
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:hiddify/core/core_providers.dart';
|
||||
import 'package:hiddify/core/prefs/prefs.dart';
|
||||
@@ -23,6 +24,22 @@ class ConfigOptionsPage extends HookConsumerWidget {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(t.settings.config.pageTitle),
|
||||
actions: [
|
||||
PopupMenuButton(
|
||||
itemBuilder: (context) {
|
||||
return [
|
||||
PopupMenuItem(
|
||||
child: Text(t.general.addToClipboard),
|
||||
onTap: () {
|
||||
Clipboard.setData(
|
||||
ClipboardData(text: options.format()),
|
||||
);
|
||||
},
|
||||
),
|
||||
];
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
|
||||
Reference in New Issue
Block a user