mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-09-20 18:37:50 +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 = '🇮🇳';
|
emoji = '🇮🇳';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'syd':
|
||||||
|
emoji = '🇦🇺';
|
||||||
|
break;
|
||||||
|
|
||||||
case 'nyc':
|
case 'nyc':
|
||||||
case 'sfo':
|
case 'sfo':
|
||||||
emoji = '🇺🇸';
|
emoji = '🇺🇸';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return emoji;
|
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()
|
@JsonSerializable()
|
||||||
|
|
|
@ -155,6 +155,24 @@ class HetznerLocation {
|
||||||
}
|
}
|
||||||
return emoji;
|
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.
|
/// A Volume is a highly-available, scalable, and SSD-based block storage for Servers.
|
||||||
|
|
|
@ -2,12 +2,14 @@ class ServerProviderLocation {
|
||||||
ServerProviderLocation({
|
ServerProviderLocation({
|
||||||
required this.title,
|
required this.title,
|
||||||
required this.identifier,
|
required this.identifier,
|
||||||
|
required this.country,
|
||||||
this.description,
|
this.description,
|
||||||
this.flag = '',
|
this.flag = '',
|
||||||
});
|
});
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
final String identifier;
|
final String identifier;
|
||||||
|
final String country;
|
||||||
final String? description;
|
final String? description;
|
||||||
final String flag;
|
final String flag;
|
||||||
}
|
}
|
||||||
|
|
|
@ -438,6 +438,7 @@ class DigitalOceanServerProvider extends ServerProvider {
|
||||||
description: rawLocation.name,
|
description: rawLocation.name,
|
||||||
flag: rawLocation.flag,
|
flag: rawLocation.flag,
|
||||||
identifier: rawLocation.slug,
|
identifier: rawLocation.slug,
|
||||||
|
country: rawLocation.countryDisplayName,
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -156,6 +156,7 @@ class HetznerServerProvider extends ServerProvider {
|
||||||
description: server.location.description,
|
description: server.location.description,
|
||||||
flag: server.location.flag,
|
flag: server.location.flag,
|
||||||
identifier: server.location.name,
|
identifier: server.location.name,
|
||||||
|
country: server.location.countryDisplayName,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -456,6 +457,7 @@ class HetznerServerProvider extends ServerProvider {
|
||||||
description: rawLocation.description,
|
description: rawLocation.description,
|
||||||
flag: rawLocation.flag,
|
flag: rawLocation.flag,
|
||||||
identifier: rawLocation.name,
|
identifier: rawLocation.name,
|
||||||
|
country: rawLocation.countryDisplayName,
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -120,6 +120,14 @@ class SelectLocationPage extends StatelessWidget {
|
||||||
.titleMedium,
|
.titleMedium,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
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)
|
if (location.description != null)
|
||||||
Text(
|
Text(
|
||||||
location.description!,
|
location.description!,
|
||||||
|
|
Loading…
Reference in a new issue