2022-05-17 16:31:34 +03:00
|
|
|
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
2022-11-07 20:57:46 +02:00
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
2021-03-26 15:38:39 +02:00
|
|
|
|
2021-12-06 20:31:19 +02:00
|
|
|
/// it's ui helpers use only for ui components, don't use for logic components.
|
2021-03-26 15:38:39 +02:00
|
|
|
|
|
|
|
class UiHelpers {
|
2022-06-05 22:36:32 +03:00
|
|
|
static String getDomainName(final ServerInstallationState config) =>
|
2022-07-22 19:22:10 +03:00
|
|
|
config.isDomainSelected ? config.serverDomain!.domainName : 'example.com';
|
2022-11-07 20:57:46 +02:00
|
|
|
|
|
|
|
static Future<bool> launchExternalApplicationURL(final url) async {
|
|
|
|
bool launched = false;
|
|
|
|
|
|
|
|
try {
|
|
|
|
final Uri uri = Uri.parse(url);
|
|
|
|
if (await canLaunchUrl(uri)) {
|
|
|
|
launched = await launchUrl(
|
|
|
|
uri,
|
|
|
|
mode: LaunchMode.externalApplication,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
print(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
return launched;
|
|
|
|
}
|
2021-03-26 15:38:39 +02:00
|
|
|
}
|