feat: переход по komet:// внутри приложения
This commit is contained in:
@@ -59,6 +59,8 @@ class DeepLinkService {
|
||||
_flushPending();
|
||||
}
|
||||
|
||||
void handle(Uri uri) => _onUri(uri);
|
||||
|
||||
void _onUri(Uri uri) {
|
||||
if (_isLogExportLink(uri)) {
|
||||
_pendingLogExport = true;
|
||||
|
||||
@@ -3,6 +3,8 @@ import 'dart:io' show Platform;
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../links/deep_link_service.dart';
|
||||
|
||||
import '../../frontend/widgets/custom_notification.dart';
|
||||
import '../../frontend/widgets/max_link_handler.dart';
|
||||
|
||||
@@ -21,7 +23,15 @@ bool leavesWebView(String? scheme) {
|
||||
return !_webViewSchemes.contains(scheme.toLowerCase());
|
||||
}
|
||||
|
||||
const Set<String> _appSchemes = {'komet', 'max'};
|
||||
|
||||
Future<void> openExternalUrl(BuildContext context, String url) async {
|
||||
final appUri = Uri.tryParse(url.trim());
|
||||
if (appUri != null && _appSchemes.contains(appUri.scheme.toLowerCase())) {
|
||||
DeepLinkService.instance.handle(appUri);
|
||||
return;
|
||||
}
|
||||
|
||||
if (await tryHandleMaxLink(context, url)) return;
|
||||
if (!context.mounted) return;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import '../../core/utils/link_opener.dart';
|
||||
|
||||
final RegExp linkPattern = RegExp(
|
||||
r'(https?://[^\s<>]+'
|
||||
r'((?:https?|komet|max)://[^\s<>]+'
|
||||
r'|www\.[^\s<>]+'
|
||||
r'|(?<![\w.@/-])max\.ru(?![\w.-])(?:/[^\s<>]*)?)',
|
||||
caseSensitive: false,
|
||||
|
||||
Reference in New Issue
Block a user