mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-09-21 02:47:51 +00:00
feat: Add country names to installation process
- Resolve: https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/494
This commit is contained in:
parent
c179a109fd
commit
6dc4109e0d
|
@ -65,14 +65,56 @@ class DigitalOceanLocation {
|
|||
emoji = '🇮🇳';
|
||||
break;
|
||||
|
||||
case 'syd':
|
||||
emoji = '🇦🇺';
|
||||
break;
|
||||
|
||||
case 'nyc':
|
||||
case 'sfo':
|
||||
emoji = '🇺🇸';
|
||||
break;
|
||||
}
|
||||
|
||||
return emoji;
|
||||
}
|
||||
|
||||
String get countryDisplayName {
|
||||
String displayName = slug;
|
||||
switch (slug.substring(0, 3)) {
|
||||
case 'fra':
|
||||
displayName = 'Germany';
|
||||
break;
|
||||
|
||||
case 'ams':
|
||||
displayName = 'Netherlands';
|
||||
break;
|
||||
|
||||
case 'sgp':
|
||||
displayName = 'Singapore';
|
||||
break;
|
||||
|
||||
case 'lon':
|
||||
displayName = 'United Kingdom';
|
||||
break;
|
||||
|
||||
case 'tor':
|
||||
displayName = 'Canada';
|
||||
break;
|
||||
|
||||
case 'blr':
|
||||
displayName = 'India';
|
||||
break;
|
||||
|
||||
case 'syd':
|
||||
displayName = 'Australia';
|
||||
break;
|
||||
|
||||
case 'nyc':
|
||||
case 'sfo':
|
||||
displayName = 'United States';
|
||||
break;
|
||||
}
|
||||
return displayName;
|
||||
}
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
|
|
|
@ -155,6 +155,24 @@ class HetznerLocation {
|
|||
}
|
||||
return emoji;
|
||||
}
|
||||
|
||||
String get countryDisplayName {
|
||||
String displayName = country;
|
||||
switch (country.substring(0, 2)) {
|
||||
case 'DE':
|
||||
displayName = 'Germany';
|
||||
break;
|
||||
|
||||
case 'FI':
|
||||
displayName = 'Finland';
|
||||
break;
|
||||
|
||||
case 'US':
|
||||
displayName = 'United States';
|
||||
break;
|
||||
}
|
||||
return displayName;
|
||||
}
|
||||
}
|
||||
|
||||
/// A Volume is a highly-available, scalable, and SSD-based block storage for Servers.
|
||||
|
|
|
@ -2,12 +2,14 @@ class ServerProviderLocation {
|
|||
ServerProviderLocation({
|
||||
required this.title,
|
||||
required this.identifier,
|
||||
required this.country,
|
||||
this.description,
|
||||
this.flag = '',
|
||||
});
|
||||
|
||||
final String title;
|
||||
final String identifier;
|
||||
final String country;
|
||||
final String? description;
|
||||
final String flag;
|
||||
}
|
||||
|
|
|
@ -438,6 +438,7 @@ class DigitalOceanServerProvider extends ServerProvider {
|
|||
description: rawLocation.name,
|
||||
flag: rawLocation.flag,
|
||||
identifier: rawLocation.slug,
|
||||
country: rawLocation.countryDisplayName,
|
||||
);
|
||||
} catch (e) {
|
||||
continue;
|
||||
|
|
|
@ -156,6 +156,7 @@ class HetznerServerProvider extends ServerProvider {
|
|||
description: server.location.description,
|
||||
flag: server.location.flag,
|
||||
identifier: server.location.name,
|
||||
country: server.location.countryDisplayName,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -456,6 +457,7 @@ class HetznerServerProvider extends ServerProvider {
|
|||
description: rawLocation.description,
|
||||
flag: rawLocation.flag,
|
||||
identifier: rawLocation.name,
|
||||
country: rawLocation.countryDisplayName,
|
||||
);
|
||||
} catch (e) {
|
||||
continue;
|
||||
|
|
|
@ -120,6 +120,14 @@ class SelectLocationPage extends StatelessWidget {
|
|||
.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
location.country,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyMedium,
|
||||
),
|
||||
if (location.description != null)
|
||||
const SizedBox(height: 4),
|
||||
if (location.description != null)
|
||||
Text(
|
||||
location.description!,
|
||||
|
|
Loading…
Reference in a new issue