2024-12-23 22:21:48 +00:00
|
|
|
import 'package:result_monad/result_monad.dart';
|
|
|
|
|
|
|
|
import '../globals.dart';
|
2023-11-30 00:32:03 +00:00
|
|
|
import '../models/auth/profile.dart';
|
2024-12-23 22:21:48 +00:00
|
|
|
import '../routes.dart';
|
|
|
|
|
|
|
|
Uri generateTagUriFromProfile(Profile profile, String tag) {
|
|
|
|
return Uri.parse('relatica://route${ScreenPaths.tagView}/$tag');
|
|
|
|
}
|
|
|
|
|
|
|
|
Result<String, bool> processUrlStringForTag(String url) {
|
|
|
|
final uri = Uri.parse(url);
|
|
|
|
if (uri.scheme == deepLinkScheme &&
|
|
|
|
uri.host == 'route' &&
|
|
|
|
uri.pathSegments.length == 2) {
|
|
|
|
final route = '/${uri.pathSegments[0]}';
|
|
|
|
final tag = uri.pathSegments[1];
|
|
|
|
if (route == ScreenPaths.tagView) {
|
|
|
|
return Result.ok(tag);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return Result.error(false);
|
|
|
|
}
|
2023-11-30 00:32:03 +00:00
|
|
|
|
2024-12-23 22:21:48 +00:00
|
|
|
String generateTagSearchFromProfile(Profile profile, String tagName) {
|
|
|
|
return Uri.https(
|
|
|
|
profile.serverName,
|
|
|
|
'/search',
|
|
|
|
{'tag': tagName},
|
|
|
|
).toString();
|
2023-11-30 00:32:03 +00:00
|
|
|
}
|