25 lines
934 B
Dart
25 lines
934 B
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:please_pay_me/core/config/app_config.dart';
|
|
import 'package:please_pay_me/core/config/env_file.dart';
|
|
import 'package:please_pay_me/ui/ui.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
abstract final class LegalLinks {
|
|
static const offer = '/legal/offer';
|
|
static const privacy = '/legal/privacy';
|
|
static const consent = '/legal/consent';
|
|
static const cookies = '/legal/cookies';
|
|
|
|
static Uri resolve(String cabinetUrl, String path) {
|
|
final base = cabinetUrl.isEmpty ? AppConfig.productionOrigin : cabinetUrl;
|
|
return Uri.parse('${normalizeUrl(base)}$path');
|
|
}
|
|
}
|
|
|
|
Future<void> openLegalDocument(BuildContext context, Uri uri) async {
|
|
final opened = await launchUrl(uri, mode: LaunchMode.externalApplication);
|
|
if (!opened && context.mounted) {
|
|
await showAppToast(context, message: 'Не удалось открыть документ');
|
|
}
|
|
}
|