fix: The 'Copy Link' function will prioritize copying any available custom URL, mirroring the behavior found on the web version

This commit is contained in:
Damian Lesiuk 2025-09-09 21:42:32 +02:00
parent 27bc8eba7b
commit 7af9d6d7b7
7 changed files with 502 additions and 3 deletions

View file

@ -1,5 +1,6 @@
import 'package:immich_mobile/domain/models/store.model.dart';
import 'package:immich_mobile/entities/store.entity.dart';
import 'package:immich_mobile/models/shared_link/shared_link.model.dart';
import 'package:punycode/punycode.dart';
String sanitizeUrl(String url) {
@ -90,3 +91,12 @@ String? punycodeDecodeUrl(String? serverUrl) {
return Uri.decodeFull(serverUri.replace(host: decodedHost).toString());
}
/// Generates the appropriate share URL path for a given shared link.
///
/// Returns a path string based on the shared link's slug and key:
/// - If slug is present: 's/${sharedLink.slug}'
/// - Otherwise: 'share/${sharedLink.key}'
String getShareUrlPath(SharedLink sharedLink) {
return sharedLink.slug != null ? 's/${sharedLink.slug}' : 'share/${sharedLink.key}';
}