selfprivacy.org.app/lib/logic/common_enum/common_enum.dart

147 lines
3.4 KiB
Dart
Raw Normal View History

2021-08-18 13:44:46 +03:00
import 'package:easy_localization/easy_localization.dart';
2022-05-30 16:49:42 +03:00
import 'package:flutter/material.dart';
2021-08-18 13:44:46 +03:00
import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart';
enum LoadingStatus {
uninitialized,
refreshing,
success,
error,
}
2021-01-08 14:37:28 +02:00
enum InitializingSteps {
2022-02-16 09:28:29 +02:00
setHetznerKey,
2021-01-08 14:37:28 +02:00
setCloudFlareKey,
setDomainName,
setRootUser,
createServer,
checkCloudFlareDns,
startServer,
checkSystemDnsAndDkimSet,
}
2022-05-16 23:30:14 +03:00
enum Period {
hour,
day,
month;
int get stepPeriodInSeconds {
switch (this) {
case Period.hour:
return 18;
case Period.day:
return 432;
case Period.month:
return 6480;
}
}
}
2021-04-10 06:04:23 +03:00
2021-08-18 13:44:46 +03:00
enum ServiceTypes {
mailserver,
bitwarden,
jitsi,
nextcloud,
pleroma,
gitea,
ocserv,
2021-08-18 13:44:46 +03:00
}
extension ServiceTypesExt on ServiceTypes {
String get title {
switch (this) {
case ServiceTypes.mailserver:
return 'mail.title'.tr();
case ServiceTypes.bitwarden:
return 'password_manager.title'.tr();
case ServiceTypes.jitsi:
return 'video.title'.tr();
case ServiceTypes.nextcloud:
return 'cloud.title'.tr();
case ServiceTypes.pleroma:
return 'social_network.title'.tr();
case ServiceTypes.gitea:
return 'git.title'.tr();
case ServiceTypes.ocserv:
return 'vpn.title'.tr();
2021-08-18 13:44:46 +03:00
}
}
String get subtitle {
switch (this) {
case ServiceTypes.mailserver:
return 'mail.subtitle'.tr();
case ServiceTypes.bitwarden:
return 'password_manager.subtitle'.tr();
case ServiceTypes.jitsi:
return 'video.subtitle'.tr();
case ServiceTypes.nextcloud:
return 'cloud.subtitle'.tr();
case ServiceTypes.pleroma:
return 'social_network.subtitle'.tr();
case ServiceTypes.gitea:
return 'git.subtitle'.tr();
case ServiceTypes.ocserv:
return 'vpn.subtitle'.tr();
2021-08-18 13:44:46 +03:00
}
}
2021-12-23 15:52:12 +02:00
String get loginInfo {
switch (this) {
case ServiceTypes.mailserver:
return 'mail.login_info'.tr();
case ServiceTypes.bitwarden:
return 'password_manager.login_info'.tr();
case ServiceTypes.jitsi:
return 'video.login_info'.tr();
case ServiceTypes.nextcloud:
return 'cloud.login_info'.tr();
case ServiceTypes.pleroma:
return 'social_network.login_info'.tr();
case ServiceTypes.gitea:
return 'git.login_info'.tr();
case ServiceTypes.ocserv:
2021-12-23 15:52:12 +02:00
return '';
}
}
String get subdomain {
switch (this) {
case ServiceTypes.bitwarden:
2021-12-23 15:52:12 +02:00
return 'password';
case ServiceTypes.jitsi:
2021-12-23 15:52:12 +02:00
return 'meet';
case ServiceTypes.nextcloud:
2021-12-23 15:52:12 +02:00
return 'cloud';
case ServiceTypes.pleroma:
2021-12-23 15:52:12 +02:00
return 'social';
case ServiceTypes.gitea:
2021-12-23 15:52:12 +02:00
return 'git';
case ServiceTypes.ocserv:
2021-12-23 15:52:12 +02:00
default:
return '';
}
}
2021-08-18 13:44:46 +03:00
IconData get icon {
switch (this) {
case ServiceTypes.mailserver:
2021-08-18 13:44:46 +03:00
return BrandIcons.envelope;
case ServiceTypes.bitwarden:
2021-08-18 13:44:46 +03:00
return BrandIcons.key;
case ServiceTypes.jitsi:
2021-08-18 13:44:46 +03:00
return BrandIcons.webcam;
case ServiceTypes.nextcloud:
2021-08-18 13:44:46 +03:00
return BrandIcons.upload;
case ServiceTypes.pleroma:
2021-08-18 13:44:46 +03:00
return BrandIcons.social;
case ServiceTypes.gitea:
2021-08-18 13:44:46 +03:00
return BrandIcons.git;
case ServiceTypes.ocserv:
2022-05-30 16:49:42 +03:00
return Icons.vpn_lock_outlined;
2021-08-18 13:44:46 +03:00
}
}
2021-08-29 16:54:28 +03:00
2022-05-24 21:55:39 +03:00
String get txt => toString().split('.')[1];
2021-08-18 13:44:46 +03:00
}