Refactor
This commit is contained in:
17
lib/features/per_app_proxy/model/installed_package_info.dart
Normal file
17
lib/features/per_app_proxy/model/installed_package_info.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'installed_package_info.freezed.dart';
|
||||
part 'installed_package_info.g.dart';
|
||||
|
||||
@freezed
|
||||
class InstalledPackageInfo with _$InstalledPackageInfo {
|
||||
@JsonSerializable(fieldRename: FieldRename.kebab)
|
||||
const factory InstalledPackageInfo({
|
||||
required String packageName,
|
||||
required String name,
|
||||
required bool isSystemApp,
|
||||
}) = _InstalledPackageInfo;
|
||||
|
||||
factory InstalledPackageInfo.fromJson(Map<String, dynamic> json) =>
|
||||
_$InstalledPackageInfoFromJson(json);
|
||||
}
|
||||
24
lib/features/per_app_proxy/model/per_app_proxy_mode.dart
Normal file
24
lib/features/per_app_proxy/model/per_app_proxy_mode.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
import 'package:hiddify/core/localization/translations.dart';
|
||||
|
||||
enum PerAppProxyMode {
|
||||
off,
|
||||
include,
|
||||
exclude;
|
||||
|
||||
bool get enabled => this != off;
|
||||
|
||||
({String title, String message}) present(TranslationsEn t) => switch (this) {
|
||||
off => (
|
||||
title: t.settings.network.perAppProxyModes.off,
|
||||
message: t.settings.network.perAppProxyModes.offMsg,
|
||||
),
|
||||
include => (
|
||||
title: t.settings.network.perAppProxyModes.include,
|
||||
message: t.settings.network.perAppProxyModes.includeMsg,
|
||||
),
|
||||
exclude => (
|
||||
title: t.settings.network.perAppProxyModes.exclude,
|
||||
message: t.settings.network.perAppProxyModes.excludeMsg,
|
||||
),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user